public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, i386, AVX-512] Fix PR target/70662.
@ 2016-04-15  7:59 Kirill Yukhin
  2016-04-15  8:20 ` Kirill Yukhin
  2016-04-15 13:43 ` H.J. Lu
  0 siblings, 2 replies; 5+ messages in thread
From: Kirill Yukhin @ 2016-04-15  7:59 UTC (permalink / raw)
  To: GCC Patches; +Cc: Uros Bizjak

Hello,
Patch in the bottom fixes memory operand modifiers
for Intel syntax on broadcast patter.

Bootstrapped and regtested on 32,64b x86 target.

I'll check it into main trunk and gcc-5 branch.

gcc/
	PR target/70662
	* config/i386/sse.md: Use proper memory operand
	modifiers.
gcc/testsuite/
	PR target/70662
	* gcc.target/i386/pr70662.c: New test.

--
Thanks, K

commit 4923dda50a901bf38d386818fcc5347e3882cd99
Author: Kirill Yukhin <kirill.yukhin@intel.com>
Date:   Fri Apr 15 09:37:48 2016 +0300

    AVX-512. Fix PR target/70662 - use proper operand modifiers.

diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index b64457e..4d2927e 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -17262,9 +17262,12 @@
   /*  There is no DF broadcast (in AVX-512*) to 128b register.
       Mimic it with integer variant.  */
   if (<MODE>mode == V2DFmode)
-    return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
+    return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
+
+  if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 32)
+    return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}";
   else
-    return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
+    return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
 }
   [(set_attr "type" "ssemov")
    (set_attr "prefix" "evex")
diff --git a/gcc/testsuite/gcc.target/i386/pr70662.c b/gcc/testsuite/gcc.target/i386/pr70662.c
new file mode 100755
index 0000000..546211d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr70662.c
@@ -0,0 +1,18 @@
+/* { dg-do assemble { target { ! ia32 } } } */
+/* { dg-require-effective-target avx512vbmi } */
+/* { dg-options "-Og -fschedule-insns -fno-tree-fre -mavx512vbmi --param=max-sched-ready-insns=1 -masm=intel" } */
+
+typedef char v64u8 __attribute__((vector_size(64)));
+typedef int v64u32 __attribute__((vector_size(64)));
+typedef long v64u64 __attribute__((vector_size(64)));
+typedef __int128 v64u128 __attribute__((vector_size(64)));
+
+v64u128
+foo(int u8_0, unsigned u128_0, v64u32 v64u32_1, v64u32 v64u32_0, v64u64 v64u64_0, v64u128 v64u128_0)
+{
+  v64u8 v64u8_0 = v64u8_0;
+  v64u32_0 = v64u32_0 >> (v64u32){0, 0, 0, 1, 0, ((v64u64)v64u64_0)[u8_0], ((v64u32)v64u128_0)[15], 0, 0, 0, 0, 4, ((v64u64)v64u64_0)[v64u32_0[0]] - 1};
+  v64u8_0 = v64u8_0 << ((v64u8)v64u32_1 & 1);
+  v64u64_0[0] >>= 0;
+  return u128_0 + (v64u128)v64u8_0 + (v64u128)v64u32_0 + (v64u128)v64u64_0;
+}

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

* Re: [PATCH, i386, AVX-512] Fix PR target/70662.
  2016-04-15  7:59 [PATCH, i386, AVX-512] Fix PR target/70662 Kirill Yukhin
@ 2016-04-15  8:20 ` Kirill Yukhin
  2016-04-15 13:43 ` H.J. Lu
  1 sibling, 0 replies; 5+ messages in thread
From: Kirill Yukhin @ 2016-04-15  8:20 UTC (permalink / raw)
  To: GCC Patches; +Cc: Uros Bizjak

On 15 Apr 10:57, Kirill Yukhin wrote:
> Hello,
> Patch in the bottom fixes memory operand modifiers
> for Intel syntax on broadcast patter.
> 
> Bootstrapped and regtested on 32,64b x86 target.
> 
> I'll check it into main trunk and gcc-5 branch.
> 
> gcc/
> 	PR target/70662
> 	* config/i386/sse.md: Use proper memory operand
> 	modifiers.
> gcc/testsuite/
> 	PR target/70662
> 	* gcc.target/i386/pr70662.c: New test.
> 
I'v added target check for Intel syntax.

commit 77212d7c64faeca862afb7e9d6f3e00cb5db14a7
Author: Kirill Yukhin <kirill.yukhin@intel.com>
Date:   Fri Apr 15 09:37:48 2016 +0300

    AVX-512. Fix PR target/70662 - use proper operand modifiers.

diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index b64457e..4d2927e 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -17262,9 +17262,12 @@
   /*  There is no DF broadcast (in AVX-512*) to 128b register.
       Mimic it with integer variant.  */
   if (<MODE>mode == V2DFmode)
-    return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
+    return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
+
+  if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 32)
+    return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}";
   else
-    return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
+    return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
 }
   [(set_attr "type" "ssemov")
    (set_attr "prefix" "evex")
diff --git a/gcc/testsuite/gcc.target/i386/pr70662.c b/gcc/testsuite/gcc.target/i386/pr70662.c
new file mode 100755
index 0000000..109e224
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr70662.c
@@ -0,0 +1,19 @@
+/* { dg-do assemble { target { ! ia32 } } } */
+/* { dg-require-effective-target avx512vbmi } */
+/* { dg-require-effective-target masm_intel } */
+/* { dg-options "-Og -fschedule-insns -fno-tree-fre -mavx512vbmi --param=max-sched-ready-insns=1 -masm=intel" } */
+
+typedef char v64u8 __attribute__((vector_size(64)));
+typedef int v64u32 __attribute__((vector_size(64)));
+typedef long v64u64 __attribute__((vector_size(64)));
+typedef __int128 v64u128 __attribute__((vector_size(64)));
+
+v64u128
+foo(int u8_0, unsigned u128_0, v64u32 v64u32_1, v64u32 v64u32_0, v64u64 v64u64_0, v64u128 v64u128_0)
+{
+  v64u8 v64u8_0 = v64u8_0;
+  v64u32_0 = v64u32_0 >> (v64u32){0, 0, 0, 1, 0, ((v64u64)v64u64_0)[u8_0], ((v64u32)v64u128_0)[15], 0, 0, 0, 0, 4, ((v64u64)v64u64_0)[v64u32_0[0]] - 1};
+  v64u8_0 = v64u8_0 << ((v64u8)v64u32_1 & 1);
+  v64u64_0[0] >>= 0;
+  return u128_0 + (v64u128)v64u8_0 + (v64u128)v64u32_0 + (v64u128)v64u64_0;
+}

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

* Re: [PATCH, i386, AVX-512] Fix PR target/70662.
  2016-04-15  7:59 [PATCH, i386, AVX-512] Fix PR target/70662 Kirill Yukhin
  2016-04-15  8:20 ` Kirill Yukhin
@ 2016-04-15 13:43 ` H.J. Lu
  2016-04-15 15:23   ` Kirill Yukhin
  1 sibling, 1 reply; 5+ messages in thread
From: H.J. Lu @ 2016-04-15 13:43 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: GCC Patches, Uros Bizjak

On Fri, Apr 15, 2016 at 12:57 AM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
> Hello,
> Patch in the bottom fixes memory operand modifiers
> for Intel syntax on broadcast patter.
>
> Bootstrapped and regtested on 32,64b x86 target.
>
> I'll check it into main trunk and gcc-5 branch.
>
> gcc/
>         PR target/70662
>         * config/i386/sse.md: Use proper memory operand
>         modifiers.
> gcc/testsuite/
>         PR target/70662
>         * gcc.target/i386/pr70662.c: New test.
>

The fix is incomplete:

[hjl@gnu-6 gcc]$ /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/  -mx32 -mtune=slm
 -fno-diagnostics-show-caret -fdiagnostics-color=never   -Og
-fschedule-insns -fno-tree-fre -mavx512vbmi
--param=max-sched-ready-insns=1 -masm=intel -c -o pr70662.o
/export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.target/i386/pr70662.c
/tmp/ccatFXMU.s: Assembler messages:
/tmp/ccatFXMU.s:240: Error: operand size mismatch for `vpbroadcastd'
[hjl@gnu-6 gcc]$

        vpbroadcastd    zmm17{k1}, QWORD PTR [esp+184]
                                                  ^^^^^^^^ Should be DWORD.

H.J.

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

* Re: [PATCH, i386, AVX-512] Fix PR target/70662.
  2016-04-15 13:43 ` H.J. Lu
@ 2016-04-15 15:23   ` Kirill Yukhin
  2016-04-15 15:25     ` Jakub Jelinek
  0 siblings, 1 reply; 5+ messages in thread
From: Kirill Yukhin @ 2016-04-15 15:23 UTC (permalink / raw)
  To: H.J. Lu, Jakub Jelinek, Richard Biener; +Cc: GCC Patches, Uros Bizjak

Hi,
On 15 Apr 06:43, H.J. Lu wrote:
> [hjl@gnu-6 gcc]$ /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc
> -B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/  -mx32 -mtune=slm
>  -fno-diagnostics-show-caret -fdiagnostics-color=never   -Og
> -fschedule-insns -fno-tree-fre -mavx512vbmi
> --param=max-sched-ready-insns=1 -masm=intel -c -o pr70662.o
> /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.target/i386/pr70662.c
> /tmp/ccatFXMU.s: Assembler messages:
> /tmp/ccatFXMU.s:240: Error: operand size mismatch for `vpbroadcastd'
> [hjl@gnu-6 gcc]$
> 
>         vpbroadcastd    zmm17{k1}, QWORD PTR [esp+184]
>                                                   ^^^^^^^^ Should be DWORD.
Thanks for catching.

GCC v6 forked 10 mins ago.

Patch in the bottom checked into gcc-5 branch and trunk (v7).

Is it ok to check in to gcc-6 branch?

> 
> H.J.

--
Thanks, K

diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 4d2927e..1ffb3b9 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -17264,7 +17264,7 @@
   if (<MODE>mode == V2DFmode)
     return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
 
-  if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 32)
+  if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
     return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}";
   else
     return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";

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

* Re: [PATCH, i386, AVX-512] Fix PR target/70662.
  2016-04-15 15:23   ` Kirill Yukhin
@ 2016-04-15 15:25     ` Jakub Jelinek
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Jelinek @ 2016-04-15 15:25 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: H.J. Lu, Richard Biener, GCC Patches, Uros Bizjak

On Fri, Apr 15, 2016 at 06:21:56PM +0300, Kirill Yukhin wrote:
> Hi,
> On 15 Apr 06:43, H.J. Lu wrote:
> > [hjl@gnu-6 gcc]$ /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc
> > -B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/  -mx32 -mtune=slm
> >  -fno-diagnostics-show-caret -fdiagnostics-color=never   -Og
> > -fschedule-insns -fno-tree-fre -mavx512vbmi
> > --param=max-sched-ready-insns=1 -masm=intel -c -o pr70662.o
> > /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.target/i386/pr70662.c
> > /tmp/ccatFXMU.s: Assembler messages:
> > /tmp/ccatFXMU.s:240: Error: operand size mismatch for `vpbroadcastd'
> > [hjl@gnu-6 gcc]$
> > 
> >         vpbroadcastd    zmm17{k1}, QWORD PTR [esp+184]
> >                                                   ^^^^^^^^ Should be DWORD.
> Thanks for catching.
> 
> GCC v6 forked 10 mins ago.
> 
> Patch in the bottom checked into gcc-5 branch and trunk (v7).
> 
> Is it ok to check in to gcc-6 branch?

Ok.

	Jakub

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

end of thread, other threads:[~2016-04-15 15:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-15  7:59 [PATCH, i386, AVX-512] Fix PR target/70662 Kirill Yukhin
2016-04-15  8:20 ` Kirill Yukhin
2016-04-15 13:43 ` H.J. Lu
2016-04-15 15:23   ` Kirill Yukhin
2016-04-15 15:25     ` Jakub Jelinek

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