diff mbox

[i386,AVX-512] Fix PR target/70662.

Message ID 20160415075750.GA29751@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Kirill Yukhin April 15, 2016, 7:57 a.m. UTC
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.

Comments

H.J. Lu April 15, 2016, 1:43 p.m. UTC | #1
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.
diff mbox

Patch

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