powerc: Fix asm machine directive for some CPUs
Commit Message
For some CPUs, the assembler machine directive cannot be determined by ISA
flags.
gcc/
PR 104090/target
* config/rs6000/rs6000.cc (rs6000_machine_from_flags): Use also
rtems_cpu.
---
gcc/config/rs6000/rs6000.cc | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
Comments
Hi!
On Tue, Jan 18, 2022 at 12:51:39PM +0100, Sebastian Huber wrote:
> For some CPUs, the assembler machine directive cannot be determined by ISA
> flags.
That may be the best we can do here, with the current setup, yes.
> PR 104090/target
> * config/rs6000/rs6000.cc (rs6000_machine_from_flags): Use also
> rtems_cpu.
rs6000_cpu you mean :-)
> + /* For some CPUs, the machine cannot be determined by ISA flags. We have to
> + check them first. */
> + switch (rs6000_cpu)
> + {
> + case PROCESSOR_PPC8540:
> + case PROCESSOR_PPC8548:
> + return "e500";
Ah I could not figure out what core those two are. But you know it :-)
> + default:
> + break;
Please don't do that. You can do
default:
break;
break;
/* And just to make sure: */
break;
break;
and it will do exactly the same as not having a default at all. Not
having such useless code is by far the most readable, so please don't
include a default case at all.
Okay with those changes. Thanks!
Segher
On 18/01/2022 22:42, Segher Boessenkool wrote:
>> + default:
>> + break;
> Please don't do that. You can do
>
> default:
> break;
> break;
> /* And just to make sure: */
> break;
> break;
>
> and it will do exactly the same as not having a default at all. Not
> having such useless code is by far the most readable, so please don't
> include a default case at all.
I removed the default case. I hope this is what you wanted.
>
> Okay with those changes. Thanks!
Thanks for having a look at this. I would like to back port this patch
also to the GCC 10 and 11 branches.
On 19/01/2022 07:54, Sebastian Huber wrote:
>
>>
>> Okay with those changes. Thanks!
>
> Thanks for having a look at this. I would like to back port this patch
> also to the GCC 10 and 11 branches.
The default is to ask for back ports after a break. Can I back port the
patch (with the default: break) to GCC 10 and 11 now?
On Wed, Feb 02, 2022 at 06:07:38PM +0100, Sebastian Huber wrote:
> On 19/01/2022 07:54, Sebastian Huber wrote:
> >>Okay with those changes. Thanks!
> >
> >Thanks for having a look at this. I would like to back port this patch
> >also to the GCC 10 and 11 branches.
>
> The default is to ask for back ports after a break. Can I back port the
> patch (with the default: break) to GCC 10 and 11 now?
I have many more changes, but I'll deal with that. Okay for 11 and 10.
Thanks!
Segher
@@ -5935,6 +5935,34 @@ const char *rs6000_machine;
const char *
rs6000_machine_from_flags (void)
{
+ /* For some CPUs, the machine cannot be determined by ISA flags. We have to
+ check them first. */
+ switch (rs6000_cpu)
+ {
+ case PROCESSOR_PPC8540:
+ case PROCESSOR_PPC8548:
+ return "e500";
+
+ case PROCESSOR_PPCE300C2:
+ case PROCESSOR_PPCE300C3:
+ return "e300";
+
+ case PROCESSOR_PPCE500MC:
+ return "e500mc";
+
+ case PROCESSOR_PPCE500MC64:
+ return "e500mc64";
+
+ case PROCESSOR_PPCE5500:
+ return "e5500";
+
+ case PROCESSOR_PPCE6500:
+ return "e6500";
+
+ default:
+ break;
+ }
+
HOST_WIDE_INT flags = rs6000_isa_flags;
/* Disable the flags that should never influence the .machine selection. */