From ddce00dba244d889d688490517fb106169a72f01 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 19 Jan 2022 02:24:06 +0100 Subject: [PATCH] i386: Fix GLC tuning with -masm=intel [PR104104] > > On Sat, Jan 15, 2022 at 5:39 PM Hongyu Wang wrote: > > > Thanks for the suggestion, here is the updated patch that survived > > > bootstrap/regtest. Unfortunately the patch results in assembler failures with -masm=intel. > > > > + if (TARGET_DEST_FALSE_DEPENDENCY > > > > + && get_attr_dest_false_dep (insn) == > > > > + DEST_FALSE_DEP_TRUE) > > > > + output_asm_insn ("vxorps\t{%x0, %x0, %x0}", operands); All the vxorps insns were emitted like the above, which means for -masm=sysv it looks like vxorps %xmm3, %xmm3, %xmm3 but for -masm=intel like: vxorps We want obviously vxorps xmm3, xmm3, xmm3 so the following patch just drops the errorneous {}s. 2022-01-19 Jakub Jelinek PR target/104104 * config/i386/sse.md (__, avx512fp16_sh_v8hf, avx512dq_mul3, _permvar, avx2_perm_1, avx512f_perm_1, avx512dq_rangep, avx512dq_ranges, _getmant, avx512f_vgetmant): Use vxorps\t%x0, %x0, %x0 instead of vxorps\t{%x0, %x0, %x0}. * gcc.target/i386/pr104104.c: New test. --- gcc/config/i386/sse.md | 20 ++++++++++---------- gcc/testsuite/gcc.target/i386/pr104104.c | 10 ++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr104104.c diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 34175fd..829107e 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -6539,7 +6539,7 @@ { if (TARGET_DEST_FALSE_DEP_FOR_GLC && ) - output_asm_insn ("vxorps\t{%x0, %x0, %x0}", operands); + output_asm_insn ("vxorps\t%x0, %x0, %x0", operands); return "v\t{%2, %1, %0|%0, %1, %2}"; } [(set_attr "type" "ssemul") @@ -6750,7 +6750,7 @@ { if (TARGET_DEST_FALSE_DEP_FOR_GLC && ) - output_asm_insn ("vxorps\t{%x0, %x0, %x0}", operands); + output_asm_insn ("vxorps\t%x0, %x0, %x0", operands); return "vsh\t{%2, %1, %0|%0, %1, %2}"; } [(set_attr "type" "ssemul") @@ -15222,7 +15222,7 @@ && && !reg_mentioned_p (operands[0], operands[1]) && !reg_mentioned_p (operands[0], operands[2])) - output_asm_insn ("vxorps\t{%x0, %x0, %x0}", operands); + output_asm_insn ("vxorps\t%x0, %x0, %x0", operands); return "vpmullq\t{%2, %1, %0|%0, %1, %2}"; } [(set_attr "type" "sseimul") @@ -24658,7 +24658,7 @@ && && !reg_mentioned_p (operands[0], operands[1]) && !reg_mentioned_p (operands[0], operands[2])) - output_asm_insn ("vxorps\t{%x0, %x0, %x0}", operands); + output_asm_insn ("vxorps\t%x0, %x0, %x0", operands); return "vperm\t{%1, %2, %0|%0, %2, %1}"; } [(set_attr "type" "sselog") @@ -24900,7 +24900,7 @@ if (TARGET_DEST_FALSE_DEP_FOR_GLC && && !reg_mentioned_p (operands[0], operands[1])) - output_asm_insn ("vxorps\t{%x0, %x0, %x0}", operands); + output_asm_insn ("vxorps\t%x0, %x0, %x0", operands); return "vperm\t{%2, %1, %0|%0, %1, %2}"; } [(set_attr "type" "sselog") @@ -24975,7 +24975,7 @@ if (TARGET_DEST_FALSE_DEP_FOR_GLC && && !reg_mentioned_p (operands[0], operands[1])) - output_asm_insn ("vxorps\t{%x0, %x0, %x0}", operands); + output_asm_insn ("vxorps\t%x0, %x0, %x0", operands); return "vperm\t{%2, %1, %0|%0, %1, %2}"; } [(set_attr "type" "sselog") @@ -26880,7 +26880,7 @@ && && !reg_mentioned_p (operands[0], operands[1]) && !reg_mentioned_p (operands[0], operands[2])) - output_asm_insn ("vxorps\t{%x0, %x0, %x0}", operands); + output_asm_insn ("vxorps\t%x0, %x0, %x0", operands); return "vrange\t{%3, %2, %1, %0|%0, %1, %2, %3}"; } [(set_attr "type" "sse") @@ -26903,7 +26903,7 @@ && && !reg_mentioned_p (operands[0], operands[1]) && !reg_mentioned_p (operands[0], operands[2])) - output_asm_insn ("vxorps\t{%x0, %x0, %x0}", operands); + output_asm_insn ("vxorps\t%x0, %x0, %x0", operands); return "vrange\t{%3, %2, %1, %0|%0, %1, %2, %3}"; } [(set_attr "type" "sse") @@ -26949,7 +26949,7 @@ if (TARGET_DEST_FALSE_DEP_FOR_GLC && && MEM_P (operands[1])) - output_asm_insn ("vxorps\t{%x0, %x0, %x0}", operands); + output_asm_insn ("vxorps\t%x0, %x0, %x0", operands); return "vgetmant\t{%2, %1, %0|%0, %1, %2}"; } [(set_attr "prefix" "evex") @@ -26971,7 +26971,7 @@ && && !reg_mentioned_p (operands[0], operands[1]) && !reg_mentioned_p (operands[0], operands[2])) - output_asm_insn ("vxorps\t{%x0, %x0, %x0}", operands); + output_asm_insn ("vxorps\t%x0, %x0, %x0", operands); return "vgetmant\t{%3, %2, %1, %0|%0, %1, %2, %3}"; } [(set_attr "prefix" "evex") diff --git a/gcc/testsuite/gcc.target/i386/pr104104.c b/gcc/testsuite/gcc.target/i386/pr104104.c new file mode 100644 index 0000000..1653cae --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr104104.c @@ -0,0 +1,10 @@ +/* PR target/104104 */ +/* { dg-do assemble { target vect_simd_clones } } */ +/* { dg-require-effective-target masm_intel } */ +/* { dg-options "-march=alderlake -masm=intel -O1 -fallow-store-data-races -funroll-all-loops" } */ + +__attribute__ ((simd)) short int +foo (void) +{ + return 0; +} -- 2.7.4