1 ; RUN: llc < %s -mtriple=thumbv7-none-eabi -mcpu=cortex-m3 | FileCheck %s -check-prefix=CHECK -check-prefix=SOFT -check-prefix=NONE
2 ; RUN: llc < %s -mtriple=thumbv7-none-eabihf -mcpu=cortex-m4 | FileCheck %s -check-prefix=CHECK -check-prefix=HARD -check-prefix=SP -check-prefix=NO-VMLA
3 ; RUN: llc < %s -mtriple=thumbv7-none-eabihf -mcpu=cortex-m33 | FileCheck %s -check-prefix=CHECK -check-prefix=HARD -check-prefix=SP -check-prefix=NO-VMLA
4 ; RUN: llc < %s -mtriple=thumbv7-none-eabihf -mcpu=cortex-m7 | FileCheck %s -check-prefix=CHECK -check-prefix=HARD -check-prefix=DP -check-prefix=VFP -check-prefix=FP-ARMv8 -check-prefix=VMLA
5 ; RUN: llc < %s -mtriple=thumbv7-none-eabihf -mcpu=cortex-m7 -mattr=-fp64 | FileCheck %s -check-prefix=CHECK -check-prefix=HARD -check-prefix=SP -check-prefix=FP-ARMv8 -check-prefix=VMLA
6 ; RUN: llc < %s -mtriple=thumbv7-none-eabihf -mcpu=cortex-a7 | FileCheck %s -check-prefix=CHECK -check-prefix=HARD -check-prefix=DP -check-prefix=NEON -check-prefix=VFP4 -check-prefix=NO-VMLA
7 ; RUN: llc < %s -mtriple=thumbv7-none-eabihf -mcpu=cortex-a57 | FileCheck %s -check-prefix=CHECK -check-prefix=HARD -check-prefix=DP -check-prefix=NEON -check-prefix=FP-ARMv8 -check-prefix=VMLA
9 declare float @llvm.sqrt.f32(float %Val)
10 define float @sqrt_f(float %a) {
11 ; CHECK-LABEL: sqrt_f:
13 ; HARD: vsqrt.f32 s0, s0
14 %1 = call float @llvm.sqrt.f32(float %a)
18 declare float @llvm.powi.f32(float %Val, i32 %power)
19 define float @powi_f(float %a, i32 %b) {
20 ; CHECK-LABEL: powi_f:
23 %1 = call float @llvm.powi.f32(float %a, i32 %b)
27 declare float @llvm.sin.f32(float %Val)
28 define float @sin_f(float %a) {
32 %1 = call float @llvm.sin.f32(float %a)
36 declare float @llvm.cos.f32(float %Val)
37 define float @cos_f(float %a) {
41 %1 = call float @llvm.cos.f32(float %a)
45 declare float @llvm.pow.f32(float %Val, float %power)
46 define float @pow_f(float %a, float %b) {
50 %1 = call float @llvm.pow.f32(float %a, float %b)
54 declare float @llvm.exp.f32(float %Val)
55 define float @exp_f(float %a) {
59 %1 = call float @llvm.exp.f32(float %a)
63 declare float @llvm.exp2.f32(float %Val)
64 define float @exp2_f(float %a) {
65 ; CHECK-LABEL: exp2_f:
68 %1 = call float @llvm.exp2.f32(float %a)
72 declare float @llvm.log.f32(float %Val)
73 define float @log_f(float %a) {
77 %1 = call float @llvm.log.f32(float %a)
81 declare float @llvm.log10.f32(float %Val)
82 define float @log10_f(float %a) {
83 ; CHECK-LABEL: log10_f:
86 %1 = call float @llvm.log10.f32(float %a)
90 declare float @llvm.log2.f32(float %Val)
91 define float @log2_f(float %a) {
92 ; CHECK-LABEL: log2_f:
95 %1 = call float @llvm.log2.f32(float %a)
99 declare float @llvm.fma.f32(float %a, float %b, float %c)
100 define float @fma_f(float %a, float %b, float %c) {
101 ; CHECK-LABEL: fma_f:
104 %1 = call float @llvm.fma.f32(float %a, float %b, float %c)
108 declare float @llvm.fabs.f32(float %Val)
109 define float @abs_f(float %a) {
110 ; CHECK-LABEL: abs_f:
111 ; SOFT: bic r0, r0, #-2147483648
113 %1 = call float @llvm.fabs.f32(float %a)
117 declare float @llvm.copysign.f32(float %Mag, float %Sgn)
118 define float @copysign_f(float %a, float %b) {
119 ; CHECK-LABEL: copysign_f:
120 ; NONE: lsrs [[REG:r[0-9]+]], r{{[0-9]+}}, #31
121 ; NONE: bfi r{{[0-9]+}}, [[REG]], #31, #1
122 ; SP: lsrs [[REG:r[0-9]+]], r{{[0-9]+}}, #31
123 ; SP: bfi r{{[0-9]+}}, [[REG]], #31, #1
124 ; VFP: lsrs [[REG:r[0-9]+]], r{{[0-9]+}}, #31
125 ; VFP: bfi r{{[0-9]+}}, [[REG]], #31, #1
126 ; NEON: vmov.i32 [[REG:d[0-9]+]], #0x80000000
127 ; NEON: vbsl [[REG]], d
128 %1 = call float @llvm.copysign.f32(float %a, float %b)
132 declare float @llvm.floor.f32(float %Val)
133 define float @floor_f(float %a) {
134 ; CHECK-LABEL: floor_f:
137 ; FP-ARMv8: vrintm.f32
138 %1 = call float @llvm.floor.f32(float %a)
142 declare float @llvm.ceil.f32(float %Val)
143 define float @ceil_f(float %a) {
144 ; CHECK-LABEL: ceil_f:
147 ; FP-ARMv8: vrintp.f32
148 %1 = call float @llvm.ceil.f32(float %a)
152 declare float @llvm.trunc.f32(float %Val)
153 define float @trunc_f(float %a) {
154 ; CHECK-LABEL: trunc_f:
157 ; FP-ARMv8: vrintz.f32
158 %1 = call float @llvm.trunc.f32(float %a)
162 declare float @llvm.rint.f32(float %Val)
163 define float @rint_f(float %a) {
164 ; CHECK-LABEL: rint_f:
167 ; FP-ARMv8: vrintx.f32
168 %1 = call float @llvm.rint.f32(float %a)
172 declare float @llvm.nearbyint.f32(float %Val)
173 define float @nearbyint_f(float %a) {
174 ; CHECK-LABEL: nearbyint_f:
175 ; SOFT: bl nearbyintf
177 ; FP-ARMv8: vrintr.f32
178 %1 = call float @llvm.nearbyint.f32(float %a)
182 declare float @llvm.round.f32(float %Val)
183 define float @round_f(float %a) {
184 ; CHECK-LABEL: round_f:
187 ; FP-ARMv8: vrinta.f32
188 %1 = call float @llvm.round.f32(float %a)
192 declare float @llvm.fmuladd.f32(float %a, float %b, float %c)
193 define float @fmuladd_f(float %a, float %b, float %c) {
194 ; CHECK-LABEL: fmuladd_f:
195 ; SOFT: bl __aeabi_fmul
196 ; SOFT: bl __aeabi_fadd
200 %1 = call float @llvm.fmuladd.f32(float %a, float %b, float %c)
204 declare i16 @llvm.convert.to.fp16.f32(float %a)
205 define i16 @f_to_h(float %a) {
206 ; CHECK-LABEL: f_to_h:
207 ; SOFT: bl __aeabi_f2h
208 ; HARD: vcvt{{[bt]}}.f16.f32
209 %1 = call i16 @llvm.convert.to.fp16.f32(float %a)
213 declare float @llvm.convert.from.fp16.f32(i16 %a)
214 define float @h_to_f(i16 %a) {
215 ; CHECK-LABEL: h_to_f:
216 ; SOFT: bl __aeabi_h2f
217 ; HARD: vcvt{{[bt]}}.f32.f16
218 %1 = call float @llvm.convert.from.fp16.f32(i16 %a)