@@ -106,7 +106,8 @@ bool RISCVTargetLowering::lowerInterleavedLoad(
106
106
Value *Offset = ConstantInt::get (XLenTy, Indices[0 ] * ScalarSizeInBytes);
107
107
Value *BasePtr = Builder.CreatePtrAdd (LI->getPointerOperand (), Offset);
108
108
Value *Mask = Builder.getAllOnesMask (VTy->getElementCount ());
109
- Value *VL = Builder.getInt32 (VTy->getNumElements ());
109
+ Value *VL = Builder.CreateElementCount (Builder.getInt32Ty (),
110
+ VTy->getElementCount ());
110
111
111
112
CallInst *CI =
112
113
Builder.CreateIntrinsic (Intrinsic::experimental_vp_strided_load,
@@ -118,7 +119,7 @@ bool RISCVTargetLowering::lowerInterleavedLoad(
118
119
return true ;
119
120
};
120
121
121
- Value *VL = ConstantInt::get (XLenTy, VTy->getNumElements ());
122
+ Value *VL = Builder. CreateElementCount (XLenTy, VTy->getElementCount ());
122
123
Value *Mask = Builder.getAllOnesMask (VTy->getElementCount ());
123
124
CallInst *VlsegN = Builder.CreateIntrinsic (
124
125
FixedVlsegIntrIds[Factor - 2 ], {VTy, PtrTy, XLenTy},
@@ -191,7 +192,8 @@ bool RISCVTargetLowering::lowerInterleavedStore(StoreInst *SI,
191
192
Value *Offset = ConstantInt::get (XLenTy, Index * ScalarSizeInBytes);
192
193
Value *BasePtr = Builder.CreatePtrAdd (SI->getPointerOperand (), Offset);
193
194
Value *Mask = Builder.getAllOnesMask (DataVTy->getElementCount ());
194
- Value *VL = Builder.getInt32 (VTy->getNumElements ());
195
+ Value *VL = Builder.CreateElementCount (Builder.getInt32Ty (),
196
+ VTy->getElementCount ());
195
197
196
198
CallInst *CI = Builder.CreateIntrinsic (
197
199
Intrinsic::experimental_vp_strided_store,
@@ -223,7 +225,7 @@ bool RISCVTargetLowering::lowerInterleavedStore(StoreInst *SI,
223
225
// This VL should be OK (should be executable in one vsseg instruction,
224
226
// potentially under larger LMULs) because we checked that the fixed vector
225
227
// type fits in isLegalInterleavedAccessType
226
- Value *VL = ConstantInt::get (XLenTy, VTy->getNumElements ());
228
+ Value *VL = Builder. CreateElementCount (XLenTy, VTy->getElementCount ());
227
229
Value *StoreMask = Builder.getAllOnesMask (VTy->getElementCount ());
228
230
Ops.append ({SI->getPointerOperand (), StoreMask, VL});
229
231
@@ -256,7 +258,7 @@ bool RISCVTargetLowering::lowerDeinterleaveIntrinsicToLoad(
256
258
Type *XLenTy = Type::getIntNTy (LI->getContext (), Subtarget.getXLen ());
257
259
258
260
if (auto *FVTy = dyn_cast<FixedVectorType>(ResVTy)) {
259
- Value *VL = ConstantInt::get (XLenTy, FVTy->getNumElements ());
261
+ Value *VL = Builder. CreateElementCount (XLenTy, FVTy->getElementCount ());
260
262
Value *Mask = Builder.getAllOnesMask (FVTy->getElementCount ());
261
263
Return = Builder.CreateIntrinsic (FixedVlsegIntrIds[Factor - 2 ],
262
264
{ResVTy, PtrTy, XLenTy},
@@ -330,7 +332,7 @@ bool RISCVTargetLowering::lowerInterleaveIntrinsicToStore(
330
332
SI->getModule (), FixedVssegIntrIds[Factor - 2 ], {InVTy, PtrTy, XLenTy});
331
333
332
334
SmallVector<Value *, 10 > Ops (InterleaveValues);
333
- Value *VL = ConstantInt::get (XLenTy, FVTy->getNumElements ());
335
+ Value *VL = Builder. CreateElementCount (XLenTy, FVTy->getElementCount ());
334
336
Value *Mask = Builder.getAllOnesMask (FVTy->getElementCount ());
335
337
Ops.append ({SI->getPointerOperand (), Mask, VL});
336
338
0 commit comments