[PATCH] mips: msa: truncate immediate shift amount [PR101922]

Xi Ruoyao xry111@mengyan1223.wang
Mon Aug 23 06:28:33 GMT 2021

On Sun, 2021-08-22 at 19:21 -0600, Jeff Law wrote:
> On 8/20/2021 11:07 AM, Xi Ruoyao via Gcc-patches wrote:
> > When -mloongson-mmi is enabled, SHIFT_COUNT_TRUNCATED is turned off.
> > This causes untruncated immediate shift amount outputed into the
> > asm,
> > and the GNU assembler refuses to assemble it.
> > 
> > Truncate immediate shift amount when outputing the asm instruction
> > to
> > make GAS happy again.
> > 
> > gcc/
> > 
> >         PR target/101922
> >         * config/mips/mips-protos.h
> > (mips_msa_output_shift_immediate):
> >           Declare.
> >         * config/mips/mips.c (mips_msa_output_shift_immediate): New
> >           function.
> >         * config/mips/mips-msa.md (vashl<mode>3, vashr<mode>3,
> >           vlshr<mode>3): Call it.
> > 
> > gcc/testsuite/
> > 
> >         PR target/101922
> >         * gcc.target/mips/pr101922.c: New test.
> OK.

Committed @ f93f0868919.

> Q. Looking out further, is it going to continue to make sense to have 
> more sense to have a distinct loongson port?

The latest Loongson processors (branded Loongson 3A5000 for desktop,
3B5000 for workstation and server, and 3C5000L for server) have moved
away from MIPS to a new RISC architecture named "LoongArch".  Its design
learnt some traits from MIPSr6 and RISC-V I think, but it's not a simple
MIPS variant and will need a new port for GCC.  A manual of LoongArch
basic instructions is at
LoongArch also have 128 and 256 bit vector insturctions, but the manual
is not published yet.

A team from Loongson is working on the port, the (experimental) source
code is available at
https://github.com/loongson/gcc/commits/loongarch-12.  It's not ready
for upstream reviewing yet.

For "legacy" Loongson processors using MIPS, I suggest to keep the
support as a MIPS extension.  I'll try to keep it in an "usable" state
(i. e. fix, or at least workaround ICE and bad assemble code like this).
If one day we can't maintain it anymore we'd have to sadly deprecate and
remove Loongson MMI support.
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University

More information about the Gcc-patches mailing list