Skip to content

Commit 69df300

Browse files
author
git apple-llvm automerger
committed
Merge commit '22139b36d7a8' from llvm.org/release/19.x into stable/20240723
2 parents ad2c8de + 22139b3 commit 69df300

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2707,7 +2707,8 @@ bool X86AsmParser::parseIntelOperand(OperandVector &Operands, StringRef Name) {
27072707
bool MaybeDirectBranchDest = true;
27082708

27092709
if (Parser.isParsingMasm()) {
2710-
if (is64BitMode() && SM.getElementSize() > 0) {
2710+
if (is64BitMode() &&
2711+
((PtrInOperand && !IndexReg) || SM.getElementSize() > 0)) {
27112712
DefaultBaseReg = X86::RIP;
27122713
}
27132714
if (IsUnconditionalBranch) {

llvm/test/tools/llvm-ml/rip_relative_addressing.asm

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,14 @@ mov eax, [t8]
5353
; CHECK-LABEL: t8:
5454
; CHECK: mov eax, dword ptr [t8]
5555

56-
END
56+
t9:
57+
mov eax, dword ptr [bar]
58+
; CHECK-LABEL: t9:
59+
; CHECK-32: mov eax, dword ptr [bar]
60+
; CHECK-64: mov eax, dword ptr [rip + bar]
61+
62+
t10:
63+
mov ebx, dword ptr [4*eax]
64+
; CHECK: mov ebx, dword ptr [4*eax]
65+
66+
END

0 commit comments

Comments
 (0)