[InstCombine] add test for shift-shift with extra use; NFC

This commit is contained in:
Sanjay Patel 2021-09-22 16:15:47 -04:00
parent d8e1203f91
commit 55aa4e92f7
1 changed files with 17 additions and 0 deletions

View File

@ -260,3 +260,20 @@ cond.end:
%eq = icmp eq i32 %cond, %conv27 %eq = icmp eq i32 %cond, %conv27
ret i1 %eq ret i1 %eq
} }
define i16 @extra_use_on_first_shift(i32 %x) {
; CHECK-LABEL: @extra_use_on_first_shift(
; CHECK-NEXT: [[A:%.*]] = ashr i32 [[X:%.*]], 3
; CHECK-NEXT: call void @use32(i32 [[A]])
; CHECK-NEXT: [[SH1:%.*]] = lshr i32 [[A]], 6
; CHECK-NEXT: [[TMP1:%.*]] = trunc i32 [[SH1]] to i16
; CHECK-NEXT: [[SH:%.*]] = and i16 [[TMP1]], 1023
; CHECK-NEXT: ret i16 [[SH]]
;
%a = ashr i32 %x, 3
call void @use32(i32 %a)
%tr = trunc i32 %a to i16
%sh = lshr i16 %tr, 6
ret i16 %sh
}