blob: 3c47eb580ff1e4f47abc6619cb9d69f7fb0c4d9c [file] [log] [blame]
Dan Gohmanc8054d92009-09-09 00:09:15 +00001; RUN: llc < %s -march=arm -mattr=+vfp2 | FileCheck %s -check-prefix=VFP2
Jim Grosbach71fcb4f2010-03-25 23:47:34 +00002; RUN: llc < %s -march=arm -mattr=+neon | FileCheck %s -check-prefix=VFP2
Renato Golina4d56352013-03-21 21:30:49 +00003; 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
Dan Gohmanc8054d92009-09-09 00:09:15 +00006; RUN: llc < %s -march=arm -mcpu=cortex-a9 | FileCheck %s -check-prefix=VFP2
Chris Lattner0c533d92009-08-11 15:54:17 +00007
8define i32 @test1(float %a, float %b) {
9; VFP2: test1:
Bob Wilsondf612ba2011-04-19 18:11:45 +000010; VFP2: vcvt.s32.f32 s{{.}}, s{{.}}
Chris Lattner0c533d92009-08-11 15:54:17 +000011; NEON: test1:
Jakob Stoklund Olesen53910d62011-08-09 18:19:41 +000012; NEON: vadd.f32 [[D0:d[0-9]+]]
13; NEON: vcvt.s32.f32 d0, [[D0]]
Chris Lattner0c533d92009-08-11 15:54:17 +000014entry:
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: test2:
Bob Wilsondf612ba2011-04-19 18:11:45 +000022; VFP2: vcvt.u32.f32 s{{.}}, s{{.}}
Chris Lattner0c533d92009-08-11 15:54:17 +000023; NEON: test2:
Jakob Stoklund Olesen53910d62011-08-09 18:19:41 +000024; NEON: vadd.f32 [[D0:d[0-9]+]]
25; NEON: vcvt.u32.f32 d0, [[D0]]
Chris Lattner0c533d92009-08-11 15:54:17 +000026entry:
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: test3:
Bob Wilsondf612ba2011-04-19 18:11:45 +000034; VFP2: vcvt.f32.u32 s{{.}}, s{{.}}
Chris Lattner0c533d92009-08-11 15:54:17 +000035; NEON: test3:
Bob Wilsone8a549c2012-09-29 21:43:49 +000036; NEON: vcvt.f32.u32 d
Chris Lattner0c533d92009-08-11 15:54:17 +000037entry:
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: test4:
Bob Wilsondf612ba2011-04-19 18:11:45 +000045; VFP2: vcvt.f32.s32 s{{.}}, s{{.}}
Chris Lattner0c533d92009-08-11 15:54:17 +000046; NEON: test4:
Bob Wilsone8a549c2012-09-29 21:43:49 +000047; NEON: vcvt.f32.s32 d
Chris Lattner0c533d92009-08-11 15:54:17 +000048entry:
49 %0 = add i32 %a, %b
50 %1 = sitofp i32 %0 to float
51 ret float %1
52}