[lld] lld: Migrate amdgpu tests to use subarch triples (PR #210114)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 16 10:16:09 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Matt Arsenault (arsenm)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/210114.diff
12 Files Affected:
- (modified) lld/test/ELF/amdgpu-abi-version-err.s (+2-2)
- (modified) lld/test/ELF/amdgpu-abi-version.s (+2-2)
- (modified) lld/test/ELF/amdgpu-duplicate-sym.s (+3-3)
- (modified) lld/test/ELF/amdgpu-elf-flags-err.s (+2-2)
- (modified) lld/test/ELF/amdgpu-elf-flags.s (+2-2)
- (modified) lld/test/ELF/amdgpu-globals.s (+1-1)
- (modified) lld/test/ELF/amdgpu-relocs.s (+1-1)
- (modified) lld/test/ELF/amdgpu-relocs2.s (+1-1)
- (modified) lld/test/ELF/amdgpu-tid.s (+14-14)
- (modified) lld/test/ELF/emulation-amdgpu.s (+4-3)
- (modified) lld/test/ELF/lto/amdgcn-oses.ll (+3-3)
- (added) lld/test/ELF/lto/amdgpu.ll (+12)
``````````diff
diff --git a/lld/test/ELF/amdgpu-abi-version-err.s b/lld/test/ELF/amdgpu-abi-version-err.s
index d7ce1d5e485af..4b8bf051275f4 100644
--- a/lld/test/ELF/amdgpu-abi-version-err.s
+++ b/lld/test/ELF/amdgpu-abi-version-err.s
@@ -1,6 +1,6 @@
# REQUIRES: amdgpu
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=4 -filetype=obj %s -o %t-0.o
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=5 -filetype=obj %s -o %t-1.o
+# RUN: llvm-mc -triple amdgpu9.00-amd-amdhsa --amdhsa-code-object-version=4 -filetype=obj %s -o %t-0.o
+# RUN: llvm-mc -triple amdgpu9.00-amd-amdhsa --amdhsa-code-object-version=5 -filetype=obj %s -o %t-1.o
# RUN: not ld.lld -shared %t-0.o %t-1.o -o /dev/null 2>&1 | FileCheck %s
# CHECK: ld.lld: error: incompatible ABI version: {{.*}}-1.o
diff --git a/lld/test/ELF/amdgpu-abi-version.s b/lld/test/ELF/amdgpu-abi-version.s
index cda9f5aafa5ee..8426988afdcac 100644
--- a/lld/test/ELF/amdgpu-abi-version.s
+++ b/lld/test/ELF/amdgpu-abi-version.s
@@ -1,12 +1,12 @@
# REQUIRES: amdgpu
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=4 -filetype=obj %s -o %t.o
+# RUN: llvm-mc -triple amdgpu9.00-amd-amdhsa --amdhsa-code-object-version=4 -filetype=obj %s -o %t.o
# RUN: ld.lld -shared %t.o -o %t.so
# RUN: llvm-readobj --file-headers %t.so | FileCheck --check-prefix=COV4 %s
# COV4: OS/ABI: AMDGPU_HSA (0x40)
# COV4: ABIVersion: 2
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=5 -filetype=obj %s -o %t.o
+# RUN: llvm-mc -triple amdgpu9.00-amd-amdhsa --amdhsa-code-object-version=5 -filetype=obj %s -o %t.o
# RUN: ld.lld -shared %t.o -o %t.so
# RUN: llvm-readobj --file-headers %t.so | FileCheck --check-prefix=COV5 %s
diff --git a/lld/test/ELF/amdgpu-duplicate-sym.s b/lld/test/ELF/amdgpu-duplicate-sym.s
index 9423a2cee1d4a..8d3e3c663c908 100644
--- a/lld/test/ELF/amdgpu-duplicate-sym.s
+++ b/lld/test/ELF/amdgpu-duplicate-sym.s
@@ -1,11 +1,11 @@
# REQUIRES: amdgpu
-# RUN: llvm-mc -filetype=obj -triple amdgcn-amd-amdhsa -mcpu=gfx1031 --position-independent %s -o %t.o
+# RUN: llvm-mc -filetype=obj -triple amdgpu10.31-amd-amdhsa --position-independent %s -o %t.o
# We use lld-link on purpose to exercise -flavor.
# RUN: lld-link -flavor gnu -shared %t.o -o /dev/null
.text
- .amdgcn_target "amdgcn-amd-amdhsa--gfx1031"
+ .amdgcn_target "amdgpu10.31-amd-amdhsa--gfx1031"
.protected xxx ; @xxx
.type xxx, at object
.data
@@ -17,7 +17,7 @@ xxx:
.amdgpu_metadata
---
amdhsa.kernels: []
-amdhsa.target: amdgcn-amd-amdhsa--gfx1031
+amdhsa.target: amdgpu10.31-amd-amdhsa--gfx1031
amdhsa.version:
- 1
- 1
diff --git a/lld/test/ELF/amdgpu-elf-flags-err.s b/lld/test/ELF/amdgpu-elf-flags-err.s
index 8dfa4854abe25..f0c95d1af74d1 100644
--- a/lld/test/ELF/amdgpu-elf-flags-err.s
+++ b/lld/test/ELF/amdgpu-elf-flags-err.s
@@ -1,6 +1,6 @@
# REQUIRES: amdgpu
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx802 --amdhsa-code-object-version=4 -filetype=obj %S/Inputs/amdgpu-kernel-0.s -o %t-0.o
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx803 --amdhsa-code-object-version=4 -filetype=obj %S/Inputs/amdgpu-kernel-1.s -o %t-1.o
+# RUN: llvm-mc -triple amdgpu8.02-amd-amdhsa --amdhsa-code-object-version=4 -filetype=obj %S/Inputs/amdgpu-kernel-0.s -o %t-0.o
+# RUN: llvm-mc -triple amdgpu8.03-amd-amdhsa --amdhsa-code-object-version=4 -filetype=obj %S/Inputs/amdgpu-kernel-1.s -o %t-1.o
# RUN: not ld.lld -shared %t-0.o %t-1.o -o /dev/null 2>&1 | FileCheck %s
# CHECK: error: incompatible mach: {{.*}}-1.o
diff --git a/lld/test/ELF/amdgpu-elf-flags.s b/lld/test/ELF/amdgpu-elf-flags.s
index 41d69af8e0b20..4021aca02deb6 100644
--- a/lld/test/ELF/amdgpu-elf-flags.s
+++ b/lld/test/ELF/amdgpu-elf-flags.s
@@ -1,6 +1,6 @@
# REQUIRES: amdgpu
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx803 --amdhsa-code-object-version=4 -filetype=obj %S/Inputs/amdgpu-kernel-0.s -o %t-0.o
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx803 --amdhsa-code-object-version=4 -filetype=obj %S/Inputs/amdgpu-kernel-1.s -o %t-1.o
+# RUN: llvm-mc -triple amdgpu8.03-amd-amdhsa --amdhsa-code-object-version=4 -filetype=obj %S/Inputs/amdgpu-kernel-0.s -o %t-0.o
+# RUN: llvm-mc -triple amdgpu8.03-amd-amdhsa --amdhsa-code-object-version=4 -filetype=obj %S/Inputs/amdgpu-kernel-1.s -o %t-1.o
# RUN: ld.lld -shared %t-0.o %t-1.o -o %t.so
# RUN: llvm-readobj --file-headers %t.so | FileCheck --check-prefix=FIRSTLINK %s
diff --git a/lld/test/ELF/amdgpu-globals.s b/lld/test/ELF/amdgpu-globals.s
index 603006604522a..8f94866378cdc 100644
--- a/lld/test/ELF/amdgpu-globals.s
+++ b/lld/test/ELF/amdgpu-globals.s
@@ -1,5 +1,5 @@
# REQUIRES: amdgpu
-# RUN: llvm-mc -filetype=obj -triple amdgcn--amdhsa -mcpu=kaveri %s -o %t.o
+# RUN: llvm-mc -filetype=obj -triple amdgpu7.00--amdhsa %s -o %t.o
# RUN: ld.lld -shared %t.o -o %t
# RUN: llvm-readobj --sections --symbols -l %t | FileCheck %s
diff --git a/lld/test/ELF/amdgpu-relocs.s b/lld/test/ELF/amdgpu-relocs.s
index 447e60b4e7af6..aabf2713487d6 100644
--- a/lld/test/ELF/amdgpu-relocs.s
+++ b/lld/test/ELF/amdgpu-relocs.s
@@ -1,5 +1,5 @@
# REQUIRES: amdgpu
-# RUN: llvm-mc -filetype=obj -triple=amdgcn--amdhsa -mcpu=fiji %s -o %t.o
+# RUN: llvm-mc -filetype=obj -triple=amdgpu8.03--amdhsa %s -o %t.o
# RUN: ld.lld --hash-style=sysv -shared %t.o -o %t.so
# RUN: llvm-readobj -r %t.so | FileCheck %s
# RUN: llvm-nm %t.so | FileCheck %s --check-prefix=NM
diff --git a/lld/test/ELF/amdgpu-relocs2.s b/lld/test/ELF/amdgpu-relocs2.s
index 12099b8eda3eb..c30a0ff1858a5 100644
--- a/lld/test/ELF/amdgpu-relocs2.s
+++ b/lld/test/ELF/amdgpu-relocs2.s
@@ -1,6 +1,6 @@
# REQUIRES: amdgpu
# RUN: split-file %s %t
-# RUN: llvm-mc -filetype=obj -triple=amdgcn--amdhsa -mcpu=fiji %t/asm -o %t.o
+# RUN: llvm-mc -filetype=obj -triple=amdgpu8.03--amdhsa %t/asm -o %t.o
# RUN: ld.lld %t.o -o %t/out --script %t/script
# RUN: llvm-objdump -d %t/out | FileCheck %s
diff --git a/lld/test/ELF/amdgpu-tid.s b/lld/test/ELF/amdgpu-tid.s
index ee0062eb750c8..66d04d85243f2 100644
--- a/lld/test/ELF/amdgpu-tid.s
+++ b/lld/test/ELF/amdgpu-tid.s
@@ -1,16 +1,16 @@
# REQUIRES: amdgpu
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx906 -mattr=-xnack --amdhsa-code-object-version=4 -filetype=obj %s -o %t-xnack-off0.o
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx906 -mattr=-xnack --amdhsa-code-object-version=4 -filetype=obj %s -o %t-xnack-off1.o
+# RUN: llvm-mc -triple amdgpu9.06-amd-amdhsa -mattr=-xnack --amdhsa-code-object-version=4 -filetype=obj %s -o %t-xnack-off0.o
+# RUN: llvm-mc -triple amdgpu9.06-amd-amdhsa -mattr=-xnack --amdhsa-code-object-version=4 -filetype=obj %s -o %t-xnack-off1.o
# RUN: ld.lld -shared %t-xnack-off0.o %t-xnack-off1.o -o %t-xnack-off2.so
# RUN: llvm-readobj --file-headers %t-xnack-off2.so | FileCheck --check-prefix=XNACK-OFF %s
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx906 -mattr=+xnack --amdhsa-code-object-version=4 -filetype=obj %s -o %t-xnack-on0.o
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx906 -mattr=+xnack --amdhsa-code-object-version=4 -filetype=obj %s -o %t-xnack-on1.o
+# RUN: llvm-mc -triple amdgpu9.06-amd-amdhsa -mattr=+xnack --amdhsa-code-object-version=4 -filetype=obj %s -o %t-xnack-on0.o
+# RUN: llvm-mc -triple amdgpu9.06-amd-amdhsa -mattr=+xnack --amdhsa-code-object-version=4 -filetype=obj %s -o %t-xnack-on1.o
# RUN: ld.lld -shared %t-xnack-on0.o %t-xnack-on1.o -o %t-xnack-on2.so
# RUN: llvm-readobj --file-headers %t-xnack-on2.so | FileCheck --check-prefix=XNACK-ON %s
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx906 --amdhsa-code-object-version=4 -filetype=obj %s -o %t-xnack-any.o
+# RUN: llvm-mc -triple amdgpu9.06-amd-amdhsa --amdhsa-code-object-version=4 -filetype=obj %s -o %t-xnack-any.o
# RUN: ld.lld -shared %t-xnack-off0.o %t-xnack-any.o -o %t-xnack-off3.so
# RUN: llvm-readobj --file-headers %t-xnack-off3.so | FileCheck --check-prefix=XNACK-OFF %s
# RUN: ld.lld -shared %t-xnack-on0.o %t-xnack-any.o -o %t-xnack-on3.so
@@ -22,17 +22,17 @@
# XNACK-ON: EF_AMDGPU_FEATURE_XNACK_ON_V4 (0x300)
# XNACK-INCOMPATIBLE: incompatible xnack:
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx906 -mattr=-sramecc --amdhsa-code-object-version=4 -filetype=obj %s -o %t-sramecc-off0.o
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx906 -mattr=-sramecc --amdhsa-code-object-version=4 -filetype=obj %s -o %t-sramecc-off1.o
+# RUN: llvm-mc -triple amdgpu9.06-amd-amdhsa -mattr=-sramecc --amdhsa-code-object-version=4 -filetype=obj %s -o %t-sramecc-off0.o
+# RUN: llvm-mc -triple amdgpu9.06-amd-amdhsa -mattr=-sramecc --amdhsa-code-object-version=4 -filetype=obj %s -o %t-sramecc-off1.o
# RUN: ld.lld -shared %t-sramecc-off0.o %t-sramecc-off1.o -o %t-sramecc-off2.so
# RUN: llvm-readobj --file-headers %t-sramecc-off2.so | FileCheck --check-prefix=SRAMECC-OFF %s
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx906 -mattr=+sramecc --amdhsa-code-object-version=4 -filetype=obj %s -o %t-sramecc-on0.o
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx906 -mattr=+sramecc --amdhsa-code-object-version=4 -filetype=obj %s -o %t-sramecc-on1.o
+# RUN: llvm-mc -triple amdgpu9.06-amd-amdhsa -mattr=+sramecc --amdhsa-code-object-version=4 -filetype=obj %s -o %t-sramecc-on0.o
+# RUN: llvm-mc -triple amdgpu9.06-amd-amdhsa -mattr=+sramecc --amdhsa-code-object-version=4 -filetype=obj %s -o %t-sramecc-on1.o
# RUN: ld.lld -shared %t-sramecc-on0.o %t-sramecc-on1.o -o %t-sramecc-on2.so
# RUN: llvm-readobj --file-headers %t-sramecc-on2.so | FileCheck --check-prefix=SRAMECC-ON %s
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx906 --amdhsa-code-object-version=4 -filetype=obj %s -o %t-sramecc-any.o
+# RUN: llvm-mc -triple amdgpu9.06-amd-amdhsa --amdhsa-code-object-version=4 -filetype=obj %s -o %t-sramecc-any.o
# RUN: ld.lld -shared %t-sramecc-off0.o %t-sramecc-any.o -o %t-sramecc-off3.so
# RUN: llvm-readobj --file-headers %t-sramecc-off3.so | FileCheck --check-prefix=SRAMECC-OFF %s
# RUN: ld.lld -shared %t-sramecc-on0.o %t-sramecc-any.o -o %t-sramecc-on3.so
@@ -44,13 +44,13 @@
# SRAMECC-ON: EF_AMDGPU_FEATURE_SRAMECC_ON_V4 (0xC00)
# SRAMECC-INCOMPATIBLE: incompatible sramecc:
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=6 --amdgpu-force-generic-version=1 -filetype=obj %s -o %t-genericv1_0.o
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=6 --amdgpu-force-generic-version=1 -filetype=obj %s -o %t-genericv1_1.o
+# RUN: llvm-mc -triple amdgpu9.00-amd-amdhsa --amdhsa-code-object-version=6 --amdgpu-force-generic-version=1 -filetype=obj %s -o %t-genericv1_0.o
+# RUN: llvm-mc -triple amdgpu9.00-amd-amdhsa --amdhsa-code-object-version=6 --amdgpu-force-generic-version=1 -filetype=obj %s -o %t-genericv1_1.o
# RUN: ld.lld -shared %t-genericv1_0.o %t-genericv1_1.o -o %t-genericv1_2.so
# RUN: llvm-readobj --file-headers %t-genericv1_2.so | FileCheck --check-prefix=GENERICV1 %s
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=6 --amdgpu-force-generic-version=2 -filetype=obj %s -o %t-genericv2_0.o
-# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=6 --amdgpu-force-generic-version=2 -filetype=obj %s -o %t-genericv2_1.o
+# RUN: llvm-mc -triple amdgpu9.00-amd-amdhsa --amdhsa-code-object-version=6 --amdgpu-force-generic-version=2 -filetype=obj %s -o %t-genericv2_0.o
+# RUN: llvm-mc -triple amdgpu9.00-amd-amdhsa --amdhsa-code-object-version=6 --amdgpu-force-generic-version=2 -filetype=obj %s -o %t-genericv2_1.o
# RUN: ld.lld -shared %t-genericv2_0.o %t-genericv2_1.o -o %t-genericv2_2.so
# RUN: llvm-readobj --file-headers %t-genericv2_2.so | FileCheck --check-prefix=GENERICV2 %s
diff --git a/lld/test/ELF/emulation-amdgpu.s b/lld/test/ELF/emulation-amdgpu.s
index 2d9ae52548b41..892cbffaf2cb7 100644
--- a/lld/test/ELF/emulation-amdgpu.s
+++ b/lld/test/ELF/emulation-amdgpu.s
@@ -1,12 +1,12 @@
# REQUIRES: amdgpu
-# RUN: llvm-mc -filetype=obj -triple=amdgcn-amd-amdhsa --amdhsa-code-object-version=4 %s -o %t.o
+# RUN: llvm-mc -filetype=obj -triple=amdgpu7.00-amd-amdhsa --amdhsa-code-object-version=4 %s -o %t.o
# RUN: ld.lld %t.o -o %t
# RUN: llvm-readobj --file-headers %t | FileCheck --check-prefixes=CHECK,HSA4 %s
# RUN: ld.lld -m elf64_amdgpu %t.o -o %t
# RUN: llvm-readobj --file-headers %t | FileCheck --check-prefixes=CHECK,HSA4 %s
-# RUN: llvm-mc -filetype=obj -triple=amdgcn-amd-amdhsa --amdhsa-code-object-version=5 %s -o %t.o
+# RUN: llvm-mc -filetype=obj -triple=amdgpu7.00-amd-amdhsa --amdhsa-code-object-version=5 %s -o %t.o
# RUN: ld.lld %t.o -o %t
# RUN: llvm-readobj --file-headers %t | FileCheck --check-prefixes=CHECK,HSA5 %s
# RUN: ld.lld -m elf64_amdgpu %t.o -o %t
@@ -29,7 +29,8 @@
# CHECK-NEXT: Entry:
# CHECK-NEXT: ProgramHeaderOffset: 0x40
# CHECK-NEXT: SectionHeaderOffset:
-# CHECK-NEXT: Flags [ (0x0)
+# CHECK-NEXT: Flags [
+# CHECK-NEXT: EF_AMDGPU_MACH_AMDGCN_GFX700 (0x22)
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 64
# CHECK-NEXT: ProgramHeaderEntrySize: 56
diff --git a/lld/test/ELF/lto/amdgcn-oses.ll b/lld/test/ELF/lto/amdgcn-oses.ll
index b3caf0f0de3b9..2ff60bfc66bdd 100644
--- a/lld/test/ELF/lto/amdgcn-oses.ll
+++ b/lld/test/ELF/lto/amdgcn-oses.ll
@@ -24,7 +24,7 @@
; GCN: Machine: EM_AMDGPU
;--- amdhsa.ll
-target triple = "amdgcn-amd-amdhsa"
+target triple = "amdgpu7.00-amd-amdhsa"
target datalayout = "e-m:e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
!llvm.module.flags = !{!0}
@@ -35,7 +35,7 @@ define void @_start() {
}
;--- amdpal.ll
-target triple = "amdgcn-amd-amdpal"
+target triple = "amdgpu7.00-amd-amdpal"
target datalayout = "e-m:e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
define amdgpu_cs void @_start() {
@@ -43,7 +43,7 @@ define amdgpu_cs void @_start() {
}
;--- mesa3d.ll
-target triple = "amdgcn-amd-mesa3d"
+target triple = "amdgpu7.00-amd-mesa3d"
target datalayout = "e-m:e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
define void @_start() {
diff --git a/lld/test/ELF/lto/amdgpu.ll b/lld/test/ELF/lto/amdgpu.ll
new file mode 100644
index 0000000000000..c24ce3831df19
--- /dev/null
+++ b/lld/test/ELF/lto/amdgpu.ll
@@ -0,0 +1,12 @@
+; REQUIRES: amdgpu
+; RUN: llvm-as %s -o %t.o
+; RUN: ld.lld %t.o -o %t
+
+; Make sure the amdgpu triple is handled
+
+target triple = "amdgpu7.00-amd-amdhsa"
+target datalayout = "e-m:e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
+
+define void @_start() {
+ ret void
+}
``````````
</details>
https://github.com/llvm/llvm-project/pull/210114
More information about the llvm-commits
mailing list