[ARM backend] SMLAL issue

Hi James,
Patch for this is almost ready, I am now considering some cases around SMLALBB.

I came across one the gcc test cases and was a but puzzeled and hoped you would clarify it.

/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-require-effective-target arm_dsp } */

long long
foo (long long a, char *b, char *c)
  return a + *b * *c;

/* { dg-final { scan-assembler "umlal" } } */

For this test case, why is gcc toolchain expecting UMLAL instead of SMLAL, because the multiplication is being done on signed char values?

Jyoti Allur

Hi Jyoti,

From memory, char is unsigned on ARM platforms. So the multiplication needs to be done unsigned and the add doesn’t care, so UMLAL would be right.