Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from MaxMood96:main #141

Merged
merged 13 commits into from
Oct 10, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[InstCombine] add test for or-of-icmps; NFC
  • Loading branch information
rotateright committed Oct 10, 2021
commit c00cab878aa523e20a5dbd618e9852e191504cfe
15 changes: 15 additions & 0 deletions llvm/test/Transforms/InstCombine/or.ll
Original file line number Diff line number Diff line change
Expand Up @@ -1444,3 +1444,18 @@ define i8 @lshr_bitwidth_mask(i8 %x, i8 %y) {
%r = or i8 %sign, %y
ret i8 %r
}

define i1 @cmp_overlap(i32 %x) {
; CHECK-LABEL: @cmp_overlap(
; CHECK-NEXT: [[ISNEG:%.*]] = icmp slt i32 [[X:%.*]], 0
; CHECK-NEXT: [[NEGX:%.*]] = sub i32 0, [[X]]
; CHECK-NEXT: [[ISNOTNEG:%.*]] = icmp sgt i32 [[NEGX]], -1
; CHECK-NEXT: [[R:%.*]] = or i1 [[ISNEG]], [[ISNOTNEG]]
; CHECK-NEXT: ret i1 [[R]]
;
%isneg = icmp slt i32 %x, 0
%negx = sub i32 0, %x
%isnotneg = icmp sgt i32 %negx, -1
%r = or i1 %isneg, %isnotneg
ret i1 %r
}