Skip to content

Commit ee76861

Browse files
committed
[InstCombine][X86] Add SSE shift test coverage for #125228
Pulled out of #125935 to show diff
1 parent 5870c19 commit ee76861

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

llvm/test/Transforms/InstCombine/X86/x86-vector-shifts.ll

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3732,6 +3732,32 @@ define <4 x i64> @test_avx2_psrl_0() {
37323732
ret <4 x i64> %16
37333733
}
37343734

3735+
; FIXME: Failure to peek through bitcasts to ensure psllq shift amount is within bounds.
3736+
define <2 x i64> @PR125228(<2 x i64> %v, <2 x i64> %s) {
3737+
; CHECK-LABEL: @PR125228(
3738+
; CHECK-NEXT: [[MASK:%.*]] = and <2 x i64> [[S:%.*]], splat (i64 63)
3739+
; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x i64> [[MASK]], <2 x i64> poison, <2 x i32> zeroinitializer
3740+
; CHECK-NEXT: [[SLL0:%.*]] = shl <2 x i64> [[V:%.*]], [[TMP1]]
3741+
; CHECK-NEXT: [[CAST:%.*]] = bitcast <2 x i64> [[MASK]] to <16 x i8>
3742+
; CHECK-NEXT: [[PSRLDQ:%.*]] = shufflevector <16 x i8> [[CAST]], <16 x i8> poison, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
3743+
; CHECK-NEXT: [[CAST3:%.*]] = bitcast <16 x i8> [[PSRLDQ]] to <2 x i64>
3744+
; CHECK-NEXT: [[SLL1:%.*]] = call <2 x i64> @llvm.x86.sse2.psll.q(<2 x i64> [[V]], <2 x i64> [[CAST3]])
3745+
; CHECK-NEXT: [[SHUFP_UNCASTED:%.*]] = shufflevector <2 x i64> [[SLL0]], <2 x i64> [[SLL1]], <2 x i32> <i32 0, i32 3>
3746+
; CHECK-NEXT: ret <2 x i64> [[SHUFP_UNCASTED]]
3747+
;
3748+
%mask = and <2 x i64> %s, splat (i64 63)
3749+
%sll0 = call <2 x i64> @llvm.x86.sse2.psll.q(<2 x i64> %v, <2 x i64> %mask)
3750+
%cast = bitcast <2 x i64> %mask to <16 x i8>
3751+
%psrldq = shufflevector <16 x i8> %cast, <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison>, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23>
3752+
%cast3 = bitcast <16 x i8> %psrldq to <2 x i64>
3753+
%sll1 = call <2 x i64> @llvm.x86.sse2.psll.q(<2 x i64> %v, <2 x i64> %cast3)
3754+
%cast0 = bitcast <2 x i64> %sll0 to <2 x double>
3755+
%cast1 = bitcast <2 x i64> %sll1 to <2 x double>
3756+
%shufp = shufflevector <2 x double> %cast0, <2 x double> %cast1, <2 x i32> <i32 0, i32 3>
3757+
%res = bitcast <2 x double> %shufp to <2 x i64>
3758+
ret <2 x i64> %res
3759+
}
3760+
37353761
declare <8 x i64> @llvm.x86.avx512.pslli.q.512(<8 x i64>, i32) #1
37363762
declare <16 x i32> @llvm.x86.avx512.pslli.d.512(<16 x i32>, i32) #1
37373763
declare <32 x i16> @llvm.x86.avx512.pslli.w.512(<32 x i16>, i32) #1

0 commit comments

Comments
 (0)