mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
[InstCombine] add tests for vector demanded elements of select condition; NFC
This commit is contained in:
parent
59de807f62
commit
f3ed581267
@ -672,3 +672,64 @@ bb:
|
||||
%tmp2 = extractelement <4 x i32*> %tmp, i64 0
|
||||
ret i32* %tmp2
|
||||
}
|
||||
|
||||
; The non-zero elements of the result are always 'min', so the splat is unnecessary.
|
||||
|
||||
define <4 x i8> @select_cond_with_eq_true_false_elts(<4 x i8> %x, <4 x i8> %y, <4 x i1> %cmp) {
|
||||
; CHECK-LABEL: @select_cond_with_eq_true_false_elts(
|
||||
; CHECK-NEXT: [[TVAL:%.*]] = shufflevector <4 x i8> [[X:%.*]], <4 x i8> [[Y:%.*]], <4 x i32> <i32 0, i32 5, i32 6, i32 7>
|
||||
; CHECK-NEXT: [[SPLAT:%.*]] = shufflevector <4 x i1> [[CMP:%.*]], <4 x i1> undef, <4 x i32> zeroinitializer
|
||||
; CHECK-NEXT: [[R:%.*]] = select <4 x i1> [[SPLAT]], <4 x i8> [[TVAL]], <4 x i8> [[Y]]
|
||||
; CHECK-NEXT: ret <4 x i8> [[R]]
|
||||
;
|
||||
%tval = shufflevector <4 x i8> %x, <4 x i8> %y, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
|
||||
%splat = shufflevector <4 x i1> %cmp, <4 x i1> undef, <4 x i32> zeroinitializer
|
||||
%r = select <4 x i1> %splat, <4 x i8> %tval, <4 x i8> %y
|
||||
ret <4 x i8> %r
|
||||
}
|
||||
|
||||
; First element of the result is always x[0], so first element of select condition is unnecessary.
|
||||
|
||||
define <4 x i8> @select_cond_with_eq_true_false_elts2(<4 x i8> %x, <4 x i8> %y, <4 x i1> %cmp) {
|
||||
; CHECK-LABEL: @select_cond_with_eq_true_false_elts2(
|
||||
; CHECK-NEXT: [[TVAL:%.*]] = shufflevector <4 x i8> [[X:%.*]], <4 x i8> [[Y:%.*]], <4 x i32> <i32 0, i32 5, i32 6, i32 7>
|
||||
; CHECK-NEXT: [[COND:%.*]] = shufflevector <4 x i1> [[CMP:%.*]], <4 x i1> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
|
||||
; CHECK-NEXT: [[R:%.*]] = select <4 x i1> [[COND]], <4 x i8> [[TVAL]], <4 x i8> [[X]]
|
||||
; CHECK-NEXT: ret <4 x i8> [[R]]
|
||||
;
|
||||
%tval = shufflevector <4 x i8> %x, <4 x i8> %y, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
|
||||
%cond = shufflevector <4 x i1> %cmp, <4 x i1> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
|
||||
%r = select <4 x i1> %cond, <4 x i8> %tval, <4 x i8> %x
|
||||
ret <4 x i8> %r
|
||||
}
|
||||
|
||||
; Second element of the result is always x[3], so second element of select condition is unnecessary.
|
||||
; Fourth element of the result is always undef, so fourth element of select condition is unnecessary.
|
||||
|
||||
define <4 x float> @select_cond_with_eq_true_false_elts3(<4 x float> %x, <4 x float> %y, <4 x i1> %cmp) {
|
||||
; CHECK-LABEL: @select_cond_with_eq_true_false_elts3(
|
||||
; CHECK-NEXT: [[TVAL:%.*]] = shufflevector <4 x float> [[X:%.*]], <4 x float> [[Y:%.*]], <4 x i32> <i32 1, i32 3, i32 5, i32 undef>
|
||||
; CHECK-NEXT: [[FVAL:%.*]] = shufflevector <4 x float> [[Y]], <4 x float> [[X]], <4 x i32> <i32 0, i32 7, i32 6, i32 undef>
|
||||
; CHECK-NEXT: [[COND:%.*]] = shufflevector <4 x i1> [[CMP:%.*]], <4 x i1> undef, <4 x i32> <i32 undef, i32 1, i32 2, i32 3>
|
||||
; CHECK-NEXT: [[R:%.*]] = select <4 x i1> [[COND]], <4 x float> [[TVAL]], <4 x float> [[FVAL]]
|
||||
; CHECK-NEXT: ret <4 x float> [[R]]
|
||||
;
|
||||
%tval = shufflevector <4 x float> %x, <4 x float> %y, <4 x i32> <i32 1, i32 3, i32 5, i32 undef>
|
||||
%fval = shufflevector <4 x float> %y, <4 x float> %x, <4 x i32> <i32 0, i32 7, i32 6, i32 undef>
|
||||
%cond = shufflevector <4 x i1> %cmp, <4 x i1> undef, <4 x i32> <i32 undef, i32 1, i32 2, i32 3>
|
||||
%r = select <4 x i1> %cond, <4 x float> %tval, <4 x float> %fval
|
||||
ret <4 x float> %r
|
||||
}
|
||||
|
||||
define <4 x i8> @select_cond_with_undef_true_false_elts(<4 x i8> %x, <4 x i8> %y, <4 x i1> %cmp) {
|
||||
; CHECK-LABEL: @select_cond_with_undef_true_false_elts(
|
||||
; CHECK-NEXT: [[TVAL:%.*]] = shufflevector <4 x i8> [[Y:%.*]], <4 x i8> undef, <4 x i32> <i32 undef, i32 1, i32 2, i32 3>
|
||||
; CHECK-NEXT: [[COND:%.*]] = shufflevector <4 x i1> [[CMP:%.*]], <4 x i1> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
|
||||
; CHECK-NEXT: [[R:%.*]] = select <4 x i1> [[COND]], <4 x i8> [[TVAL]], <4 x i8> [[X:%.*]]
|
||||
; CHECK-NEXT: ret <4 x i8> [[R]]
|
||||
;
|
||||
%tval = shufflevector <4 x i8> %x, <4 x i8> %y, <4 x i32> <i32 undef, i32 5, i32 6, i32 7>
|
||||
%cond = shufflevector <4 x i1> %cmp, <4 x i1> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
|
||||
%r = select <4 x i1> %cond, <4 x i8> %tval, <4 x i8> %x
|
||||
ret <4 x i8> %r
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user