]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.target/riscv/rvv/rvv.exp
1ceb10cd489cc50be5b2c1368f170345512b19a1
[thirdparty/gcc.git] / gcc / testsuite / gcc.target / riscv / rvv / rvv.exp
1 # Copyright (C) 2022-2024 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with GCC; see the file COPYING3. If not see
15 # <http://www.gnu.org/licenses/>.
16
17 # GCC testsuite that uses the `dg.exp' driver.
18
19 # Exit immediately if this isn't a RISC-V target.
20 if ![istarget riscv*-*-*] then {
21 return
22 }
23
24 # Load support procs.
25 load_lib gcc-dg.exp
26
27 # If a testcase doesn't have special options, use these.
28 global DEFAULT_CFLAGS
29 if ![info exists DEFAULT_CFLAGS] then {
30 set DEFAULT_CFLAGS " -ansi -pedantic-errors"
31 }
32
33 # Initialize `dg'.
34 dg-init
35
36 # Main loop.
37 set CFLAGS "$DEFAULT_CFLAGS -O3"
38 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/base/*.\[cS\]]] \
39 "" $CFLAGS
40 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vsetvl/*.\[cS\]]] \
41 "" $CFLAGS
42 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/*.\[cS\]]] \
43 "-O3 -ftree-vectorize" $CFLAGS
44 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/vls/*.\[cS\]]] \
45 "-O3 -ftree-vectorize --param riscv-autovec-preference=scalable" $CFLAGS
46 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/struct/*.\[cS\]]] \
47 "" "-O3 -ftree-vectorize"
48
49 set AUTOVEC_TEST_OPTS [list \
50 {-ftree-vectorize -O3 --param riscv-autovec-lmul=m1} \
51 {-ftree-vectorize -O3 --param riscv-autovec-lmul=m2} \
52 {-ftree-vectorize -O3 --param riscv-autovec-lmul=m4} \
53 {-ftree-vectorize -O3 --param riscv-autovec-lmul=m8} \
54 {-ftree-vectorize -O3 --param riscv-autovec-lmul=dynamic} \
55 {-ftree-vectorize -O2 --param riscv-autovec-lmul=m1} \
56 {-ftree-vectorize -O2 --param riscv-autovec-lmul=m2} \
57 {-ftree-vectorize -O2 --param riscv-autovec-lmul=m4} \
58 {-ftree-vectorize -O2 --param riscv-autovec-lmul=m8} \
59 {-ftree-vectorize -O2 --param riscv-autovec-lmul=dynamic} ]
60 foreach op $AUTOVEC_TEST_OPTS {
61 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/partial/*.\[cS\]]] \
62 "" "$op"
63 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/binop/*.\[cS\]]] \
64 "" "$op"
65 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/cmp/*.\[cS\]]] \
66 "" "$op"
67 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/conversions/*.\[cS\]]] \
68 "" "$op"
69 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/unop/*.\[cS\]]] \
70 "" "$op"
71 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/ternop/*.\[cS\]]] \
72 "" "$op"
73 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/reduc/*.\[cS\]]] \
74 "" "$op"
75 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/cond/*.\[cS\]]] \
76 "" "$op"
77 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/builtin/*.\[cS\]]] \
78 "" "$op"
79 }
80
81 # widening operation only test on LMUL < 8
82 set AUTOVEC_TEST_OPTS [list \
83 {-ftree-vectorize -O3 --param riscv-autovec-lmul=m1} \
84 {-ftree-vectorize -O3 --param riscv-autovec-lmul=m2} \
85 {-ftree-vectorize -O3 --param riscv-autovec-lmul=m4} \
86 {-ftree-vectorize -O2 --param riscv-autovec-lmul=m1} \
87 {-ftree-vectorize -O2 --param riscv-autovec-lmul=m2} \
88 {-ftree-vectorize -O2 --param riscv-autovec-lmul=m4} ]
89 foreach op $AUTOVEC_TEST_OPTS {
90 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/widen/*.\[cS\]]] \
91 "" "$op"
92 }
93
94 # VLS-VLMAX tests
95 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/vls-vlmax/*.\[cS\]]] \
96 "-std=c99 -O3 -ftree-vectorize --param riscv-autovec-preference=fixed-vlmax" $CFLAGS
97
98 # gather-scatter tests
99 set AUTOVEC_TEST_OPTS [list \
100 {-ftree-vectorize -O3 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m1 -fno-vect-cost-model -ffast-math} \
101 {-ftree-vectorize -O3 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m2 -fno-vect-cost-model -ffast-math} \
102 {-ftree-vectorize -O3 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m4 -fno-vect-cost-model -ffast-math} \
103 {-ftree-vectorize -O3 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m8 -fno-vect-cost-model -ffast-math} \
104 {-ftree-vectorize -O3 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=dynamic -ffast-math} \
105 {-ftree-vectorize -O2 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m1 -fno-vect-cost-model -ffast-math} \
106 {-ftree-vectorize -O2 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m2 -fno-vect-cost-model -ffast-math} \
107 {-ftree-vectorize -O2 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m4 -fno-vect-cost-model -ffast-math} \
108 {-ftree-vectorize -O2 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m8 -fno-vect-cost-model -ffast-math} \
109 {-ftree-vectorize -O2 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=dynamic -ffast-math} \
110 {-ftree-vectorize -O3 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m1 -fno-vect-cost-model -ffast-math} \
111 {-ftree-vectorize -O3 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m2 -fno-vect-cost-model -ffast-math} \
112 {-ftree-vectorize -O3 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m4 -fno-vect-cost-model -ffast-math} \
113 {-ftree-vectorize -O3 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m8 -fno-vect-cost-model -ffast-math} \
114 {-ftree-vectorize -O3 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=dynamic -ffast-math} \
115 {-ftree-vectorize -O2 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m1 -fno-vect-cost-model -ffast-math} \
116 {-ftree-vectorize -O2 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m2 -fno-vect-cost-model -ffast-math} \
117 {-ftree-vectorize -O2 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m4 -fno-vect-cost-model -ffast-math} \
118 {-ftree-vectorize -O2 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m8 -fno-vect-cost-model -ffast-math} \
119 {-ftree-vectorize -O2 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=dynamic -ffast-math} ]
120 foreach op $AUTOVEC_TEST_OPTS {
121 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/gather-scatter/*.\[cS\]]] \
122 "" "$op"
123 }
124
125 # All done.
126 dg-finish