public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix avx512f_sfixupimm* (PR target/88489)
@ 2018-12-14 19:50 Jakub Jelinek
  2018-12-14 23:12 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2018-12-14 19:50 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches

Hi!

The avx512f-vfixupimms{s,d}-2.c testcases were miscompiled with -mavx512vl.
The problem is that there are separate instructions (e.g. vfixupimmsd vs.
vfixupimmpd), each of those have different behavior, the first one is
TARGET_AVX512F, the latter TARGET_AVX512VL, but the 128-bit version of the
latter used identical RTL pattern to the vfixupimmsd instruction and was
defined earlier.

Fixed by using different UNSPEC number for the scalar vs. vector ones.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2018-12-14  Jakub Jelinek  <jakub@redhat.com>

	PR target/88489
	* config/i386/sse.md (UNSPEC_SFIXUPIMM): New unspec enumerator.
	(avx512f_sfixupimm<mode><mask_name><round_saeonly_name>): Use it
	instead of UNSPEC_FIXUPIMM.

	* gcc.target/i386/avx512vl-vfixupimmsd-2.c: New test.
	* gcc.target/i386/avx512vl-vfixupimmss-2.c: New test.

--- gcc/config/i386/sse.md.jj	2018-12-13 08:59:03.000000000 +0100
+++ gcc/config/i386/sse.md	2018-12-14 18:43:04.924881740 +0100
@@ -95,6 +95,7 @@ (define_c_enum "unspec" [
   UNSPEC_RCP14
   UNSPEC_RSQRT14
   UNSPEC_FIXUPIMM
+  UNSPEC_SFIXUPIMM
   UNSPEC_SCALEF
   UNSPEC_VTERNLOG
   UNSPEC_GETEXP
@@ -8872,7 +8873,7 @@ (define_insn "avx512f_sfixupimm<mode><ma
           [(match_operand:VF_128 1 "register_operand" "v")
 	     (match_operand:<sseintvecmode> 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
 	     (match_operand:SI 3 "const_0_to_255_operand")]
-	    UNSPEC_FIXUPIMM))]
+	    UNSPEC_SFIXUPIMM))]
    "TARGET_AVX512F"
   "vfixupimm<ssescalarmodesuffix>\t{%3, <round_saeonly_mask_op4>%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %<iptr>2<round_saeonly_mask_op4>, %3}";
   [(set_attr "prefix" "evex")
--- gcc/testsuite/gcc.target/i386/avx512vl-vfixupimmsd-2.c.jj	2018-12-14 18:46:05.334946460 +0100
+++ gcc/testsuite/gcc.target/i386/avx512vl-vfixupimmsd-2.c	2018-12-14 18:50:11.986933429 +0100
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options "-mavx512vl -O2 -std=gnu99" } */
+/* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target c99_runtime } */
+
+#define AVX512VL
+#define AVX512F_LEN 512
+#define AVX512F_LEN_HALF 256
+#include "avx512f-vfixupimmsd-2.c"
+
+static void
+test_256 (void)
+{
+  test_512 ();
+}
+
+static void
+test_128 (void)
+{
+}
--- gcc/testsuite/gcc.target/i386/avx512vl-vfixupimmss-2.c.jj	2018-12-14 18:50:52.808269261 +0100
+++ gcc/testsuite/gcc.target/i386/avx512vl-vfixupimmss-2.c	2018-12-14 18:51:06.084053265 +0100
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options "-mavx512vl -O2 -std=gnu99" } */
+/* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target c99_runtime } */
+
+#define AVX512VL
+#define AVX512F_LEN 512
+#define AVX512F_LEN_HALF 256
+#include "avx512f-vfixupimmss-2.c"
+
+static void
+test_256 (void)
+{
+  test_512 ();
+}
+
+static void
+test_128 (void)
+{
+}

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix avx512f_sfixupimm* (PR target/88489)
  2018-12-14 19:50 [PATCH] Fix avx512f_sfixupimm* (PR target/88489) Jakub Jelinek
@ 2018-12-14 23:12 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2018-12-14 23:12 UTC (permalink / raw)
  To: Jakub Jelinek, Uros Bizjak; +Cc: gcc-patches

On 12/14/18 12:50 PM, Jakub Jelinek wrote:
> Hi!
> 
> The avx512f-vfixupimms{s,d}-2.c testcases were miscompiled with -mavx512vl.
> The problem is that there are separate instructions (e.g. vfixupimmsd vs.
> vfixupimmpd), each of those have different behavior, the first one is
> TARGET_AVX512F, the latter TARGET_AVX512VL, but the 128-bit version of the
> latter used identical RTL pattern to the vfixupimmsd instruction and was
> defined earlier.
> 
> Fixed by using different UNSPEC number for the scalar vs. vector ones.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> 2018-12-14  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR target/88489
> 	* config/i386/sse.md (UNSPEC_SFIXUPIMM): New unspec enumerator.
> 	(avx512f_sfixupimm<mode><mask_name><round_saeonly_name>): Use it
> 	instead of UNSPEC_FIXUPIMM.
> 
> 	* gcc.target/i386/avx512vl-vfixupimmsd-2.c: New test.
> 	* gcc.target/i386/avx512vl-vfixupimmss-2.c: New test.
OK
jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-14 23:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-14 19:50 [PATCH] Fix avx512f_sfixupimm* (PR target/88489) Jakub Jelinek
2018-12-14 23:12 ` Jeff Law

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).