Skip to content

Commit 2cf7abd

Browse files
authored
merge main into amd-staging (llvm#1663)
2 parents aaa27cc + 2d0d897 commit 2cf7abd

File tree

182 files changed

+3327
-1657
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+3327
-1657
lines changed

.github/workflows/premerge.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ jobs:
6565
export CXX=/opt/llvm/bin/clang++
6666
6767
./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}"
68+
- name: "Upload artifact"
69+
- name: Upload Artifacts
70+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
71+
with:
72+
name: Premerge Artifacts
73+
path: artifacts/
74+
retention-days: 5
75+
include-hidden-files: 'true'
6876

6977
premerge-checks-windows:
7078
name: Windows Premerge Checks (Test Only - Please Ignore Results)
@@ -113,6 +121,13 @@ jobs:
113121
set MAX_PARALLEL_LINK_JOBS=64
114122
call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64
115123
bash .ci/monolithic-windows.sh "${{ steps.vars.outputs.windows-projects }}" "${{ steps.vars.outputs.windows-check-targets }}"
124+
- name: Upload Artifacts
125+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
126+
with:
127+
name: Premerge Artifacts
128+
path: artifacts/
129+
retention-days: 5
130+
include-hidden-files: 'true'
116131

117132
premerge-check-macos:
118133
name: MacOS Premerge Checks

.mailmap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ Ramkumar Ramachandra <[email protected]> <[email protected]>
4949
Ramkumar Ramachandra <[email protected]> <[email protected]>
5050
Saleem Abdulrasool <[email protected]>
5151
52-
Wang Pengcheng <[email protected]>
53-
54-
52+
Pengcheng Wang <[email protected]>
53+
54+

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ Potentially Breaking Changes
3838
- Fix missing diagnostics for uses of declarations when performing typename access,
3939
such as when performing member access on a '[[deprecated]]' type alias.
4040
(#GH58547)
41+
- For ARM targets when compiling assembly files, the features included in the selected CPU
42+
or Architecture's FPU are included. If you wish not to use a specific feature,
43+
the relevant ``+no`` option will need to be amended to the command line option.
4144

4245
C/C++ Language Potentially Breaking Changes
4346
-------------------------------------------
@@ -532,6 +535,7 @@ X86 Support
532535

533536
Arm and AArch64 Support
534537
^^^^^^^^^^^^^^^^^^^^^^^
538+
- For ARM targets, cc1as now considers the FPU's features for the selected CPU or Architecture.
535539

536540
Android Support
537541
^^^^^^^^^^^^^^^

clang/lib/Driver/ToolChains/Arch/ARM.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -679,21 +679,17 @@ llvm::ARM::FPUKind arm::getARMTargetFeatures(const Driver &D,
679679
CPUArgFPUKind != llvm::ARM::FK_INVALID ? CPUArgFPUKind : ArchArgFPUKind;
680680
(void)llvm::ARM::getFPUFeatures(FPUKind, Features);
681681
} else {
682-
bool Generic = true;
683-
if (!ForAS) {
684-
std::string CPU = arm::getARMTargetCPU(CPUName, ArchName, Triple);
685-
if (CPU != "generic")
686-
Generic = false;
687-
llvm::ARM::ArchKind ArchKind =
688-
arm::getLLVMArchKindForARM(CPU, ArchName, Triple);
689-
FPUKind = llvm::ARM::getDefaultFPU(CPU, ArchKind);
690-
(void)llvm::ARM::getFPUFeatures(FPUKind, Features);
691-
}
682+
std::string CPU = arm::getARMTargetCPU(CPUName, ArchName, Triple);
683+
bool Generic = CPU == "generic";
692684
if (Generic && (Triple.isOSWindows() || Triple.isOSDarwin()) &&
693685
getARMSubArchVersionNumber(Triple) >= 7) {
694686
FPUKind = llvm::ARM::parseFPU("neon");
695-
(void)llvm::ARM::getFPUFeatures(FPUKind, Features);
687+
} else {
688+
llvm::ARM::ArchKind ArchKind =
689+
arm::getLLVMArchKindForARM(CPU, ArchName, Triple);
690+
FPUKind = llvm::ARM::getDefaultFPU(CPU, ArchKind);
696691
}
692+
(void)llvm::ARM::getFPUFeatures(FPUKind, Features);
697693
}
698694

699695
// Now we've finished accumulating features from arch, cpu and fpu,

clang/test/Driver/arm-fpu-selection.s

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// REQUIRES: arm-registered-target
2+
/// Ensures that when targeting an ARM target with an Asm file, clang
3+
/// collects the features from the FPU. This is critical in the
4+
/// activation of NEON for supported targets. The Cortex-R52 will be
5+
/// used and tested for VFP and NEON Support
6+
7+
// RUN: %clang -target arm-none-eabi -mcpu=cortex-r52 -c %s -o /dev/null 2>&1 | FileCheck --check-prefix=CHECK-STDERR %s --allow-empty
8+
// RUN: %clang -target arm-none-eabi -mcpu=cortex-r52 -c %s -o /dev/null -### 2>&1 | FileCheck --check-prefix=CHECK-TARGET-FEATURES %s
9+
10+
/// Check that no errors or warnings are present when assembling using cc1as.
11+
// CHECK-STDERR-NOT: error:
12+
// CHECK-STDERR-NOT: warning:
13+
14+
/// Check that NEON and VFPV5 have been activated when using Cortex-R52 when using cc1as
15+
// CHECK-TARGET-FEATURES: "-target-feature" "+vfp2sp"
16+
// CHECK-TARGET-FEATURES: "-target-feature" "+vfp3"
17+
// CHECK-TARGET-FEATURES: "-target-feature" "+fp-armv8"
18+
// CHECK-TARGET-FEATURES: "-target-feature" "+fp-armv8d16"
19+
// CHECK-TARGET-FEATURES: "-target-feature" "+fp-armv8d16sp"
20+
// CHECK-TARGET-FEATURES: "-target-feature" "+fp-armv8sp"
21+
// CHECK-TARGET-FEATURES: "-target-feature" "+neon"
22+
23+
vadd.f32 s0, s1, s2
24+
vadd.f64 d0, d1, d2
25+
vcvt.u32.f32 s0, s0, #1
26+
vcvt.u32.f64 d0, d0, #1
27+
vcvtb.f32.f16 s0, s1
28+
vcvtb.f64.f16 d0, s1
29+
vfma.f32 s0, s1, s2
30+
vfma.f64 d0, d1, d2
31+
vcvta.u32.f32 s0, s1
32+
vcvta.u32.f64 s0, d1
33+
vadd.f32 q0, q1, q2
34+
vcvt.f32.f16 q0, d1
35+
vfma.f32 q0, q1, q2
36+
vcvta.u32.f32 q0, q1
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/// Ensure that we can assemble NEON by just specifying an armv7
2+
/// Apple or Windows target.
3+
4+
// REQUIRES: arm-registered-target
5+
// RUN: %clang -c -target armv7-apple-darwin -o /dev/null %s 2>&1 | FileCheck --check-prefix=CHECK-STDERR %s --allow-empty
6+
// RUN: %clang -c -target armv7-apple-darwin -o /dev/null %s -### 2>&1 | FileCheck --check-prefix=CHECK-TARGET-FEATURES %s
7+
// RUN: %clang -c -target armv7-windows -o /dev/null %s 2>&1 | FileCheck --check-prefix=CHECK-STDERR %s --allow-empty
8+
// RUN: %clang -c -target armv7-windows -o /dev/null %s -### 2>&1 | FileCheck --check-prefix=CHECK-TARGET-FEATURES %s
9+
10+
/// Check that no errors or warnings are present when assembling using cc1as.
11+
// CHECK-STDERR-NOT: error:
12+
// CHECK-STDERR-NOT: warning:
13+
14+
// CHECK-TARGET-FEATURES: "-target-feature" "+neon"
15+
16+
vadd.i32 q0, q0, q0
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/// Ensure that we can assemble VFPv4 by just specifying an armv7s target.
2+
3+
// REQUIRES: arm-registered-target
4+
// RUN: %clang -c -target armv7s-apple-darwin -o /dev/null %s 2>&1 | FileCheck --check-prefix=CHECK-STDERR %s --allow-empty
5+
// RUN: %clang -c -target armv7s-apple-darwin -o /dev/null %s -### 2>&1 | FileCheck --check-prefix=CHECK-TARGET-FEATURES %s
6+
7+
/// Check that no errors or warnings are present when assembling using cc1as.
8+
// CHECK-STDERR-NOT: error:
9+
// CHECK-STDERR-NOT: warning:
10+
11+
// CHECK-TARGET-FEATURES: "-target-feature" "+vfp4"
12+
13+
vfma.f32 q1, q2, q3

clang/test/Driver/armv8.1m.main.s

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@
88
# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+fp -o /dev/null %s 2>%t
99
# RUN: FileCheck --check-prefix=ERROR-V81M_FP < %t %s
1010
# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+nofp -o /dev/null %s 2>%t
11-
# RUN: FileCheck --check-prefix=ERROR-V81M_FP < %t %s
11+
# RUN: FileCheck --check-prefix=ERROR-V81M_NOFP < %t %s
1212
# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+fp.dp -o /dev/null %s 2>%t
1313
# RUN: FileCheck --check-prefix=ERROR-V81M_FPDP < %t %s
1414
# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+nofp.dp -o /dev/null %s 2>%t
15-
# RUN: FileCheck --check-prefix=ERROR-V81M_FPDP < %t %s
15+
# RUN: FileCheck --check-prefix=ERROR-V81M_NOFPDP < %t %s
1616
# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve -o /dev/null %s 2>%t
1717
# RUN: FileCheck --check-prefix=ERROR-V81M_MVE < %t %s
1818
# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+nomve -o /dev/null %s 2>%t
19-
# RUN: FileCheck --check-prefix=ERROR-V81M_MVE < %t %s
19+
# RUN: FileCheck --check-prefix=ERROR-V81M_NOMVE < %t %s
2020
# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve+fp -o /dev/null %s 2>%t
2121
# RUN: FileCheck --check-prefix=ERROR-V81M_MVE_FP < %t %s
2222
# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve.fp -o /dev/null %s 2>%t
2323
# RUN: FileCheck --check-prefix=ERROR-V81M_MVEFP < %t %s
2424
# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+nomve.fp -o /dev/null %s 2>%t
25-
# RUN: FileCheck --check-prefix=ERROR-V81M_MVEFP < %t %s
25+
# RUN: FileCheck --check-prefix=ERROR-V81M_NOMVEFP < %t %s
2626

2727
.syntax unified
2828
.thumb
@@ -35,39 +35,58 @@ qadd r0, r1, r2
3535
# ERROR-V8M: :[[@LINE-1]]:1: error
3636
# ERROR-V81M: :[[@LINE-2]]:1: error
3737
# ERROR-V81M_FP: :[[@LINE-3]]:1: error
38-
# ERROR-V81M_FPDP: :[[@LINE-4]]:1: error
38+
# ERROR-V81M_NOFP: :[[@LINE-4]]:1: error
39+
# ERROR-V81M_FPDP: :[[@LINE-5]]:1: error
40+
# ERROR-V81M_NOFPDP: :[[@LINE-6]]:1: error
41+
# ERROR-V81M_NOMVE: :[[@LINE-7]]:1: error
42+
# ERROR-V81M_NOMVEFP: :[[@LINE-8]]:1: error
3943

4044
vadd.f16 s0, s1, s2
4145
# ERROR-V8M: :[[@LINE-1]]:1: error
42-
# ERROR-V81M: :[[@LINE-2]]:1: error
43-
# ERROR-V81M_DSP: :[[@LINE-3]]:1: error
44-
# ERROR-V81M_MVE: :[[@LINE-4]]:1: error
46+
# ERROR-V81M_NOFP: :[[@LINE-2]]:1: error
4547

4648
vabs.f32 s0, s1
47-
# ERROR-V8M: :[[@LINE-1]]:1: error
48-
# ERROR-V81M: :[[@LINE-2]]:1: error
49-
# ERROR-V81M_DSP: :[[@LINE-3]]:1: error
50-
# ERROR-V81M_MVE: :[[@LINE-4]]:1: error
49+
# ERROR-V81M_NOFP: :[[@LINE-1]]:1: error
5150

52-
vcmp.f64 d0,d1
51+
vabs.s32 q0, q1
5352
# ERROR-V8M: :[[@LINE-1]]:1: error
5453
# ERROR-V81M: :[[@LINE-2]]:1: error
5554
# ERROR-V81M_DSP: :[[@LINE-3]]:1: error
5655
# ERROR-V81M_FP: :[[@LINE-4]]:1: error
57-
# ERROR-V81M_MVE: :[[@LINE-5]]:1: error
58-
# ERROR-V81M_MVE_FP: :[[@LINE-6]]:1: error
59-
# ERROR-V81M_MVEFP: :[[@LINE-7]]:1: error
56+
# ERROR-V81M_NOFP: :[[@LINE-5]]:1: error
57+
# ERROR-V81M_FPDP: :[[@LINE-6]]:1: error
58+
# ERROR-V81M_NOFPDP: :[[@LINE-7]]:1: error
59+
# ERROR-V81M_NOMVE: :[[@LINE-8]]:1: error
60+
# ERROR-V81M_NOMVEFP: :[[@LINE-9]]:1: error
61+
62+
vcmp.f64 d0,d1
63+
# ERROR-V81M: :[[@LINE-1]]:1: error
64+
# ERROR-V81M_DSP: :[[@LINE-2]]:1: error
65+
# ERROR-V81M_FP: :[[@LINE-3]]:1: error
66+
# ERROR-V81M_NOFP: :[[@LINE-4]]:1: error
67+
# ERROR-V81M_NOFPDP: :[[@LINE-5]]:1: error
68+
# ERROR-V81M_MVE: :[[@LINE-6]]:1: error
69+
# ERROR-V81M_NOMVE: :[[@LINE-7]]:1: error
70+
# ERROR-V81M_MVE_FP: :[[@LINE-8]]:1: error
71+
# ERROR-V81M_MVEFP: :[[@LINE-9]]:1: error
72+
# ERROR-V81M_NOMVEFP: :[[@LINE-10]]:1: error
6073

6174
asrl r0, r1, r2
6275
# ERROR-V8M: :[[@LINE-1]]:1: error
6376
# ERROR-V81M: :[[@LINE-2]]:1: error
6477
# ERROR-V81M_DSP: :[[@LINE-3]]:1: error
6578
# ERROR-V81M_FP: :[[@LINE-4]]:1: error
6679
# ERROR-V81M_FPDP: :[[@LINE-5]]:1: error
80+
# ERROR-V81M_NOFPDP: :[[@LINE-6]]:1: error
81+
# ERROR-V81M_NOMVE: :[[@LINE-7]]:1: error
82+
# ERROR-V81M_NOMVEFP: :[[@LINE-8]]:1: error
6783

6884
vcadd.i8 q0, q1, q2, #90
6985
# ERROR-V8M: :[[@LINE-1]]:1: error
7086
# ERROR-V81M: :[[@LINE-2]]:1: error
7187
# ERROR-V81M_DSP: :[[@LINE-3]]:1: error
7288
# ERROR-V81M_FP: :[[@LINE-4]]:1: error
7389
# ERROR-V81M_FPDP: :[[@LINE-5]]:1: error
90+
# ERROR-V81M_NOFPDP: :[[@LINE-6]]:1: error
91+
# ERROR-V81M_NOMVE: :[[@LINE-7]]:1: error
92+
# ERROR-V81M_NOMVEFP: :[[@LINE-8]]:1: error
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifdef cl_khr_global_int32_base_atomics
10+
#define __CLC_FUNCTION atom_add
11+
#define __CLC_ADDRESS_SPACE global
12+
#include <clc/atomic/atom_decl_int32.inc>
13+
#endif // cl_khr_global_int32_base_atomics
14+
15+
#ifdef cl_khr_local_int32_base_atomics
16+
#define __CLC_FUNCTION atom_add
17+
#define __CLC_ADDRESS_SPACE local
18+
#include <clc/atomic/atom_decl_int32.inc>
19+
#endif // cl_khr_local_int32_base_atomics
20+
21+
#ifdef cl_khr_int64_base_atomics
22+
#define __CLC_FUNCTION atom_add
23+
#include <clc/atomic/atom_decl_int64.inc>
24+
#endif // cl_khr_int64_base_atomics
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifdef cl_khr_global_int32_extended_atomics
10+
#define __CLC_FUNCTION atom_and
11+
#define __CLC_ADDRESS_SPACE global
12+
#include <clc/atomic/atom_decl_int32.inc>
13+
#endif // cl_khr_global_int32_extended_atomics
14+
15+
#ifdef cl_khr_local_int32_extended_atomics
16+
#define __CLC_FUNCTION atom_and
17+
#define __CLC_ADDRESS_SPACE local
18+
#include <clc/atomic/atom_decl_int32.inc>
19+
#endif // cl_khr_local_int32_extended_atomics
20+
21+
#ifdef cl_khr_int64_extended_atomics
22+
#define __CLC_FUNCTION atom_and
23+
#include <clc/atomic/atom_decl_int64.inc>
24+
#endif // cl_khr_int64_extended_atomics

0 commit comments

Comments
 (0)