[v2,4/4] LoongArch: When -mfpu=none, '__loongarch_frecipe' shouldn't be defined [PR118843].
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_simplebootstrap_build--master-aarch64-bootstrap |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_simplebootstrap_build--master-arm-bootstrap |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
Commit Message
PR target/118843
gcc/ChangeLog:
* config/loongarch/loongarch-c.cc
(loongarch_update_cpp_builtins): Fix macro definition issues.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/pr118843.c: New test.
Change-Id: I777e46ccbc80bfa8948e7d416ac86853c8f4c16d
---
gcc/config/loongarch/loongarch-c.cc | 27 ++++++++++---------
gcc/testsuite/gcc.target/loongarch/pr118843.c | 6 +++++
2 files changed, 21 insertions(+), 12 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/loongarch/pr118843.c
@@ -129,9 +129,6 @@ loongarch_update_cpp_builtins (cpp_reader *pfile)
else
builtin_define ("__loongarch_frlen=0");
- loongarch_def_or_undef (TARGET_HARD_FLOAT && ISA_HAS_FRECIPE,
- "__loongarch_frecipe", pfile);
-
loongarch_def_or_undef (ISA_HAS_LSX, "__loongarch_simd", pfile);
loongarch_def_or_undef (ISA_HAS_LSX, "__loongarch_sx", pfile);
loongarch_def_or_undef (ISA_HAS_LASX, "__loongarch_asx", pfile);
@@ -149,17 +146,23 @@ loongarch_update_cpp_builtins (cpp_reader *pfile)
int max_v_major = 1, max_v_minor = 0;
for (int i = 0; i < N_EVO_FEATURES; i++)
- if (la_target.isa.evolution & la_evo_feature_masks[i])
- {
- builtin_define (la_evo_macro_name[i]);
+ {
+ builtin_undef (la_evo_macro_name[i]);
- int major = la_evo_version_major[i],
- minor = la_evo_version_minor[i];
+ if (la_target.isa.evolution & la_evo_feature_masks[i]
+ && (la_evo_feature_masks[i] != OPTION_MASK_ISA_FRECIPE
+ || TARGET_HARD_FLOAT))
+ {
+ builtin_define (la_evo_macro_name[i]);
- max_v_major = major > max_v_major ? major : max_v_major;
- max_v_minor = major == max_v_major
- ? (minor > max_v_minor ? minor : max_v_minor) : max_v_minor;
- }
+ int major = la_evo_version_major[i],
+ minor = la_evo_version_minor[i];
+
+ max_v_major = major > max_v_major ? major : max_v_major;
+ max_v_minor = major == max_v_major
+ ? (minor > max_v_minor ? minor : max_v_minor) : max_v_minor;
+ }
+ }
/* Find the minimum ISA version required to run the target program. */
builtin_undef ("__loongarch_version_major");
new file mode 100644
@@ -0,0 +1,6 @@
+/* { dg-do preprocess } */
+/* { dg-options "-mfrecipe -mfpu=none" } */
+
+#ifdef __loongarch_frecipe
+#error __loongarch_frecipe should not be avaliable here
+#endif