summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/setcc-strength-reduce.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-08-03 20:30:26 +0000
committerChris Lattner <sabre@nondot.org>2002-08-03 20:30:26 +0000
commit7d20fe3727a19be875eca577118b49ffef94eb04 (patch)
treec533442de9becb3c8ef5e38179f8514b0062e245 /test/Transforms/InstCombine/setcc-strength-reduce.ll
parentd3e7929626a083d425d845a7039037c92e9ce761 (diff)
downloadllvm-7d20fe3727a19be875eca577118b49ffef94eb04.tar.gz
llvm-7d20fe3727a19be875eca577118b49ffef94eb04.tar.bz2
llvm-7d20fe3727a19be875eca577118b49ffef94eb04.tar.xz
Testcase for stuff instcombine should do eventually
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3240 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/setcc-strength-reduce.ll')
-rw-r--r--test/Transforms/InstCombine/setcc-strength-reduce.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/setcc-strength-reduce.ll b/test/Transforms/InstCombine/setcc-strength-reduce.ll
new file mode 100644
index 0000000000..1018ca5b6e
--- /dev/null
+++ b/test/Transforms/InstCombine/setcc-strength-reduce.ll
@@ -0,0 +1,24 @@
+; This test ensures that "strength reduction" of conditional expressions are
+; working. Basically this boils down to converting setlt,gt,le,ge instructions
+; into equivalent setne,eq instructions.
+;
+
+; RUN: if as < %s | opt -instcombine | dis | grep -v seteq | grep -v setne | grep set
+; RUN: then exit 1
+; RUN: else exit 0
+; RUN: fi
+
+bool "test1"(uint %A) {
+ %B = setge uint %A, 1 ; setne %A, 0
+ ret bool %B
+}
+
+bool "test2"(uint %A) {
+ %B = setgt uint %A, 0 ; setne %A, 0
+ ret bool %B
+}
+
+bool "test3"(sbyte %A) {
+ %B = setge sbyte %A, -127 ; setne %A, -128
+ ret bool %B
+}