HTEC Proprietary

Hi,

>>> From 16b3207aed5e4846fde4f3ffa1253c65ef6ba056 Mon Sep 17 00:00:00 2001
>>> From: Aleksandar Rakic <aleksandar.ra...@htecgroup.com>
>>> Date: Wed, 23 Apr 2025 14:14:17 +0200
>>> Subject: [PATCH] Make MSA and microMIPS R5 unsupported
>>>
>>> There are no platforms nor simulators for MSA and microMIPS R5 so
>>> turning off this support for now.
>>>
>>> gcc/ChangeLog:
>>>
>>>      * config/mips/mips.cc (mips_option_override): Error out for
>>>      -mmicromips -mips32r5 -mmsa.
>>>
>>> Cherry-picked 1009d6ff7a8d3b56e0224a6b193c5a7b3c29aa5f
>>> from https://github.com/MIPS/gcc
>>>
>>> Signed-off-by: Matthew Fortune <matthew.fort...@imgtec.com>
>>> Signed-off-by: Faraz Shahbazker <fshahbaz...@wavecomp.com>
>>> Signed-off-by: Aleksandar Rakic <aleksandar.ra...@htecgroup.com>
>>> ---
>>>  gcc/config/mips/mips.cc | 4 +++-
>>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
>>> index 0d3d0263f2d..23205dfb616 100644
>>> --- a/gcc/config/mips/mips.cc
>>> +++ b/gcc/config/mips/mips.cc
>>> @@ -20414,6 +20414,7 @@ static void
>>>  mips_option_override (void)
>>>  {
>>>    int i, regno, mode;
>>> +  unsigned int is_micromips;
>>>
>>>    if (OPTION_SET_P (mips_isa_option))
>>>      mips_isa_option_info = &mips_cpu_info_table[mips_isa_option];
>>> @@ -20434,6 +20435,7 @@ mips_option_override (void)
>>>    /* Save the base compression state and process flags as though we
>>>       were generating uncompressed code.  */
>>>    mips_base_compression_flags = TARGET_COMPRESSION;
>>> +  is_micromips = TARGET_MICROMIPS;
>>>    target_flags &= ~TARGET_COMPRESSION;
>>>    mips_base_code_readable = mips_code_readable;
>>>
>>> @@ -20678,7 +20680,7 @@ mips_option_override (void)
>>>            "-mcompact-branches=never");
>>>      }
>>>
>>> -  if (is_micromips && TARGET_MSA)
>>> +  if (is_micromips && mips_isa_rev <= 5 && TARGET_MSA)
>>
>> Why not just "TARGET_MICROMIPS && mips_isa_rev <= 5 && TARGET_MSA"?

I tried to use just "TARGET_MICROMIPS" instead of "is_micromips", but
the compiler optimized "TARGET_MICROMIPS" away for some reason and
encoded it as "false".
Also, the original patch was dependent upon a patch that adds a support
for microMIPS R6 in GCC, where the local variable "is_micromips" was
defined and used several times.

>>
>>>      error ("unsupported combination: %s", "-mmicromips -mmsa");
>>
>> And should this line be updated too like "-mmicromips -mmsa is only
>> supported for MIPSr6"?

Yes, thank you for the advice, please find a new version of the patch in
the attachment, where this line and changelog were updated
appropriately.

>>
>> Unfortunately the original patch is already applied and breaking even a
>> non-bootstrapping build for MIPS.  Thus a fix is needed ASAP or we'd
>> revert the original patch.
>
> i.e. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119929#c2.
>
> Also, Aleksandar, do you have an account on Bugzilla? It'd be useful to
> be able to CC you on any MIPS-related issues with the upstreaming of
> these patches. Thanks.

I sent a GCC Bugzilla account creation request. Thanks.

Kind regards,
Aleksandar
From 601d3b7fc5dc21b559385e6dbbd672548bb75e66 Mon Sep 17 00:00:00 2001
From: Aleksandar Rakic <aleksandar.ra...@htecgroup.com>
Date: Wed, 23 Apr 2025 14:14:17 +0200
Subject: [PATCH] Make MSA and microMIPS R5 unsupported

There are no platforms nor simulators for MSA and microMIPS R5 so
turning off this support for now.

gcc/ChangeLog:

	* config/mips/mips.cc (mips_option_override): Error out for
	-mmicromips -mmsa for MIPSr5 and less.

Cherry-picked 1009d6ff7a8d3b56e0224a6b193c5a7b3c29aa5f
from https://github.com/MIPS/gcc

Signed-off-by: Matthew Fortune <matthew.fort...@imgtec.com>
Signed-off-by: Faraz Shahbazker <fshahbaz...@wavecomp.com>
Signed-off-by: Aleksandar Rakic <aleksandar.ra...@htecgroup.com>
---
 gcc/config/mips/mips.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
index 0d3d0263f2d..728a5883841 100644
--- a/gcc/config/mips/mips.cc
+++ b/gcc/config/mips/mips.cc
@@ -20414,6 +20414,7 @@ static void
 mips_option_override (void)
 {
   int i, regno, mode;
+  unsigned int is_micromips;
 
   if (OPTION_SET_P (mips_isa_option))
     mips_isa_option_info = &mips_cpu_info_table[mips_isa_option];
@@ -20434,6 +20435,7 @@ mips_option_override (void)
   /* Save the base compression state and process flags as though we
      were generating uncompressed code.  */
   mips_base_compression_flags = TARGET_COMPRESSION;
+  is_micromips = TARGET_MICROMIPS;
   target_flags &= ~TARGET_COMPRESSION;
   mips_base_code_readable = mips_code_readable;
 
@@ -20678,8 +20680,10 @@ mips_option_override (void)
 	      "-mcompact-branches=never");
     }
 
-  if (is_micromips && TARGET_MSA)
-    error ("unsupported combination: %s", "-mmicromips -mmsa");
+  if (is_micromips && mips_isa_rev <= 5 && TARGET_MSA)
+    error ("%qs is incompatible with %qs, %<-mmicromips -mmsa%> is "
+	   "only supported for MIPSr6", mips_arch_info->name,
+	   "-mmicromips -mmsa");
 
   /* Require explicit relocs for MIPS R6 onwards.  This enables simplification
      of the compact branch and jump support through the backend.  */
-- 
2.34.1

Reply via email to