r270699 - [Clang][AVX512][BUILTIN] Add missing intrinsics for cast
Michael Zuckerman via cfe-commits
cfe-commits at lists.llvm.org
Wed May 25 07:04:21 PDT 2016
Author: mzuckerm
Date: Wed May 25 09:04:21 2016
New Revision: 270699
URL: http://llvm.org/viewvc/llvm-project?rev=270699&view=rev
Log:
[Clang][AVX512][BUILTIN] Add missing intrinsics for cast
Differential Revision: http://reviews.llvm.org/D20523
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=270699&r1=270698&r2=270699&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Wed May 25 09:04:21 2016
@@ -337,12 +337,35 @@ _mm512_castpd512_pd128(__m512d __a)
return __builtin_shufflevector(__a, __a, 0, 1);
}
+static __inline __m256d __DEFAULT_FN_ATTRS
+_mm512_castpd512_pd256 (__m512d __A)
+{
+ return __builtin_shufflevector(__A, __A, 0, 1, 2, 3);
+}
+
static __inline __m128 __DEFAULT_FN_ATTRS
_mm512_castps512_ps128(__m512 __a)
{
return __builtin_shufflevector(__a, __a, 0, 1, 2, 3);
}
+static __inline __m256 __DEFAULT_FN_ATTRS
+_mm512_castps512_ps256 (__m512 __A)
+{
+ return __builtin_shufflevector(__A, __A, 0, 1, 2, 3, 4, 5, 6, 7);
+}
+
+static __inline __m512 __DEFAULT_FN_ATTRS
+_mm512_castpd_ps (__m512d __A)
+{
+ return (__m512) (__A);
+}
+
+static __inline __m512i __DEFAULT_FN_ATTRS
+_mm512_castpd_si512 (__m512d __A)
+{
+ return (__m512i) (__A);
+}
static __inline__ __m512d __DEFAULT_FN_ATTRS
_mm512_castpd128_pd512 (__m128d __A)
@@ -350,6 +373,18 @@ _mm512_castpd128_pd512 (__m128d __A)
return __builtin_shufflevector( __A, __A, 0, 1, -1, -1, -1, -1, -1, -1);
}
+static __inline __m512d __DEFAULT_FN_ATTRS
+_mm512_castps_pd (__m512 __A)
+{
+ return (__m512d) (__A);
+}
+
+static __inline __m512i __DEFAULT_FN_ATTRS
+_mm512_castps_si512 (__m512 __A)
+{
+ return (__m512i) (__A);
+}
+
static __inline__ __m512 __DEFAULT_FN_ATTRS
_mm512_castps128_ps512 (__m128 __A)
{
@@ -368,6 +403,24 @@ _mm512_castsi256_si512 (__m256i __A)
return __builtin_shufflevector( __A, __A, 0, 1, 2, 3, -1, -1, -1, -1);
}
+static __inline __m512 __DEFAULT_FN_ATTRS
+_mm512_castsi512_ps (__m512i __A)
+{
+ return (__m512) (__A);
+}
+
+static __inline __m512d __DEFAULT_FN_ATTRS
+_mm512_castsi512_pd (__m512i __A)
+{
+ return (__m512d) (__A);
+}
+
+static __inline __m128i __DEFAULT_FN_ATTRS
+_mm512_castsi512_si128 (__m512i __A)
+{
+ return (__m128i)__builtin_shufflevector(__A, __A , 0, 1);
+}
+
/* Bitwise operators */
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_and_epi32(__m512i __a, __m512i __b)
Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=270699&r1=270698&r2=270699&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Wed May 25 09:04:21 2016
@@ -328,13 +328,6 @@ __m512d test_mm512_set1_pd(double d)
return _mm512_set1_pd(d);
}
-__m512d test_mm512_castpd256_pd512(__m256d a)
-{
- // CHECK-LABEL: @test_mm512_castpd256_pd512
- // CHECK: shufflevector <4 x double> {{.*}} <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
- return _mm512_castpd256_pd512(a);
-}
-
__mmask16 test_mm512_knot(__mmask16 a)
{
// CHECK-LABEL: @test_mm512_knot
@@ -5925,10 +5918,25 @@ __m256i test_mm512_maskz_cvttpd_epu32(__
return _mm512_maskz_cvttpd_epu32(__U, __A);
}
-__m512d test_mm512_castpd128_pd512(__m128d __A) {
- // CHECK-LABEL: @test_mm512_castpd128_pd512
- // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- return _mm512_castpd128_pd512(__A);
+__m512 test_mm512_castpd_ps (__m512d __A)
+{
+ // CHECK-LABEL: @test_mm512_castpd_ps
+ // CHECK: bitcast <8 x double> %1 to <16 x float>
+ return _mm512_castpd_ps (__A);
+}
+
+__m512d test_mm512_castps_pd (__m512 __A)
+{
+ // CHECK-LABEL: @test_mm512_castps_pd
+ // CHECK: bitcast <16 x float> %1 to <8 x double>
+ return _mm512_castps_pd (__A);
+}
+
+__m512i test_mm512_castpd_si512 (__m512d __A)
+{
+ // CHECK-LABEL: @test_mm512_castpd_si512
+ // CHECK: bitcast <8 x double> %1 to <8 x i64>
+ return _mm512_castpd_si512 (__A);
}
__m512 test_mm512_castps128_ps512(__m128 __A) {
@@ -5937,6 +5945,39 @@ __m512 test_mm512_castps128_ps512(__m128
return _mm512_castps128_ps512(__A);
}
+__m512d test_mm512_castpd128_pd512(__m128d __A) {
+ // CHECK-LABEL: @test_mm512_castpd128_pd512
+ // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
+ return _mm512_castpd128_pd512(__A);
+}
+
+__m512d test_mm512_castpd256_pd512(__m256d a)
+{
+ // CHECK-LABEL: @test_mm512_castpd256_pd512
+ // CHECK: shufflevector <4 x double> {{.*}} <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
+ return _mm512_castpd256_pd512(a);
+}
+
+__m256d test_mm512_castpd512_pd256 (__m512d __A)
+{
+ // CHECK-LABEL: @test_mm512_castpd512_pd256
+ // CHECK: shufflevector <8 x double> %1, <8 x double> %2, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
+ return _mm512_castpd512_pd256 (__A);
+}
+
+__m256 test_mm512_castps512_ps256 (__m512 __A)
+{
+ // CHECK-LABEL: @test_mm512_castps512_ps256
+ // CHECK: shufflevector <16 x float> %1, <16 x float> %2, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+ return _mm512_castps512_ps256 (__A);
+}
+
+__m512i test_mm512_castps_si512 (__m512 __A)
+{
+ // CHECK-LABEL: @test_mm512_castps_si512
+ // CHECK: bitcast <16 x float> %1 to <8 x i64>
+ return _mm512_castps_si512 (__A);
+}
__m512i test_mm512_castsi128_si512(__m128i __A) {
// CHECK-LABEL: @test_mm512_castsi128_si512
// CHECK: shufflevector <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
@@ -5949,6 +5990,26 @@ __m512i test_mm512_castsi256_si512(__m25
return _mm512_castsi256_si512(__A);
}
+__m512 test_mm512_castsi512_ps (__m512i __A)
+{
+ // CHECK-LABEL: @test_mm512_castsi512_ps
+ // CHECK: bitcast <8 x i64> %1 to <16 x float>
+ return _mm512_castsi512_ps (__A);
+}
+
+__m512d test_mm512_castsi512_pd (__m512i __A)
+{
+ // CHECK-LABEL: @test_mm512_castsi512_pd
+ // CHECK: bitcast <8 x i64> %1 to <8 x double>
+ return _mm512_castsi512_pd (__A);
+}
+
+__m128i test_mm512_castsi512_si128 (__m512i __A)
+{
+ // CHECK-LABEL: @test_mm512_castsi512_si128
+ // CHECK: shufflevector <8 x i64> %1, <8 x i64> %2, <2 x i32> <i32 0, i32 1>
+ return _mm512_castsi512_si128 (__A);
+}
__m128 test_mm_cvt_roundsd_ss(__m128 __A, __m128d __B) {
// CHECK-LABEL: @test_mm_cvt_roundsd_ss
More information about the cfe-commits
mailing list