mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-03-01 14:58:18 +00:00
[InstCombine] Add test for displaced shift fold with or disjoint (NFC)
This commit is contained in:
parent
e825cc4eba
commit
04697aa18a
@ -328,3 +328,35 @@ define <2 x i8> @shl_or_non_splat_out_of_range(<2 x i8> %x) {
|
||||
%binop = or <2 x i8> %shift, %shift2
|
||||
ret <2 x i8> %binop
|
||||
}
|
||||
|
||||
define i8 @shl_or_with_or_disjoint_instead_of_add(i8 %x) {
|
||||
; CHECK-LABEL: define i8 @shl_or_with_or_disjoint_instead_of_add
|
||||
; CHECK-SAME: (i8 [[X:%.*]]) {
|
||||
; CHECK-NEXT: [[SHIFT:%.*]] = shl i8 16, [[X]]
|
||||
; CHECK-NEXT: [[ADD:%.*]] = or disjoint i8 [[X]], 1
|
||||
; CHECK-NEXT: [[SHIFT2:%.*]] = shl i8 3, [[ADD]]
|
||||
; CHECK-NEXT: [[BINOP:%.*]] = or i8 [[SHIFT]], [[SHIFT2]]
|
||||
; CHECK-NEXT: ret i8 [[BINOP]]
|
||||
;
|
||||
%shift = shl i8 16, %x
|
||||
%add = or disjoint i8 %x, 1
|
||||
%shift2 = shl i8 3, %add
|
||||
%binop = or i8 %shift, %shift2
|
||||
ret i8 %binop
|
||||
}
|
||||
|
||||
define i8 @shl_or_with_or_instead_of_add(i8 %x) {
|
||||
; CHECK-LABEL: define i8 @shl_or_with_or_instead_of_add
|
||||
; CHECK-SAME: (i8 [[X:%.*]]) {
|
||||
; CHECK-NEXT: [[SHIFT:%.*]] = shl i8 16, [[X]]
|
||||
; CHECK-NEXT: [[ADD:%.*]] = or i8 [[X]], 1
|
||||
; CHECK-NEXT: [[SHIFT2:%.*]] = shl i8 3, [[ADD]]
|
||||
; CHECK-NEXT: [[BINOP:%.*]] = or i8 [[SHIFT]], [[SHIFT2]]
|
||||
; CHECK-NEXT: ret i8 [[BINOP]]
|
||||
;
|
||||
%shift = shl i8 16, %x
|
||||
%add = or i8 %x, 1
|
||||
%shift2 = shl i8 3, %add
|
||||
%binop = or i8 %shift, %shift2
|
||||
ret i8 %binop
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user