summaryrefslogtreecommitdiff
path: root/test/CodeGen/PowerPC/iabs.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-11 05:02:57 +0000
committerChris Lattner <sabre@nondot.org>2007-04-11 05:02:57 +0000
commit603572a7711440d7229a6f98a4e6920fdc691848 (patch)
treeab07ad896fac91e9681aa8195d1b088b6f7f5646 /test/CodeGen/PowerPC/iabs.ll
parented4e51e58e021384cd6e7a281d13d25dbbee2eca (diff)
downloadllvm-603572a7711440d7229a6f98a4e6920fdc691848.tar.gz
llvm-603572a7711440d7229a6f98a4e6920fdc691848.tar.bz2
llvm-603572a7711440d7229a6f98a4e6920fdc691848.tar.xz
new testcases for integer abs function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35880 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/PowerPC/iabs.ll')
-rw-r--r--test/CodeGen/PowerPC/iabs.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/CodeGen/PowerPC/iabs.ll b/test/CodeGen/PowerPC/iabs.ll
new file mode 100644
index 0000000000..1414c0e67c
--- /dev/null
+++ b/test/CodeGen/PowerPC/iabs.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | llc -march=ppc32 -stats 2>&1 | grep '4 .*Number of machine instrs printed'
+
+;; Integer absolute value, should produce something as good as:
+;; srawi r2, r3, 31
+;; add r3, r3, r2
+;; xor r3, r3, r2
+;; blr
+define i32 @test(i32 %a) {
+ %tmp1neg = sub i32 0, %a
+ %b = icmp sgt i32 %a, -1
+ %abs = select i1 %b, i32 %a, i32 %tmp1neg
+ ret i32 %abs
+}
+