Index: llvm/lib/Target/M68k/M68kISelDAGToDAG.cpp =================================================================== --- llvm/lib/Target/M68k/M68kISelDAGToDAG.cpp +++ llvm/lib/Target/M68k/M68kISelDAGToDAG.cpp @@ -500,6 +500,13 @@ return true; } break; + + case ISD::TargetGlobalTLSAddress: { + GlobalAddressSDNode *GA = cast(N); + AM.GV = GA->getGlobal(); + AM.SymbolFlags = GA->getTargetFlags(); + return true; + } } return matchAddressBase(N, AM); @@ -724,6 +731,8 @@ return false; } + Base = AM.BaseReg; + if (getSymbolicDisplacement(AM, SDLoc(N), Disp)) { assert(!AM.Disp && "Should not be any displacement"); LLVM_DEBUG(dbgs() << "SUCCESS, matched Symbol\n"); @@ -736,7 +745,6 @@ return false; } - Base = AM.BaseReg; Disp = getI16Imm(AM.Disp, SDLoc(N)); LLVM_DEBUG(dbgs() << "SUCCESS\n"); Index: llvm/test/CodeGen/M68k/TLS/tlsgd.ll =================================================================== --- llvm/test/CodeGen/M68k/TLS/tlsgd.ll +++ llvm/test/CodeGen/M68k/TLS/tlsgd.ll @@ -8,7 +8,7 @@ ; CHECK: ; %bb.0: ; %entry ; CHECK-NEXT: suba.l #4, %sp ; CHECK-NEXT: lea (_GLOBAL_OFFSET_TABLE_@GOTPCREL,%pc), %a0 -; CHECK-NEXT: adda.l myvar@TLSGD, %a0 +; CHECK-NEXT: lea (myvar@TLSGD,%a0), %a0 ; CHECK-NEXT: move.l %a0, (%sp) ; CHECK-NEXT: jsr (__tls_get_addr@PLT,%pc) ; CHECK-NEXT: adda.l #4, %sp Index: llvm/test/CodeGen/M68k/TLS/tlsie.ll =================================================================== --- llvm/test/CodeGen/M68k/TLS/tlsie.ll +++ llvm/test/CodeGen/M68k/TLS/tlsie.ll @@ -10,7 +10,7 @@ ; CHECK-NEXT: jsr __m68k_read_tp@PLT ; CHECK-NEXT: move.l %a0, %d0 ; CHECK-NEXT: lea (_GLOBAL_OFFSET_TABLE_@GOTPCREL,%pc), %a0 -; CHECK-NEXT: add.l (0,myvar@GOTTPOFF,%a0), %d0 +; CHECK-NEXT: add.l (myvar@GOTTPOFF,%a0), %d0 ; CHECK-NEXT: move.l %d0, %a0 ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts Index: llvm/test/CodeGen/M68k/TLS/tlsld.ll =================================================================== --- llvm/test/CodeGen/M68k/TLS/tlsld.ll +++ llvm/test/CodeGen/M68k/TLS/tlsld.ll @@ -8,10 +8,10 @@ ; CHECK: ; %bb.0: ; %entry ; CHECK-NEXT: suba.l #4, %sp ; CHECK-NEXT: lea (_GLOBAL_OFFSET_TABLE_@GOTPCREL,%pc), %a0 -; CHECK-NEXT: adda.l myvar@TLSLDM, %a0 +; CHECK-NEXT: lea (myvar@TLSLDM,%a0), %a0 ; CHECK-NEXT: move.l %a0, (%sp) ; CHECK-NEXT: jsr (__tls_get_addr@PLT,%pc) -; CHECK-NEXT: adda.l myvar@TLSLD, %a0 +; CHECK-NEXT: lea (myvar@TLSLD,%a0), %a0 ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts entry: Index: llvm/test/CodeGen/M68k/TLS/tlsle.ll =================================================================== --- llvm/test/CodeGen/M68k/TLS/tlsle.ll +++ llvm/test/CodeGen/M68k/TLS/tlsle.ll @@ -8,7 +8,7 @@ ; CHECK: ; %bb.0: ; %entry ; CHECK-NEXT: suba.l #4, %sp ; CHECK-NEXT: jsr __m68k_read_tp@PLT -; CHECK-NEXT: adda.l myvar@TPOFF, %a0 +; CHECK-NEXT: lea (myvar@TPOFF,%a0), %a0 ; CHECK-NEXT: adda.l #4, %sp ; CHECK-NEXT: rts entry: