1 // SSE
2 // RUN: %clang_cc1 -fexperimental-strict-floating-point \
3 // RUN: -triple i386-pc-windows -target-cpu pentium4 -target-feature +sse \
4 // RUN: -emit-llvm -o - %s -ffp-eval-method=source \
5 // RUN: | FileCheck -check-prefix=CHECK-SRC %s
6 
7 // RUN: %clang_cc1 -fexperimental-strict-floating-point \
8 // RUN: -triple i386-pc-windows -target-cpu pentium4 -target-feature +sse \
9 // RUN: -emit-llvm -o - %s -ffp-eval-method=double \
10 // RUN: | FileCheck -check-prefix=CHECK-DBL %s
11 
12 // RUN: %clang_cc1 -fexperimental-strict-floating-point \
13 // RUN: -triple i386-pc-windows -target-cpu pentium4 -target-feature +sse \
14 // RUN: -emit-llvm -o - %s -ffp-eval-method=extended \
15 // RUN: | FileCheck -check-prefix=CHECK-DBL %s
16 
17 // SSE Fast Math
18 // RUN: %clang_cc1 -fexperimental-strict-floating-point \
19 // RUN: -triple i386-pc-windows -target-cpu pentium4 -target-feature +sse \
20 // RUN: -emit-llvm -o - %s -ffp-eval-method=source \
21 // RUN: -ffast-math | FileCheck -check-prefix=CHECK-FM-SRC %s
22 
23 // RUN: %clang_cc1 -fexperimental-strict-floating-point \
24 // RUN: -triple i386-pc-windows -target-cpu pentium4 -target-feature +sse \
25 // RUN: -emit-llvm -o - %s -ffp-eval-method=double \
26 // RUN: -ffast-math | FileCheck -check-prefix=CHECK-FM %s
27 
28 // RUN: %clang_cc1 -fexperimental-strict-floating-point \
29 // RUN: -triple i386-pc-windows -target-cpu pentium4 -target-feature +sse \
30 // RUN: -emit-llvm -o - %s -ffp-eval-method=extended \
31 // RUN: -ffast-math | FileCheck -check-prefix=CHECK-FM %s
32 
33 // NO SSE
34 // RUN: %clang_cc1 -fexperimental-strict-floating-point \
35 // RUN: -triple i386-pc-windows -target-cpu pentium4 -target-feature -sse \
36 // RUN: -emit-llvm -o - %s -ffp-eval-method=source  \
37 // RUN: | FileCheck -check-prefix=CHECK-SRC %s
38 
39 // RUN: %clang_cc1 -fexperimental-strict-floating-point \
40 // RUN: -triple i386-pc-windows -target-cpu pentium4 -target-feature -sse \
41 // RUN: -emit-llvm -o - %s -ffp-eval-method=double \
42 // RUN: | FileCheck -check-prefix=CHECK-DBL %s
43 
44 // RUN: %clang_cc1 -fexperimental-strict-floating-point \
45 // RUN: -triple i386-pc-windows -target-cpu pentium4 -target-feature -sse \
46 // RUN: -emit-llvm -o - %s -ffp-eval-method=extended \
47 // RUN: | FileCheck -check-prefix=CHECK-DBL %s
48 
49 // NO SSE Fast Math
50 // RUN: %clang_cc1 -fexperimental-strict-floating-point \
51 // RUN: -triple i386-pc-windows -target-cpu pentium4 -target-feature -sse \
52 // RUN: -emit-llvm -o - %s -ffp-eval-method=source \
53 // RUN: -ffast-math | FileCheck -check-prefix=CHECK %s
54 
55 // RUN: %clang_cc1 -fexperimental-strict-floating-point \
56 // RUN: -triple i386-pc-windows -target-cpu pentium4 -target-feature -sse \
57 // RUN: -emit-llvm -o - %s -ffp-eval-method=double \
58 // RUN: -ffast-math | FileCheck -check-prefix=CHECK-DBL-FM %s
59 
60 // RUN: %clang_cc1 -fexperimental-strict-floating-point \
61 // RUN: -triple i386-pc-windows -target-cpu pentium4 -target-feature -sse \
62 // RUN: -emit-llvm -o - %s -ffp-eval-method=extended \
63 // RUN: -ffast-math | FileCheck -check-prefix=CHECK-DBL-FM %s
64 
65 float addit(float a, float b, float c) {
66   // CHECK-SRC: load float, float*
67   // CHECK-SRC: load float, float*
68   // CHECK-SRC: fadd float
69   // CHECK-SRC: load float, float*
70   // CHECK-SRC: fadd float
71 
72   // CHECK-FM-SRC: load float, float*
73   // CHECK-FM-SRC: load float, float*
74   // CHECK-FM-SRC: fadd reassoc nnan ninf nsz arcp afn float
75   // CHECK-FM-SRC: load float, float*
76   // CHECK-FM-SRC: fadd reassoc nnan ninf nsz arcp afn float
77 
78   // CHECK-FM: load float, float*
79   // CHECK-FM: fpext float {{.*}} to double
80   // CHECK-FM: load float, float*
81   // CHECK-FM: fpext float {{.*}} to double
82   // CHECK-FM: fadd reassoc nnan ninf nsz arcp afn double
83   // CHECK-FM: load float, float*
84   // CHECK-FM: fadd reassoc nnan ninf nsz arcp afn double
85   // CHECK-FM: fptrunc double {{.*}} to float
86 
87   // CHECK-DBL: load float, float*
88   // CHECK-DBL: fpext float {{.*}} to double
89   // CHECK-DBL: load float, float*
90   // CHECK-DBL: fpext float {{.*}} to double
91   // CHECK-DBL: fadd double
92   // CHECK-DBL: load float, float*
93   // CHECK-DBL: fpext float {{.*}} to double
94   // CHECK-DBL: fadd double
95   // CHECK-DBL: fptrunc double {{.*}} to float
96 
97   // CHECK-DBL-FM: load float, float*
98   // CHECK-DBL-FM: fpext float {{.*}} to double
99   // CHECK-DBL-FM: load float, float*
100   // CHECK-DBL-FM: fpext float {{.*}} to double
101   // CHECK-DBL-FM: fadd reassoc nnan ninf nsz arcp afn double
102   // CHECK-DBL-FM: load float, float*
103   // CHECK-DBL-FM: fpext float {{.*}} to double
104   // CHECK-DBL-FM: fadd reassoc nnan ninf nsz arcp afn double
105   // CHECK-DBL-FM: fptrunc double {{.*}} to float
106 
107   // CHECK: ret float
108   return a + b + c;
109 }
110