[InstCombine] Add test for or(fshl(),fshl()) bswap pattern.

Currently InstCombinerImpl::matchBSwapOrBitReverse won't match starting from funnel shifts.
This commit is contained in:
Simon Pilgrim 2020-10-25 10:07:19 +00:00
parent f81f09ba89
commit 5e9f172295
1 changed files with 17 additions and 0 deletions

View File

@ -685,6 +685,23 @@ define i32 @funnel_binary(i32 %abcd) {
ret i32 %dcba
}
define i32 @funnel_and(i32 %abcd) {
; CHECK-LABEL: @funnel_and(
; CHECK-NEXT: [[ZZCZ:%.*]] = and i32 [[ABCD:%.*]], 65280
; CHECK-NEXT: [[ZCZA:%.*]] = call i32 @llvm.fshl.i32(i32 [[ZZCZ]], i32 [[ABCD]], i32 8)
; CHECK-NEXT: [[ZBZZ:%.*]] = and i32 [[ABCD]], 16711680
; CHECK-NEXT: [[DZBZ:%.*]] = call i32 @llvm.fshl.i32(i32 [[ABCD]], i32 [[ZBZZ]], i32 24)
; CHECK-NEXT: [[DCBA:%.*]] = or i32 [[ZCZA]], [[DZBZ]]
; CHECK-NEXT: ret i32 [[DCBA]]
;
%zzcz = and i32 %abcd, 65280
%zcza = call i32 @llvm.fshl.i32(i32 %zzcz, i32 %abcd, i32 8)
%zbzz = and i32 %abcd, 16711680
%dzbz = call i32 @llvm.fshl.i32(i32 %abcd, i32 %zbzz, i32 24)
%dcba = or i32 %zcza, %dzbz
ret i32 %dcba
}
; PR47191 - deep IR trees prevent ADD/XOR instructions being simplified to OR.
define i64 @PR47191_problem1(i64 %0) {