view gcc/testsuite/gcc.target/riscv/shorten-memrefs-2.c @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
line wrap: on
line source

/* { dg-options "-Os -march=rv32imc -mabi=ilp32" } */

/* shorten_memrefs should rewrite these load/stores into a compressible
   format.  */

void
store1a (int *array, int a)
{
  array[200] = a;
  array[201] = a;
  array[202] = a;
  array[203] = a;
}

void
store2a (long long *array, long long a)
{
  array[200] = a;
  array[201] = a;
  array[202] = a;
  array[203] = a;
}

int
load1r (int *array)
{
  int a = 0;
  a += array[200];
  a += array[201];
  a += array[202];
  a += array[203];
  return a;
}

long long
load2r (long long *array)
{
  int a = 0;
  a += array[200];
  a += array[201];
  a += array[202];
  a += array[203];
  return a;
}

/* { dg-final { scan-assembler "store1a:\n\taddi" } } */
/* The sd insns in store2a are not rewritten because shorten_memrefs currently
   only optimizes lw and sw.
/* { dg-final { scan-assembler "store2a:\n\taddi" { xfail riscv*-*-*  } } } */
/* { dg-final { scan-assembler "load1r:\n\taddi" } } */
/* { dg-final { scan-assembler "load2r:\n\taddi" } } */