summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/icmp-add.ll
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-02-08 22:14:11 +0000
committerSanjay Patel <spatel@rotateright.com>2017-02-08 22:14:11 +0000
commita62bc44f6746d0cbcf9c0e1d71c5c32d6a203372 (patch)
tree3080b84186bd8f5787b67e1339c524f9e3f3ab2e /llvm/test/Transforms/InstCombine/icmp-add.ll
parentc3a4b282bb787da8cb09d03b490df4aaadb81d33 (diff)
downloadbcm5719-llvm-a62bc44f6746d0cbcf9c0e1d71c5c32d6a203372.tar.gz
bcm5719-llvm-a62bc44f6746d0cbcf9c0e1d71c5c32d6a203372.zip
[InstCombine] add tests to show information-losing add nsw/nuw transforms; NFC
llvm-svn: 294524
Diffstat (limited to 'llvm/test/Transforms/InstCombine/icmp-add.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/icmp-add.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/icmp-add.ll b/llvm/test/Transforms/InstCombine/icmp-add.ll
index 3bf1849c91c..d00875f9a66 100644
--- a/llvm/test/Transforms/InstCombine/icmp-add.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-add.ll
@@ -106,3 +106,27 @@ define <2 x i1> @slt_zero_add_nsw_splat_vec(<2 x i8> %a) {
ret <2 x i1> %cmp
}
+; FIXME: InstCombine should not lose wrapping information by changing the add to xor.
+
+define i1 @slt_zero_add_nsw_signbit(i8 %x) {
+; CHECK-LABEL: @slt_zero_add_nsw_signbit(
+; CHECK-NEXT: [[Z:%.*]] = icmp sgt i8 %x, -1
+; CHECK-NEXT: ret i1 [[Z]]
+;
+ %y = add nsw i8 %x, -128
+ %z = icmp slt i8 %y, 0
+ ret i1 %z
+}
+
+; FIXME: InstCombine should not lose wrapping information by changing the add to xor.
+
+define i1 @slt_zero_add_nuw_signbit(i8 %x) {
+; CHECK-LABEL: @slt_zero_add_nuw_signbit(
+; CHECK-NEXT: [[Z:%.*]] = icmp sgt i8 %x, -1
+; CHECK-NEXT: ret i1 [[Z]]
+;
+ %y = add nuw i8 %x, 128
+ %z = icmp slt i8 %y, 0
+ ret i1 %z
+}
+
OpenPOWER on IntegriCloud