[LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (#116856)
[llvm-project.git] / clang / test / CodeGen / pr87758.c
blob1357449187ecc79e71357d37841cebb8d6eab981
1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
3 // precise mode
4 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fmath-errno -ffp-contract=on \
5 // RUN: -fno-rounding-math -emit-llvm -o - %s | FileCheck \
6 // RUN: --check-prefix=CHECK-PRECISE %s
8 // fast mode
9 // RUN: %clang_cc1 -triple x86_64-linux-gnu -ffast-math -ffp-contract=fast \
10 // RUN: -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-FAST %s
12 // Reproducer for issue #87758
13 // The testcase below verifies that the "fast" flag are set on the calls.
15 float sqrtf(float x); // unary fp builtin
16 float powf(float x, float y); // binary fp builtin
17 float fmaf(float x, float y, float z); // ternary fp builtin
18 char *rindex(const char *s, int c); // not a fp builtin
20 #pragma float_control(push)
21 #pragma float_control(precise, off)
22 // CHECK: define dso_local float @fp_precise_off_libm_calls(
23 // CHECK: call fast float @llvm.sqrt.f32(
24 // CHECK: call fast float @llvm.pow.f32(
25 // CHECK: call fast float @llvm.fma.f32(
26 // CHECK: call ptr @rindex(
28 // CHECK-PRECISE: define dso_local float @fp_precise_off_libm_calls(
29 // CHECK-PRECISE: call fast float @sqrtf(
30 // CHECK-PRECISE: call fast float @powf(
31 // CHECK-PRECISE: call fast float @llvm.fma.f32(
32 // CHECK-PRECISE: call ptr @rindex(
34 // CHECK-FAST: define dso_local nofpclass(nan inf) float @fp_precise_off_libm_calls(
35 // CHECK-FAST: call fast float @llvm.sqrt.f32(
36 // CHECK-FAST: call fast float @llvm.pow.f32(
37 // CHECK-FAST: call fast float @llvm.fma.f32(
38 // CHECK-FAST: call ptr @rindex(
40 float fp_precise_off_libm_calls(float a, float b, float c, const char *d, char *e, unsigned char f) {
41 a = sqrtf(a);
42 a = powf(a,b);
43 a = fmaf(a,b,c);
44 e = rindex(d, 75);
45 return a;
47 #pragma float_control(pop)
49 #pragma float_control(push)
50 #pragma float_control(precise, on)
51 // CHECK: define dso_local float @fp_precise_on_libm_calls(
52 // CHECK: call float @sqrtf(
53 // CHECK: call float @powf(
54 // CHECK: call float @llvm.fma.f32(
55 // CHECK: call ptr @rindex(
57 // CHECK-PRECISE: define dso_local float @fp_precise_on_libm_calls(
58 // CHECK-PRECISE: call float @sqrtf(
59 // CHECK-PRECISE: call float @powf(
60 // CHECK-PRECISE: call float @llvm.fma.f32(
61 // CHECK-PRECISE: call ptr @rindex(
63 // CHECK-FAST: define dso_local nofpclass(nan inf) float @fp_precise_on_libm_calls(
64 // CHECK-FAST: call nofpclass(nan inf) float @sqrtf(
65 // CHECK-FAST: call nofpclass(nan inf) float @powf(
66 // CHECK-FAST: call float @llvm.fma.f32(
67 // CHECK-FAST: call ptr @rindex(
69 float fp_precise_on_libm_calls(float a, float b, float c, const char *d, char *e, unsigned char f) {
70 a = sqrtf(a);
71 a = powf(a,b);
72 a = fmaf(a,b,c);
73 e = rindex(d, 75);
74 return a;
76 #pragma float_control(pop)