[llvm] [SandboxIR] Add ShuffleVectorInst (PR #104891)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 20 17:22:37 PDT 2024
================
@@ -739,6 +740,401 @@ define void @foo(i8 %v0, i8 %v1, <2 x i8> %vec) {
llvm::InsertElementInst::isValidOperands(LLVMArg0, LLVMArgVec, LLVMZero));
}
+TEST_F(SandboxIRTest, ShuffleVectorInst) {
+ parseIR(C, R"IR(
+define void @foo(<2 x i8> %v1, <2 x i8> %v2) {
+ %ins0 = shufflevector <2 x i8> %v1, <2 x i8> %v2, <2 x i32> <i32 0, i32 2>
+ ret void
+}
+)IR");
+ Function &LLVMF = *M->getFunction("foo");
+ sandboxir::Context Ctx(C);
+ auto &F = *Ctx.createFunction(&LLVMF);
+ auto *ArgV1 = F.getArg(0);
+ auto *ArgV2 = F.getArg(1);
+ auto *BB = &*F.begin();
+ auto It = BB->begin();
+ auto *SI = cast<sandboxir::ShuffleVectorInst>(&*It++);
----------------
vporpo wrote:
nit: `SI` is commonly used for `StoreInst`. Perhaps something like `Shuf` would be better?
https://github.com/llvm/llvm-project/pull/104891
More information about the llvm-commits
mailing list