[LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (#116856)
[llvm-project.git] / clang / test / CodeGen / flt_eval_macro.cpp
blob5383c98122235fb8daeec80173f11d540ad47509
1 // RUN: %clang_cc1 -fexperimental-strict-floating-point -DEXCEPT=1 \
2 // RUN: -fcxx-exceptions -triple x86_64-linux-gnu -emit-llvm -o - %s \
3 // RUN: | FileCheck -check-prefix=CHECK-SRC %s
5 // RUN: %clang_cc1 -fexperimental-strict-floating-point \
6 // RUN: -triple x86_64-linux-gnu -emit-llvm -o - %s -ffp-eval-method=source \
7 // RUN: | FileCheck -check-prefix=CHECK-SRC %s
9 // RUN: %clang_cc1 -fexperimental-strict-floating-point \
10 // RUN: -triple x86_64-linux-gnu -emit-llvm -o - %s -ffp-eval-method=double \
11 // RUN: | FileCheck -check-prefixes=CHECK-DBL %s
13 // RUN: %clang_cc1 -fexperimental-strict-floating-point \
14 // RUN: -triple x86_64-linux-gnu -emit-llvm -o - %s -ffp-eval-method=extended \
15 // RUN: | FileCheck -check-prefixes=CHECK-EXT-FLT %s
17 // RUN: %clang_cc1 -triple powerpc-unknown-aix -emit-llvm -o - %s \
18 // RUN: | FileCheck %s -check-prefix=CHECK-DBL-PPC
20 // RUN: %clang_cc1 -fexperimental-strict-floating-point -triple i386-linux-gnu \
21 // RUN: -emit-llvm -o - %s -ffp-eval-method=extended -mlong-double-80 \
22 // RUN: | FileCheck %s -check-prefix=CHECK-EXT-FLT
24 int getFEM() {
25 // LABEL: define {{.*}}getFEM{{.*}}
26 return __FLT_EVAL_METHOD__;
27 // CHECK-SRC: ret {{.*}} 0
28 // CHECK-DBL: ret {{.*}} 1
29 // CHECK-DBL-PPC: ret {{.*}} 1
30 // CHECK-EXT-FLT: ret {{.*}} 2
33 float func() {
34 // LABEL: define {{.*}}@_Z4func{{.*}}
35 float X = 100.0f;
36 float Y = -45.3f;
37 float Z = 393.78f;
38 float temp;
39 #if __FLT_EVAL_METHOD__ == 0
40 temp = X + Y + Z;
41 #elif __FLT_EVAL_METHOD__ == 1
42 temp = X * Y * Z;
43 #elif __FLT_EVAL_METHOD__ == 2
44 temp = X * Y - Z;
45 #endif
46 // CHECK-SRC: load float, ptr
47 // CHECK-SRC: load float, ptr
48 // CHECK-SRC: fadd float
49 // CHECK-SRC: load float, ptr
50 // CHECK-SRC: fadd float
52 // CHECK-DBL: load float, ptr
53 // CHECK-DBL: fpext float
54 // CHECK-DBL: load float, ptr
55 // CHECK-DBL: fpext float
56 // CHECK-DBL: fmul double
57 // CHECK-DBL: load float, ptr
58 // CHECK-DBL: fpext float
59 // CHECK-DBL: fmul double
60 // CHECK-DBL: fptrunc double
62 // CHECK-EXT-FLT: load float, ptr
63 // CHECK-EXT-FLT: fpext float
64 // CHECK-EXT-FLT: load float, ptr
65 // CHECK-EXT-FLT: fpext float
66 // CHECK-EXT-FLT: fmul x86_fp80
67 // CHECK-EXT-FLT: load float, ptr
68 // CHECK-EXT-FLT: fpext float
69 // CHECK-EXT-FLT: fsub x86_fp80
70 // CHECK-EXT-FLT: fptrunc x86_fp80
72 // CHECK-DBL-PPC: load float, ptr
73 // CHECK-DBL-PPC: load float, ptr
74 // CHECK-DBL-PPC: fmul float
75 // CHECK-DBL-PPC: load float, ptr
76 // CHECK-DBL-PPC: fmul float
78 return temp;