Index: lib/Headers/avx512fintrin.h =================================================================== --- lib/Headers/avx512fintrin.h +++ lib/Headers/avx512fintrin.h @@ -343,6 +343,66 @@ return __builtin_shufflevector(__a, __a, 0, 1, 2, 3); } +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_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_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)_mm512_extracti32x4_epi32((__m512i)__A, 0); +} + +static __inline__ __m256d __DEFAULT_FN_ATTRS +_mm512_castpd512_pd256 (__m512d __A) +{ + return _mm512_extractf64x4_pd(__A, 0); +} + +static __inline__ __m256 __DEFAULT_FN_ATTRS +_mm512_castps512_ps256 (__m512 __A) +{ + return (__m256)_mm512_extractf64x4_pd((__m512d)__A, 0); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm512_castsi512_si256 (__m512i __A) +{ + return (__m256i)_mm512_extractf64x4_pd((__m512d)__A, 0); +} + /* Bitwise operators */ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_and_epi32(__m512i __a, __m512i __b) Index: test/CodeGen/avx512f-builtins.c =================================================================== --- test/CodeGen/avx512f-builtins.c +++ test/CodeGen/avx512f-builtins.c @@ -166,6 +166,76 @@ return _mm512_castpd256_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); +} + +__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); +} + +__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_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); +} + +__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: @llvm.x86.avx512.mask.vextracti32x4.512 + return _mm512_castsi512_si128 (__A); +} + +__m256d test_mm512_castpd512_pd256 (__m512d __A) +{ + // CHECK-LABEL: @test_mm512_castpd512_pd256 + // CHECK: @llvm.x86.avx512.mask.vextractf64x4.512 + return _mm512_castpd512_pd256 (__A); +} + +__m256 test_mm512_castps512_ps256 (__m512 __A) +{ + // CHECK-LABEL: @test_mm512_castps512_ps256 + // CHECK: @llvm.x86.avx512.mask.vextractf64x4.512 + return _mm512_castps512_ps256 (__A); +} + +__m256i test_mm512_castsi512_si256 (__m512i __A) +{ + // CHECK-LABEL: @test_mm512_castsi512_si256 + // CHECK: @llvm.x86.avx512.mask.vextractf64x4.512 + return _mm512_castsi512_si256 (__A); +} + __mmask16 test_mm512_knot(__mmask16 a) { // CHECK-LABEL: @test_mm512_knot