Index: lib/Headers/avxintrin.h =================================================================== --- lib/Headers/avxintrin.h +++ lib/Headers/avxintrin.h @@ -1270,4 +1270,36 @@ __builtin_ia32_storedqu((char *)__addr_hi, (__v16qi)__v128); } +static __inline __m256 __attribute__((__always_inline__, __nodebug__)) +_mm256_set_m128 (__m128 __hi, __m128 __lo) { + __m256 __hi256 = _mm256_castps128_ps256(__hi); + __m256 __lo256 = _mm256_castps128_ps256(__lo); + return __builtin_shufflevector(__lo256, __hi256, 0, 1, 2, 3, 8, 9, 10, 11); +} + +static __inline __m256d __attribute__((__always_inline__, __nodebug__)) +_mm256_set_m128d (__m128d __hi, __m128d __lo) { + return (__m256d)_mm256_set_m128((__m128)__hi, (__m128)__lo); +} + +static __inline __m256i __attribute__((__always_inline__, __nodebug__)) +_mm256_set_m128i (__m128i __hi, __m128i __lo) { + return (__m256i)_mm256_set_m128((__m128)__hi, (__m128)__lo); +} + +static __inline __m256 __attribute__((__always_inline__, __nodebug__)) +_mm256_setr_m128 (__m128 __lo, __m128 __hi) { + return _mm256_set_m128(__hi, __lo); +} + +static __inline __m256d __attribute__((__always_inline__, __nodebug__)) +_mm256_setr_m128d (__m128d __lo, __m128d __hi) { + return (__m256d)_mm256_set_m128((__m128)__hi, (__m128)__lo); +} + +static __inline __m256i __attribute__((__always_inline__, __nodebug__)) +_mm256_setr_m128i (__m128i __lo, __m128i __hi) { + return (__m256i)_mm256_set_m128((__m128)__hi, (__m128)__lo); +} + #endif /* __AVXINTRIN_H */ Index: test/CodeGen/avx-shuffle-builtins.c =================================================================== --- test/CodeGen/avx-shuffle-builtins.c +++ test/CodeGen/avx-shuffle-builtins.c @@ -174,3 +174,50 @@ return _mm256_extractf128_si256(a, 1); } +__m256 test_mm256_set_m128(__m128 hi, __m128 lo) { + // CHECK-LABEL: @test_mm256_set_m128 + // CHECK: shufflevector{{.*}} + // CHECK: shufflevector{{.*}} + // CHECK: shufflevector{{.*}} + return _mm256_set_m128(hi, lo); +} + +__m256d test_mm256_set_m128d(__m128d hi, __m128d lo) { + // CHECK-LABEL: @test_mm256_set_m128d + // CHECK: shufflevector{{.*}} + // CHECK: shufflevector{{.*}} + // CHECK: shufflevector{{.*}} + return _mm256_set_m128d(hi, lo); +} + +__m256i test_mm256_set_m128i(__m128i hi, __m128i lo) { + // CHECK-LABEL: @test_mm256_set_m128i + // CHECK: shufflevector{{.*}} + // CHECK: shufflevector{{.*}} + // CHECK: shufflevector{{.*}} + return _mm256_set_m128i(hi, lo); +} + +__m256 test_mm256_setr_m128(__m128 hi, __m128 lo) { + // CHECK-LABEL: @test_mm256_setr_m128 + // CHECK: shufflevector{{.*}} + // CHECK: shufflevector{{.*}} + // CHECK: shufflevector{{.*}} + return _mm256_setr_m128(lo, hi); +} + +__m256d test_mm256_setr_m128d(__m128d hi, __m128d lo) { + // CHECK-LABEL: @test_mm256_setr_m128d + // CHECK: shufflevector{{.*}} + // CHECK: shufflevector{{.*}} + // CHECK: shufflevector{{.*}} + return _mm256_setr_m128d(lo, hi); +} + +__m256i test_mm256_setr_m128i(__m128i hi, __m128i lo) { + // CHECK-LABEL: @test_mm256_setr_m128i + // CHECK: shufflevector{{.*}} + // CHECK: shufflevector{{.*}} + // CHECK: shufflevector{{.*}} + return _mm256_setr_m128i(lo, hi); +}