[Embench] aha-mont64 unfairly penalises 64bit architectures

Anton Blanchard anton at ozlabs.org
Tue Oct 22 02:29:26 CEST 2019


Hi,

aha-mont64 contains an open coded 64 x 64 -> 128 bit multiplication:

void
mulul64 (uint64 u, uint64 v, uint64 * whi, uint64 * wlo)
{
  uint64 u0, u1, v0, v1, k, t;
  uint64 w0, w1, w2;

  u1 = u >> 32;
  u0 = u & 0xFFFFFFFF;
  v1 = v >> 32;
  v0 = v & 0xFFFFFFFF;

  t = u0 * v0;
  w0 = t & 0xFFFFFFFF;
  k = t >> 32;

  t = u1 * v0 + k;
  w1 = t & 0xFFFFFFFF;
  w2 = t >> 32;

  t = u0 * v1 + w1;
  k = t >> 32;

  *wlo = (t << 32) + w0;
  *whi = u1 * v1 + w2 + k;

  return;
}

This is very sub optimal on 64 bit architectures where it could be done
in 2 instructions. Potential fix:

https://github.com/embench/embench-iot/pull/19

Thanks,
Anton



More information about the Embench mailing list