diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-02-08 22:14:11 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-02-08 22:14:11 +0000 |
commit | a62bc44f6746d0cbcf9c0e1d71c5c32d6a203372 (patch) | |
tree | 3080b84186bd8f5787b67e1339c524f9e3f3ab2e /llvm/test/Transforms/InstCombine/icmp-add.ll | |
parent | c3a4b282bb787da8cb09d03b490df4aaadb81d33 (diff) | |
download | bcm5719-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.ll | 24 |
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 +} + |