From: Ju-Zhe Zhong Date: Wed, 14 Dec 2022 08:19:35 +0000 (+0800) Subject: RISC-V: Add testcases for VSETVL PASS 4 X-Git-Tag: upstream/13.1.0~2454 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5a1b66b77cfbf617494e1baad8cbf0fd2d1a0c54;p=platform%2Fupstream%2Fgcc.git RISC-V: Add testcases for VSETVL PASS 4 gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-1.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-10.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-11.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-12.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-13.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-14.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-15.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-16.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-17.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-18.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-19.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-2.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-20.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-21.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-22.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-23.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-24.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-25.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-26.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-27.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-28.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-3.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-4.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-5.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-6.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-7.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-8.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-9.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_call-1.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_call-2.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_call-3.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_call-4.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_complex_loop-1.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_complex_loop-2.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-1.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-10.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-11.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-12.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-2.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-3.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-4.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-5.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-6.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-7.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-8.c: New test. * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-9.c: New test. --- diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-1.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-1.c new file mode 100644 index 0000000..4e4e16c --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-1.c @@ -0,0 +1,182 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint8mf8_t v = *(vint8mf8_t*)(in + 500); + *(vint8mf8_t*)(out + 500) = v; + } else if (n == 1) { + vint8mf8_t v = *(vint8mf8_t*)(in + 600); + *(vint8mf8_t*)(out + 600) = v; + } else { + vint8mf8_t v = *(vint8mf8_t*)(in + 700); + *(vint8mf8_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf8_t v = *(vint8mf8_t*)(in + 900 + i); + *(vint8mf8_t*)(out + 900 + i) = v; + } +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint8mf4_t v = *(vint8mf4_t*)(in + 500); + *(vint8mf4_t*)(out + 500) = v; + } else if (n == 1) { + vint8mf4_t v = *(vint8mf4_t*)(in + 600); + *(vint8mf4_t*)(out + 600) = v; + } else { + vint8mf4_t v = *(vint8mf4_t*)(in + 700); + *(vint8mf4_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf4_t v = *(vint8mf4_t*)(in + 900 + i); + *(vint8mf4_t*)(out + 900 + i) = v; + } +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint8mf2_t v = *(vint8mf2_t*)(in + 500); + *(vint8mf2_t*)(out + 500) = v; + } else if (n == 1) { + vint8mf2_t v = *(vint8mf2_t*)(in + 600); + *(vint8mf2_t*)(out + 600) = v; + } else { + vint8mf2_t v = *(vint8mf2_t*)(in + 700); + *(vint8mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf2_t v = *(vint8mf2_t*)(in + 900 + i); + *(vint8mf2_t*)(out + 900 + i) = v; + } +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint16mf4_t v = *(vint16mf4_t*)(in + 500); + *(vint16mf4_t*)(out + 500) = v; + } else if (n == 1) { + vint16mf4_t v = *(vint16mf4_t*)(in + 600); + *(vint16mf4_t*)(out + 600) = v; + } else { + vint16mf4_t v = *(vint16mf4_t*)(in + 700); + *(vint16mf4_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf4_t v = *(vint16mf4_t*)(in + 900 + i); + *(vint16mf4_t*)(out + 900 + i) = v; + } +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint16mf2_t v = *(vint16mf2_t*)(in + 500); + *(vint16mf2_t*)(out + 500) = v; + } else if (n == 1) { + vint16mf2_t v = *(vint16mf2_t*)(in + 600); + *(vint16mf2_t*)(out + 600) = v; + } else { + vint16mf2_t v = *(vint16mf2_t*)(in + 700); + *(vint16mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf2_t v = *(vint16mf2_t*)(in + 900 + i); + *(vint16mf2_t*)(out + 900 + i) = v; + } +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint32mf2_t v = *(vint32mf2_t*)(in + 500); + *(vint32mf2_t*)(out + 500) = v; + } else if (n == 1) { + vint32mf2_t v = *(vint32mf2_t*)(in + 600); + *(vint32mf2_t*)(out + 600) = v; + } else { + vint32mf2_t v = *(vint32mf2_t*)(in + 700); + *(vint32mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint32mf2_t v = *(vint32mf2_t*)(in + 900 + i); + *(vint32mf2_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-10.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-10.c new file mode 100644 index 0000000..f78c348 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-10.c @@ -0,0 +1,230 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint8mf8_t v = *(vint8mf8_t*)(in + 500); + *(vint8mf8_t*)(out + 500) = v; + break; + } + case 1:{ + vint8mf8_t v = *(vint8mf8_t*)(in + 500); + *(vint8mf8_t*)(out + 500) = v; + break; + } + default:{ + vint8mf8_t v = *(vint8mf8_t*)(in + 700); + *(vint8mf8_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf8_t v = *(vint8mf8_t*)(in + 900 + i); + *(vint8mf8_t*)(out + 900 + i) = v; + } +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint8mf4_t v = *(vint8mf4_t*)(in + 500); + *(vint8mf4_t*)(out + 500) = v; + break; + } + case 1:{ + vint8mf4_t v = *(vint8mf4_t*)(in + 500); + *(vint8mf4_t*)(out + 500) = v; + break; + } + default:{ + vint8mf4_t v = *(vint8mf4_t*)(in + 700); + *(vint8mf4_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf4_t v = *(vint8mf4_t*)(in + 900 + i); + *(vint8mf4_t*)(out + 900 + i) = v; + } +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint8mf2_t v = *(vint8mf2_t*)(in + 500); + *(vint8mf2_t*)(out + 500) = v; + break; + } + case 1:{ + vint8mf2_t v = *(vint8mf2_t*)(in + 500); + *(vint8mf2_t*)(out + 500) = v; + break; + } + default:{ + vint8mf2_t v = *(vint8mf2_t*)(in + 700); + *(vint8mf2_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf2_t v = *(vint8mf2_t*)(in + 900 + i); + *(vint8mf2_t*)(out + 900 + i) = v; + } +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint16mf4_t v = *(vint16mf4_t*)(in + 500); + *(vint16mf4_t*)(out + 500) = v; + break; + } + case 1:{ + vint16mf4_t v = *(vint16mf4_t*)(in + 500); + *(vint16mf4_t*)(out + 500) = v; + break; + } + default:{ + vint16mf4_t v = *(vint16mf4_t*)(in + 700); + *(vint16mf4_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf4_t v = *(vint16mf4_t*)(in + 900 + i); + *(vint16mf4_t*)(out + 900 + i) = v; + } +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint16mf2_t v = *(vint16mf2_t*)(in + 500); + *(vint16mf2_t*)(out + 500) = v; + break; + } + case 1:{ + vint16mf2_t v = *(vint16mf2_t*)(in + 500); + *(vint16mf2_t*)(out + 500) = v; + break; + } + default:{ + vint16mf2_t v = *(vint16mf2_t*)(in + 700); + *(vint16mf2_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf2_t v = *(vint16mf2_t*)(in + 900 + i); + *(vint16mf2_t*)(out + 900 + i) = v; + } +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vuint32mf2_t v = *(vuint32mf2_t*)(in + 500); + *(vuint32mf2_t*)(out + 500) = v; + break; + } + case 1:{ + vuint32mf2_t v = *(vuint32mf2_t*)(in + 500); + *(vuint32mf2_t*)(out + 500) = v; + break; + } + default:{ + vuint32mf2_t v = *(vuint32mf2_t*)(in + 700); + *(vuint32mf2_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 900 + i); + *(vuint32mf2_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-11.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-11.c new file mode 100644 index 0000000..1dfa2e9 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-11.c @@ -0,0 +1,43 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 500); + *(vfloat32mf2_t*)(out + 500) = v; + break; + } + case 1:{ + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 500); + *(vfloat32mf2_t*)(out + 500) = v; + break; + } + default:{ + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 700); + *(vfloat32mf2_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 900 + i); + *(vfloat32mf2_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-12.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-12.c new file mode 100644 index 0000000..fed1aa3 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-12.c @@ -0,0 +1,266 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vbool64_t v = *(vbool64_t*)(in + 500); + *(vbool64_t*)(out + 500) = v; + break; + } + case 1:{ + vbool64_t v = *(vbool64_t*)(in + 500); + *(vbool64_t*)(out + 500) = v; + break; + } + default:{ + vbool64_t v = *(vbool64_t*)(in + 700); + *(vbool64_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool64_t v = *(vbool64_t*)(in + 900 + i); + *(vbool64_t*)(out + 900 + i) = v; + } +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vbool32_t v = *(vbool32_t*)(in + 500); + *(vbool32_t*)(out + 500) = v; + break; + } + case 1:{ + vbool32_t v = *(vbool32_t*)(in + 500); + *(vbool32_t*)(out + 500) = v; + break; + } + default:{ + vbool32_t v = *(vbool32_t*)(in + 700); + *(vbool32_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool32_t v = *(vbool32_t*)(in + 900 + i); + *(vbool32_t*)(out + 900 + i) = v; + } +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vbool16_t v = *(vbool16_t*)(in + 500); + *(vbool16_t*)(out + 500) = v; + break; + } + case 1:{ + vbool16_t v = *(vbool16_t*)(in + 500); + *(vbool16_t*)(out + 500) = v; + break; + } + default:{ + vbool16_t v = *(vbool16_t*)(in + 700); + *(vbool16_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool16_t v = *(vbool16_t*)(in + 900 + i); + *(vbool16_t*)(out + 900 + i) = v; + } +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vbool8_t v = *(vbool8_t*)(in + 500); + *(vbool8_t*)(out + 500) = v; + break; + } + case 1:{ + vbool8_t v = *(vbool8_t*)(in + 500); + *(vbool8_t*)(out + 500) = v; + break; + } + default:{ + vbool8_t v = *(vbool8_t*)(in + 700); + *(vbool8_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool8_t v = *(vbool8_t*)(in + 900 + i); + *(vbool8_t*)(out + 900 + i) = v; + } +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vbool4_t v = *(vbool4_t*)(in + 500); + *(vbool4_t*)(out + 500) = v; + break; + } + case 1:{ + vbool4_t v = *(vbool4_t*)(in + 500); + *(vbool4_t*)(out + 500) = v; + break; + } + default:{ + vbool4_t v = *(vbool4_t*)(in + 700); + *(vbool4_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool4_t v = *(vbool4_t*)(in + 900 + i); + *(vbool4_t*)(out + 900 + i) = v; + } +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vbool2_t v = *(vbool2_t*)(in + 500); + *(vbool2_t*)(out + 500) = v; + break; + } + case 1:{ + vbool2_t v = *(vbool2_t*)(in + 500); + *(vbool2_t*)(out + 500) = v; + break; + } + default:{ + vbool2_t v = *(vbool2_t*)(in + 700); + *(vbool2_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool2_t v = *(vbool2_t*)(in + 900 + i); + *(vbool2_t*)(out + 900 + i) = v; + } +} + +void f7 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vbool1_t v = *(vbool1_t*)(in + 500); + *(vbool1_t*)(out + 500) = v; + break; + } + case 1:{ + vbool1_t v = *(vbool1_t*)(in + 500); + *(vbool1_t*)(out + 500) = v; + break; + } + default:{ + vbool1_t v = *(vbool1_t*)(in + 700); + *(vbool1_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool1_t v = *(vbool1_t*)(in + 900 + i); + *(vbool1_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m1,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" no-opts "-O1" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-13.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-13.c new file mode 100644 index 0000000..bcf8e1c --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-13.c @@ -0,0 +1,221 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint8mf8_t v = *(vint8mf8_t*)(in + 500); + *(vint8mf8_t*)(out + 500) = v; + break; + } + case 1:{ + vint8mf8_t v = *(vint8mf8_t*)(in + 500); + *(vint8mf8_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf8_t v = *(vint8mf8_t*)(in + 900 + i); + *(vint8mf8_t*)(out + 900 + i) = v; + } +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint8mf4_t v = *(vint8mf4_t*)(in + 500); + *(vint8mf4_t*)(out + 500) = v; + break; + } + case 1:{ + vint8mf4_t v = *(vint8mf4_t*)(in + 500); + *(vint8mf4_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf4_t v = *(vint8mf4_t*)(in + 900 + i); + *(vint8mf4_t*)(out + 900 + i) = v; + } +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint8mf2_t v = *(vint8mf2_t*)(in + 500); + *(vint8mf2_t*)(out + 500) = v; + break; + } + case 1:{ + vint8mf2_t v = *(vint8mf2_t*)(in + 500); + *(vint8mf2_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf2_t v = *(vint8mf2_t*)(in + 900 + i); + *(vint8mf2_t*)(out + 900 + i) = v; + } +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint16mf4_t v = *(vint16mf4_t*)(in + 500); + *(vint16mf4_t*)(out + 500) = v; + break; + } + case 1:{ + vint16mf4_t v = *(vint16mf4_t*)(in + 500); + *(vint16mf4_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf4_t v = *(vint16mf4_t*)(in + 900 + i); + *(vint16mf4_t*)(out + 900 + i) = v; + } +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint16mf2_t v = *(vint16mf2_t*)(in + 500); + *(vint16mf2_t*)(out + 500) = v; + break; + } + case 1:{ + vint16mf2_t v = *(vint16mf2_t*)(in + 500); + *(vint16mf2_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf2_t v = *(vint16mf2_t*)(in + 900 + i); + *(vint16mf2_t*)(out + 900 + i) = v; + } +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint32mf2_t v = *(vint32mf2_t*)(in + 500); + *(vint32mf2_t*)(out + 500) = v; + break; + } + case 1:{ + vint32mf2_t v = *(vint32mf2_t*)(in + 500); + *(vint32mf2_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint32mf2_t v = *(vint32mf2_t*)(in + 900 + i); + *(vint32mf2_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-14.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-14.c new file mode 100644 index 0000000..c2a8c3b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-14.c @@ -0,0 +1,221 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vuint8mf8_t v = *(vuint8mf8_t*)(in + 500); + *(vuint8mf8_t*)(out + 500) = v; + break; + } + case 1:{ + vuint8mf8_t v = *(vuint8mf8_t*)(in + 500); + *(vuint8mf8_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 900 + i); + *(vuint8mf8_t*)(out + 900 + i) = v; + } +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vuint8mf4_t v = *(vuint8mf4_t*)(in + 500); + *(vuint8mf4_t*)(out + 500) = v; + break; + } + case 1:{ + vuint8mf4_t v = *(vuint8mf4_t*)(in + 500); + *(vuint8mf4_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 900 + i); + *(vuint8mf4_t*)(out + 900 + i) = v; + } +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vuint8mf2_t v = *(vuint8mf2_t*)(in + 500); + *(vuint8mf2_t*)(out + 500) = v; + break; + } + case 1:{ + vuint8mf2_t v = *(vuint8mf2_t*)(in + 500); + *(vuint8mf2_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 900 + i); + *(vuint8mf2_t*)(out + 900 + i) = v; + } +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vuint16mf4_t v = *(vuint16mf4_t*)(in + 500); + *(vuint16mf4_t*)(out + 500) = v; + break; + } + case 1:{ + vuint16mf4_t v = *(vuint16mf4_t*)(in + 500); + *(vuint16mf4_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 900 + i); + *(vuint16mf4_t*)(out + 900 + i) = v; + } +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vuint16mf2_t v = *(vuint16mf2_t*)(in + 500); + *(vuint16mf2_t*)(out + 500) = v; + break; + } + case 1:{ + vuint16mf2_t v = *(vuint16mf2_t*)(in + 500); + *(vuint16mf2_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 900 + i); + *(vuint16mf2_t*)(out + 900 + i) = v; + } +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vuint32mf2_t v = *(vuint32mf2_t*)(in + 500); + *(vuint32mf2_t*)(out + 500) = v; + break; + } + case 1:{ + vuint32mf2_t v = *(vuint32mf2_t*)(in + 500); + *(vuint32mf2_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 900 + i); + *(vuint32mf2_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-15.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-15.c new file mode 100644 index 0000000..e449078 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-15.c @@ -0,0 +1,41 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 500); + *(vfloat32mf2_t*)(out + 500) = v; + break; + } + case 1:{ + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 500); + *(vfloat32mf2_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 900 + i); + *(vfloat32mf2_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-16.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-16.c new file mode 100644 index 0000000..224fc2e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-16.c @@ -0,0 +1,257 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vbool64_t v = *(vbool64_t*)(in + 500); + *(vbool64_t*)(out + 500) = v; + break; + } + case 1:{ + vbool64_t v = *(vbool64_t*)(in + 500); + *(vbool64_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool64_t v = *(vbool64_t*)(in + 900 + i); + *(vbool64_t*)(out + 900 + i) = v; + } +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vbool32_t v = *(vbool32_t*)(in + 500); + *(vbool32_t*)(out + 500) = v; + break; + } + case 1:{ + vbool32_t v = *(vbool32_t*)(in + 500); + *(vbool32_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool32_t v = *(vbool32_t*)(in + 900 + i); + *(vbool32_t*)(out + 900 + i) = v; + } +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vbool16_t v = *(vbool16_t*)(in + 500); + *(vbool16_t*)(out + 500) = v; + break; + } + case 1:{ + vbool16_t v = *(vbool16_t*)(in + 500); + *(vbool16_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool16_t v = *(vbool16_t*)(in + 900 + i); + *(vbool16_t*)(out + 900 + i) = v; + } +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vbool8_t v = *(vbool8_t*)(in + 500); + *(vbool8_t*)(out + 500) = v; + break; + } + case 1:{ + vbool8_t v = *(vbool8_t*)(in + 500); + *(vbool8_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool8_t v = *(vbool8_t*)(in + 900 + i); + *(vbool8_t*)(out + 900 + i) = v; + } +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vbool4_t v = *(vbool4_t*)(in + 500); + *(vbool4_t*)(out + 500) = v; + break; + } + case 1:{ + vbool4_t v = *(vbool4_t*)(in + 500); + *(vbool4_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool4_t v = *(vbool4_t*)(in + 900 + i); + *(vbool4_t*)(out + 900 + i) = v; + } +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vbool2_t v = *(vbool2_t*)(in + 500); + *(vbool2_t*)(out + 500) = v; + break; + } + case 1:{ + vbool2_t v = *(vbool2_t*)(in + 500); + *(vbool2_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool2_t v = *(vbool2_t*)(in + 900 + i); + *(vbool2_t*)(out + 900 + i) = v; + } +} + +void f7 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vbool1_t v = *(vbool1_t*)(in + 500); + *(vbool1_t*)(out + 500) = v; + break; + } + case 1:{ + vbool1_t v = *(vbool1_t*)(in + 500); + *(vbool1_t*)(out + 500) = v; + break; + } + default:{ + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool1_t v = *(vbool1_t*)(in + 900 + i); + *(vbool1_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m1,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m1,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]\s+\.L[0-9][0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-17.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-17.c new file mode 100644 index 0000000..7cbabab --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-17.c @@ -0,0 +1,177 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vint8mf8_t v = *(vint8mf8_t*)(in + 100); + *(vint8mf8_t*)(out + 100) = v; + } + else + { + vint8mf8_t v = *(vint8mf8_t*)(in + 200); + *(vint8mf8_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vint8mf8_t v = *(vint8mf8_t*)(in + i); + *(vint8mf8_t*)(out + i) = v; + } +} + +void f2 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vint8mf4_t v = *(vint8mf4_t*)(in + 100); + *(vint8mf4_t*)(out + 100) = v; + } + else + { + vint8mf4_t v = *(vint8mf4_t*)(in + 200); + *(vint8mf4_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vint8mf4_t v = *(vint8mf4_t*)(in + i); + *(vint8mf4_t*)(out + i) = v; + } +} + +void f3 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vint8mf2_t v = *(vint8mf2_t*)(in + 100); + *(vint8mf2_t*)(out + 100) = v; + } + else + { + vint8mf2_t v = *(vint8mf2_t*)(in + 200); + *(vint8mf2_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vint8mf2_t v = *(vint8mf2_t*)(in + i); + *(vint8mf2_t*)(out + i) = v; + } +} + +void f4 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vint16mf4_t v = *(vint16mf4_t*)(in + 100); + *(vint16mf4_t*)(out + 100) = v; + } + else + { + vint16mf4_t v = *(vint16mf4_t*)(in + 200); + *(vint16mf4_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vint16mf4_t v = *(vint16mf4_t*)(in + i); + *(vint16mf4_t*)(out + i) = v; + } +} + +void f5 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vint16mf2_t v = *(vint16mf2_t*)(in + 100); + *(vint16mf2_t*)(out + 100) = v; + } + else + { + vint16mf2_t v = *(vint16mf2_t*)(in + 200); + *(vint16mf2_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vint16mf2_t v = *(vint16mf2_t*)(in + i); + *(vint16mf2_t*)(out + i) = v; + } +} + +void f6 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vint32mf2_t v = *(vint32mf2_t*)(in + 100); + *(vint32mf2_t*)(out + 100) = v; + } + else + { + vint32mf2_t v = *(vint32mf2_t*)(in + 200); + *(vint32mf2_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vint32mf2_t v = *(vint32mf2_t*)(in + i); + *(vint32mf2_t*)(out + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-18.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-18.c new file mode 100644 index 0000000..cfaba79 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-18.c @@ -0,0 +1,177 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 100); + *(vuint8mf8_t*)(out + 100) = v; + } + else + { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 200); + *(vuint8mf8_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vuint8mf8_t v = *(vuint8mf8_t*)(in + i); + *(vuint8mf8_t*)(out + i) = v; + } +} + +void f2 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 100); + *(vuint8mf4_t*)(out + 100) = v; + } + else + { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 200); + *(vuint8mf4_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vuint8mf4_t v = *(vuint8mf4_t*)(in + i); + *(vuint8mf4_t*)(out + i) = v; + } +} + +void f3 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 100); + *(vuint8mf2_t*)(out + 100) = v; + } + else + { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 200); + *(vuint8mf2_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vuint8mf2_t v = *(vuint8mf2_t*)(in + i); + *(vuint8mf2_t*)(out + i) = v; + } +} + +void f4 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 100); + *(vuint16mf4_t*)(out + 100) = v; + } + else + { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 200); + *(vuint16mf4_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vuint16mf4_t v = *(vuint16mf4_t*)(in + i); + *(vuint16mf4_t*)(out + i) = v; + } +} + +void f5 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 100); + *(vuint16mf2_t*)(out + 100) = v; + } + else + { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 200); + *(vuint16mf2_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vuint16mf2_t v = *(vuint16mf2_t*)(in + i); + *(vuint16mf2_t*)(out + i) = v; + } +} + +void f6 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 100); + *(vuint32mf2_t*)(out + 100) = v; + } + else + { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 200); + *(vuint32mf2_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vuint32mf2_t v = *(vuint32mf2_t*)(in + i); + *(vuint32mf2_t*)(out + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-19.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-19.c new file mode 100644 index 0000000..4ea46c7 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-19.c @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f6 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 100); + *(vfloat32mf2_t*)(out + 100) = v; + } + else + { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 200); + *(vfloat32mf2_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + i); + *(vfloat32mf2_t*)(out + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-2.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-2.c new file mode 100644 index 0000000..4e478a8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-2.c @@ -0,0 +1,182 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 500); + *(vuint8mf8_t*)(out + 500) = v; + } else if (n == 1) { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 600); + *(vuint8mf8_t*)(out + 600) = v; + } else { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 700); + *(vuint8mf8_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 900 + i); + *(vuint8mf8_t*)(out + 900 + i) = v; + } +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 500); + *(vuint8mf4_t*)(out + 500) = v; + } else if (n == 1) { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 600); + *(vuint8mf4_t*)(out + 600) = v; + } else { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 700); + *(vuint8mf4_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 900 + i); + *(vuint8mf4_t*)(out + 900 + i) = v; + } +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 500); + *(vuint8mf2_t*)(out + 500) = v; + } else if (n == 1) { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 600); + *(vuint8mf2_t*)(out + 600) = v; + } else { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 700); + *(vuint8mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 900 + i); + *(vuint8mf2_t*)(out + 900 + i) = v; + } +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 500); + *(vuint16mf4_t*)(out + 500) = v; + } else if (n == 1) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 600); + *(vuint16mf4_t*)(out + 600) = v; + } else { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 700); + *(vuint16mf4_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 900 + i); + *(vuint16mf4_t*)(out + 900 + i) = v; + } +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 500); + *(vuint16mf2_t*)(out + 500) = v; + } else if (n == 1) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 600); + *(vuint16mf2_t*)(out + 600) = v; + } else { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 700); + *(vuint16mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 900 + i); + *(vuint16mf2_t*)(out + 900 + i) = v; + } +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 500); + *(vuint32mf2_t*)(out + 500) = v; + } else if (n == 1) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 600); + *(vuint32mf2_t*)(out + 600) = v; + } else { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 700); + *(vuint32mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 900 + i); + *(vuint32mf2_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" no-opts "-O1" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-20.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-20.c new file mode 100644 index 0000000..9562d8f --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-20.c @@ -0,0 +1,203 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vbool64_t v = *(vbool64_t*)(in + 100); + *(vbool64_t*)(out + 100) = v; + } + else + { + vbool64_t v = *(vbool64_t*)(in + 200); + *(vbool64_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vbool64_t v = *(vbool64_t*)(in + i); + *(vbool64_t*)(out + i) = v; + } +} + +void f2 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vbool32_t v = *(vbool32_t*)(in + 100); + *(vbool32_t*)(out + 100) = v; + } + else + { + vbool32_t v = *(vbool32_t*)(in + 200); + *(vbool32_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vbool32_t v = *(vbool32_t*)(in + i); + *(vbool32_t*)(out + i) = v; + } +} + +void f3 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vbool16_t v = *(vbool16_t*)(in + 100); + *(vbool16_t*)(out + 100) = v; + } + else + { + vbool16_t v = *(vbool16_t*)(in + 200); + *(vbool16_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vbool16_t v = *(vbool16_t*)(in + i); + *(vbool16_t*)(out + i) = v; + } +} + +void f4 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vbool8_t v = *(vbool8_t*)(in + 100); + *(vbool8_t*)(out + 100) = v; + } + else + { + vbool8_t v = *(vbool8_t*)(in + 200); + *(vbool8_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vbool8_t v = *(vbool8_t*)(in + i); + *(vbool8_t*)(out + i) = v; + } +} + +void f5 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vbool4_t v = *(vbool4_t*)(in + 100); + *(vbool4_t*)(out + 100) = v; + } + else + { + vbool4_t v = *(vbool4_t*)(in + 200); + *(vbool4_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vbool4_t v = *(vbool4_t*)(in + i); + *(vbool4_t*)(out + i) = v; + } +} + +void f6 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vbool2_t v = *(vbool2_t*)(in + 100); + *(vbool2_t*)(out + 100) = v; + } + else + { + vbool2_t v = *(vbool2_t*)(in + 200); + *(vbool2_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vbool2_t v = *(vbool2_t*)(in + i); + *(vbool2_t*)(out + i) = v; + } +} + +void f7 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vbool1_t v = *(vbool1_t*)(in + 100); + *(vbool1_t*)(out + 100) = v; + } + else + { + vbool1_t v = *(vbool1_t*)(in + 200); + *(vbool1_t*)(out + 200) = v; + if (cond == 2) + { + out[1000] = 8000; + } + else + { + out[2000] = 9000; + } + } + for (int i = 0; i < n; i++) + { + vbool1_t v = *(vbool1_t*)(in + i); + *(vbool1_t*)(out + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m1,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 6 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-21.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-21.c new file mode 100644 index 0000000..198b72f --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-21.c @@ -0,0 +1,155 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vint8mf8_t v = *(vint8mf8_t*)(in + 100); + *(vint8mf8_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vint8mf8_t v = *(vint8mf8_t*)(in + 200); + *(vint8mf8_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vint8mf8_t v = *(vint8mf8_t*)(in + i); + *(vint8mf8_t*)(out + i) = v; + } +} + +void f2 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vint8mf4_t v = *(vint8mf4_t*)(in + 100); + *(vint8mf4_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vint8mf4_t v = *(vint8mf4_t*)(in + 200); + *(vint8mf4_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vint8mf4_t v = *(vint8mf4_t*)(in + i); + *(vint8mf4_t*)(out + i) = v; + } +} + +void f3 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vint8mf2_t v = *(vint8mf2_t*)(in + 100); + *(vint8mf2_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vint8mf2_t v = *(vint8mf2_t*)(in + 200); + *(vint8mf2_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vint8mf2_t v = *(vint8mf2_t*)(in + i); + *(vint8mf2_t*)(out + i) = v; + } +} + +void f4 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vint16mf4_t v = *(vint16mf4_t*)(in + 100); + *(vint16mf4_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vint16mf4_t v = *(vint16mf4_t*)(in + 200); + *(vint16mf4_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vint16mf4_t v = *(vint16mf4_t*)(in + i); + *(vint16mf4_t*)(out + i) = v; + } +} + +void f5 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vint16mf2_t v = *(vint16mf2_t*)(in + 100); + *(vint16mf2_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vint16mf2_t v = *(vint16mf2_t*)(in + 200); + *(vint16mf2_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vint16mf2_t v = *(vint16mf2_t*)(in + i); + *(vint16mf2_t*)(out + i) = v; + } +} + +void f6 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vint32mf2_t v = *(vint32mf2_t*)(in + 100); + *(vint32mf2_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vint32mf2_t v = *(vint32mf2_t*)(in + 200); + *(vint32mf2_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vint32mf2_t v = *(vint32mf2_t*)(in + i); + *(vint32mf2_t*)(out + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]\s+\.L[0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-22.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-22.c new file mode 100644 index 0000000..ca20f2f --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-22.c @@ -0,0 +1,155 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 100); + *(vuint8mf8_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 200); + *(vuint8mf8_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vuint8mf8_t v = *(vuint8mf8_t*)(in + i); + *(vuint8mf8_t*)(out + i) = v; + } +} + +void f2 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 100); + *(vuint8mf4_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 200); + *(vuint8mf4_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vuint8mf4_t v = *(vuint8mf4_t*)(in + i); + *(vuint8mf4_t*)(out + i) = v; + } +} + +void f3 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 100); + *(vuint8mf2_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 200); + *(vuint8mf2_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vuint8mf2_t v = *(vuint8mf2_t*)(in + i); + *(vuint8mf2_t*)(out + i) = v; + } +} + +void f4 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 100); + *(vuint16mf4_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 200); + *(vuint16mf4_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vuint16mf4_t v = *(vuint16mf4_t*)(in + i); + *(vuint16mf4_t*)(out + i) = v; + } +} + +void f5 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 100); + *(vuint16mf2_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 200); + *(vuint16mf2_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vuint16mf2_t v = *(vuint16mf2_t*)(in + i); + *(vuint16mf2_t*)(out + i) = v; + } +} + +void f6 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 100); + *(vuint32mf2_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 200); + *(vuint32mf2_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vuint32mf2_t v = *(vuint32mf2_t*)(in + i); + *(vuint32mf2_t*)(out + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]\s+\.L[0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-23.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-23.c new file mode 100644 index 0000000..ecd8a20 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-23.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 100); + *(vuint32mf2_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 200); + *(vuint32mf2_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vuint32mf2_t v = *(vuint32mf2_t*)(in + i); + *(vuint32mf2_t*)(out + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-24.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-24.c new file mode 100644 index 0000000..a9ed211 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-24.c @@ -0,0 +1,180 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vbool64_t v = *(vbool64_t*)(in + 100); + *(vbool64_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vbool64_t v = *(vbool64_t*)(in + 200); + *(vbool64_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vbool64_t v = *(vbool64_t*)(in + i); + *(vbool64_t*)(out + i) = v; + } +} + +void f2 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vbool32_t v = *(vbool32_t*)(in + 100); + *(vbool32_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vbool32_t v = *(vbool32_t*)(in + 200); + *(vbool32_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vbool32_t v = *(vbool32_t*)(in + i); + *(vbool32_t*)(out + i) = v; + } +} + +void f3 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vbool16_t v = *(vbool16_t*)(in + 100); + *(vbool16_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vbool16_t v = *(vbool16_t*)(in + 200); + *(vbool16_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vbool16_t v = *(vbool16_t*)(in + i); + *(vbool16_t*)(out + i) = v; + } +} + +void f4 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vbool8_t v = *(vbool8_t*)(in + 100); + *(vbool8_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vbool8_t v = *(vbool8_t*)(in + 200); + *(vbool8_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vbool8_t v = *(vbool8_t*)(in + i); + *(vbool8_t*)(out + i) = v; + } +} + +void f5 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vbool4_t v = *(vbool4_t*)(in + 100); + *(vbool4_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vbool4_t v = *(vbool4_t*)(in + 200); + *(vbool4_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vbool4_t v = *(vbool4_t*)(in + i); + *(vbool4_t*)(out + i) = v; + } +} + +void f6 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vbool2_t v = *(vbool2_t*)(in + 100); + *(vbool2_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vbool2_t v = *(vbool2_t*)(in + 200); + *(vbool2_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vbool2_t v = *(vbool2_t*)(in + i); + *(vbool2_t*)(out + i) = v; + } +} + +void f7 (int * restrict in, int * restrict out, int n, int cond) +{ + if (cond == 1) + { + vbool1_t v = *(vbool1_t*)(in + 100); + *(vbool1_t*)(out + 100) = v; + } + else + { + if (cond == 2) + { + vbool1_t v = *(vbool1_t*)(in + 200); + *(vbool1_t*)(out + 200) = v; + out[1000] = 8000; + } + } + for (int i = 0; i < n; i++) + { + vbool1_t v = *(vbool1_t*)(in + i); + *(vbool1_t*)(out + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m1,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]\s+\.L[0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m1,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-25.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-25.c new file mode 100644 index 0000000..f87a8cc --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-25.c @@ -0,0 +1,572 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool64_t v = *(vbool64_t*)(in + 500); + *(vbool64_t*)(out + 500) = v; + } else if (n == 1) { + vbool64_t v = *(vbool64_t*)(in + 600); + *(vbool64_t*)(out + 600) = v; + } else { + vbool64_t v = *(vbool64_t*)(in + 700); + *(vbool64_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool64_t v = *(vbool64_t*)(in + 900 + i); + *(vbool64_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vbool64_t v = *(vbool64_t*)(in + 500); + *(vbool64_t*)(out + 500) = v; + } else if (n == 1) { + vbool64_t v = *(vbool64_t*)(in + 600); + *(vbool64_t*)(out + 600) = v; + } else { + vbool64_t v = *(vbool64_t*)(in + 700); + *(vbool64_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool64_t v = *(vbool64_t*)(in + 900 + i); + *(vbool64_t*)(out + 900 + i) = v; + } +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool32_t v = *(vbool32_t*)(in + 500); + *(vbool32_t*)(out + 500) = v; + } else if (n == 1) { + vbool32_t v = *(vbool32_t*)(in + 600); + *(vbool32_t*)(out + 600) = v; + } else { + vbool32_t v = *(vbool32_t*)(in + 700); + *(vbool32_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool32_t v = *(vbool32_t*)(in + 900 + i); + *(vbool32_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vbool32_t v = *(vbool32_t*)(in + 500); + *(vbool32_t*)(out + 500) = v; + } else if (n == 1) { + vbool32_t v = *(vbool32_t*)(in + 600); + *(vbool32_t*)(out + 600) = v; + } else { + vbool32_t v = *(vbool32_t*)(in + 700); + *(vbool32_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool32_t v = *(vbool32_t*)(in + 900 + i); + *(vbool32_t*)(out + 900 + i) = v; + } +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool16_t v = *(vbool16_t*)(in + 500); + *(vbool16_t*)(out + 500) = v; + } else if (n == 1) { + vbool16_t v = *(vbool16_t*)(in + 600); + *(vbool16_t*)(out + 600) = v; + } else { + vbool16_t v = *(vbool16_t*)(in + 700); + *(vbool16_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool16_t v = *(vbool16_t*)(in + 900 + i); + *(vbool16_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vbool16_t v = *(vbool16_t*)(in + 500); + *(vbool16_t*)(out + 500) = v; + } else if (n == 1) { + vbool16_t v = *(vbool16_t*)(in + 600); + *(vbool16_t*)(out + 600) = v; + } else { + vbool16_t v = *(vbool16_t*)(in + 700); + *(vbool16_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool16_t v = *(vbool16_t*)(in + 900 + i); + *(vbool16_t*)(out + 900 + i) = v; + } +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool8_t v = *(vbool8_t*)(in + 500); + *(vbool8_t*)(out + 500) = v; + } else if (n == 1) { + vbool8_t v = *(vbool8_t*)(in + 600); + *(vbool8_t*)(out + 600) = v; + } else { + vbool8_t v = *(vbool8_t*)(in + 700); + *(vbool8_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool8_t v = *(vbool8_t*)(in + 900 + i); + *(vbool8_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vbool8_t v = *(vbool8_t*)(in + 500); + *(vbool8_t*)(out + 500) = v; + } else if (n == 1) { + vbool8_t v = *(vbool8_t*)(in + 600); + *(vbool8_t*)(out + 600) = v; + } else { + vbool8_t v = *(vbool8_t*)(in + 700); + *(vbool8_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool8_t v = *(vbool8_t*)(in + 900 + i); + *(vbool8_t*)(out + 900 + i) = v; + } +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool4_t v = *(vbool4_t*)(in + 500); + *(vbool4_t*)(out + 500) = v; + } else if (n == 1) { + vbool4_t v = *(vbool4_t*)(in + 600); + *(vbool4_t*)(out + 600) = v; + } else { + vbool4_t v = *(vbool4_t*)(in + 700); + *(vbool4_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool4_t v = *(vbool4_t*)(in + 900 + i); + *(vbool4_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vbool4_t v = *(vbool4_t*)(in + 500); + *(vbool4_t*)(out + 500) = v; + } else if (n == 1) { + vbool4_t v = *(vbool4_t*)(in + 600); + *(vbool4_t*)(out + 600) = v; + } else { + vbool4_t v = *(vbool4_t*)(in + 700); + *(vbool4_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool4_t v = *(vbool4_t*)(in + 900 + i); + *(vbool4_t*)(out + 900 + i) = v; + } +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool2_t v = *(vbool2_t*)(in + 500); + *(vbool2_t*)(out + 500) = v; + } else if (n == 1) { + vbool2_t v = *(vbool2_t*)(in + 600); + *(vbool2_t*)(out + 600) = v; + } else { + vbool2_t v = *(vbool2_t*)(in + 700); + *(vbool2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool2_t v = *(vbool2_t*)(in + 900 + i); + *(vbool2_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vbool2_t v = *(vbool2_t*)(in + 500); + *(vbool2_t*)(out + 500) = v; + } else if (n == 1) { + vbool2_t v = *(vbool2_t*)(in + 600); + *(vbool2_t*)(out + 600) = v; + } else { + vbool2_t v = *(vbool2_t*)(in + 700); + *(vbool2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool2_t v = *(vbool2_t*)(in + 900 + i); + *(vbool2_t*)(out + 900 + i) = v; + } +} + +void f7 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool1_t v = *(vbool1_t*)(in + 500); + *(vbool1_t*)(out + 500) = v; + } else if (n == 1) { + vbool1_t v = *(vbool1_t*)(in + 600); + *(vbool1_t*)(out + 600) = v; + } else { + vbool1_t v = *(vbool1_t*)(in + 700); + *(vbool1_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool1_t v = *(vbool1_t*)(in + 900 + i); + *(vbool1_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vbool1_t v = *(vbool1_t*)(in + 500); + *(vbool1_t*)(out + 500) = v; + } else if (n == 1) { + vbool1_t v = *(vbool1_t*)(in + 600); + *(vbool1_t*)(out + 600) = v; + } else { + vbool1_t v = *(vbool1_t*)(in + 700); + *(vbool1_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool1_t v = *(vbool1_t*)(in + 900 + i); + *(vbool1_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m1,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-26.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-26.c new file mode 100644 index 0000000..c123855 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-26.c @@ -0,0 +1,492 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint8mf8_t v = *(vint8mf8_t*)(in + 500); + *(vint8mf8_t*)(out + 500) = v; + } else if (n == 1) { + vint8mf8_t v = *(vint8mf8_t*)(in + 600); + *(vint8mf8_t*)(out + 600) = v; + } else { + vint8mf8_t v = *(vint8mf8_t*)(in + 700); + *(vint8mf8_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf8_t v = *(vint8mf8_t*)(in + 900 + i); + *(vint8mf8_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vint8mf8_t v = *(vint8mf8_t*)(in + 500); + *(vint8mf8_t*)(out + 500) = v; + } else if (n == 1) { + vint8mf8_t v = *(vint8mf8_t*)(in + 600); + *(vint8mf8_t*)(out + 600) = v; + } else { + vint8mf8_t v = *(vint8mf8_t*)(in + 700); + *(vint8mf8_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf8_t v = *(vint8mf8_t*)(in + 900 + i); + *(vint8mf8_t*)(out + 900 + i) = v; + } +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint8mf4_t v = *(vint8mf4_t*)(in + 500); + *(vint8mf4_t*)(out + 500) = v; + } else if (n == 1) { + vint8mf4_t v = *(vint8mf4_t*)(in + 600); + *(vint8mf4_t*)(out + 600) = v; + } else { + vint8mf4_t v = *(vint8mf4_t*)(in + 700); + *(vint8mf4_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf4_t v = *(vint8mf4_t*)(in + 900 + i); + *(vint8mf4_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vint8mf4_t v = *(vint8mf4_t*)(in + 500); + *(vint8mf4_t*)(out + 500) = v; + } else if (n == 1) { + vint8mf4_t v = *(vint8mf4_t*)(in + 600); + *(vint8mf4_t*)(out + 600) = v; + } else { + vint8mf4_t v = *(vint8mf4_t*)(in + 700); + *(vint8mf4_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf4_t v = *(vint8mf4_t*)(in + 900 + i); + *(vint8mf4_t*)(out + 900 + i) = v; + } +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint8mf2_t v = *(vint8mf2_t*)(in + 500); + *(vint8mf2_t*)(out + 500) = v; + } else if (n == 1) { + vint8mf2_t v = *(vint8mf2_t*)(in + 600); + *(vint8mf2_t*)(out + 600) = v; + } else { + vint8mf2_t v = *(vint8mf2_t*)(in + 700); + *(vint8mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf2_t v = *(vint8mf2_t*)(in + 900 + i); + *(vint8mf2_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vint8mf2_t v = *(vint8mf2_t*)(in + 500); + *(vint8mf2_t*)(out + 500) = v; + } else if (n == 1) { + vint8mf2_t v = *(vint8mf2_t*)(in + 600); + *(vint8mf2_t*)(out + 600) = v; + } else { + vint8mf2_t v = *(vint8mf2_t*)(in + 700); + *(vint8mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf2_t v = *(vint8mf2_t*)(in + 900 + i); + *(vint8mf2_t*)(out + 900 + i) = v; + } +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint16mf4_t v = *(vint16mf4_t*)(in + 500); + *(vint16mf4_t*)(out + 500) = v; + } else if (n == 1) { + vint16mf4_t v = *(vint16mf4_t*)(in + 600); + *(vint16mf4_t*)(out + 600) = v; + } else { + vint16mf4_t v = *(vint16mf4_t*)(in + 700); + *(vint16mf4_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf4_t v = *(vint16mf4_t*)(in + 900 + i); + *(vint16mf4_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vint16mf4_t v = *(vint16mf4_t*)(in + 500); + *(vint16mf4_t*)(out + 500) = v; + } else if (n == 1) { + vint16mf4_t v = *(vint16mf4_t*)(in + 600); + *(vint16mf4_t*)(out + 600) = v; + } else { + vint16mf4_t v = *(vint16mf4_t*)(in + 700); + *(vint16mf4_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf4_t v = *(vint16mf4_t*)(in + 900 + i); + *(vint16mf4_t*)(out + 900 + i) = v; + } +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint16mf2_t v = *(vint16mf2_t*)(in + 500); + *(vint16mf2_t*)(out + 500) = v; + } else if (n == 1) { + vint16mf2_t v = *(vint16mf2_t*)(in + 600); + *(vint16mf2_t*)(out + 600) = v; + } else { + vint16mf2_t v = *(vint16mf2_t*)(in + 700); + *(vint16mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf2_t v = *(vint16mf2_t*)(in + 900 + i); + *(vint16mf2_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vint16mf2_t v = *(vint16mf2_t*)(in + 500); + *(vint16mf2_t*)(out + 500) = v; + } else if (n == 1) { + vint16mf2_t v = *(vint16mf2_t*)(in + 600); + *(vint16mf2_t*)(out + 600) = v; + } else { + vint16mf2_t v = *(vint16mf2_t*)(in + 700); + *(vint16mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf2_t v = *(vint16mf2_t*)(in + 900 + i); + *(vint16mf2_t*)(out + 900 + i) = v; + } +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint32mf2_t v = *(vint32mf2_t*)(in + 500); + *(vint32mf2_t*)(out + 500) = v; + } else if (n == 1) { + vint32mf2_t v = *(vint32mf2_t*)(in + 600); + *(vint32mf2_t*)(out + 600) = v; + } else { + vint32mf2_t v = *(vint32mf2_t*)(in + 700); + *(vint32mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint32mf2_t v = *(vint32mf2_t*)(in + 900 + i); + *(vint32mf2_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vint32mf2_t v = *(vint32mf2_t*)(in + 500); + *(vint32mf2_t*)(out + 500) = v; + } else if (n == 1) { + vint32mf2_t v = *(vint32mf2_t*)(in + 600); + *(vint32mf2_t*)(out + 600) = v; + } else { + vint32mf2_t v = *(vint32mf2_t*)(in + 700); + *(vint32mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint32mf2_t v = *(vint32mf2_t*)(in + 900 + i); + *(vint32mf2_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ + diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-27.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-27.c new file mode 100644 index 0000000..6265000 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-27.c @@ -0,0 +1,491 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 500); + *(vuint8mf8_t*)(out + 500) = v; + } else if (n == 1) { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 600); + *(vuint8mf8_t*)(out + 600) = v; + } else { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 700); + *(vuint8mf8_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 900 + i); + *(vuint8mf8_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 500); + *(vuint8mf8_t*)(out + 500) = v; + } else if (n == 1) { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 600); + *(vuint8mf8_t*)(out + 600) = v; + } else { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 700); + *(vuint8mf8_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 900 + i); + *(vuint8mf8_t*)(out + 900 + i) = v; + } +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 500); + *(vuint8mf4_t*)(out + 500) = v; + } else if (n == 1) { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 600); + *(vuint8mf4_t*)(out + 600) = v; + } else { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 700); + *(vuint8mf4_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 900 + i); + *(vuint8mf4_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 500); + *(vuint8mf4_t*)(out + 500) = v; + } else if (n == 1) { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 600); + *(vuint8mf4_t*)(out + 600) = v; + } else { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 700); + *(vuint8mf4_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 900 + i); + *(vuint8mf4_t*)(out + 900 + i) = v; + } +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 500); + *(vuint8mf2_t*)(out + 500) = v; + } else if (n == 1) { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 600); + *(vuint8mf2_t*)(out + 600) = v; + } else { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 700); + *(vuint8mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 900 + i); + *(vuint8mf2_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 500); + *(vuint8mf2_t*)(out + 500) = v; + } else if (n == 1) { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 600); + *(vuint8mf2_t*)(out + 600) = v; + } else { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 700); + *(vuint8mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 900 + i); + *(vuint8mf2_t*)(out + 900 + i) = v; + } +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 500); + *(vuint16mf4_t*)(out + 500) = v; + } else if (n == 1) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 600); + *(vuint16mf4_t*)(out + 600) = v; + } else { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 700); + *(vuint16mf4_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 900 + i); + *(vuint16mf4_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 500); + *(vuint16mf4_t*)(out + 500) = v; + } else if (n == 1) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 600); + *(vuint16mf4_t*)(out + 600) = v; + } else { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 700); + *(vuint16mf4_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 900 + i); + *(vuint16mf4_t*)(out + 900 + i) = v; + } +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 500); + *(vuint16mf2_t*)(out + 500) = v; + } else if (n == 1) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 600); + *(vuint16mf2_t*)(out + 600) = v; + } else { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 700); + *(vuint16mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 900 + i); + *(vuint16mf2_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 500); + *(vuint16mf2_t*)(out + 500) = v; + } else if (n == 1) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 600); + *(vuint16mf2_t*)(out + 600) = v; + } else { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 700); + *(vuint16mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 900 + i); + *(vuint16mf2_t*)(out + 900 + i) = v; + } +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 500); + *(vuint32mf2_t*)(out + 500) = v; + } else if (n == 1) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 600); + *(vuint32mf2_t*)(out + 600) = v; + } else { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 700); + *(vuint32mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 900 + i); + *(vuint32mf2_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 500); + *(vuint32mf2_t*)(out + 500) = v; + } else if (n == 1) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 600); + *(vuint32mf2_t*)(out + 600) = v; + } else { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 700); + *(vuint32mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 900 + i); + *(vuint32mf2_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-28.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-28.c new file mode 100644 index 0000000..de7c5f9 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-28.c @@ -0,0 +1,86 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 500); + *(vfloat32mf2_t*)(out + 500) = v; + } else if (n == 1) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 600); + *(vfloat32mf2_t*)(out + 600) = v; + } else { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 700); + *(vfloat32mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 900 + i); + *(vfloat32mf2_t*)(out + 900 + i) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + if (n == 0) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 500); + *(vfloat32mf2_t*)(out + 500) = v; + } else if (n == 1) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 600); + *(vfloat32mf2_t*)(out + 600) = v; + } else { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 700); + *(vfloat32mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 900 + i); + *(vfloat32mf2_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-3.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-3.c new file mode 100644 index 0000000..f920017 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-3.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 500); + *(vfloat32mf2_t*)(out + 500) = v; + } else if (n == 1) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 600); + *(vfloat32mf2_t*)(out + 600) = v; + } else { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 700); + *(vfloat32mf2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 900 + i); + *(vfloat32mf2_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-4.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-4.c new file mode 100644 index 0000000..31a9e43 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-4.c @@ -0,0 +1,210 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool64_t v = *(vbool64_t*)(in + 500); + *(vbool64_t*)(out + 500) = v; + } else if (n == 1) { + vbool64_t v = *(vbool64_t*)(in + 600); + *(vbool64_t*)(out + 600) = v; + } else { + vbool64_t v = *(vbool64_t*)(in + 700); + *(vbool64_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool64_t v = *(vbool64_t*)(in + 900 + i); + *(vbool64_t*)(out + 900 + i) = v; + } +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool32_t v = *(vbool32_t*)(in + 500); + *(vbool32_t*)(out + 500) = v; + } else if (n == 1) { + vbool32_t v = *(vbool32_t*)(in + 600); + *(vbool32_t*)(out + 600) = v; + } else { + vbool32_t v = *(vbool32_t*)(in + 700); + *(vbool32_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool32_t v = *(vbool32_t*)(in + 900 + i); + *(vbool32_t*)(out + 900 + i) = v; + } +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool16_t v = *(vbool16_t*)(in + 500); + *(vbool16_t*)(out + 500) = v; + } else if (n == 1) { + vbool16_t v = *(vbool16_t*)(in + 600); + *(vbool16_t*)(out + 600) = v; + } else { + vbool16_t v = *(vbool16_t*)(in + 700); + *(vbool16_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool16_t v = *(vbool16_t*)(in + 900 + i); + *(vbool16_t*)(out + 900 + i) = v; + } +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool8_t v = *(vbool8_t*)(in + 500); + *(vbool8_t*)(out + 500) = v; + } else if (n == 1) { + vbool8_t v = *(vbool8_t*)(in + 600); + *(vbool8_t*)(out + 600) = v; + } else { + vbool8_t v = *(vbool8_t*)(in + 700); + *(vbool8_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool8_t v = *(vbool8_t*)(in + 900 + i); + *(vbool8_t*)(out + 900 + i) = v; + } +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool4_t v = *(vbool4_t*)(in + 500); + *(vbool4_t*)(out + 500) = v; + } else if (n == 1) { + vbool4_t v = *(vbool4_t*)(in + 600); + *(vbool4_t*)(out + 600) = v; + } else { + vbool4_t v = *(vbool4_t*)(in + 700); + *(vbool4_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool4_t v = *(vbool4_t*)(in + 900 + i); + *(vbool4_t*)(out + 900 + i) = v; + } +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool2_t v = *(vbool2_t*)(in + 500); + *(vbool2_t*)(out + 500) = v; + } else if (n == 1) { + vbool2_t v = *(vbool2_t*)(in + 600); + *(vbool2_t*)(out + 600) = v; + } else { + vbool2_t v = *(vbool2_t*)(in + 700); + *(vbool2_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool2_t v = *(vbool2_t*)(in + 900 + i); + *(vbool2_t*)(out + 900 + i) = v; + } +} + +void f7 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool1_t v = *(vbool1_t*)(in + 500); + *(vbool1_t*)(out + 500) = v; + } else if (n == 1) { + vbool1_t v = *(vbool1_t*)(in + 600); + *(vbool1_t*)(out + 600) = v; + } else { + vbool1_t v = *(vbool1_t*)(in + 700); + *(vbool1_t*)(out + 700) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool1_t v = *(vbool1_t*)(in + 900 + i); + *(vbool1_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m1,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 6 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O2" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-5.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-5.c new file mode 100644 index 0000000..2cf28d7 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-5.c @@ -0,0 +1,167 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint8mf8_t v = *(vint8mf8_t*)(in + 500); + *(vint8mf8_t*)(out + 500) = v; + } else if (n == 1) { + vint8mf8_t v = *(vint8mf8_t*)(in + 600); + *(vint8mf8_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf8_t v = *(vint8mf8_t*)(in + 900 + i); + *(vint8mf8_t*)(out + 900 + i) = v; + } +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint8mf4_t v = *(vint8mf4_t*)(in + 500); + *(vint8mf4_t*)(out + 500) = v; + } else if (n == 1) { + vint8mf4_t v = *(vint8mf4_t*)(in + 600); + *(vint8mf4_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf4_t v = *(vint8mf4_t*)(in + 900 + i); + *(vint8mf4_t*)(out + 900 + i) = v; + } +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint8mf2_t v = *(vint8mf2_t*)(in + 500); + *(vint8mf2_t*)(out + 500) = v; + } else if (n == 1) { + vint8mf2_t v = *(vint8mf2_t*)(in + 600); + *(vint8mf2_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf2_t v = *(vint8mf2_t*)(in + 900 + i); + *(vint8mf2_t*)(out + 900 + i) = v; + } +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint16mf4_t v = *(vint16mf4_t*)(in + 500); + *(vint16mf4_t*)(out + 500) = v; + } else if (n == 1) { + vint16mf4_t v = *(vint16mf4_t*)(in + 600); + *(vint16mf4_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf4_t v = *(vint16mf4_t*)(in + 900 + i); + *(vint16mf4_t*)(out + 900 + i) = v; + } +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint16mf2_t v = *(vint16mf2_t*)(in + 500); + *(vint16mf2_t*)(out + 500) = v; + } else if (n == 1) { + vint16mf2_t v = *(vint16mf2_t*)(in + 600); + *(vint16mf2_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf2_t v = *(vint16mf2_t*)(in + 900 + i); + *(vint16mf2_t*)(out + 900 + i) = v; + } +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint32mf2_t v = *(vint32mf2_t*)(in + 500); + *(vint32mf2_t*)(out + 500) = v; + } else if (n == 1) { + vint32mf2_t v = *(vint32mf2_t*)(in + 600); + *(vint32mf2_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint32mf2_t v = *(vint32mf2_t*)(in + 900 + i); + *(vint32mf2_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-6.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-6.c new file mode 100644 index 0000000..d52c1bb --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-6.c @@ -0,0 +1,167 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint8mf8_t v = *(vint8mf8_t*)(in + 500); + *(vint8mf8_t*)(out + 500) = v; + } else if (n == 1) { + vint8mf8_t v = *(vint8mf8_t*)(in + 600); + *(vint8mf8_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf8_t v = *(vint8mf8_t*)(in + 900 + i); + *(vint8mf8_t*)(out + 900 + i) = v; + } +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint8mf4_t v = *(vint8mf4_t*)(in + 500); + *(vint8mf4_t*)(out + 500) = v; + } else if (n == 1) { + vint8mf4_t v = *(vint8mf4_t*)(in + 600); + *(vint8mf4_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf4_t v = *(vint8mf4_t*)(in + 900 + i); + *(vint8mf4_t*)(out + 900 + i) = v; + } +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint8mf2_t v = *(vint8mf2_t*)(in + 500); + *(vint8mf2_t*)(out + 500) = v; + } else if (n == 1) { + vint8mf2_t v = *(vint8mf2_t*)(in + 600); + *(vint8mf2_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf2_t v = *(vint8mf2_t*)(in + 900 + i); + *(vint8mf2_t*)(out + 900 + i) = v; + } +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint16mf4_t v = *(vint16mf4_t*)(in + 500); + *(vint16mf4_t*)(out + 500) = v; + } else if (n == 1) { + vint16mf4_t v = *(vint16mf4_t*)(in + 600); + *(vint16mf4_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf4_t v = *(vint16mf4_t*)(in + 900 + i); + *(vint16mf4_t*)(out + 900 + i) = v; + } +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vint16mf2_t v = *(vint16mf2_t*)(in + 500); + *(vint16mf2_t*)(out + 500) = v; + } else if (n == 1) { + vint16mf2_t v = *(vint16mf2_t*)(in + 600); + *(vint16mf2_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf2_t v = *(vint16mf2_t*)(in + 900 + i); + *(vint16mf2_t*)(out + 900 + i) = v; + } +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 500); + *(vuint32mf2_t*)(out + 500) = v; + } else if (n == 1) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 600); + *(vuint32mf2_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 900 + i); + *(vuint32mf2_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-7.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-7.c new file mode 100644 index 0000000..bd6d68b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-7.c @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 500); + *(vfloat32mf2_t*)(out + 500) = v; + } else if (n == 1) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 600); + *(vfloat32mf2_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 900 + i); + *(vfloat32mf2_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-8.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-8.c new file mode 100644 index 0000000..d3b3fa3 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-8.c @@ -0,0 +1,194 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool64_t v = *(vbool64_t*)(in + 500); + *(vbool64_t*)(out + 500) = v; + } else if (n == 1) { + vbool64_t v = *(vbool64_t*)(in + 600); + *(vbool64_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool64_t v = *(vbool64_t*)(in + 900 + i); + *(vbool64_t*)(out + 900 + i) = v; + } +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool32_t v = *(vbool32_t*)(in + 500); + *(vbool32_t*)(out + 500) = v; + } else if (n == 1) { + vbool32_t v = *(vbool32_t*)(in + 600); + *(vbool32_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool32_t v = *(vbool32_t*)(in + 900 + i); + *(vbool32_t*)(out + 900 + i) = v; + } +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool16_t v = *(vbool16_t*)(in + 500); + *(vbool16_t*)(out + 500) = v; + } else if (n == 1) { + vbool16_t v = *(vbool16_t*)(in + 600); + *(vbool16_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool16_t v = *(vbool16_t*)(in + 900 + i); + *(vbool16_t*)(out + 900 + i) = v; + } +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool8_t v = *(vbool8_t*)(in + 500); + *(vbool8_t*)(out + 500) = v; + } else if (n == 1) { + vbool8_t v = *(vbool8_t*)(in + 600); + *(vbool8_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool8_t v = *(vbool8_t*)(in + 900 + i); + *(vbool8_t*)(out + 900 + i) = v; + } +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool4_t v = *(vbool4_t*)(in + 500); + *(vbool4_t*)(out + 500) = v; + } else if (n == 1) { + vbool4_t v = *(vbool4_t*)(in + 600); + *(vbool4_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool4_t v = *(vbool4_t*)(in + 900 + i); + *(vbool4_t*)(out + 900 + i) = v; + } +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool2_t v = *(vbool2_t*)(in + 500); + *(vbool2_t*)(out + 500) = v; + } else if (n == 1) { + vbool2_t v = *(vbool2_t*)(in + 600); + *(vbool2_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool2_t v = *(vbool2_t*)(in + 900 + i); + *(vbool2_t*)(out + 900 + i) = v; + } +} + +void f7 (int8_t * restrict in, int8_t * restrict out, int n) +{ + if (n == 0) { + vbool1_t v = *(vbool1_t*)(in + 500); + *(vbool1_t*)(out + 500) = v; + } else if (n == 1) { + vbool1_t v = *(vbool1_t*)(in + 600); + *(vbool1_t*)(out + 600) = v; + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool1_t v = *(vbool1_t*)(in + 900 + i); + *(vbool1_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m1,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m1,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]\s+\.L[0-9][0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-9.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-9.c new file mode 100644 index 0000000..e1c5609 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-9.c @@ -0,0 +1,230 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint8mf8_t v = *(vint8mf8_t*)(in + 500); + *(vint8mf8_t*)(out + 500) = v; + break; + } + case 1:{ + vint8mf8_t v = *(vint8mf8_t*)(in + 500); + *(vint8mf8_t*)(out + 500) = v; + break; + } + default:{ + vint8mf8_t v = *(vint8mf8_t*)(in + 700); + *(vint8mf8_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf8_t v = *(vint8mf8_t*)(in + 900 + i); + *(vint8mf8_t*)(out + 900 + i) = v; + } +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint8mf4_t v = *(vint8mf4_t*)(in + 500); + *(vint8mf4_t*)(out + 500) = v; + break; + } + case 1:{ + vint8mf4_t v = *(vint8mf4_t*)(in + 500); + *(vint8mf4_t*)(out + 500) = v; + break; + } + default:{ + vint8mf4_t v = *(vint8mf4_t*)(in + 700); + *(vint8mf4_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf4_t v = *(vint8mf4_t*)(in + 900 + i); + *(vint8mf4_t*)(out + 900 + i) = v; + } +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint8mf2_t v = *(vint8mf2_t*)(in + 500); + *(vint8mf2_t*)(out + 500) = v; + break; + } + case 1:{ + vint8mf2_t v = *(vint8mf2_t*)(in + 500); + *(vint8mf2_t*)(out + 500) = v; + break; + } + default:{ + vint8mf2_t v = *(vint8mf2_t*)(in + 700); + *(vint8mf2_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf2_t v = *(vint8mf2_t*)(in + 900 + i); + *(vint8mf2_t*)(out + 900 + i) = v; + } +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint16mf4_t v = *(vint16mf4_t*)(in + 500); + *(vint16mf4_t*)(out + 500) = v; + break; + } + case 1:{ + vint16mf4_t v = *(vint16mf4_t*)(in + 500); + *(vint16mf4_t*)(out + 500) = v; + break; + } + default:{ + vint16mf4_t v = *(vint16mf4_t*)(in + 700); + *(vint16mf4_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf4_t v = *(vint16mf4_t*)(in + 900 + i); + *(vint16mf4_t*)(out + 900 + i) = v; + } +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint16mf2_t v = *(vint16mf2_t*)(in + 500); + *(vint16mf2_t*)(out + 500) = v; + break; + } + case 1:{ + vint16mf2_t v = *(vint16mf2_t*)(in + 500); + *(vint16mf2_t*)(out + 500) = v; + break; + } + default:{ + vint16mf2_t v = *(vint16mf2_t*)(in + 700); + *(vint16mf2_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf2_t v = *(vint16mf2_t*)(in + 900 + i); + *(vint16mf2_t*)(out + 900 + i) = v; + } +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + switch (n) + { + case 0:{ + vint32mf2_t v = *(vint32mf2_t*)(in + 500); + *(vint32mf2_t*)(out + 500) = v; + break; + } + case 1:{ + vint32mf2_t v = *(vint32mf2_t*)(in + 500); + *(vint32mf2_t*)(out + 500) = v; + break; + } + default:{ + vint32mf2_t v = *(vint32mf2_t*)(in + 700); + *(vint32mf2_t*)(out + 700) = v; + break; + } + } + + for (int i = 0 ; i < n * n; i++) + out[i] = out[i] + out[i]; + + for (int i = 0 ; i < n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) + out[i] = out[i] * out[i]; + + for (int i = 0 ; i < n * n * n * n; i++) { + vint32mf2_t v = *(vint32mf2_t*)(in + 900 + i); + *(vint32mf2_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ +/* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_call-1.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_call-1.c new file mode 100644 index 0000000..89b6abe --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_call-1.c @@ -0,0 +1,239 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void fn3 (void); + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vbool64_t v = *(vbool64_t*)(in + 900 + i); + *(vbool64_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool64_t v = *(vbool64_t*)(in + 900 + i); + *(vbool64_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool64_t v = *(vbool64_t*)(in + 900 + i); + *(vbool64_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vbool64_t v = *(vbool64_t*)(in + 900 + i); + *(vbool64_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vbool64_t v = *(vbool64_t*)(in + 900 + i); + *(vbool64_t*)(out + 900 + i) = v; + } + +} + +int f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vbool32_t v = *(vbool32_t*)(in + 900 + i); + *(vbool32_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool32_t v = *(vbool32_t*)(in + 900 + i); + *(vbool32_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool32_t v = *(vbool32_t*)(in + 900 + i); + *(vbool32_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vbool32_t v = *(vbool32_t*)(in + 900 + i); + *(vbool32_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vbool32_t v = *(vbool32_t*)(in + 900 + i); + *(vbool32_t*)(out + 900 + i) = v; + } + +} + +int f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vbool16_t v = *(vbool16_t*)(in + 900 + i); + *(vbool16_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool16_t v = *(vbool16_t*)(in + 900 + i); + *(vbool16_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool16_t v = *(vbool16_t*)(in + 900 + i); + *(vbool16_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vbool16_t v = *(vbool16_t*)(in + 900 + i); + *(vbool16_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vbool16_t v = *(vbool16_t*)(in + 900 + i); + *(vbool16_t*)(out + 900 + i) = v; + } + +} + +int f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vbool8_t v = *(vbool8_t*)(in + 900 + i); + *(vbool8_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool8_t v = *(vbool8_t*)(in + 900 + i); + *(vbool8_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool8_t v = *(vbool8_t*)(in + 900 + i); + *(vbool8_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vbool8_t v = *(vbool8_t*)(in + 900 + i); + *(vbool8_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vbool8_t v = *(vbool8_t*)(in + 900 + i); + *(vbool8_t*)(out + 900 + i) = v; + } + +} + +int f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vbool4_t v = *(vbool4_t*)(in + 900 + i); + *(vbool4_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool4_t v = *(vbool4_t*)(in + 900 + i); + *(vbool4_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool4_t v = *(vbool4_t*)(in + 900 + i); + *(vbool4_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vbool4_t v = *(vbool4_t*)(in + 900 + i); + *(vbool4_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vbool4_t v = *(vbool4_t*)(in + 900 + i); + *(vbool4_t*)(out + 900 + i) = v; + } + +} + +int f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vbool2_t v = *(vbool2_t*)(in + 900 + i); + *(vbool2_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool2_t v = *(vbool2_t*)(in + 900 + i); + *(vbool2_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool2_t v = *(vbool2_t*)(in + 900 + i); + *(vbool2_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vbool2_t v = *(vbool2_t*)(in + 900 + i); + *(vbool2_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vbool2_t v = *(vbool2_t*)(in + 900 + i); + *(vbool2_t*)(out + 900 + i) = v; + } + +} + +int f7 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vbool1_t v = *(vbool1_t*)(in + 900 + i); + *(vbool1_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool1_t v = *(vbool1_t*)(in + 900 + i); + *(vbool1_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vbool1_t v = *(vbool1_t*)(in + 900 + i); + *(vbool1_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vbool1_t v = *(vbool1_t*)(in + 900 + i); + *(vbool1_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vbool1_t v = *(vbool1_t*)(in + 900 + i); + *(vbool1_t*)(out + 900 + i) = v; + } + +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]\s+\.L[0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m1,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m1,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m2,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m4,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]\s+\.L[0-9][0-9][0-9]\:\s+vlm\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 4 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_call-2.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_call-2.c new file mode 100644 index 0000000..930f6f8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_call-2.c @@ -0,0 +1,207 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void fn3 (void); + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf8_t v = *(vint8mf8_t*)(in + 900 + i); + *(vint8mf8_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf8_t v = *(vint8mf8_t*)(in + 900 + i); + *(vint8mf8_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf8_t v = *(vint8mf8_t*)(in + 900 + i); + *(vint8mf8_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf8_t v = *(vint8mf8_t*)(in + 900 + i); + *(vint8mf8_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf8_t v = *(vint8mf8_t*)(in + 900 + i); + *(vint8mf8_t*)(out + 900 + i) = v; + } + +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf4_t v = *(vint8mf4_t*)(in + 900 + i); + *(vint8mf4_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf4_t v = *(vint8mf4_t*)(in + 900 + i); + *(vint8mf4_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf4_t v = *(vint8mf4_t*)(in + 900 + i); + *(vint8mf4_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf4_t v = *(vint8mf4_t*)(in + 900 + i); + *(vint8mf4_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf4_t v = *(vint8mf4_t*)(in + 900 + i); + *(vint8mf4_t*)(out + 900 + i) = v; + } + +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf2_t v = *(vint8mf2_t*)(in + 900 + i); + *(vint8mf2_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf2_t v = *(vint8mf2_t*)(in + 900 + i); + *(vint8mf2_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf2_t v = *(vint8mf2_t*)(in + 900 + i); + *(vint8mf2_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf2_t v = *(vint8mf2_t*)(in + 900 + i); + *(vint8mf2_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vint8mf2_t v = *(vint8mf2_t*)(in + 900 + i); + *(vint8mf2_t*)(out + 900 + i) = v; + } + +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf4_t v = *(vint16mf4_t*)(in + 900 + i); + *(vint16mf4_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf4_t v = *(vint16mf4_t*)(in + 900 + i); + *(vint16mf4_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf4_t v = *(vint16mf4_t*)(in + 900 + i); + *(vint16mf4_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf4_t v = *(vint16mf4_t*)(in + 900 + i); + *(vint16mf4_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf4_t v = *(vint16mf4_t*)(in + 900 + i); + *(vint16mf4_t*)(out + 900 + i) = v; + } + +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf2_t v = *(vint16mf2_t*)(in + 900 + i); + *(vint16mf2_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf2_t v = *(vint16mf2_t*)(in + 900 + i); + *(vint16mf2_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf2_t v = *(vint16mf2_t*)(in + 900 + i); + *(vint16mf2_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf2_t v = *(vint16mf2_t*)(in + 900 + i); + *(vint16mf2_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vint16mf2_t v = *(vint16mf2_t*)(in + 900 + i); + *(vint16mf2_t*)(out + 900 + i) = v; + } + +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vint32mf2_t v = *(vint32mf2_t*)(in + 900 + i); + *(vint32mf2_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vint32mf2_t v = *(vint32mf2_t*)(in + 900 + i); + *(vint32mf2_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vint32mf2_t v = *(vint32mf2_t*)(in + 900 + i); + *(vint32mf2_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vint32mf2_t v = *(vint32mf2_t*)(in + 900 + i); + *(vint32mf2_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vint32mf2_t v = *(vint32mf2_t*)(in + 900 + i); + *(vint32mf2_t*)(out + 900 + i) = v; + } + +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]\s+\.L[0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_call-3.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_call-3.c new file mode 100644 index 0000000..e8b92e0 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_call-3.c @@ -0,0 +1,207 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void fn3 (void); + +void f (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 900 + i); + *(vuint8mf8_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 900 + i); + *(vuint8mf8_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 900 + i); + *(vuint8mf8_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 900 + i); + *(vuint8mf8_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf8_t v = *(vuint8mf8_t*)(in + 900 + i); + *(vuint8mf8_t*)(out + 900 + i) = v; + } + +} + +void f2 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 900 + i); + *(vuint8mf4_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 900 + i); + *(vuint8mf4_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 900 + i); + *(vuint8mf4_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 900 + i); + *(vuint8mf4_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf4_t v = *(vuint8mf4_t*)(in + 900 + i); + *(vuint8mf4_t*)(out + 900 + i) = v; + } + +} + +void f3 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 900 + i); + *(vuint8mf2_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 900 + i); + *(vuint8mf2_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 900 + i); + *(vuint8mf2_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 900 + i); + *(vuint8mf2_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vuint8mf2_t v = *(vuint8mf2_t*)(in + 900 + i); + *(vuint8mf2_t*)(out + 900 + i) = v; + } + +} + +void f4 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 900 + i); + *(vuint16mf4_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 900 + i); + *(vuint16mf4_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 900 + i); + *(vuint16mf4_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 900 + i); + *(vuint16mf4_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + 900 + i); + *(vuint16mf4_t*)(out + 900 + i) = v; + } + +} + +void f5 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 900 + i); + *(vuint16mf2_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 900 + i); + *(vuint16mf2_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 900 + i); + *(vuint16mf2_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 900 + i); + *(vuint16mf2_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + 900 + i); + *(vuint16mf2_t*)(out + 900 + i) = v; + } + +} + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 900 + i); + *(vuint32mf2_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 900 + i); + *(vuint32mf2_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 900 + i); + *(vuint32mf2_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 900 + i); + *(vuint32mf2_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vuint32mf2_t v = *(vuint32mf2_t*)(in + 900 + i); + *(vuint32mf2_t*)(out + 900 + i) = v; + } + +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]\s+\.L[0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_call-4.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_call-4.c new file mode 100644 index 0000000..27f11a8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_call-4.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void fn3 (void); + +void f6 (int8_t * restrict in, int8_t * restrict out, int n) +{ + for (int i = 0 ; i < n * n * n * n; i++) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 900 + i); + *(vfloat32mf2_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 900 + i); + *(vfloat32mf2_t*)(out + 900 + i) = v; + } + fn3 (); + + for (int i = 0 ; i < n * n * n * n; i++) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 900 + i); + *(vfloat32mf2_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 900 + i); + *(vfloat32mf2_t*)(out + 900 + i) = v; + } + fn3 (); + for (int i = 0 ; i < n * n * n * n; i++) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 900 + i); + *(vfloat32mf2_t*)(out + 900 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_complex_loop-1.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_complex_loop-1.c new file mode 100644 index 0000000..c5962e5 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_complex_loop-1.c @@ -0,0 +1,52 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int32_t * restrict in, int32_t * restrict out, size_t n, size_t m, int cond) +{ + for (size_t i = 0; i < n; i++) + { + if (i % 2) { + + if (cond) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + i + 2000); + *(vfloat32mf2_t*)out = v; + } else { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + i + 3000); + *(vfloat32mf2_t*)out = v; + } + + for (size_t j = 0; j < m; j += 1) { + if (j % 2 == 0) { + vint8mf8_t v = *(vint8mf8_t*)(in + i + j + 100); + *(vint8mf8_t*)out = v; + } else { + vint8mf8_t v = *(vint8mf8_t*)(in + i + j + 200); + *(vint8mf8_t*)out = v; + } + } + + if (cond) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + i + 7000); + *(vuint16mf4_t*)out = v; + } else { + vuint16mf4_t v = *(vuint16mf4_t*)(in + i + 8000); + *(vuint16mf4_t*)out = v; + } + } else { + if (cond) { + vint8mf8_t v = *(vint8mf8_t*)(in + i + 4000); + *(vint8mf8_t*)out = v; + } else { + vint8mf8_t v = *(vint8mf8_t*)(in + i + 5000); + *(vint8mf8_t*)out = v; + } + + vbool64_t v = *(vbool64_t*)(in + i + 300); + *(vbool64_t*)out = v; + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_complex_loop-2.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_complex_loop-2.c new file mode 100644 index 0000000..8fa2bd8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_complex_loop-2.c @@ -0,0 +1,56 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int32_t * restrict in, int32_t * restrict out, size_t n, size_t m, int cond) +{ + for (size_t i = 0; i < n; i++) + { + if (i % 2) { + + if (cond) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + i + 2000); + *(vfloat32mf2_t*)(out + i + 2000) = v; + } else { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + i + 3000); + *(vfloat32mf2_t*)(out + i + 3000) = v; + } + + for (size_t j = 0; j < m; j += 1) { + if (j % 2 == 0) { + vint8mf8_t v = *(vint8mf8_t*)(in + i + j + 100); + *(vint8mf8_t*)(out + i + j + 100) = v; + } else { + vint8mf8_t v = *(vint8mf8_t*)(in + i + j + 200); + *(vint8mf8_t*)(out + i + j + 200) = v; + } + } + + if (cond) { + vuint16mf4_t v = *(vuint16mf4_t*)(in + i + 7000); + *(vuint16mf4_t*)(out + i + 7000) = v; + } else { + vuint16mf4_t v = *(vuint16mf4_t*)(in + i + 8000); + *(vuint16mf4_t*)(out + i + 8000) = v; + } + } else { + if (cond) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + i + 4000); + *(vuint16mf2_t*)(out + i + 4000) = v; + } else { + vuint16mf2_t v = *(vuint16mf2_t*)(in + i + 5000); + *(vuint16mf2_t*)(out + i + 5000) = v; + } + + vbool1_t v = *(vbool1_t*)(in + i + 300); + *(vbool1_t*)(out + i + 300) = v; + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli} 5 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-not {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-1.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-1.c new file mode 100644 index 0000000..34ac4a5 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-1.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int32_t * restrict in, int32_t * restrict out, size_t n, size_t cond, size_t cond2) +{ + for (size_t i = 0; i < n; i++) + { + if (i != cond) { + vint8mf8_t v = *(vint8mf8_t*)(in + i + 100); + *(vint8mf8_t*)(out + i + 100) = v; + } else { + vbool1_t v = *(vbool1_t*)(in + i + 400); + *(vbool1_t*)(out + i + 400) = v; + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {\.L[0-9]+:\s+vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]\s+\.L[0-9]+} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]\s+j\s+\.L[0-9]+} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-10.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-10.c new file mode 100644 index 0000000..697b093 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-10.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int32_t * restrict in, int32_t * restrict out, size_t n, size_t m, size_t cond, size_t cond2) +{ + for (size_t i = 0; i < n; i++) + { + if (i != cond) { + vbool16_t v = *(vbool16_t*)(in + i + 400); + *(vbool16_t*)(out + i + 400) = v; + for (int j = 0; j < m; j++) { + vuint8mf2_t v = *(vuint8mf2_t*)(in + i + 100 + j); + *(vuint8mf2_t*)(out + i + 100 + j) = v; + } + } else if (i == cond2) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + i + 200); + *(vuint16mf2_t*)(out + i + 200) = v; + } else { + vint8mf8_t v = *(vint8mf8_t*)(in + i + 100); + *(vint8mf8_t*)(out + i + 100) = v; + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli} 5 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-11.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-11.c new file mode 100644 index 0000000..1dab5ed --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-11.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int32_t * restrict in, int32_t * restrict out, size_t n, size_t m, size_t cond, size_t cond2) +{ + for (int i = 0; i < n; i++) { + vint8mf8_t v = *(vint8mf8_t*) (in + i + 1); + *(vint8mf8_t*) (out + i + 1) = v; + } + for (int i = 0; i < n; i++) { + vfloat32mf2_t v = *(vfloat32mf2_t*) (in + i + 2); + *(vfloat32mf2_t*) (out + i + 2) = v; + } + for (int i = 0; i < n; i++) { + vfloat32mf2_t v; + *(vfloat32mf2_t*) (out + i + 3) = v; + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-12.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-12.c new file mode 100644 index 0000000..38828bc --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-12.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f2 (int32_t * restrict in, int32_t * restrict in2, int32_t * restrict out, int32_t * restrict out2, size_t n, size_t m, size_t cond, size_t cond2) +{ + for (int i = 0; i < n; i++){ + out2[i] = in2[i] + out[i]; + } + for (int i = 0; i < n; i++){ + out[i] = in[i] & out2[i]; + } + for (int i = 0; i < n; i++){ + out2[i] = out[i] * out2[i]; + } + for (size_t i = 0; i < n; i++) + { + if (i > cond) { + if (cond2) { + for (int j = 0; j < m; j++) { + vint8mf8_t v2 = *(vint8mf8_t*)(in2 + i + 100 + j); + *(vint8mf8_t*)(out2 + i + 100 + j) = v2; + } + } else { + for (int j = 0; j < m; j++) { + vfloat32mf2_t v3 = *(vfloat32mf2_t*)(in2 + i + 300 + j); + *(vfloat32mf2_t*)(out2 + i + 100 + j) = v3; + } + } + } else { + vbool64_t v = *(vbool64_t*)(in + i + 400); + *(vbool64_t*)(out + i + 400) = v; + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-2.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-2.c new file mode 100644 index 0000000..cd01c9f --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-2.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int32_t * restrict in, int32_t * restrict out, size_t n, size_t cond, size_t cond2) +{ + for (size_t i = 0; i < n; i++) + { + if (i == cond) { + vint8mf8_t v = *(vint8mf8_t*)(in + i + 100); + *(vint8mf8_t*)(out + i + 100) = v; + } else { + vbool1_t v = *(vbool1_t*)(in + i + 400); + *(vbool1_t*)(out + i + 400) = v; + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]\s+\.L[0-9]+} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]\s+j\s+\.L[0-9]+} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-3.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-3.c new file mode 100644 index 0000000..d79e83a --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-3.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f2 (int32_t * restrict in, int32_t * restrict in2, int32_t * restrict out, int32_t * restrict out2, size_t n, size_t m, size_t cond, size_t cond2) +{ + for (size_t i = 0; i < n; i++) + { + if (i > cond) { + if (cond2) { + for (int j = 0; j < m; j++) { + vint8mf8_t v2 = *(vint8mf8_t*)(in2 + i + 100 + j); + *(vint8mf8_t*)(out2 + i + 100 + j) = v2; + } + } else { + for (int j = 0; j < m; j++) { + vfloat32mf2_t v3 = *(vfloat32mf2_t*)(in2 + i + 300 + j); + *(vfloat32mf2_t*)(out2 + i + 100 + j) = v3; + } + } + } else { + vbool64_t v = *(vbool64_t*)(in + i + 400); + *(vbool64_t*)(out + i + 400) = v; + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-4.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-4.c new file mode 100644 index 0000000..44bd4d8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-4.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int32_t * restrict in, int32_t * restrict out, size_t n, size_t cond, size_t cond2) +{ + for (size_t i = 0; i < n; i++) + { + if (i == cond) { + vint8mf8_t v = *(vint8mf8_t*)(in + i + 100); + *(vint8mf8_t*)(out + i + 100) = v; + } else if (i == cond2) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + i + 200); + *(vfloat32mf2_t*)(out + i + 200) = v; + } else { + vbool1_t v = *(vbool1_t*)(in + i + 400); + *(vbool1_t*)(out + i + 400) = v; + } + } +} + + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]\s+\.L[0-9]:+} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 5 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ + diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-5.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-5.c new file mode 100644 index 0000000..12f40f3 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-5.c @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int32_t * restrict in, int32_t * restrict out, size_t n, size_t cond, size_t cond2) +{ + for (size_t i = 0; i < n; i++) + { + if (i == cond) { + vint8mf8_t v = *(vint8mf8_t*)(in + i + 100); + *(vint8mf8_t*)(out + i + 100) = v; + } else if (i == cond2) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + i + 200); + *(vfloat32mf2_t*)(out + i + 200) = v; + } else if (i == (cond2 - 1)) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + i + 300); + *(vuint16mf2_t*)(out + i + 300) = v; + } else { + vbool1_t v = *(vbool1_t*)(in + i + 400); + *(vbool1_t*)(out + i + 400) = v; + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 4 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]\s+\.L[0-9]:+} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 7 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ + diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-6.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-6.c new file mode 100644 index 0000000..217ce11 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-6.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int32_t * in, int32_t * out, int n, int cond) +{ + if (cond) { + vint32mf2_t v = *(vint32mf2_t*) (in + 100); + *(vint32mf2_t*) (out + 100) = v; + } else { + vint16mf2_t v = *(vint16mf2_t*) (in + 200); + *(vint16mf2_t*) (out + 200) = v; + } + + for (int i = 0; i < n; i++) { + vint8mf8_t v = *(vint8mf8_t*) (in + 300 + i); + *(vint8mf8_t*) (out + 300 + i) = v; + } +} + +/* { dg-final { scan-assembler-times {\.L[0-9]+:\s+vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]\s+\.L[0-9]+:} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {\.L[0-9]+:\s+vle8\.v} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-7.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-7.c new file mode 100644 index 0000000..05058b8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-7.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int32_t * restrict in, int32_t * restrict out, size_t n, size_t cond, size_t cond2) +{ + for (size_t i = 0; i < n; i++) + { + if (i != cond) { + vbool1_t v = *(vbool1_t*)(in + i + 400); + *(vbool1_t*)(out + i + 400) = v; + } else if (i == cond2) { + vfloat32mf2_t v = *(vfloat32mf2_t*)(in + i + 200); + *(vfloat32mf2_t*)(out + i + 200) = v; + } else { + vint8mf8_t v = *(vint8mf8_t*)(in + i + 100); + *(vint8mf8_t*)(out + i + 100) = v; + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli} 4 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {j\s+\.L[0-9]+\s+\.L[0-9]+:\s+vlm\.v} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-8.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-8.c new file mode 100644 index 0000000..79a02e4 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-8.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int32_t * restrict in, int32_t * restrict out, size_t n, size_t cond, size_t cond2) +{ + for (size_t i = 0; i < n; i++) + { + if (i != cond) { + vbool1_t v = *(vbool1_t*)(in + i + 400); + *(vbool1_t*)(out + i + 400) = v; + } else if (i == cond2) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + i + 200); + *(vuint16mf2_t*)(out + i + 200) = v; + } else { + vint8mf8_t v = *(vint8mf8_t*)(in + i + 100); + *(vint8mf8_t*)(out + i + 100) = v; + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli} 5 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {j\s+\.L[0-9]+\s+\.L[0-9]+:\s+vlm\.v} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-9.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-9.c new file mode 100644 index 0000000..bd6d552 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-9.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int32_t * restrict in, int32_t * restrict out, size_t n, size_t m, size_t cond, size_t cond2) +{ + for (size_t i = 0; i < n; i++) + { + if (i != cond) { + vbool1_t v = *(vbool1_t*)(in + i + 400); + *(vbool1_t*)(out + i + 400) = v; + for (int j = 0; j < m; j++) { + vint32mf2_t v = *(vint32mf2_t*)(in + i + 100 + j); + *(vint32mf2_t*)(out + i + 100 + j) = v; + } + } else if (i == cond2) { + vuint16mf2_t v = *(vuint16mf2_t*)(in + i + 200); + *(vuint16mf2_t*)(out + i + 200) = v; + } else { + vint8mf8_t v = *(vint8mf8_t*)(in + i + 100); + *(vint8mf8_t*)(out + i + 100) = v; + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli} 7 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */