| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -mno-movbe" } */ |
| 3 |
/* { dg-final { scan-assembler-times "bswap\[ \t\]+" 5 { target { ! ia32 } } } } */ |
| 4 |
/* { dg-final { scan-assembler-times "bswap\[ \t\]+" 8 { target ia32 } } } */ |
| 5 |
|
| 6 |
#include<stdint.h> |
| 7 |
|
| 8 |
uint64_t |
| 9 |
__attribute__((noipa)) |
| 10 |
swap_rotate_64 (unsigned char* x) |
| 11 |
{ |
| 12 |
return ((uint64_t)(x[0]) << 0 | |
| 13 |
(uint64_t)(x[1]) << 56 | |
| 14 |
(uint64_t)(x[2]) << 48 | |
| 15 |
(uint64_t)(x[3]) << 40 | |
| 16 |
(uint64_t)(x[4]) << 32 | |
| 17 |
(uint64_t)(x[5]) << 24 | |
| 18 |
(uint64_t)(x[6]) << 16 | |
| 19 |
(uint64_t)(x[7]) << 8); |
| 20 |
} |
| 21 |
|
| 22 |
uint64_t |
| 23 |
__attribute__((noipa)) |
| 24 |
swap_rotate_64_mask_1 (unsigned char* x) |
| 25 |
{ |
| 26 |
return ((uint64_t)(x[0]) << 24 | |
| 27 |
(uint64_t)(x[1]) << 16 | |
| 28 |
(uint64_t)(x[2]) << 8 | |
| 29 |
(uint64_t)(0) << 0 | |
| 30 |
(uint64_t)(x[4]) << 56 | |
| 31 |
(uint64_t)(x[5]) << 48 | |
| 32 |
(uint64_t)(x[6]) << 40 | |
| 33 |
(uint64_t)(x[7]) << 32); |
| 34 |
} |
| 35 |
|
| 36 |
uint64_t |
| 37 |
__attribute__((noipa)) |
| 38 |
swap_rotate_64_mask_2 (unsigned char* x) |
| 39 |
{ |
| 40 |
return ((uint64_t)(x[0]) << 0 | |
| 41 |
(uint64_t)(x[1]) << 56 | |
| 42 |
(uint64_t)(x[2]) << 48 | |
| 43 |
(uint64_t)(0) << 40 | |
| 44 |
(uint64_t)(x[4]) << 32 | |
| 45 |
(uint64_t)(x[5]) << 24 | |
| 46 |
(uint64_t)(x[6]) << 16 | |
| 47 |
(uint64_t)(x[7]) << 8); |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
uint32_t |
| 52 |
__attribute__((noipa)) |
| 53 |
swap_rotate_32 (unsigned char* x) |
| 54 |
{ |
| 55 |
return ((uint64_t)(x[0]) << 8 | |
| 56 |
(uint64_t)(x[1]) << 0 | |
| 57 |
(uint64_t)(x[2]) << 24 | |
| 58 |
(uint64_t)(x[3]) << 16); |
| 59 |
} |
| 60 |
|
| 61 |
uint32_t |
| 62 |
__attribute__((noipa)) |
| 63 |
swap_rotate_32_mask_1 (unsigned char* x) |
| 64 |
{ |
| 65 |
return ((uint64_t)(x[0]) << 8 | |
| 66 |
(uint64_t)(0) << 0 | |
| 67 |
(uint64_t)(x[2]) << 24 | |
| 68 |
(uint64_t)(x[3]) << 16); |
| 69 |
} |