[AArch64] Don't #define __ARM_FP when there's no FPU.
authorSimon Tatham <simon.tatham@arm.com>
Mon, 13 Mar 2023 16:28:38 +0000 (16:28 +0000)
committerSimon Tatham <simon.tatham@arm.com>
Mon, 13 Mar 2023 16:43:25 +0000 (16:43 +0000)
commit5fba4c4d08bdb38d0df2fd43afa4bec4f3809b66
treec0d32416a31502dfcc73e46696d4c4cf718baed6
parentdb3d2adecb4a1f613c7950fa36d1cd7aa38c9f22
[AArch64] Don't #define __ARM_FP when there's no FPU.

On some R-profile CPUs, leaving out the FPU is an option. Clang will
accept `-march=armv8-r+nofp`, but it's currently not possible to find
out via the preprocessor whether it's in that mode (e.g. to change or
disable inline asm statements in your code).

The __ARM_FP macro, which has a bit set for each size of floating
point number supported by the hardware, is the natural thing to test.
But Clang was defining it unconditionally on AArch64. Now it checks
for FP support before defining it at all.

Reviewed By: tmatheson, DavidSpickett

Differential Revision: https://reviews.llvm.org/D145781
clang/lib/Basic/Targets/AArch64.cpp
clang/lib/Basic/Targets/AArch64.h
clang/test/Preprocessor/aarch64-target-features.c