summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/PowerPC/iabs.ll
diff options
context:
space:
mode:
authorJan Wen Voung <jvoung@google.com>2013-03-12 16:27:52 +0000
committerJan Wen Voung <jvoung@google.com>2013-03-12 16:27:52 +0000
commit6dc3076080a40c29f503cbf1e6ce72ead1e63fb6 (patch)
treebe0438e782d385284467c2921fbc917c15d26a66 /llvm/test/CodeGen/PowerPC/iabs.ll
parent00253592c77666fed0d1d80a54ec674103dec717 (diff)
downloadbcm5719-llvm-6dc3076080a40c29f503cbf1e6ce72ead1e63fb6.tar.gz
bcm5719-llvm-6dc3076080a40c29f503cbf1e6ce72ead1e63fb6.zip
Revert the test moves from 176733. Use "REQUIRES: asserts" instead.
llvm-svn: 176873
Diffstat (limited to 'llvm/test/CodeGen/PowerPC/iabs.ll')
-rw-r--r--llvm/test/CodeGen/PowerPC/iabs.ll16
1 files changed, 16 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..f683238de26
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/iabs.ll
@@ -0,0 +1,16 @@
+; REQUIRES: asserts
+; RUN: llc < %s -march=ppc32 -stats 2>&1 | \
+; RUN: 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