forked from OSchip/llvm-project
[NFC][InstCombine] Revisit tests for D47980 / D47981 once more.
llvm-svn: 334370
This commit is contained in:
parent
3629e3a2a8
commit
1e9457ee76
|
@ -98,8 +98,8 @@ define i32 @positive_biggershl_ashrexact(i32 %x) {
|
|||
ret i32 %ret
|
||||
}
|
||||
|
||||
define i32 @positive_biggershl_ashrexact_shlexact(i32 %x) {
|
||||
; CHECK-LABEL: @positive_biggershl_ashrexact_shlexact(
|
||||
define i32 @positive_biggershl_ashrexact_shlnuw(i32 %x) {
|
||||
; CHECK-LABEL: @positive_biggershl_ashrexact_shlnuw(
|
||||
; CHECK-NEXT: [[RET:%.*]] = shl nuw i32 [[X:%.*]], 5
|
||||
; CHECK-NEXT: ret i32 [[RET]]
|
||||
;
|
||||
|
@ -258,6 +258,50 @@ define <3 x i32> @positive_biggershl_vec_undef2(<3 x i32> %x) {
|
|||
ret <3 x i32> %ret
|
||||
}
|
||||
|
||||
; ============================================================================ ;
|
||||
; Positive multi-use tests with constant
|
||||
; ============================================================================ ;
|
||||
|
||||
; FIXME: drop 'exact' once it is no longer needed.
|
||||
|
||||
define i32 @positive_sameconst_multiuse(i32 %x) {
|
||||
; CHECK-LABEL: @positive_sameconst_multiuse(
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = ashr exact i32 [[X:%.*]], 5
|
||||
; CHECK-NEXT: call void @use32(i32 [[TMP0]])
|
||||
; CHECK-NEXT: ret i32 [[X]]
|
||||
;
|
||||
%tmp0 = ashr exact i32 %x, 5
|
||||
call void @use32(i32 %tmp0)
|
||||
%ret = shl i32 %tmp0, 5
|
||||
ret i32 %ret
|
||||
}
|
||||
|
||||
define i32 @positive_biggerashr_multiuse(i32 %x) {
|
||||
; CHECK-LABEL: @positive_biggerashr_multiuse(
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = ashr exact i32 [[X:%.*]], 10
|
||||
; CHECK-NEXT: call void @use32(i32 [[TMP0]])
|
||||
; CHECK-NEXT: [[RET:%.*]] = ashr exact i32 [[X]], 5
|
||||
; CHECK-NEXT: ret i32 [[RET]]
|
||||
;
|
||||
%tmp0 = ashr exact i32 %x, 10
|
||||
call void @use32(i32 %tmp0)
|
||||
%ret = shl i32 %tmp0, 5
|
||||
ret i32 %ret
|
||||
}
|
||||
|
||||
define i32 @positive_biggershl_multiuse(i32 %x) {
|
||||
; CHECK-LABEL: @positive_biggershl_multiuse(
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = ashr exact i32 [[X:%.*]], 5
|
||||
; CHECK-NEXT: call void @use32(i32 [[TMP0]])
|
||||
; CHECK-NEXT: [[RET:%.*]] = shl i32 [[X]], 5
|
||||
; CHECK-NEXT: ret i32 [[RET]]
|
||||
;
|
||||
%tmp0 = ashr exact i32 %x, 5
|
||||
call void @use32(i32 %tmp0)
|
||||
%ret = shl i32 %tmp0, 10
|
||||
ret i32 %ret
|
||||
}
|
||||
|
||||
; ============================================================================ ;
|
||||
; Constant Non-Splat Vectors
|
||||
; ============================================================================ ;
|
||||
|
|
|
@ -98,8 +98,8 @@ define i32 @positive_biggershl_lshrexact(i32 %x) {
|
|||
ret i32 %ret
|
||||
}
|
||||
|
||||
define i32 @positive_biggershl_lshrexact_shlexact(i32 %x) {
|
||||
; CHECK-LABEL: @positive_biggershl_lshrexact_shlexact(
|
||||
define i32 @positive_biggershl_lshrexact_shlnuw(i32 %x) {
|
||||
; CHECK-LABEL: @positive_biggershl_lshrexact_shlnuw(
|
||||
; CHECK-NEXT: [[RET:%.*]] = shl nuw i32 [[X:%.*]], 5
|
||||
; CHECK-NEXT: ret i32 [[RET]]
|
||||
;
|
||||
|
@ -258,6 +258,50 @@ define <3 x i32> @positive_biggershl_vec_undef2(<3 x i32> %x) {
|
|||
ret <3 x i32> %ret
|
||||
}
|
||||
|
||||
; ============================================================================ ;
|
||||
; Positive multi-use tests with constant
|
||||
; ============================================================================ ;
|
||||
|
||||
; FIXME: drop 'exact' once it is no longer needed.
|
||||
|
||||
define i32 @positive_sameconst_multiuse(i32 %x) {
|
||||
; CHECK-LABEL: @positive_sameconst_multiuse(
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = lshr exact i32 [[X:%.*]], 5
|
||||
; CHECK-NEXT: call void @use32(i32 [[TMP0]])
|
||||
; CHECK-NEXT: ret i32 [[X]]
|
||||
;
|
||||
%tmp0 = lshr exact i32 %x, 5
|
||||
call void @use32(i32 %tmp0)
|
||||
%ret = shl i32 %tmp0, 5
|
||||
ret i32 %ret
|
||||
}
|
||||
|
||||
define i32 @positive_biggerlshr_multiuse(i32 %x) {
|
||||
; CHECK-LABEL: @positive_biggerlshr_multiuse(
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = lshr exact i32 [[X:%.*]], 10
|
||||
; CHECK-NEXT: call void @use32(i32 [[TMP0]])
|
||||
; CHECK-NEXT: [[RET:%.*]] = lshr exact i32 [[X]], 5
|
||||
; CHECK-NEXT: ret i32 [[RET]]
|
||||
;
|
||||
%tmp0 = lshr exact i32 %x, 10
|
||||
call void @use32(i32 %tmp0)
|
||||
%ret = shl i32 %tmp0, 5
|
||||
ret i32 %ret
|
||||
}
|
||||
|
||||
define i32 @positive_biggershl_multiuse(i32 %x) {
|
||||
; CHECK-LABEL: @positive_biggershl_multiuse(
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = lshr exact i32 [[X:%.*]], 5
|
||||
; CHECK-NEXT: call void @use32(i32 [[TMP0]])
|
||||
; CHECK-NEXT: [[RET:%.*]] = shl i32 [[X]], 5
|
||||
; CHECK-NEXT: ret i32 [[RET]]
|
||||
;
|
||||
%tmp0 = lshr exact i32 %x, 5
|
||||
call void @use32(i32 %tmp0)
|
||||
%ret = shl i32 %tmp0, 10
|
||||
ret i32 %ret
|
||||
}
|
||||
|
||||
; ============================================================================ ;
|
||||
; Constant Non-Splat Vectors
|
||||
; ============================================================================ ;
|
||||
|
|
|
@ -55,6 +55,17 @@ define i32 @positive_biggerLshr(i32 %x) {
|
|||
ret i32 %ret
|
||||
}
|
||||
|
||||
define i32 @positive_biggerLshr_lshrexact(i32 %x) {
|
||||
; CHECK-LABEL: @positive_biggerLshr_lshrexact(
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = lshr exact i32 [[X:%.*]], 5
|
||||
; CHECK-NEXT: [[RET:%.*]] = and i32 [[TMP1]], 4194303
|
||||
; CHECK-NEXT: ret i32 [[RET]]
|
||||
;
|
||||
%tmp0 = shl i32 %x, 5
|
||||
%ret = lshr exact i32 %tmp0, 10
|
||||
ret i32 %ret
|
||||
}
|
||||
|
||||
; ============================================================================ ;
|
||||
; NUW on the first shift
|
||||
; ============================================================================ ;
|
||||
|
@ -257,6 +268,79 @@ define <3 x i32> @positive_biggerLshr_vec_undef2(<3 x i32> %x) {
|
|||
ret <3 x i32> %ret
|
||||
}
|
||||
|
||||
; ============================================================================ ;
|
||||
; Positive multi-use tests with constant
|
||||
; ============================================================================ ;
|
||||
|
||||
define i32 @positive_sameconst_multiuse(i32 %x) {
|
||||
; CHECK-LABEL: @positive_sameconst_multiuse(
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = shl i32 [[X:%.*]], 5
|
||||
; CHECK-NEXT: call void @use32(i32 [[TMP0]])
|
||||
; CHECK-NEXT: [[RET:%.*]] = and i32 [[X]], 134217727
|
||||
; CHECK-NEXT: ret i32 [[RET]]
|
||||
;
|
||||
%tmp0 = shl i32 %x, 5
|
||||
call void @use32(i32 %tmp0)
|
||||
%ret = lshr i32 %tmp0, 5
|
||||
ret i32 %ret
|
||||
}
|
||||
|
||||
define i32 @positive_biggerShl_shlnuw_multiuse(i32 %x) {
|
||||
; CHECK-LABEL: @positive_biggerShl_shlnuw_multiuse(
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = shl nuw i32 [[X:%.*]], 10
|
||||
; CHECK-NEXT: call void @use32(i32 [[TMP0]])
|
||||
; CHECK-NEXT: [[RET:%.*]] = shl nuw i32 [[X]], 5
|
||||
; CHECK-NEXT: ret i32 [[RET]]
|
||||
;
|
||||
%tmp0 = shl nuw i32 %x, 10
|
||||
call void @use32(i32 %tmp0)
|
||||
%ret = lshr i32 %tmp0, 5
|
||||
ret i32 %ret
|
||||
}
|
||||
|
||||
define i32 @positive_biggerLshr_shlnuw_multiuse(i32 %x) {
|
||||
; CHECK-LABEL: @positive_biggerLshr_shlnuw_multiuse(
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = shl nuw i32 [[X:%.*]], 5
|
||||
; CHECK-NEXT: call void @use32(i32 [[TMP0]])
|
||||
; CHECK-NEXT: [[RET:%.*]] = lshr i32 [[X]], 5
|
||||
; CHECK-NEXT: ret i32 [[RET]]
|
||||
;
|
||||
%tmp0 = shl nuw i32 %x, 5
|
||||
call void @use32(i32 %tmp0)
|
||||
%ret = lshr i32 %tmp0, 10
|
||||
ret i32 %ret
|
||||
}
|
||||
|
||||
; NOTE: creates one extra instruction, but this seems intentional.
|
||||
define i32 @positive_biggerShl_multiuse_extrainstr(i32 %x) {
|
||||
; CHECK-LABEL: @positive_biggerShl_multiuse_extrainstr(
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = shl i32 [[X:%.*]], 10
|
||||
; CHECK-NEXT: call void @use32(i32 [[TMP0]])
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = shl i32 [[X]], 5
|
||||
; CHECK-NEXT: [[RET:%.*]] = and i32 [[TMP1]], 134217696
|
||||
; CHECK-NEXT: ret i32 [[RET]]
|
||||
;
|
||||
%tmp0 = shl i32 %x, 10
|
||||
call void @use32(i32 %tmp0)
|
||||
%ret = lshr i32 %tmp0, 5
|
||||
ret i32 %ret
|
||||
}
|
||||
|
||||
; NOTE: creates one extra instruction, but this seems intentional.
|
||||
define i32 @positive_biggerLshr_multiuse_extrainstr(i32 %x) {
|
||||
; CHECK-LABEL: @positive_biggerLshr_multiuse_extrainstr(
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = shl i32 [[X:%.*]], 5
|
||||
; CHECK-NEXT: call void @use32(i32 [[TMP0]])
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[X]], 5
|
||||
; CHECK-NEXT: [[RET:%.*]] = and i32 [[TMP1]], 4194303
|
||||
; CHECK-NEXT: ret i32 [[RET]]
|
||||
;
|
||||
%tmp0 = shl i32 %x, 5
|
||||
call void @use32(i32 %tmp0)
|
||||
%ret = lshr i32 %tmp0, 10
|
||||
ret i32 %ret
|
||||
}
|
||||
|
||||
; ============================================================================ ;
|
||||
; Constant Non-Splat Vectors
|
||||
; ============================================================================ ;
|
||||
|
|
Loading…
Reference in New Issue