Skip to content

Commit 1b8eab1

Browse files
committed
AMDGPU/R600: Emit rodata in text segment
R600 relies on this behaviour. Fixes: 6e18266 ('Partially revert D61491 "AMDGPU: Be explicit about whether the high-word in SI_PC_ADD_REL_OFFSET is 0"') Fixes ~100 piglit regressions since 6e18266 Differential Revision: https://reviews.llvm.org/D72991
1 parent 90cfbb8 commit 1b8eab1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ bool isReadOnlySegment(const GlobalValue *GV) {
559559
}
560560

561561
bool shouldEmitConstantsToTextSection(const Triple &TT) {
562-
return TT.getOS() == Triple::AMDPAL;
562+
return TT.getOS() == Triple::AMDPAL || TT.getArch() == Triple::r600;
563563
}
564564

565565
int getIntegerAttribute(const Function &F, StringRef Name, int Default) {

llvm/test/CodeGen/AMDGPU/global-constant.ll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
; RUN: llc -mtriple=amdgcn-- -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=NOPAL %s
33
; RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=NOPAL %s
44
; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=NOPAL %s
5+
; RUN: llc -mtriple=r600-- -mcpu=cypress < %s | FileCheck -check-prefix=R600 %s
56

67
@private1 = private unnamed_addr addrspace(4) constant [4 x float] [float 0.0, float 1.0, float 2.0, float 3.0]
78
@private2 = private unnamed_addr addrspace(4) constant [4 x float] [float 4.0, float 5.0, float 6.0, float 7.0]
@@ -28,6 +29,7 @@
2829
; NOPAL: s_add_u32 s{{[0-9]+}}, s[[PC1_LO]], private2@rel32@lo+4
2930
; NOPAL: s_addc_u32 s{{[0-9]+}}, s[[PC1_HI]], private2@rel32@hi+4
3031

32+
; R600-LABEL: private_test
3133
define amdgpu_kernel void @private_test(i32 %index, float addrspace(1)* %out) {
3234
%ptr = getelementptr [4 x float], [4 x float] addrspace(4) * @private1, i32 0, i32 %index
3335
%val = load float, float addrspace(4)* %ptr
@@ -42,6 +44,7 @@ define amdgpu_kernel void @private_test(i32 %index, float addrspace(1)* %out) {
4244
; NOPAL: s_getpc_b64 s{{\[}}[[PC0_LO:[0-9]+]]:[[PC0_HI:[0-9]+]]{{\]}}
4345
; NOPAL: s_add_u32 s{{[0-9]+}}, s[[PC0_LO]], available_externally@gotpcrel32@lo+4
4446
; NOPAL: s_addc_u32 s{{[0-9]+}}, s[[PC0_HI]], available_externally@gotpcrel32@hi+4
47+
; R600-LABEL: available_externally_test
4548
define amdgpu_kernel void @available_externally_test(i32 addrspace(1)* %out) {
4649
%ptr = getelementptr [256 x i32], [256 x i32] addrspace(4)* @available_externally, i32 0, i32 1
4750
%val = load i32, i32 addrspace(4)* %ptr
@@ -51,6 +54,9 @@ define amdgpu_kernel void @available_externally_test(i32 addrspace(1)* %out) {
5154

5255
; PAL: .text
5356
; NOPAL: .section .rodata
57+
; R600: .text
5458

5559
; GCN: private1:
5660
; GCN: private2:
61+
; R600: private1:
62+
; R600: private2:

0 commit comments

Comments
 (0)