The 'you' here is Richi, which Richi is probably aware but maybe not the rest of the list :')

On 09/06/2020 15:29, Andre Vieira (lists) wrote:
Hi,

So this is my rework of the code you sent me, I have not included the 'permute' code you included as I can't figure out what it is meant to be doing. Maybe something to look at later.

I have also included three tests that show it working for some simple cases and even a nested one.

Unfortunately it will not handle other simple cases where reassoc doesn't put the reduction in the form of :
sum0 = a + b;
sum1 = c + sum0;
...

For instance a testcase I have been looking at is:
unsigned int u32_single_abs_sum (unsigned int * a, unsigned int * b)
{
  unsigned int sub0 = a[0] - b[0];
  unsigned int sub1 = a[1] - b[1];
  unsigned int sub2 = a[2] - b[2];
  unsigned int sub3 = a[3] - b[3];
  unsigned int sum = sub0 + sub1;
  sum += sub2;
  sum += sub3;
  return sum;
}

Unfortunately, the code that reaches slp will look like:
  _1 = *a_10(D);
  _2 = *b_11(D);
  _3 = MEM[(unsigned int *)a_10(D) + 4B];
  _4 = MEM[(unsigned int *)b_11(D) + 4B];
  _5 = MEM[(unsigned int *)a_10(D) + 8B];
  _6 = MEM[(unsigned int *)b_11(D) + 8B];
  _7 = MEM[(unsigned int *)a_10(D) + 12B];
  _8 = MEM[(unsigned int *)b_11(D) + 12B];
  _28 = _1 - _2;
  _29 = _3 + _28;
  _30 = _29 - _4;
  _31 = _5 + _30;
  _32 = _31 - _6;
  _33 = _7 + _32;
  sum_18 = _33 - _8;
  return sum_18;

Which doesn't have the format expected as I described above... I am wondering how to teach it to support this. Maybe starting with your suggestion of making plus_expr and minus_expr have the same hash, so it groups all these statements together might be a start, but you'd still need to 'rebalance' the tree somehow.... I need to give this a bit more thought but I wanted to share what I have so far.

The code is severely lacking in comments for now btw...

Cheers,
Andre

Reply via email to