From: Lulu Cheng Date: Wed, 12 Feb 2025 03:50:50 +0000 (+0800) Subject: LoongArch: When -mfpu=none, '__loongarch_frecipe' shouldn't be defined [PR118843]. X-Git-Tag: releases/gcc-14.3.0~483 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=889fb66025cef4e434cc60e35add9f7406e38db7;p=thirdparty%2Fgcc.git LoongArch: When -mfpu=none, '__loongarch_frecipe' shouldn't be defined [PR118843]. 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. (cherry picked from commit ee579b7c257468b9032ab4583ec455fa871d4428) --- diff --git a/gcc/config/loongarch/loongarch-c.cc b/gcc/config/loongarch/loongarch-c.cc index c6763647cd1..591d1dabcdf 100644 --- a/gcc/config/loongarch/loongarch-c.cc +++ b/gcc/config/loongarch/loongarch-c.cc @@ -85,9 +85,6 @@ loongarch_cpu_cpp_builtins (cpp_reader *pfile) else builtin_define ("__loongarch_frlen=0"); - if (TARGET_HARD_FLOAT && ISA_HAS_FRECIPE) - builtin_define ("__loongarch_frecipe"); - if (ISA_HAS_LSX) { builtin_define ("__loongarch_simd"); @@ -107,7 +104,9 @@ loongarch_cpu_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]) + 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]); diff --git a/gcc/testsuite/gcc.target/loongarch/pr118843.c b/gcc/testsuite/gcc.target/loongarch/pr118843.c new file mode 100644 index 00000000000..30372b8ffe6 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/pr118843.c @@ -0,0 +1,6 @@ +/* { dg-do preprocess } */ +/* { dg-options "-mfrecipe -mfpu=none" } */ + +#ifdef __loongarch_frecipe +#error __loongarch_frecipe should not be avaliable here +#endif