| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Og" } } */ |
| 3 |
/* { dg-options "-march=rv64gc_xtheadmemidx -mabi=lp64" } */ |
| 4 |
|
| 5 |
/* XTheadMemIdx support is implemented such that reg+reg addressing mode |
| 6 |
loads/stores are preferred over standard loads/stores. |
| 7 |
If this order changed using inline assembly, the result will be invalid |
| 8 |
instructions. This test serves the purpose of documenting this |
| 9 |
limitation until a solution is available. */ |
| 10 |
|
| 11 |
void foo (void *p, unsigned long off, unsigned long val) |
| 12 |
{ |
| 13 |
unsigned long *tmp = (unsigned long*)(p + off); |
| 14 |
asm volatile ("sd %1,%0" : "=m"(*tmp) : "r"(val)); |
| 15 |
} |
| 16 |
|
| 17 |
void bar (void *p, unsigned long off, unsigned long val) |
| 18 |
{ |
| 19 |
unsigned long *tmp = (unsigned long*)(p + off); |
| 20 |
asm volatile ("th.srd %1,%0" : "=m"(*tmp) : "r"(val)); |
| 21 |
} |
| 22 |
|
| 23 |
/* { dg-final { scan-assembler "sd\t\[a-z\]\[0-9\]+,0\\(\[a-z\]\[0-9\]+\\)" { xfail *-*-* } } } */ |
| 24 |
/* { dg-final { scan-assembler-not "sd\t\[a-z\]\[0-9\]+,\[a-z\]\[0-9\]+,\[a-z\]\[0-9\]+,0" { xfail *-*-* } } } */ |
| 25 |
/* { dg-final { scan-assembler "th\.srd\t\[a-z\]\[0-9\]+,\[a-z\]\[0-9\]+,\[a-z\]\[0-9\]+,0" } } */ |
| 26 |
/* { dg-final { scan-assembler-not "th\.srd\t\[a-z\]\[0-9\]+,0\\(\[a-z\]\[0-9\]+\\)" } } */ |