On Wed, 2023-09-06 at 09:04 +0800, Yang Yujie wrote:
> On Tue, Sep 05, 2023 at 09:31:56PM +0800, Xi Ruoyao wrote:
> > On Thu, 2023-08-31 at 20:48 +0800, Yang Yujie wrote:
> > > * Support options for LoongArch SIMD extensions:
> > >   new configure options --with-simd={none,lsx,lasx};
> > >   new compiler option -msimd={none,lsx,lasx};
> > >   new driver options -m[no]-l[a]sx.
> > 
> > Hmm... In my build (a cross compiler configured with
> > ../gcc/configure --
> > target=loongarch64-linux-gnu --with-system-zlib) I have:
> > 
> > $ cat lasx.c
> > int x __attribute__((vector_size(32)));
> > int y __attribute__((vector_size(32)));
> > void test(void) { x += y; }
> > $ gcc/cc1 lasx.c -msimd=lasx -o- -nostdinc -mexplicit-relocs -O2
> > 
> > ... ...
> > 
> >         pcalau12i       $r12,%pc_hi20(.LANCHOR0)
> >         addi.d  $r12,$r12,%pc_lo12(.LANCHOR0)
> >         xvld    $xr0,$r12,0
> >         xvld    $xr1,$r12,32
> >         xvadd.w $xr0,$xr0,$xr1
> >         xvst    $xr0,$r12,0
> >         jr      $r1
> > 
> > ... ...
> > 
> > This seems perfectly fine.  But:
> > 
> > $ gcc/xgcc -B gcc lasx.c -mlasx -o- -nostdinc -mexplicit-relocs -O2
> > -S
> > 
> > ... ...
> > 
> > test:
> > .LFB0 = .
> >         pcalau12i       $r12,%pc_hi20(.LANCHOR0)
> >         addi.d  $r12,$r12,%pc_lo12(.LANCHOR0)
> >         addi.d  $r3,$r3,-16
> > .LCFI0 = .
> >         st.d    $r23,$r3,8
> > .LCFI1 = .
> >         ldptr.w $r7,$r12,0
> >         ldptr.w $r23,$r12,32
> >         ldptr.w $r6,$r12,8
> > 
> > ... ... (no SIMD instructions)
> > 
> > Is this a bug in the driver or I missed something?
> > 
> > -- 
> > Xi Ruoyao <xry...@xry111.site>
> > School of Aerospace Science and Technology, Xidian University
> 
> Maybe you can try deleting gcc/specs first.
> 
> It contains a modified version of self_specs that is used for building
> the libraries, which purges all user-specified "-m" options.
> This file is automatically restored prior to "make check*".

This is bad.  It makes BOOT_CFLAGS=-mlasx or CFLAGS_FOR_TARGET=-mlasx
silently ignored so we cannot test a LSX/LASX or vectorizer change with
them.

Why do we need to purge all user-specified -m options here?

-- 
Xi Ruoyao <xry...@xry111.site>
School of Aerospace Science and Technology, Xidian University

Reply via email to