1 // REQUIRES: x86-registered-target
2 // RUN: %clang_cc1 -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 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -ffp-exception-behavior=strict -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=CONSTRAINED --check-prefix=COMMON --check-prefix=COMMONIR
4 // RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -S %s -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK-ASM --check-prefix=COMMON
5 // RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -ffp-exception-behavior=strict -S %s -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK-ASM --check-prefix=COMMON
6 
7 
8 #include <immintrin.h>
9 
test_mm_sqrt_ps(__m128 x)10 __m128 test_mm_sqrt_ps(__m128 x) {
11   // COMMON-LABEL: test_mm_sqrt_ps
12   // UNCONSTRAINED: call <4 x float> @llvm.sqrt.v4f32(<4 x float> {{.*}})
13   // CONSTRAINED: call <4 x float> @llvm.experimental.constrained.sqrt.v4f32(<4 x float> {{.*}}, metadata !{{.*}})
14   // CHECK-ASM: sqrtps
15   return _mm_sqrt_ps(x);
16 }
17 
test_sqrt_ss(__m128 x)18 __m128 test_sqrt_ss(__m128 x) {
19   // COMMON-LABEL: test_sqrt_ss
20   // COMMONIR: extractelement <4 x float> {{.*}}, i64 0
21   // UNCONSTRAINED: call float @llvm.sqrt.f32(float {{.*}})
22   // CONSTRAINED: call float @llvm.experimental.constrained.sqrt.f32(float {{.*}}, metadata !{{.*}})
23   // CHECK-ASM: sqrtss
24   // COMMONIR: insertelement <4 x float> {{.*}}, float {{.*}}, i64 0
25   return _mm_sqrt_ss(x);
26 }
27 
28