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.
This commit is contained in:
liuhongt 2022-03-18 16:11:04 +08:00
parent ac73c944ea
commit 1f5c0e6739
2 changed files with 13 additions and 1 deletions

View file

@ -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"))

View file

@ -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;
}