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