| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-skip-if "ARC700 always has mpy option on" { arc700 } } */ |
| 3 |
/* { dg-skip-if "ARC600 doesn't have mpy instruction" { arc6xx } } */ |
| 4 |
/* { dg-options "-O2 -mmpy-option=0 -w -save-temps" } */ |
| 5 |
|
| 6 |
#include <stdlib.h> |
| 7 |
|
| 8 |
/* Hide value propagation from the optimizers. */ |
| 9 |
static int |
| 10 |
id (int i) |
| 11 |
{ |
| 12 |
asm ("": "+r" (i)); |
| 13 |
return i; |
| 14 |
} |
| 15 |
|
| 16 |
static int |
| 17 |
mulhigh (unsigned a, unsigned b) |
| 18 |
{ |
| 19 |
return (unsigned long long) a * b >> 32; |
| 20 |
} |
| 21 |
|
| 22 |
int |
| 23 |
main (void) |
| 24 |
{ |
| 25 |
if (mulhigh (id (0x12345678), id (0x90abcdef)) != 0xa49a83e) |
| 26 |
abort (); |
| 27 |
return 0; |
| 28 |
} |
| 29 |
|
| 30 |
/* { dg-final { scan-assembler-not "mpyhu\[ \t\]" } } */ |
| 31 |
/* { dg-final { scan-assembler "@__muldi3" } } */ |