Skip to content

Commit deed1b0

Browse files
committed
[SystemZ] Fix address parsing in HLASM mode
When parsing an address that contains only a single register for an instruction that actually has both a base and an index register, the parsed register is treated as base by AsmParser. This is correct when emulating the GNU assembler, but not when emulating HLASM, as the latter treat the register as index in this case.
1 parent 0c6457b commit deed1b0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,9 +1148,10 @@ ParseStatus SystemZAsmParser::parseAddress(OperandVector &Operands,
11481148
if (HaveReg1) {
11491149
if (parseAddressRegister(Reg1))
11501150
return ParseStatus::Failure;
1151-
// If the are two registers, the first one is the index and the
1152-
// second is the base.
1153-
if (HaveReg2)
1151+
// If there are two registers, the first one is the index and the
1152+
// second is the base. If there is only a single register, it is
1153+
// used as base with GAS and as index with HLASM.
1154+
if (HaveReg2 || isParsingHLASM())
11541155
Index = Reg1.Num == 0 ? 0 : Regs[Reg1.Num];
11551156
else
11561157
Base = Reg1.Num == 0 ? 0 : Regs[Reg1.Num];

0 commit comments

Comments
 (0)