From 1f5c0e67393e8f67d66150eba8c64edfeb14e11b Mon Sep 17 00:00:00 2001 From: liuhongt Date: Fri, 18 Mar 2022 16:11:04 +0800 Subject: Refine HImode movement for "v" to "v". Set attr from HImode to HFmode which uses vmovsh instead of vmovw for movment between sse registers. 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 5b44c65..02f298c 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -2658,7 +2658,7 @@ (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 0000000..d1f2b1a --- /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; +} -- cgit v1.1