Skip to content

Commit 2c5656a

Browse files
authored
Merge pull request #13 from cr1901/rustc/8.0-2019-03-18
Fix AsmPrinter and GNU assembler syntax mismatch in the msp430 backend
2 parents e792248 + baac63d commit 2c5656a

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

llvm/lib/Target/MSP430/MSP430AsmPrinter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ void MSP430AsmPrinter::printSrcMemOperand(const MachineInstr *MI, int OpNum,
114114
// Print displacement first
115115

116116
// Imm here is in fact global address - print extra modifier.
117-
if (Disp.isImm() && !Base.getReg())
117+
if (Disp.isImm() && Base.getReg() == MSP430::SR)
118118
O << '&';
119119
printOperand(MI, OpNum+1, O, "nohash");
120120

121121
// Print register base field
122-
if (Base.getReg()) {
122+
if (Base.getReg() != MSP430::SR && Base.getReg() != MSP430::PC) {
123123
O << '(';
124124
printOperand(MI, OpNum, O);
125125
O << ')';
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; RUN: llc < %s | FileCheck %s
2+
3+
; Check that absolute addressing mode is represented in a way
4+
; defined in MSP430 EABI and not as indexed addressing mode form.
5+
; See PR39993 for details.
6+
7+
target datalayout = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8-n8:16"
8+
target triple = "msp430-elf"
9+
10+
define void @f() {
11+
entry:
12+
; CHECK: mov r1, &256
13+
call void asm sideeffect "mov r1, $0", "*m"(i8* inttoptr (i16 256 to i8*))
14+
ret void
15+
}

0 commit comments

Comments
 (0)