]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386: PR target/112992: Optimize mode for broadcast of constants.
authorRoger Sayle <roger@nextmovesoftware.com>
Tue, 9 Jan 2024 08:28:42 +0000 (08:28 +0000)
committerRoger Sayle <roger@nextmovesoftware.com>
Tue, 9 Jan 2024 08:28:42 +0000 (08:28 +0000)
The issue addressed by this patch is that when initializing vectors by
broadcasting integer constants, the compiler has the flexibility to
select the most appropriate vector mode to perform the broadcast, as
long as the resulting vector has an identical bit pattern.
For example, the following constants are all equivalent:
V4SImode {0x01010101, 0x01010101, 0x01010101, 0x01010101 }
V8HImode {0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101 }
V16QImode {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, ... 0x01 }
So instruction sequences that construct any of these can be used to
construct the others (with a suitable cast/SUBREG).

On x86_64, it turns out that broadcasts of SImode constants are preferred,
as DImode constants often require a longer movabs instruction, and
HImode and QImode broadcasts require multiple uops on some architectures.
Hence, SImode is always the equal shortest/fastest implementation.

Examples of this improvement, can be seen in the testsuite.

gcc.target/i386/pr102021.c
Before:
   0:   48 b8 0c 00 0c 00 0c    movabs $0xc000c000c000c,%rax
   7:   00 0c 00
   a:   62 f2 fd 28 7c c0       vpbroadcastq %rax,%ymm0
  10:   c3                      retq

After:
   0:   b8 0c 00 0c 00          mov    $0xc000c,%eax
   5:   62 f2 7d 28 7c c0       vpbroadcastd %eax,%ymm0
   b:   c3                      retq

and
gcc.target/i386/pr90773-17.c:
Before:
   0:   48 8b 15 00 00 00 00    mov    0x0(%rip),%rdx        # 7 <foo+0x7>
   7:   b8 0c 00 00 00          mov    $0xc,%eax
   c:   62 f2 7d 08 7a c0       vpbroadcastb %eax,%xmm0
  12:   62 f1 7f 08 7f 02       vmovdqu8 %xmm0,(%rdx)
  18:   c7 42 0f 0c 0c 0c 0c    movl   $0xc0c0c0c,0xf(%rdx)
  1f:   c3                      retq

After:
   0:   48 8b 15 00 00 00 00    mov    0x0(%rip),%rdx        # 7 <foo+0x7>
   7:   b8 0c 0c 0c 0c          mov    $0xc0c0c0c,%eax
   c:   62 f2 7d 08 7c c0       vpbroadcastd %eax,%xmm0
  12:   62 f1 7f 08 7f 02       vmovdqu8 %xmm0,(%rdx)
  18:   c7 42 0f 0c 0c 0c 0c    movl   $0xc0c0c0c,0xf(%rdx)
  1f:   c3                      retq

where according to Agner Fog's instruction tables broadcastd is slightly
faster on some microarchitectures, for example Knight's Landing.

2024-01-09  Roger Sayle  <roger@nextmovesoftware.com>
    Hongtao Liu  <hongtao.liu@intel.com>

gcc/ChangeLog
PR target/112992
* config/i386/i386-expand.cc
(ix86_convert_const_wide_int_to_broadcast): Allow call to
ix86_expand_vector_init_duplicate to fail, and return NULL_RTX.
(ix86_broadcast_from_constant): Revert recent change; Return a
suitable MEMREF independently of mode/target combinations.
(ix86_expand_vector_move): Allow ix86_expand_vector_init_duplicate
to decide whether expansion is possible/preferrable.  Only try
forcing DImode constants to memory (and trying again) if calling
ix86_expand_vector_init_duplicate fails with an DImode immediate
constant.
(ix86_expand_vector_init_duplicate) <case E_V2DImode>: Try using
V4SImode for suitable immediate constants.
<case E_V4DImode>: Try using V8SImode for suitable constants.
<case E_V4HImode>: Fail for CONST_INT_P, i.e. use constant pool.
<case E_V2HImode>: Likewise.
<case E_V8HImode>: For CONST_INT_P try using V4SImode via widen.
<case E_V16QImode>: For CONT_INT_P try using V8HImode via widen.
<label widen>: Handle CONT_INTs via simplify_binary_operation.
Allow recursive calls to ix86_expand_vector_init_duplicate to fail.
<case E_V16HImode>: For CONST_INT_P try V8SImode via widen.
<case E_V32QImode>: For CONST_INT_P try V16HImode via widen.
(ix86_expand_vector_init): Move try using a broadcast for all_same
with ix86_expand_vector_init_duplicate before using constant pool.

gcc/testsuite/ChangeLog
* gcc.target/i386/auto-init-8.c: Update test case.
* gcc.target/i386/avx512f-broadcast-pr87767-1.c: Likewise.
* gcc.target/i386/avx512f-broadcast-pr87767-5.c: Likewise.
* gcc.target/i386/avx512fp16-13.c: Likewise.
* gcc.target/i386/avx512vl-broadcast-pr87767-1.c: Likewise.
* gcc.target/i386/avx512vl-broadcast-pr87767-5.c: Likewise.
* gcc.target/i386/pr100865-1.c: Likewise.
* gcc.target/i386/pr100865-10a.c: Likewise.
* gcc.target/i386/pr100865-10b.c: Likewise.
* gcc.target/i386/pr100865-2.c: Likewise.
* gcc.target/i386/pr100865-3.c: Likewise.
* gcc.target/i386/pr100865-4a.c: Likewise.
* gcc.target/i386/pr100865-4b.c: Likewise.
* gcc.target/i386/pr100865-5a.c: Likewise.
* gcc.target/i386/pr100865-5b.c: Likewise.
* gcc.target/i386/pr100865-9a.c: Likewise.
* gcc.target/i386/pr100865-9b.c: Likewise.
* gcc.target/i386/pr102021.c: Likewise.
* gcc.target/i386/pr90773-17.c: Likewise.

20 files changed:
gcc/config/i386/i386-expand.cc
gcc/testsuite/gcc.target/i386/auto-init-8.c
gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-1.c
gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-5.c
gcc/testsuite/gcc.target/i386/avx512fp16-13.c
gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-1.c
gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-5.c
gcc/testsuite/gcc.target/i386/pr100865-1.c
gcc/testsuite/gcc.target/i386/pr100865-10a.c
gcc/testsuite/gcc.target/i386/pr100865-10b.c
gcc/testsuite/gcc.target/i386/pr100865-2.c
gcc/testsuite/gcc.target/i386/pr100865-3.c
gcc/testsuite/gcc.target/i386/pr100865-4a.c
gcc/testsuite/gcc.target/i386/pr100865-4b.c
gcc/testsuite/gcc.target/i386/pr100865-5a.c
gcc/testsuite/gcc.target/i386/pr100865-5b.c
gcc/testsuite/gcc.target/i386/pr100865-9a.c
gcc/testsuite/gcc.target/i386/pr100865-9b.c
gcc/testsuite/gcc.target/i386/pr102021.c
gcc/testsuite/gcc.target/i386/pr90773-17.c

index 527fcc63506e209022ed81fc472f508f43db565f..52754e114f4eaf0db4d9cce3af98a133657ab399 100644 (file)
@@ -352,7 +352,8 @@ ix86_convert_const_wide_int_to_broadcast (machine_mode mode, rtx op)
   bool ok = ix86_expand_vector_init_duplicate (false, vector_mode,
                                               target,
                                               GEN_INT (val_broadcast));
-  gcc_assert (ok);
+  if (!ok)
+    return nullptr;
   target = lowpart_subreg (mode, target, vector_mode);
   return target;
 }
@@ -599,19 +600,11 @@ ix86_broadcast_from_constant (machine_mode mode, rtx op)
       && INTEGRAL_MODE_P (mode))
     return nullptr;
 
-  unsigned int msize = GET_MODE_SIZE (mode);
-  unsigned int inner_size = GET_MODE_SIZE (GET_MODE_INNER ((mode)));
-
   /* Convert CONST_VECTOR to a non-standard SSE constant integer
      broadcast only if vector broadcast is available.  */
   if (standard_sse_constant_p (op, mode))
     return nullptr;
 
-  /* vpbroadcast[b,w] is available under TARGET_AVX2.
-     or TARGET_AVX512BW for zmm.  */
-  if (inner_size < 4 && !(msize == 64 ? TARGET_AVX512BW : TARGET_AVX2))
-    return nullptr;
-
   if (GET_MODE_INNER (mode) == TImode)
     return nullptr;
 
@@ -705,22 +698,22 @@ ix86_expand_vector_move (machine_mode mode, rtx operands[])
        {
          /* Broadcast to XMM/YMM/ZMM register from an integer
             constant or scalar mem.  */
-         op1 = gen_reg_rtx (mode);
-         if (FLOAT_MODE_P (mode)
-             || (!TARGET_64BIT && GET_MODE_INNER (mode) == DImode)
-             /* vbroadcastss/vbroadcastsd only supports memory operand
-                w/o AVX2, force them into memory to avoid spill to
-                memory.  */
-             || (GET_MODE_SIZE (mode) == 32
-                 && (GET_MODE_INNER (mode) == DImode
-                     || GET_MODE_INNER (mode) == SImode)
-                 && !TARGET_AVX2))
+         rtx tmp = gen_reg_rtx (mode);
+         if (FLOAT_MODE_P (mode))
            first = force_const_mem (GET_MODE_INNER (mode), first);
          bool ok = ix86_expand_vector_init_duplicate (false, mode,
-                                                      op1, first);
-         gcc_assert (ok);
-         emit_move_insn (op0, op1);
-         return;
+                                                      tmp, first);
+         if (!ok && !TARGET_64BIT && GET_MODE_INNER (mode) == DImode)
+           {
+             first = force_const_mem (GET_MODE_INNER (mode), first);
+             ok = ix86_expand_vector_init_duplicate (false, mode,
+                                                     tmp, first);
+           }
+         if (ok)
+           {
+             emit_move_insn (op0, tmp);
+             return;
+           }
        }
     }
 
@@ -15714,6 +15707,42 @@ ix86_expand_vector_init_duplicate (bool mmx_ok, machine_mode mode,
 
   switch (mode)
     {
+    case E_V2DImode:
+      if (CONST_INT_P (val))
+       {
+         int tmp = (int)INTVAL (val);
+         if (tmp == (int)(INTVAL (val) >> 32))
+           {
+             rtx reg = gen_reg_rtx (V4SImode);
+             ok = ix86_vector_duplicate_value (V4SImode, reg,
+                                               GEN_INT (tmp));
+             if (ok)
+               {
+                 emit_move_insn (target, gen_lowpart (V2DImode, reg));
+                 return true;
+               }
+           }
+       }
+      return ix86_vector_duplicate_value (mode, target, val);
+
+    case E_V4DImode:
+      if (CONST_INT_P (val))
+       {
+         int tmp = (int)INTVAL (val);
+         if (tmp == (int)(INTVAL (val) >> 32))
+           {
+             rtx reg = gen_reg_rtx (V8SImode);
+             ok = ix86_vector_duplicate_value (V8SImode, reg,
+                                               GEN_INT (tmp));
+             if (ok)
+               {
+                 emit_move_insn (target, gen_lowpart (V4DImode, reg));
+                 return true;
+               }
+           }
+       }
+      return ix86_vector_duplicate_value (mode, target, val);
+
     case E_V2SImode:
     case E_V2SFmode:
       if (!mmx_ok)
@@ -15721,11 +15750,9 @@ ix86_expand_vector_init_duplicate (bool mmx_ok, machine_mode mode,
       /* FALLTHRU */
 
     case E_V4DFmode:
-    case E_V4DImode:
     case E_V8SFmode:
     case E_V8SImode:
     case E_V2DFmode:
-    case E_V2DImode:
     case E_V4SFmode:
     case E_V4SImode:
     case E_V16SImode:
@@ -15742,6 +15769,8 @@ ix86_expand_vector_init_duplicate (bool mmx_ok, machine_mode mode,
          rtx x;
 
          val = gen_lowpart (SImode, val);
+         if (CONST_INT_P (val))
+           return false;
          x = gen_rtx_TRUNCATE (HImode, val);
          x = gen_rtx_VEC_DUPLICATE (mode, x);
          emit_insn (gen_rtx_SET (target, x));
@@ -15766,6 +15795,8 @@ ix86_expand_vector_init_duplicate (bool mmx_ok, machine_mode mode,
          rtx x;
 
          val = gen_lowpart (SImode, val);
+         if (CONST_INT_P (val))
+           return false;
          x = gen_rtx_TRUNCATE (HImode, val);
          x = gen_rtx_VEC_DUPLICATE (mode, x);
          emit_insn (gen_rtx_SET (target, x));
@@ -15791,6 +15822,10 @@ ix86_expand_vector_init_duplicate (bool mmx_ok, machine_mode mode,
       goto widen;
 
     case E_V8HImode:
+      if (CONST_INT_P (val))
+       goto widen;
+      /* FALLTHRU */
+
     case E_V8HFmode:
     case E_V8BFmode:
       if (TARGET_AVX2)
@@ -15838,6 +15873,8 @@ ix86_expand_vector_init_duplicate (bool mmx_ok, machine_mode mode,
       goto widen;
 
     case E_V16QImode:
+      if (CONST_INT_P (val))
+       goto widen;
       if (TARGET_AVX2)
        return ix86_vector_duplicate_value (mode, target, val);
 
@@ -15857,7 +15894,13 @@ ix86_expand_vector_init_duplicate (bool mmx_ok, machine_mode mode,
 
        val = convert_modes (wsmode, smode, val, true);
 
-       if (smode == QImode && !TARGET_PARTIAL_REG_STALL)
+       if (CONST_INT_P (val))
+         {
+           x = simplify_binary_operation (ASHIFT, wsmode, val,
+                                          GEN_INT (GET_MODE_BITSIZE (smode)));
+           val = simplify_binary_operation (IOR, wsmode, val, x);
+         }
+       else if (smode == QImode && !TARGET_PARTIAL_REG_STALL)
          emit_insn (gen_insv_1 (wsmode, val, val));
        else
          {
@@ -15870,15 +15913,20 @@ ix86_expand_vector_init_duplicate (bool mmx_ok, machine_mode mode,
 
        x = gen_reg_rtx (wvmode);
        ok = ix86_expand_vector_init_duplicate (mmx_ok, wvmode, x, val);
-       gcc_assert (ok);
+       if (!ok)
+         return false;
        emit_move_insn (target, gen_lowpart (GET_MODE (target), x));
-       return ok;
+       return true;
       }
 
     case E_V16HImode:
+    case E_V32QImode:
+      if (CONST_INT_P (val))
+       goto widen;
+      /* FALLTHRU */
+
     case E_V16HFmode:
     case E_V16BFmode:
-    case E_V32QImode:
       if (TARGET_AVX2)
        return ix86_vector_duplicate_value (mode, target, val);
       else
@@ -15904,7 +15952,8 @@ ix86_expand_vector_init_duplicate (bool mmx_ok, machine_mode mode,
          rtx x = gen_reg_rtx (hvmode);
 
          ok = ix86_expand_vector_init_duplicate (false, hvmode, x, val);
-         gcc_assert (ok);
+         if (!ok)
+           return false;
 
          x = gen_rtx_VEC_CONCAT (mode, x, x);
          emit_insn (gen_rtx_SET (target, x));
@@ -15941,7 +15990,8 @@ ix86_expand_vector_init_duplicate (bool mmx_ok, machine_mode mode,
          rtx x = gen_reg_rtx (hvmode);
 
          ok = ix86_expand_vector_init_duplicate (false, hvmode, x, val);
-         gcc_assert (ok);
+         if (!ok)
+           return false;
 
          x = gen_rtx_VEC_CONCAT (mode, x, x);
          emit_insn (gen_rtx_SET (target, x));
@@ -16913,6 +16963,12 @@ ix86_expand_vector_init (bool mmx_ok, rtx target, rtx vals)
        all_same = false;
     }
 
+  /* If all values are identical, broadcast the value.  */
+  if (all_same
+      && ix86_expand_vector_init_duplicate (mmx_ok, mode, target,
+                                           XVECEXP (vals, 0, 0)))
+    return;
+
   /* Constants are best loaded from the constant pool.  */
   if (n_var == 0)
     {
@@ -16920,12 +16976,6 @@ ix86_expand_vector_init (bool mmx_ok, rtx target, rtx vals)
       return;
     }
 
-  /* If all values are identical, broadcast the value.  */
-  if (all_same
-      && ix86_expand_vector_init_duplicate (mmx_ok, mode, target,
-                                           XVECEXP (vals, 0, 0)))
-    return;
-
   /* Values where only one field is non-constant are best loaded from
      the pool and overwritten via move later.  */
   if (n_var == 1)
index 666ee14d2bc9f2d99ab079385ad7f596df3a7927..7023d72a4e883a5f049f5a73bda8cf38350acd66 100644 (file)
@@ -29,7 +29,7 @@ double foo()
   return result;
 }
 
-/* { dg-final { scan-rtl-dump-times "0xfffffffffefefefe" 1 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "0xfffffffffefefefe" 3 "expand" } } */
 /* { dg-final { scan-rtl-dump-times "\\\[0xfefefefefefefefe\\\]" 2 "expand" } } */
 /* { dg-final { scan-rtl-dump-times "0xfffffffffffffffe\\\]\\\) repeated x16" 2 "expand" } } */
 
index 0fa93e031359ea5dd84cb8331fba1187010386e2..138dbb4c97358643220eec75dd0ac69d37834ac6 100644 (file)
@@ -3,8 +3,7 @@
 /* { dg-options "-O2 -mavx512f -mavx512dq" } */
 /* { dg-additional-options "-fno-PIE" { target ia32 } } */
 /* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } }
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 2 { target { ! ia32 } } } }  */
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 5 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 2 } } */
 /* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to16\\\}" 2 } }  */
 /* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %zmm\[0-9\]+" 3 } } */
 /* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+%r\[^\n\]*, %zmm\[0-9\]+" 3 { target { ! ia32 } } } } */
index f1b672aba4db091c5dc86e85c85309488bc6a5c8..d22251bc2a3a3fa77c5632dbdac2b6ef5a838cc1 100644 (file)
@@ -3,7 +3,7 @@
 /* { dg-options "-O2 -mavx512f" } */
 /* { dg-additional-options "-fno-PIE" { target ia32 } } */
 /* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } }
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 4 { target ia32 } } } */
+/* { dg-final { scan-assembler-not "\[^\n\]*\\\{1to8\\\}" { target ia32 } } } */
 /* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %zmm\[0-9\]+" 4 } } */
 /* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+%r\[^\n\]*, %zmm\[0-9\]+" 4 { target { ! ia32 } } } } */
 
index b73a8f44e1a2c0fad76198071ef86f4e2f3d4e5a..f431b8a88b00ef5f81ae03baa885140787aa7275 100644 (file)
@@ -126,7 +126,7 @@ abs256_ph (__m256h a)
   return _mm256_abs_ph (a);
 }
 
-/* { dg-final { scan-assembler-times "vpbroadcastq\[^\n\]*%ymm\[0-9\]+" 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[^\n\]*%ymm\[0-9\]+" 1 { target { ! ia32 } } } } */
 /* { dg-final { scan-assembler-times "vpand\[^\n\]*%ymm\[0-9\]+" 1 } } */
 
 __m128h
@@ -136,5 +136,5 @@ abs_ph (__m128h a)
   return _mm_abs_ph (a);
 }
 
-/* { dg-final { scan-assembler-times "vpbroadcastq\[^\n\]*%xmm\[0-9\]+" 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[^\n\]*%xmm\[0-9\]+" 1 { target { ! ia32 } } } } */
 /* { dg-final { scan-assembler-times "vpand\[^\n\]*%xmm\[0-9\]+" 1 } } */
index 0304b9de3a3c3062f8c09fe2e70a6d6a2af5850c..e6df4d25f36bd0112bb8f49d2b86077fe35bfd34 100644 (file)
@@ -3,10 +3,8 @@
 /* { dg-options "-O2 -mavx512f -mavx512vl -mavx512dq" } */
 /* { dg-additional-options "-fno-PIE" { target ia32 } } */
 /* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } }
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to2\\\}" 2 { target { ! ia32 } } } }  */
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to4\\\}" 4 { target { ! ia32 } } } }  */
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to2\\\}" 5 { target ia32 } } } */
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to4\\\}" 7 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to2\\\}" 2 } }  */
+/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to4\\\}" 4 } }  */
 /* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 2 } }  */
 /* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %xmm\[0-9\]+" 3 } } */
 /* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %ymm\[0-9\]+" 3 } } */
index 0ba0cd943c2c7a4ce67881d9b862c4c4cc730c85..ebdc3619d8eb33083a6248eb9a32c712ce9381b0 100644 (file)
@@ -3,8 +3,8 @@
 /* { dg-options "-O2 -mavx512f -mavx512vl" } */
 /* { dg-additional-options "-fno-PIE" { target ia32 } } */
 /* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } }
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to2\\\}" 4 { target ia32 } } } */
-/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to4\\\}" 4 { target ia32 } } } */
+/* { dg-final { scan-assembler-not "\[^\n\]*\\\{1to2\\\}" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "\[^\n\]*\\\{1to4\\\}" { target ia32 } } } */
 /* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %xmm\[0-9\]+" 4 } } */
 /* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %ymm\[0-9\]+" 4 } } */
 /* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+%r\[^\n\]*, %xmm\[0-9\]+" 4 { target { ! ia32 } } } } */
index 949dd5c337a98b35192f45385cc60788e30c5d31..75cd463cbfc2ea13e0b382b84715e87d8cc8690d 100644 (file)
@@ -9,5 +9,6 @@ foo (void)
   __builtin_memset (dst, 3, 16);
 }
 
-/* { dg-final { scan-assembler-times "movdqa\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "movd\[ \\t\]+\[^\n\]*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "pshufd" 1 } } */
 /* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
index 1d849a381c05de8df0aee2bd601dd8b975ad2c00..3bc0f1a2f0fbad3e99bd431132e9a3fa25767f7f 100644 (file)
@@ -29,5 +29,5 @@ foo (void)
     array[i] = MK_CONST128_BROADCAST (0x1f);
 }
 
-/* { dg-final { scan-assembler-times "vpbroadcastb\[\\t \]+\[^\n\]*, %ymm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+\[^\n\]*, %ymm\[0-9\]+" 1 } } */
 /* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, " 8 } } */
index e5616d8d258791514788239663b78c7f93078c25..f60d1bfd2c78d0f90afeae76a4c97988d65174d0 100644 (file)
@@ -3,5 +3,5 @@
 
 #include "pr100865-10a.c"
 
-/* { dg-final { scan-assembler-times "vpbroadcastb\[\\t \]+%(?:r|e)\[^\n\]*, %ymm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %ymm\[0-9\]+" 1 } } */
 /* { dg-final { scan-assembler-times "vmovdqu8\[\\t \]%ymm\[0-9\]+, " 8 } } */
index 090a010b719d458895e2dfcbe1f6b34e33b2e07c..e0265d27525f812421a1c898ce4aaba440e3cadf 100644 (file)
@@ -10,6 +10,6 @@ foo (void)
   __builtin_memset (dst, 3, 16);
 }
 
-/* { dg-final { scan-assembler-times "vpbroadcastb\[\\t \]+%xmm\[0-9\]+, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%xmm\[0-9\]+, %xmm\[0-9\]+" 1 } } */
 /* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
 /* { dg-final { scan-assembler-not "vmovdqa" } } */
index cde4b1c8927b7c1ee457f140ccf6a3b227c0ae09..433fd81cb0db2d2690b43e6e39d7ccfc782e4cf9 100644 (file)
@@ -10,7 +10,7 @@ foo (void)
   __builtin_memset (dst, 3, 16);
 }
 
-/* { dg-final { scan-assembler-times "vpbroadcastb\[\\t \]+%(?:r|e)\[^\n\]*, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %xmm\[0-9\]+" 1 } } */
 /* { dg-final { scan-assembler-times "vmovdqu8\[\\t \]%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
-/* { dg-final { scan-assembler-not "vpbroadcastb\[\\t \]+%xmm\[0-9\]+, %xmm\[0-9\]+" } } */
+/* { dg-final { scan-assembler-not "vpbroadcastd\[\\t \]+%xmm\[0-9\]+, %xmm\[0-9\]+" } } */
 /* { dg-final { scan-assembler-not "vmovdqa" } } */
index bd99945fd9dbe8c17e59fe20c022dca238787ebf..8009e5cebd6935d2795570b1a77288be59c43dbe 100644 (file)
@@ -12,6 +12,6 @@ foo (void)
     array[i] = -45;
 }
 
-/* { dg-final { scan-assembler-times "vpbroadcastb\[\\t \]+%xmm\[0-9\]+, %ymm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%xmm\[0-9\]+, %ymm\[0-9\]+" 1 } } */
 /* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, " 2 } } */
 /* { dg-final { scan-assembler-not "vmovdqa" } } */
index 1814306d5fc31f8cfc6bd227ef2d2bbbd50850e5..6fd703e8049fccb252027f2d884f724d5aa6f0a1 100644 (file)
@@ -4,8 +4,8 @@
 
 #include "pr100865-4a.c"
 
-/* { dg-final { scan-assembler-times "vpbroadcastb\[\\t \]+%(?:r|e)\[^\n\]*, %ymm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %ymm\[0-9\]+" 1 } } */
 /* { dg-final { scan-assembler-times "vmovdqu8\[\\t \]%ymm\[0-9\]+, " 2 } } */
 /* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
-/* { dg-final { scan-assembler-not "vpbroadcastb\[\\t \]+%xmm\[0-9\]+, %ymm\[0-9\]+" } } */
+/* { dg-final { scan-assembler-not "vpbroadcastd\[\\t \]+%xmm\[0-9\]+, %ymm\[0-9\]+" } } */
 /* { dg-final { scan-assembler-not "vmovdqa" } } */
index b023fcae0ad4f9c121071cf0488599dcfe218dcd..d6fb79e69968b053af60f36fbe3c4151082979da 100644 (file)
@@ -12,6 +12,6 @@ foo (void)
     array[i] = -45;
 }
 
-/* { dg-final { scan-assembler-times "vpbroadcastw\[\\t \]+%xmm\[0-9\]+, %ymm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%xmm\[0-9\]+, %ymm\[0-9\]+" 1 } } */
 /* { dg-final { scan-assembler-times "vmovdqu\[\\t \]%ymm\[0-9\]+, " 4 } } */
 /* { dg-final { scan-assembler-not "vmovdqa" } } */
index 5bccfd0de9fd5d499dd610c104b6c1cc19995bf9..6c2b33d6c69df87d8cac58417d5e5dabf4bd44d1 100644 (file)
@@ -4,7 +4,7 @@
 
 #include "pr100865-5a.c"
 
-/* { dg-final { scan-assembler-times "vpbroadcastw\[\\t \]+%(?:r|e)\[^\n\]*, %ymm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %ymm\[0-9\]+" 1 } } */
 /* { dg-final { scan-assembler-times "vmovdqu16\[\\t \]%ymm\[0-9\]+, " 4 } } */
-/* { dg-final { scan-assembler-not "vpbroadcastw\[\\t \]+%xmm\[0-9\]+, %ymm\[0-9\]+" } } */
+/* { dg-final { scan-assembler-not "vpbroadcastd\[\\t \]+%xmm\[0-9\]+, %ymm\[0-9\]+" } } */
 /* { dg-final { scan-assembler-not "vmovdqa" } } */
index 45d0e0d0e2e947b61fbbcc9bcf0a4d81f08954f4..f2ac1bd94ea2cf8992128b44a741c57c5035684f 100644 (file)
@@ -21,5 +21,5 @@ foo (void)
     array[i] = MK_CONST128_BROADCAST (0x1fff);
 }
 
-/* { dg-final { scan-assembler-times "vpbroadcastw\[\\t \]+%xmm\[0-9\]+, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%xmm\[0-9\]+, %xmm\[0-9\]+" 1 } } */
 /* { dg-final { scan-assembler-times "vmovdqa\[\\t \]%xmm\[0-9\]+, " 16 } } */
index 146962485258e408a6733fc8a29424126164cee6..e2a3f924d0887dd1116aa40fc4735425d655c8aa 100644 (file)
@@ -3,5 +3,5 @@
 
 #include "pr100865-9a.c"
 
-/* { dg-final { scan-assembler-times "vpbroadcastw\[\\t \]+%(?:r|e)\[^\n\]*, %xmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %xmm\[0-9\]+" 1 } } */
 /* { dg-final { scan-assembler-times "vmovdqa\[\\t \]%xmm\[0-9\]+, " 16 } } */
index a5012a4beb10c3f43c4413f903442fdd444e2f31..8ff898d2c93947f4ebce9ab0c8ba85a3e20bd6be 100644 (file)
@@ -10,7 +10,7 @@ foo ()
   return _mm256_set1_epi16 (12);
 }
 
-/* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+%r\[^\n\]*, %ymm\[0-9\]+" 1 { target { ! ia32 } } } } */
-/* { dg-final { scan-assembler-times "vpbroadcastq\[\\t \]+\[^\n\]*, %ymm\[0-9\]+" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%\[^\n\]*, %ymm\[0-9\]+" 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+\[^\n\]*, %ymm\[0-9\]+" 1 { target ia32 } } } */
 /* { dg-final { scan-assembler-not "vmovdqa" } } */
 /* { dg-final { scan-assembler-not "vzeroupper" } } */
index 3036085b7bf774b02692a13033352b615f989ddb..61b2bfd7485a3f9be4b636cfe575d8cf2d33b396 100644 (file)
@@ -10,6 +10,6 @@ foo (void)
   __builtin_memset (dst, 12, 19);
 }
 
-/* { dg-final { scan-assembler-times "vpbroadcastb" 1 } } */
+/* { dg-final { scan-assembler-times "vpbroadcastd" 1 } } */
 /* { dg-final { scan-assembler-times "vmovdqu8\[\\t \]+%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */
 /* { dg-final { scan-assembler-times "vmovd\[\\t \]+%xmm\[0-9\]+, 16\\(%\[\^,\]+\\)" 1 { xfail *-*-* } } } */