| 1 |
/* { dg-do compile { target { ! riscv_abi_e } } } */ |
| 2 |
/* { dg-options "-march=rv32gc_xtheadmac" { target { rv32 } } } */ |
| 3 |
/* { dg-options "-march=rv64gc_xtheadmac" { target { rv64 } } } */ |
| 4 |
/* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Og" } } */ |
| 5 |
|
| 6 |
long f_mula(long a, long b, long c) |
| 7 |
{ |
| 8 |
return a + b * c; |
| 9 |
} |
| 10 |
|
| 11 |
long f_muls(long a, long b, long c) |
| 12 |
{ |
| 13 |
return a - b * c; |
| 14 |
} |
| 15 |
|
| 16 |
#if __riscv_xlen == 64 |
| 17 |
int f_mulaw(int a, int b, int c) |
| 18 |
{ |
| 19 |
return a + b * c; |
| 20 |
} |
| 21 |
|
| 22 |
int f_mulsw(int a, int b, int c) |
| 23 |
{ |
| 24 |
return a - b * c; |
| 25 |
} |
| 26 |
#endif |
| 27 |
|
| 28 |
long f_mulah(int a, unsigned short b, unsigned short c) |
| 29 |
{ |
| 30 |
return a + (int)(short)b * (int)(short)c; |
| 31 |
} |
| 32 |
|
| 33 |
long f_mulsh(int a, unsigned short b, unsigned short c) |
| 34 |
{ |
| 35 |
return a - (int)(short)b * (int)(short)c; |
| 36 |
} |
| 37 |
|
| 38 |
/* { dg-final { scan-assembler-times "th.mula\t" 1 } } */ |
| 39 |
/* { dg-final { scan-assembler-times "th.muls\t" 1 } } */ |
| 40 |
/* { dg-final { scan-assembler-times "th.mulaw\t" 1 { target { rv64 } } } } */ |
| 41 |
/* { dg-final { scan-assembler-times "th.mulsw\t" 1 { target { rv64 } } } } */ |
| 42 |
/* { dg-final { scan-assembler-times "th.mulah\t" 1 } } */ |
| 43 |
/* { dg-final { scan-assembler-times "th.mulsh\t" 1 } } */ |