| 1 |
/* { dg-do compile { target { ! riscv_abi_e } } } */ |
| 2 |
/* { dg-options "-march=rv32gc_zbb" { target { rv32 } } } */ |
| 3 |
/* { dg-options "-march=rv64gc_zbb" { target { rv64 } } } */ |
| 4 |
/* { dg-skip-if "" { *-*-* } { "-O0" "-Os" "-Og" "-Oz" } } */ |
| 5 |
|
| 6 |
#include <stddef.h> |
| 7 |
#define aligned32 __attribute__ ((aligned (32))) |
| 8 |
|
| 9 |
const char myconst15[] aligned32 = { 1, 2, 3, 4, 5, 6, 7, |
| 10 |
0, 1, 2, 3, 4, 5, 6, 7 }; |
| 11 |
const char myconst23[] aligned32 = { 1, 2, 3, 4, 5, 6, 7, |
| 12 |
0, 1, 2, 3, 4, 5, 6, 7, |
| 13 |
0, 1, 2, 3, 4, 5, 6, 7 }; |
| 14 |
const char myconst31[] aligned32 = { 1, 2, 3, 4, 5, 6, 7, |
| 15 |
0, 1, 2, 3, 4, 5, 6, 7, |
| 16 |
0, 1, 2, 3, 4, 5, 6, 7, |
| 17 |
0, 1, 2, 3, 4, 5, 6, 7 }; |
| 18 |
|
| 19 |
/* No expansion (unknown alignment) */ |
| 20 |
#define MY_MEM_CMP_N(N) \ |
| 21 |
int my_mem_cmp_##N(const char *b1, const char *b2) \ |
| 22 |
{ \ |
| 23 |
return __builtin_memcmp (b1, b2, N); \ |
| 24 |
} |
| 25 |
|
| 26 |
/* No expansion (unknown alignment) */ |
| 27 |
#define MY_MEM_CMP_CONST_N(N) \ |
| 28 |
int my_mem_cmp_const_##N(const char *b1) \ |
| 29 |
{ \ |
| 30 |
return __builtin_memcmp (b1, myconst##N, sizeof(myconst##N)); \ |
| 31 |
} |
| 32 |
|
| 33 |
MY_MEM_CMP_N(15) |
| 34 |
MY_MEM_CMP_CONST_N(15) |
| 35 |
|
| 36 |
MY_MEM_CMP_N(23) |
| 37 |
MY_MEM_CMP_CONST_N(23) |
| 38 |
|
| 39 |
MY_MEM_CMP_N(31) |
| 40 |
MY_MEM_CMP_CONST_N(31) |
| 41 |
|
| 42 |
/* { dg-final { scan-assembler-times "\t(call|tail)\tmemcmp" 6 } } */ |