From 66eb4d17bba8e55395434deb192592b1a5edbdff Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 5 May 2016 17:03:33 +0000 Subject: [PATCH] AMDGPU/SI: Add support for AMD code object version 2. Summary: Version 2 is now the default. If you want to emit version 1, use the amdgcn--amdhsa-amdcov1 triple. Reviewers: arsenm, kzhuravl Subscribers: arsenm, llvm-commits Differential Revision: http://reviews.llvm.org/D19283 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268647 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp | 50 +---- lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 3 - lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp | 56 ----- lib/Target/AMDGPU/AMDGPUTargetObjectFile.h | 18 -- .../AMDGPU/AsmParser/AMDGPUAsmParser.cpp | 2 +- .../AMDGPU/MCTargetDesc/AMDGPUELFStreamer.cpp | 5 - .../AMDGPU/MCTargetDesc/AMDGPUELFStreamer.h | 1 - .../MCTargetDesc/AMDGPUTargetStreamer.cpp | 4 - test/CodeGen/AMDGPU/global-constant.ll | 2 +- test/CodeGen/AMDGPU/hsa-globals.ll | 192 ++---------------- test/CodeGen/AMDGPU/hsa-note-no-func.ll | 2 +- test/CodeGen/AMDGPU/hsa.ll | 13 +- test/MC/AMDGPU/hsa-text.s | 16 +- test/MC/AMDGPU/hsa.s | 21 +- test/Object/AMDGPU/objdump.s | 2 +- 15 files changed, 47 insertions(+), 340 deletions(-) diff --git a/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp index 7b27e16081b..73803441f48 100644 --- a/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp +++ b/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp @@ -104,7 +104,8 @@ void AMDGPUAsmPrinter::EmitStartOfAsmFile(Module &M) { AMDGPUTargetStreamer *TS = static_cast(OutStreamer->getTargetStreamer()); - TS->EmitDirectiveHSACodeObjectVersion(1, 0); + TS->EmitDirectiveHSACodeObjectVersion(2, 0); + AMDGPU::IsaVersion ISA = AMDGPU::getIsaVersion(STI->getFeatureBits()); TS->EmitDirectiveHSACodeObjectISA(ISA.Major, ISA.Minor, ISA.Stepping, "AMD", "AMDGPU"); @@ -132,56 +133,13 @@ void AMDGPUAsmPrinter::EmitFunctionEntryLabel() { AsmPrinter::EmitFunctionEntryLabel(); } -static bool isModuleLinkage(const GlobalValue *GV) { - switch (GV->getLinkage()) { - case GlobalValue::LinkOnceODRLinkage: - case GlobalValue::LinkOnceAnyLinkage: - case GlobalValue::InternalLinkage: - case GlobalValue::CommonLinkage: - return true; - case GlobalValue::ExternalLinkage: - return false; - default: llvm_unreachable("unknown linkage type"); - } -} - void AMDGPUAsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) { - if (TM.getTargetTriple().getOS() != Triple::AMDHSA) { - AsmPrinter::EmitGlobalVariable(GV); - return; - } - - if (GV->isDeclaration() || GV->getLinkage() == GlobalValue::PrivateLinkage) { - AsmPrinter::EmitGlobalVariable(GV); - return; - } - // Group segment variables aren't emitted in HSA. if (AMDGPU::isGroupSegment(GV)) return; - AMDGPUTargetStreamer *TS = - static_cast(OutStreamer->getTargetStreamer()); - if (isModuleLinkage(GV)) { - TS->EmitAMDGPUHsaModuleScopeGlobal(GV->getName()); - } else { - TS->EmitAMDGPUHsaProgramScopeGlobal(GV->getName()); - } - - MCSymbolELF *GVSym = cast(getSymbol(GV)); - const DataLayout &DL = getDataLayout(); - - // Emit the size - uint64_t Size = DL.getTypeAllocSize(GV->getType()->getElementType()); - OutStreamer->emitELFSize(GVSym, MCConstantExpr::create(Size, OutContext)); - OutStreamer->PushSection(); - OutStreamer->SwitchSection( - getObjFileLowering().SectionForGlobal(GV, *Mang, TM)); - const Constant *C = GV->getInitializer(); - OutStreamer->EmitLabel(GVSym); - EmitGlobalConstant(DL, C); - OutStreamer->PopSection(); + AsmPrinter::EmitGlobalVariable(GV); } bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) { @@ -717,6 +675,8 @@ void AMDGPUAsmPrinter::EmitAmdKernelCodeT(const MachineFunction &MF, AMDGPUTargetStreamer *TS = static_cast(OutStreamer->getTargetStreamer()); + + OutStreamer->SwitchSection(getObjFileLowering().getTextSection()); TS->EmitAMDKernelCodeT(header); } diff --git a/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp index 342afffea6d..a1c97300920 100644 --- a/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp +++ b/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp @@ -61,9 +61,6 @@ extern "C" void LLVMInitializeAMDGPUTarget() { } static std::unique_ptr createTLOF(const Triple &TT) { - if (TT.getOS() == Triple::AMDHSA) - return make_unique(); - return make_unique(); } diff --git a/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp b/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp index e050f21091b..03d1e2c764d 100644 --- a/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp +++ b/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp @@ -29,59 +29,3 @@ MCSection *AMDGPUTargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV, return TargetLoweringObjectFileELF::SelectSectionForGlobal(GV, Kind, Mang, TM); } - -//===----------------------------------------------------------------------===// -// HSA Object File -//===----------------------------------------------------------------------===// - - -void AMDGPUHSATargetObjectFile::Initialize(MCContext &Ctx, - const TargetMachine &TM){ - TargetLoweringObjectFileELF::Initialize(Ctx, TM); - InitializeELF(TM.Options.UseInitArray); - - TextSection = AMDGPU::getHSATextSection(Ctx); - - DataGlobalAgentSection = AMDGPU::getHSADataGlobalAgentSection(Ctx); - DataGlobalProgramSection = AMDGPU::getHSADataGlobalProgramSection(Ctx); - - RodataReadonlyAgentSection = AMDGPU::getHSARodataReadonlyAgentSection(Ctx); -} - -bool AMDGPUHSATargetObjectFile::isAgentAllocationSection( - const char *SectionName) const { - return cast(DataGlobalAgentSection) - ->getSectionName() - .equals(SectionName); -} - -bool AMDGPUHSATargetObjectFile::isAgentAllocation(const GlobalValue *GV) const { - // Read-only segments can only have agent allocation. - return AMDGPU::isReadOnlySegment(GV) || - (AMDGPU::isGlobalSegment(GV) && GV->hasSection() && - isAgentAllocationSection(GV->getSection())); -} - -bool AMDGPUHSATargetObjectFile::isProgramAllocation( - const GlobalValue *GV) const { - // The default for global segments is program allocation. - return AMDGPU::isGlobalSegment(GV) && !isAgentAllocation(GV); -} - -MCSection *AMDGPUHSATargetObjectFile::SelectSectionForGlobal( - const GlobalValue *GV, SectionKind Kind, - Mangler &Mang, - const TargetMachine &TM) const { - if (Kind.isText() && !GV->hasComdat()) - return getTextSection(); - - if (AMDGPU::isGlobalSegment(GV)) { - if (isAgentAllocation(GV)) - return DataGlobalAgentSection; - - if (isProgramAllocation(GV)) - return DataGlobalProgramSection; - } - - return AMDGPUTargetObjectFile::SelectSectionForGlobal(GV, Kind, Mang, TM); -} diff --git a/lib/Target/AMDGPU/AMDGPUTargetObjectFile.h b/lib/Target/AMDGPU/AMDGPUTargetObjectFile.h index 921341ebb89..f530e0952a7 100644 --- a/lib/Target/AMDGPU/AMDGPUTargetObjectFile.h +++ b/lib/Target/AMDGPU/AMDGPUTargetObjectFile.h @@ -28,24 +28,6 @@ class AMDGPUTargetObjectFile : public TargetLoweringObjectFileELF { const TargetMachine &TM) const override; }; -class AMDGPUHSATargetObjectFile final : public AMDGPUTargetObjectFile { -private: - MCSection *DataGlobalAgentSection; - MCSection *DataGlobalProgramSection; - MCSection *RodataReadonlyAgentSection; - - bool isAgentAllocationSection(const char *SectionName) const; - bool isAgentAllocation(const GlobalValue *GV) const; - bool isProgramAllocation(const GlobalValue *GV) const; - -public: - void Initialize(MCContext &Ctx, const TargetMachine &TM) override; - - MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler &Mang, - const TargetMachine &TM) const override; -}; - } // end namespace llvm #endif diff --git a/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp index f67a0937cf9..ac24c056019 100644 --- a/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp +++ b/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp @@ -1083,7 +1083,7 @@ bool AMDGPUAsmParser::ParseDirective(AsmToken DirectiveID) { if (IDVal == ".amd_kernel_code_t") return ParseDirectiveAMDKernelCodeT(); - if (IDVal == ".hsatext" || IDVal == ".text") + if (IDVal == ".hsatext") return ParseSectionDirectiveHSAText(); if (IDVal == ".amdgpu_hsa_kernel") diff --git a/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFStreamer.cpp b/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFStreamer.cpp index 9ff9fe794d2..43338a5bebd 100644 --- a/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFStreamer.cpp +++ b/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFStreamer.cpp @@ -12,11 +12,6 @@ using namespace llvm; -void AMDGPUELFStreamer::InitSections(bool NoExecStack) { - // Start with the .hsatext section by default. - SwitchSection(AMDGPU::getHSATextSection(getContext())); -} - MCELFStreamer *llvm::createAMDGPUELFStreamer(MCContext &Context, MCAsmBackend &MAB, raw_pwrite_stream &OS, diff --git a/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFStreamer.h b/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFStreamer.h index df288abe7d6..5319b65d65f 100644 --- a/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFStreamer.h +++ b/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFStreamer.h @@ -29,7 +29,6 @@ public: MCCodeEmitter *Emitter) : MCELFStreamer(Context, MAB, OS, Emitter) { } - virtual void InitSections(bool NoExecStac) override; }; MCELFStreamer *createAMDGPUELFStreamer(MCContext &Context, MCAsmBackend &MAB, diff --git a/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp b/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp index b91134d2ee9..83dcaacb738 100644 --- a/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp +++ b/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp @@ -312,10 +312,6 @@ AMDGPUTargetELFStreamer::EmitAMDKernelCodeT(const amd_kernel_code_t &Header) { MCStreamer &OS = getStreamer(); OS.PushSection(); - // The MCObjectFileInfo that is available to the assembler is a generic - // implementation and not AMDGPUHSATargetObjectFile, so we can't use - // MCObjectFileInfo::getTextSection() here for fetching the HSATextSection. - OS.SwitchSection(AMDGPU::getHSATextSection(OS.getContext())); OS.EmitBytes(StringRef((const char*)&Header, sizeof(Header))); OS.PopSection(); } diff --git a/test/CodeGen/AMDGPU/global-constant.ll b/test/CodeGen/AMDGPU/global-constant.ll index bc5f031cd4a..0f2fc836a24 100644 --- a/test/CodeGen/AMDGPU/global-constant.ll +++ b/test/CodeGen/AMDGPU/global-constant.ll @@ -12,7 +12,7 @@ ; GCN-NEXT: s_add_u32 s{{[0-9]+}}, s[[PC1_LO]], readonly ; GCN: s_addc_u32 s{{[0-9]+}}, s[[PC1_HI]], 0 ; NOHSA: .text -; HSA: .hsatext +; HSA: .text ; GCN: readonly: ; GCN: readonly2: define void @main(i32 %index, float addrspace(1)* %out) { diff --git a/test/CodeGen/AMDGPU/hsa-globals.ll b/test/CodeGen/AMDGPU/hsa-globals.ll index a19a33492a7..df478fbcf3b 100644 --- a/test/CodeGen/AMDGPU/hsa-globals.ll +++ b/test/CodeGen/AMDGPU/hsa-globals.ll @@ -1,5 +1,4 @@ ; RUN: llc < %s -mtriple=amdgcn--amdhsa -mcpu=kaveri | FileCheck --check-prefix=ASM %s -; RUN: llc < %s -mtriple=amdgcn--amdhsa -mcpu=kaveri | llvm-mc -filetype=obj -triple amdgcn--amdhsa -mcpu=kaveri | llvm-readobj -symbols -s | FileCheck %s --check-prefix=ELF @linkonce_odr_global_program = linkonce_odr addrspace(1) global i32 0 @linkonce_global_program = linkonce addrspace(1) global i32 0 @@ -7,12 +6,6 @@ @common_global_program = common addrspace(1) global i32 0 @external_global_program = addrspace(1) global i32 0 -@linkonce_odr_global_agent = linkonce_odr addrspace(1) global i32 0, section ".hsadata_global_agent" -@linkonce_global_agent = linkonce addrspace(1) global i32 0, section ".hsadata_global_agent" -@internal_global_agent = internal addrspace(1) global i32 0, section ".hsadata_global_agent" -@common_global_agent = common addrspace(1) global i32 0, section ".hsadata_global_agent" -@external_global_agent = addrspace(1) global i32 0, section ".hsadata_global_agent" - @internal_readonly = internal unnamed_addr addrspace(2) constant i32 0 @external_readonly = unnamed_addr addrspace(2) constant i32 0 @@ -20,185 +13,38 @@ define void @test() { ret void } -; ASM: .amdgpu_hsa_module_global linkonce_odr_global -; ASM: .size linkonce_odr_global_program, 4 -; ASM: .hsadata_global_program +; ASM: .type linkonce_odr_global_program,@object +; ASM: .section .bss,#alloc,#write +; ASM: .weak linkonce_odr_global_program ; ASM: linkonce_odr_global_program: ; ASM: .long 0 +; ASM: .size linkonce_odr_global_program, 4 -; ASM: .amdgpu_hsa_module_global linkonce_global -; ASM: .size linkonce_global_program, 4 -; ASM: .hsadata_global_program +; ASM: .type linkonce_global_program,@object +; ASM: .weak linkonce_global_program ; ASM: linkonce_global_program: ; ASM: .long 0 +; ASM: .size linkonce_global_program, 4 -; ASM: .amdgpu_hsa_module_global internal_global -; ASM: .size internal_global_program, 4 -; ASM: .hsadata_global_program -; ASM: internal_global_program: -; ASM: .long 0 +; ASM: .type internal_global_program,@object +; ASM: .local internal_global_program +; ASM: .comm internal_global_program,4,2 -; ASM: .amdgpu_hsa_module_global common_global -; ASM: .size common_global_program, 4 -; ASM: .hsadata_global_program -; ASM: common_global_program: -; ASM: .long 0 +; ASM: .type common_global_program,@object +; ASM: .comm common_global_program,4,2 -; ASM: .amdgpu_hsa_program_global external_global -; ASM: .size external_global_program, 4 -; ASM: .hsadata_global_program ; ASM: external_global_program: ; ASM: .long 0 +; ASM: .size external_global_program, 4 -; ASM: .amdgpu_hsa_module_global linkonce_odr_global -; ASM: .size linkonce_odr_global_agent, 4 -; ASM: .hsadata_global_agent -; ASM: linkonce_odr_global_agent: -; ASM: .long 0 - -; ASM: .amdgpu_hsa_module_global linkonce_global -; ASM: .size linkonce_global_agent, 4 -; ASM: .hsadata_global_agent -; ASM: linkonce_global_agent: -; ASM: .long 0 - -; ASM: .amdgpu_hsa_module_global internal_global -; ASM: .size internal_global_agent, 4 -; ASM: .hsadata_global_agent -; ASM: internal_global_agent: -; ASM: .long 0 - -; ASM: .amdgpu_hsa_module_global common_global -; ASM: .size common_global_agent, 4 -; ASM: .hsadata_global_agent -; ASM: common_global_agent: -; ASM: .long 0 - -; ASM: .amdgpu_hsa_program_global external_global -; ASM: .size external_global_agent, 4 -; ASM: .hsadata_global_agent -; ASM: external_global_agent: -; ASM: .long 0 - -; ASM: .amdgpu_hsa_module_global internal_readonly -; ASM: .size internal_readonly, 4 -; ASM: .hsatext +; ASM: .type internal_readonly,@object +; ASM: .text ; ASM: internal_readonly: ; ASM: .long 0 +; ASM: .size internal_readonly, 4 -; ASM: .amdgpu_hsa_program_global external_readonly -; ASM: .size external_readonly, 4 -; ASM: .hsatext +; ASM: .type external_readonly,@object +; ASM: .globl external_readonly ; ASM: external_readonly: ; ASM: .long 0 - -; ELF: Section { -; ELF: Name: .hsadata_global_program -; ELF: Type: SHT_PROGBITS (0x1) -; ELF: Flags [ (0x100003) -; ELF: SHF_ALLOC (0x2) -; ELF: SHF_AMDGPU_HSA_GLOBAL (0x100000) -; ELF: SHF_WRITE (0x1) -; ELF: ] -; ELF: } - -; ELF: Section { -; ELF: Name: .hsadata_global_agent -; ELF: Type: SHT_PROGBITS (0x1) -; ELF: Flags [ (0x900003) -; ELF: SHF_ALLOC (0x2) -; ELF: SHF_AMDGPU_HSA_AGENT (0x800000) -; ELF: SHF_AMDGPU_HSA_GLOBAL (0x100000) -; ELF: SHF_WRITE (0x1) -; ELF: ] -; ELF: } - -; ELF: Symbol { -; ELF: Name: common_global_agent -; ELF: Size: 4 -; ELF: Binding: Local -; ELF: Section: .hsadata_global_agent -; ELF: } - -; ELF: Symbol { -; ELF: Name: common_global_program -; ELF: Size: 4 -; ELF: Binding: Local -; ELF: Section: .hsadata_global_program -; ELF: } - -; ELF: Symbol { -; ELF: Name: internal_global_agent -; ELF: Size: 4 -; ELF: Binding: Local -; ELF: Type: Object -; ELF: Section: .hsadata_global_agent -; ELF: } - -; ELF: Symbol { -; ELF: Name: internal_global_program -; ELF: Size: 4 -; ELF: Binding: Local -; ELF: Type: Object -; ELF: Section: .hsadata_global_program -; ELF: } - -; ELF: Symbol { -; ELF: Name: internal_readonly -; ELF: Size: 4 -; ELF: Binding: Local -; ELF: Type: Object -; ELF: Section: .hsatext -; ELF: } - -; ELF: Symbol { -; ELF: Name: linkonce_global_agent -; ELF: Size: 4 -; ELF: Binding: Local -; ELF: Section: .hsadata_global_agent -; ELF: } - -; ELF: Symbol { -; ELF: Name: linkonce_global_program -; ELF: Size: 4 -; ELF: Binding: Local -; ELF: Section: .hsadata_global_program -; ELF: } - -; ELF: Symbol { -; ELF: Name: linkonce_odr_global_agent -; ELF: Size: 4 -; ELF: Binding: Local -; ELF: Section: .hsadata_global_agent -; ELF: } - -; ELF: Symbol { -; ELF: Name: linkonce_odr_global_program -; ELF: Size: 4 -; ELF: Binding: Local -; ELF: Section: .hsadata_global_program -; ELF: } - -; ELF: Symbol { -; ELF: Name: external_global_agent -; ELF: Size: 4 -; ELF: Binding: Global -; ELF: Type: Object -; ELF: Section: .hsadata_global_agent -; ELF: } - -; ELF: Symbol { -; ELF: Name: external_global_program -; ELF: Size: 4 -; ELF: Binding: Global -; ELF: Type: Object -; ELF: Section: .hsadata_global_program -; ELF: } - -; ELF: Symbol { -; ELF: Name: external_readonly -; ELF: Size: 4 -; ELF: Binding: Global -; ELF: Type: Object -; ELF: Section: .hsatext -; ELF: } +; ASM: .size external_readonly, 4 diff --git a/test/CodeGen/AMDGPU/hsa-note-no-func.ll b/test/CodeGen/AMDGPU/hsa-note-no-func.ll index f82e98e7954..67d82e2731e 100644 --- a/test/CodeGen/AMDGPU/hsa-note-no-func.ll +++ b/test/CodeGen/AMDGPU/hsa-note-no-func.ll @@ -2,7 +2,7 @@ ; RUN: llc < %s -mtriple=amdgcn--amdhsa -mcpu=carrizo | FileCheck --check-prefix=HSA --check-prefix=HSA-VI %s ; RUN: llc < %s -mtriple=amdgcn--amdhsa -mcpu=fiji | FileCheck --check-prefix=HSA --check-prefix=HSA-FIJI %s -; HSA: .hsa_code_object_version 1,0 +; HSA: .hsa_code_object_version 2,0 ; HSA-CI: .hsa_code_object_isa 7,0,0,"AMD","AMDGPU" ; HSA-VI: .hsa_code_object_isa 8,0,1,"AMD","AMDGPU" ; HSA-FIJI: .hsa_code_object_isa 8,0,3,"AMD","AMDGPU" diff --git a/test/CodeGen/AMDGPU/hsa.ll b/test/CodeGen/AMDGPU/hsa.ll index 073c1858244..9017b6253d2 100644 --- a/test/CodeGen/AMDGPU/hsa.ll +++ b/test/CodeGen/AMDGPU/hsa.ll @@ -9,19 +9,16 @@ ; directives. ; ELF: Section { -; ELF: Name: .hsatext +; ELF: Name: .text ; ELF: Type: SHT_PROGBITS (0x1) -; ELF: Flags [ (0xC00007) +; ELF: Flags [ (0x6) ; ELF: SHF_ALLOC (0x2) -; ELF: SHF_AMDGPU_HSA_AGENT (0x800000) -; ELF: SHF_AMDGPU_HSA_CODE (0x400000) ; ELF: SHF_EXECINSTR (0x4) -; ELF: SHF_WRITE (0x1) ; ELF: } ; ELF: SHT_NOTE ; ELF: 0000: 04000000 08000000 01000000 414D4400 -; ELF: 0010: 01000000 00000000 04000000 1B000000 +; ELF: 0010: 02000000 00000000 04000000 1B000000 ; ELF: 0020: 03000000 414D4400 04000700 07000000 ; ELF: 0030: 00000000 00000000 414D4400 414D4447 ; ELF: 0040: 50550000 @@ -32,11 +29,11 @@ ; ELF: Type: AMDGPU_HSA_KERNEL (0xA) ; ELF: } -; HSA: .hsa_code_object_version 1,0 +; HSA: .hsa_code_object_version 2,0 ; HSA-CI: .hsa_code_object_isa 7,0,0,"AMD","AMDGPU" ; HSA-VI: .hsa_code_object_isa 8,0,1,"AMD","AMDGPU" -; HSA: .hsatext +; HSA: .text ; HSA: .amdgpu_hsa_kernel simple ; HSA: {{^}}simple: diff --git a/test/MC/AMDGPU/hsa-text.s b/test/MC/AMDGPU/hsa-text.s index 1d2f1f1619e..afe696af0a2 100644 --- a/test/MC/AMDGPU/hsa-text.s +++ b/test/MC/AMDGPU/hsa-text.s @@ -5,29 +5,23 @@ // ELF: Section { -// We want to avoid emitting an empty .text section. -// ELF-NOT: Name: .text - -// ELF: Name: .hsatext +// ELF: Name: .text // ELF: Type: SHT_PROGBITS (0x1) -// ELF: Flags [ (0xC00007) +// ELF: Flags [ (0x6) // ELF: SHF_ALLOC (0x2) -// ELF: SHF_AMDGPU_HSA_AGENT (0x800000) -// ELF: SHF_AMDGPU_HSA_CODE (0x400000) // ELF: SHF_EXECINSTR (0x4) -// ELF: SHF_WRITE (0x1) // ELF: Size: 260 // ELF: } +.text +// ASM: .text + .hsa_code_object_version 1,0 // ASM: .hsa_code_object_version 1,0 .hsa_code_object_isa 7,0,0,"AMD","AMDGPU" // ASM: .hsa_code_object_isa 7,0,0,"AMD","AMDGPU" -.text -// ASM: .hsatext - .amd_kernel_code_t .end_amd_kernel_code_t diff --git a/test/MC/AMDGPU/hsa.s b/test/MC/AMDGPU/hsa.s index bfdcfb43292..27de3d5325d 100644 --- a/test/MC/AMDGPU/hsa.s +++ b/test/MC/AMDGPU/hsa.s @@ -2,18 +2,15 @@ // RUN: llvm-mc -filetype=obj -triple amdgcn--amdhsa -mcpu=kaveri -show-encoding %s | llvm-readobj -symbols -s -sd | FileCheck %s --check-prefix=ELF // ELF: Section { -// ELF: Name: .hsatext +// ELF: Name: .text // ELF: Type: SHT_PROGBITS (0x1) -// ELF: Flags [ (0xC00007) +// ELF: Flags [ (0x6) // ELF: SHF_ALLOC (0x2) -// ELF: SHF_AMDGPU_HSA_AGENT (0x800000) -// ELF: SHF_AMDGPU_HSA_CODE (0x400000) // ELF: SHF_EXECINSTR (0x4) -// ELF: SHF_WRITE (0x1) // ELF: SHT_NOTE // ELF: 0000: 04000000 08000000 01000000 414D4400 -// ELF: 0010: 01000000 00000000 04000000 1B000000 +// ELF: 0010: 02000000 00000000 04000000 1B000000 // ELF: 0020: 03000000 414D4400 04000700 07000000 // ELF: 0030: 00000000 00000000 414D4400 414D4447 // ELF: 0040: 50550000 @@ -21,17 +18,19 @@ // ELF: Symbol { // ELF: Name: amd_kernel_code_t_minimal // ELF: Type: AMDGPU_HSA_KERNEL (0xA) -// ELF: Section: .hsatext +// ELF: Section: .text // ELF: } // ELF: Symbol { // ELF: Name: amd_kernel_code_t_test_all // ELF: Type: AMDGPU_HSA_KERNEL (0xA) -// ELF: Section: .hsatext +// ELF: Section: .text // ELF: } +.text +// ASM: .text -.hsa_code_object_version 1,0 -// ASM: .hsa_code_object_version 1,0 +.hsa_code_object_version 2,0 +// ASM: .hsa_code_object_version 2,0 .hsa_code_object_isa 7,0,0,"AMD","AMDGPU" // ASM: .hsa_code_object_isa 7,0,0,"AMD","AMDGPU" @@ -39,8 +38,6 @@ .amdgpu_hsa_kernel amd_kernel_code_t_test_all .amdgpu_hsa_kernel amd_kernel_code_t_minimal -.hsatext -// ASM: .hsatext amd_kernel_code_t_test_all: ; Test all amd_kernel_code_t members with non-default values. diff --git a/test/Object/AMDGPU/objdump.s b/test/Object/AMDGPU/objdump.s index 997bcb1f325..ca02a7ac205 100644 --- a/test/Object/AMDGPU/objdump.s +++ b/test/Object/AMDGPU/objdump.s @@ -42,7 +42,7 @@ hello_world2: s_endpgm // CHECK: file format ELF64-amdgpu-hsacobj -// CHECK: Disassembly of section .hsatext: +// CHECK: Disassembly of section .text: // CHECK: hello_world: // CHECK: s_mov_b32 m0, 0x10000 // 000000000100: BEFC00FF 00010000 // CHECK: s_load_dwordx2 s[0:1], s[4:5], 0x8 // 000000000108: C0060002 00000008 -- 2.50.1