Skip to content

Commit 976580e

Browse files
committed
change the order of enabling to CPU->Arch
1 parent b0aede2 commit 976580e

8 files changed

Lines changed: 26 additions & 22 deletions

File tree

clang/test/Driver/aarch64-dotprod.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
// RUN: %clang -### --target=aarch64 -mcpu=cortex-a75 %s 2>&1 | FileCheck %s
1010
// RUN: %clang -### --target=aarch64 -mcpu=cortex-a76 %s 2>&1 | FileCheck %s
1111
// RUN: %clang -### --target=aarch64 -mcpu=cortex-a55 %s 2>&1 | FileCheck %s
12-
// RUN: %clang -### --target=aarch64 -mcpu=cortex-r82 %s 2>&1 | FileCheck %s --check-prefix=CHECK-NONE
12+
// RUN: %clang -### --target=aarch64 -mcpu=cortex-r82 %s 2>&1 | FileCheck %s
1313
// CHECK: "+dotprod"

clang/test/Driver/aarch64-implied-sve-features.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
// SVE-MCPU-FEATURES-NOT: "-target-feature" "+sve-bitperm"
8383
// SVE-MCPU-FEATURES-NOT: "-target-feature" "+sve2-bitperm"
8484
// SVE-MCPU-FEATURES-NOT: "-target-feature" "+sve2"
85-
// SVE-MCPU-FEATURES-NOT: "-target-feature" "+sve"
85+
// SVE-MCPU-FEATURES: "-target-feature" "+sve"
8686

8787
// RUN: %clang --target=aarch64-linux-gnu -mcpu=neoverse-n2+nosve+sve2 %s -### 2>&1 | FileCheck %s --check-prefix=SVE-MCPU-FEATURES-CONFLICT
8888
// SVE-MCPU-FEATURES-CONFLICT-NOT: "-target-feature" "+sve2-bitperm"

clang/test/Driver/aarch64-predres.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clang -### --target=aarch64-none-elf -march=armv8a+predres %s 2>&1 | FileCheck %s
2-
// RUN: %clang -### --target=aarch64-none-elf -mcpu=cortex-a520 %s 2>&1 | FileCheck %s --check-prefix=ABSENT
2+
// RUN: %clang -### --target=aarch64-none-elf -mcpu=cortex-a520 %s 2>&1 | FileCheck %s
33
// CHECK: "-target-feature" "+predres"
44
// CHECK-NOT: "-target-feature" "-predres"
55

clang/test/Driver/aarch64-ras.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// RUN: %clang --target=aarch64-none-elf -march=armv8.2a+ras -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RAS %s
44
// RUN: %clang --target=aarch64-none-elf -march=armv8-a+ras -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RAS %s
55
// RUN: %clang --target=aarch64-none-elf -mcpu=generic+ras -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RAS %s
6-
// RUN: %clang --target=aarch64-none-elf -mcpu=cortex-a75 -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-ABSENT %s
7-
// RUN: %clang --target=aarch64-none-elf -mcpu=cortex-a55 -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-ABSENT %s
6+
// RUN: %clang --target=aarch64-none-elf -mcpu=cortex-a75 -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RAS %s
7+
// RUN: %clang --target=aarch64-none-elf -mcpu=cortex-a55 -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RAS %s
88
// CHECK-RAS: "-target-feature" "+ras"
99

1010
// RUN: %clang --target=aarch64-none-elf -march=armv8a+noras -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-ABSENT %s

clang/test/Driver/aarch64-rdm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %clang --target=aarch64-none-elf -march=armv8a+rdma -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RDM %s
33
// RUN: %clang --target=aarch64-none-elf -mcpu=generic+rdm -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RDM %s
44
// RUN: %clang --target=aarch64-none-elf -mcpu=falkor -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RDM %s
5-
// RUN: %clang --target=aarch64-none-elf -mcpu=thunderx2t99 -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-NORDM %s
5+
// RUN: %clang --target=aarch64-none-elf -mcpu=thunderx2t99 -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RDM %s
66
// CHECK-RDM: "-target-feature" "+rdm"
77

88
// RUN: %clang --target=aarch64-none-elf -march=armv8a+nordm -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-NORDM %s

clang/test/Driver/arm-sb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clang -### -target arm-none-none-eabi -march=armv8a+sb %s 2>&1 | FileCheck %s
22
// RUN: %clang -### -target aarch64-none-elf -march=armv8a+sb %s 2>&1 | FileCheck %s
3-
// RUN: %clang -### -target aarch64-none-elf -mcpu=cortex-a510 %s 2>&1 | FileCheck %s --check-prefix=ABSENT
3+
// RUN: %clang -### -target aarch64-none-elf -mcpu=cortex-a510 %s 2>&1 | FileCheck %s
44
// CHECK: "-target-feature" "+sb"
55
// CHECK-NOT: "-target-feature" "-sb"
66

llvm/lib/TargetParser/AArch64TargetParser.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,16 +349,17 @@ void AArch64::ExtensionSet::addCPUDefaults(const CpuInfo &CPU) {
349349
LLVM_DEBUG(llvm::dbgs() << "addCPUDefaults(" << StrTab[CPU.Name] << ")\n");
350350
BaseArch = &ArchInfos[CPU.ArchIdx];
351351

352+
for (const auto &E : Extensions)
353+
if (CPU.DefaultExtensions.test(E.ID))
354+
enable(E.ID);
355+
352356
// Enabling the default extensions for the base-architecture is used for the
353357
// explicit +no<feature>. Does not call enable() because we do not want to set
354358
// Touched to avoid marking redundant features in the cc1 command-line.
355359
for (const auto &E : Extensions)
356360
if (BaseArch->DefaultExts.test(E.ID))
357361
Enabled.set(E.ID);
358-
for (const auto &E : Extensions) {
359-
if (CPU.DefaultExtensions.test(E.ID))
360-
enable(E.ID);
361-
}
362+
362363
}
363364

364365
void AArch64::ExtensionSet::addArchDefaults(const ArchInfo &Arch) {

llvm/unittests/TargetParser/TargetParserTest.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,25 +2321,28 @@ INSTANTIATE_TEST_SUITE_P(
23212321
AArch64ExtensionDependenciesBaseCPUTestParams
23222322
AArch64ExtensionDependenciesCPUData[] = {
23232323
// Base CPU features
2324-
{"cortex-a57", {}, {"v8a", "aes", "crc", "sha2"}, {"fp-armv8", "neon"}},
2324+
{"cortex-a57",
2325+
{},
2326+
{"v8a", "aes", "crc", "fp-armv8", "sha2", "neon"},
2327+
{}},
23252328
{"cortex-r82",
23262329
{},
2327-
{"v8r"},
2328-
{"crc", "dotprod", "fp-armv8", "fullfp16", "fp16fml", "lse", "ras",
2329-
"rcpc", "rdm", "sb", "neon", "ssbs"}},
2330+
{"v8r", "crc", "dotprod", "fp-armv8", "fullfp16", "fp16fml", "lse",
2331+
"ras", "rcpc", "rdm", "sb", "neon", "ssbs"},
2332+
{}},
23302333
{"cortex-a520",
23312334
{},
2332-
{"v9.2a", "fp16fml", "mte", "perfmon", "sve-bitperm"},
2333-
{"bf16", "crc", "dotprod", "flagm", "fp-armv8", "fullfp16", "i8mm",
2334-
"lse", "pauth", "predres", "ras", "rcpc", "rdm", "sb", "neon", "ssbs",
2335-
"sve", "sve2"}},
2335+
{"v9.2a", "bf16", "crc", "dotprod", "flagm", "fp-armv8",
2336+
"fullfp16", "fp16fml", "i8mm", "lse", "mte", "pauth",
2337+
"perfmon", "predres", "ras", "rcpc", "rdm", "sb",
2338+
"neon", "ssbs", "sve", "sve-bitperm", "sve2"},
2339+
{}},
23362340

23372341
// Negative modifiers
23382342
{"cortex-r82",
23392343
{"nofp"},
2340-
{"v8r"},
2341-
{"crc", "lse", "ras", "rcpc", "sb", "ssbs", "fp-armv8", "neon",
2342-
"fullfp16", "fp16fml", "dotprod", "rdm"}},
2344+
{"v8r", "crc", "lse", "ras", "rcpc", "sb", "ssbs"},
2345+
{"fp-armv8", "neon", "fullfp16", "fp16fml", "dotprod", "rdm"}},
23432346
};
23442347

23452348
INSTANTIATE_TEST_SUITE_P(

0 commit comments

Comments
 (0)