r242986 - [X86][AVX512BW] add madd and maddubs intrinsics

Asaf Badouh asaf.badouh at intel.com
Thu Jul 23 00:07:25 PDT 2015


Author: abadouh
Date: Thu Jul 23 02:07:25 2015
New Revision: 242986

URL: http://llvm.org/viewvc/llvm-project?rev=242986&view=rev
Log:
[X86][AVX512BW] add madd and maddubs intrinsics

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

Modified:
    cfe/trunk/include/clang/Basic/BuiltinsX86.def
    cfe/trunk/lib/Headers/avx512bwintrin.h
    cfe/trunk/test/CodeGen/avx512bw-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=242986&r1=242985&r2=242986&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Thu Jul 23 02:07:25 2015
@@ -1228,4 +1228,7 @@ BUILTIN(__builtin_ia32_mulpd512_mask, "V
 BUILTIN(__builtin_ia32_mulps512_mask, "V16fV16fV16fV16fUsIi", "")
 BUILTIN(__builtin_ia32_subpd512_mask, "V8dV8dV8dV8dUcIi", "")
 BUILTIN(__builtin_ia32_subps512_mask, "V16fV16fV16fV16fUsIi", "")
+BUILTIN(__builtin_ia32_pmaddubsw512_mask, "V32sV64cV64cV32sUi", "")
+BUILTIN(__builtin_ia32_pmaddwd512_mask, "V16iV32sV32sV16iUs", "")
+
 #undef BUILTIN

Modified: cfe/trunk/lib/Headers/avx512bwintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bwintrin.h?rev=242986&r1=242985&r2=242986&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avx512bwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512bwintrin.h Thu Jul 23 02:07:25 2015
@@ -1294,6 +1294,60 @@ _mm512_maskz_mulhi_epu16 (__mmask32 __U,
                (__mmask32) __U);
 }
 
+static __inline__ __m512i __attribute__((__always_inline__, __nodebug__))
+_mm512_maddubs_epi16 (__m512i __X, __m512i __Y) {
+  return (__m512i) __builtin_ia32_pmaddubsw512_mask ((__v64qi) __X,
+                 (__v64qi) __Y,
+                 (__v32hi)
+                 _mm512_setzero_hi (),
+                 (__mmask32) -1);
+}
+
+static __inline__ __m512i __attribute__((__always_inline__, __nodebug__))
+_mm512_mask_maddubs_epi16 (__m512i __W, __mmask32 __U, __m512i __X,
+         __m512i __Y) {
+  return (__m512i) __builtin_ia32_pmaddubsw512_mask ((__v64qi) __X,
+                 (__v64qi) __Y,
+                 (__v32hi) __W,
+                 (__mmask32) __U);
+}
+
+static __inline__ __m512i __attribute__((__always_inline__, __nodebug__))
+_mm512_maskz_maddubs_epi16 (__mmask32 __U, __m512i __X, __m512i __Y) {
+  return (__m512i) __builtin_ia32_pmaddubsw512_mask ((__v64qi) __X,
+                 (__v64qi) __Y,
+                 (__v32hi)
+                 _mm512_setzero_hi (),
+                 (__mmask32) __U);
+}
+
+static __inline__ __m512i __attribute__((__always_inline__, __nodebug__))
+_mm512_madd_epi16 (__m512i __A, __m512i __B) {
+  return (__m512i) __builtin_ia32_pmaddwd512_mask ((__v32hi) __A,
+               (__v32hi) __B,
+               (__v16si)
+               _mm512_setzero_si512 (),
+               (__mmask16) -1);
+}
+
+static __inline__ __m512i __attribute__((__always_inline__, __nodebug__))
+_mm512_mask_madd_epi16 (__m512i __W, __mmask16 __U, __m512i __A,
+      __m512i __B) {
+  return (__m512i) __builtin_ia32_pmaddwd512_mask ((__v32hi) __A,
+               (__v32hi) __B,
+               (__v16si) __W,
+               (__mmask16) __U);
+}
+
+static __inline__ __m512i __attribute__((__always_inline__, __nodebug__))
+_mm512_maskz_madd_epi16 (__mmask16 __U, __m512i __A, __m512i __B) {
+  return (__m512i) __builtin_ia32_pmaddwd512_mask ((__v32hi) __A,
+               (__v32hi) __B,
+               (__v16si)
+               _mm512_setzero_si512 (),
+               (__mmask16) __U);
+}
+
 #define _mm512_cmp_epi8_mask(a, b, p) __extension__ ({ \
   (__mmask16)__builtin_ia32_cmpb512_mask((__v64qi)(__m512i)(a), \
                                          (__v64qi)(__m512i)(b), \

Modified: cfe/trunk/test/CodeGen/avx512bw-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512bw-builtins.c?rev=242986&r1=242985&r2=242986&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/avx512bw-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512bw-builtins.c Thu Jul 23 02:07:25 2015
@@ -880,3 +880,33 @@ __m512i test_mm512_maskz_mulhi_epu16(__m
   return _mm512_maskz_mulhi_epu16(__U,__A,__B); 
 }
 
+__m512i test_mm512_maddubs_epi16(__m512i __X, __m512i __Y) {
+  // CHECK-LABEL: @test_mm512_maddubs_epi16
+  // CHECK: @llvm.x86.avx512.mask.pmaddubs.w.512
+  return _mm512_maddubs_epi16(__X,__Y); 
+}
+__m512i test_mm512_mask_maddubs_epi16(__m512i __W, __mmask32 __U, __m512i __X,         __m512i __Y) {
+  // CHECK-LABEL: @test_mm512_mask_maddubs_epi16
+  // CHECK: @llvm.x86.avx512.mask.pmaddubs.w.512
+  return _mm512_mask_maddubs_epi16(__W,__U,__X,__Y); 
+}
+__m512i test_mm512_maskz_maddubs_epi16(__mmask32 __U, __m512i __X, __m512i __Y) {
+  // CHECK-LABEL: @test_mm512_maskz_maddubs_epi16
+  // CHECK: @llvm.x86.avx512.mask.pmaddubs.w.512
+  return _mm512_maskz_maddubs_epi16(__U,__X,__Y); 
+}
+__m512i test_mm512_madd_epi16(__m512i __A, __m512i __B) {
+  // CHECK-LABEL: @test_mm512_madd_epi16
+  // CHECK: @llvm.x86.avx512.mask.pmaddw.d.512
+  return _mm512_madd_epi16(__A,__B); 
+}
+__m512i test_mm512_mask_madd_epi16(__m512i __W, __mmask16 __U, __m512i __A,      __m512i __B) {
+  // CHECK-LABEL: @test_mm512_mask_madd_epi16
+  // CHECK: @llvm.x86.avx512.mask.pmaddw.d.512
+  return _mm512_mask_madd_epi16(__W,__U,__A,__B); 
+}
+__m512i test_mm512_maskz_madd_epi16(__mmask16 __U, __m512i __A, __m512i __B) {
+  // CHECK-LABEL: @test_mm512_maskz_madd_epi16
+  // CHECK: @llvm.x86.avx512.mask.pmaddw.d.512
+  return _mm512_maskz_madd_epi16(__U,__A,__B); 
+}





More information about the cfe-commits mailing list