1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
2 // RUN: %clang_cc1 -triple x86_64-linux-gnu -frounding-math -ffp-exception-behavior=strict -O2 -emit-llvm -o - %s | FileCheck %s
4 // FIXME: This demonstrates elementwise builtins are broken for strictfp and
5 // produce unconstrained intrinsics
7 typedef float float4
__attribute__((ext_vector_type(4)));
9 // Sanity check we're getting constrained ops for a non-builtin.
10 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z11strict_faddDv4_fS_
11 // CHECK-SAME: (<4 x float> noundef [[A:%.*]], <4 x float> noundef [[B:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
13 // CHECK-NEXT: [[ADD:%.*]] = tail call <4 x float> @llvm.experimental.constrained.fadd.v4f32(<4 x float> [[A]], <4 x float> [[B]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR4:[0-9]+]]
14 // CHECK-NEXT: ret <4 x float> [[ADD]]
16 float4
strict_fadd(float4 a
, float4 b
) {
20 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z22strict_elementwise_absDv4_f
21 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] {
23 // CHECK-NEXT: [[ELT_ABS:%.*]] = tail call <4 x float> @llvm.fabs.v4f32(<4 x float> [[A]]) #[[ATTR4]]
24 // CHECK-NEXT: ret <4 x float> [[ELT_ABS]]
26 float4
strict_elementwise_abs(float4 a
) {
27 return __builtin_elementwise_abs(a
);
30 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z22strict_elementwise_maxDv4_fS_
31 // CHECK-SAME: (<4 x float> noundef [[A:%.*]], <4 x float> noundef [[B:%.*]]) local_unnamed_addr #[[ATTR0]] {
33 // CHECK-NEXT: [[ELT_MAX:%.*]] = tail call <4 x float> @llvm.experimental.constrained.maxnum.v4f32(<4 x float> [[A]], <4 x float> [[B]], metadata !"fpexcept.strict") #[[ATTR4]]
34 // CHECK-NEXT: ret <4 x float> [[ELT_MAX]]
36 float4
strict_elementwise_max(float4 a
, float4 b
) {
37 return __builtin_elementwise_max(a
, b
);
40 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z22strict_elementwise_minDv4_fS_
41 // CHECK-SAME: (<4 x float> noundef [[A:%.*]], <4 x float> noundef [[B:%.*]]) local_unnamed_addr #[[ATTR0]] {
43 // CHECK-NEXT: [[ELT_MIN:%.*]] = tail call <4 x float> @llvm.experimental.constrained.minnum.v4f32(<4 x float> [[A]], <4 x float> [[B]], metadata !"fpexcept.strict") #[[ATTR4]]
44 // CHECK-NEXT: ret <4 x float> [[ELT_MIN]]
46 float4
strict_elementwise_min(float4 a
, float4 b
) {
47 return __builtin_elementwise_min(a
, b
);
50 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z23strict_elementwise_ceilDv4_f
51 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
53 // CHECK-NEXT: [[ELT_CEIL:%.*]] = tail call <4 x float> @llvm.ceil.v4f32(<4 x float> [[A]]) #[[ATTR4]]
54 // CHECK-NEXT: ret <4 x float> [[ELT_CEIL]]
56 float4
strict_elementwise_ceil(float4 a
) {
57 return __builtin_elementwise_ceil(a
);
60 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z22strict_elementwise_cosDv4_f
61 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
63 // CHECK-NEXT: [[ELT_COS:%.*]] = tail call <4 x float> @llvm.cos.v4f32(<4 x float> [[A]]) #[[ATTR4]]
64 // CHECK-NEXT: ret <4 x float> [[ELT_COS]]
66 float4
strict_elementwise_cos(float4 a
) {
67 return __builtin_elementwise_cos(a
);
70 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z22strict_elementwise_expDv4_f
71 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
73 // CHECK-NEXT: [[ELT_EXP:%.*]] = tail call <4 x float> @llvm.exp.v4f32(<4 x float> [[A]]) #[[ATTR4]]
74 // CHECK-NEXT: ret <4 x float> [[ELT_EXP]]
76 float4
strict_elementwise_exp(float4 a
) {
77 return __builtin_elementwise_exp(a
);
80 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z23strict_elementwise_exp2Dv4_f
81 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
83 // CHECK-NEXT: [[ELT_EXP2:%.*]] = tail call <4 x float> @llvm.exp2.v4f32(<4 x float> [[A]]) #[[ATTR4]]
84 // CHECK-NEXT: ret <4 x float> [[ELT_EXP2]]
86 float4
strict_elementwise_exp2(float4 a
) {
87 return __builtin_elementwise_exp2(a
);
90 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z24strict_elementwise_floorDv4_f
91 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
93 // CHECK-NEXT: [[ELT_FLOOR:%.*]] = tail call <4 x float> @llvm.floor.v4f32(<4 x float> [[A]]) #[[ATTR4]]
94 // CHECK-NEXT: ret <4 x float> [[ELT_FLOOR]]
96 float4
strict_elementwise_floor(float4 a
) {
97 return __builtin_elementwise_floor(a
);
100 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z22strict_elementwise_logDv4_f
101 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
102 // CHECK-NEXT: entry:
103 // CHECK-NEXT: [[ELT_LOG:%.*]] = tail call <4 x float> @llvm.log.v4f32(<4 x float> [[A]]) #[[ATTR4]]
104 // CHECK-NEXT: ret <4 x float> [[ELT_LOG]]
106 float4
strict_elementwise_log(float4 a
) {
107 return __builtin_elementwise_log(a
);
110 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z23strict_elementwise_log2Dv4_f
111 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
112 // CHECK-NEXT: entry:
113 // CHECK-NEXT: [[ELT_LOG2:%.*]] = tail call <4 x float> @llvm.log2.v4f32(<4 x float> [[A]]) #[[ATTR4]]
114 // CHECK-NEXT: ret <4 x float> [[ELT_LOG2]]
116 float4
strict_elementwise_log2(float4 a
) {
117 return __builtin_elementwise_log2(a
);
120 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z24strict_elementwise_log10Dv4_f
121 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
122 // CHECK-NEXT: entry:
123 // CHECK-NEXT: [[ELT_LOG2:%.*]] = tail call <4 x float> @llvm.log2.v4f32(<4 x float> [[A]]) #[[ATTR4]]
124 // CHECK-NEXT: ret <4 x float> [[ELT_LOG2]]
126 float4
strict_elementwise_log10(float4 a
) {
127 return __builtin_elementwise_log2(a
);
130 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z28strict_elementwise_roundevenDv4_f
131 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
132 // CHECK-NEXT: entry:
133 // CHECK-NEXT: [[ELT_ROUNDEVEN:%.*]] = tail call <4 x float> @llvm.roundeven.v4f32(<4 x float> [[A]]) #[[ATTR4]]
134 // CHECK-NEXT: ret <4 x float> [[ELT_ROUNDEVEN]]
136 float4
strict_elementwise_roundeven(float4 a
) {
137 return __builtin_elementwise_roundeven(a
);
140 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z24strict_elementwise_roundDv4_f
141 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
142 // CHECK-NEXT: entry:
143 // CHECK-NEXT: [[ELT_ROUND:%.*]] = tail call <4 x float> @llvm.round.v4f32(<4 x float> [[A]]) #[[ATTR4]]
144 // CHECK-NEXT: ret <4 x float> [[ELT_ROUND]]
146 float4
strict_elementwise_round(float4 a
) {
147 return __builtin_elementwise_round(a
);
150 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z23strict_elementwise_rintDv4_f
151 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
152 // CHECK-NEXT: entry:
153 // CHECK-NEXT: [[ELT_RINT:%.*]] = tail call <4 x float> @llvm.rint.v4f32(<4 x float> [[A]]) #[[ATTR4]]
154 // CHECK-NEXT: ret <4 x float> [[ELT_RINT]]
156 float4
strict_elementwise_rint(float4 a
) {
157 return __builtin_elementwise_rint(a
);
160 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z28strict_elementwise_nearbyintDv4_f
161 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
162 // CHECK-NEXT: entry:
163 // CHECK-NEXT: [[ELT_NEARBYINT:%.*]] = tail call <4 x float> @llvm.nearbyint.v4f32(<4 x float> [[A]]) #[[ATTR4]]
164 // CHECK-NEXT: ret <4 x float> [[ELT_NEARBYINT]]
166 float4
strict_elementwise_nearbyint(float4 a
) {
167 return __builtin_elementwise_nearbyint(a
);
170 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z22strict_elementwise_sinDv4_f
171 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
172 // CHECK-NEXT: entry:
173 // CHECK-NEXT: [[ELT_SIN:%.*]] = tail call <4 x float> @llvm.sin.v4f32(<4 x float> [[A]]) #[[ATTR4]]
174 // CHECK-NEXT: ret <4 x float> [[ELT_SIN]]
176 float4
strict_elementwise_sin(float4 a
) {
177 return __builtin_elementwise_sin(a
);
180 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z23strict_elementwise_sqrtDv4_f
181 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR0]] {
182 // CHECK-NEXT: entry:
183 // CHECK-NEXT: [[TMP0:%.*]] = tail call <4 x float> @llvm.experimental.constrained.sqrt.v4f32(<4 x float> [[A]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR4]]
184 // CHECK-NEXT: ret <4 x float> [[TMP0]]
186 float4
strict_elementwise_sqrt(float4 a
) {
187 return __builtin_elementwise_sqrt(a
);
190 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z24strict_elementwise_truncDv4_f
191 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
192 // CHECK-NEXT: entry:
193 // CHECK-NEXT: [[ELT_TRUNC:%.*]] = tail call <4 x float> @llvm.trunc.v4f32(<4 x float> [[A]]) #[[ATTR4]]
194 // CHECK-NEXT: ret <4 x float> [[ELT_TRUNC]]
196 float4
strict_elementwise_trunc(float4 a
) {
197 return __builtin_elementwise_trunc(a
);
200 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z31strict_elementwise_canonicalizeDv4_f
201 // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
202 // CHECK-NEXT: entry:
203 // CHECK-NEXT: [[ELT_CANONICALIZE:%.*]] = tail call <4 x float> @llvm.canonicalize.v4f32(<4 x float> [[A]]) #[[ATTR4]]
204 // CHECK-NEXT: ret <4 x float> [[ELT_CANONICALIZE]]
206 float4
strict_elementwise_canonicalize(float4 a
) {
207 return __builtin_elementwise_canonicalize(a
);
210 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z27strict_elementwise_copysignDv4_fS_
211 // CHECK-SAME: (<4 x float> noundef [[A:%.*]], <4 x float> noundef [[B:%.*]]) local_unnamed_addr #[[ATTR2]] {
212 // CHECK-NEXT: entry:
213 // CHECK-NEXT: [[TMP0:%.*]] = tail call <4 x float> @llvm.copysign.v4f32(<4 x float> [[A]], <4 x float> [[B]]) #[[ATTR4]]
214 // CHECK-NEXT: ret <4 x float> [[TMP0]]
216 float4
strict_elementwise_copysign(float4 a
, float4 b
) {
217 return __builtin_elementwise_copysign(a
, b
);
220 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z22strict_elementwise_fmaDv4_fS_S_
221 // CHECK-SAME: (<4 x float> noundef [[A:%.*]], <4 x float> noundef [[B:%.*]], <4 x float> noundef [[C:%.*]]) local_unnamed_addr #[[ATTR2]] {
222 // CHECK-NEXT: entry:
223 // CHECK-NEXT: [[TMP0:%.*]] = tail call <4 x float> @llvm.fma.v4f32(<4 x float> [[A]], <4 x float> [[B]], <4 x float> [[C]]) #[[ATTR4]]
224 // CHECK-NEXT: ret <4 x float> [[TMP0]]
226 float4
strict_elementwise_fma(float4 a
, float4 b
, float4 c
) {
227 return __builtin_elementwise_fma(a
, b
, c
);
230 // CHECK-LABEL: define dso_local noundef <4 x float> @_Z22strict_elementwise_powDv4_fS_
231 // CHECK-SAME: (<4 x float> noundef [[A:%.*]], <4 x float> noundef [[B:%.*]]) local_unnamed_addr #[[ATTR2]] {
232 // CHECK-NEXT: entry:
233 // CHECK-NEXT: [[TMP0:%.*]] = tail call <4 x float> @llvm.pow.v4f32(<4 x float> [[A]], <4 x float> [[B]]) #[[ATTR4]]
234 // CHECK-NEXT: ret <4 x float> [[TMP0]]
236 float4
strict_elementwise_pow(float4 a
, float4 b
) {
237 return __builtin_elementwise_pow(a
, b
);