Link to the Compiler Explorer: https://godbolt.org/z/9GTPqWfn8 It looks like GCC produced vmovw instruction with an incorrect argument (https://software.intel.com/content/www/us/en/develop/download/intel-avx512-fp16-architecture-specification.html) Reproducer: extern long c[]; extern int d[]; long a; long e(long f) { return f < a ? f : a; } void g() { for (signed b = 0; b < 4028643; b++) d[b] = e((char)(~c[b])); } Error: >$ g++ -O3 -march=sapphirerapids -c func.cpp /tmp/ccB2zLYr.s: Assembler messages: /tmp/ccB2zLYr.s:92: Error: operand type mismatch for `vmovw' gcc version 12.0.1 20220401 (git://gcc.gnu.org/git/gcc.git:master 15d683d4f0b390b27c54a7c92c6e4f33195bdc93) P.S. I'm not sure if "tree-optimization" is the correct classification for this fault
it works for me, it produces vmovw %xmm0, %xmm1 what assembler version are you using? I have 2.37
It's rejected with 2.38: $ as -v --64 -o a-pr105139.o a-pr105139.s GNU assembler version 2.38 (x86_64-suse-linux) using BFD version (GNU Binutils; openSUSE Tumbleweed) 2.38.20220304-3 a-pr105139.s: Assembler messages: a-pr105139.s:92: Error: operand type mismatch for `vmovw' Let me bisect GAS.
@Richi: Are you sure about that your GAS supports that? $ cat vmovw.s vmovw %xmm0, %xmm1 $ as -v --64 vmovw.s GNU assembler version 2.38 (x86_64-suse-linux) using BFD version (GNU Binutils; openSUSE Tumbleweed) 2.38.20220304-3 vmovw.s: Assembler messages: vmovw.s:1: Error: operand type mismatch for `vmovw' $ ./gas/as-new /home/marxin/Programming/testcases/vmovw.s -v GNU assembler version 2.37 (x86_64-pc-linux-gnu) using BFD version (GNU Binutils) 2.37 /home/marxin/Programming/testcases/vmovw.s: Assembler messages: /home/marxin/Programming/testcases/vmovw.s:1: Error: no such instruction: `vmovw %xmm0,%xmm1'
Started with r12-6215-g708b87dcb6e48cb4.
(In reply to Martin Liška from comment #3) > @Richi: Are you sure about that your GAS supports that? > > $ cat vmovw.s > vmovw %xmm0, %xmm1 > $ as -v --64 vmovw.s > GNU assembler version 2.38 (x86_64-suse-linux) using BFD version (GNU > Binutils; openSUSE Tumbleweed) 2.38.20220304-3 > vmovw.s: Assembler messages: > vmovw.s:1: Error: operand type mismatch for `vmovw' > > $ ./gas/as-new /home/marxin/Programming/testcases/vmovw.s -v > GNU assembler version 2.37 (x86_64-pc-linux-gnu) using BFD version (GNU > Binutils) 2.37 > /home/marxin/Programming/testcases/vmovw.s: Assembler messages: > /home/marxin/Programming/testcases/vmovw.s:1: Error: no such instruction: > `vmovw %xmm0,%xmm1' oops, I forgot to actually assemble the output
*movv2qi_internal was not fixed in the same way as *movhi_internal, so: diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md index 29d470bdef2..197f19e4b1a 100644 --- a/gcc/config/i386/mmx.md +++ b/gcc/config/i386/mmx.md @@ -462,7 +462,7 @@ (const_string "TI")) (eq_attr "alternative" "5") (cond [(match_test "TARGET_AVX512FP16") - (const_string "HI") + (const_string "HF") (match_test "TARGET_AVX") (const_string "TI") (ior (not (match_test "TARGET_SSE2"))
The master branch has been updated by Uros Bizjak <uros@gcc.gnu.org>: https://gcc.gnu.org/g:cbc9dd66484a51d450f78ab748a872b939c90c3f commit r12-8004-gcbc9dd66484a51d450f78ab748a872b939c90c3f Author: Uros Bizjak <ubizjak@gmail.com> Date: Tue Apr 5 21:03:18 2022 +0200 i386: Fix movv2qi_internal xmm reg to xmm reg move for AVX512FP16 [PR105139] 2022-04-05 Uroš Bizjak <ubizjak@gmail.com> gcc/ChangeLog: PR target/105139 * config/i386/mmx.md (*movv2qi_internal): Change insn mode of alternative 5 to HF for TARGET_AVX512FP16. gcc/testsuite/ChangeLog: PR target/105139 * gcc.target/i386/pr105139.c: New test.
Fixed.