Set attr from HImode to HFmode which uses vmovsh instead of vmovw for movment between sse registers.
Bootstrapped and regstested on x86_64-pc-linux-gnu{-m32,}. Ok for main trunk? gcc/ChangeLog: PR target/104974 * config/i386/i386.md (*movhi_internal): Set attr type from HI to HF for alternative 12 under TARGET_AVX512FP16. gcc/testsuite/ChangeLog: * gcc.target/i386/pr104974.c: New test. --- gcc/config/i386/i386.md | 2 +- gcc/testsuite/gcc.target/i386/pr104974.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr104974.c diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index c8fbf605e41..42aa0e1d998 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -2658,7 +2658,7 @@ (define_insn "*movhi_internal" (const_string "TI")) (eq_attr "alternative" "12") (cond [(match_test "TARGET_AVX512FP16") - (const_string "HI") + (const_string "HF") (match_test "TARGET_AVX") (const_string "TI") (ior (not (match_test "TARGET_SSE2")) diff --git a/gcc/testsuite/gcc.target/i386/pr104974.c b/gcc/testsuite/gcc.target/i386/pr104974.c new file mode 100644 index 00000000000..d1f2b1a9722 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr104974.c @@ -0,0 +1,12 @@ +/* { dg-do assemble { target avx512fp16 } } */ +/* { dg-options "-mavx512fp16 -O2" } */ + +short +foo (short a) +{ + register short b __asm ("%xmm1") = a; + asm volatile ("": "+v" (b)); + register short c __asm ("%xmm2") = b; + asm volatile ("": "+v" (c)); + return a; +} -- 2.18.1