Add missing mask[z]_scalef_round_s[d,s] intrinsics
authorOlga Makhotina <olga.makhotina@intel.com>
Mon, 12 Feb 2018 06:09:20 +0000 (06:09 +0000)
committerKirill Yukhin <kyukhin@gcc.gnu.org>
Mon, 12 Feb 2018 06:09:20 +0000 (06:09 +0000)
gcc/
* config/i386/avx512fintrin.h (_mm_mask_scalef_round_sd,
_mm_maskz_scalef_round_sd, _mm_mask_scalef_round_ss,
_mm_maskz_scalef_round_ss): New intrinsics.
(__builtin_ia32_scalefsd_round, __builtin_ia32_scalefss_round): Fix.
* config/i386/i386-builtin.def (__builtin_ia32_scalefsd_round,
__builtin_ia32_scalefss_round): Remove.
(__builtin_ia32_scalefsd_mask_round,
__builtin_ia32_scalefss_mask_round): New intrinsics.
* config/i386/sse.md (vmscalef<mode><round_name>): Renamed to ...
(vmscalef<mode><mask_scalar_name><round_scalar_name>): ... this.
((match_operand:VF_128 2 "<round_nimm_predicate>"
"<round_constraint>")): Changed to ...
((match_operand:VF_128 2 "<round_scalar_nimm_predicate>"
"<round_scalar_constraint>")): ... this.
("vscalef<ssescalarmodesuffix>\t{<round_op3>%2, %1, %0|
%0, %1, %2<round_op3>}"): Changed to ...
("vscalef<ssescalarmodesuffix>\t{<round_scalar_mask_op3>%2, %1,
%0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %1,
%2<round_scalar_mask_op3>}"): ... this.
* config/i386/subst.md (round_scalar_nimm_predicate): New.

gcc/testsuite/
* gcc.target/i386/avx512f-vscalefsd-1.c (_mm_mask_scalef_round_sd,
_mm_maskz_scalef_round_sd): Test new intrinsics.
* gcc.target/i386/avx512f-vscalefsd-2.c (_mm_scalef_round_sd,
_mm_mask_scalef_round_sd, _mm_maskz_scalef_round_sd): Test new
intrinsics.
* gcc.target/i386/avx512f-vscalefss-1.c (_mm_mask_scalef_round_ss,
_mm_maskz_scalef_round_ss): Test new intrinsics.
* gcc.target/i386/avx512f-vscalefss-2.c (_mm_scalef_round_ss,
_mm_mask_scalef_round_ss, _mm_maskz_scalef_round_ss): Test new
intrinsics.
* gcc.target/i386/avx-1.c (__builtin_ia32_scalefsd_round,
__builtin_ia32_scalefss_round): Remove builtin.
(__builtin_ia32_scalefsd_mask_round,
__builtin_ia32_scalefss_mask_round): Test new builtin.
* gcc.target/i386/sse-13.c: Ditto.
* gcc.target/i386/sse-23.c: Ditto.

From-SVN: r257578

13 files changed:
gcc/ChangeLog
gcc/config/i386/avx512fintrin.h
gcc/config/i386/i386-builtin.def
gcc/config/i386/sse.md
gcc/config/i386/subst.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/avx-1.c
gcc/testsuite/gcc.target/i386/avx512f-vscalefsd-1.c
gcc/testsuite/gcc.target/i386/avx512f-vscalefsd-2.c
gcc/testsuite/gcc.target/i386/avx512f-vscalefss-1.c
gcc/testsuite/gcc.target/i386/avx512f-vscalefss-2.c
gcc/testsuite/gcc.target/i386/sse-13.c
gcc/testsuite/gcc.target/i386/sse-23.c

index ac1803e9e4b0a007c586f45375e86a504a962a8e..b29822b0ebd9c47f5a0d0bd62df3d75670ec52a9 100644 (file)
@@ -1,3 +1,26 @@
+2018-02-12  Olga Makhotina  <olga.makhotina@intel.com>
+
+       * config/i386/avx512fintrin.h (_mm_mask_scalef_round_sd,
+       _mm_maskz_scalef_round_sd, _mm_mask_scalef_round_ss,
+       _mm_maskz_scalef_round_ss): New intrinsics.
+       (__builtin_ia32_scalefsd_round, __builtin_ia32_scalefss_round): Fix.
+       * config/i386/i386-builtin.def (__builtin_ia32_scalefsd_round,
+       __builtin_ia32_scalefss_round): Remove.
+       (__builtin_ia32_scalefsd_mask_round,
+       __builtin_ia32_scalefss_mask_round): New intrinsics.
+       * config/i386/sse.md (vmscalef<mode><round_name>): Renamed to ...
+       (vmscalef<mode><mask_scalar_name><round_scalar_name>): ... this.
+       ((match_operand:VF_128 2 "<round_nimm_predicate>"
+       "<round_constraint>")): Changed to ...
+       ((match_operand:VF_128 2 "<round_scalar_nimm_predicate>"
+       "<round_scalar_constraint>")): ... this.
+       ("vscalef<ssescalarmodesuffix>\t{<round_op3>%2, %1, %0|
+       %0, %1, %2<round_op3>}"): Changed to ...
+       ("vscalef<ssescalarmodesuffix>\t{<round_scalar_mask_op3>%2, %1,
+       %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %1,
+       %2<round_scalar_mask_op3>}"): ... this.
+       * config/i386/subst.md (round_scalar_nimm_predicate): New.
+
 2018-02-12  Olga Makhotina  <olga.makhotina@intel.com>
 
        * config/i386/avx512fintrin.h (_mm_mask_sqrt_round_sd)
index ffbb1d9c14cb2aecfe3148b9c65d43f96a6c09ba..ba65acadf8ddad9d6eea786cb37608a878d71f02 100644 (file)
@@ -3103,18 +3103,67 @@ extern __inline __m128d
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm_scalef_round_sd (__m128d __A, __m128d __B, const int __R)
 {
-  return (__m128d) __builtin_ia32_scalefsd_round ((__v2df) __A,
-                                                 (__v2df) __B,
-                                                 __R);
+  return (__m128d) __builtin_ia32_scalefsd_mask_round ((__v2df) __A,
+                                                      (__v2df) __B,
+                                                      (__v2df)
+                                                      _mm_setzero_pd (),
+                                                      (__mmask8) -1, __R);
+}
+
+extern __inline __m128d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_mask_scalef_round_sd (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B,
+                         const int __R)
+{
+  return (__m128d) __builtin_ia32_scalefsd_mask_round ((__v2df) __A,
+                                                      (__v2df) __B,
+                                                      (__v2df) __W,
+                                                      (__mmask8) __U, __R);
+}
+
+extern __inline __m128d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_maskz_scalef_round_sd (__mmask8 __U, __m128d __A, __m128d __B,
+                          const int __R)
+{
+  return (__m128d) __builtin_ia32_scalefsd_mask_round ((__v2df) __A,
+                                                      (__v2df) __B,
+                                                      (__v2df)
+                                                      _mm_setzero_pd (),
+                                                      (__mmask8) __U, __R);
 }
 
 extern __inline __m128
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm_scalef_round_ss (__m128 __A, __m128 __B, const int __R)
 {
-  return (__m128) __builtin_ia32_scalefss_round ((__v4sf) __A,
-                                                (__v4sf) __B,
-                                                __R);
+  return (__m128) __builtin_ia32_scalefss_mask_round ((__v4sf) __A,
+                                                     (__v4sf) __B,
+                                                     (__v4sf)
+                                                     _mm_setzero_ps (),
+                                                     (__mmask8) -1, __R);
+}
+
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_mask_scalef_round_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B,
+                        const int __R)
+{
+  return (__m128) __builtin_ia32_scalefss_mask_round ((__v4sf) __A,
+                                                     (__v4sf) __B,
+                                                     (__v4sf) __W,
+                                                     (__mmask8) __U, __R);
+}
+
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_maskz_scalef_round_ss (__mmask8 __U, __m128 __A, __m128 __B, const int __R)
+{
+  return (__m128) __builtin_ia32_scalefss_mask_round ((__v4sf) __A,
+                                                     (__v4sf) __B,
+                                                     (__v4sf)
+                                                     _mm_setzero_ps (),
+                                                     (__mmask8) __U, __R);
 }
 #else
 #define _mm512_scalef_round_pd(A, B, C)            \
@@ -3136,10 +3185,12 @@ _mm_scalef_round_ss (__m128 __A, __m128 __B, const int __R)
     (__m512)__builtin_ia32_scalefps512_mask(A, B, (__v16sf)_mm512_setzero_ps(), U, C)
 
 #define _mm_scalef_round_sd(A, B, C)            \
-    (__m128d)__builtin_ia32_scalefsd_round(A, B, C)
+    (__m128d)__builtin_ia32_scalefsd_mask_round (A, B, \
+       (__v2df)_mm_setzero_pd (), -1, C)
 
 #define _mm_scalef_round_ss(A, B, C)            \
-    (__m128)__builtin_ia32_scalefss_round(A, B, C)
+    (__m128)__builtin_ia32_scalefss_mask_round (A, B, \
+       (__v4sf)_mm_setzero_ps (), -1, C)
 #endif
 
 #ifdef __OPTIMIZE__
@@ -12182,18 +12233,24 @@ extern __inline __m128d
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm_scalef_sd (__m128d __A, __m128d __B)
 {
-  return (__m128d) __builtin_ia32_scalefsd_round ((__v2df) __A,
-                                                 (__v2df) __B,
-                                                 _MM_FROUND_CUR_DIRECTION);
+  return (__m128d) __builtin_ia32_scalefsd_mask_round ((__v2df) __A,
+                                                   (__v2df) __B,
+                                                   (__v2df)
+                                                   _mm_setzero_pd (),
+                                                   (__mmask8) -1,
+                                                   _MM_FROUND_CUR_DIRECTION);
 }
 
 extern __inline __m128
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm_scalef_ss (__m128 __A, __m128 __B)
 {
-  return (__m128) __builtin_ia32_scalefss_round ((__v4sf) __A,
-                                                (__v4sf) __B,
-                                                _MM_FROUND_CUR_DIRECTION);
+  return (__m128) __builtin_ia32_scalefss_mask_round ((__v4sf) __A,
+                                                  (__v4sf) __B,
+                                                  (__v4sf)
+                                                  _mm_setzero_ps (),
+                                                  (__mmask8) -1,
+                                                  _MM_FROUND_CUR_DIRECTION);
 }
 
 extern __inline __m512d
index 506104221e762fee83f9fa5158fcc6d2dccfc6b8..169189d962c9ec88b04b1fd08fe7adfa30f3c746 100644 (file)
@@ -2718,8 +2718,8 @@ BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_rndscalev2df_round, "__builtin_
 BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_rndscalev4sf_round, "__builtin_ia32_rndscaless_round", IX86_BUILTIN_RNDSCALESS, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF_INT_INT)
 BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_scalefv8df_mask_round, "__builtin_ia32_scalefpd512_mask", IX86_BUILTIN_SCALEFPD512, UNKNOWN, (int) V8DF_FTYPE_V8DF_V8DF_V8DF_UQI_INT)
 BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_scalefv16sf_mask_round, "__builtin_ia32_scalefps512_mask", IX86_BUILTIN_SCALEFPS512, UNKNOWN, (int) V16SF_FTYPE_V16SF_V16SF_V16SF_HI_INT)
-BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_vmscalefv2df_round, "__builtin_ia32_scalefsd_round", IX86_BUILTIN_SCALEFSD, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF_INT)
-BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_vmscalefv4sf_round, "__builtin_ia32_scalefss_round", IX86_BUILTIN_SCALEFSS, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF_INT)
+BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_vmscalefv2df_mask_round, "__builtin_ia32_scalefsd_mask_round", IX86_BUILTIN_SCALEFSD, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF_V2DF_UQI_INT)
+BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_vmscalefv4sf_mask_round, "__builtin_ia32_scalefss_mask_round", IX86_BUILTIN_SCALEFSS, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF_V4SF_UQI_INT)
 BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_sqrtv8df2_mask_round, "__builtin_ia32_sqrtpd512_mask", IX86_BUILTIN_SQRTPD512_MASK, UNKNOWN, (int) V8DF_FTYPE_V8DF_V8DF_QI_INT)
 BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_sqrtv16sf2_mask_round, "__builtin_ia32_sqrtps512_mask", IX86_BUILTIN_SQRTPS512_MASK, UNKNOWN, (int) V16SF_FTYPE_V16SF_V16SF_HI_INT)
 BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_sse2_vmsqrtv2df2_mask_round, "__builtin_ia32_sqrtsd_mask_round", IX86_BUILTIN_SQRTSD_ROUND, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF_V2DF_UQI_INT)
index 47687a614fb2a398e9f7dbd07fb49bed45b22a8e..da9af2367ae4aa7fa4a9781c28e932b39553d987 100644 (file)
   operands[1] = adjust_address (operands[1], DFmode, INTVAL (operands[2]) * 8);
 })
 
-(define_insn "avx512f_vmscalef<mode><round_name>"
+(define_insn "avx512f_vmscalef<mode><mask_scalar_name><round_scalar_name>"
   [(set (match_operand:VF_128 0 "register_operand" "=v")
        (vec_merge:VF_128
          (unspec:VF_128
            [(match_operand:VF_128 1 "register_operand" "v")
-            (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>")]
+            (match_operand:VF_128 2 "<round_scalar_nimm_predicate>" "<round_scalar_constraint>")]
            UNSPEC_SCALEF)
          (match_dup 1)
          (const_int 1)))]
   "TARGET_AVX512F"
-  "vscalef<ssescalarmodesuffix>\t{<round_op3>%2, %1, %0|%0, %1, %2<round_op3>}"
+  "vscalef<ssescalarmodesuffix>\t{<round_scalar_mask_op3>%2, %1, %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %1, %2<round_scalar_mask_op3>}"
   [(set_attr "prefix" "evex")
    (set_attr "mode"  "<ssescalarmode>")])
 
index 9ed2e8dd3d0b22b1039713b5a46680d35931b781..3f638650846fd88ec58207b36dca4f7dd6241d5e 100644 (file)
 (define_subst_attr "round_scalar_mask_op3" "round_scalar" "" "<round_scalar_mask_operand3>")
 (define_subst_attr "round_scalar_constraint" "round_scalar" "vm" "v")
 (define_subst_attr "round_scalar_prefix" "round_scalar" "vex" "evex")
+(define_subst_attr "round_scalar_nimm_predicate" "round_scalar" "vector_operand" "register_operand")
 
 (define_subst "round_scalar"
   [(set (match_operand:SUBST_V 0)
index 9c53f99d3fdc3aba40b1b2330a7743fe8e5565cf..1a76336d0d019bbf126a6b5baf2cf72ea55d3174 100644 (file)
@@ -1,3 +1,22 @@
+2018-02-12  Olga Makhotina  <olga.makhotina@intel.com>
+
+       * gcc.target/i386/avx512f-vscalefsd-1.c (_mm_mask_scalef_round_sd,
+       _mm_maskz_scalef_round_sd): Test new intrinsics.
+       * gcc.target/i386/avx512f-vscalefsd-2.c (_mm_scalef_round_sd,
+       (_mm_mask_scalef_round_sd, _mm_maskz_scalef_round_sd): Test new
+       intrinsics.
+       * gcc.target/i386/avx512f-vscalefss-1.c (_mm_mask_scalef_round_ss,
+       _mm_maskz_scalef_round_ss): Test new intrinsics.
+       * gcc.target/i386/avx512f-vscalefss-2.c (_mm_scalef_round_ss,
+       _mm_mask_scalef_round_ss, _mm_maskz_scalef_round_ss): Test new
+       intrinsics.
+       * gcc.target/i386/avx-1.c (__builtin_ia32_scalefsd_round,
+       __builtin_ia32_scalefss_round): Remove builtin.
+       (__builtin_ia32_scalefsd_mask_round,
+       __builtin_ia32_scalefss_mask_round): Test new builtin.
+       * gcc.target/i386/sse-13.c: Ditto.
+       * gcc.target/i386/sse-23.c: Ditto.
+
 2018-02-12  Olga Makhotina  <olga.makhotina@intel.com>
 
        * gcc.target/i386/avx512f-vsqrtsd-1.c (_mm_mask_sqrt_round_sd)
index acfc85bfaa4c66ccf06fb77d47dd3dc2c0211e9f..c877f9996b31524e7739f992ef5983a6b7d62ab2 100644 (file)
 #define __builtin_ia32_rndscaless_round(A, B, C, D) __builtin_ia32_rndscaless_round(A, B, 1, 4)
 #define __builtin_ia32_scalefpd512_mask(A, B, C, D, E) __builtin_ia32_scalefpd512_mask(A, B, C, D, 8)
 #define __builtin_ia32_scalefps512_mask(A, B, C, D, E) __builtin_ia32_scalefps512_mask(A, B, C, D, 8)
-#define __builtin_ia32_scalefsd_round(A, B, C) __builtin_ia32_scalefsd_round(A, B, 8)
-#define __builtin_ia32_scalefss_round(A, B, C) __builtin_ia32_scalefss_round(A, B, 8)
+#define __builtin_ia32_scalefsd_mask_round(A, B, C, D, E) __builtin_ia32_scalefsd_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_scalefss_mask_round(A, B, C, D, E) __builtin_ia32_scalefss_mask_round(A, B, C, D, 8)
 #define __builtin_ia32_scatterdiv8df(A, B, C, D, F) __builtin_ia32_scatterdiv8df(A, B, C, D, 8)
 #define __builtin_ia32_scatterdiv8di(A, B, C, D, F) __builtin_ia32_scatterdiv8di(A, B, C, D, 8)
 #define __builtin_ia32_scatterdiv16sf(A, B, C, D, F) __builtin_ia32_scatterdiv16sf(A, B, C, D, 8)
index c883192db133f674493df0fe8a120d246188de5f..09bc5c63bb757461808caad3ddb009c4d075f82f 100644 (file)
@@ -1,14 +1,21 @@
 /* { dg-do compile } */
 /* { dg-options "-mavx512f -O2" } */
 /* { dg-final { scan-assembler-times "vscalefsd\[ \\t\]+\[^\n\]*\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vscalefsd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vscalefsd\[ \\t\]+\[^\n\]*\{rd-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vscalefsd\[ \\t\]+\[^\n\]*\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+
 
 #include <immintrin.h>
 
 volatile __m128d x;
+volatile __mmask8 m;
 
 void extern
 avx512f_test (void)
 {
   x = _mm_scalef_sd (x, x);
   x = _mm_scalef_round_sd (x, x, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
+  x = _mm_mask_scalef_round_sd (x, m, x, x, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC);
+  x = _mm_maskz_scalef_round_sd (m, x, x, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
 }
index 28738f7783786bf317be8ca355656be0a7af7825..afe73dc5e83b2db19d97f1db4bd2278db0a9b08e 100644 (file)
@@ -6,6 +6,7 @@
 #include "avx512f-check.h"
 
 #define SIZE (128 / 64)
+#include "avx512f-mask-type.h"
 
 static void
 compute_scalefsd (double *s1, double *s2, double *r)
@@ -17,20 +18,45 @@ compute_scalefsd (double *s1, double *s2, double *r)
 void static
 avx512f_test (void)
 {
-  union128d res1, s1, s2;
+  union128d res1, res2, res3, res4;
+  union128d s1, s2;
   double res_ref[SIZE];
+  MASK_TYPE mask = MASK_VALUE;
   int i;
 
   for (i = 0; i < SIZE; i++)
     {
       s1.a[i] = 11.5 * (i + 1);
       s2.a[i] = 10.5 * (i + 1);
+      res_ref[i] = 9.5 * (i + 1);
+      res1.a[i] = DEFAULT_VALUE;
+      res2.a[i] = DEFAULT_VALUE;
+      res3.a[i] = DEFAULT_VALUE;
+      res4.a[i] = DEFAULT_VALUE;
     }
 
   res1.x = _mm_scalef_sd (s1.x, s2.x);
+  res2.x = _mm_scalef_round_sd (s1.x, s2.x,
+              _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
+  res3.x = _mm_mask_scalef_round_sd (s1.x, mask, s1.x, s2.x,
+              _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
+  res4.x = _mm_maskz_scalef_round_sd (mask, s1.x, s2.x,
+              _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
 
   compute_scalefsd (s1.a, s2.a, res_ref);
 
   if (check_union128d (res1, res_ref))
     abort ();
+  if (check_union128d (res2, res_ref))
+    abort ();
+
+  MASK_MERGE (d) (res_ref, mask, 1);
+
+  if (check_union128d (res3, res_ref))
+    abort ();
+
+  MASK_ZERO (d) (res_ref, mask, 1);
+
+  if (check_union128d (res4, res_ref))
+    abort ();
 }
index f59525f973326fe0485affd4be75997c6de34c23..d1af336c26765c270ecc10e72b765d31fad2e2a5 100644 (file)
@@ -1,14 +1,20 @@
 /* { dg-do compile } */
 /* { dg-options "-mavx512f -O2" } */
 /* { dg-final { scan-assembler-times "vscalefss\[ \\t\]+\[^\n\]*\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vscalefss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vscalefss\[ \\t\]+\[^\n\]*\{ru-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vscalefss\[ \\t\]+\[^\n\]*\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
 
 #include <immintrin.h>
 
 volatile __m128 x;
+volatile __mmask8 m;
 
 void extern
 avx512f_test (void)
 {
   x = _mm_scalef_ss (x, x);
   x = _mm_scalef_round_ss (x, x, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
+  x = _mm_mask_scalef_round_ss (x, m, x, x, _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC);
+  x = _mm_maskz_scalef_round_ss (m, x, x, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
 }
index 935618438a1bd50d2f283dbde252389c0c381090..811ff15e5e6143d240821ef39052e43a943109fc 100644 (file)
@@ -6,6 +6,7 @@
 #include "avx512f-check.h"
 
 #define SIZE (128 / 32)
+#include "avx512f-mask-type.h"
 
 static void
 compute_scalefss (float *s1, float *s2, float *r)
@@ -19,20 +20,45 @@ compute_scalefss (float *s1, float *s2, float *r)
 static void
 avx512f_test (void)
 {
-  union128 res1, s1, s2;
+  union128 res1, res2, res3, res4;
+  union128 s1, s2;
   float res_ref[SIZE];
+  MASK_TYPE mask = MASK_VALUE;
   int i;
 
   for (i = 0; i < SIZE; i++)
     {
       s1.a[i] = 11.5 * (i + 1);
       s2.a[i] = 10.5 * (i + 1);
+      res_ref[i] = 9.5 * (i + 1);
+      res1.a[i] = DEFAULT_VALUE;
+      res2.a[i] = DEFAULT_VALUE;
+      res3.a[i] = DEFAULT_VALUE;
+      res4.a[i] = DEFAULT_VALUE;
     }
 
   res1.x = _mm_scalef_ss (s1.x, s2.x);
+  res2.x = _mm_scalef_round_ss (s1.x, s2.x,
+              _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
+  res3.x = _mm_mask_scalef_round_ss (s1.x, mask, s1.x, s2.x,
+              _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
+  res4.x = _mm_maskz_scalef_round_ss (mask, s1.x, s2.x,
+              _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
 
   compute_scalefss (s1.a, s2.a, res_ref);
 
   if (check_union128 (res1, res_ref))
     abort ();
+  if (check_union128 (res2, res_ref))                                         
+    abort ();
+
+  MASK_MERGE () (res_ref, mask, 1);
+
+  if (check_union128 (res3, res_ref))
+    abort ();
+
+  MASK_ZERO () (res_ref, mask, 1);
+
+  if (check_union128 (res4, res_ref))
+    abort ();
 }
index 7b031998387a971adaf34e9a9d1c1a91b0253947..b43f903086e93cc7f748877ad9725d05ebc0aac5 100644 (file)
 #define __builtin_ia32_rndscaless_round(A, B, C, D) __builtin_ia32_rndscaless_round(A, B, 1, 4)
 #define __builtin_ia32_scalefpd512_mask(A, B, C, D, E) __builtin_ia32_scalefpd512_mask(A, B, C, D, 8)
 #define __builtin_ia32_scalefps512_mask(A, B, C, D, E) __builtin_ia32_scalefps512_mask(A, B, C, D, 8)
-#define __builtin_ia32_scalefsd_round(A, B, C) __builtin_ia32_scalefsd_round(A, B, 8)
-#define __builtin_ia32_scalefss_round(A, B, C) __builtin_ia32_scalefss_round(A, B, 8)
+#define __builtin_ia32_scalefsd_mask_round(A, B, C, D, E) __builtin_ia32_scalefsd_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_scalefss_mask_round(A, B, C, D, E) __builtin_ia32_scalefss_mask_round(A, B, C, D, 8)
 #define __builtin_ia32_scatterdiv8df(A, B, C, D, F) __builtin_ia32_scatterdiv8df(A, B, C, D, 8)
 #define __builtin_ia32_scatterdiv8di(A, B, C, D, F) __builtin_ia32_scatterdiv8di(A, B, C, D, 8)
 #define __builtin_ia32_scatterdiv16sf(A, B, C, D, F) __builtin_ia32_scatterdiv16sf(A, B, C, D, 8)
index 0b18eecf6b9c1507bfddfa664c8786a701ae35f1..8f93d65f5c1518fa238ba9d86c1155bb8a440833 100644 (file)
 #define __builtin_ia32_rndscaless_round(A, B, C, D) __builtin_ia32_rndscaless_round(A, B, 1, 4)
 #define __builtin_ia32_scalefpd512_mask(A, B, C, D, E) __builtin_ia32_scalefpd512_mask(A, B, C, D, 8)
 #define __builtin_ia32_scalefps512_mask(A, B, C, D, E) __builtin_ia32_scalefps512_mask(A, B, C, D, 8)
-#define __builtin_ia32_scalefsd_round(A, B, C) __builtin_ia32_scalefsd_round(A, B, 8)
-#define __builtin_ia32_scalefss_round(A, B, C) __builtin_ia32_scalefss_round(A, B, 8)
+#define __builtin_ia32_scalefsd_mask_round(A, B, C, D, E) __builtin_ia32_scalefsd_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_scalefss_mask_round(A, B, C, D, E) __builtin_ia32_scalefss_mask_round(A, B, C, D, 8)
 #define __builtin_ia32_scatterdiv8df(A, B, C, D, F) __builtin_ia32_scatterdiv8df(A, B, C, D, 8)
 #define __builtin_ia32_scatterdiv8di(A, B, C, D, F) __builtin_ia32_scatterdiv8di(A, B, C, D, 8)
 #define __builtin_ia32_scatterdiv16sf(A, B, C, D, F) __builtin_ia32_scatterdiv16sf(A, B, C, D, 8)