Skip to content

Commit b9efd0b

Browse files
authored
Fix library variants for v7-R soft-float ABI (#532)
We currently build these two library variants for v7-R with the soft-float ABI: * armv7r_soft_nofp * armv7r_soft_vfpv3_d16 The first variant can only be used when the target does not have an FPU, because it does not include bootcode to enable the FPU. This means that we don't have any library variants which can be selected for the single-precision-only FPUs when using the soft-float ABI. For the hard-float ABI, we solve this by having separate library variants for vfpv3xd (SP-only) and vfpv3_d16 (SP+DP). This is important for performance, as it allows the math library to use DP instructions where available. We could do the same thing for the soft-float libraries, however these variants with an FPU are included for completeness, their performance is less important because a user interested in performance would use the hard-float ABI. Thesefore I think we should only include the variant for the minimal FPU, which is vfpv3xd. These libraries are also used for v8-R AArch32, where this change is important because -march=armv8-r implies -mfpu=fpv5-sp-d16 by default, which currently fails to find a library.
1 parent e823c64 commit b9efd0b

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,9 +1777,9 @@ add_library_variants_for_cpu(
17771777
)
17781778
add_library_variants_for_cpu(
17791779
armv7r
1780-
SUFFIX soft_vfpv3_d16
1781-
COMPILE_FLAGS "-mfloat-abi=softfp -march=armv7r -mfpu=vfpv3-d16"
1782-
MULTILIB_FLAGS "--target=armv7r-unknown-none-eabi -mfpu=vfpv3-d16"
1780+
SUFFIX soft_vfpv3xd
1781+
COMPILE_FLAGS "-mfloat-abi=softfp -march=armv7r -mfpu=vfpv3xd"
1782+
MULTILIB_FLAGS "--target=armv7r-unknown-none-eabi -mfpu=vfpv3xd"
17831783
PICOLIBC_BUILD_TYPE "release"
17841784
QEMU_MACHINE "none"
17851785
QEMU_CPU "cortex-r5f"

test/multilib/armv7r.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# RUN: %clang -print-multi-directory --target=armv7r-none-eabihf -mfpu=vfpv3-d16 -mfloat-abi=softfp | FileCheck --check-prefix=SOFT-VFPV3 %s
1414
# RUN: %clang -print-multi-directory --target=armv7r-none-eabihf -mfpu=vfpv3-d16 -marm -mfloat-abi=softfp | FileCheck --check-prefix=SOFT-VFPV3 %s
1515
# RUN: %clang -print-multi-directory --target=armv7r-none-eabihf -mfpu=vfpv3-d16 -mthumb -mfloat-abi=softfp | FileCheck --check-prefix=SOFT-VFPV3 %s
16-
# SOFT-VFPV3: arm-none-eabi/armv7r_soft_vfpv3_d16_exn_rtti{{$}}
16+
# SOFT-VFPV3: arm-none-eabi/armv7r_soft_vfpv3xd_exn_rtti{{$}}
1717
# SOFT-VFPV3-EMPTY:
1818

1919
# RUN: %clang -print-multi-directory --target=armv7r-none-eabihf -mfpu=vfpv3xd | FileCheck --check-prefix=VFPV3XD %s

test/multilib/armv8r.test

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
# CHECK: arm-none-eabi/armv7r_soft_nofp_exn_rtti{{$}}
77
# CHECK-EMPTY:
88

9+
# RUN: %clang -print-multi-directory --target=armv8r-none-eabi | FileCheck --check-prefix=SOFT-VFPV3 %s
10+
# RUN: %clang -print-multi-directory --target=arm-none-eabi -march=armv8-r | FileCheck --check-prefix=SOFT-VFPV3 %s
11+
# RUN: %clang -print-multi-directory --target=armv8r-none-eabihf -mfloat-abi=softfp | FileCheck --check-prefix=SOFT-VFPV3 %s
12+
# RUN: %clang -print-multi-directory --target=arm-none-eabihf -mfloat-abi=softfp -march=armv8-r | FileCheck --check-prefix=SOFT-VFPV3 %s
13+
# RUN: %clang -print-multi-directory --target=arm-none-eabi -march=armv8-r -marm | FileCheck --check-prefix=SOFT-VFPV3 %s
14+
# RUN: %clang -print-multi-directory --target=arm-none-eabi -march=armv8-r -mthumb | FileCheck --check-prefix=SOFT-VFPV3 %s
15+
# RUN: %clang -print-multi-directory --target=arm-none-eabi -march=armv8-r -mfpu=fpv5-d16 | FileCheck --check-prefix=SOFT-VFPV3 %s
16+
# SOFT-VFPV3: arm-none-eabi/armv7r_soft_vfpv3xd_exn_rtti{{$}}
17+
# SOFT-VFPV3-EMPTY:
18+
919
# RUN: %clang -print-multi-directory --target=armv8r-none-eabihf -mfpu=vfpv3-d16 | FileCheck --check-prefix=VFPV3 %s
1020
# RUN: %clang -print-multi-directory --target=armv8r-none-eabihf -mfpu=neon-vfpv3 | FileCheck --check-prefix=VFPV3 %s
1121
# RUN: %clang -print-multi-directory --target=armv8r-none-eabihf -mfpu=vfpv3 | FileCheck --check-prefix=VFPV3 %s
@@ -18,5 +28,16 @@
1828
# RUN: %clang -print-multi-directory --target=armv8r-none-eabihf -mfpu=vfpv3-d16 -marm | FileCheck --check-prefix=VFPV3 %s
1929
# RUN: %clang -print-multi-directory --target=armv8r-none-eabihf -mfpu=vfpv3-d16 -mthumb | FileCheck --check-prefix=VFPV3 %s
2030
# RUN: %clang -print-multi-directory --target=armv8r-none-eabihf -mcpu=cortex-r52 | FileCheck --check-prefix=VFPV3 %s
31+
# RUN: %clang -print-multi-directory --target=arm-none-eabihf -march=armv8-r -mfpu=fpv5-d16 | FileCheck --check-prefix=VFPV3 %s
32+
# RUN: %clang -print-multi-directory --target=arm-none-eabihf -march=armv8-r -mfpu=fp-armv8 | FileCheck --check-prefix=VFPV3 %s
2133
# VFPV3: arm-none-eabi/armv7r_hard_vfpv3_d16_exn_rtti{{$}}
2234
# VFPV3-EMPTY:
35+
36+
# RUN: %clang -print-multi-directory --target=armv8r-none-eabihf | FileCheck --check-prefix=VFPV3XD %s
37+
# RUN: %clang -print-multi-directory --target=arm-none-eabihf -march=armv8-r | FileCheck --check-prefix=VFPV3XD %s
38+
# RUN: %clang -print-multi-directory --target=arm-none-eabihf -march=armv8-r -marm | FileCheck --check-prefix=VFPV3XD %s
39+
# RUN: %clang -print-multi-directory --target=arm-none-eabihf -march=armv8-r -mthumb | FileCheck --check-prefix=VFPV3XD %s
40+
# RUN: %clang -print-multi-directory --target=arm-none-eabihf -march=armv8-r -mfpu=fpv4-sp-d16 | FileCheck --check-prefix=VFPV3XD %s
41+
# RUN: %clang -print-multi-directory --target=arm-none-eabihf -march=armv8-r -mfpu=fpv5-sp-d16 | FileCheck --check-prefix=VFPV3XD %s
42+
# VFPV3XD: arm-none-eabi/armv7r_hard_vfpv3xd_exn_rtti{{$}}
43+
# VFPV3XD-EMPTY:

0 commit comments

Comments
 (0)