forked from OSchip/llvm-project
[InstSimplify] add tests for insert constant + splat; NFC
This commit is contained in:
parent
4ffd3f44e3
commit
252d3b9805
|
@ -721,3 +721,16 @@ define <4 x float> @insert_demanded_element_op1(<4 x float> %x, <4 x float> %y)
|
|||
%s = shufflevector <4 x float> %y, <4 x float> %ins, <4 x i32> <i32 0, i32 7, i32 1, i32 4>
|
||||
ret <4 x float> %s
|
||||
}
|
||||
|
||||
define <4 x float> @splat_constant(<4 x float> %x) {
|
||||
; CHECK-LABEL: @splat_constant(
|
||||
; CHECK-NEXT: [[INS3:%.*]] = insertelement <4 x float> [[X:%.*]], float 3.000000e+00, i32 3
|
||||
; CHECK-NEXT: [[SPLAT3:%.*]] = shufflevector <4 x float> [[INS3]], <4 x float> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
|
||||
; CHECK-NEXT: [[R:%.*]] = fadd <4 x float> [[INS3]], [[SPLAT3]]
|
||||
; CHECK-NEXT: ret <4 x float> [[R]]
|
||||
;
|
||||
%ins3 = insertelement <4 x float> %x, float 3.0, i32 3
|
||||
%splat3 = shufflevector <4 x float> %ins3, <4 x float> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
|
||||
%r = fadd <4 x float> %ins3, %splat3
|
||||
ret <4 x float> %r
|
||||
}
|
||||
|
|
|
@ -247,3 +247,25 @@ define <2 x float> @PR32872(<2 x float> %x) {
|
|||
%tmp4 = shufflevector <4 x float> zeroinitializer, <4 x float> %tmp1, <2 x i32> <i32 4, i32 5>
|
||||
ret <2 x float> %tmp4
|
||||
}
|
||||
|
||||
define <4 x float> @splat_constant(<4 x float> %x) {
|
||||
; CHECK-LABEL: @splat_constant(
|
||||
; CHECK-NEXT: [[INS3:%.*]] = insertelement <4 x float> [[X:%.*]], float 4.200000e+01, i32 3
|
||||
; CHECK-NEXT: [[SPLAT3:%.*]] = shufflevector <4 x float> [[INS3]], <4 x float> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
|
||||
; CHECK-NEXT: ret <4 x float> [[SPLAT3]]
|
||||
;
|
||||
%ins3 = insertelement <4 x float> %x, float 42.0, i32 3
|
||||
%splat3 = shufflevector <4 x float> %ins3, <4 x float> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
|
||||
ret <4 x float> %splat3
|
||||
}
|
||||
|
||||
define <4 x float> @splat_constant_undef_elt(<4 x float> %x) {
|
||||
; CHECK-LABEL: @splat_constant_undef_elt(
|
||||
; CHECK-NEXT: [[INS1:%.*]] = insertelement <4 x float> [[X:%.*]], float 1.200000e+01, i32 1
|
||||
; CHECK-NEXT: [[SPLAT1:%.*]] = shufflevector <4 x float> [[INS1]], <4 x float> undef, <4 x i32> <i32 1, i32 1, i32 undef, i32 1>
|
||||
; CHECK-NEXT: ret <4 x float> [[SPLAT1]]
|
||||
;
|
||||
%ins1 = insertelement <4 x float> %x, float 12.0, i32 1
|
||||
%splat1 = shufflevector <4 x float> %ins1, <4 x float> undef, <4 x i32> <i32 1, i32 1, i32 undef, i32 1>
|
||||
ret <4 x float> %splat1
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue