summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/PowerPC
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
commit9f780e339eccc5a045b4849c5caae2c0f5a94ac9 (patch)
tree7d922c6c9ce4dfdb19460e4113bb5b4339aaedee /llvm/test/CodeGen/PowerPC
parent32104034f8e186e23bd184b01ce150d7f5564230 (diff)
downloadbcm5719-llvm-9f780e339eccc5a045b4849c5caae2c0f5a94ac9.tar.gz
bcm5719-llvm-9f780e339eccc5a045b4849c5caae2c0f5a94ac9.zip
new testcases for integer abs function
llvm-svn: 35880
Diffstat (limited to 'llvm/test/CodeGen/PowerPC')
-rw-r--r--llvm/test/CodeGen/PowerPC/iabs.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/PowerPC/iabs.ll b/llvm/test/CodeGen/PowerPC/iabs.ll
new file mode 100644
index 00000000000..1414c0e67c3
--- /dev/null
+++ b/llvm/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
+}
+
OpenPOWER on IntegriCloud