[llvm] [SandboxIR] Add the ExtractElementInst class (PR #102706)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 9 17:44:44 PDT 2024


================
@@ -631,6 +631,48 @@ define void @foo(i1 %c0, i8 %v0, i8 %v1, i1 %c1) {
   }
 }
 
+TEST_F(SandboxIRTest, ExtractElementInst) {
+  parseIR(C, R"IR(
+define void @foo(<2 x i8> %vec, i32 %idx) {
+  %ins0 = extractelement <2 x i8> %vec, i32 %idx
+  ret void
+}
+)IR");
+  Function &LLVMF = *M->getFunction("foo");
+  sandboxir::Context Ctx(C);
+  auto &F = *Ctx.createFunction(&LLVMF);
+  auto *ArgVec = F.getArg(0);
+  auto *ArgIdx = F.getArg(1);
+  auto *BB = &*F.begin();
+  auto It = BB->begin();
+  auto *Ins0 = cast<sandboxir::ExtractElementInst>(&*It++);
----------------
vporpo wrote:

Rename `Ins0` to `Extr` or `EI`

https://github.com/llvm/llvm-project/pull/102706


More information about the llvm-commits mailing list