https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117323
--- Comment #6 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #5)
> Note the reasoning for the difference in arguments between aarch64 and
> x86_64 is that x86_64 defines PUSH_ARGS_REVERSED to be 1.
Interesting define min/max as macro works perfect
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
void
foo1 (short* p1, short* p2, char* __restrict p3, int n)
{
for (int i = 0; i != n; i++)
{
short sum0 = p1[i];
short sum1 = p2[i];
sum0 = MAX(0, MIN(127, sum0));
sum1 = MAX(0, MIN(127, sum1));
p3[i] = static_cast<char>(sum0 * sum1 / 128);
}
}