[llvm] [AArch64] Reserve `W30_HI` and `[BHSDQ]31_HI` (PR #202929)

Nathan Corbyn via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 15 03:06:23 PDT 2026


================
@@ -149,4 +153,36 @@ TEST(AArch64LaneBitmasks, SubRegs) {
             AArch64::W1);
 }
 
+TEST(AArch64ReservedRegs, ArtificialHIRegistersAreReserved) {
+  std::unique_ptr<TargetMachine> TM = createTargetMachine("");
+  ASSERT_TRUE(TM);
+
+  std::unique_ptr<AArch64InstrInfo> II = createInstrInfo(TM.get());
+  ASSERT_TRUE(II);
+
+  const AArch64RegisterInfo &TRI = II->getRegisterInfo();
+
+  // Create an empty machine function
+  LLVMContext Context;
+  Module M("", Context);
+  M.setDataLayout(TM->createDataLayout());
+  Function *F = Function::Create(
+      FunctionType::get(Type::getVoidTy(Context), /*isVarArg=*/false),
+      GlobalValue::ExternalLinkage, "f", &M);
+
+  MachineModuleInfo MMI(TM.get());
+  const TargetSubtargetInfo *STI = TM->getSubtargetImpl(*F);
+  MachineFunction MF(*F, *TM, *STI, MMI.getContext(), /*FunctionNum=*/0);
+  MF.initTargetMachineFunctionInfo(*STI);
+
+  BitVector Reserved = TRI.getReservedRegs(MF);
+
+  EXPECT_TRUE(Reserved.test(AArch64::W30_HI));
----------------
cofibrant wrote:

Sounds good!

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


More information about the llvm-commits mailing list