]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
LoongArch: Fix internal error running "gcc -march=native" on LA664
authorXi Ruoyao <xry111@xry111.site>
Fri, 17 Nov 2023 12:44:17 +0000 (20:44 +0800)
committerXi Ruoyao <xry111@xry111.site>
Sat, 18 Nov 2023 17:11:09 +0000 (01:11 +0800)
On LA664, the PRID preset is ISA_BASE_LA64V110 but the base architecture
is guessed ISA_BASE_LA64V100.  This causes a warning to be outputed:

    cc1: warning: base architecture 'la64' differs from PRID preset '?'

But we've not set the "?" above in loongarch_isa_base_strings, thus it's
a nullptr and then an ICE is triggered.

Add ISA_BASE_LA64V110 to genopts and initialize
loongarch_isa_base_strings[ISA_BASE_LA64V110] correctly to fix the ICE.
The warning itself will be fixed later.

gcc/ChangeLog:

* config/loongarch/genopts/loongarch-strings:
(STR_ISA_BASE_LA64V110): Add.
* config/loongarch/genopts/loongarch.opt.in:
(ISA_BASE_LA64V110): Add.
* config/loongarch/loongarch-def.c
(loongarch_isa_base_strings): Initialize [ISA_BASE_LA64V110]
to STR_ISA_BASE_LA64V110.
* config/loongarch/loongarch.opt: Regenerate.
* config/loongarch/loongarch-str.h: Regenerate.

gcc/config/loongarch/genopts/loongarch-strings
gcc/config/loongarch/genopts/loongarch.opt.in
gcc/config/loongarch/loongarch-def.c
gcc/config/loongarch/loongarch-str.h
gcc/config/loongarch/loongarch.opt

index 7bc4824007e23b9b2a8bec0a26f290f689ff9ddf..b2070c83ed004af535fdc1c0718c839fc10d9a11 100644 (file)
@@ -30,6 +30,7 @@ STR_CPU_LA664       la664
 
 # Base architecture
 STR_ISA_BASE_LA64V100 la64
+STR_ISA_BASE_LA64V110 la64v1.1
 
 # -mfpu
 OPTSTR_ISA_EXT_FPU    fpu
index 00b4733d75bb91e2407c044006070bc3f9686118..b274b3fb21edbfc2b3a51cbeb81503a9ad175c91 100644 (file)
@@ -32,6 +32,9 @@ Basic ISAs of LoongArch:
 EnumValue
 Enum(isa_base) String(@@STR_ISA_BASE_LA64V100@@) Value(ISA_BASE_LA64V100)
 
+EnumValue
+Enum(isa_base) String(@@STR_ISA_BASE_LA64V110@@) Value(ISA_BASE_LA64V110)
+
 ;; ISA extensions / adjustments
 Enum
 Name(isa_ext_fpu) Type(int)
index 067629141b6c6a374935e6817e49e99e9c83793f..f22d488acb2412d2b858c9c65f8bf0e049730306 100644 (file)
@@ -165,6 +165,7 @@ loongarch_cpu_multipass_dfa_lookahead[N_TUNE_TYPES] = {
 const char*
 loongarch_isa_base_strings[N_ISA_BASE_TYPES] = {
   [ISA_BASE_LA64V100] = STR_ISA_BASE_LA64V100,
+  [ISA_BASE_LA64V110] = STR_ISA_BASE_LA64V110,
 };
 
 const char*
index fc4f41bfc1eb0ae5e3217e92c01fdad30d405e49..114dbc692d754cd472f294468c92fdad03fb6c5a 100644 (file)
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3.  If not see
 #define STR_CPU_LA664 "la664"
 
 #define STR_ISA_BASE_LA64V100 "la64"
+#define STR_ISA_BASE_LA64V110 "la64v1.1"
 
 #define OPTSTR_ISA_EXT_FPU "fpu"
 #define STR_NONE "none"
index 7f129e53ba5d338e34fc59c42eb319ea3cdc9ea0..350ca30d2321b472b0060c4ef55349ba4b688e60 100644 (file)
@@ -39,6 +39,9 @@ Basic ISAs of LoongArch:
 EnumValue
 Enum(isa_base) String(la64) Value(ISA_BASE_LA64V100)
 
+EnumValue
+Enum(isa_base) String(la64v1.1) Value(ISA_BASE_LA64V110)
+
 ;; ISA extensions / adjustments
 Enum
 Name(isa_ext_fpu) Type(int)