]> gcc.gnu.org Git - gcc.git/commit
RISC-V: Make full-vec-move1.c test robust for optimization
authorPan Li <pan2.li@intel.com>
Thu, 9 May 2024 02:56:46 +0000 (10:56 +0800)
committerJeff Law <jlaw@ventanamicro.com>
Mon, 27 May 2024 00:00:08 +0000 (18:00 -0600)
commit227ec9bfd49a7bf388f5c5ddd4f556e254c7a928
tree02f598df29dbf759b55ec912e1753b664da80830
parent94912842c2baae5ac6a1fe0c0d91330a7376d21f
RISC-V: Make full-vec-move1.c test robust for optimization

During investigate the support of early break autovec, we notice
the test full-vec-move1.c will be optimized to 'return 0;' in main
function body.  Because somehow the value of V type is compiler
time constant,  and then the second loop will be considered as
assert (true).

Thus,  the ccp4 pass will eliminate these stmt and just return 0.

typedef int16_t V __attribute__((vector_size (128)));

int main ()
{
  V v;
  for (int i = 0; i < sizeof (v) / sizeof (v[0]); i++)
    (v)[i] = i;

  V res = v;
  for (int i = 0; i < sizeof (v) / sizeof (v[0]); i++)
    assert (res[i] == i); // will be optimized to assert (true)
}

This patch would like to introduce a extern function to use the res[i]
that get rid of the ccp4 optimization.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vls-vlmax/full-vec-move1.c:
Introduce extern func use to get rid of ccp4 optimization.

Signed-off-by: Pan Li <pan2.li@intel.com>
(cherry picked from commit b1520d2260c5e0cfcd7a4354fab70f66e2912ff2)
gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/full-vec-move1.c
This page took 0.061982 seconds and 6 git commands to generate.