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