Author: mzuckerm
Date: Wed Jun  1 03:34:03 2016
New Revision: 271373

URL: http://llvm.org/viewvc/llvm-project?rev=271373&view=rev
Log:
[Clang][Intrinsics][avx512] Adding round intrinsics fot max/min/sqrt 
instruction set to clang

Differential Revision: http://reviews.llvm.org/D20812

Modified:
    cfe/trunk/lib/Headers/avx512fintrin.h
    cfe/trunk/test/CodeGen/avx512f-builtins.c

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=271373&r1=271372&r2=271373&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Wed Jun  1 03:34:03 2016
@@ -813,6 +813,29 @@ _mm512_maskz_sub_epi32 (__mmask16 __U, _
              (__mmask16) __U);
 }
 
+#define _mm512_mask_max_round_pd( __W, __U, __A, __B, __R) __extension__ ({ \
+__builtin_ia32_maxpd512_mask ((__v8df)( __A),\
+            (__v8df)( __B),\
+            (__v8df)( __W),\
+            (__mmask8)( __U),( __R));\
+})
+
+#define _mm512_maskz_max_round_pd( __U, __A, __B, __R) __extension__ ({ \
+__builtin_ia32_maxpd512_mask ((__v8df)( __A),\
+            (__v8df)( __B),\
+            (__v8df)\
+            _mm512_setzero_pd (),\
+            (__mmask8)( __U),( __R));\
+})
+
+#define _mm512_max_round_pd( __A, __B, __R) __extension__ ({ \
+__builtin_ia32_maxpd512_mask ((__v8df)( __A),\
+            (__v8df)( __B),\
+            (__v8df)\
+            _mm512_undefined_pd (),\
+            (__mmask8) -1,( __R));\
+})
+
 static  __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_max_pd(__m512d __A, __m512d __B)
 {
@@ -845,6 +868,29 @@ _mm512_maskz_max_pd (__mmask8 __U, __m51
                   _MM_FROUND_CUR_DIRECTION);
 }
 
+#define _mm512_mask_max_round_ps( __W, __U, __A, __B, __R) __extension__ ({ \
+__builtin_ia32_maxps512_mask ((__v16sf)( __A),\
+           (__v16sf)( __B),\
+           (__v16sf)( __W),\
+           (__mmask16)( __U),( __R));\
+})
+
+#define _mm512_maskz_max_round_ps( __U, __A, __B, __R) __extension__ ({ \
+__builtin_ia32_maxps512_mask ((__v16sf)( __A),\
+           (__v16sf)( __B),\
+           (__v16sf)\
+           _mm512_setzero_ps (),\
+           (__mmask16)( __U),( __R));\
+})
+
+#define _mm512_max_round_ps( __A, __B, __R) __extension__ ({ \
+__builtin_ia32_maxps512_mask ((__v16sf)( __A),\
+           (__v16sf)( __B),\
+           (__v16sf)\
+           _mm512_undefined_ps (),\
+           (__mmask16) -1,( __R));\
+})
+
 static  __inline__ __m512 __DEFAULT_FN_ATTRS
 _mm512_max_ps(__m512 __A, __m512 __B)
 {
@@ -1062,6 +1108,29 @@ _mm512_maskz_max_epu64 (__mmask8 __M, __
                    __M);
 }
 
+#define _mm512_mask_min_round_pd( __W, __U, __A, __B, __R) __extension__ ({ \
+__builtin_ia32_minpd512_mask ((__v8df)( __A),\
+            (__v8df)( __B),\
+            (__v8df)( __W),\
+            (__mmask8)( __U),( __R));\
+})
+
+#define _mm512_maskz_min_round_pd( __U, __A, __B, __R) __extension__ ({ \
+__builtin_ia32_minpd512_mask ((__v8df)( __A),\
+            (__v8df)( __B),\
+            (__v8df)\
+            _mm512_setzero_pd (),\
+            (__mmask8)( __U),( __R));\
+})
+
+#define _mm512_min_round_pd( __A, __B, __R) __extension__ ({ \
+__builtin_ia32_minpd512_mask ((__v8df)( __A),\
+            (__v8df)( __B),\
+            (__v8df)\
+            _mm512_undefined_pd (),\
+            (__mmask8) -1,( __R));\
+})
+
 static  __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_min_pd(__m512d __A, __m512d __B)
 {
@@ -1083,6 +1152,29 @@ _mm512_mask_min_pd (__m512d __W, __mmask
                   _MM_FROUND_CUR_DIRECTION);
 }
 
+#define _mm512_mask_min_round_ps( __W, __U, __A, __B, __R) __extension__ ({ \
+__builtin_ia32_minps512_mask ((__v16sf)( __A),\
+           (__v16sf)( __B),\
+           (__v16sf)( __W),\
+           (__mmask16)( __U),( __R));\
+})
+
+#define _mm512_maskz_min_round_ps( __U, __A, __B, __R) __extension__ ({ \
+__builtin_ia32_minps512_mask ((__v16sf)( __A),\
+           (__v16sf)( __B),\
+           (__v16sf)\
+           _mm512_setzero_ps (),\
+           (__mmask16)( __U),( __R));\
+})
+
+#define _mm512_min_round_ps( __A, __B, __R) __extension__ ({ \
+__builtin_ia32_minps512_mask ((__v16sf)( __A),\
+           (__v16sf)( __B),\
+           (__v16sf)\
+           _mm512_undefined_ps (),\
+           (__mmask16) -1,( __R));\
+})
+
 static __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_maskz_min_pd (__mmask8 __U, __m512d __A, __m512d __B)
 {
@@ -1391,6 +1483,26 @@ _mm512_mask_mullo_epi32 (__m512i __W, __
               (__v16si) __W, __M);
 }
 
+#define _mm512_mask_sqrt_round_pd( __W, __U, __A, __R) __extension__ ({ \
+__builtin_ia32_sqrtpd512_mask ((__v8df)( __A),\
+             (__v8df)( __W),\
+             (__mmask8)( __U),( __R));\
+})
+
+#define _mm512_maskz_sqrt_round_pd( __U, __A, __R) __extension__ ({ \
+__builtin_ia32_sqrtpd512_mask ((__v8df)( __A),\
+             (__v8df)\
+             _mm512_setzero_pd (),\
+             (__mmask8)( __U),( __R));\
+})
+
+#define _mm512_sqrt_round_pd( __A, __R) __extension__ ({ \
+__builtin_ia32_sqrtpd512_mask ((__v8df)( __A),\
+             (__v8df)\
+             _mm512_undefined_pd (),\
+             (__mmask8) -1,( __R));\
+})
+
 static  __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_sqrt_pd(__m512d __a)
 {
@@ -1419,6 +1531,26 @@ _mm512_maskz_sqrt_pd (__mmask8 __U, __m5
                    _MM_FROUND_CUR_DIRECTION);
 }
 
+#define _mm512_mask_sqrt_round_ps( __W, __U, __A, __R) __extension__ ({ \
+__builtin_ia32_sqrtps512_mask ((__v16sf)( __A),\
+            (__v16sf)( __W),\
+            (__mmask16)( __U),( __R));\
+})
+
+#define _mm512_maskz_sqrt_round_ps( __U, __A, __R) __extension__ ({ \
+__builtin_ia32_sqrtps512_mask ((__v16sf)( __A),\
+            (__v16sf)\
+            _mm512_setzero_ps (),\
+            (__mmask16)( __U),( __R));\
+})
+
+#define _mm512_sqrt_round_ps( __A, __R) __extension__ ({ \
+__builtin_ia32_sqrtps512_mask ((__v16sf)( __A),\
+            (__v16sf)\
+            _mm512_undefined_ps (),\
+            (__mmask16) -1,( __R));\
+})
+
 static  __inline__ __m512 __DEFAULT_FN_ATTRS
 _mm512_sqrt_ps(__m512 __a)
 {
@@ -1679,7 +1811,6 @@ _mm512_mask_floor_ps (__m512 __W, __mmas
                    _MM_FROUND_CUR_DIRECTION);
 }
 
-
 static __inline __m512d __DEFAULT_FN_ATTRS
 _mm512_floor_pd(__m512d __A)
 {
@@ -1698,7 +1829,6 @@ _mm512_mask_floor_pd (__m512d __W, __mma
                 _MM_FROUND_CUR_DIRECTION);
 }
 
-
 static __inline__ __m512 __DEFAULT_FN_ATTRS
 _mm512_mask_ceil_ps (__m512 __W, __mmask16 __U, __m512 __A)
 {
@@ -3679,8 +3809,7 @@ _mm512_maskz_cvtpd_ps (__mmask8 __U, __m
   (__m256i)__builtin_ia32_vcvtps2ph512_mask((__v16sf)(__m512)(A), (int)(I), \
                                             (__v16hi)_mm256_setzero_si256(), \
                                             (__mmask16)(W)); })
-
-
+                   
 static  __inline __m512 __DEFAULT_FN_ATTRS
 _mm512_cvtph_ps(__m256i __A)
 {

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=271373&r1=271372&r2=271373&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Wed Jun  1 03:34:03 2016
@@ -26,6 +26,27 @@ __m512d test_mm512_maskz_sqrt_pd (__mmas
   return _mm512_maskz_sqrt_pd (__U,__A);
 }
 
+__m512d test_mm512_mask_sqrt_round_pd(__m512d __W,__mmask8 __U,__m512d __A)
+{
+  // CHECK-LABEL: @test_mm512_mask_sqrt_round_pd
+  // CHECK: @llvm.x86.avx512.mask.sqrt.pd.512
+  return _mm512_mask_sqrt_round_pd(__W,__U,__A,_MM_FROUND_CUR_DIRECTION);
+}
+
+__m512d test_mm512_maskz_sqrt_round_pd(__mmask8 __U,__m512d __A)
+{
+  // CHECK-LABEL: @test_mm512_maskz_sqrt_round_pd
+  // CHECK: @llvm.x86.avx512.mask.sqrt.pd.512
+  return _mm512_maskz_sqrt_round_pd(__U,__A,_MM_FROUND_CUR_DIRECTION);
+}
+
+__m512d test_mm512_sqrt_round_pd(__m512d __A)
+{
+  // CHECK-LABEL: @test_mm512_sqrt_round_pd
+  // CHECK: @llvm.x86.avx512.mask.sqrt.pd.512
+  return _mm512_sqrt_round_pd(__A,_MM_FROUND_CUR_DIRECTION);
+}
+
 __m512 test_mm512_sqrt_ps(__m512 a)
 {
   // CHECK-LABEL: @test_mm512_sqrt_ps
@@ -47,6 +68,27 @@ __m512 test_mm512_maskz_sqrt_ps( __mmask
   return _mm512_maskz_sqrt_ps(__U ,__A);
 }
 
+__m512 test_mm512_mask_sqrt_round_ps(__m512 __W,__mmask16 __U,__m512 __A)
+{
+  // CHECK-LABEL: @test_mm512_mask_sqrt_round_ps
+  // CHECK: @llvm.x86.avx512.mask.sqrt.ps.512
+  return _mm512_mask_sqrt_round_ps(__W,__U,__A,_MM_FROUND_CUR_DIRECTION);
+}
+
+__m512 test_mm512_maskz_sqrt_round_ps(__mmask16 __U,__m512 __A)
+{
+  // CHECK-LABEL: @test_mm512_maskz_sqrt_round_ps
+  // CHECK: @llvm.x86.avx512.mask.sqrt.ps.512
+  return _mm512_maskz_sqrt_round_ps(__U,__A,_MM_FROUND_CUR_DIRECTION);
+}
+
+__m512 test_mm512_sqrt_round_ps(__m512 __A)
+{
+  // CHECK-LABEL: @test_mm512_sqrt_round_ps
+  // CHECK: @llvm.x86.avx512.mask.sqrt.ps.512
+  return _mm512_sqrt_round_ps(__A,_MM_FROUND_CUR_DIRECTION);
+}
+
 __m512d test_mm512_rsqrt14_pd(__m512d a)
 {
   // CHECK-LABEL: @test_mm512_rsqrt14_pd
@@ -6576,6 +6618,27 @@ __m512 test_mm512_mask_max_ps (__m512 __
   return _mm512_mask_max_ps (__W,__U,__A,__B);
 }
 
+__m512d test_mm512_mask_max_round_pd(__m512d __W,__mmask8 __U,__m512d 
__A,__m512d __B)
+{
+  // CHECK-LABEL: @test_mm512_mask_max_round_pd
+  // CHECK: @llvm.x86.avx512.mask.max.pd.512
+  return _mm512_mask_max_round_pd(__W,__U,__A,__B,_MM_FROUND_CUR_DIRECTION);
+}
+
+__m512d test_mm512_maskz_max_round_pd(__mmask8 __U,__m512d __A,__m512d __B)
+{
+  // CHECK-LABEL: @test_mm512_maskz_max_round_pd
+  // CHECK: @llvm.x86.avx512.mask.max.pd.512
+  return _mm512_maskz_max_round_pd(__U,__A,__B,_MM_FROUND_CUR_DIRECTION);
+}
+
+__m512d test_mm512_max_round_pd(__m512d __A,__m512d __B)
+{
+  // CHECK-LABEL: @test_mm512_max_round_pd
+  // CHECK: @llvm.x86.avx512.mask.max.pd.512
+  return _mm512_max_round_pd(__A,__B,_MM_FROUND_CUR_DIRECTION);
+}
+
 __m512 test_mm512_maskz_max_ps (__mmask16 __U, __m512 __A, __m512 __B)
 {
   // CHECK-LABEL: @test_mm512_maskz_max_ps 
@@ -6583,6 +6646,27 @@ __m512 test_mm512_maskz_max_ps (__mmask1
   return _mm512_maskz_max_ps (__U,__A,__B);
 }
 
+__m512 test_mm512_mask_max_round_ps(__m512 __W,__mmask16 __U,__m512 __A,__m512 
__B)
+{
+  // CHECK-LABEL: @test_mm512_mask_max_round_ps
+  // CHECK: @llvm.x86.avx512.mask.max.ps.512
+  return _mm512_mask_max_round_ps(__W,__U,__A,__B,_MM_FROUND_CUR_DIRECTION);
+}
+
+__m512 test_mm512_maskz_max_round_ps(__mmask16 __U,__m512 __A,__m512 __B)
+{
+  // CHECK-LABEL: @test_mm512_maskz_max_round_ps
+  // CHECK: @llvm.x86.avx512.mask.max.ps.512
+  return _mm512_maskz_max_round_ps(__U,__A,__B,_MM_FROUND_CUR_DIRECTION);
+}
+
+__m512 test_mm512_max_round_ps(__m512 __A,__m512 __B)
+{
+  // CHECK-LABEL: @test_mm512_max_round_ps
+  // CHECK: @llvm.x86.avx512.mask.max.ps.512
+  return _mm512_max_round_ps(__A,__B,_MM_FROUND_CUR_DIRECTION);
+}
+
 __m512d test_mm512_mask_min_pd (__m512d __W, __mmask8 __U, __m512d __A, 
__m512d __B)
 {
   // CHECK-LABEL: @test_mm512_mask_min_pd 
@@ -6597,6 +6681,27 @@ __m512d test_mm512_maskz_min_pd (__mmask
   return _mm512_maskz_min_pd (__U,__A,__B);
 }
 
+__m512d test_mm512_mask_min_round_pd(__m512d __W,__mmask8 __U,__m512d 
__A,__m512d __B)
+{
+  // CHECK-LABEL: @test_mm512_mask_min_round_pd
+  // CHECK: @llvm.x86.avx512.mask.min.pd.512
+  return _mm512_mask_min_round_pd(__W,__U,__A,__B,_MM_FROUND_CUR_DIRECTION);
+}
+
+__m512d test_mm512_maskz_min_round_pd(__mmask8 __U,__m512d __A,__m512d __B)
+{
+  // CHECK-LABEL: @test_mm512_maskz_min_round_pd
+  // CHECK: @llvm.x86.avx512.mask.min.pd.512
+  return _mm512_maskz_min_round_pd(__U,__A,__B,_MM_FROUND_CUR_DIRECTION);
+}
+
+__m512d test_mm512_min_round_pd( __m512d __A,__m512d __B)
+{
+  // CHECK-LABEL: @test_mm512_min_round_pd
+  // CHECK: @llvm.x86.avx512.mask.min.pd.512
+  return _mm512_min_round_pd(__A,__B,_MM_FROUND_CUR_DIRECTION);
+}
+
 __m512 test_mm512_mask_min_ps (__m512 __W, __mmask16 __U, __m512 __A, __m512 
__B)
 {
   // CHECK-LABEL: @test_mm512_mask_min_ps 
@@ -6611,6 +6716,27 @@ __m512 test_mm512_maskz_min_ps (__mmask1
   return _mm512_maskz_min_ps (__U,__A,__B);
 }
 
+__m512 test_mm512_mask_min_round_ps(__m512 __W,__mmask16 __U,__m512 __A,__m512 
__B)
+{
+  // CHECK-LABEL: @test_mm512_mask_min_round_ps
+  // CHECK: @llvm.x86.avx512.mask.min.ps.512
+  return _mm512_mask_min_round_ps(__W,__U,__A,__B,_MM_FROUND_CUR_DIRECTION);
+}
+
+__m512 test_mm512_maskz_min_round_ps(__mmask16 __U,__m512 __A,__m512 __B)
+{
+  // CHECK-LABEL: @test_mm512_maskz_min_round_ps
+  // CHECK: @llvm.x86.avx512.mask.min.ps.512
+  return _mm512_maskz_min_round_ps(__U,__A,__B,_MM_FROUND_CUR_DIRECTION);
+}
+
+__m512 test_mm512_min_round_ps(__m512 __A,__m512 __B)
+{
+  // CHECK-LABEL: @test_mm512_min_round_ps
+  // CHECK: @llvm.x86.avx512.mask.min.ps.512
+  return _mm512_min_round_ps(__A,__B,_MM_FROUND_CUR_DIRECTION);
+}
+
 __m512 test_mm512_mask_floor_ps (__m512 __W, __mmask16 __U, __m512 __A)
 {
   // CHECK-LABEL: @test_mm512_mask_floor_ps 


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to