Skip to content

Commit 1115ca7

Browse files
committed
Fix hardcoding of NEON FPU for armv8
Android hardcoded NEON FPU for armv7 that is now causing issues with 32-bit builds for armv8.
1 parent dcc141b commit 1115ca7

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ llvm::ARM::FPUKind arm::getARMTargetFeatures(const Driver &D,
647647
(void)getARMFPUFeatures(D, WaFPU->first, Args, WaFPU->second, Features);
648648
} else if (FPUArg) {
649649
FPUKind = getARMFPUFeatures(D, FPUArg, Args, FPUArg->getValue(), Features);
650-
} else if (Triple.isAndroid() && getARMSubArchVersionNumber(Triple) >= 7) {
650+
} else if (Triple.isAndroid() && getARMSubArchVersionNumber(Triple) == 7) {
651651
const char *AndroidFPU = "neon";
652652
FPUKind = llvm::ARM::parseFPU(AndroidFPU);
653653
if (!llvm::ARM::getFPUFeatures(FPUKind, Features))

clang/test/Driver/arm-mfpu.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,25 @@
409409
// CHECK-ARM7-ANDROID-FP-DEFAULT-NOT: "-target-feature" "+sha2"
410410
// CHECK-ARM7-ANDROID-FP-DEFAULT-NOT: "-target-feature" "+aes"
411411

412+
// RUN: %clang -target armv8-linux-androideabi21 %s -### -c 2>&1 \
413+
// RUN: | FileCheck --check-prefix=CHECK-ARM8-ANDROID-FP-DEFAULT %s
414+
// CHECK-ARM8-ANDROID-FP-DEFAULT-DAG: "-target-feature" "+soft-float-abi"
415+
// CHECK-ARM8-ANDROID-FP-DEFAULT-DAG: "-target-feature" "+vfp3"
416+
// CHECK-ARM8-ANDROID-FP-DEFAULT-DAG: "-target-feature" "+vfp4"
417+
// CHECK-ARM8-ANDROID-FP-DEFAULT-DAG: "-target-feature" "+fp-armv8"
418+
// CHECK-ARM8-ANDROID-FP-DEFAULT-DAG: "-target-feature" "+aes"
419+
// CHECK-ARM8-ANDROID-FP-DEFAULT-DAG: "-target-feature" "+sha2"
420+
// CHECK-ARM8-ANDROID-FP-DEFAULT-NOT: "-target-feature" "+neon"
421+
422+
// RUN: %clang -target armv8-linux-android %s -### -c 2>&1 \
423+
// RUN: | FileCheck --check-prefix=CHECK-ARM8-ANDROID-DEFAULT %s
424+
// CHECK-ARM8-ANDROID-DEFAULT-DAG: "-target-feature" "+vfp3"
425+
// CHECK-ARM8-ANDROID-DEFAULT-DAG: "-target-feature" "+vfp4"
426+
// CHECK-ARM8-ANDROID-DEFAULT-DAG: "-target-feature" "+fp-armv8"
427+
// CHECK-ARM8-ANDROID-DEFAULT-DAG: "-target-feature" "+aes"
428+
// CHECK-ARM8-ANDROID-DEFAULT-DAG: "-target-feature" "+sha2"
429+
// CHECK-ARM8-ANDROID-DEFAULT-NOT: "-target-feature" "+neon"
430+
412431
// RUN: %clang -target armv7-linux-androideabi21 %s -mfpu=vfp3-d16 -### -c 2>&1 \
413432
// RUN: | FileCheck --check-prefix=CHECK-ARM7-ANDROID-FP-D16 %s
414433
// CHECK-ARM7-ANDROID-FP-D16-NOT: "-target-feature" "+soft-float"

0 commit comments

Comments
 (0)