Skip to content

Commit 51bbd01

Browse files
author
Elena Demikhovsky
committed
AVX-512: Fixed a bug in shufflevector lowering.
PALIGNR instruction does not exist in AVX-512F set. Added a test. llvm-svn: 215526
1 parent a4a4db9 commit 51bbd01

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3872,7 +3872,8 @@ static bool isAlignrMask(ArrayRef<int> Mask, MVT VT, bool InterLane) {
38723872
static bool isPALIGNRMask(ArrayRef<int> Mask, MVT VT,
38733873
const X86Subtarget *Subtarget) {
38743874
if ((VT.is128BitVector() && !Subtarget->hasSSSE3()) ||
3875-
(VT.is256BitVector() && !Subtarget->hasInt256()))
3875+
(VT.is256BitVector() && !Subtarget->hasInt256()) ||
3876+
VT.is512BitVector())
38763877
// FIXME: Add AVX512BW.
38773878
return false;
38783879

llvm/test/CodeGen/X86/avx512-shuffle.ll

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,24 @@ define <16 x i32> @test15(<16 x i32> %a) {
199199
%b = shufflevector <16 x i32> %a, <16 x i32> undef, <16 x i32><i32 1, i32 0, i32 3, i32 2, i32 5, i32 4, i32 7, i32 6, i32 9, i32 8, i32 11, i32 10, i32 13, i32 12, i32 15, i32 14>
200200
ret <16 x i32> %b
201201
}
202+
203+
; CHECK-LABEL: valign_test_v16f32
204+
; CHECK: valignd $2, %zmm0, %zmm0
205+
; CHECK: ret
206+
define <16 x float> @valign_test_v16f32(<16 x float> %a, <16 x float> %b) nounwind {
207+
%c = shufflevector <16 x float> %a, <16 x float> %b, <16 x i32><i32 2, i32 3, i32 undef, i32 undef, i32 6, i32 7, i32 undef, i32 undef, i32 10, i32 11, i32 undef, i32 undef, i32 14, i32 15, i32 undef, i32 undef>
208+
ret <16 x float> %c
209+
}
210+
211+
; CHECK-LABEL: valign_test_v16i32
212+
; CHECK: valignd $2, %zmm0, %zmm0
213+
; CHECK: ret
214+
define <16 x i32> @valign_test_v16i32(<16 x i32> %a, <16 x i32> %b) nounwind {
215+
%c = shufflevector <16 x i32> %a, <16 x i32> %b, <16 x i32><i32 2, i32 3, i32 undef, i32 undef, i32 6, i32 7, i32 undef, i32 undef, i32 10, i32 11, i32 undef, i32 undef, i32 14, i32 15, i32 undef, i32 undef>
216+
ret <16 x i32> %c
217+
}
218+
219+
202220
; CHECK-LABEL: test16
203221
; CHECK: valignq $2, %zmm0, %zmm1
204222
; CHECK: ret

0 commit comments

Comments
 (0)