| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target rv32 } */ |
| 3 |
/* { dg-options "-march=rv32gc -mabi=ilp32d -mtune=generic-ooo" } */ |
| 4 |
/* { dg-skip-if "" { *-*-* } {"-O0" "-Os" "-Og" "-Oz" "-flto" } } */ |
| 5 |
/* { dg-final { check-function-bodies "**" "" } } */ |
| 6 |
/* { dg-allow-blank-lines-in-output 1 } */ |
| 7 |
|
| 8 |
#define COPY_N(N) \ |
| 9 |
void copy_##N (void *to, void *from) \ |
| 10 |
{ \ |
| 11 |
__builtin_memcpy (to, from, N); \ |
| 12 |
} |
| 13 |
|
| 14 |
#define COPY_ALIGNED_N(N) \ |
| 15 |
void copy_aligned_##N (void *to, void *from) \ |
| 16 |
{ \ |
| 17 |
to = __builtin_assume_aligned(to, sizeof(long)); \ |
| 18 |
from = __builtin_assume_aligned(from, sizeof(long)); \ |
| 19 |
__builtin_memcpy (to, from, N); \ |
| 20 |
} |
| 21 |
|
| 22 |
/* |
| 23 |
**copy_7: |
| 24 |
** ... |
| 25 |
** lw\t[at][0-9],0\([at][0-9]\) |
| 26 |
** sw\t[at][0-9],0\([at][0-9]\) |
| 27 |
** lw\t[at][0-9],3\([at][0-9]\) |
| 28 |
** sw\t[at][0-9],3\([at][0-9]\) |
| 29 |
** ... |
| 30 |
*/ |
| 31 |
COPY_N(7) |
| 32 |
|
| 33 |
/* |
| 34 |
**copy_aligned_7: |
| 35 |
** ... |
| 36 |
** lw\t[at][0-9],0\([at][0-9]\) |
| 37 |
** sw\t[at][0-9],0\([at][0-9]\) |
| 38 |
** lw\t[at][0-9],3\([at][0-9]\) |
| 39 |
** sw\t[at][0-9],3\([at][0-9]\) |
| 40 |
** ... |
| 41 |
*/ |
| 42 |
COPY_ALIGNED_N(7) |
| 43 |
|
| 44 |
/* |
| 45 |
**copy_8: |
| 46 |
** ... |
| 47 |
** lw\ta[0-9],0\(a[0-9]\) |
| 48 |
** sw\ta[0-9],0\(a[0-9]\) |
| 49 |
** ... |
| 50 |
*/ |
| 51 |
COPY_N(8) |
| 52 |
|
| 53 |
/* |
| 54 |
**copy_aligned_8: |
| 55 |
** ... |
| 56 |
** lw\ta[0-9],0\(a[0-9]\) |
| 57 |
** sw\ta[0-9],0\(a[0-9]\) |
| 58 |
** ... |
| 59 |
*/ |
| 60 |
COPY_ALIGNED_N(8) |
| 61 |
|
| 62 |
/* |
| 63 |
**copy_11: |
| 64 |
** ... |
| 65 |
** ... |
| 66 |
** lw\t[at][0-9],0\([at][0-9]\) |
| 67 |
** sw\t[at][0-9],0\([at][0-9]\) |
| 68 |
** ... |
| 69 |
** lw\t[at][0-9],7\([at][0-9]\) |
| 70 |
** sw\t[at][0-9],7\([at][0-9]\) |
| 71 |
** ... |
| 72 |
*/ |
| 73 |
COPY_N(11) |
| 74 |
|
| 75 |
/* |
| 76 |
**copy_aligned_11: |
| 77 |
** ... |
| 78 |
** lw\t[at][0-9],0\([at][0-9]\) |
| 79 |
** sw\t[at][0-9],0\([at][0-9]\) |
| 80 |
** ... |
| 81 |
** lw\t[at][0-9],7\([at][0-9]\) |
| 82 |
** sw\t[at][0-9],7\([at][0-9]\) |
| 83 |
** ... |
| 84 |
*/ |
| 85 |
COPY_ALIGNED_N(11) |
| 86 |
|
| 87 |
/* |
| 88 |
**copy_15: |
| 89 |
** ... |
| 90 |
** lw\t[at][0-9],0\([at][0-9]\) |
| 91 |
** ... |
| 92 |
** sw\t[at][0-9],0\([at][0-9]\) |
| 93 |
** ... |
| 94 |
** lw\t[at][0-9],11\([at][0-9]\) |
| 95 |
** sw\t[at][0-9],11\([at][0-9]\) |
| 96 |
** ... |
| 97 |
*/ |
| 98 |
COPY_N(15) |
| 99 |
|
| 100 |
/* |
| 101 |
**copy_aligned_15: |
| 102 |
** ... |
| 103 |
** lw\t[at][0-9],0\([at][0-9]\) |
| 104 |
** ... |
| 105 |
** sw\t[at][0-9],0\([at][0-9]\) |
| 106 |
** ... |
| 107 |
** lw\t[at][0-9],11\([at][0-9]\) |
| 108 |
** sw\t[at][0-9],11\([at][0-9]\) |
| 109 |
** ... |
| 110 |
*/ |
| 111 |
COPY_ALIGNED_N(15) |
| 112 |
|
| 113 |
/* |
| 114 |
**copy_27: |
| 115 |
** ... |
| 116 |
** lw\t[at][0-9],20\([at][0-9]\) |
| 117 |
** ... |
| 118 |
** sw\t[at][0-9],20\([at][0-9]\) |
| 119 |
** ... |
| 120 |
** lw\t[at][0-9],23\([at][0-9]\) |
| 121 |
** sw\t[at][0-9],23\([at][0-9]\) |
| 122 |
** ... |
| 123 |
*/ |
| 124 |
COPY_N(27) |
| 125 |
|
| 126 |
/* |
| 127 |
**copy_aligned_27: |
| 128 |
** ... |
| 129 |
** lw\t[at][0-9],20\([at][0-9]\) |
| 130 |
** ... |
| 131 |
** sw\t[at][0-9],20\([at][0-9]\) |
| 132 |
** ... |
| 133 |
** lw\t[at][0-9],23\([at][0-9]\) |
| 134 |
** sw\t[at][0-9],23\([at][0-9]\) |
| 135 |
** ... |
| 136 |
*/ |
| 137 |
COPY_ALIGNED_N(27) |