forked from OSchip/llvm-project
AMDGPU/SI: Don't use fixup_si_rodata for scratch rsrc relocations
Summary: We need to set the fixup type to FK_Data_4 for the SCRATCH_RSRC_DWORD[01] symbols, since these require absolute relocations, and fixup_si_rodata is for relative relocations. Reviewers: arsenm, kzhuravl Subscribers: arsenm, kzhuravl, llvm-commits Differential Revision: http://reviews.llvm.org/D21153 llvm-svn: 272417
This commit is contained in:
parent
cbd68ecf04
commit
f3af841462
|
@ -75,6 +75,7 @@ void AMDGPUMCInstLower::lower(const MachineInstr *MI, MCInst &OutMI) const {
|
||||||
}
|
}
|
||||||
case MachineOperand::MO_ExternalSymbol: {
|
case MachineOperand::MO_ExternalSymbol: {
|
||||||
MCSymbol *Sym = Ctx.getOrCreateSymbol(StringRef(MO.getSymbolName()));
|
MCSymbol *Sym = Ctx.getOrCreateSymbol(StringRef(MO.getSymbolName()));
|
||||||
|
Sym->setExternal(true);
|
||||||
const MCSymbolRefExpr *Expr = MCSymbolRefExpr::create(Sym, Ctx);
|
const MCSymbolRefExpr *Expr = MCSymbolRefExpr::create(Sym, Ctx);
|
||||||
MCOp = MCOperand::createExpr(Expr);
|
MCOp = MCOperand::createExpr(Expr);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -249,7 +249,12 @@ uint64_t SIMCCodeEmitter::getMachineOpValue(const MCInst &MI,
|
||||||
|
|
||||||
if (MO.isExpr()) {
|
if (MO.isExpr()) {
|
||||||
const MCSymbolRefExpr *Expr = cast<MCSymbolRefExpr>(MO.getExpr());
|
const MCSymbolRefExpr *Expr = cast<MCSymbolRefExpr>(MO.getExpr());
|
||||||
MCFixupKind Kind = (MCFixupKind)AMDGPU::fixup_si_rodata;
|
const MCSymbol &Sym = Expr->getSymbol();
|
||||||
|
MCFixupKind Kind;
|
||||||
|
if (Sym.isExternal())
|
||||||
|
Kind = FK_Data_4;
|
||||||
|
else
|
||||||
|
Kind = (MCFixupKind)AMDGPU::fixup_si_rodata;
|
||||||
Fixups.push_back(MCFixup::create(4, Expr, Kind, MI.getLoc()));
|
Fixups.push_back(MCFixup::create(4, Expr, Kind, MI.getLoc()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
; RUN: llc -march=amdgcn -mcpu=bonaire < %s | FileCheck -check-prefix=GCN -check-prefix=CI -check-prefix=ALL %s
|
; RUN: llc -march=amdgcn -mcpu=bonaire -show-mc-encoding < %s | FileCheck -check-prefix=GCN -check-prefix=CI -check-prefix=ALL %s
|
||||||
; RUN: llc -march=amdgcn -mcpu=carrizo < %s | FileCheck -check-prefix=GCN -check-prefix=VI -check-prefix=ALL %s
|
; RUN: llc -march=amdgcn -mcpu=carrizo --show-mc-encoding < %s | FileCheck -check-prefix=GCN -check-prefix=VI -check-prefix=ALL %s
|
||||||
; RUN: llc -march=amdgcn -mcpu=bonaire -mtriple=amdgcn-unknown-amdhsa < %s -mattr=-flat-for-global | FileCheck -check-prefix=GCNHSA -check-prefix=CIHSA -check-prefix=ALL %s
|
; RUN: llc -march=amdgcn -mcpu=bonaire -mtriple=amdgcn-unknown-amdhsa < %s -mattr=-flat-for-global | FileCheck -check-prefix=GCNHSA -check-prefix=CIHSA -check-prefix=ALL %s
|
||||||
; RUN: llc -march=amdgcn -mcpu=carrizo -mtriple=amdgcn-unknown-amdhsa -mattr=-flat-for-global < %s | FileCheck -check-prefix=GCNHSA -check-prefix=VIHSA -check-prefix=ALL %s
|
; RUN: llc -march=amdgcn -mcpu=carrizo -mtriple=amdgcn-unknown-amdhsa -mattr=-flat-for-global < %s | FileCheck -check-prefix=GCNHSA -check-prefix=VIHSA -check-prefix=ALL %s
|
||||||
|
|
||||||
|
@ -8,7 +8,9 @@
|
||||||
; ALL-LABEL: {{^}}large_alloca_compute_shader:
|
; ALL-LABEL: {{^}}large_alloca_compute_shader:
|
||||||
|
|
||||||
; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD0
|
; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD0
|
||||||
|
; GCN-DAG: ; fixup A - offset: 4, value: SCRATCH_RSRC_DWORD0, kind: FK_Data_4
|
||||||
; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD1
|
; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD1
|
||||||
|
; GCN-DAG: ; fixup A - offset: 4, value: SCRATCH_RSRC_DWORD1, kind: FK_Data_4
|
||||||
; GCN-DAG: s_mov_b32 s{{[0-9]+}}, -1
|
; GCN-DAG: s_mov_b32 s{{[0-9]+}}, -1
|
||||||
; CI-DAG: s_mov_b32 s{{[0-9]+}}, 0x88f000
|
; CI-DAG: s_mov_b32 s{{[0-9]+}}, 0x88f000
|
||||||
; VI-DAG: s_mov_b32 s{{[0-9]+}}, 0x880000
|
; VI-DAG: s_mov_b32 s{{[0-9]+}}, 0x880000
|
||||||
|
|
Loading…
Reference in New Issue