LoongArch: Try harder using vrepli instructions to materialize const vectors
For a = (v4si){0xdddddddd, 0xdddddddd, 0xdddddddd, 0xdddddddd} we just want vrepli.b $vr0, 0xdd but the compiler actually produces a load: la.local $r14,.LC0 vld $vr0,$r14,0 It's because we only tried vrepli.d which wouldn't work. Try all vrepli instructions for const int vector materializing to fix it. gcc/ChangeLog: * config/loongarch/loongarch-protos.h (loongarch_const_vector_vrepli): New function prototype. * config/loongarch/loongarch.cc (loongarch_const_vector_vrepli): Implement. (loongarch_const_insns): Call loongarch_const_vector_vrepli instead of loongarch_const_vector_same_int_p. (loongarch_split_vector_move_p): Likewise. (loongarch_output_move): Use loongarch_const_vector_vrepli to pun operend[1] into a better mode if it's a const int vector, and decide the suffix of [x]vrepli with the new mode. * config/loongarch/constraints.md (YI): Call loongarch_const_vector_vrepli instead of loongarch_const_vector_same_int_p. gcc/testsuite/ChangeLog: * gcc.target/loongarch/vrepli.c: New test.
Showing
- gcc/config/loongarch/constraints.md 1 addition, 1 deletiongcc/config/loongarch/constraints.md
- gcc/config/loongarch/loongarch-protos.h 1 addition, 0 deletionsgcc/config/loongarch/loongarch-protos.h
- gcc/config/loongarch/loongarch.cc 29 additions, 5 deletionsgcc/config/loongarch/loongarch.cc
- gcc/testsuite/gcc.target/loongarch/vrepli.c 15 additions, 0 deletionsgcc/testsuite/gcc.target/loongarch/vrepli.c
Loading
Please register or sign in to comment