xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/fp_convert.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=arm-eabi -mattr=+vfp2 %s -o - \
2*9880d681SAndroid Build Coastguard Worker; RUN:  | FileCheck %s -check-prefix=VFP2
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=arm-eabi -mattr=+neon %s -o - \
5*9880d681SAndroid Build Coastguard Worker; RUN:  | FileCheck %s -check-prefix=VFP2
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=arm-eabi -mcpu=cortex-a8 %s -o - \
8*9880d681SAndroid Build Coastguard Worker; RUN: | FileCheck %s -check-prefix=VFP2
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=arm-eabi -mcpu=cortex-a8 --enable-unsafe-fp-math %s -o - \
11*9880d681SAndroid Build Coastguard Worker; RUN:  | FileCheck %s -check-prefix=NEON
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=arm-darwin -mcpu=cortex-a8 %s -o - \
14*9880d681SAndroid Build Coastguard Worker; RUN:  | FileCheck %s -check-prefix=NEON
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=arm-eabi -mcpu=cortex-a9 %s -o - \
17*9880d681SAndroid Build Coastguard Worker; RUN:  | FileCheck %s -check-prefix=VFP2
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Workerdefine i32 @test1(float %a, float %b) {
20*9880d681SAndroid Build Coastguard Worker; VFP2-LABEL: test1:
21*9880d681SAndroid Build Coastguard Worker; VFP2: vcvt.s32.f32 s{{.}}, s{{.}}
22*9880d681SAndroid Build Coastguard Worker; NEON-LABEL: test1:
23*9880d681SAndroid Build Coastguard Worker; NEON: vadd.f32 [[D0:d[0-9]+]]
24*9880d681SAndroid Build Coastguard Worker; NEON: vcvt.s32.f32 d0, [[D0]]
25*9880d681SAndroid Build Coastguard Workerentry:
26*9880d681SAndroid Build Coastguard Worker        %0 = fadd float %a, %b
27*9880d681SAndroid Build Coastguard Worker        %1 = fptosi float %0 to i32
28*9880d681SAndroid Build Coastguard Worker	ret i32 %1
29*9880d681SAndroid Build Coastguard Worker}
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Workerdefine i32 @test2(float %a, float %b) {
32*9880d681SAndroid Build Coastguard Worker; VFP2-LABEL: test2:
33*9880d681SAndroid Build Coastguard Worker; VFP2: vcvt.u32.f32 s{{.}}, s{{.}}
34*9880d681SAndroid Build Coastguard Worker; NEON-LABEL: test2:
35*9880d681SAndroid Build Coastguard Worker; NEON: vadd.f32 [[D0:d[0-9]+]]
36*9880d681SAndroid Build Coastguard Worker; NEON: vcvt.u32.f32 d0, [[D0]]
37*9880d681SAndroid Build Coastguard Workerentry:
38*9880d681SAndroid Build Coastguard Worker        %0 = fadd float %a, %b
39*9880d681SAndroid Build Coastguard Worker        %1 = fptoui float %0 to i32
40*9880d681SAndroid Build Coastguard Worker	ret i32 %1
41*9880d681SAndroid Build Coastguard Worker}
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Workerdefine float @test3(i32 %a, i32 %b) {
44*9880d681SAndroid Build Coastguard Worker; VFP2-LABEL: test3:
45*9880d681SAndroid Build Coastguard Worker; VFP2: vcvt.f32.u32 s{{.}}, s{{.}}
46*9880d681SAndroid Build Coastguard Worker; NEON-LABEL: test3:
47*9880d681SAndroid Build Coastguard Worker; NEON: vcvt.f32.u32 d
48*9880d681SAndroid Build Coastguard Workerentry:
49*9880d681SAndroid Build Coastguard Worker        %0 = add i32 %a, %b
50*9880d681SAndroid Build Coastguard Worker        %1 = uitofp i32 %0 to float
51*9880d681SAndroid Build Coastguard Worker	ret float %1
52*9880d681SAndroid Build Coastguard Worker}
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Workerdefine float @test4(i32 %a, i32 %b) {
55*9880d681SAndroid Build Coastguard Worker; VFP2-LABEL: test4:
56*9880d681SAndroid Build Coastguard Worker; VFP2: vcvt.f32.s32 s{{.}}, s{{.}}
57*9880d681SAndroid Build Coastguard Worker; NEON-LABEL: test4:
58*9880d681SAndroid Build Coastguard Worker; NEON: vcvt.f32.s32 d
59*9880d681SAndroid Build Coastguard Workerentry:
60*9880d681SAndroid Build Coastguard Worker        %0 = add i32 %a, %b
61*9880d681SAndroid Build Coastguard Worker        %1 = sitofp i32 %0 to float
62*9880d681SAndroid Build Coastguard Worker	ret float %1
63*9880d681SAndroid Build Coastguard Worker}
64