[Pixman] [PATCH v2 2/3] build: use '-mloongson-mmi' for Loongson MMI.

YunQiang Su wzssyqa at gmail.com
Mon Mar 9 10:21:25 UTC 2020

Matt Turner <mattst88 at gmail.com> 于2020年3月9日周一 上午8:26写道:
> On Sat, Feb 22, 2020 at 5:26 AM Shiyou Yin <yinshiyou-hf at loongson.cn> wrote:
> >
> > >-----Original Message-----
> > >From: Adam Jackson [mailto:ajax at redhat.com]
> > >Sent: Friday, February 21, 2020 11:33 PM
> > >To: Yin Shiyou; pixman at lists.freedesktop.org
> > >Subject: Re: [Pixman] [PATCH v2 2/3] build: use '-mloongson-mmi' for Loongson MMI.
> > >
> > >On Thu, 2020-02-20 at 22:23 +0800, Yin Shiyou wrote:
> > >> It's suggested to use '-mloongson-mmi' to enable MMI.
> > >> To keep compatible with old processor, '-mloongson-mmi' will be
> > >> setted for Loongson-3A only.
> > >
> > >The pattern we've used for other CPUs is to build support for as many
> > >ISA extensions as possible, unless they are explicitly disabled.
> > >Distributions tend to want to set their own minimum ISA levels, and if
> > >they wanted to assert -mloongson-mmi they would already have added it
> > >to CFLAGS globally.
> > >
> > >Do you have any performance data for this change?
> > >
> > >If setting -mloongson-mmi means the compiler can do useful
> > >autovectorization, then that's probably true for other arches too (eg
> > >amd64 vs avx2), and we should support this kind of thing more
> > >generically. But as it stands I don't think this patch is a good idea.
> > >
> > First, that's introduce the history of '-march=loongson2f' and '-mloongson-mmi'.
> > From loongson2f start, mmi is supported by loongson processor.
> > Unfortunately, the compiler's support for MMI extention is not standardized.
> > Gcc compiler use '-march=loongson2f' for loongson2f at first, but from Loongson-3A,
> > opcode of mmi instruction has changed, and '-march=loongson3a' is in replaced.
> > From last year, compile option for mmi instruction has been standardized.
> > Just like -mmsa for mips MSA. (MMI,LSX,LASX is Loongson SIMD extention.)
> > -mloongson-mmi   for MMI (-march=loongson3a still works, but -mloongson-mmi is recommended for new processors except Loongson2f. )
> > -mloongson-sx     for LSX
> > -mloongson-asx    for LASX
> >
> > Second, back to this patch itself.
> > I meet a problem when compile pixman on my Loongson3a with gcc, MMI can't be enabled.
> > configure check failure: " linking mips:loongson_2f module with previous mips:gs464 modules"
> Do you know why this is?
> Obviously we can and do build MMX, SSE2, SSSE3 paths and choose to
> execute them at runtime.
> Why does binutils not allow combining object files that are compiled
> with mixed -march=... values on mips? I cannot find the branch now,

MIPS has lots of licensees. Most of them have their extensions, and
they are vendor specific. Loongson's MMI is one of them.
It can be used only on Loongson's CPU.

> but I tried once to make pixman build pixman-mmx.c with three
> different -march=... values (2e, 2f, 3a) and choose which to execute
> at runtime, but binutils would not allow the files to be linked into
> the same binary.

The major problem for 2F and 3A here is that some of their opcode is different.

Not only Loongsn 2f vs Loongson 3A, in fact we have lots of other pairs
that will make some trouble to interlink.

> _______________________________________________
> Pixman mailing list
> Pixman at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pixman

YunQiang Su

More information about the Pixman mailing list