[InstCombine] Add exact shift tests missed in D88475

I missed the post-LGTM comment from @lebedev.ri
This commit is contained in:
Simon Pilgrim 2020-09-29 15:05:30 +01:00
parent d9ee935679
commit 042f22bda5
1 changed files with 23 additions and 0 deletions

View File

@ -1546,6 +1546,17 @@ define i8 @trunc_lshr_sext(i8 %A) {
ret i8 %D
}
define i8 @trunc_lshr_sext_exact(i8 %A) {
; ALL-LABEL: @trunc_lshr_sext_exact(
; ALL-NEXT: [[D:%.*]] = ashr i8 [[A:%.*]], 6
; ALL-NEXT: ret i8 [[D]]
;
%B = sext i8 %A to i32
%C = lshr exact i32 %B, 6
%D = trunc i32 %C to i8
ret i8 %D
}
define <2 x i8> @trunc_lshr_sext_uniform(<2 x i8> %A) {
; ALL-LABEL: @trunc_lshr_sext_uniform(
; ALL-NEXT: [[D:%.*]] = ashr <2 x i8> [[A:%.*]], <i8 6, i8 6>
@ -1705,6 +1716,18 @@ define i8 @trunc_lshr_sext_wide_input(i16 %A) {
ret i8 %D
}
define i8 @trunc_lshr_sext_wide_input_exact(i16 %A) {
; ALL-LABEL: @trunc_lshr_sext_wide_input_exact(
; ALL-NEXT: [[TMP1:%.*]] = ashr i16 [[A:%.*]], 9
; ALL-NEXT: [[D:%.*]] = trunc i16 [[TMP1]] to i8
; ALL-NEXT: ret i8 [[D]]
;
%B = sext i16 %A to i32
%C = lshr exact i32 %B, 9
%D = trunc i32 %C to i8
ret i8 %D
}
define <2 x i8> @trunc_lshr_sext_wide_input_uses1(<2 x i16> %A) {
; ALL-LABEL: @trunc_lshr_sext_wide_input_uses1(
; ALL-NEXT: [[B:%.*]] = sext <2 x i16> [[A:%.*]] to <2 x i32>