gcc/testsuite/gcc.target/pru/clz-hi-2.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -fno-tree-ch" } */ |
| 3 | |
| 4 | /* This test case is based on gcc.dg/tree-ssa/clz-char.c. */ |
| 5 | |
| 6 | #define PREC (sizeof(short) * 8) |
| 7 | |
| 8 | int |
| 9 | __attribute__ ((noinline, noclone)) |
| 10 | foo (unsigned short b) { |
| 11 | int c = 0; |
| 12 | |
| 13 | if (b == 0) |
| 14 | return PREC; |
| 15 | |
| 16 | while (!(b & (1 << (PREC - 1)))) { |
| 17 | b <<= 1; |
| 18 | c++; |
| 19 | } |
| 20 | |
| 21 | return c; |
| 22 | } |
| 23 | |
| 24 | /* { dg-final { scan-assembler "lmbd\\tr\[012\]\[0-9\]?.w\[0-2\], r\[012\]\[0-9\]?.w\[0-2\], 1" } } */ |