diff options
| -rw-r--r-- | doc/install.html | 4 | ||||
| -rw-r--r-- | src/lj_arch.h | 6 | ||||
| -rw-r--r-- | src/lj_def.h | 24 |
3 files changed, 30 insertions, 4 deletions
diff --git a/doc/install.html b/doc/install.html index 12f28d4f..de934abc 100644 --- a/doc/install.html +++ b/doc/install.html | |||
| @@ -123,8 +123,8 @@ operating system, CPU and compilers: | |||
| 123 | </tr> | 123 | </tr> |
| 124 | <tr class="odd"> | 124 | <tr class="odd"> |
| 125 | <td class="compatcpu">ARM</td> | 125 | <td class="compatcpu">ARM</td> |
| 126 | <td class="compatos">GCC 4.3+</td> | 126 | <td class="compatos">GCC 4.2+</td> |
| 127 | <td class="compatos">GCC 4.3+</td> | 127 | <td class="compatos">GCC 4.2+</td> |
| 128 | <td class="compatos compatno"> </td> | 128 | <td class="compatos compatno"> </td> |
| 129 | <td class="compatos compatno"> </td> | 129 | <td class="compatos compatno"> </td> |
| 130 | </tr> | 130 | </tr> |
diff --git a/src/lj_arch.h b/src/lj_arch.h index 3ddc3e46..f179cf80 100644 --- a/src/lj_arch.h +++ b/src/lj_arch.h | |||
| @@ -173,7 +173,11 @@ | |||
| 173 | #if __GNUC__ < 4 | 173 | #if __GNUC__ < 4 |
| 174 | #error "Need at least GCC 4.0 or newer" | 174 | #error "Need at least GCC 4.0 or newer" |
| 175 | #endif | 175 | #endif |
| 176 | #elif LJ_TARGET_ARM || LJ_TARGET_PPC | 176 | #elif LJ_TARGET_ARM |
| 177 | #if (__GNUC__ < 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ < 2) | ||
| 178 | #error "Need at least GCC 4.2 or newer" | ||
| 179 | #endif | ||
| 180 | #elif LJ_TARGET_PPC | ||
| 177 | #if (__GNUC__ < 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ < 3) | 181 | #if (__GNUC__ < 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ < 3) |
| 178 | #error "Need at least GCC 4.3 or newer" | 182 | #error "Need at least GCC 4.3 or newer" |
| 179 | #endif | 183 | #endif |
diff --git a/src/lj_def.h b/src/lj_def.h index b7df8606..c60bc118 100644 --- a/src/lj_def.h +++ b/src/lj_def.h | |||
| @@ -131,7 +131,29 @@ static LJ_AINLINE uint32_t lj_fls(uint32_t x) | |||
| 131 | #define lj_fls(x) ((uint32_t)(__builtin_clz(x)^31)) | 131 | #define lj_fls(x) ((uint32_t)(__builtin_clz(x)^31)) |
| 132 | #endif | 132 | #endif |
| 133 | 133 | ||
| 134 | #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) | 134 | #if defined(__arm__) |
| 135 | static LJ_AINLINE uint32_t lj_bswap(uint32_t x) | ||
| 136 | { | ||
| 137 | uint32_t r; | ||
| 138 | #if __ARM_ARCH_6__ || __ARM_ARCH_6J__ || __ARM_ARCH_6T2__ || __ARM_ARCH_6Z__ ||\ | ||
| 139 | __ARM_ARCH_7__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ | ||
| 140 | __asm__("rev %0, %1" : "=r" (r) : "r" (x)); | ||
| 141 | return r; | ||
| 142 | #else | ||
| 143 | #ifdef __thumb__ | ||
| 144 | r = x ^ lj_ror(x, 16); | ||
| 145 | #else | ||
| 146 | __asm__("eor %0, %1, %1, ror #16" : "=r" (r) : "r" (x)); | ||
| 147 | #endif | ||
| 148 | return ((r & 0xff00ffffu) >> 8) ^ lj_ror(x, 8); | ||
| 149 | #endif | ||
| 150 | } | ||
| 151 | |||
| 152 | static LJ_AINLINE uint64_t lj_bswap64(uint64_t x) | ||
| 153 | { | ||
| 154 | return ((uint64_t)lj_bswap((uint32_t)x)<<32) | lj_bswap((uint32_t)(x>>32)); | ||
| 155 | } | ||
| 156 | #elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) | ||
| 135 | static LJ_AINLINE uint32_t lj_bswap(uint32_t x) | 157 | static LJ_AINLINE uint32_t lj_bswap(uint32_t x) |
| 136 | { | 158 | { |
| 137 | return (uint32_t)__builtin_bswap32((int32_t)x); | 159 | return (uint32_t)__builtin_bswap32((int32_t)x); |
