mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
[InstCombine][NFC] add2.ll: add a few commutative checks.
Fixes some missing test coverage in InstCombineAddSub.cpp, visitAdd() llvm-svn: 330986
This commit is contained in:
parent
f83f8c795a
commit
008ec4f352
@ -379,6 +379,39 @@ define i32 @add_or_and(i32 %x, i32 %y) {
|
||||
ret i32 %add
|
||||
}
|
||||
|
||||
define i32 @add_or_and_commutative(i32 %x, i32 %y) {
|
||||
; CHECK-LABEL: @add_or_and_commutative(
|
||||
; CHECK-NEXT: [[ADD:%.*]] = add i32 [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: ret i32 [[ADD]]
|
||||
;
|
||||
%or = or i32 %x, %y
|
||||
%and = and i32 %y, %x ; swapped
|
||||
%add = add i32 %or, %and
|
||||
ret i32 %add
|
||||
}
|
||||
|
||||
define i32 @add_and_or(i32 %x, i32 %y) {
|
||||
; CHECK-LABEL: @add_and_or(
|
||||
; CHECK-NEXT: [[ADD:%.*]] = add i32 [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: ret i32 [[ADD]]
|
||||
;
|
||||
%or = or i32 %x, %y
|
||||
%and = and i32 %x, %y
|
||||
%add = add i32 %and, %or
|
||||
ret i32 %add
|
||||
}
|
||||
|
||||
define i32 @add_and_or_commutative(i32 %x, i32 %y) {
|
||||
; CHECK-LABEL: @add_and_or_commutative(
|
||||
; CHECK-NEXT: [[ADD:%.*]] = add i32 [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: ret i32 [[ADD]]
|
||||
;
|
||||
%or = or i32 %x, %y
|
||||
%and = and i32 %y, %x ; swapped
|
||||
%add = add i32 %and, %or
|
||||
ret i32 %add
|
||||
}
|
||||
|
||||
define i32 @add_nsw_or_and(i32 %x, i32 %y) {
|
||||
; CHECK-LABEL: @add_nsw_or_and(
|
||||
; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[X:%.*]], [[Y:%.*]]
|
||||
|
Loading…
Reference in New Issue
Block a user