| 1 |
// REQUIRES: x86-registered-target |
| 2 |
// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=UNCONSTRAINED --check-prefix=COMMON --check-prefix=COMMONIR |
| 3 |
// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -ffp-exception-behavior=maytrap -DSTRICT=1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=CONSTRAINED --check-prefix=COMMON --check-prefix=COMMONIR |
| 4 |
// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -S -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK-ASM --check-prefix=COMMON |
| 5 |
// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -ffp-exception-behavior=maytrap -DSTRICT=1 -S -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK-ASM --check-prefix=COMMON |
| 6 |
// RUN: %clang_cc1 -x c++ -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=UNCONSTRAINED --check-prefix=COMMON --check-prefix=COMMONIR |
| 7 |
// RUN: %clang_cc1 -x c++ -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -ffp-exception-behavior=maytrap -DSTRICT=1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=CONSTRAINED --check-prefix=COMMON --check-prefix=COMMONIR |
| 8 |
// RUN: %clang_cc1 -x c++ -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -S -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK-ASM --check-prefix=COMMON |
| 9 |
// RUN: %clang_cc1 -x c++ -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -ffp-exception-behavior=maytrap -DSTRICT=1 -S -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK-ASM --check-prefix=COMMON |
| 10 |
|
| 11 |
#ifdef STRICT |
| 12 |
// Test that the constrained intrinsics are picking up the exception |
| 13 |
// metadata from the AST instead of the global default from the command line. |
| 14 |
|
| 15 |
#pragma float_control(except, on) |
| 16 |
#endif |
| 17 |
|
| 18 |
|
| 19 |
#include <immintrin.h> |
| 20 |
|
| 21 |
__m128 test_mm_sqrt_ps(__m128 x) { |
| 22 |
// COMMON-LABEL: test_mm_sqrt_ps |
| 23 |
// UNCONSTRAINED: call {{.*}}<4 x float> @llvm.sqrt.v4f32(<4 x float> {{.*}}) |
| 24 |
// CONSTRAINED: call {{.*}}<4 x float> @llvm.experimental.constrained.sqrt.v4f32(<4 x float> {{.*}}, metadata !{{.*}}) |
| 25 |
// CHECK-ASM: sqrtps |
| 26 |
return _mm_sqrt_ps(x); |
| 27 |
} |
| 28 |
|
| 29 |
__m128 test_sqrt_ss(__m128 x) { |
| 30 |
// COMMON-LABEL: test_sqrt_ss |
| 31 |
// COMMONIR: extractelement <4 x float> {{.*}}, i32 0 |
| 32 |
// UNCONSTRAINED: call float @llvm.sqrt.f32(float {{.*}}) |
| 33 |
// CONSTRAINED: call float @llvm.experimental.constrained.sqrt.f32(float {{.*}}, metadata !{{.*}}) |
| 34 |
// CHECK-ASM: sqrtss |
| 35 |
// COMMONIR: insertelement <4 x float> {{.*}}, float {{.*}}, i32 0 |
| 36 |
return _mm_sqrt_ss(x); |
| 37 |
} |