aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr62262.c
blob: 20763b499242f8d758fa01e1b4a37ca0a8a1de60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* { dg-do compile } */
/* { dg-options "-O2 -fprofile-use" } */

static inline int CLZ(int mask) {
   return mask ? __builtin_clz(mask) : 32;
}

int foo(int value)
{
    if (value == 0)
        return 0;

    int bias = CLZ(value);
    value >>= bias;
    int zeros = CLZ(value << 1);
    value <<= zeros;

    int packed = (unsigned)(value << 9) >> 9;
    return packed;
}
/* { dg-do compile } */
/* { dg-options "-O2 -fprofile-use" } */

static inline int CLZ(int mask) {
   return mask ? __builtin_clz(mask) : 32;
}

int foo(int value)
{
    if (value == 0)
        return 0;

    int bias = CLZ(value);
    value >>= bias;
    int zeros = CLZ(value << 1);
    value <<= zeros;

    int packed = (unsigned)(value << 9) >> 9;
    return packed;
}