[llvm] [IR] Allow vector atomicrmw xchg (PR #208510)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 15 07:42:51 PDT 2026


================
@@ -527,8 +526,33 @@ TEST(VerifierTest, AtomicRMWIntVector) {
   raw_string_ostream ErrorOS(Error);
   EXPECT_TRUE(verifyFunction(*F, &ErrorOS));
   EXPECT_TRUE(
-      StringRef(Error).starts_with("atomicrmw add operand must have integer or "
-                                   "fixed vector of integer type!"))
+      StringRef(Error).starts_with("atomicrmw operand may not be scalable"))
+      << Error;
+}
+
+TEST(VerifierTest, AtomicRMWXchgVector) {
+  LLVMContext C;
+  Module M("M", C);
+  FunctionType *FTy = FunctionType::get(Type::getVoidTy(C), /*isVarArg=*/false);
+  Function *F = Function::Create(FTy, Function::ExternalLinkage, "foo", M);
+  BasicBlock *Entry = BasicBlock::Create(C, "entry", F);
+  Value *Ptr = PoisonValue::get(PointerType::get(C, 0));
+
+  Type *FPTy = Type::getHalfTy(C);
+  Constant *CF = ConstantFP::getZero(FPTy);
+
+  // Invalid scalable type : atomicrmw xchg (<vscale x 2 x half>)
----------------
antoniofrighetto wrote:

Nit:
```suggestion
  // Invalid scalable type: atomicrmw xchg (<vscale x 2 x half>).
```

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


More information about the llvm-commits mailing list