From: Adam Nemet Date: Mon, 28 Jul 2014 17:14:42 +0000 (+0000) Subject: [AVX512] Add FP add/sub/mul intrinsics X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=264c7d4996ab068ca043f8b050f79c61caf064a8;p=clang [AVX512] Add FP add/sub/mul intrinsics Part of git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214098 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Headers/avx512fintrin.h b/lib/Headers/avx512fintrin.h index 9ea5da9e34..785d5281bc 100644 --- a/lib/Headers/avx512fintrin.h +++ b/lib/Headers/avx512fintrin.h @@ -93,6 +93,42 @@ _mm512_setzero_pd(void) /* Arithmetic */ +static __inline __m512d __attribute__((__always_inline__, __nodebug__)) +_mm512_add_pd(__m512d __a, __m512d __b) +{ + return __a + __b; +} + +static __inline __m512 __attribute__((__always_inline__, __nodebug__)) +_mm512_add_ps(__m512 __a, __m512 __b) +{ + return __a + __b; +} + +static __inline __m512d __attribute__((__always_inline__, __nodebug__)) +_mm512_mul_pd(__m512d __a, __m512d __b) +{ + return __a * __b; +} + +static __inline __m512 __attribute__((__always_inline__, __nodebug__)) +_mm512_mul_ps(__m512 __a, __m512 __b) +{ + return __a * __b; +} + +static __inline __m512d __attribute__((__always_inline__, __nodebug__)) +_mm512_sub_pd(__m512d __a, __m512d __b) +{ + return __a - __b; +} + +static __inline __m512 __attribute__((__always_inline__, __nodebug__)) +_mm512_sub_ps(__m512 __a, __m512 __b) +{ + return __a - __b; +} + static __inline__ __m512d __attribute__((__always_inline__, __nodebug__)) _mm512_max_pd(__m512d __A, __m512d __B) { diff --git a/test/CodeGen/avx512f-builtins.c b/test/CodeGen/avx512f-builtins.c index e58a89a97c..968c015c87 100644 --- a/test/CodeGen/avx512f-builtins.c +++ b/test/CodeGen/avx512f-builtins.c @@ -32,3 +32,31 @@ __m512 test_mm512_rsqrt14_ps(__m512 a) // CHECK: @llvm.x86.avx512.rsqrt14.ps.512 return _mm512_rsqrt14_ps(a); } + +__m512 test_mm512_add_ps(__m512 a, __m512 b) +{ + // CHECK-LABEL: @test_mm512_add_ps + // CHECK: fadd <16 x float> + return _mm512_add_ps(a, b); +} + +__m512d test_mm512_add_pd(__m512d a, __m512d b) +{ + // CHECK-LABEL: @test_mm512_add_pd + // CHECK: fadd <8 x double> + return _mm512_add_pd(a, b); +} + +__m512 test_mm512_mul_ps(__m512 a, __m512 b) +{ + // CHECK-LABEL: @test_mm512_mul_ps + // CHECK: fmul <16 x float> + return _mm512_mul_ps(a, b); +} + +__m512d test_mm512_mul_pd(__m512d a, __m512d b) +{ + // CHECK-LABEL: @test_mm512_mul_pd + // CHECK: fmul <8 x double> + return _mm512_mul_pd(a, b); +}