| 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 |
#define MY_MEM_CMP_ALIGNED_N(N) \ |
| 20 |
int my_mem_cmp_aligned_##N(const char *b1, const char *b2) \ |
| 21 |
{ \ |
| 22 |
b1 = __builtin_assume_aligned (b1, 4096); \ |
| 23 |
b2 = __builtin_assume_aligned (b2, 4096); \ |
| 24 |
return __builtin_memcmp (b1, b2, N); \ |
| 25 |
} |
| 26 |
|
| 27 |
#define MY_MEM_CMP_ALIGNED_CONST_N(N) \ |
| 28 |
int my_mem_cmp_aligned_const_##N(const char *b1) \ |
| 29 |
{ \ |
| 30 |
b1 = __builtin_assume_aligned (b1, 4096); \ |
| 31 |
return __builtin_memcmp (b1, myconst##N, sizeof(myconst##N)); \ |
| 32 |
} |
| 33 |
|
| 34 |
MY_MEM_CMP_ALIGNED_N(15) |
| 35 |
MY_MEM_CMP_ALIGNED_CONST_N(15) |
| 36 |
|
| 37 |
MY_MEM_CMP_ALIGNED_N(23) |
| 38 |
MY_MEM_CMP_ALIGNED_CONST_N(23) |
| 39 |
|
| 40 |
MY_MEM_CMP_ALIGNED_N(31) |
| 41 |
MY_MEM_CMP_ALIGNED_CONST_N(31) |
| 42 |
|
| 43 |
/* { dg-final { scan-assembler-not "\t(call|tail)\tmemcmp" } } */ |