view gcc/testsuite/gcc.dg/tree-ssa/reassoc-14.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-reassoc1" } */

unsigned int test1 (unsigned int x, unsigned int y, unsigned int z,
		    unsigned int weight)
{
  unsigned int tmp1 = x * weight;
  unsigned int tmp2 = y * weight;
  unsigned int tmp3 = (x - y) * weight;
  return tmp1 + (tmp2 + tmp3);
}

unsigned int test2 (unsigned int x, unsigned int y, unsigned int z,
		    unsigned int weight)
{
  unsigned int tmp1 = x * weight;
  unsigned int tmp2 = y * weight * weight;
  unsigned int tmp3 = z * weight * weight * weight;
  return tmp1 + tmp2 + tmp3;
}

/* There should be two multiplication left in test1 (inculding one generated
   when converting addition to multiplication) and three in test2.  */

/* { dg-final { scan-tree-dump-times "\\\*" 5 "reassoc1" } } */