| 1 |
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X64 |
| 2 |
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X64 |
| 3 |
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK |
| 4 |
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK |
| 5 |
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X64 |
| 6 |
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X64 |
| 7 |
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK |
| 8 |
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK |
| 9 |
|
| 10 |
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK,X64 |
| 11 |
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK,X64 |
| 12 |
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK |
| 13 |
// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK |
| 14 |
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK,X64 |
| 15 |
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK,X64 |
| 16 |
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK |
| 17 |
// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s --check-prefixes=CHECK |
| 18 |
|
| 19 |
|
| 20 |
#include <immintrin.h> |
| 21 |
#include "builtin_test_helpers.h" |
| 22 |
|
| 23 |
// NOTE: This should match the tests in llvm/test/CodeGen/X86/sse41-intrinsics-fast-isel.ll |
| 24 |
|
| 25 |
__m128i test_mm_blend_epi16(__m128i V1, __m128i V2) { |
| 26 |
// CHECK-LABEL: test_mm_blend_epi16 |
| 27 |
// CHECK: shufflevector <8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <8 x i32> <i32 0, i32 9, i32 2, i32 11, i32 4, i32 13, i32 6, i32 7> |
| 28 |
return _mm_blend_epi16(V1, V2, 42); |
| 29 |
} |
| 30 |
TEST_CONSTEXPR(match_v8hi(_mm_blend_epi16(((__m128i)(__v8hi){1,2,3,4,5,6,7,8}),((__m128i)(__v8hi){-1,-2,-3,-4,-5,-6,-7,-8}),0x00),1,2,3,4,5,6,7,8)); |
| 31 |
TEST_CONSTEXPR(match_v8hi(_mm_blend_epi16(((__m128i)(__v8hi){1,2,3,4,5,6,7,8}),((__m128i)(__v8hi){-1,-2,-3,-4,-5,-6,-7,-8}),0x5A),1,-2,3,-4,-5,6,-7,8)); |
| 32 |
TEST_CONSTEXPR(match_v8hi(_mm_blend_epi16(((__m128i)(__v8hi){1,2,3,4,5,6,7,8}),((__m128i)(__v8hi){-1,-2,-3,-4,-5,-6,-7,-8}),0x94),1,2,-3,4,-5,6,7,-8)); |
| 33 |
TEST_CONSTEXPR(match_v8hi(_mm_blend_epi16(((__m128i)(__v8hi){1,2,3,4,5,6,7,8}),((__m128i)(__v8hi){-1,-2,-3,-4,-5,-6,-7,-8}),0xFF),-1,-2,-3,-4,-5,-6,-7,-8)); |
| 34 |
|
| 35 |
__m128d test_mm_blend_pd(__m128d V1, __m128d V2) { |
| 36 |
// CHECK-LABEL: test_mm_blend_pd |
| 37 |
// CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x i32> <i32 0, i32 3> |
| 38 |
return _mm_blend_pd(V1, V2, 2); |
| 39 |
} |
| 40 |
TEST_CONSTEXPR(match_m128d(_mm_blend_pd(((__m128d){1.0, 2.0}), ((__m128d){3.0, 4.0}), 0), 1.0, 2.0)); |
| 41 |
TEST_CONSTEXPR(match_m128d(_mm_blend_pd(((__m128d){1.0, 2.0}), ((__m128d){3.0, 4.0}), 1), 3.0, 2.0)); |
| 42 |
TEST_CONSTEXPR(match_m128d(_mm_blend_pd(((__m128d){1.0, 2.0}), ((__m128d){3.0, 4.0}), 2), 1.0, 4.0)); |
| 43 |
TEST_CONSTEXPR(match_m128d(_mm_blend_pd(((__m128d){1.0, 2.0}), ((__m128d){3.0, 4.0}), 3), 3.0, 4.0)); |
| 44 |
|
| 45 |
__m128 test_mm_blend_ps(__m128 V1, __m128 V2) { |
| 46 |
// CHECK-LABEL: test_mm_blend_ps |
| 47 |
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 0, i32 5, i32 6, i32 3> |
| 48 |
return _mm_blend_ps(V1, V2, 6); |
| 49 |
} |
| 50 |
TEST_CONSTEXPR(match_m128(_mm_blend_ps(((__m128){1.0f, 2.0f, 3.0f, 4.0f}), ((__m128){5.0f, 6.0f, 7.0f, 8.0f}), 0x0), 1.0f, 2.0f, 3.0f, 4.0f)); |
| 51 |
TEST_CONSTEXPR(match_m128(_mm_blend_ps(((__m128){1.0f, 2.0f, 3.0f, 4.0f}), ((__m128){5.0f, 6.0f, 7.0f, 8.0f}), 0x5), 5.0f, 2.0f, 7.0f, 4.0f)); |
| 52 |
TEST_CONSTEXPR(match_m128(_mm_blend_ps(((__m128){1.0f, 2.0f, 3.0f, 4.0f}), ((__m128){5.0f, 6.0f, 7.0f, 8.0f}), 0xA), 1.0f, 6.0f, 3.0f, 8.0f)); |
| 53 |
TEST_CONSTEXPR(match_m128(_mm_blend_ps(((__m128){1.0f, 2.0f, 3.0f, 4.0f}), ((__m128){5.0f, 6.0f, 7.0f, 8.0f}), 0xF), 5.0f, 6.0f, 7.0f, 8.0f)); |
| 54 |
|
| 55 |
__m128i test_mm_blendv_epi8(__m128i V1, __m128i V2, __m128i V3) { |
| 56 |
// CHECK-LABEL: test_mm_blendv_epi8 |
| 57 |
// CHECK: call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <16 x i8> %{{.*}}) |
| 58 |
return _mm_blendv_epi8(V1, V2, V3); |
| 59 |
} |
| 60 |
TEST_CONSTEXPR(match_v16qi(_mm_blendv_epi8((__m128i)(__v16qs){0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},(__m128i)(__v16qs){-99,-98,97,-96,-95,-94,-93,-92,-91,-90,-89,-88,-87,-86,-85,-84},(__m128i)(__v16qs){-1,-1,0,-1,0,0,0,0,0,-1,-1,-1,0,0,-1,0}), -99, -98, 2, -96, 4, 5, 6, 7, 8, -90, -89, -88, 12, 13, -85, 15)); |
| 61 |
|
| 62 |
__m128d test_mm_blendv_pd(__m128d V1, __m128d V2, __m128d V3) { |
| 63 |
// CHECK-LABEL: test_mm_blendv_pd |
| 64 |
// CHECK: call {{.*}}<2 x double> @llvm.x86.sse41.blendvpd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}}) |
| 65 |
return _mm_blendv_pd(V1, V2, V3); |
| 66 |
} |
| 67 |
TEST_CONSTEXPR(match_m128d(_mm_blendv_pd((__m128d)(__v2df){2.0, -4.0},(__m128d)(__v2df){-111.0, +222.0},(__m128d)(__v2df){2.0, -2.0}), 2.0, 222.0)); |
| 68 |
|
| 69 |
__m128 test_mm_blendv_ps(__m128 V1, __m128 V2, __m128 V3) { |
| 70 |
// CHECK-LABEL: test_mm_blendv_ps |
| 71 |
// CHECK: call {{.*}}<4 x float> @llvm.x86.sse41.blendvps(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 72 |
return _mm_blendv_ps(V1, V2, V3); |
| 73 |
} |
| 74 |
TEST_CONSTEXPR(match_m128(_mm_blendv_ps((__m128)(__v4sf){0.0f, 1.0f, 2.0f, 3.0f},(__m128)(__v4sf){-100.0f, -101.0f, -102.0f, -103.0f},(__m128)(__v4sf){-1.0f, 2.0f, -3.0f, 0.0f}), -100.0f, 1.0f, -102.0f, 3.0f)); |
| 75 |
|
| 76 |
__m128d test_mm_ceil_pd(__m128d x) { |
| 77 |
// CHECK-LABEL: test_mm_ceil_pd |
| 78 |
// CHECK %{{.*}} = call <2 x double> @llvm.ceil.v2f64(<2 x double> %{{.*}}) |
| 79 |
return _mm_ceil_pd(x); |
| 80 |
} |
| 81 |
|
| 82 |
__m128 test_mm_ceil_ps(__m128 x) { |
| 83 |
// CHECK-LABEL: test_mm_ceil_ps |
| 84 |
// CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> %{{.*}}, i32 2) |
| 85 |
return _mm_ceil_ps(x); |
| 86 |
} |
| 87 |
|
| 88 |
__m128d test_mm_ceil_sd(__m128d x, __m128d y) { |
| 89 |
// CHECK-LABEL: test_mm_ceil_sd |
| 90 |
// CHECK: call {{.*}}<2 x double> @llvm.x86.sse41.round.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 2) |
| 91 |
return _mm_ceil_sd(x, y); |
| 92 |
} |
| 93 |
|
| 94 |
__m128 test_mm_ceil_ss(__m128 x, __m128 y) { |
| 95 |
// CHECK-LABEL: test_mm_ceil_ss |
| 96 |
// CHECK: call {{.*}}<4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 2) |
| 97 |
return _mm_ceil_ss(x, y); |
| 98 |
} |
| 99 |
|
| 100 |
__m128i test_mm_cmpeq_epi64(__m128i A, __m128i B) { |
| 101 |
// CHECK-LABEL: test_mm_cmpeq_epi64 |
| 102 |
// CHECK: icmp eq <2 x i64> |
| 103 |
// CHECK: sext <2 x i1> %{{.*}} to <2 x i64> |
| 104 |
return _mm_cmpeq_epi64(A, B); |
| 105 |
} |
| 106 |
TEST_CONSTEXPR(match_v2di(_mm_cmpeq_epi64((__m128i)(__v2di){+1, -8}, (__m128i)(__v2di){-10, -8}), 0, -1)); |
| 107 |
|
| 108 |
__m128i test_mm_cvtepi8_epi16(__m128i a) { |
| 109 |
// CHECK-LABEL: test_mm_cvtepi8_epi16 |
| 110 |
// CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 111 |
// CHECK: sext <8 x i8> {{.*}} to <8 x i16> |
| 112 |
return _mm_cvtepi8_epi16(a); |
| 113 |
} |
| 114 |
|
| 115 |
TEST_CONSTEXPR(match_v8hi(_mm_cvtepi8_epi16(_mm_setr_epi8(-3, 2, -1, 0, 1, -2, 3, -4, 0, 0, 0, 0, 0, 0, 0, 0)), -3, 2, -1, 0, 1, -2, 3, -4)); |
| 116 |
|
| 117 |
__m128i test_mm_cvtepi8_epi32(__m128i a) { |
| 118 |
// CHECK-LABEL: test_mm_cvtepi8_epi32 |
| 119 |
// CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <4 x i32> <i32 0, i32 1, i32 2, i32 3> |
| 120 |
// CHECK: sext <4 x i8> {{.*}} to <4 x i32> |
| 121 |
return _mm_cvtepi8_epi32(a); |
| 122 |
} |
| 123 |
|
| 124 |
TEST_CONSTEXPR(match_v4si(_mm_cvtepi8_epi32(_mm_setr_epi8(-3, 2, -1, 0, 1, -2, 3, -4, 0, 0, 0, 0, 0, 0, 0, 0)), -3, 2, -1, 0)); |
| 125 |
|
| 126 |
__m128i test_mm_cvtepi8_epi64(__m128i a) { |
| 127 |
// CHECK-LABEL: test_mm_cvtepi8_epi64 |
| 128 |
// CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <2 x i32> <i32 0, i32 1> |
| 129 |
// CHECK: sext <2 x i8> {{.*}} to <2 x i64> |
| 130 |
return _mm_cvtepi8_epi64(a); |
| 131 |
} |
| 132 |
|
| 133 |
TEST_CONSTEXPR(match_v2di(_mm_cvtepi8_epi64(_mm_setr_epi8(-3, 2, -1, 0, 1, -2, 3, -4, 0, 0, 0, 0, 0, 0, 0, 0)), -3, 2)); |
| 134 |
|
| 135 |
__m128i test_mm_cvtepi16_epi32(__m128i a) { |
| 136 |
// CHECK-LABEL: test_mm_cvtepi16_epi32 |
| 137 |
// CHECK: shufflevector <8 x i16> {{.*}}, <8 x i16> {{.*}}, <4 x i32> <i32 0, i32 1, i32 2, i32 3> |
| 138 |
// CHECK: sext <4 x i16> {{.*}} to <4 x i32> |
| 139 |
return _mm_cvtepi16_epi32(a); |
| 140 |
} |
| 141 |
|
| 142 |
TEST_CONSTEXPR(match_v4si(_mm_cvtepi16_epi32(_mm_setr_epi16(-300, 2, -1, 0, 1, -2, 3, -4)), -300, 2, -1, 0)); |
| 143 |
|
| 144 |
__m128i test_mm_cvtepi16_epi64(__m128i a) { |
| 145 |
// CHECK-LABEL: test_mm_cvtepi16_epi64 |
| 146 |
// CHECK: shufflevector <8 x i16> {{.*}}, <8 x i16> {{.*}}, <2 x i32> <i32 0, i32 1> |
| 147 |
// CHECK: sext <2 x i16> {{.*}} to <2 x i64> |
| 148 |
return _mm_cvtepi16_epi64(a); |
| 149 |
} |
| 150 |
|
| 151 |
TEST_CONSTEXPR(match_v2di(_mm_cvtepi16_epi64(_mm_setr_epi16(-300, 2, -1, 0, 1, -2, 3, -4)), -300, 2)); |
| 152 |
|
| 153 |
__m128i test_mm_cvtepi32_epi64(__m128i a) { |
| 154 |
// CHECK-LABEL: test_mm_cvtepi32_epi64 |
| 155 |
// CHECK: shufflevector <4 x i32> {{.*}}, <4 x i32> {{.*}}, <2 x i32> <i32 0, i32 1> |
| 156 |
// CHECK: sext <2 x i32> {{.*}} to <2 x i64> |
| 157 |
return _mm_cvtepi32_epi64(a); |
| 158 |
} |
| 159 |
|
| 160 |
TEST_CONSTEXPR(match_v2di(_mm_cvtepi32_epi64(_mm_setr_epi32(-70000, 2, -1, 0)), -70000, 2)); |
| 161 |
|
| 162 |
__m128i test_mm_cvtepu8_epi16(__m128i a) { |
| 163 |
// CHECK-LABEL: test_mm_cvtepu8_epi16 |
| 164 |
// CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 165 |
// CHECK: zext <8 x i8> {{.*}} to <8 x i16> |
| 166 |
return _mm_cvtepu8_epi16(a); |
| 167 |
} |
| 168 |
|
| 169 |
TEST_CONSTEXPR(match_v8hi(_mm_cvtepu8_epi16(_mm_setr_epi8(-3, 2, -1, 0, 1, -2, 3, -4, 0, 0, 0, 0, 0, 0, 0, 0)), 253, 2, 255, 0, 1, 254, 3, 252)); |
| 170 |
|
| 171 |
__m128i test_mm_cvtepu8_epi32(__m128i a) { |
| 172 |
// CHECK-LABEL: test_mm_cvtepu8_epi32 |
| 173 |
// CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <4 x i32> <i32 0, i32 1, i32 2, i32 3> |
| 174 |
// CHECK: zext <4 x i8> {{.*}} to <4 x i32> |
| 175 |
return _mm_cvtepu8_epi32(a); |
| 176 |
} |
| 177 |
|
| 178 |
TEST_CONSTEXPR(match_v4si(_mm_cvtepu8_epi32(_mm_setr_epi8(-3, 2, -1, 0, 1, -2, 3, -4, 0, 0, 0, 0, 0, 0, 0, 0)), 253, 2, 255, 0)); |
| 179 |
|
| 180 |
__m128i test_mm_cvtepu8_epi64(__m128i a) { |
| 181 |
// CHECK-LABEL: test_mm_cvtepu8_epi64 |
| 182 |
// CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <2 x i32> <i32 0, i32 1> |
| 183 |
// CHECK: zext <2 x i8> {{.*}} to <2 x i64> |
| 184 |
return _mm_cvtepu8_epi64(a); |
| 185 |
} |
| 186 |
|
| 187 |
TEST_CONSTEXPR(match_v2di(_mm_cvtepu8_epi64(_mm_setr_epi8(-3, 2, -1, 0, 1, -2, 3, -4, 0, 0, 0, 0, 0, 0, 0, 0)), 253, 2)); |
| 188 |
|
| 189 |
__m128i test_mm_cvtepu16_epi32(__m128i a) { |
| 190 |
// CHECK-LABEL: test_mm_cvtepu16_epi32 |
| 191 |
// CHECK: shufflevector <8 x i16> {{.*}}, <8 x i16> {{.*}}, <4 x i32> <i32 0, i32 1, i32 2, i32 3> |
| 192 |
// CHECK: zext <4 x i16> {{.*}} to <4 x i32> |
| 193 |
return _mm_cvtepu16_epi32(a); |
| 194 |
} |
| 195 |
|
| 196 |
TEST_CONSTEXPR(match_v4si(_mm_cvtepu16_epi32(_mm_setr_epi16(-300, 2, -1, 0, 1, -2, 3, -4)), 65236, 2, 65535, 0)); |
| 197 |
|
| 198 |
__m128i test_mm_cvtepu16_epi64(__m128i a) { |
| 199 |
// CHECK-LABEL: test_mm_cvtepu16_epi64 |
| 200 |
// CHECK: shufflevector <8 x i16> {{.*}}, <8 x i16> {{.*}}, <2 x i32> <i32 0, i32 1> |
| 201 |
// CHECK: zext <2 x i16> {{.*}} to <2 x i64> |
| 202 |
return _mm_cvtepu16_epi64(a); |
| 203 |
} |
| 204 |
|
| 205 |
TEST_CONSTEXPR(match_v2di(_mm_cvtepu16_epi64(_mm_setr_epi16(-300, 2, -1, 0, 1, -2, 3, -4)), 65236, 2)); |
| 206 |
|
| 207 |
__m128i test_mm_cvtepu32_epi64(__m128i a) { |
| 208 |
// CHECK-LABEL: test_mm_cvtepu32_epi64 |
| 209 |
// CHECK: shufflevector <4 x i32> {{.*}}, <4 x i32> {{.*}}, <2 x i32> <i32 0, i32 1> |
| 210 |
// CHECK: zext <2 x i32> {{.*}} to <2 x i64> |
| 211 |
return _mm_cvtepu32_epi64(a); |
| 212 |
} |
| 213 |
|
| 214 |
TEST_CONSTEXPR(match_v2di(_mm_cvtepu32_epi64(_mm_setr_epi32(-70000, 2, -1, 0)), 4294897296, 2)); |
| 215 |
|
| 216 |
__m128d test_mm_dp_pd(__m128d x, __m128d y) { |
| 217 |
// CHECK-LABEL: test_mm_dp_pd |
| 218 |
// CHECK: call {{.*}}<2 x double> @llvm.x86.sse41.dppd(<2 x double> {{.*}}, <2 x double> {{.*}}, i8 7) |
| 219 |
return _mm_dp_pd(x, y, 7); |
| 220 |
} |
| 221 |
|
| 222 |
__m128 test_mm_dp_ps(__m128 x, __m128 y) { |
| 223 |
// CHECK-LABEL: test_mm_dp_ps |
| 224 |
// CHECK: call {{.*}}<4 x float> @llvm.x86.sse41.dpps(<4 x float> {{.*}}, <4 x float> {{.*}}, i8 7) |
| 225 |
return _mm_dp_ps(x, y, 7); |
| 226 |
} |
| 227 |
|
| 228 |
int test_mm_extract_epi8(__m128i x) { |
| 229 |
// CHECK-LABEL: test_mm_extract_epi8 |
| 230 |
// CHECK: extractelement <16 x i8> %{{.*}}, {{i32|i64}} 1 |
| 231 |
// CHECK: zext i8 %{{.*}} to i32 |
| 232 |
return _mm_extract_epi8(x, 1); |
| 233 |
} |
| 234 |
TEST_CONSTEXPR(_mm_extract_epi8(((__m128i)(__v16qi){0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}), 20) == 4); |
| 235 |
|
| 236 |
int test_mm_extract_epi32(__m128i x) { |
| 237 |
// CHECK-LABEL: test_mm_extract_epi32 |
| 238 |
// CHECK: extractelement <4 x i32> %{{.*}}, {{i32|i64}} 1 |
| 239 |
return _mm_extract_epi32(x, 1); |
| 240 |
} |
| 241 |
TEST_CONSTEXPR(_mm_extract_epi32(((__m128i)(__v4si){1, 3, 5, 7}), 10) == 5); |
| 242 |
|
| 243 |
long long test_mm_extract_epi64(__m128i x) { |
| 244 |
// CHECK-LABEL: test_mm_extract_epi64 |
| 245 |
// CHECK: extractelement <2 x i64> %{{.*}}, {{i32|i64}} 1 |
| 246 |
return _mm_extract_epi64(x, 1); |
| 247 |
} |
| 248 |
TEST_CONSTEXPR(_mm_extract_epi64(((__m128i)(__v2di){11, 22}), 5) == 22); |
| 249 |
|
| 250 |
int test_mm_extract_ps(__m128 x) { |
| 251 |
// CHECK-LABEL: test_mm_extract_ps |
| 252 |
// CHECK: extractelement <4 x float> %{{.*}}, {{i32|i64}} 1 |
| 253 |
return _mm_extract_ps(x, 1); |
| 254 |
} |
| 255 |
TEST_CONSTEXPR(_mm_extract_ps(((__m128){1.25f, 2.5f, 3.75f, 5.0f}), 6) == __builtin_bit_cast(int, 3.75f)); |
| 256 |
|
| 257 |
__m128d test_mm_floor_pd(__m128d x) { |
| 258 |
// CHECK-LABEL: test_mm_floor_pd |
| 259 |
// CHECK: call {{.*}}<2 x double> @llvm.x86.sse41.round.pd(<2 x double> %{{.*}}, i32 1) |
| 260 |
return _mm_floor_pd(x); |
| 261 |
} |
| 262 |
|
| 263 |
__m128 test_mm_floor_ps(__m128 x) { |
| 264 |
// CHECK-LABEL: test_mm_floor_ps |
| 265 |
// CHECK: call {{.*}}<4 x float> @llvm.x86.sse41.round.ps(<4 x float> %{{.*}}, i32 1) |
| 266 |
return _mm_floor_ps(x); |
| 267 |
} |
| 268 |
|
| 269 |
__m128d test_mm_floor_sd(__m128d x, __m128d y) { |
| 270 |
// CHECK-LABEL: test_mm_floor_sd |
| 271 |
// CHECK: call {{.*}}<2 x double> @llvm.x86.sse41.round.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 1) |
| 272 |
return _mm_floor_sd(x, y); |
| 273 |
} |
| 274 |
|
| 275 |
__m128 test_mm_floor_ss(__m128 x, __m128 y) { |
| 276 |
// CHECK-LABEL: test_mm_floor_ss |
| 277 |
// CHECK: call {{.*}}<4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 1) |
| 278 |
return _mm_floor_ss(x, y); |
| 279 |
} |
| 280 |
|
| 281 |
__m128i test_mm_insert_epi8(__m128i x, char b) { |
| 282 |
// CHECK-LABEL: test_mm_insert_epi8 |
| 283 |
// CHECK: insertelement <16 x i8> %{{.*}}, i8 %{{.*}}, {{i32|i64}} 1 |
| 284 |
return _mm_insert_epi8(x, b, 1); |
| 285 |
} |
| 286 |
TEST_CONSTEXPR(match_v16qi(_mm_insert_epi8(((__m128i)(__v16qi){ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}), 101, 33), 0, 101, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)); |
| 287 |
|
| 288 |
__m128i test_mm_insert_epi32(__m128i x, int b) { |
| 289 |
// CHECK-LABEL: test_mm_insert_epi32 |
| 290 |
// CHECK: insertelement <4 x i32> %{{.*}}, i32 %{{.*}}, {{i32|i64}} 1 |
| 291 |
return _mm_insert_epi32(x, b, 1); |
| 292 |
} |
| 293 |
TEST_CONSTEXPR(match_v4si(_mm_insert_epi32(((__m128i)(__v4si){0, 1, 2, 3}), 5678, 18), 0, 1, 5678, 3)); |
| 294 |
|
| 295 |
#ifdef __x86_64__ |
| 296 |
__m128i test_mm_insert_epi64(__m128i x, long long b) { |
| 297 |
// X64-LABEL: test_mm_insert_epi64 |
| 298 |
// X64: insertelement <2 x i64> %{{.*}}, i64 %{{.*}}, {{i32|i64}} 1 |
| 299 |
return _mm_insert_epi64(x, b, 1); |
| 300 |
} |
| 301 |
TEST_CONSTEXPR(match_v2di(_mm_insert_epi64(((__m128i)(__v2di){100, 200}), -999, 9), 100, -999)); |
| 302 |
#endif |
| 303 |
|
| 304 |
__m128 test_mm_insert_ps(__m128 x, __m128 y) { |
| 305 |
// CHECK-LABEL: test_mm_insert_ps |
| 306 |
// CHECK: call {{.*}}<4 x float> @llvm.x86.sse41.insertps(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 4) |
| 307 |
return _mm_insert_ps(x, y, 4); |
| 308 |
} |
| 309 |
|
| 310 |
TEST_CONSTEXPR((match_m128(_mm_insert_ps(((__m128)(__v4sf){1.0f, 2.0f, 3.0f, 4.0f}), ((__m128)(__v4sf){10.0f, 20.0f, 30.0f, 40.0f}), 0x10), 1.0f, 10.0f, 3.0f, 4.0f))); // Insert Y[0] into X[1] |
| 311 |
TEST_CONSTEXPR((match_m128(_mm_insert_ps(((__m128)(__v4sf){1.0f, 2.0f, 3.0f, 4.0f}), ((__m128)(__v4sf){10.0f, 20.0f, 30.0f, 40.0f}), 0x00), 10.0f, 2.0f, 3.0f, 4.0f))); // Insert Y[0] into X[0] |
| 312 |
TEST_CONSTEXPR((match_m128(_mm_insert_ps(((__m128)(__v4sf){1.0f, 2.0f, 3.0f, 4.0f}), ((__m128)(__v4sf){10.0f, 20.0f, 30.0f, 40.0f}), 0x20), 1.0f, 2.0f, 10.0f, 4.0f))); // Insert Y[0] into X[2] |
| 313 |
TEST_CONSTEXPR((match_m128(_mm_insert_ps(((__m128)(__v4sf){1.0f, 2.0f, 3.0f, 4.0f}), ((__m128)(__v4sf){10.0f, 20.0f, 30.0f, 40.0f}), 0x30), 1.0f, 2.0f, 3.0f, 10.0f))); // Insert Y[0] into X[3] |
| 314 |
TEST_CONSTEXPR((match_m128(_mm_insert_ps(((__m128)(__v4sf){1.0f, 2.0f, 3.0f, 4.0f}), ((__m128)(__v4sf){10.0f, 20.0f, 30.0f, 40.0f}), 0x80), 30.0f, 2.0f, 3.0f, 4.0f))); // Insert Y[2] into X[0] |
| 315 |
TEST_CONSTEXPR((match_m128(_mm_insert_ps(((__m128)(__v4sf){1.0f, 2.0f, 3.0f, 4.0f}), ((__m128)(__v4sf){10.0f, 20.0f, 30.0f, 40.0f}), 0x01), 0.0f, 2.0f, 3.0f, 4.0f))); // Insert Y[0] into X[0], zero X[0] |
| 316 |
TEST_CONSTEXPR((match_m128(_mm_insert_ps(((__m128)(__v4sf){1.0f, 2.0f, 3.0f, 4.0f}), ((__m128)(__v4sf){10.0f, 20.0f, 30.0f, 40.0f}), 0x0A), 10.0f, 0.0f, 3.0f, 0.0f))); // Insert Y[0] into X[0], zero X[1] and X[3] |
| 317 |
TEST_CONSTEXPR((match_m128(_mm_insert_ps(((__m128)(__v4sf){1.0f, 2.0f, 3.0f, 4.0f}), ((__m128)(__v4sf){10.0f, 20.0f, 30.0f, 40.0f}), 0x0F), 0.0f, 0.0f, 0.0f, 0.0f))); // Insert Y[0] into X[0], zero all |
| 318 |
TEST_CONSTEXPR((match_m128(_mm_insert_ps(((__m128)(__v4sf){1.0f, 2.0f, 3.0f, 4.0f}), ((__m128)(__v4sf){10.0f, 20.0f, 30.0f, 40.0f}), 0xCF), 0.0f, 0.0f, 0.0f, 0.0f))); // Insert Y[3] into X[0], zero all |
| 319 |
|
| 320 |
__m128i test_mm_max_epi8(__m128i x, __m128i y) { |
| 321 |
// CHECK-LABEL: test_mm_max_epi8 |
| 322 |
// CHECK: call <16 x i8> @llvm.smax.v16i8(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) |
| 323 |
return _mm_max_epi8(x, y); |
| 324 |
} |
| 325 |
|
| 326 |
TEST_CONSTEXPR(match_v16qi(_mm_max_epi8((__m128i)(__v16qs){-1, +2, -3, +4, -5, +6, -7, +8, -9, +10, -11, +12, -13, +14, -15, +16}, (__m128i)(__v16qs){+1, -2, +3, -4, +5, -6, +7, -8, +9, -10, +11, -12, +13, -14, +15, -16}), +1, +2, +3, +4, +5, +6, +7, +8, +9, +10, +11, +12, +13, +14, +15, +16)); |
| 327 |
|
| 328 |
__m128i test_mm_max_epi32(__m128i x, __m128i y) { |
| 329 |
// CHECK-LABEL: test_mm_max_epi32 |
| 330 |
// CHECK: call <4 x i32> @llvm.smax.v4i32(<4 x i32> %{{.*}}, <4 x i32> %{{.*}}) |
| 331 |
return _mm_max_epi32(x, y); |
| 332 |
} |
| 333 |
|
| 334 |
TEST_CONSTEXPR(match_v4si(_mm_max_epi32((__m128i)(__v4si){-1, +2, -3, +4}, (__m128i)(__v4si){+1, -2, +3, -4}), +1, +2, +3, +4 )); |
| 335 |
|
| 336 |
__m128i test_mm_max_epu16(__m128i x, __m128i y) { |
| 337 |
// CHECK-LABEL: test_mm_max_epu16 |
| 338 |
// CHECK: call <8 x i16> @llvm.umax.v8i16(<8 x i16> %{{.*}}, <8 x i16> %{{.*}}) |
| 339 |
return _mm_max_epu16(x, y); |
| 340 |
} |
| 341 |
|
| 342 |
TEST_CONSTEXPR(match_v8hu(_mm_max_epu16((__m128i)(__v8hu){1, 3, 5, 7, 9, 11, 13, 15}, (__m128i)(__v8hu){3, 4, 5, 6, 7, 8, 9, 10}), 3, 4, 5, 7, 9, 11, 13, 15)); |
| 343 |
|
| 344 |
__m128i test_mm_max_epu32(__m128i x, __m128i y) { |
| 345 |
// CHECK-LABEL: test_mm_max_epu32 |
| 346 |
// CHECK: call <4 x i32> @llvm.umax.v4i32(<4 x i32> %{{.*}}, <4 x i32> %{{.*}}) |
| 347 |
return _mm_max_epu32(x, y); |
| 348 |
} |
| 349 |
|
| 350 |
TEST_CONSTEXPR(match_v4su(_mm_max_epu32((__m128i)(__v4su){1, 3, 5, 7}, (__m128i)(__v4su){3, 4, 5, 6}), 3, 4, 5, 7)); |
| 351 |
|
| 352 |
__m128i test_mm_min_epi8(__m128i x, __m128i y) { |
| 353 |
// CHECK-LABEL: test_mm_min_epi8 |
| 354 |
// CHECK: call <16 x i8> @llvm.smin.v16i8(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) |
| 355 |
return _mm_min_epi8(x, y); |
| 356 |
} |
| 357 |
|
| 358 |
TEST_CONSTEXPR(match_v16qi(_mm_min_epi8((__m128i)(__v16qs){-1, +2, -3, +4, -5, +6, -7, +8, -9, +10, -11, +12, -13, +14, -15, +16}, (__m128i)(__v16qs){+1, -2, +3, -4, +5, -6, +7, -8, +9, -10, +11, -12, +13, -14, +15, -16}), -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16)); |
| 359 |
|
| 360 |
__m128i test_mm_min_epi32(__m128i x, __m128i y) { |
| 361 |
// CHECK-LABEL: test_mm_min_epi32 |
| 362 |
// CHECK: call <4 x i32> @llvm.smin.v4i32(<4 x i32> %{{.*}}, <4 x i32> %{{.*}}) |
| 363 |
return _mm_min_epi32(x, y); |
| 364 |
} |
| 365 |
|
| 366 |
TEST_CONSTEXPR(match_v4si(_mm_min_epi32((__m128i)(__v4si){-1, +2, -3, +4}, (__m128i)(__v4si){+1, -2, +3, -4}), -1, -2, -3, -4 )); |
| 367 |
|
| 368 |
__m128i test_mm_min_epu16(__m128i x, __m128i y) { |
| 369 |
// CHECK-LABEL: test_mm_min_epu16 |
| 370 |
// CHECK: call <8 x i16> @llvm.umin.v8i16(<8 x i16> %{{.*}}, <8 x i16> %{{.*}}) |
| 371 |
return _mm_min_epu16(x, y); |
| 372 |
} |
| 373 |
|
| 374 |
TEST_CONSTEXPR(match_v8hu(_mm_min_epu16((__m128i)(__v8hu){1, 3, 5, 7, 9, 11, 13, 15}, (__m128i)(__v8hu){3, 4, 5, 6, 7, 8, 9, 10}), 1, 3, 5, 6, 7, 8, 9, 10)); |
| 375 |
|
| 376 |
__m128i test_mm_min_epu32(__m128i x, __m128i y) { |
| 377 |
// CHECK-LABEL: test_mm_min_epu32 |
| 378 |
// CHECK: call <4 x i32> @llvm.umin.v4i32(<4 x i32> %{{.*}}, <4 x i32> %{{.*}}) |
| 379 |
return _mm_min_epu32(x, y); |
| 380 |
} |
| 381 |
|
| 382 |
TEST_CONSTEXPR(match_v4su(_mm_min_epu32((__m128i)(__v4su){1, 3, 5, 7}, (__m128i)(__v4su){3, 4, 5, 6}), 1, 3, 5, 6)); |
| 383 |
|
| 384 |
__m128i test_mm_minpos_epu16(__m128i x) { |
| 385 |
// CHECK-LABEL: test_mm_minpos_epu16 |
| 386 |
// CHECK: call <8 x i16> @llvm.x86.sse41.phminposuw(<8 x i16> %{{.*}}) |
| 387 |
return _mm_minpos_epu16(x); |
| 388 |
} |
| 389 |
TEST_CONSTEXPR(match_v8hu(_mm_minpos_epu16((__m128i)(__v8hu){0,0,0,0, 0,0,0,0}), 0,0,0,0, 0,0,0,0)); |
| 390 |
TEST_CONSTEXPR(match_v8hu(_mm_minpos_epu16((__m128i)(__v8hu){1,0,0,0, 0,0,0,0}), 0,1,0,0, 0,0,0,0)); |
| 391 |
TEST_CONSTEXPR(match_v8hu(_mm_minpos_epu16((__m128i)(__v8hu){65535,65535,65535,65535,65535,65535,65535,65535}), 65535,0,0,0, 0,0,0,0)); |
| 392 |
TEST_CONSTEXPR(match_v8hu(_mm_minpos_epu16((__m128i)(__v8hu){9,8,7,6,5,4,3,2}), 2,7,0,0, 0,0,0,0)); |
| 393 |
TEST_CONSTEXPR(match_v8hu(_mm_minpos_epu16((__m128i)(__v8hu){5,5,5,5,5,5,5,5}), 5,0,0,0, 0,0,0,0)); |
| 394 |
TEST_CONSTEXPR(match_v8hu(_mm_minpos_epu16((__m128i)(__v8hu){5,7,9,4,10,4,11,12}), 4,3,0,0, 0,0,0,0)); |
| 395 |
TEST_CONSTEXPR(match_v8hu(_mm_minpos_epu16((__m128i)(__v8hu){6,0,0,0,0,0,0,0}), 0,1,0,0, 0,0,0,0)); |
| 396 |
TEST_CONSTEXPR(match_v8hu(_mm_minpos_epu16((__m128i)(__v8hu){1000,2000,3000,4000,5000,6000,7000,1}), 1,7,0,0, 0,0,0,0)); |
| 397 |
TEST_CONSTEXPR(match_v8hu(_mm_minpos_epu16((__m128i)(__v8hu){1234,5678,42,9999,65535,0,4242,42}), 0,5,0,0, 0,0,0,0)); |
| 398 |
TEST_CONSTEXPR(match_v8hu(_mm_minpos_epu16((__m128i)(__v8hu){400,500,12,600,12,700,800,900}), 12,2,0,0, 0,0,0,0)); |
| 399 |
|
| 400 |
__m128i test_mm_mpsadbw_epu8(__m128i x, __m128i y) { |
| 401 |
// CHECK-LABEL: test_mm_mpsadbw_epu8 |
| 402 |
// CHECK: call <8 x i16> @llvm.x86.sse41.mpsadbw(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 1) |
| 403 |
return _mm_mpsadbw_epu8(x, y, 1); |
| 404 |
} |
| 405 |
|
| 406 |
__m128i test_mm_mul_epi32(__m128i x, __m128i y) { |
| 407 |
// CHECK-LABEL: test_mm_mul_epi32 |
| 408 |
// CHECK: shl <2 x i64> %{{.*}}, splat (i64 32) |
| 409 |
// CHECK: ashr <2 x i64> %{{.*}}, splat (i64 32) |
| 410 |
// CHECK: shl <2 x i64> %{{.*}}, splat (i64 32) |
| 411 |
// CHECK: ashr <2 x i64> %{{.*}}, splat (i64 32) |
| 412 |
// CHECK: mul <2 x i64> %{{.*}}, %{{.*}} |
| 413 |
return _mm_mul_epi32(x, y); |
| 414 |
} |
| 415 |
TEST_CONSTEXPR(match_m128i(_mm_mul_epi32((__m128i)(__v4si){+1, -2, +3, -4}, (__m128i)(__v4si){-16, -14, +12, +10}), -16, 36)); |
| 416 |
|
| 417 |
__m128i test_mm_mullo_epi32(__m128i x, __m128i y) { |
| 418 |
// CHECK-LABEL: test_mm_mullo_epi32 |
| 419 |
// CHECK: mul <4 x i32> |
| 420 |
return _mm_mullo_epi32(x, y); |
| 421 |
} |
| 422 |
TEST_CONSTEXPR(match_v4si(_mm_mullo_epi32((__m128i)(__v4si){+1, -2, +3, -4}, (__m128i)(__v4si){-16, +14, +12, -10}), -16, -28, +36, +40)); |
| 423 |
|
| 424 |
__m128i test_mm_packus_epi32(__m128i x, __m128i y) { |
| 425 |
// CHECK-LABEL: test_mm_packus_epi32 |
| 426 |
// CHECK: call <8 x i16> @llvm.x86.sse41.packusdw(<4 x i32> %{{.*}}, <4 x i32> %{{.*}}) |
| 427 |
return _mm_packus_epi32(x, y); |
| 428 |
} |
| 429 |
TEST_CONSTEXPR(match_v8hi(_mm_packus_epi32((__m128i)(__v4si){40000, -50000, 32767, -32768}, (__m128i)(__v4si){0, 1, -1, 70000}), -25536, 0, 32767, 0, 0, 1, 0, -1)); |
| 430 |
|
| 431 |
__m128d test_mm_round_pd(__m128d x) { |
| 432 |
// CHECK-LABEL: test_mm_round_pd |
| 433 |
// CHECK: %{{.*}} = call <2 x double> @llvm.roundeven.v2f64(<2 x double> %{{.*}}) |
| 434 |
return _mm_round_pd(x, 0b1000); |
| 435 |
} |
| 436 |
|
| 437 |
__m128d test_mm_round_pd_mxcsr(__m128d x) { |
| 438 |
// CHECK-LABEL: test_mm_round_pd_mxcsr |
| 439 |
// CHECK: %{{.*}} = call <2 x double> @llvm.x86.sse41.round.pd(<2 x double> %{{.*}}, i32 12) |
| 440 |
return _mm_round_pd(x, 0b1100); |
| 441 |
} |
| 442 |
|
| 443 |
__m128d test_mm_round_pd_fround_no_exc(__m128d x) { |
| 444 |
// CHECK-LABEL: test_mm_round_pd_fround_no_exc |
| 445 |
// CHECK: %{{.*}} = call <2 x double> @llvm.x86.sse41.round.pd(<2 x double> %{{.*}}, i32 0) |
| 446 |
return _mm_round_pd(x, 0b0000); |
| 447 |
} |
| 448 |
|
| 449 |
__m128 test_mm_round_ps(__m128 x) { |
| 450 |
// CHECK-LABEL: test_mm_round_ps |
| 451 |
// CHECK: %{{.*}} = call <4 x float> @llvm.floor.v4f32(<4 x float> %{{.*}}) |
| 452 |
return _mm_round_ps(x, 0b1001); |
| 453 |
} |
| 454 |
|
| 455 |
__m128 test_mm_round_ps_mxcsr(__m128 x) { |
| 456 |
// CHECK-LABEL: test_mm_round_ps_mxcsr |
| 457 |
// CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> %{{.*}}, i32 12) |
| 458 |
return _mm_round_ps(x, 0b1100); |
| 459 |
} |
| 460 |
|
| 461 |
__m128 test_mm_round_ps_fround_no_exc(__m128 x) { |
| 462 |
// CHECK-LABEL: test_mm_round_ps_fround_no_exc |
| 463 |
// CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> %{{.*}}, i32 0) |
| 464 |
return _mm_round_ps(x, 0b0000); |
| 465 |
} |
| 466 |
|
| 467 |
__m128d test_mm_round_sd(__m128d x, __m128d y) { |
| 468 |
// CHECK-LABEL: test_mm_round_sd |
| 469 |
// CHECK: %[[A:.*]] = extractelement <2 x double> %{{.*}}, i32 0 |
| 470 |
// CHECK: %[[B:.*]] = call double @llvm.roundeven.f64(double %[[A:.*]]) |
| 471 |
// CHECK: %{{.*}} = insertelement <2 x double> %0, double %[[B:.*]], i32 0 |
| 472 |
return _mm_round_sd(x, y, 0b1000); |
| 473 |
} |
| 474 |
|
| 475 |
__m128d test_mm_round_sd_mxcsr(__m128d x, __m128d y) { |
| 476 |
// CHECK-LABEL: test_mm_round_sd_mxcsr |
| 477 |
// CHECK: %{{.*}} = call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %0, <2 x double> %{{.*}}, i32 12) |
| 478 |
return _mm_round_sd(x, y, 0b1100); |
| 479 |
} |
| 480 |
|
| 481 |
__m128d test_mm_round_sd_fround_no_exc(__m128d x, __m128d y) { |
| 482 |
// CHECK-LABEL: test_mm_round_sd_fround_no_exc |
| 483 |
// CHECK: %{{.*}} = call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %0, <2 x double> %{{.*}}, i32 0) |
| 484 |
return _mm_round_sd(x, y, 0b0000); |
| 485 |
} |
| 486 |
|
| 487 |
__m128 test_mm_round_ss(__m128 x, __m128 y) { |
| 488 |
// CHECK-LABEL: test_mm_round_ss |
| 489 |
// CHECK: %[[A:.*]] = extractelement <4 x float> %{{.*}}, i32 0 |
| 490 |
// CHECK: %[[B:.*]] = call float @llvm.trunc.f32(float %[[A:.*]]) |
| 491 |
// CHECK: %{{.*}} = insertelement <4 x float> %0, float %[[B:.*]], i32 0 |
| 492 |
return _mm_round_ss(x, y, 0b1011); |
| 493 |
} |
| 494 |
|
| 495 |
__m128 test_mm_round_ss_mxcsr(__m128 x, __m128 y) { |
| 496 |
// CHECK-LABEL: test_mm_round_ss_mxcsr |
| 497 |
// CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %0, <4 x float> %{{.*}}, i32 12) |
| 498 |
return _mm_round_ss(x, y, 0b1100); |
| 499 |
} |
| 500 |
|
| 501 |
__m128 test_mm_round_ss_fround_no_exc(__m128 x, __m128 y) { |
| 502 |
// CHECK-LABEL: test_mm_round_ss_fround_no_exc |
| 503 |
// CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %0, <4 x float> %{{.*}}, i32 0) |
| 504 |
return _mm_round_ss(x, y, 0b0000); |
| 505 |
} |
| 506 |
|
| 507 |
__m128i test_mm_stream_load_si128(__m128i const *a) { |
| 508 |
// CHECK-LABEL: test_mm_stream_load_si128 |
| 509 |
// CHECK: load <2 x i64>, ptr %{{.*}}, align 16, !nontemporal |
| 510 |
return _mm_stream_load_si128(a); |
| 511 |
} |
| 512 |
|
| 513 |
__m128i test_mm_stream_load_si128_void(const void *a) { |
| 514 |
// CHECK-LABEL: test_mm_stream_load_si128_void |
| 515 |
// CHECK: load <2 x i64>, ptr %{{.*}}, align 16, !nontemporal |
| 516 |
return _mm_stream_load_si128(a); |
| 517 |
} |
| 518 |
|
| 519 |
int test_mm_test_all_ones(__m128i x) { |
| 520 |
// CHECK-LABEL: test_mm_test_all_ones |
| 521 |
// CHECK: call {{.*}}i32 @llvm.x86.sse41.ptestc(<2 x i64> %{{.*}}, <2 x i64> %{{.*}}) |
| 522 |
return _mm_test_all_ones(x); |
| 523 |
} |
| 524 |
TEST_CONSTEXPR(_mm_test_all_ones(((__m128i)(__v2di){-1, -1})) == 1); |
| 525 |
TEST_CONSTEXPR(_mm_test_all_ones(((__m128i)(__v2di){-1, 0})) == 0); |
| 526 |
TEST_CONSTEXPR(_mm_test_all_ones(((__m128i)(__v4si){-1, -1, -1, 0x7FFFFFFF})) == 0); |
| 527 |
|
| 528 |
int test_mm_test_all_zeros(__m128i x, __m128i y) { |
| 529 |
// CHECK-LABEL: test_mm_test_all_zeros |
| 530 |
// CHECK: call {{.*}}i32 @llvm.x86.sse41.ptestz(<2 x i64> %{{.*}}, <2 x i64> %{{.*}}) |
| 531 |
return _mm_test_all_zeros(x, y); |
| 532 |
} |
| 533 |
TEST_CONSTEXPR(_mm_test_all_zeros(((__m128i)(__v2di){0,0}), ((__m128i)(__v2di){0,0})) == 1); |
| 534 |
TEST_CONSTEXPR(_mm_test_all_zeros(((__m128i)(__v2di){0xFF00,0}), ((__m128i)(__v2di){0x00FF,0})) == 1); |
| 535 |
TEST_CONSTEXPR(_mm_test_all_zeros(((__m128i)(__v2di){1,0}), ((__m128i)(__v2di){-1,0})) == 0); |
| 536 |
TEST_CONSTEXPR(_mm_test_all_zeros(((__m128i)(__v2di){0,1}), ((__m128i)(__v2di){0,-1})) == 0); |
| 537 |
|
| 538 |
int test_mm_test_mix_ones_zeros(__m128i x, __m128i y) { |
| 539 |
// CHECK-LABEL: test_mm_test_mix_ones_zeros |
| 540 |
// CHECK: call {{.*}}i32 @llvm.x86.sse41.ptestnzc(<2 x i64> %{{.*}}, <2 x i64> %{{.*}}) |
| 541 |
return _mm_test_mix_ones_zeros(x, y); |
| 542 |
} |
| 543 |
TEST_CONSTEXPR(_mm_test_mix_ones_zeros(((__m128i)(__v2di){0xFF, 0}), ((__m128i)(__v2di){0xF0, 1})) == 1); |
| 544 |
TEST_CONSTEXPR(_mm_test_mix_ones_zeros(((__m128i)(__v2di){0xF0, 0}), ((__m128i)(__v2di){0x0F, 0})) == 0); |
| 545 |
TEST_CONSTEXPR(_mm_test_mix_ones_zeros(((__m128i)(__v2di){-1, -1}), ((__m128i)(__v2di){1, 0})) == 0); |
| 546 |
TEST_CONSTEXPR(_mm_test_mix_ones_zeros(((__m128i)(__v2di){0, 0}), ((__m128i)(__v2di){0, 0})) == 0); |
| 547 |
|
| 548 |
int test_mm_testc_si128(__m128i x, __m128i y) { |
| 549 |
// CHECK-LABEL: test_mm_testc_si128 |
| 550 |
// CHECK: call {{.*}}i32 @llvm.x86.sse41.ptestc(<2 x i64> %{{.*}}, <2 x i64> %{{.*}}) |
| 551 |
return _mm_testc_si128(x, y); |
| 552 |
} |
| 553 |
TEST_CONSTEXPR(_mm_testc_si128((__m128i)(__v2di){0,0}, (__m128i)(__v2di){0,0}) == 1); |
| 554 |
TEST_CONSTEXPR(_mm_testc_si128((__m128i)(__v2di){1,0}, (__m128i)(__v2di){-1,0}) == 0); |
| 555 |
TEST_CONSTEXPR(_mm_testc_si128((__m128i)(__v2di){0,-1}, (__m128i)(__v2di){0,1}) == 1); |
| 556 |
|
| 557 |
int test_mm_testnzc_si128(__m128i x, __m128i y) { |
| 558 |
// CHECK-LABEL: test_mm_testnzc_si128 |
| 559 |
// CHECK: call {{.*}}i32 @llvm.x86.sse41.ptestnzc(<2 x i64> %{{.*}}, <2 x i64> %{{.*}}) |
| 560 |
return _mm_testnzc_si128(x, y); |
| 561 |
} |
| 562 |
TEST_CONSTEXPR(_mm_testnzc_si128((__m128i)(__v2di){3,0}, (__m128i)(__v2di){1,1}) == 1); |
| 563 |
TEST_CONSTEXPR(_mm_testnzc_si128((__m128i)(__v2di){32,-1}, (__m128i)(__v2di){15,0}) == 0); |
| 564 |
TEST_CONSTEXPR(_mm_testnzc_si128((__m128i)(__v2di){0,999}, (__m128i)(__v2di){0,999}) == 0); |
| 565 |
|
| 566 |
int test_mm_testz_si128(__m128i x, __m128i y) { |
| 567 |
// CHECK-LABEL: test_mm_testz_si128 |
| 568 |
// CHECK: call {{.*}}i32 @llvm.x86.sse41.ptestz(<2 x i64> %{{.*}}, <2 x i64> %{{.*}}) |
| 569 |
return _mm_testz_si128(x, y); |
| 570 |
} |
| 571 |
TEST_CONSTEXPR(_mm_testz_si128((__m128i)(__v2di){0,0}, (__m128i)(__v2di){0,0}) == 1); |
| 572 |
TEST_CONSTEXPR(_mm_testz_si128((__m128i)(__v2di){1,0}, (__m128i)(__v2di){-1,0}) == 0); |
| 573 |
TEST_CONSTEXPR(_mm_testz_si128((__m128i)(__v2di){1,0}, (__m128i)(__v2di){0,1}) == 1); |