| 1 |
/* Test the ACLE data intrinsics existence for specific instruction. */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-require-effective-target arm_arch_v6t2_hw } */ |
| 4 |
/* { dg-additional-options "--save-temps -O1" } */ |
| 5 |
/* { dg-add-options arm_arch_v6t2 } */ |
| 6 |
/* { dg-final { check-function-bodies "**" "" "" } } */ |
| 7 |
|
| 8 |
#include "arm_acle.h" |
| 9 |
|
| 10 |
extern void abort (void); |
| 11 |
|
| 12 |
uint32_t *g32; |
| 13 |
unsigned long *gul; |
| 14 |
uint64_t *g64; |
| 15 |
|
| 16 |
/* |
| 17 |
** test_rbit: |
| 18 |
** rbit r0, r0 |
| 19 |
** bx lr |
| 20 |
*/ |
| 21 |
|
| 22 |
uint32_t test_rbit (uint32_t a) |
| 23 |
{ |
| 24 |
return __rbit (a); |
| 25 |
} |
| 26 |
|
| 27 |
/* |
| 28 |
** test_rbitl: |
| 29 |
** rbit r0, r0 |
| 30 |
** bx lr |
| 31 |
*/ |
| 32 |
|
| 33 |
unsigned long test_rbitl (unsigned long a) |
| 34 |
{ |
| 35 |
return __rbitl (a); |
| 36 |
} |
| 37 |
|
| 38 |
/* |
| 39 |
** test_rbitll: |
| 40 |
** mov (r[0-9]+), r0 |
| 41 |
** rbit r0, r1 |
| 42 |
** rbit r1, \1 |
| 43 |
** bx lr |
| 44 |
*/ |
| 45 |
|
| 46 |
uint64_t test_rbitll (uint64_t a) |
| 47 |
{ |
| 48 |
return __rbitll (a); |
| 49 |
} |
| 50 |
|
| 51 |
/* |
| 52 |
** test_rbit_mem: |
| 53 |
** ... |
| 54 |
** rbit r[0-9]+, r[0-9]+ |
| 55 |
** ... |
| 56 |
** bx lr |
| 57 |
*/ |
| 58 |
|
| 59 |
void test_rbit_mem (uint32_t *a) |
| 60 |
{ |
| 61 |
*g32 = __rbit (*a); |
| 62 |
} |
| 63 |
|
| 64 |
/* |
| 65 |
** test_rbitl_mem: |
| 66 |
** ... |
| 67 |
** rbit r[0-9]+, r[0-9]+ |
| 68 |
** ... |
| 69 |
** bx lr |
| 70 |
*/ |
| 71 |
|
| 72 |
void test_rbitl_mem (unsigned long *a) |
| 73 |
{ |
| 74 |
*gul = __rbitl (*a); |
| 75 |
} |
| 76 |
|
| 77 |
/* |
| 78 |
** test_rbitll_mem: |
| 79 |
** ... |
| 80 |
** rbit r[0-9]+, r[0-9]+ |
| 81 |
** ... |
| 82 |
** bx lr |
| 83 |
*/ |
| 84 |
|
| 85 |
void test_rbitll_mem (uint64_t *a) |
| 86 |
{ |
| 87 |
*g64 = __rbitll (*a); |
| 88 |
} |
| 89 |
|
| 90 |
int |
| 91 |
main (int argc, char **argv) |
| 92 |
{ |
| 93 |
if (__rbit(0x12345678) != 0x1e6a2c48) { abort(); } |
| 94 |
if (__rbitl(0x12345678) != 0x1e6a2c48) { abort(); } |
| 95 |
if (__rbitll(0x1234567890abcdef) != 0xf7b3d5091e6a2c48) { abort(); } |
| 96 |
return 0; |
| 97 |
} |
| 98 |
|