Skip to content

Commit 0563479

Browse files
committed
Address code review comments
1 parent 77916a6 commit 0563479

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2160,7 +2160,8 @@ def VecShuffleDynamicOp : CIR_Op<"vec.shuffle.dynamic",
21602160
vector from the indices indicated by the elements of the second vector.
21612161

21622162
```mlir
2163-
%new_vec = cir.vec.shuffle.dynamic %vec : !cir.vector<4 x !s32i>, %indices : !cir.vector<4 x !s32i>
2163+
%new_vec = cir.vec.shuffle.dynamic %vec : !cir.vector<4 x !s32i>, %indices
2164+
: !cir.vector<4 x !s32i>
21642165
```
21652166
}];
21662167

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,6 +1891,11 @@ mlir::LogicalResult CIRToLLVMVecShuffleDynamicOpLowering::matchAndRewrite(
18911891
elementTypeIfVector(op.getIndices().getType()));
18921892
uint64_t numElements =
18931893
mlir::cast<cir::VectorType>(op.getVec().getType()).getSize();
1894+
1895+
if (llvm::isPowerOf2_64(numElements))
1896+
return op.emitError() << "unsupported VecShuffleDynamic for VectorType "
1897+
"with size not power of 2";
1898+
18941899
mlir::Value maskValue = rewriter.create<mlir::LLVM::ConstantOp>(
18951900
loc, llvmIndexType,
18961901
mlir::IntegerAttr::get(llvmIndexType, numElements - 1));

0 commit comments

Comments
 (0)