Index: lib/Headers/avx2intrin.h =================================================================== --- lib/Headers/avx2intrin.h +++ lib/Headers/avx2intrin.h @@ -760,7 +760,7 @@ static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_broadcastss_ps(__m128 __X) { - return (__m128)__builtin_ia32_vbroadcastss_ps((__v4sf)__X); + return (__m128)__builtin_shufflevector((__v4sf)__X, (__v4sf)__X, 0, 0, 0, 0); } static __inline__ __m128d __DEFAULT_FN_ATTRS @@ -772,13 +772,13 @@ static __inline__ __m256 __DEFAULT_FN_ATTRS _mm256_broadcastss_ps(__m128 __X) { - return (__m256)__builtin_ia32_vbroadcastss_ps256((__v4sf)__X); + return (__m256)__builtin_shufflevector((__v4sf)__X, (__v4sf)__X, 0, 0, 0, 0, 0, 0, 0, 0); } static __inline__ __m256d __DEFAULT_FN_ATTRS _mm256_broadcastsd_pd(__m128d __X) { - return (__m256d)__builtin_ia32_vbroadcastsd_pd256((__v2df)__X); + return (__m256d)__builtin_shufflevector((__v2df)__X, (__v2df)__X, 0, 0, 0, 0); } static __inline__ __m256i __DEFAULT_FN_ATTRS @@ -812,50 +812,50 @@ static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_broadcastb_epi8(__m128i __X) { - return (__m256i)__builtin_ia32_pbroadcastb256((__v16qi)__X); + return (__m256i)__builtin_shufflevector((__v16qi)__X, (__v16qi)__X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); } static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_broadcastw_epi16(__m128i __X) { - return (__m256i)__builtin_ia32_pbroadcastw256((__v8hi)__X); + return (__m256i)__builtin_shufflevector((__v8hi)__X, (__v8hi)__X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); } static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_broadcastd_epi32(__m128i __X) { - return (__m256i)__builtin_ia32_pbroadcastd256((__v4si)__X); + return (__m256i)__builtin_shufflevector((__v4si)__X, (__v4si)__X, 0, 0, 0, 0, 0, 0, 0, 0); } static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_broadcastq_epi64(__m128i __X) { - return (__m256i)__builtin_ia32_pbroadcastq256(__X); + return (__m256i)__builtin_shufflevector(__X, __X, 0, 0, 0, 0); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_broadcastb_epi8(__m128i __X) { - return (__m128i)__builtin_ia32_pbroadcastb128((__v16qi)__X); + return (__m128i)__builtin_shufflevector((__v16qi)__X, (__v16qi)__X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_broadcastw_epi16(__m128i __X) { - return (__m128i)__builtin_ia32_pbroadcastw128((__v8hi)__X); + return (__m128i)__builtin_shufflevector((__v8hi)__X, (__v8hi)__X, 0, 0, 0, 0, 0, 0, 0, 0); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_broadcastd_epi32(__m128i __X) { - return (__m128i)__builtin_ia32_pbroadcastd128((__v4si)__X); + return (__m128i)__builtin_shufflevector((__v4si)__X, (__v4si)__X, 0, 0, 0, 0); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_broadcastq_epi64(__m128i __X) { - return (__m128i)__builtin_ia32_pbroadcastq128(__X); + return (__m128i)__builtin_shufflevector(__X, __X, 0, 0); } static __inline__ __m256i __DEFAULT_FN_ATTRS Index: test/CodeGen/avx2-builtins.c =================================================================== --- test/CodeGen/avx2-builtins.c +++ test/CodeGen/avx2-builtins.c @@ -607,7 +607,9 @@ } __m128 test_mm_broadcastss_ps(__m128 a) { - // CHECK: @llvm.x86.avx2.vbroadcast.ss.ps + // CHECK-LABEL: test_mm_broadcastss_ps + // CHECK-NOT: @llvm.x86.avx2.vbroadcast.ss.ps + // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> zeroinitializer return _mm_broadcastss_ps(a); } @@ -617,12 +619,16 @@ } __m256 test_mm256_broadcastss_ps(__m128 a) { - // CHECK: @llvm.x86.avx2.vbroadcast.ss.ps.256 + // CHECK-LABEL: test_mm256_broadcastss_ps + // CHECK-NOT: @llvm.x86.avx2.vbroadcast.ss.ps.256 + // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <8 x i32> zeroinitializer return _mm256_broadcastss_ps(a); } __m256d test_mm256_broadcastsd_pd(__m128d a) { - // check: @llvm.x86.avx2.vbroadcast.sd.pd.256 + // CHECK-LABEL: test_mm256_broadcastsd_pd + // CHECK-NOT: @llvm.x86.avx2.vbroadcast.sd.pd.256 + // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <4 x i32> zeroinitializer return _mm256_broadcastsd_pd(a); } @@ -646,42 +652,58 @@ } __m256i test_mm256_broadcastb_epi8(__m128i a) { - // CHECK: @llvm.x86.avx2.pbroadcastb.256 + // CHECK-LABEL: test_mm256_broadcastb_epi8 + // CHECK-NOT: @llvm.x86.avx2.pbroadcastb.256 + // CHECK: shufflevector <16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <32 x i32> zeroinitializer return _mm256_broadcastb_epi8(a); } __m256i test_mm256_broadcastw_epi16(__m128i a) { - // CHECK: @llvm.x86.avx2.pbroadcastw.256 + // CHECK-LABEL: test_mm256_broadcastw_epi16 + // CHECK-NOT: @llvm.x86.avx2.pbroadcastw.256 + // CHECK: shufflevector <8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <16 x i32> zeroinitializer return _mm256_broadcastw_epi16(a); } __m256i test_mm256_broadcastd_epi32(__m128i a) { - // CHECK: @llvm.x86.avx2.pbroadcastd.256 + // CHECK-LABEL: test_mm256_broadcastd_epi32 + // CHECK-NOT: @llvm.x86.avx2.pbroadcastd.256 + // CHECK: shufflevector <4 x i32> %{{.*}}, <4 x i32> %{{.*}}, <8 x i32> zeroinitializer return _mm256_broadcastd_epi32(a); } __m256i test_mm256_broadcastq_epi64(__m128i a) { - // CHECK: @llvm.x86.avx2.pbroadcastq.256 + // CHECK-LABEL: test_mm256_broadcastq_epi64 + // CHECK-NOT: @llvm.x86.avx2.pbroadcastq.256 + // CHECK: shufflevector <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <4 x i32> zeroinitializer return _mm256_broadcastq_epi64(a); } __m128i test_mm_broadcastb_epi8(__m128i a) { - // CHECK: @llvm.x86.avx2.pbroadcastb.128 + // CHECK-LABEL: test_mm_broadcastb_epi8 + // CHECK-NOT: @llvm.x86.avx2.pbroadcastb.128 + // CHECK: shufflevector <16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <16 x i32> zeroinitializer return _mm_broadcastb_epi8(a); } __m128i test_mm_broadcastw_epi16(__m128i a) { - // CHECK: @llvm.x86.avx2.pbroadcastw.128 + // CHECK-LABEL: test_mm_broadcastw_epi16 + // CHECK-NOT: @llvm.x86.avx2.pbroadcastw.128 + // CHECK: shufflevector <8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <8 x i32> zeroinitializer return _mm_broadcastw_epi16(a); } __m128i test_mm_broadcastd_epi32(__m128i a) { - // CHECK: @llvm.x86.avx2.pbroadcastd.128 + // CHECK-LABEL: test_mm_broadcastd_epi32 + // CHECK-NOT: @llvm.x86.avx2.pbroadcastd.128 + // CHECK: shufflevector <4 x i32> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> zeroinitializer return _mm_broadcastd_epi32(a); } __m128i test_mm_broadcastq_epi64(__m128i a) { - // CHECK: @llvm.x86.avx2.pbroadcastq.128 + // CHECK-LABEL: test_mm_broadcastq_epi64 + // CHECK-NOT: @llvm.x86.avx2.pbroadcastq.128 + // CHECK: shufflevector <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i32> zeroinitializer return _mm_broadcastq_epi64(a); }