1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -internal-isystem %S/Inputs/include -x c -fopenmp -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc %s -o %t-host.bc
3 // RUN: %clang_cc1 -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/../../lib/Headers/openmp_wrappers -internal-isystem %S/Inputs/include -x c -fopenmp -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-host.bc -o - | FileCheck %s --check-prefixes=CHECK,CHECK-C
4 // RUN: %clang_cc1 -internal-isystem %S/Inputs/include -x c++ -fopenmp -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc %s -o %t-host.bc
5 // RUN: %clang_cc1 -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/../../lib/Headers/openmp_wrappers -internal-isystem %S/Inputs/include -x c++ -fopenmp -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-host.bc -o - | FileCheck %s --check-prefixes=CHECK,CHECK-CPP
13 #pragma omp begin declare target
15 // CHECK-C-LABEL: @test_math_f64(
16 // CHECK-C-NEXT: entry:
17 // CHECK-C-NEXT: [[RETVAL_I13:%.*]] = alloca double, align 8, addrspace(5)
18 // CHECK-C-NEXT: [[__X_ADDR_I14:%.*]] = alloca double, align 8, addrspace(5)
19 // CHECK-C-NEXT: [[__Y_ADDR_I:%.*]] = alloca double, align 8, addrspace(5)
20 // CHECK-C-NEXT: [[__Z_ADDR_I:%.*]] = alloca double, align 8, addrspace(5)
21 // CHECK-C-NEXT: [[RETVAL_I9:%.*]] = alloca double, align 8, addrspace(5)
22 // CHECK-C-NEXT: [[__X_ADDR_I10:%.*]] = alloca double, align 8, addrspace(5)
23 // CHECK-C-NEXT: [[RETVAL_I4:%.*]] = alloca double, align 8, addrspace(5)
24 // CHECK-C-NEXT: [[__X_ADDR_I5:%.*]] = alloca double, align 8, addrspace(5)
25 // CHECK-C-NEXT: [[RETVAL_I:%.*]] = alloca double, align 8, addrspace(5)
26 // CHECK-C-NEXT: [[__X_ADDR_I:%.*]] = alloca double, align 8, addrspace(5)
27 // CHECK-C-NEXT: [[X_ADDR:%.*]] = alloca double, align 8, addrspace(5)
28 // CHECK-C-NEXT: [[Y_ADDR:%.*]] = alloca double, align 8, addrspace(5)
29 // CHECK-C-NEXT: [[Z_ADDR:%.*]] = alloca double, align 8, addrspace(5)
30 // CHECK-C-NEXT: [[L1:%.*]] = alloca double, align 8, addrspace(5)
31 // CHECK-C-NEXT: [[L2:%.*]] = alloca double, align 8, addrspace(5)
32 // CHECK-C-NEXT: [[L3:%.*]] = alloca double, align 8, addrspace(5)
33 // CHECK-C-NEXT: [[L4:%.*]] = alloca double, align 8, addrspace(5)
34 // CHECK-C-NEXT: [[X_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X_ADDR]] to ptr
35 // CHECK-C-NEXT: [[Y_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[Y_ADDR]] to ptr
36 // CHECK-C-NEXT: [[Z_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[Z_ADDR]] to ptr
37 // CHECK-C-NEXT: [[L1_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L1]] to ptr
38 // CHECK-C-NEXT: [[L2_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L2]] to ptr
39 // CHECK-C-NEXT: [[L3_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L3]] to ptr
40 // CHECK-C-NEXT: [[L4_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L4]] to ptr
41 // CHECK-C-NEXT: store double [[X:%.*]], ptr [[X_ADDR_ASCAST]], align 8
42 // CHECK-C-NEXT: store double [[Y:%.*]], ptr [[Y_ADDR_ASCAST]], align 8
43 // CHECK-C-NEXT: store double [[Z:%.*]], ptr [[Z_ADDR_ASCAST]], align 8
44 // CHECK-C-NEXT: [[TMP0:%.*]] = load double, ptr [[X_ADDR_ASCAST]], align 8
45 // CHECK-C-NEXT: [[RETVAL_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I]] to ptr
46 // CHECK-C-NEXT: [[__X_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I]] to ptr
47 // CHECK-C-NEXT: store double [[TMP0]], ptr [[__X_ADDR_ASCAST_I]], align 8
48 // CHECK-C-NEXT: [[TMP1:%.*]] = load double, ptr [[__X_ADDR_ASCAST_I]], align 8
49 // CHECK-C-NEXT: [[CALL_I:%.*]] = call double @__ocml_sin_f64(double noundef [[TMP1]]) #[[ATTR3:[0-9]+]]
50 // CHECK-C-NEXT: store double [[CALL_I]], ptr [[L1_ASCAST]], align 8
51 // CHECK-C-NEXT: [[TMP2:%.*]] = load double, ptr [[X_ADDR_ASCAST]], align 8
52 // CHECK-C-NEXT: [[RETVAL_ASCAST_I6:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I4]] to ptr
53 // CHECK-C-NEXT: [[__X_ADDR_ASCAST_I7:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I5]] to ptr
54 // CHECK-C-NEXT: store double [[TMP2]], ptr [[__X_ADDR_ASCAST_I7]], align 8
55 // CHECK-C-NEXT: [[TMP3:%.*]] = load double, ptr [[__X_ADDR_ASCAST_I7]], align 8
56 // CHECK-C-NEXT: [[CALL_I8:%.*]] = call double @__ocml_cos_f64(double noundef [[TMP3]]) #[[ATTR3]]
57 // CHECK-C-NEXT: store double [[CALL_I8]], ptr [[L2_ASCAST]], align 8
58 // CHECK-C-NEXT: [[TMP4:%.*]] = load double, ptr [[X_ADDR_ASCAST]], align 8
59 // CHECK-C-NEXT: [[RETVAL_ASCAST_I11:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I9]] to ptr
60 // CHECK-C-NEXT: [[__X_ADDR_ASCAST_I12:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I10]] to ptr
61 // CHECK-C-NEXT: store double [[TMP4]], ptr [[__X_ADDR_ASCAST_I12]], align 8
62 // CHECK-C-NEXT: [[TMP5:%.*]] = load double, ptr [[__X_ADDR_ASCAST_I12]], align 8
63 // CHECK-C-NEXT: [[TMP6:%.*]] = call double @llvm.fabs.f64(double [[TMP5]])
64 // CHECK-C-NEXT: store double [[TMP6]], ptr [[L3_ASCAST]], align 8
65 // CHECK-C-NEXT: [[TMP7:%.*]] = load double, ptr [[X_ADDR_ASCAST]], align 8
66 // CHECK-C-NEXT: [[TMP8:%.*]] = load double, ptr [[Y_ADDR_ASCAST]], align 8
67 // CHECK-C-NEXT: [[TMP9:%.*]] = load double, ptr [[Z_ADDR_ASCAST]], align 8
68 // CHECK-C-NEXT: [[RETVAL_ASCAST_I15:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I13]] to ptr
69 // CHECK-C-NEXT: [[__X_ADDR_ASCAST_I16:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I14]] to ptr
70 // CHECK-C-NEXT: [[__Y_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__Y_ADDR_I]] to ptr
71 // CHECK-C-NEXT: [[__Z_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__Z_ADDR_I]] to ptr
72 // CHECK-C-NEXT: store double [[TMP7]], ptr [[__X_ADDR_ASCAST_I16]], align 8
73 // CHECK-C-NEXT: store double [[TMP8]], ptr [[__Y_ADDR_ASCAST_I]], align 8
74 // CHECK-C-NEXT: store double [[TMP9]], ptr [[__Z_ADDR_ASCAST_I]], align 8
75 // CHECK-C-NEXT: [[TMP10:%.*]] = load double, ptr [[__X_ADDR_ASCAST_I16]], align 8
76 // CHECK-C-NEXT: [[TMP11:%.*]] = load double, ptr [[__Y_ADDR_ASCAST_I]], align 8
77 // CHECK-C-NEXT: [[TMP12:%.*]] = load double, ptr [[__Z_ADDR_ASCAST_I]], align 8
78 // CHECK-C-NEXT: [[TMP13:%.*]] = call double @llvm.fma.f64(double [[TMP10]], double [[TMP11]], double [[TMP12]])
79 // CHECK-C-NEXT: store double [[TMP13]], ptr [[L4_ASCAST]], align 8
80 // CHECK-C-NEXT: ret void
82 // CHECK-CPP-LABEL: @_Z13test_math_f64ddd(
83 // CHECK-CPP-NEXT: entry:
84 // CHECK-CPP-NEXT: [[RETVAL_I13:%.*]] = alloca double, align 8, addrspace(5)
85 // CHECK-CPP-NEXT: [[__X_ADDR_I14:%.*]] = alloca double, align 8, addrspace(5)
86 // CHECK-CPP-NEXT: [[__Y_ADDR_I:%.*]] = alloca double, align 8, addrspace(5)
87 // CHECK-CPP-NEXT: [[__Z_ADDR_I:%.*]] = alloca double, align 8, addrspace(5)
88 // CHECK-CPP-NEXT: [[RETVAL_I9:%.*]] = alloca double, align 8, addrspace(5)
89 // CHECK-CPP-NEXT: [[__X_ADDR_I10:%.*]] = alloca double, align 8, addrspace(5)
90 // CHECK-CPP-NEXT: [[RETVAL_I4:%.*]] = alloca double, align 8, addrspace(5)
91 // CHECK-CPP-NEXT: [[__X_ADDR_I5:%.*]] = alloca double, align 8, addrspace(5)
92 // CHECK-CPP-NEXT: [[RETVAL_I:%.*]] = alloca double, align 8, addrspace(5)
93 // CHECK-CPP-NEXT: [[__X_ADDR_I:%.*]] = alloca double, align 8, addrspace(5)
94 // CHECK-CPP-NEXT: [[X_ADDR:%.*]] = alloca double, align 8, addrspace(5)
95 // CHECK-CPP-NEXT: [[Y_ADDR:%.*]] = alloca double, align 8, addrspace(5)
96 // CHECK-CPP-NEXT: [[Z_ADDR:%.*]] = alloca double, align 8, addrspace(5)
97 // CHECK-CPP-NEXT: [[L1:%.*]] = alloca double, align 8, addrspace(5)
98 // CHECK-CPP-NEXT: [[L2:%.*]] = alloca double, align 8, addrspace(5)
99 // CHECK-CPP-NEXT: [[L3:%.*]] = alloca double, align 8, addrspace(5)
100 // CHECK-CPP-NEXT: [[L4:%.*]] = alloca double, align 8, addrspace(5)
101 // CHECK-CPP-NEXT: [[X_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X_ADDR]] to ptr
102 // CHECK-CPP-NEXT: [[Y_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[Y_ADDR]] to ptr
103 // CHECK-CPP-NEXT: [[Z_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[Z_ADDR]] to ptr
104 // CHECK-CPP-NEXT: [[L1_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L1]] to ptr
105 // CHECK-CPP-NEXT: [[L2_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L2]] to ptr
106 // CHECK-CPP-NEXT: [[L3_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L3]] to ptr
107 // CHECK-CPP-NEXT: [[L4_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L4]] to ptr
108 // CHECK-CPP-NEXT: store double [[X:%.*]], ptr [[X_ADDR_ASCAST]], align 8
109 // CHECK-CPP-NEXT: store double [[Y:%.*]], ptr [[Y_ADDR_ASCAST]], align 8
110 // CHECK-CPP-NEXT: store double [[Z:%.*]], ptr [[Z_ADDR_ASCAST]], align 8
111 // CHECK-CPP-NEXT: [[TMP0:%.*]] = load double, ptr [[X_ADDR_ASCAST]], align 8
112 // CHECK-CPP-NEXT: [[RETVAL_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I]] to ptr
113 // CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I]] to ptr
114 // CHECK-CPP-NEXT: store double [[TMP0]], ptr [[__X_ADDR_ASCAST_I]], align 8
115 // CHECK-CPP-NEXT: [[TMP1:%.*]] = load double, ptr [[__X_ADDR_ASCAST_I]], align 8
116 // CHECK-CPP-NEXT: [[CALL_I:%.*]] = call noundef double @__ocml_sin_f64(double noundef [[TMP1]]) #[[ATTR3:[0-9]+]]
117 // CHECK-CPP-NEXT: store double [[CALL_I]], ptr [[L1_ASCAST]], align 8
118 // CHECK-CPP-NEXT: [[TMP2:%.*]] = load double, ptr [[X_ADDR_ASCAST]], align 8
119 // CHECK-CPP-NEXT: [[RETVAL_ASCAST_I6:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I4]] to ptr
120 // CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I7:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I5]] to ptr
121 // CHECK-CPP-NEXT: store double [[TMP2]], ptr [[__X_ADDR_ASCAST_I7]], align 8
122 // CHECK-CPP-NEXT: [[TMP3:%.*]] = load double, ptr [[__X_ADDR_ASCAST_I7]], align 8
123 // CHECK-CPP-NEXT: [[CALL_I8:%.*]] = call noundef double @__ocml_cos_f64(double noundef [[TMP3]]) #[[ATTR3]]
124 // CHECK-CPP-NEXT: store double [[CALL_I8]], ptr [[L2_ASCAST]], align 8
125 // CHECK-CPP-NEXT: [[TMP4:%.*]] = load double, ptr [[X_ADDR_ASCAST]], align 8
126 // CHECK-CPP-NEXT: [[RETVAL_ASCAST_I11:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I9]] to ptr
127 // CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I12:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I10]] to ptr
128 // CHECK-CPP-NEXT: store double [[TMP4]], ptr [[__X_ADDR_ASCAST_I12]], align 8
129 // CHECK-CPP-NEXT: [[TMP5:%.*]] = load double, ptr [[__X_ADDR_ASCAST_I12]], align 8
130 // CHECK-CPP-NEXT: [[TMP6:%.*]] = call noundef double @llvm.fabs.f64(double [[TMP5]])
131 // CHECK-CPP-NEXT: store double [[TMP6]], ptr [[L3_ASCAST]], align 8
132 // CHECK-CPP-NEXT: [[TMP7:%.*]] = load double, ptr [[X_ADDR_ASCAST]], align 8
133 // CHECK-CPP-NEXT: [[TMP8:%.*]] = load double, ptr [[Y_ADDR_ASCAST]], align 8
134 // CHECK-CPP-NEXT: [[TMP9:%.*]] = load double, ptr [[Z_ADDR_ASCAST]], align 8
135 // CHECK-CPP-NEXT: [[RETVAL_ASCAST_I15:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I13]] to ptr
136 // CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I16:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I14]] to ptr
137 // CHECK-CPP-NEXT: [[__Y_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__Y_ADDR_I]] to ptr
138 // CHECK-CPP-NEXT: [[__Z_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__Z_ADDR_I]] to ptr
139 // CHECK-CPP-NEXT: store double [[TMP7]], ptr [[__X_ADDR_ASCAST_I16]], align 8
140 // CHECK-CPP-NEXT: store double [[TMP8]], ptr [[__Y_ADDR_ASCAST_I]], align 8
141 // CHECK-CPP-NEXT: store double [[TMP9]], ptr [[__Z_ADDR_ASCAST_I]], align 8
142 // CHECK-CPP-NEXT: [[TMP10:%.*]] = load double, ptr [[__X_ADDR_ASCAST_I16]], align 8
143 // CHECK-CPP-NEXT: [[TMP11:%.*]] = load double, ptr [[__Y_ADDR_ASCAST_I]], align 8
144 // CHECK-CPP-NEXT: [[TMP12:%.*]] = load double, ptr [[__Z_ADDR_ASCAST_I]], align 8
145 // CHECK-CPP-NEXT: [[TMP13:%.*]] = call noundef double @llvm.fma.f64(double [[TMP10]], double [[TMP11]], double [[TMP12]])
146 // CHECK-CPP-NEXT: store double [[TMP13]], ptr [[L4_ASCAST]], align 8
147 // CHECK-CPP-NEXT: ret void
149 void test_math_f64(double x
, double y
, double z
) {
153 double l4
= fma(x
, y
, z
);
156 // CHECK-C-LABEL: @test_math_f32(
157 // CHECK-C-NEXT: entry:
158 // CHECK-C-NEXT: [[RETVAL_I22:%.*]] = alloca double, align 8, addrspace(5)
159 // CHECK-C-NEXT: [[__X_ADDR_I23:%.*]] = alloca double, align 8, addrspace(5)
160 // CHECK-C-NEXT: [[__Y_ADDR_I:%.*]] = alloca double, align 8, addrspace(5)
161 // CHECK-C-NEXT: [[__Z_ADDR_I:%.*]] = alloca double, align 8, addrspace(5)
162 // CHECK-C-NEXT: [[RETVAL_I18:%.*]] = alloca double, align 8, addrspace(5)
163 // CHECK-C-NEXT: [[__X_ADDR_I19:%.*]] = alloca double, align 8, addrspace(5)
164 // CHECK-C-NEXT: [[RETVAL_I13:%.*]] = alloca double, align 8, addrspace(5)
165 // CHECK-C-NEXT: [[__X_ADDR_I14:%.*]] = alloca double, align 8, addrspace(5)
166 // CHECK-C-NEXT: [[RETVAL_I:%.*]] = alloca double, align 8, addrspace(5)
167 // CHECK-C-NEXT: [[__X_ADDR_I:%.*]] = alloca double, align 8, addrspace(5)
168 // CHECK-C-NEXT: [[X_ADDR:%.*]] = alloca float, align 4, addrspace(5)
169 // CHECK-C-NEXT: [[Y_ADDR:%.*]] = alloca float, align 4, addrspace(5)
170 // CHECK-C-NEXT: [[Z_ADDR:%.*]] = alloca float, align 4, addrspace(5)
171 // CHECK-C-NEXT: [[L1:%.*]] = alloca float, align 4, addrspace(5)
172 // CHECK-C-NEXT: [[L2:%.*]] = alloca float, align 4, addrspace(5)
173 // CHECK-C-NEXT: [[L3:%.*]] = alloca float, align 4, addrspace(5)
174 // CHECK-C-NEXT: [[L4:%.*]] = alloca float, align 4, addrspace(5)
175 // CHECK-C-NEXT: [[X_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X_ADDR]] to ptr
176 // CHECK-C-NEXT: [[Y_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[Y_ADDR]] to ptr
177 // CHECK-C-NEXT: [[Z_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[Z_ADDR]] to ptr
178 // CHECK-C-NEXT: [[L1_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L1]] to ptr
179 // CHECK-C-NEXT: [[L2_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L2]] to ptr
180 // CHECK-C-NEXT: [[L3_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L3]] to ptr
181 // CHECK-C-NEXT: [[L4_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L4]] to ptr
182 // CHECK-C-NEXT: store float [[X:%.*]], ptr [[X_ADDR_ASCAST]], align 4
183 // CHECK-C-NEXT: store float [[Y:%.*]], ptr [[Y_ADDR_ASCAST]], align 4
184 // CHECK-C-NEXT: store float [[Z:%.*]], ptr [[Z_ADDR_ASCAST]], align 4
185 // CHECK-C-NEXT: [[TMP0:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
186 // CHECK-C-NEXT: [[CONV:%.*]] = fpext float [[TMP0]] to double
187 // CHECK-C-NEXT: [[RETVAL_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I]] to ptr
188 // CHECK-C-NEXT: [[__X_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I]] to ptr
189 // CHECK-C-NEXT: store double [[CONV]], ptr [[__X_ADDR_ASCAST_I]], align 8
190 // CHECK-C-NEXT: [[TMP1:%.*]] = load double, ptr [[__X_ADDR_ASCAST_I]], align 8
191 // CHECK-C-NEXT: [[CALL_I:%.*]] = call double @__ocml_sin_f64(double noundef [[TMP1]]) #[[ATTR3]]
192 // CHECK-C-NEXT: [[CONV1:%.*]] = fptrunc double [[CALL_I]] to float
193 // CHECK-C-NEXT: store float [[CONV1]], ptr [[L1_ASCAST]], align 4
194 // CHECK-C-NEXT: [[TMP2:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
195 // CHECK-C-NEXT: [[CONV2:%.*]] = fpext float [[TMP2]] to double
196 // CHECK-C-NEXT: [[RETVAL_ASCAST_I15:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I13]] to ptr
197 // CHECK-C-NEXT: [[__X_ADDR_ASCAST_I16:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I14]] to ptr
198 // CHECK-C-NEXT: store double [[CONV2]], ptr [[__X_ADDR_ASCAST_I16]], align 8
199 // CHECK-C-NEXT: [[TMP3:%.*]] = load double, ptr [[__X_ADDR_ASCAST_I16]], align 8
200 // CHECK-C-NEXT: [[CALL_I17:%.*]] = call double @__ocml_cos_f64(double noundef [[TMP3]]) #[[ATTR3]]
201 // CHECK-C-NEXT: [[CONV4:%.*]] = fptrunc double [[CALL_I17]] to float
202 // CHECK-C-NEXT: store float [[CONV4]], ptr [[L2_ASCAST]], align 4
203 // CHECK-C-NEXT: [[TMP4:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
204 // CHECK-C-NEXT: [[CONV5:%.*]] = fpext float [[TMP4]] to double
205 // CHECK-C-NEXT: [[RETVAL_ASCAST_I20:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I18]] to ptr
206 // CHECK-C-NEXT: [[__X_ADDR_ASCAST_I21:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I19]] to ptr
207 // CHECK-C-NEXT: store double [[CONV5]], ptr [[__X_ADDR_ASCAST_I21]], align 8
208 // CHECK-C-NEXT: [[TMP5:%.*]] = load double, ptr [[__X_ADDR_ASCAST_I21]], align 8
209 // CHECK-C-NEXT: [[TMP6:%.*]] = call double @llvm.fabs.f64(double [[TMP5]])
210 // CHECK-C-NEXT: [[CONV7:%.*]] = fptrunc double [[TMP6]] to float
211 // CHECK-C-NEXT: store float [[CONV7]], ptr [[L3_ASCAST]], align 4
212 // CHECK-C-NEXT: [[TMP7:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
213 // CHECK-C-NEXT: [[CONV8:%.*]] = fpext float [[TMP7]] to double
214 // CHECK-C-NEXT: [[TMP8:%.*]] = load float, ptr [[Y_ADDR_ASCAST]], align 4
215 // CHECK-C-NEXT: [[CONV9:%.*]] = fpext float [[TMP8]] to double
216 // CHECK-C-NEXT: [[TMP9:%.*]] = load float, ptr [[Z_ADDR_ASCAST]], align 4
217 // CHECK-C-NEXT: [[CONV10:%.*]] = fpext float [[TMP9]] to double
218 // CHECK-C-NEXT: [[RETVAL_ASCAST_I24:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I22]] to ptr
219 // CHECK-C-NEXT: [[__X_ADDR_ASCAST_I25:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I23]] to ptr
220 // CHECK-C-NEXT: [[__Y_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__Y_ADDR_I]] to ptr
221 // CHECK-C-NEXT: [[__Z_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__Z_ADDR_I]] to ptr
222 // CHECK-C-NEXT: store double [[CONV8]], ptr [[__X_ADDR_ASCAST_I25]], align 8
223 // CHECK-C-NEXT: store double [[CONV9]], ptr [[__Y_ADDR_ASCAST_I]], align 8
224 // CHECK-C-NEXT: store double [[CONV10]], ptr [[__Z_ADDR_ASCAST_I]], align 8
225 // CHECK-C-NEXT: [[TMP10:%.*]] = load double, ptr [[__X_ADDR_ASCAST_I25]], align 8
226 // CHECK-C-NEXT: [[TMP11:%.*]] = load double, ptr [[__Y_ADDR_ASCAST_I]], align 8
227 // CHECK-C-NEXT: [[TMP12:%.*]] = load double, ptr [[__Z_ADDR_ASCAST_I]], align 8
228 // CHECK-C-NEXT: [[TMP13:%.*]] = call double @llvm.fma.f64(double [[TMP10]], double [[TMP11]], double [[TMP12]])
229 // CHECK-C-NEXT: [[CONV12:%.*]] = fptrunc double [[TMP13]] to float
230 // CHECK-C-NEXT: store float [[CONV12]], ptr [[L4_ASCAST]], align 4
231 // CHECK-C-NEXT: ret void
233 // CHECK-CPP-LABEL: @_Z13test_math_f32fff(
234 // CHECK-CPP-NEXT: entry:
235 // CHECK-CPP-NEXT: [[RETVAL_I32:%.*]] = alloca float, align 4, addrspace(5)
236 // CHECK-CPP-NEXT: [[__X_ADDR_I33:%.*]] = alloca float, align 4, addrspace(5)
237 // CHECK-CPP-NEXT: [[__Y_ADDR_I34:%.*]] = alloca float, align 4, addrspace(5)
238 // CHECK-CPP-NEXT: [[__Z_ADDR_I35:%.*]] = alloca float, align 4, addrspace(5)
239 // CHECK-CPP-NEXT: [[RETVAL_I28:%.*]] = alloca float, align 4, addrspace(5)
240 // CHECK-CPP-NEXT: [[__X_ADDR_I29:%.*]] = alloca float, align 4, addrspace(5)
241 // CHECK-CPP-NEXT: [[RETVAL_I24:%.*]] = alloca float, align 4, addrspace(5)
242 // CHECK-CPP-NEXT: [[__X_ADDR_I25:%.*]] = alloca float, align 4, addrspace(5)
243 // CHECK-CPP-NEXT: [[RETVAL_I19:%.*]] = alloca float, align 4, addrspace(5)
244 // CHECK-CPP-NEXT: [[__X_ADDR_I20:%.*]] = alloca float, align 4, addrspace(5)
245 // CHECK-CPP-NEXT: [[RETVAL_I14:%.*]] = alloca float, align 4, addrspace(5)
246 // CHECK-CPP-NEXT: [[__X_ADDR_I15:%.*]] = alloca float, align 4, addrspace(5)
247 // CHECK-CPP-NEXT: [[__Y_ADDR_I:%.*]] = alloca float, align 4, addrspace(5)
248 // CHECK-CPP-NEXT: [[__Z_ADDR_I:%.*]] = alloca float, align 4, addrspace(5)
249 // CHECK-CPP-NEXT: [[RETVAL_I9:%.*]] = alloca float, align 4, addrspace(5)
250 // CHECK-CPP-NEXT: [[__X_ADDR_I10:%.*]] = alloca float, align 4, addrspace(5)
251 // CHECK-CPP-NEXT: [[RETVAL_I4:%.*]] = alloca float, align 4, addrspace(5)
252 // CHECK-CPP-NEXT: [[__X_ADDR_I5:%.*]] = alloca float, align 4, addrspace(5)
253 // CHECK-CPP-NEXT: [[RETVAL_I:%.*]] = alloca float, align 4, addrspace(5)
254 // CHECK-CPP-NEXT: [[__X_ADDR_I:%.*]] = alloca float, align 4, addrspace(5)
255 // CHECK-CPP-NEXT: [[X_ADDR:%.*]] = alloca float, align 4, addrspace(5)
256 // CHECK-CPP-NEXT: [[Y_ADDR:%.*]] = alloca float, align 4, addrspace(5)
257 // CHECK-CPP-NEXT: [[Z_ADDR:%.*]] = alloca float, align 4, addrspace(5)
258 // CHECK-CPP-NEXT: [[L1:%.*]] = alloca float, align 4, addrspace(5)
259 // CHECK-CPP-NEXT: [[L2:%.*]] = alloca float, align 4, addrspace(5)
260 // CHECK-CPP-NEXT: [[L3:%.*]] = alloca float, align 4, addrspace(5)
261 // CHECK-CPP-NEXT: [[L4:%.*]] = alloca float, align 4, addrspace(5)
262 // CHECK-CPP-NEXT: [[X_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X_ADDR]] to ptr
263 // CHECK-CPP-NEXT: [[Y_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[Y_ADDR]] to ptr
264 // CHECK-CPP-NEXT: [[Z_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[Z_ADDR]] to ptr
265 // CHECK-CPP-NEXT: [[L1_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L1]] to ptr
266 // CHECK-CPP-NEXT: [[L2_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L2]] to ptr
267 // CHECK-CPP-NEXT: [[L3_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L3]] to ptr
268 // CHECK-CPP-NEXT: [[L4_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L4]] to ptr
269 // CHECK-CPP-NEXT: store float [[X:%.*]], ptr [[X_ADDR_ASCAST]], align 4
270 // CHECK-CPP-NEXT: store float [[Y:%.*]], ptr [[Y_ADDR_ASCAST]], align 4
271 // CHECK-CPP-NEXT: store float [[Z:%.*]], ptr [[Z_ADDR_ASCAST]], align 4
272 // CHECK-CPP-NEXT: [[TMP0:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
273 // CHECK-CPP-NEXT: [[RETVAL_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I]] to ptr
274 // CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I]] to ptr
275 // CHECK-CPP-NEXT: store float [[TMP0]], ptr [[__X_ADDR_ASCAST_I]], align 4
276 // CHECK-CPP-NEXT: [[TMP1:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I]], align 4
277 // CHECK-CPP-NEXT: [[RETVAL_ASCAST_I21:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I19]] to ptr
278 // CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I22:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I20]] to ptr
279 // CHECK-CPP-NEXT: store float [[TMP1]], ptr [[__X_ADDR_ASCAST_I22]], align 4
280 // CHECK-CPP-NEXT: [[TMP2:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I22]], align 4
281 // CHECK-CPP-NEXT: [[CALL_I23:%.*]] = call noundef float @__ocml_sin_f32(float noundef [[TMP2]]) #[[ATTR3]]
282 // CHECK-CPP-NEXT: store float [[CALL_I23]], ptr [[L1_ASCAST]], align 4
283 // CHECK-CPP-NEXT: [[TMP3:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
284 // CHECK-CPP-NEXT: [[RETVAL_ASCAST_I6:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I4]] to ptr
285 // CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I7:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I5]] to ptr
286 // CHECK-CPP-NEXT: store float [[TMP3]], ptr [[__X_ADDR_ASCAST_I7]], align 4
287 // CHECK-CPP-NEXT: [[TMP4:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I7]], align 4
288 // CHECK-CPP-NEXT: [[RETVAL_ASCAST_I26:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I24]] to ptr
289 // CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I27:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I25]] to ptr
290 // CHECK-CPP-NEXT: store float [[TMP4]], ptr [[__X_ADDR_ASCAST_I27]], align 4
291 // CHECK-CPP-NEXT: [[TMP5:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I27]], align 4
292 // CHECK-CPP-NEXT: [[CALL_I:%.*]] = call noundef float @__ocml_cos_f32(float noundef [[TMP5]]) #[[ATTR3]]
293 // CHECK-CPP-NEXT: store float [[CALL_I]], ptr [[L2_ASCAST]], align 4
294 // CHECK-CPP-NEXT: [[TMP6:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
295 // CHECK-CPP-NEXT: [[RETVAL_ASCAST_I11:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I9]] to ptr
296 // CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I12:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I10]] to ptr
297 // CHECK-CPP-NEXT: store float [[TMP6]], ptr [[__X_ADDR_ASCAST_I12]], align 4
298 // CHECK-CPP-NEXT: [[TMP7:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I12]], align 4
299 // CHECK-CPP-NEXT: [[RETVAL_ASCAST_I30:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I28]] to ptr
300 // CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I31:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I29]] to ptr
301 // CHECK-CPP-NEXT: store float [[TMP7]], ptr [[__X_ADDR_ASCAST_I31]], align 4
302 // CHECK-CPP-NEXT: [[TMP8:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I31]], align 4
303 // CHECK-CPP-NEXT: [[TMP9:%.*]] = call noundef float @llvm.fabs.f32(float [[TMP8]])
304 // CHECK-CPP-NEXT: store float [[TMP9]], ptr [[L3_ASCAST]], align 4
305 // CHECK-CPP-NEXT: [[TMP10:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
306 // CHECK-CPP-NEXT: [[TMP11:%.*]] = load float, ptr [[Y_ADDR_ASCAST]], align 4
307 // CHECK-CPP-NEXT: [[TMP12:%.*]] = load float, ptr [[Z_ADDR_ASCAST]], align 4
308 // CHECK-CPP-NEXT: [[RETVAL_ASCAST_I16:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I14]] to ptr
309 // CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I17:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I15]] to ptr
310 // CHECK-CPP-NEXT: [[__Y_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__Y_ADDR_I]] to ptr
311 // CHECK-CPP-NEXT: [[__Z_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__Z_ADDR_I]] to ptr
312 // CHECK-CPP-NEXT: store float [[TMP10]], ptr [[__X_ADDR_ASCAST_I17]], align 4
313 // CHECK-CPP-NEXT: store float [[TMP11]], ptr [[__Y_ADDR_ASCAST_I]], align 4
314 // CHECK-CPP-NEXT: store float [[TMP12]], ptr [[__Z_ADDR_ASCAST_I]], align 4
315 // CHECK-CPP-NEXT: [[TMP13:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I17]], align 4
316 // CHECK-CPP-NEXT: [[TMP14:%.*]] = load float, ptr [[__Y_ADDR_ASCAST_I]], align 4
317 // CHECK-CPP-NEXT: [[TMP15:%.*]] = load float, ptr [[__Z_ADDR_ASCAST_I]], align 4
318 // CHECK-CPP-NEXT: [[RETVAL_ASCAST_I36:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I32]] to ptr
319 // CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I37:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I33]] to ptr
320 // CHECK-CPP-NEXT: [[__Y_ADDR_ASCAST_I38:%.*]] = addrspacecast ptr addrspace(5) [[__Y_ADDR_I34]] to ptr
321 // CHECK-CPP-NEXT: [[__Z_ADDR_ASCAST_I39:%.*]] = addrspacecast ptr addrspace(5) [[__Z_ADDR_I35]] to ptr
322 // CHECK-CPP-NEXT: store float [[TMP13]], ptr [[__X_ADDR_ASCAST_I37]], align 4
323 // CHECK-CPP-NEXT: store float [[TMP14]], ptr [[__Y_ADDR_ASCAST_I38]], align 4
324 // CHECK-CPP-NEXT: store float [[TMP15]], ptr [[__Z_ADDR_ASCAST_I39]], align 4
325 // CHECK-CPP-NEXT: [[TMP16:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I37]], align 4
326 // CHECK-CPP-NEXT: [[TMP17:%.*]] = load float, ptr [[__Y_ADDR_ASCAST_I38]], align 4
327 // CHECK-CPP-NEXT: [[TMP18:%.*]] = load float, ptr [[__Z_ADDR_ASCAST_I39]], align 4
328 // CHECK-CPP-NEXT: [[TMP19:%.*]] = call noundef float @llvm.fma.f32(float [[TMP16]], float [[TMP17]], float [[TMP18]])
329 // CHECK-CPP-NEXT: store float [[TMP19]], ptr [[L4_ASCAST]], align 4
330 // CHECK-CPP-NEXT: ret void
332 void test_math_f32(float x
, float y
, float z
) {
336 float l4
= fma(x
, y
, z
);
339 // CHECK-C-LABEL: @test_math_f32_suffix(
340 // CHECK-C-NEXT: entry:
341 // CHECK-C-NEXT: [[RETVAL_I13:%.*]] = alloca float, align 4, addrspace(5)
342 // CHECK-C-NEXT: [[__X_ADDR_I14:%.*]] = alloca float, align 4, addrspace(5)
343 // CHECK-C-NEXT: [[__Y_ADDR_I:%.*]] = alloca float, align 4, addrspace(5)
344 // CHECK-C-NEXT: [[__Z_ADDR_I:%.*]] = alloca float, align 4, addrspace(5)
345 // CHECK-C-NEXT: [[RETVAL_I9:%.*]] = alloca float, align 4, addrspace(5)
346 // CHECK-C-NEXT: [[__X_ADDR_I10:%.*]] = alloca float, align 4, addrspace(5)
347 // CHECK-C-NEXT: [[RETVAL_I4:%.*]] = alloca float, align 4, addrspace(5)
348 // CHECK-C-NEXT: [[__X_ADDR_I5:%.*]] = alloca float, align 4, addrspace(5)
349 // CHECK-C-NEXT: [[RETVAL_I:%.*]] = alloca float, align 4, addrspace(5)
350 // CHECK-C-NEXT: [[__X_ADDR_I:%.*]] = alloca float, align 4, addrspace(5)
351 // CHECK-C-NEXT: [[X_ADDR:%.*]] = alloca float, align 4, addrspace(5)
352 // CHECK-C-NEXT: [[Y_ADDR:%.*]] = alloca float, align 4, addrspace(5)
353 // CHECK-C-NEXT: [[Z_ADDR:%.*]] = alloca float, align 4, addrspace(5)
354 // CHECK-C-NEXT: [[L1:%.*]] = alloca float, align 4, addrspace(5)
355 // CHECK-C-NEXT: [[L2:%.*]] = alloca float, align 4, addrspace(5)
356 // CHECK-C-NEXT: [[L3:%.*]] = alloca float, align 4, addrspace(5)
357 // CHECK-C-NEXT: [[L4:%.*]] = alloca float, align 4, addrspace(5)
358 // CHECK-C-NEXT: [[X_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X_ADDR]] to ptr
359 // CHECK-C-NEXT: [[Y_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[Y_ADDR]] to ptr
360 // CHECK-C-NEXT: [[Z_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[Z_ADDR]] to ptr
361 // CHECK-C-NEXT: [[L1_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L1]] to ptr
362 // CHECK-C-NEXT: [[L2_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L2]] to ptr
363 // CHECK-C-NEXT: [[L3_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L3]] to ptr
364 // CHECK-C-NEXT: [[L4_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L4]] to ptr
365 // CHECK-C-NEXT: store float [[X:%.*]], ptr [[X_ADDR_ASCAST]], align 4
366 // CHECK-C-NEXT: store float [[Y:%.*]], ptr [[Y_ADDR_ASCAST]], align 4
367 // CHECK-C-NEXT: store float [[Z:%.*]], ptr [[Z_ADDR_ASCAST]], align 4
368 // CHECK-C-NEXT: [[TMP0:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
369 // CHECK-C-NEXT: [[RETVAL_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I]] to ptr
370 // CHECK-C-NEXT: [[__X_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I]] to ptr
371 // CHECK-C-NEXT: store float [[TMP0]], ptr [[__X_ADDR_ASCAST_I]], align 4
372 // CHECK-C-NEXT: [[TMP1:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I]], align 4
373 // CHECK-C-NEXT: [[CALL_I:%.*]] = call float @__ocml_sin_f32(float noundef [[TMP1]]) #[[ATTR3]]
374 // CHECK-C-NEXT: store float [[CALL_I]], ptr [[L1_ASCAST]], align 4
375 // CHECK-C-NEXT: [[TMP2:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
376 // CHECK-C-NEXT: [[RETVAL_ASCAST_I6:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I4]] to ptr
377 // CHECK-C-NEXT: [[__X_ADDR_ASCAST_I7:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I5]] to ptr
378 // CHECK-C-NEXT: store float [[TMP2]], ptr [[__X_ADDR_ASCAST_I7]], align 4
379 // CHECK-C-NEXT: [[TMP3:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I7]], align 4
380 // CHECK-C-NEXT: [[CALL_I8:%.*]] = call float @__ocml_cos_f32(float noundef [[TMP3]]) #[[ATTR3]]
381 // CHECK-C-NEXT: store float [[CALL_I8]], ptr [[L2_ASCAST]], align 4
382 // CHECK-C-NEXT: [[TMP4:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
383 // CHECK-C-NEXT: [[RETVAL_ASCAST_I11:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I9]] to ptr
384 // CHECK-C-NEXT: [[__X_ADDR_ASCAST_I12:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I10]] to ptr
385 // CHECK-C-NEXT: store float [[TMP4]], ptr [[__X_ADDR_ASCAST_I12]], align 4
386 // CHECK-C-NEXT: [[TMP5:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I12]], align 4
387 // CHECK-C-NEXT: [[TMP6:%.*]] = call float @llvm.fabs.f32(float [[TMP5]])
388 // CHECK-C-NEXT: store float [[TMP6]], ptr [[L3_ASCAST]], align 4
389 // CHECK-C-NEXT: [[TMP7:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
390 // CHECK-C-NEXT: [[TMP8:%.*]] = load float, ptr [[Y_ADDR_ASCAST]], align 4
391 // CHECK-C-NEXT: [[TMP9:%.*]] = load float, ptr [[Z_ADDR_ASCAST]], align 4
392 // CHECK-C-NEXT: [[RETVAL_ASCAST_I15:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I13]] to ptr
393 // CHECK-C-NEXT: [[__X_ADDR_ASCAST_I16:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I14]] to ptr
394 // CHECK-C-NEXT: [[__Y_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__Y_ADDR_I]] to ptr
395 // CHECK-C-NEXT: [[__Z_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__Z_ADDR_I]] to ptr
396 // CHECK-C-NEXT: store float [[TMP7]], ptr [[__X_ADDR_ASCAST_I16]], align 4
397 // CHECK-C-NEXT: store float [[TMP8]], ptr [[__Y_ADDR_ASCAST_I]], align 4
398 // CHECK-C-NEXT: store float [[TMP9]], ptr [[__Z_ADDR_ASCAST_I]], align 4
399 // CHECK-C-NEXT: [[TMP10:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I16]], align 4
400 // CHECK-C-NEXT: [[TMP11:%.*]] = load float, ptr [[__Y_ADDR_ASCAST_I]], align 4
401 // CHECK-C-NEXT: [[TMP12:%.*]] = load float, ptr [[__Z_ADDR_ASCAST_I]], align 4
402 // CHECK-C-NEXT: [[TMP13:%.*]] = call float @llvm.fma.f32(float [[TMP10]], float [[TMP11]], float [[TMP12]])
403 // CHECK-C-NEXT: store float [[TMP13]], ptr [[L4_ASCAST]], align 4
404 // CHECK-C-NEXT: ret void
406 // CHECK-CPP-LABEL: @_Z20test_math_f32_suffixfff(
407 // CHECK-CPP-NEXT: entry:
408 // CHECK-CPP-NEXT: [[RETVAL_I13:%.*]] = alloca float, align 4, addrspace(5)
409 // CHECK-CPP-NEXT: [[__X_ADDR_I14:%.*]] = alloca float, align 4, addrspace(5)
410 // CHECK-CPP-NEXT: [[__Y_ADDR_I:%.*]] = alloca float, align 4, addrspace(5)
411 // CHECK-CPP-NEXT: [[__Z_ADDR_I:%.*]] = alloca float, align 4, addrspace(5)
412 // CHECK-CPP-NEXT: [[RETVAL_I9:%.*]] = alloca float, align 4, addrspace(5)
413 // CHECK-CPP-NEXT: [[__X_ADDR_I10:%.*]] = alloca float, align 4, addrspace(5)
414 // CHECK-CPP-NEXT: [[RETVAL_I4:%.*]] = alloca float, align 4, addrspace(5)
415 // CHECK-CPP-NEXT: [[__X_ADDR_I5:%.*]] = alloca float, align 4, addrspace(5)
416 // CHECK-CPP-NEXT: [[RETVAL_I:%.*]] = alloca float, align 4, addrspace(5)
417 // CHECK-CPP-NEXT: [[__X_ADDR_I:%.*]] = alloca float, align 4, addrspace(5)
418 // CHECK-CPP-NEXT: [[X_ADDR:%.*]] = alloca float, align 4, addrspace(5)
419 // CHECK-CPP-NEXT: [[Y_ADDR:%.*]] = alloca float, align 4, addrspace(5)
420 // CHECK-CPP-NEXT: [[Z_ADDR:%.*]] = alloca float, align 4, addrspace(5)
421 // CHECK-CPP-NEXT: [[L1:%.*]] = alloca float, align 4, addrspace(5)
422 // CHECK-CPP-NEXT: [[L2:%.*]] = alloca float, align 4, addrspace(5)
423 // CHECK-CPP-NEXT: [[L3:%.*]] = alloca float, align 4, addrspace(5)
424 // CHECK-CPP-NEXT: [[L4:%.*]] = alloca float, align 4, addrspace(5)
425 // CHECK-CPP-NEXT: [[X_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X_ADDR]] to ptr
426 // CHECK-CPP-NEXT: [[Y_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[Y_ADDR]] to ptr
427 // CHECK-CPP-NEXT: [[Z_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[Z_ADDR]] to ptr
428 // CHECK-CPP-NEXT: [[L1_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L1]] to ptr
429 // CHECK-CPP-NEXT: [[L2_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L2]] to ptr
430 // CHECK-CPP-NEXT: [[L3_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L3]] to ptr
431 // CHECK-CPP-NEXT: [[L4_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[L4]] to ptr
432 // CHECK-CPP-NEXT: store float [[X:%.*]], ptr [[X_ADDR_ASCAST]], align 4
433 // CHECK-CPP-NEXT: store float [[Y:%.*]], ptr [[Y_ADDR_ASCAST]], align 4
434 // CHECK-CPP-NEXT: store float [[Z:%.*]], ptr [[Z_ADDR_ASCAST]], align 4
435 // CHECK-CPP-NEXT: [[TMP0:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
436 // CHECK-CPP-NEXT: [[RETVAL_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I]] to ptr
437 // CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I]] to ptr
438 // CHECK-CPP-NEXT: store float [[TMP0]], ptr [[__X_ADDR_ASCAST_I]], align 4
439 // CHECK-CPP-NEXT: [[TMP1:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I]], align 4
440 // CHECK-CPP-NEXT: [[CALL_I:%.*]] = call noundef float @__ocml_sin_f32(float noundef [[TMP1]]) #[[ATTR3]]
441 // CHECK-CPP-NEXT: store float [[CALL_I]], ptr [[L1_ASCAST]], align 4
442 // CHECK-CPP-NEXT: [[TMP2:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
443 // CHECK-CPP-NEXT: [[RETVAL_ASCAST_I6:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I4]] to ptr
444 // CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I7:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I5]] to ptr
445 // CHECK-CPP-NEXT: store float [[TMP2]], ptr [[__X_ADDR_ASCAST_I7]], align 4
446 // CHECK-CPP-NEXT: [[TMP3:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I7]], align 4
447 // CHECK-CPP-NEXT: [[CALL_I8:%.*]] = call noundef float @__ocml_cos_f32(float noundef [[TMP3]]) #[[ATTR3]]
448 // CHECK-CPP-NEXT: store float [[CALL_I8]], ptr [[L2_ASCAST]], align 4
449 // CHECK-CPP-NEXT: [[TMP4:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
450 // CHECK-CPP-NEXT: [[RETVAL_ASCAST_I11:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I9]] to ptr
451 // CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I12:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I10]] to ptr
452 // CHECK-CPP-NEXT: store float [[TMP4]], ptr [[__X_ADDR_ASCAST_I12]], align 4
453 // CHECK-CPP-NEXT: [[TMP5:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I12]], align 4
454 // CHECK-CPP-NEXT: [[TMP6:%.*]] = call noundef float @llvm.fabs.f32(float [[TMP5]])
455 // CHECK-CPP-NEXT: store float [[TMP6]], ptr [[L3_ASCAST]], align 4
456 // CHECK-CPP-NEXT: [[TMP7:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
457 // CHECK-CPP-NEXT: [[TMP8:%.*]] = load float, ptr [[Y_ADDR_ASCAST]], align 4
458 // CHECK-CPP-NEXT: [[TMP9:%.*]] = load float, ptr [[Z_ADDR_ASCAST]], align 4
459 // CHECK-CPP-NEXT: [[RETVAL_ASCAST_I15:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I13]] to ptr
460 // CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I16:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I14]] to ptr
461 // CHECK-CPP-NEXT: [[__Y_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__Y_ADDR_I]] to ptr
462 // CHECK-CPP-NEXT: [[__Z_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__Z_ADDR_I]] to ptr
463 // CHECK-CPP-NEXT: store float [[TMP7]], ptr [[__X_ADDR_ASCAST_I16]], align 4
464 // CHECK-CPP-NEXT: store float [[TMP8]], ptr [[__Y_ADDR_ASCAST_I]], align 4
465 // CHECK-CPP-NEXT: store float [[TMP9]], ptr [[__Z_ADDR_ASCAST_I]], align 4
466 // CHECK-CPP-NEXT: [[TMP10:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I16]], align 4
467 // CHECK-CPP-NEXT: [[TMP11:%.*]] = load float, ptr [[__Y_ADDR_ASCAST_I]], align 4
468 // CHECK-CPP-NEXT: [[TMP12:%.*]] = load float, ptr [[__Z_ADDR_ASCAST_I]], align 4
469 // CHECK-CPP-NEXT: [[TMP13:%.*]] = call noundef float @llvm.fma.f32(float [[TMP10]], float [[TMP11]], float [[TMP12]])
470 // CHECK-CPP-NEXT: store float [[TMP13]], ptr [[L4_ASCAST]], align 4
471 // CHECK-CPP-NEXT: ret void
473 void test_math_f32_suffix(float x
, float y
, float z
) {
477 float l4
= fmaf(x
, y
, z
);
480 #pragma omp end declare target
481 //// NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: