| 1 |
/* { dg-do compile { target { ! riscv_abi_e } } } */ |
| 2 |
/* { dg-options "-march=rv32gc_xtheadba" { target { rv32 } } } */ |
| 3 |
/* { dg-options "-march=rv64gc_xtheadba" { target { rv64 } } } */ |
| 4 |
/* { dg-skip-if "" { *-*-* } { "-O0" } } */ |
| 5 |
|
| 6 |
long |
| 7 |
test_1 (long a, long b) |
| 8 |
{ |
| 9 |
/* th.addsl aX, aX, 1 */ |
| 10 |
return a + (b << 1); |
| 11 |
} |
| 12 |
|
| 13 |
int |
| 14 |
foos (short *x, int n) |
| 15 |
{ |
| 16 |
/* th.addsl aX, aX, 1 */ |
| 17 |
return x[n]; |
| 18 |
} |
| 19 |
|
| 20 |
long |
| 21 |
test_2 (long a, long b) |
| 22 |
{ |
| 23 |
/* th.addsl aX, aX, 2 */ |
| 24 |
return a + (b << 2); |
| 25 |
} |
| 26 |
|
| 27 |
int |
| 28 |
fooi (int *x, int n) |
| 29 |
{ |
| 30 |
/* th.addsl aX, aX, 2 */ |
| 31 |
return x[n]; |
| 32 |
} |
| 33 |
|
| 34 |
long |
| 35 |
test_3 (long a, long b) |
| 36 |
{ |
| 37 |
/* th.addsl aX, aX, 3 */ |
| 38 |
return a + (b << 3); |
| 39 |
} |
| 40 |
|
| 41 |
long |
| 42 |
fool (long *x, int n) |
| 43 |
{ |
| 44 |
/* th.addsl aX, aX, 2 (rv32) */ |
| 45 |
/* th.addsl aX, aX, 3 (rv64) */ |
| 46 |
return x[n]; |
| 47 |
} |
| 48 |
|
| 49 |
/* { dg-final { scan-assembler-times "th.addsl\[ \t\]*a\[0-9\]+,a\[0-9\]+,a\[0-9\]+,1" 2 } } */ |
| 50 |
|
| 51 |
/* { dg-final { scan-assembler-times "th.addsl\[ \t\]*a\[0-9\]+,a\[0-9\]+,a\[0-9\]+,2" 3 { target { rv32 } } } } */ |
| 52 |
/* { dg-final { scan-assembler-times "th.addsl\[ \t\]*a\[0-9\]+,a\[0-9\]+,a\[0-9\]+,2" 2 { target { rv64 } } } } */ |
| 53 |
|
| 54 |
/* { dg-final { scan-assembler-times "th.addsl\[ \t\]*a\[0-9\]+,a\[0-9\]+,a\[0-9\]+,3" 1 { target { rv32 } } } } */ |
| 55 |
/* { dg-final { scan-assembler-times "th.addsl\[ \t\]*a\[0-9\]+,a\[0-9\]+,a\[0-9\]+,3" 2 { target { rv64 } } } } */ |