-
- Downloads
MIPS: Support vector reduc for MSA
We have SHF.fmt and HADD_S/U.fmt with MSA, which can be used for vector reduc. For min/max for U8/S8, we can SHF.B W1, W0, 0xb1 # swap byte inner every half MIN.B W1, W1, W0 SHF.H W2, W1, 0xb1 # swap half inner every word MIN.B W2, W2, W1 SHF.W W3, W2, 0xb1 # swap word inner every doubleword MIN.B W4, W3, W2 SHF.W W4, W4, 0x4e # swap the two doubleword MIN.B W4, W4, W3 For plus of S8/U8, we can use HADD HADD.H W0, W0, W0 HADD.W W0, W0, W0 HADD.D W0, W0, W0 SHF.W W1, W0, 0x4e # swap the two doubleword ADDV.D W1, W1, W0 COPY_S.B T0, W1 # COPY_U.B for U8 We can do similar for S16/U16/S32/U32/S64/U64/FLOAT/DOUBLE. gcc * config/mips/mips-msa.md: (MSA_NO_HADD): we have HADD for S8/U8/S16/U16/S32/U32 only. (reduc_smin_scal_<mode>): New define pattern. (reduc_smax_scal_<mode>): Ditto. (reduc_umin_scal_<mode>): Ditto. (reduc_umax_scal_<mode>): Ditto. (reduc_plus_scal_<mode>): Ditto. (reduc_plus_scal_v4si): Ditto. (reduc_plus_scal_v8hi): Ditto. (reduc_plus_scal_v16qi): Ditto. (reduc_<optab>_scal_<mode>): Ditto. * config/mips/mips-protos.h: New function mips_expand_msa_reduc. * config/mips/mips.cc: New function mips_expand_msa_reduc. * config/mips/mips.md: Define any_bitwise iterator. gcc/testsuite: * gcc.target/mips/msa-reduc.c: New tests.
Showing
- gcc/config/mips/mips-msa.md 128 additions, 0 deletionsgcc/config/mips/mips-msa.md
- gcc/config/mips/mips-protos.h 1 addition, 0 deletionsgcc/config/mips/mips-protos.h
- gcc/config/mips/mips.cc 41 additions, 0 deletionsgcc/config/mips/mips.cc
- gcc/config/mips/mips.md 4 additions, 0 deletionsgcc/config/mips/mips.md
- gcc/testsuite/gcc.target/mips/msa-reduc.c 119 additions, 0 deletionsgcc/testsuite/gcc.target/mips/msa-reduc.c
Loading
Please register or sign in to comment