* [PATCH] [avx512fp16] Refine HImode movement for "v" to "v".
@ 2022-03-18 8:17 liuhongt
2022-03-18 10:34 ` Uros Bizjak
0 siblings, 1 reply; 2+ messages in thread
From: liuhongt @ 2022-03-18 8:17 UTC (permalink / raw)
To: gcc-patches
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] [avx512fp16] Refine HImode movement for "v" to "v".
2022-03-18 8:17 [PATCH] [avx512fp16] Refine HImode movement for "v" to "v" liuhongt
@ 2022-03-18 10:34 ` Uros Bizjak
0 siblings, 0 replies; 2+ messages in thread
From: Uros Bizjak @ 2022-03-18 10:34 UTC (permalink / raw)
To: liuhongt; +Cc: gcc-patches
On Fri, Mar 18, 2022 at 9:18 AM liuhongt <hongtao.liu@intel.com> wrote:
>
> 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.
OK.
Thanks,
Uros.
> ---
> 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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-18 10:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-18 8:17 [PATCH] [avx512fp16] Refine HImode movement for "v" to "v" liuhongt
2022-03-18 10:34 ` Uros Bizjak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).