summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/ARM/fpcmp-opt.ll
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-07-08 02:08:50 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-07-08 02:08:50 +0000
commit25f9364cbdbb26758995f8e6721fb7d3d54f504a (patch)
tree76c84b4b804d355c8c46e44d22b226d326f7cc62 /llvm/test/CodeGen/ARM/fpcmp-opt.ll
parente2289285ae2f054b6a697e1fe49f0eea4f2613c2 (diff)
downloadbcm5719-llvm-25f9364cbdbb26758995f8e6721fb7d3d54f504a.tar.gz
bcm5719-llvm-25f9364cbdbb26758995f8e6721fb7d3d54f504a.zip
Optimize some vfp comparisons to integer ones. This patch implements the simplest case when the following conditions are met:
1. The arguments are f32. 2. The arguments are loads and they have no uses other than the comparison. 3. The comparison code is EQ or NE. e.g. vldr.32 s0, [r1] vldr.32 s1, [r0] vcmpe.f32 s1, s0 vmrs apsr_nzcv, fpscr beq LBB0_2 => ldr r1, [r1] ldr r0, [r0] cmp r0, r1 beq LBB0_2 More complicated cases will be implemented in subsequent patches. llvm-svn: 107852
Diffstat (limited to 'llvm/test/CodeGen/ARM/fpcmp-opt.ll')
-rw-r--r--llvm/test/CodeGen/ARM/fpcmp-opt.ll29
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/fpcmp-opt.ll b/llvm/test/CodeGen/ARM/fpcmp-opt.ll
new file mode 100644
index 00000000000..ed515cc1e7c
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/fpcmp-opt.ll
@@ -0,0 +1,29 @@
+; RUN: llc < %s -march=arm -mattr=+vfp2 | FileCheck %s
+; rdar://7461510
+
+define arm_apcscc i32 @t1(float* %a, float* %b) nounwind {
+entry:
+; CHECK: t1:
+; CHECK-NOT: vldr
+; CHECK: ldr
+; CHECK: ldr
+; CHECK: cmp r0, r1
+; CHECK-NOT: vcmpe.f32
+; CHECK-NOT: vmrs
+; CHECK: beq
+ %0 = load float* %a
+ %1 = load float* %b
+ %2 = fcmp une float %0, %1
+ br i1 %2, label %bb1, label %bb2
+
+bb1:
+ %3 = call i32 @bar()
+ ret i32 %3
+
+bb2:
+ %4 = call i32 @foo()
+ ret i32 %4
+}
+
+declare i32 @bar()
+declare i32 @foo()
OpenPOWER on IntegriCloud