| 1 |
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse -emit-llvm -o - -Wall -Werror | FileCheck %s |
| 2 |
// RUN: %clang_cc1 -flax-vector-conversions=none -fms-extensions -fms-compatibility -ffreestanding %s -triple=x86_64-windows-msvc -target-feature +sse -emit-llvm -o - -Wall -Werror | FileCheck %s |
| 3 |
|
| 4 |
|
| 5 |
#include <immintrin.h> |
| 6 |
|
| 7 |
// NOTE: This should match the tests in llvm/test/CodeGen/X86/sse-intrinsics-fast-isel.ll |
| 8 |
|
| 9 |
__m128 test_mm_add_ps(__m128 A, __m128 B) { |
| 10 |
// CHECK-LABEL: test_mm_add_ps |
| 11 |
// CHECK: fadd <4 x float> |
| 12 |
return _mm_add_ps(A, B); |
| 13 |
} |
| 14 |
|
| 15 |
__m128 test_mm_add_ss(__m128 A, __m128 B) { |
| 16 |
// CHECK-LABEL: test_mm_add_ss |
| 17 |
// CHECK: extractelement <4 x float> %{{.*}}, i32 0 |
| 18 |
// CHECK: extractelement <4 x float> %{{.*}}, i32 0 |
| 19 |
// CHECK: fadd float |
| 20 |
// CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 0 |
| 21 |
return _mm_add_ss(A, B); |
| 22 |
} |
| 23 |
|
| 24 |
__m128 test_mm_and_ps(__m128 A, __m128 B) { |
| 25 |
// CHECK-LABEL: test_mm_and_ps |
| 26 |
// CHECK: and <4 x i32> |
| 27 |
return _mm_and_ps(A, B); |
| 28 |
} |
| 29 |
|
| 30 |
__m128 test_mm_andnot_ps(__m128 A, __m128 B) { |
| 31 |
// CHECK-LABEL: test_mm_andnot_ps |
| 32 |
// CHECK: xor <4 x i32> %{{.*}}, <i32 -1, i32 -1, i32 -1, i32 -1> |
| 33 |
// CHECK: and <4 x i32> |
| 34 |
return _mm_andnot_ps(A, B); |
| 35 |
} |
| 36 |
|
| 37 |
__m128 test_mm_cmp_ps_eq_oq(__m128 a, __m128 b) { |
| 38 |
// CHECK-LABEL: test_mm_cmp_ps_eq_oq |
| 39 |
// CHECK: fcmp oeq <4 x float> %{{.*}}, %{{.*}} |
| 40 |
return _mm_cmp_ps(a, b, _CMP_EQ_OQ); |
| 41 |
} |
| 42 |
|
| 43 |
__m128 test_mm_cmp_ps_lt_os(__m128 a, __m128 b) { |
| 44 |
// CHECK-LABEL: test_mm_cmp_ps_lt_os |
| 45 |
// CHECK: fcmp olt <4 x float> %{{.*}}, %{{.*}} |
| 46 |
return _mm_cmp_ps(a, b, _CMP_LT_OS); |
| 47 |
} |
| 48 |
|
| 49 |
__m128 test_mm_cmp_ps_le_os(__m128 a, __m128 b) { |
| 50 |
// CHECK-LABEL: test_mm_cmp_ps_le_os |
| 51 |
// CHECK: fcmp ole <4 x float> %{{.*}}, %{{.*}} |
| 52 |
return _mm_cmp_ps(a, b, _CMP_LE_OS); |
| 53 |
} |
| 54 |
|
| 55 |
__m128 test_mm_cmp_ps_unord_q(__m128 a, __m128 b) { |
| 56 |
// CHECK-LABEL: test_mm_cmp_ps_unord_q |
| 57 |
// CHECK: fcmp uno <4 x float> %{{.*}}, %{{.*}} |
| 58 |
return _mm_cmp_ps(a, b, _CMP_UNORD_Q); |
| 59 |
} |
| 60 |
|
| 61 |
__m128 test_mm_cmp_ps_neq_uq(__m128 a, __m128 b) { |
| 62 |
// CHECK-LABEL: test_mm_cmp_ps_neq_uq |
| 63 |
// CHECK: fcmp une <4 x float> %{{.*}}, %{{.*}} |
| 64 |
return _mm_cmp_ps(a, b, _CMP_NEQ_UQ); |
| 65 |
} |
| 66 |
|
| 67 |
__m128 test_mm_cmp_ps_nlt_us(__m128 a, __m128 b) { |
| 68 |
// CHECK-LABEL: test_mm_cmp_ps_nlt_us |
| 69 |
// CHECK: fcmp uge <4 x float> %{{.*}}, %{{.*}} |
| 70 |
return _mm_cmp_ps(a, b, _CMP_NLT_US); |
| 71 |
} |
| 72 |
|
| 73 |
__m128 test_mm_cmp_ps_nle_us(__m128 a, __m128 b) { |
| 74 |
// CHECK-LABEL: test_mm_cmp_ps_nle_us |
| 75 |
// CHECK: fcmp ugt <4 x float> %{{.*}}, %{{.*}} |
| 76 |
return _mm_cmp_ps(a, b, _CMP_NLE_US); |
| 77 |
} |
| 78 |
|
| 79 |
__m128 test_mm_cmp_ps_ord_q(__m128 a, __m128 b) { |
| 80 |
// CHECK-LABEL: test_mm_cmp_ps_ord_q |
| 81 |
// CHECK: fcmp ord <4 x float> %{{.*}}, %{{.*}} |
| 82 |
return _mm_cmp_ps(a, b, _CMP_ORD_Q); |
| 83 |
} |
| 84 |
|
| 85 |
__m128 test_mm_cmp_ss(__m128 A, __m128 B) { |
| 86 |
// CHECK-LABEL: test_mm_cmp_ss |
| 87 |
// CHECK: call <4 x float> @llvm.x86.sse.cmp.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 7) |
| 88 |
return _mm_cmp_ss(A, B, _CMP_ORD_Q); |
| 89 |
} |
| 90 |
|
| 91 |
__m128 test_mm_cmpeq_ps(__m128 __a, __m128 __b) { |
| 92 |
// CHECK-LABEL: test_mm_cmpeq_ps |
| 93 |
// CHECK: [[CMP:%.*]] = fcmp oeq <4 x float> |
| 94 |
// CHECK-NEXT: [[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i32> |
| 95 |
// CHECK-NEXT: [[BC:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float> |
| 96 |
// CHECK-NEXT: ret <4 x float> [[BC]] |
| 97 |
return _mm_cmpeq_ps(__a, __b); |
| 98 |
} |
| 99 |
|
| 100 |
__m128 test_mm_cmpeq_ss(__m128 __a, __m128 __b) { |
| 101 |
// CHECK-LABEL: test_mm_cmpeq_ss |
| 102 |
// CHECK: @llvm.x86.sse.cmp.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 0) |
| 103 |
return _mm_cmpeq_ss(__a, __b); |
| 104 |
} |
| 105 |
|
| 106 |
__m128 test_mm_cmpge_ps(__m128 __a, __m128 __b) { |
| 107 |
// CHECK-LABEL: test_mm_cmpge_ps |
| 108 |
// CHECK: [[CMP:%.*]] = fcmp ole <4 x float> |
| 109 |
// CHECK-NEXT: [[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i32> |
| 110 |
// CHECK-NEXT: [[BC:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float> |
| 111 |
// CHECK-NEXT: ret <4 x float> [[BC]] |
| 112 |
return _mm_cmpge_ps(__a, __b); |
| 113 |
} |
| 114 |
|
| 115 |
__m128 test_mm_cmpge_ss(__m128 __a, __m128 __b) { |
| 116 |
// CHECK-LABEL: test_mm_cmpge_ss |
| 117 |
// CHECK: @llvm.x86.sse.cmp.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 2) |
| 118 |
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 4, i32 1, i32 2, i32 3> |
| 119 |
return _mm_cmpge_ss(__a, __b); |
| 120 |
} |
| 121 |
|
| 122 |
__m128 test_mm_cmpgt_ps(__m128 __a, __m128 __b) { |
| 123 |
// CHECK-LABEL: test_mm_cmpgt_ps |
| 124 |
// CHECK: [[CMP:%.*]] = fcmp olt <4 x float> |
| 125 |
// CHECK-NEXT: [[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i32> |
| 126 |
// CHECK-NEXT: [[BC:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float> |
| 127 |
// CHECK-NEXT: ret <4 x float> [[BC]] |
| 128 |
return _mm_cmpgt_ps(__a, __b); |
| 129 |
} |
| 130 |
|
| 131 |
__m128 test_mm_cmpgt_ss(__m128 __a, __m128 __b) { |
| 132 |
// CHECK-LABEL: test_mm_cmpgt_ss |
| 133 |
// CHECK: @llvm.x86.sse.cmp.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 1) |
| 134 |
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 4, i32 1, i32 2, i32 3> |
| 135 |
return _mm_cmpgt_ss(__a, __b); |
| 136 |
} |
| 137 |
|
| 138 |
__m128 test_mm_cmple_ps(__m128 __a, __m128 __b) { |
| 139 |
// CHECK-LABEL: test_mm_cmple_ps |
| 140 |
// CHECK: [[CMP:%.*]] = fcmp ole <4 x float> |
| 141 |
// CHECK-NEXT: [[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i32> |
| 142 |
// CHECK-NEXT: [[BC:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float> |
| 143 |
// CHECK-NEXT: ret <4 x float> [[BC]] |
| 144 |
return _mm_cmple_ps(__a, __b); |
| 145 |
} |
| 146 |
|
| 147 |
__m128 test_mm_cmple_ss(__m128 __a, __m128 __b) { |
| 148 |
// CHECK-LABEL: test_mm_cmple_ss |
| 149 |
// CHECK: @llvm.x86.sse.cmp.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 2) |
| 150 |
return _mm_cmple_ss(__a, __b); |
| 151 |
} |
| 152 |
|
| 153 |
__m128 test_mm_cmplt_ps(__m128 __a, __m128 __b) { |
| 154 |
// CHECK-LABEL: test_mm_cmplt_ps |
| 155 |
// CHECK: [[CMP:%.*]] = fcmp olt <4 x float> |
| 156 |
// CHECK-NEXT: [[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i32> |
| 157 |
// CHECK-NEXT: [[BC:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float> |
| 158 |
// CHECK-NEXT: ret <4 x float> [[BC]] |
| 159 |
return _mm_cmplt_ps(__a, __b); |
| 160 |
} |
| 161 |
|
| 162 |
__m128 test_mm_cmplt_ss(__m128 __a, __m128 __b) { |
| 163 |
// CHECK-LABEL: test_mm_cmplt_ss |
| 164 |
// CHECK: @llvm.x86.sse.cmp.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 1) |
| 165 |
return _mm_cmplt_ss(__a, __b); |
| 166 |
} |
| 167 |
|
| 168 |
__m128 test_mm_cmpneq_ps(__m128 __a, __m128 __b) { |
| 169 |
// CHECK-LABEL: test_mm_cmpneq_ps |
| 170 |
// CHECK: [[CMP:%.*]] = fcmp une <4 x float> |
| 171 |
// CHECK-NEXT: [[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i32> |
| 172 |
// CHECK-NEXT: [[BC:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float> |
| 173 |
// CHECK-NEXT: ret <4 x float> [[BC]] |
| 174 |
return _mm_cmpneq_ps(__a, __b); |
| 175 |
} |
| 176 |
|
| 177 |
__m128 test_mm_cmpneq_ss(__m128 __a, __m128 __b) { |
| 178 |
// CHECK-LABEL: test_mm_cmpneq_ss |
| 179 |
// CHECK: @llvm.x86.sse.cmp.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 4) |
| 180 |
return _mm_cmpneq_ss(__a, __b); |
| 181 |
} |
| 182 |
|
| 183 |
__m128 test_mm_cmpnge_ps(__m128 __a, __m128 __b) { |
| 184 |
// CHECK-LABEL: test_mm_cmpnge_ps |
| 185 |
// CHECK: [[CMP:%.*]] = fcmp ugt <4 x float> |
| 186 |
// CHECK-NEXT: [[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i32> |
| 187 |
// CHECK-NEXT: [[BC:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float> |
| 188 |
// CHECK-NEXT: ret <4 x float> [[BC]] |
| 189 |
return _mm_cmpnge_ps(__a, __b); |
| 190 |
} |
| 191 |
|
| 192 |
__m128 test_mm_cmpnge_ss(__m128 __a, __m128 __b) { |
| 193 |
// CHECK-LABEL: test_mm_cmpnge_ss |
| 194 |
// CHECK: @llvm.x86.sse.cmp.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 6) |
| 195 |
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 4, i32 1, i32 2, i32 3> |
| 196 |
return _mm_cmpnge_ss(__a, __b); |
| 197 |
} |
| 198 |
|
| 199 |
__m128 test_mm_cmpngt_ps(__m128 __a, __m128 __b) { |
| 200 |
// CHECK-LABEL: test_mm_cmpngt_ps |
| 201 |
// CHECK: [[CMP:%.*]] = fcmp uge <4 x float> |
| 202 |
// CHECK-NEXT: [[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i32> |
| 203 |
// CHECK-NEXT: [[BC:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float> |
| 204 |
// CHECK-NEXT: ret <4 x float> [[BC]] |
| 205 |
return _mm_cmpngt_ps(__a, __b); |
| 206 |
} |
| 207 |
|
| 208 |
__m128 test_mm_cmpngt_ss(__m128 __a, __m128 __b) { |
| 209 |
// CHECK-LABEL: test_mm_cmpngt_ss |
| 210 |
// CHECK: @llvm.x86.sse.cmp.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 5) |
| 211 |
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 4, i32 1, i32 2, i32 3> |
| 212 |
return _mm_cmpngt_ss(__a, __b); |
| 213 |
} |
| 214 |
|
| 215 |
__m128 test_mm_cmpnle_ps(__m128 __a, __m128 __b) { |
| 216 |
// CHECK-LABEL: test_mm_cmpnle_ps |
| 217 |
// CHECK: [[CMP:%.*]] = fcmp ugt <4 x float> |
| 218 |
// CHECK-NEXT: [[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i32> |
| 219 |
// CHECK-NEXT: [[BC:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float> |
| 220 |
// CHECK-NEXT: ret <4 x float> [[BC]] |
| 221 |
return _mm_cmpnle_ps(__a, __b); |
| 222 |
} |
| 223 |
|
| 224 |
__m128 test_mm_cmpnle_ss(__m128 __a, __m128 __b) { |
| 225 |
// CHECK-LABEL: test_mm_cmpnle_ss |
| 226 |
// CHECK: @llvm.x86.sse.cmp.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 6) |
| 227 |
return _mm_cmpnle_ss(__a, __b); |
| 228 |
} |
| 229 |
|
| 230 |
__m128 test_mm_cmpnlt_ps(__m128 __a, __m128 __b) { |
| 231 |
// CHECK-LABEL: test_mm_cmpnlt_ps |
| 232 |
// CHECK: [[CMP:%.*]] = fcmp uge <4 x float> |
| 233 |
// CHECK-NEXT: [[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i32> |
| 234 |
// CHECK-NEXT: [[BC:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float> |
| 235 |
// CHECK-NEXT: ret <4 x float> [[BC]] |
| 236 |
return _mm_cmpnlt_ps(__a, __b); |
| 237 |
} |
| 238 |
|
| 239 |
__m128 test_mm_cmpnlt_ss(__m128 __a, __m128 __b) { |
| 240 |
// CHECK-LABEL: test_mm_cmpnlt_ss |
| 241 |
// CHECK: @llvm.x86.sse.cmp.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 5) |
| 242 |
return _mm_cmpnlt_ss(__a, __b); |
| 243 |
} |
| 244 |
|
| 245 |
__m128 test_mm_cmpord_ps(__m128 __a, __m128 __b) { |
| 246 |
// CHECK-LABEL: test_mm_cmpord_ps |
| 247 |
// CHECK: [[CMP:%.*]] = fcmp ord <4 x float> |
| 248 |
// CHECK-NEXT: [[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i32> |
| 249 |
// CHECK-NEXT: [[BC:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float> |
| 250 |
// CHECK-NEXT: ret <4 x float> [[BC]] |
| 251 |
return _mm_cmpord_ps(__a, __b); |
| 252 |
} |
| 253 |
|
| 254 |
__m128 test_mm_cmpord_ss(__m128 __a, __m128 __b) { |
| 255 |
// CHECK-LABEL: test_mm_cmpord_ss |
| 256 |
// CHECK: @llvm.x86.sse.cmp.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 7) |
| 257 |
return _mm_cmpord_ss(__a, __b); |
| 258 |
} |
| 259 |
|
| 260 |
__m128 test_mm_cmpunord_ps(__m128 __a, __m128 __b) { |
| 261 |
// CHECK-LABEL: test_mm_cmpunord_ps |
| 262 |
// CHECK: [[CMP:%.*]] = fcmp uno <4 x float> |
| 263 |
// CHECK-NEXT: [[SEXT:%.*]] = sext <4 x i1> [[CMP]] to <4 x i32> |
| 264 |
// CHECK-NEXT: [[BC:%.*]] = bitcast <4 x i32> [[SEXT]] to <4 x float> |
| 265 |
// CHECK-NEXT: ret <4 x float> [[BC]] |
| 266 |
return _mm_cmpunord_ps(__a, __b); |
| 267 |
} |
| 268 |
|
| 269 |
__m128 test_mm_cmpunord_ss(__m128 __a, __m128 __b) { |
| 270 |
// CHECK-LABEL: test_mm_cmpunord_ss |
| 271 |
// CHECK: @llvm.x86.sse.cmp.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 3) |
| 272 |
return _mm_cmpunord_ss(__a, __b); |
| 273 |
} |
| 274 |
|
| 275 |
int test_mm_comieq_ss(__m128 A, __m128 B) { |
| 276 |
// CHECK-LABEL: test_mm_comieq_ss |
| 277 |
// CHECK: call i32 @llvm.x86.sse.comieq.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 278 |
return _mm_comieq_ss(A, B); |
| 279 |
} |
| 280 |
|
| 281 |
int test_mm_comige_ss(__m128 A, __m128 B) { |
| 282 |
// CHECK-LABEL: test_mm_comige_ss |
| 283 |
// CHECK: call i32 @llvm.x86.sse.comige.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 284 |
return _mm_comige_ss(A, B); |
| 285 |
} |
| 286 |
|
| 287 |
int test_mm_comigt_ss(__m128 A, __m128 B) { |
| 288 |
// CHECK-LABEL: test_mm_comigt_ss |
| 289 |
// CHECK: call i32 @llvm.x86.sse.comigt.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 290 |
return _mm_comigt_ss(A, B); |
| 291 |
} |
| 292 |
|
| 293 |
int test_mm_comile_ss(__m128 A, __m128 B) { |
| 294 |
// CHECK-LABEL: test_mm_comile_ss |
| 295 |
// CHECK: call i32 @llvm.x86.sse.comile.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 296 |
return _mm_comile_ss(A, B); |
| 297 |
} |
| 298 |
|
| 299 |
int test_mm_comilt_ss(__m128 A, __m128 B) { |
| 300 |
// CHECK-LABEL: test_mm_comilt_ss |
| 301 |
// CHECK: call i32 @llvm.x86.sse.comilt.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 302 |
return _mm_comilt_ss(A, B); |
| 303 |
} |
| 304 |
|
| 305 |
int test_mm_comineq_ss(__m128 A, __m128 B) { |
| 306 |
// CHECK-LABEL: test_mm_comineq_ss |
| 307 |
// CHECK: call i32 @llvm.x86.sse.comineq.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 308 |
return _mm_comineq_ss(A, B); |
| 309 |
} |
| 310 |
|
| 311 |
int test_mm_cvt_ss2si(__m128 A) { |
| 312 |
// CHECK-LABEL: test_mm_cvt_ss2si |
| 313 |
// CHECK: call i32 @llvm.x86.sse.cvtss2si(<4 x float> %{{.*}}) |
| 314 |
return _mm_cvt_ss2si(A); |
| 315 |
} |
| 316 |
|
| 317 |
__m128 test_mm_cvtsi32_ss(__m128 A, int B) { |
| 318 |
// CHECK-LABEL: test_mm_cvtsi32_ss |
| 319 |
// CHECK: sitofp i32 %{{.*}} to float |
| 320 |
// CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 0 |
| 321 |
return _mm_cvtsi32_ss(A, B); |
| 322 |
} |
| 323 |
|
| 324 |
#ifdef __x86_64__ |
| 325 |
__m128 test_mm_cvtsi64_ss(__m128 A, long long B) { |
| 326 |
// CHECK-LABEL: test_mm_cvtsi64_ss |
| 327 |
// CHECK: sitofp i64 %{{.*}} to float |
| 328 |
// CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 0 |
| 329 |
return _mm_cvtsi64_ss(A, B); |
| 330 |
} |
| 331 |
#endif |
| 332 |
|
| 333 |
float test_mm_cvtss_f32(__m128 A) { |
| 334 |
// CHECK-LABEL: test_mm_cvtss_f32 |
| 335 |
// CHECK: extractelement <4 x float> %{{.*}}, i32 0 |
| 336 |
return _mm_cvtss_f32(A); |
| 337 |
} |
| 338 |
|
| 339 |
int test_mm_cvtss_si32(__m128 A) { |
| 340 |
// CHECK-LABEL: test_mm_cvtss_si32 |
| 341 |
// CHECK: call i32 @llvm.x86.sse.cvtss2si(<4 x float> %{{.*}}) |
| 342 |
return _mm_cvtss_si32(A); |
| 343 |
} |
| 344 |
|
| 345 |
#ifdef __x86_64__ |
| 346 |
long long test_mm_cvtss_si64(__m128 A) { |
| 347 |
// CHECK-LABEL: test_mm_cvtss_si64 |
| 348 |
// CHECK: call i64 @llvm.x86.sse.cvtss2si64(<4 x float> %{{.*}}) |
| 349 |
return _mm_cvtss_si64(A); |
| 350 |
} |
| 351 |
#endif |
| 352 |
|
| 353 |
int test_mm_cvtt_ss2si(__m128 A) { |
| 354 |
// CHECK-LABEL: test_mm_cvtt_ss2si |
| 355 |
// CHECK: call i32 @llvm.x86.sse.cvttss2si(<4 x float> %{{.*}}) |
| 356 |
return _mm_cvtt_ss2si(A); |
| 357 |
} |
| 358 |
|
| 359 |
int test_mm_cvttss_si32(__m128 A) { |
| 360 |
// CHECK-LABEL: test_mm_cvttss_si32 |
| 361 |
// CHECK: call i32 @llvm.x86.sse.cvttss2si(<4 x float> %{{.*}}) |
| 362 |
return _mm_cvttss_si32(A); |
| 363 |
} |
| 364 |
|
| 365 |
#ifdef __x86_64__ |
| 366 |
long long test_mm_cvttss_si64(__m128 A) { |
| 367 |
// CHECK-LABEL: test_mm_cvttss_si64 |
| 368 |
// CHECK: call i64 @llvm.x86.sse.cvttss2si64(<4 x float> %{{.*}}) |
| 369 |
return _mm_cvttss_si64(A); |
| 370 |
} |
| 371 |
#endif |
| 372 |
|
| 373 |
__m128 test_mm_div_ps(__m128 A, __m128 B) { |
| 374 |
// CHECK-LABEL: test_mm_div_ps |
| 375 |
// CHECK: fdiv <4 x float> |
| 376 |
return _mm_div_ps(A, B); |
| 377 |
} |
| 378 |
|
| 379 |
__m128 test_mm_div_ss(__m128 A, __m128 B) { |
| 380 |
// CHECK-LABEL: test_mm_div_ss |
| 381 |
// CHECK: extractelement <4 x float> %{{.*}}, i32 0 |
| 382 |
// CHECK: extractelement <4 x float> %{{.*}}, i32 0 |
| 383 |
// CHECK: fdiv float |
| 384 |
// CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 0 |
| 385 |
return _mm_div_ss(A, B); |
| 386 |
} |
| 387 |
|
| 388 |
unsigned int test_MM_GET_EXCEPTION_MASK(void) { |
| 389 |
// CHECK-LABEL: test_MM_GET_EXCEPTION_MASK |
| 390 |
// CHECK: call void @llvm.x86.sse.stmxcsr(ptr %{{.*}}) |
| 391 |
// CHECK: and i32 %{{.*}}, 8064 |
| 392 |
return _MM_GET_EXCEPTION_MASK(); |
| 393 |
} |
| 394 |
|
| 395 |
unsigned int test_MM_GET_EXCEPTION_STATE(void) { |
| 396 |
// CHECK-LABEL: test_MM_GET_EXCEPTION_STATE |
| 397 |
// CHECK: call void @llvm.x86.sse.stmxcsr(ptr %{{.*}}) |
| 398 |
// CHECK: and i32 %{{.*}}, 63 |
| 399 |
return _MM_GET_EXCEPTION_STATE(); |
| 400 |
} |
| 401 |
|
| 402 |
unsigned int test_MM_GET_FLUSH_ZERO_MODE(void) { |
| 403 |
// CHECK-LABEL: test_MM_GET_FLUSH_ZERO_MODE |
| 404 |
// CHECK: call void @llvm.x86.sse.stmxcsr(ptr %{{.*}}) |
| 405 |
// CHECK: and i32 %{{.*}}, 32768 |
| 406 |
return _MM_GET_FLUSH_ZERO_MODE(); |
| 407 |
} |
| 408 |
|
| 409 |
unsigned int test_MM_GET_ROUNDING_MODE(void) { |
| 410 |
// CHECK-LABEL: test_MM_GET_ROUNDING_MODE |
| 411 |
// CHECK: call void @llvm.x86.sse.stmxcsr(ptr %{{.*}}) |
| 412 |
// CHECK: and i32 %{{.*}}, 24576 |
| 413 |
return _MM_GET_ROUNDING_MODE(); |
| 414 |
} |
| 415 |
|
| 416 |
unsigned int test_mm_getcsr(void) { |
| 417 |
// CHECK-LABEL: test_mm_getcsr |
| 418 |
// CHECK: call void @llvm.x86.sse.stmxcsr(ptr %{{.*}}) |
| 419 |
// CHECK: load i32 |
| 420 |
return _mm_getcsr(); |
| 421 |
} |
| 422 |
|
| 423 |
__m128 test_mm_load_ps(float* y) { |
| 424 |
// CHECK-LABEL: test_mm_load_ps |
| 425 |
// CHECK: load <4 x float>, ptr {{.*}}, align 16 |
| 426 |
return _mm_load_ps(y); |
| 427 |
} |
| 428 |
|
| 429 |
__m128 test_mm_load_ps1(float* y) { |
| 430 |
// CHECK-LABEL: test_mm_load_ps1 |
| 431 |
// CHECK: load float, ptr %{{.*}}, align 4 |
| 432 |
// CHECK: insertelement <4 x float> poison, float %{{.*}}, i32 0 |
| 433 |
// CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 1 |
| 434 |
// CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 2 |
| 435 |
// CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 3 |
| 436 |
return _mm_load_ps1(y); |
| 437 |
} |
| 438 |
|
| 439 |
__m128 test_mm_load_ss(float* y) { |
| 440 |
// CHECK-LABEL: test_mm_load_ss |
| 441 |
// CHECK: load float, ptr {{.*}}, align 1{{$}} |
| 442 |
// CHECK: insertelement <4 x float> poison, float %{{.*}}, i32 0 |
| 443 |
// CHECK: insertelement <4 x float> %{{.*}}, float 0.000000e+00, i32 1 |
| 444 |
// CHECK: insertelement <4 x float> %{{.*}}, float 0.000000e+00, i32 2 |
| 445 |
// CHECK: insertelement <4 x float> %{{.*}}, float 0.000000e+00, i32 3 |
| 446 |
return _mm_load_ss(y); |
| 447 |
} |
| 448 |
|
| 449 |
__m128 test_mm_load1_ps(float* y) { |
| 450 |
// CHECK-LABEL: test_mm_load1_ps |
| 451 |
// CHECK: load float, ptr %{{.*}}, align 4 |
| 452 |
// CHECK: insertelement <4 x float> poison, float %{{.*}}, i32 0 |
| 453 |
// CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 1 |
| 454 |
// CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 2 |
| 455 |
// CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 3 |
| 456 |
return _mm_load1_ps(y); |
| 457 |
} |
| 458 |
|
| 459 |
__m128 test_mm_loadh_pi(__m128 x, __m64* y) { |
| 460 |
// CHECK-LABEL: test_mm_loadh_pi |
| 461 |
// CHECK: load <2 x float>, ptr {{.*}}, align 1{{$}} |
| 462 |
// CHECK: shufflevector {{.*}} <4 x i32> <i32 0, i32 1 |
| 463 |
// CHECK: shufflevector {{.*}} <4 x i32> <i32 0, i32 1, i32 4, i32 5> |
| 464 |
return _mm_loadh_pi(x,y); |
| 465 |
} |
| 466 |
|
| 467 |
__m128 test_mm_loadl_pi(__m128 x, __m64* y) { |
| 468 |
// CHECK-LABEL: test_mm_loadl_pi |
| 469 |
// CHECK: load <2 x float>, ptr {{.*}}, align 1{{$}} |
| 470 |
// CHECK: shufflevector {{.*}} <4 x i32> <i32 0, i32 1 |
| 471 |
// CHECK: shufflevector {{.*}} <4 x i32> <i32 4, i32 5, i32 2, i32 3> |
| 472 |
return _mm_loadl_pi(x,y); |
| 473 |
} |
| 474 |
|
| 475 |
__m128 test_mm_loadr_ps(float* A) { |
| 476 |
// CHECK-LABEL: test_mm_loadr_ps |
| 477 |
// CHECK: load <4 x float>, ptr %{{.*}}, align 16 |
| 478 |
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 3, i32 2, i32 1, i32 0> |
| 479 |
return _mm_loadr_ps(A); |
| 480 |
} |
| 481 |
|
| 482 |
__m128 test_mm_loadu_ps(float* A) { |
| 483 |
// CHECK-LABEL: test_mm_loadu_ps |
| 484 |
// CHECK: load <4 x float>, ptr %{{.*}}, align 1{{$}} |
| 485 |
return _mm_loadu_ps(A); |
| 486 |
} |
| 487 |
|
| 488 |
__m128 test_mm_max_ps(__m128 A, __m128 B) { |
| 489 |
// CHECK-LABEL: test_mm_max_ps |
| 490 |
// CHECK: @llvm.x86.sse.max.ps(<4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 491 |
return _mm_max_ps(A, B); |
| 492 |
} |
| 493 |
|
| 494 |
__m128 test_mm_max_ss(__m128 A, __m128 B) { |
| 495 |
// CHECK-LABEL: test_mm_max_ss |
| 496 |
// CHECK: @llvm.x86.sse.max.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 497 |
return _mm_max_ss(A, B); |
| 498 |
} |
| 499 |
|
| 500 |
__m128 test_mm_min_ps(__m128 A, __m128 B) { |
| 501 |
// CHECK-LABEL: test_mm_min_ps |
| 502 |
// CHECK: @llvm.x86.sse.min.ps(<4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 503 |
return _mm_min_ps(A, B); |
| 504 |
} |
| 505 |
|
| 506 |
__m128 test_mm_min_ss(__m128 A, __m128 B) { |
| 507 |
// CHECK-LABEL: test_mm_min_ss |
| 508 |
// CHECK: @llvm.x86.sse.min.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 509 |
return _mm_min_ss(A, B); |
| 510 |
} |
| 511 |
|
| 512 |
__m128 test_mm_move_ss(__m128 A, __m128 B) { |
| 513 |
// CHECK-LABEL: test_mm_move_ss |
| 514 |
// CHECK: extractelement <4 x float> %{{.*}}, i32 0 |
| 515 |
// CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 0 |
| 516 |
return _mm_move_ss(A, B); |
| 517 |
} |
| 518 |
|
| 519 |
__m128 test_mm_movehl_ps(__m128 A, __m128 B) { |
| 520 |
// CHECK-LABEL: test_mm_movehl_ps |
| 521 |
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 6, i32 7, i32 2, i32 3> |
| 522 |
return _mm_movehl_ps(A, B); |
| 523 |
} |
| 524 |
|
| 525 |
__m128 test_mm_movelh_ps(__m128 A, __m128 B) { |
| 526 |
// CHECK-LABEL: test_mm_movelh_ps |
| 527 |
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 0, i32 1, i32 4, i32 5> |
| 528 |
return _mm_movelh_ps(A, B); |
| 529 |
} |
| 530 |
|
| 531 |
int test_mm_movemask_ps(__m128 A) { |
| 532 |
// CHECK-LABEL: test_mm_movemask_ps |
| 533 |
// CHECK: call i32 @llvm.x86.sse.movmsk.ps(<4 x float> %{{.*}}) |
| 534 |
return _mm_movemask_ps(A); |
| 535 |
} |
| 536 |
|
| 537 |
__m128 test_mm_mul_ps(__m128 A, __m128 B) { |
| 538 |
// CHECK-LABEL: test_mm_mul_ps |
| 539 |
// CHECK: fmul <4 x float> |
| 540 |
return _mm_mul_ps(A, B); |
| 541 |
} |
| 542 |
|
| 543 |
__m128 test_mm_mul_ss(__m128 A, __m128 B) { |
| 544 |
// CHECK-LABEL: test_mm_mul_ss |
| 545 |
// CHECK: extractelement <4 x float> %{{.*}}, i32 0 |
| 546 |
// CHECK: extractelement <4 x float> %{{.*}}, i32 0 |
| 547 |
// CHECK: fmul float |
| 548 |
// CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 0 |
| 549 |
return _mm_mul_ss(A, B); |
| 550 |
} |
| 551 |
|
| 552 |
__m128 test_mm_or_ps(__m128 A, __m128 B) { |
| 553 |
// CHECK-LABEL: test_mm_or_ps |
| 554 |
// CHECK: or <4 x i32> |
| 555 |
return _mm_or_ps(A, B); |
| 556 |
} |
| 557 |
|
| 558 |
void test_mm_prefetch(char const* p) { |
| 559 |
// CHECK-LABEL: test_mm_prefetch |
| 560 |
// CHECK: call void @llvm.prefetch.p0(ptr {{.*}}, i32 0, i32 0, i32 1) |
| 561 |
_mm_prefetch(p, 0); |
| 562 |
} |
| 563 |
|
| 564 |
__m128 test_mm_rcp_ps(__m128 x) { |
| 565 |
// CHECK-LABEL: test_mm_rcp_ps |
| 566 |
// CHECK: call <4 x float> @llvm.x86.sse.rcp.ps(<4 x float> {{.*}}) |
| 567 |
return _mm_rcp_ps(x); |
| 568 |
} |
| 569 |
|
| 570 |
__m128 test_mm_rcp_ss(__m128 x) { |
| 571 |
// CHECK-LABEL: test_mm_rcp_ss |
| 572 |
// CHECK: call <4 x float> @llvm.x86.sse.rcp.ss(<4 x float> {{.*}}) |
| 573 |
return _mm_rcp_ss(x); |
| 574 |
} |
| 575 |
|
| 576 |
__m128 test_mm_rsqrt_ps(__m128 x) { |
| 577 |
// CHECK-LABEL: test_mm_rsqrt_ps |
| 578 |
// CHECK: call <4 x float> @llvm.x86.sse.rsqrt.ps(<4 x float> {{.*}}) |
| 579 |
return _mm_rsqrt_ps(x); |
| 580 |
} |
| 581 |
|
| 582 |
__m128 test_mm_rsqrt_ss(__m128 x) { |
| 583 |
// CHECK-LABEL: test_mm_rsqrt_ss |
| 584 |
// CHECK: call <4 x float> @llvm.x86.sse.rsqrt.ss(<4 x float> {{.*}}) |
| 585 |
return _mm_rsqrt_ss(x); |
| 586 |
} |
| 587 |
|
| 588 |
void test_MM_SET_EXCEPTION_MASK(unsigned int A) { |
| 589 |
// CHECK-LABEL: test_MM_SET_EXCEPTION_MASK |
| 590 |
// CHECK: call void @llvm.x86.sse.stmxcsr(ptr {{.*}}) |
| 591 |
// CHECK: load i32 |
| 592 |
// CHECK: and i32 {{.*}}, -8065 |
| 593 |
// CHECK: or i32 |
| 594 |
// CHECK: store i32 |
| 595 |
// CHECK: call void @llvm.x86.sse.ldmxcsr(ptr {{.*}}) |
| 596 |
_MM_SET_EXCEPTION_MASK(A); |
| 597 |
} |
| 598 |
|
| 599 |
void test_MM_SET_EXCEPTION_STATE(unsigned int A) { |
| 600 |
// CHECK-LABEL: test_MM_SET_EXCEPTION_STATE |
| 601 |
// CHECK: call void @llvm.x86.sse.stmxcsr(ptr {{.*}}) |
| 602 |
// CHECK: load i32 |
| 603 |
// CHECK: and i32 {{.*}}, -64 |
| 604 |
// CHECK: or i32 |
| 605 |
// CHECK: store i32 |
| 606 |
// CHECK: call void @llvm.x86.sse.ldmxcsr(ptr {{.*}}) |
| 607 |
_MM_SET_EXCEPTION_STATE(A); |
| 608 |
} |
| 609 |
|
| 610 |
void test_MM_SET_FLUSH_ZERO_MODE(unsigned int A) { |
| 611 |
// CHECK-LABEL: test_MM_SET_FLUSH_ZERO_MODE |
| 612 |
// CHECK: call void @llvm.x86.sse.stmxcsr(ptr {{.*}}) |
| 613 |
// CHECK: load i32 |
| 614 |
// CHECK: and i32 {{.*}}, -32769 |
| 615 |
// CHECK: or i32 |
| 616 |
// CHECK: store i32 |
| 617 |
// CHECK: call void @llvm.x86.sse.ldmxcsr(ptr {{.*}}) |
| 618 |
_MM_SET_FLUSH_ZERO_MODE(A); |
| 619 |
} |
| 620 |
|
| 621 |
__m128 test_mm_set_ps(float A, float B, float C, float D) { |
| 622 |
// CHECK-LABEL: test_mm_set_ps |
| 623 |
// CHECK: insertelement <4 x float> poison, float {{.*}}, i32 0 |
| 624 |
// CHECK: insertelement <4 x float> {{.*}}, float {{.*}}, i32 1 |
| 625 |
// CHECK: insertelement <4 x float> {{.*}}, float {{.*}}, i32 2 |
| 626 |
// CHECK: insertelement <4 x float> {{.*}}, float {{.*}}, i32 3 |
| 627 |
return _mm_set_ps(A, B, C, D); |
| 628 |
} |
| 629 |
|
| 630 |
__m128 test_mm_set_ps1(float A) { |
| 631 |
// CHECK-LABEL: test_mm_set_ps1 |
| 632 |
// CHECK: insertelement <4 x float> poison, float {{.*}}, i32 0 |
| 633 |
// CHECK: insertelement <4 x float> {{.*}}, float {{.*}}, i32 1 |
| 634 |
// CHECK: insertelement <4 x float> {{.*}}, float {{.*}}, i32 2 |
| 635 |
// CHECK: insertelement <4 x float> {{.*}}, float {{.*}}, i32 3 |
| 636 |
return _mm_set_ps1(A); |
| 637 |
} |
| 638 |
|
| 639 |
void test_MM_SET_ROUNDING_MODE(unsigned int A) { |
| 640 |
// CHECK-LABEL: test_MM_SET_ROUNDING_MODE |
| 641 |
// CHECK: call void @llvm.x86.sse.stmxcsr(ptr {{.*}}) |
| 642 |
// CHECK: load i32 |
| 643 |
// CHECK: and i32 {{.*}}, -24577 |
| 644 |
// CHECK: or i32 |
| 645 |
// CHECK: store i32 |
| 646 |
// CHECK: call void @llvm.x86.sse.ldmxcsr(ptr {{.*}}) |
| 647 |
_MM_SET_ROUNDING_MODE(A); |
| 648 |
} |
| 649 |
|
| 650 |
__m128 test_mm_set_ss(float A) { |
| 651 |
// CHECK-LABEL: test_mm_set_ss |
| 652 |
// CHECK: insertelement <4 x float> poison, float {{.*}}, i32 0 |
| 653 |
// CHECK: insertelement <4 x float> {{.*}}, float 0.000000e+00, i32 1 |
| 654 |
// CHECK: insertelement <4 x float> {{.*}}, float 0.000000e+00, i32 2 |
| 655 |
// CHECK: insertelement <4 x float> {{.*}}, float 0.000000e+00, i32 3 |
| 656 |
return _mm_set_ss(A); |
| 657 |
} |
| 658 |
|
| 659 |
__m128 test_mm_set1_ps(float A) { |
| 660 |
// CHECK-LABEL: test_mm_set1_ps |
| 661 |
// CHECK: insertelement <4 x float> poison, float {{.*}}, i32 0 |
| 662 |
// CHECK: insertelement <4 x float> {{.*}}, float {{.*}}, i32 1 |
| 663 |
// CHECK: insertelement <4 x float> {{.*}}, float {{.*}}, i32 2 |
| 664 |
// CHECK: insertelement <4 x float> {{.*}}, float {{.*}}, i32 3 |
| 665 |
return _mm_set1_ps(A); |
| 666 |
} |
| 667 |
|
| 668 |
void test_mm_setcsr(unsigned int A) { |
| 669 |
// CHECK-LABEL: test_mm_setcsr |
| 670 |
// CHECK: store i32 |
| 671 |
// CHECK: call void @llvm.x86.sse.ldmxcsr(ptr {{.*}}) |
| 672 |
_mm_setcsr(A); |
| 673 |
} |
| 674 |
|
| 675 |
__m128 test_mm_setr_ps(float A, float B, float C, float D) { |
| 676 |
// CHECK-LABEL: test_mm_setr_ps |
| 677 |
// CHECK: insertelement <4 x float> poison, float {{.*}}, i32 0 |
| 678 |
// CHECK: insertelement <4 x float> {{.*}}, float {{.*}}, i32 1 |
| 679 |
// CHECK: insertelement <4 x float> {{.*}}, float {{.*}}, i32 2 |
| 680 |
// CHECK: insertelement <4 x float> {{.*}}, float {{.*}}, i32 3 |
| 681 |
return _mm_setr_ps(A, B, C, D); |
| 682 |
} |
| 683 |
|
| 684 |
__m128 test_mm_setzero_ps(void) { |
| 685 |
// CHECK-LABEL: test_mm_setzero_ps |
| 686 |
// CHECK: store <4 x float> zeroinitializer |
| 687 |
return _mm_setzero_ps(); |
| 688 |
} |
| 689 |
|
| 690 |
void test_mm_sfence(void) { |
| 691 |
// CHECK-LABEL: test_mm_sfence |
| 692 |
// CHECK: call void @llvm.x86.sse.sfence() |
| 693 |
_mm_sfence(); |
| 694 |
} |
| 695 |
|
| 696 |
__m128 test_mm_shuffle_ps(__m128 A, __m128 B) { |
| 697 |
// CHECK-LABEL: test_mm_shuffle_ps |
| 698 |
// CHECK: shufflevector <4 x float> {{.*}}, <4 x float> {{.*}}, <4 x i32> <i32 0, i32 0, i32 4, i32 4> |
| 699 |
return _mm_shuffle_ps(A, B, 0); |
| 700 |
} |
| 701 |
|
| 702 |
__m128 test_mm_sqrt_ps(__m128 x) { |
| 703 |
// CHECK-LABEL: test_mm_sqrt_ps |
| 704 |
// CHECK: call <4 x float> @llvm.sqrt.v4f32(<4 x float> {{.*}}) |
| 705 |
return _mm_sqrt_ps(x); |
| 706 |
} |
| 707 |
|
| 708 |
__m128 test_mm_sqrt_ss(__m128 x) { |
| 709 |
// CHECK-LABEL: test_mm_sqrt_ss |
| 710 |
// CHECK: extractelement <4 x float> {{.*}}, i64 0 |
| 711 |
// CHECK: call float @llvm.sqrt.f32(float {{.*}}) |
| 712 |
// CHECK: insertelement <4 x float> {{.*}}, float {{.*}}, i64 0 |
| 713 |
return _mm_sqrt_ss(x); |
| 714 |
} |
| 715 |
|
| 716 |
void test_mm_store_ps(float* x, __m128 y) { |
| 717 |
// CHECK-LABEL: test_mm_store_ps |
| 718 |
// CHECK: store <4 x float> %{{.*}}, ptr {{.*}}, align 16 |
| 719 |
_mm_store_ps(x, y); |
| 720 |
} |
| 721 |
|
| 722 |
void test_mm_store_ps1(float* x, __m128 y) { |
| 723 |
// CHECK-LABEL: test_mm_store_ps1 |
| 724 |
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> zeroinitializer |
| 725 |
// CHECK: store <4 x float> %{{.*}}, ptr %{{.*}}, align 16 |
| 726 |
_mm_store_ps1(x, y); |
| 727 |
} |
| 728 |
|
| 729 |
void test_mm_store_ss(float* x, __m128 y) { |
| 730 |
// CHECK-LABEL: test_mm_store_ss |
| 731 |
// CHECK: extractelement <4 x float> {{.*}}, i32 0 |
| 732 |
// CHECK: store float %{{.*}}, ptr {{.*}}, align 1{{$}} |
| 733 |
_mm_store_ss(x, y); |
| 734 |
} |
| 735 |
|
| 736 |
void test_mm_store1_ps(float* x, __m128 y) { |
| 737 |
// CHECK-LABEL: test_mm_store1_ps |
| 738 |
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> zeroinitializer |
| 739 |
// CHECK: store <4 x float> %{{.*}}, ptr %{{.*}}, align 16 |
| 740 |
_mm_store1_ps(x, y); |
| 741 |
} |
| 742 |
|
| 743 |
void test_mm_storeh_pi(__m64* x, __m128 y) { |
| 744 |
// CHECK-LABEL: test_mm_storeh_pi |
| 745 |
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <2 x i32> <i32 2, i32 3> |
| 746 |
// CHECK: store <2 x float> %{{.*}}, ptr %{{.*}}, align 1{{$}} |
| 747 |
_mm_storeh_pi(x, y); |
| 748 |
} |
| 749 |
|
| 750 |
void test_mm_storel_pi(__m64* x, __m128 y) { |
| 751 |
// CHECK-LABEL: test_mm_storel_pi |
| 752 |
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <2 x i32> <i32 0, i32 1> |
| 753 |
// CHECK: store <2 x float> %{{.*}}, ptr %{{.*}}, align 1{{$}} |
| 754 |
_mm_storel_pi(x, y); |
| 755 |
} |
| 756 |
|
| 757 |
void test_mm_storer_ps(float* x, __m128 y) { |
| 758 |
// CHECK-LABEL: test_mm_storer_ps |
| 759 |
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 3, i32 2, i32 1, i32 0> |
| 760 |
// CHECK: store <4 x float> %{{.*}}, ptr {{.*}}, align 16 |
| 761 |
_mm_storer_ps(x, y); |
| 762 |
} |
| 763 |
|
| 764 |
void test_mm_storeu_ps(float* x, __m128 y) { |
| 765 |
// CHECK-LABEL: test_mm_storeu_ps |
| 766 |
// CHECK: store <4 x float> %{{.*}}, ptr %{{.*}}, align 1{{$}} |
| 767 |
// CHECK-NEXT: ret void |
| 768 |
_mm_storeu_ps(x, y); |
| 769 |
} |
| 770 |
|
| 771 |
void test_mm_stream_ps(float*A, __m128 B) { |
| 772 |
// CHECK-LABEL: test_mm_stream_ps |
| 773 |
// CHECK: store <4 x float> %{{.*}}, ptr %{{.*}}, align 16, !nontemporal |
| 774 |
_mm_stream_ps(A, B); |
| 775 |
} |
| 776 |
|
| 777 |
void test_mm_stream_ps_void(void *A, __m128 B) { |
| 778 |
// CHECK-LABEL: test_mm_stream_ps_void |
| 779 |
// CHECK: store <4 x float> %{{.*}}, ptr %{{.*}}, align 16, !nontemporal |
| 780 |
_mm_stream_ps(A, B); |
| 781 |
} |
| 782 |
|
| 783 |
__m128 test_mm_sub_ps(__m128 A, __m128 B) { |
| 784 |
// CHECK-LABEL: test_mm_sub_ps |
| 785 |
// CHECK: fsub <4 x float> |
| 786 |
return _mm_sub_ps(A, B); |
| 787 |
} |
| 788 |
|
| 789 |
__m128 test_mm_sub_ss(__m128 A, __m128 B) { |
| 790 |
// CHECK-LABEL: test_mm_sub_ss |
| 791 |
// CHECK: extractelement <4 x float> %{{.*}}, i32 0 |
| 792 |
// CHECK: extractelement <4 x float> %{{.*}}, i32 0 |
| 793 |
// CHECK: fsub float |
| 794 |
// CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 0 |
| 795 |
return _mm_sub_ss(A, B); |
| 796 |
} |
| 797 |
|
| 798 |
void test_MM_TRANSPOSE4_PS(__m128 *A, __m128 *B, __m128 *C, __m128 *D) { |
| 799 |
// CHECK-LABEL: test_MM_TRANSPOSE4_PS |
| 800 |
// CHECK: shufflevector <4 x float> {{.*}}, <4 x float> {{.*}}, <4 x i32> <i32 0, i32 4, i32 1, i32 5> |
| 801 |
// CHECK: shufflevector <4 x float> {{.*}}, <4 x float> {{.*}}, <4 x i32> <i32 0, i32 4, i32 1, i32 5> |
| 802 |
// CHECK: shufflevector <4 x float> {{.*}}, <4 x float> {{.*}}, <4 x i32> <i32 2, i32 6, i32 3, i32 7> |
| 803 |
// CHECK: shufflevector <4 x float> {{.*}}, <4 x float> {{.*}}, <4 x i32> <i32 2, i32 6, i32 3, i32 7> |
| 804 |
// CHECK: shufflevector <4 x float> {{.*}}, <4 x float> {{.*}}, <4 x i32> <i32 0, i32 1, i32 4, i32 5> |
| 805 |
// CHECK: shufflevector <4 x float> {{.*}}, <4 x float> {{.*}}, <4 x i32> <i32 6, i32 7, i32 2, i32 3> |
| 806 |
// CHECK: shufflevector <4 x float> {{.*}}, <4 x float> {{.*}}, <4 x i32> <i32 0, i32 1, i32 4, i32 5> |
| 807 |
// CHECK: shufflevector <4 x float> {{.*}}, <4 x float> {{.*}}, <4 x i32> <i32 6, i32 7, i32 2, i32 3> |
| 808 |
_MM_TRANSPOSE4_PS(*A, *B, *C, *D); |
| 809 |
} |
| 810 |
|
| 811 |
int test_mm_ucomieq_ss(__m128 A, __m128 B) { |
| 812 |
// CHECK-LABEL: test_mm_ucomieq_ss |
| 813 |
// CHECK: call i32 @llvm.x86.sse.ucomieq.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 814 |
return _mm_ucomieq_ss(A, B); |
| 815 |
} |
| 816 |
|
| 817 |
int test_mm_ucomige_ss(__m128 A, __m128 B) { |
| 818 |
// CHECK-LABEL: test_mm_ucomige_ss |
| 819 |
// CHECK: call i32 @llvm.x86.sse.ucomige.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 820 |
return _mm_ucomige_ss(A, B); |
| 821 |
} |
| 822 |
|
| 823 |
int test_mm_ucomigt_ss(__m128 A, __m128 B) { |
| 824 |
// CHECK-LABEL: test_mm_ucomigt_ss |
| 825 |
// CHECK: call i32 @llvm.x86.sse.ucomigt.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 826 |
return _mm_ucomigt_ss(A, B); |
| 827 |
} |
| 828 |
|
| 829 |
int test_mm_ucomile_ss(__m128 A, __m128 B) { |
| 830 |
// CHECK-LABEL: test_mm_ucomile_ss |
| 831 |
// CHECK: call i32 @llvm.x86.sse.ucomile.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 832 |
return _mm_ucomile_ss(A, B); |
| 833 |
} |
| 834 |
|
| 835 |
int test_mm_ucomilt_ss(__m128 A, __m128 B) { |
| 836 |
// CHECK-LABEL: test_mm_ucomilt_ss |
| 837 |
// CHECK: call i32 @llvm.x86.sse.ucomilt.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 838 |
return _mm_ucomilt_ss(A, B); |
| 839 |
} |
| 840 |
|
| 841 |
int test_mm_ucomineq_ss(__m128 A, __m128 B) { |
| 842 |
// CHECK-LABEL: test_mm_ucomineq_ss |
| 843 |
// CHECK: call i32 @llvm.x86.sse.ucomineq.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}) |
| 844 |
return _mm_ucomineq_ss(A, B); |
| 845 |
} |
| 846 |
|
| 847 |
__m128 test_mm_undefined_ps(void) { |
| 848 |
// CHECK-LABEL: test_mm_undefined_ps |
| 849 |
// CHECK: ret <4 x float> zeroinitializer |
| 850 |
return _mm_undefined_ps(); |
| 851 |
} |
| 852 |
|
| 853 |
__m128 test_mm_unpackhi_ps(__m128 A, __m128 B) { |
| 854 |
// CHECK-LABEL: test_mm_unpackhi_ps |
| 855 |
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 2, i32 6, i32 3, i32 7> |
| 856 |
return _mm_unpackhi_ps(A, B); |
| 857 |
} |
| 858 |
|
| 859 |
__m128 test_mm_unpacklo_ps(__m128 A, __m128 B) { |
| 860 |
// CHECK-LABEL: test_mm_unpacklo_ps |
| 861 |
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 0, i32 4, i32 1, i32 5> |
| 862 |
return _mm_unpacklo_ps(A, B); |
| 863 |
} |
| 864 |
|
| 865 |
__m128 test_mm_xor_ps(__m128 A, __m128 B) { |
| 866 |
// CHECK-LABEL: test_mm_xor_ps |
| 867 |
// CHECK: xor <4 x i32> |
| 868 |
return _mm_xor_ps(A, B); |
| 869 |
} |