Re: [PATCH 5/8] MIPS: mipsregs: Parse fp and sp register by name in parse_r

Jiaxun Yang
2023-04-21T11:38:21Z

> 2023年4月21日 11:48，Thomas Bogendoerfer <tsbogend@alpha.franken.de> 写道：
>
> On Sun, Apr 09, 2023 at 11:43:06AM +0100, Jiaxun Yang wrote:
>> parse_r helper is used to parse register number from oprand,
>> it only handles oprand which use number to refer register before.
>>
>> However compiler may use $gp and $sp to reference register 29 and
>> 30. Handle this situation by adding relevant match name.
>
> are you sure the compiler is doing that ? Which compiler is this ?
> To me this feels more like missing #defines from asm/regdef.h for
> some inline assembly stuff...

Yes, clang is doing that, see[1].

There is no inline assembly mentioning $fp for cfcmsa but clang is still generating $fp for
cfcmsa.

I was able to reproduce this by dumping assembly generated by clang, but I’m
unable to reproduce it for now, it seems like clang will only allocate $fp in rare cases.

[1]: https://lore.kernel.org/all/202210180436.ruWBhXRe-lkp@intel.com/

Thanks
- Jiaxun

>
> Thomas.
>
> --
> Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
> good idea. [ RFC1925, 2.3 ]