On Wed, 2024-11-27 at 11:58 +0800, Lulu Cheng wrote:
> > > --- /dev/null
> > > +++
> > > b/gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-shift-sameimm-vec.c
> > > @@ -0,0 +1,72 @@
> > > +/* Test shift bits overflow in vector */
> > > +/* { dg-do compile } */
> > > +/* { dg-options "-mlasx -O2" } */
> > > +/* { dg-final { scan-assembler "xvslli.b.*,1" } } */
> > Am I correct that the issue has triggered an assembler error? IIUC we
> > can change it to "dg-do assemble" and then we don't need to have all
> > those scan-assembler.
>
> Without adding this patch, the following builtin function can be
> successfully compiled, generating "vslli.b$vr 0,$vr 0,9",
>
> "9" is outside the immediate range of uimm3.:-
>
> eg :__builtin_lsx_vsll_b(_, (v16i8) {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
> 9, 9, 9, 9});
Yes I understand that, I mean:
$ ./gcc/xgcc -B gcc t.c
/tmp/ccjhHz0k.s: Assembler messages:
/tmp/ccjhHz0k.s:16: Fatal error: Immediate overflow.
format: u10:3
arg: 9
So we can use
/* { dg-do assemble } */
instead of
/* { dg-do compile } */
and then if the issue wasn't fixed we'd get an assembler error, thus we
no longer need write many scan-assembler directives to check if the
issue is fixed.
--
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University