| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
/* { dg-final { check-function-bodies "**" "" } } */ |
| 4 |
|
| 5 |
#include <arm_sve.h> |
| 6 |
|
| 7 |
/* |
| 8 |
** f1: |
| 9 |
** cntd x([0-9]+) |
| 10 |
** mul w0, (w0, w\1|w\1, w0) |
| 11 |
** ret |
| 12 |
*/ |
| 13 |
int |
| 14 |
f1 (int x) |
| 15 |
{ |
| 16 |
if (x & 1) |
| 17 |
__builtin_unreachable (); |
| 18 |
x /= 2; |
| 19 |
return x * svcntw(); |
| 20 |
} |
| 21 |
|
| 22 |
/* |
| 23 |
** f2: |
| 24 |
** cntd x([0-9]+) |
| 25 |
** mul w0, (w0, w\1|w\1, w0) |
| 26 |
** ret |
| 27 |
*/ |
| 28 |
int |
| 29 |
f2 (int x) |
| 30 |
{ |
| 31 |
if (x & 3) |
| 32 |
__builtin_unreachable (); |
| 33 |
x /= 4; |
| 34 |
return x * svcnth(); |
| 35 |
} |
| 36 |
|
| 37 |
/* |
| 38 |
** f3: |
| 39 |
** cntd x([0-9]+) |
| 40 |
** mul w0, (w0, w\1|w\1, w0) |
| 41 |
** ret |
| 42 |
*/ |
| 43 |
int |
| 44 |
f3 (int x) |
| 45 |
{ |
| 46 |
if (x & 7) |
| 47 |
__builtin_unreachable (); |
| 48 |
x /= 8; |
| 49 |
return x * svcntb(); |
| 50 |
} |
| 51 |
|
| 52 |
/* |
| 53 |
** f4: |
| 54 |
** cntw x([0-9]+) |
| 55 |
** mul w0, (w0, w\1|w\1, w0) |
| 56 |
** ret |
| 57 |
*/ |
| 58 |
int |
| 59 |
f4 (int x) |
| 60 |
{ |
| 61 |
if (x & 1) |
| 62 |
__builtin_unreachable (); |
| 63 |
x /= 2; |
| 64 |
return x * svcnth(); |
| 65 |
} |
| 66 |
|
| 67 |
/* |
| 68 |
** f5: |
| 69 |
** cntw x([0-9]+) |
| 70 |
** mul w0, (w0, w\1|w\1, w0) |
| 71 |
** ret |
| 72 |
*/ |
| 73 |
int |
| 74 |
f5 (int x) |
| 75 |
{ |
| 76 |
if (x & 3) |
| 77 |
__builtin_unreachable (); |
| 78 |
x /= 4; |
| 79 |
return x * svcntb(); |
| 80 |
} |
| 81 |
|
| 82 |
/* |
| 83 |
** f6: |
| 84 |
** cnth x([0-9]+) |
| 85 |
** mul w0, (w0, w\1|w\1, w0) |
| 86 |
** ret |
| 87 |
*/ |
| 88 |
int |
| 89 |
f6 (int x) |
| 90 |
{ |
| 91 |
if (x & 1) |
| 92 |
__builtin_unreachable (); |
| 93 |
x /= 2; |
| 94 |
return x * svcntb(); |
| 95 |
} |
| 96 |
|
| 97 |
/* |
| 98 |
** f7: |
| 99 |
** cntb x([0-9]+) |
| 100 |
** mul w0, (w0, w\1|w\1, w0) |
| 101 |
** ret |
| 102 |
*/ |
| 103 |
int |
| 104 |
f7 (int x) |
| 105 |
{ |
| 106 |
if (x & 15) |
| 107 |
__builtin_unreachable (); |
| 108 |
x /= 16; |
| 109 |
return x * svcntb() * 16; |
| 110 |
} |