Skip to content

Commit b338971

Browse files
committed
reduce/rename test and add assertion
1 parent 1df623a commit b338971

File tree

3 files changed

+24
-30
lines changed

3 files changed

+24
-30
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4070,6 +4070,9 @@ static SDValue extractSubVector(SDValue Vec, unsigned IdxVal, SelectionDAG &DAG,
40704070
(VT.getVectorNumElements() * vectorWidth) / VT.getSizeInBits();
40714071
EVT ResultVT = EVT::getVectorVT(*DAG.getContext(), ElVT, ResultNumElts);
40724072

4073+
assert(ResultVT.getSizeInBits() == vectorWidth &&
4074+
"Illegal subvector extraction");
4075+
40734076
// Extract the relevant vectorWidth bits. Generate an EXTRACT_SUBVECTOR
40744077
unsigned ElemsPerChunk = vectorWidth / ElVT.getSizeInBits();
40754078
assert(isPowerOf2_32(ElemsPerChunk) && "Elements per chunk not power of 2");
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+
; Ensure assertion is not hit when folding concat of two contiguous extract_subvector operations
3+
; from a source with a non-power-of-two vector length.
4+
; RUN: llc -mtriple=x86_64 -mattr=+avx2 < %s | FileCheck %s
5+
6+
define void @foo(ptr %pDst) {
7+
; CHECK-LABEL: foo:
8+
; CHECK: # %bb.0: # %entry
9+
; CHECK-NEXT: vxorps %xmm0, %xmm0, %xmm0
10+
; CHECK-NEXT: vmovups %ymm0, 16(%rdi)
11+
; CHECK-NEXT: vzeroupper
12+
; CHECK-NEXT: retq
13+
entry:
14+
%0 = shufflevector <12 x float> zeroinitializer, <12 x float> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
15+
%1 = shufflevector <12 x float> zeroinitializer, <12 x float> zeroinitializer, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
16+
%2 = getelementptr i8, ptr %pDst, i64 16
17+
%3 = getelementptr i8, ptr %pDst, i64 32
18+
store <4 x float> %0, ptr %2, align 1
19+
store <4 x float> %1, ptr %3, align 1
20+
ret void
21+
}

llvm/test/CodeGen/X86/pr128052.ll

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)