Bruno Cardoso Lopes | 3f7eb9a | 2011-08-24 01:35:04 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature +avx -emit-llvm -o - | FileCheck %s |
| 2 | |
| 3 | // Don't include mm_malloc.h, it's system specific. |
| 4 | #define __MM_MALLOC_H |
| 5 | |
| 6 | #include <immintrin.h> |
| 7 | |
| 8 | // |
| 9 | // Test LLVM IR codegen of shuffle instructions |
| 10 | // |
| 11 | |
| 12 | __m256 x(__m256 a, __m256 b) { |
| 13 | // Check if the mask is correct |
| 14 | // CHECK: shufflevector{{.*}}<i32 3, i32 2, i32 8, i32 11, i32 7, i32 6, i32 12, i32 15> |
| 15 | return _mm256_shuffle_ps(a, b, 203); |
| 16 | } |
Craig Topper | 10c57a8 | 2012-02-08 05:16:54 +0000 | [diff] [blame] | 17 | |
| 18 | __m128d test_mm_permute_pd(__m128d a) { |
| 19 | // Check if the mask is correct |
| 20 | // CHECK: shufflevector{{.*}}<i32 1, i32 0> |
| 21 | return _mm_permute_pd(a, 1); |
| 22 | } |
| 23 | |
| 24 | __m256d test_mm256_permute_pd(__m256d a) { |
| 25 | // Check if the mask is correct |
| 26 | // CHECK: shufflevector{{.*}}<i32 1, i32 0, i32 3, i32 2> |
| 27 | return _mm256_permute_pd(a, 5); |
| 28 | } |
| 29 | |
| 30 | __m128 test_mm_permute_ps(__m128 a) { |
| 31 | // Check if the mask is correct |
| 32 | // CHECK: shufflevector{{.*}}<i32 3, i32 2, i32 1, i32 0> |
| 33 | return _mm_permute_ps(a, 0x1b); |
| 34 | } |
| 35 | |
| 36 | __m256 test_mm256_permute_ps(__m256 a) { |
| 37 | // Check if the mask is correct |
| 38 | // CHECK: shufflevector{{.*}}<i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4> |
| 39 | return _mm256_permute_ps(a, 0x1b); |
| 40 | } |
Craig Topper | cfa8e65 | 2012-02-08 07:33:36 +0000 | [diff] [blame] | 41 | |
| 42 | __m256d test_mm256_permute2f128_pd(__m256d a, __m256d b) { |
| 43 | // Check if the mask is correct |
| 44 | // CHECK: shufflevector{{.*}}<i32 2, i32 3, i32 6, i32 7> |
| 45 | return _mm256_permute2f128_pd(a, b, 0x31); |
| 46 | } |
| 47 | |
| 48 | __m256 test_mm256_permute2f128_ps(__m256 a, __m256 b) { |
| 49 | // Check if the mask is correct |
| 50 | // CHECK: shufflevector{{.*}}<i32 12, i32 13, i32 14, i32 15, i32 4, i32 5, i32 6, i32 7> |
| 51 | return _mm256_permute2f128_ps(a, b, 0x13); |
| 52 | } |
| 53 | |
| 54 | __m256i test_mm256_permute2f128_si256(__m256i a, __m256i b) { |
| 55 | // Check if the mask is correct |
| 56 | // CHECK: shufflevector{{.*}}<i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11> |
| 57 | return _mm256_permute2f128_si256(a, b, 0x20); |
| 58 | } |