1.Added dg-do compile on LoongArch. When binutils does not support vector instruction sets, an error occurs because the assembler does not recognize vector instructions.
2.Added "-mlsx" option for vectorization on LoongArch. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/gen-vect-2.c: Added detection of compilation behavior and "-mlsx" option on LoongArch. * gcc.dg/tree-ssa/gen-vect-25.c: Dito. --- gcc/testsuite/gcc.dg/tree-ssa/gen-vect-2.c | 2 ++ gcc/testsuite/gcc.dg/tree-ssa/gen-vect-25.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-2.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-2.c index b84f3184427..a35999a172a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-2.c @@ -1,6 +1,8 @@ /* { dg-do run { target vect_cmdline_needed } } */ +/* { dg-do compile { target { loongarch_sx && {! loongarch_sx_hw } } } } */ /* { dg-options "-O2 -fno-tree-loop-distribute-patterns -ftree-vectorize -fdump-tree-vect-details -fvect-cost-model=dynamic" } */ /* { dg-additional-options "-mno-sse" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-additional-options "-mlsx" { target { loongarch*-*-* } } } */ #include <stdlib.h> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-25.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-25.c index 18fe1aa1502..9f14a54c413 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-25.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-25.c @@ -1,6 +1,8 @@ /* { dg-do run { target vect_cmdline_needed } } */ +/* { dg-do compile { target { loongarch_sx && {! loongarch_sx_hw } } } } */ /* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-details -fvect-cost-model=dynamic" } */ /* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-details -fvect-cost-model=dynamic -mno-sse" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-additional-options "-mlsx" { target { loongarch*-*-* } } } */ #include <stdlib.h> -- 2.20.1