Hi Segher!
Thanks for the comments again!
on 2022/10/4 05:15, Segher Boessenkool wrote:
> On Fri, Sep 30, 2022 at 08:15:37PM +0800, Kewen.Lin wrote:
>> on 2022/9/30 01:11, Segher Boessenkool wrote:
>>>> +#ifdef OS_MISSING_POWERPC64
>>>> + else if (OS_MISSING_POWERPC64)
>>>> + /* It's unexpected to have OPTION_MASK_POWERPC64 on for OSes which
>>>> + miss powerpc64 support, so disable it. */
>>>> + rs6000_isa_flags &= ~OPTION_MASK_POWERPC64;
>>>> +#endif
>>>
>>> All silent stuff is always bad.
>>
>> OK, with more testings for replacing warning instead of silently disablement
>> I noticed that some disablement is needed, one typical case is -m32
>> compilation
>> on ppc64, we have OPTION_MASK_POWERPC64 on from TARGET_DEFAULT which is used
>> for initialization (It makes sense to have it on in TARGET_DEFAULT because
>> of it's 64 bit cpu). And -m32 compilation matches OS_MISSING_POWERPC64
>> (!TARGET_64BIT), so it's the case that we have an implicit
>> OPTION_MASK_POWERPC64
>> on and OS_MISSING_POWERPC64 holds, but it's unexpected not to disable it but
>> warn it.
>
> Right. If If mpowerpc64 is enabled while OS_MISSING_POWERPC64, warn for
> that;
>
Currently if option powerpc64 is enabled explicitly while OS_MISSING_POWERPC64,
there is no warning. One typical case is -m32 compilation on ppc64. I made
a patch to warn for this case as you suggested (btw, this change can be taken
separately from this rework), it caused some test cases to fail as below:
gcc.dg/vect/vect-82_64.c
gcc.dg/vect/vect-83_64.c
gcc.target/powerpc/bswap64-4.c
gcc.target/powerpc/ppc64-double-1.c
gcc.target/powerpc/pr106680-4.c
gcc.target/powerpc/rs6000-fpint-2.c
It's fine to fix them with one additional option "-w" to disable the warning.
But IIUC one concern is that if we want to test with "--target_board=unix'{-m32,
-m32/-mpowerpc64}'", the latter combination will always have this warning,
with one extra "-w" (that is -m32/-mpowerpc64/-w) can make some cases which
aim to check warning msg ineffective. So maybe we want to re-consider it
(like just leaving it as before)?
> and if mpowerpc64 was only implicit, disable it as well (and say
> we did!)
But on ppc64 linux, for -m32 compilation mpowerpc64 is implicitly enabled
since it's with bi-arch supported, I made a patch to disable it as well as
warn it, it can't be bootstrapped since it warned for -m32 build (-Werror)
and failed. So I refined it to something like:
+ /* With RS6000_BI_ARCH defined (bi-architecture (32/64) supported),
+ TARGET_DEFAULT has bit MASK_POWERPC64 on by default, to keep the
+ behavior consistent (like: no warnings for -m32 on ppc64), we
+ just sliently disable it. Otherwise, disable it and warn. */
+ rs6000_isa_flags &= ~OPTION_MASK_POWERPC64;
+#ifndef RS6000_BI_ARCH
+ warning (0, "powerpc64 is unexpected to be enabled on the "
+ "current OS");
+#endif
BR,
Kewen