| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target arm_thumb2_ok } */ |
| 3 |
/* { dg-options "-O2 -mthumb -fno-schedule-insns -fno-schedule-insns2" } */ |
| 4 |
/* { dg-final { check-function-bodies "**" "" } } */ |
| 5 |
|
| 6 |
/* |
| 7 |
** foo: |
| 8 |
** ( |
| 9 |
** movs (r[0-9]+), #8 |
| 10 |
** and r0, r1, r0, lsr #1 |
| 11 |
** subs \1, \1, #1 |
| 12 |
** ands \1, \1, #255 |
| 13 |
** bne .L[0-9]+ |
| 14 |
** bx lr |
| 15 |
** | |
| 16 |
** push {lr} |
| 17 |
** movs (r[0-9]+), #8 |
| 18 |
** dls lr, \2 |
| 19 |
** and r0, r1, r0, lsr #1 |
| 20 |
** le lr, .L[0-9]+ |
| 21 |
** pop {pc} |
| 22 |
** ) |
| 23 |
*/ |
| 24 |
|
| 25 |
unsigned short foo (unsigned short x, unsigned short c) |
| 26 |
{ |
| 27 |
unsigned char i = 0; |
| 28 |
for (i = 0; i < 8; i++) |
| 29 |
{ |
| 30 |
x >>= 1; |
| 31 |
x &= c; |
| 32 |
} |
| 33 |
return x; |
| 34 |
} |