Skip to content

Commit 7ce595b

Browse files
committed
[hexagon] Bump the default version to v68
Set the default processor version to v68 when the user does not specify one in the command line. This includes changes in the LLVM backed and linker (lld). Since lld normally sets the version based on inputs, this change will only affect cases when there are no inputs. Fixes #127558
1 parent e86d627 commit 7ce595b

File tree

8 files changed

+27
-9
lines changed

8 files changed

+27
-9
lines changed

lld/ELF/Arch/Hexagon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ uint32_t Hexagon::calcEFlags() const {
6868
if (!ret || eflags > *ret)
6969
ret = eflags;
7070
}
71-
return ret.value_or(/* Default Arch Rev: */ 0x60);
71+
return ret.value_or(/* Default Arch Rev: */ EF_HEXAGON_MACH_V68);
7272
}
7373

7474
static uint32_t applyMask(uint32_t mask, uint32_t data) {

lld/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ ELF Improvements
3030
from ``-zgcs-report`` (capped at ``warning`` level) unless user-defined,
3131
ensuring compatibility with GNU ld linker.
3232

33+
* The default Hexagon architecture version in ELF object files produced by
34+
lld is changed to v68. This change is only effective when the version is
35+
not provided in the command line by the user and cannot be inferred from
36+
inputs.
37+
3338
Breaking changes
3439
----------------
3540

lld/test/ELF/emulation-hexagon.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# REQUIRES: hexagon
2-
# RUN: llvm-mc -filetype=obj -triple=hexagon %s -o %t.o
2+
# RUN: llvm-mc -filetype=obj -triple=hexagon --mcpu=hexagonv73 %s -o %t.o
33
# RUN: ld.lld %t.o -o %t
44
# RUN: llvm-readelf --file-headers %t | FileCheck --check-prefix=CHECK %s
55
# RUN: ld.lld -m hexagonelf %t.o -o %t
@@ -26,7 +26,7 @@
2626
# CHECK-NEXT: Entry point address: 0x200B4
2727
# CHECK-NEXT: Start of program headers: 52 (bytes into file)
2828
# CHECK-NEXT: Start of section headers:
29-
# CHECK-NEXT: Flags: 0x60
29+
# CHECK-NEXT: Flags: 0x73
3030
# CHECK-NEXT: Size of this header: 52 (bytes)
3131
# CHECK-NEXT: Size of program headers: 32 (bytes)
3232

lld/test/ELF/hexagon-eflag.s

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# Verify that the largest arch in the input list is selected.
77
# CHECK: Flags: 0x62
88

9+
# Verify the arch version when it cannot be inferred from inputs.
910
# RUN: llvm-ar rcsD %t4
1011
# RUN: ld.lld -m hexagonelf %t4 -o %t5
1112
# RUN: llvm-readelf -h %t5 | FileCheck --check-prefix=CHECK-EMPTYARCHIVE %s
12-
# CHECK-EMPTYARCHIVE: Flags: 0x60
13+
# CHECK-EMPTYARCHIVE: Flags: 0x68

llvm/docs/ReleaseNotes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ Changes to the DirectX Backend
102102
Changes to the Hexagon Backend
103103
------------------------------
104104

105+
* The default Hexagon architecture version in ELF object files produced by
106+
the tools such as llvm-mc is changed to v68. This version will be set if
107+
the user does not provide the CPU version in the command line.
108+
105109
Changes to the LoongArch Backend
106110
--------------------------------
107111

llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static cl::opt<bool>
125125
static cl::opt<bool> EnableHexagonCabac
126126
("mcabac", cl::desc("tbd"), cl::init(false));
127127

128-
static StringRef DefaultArch = "hexagonv60";
128+
static StringRef DefaultArch = "hexagonv68";
129129

130130
static StringRef HexagonGetArchVariant() {
131131
if (MV5)

llvm/test/MC/Hexagon/arch-support.s

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
# RUN: llvm-mc -triple=hexagon -mv75 -filetype=obj %s | llvm-readelf -h - | FileCheck --check-prefix=CHECK-V75 %s
1212
# RUN: llvm-mc -triple=hexagon -mv79 -filetype=obj %s | llvm-readelf -h - | FileCheck --check-prefix=CHECK-V79 %s
1313

14+
# Check which arch version llvm-mc sets when the user does not provide one.
15+
# RUN: llvm-mc -triple=hexagon -filetype=obj %s | llvm-readelf -h - | FileCheck --check-prefix=CHECK-DEFAULT %s
16+
1417
# RUN: llvm-mc -triple=hexagon -mv5 -filetype=obj %s | llvm-objdump --disassemble - | FileCheck --check-prefix=CHECK-OBJDUMP %s
1518
# RUN: llvm-mc -triple=hexagon -mv55 -filetype=obj %s | llvm-objdump --disassemble - | FileCheck --check-prefix=CHECK-OBJDUMP %s
1619
# RUN: llvm-mc -triple=hexagon -mv60 -filetype=obj %s | llvm-objdump --disassemble - | FileCheck --check-prefix=CHECK-OBJDUMP %s
@@ -38,5 +41,6 @@ r1 = r1
3841
# CHECK-V73: Flags:{{.*}}0x73
3942
# CHECK-V75: Flags:{{.*}}0x75
4043
# CHECK-V79: Flags:{{.*}}0x79
44+
# CHECK-DEFAULT: Flags:{{.*}}0x68
4145

4246
# CHECK-OBJDUMP: { r1 = r1 }

llvm/test/MC/Hexagon/hexagon_attributes.s

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ r3:2=cround(r1:0,#0x0) // v67, audio
55
v3:0.w=vrmpyz(v0.b,r0.b) // hvxv73, zreg
66
v1:0.sf=vadd(v0.bf,v0.bf) // hvxv73, hvx-ieee-fp
77

8-
// RUN: llvm-mc --mattr=+v67,+hvxv73,+hvx-qfloat,+hvx-ieee-fp,+zreg,+audio %s \
9-
// RUN: -triple=hexagon -filetype=obj --hexagon-add-build-attributes -o %t.o
8+
// Note that the CPU version should be set with `--mcpu` and not with attributes
9+
// because attributes are additive.
10+
// RUN: llvm-mc -triple=hexagon --mcpu=hexagonv67 \
11+
// RUN: --mattr=+hvxv73,+hvx-qfloat,+hvx-ieee-fp,+zreg,+audio %s \
12+
// RUN: -filetype=obj --hexagon-add-build-attributes -o %t.o
1013

1114
// RUN: llvm-readelf -A %t.o | \
1215
// RUN: FileCheck %s --match-full-lines --implicit-check-not={{.}} --check-prefix=READELF
@@ -15,8 +18,9 @@ v1:0.sf=vadd(v0.bf,v0.bf) // hvxv73, hvx-ieee-fp
1518
/// without manually passing in features when an attribute section is present.
1619
// RUN: llvm-objdump -d %t.o | FileCheck %s --check-prefix=OBJDUMP
1720

18-
// RUN: llvm-mc --mattr=+v67,+hvxv73,+hvx-qfloat,+hvx-ieee-fp,+zreg,+audio %s \
19-
// RUN: -triple=hexagon -filetype=asm --hexagon-add-build-attributes | \
21+
// RUN: llvm-mc -triple=hexagon --mcpu=hexagonv67 \
22+
// RUN: --mattr=+hvxv73,+hvx-qfloat,+hvx-ieee-fp,+zreg,+audio %s \
23+
// RUN: -filetype=asm --hexagon-add-build-attributes | \
2024
// RUN: FileCheck %s --match-full-lines --implicit-check-not={{.}} --check-prefix=ASM
2125

2226
// READELF: BuildAttributes {

0 commit comments

Comments
 (0)