| 1 |
/* PR tree-optimization/112536 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2 -fno-ipa-icf" } */ |
| 4 |
/* { dg-additional-options "-mlzcnt -mavx512cd -mavx512vl" { target { i?86-*-* x86_64-*-* } } } */ |
| 5 |
/* { dg-final { scan-assembler-times "\tvplzcntd\t" 3 { target { i?86-*-* x86_64-*-* } } } } */ |
| 6 |
|
| 7 |
unsigned a[12]; |
| 8 |
|
| 9 |
void |
| 10 |
foo (void) |
| 11 |
{ |
| 12 |
int i = a[0]; |
| 13 |
int j = a[1]; |
| 14 |
int k = a[2]; |
| 15 |
int l = a[3]; |
| 16 |
int e = i ? __builtin_clz (i) : __SIZEOF_INT__ * __CHAR_BIT__; |
| 17 |
int f = j ? __builtin_clz (j) : __SIZEOF_INT__ * __CHAR_BIT__; |
| 18 |
int g = k ? __builtin_clz (k) : __SIZEOF_INT__ * __CHAR_BIT__; |
| 19 |
int h = l ? __builtin_clz (l) : __SIZEOF_INT__ * __CHAR_BIT__; |
| 20 |
a[0] = e; |
| 21 |
a[1] = f; |
| 22 |
a[2] = g; |
| 23 |
a[3] = h; |
| 24 |
} |
| 25 |
|
| 26 |
void |
| 27 |
bar (void) |
| 28 |
{ |
| 29 |
int i = a[4]; |
| 30 |
int j = a[5]; |
| 31 |
int k = a[6]; |
| 32 |
int l = a[7]; |
| 33 |
int e = i ? __builtin_clz (i) : __SIZEOF_INT__ * __CHAR_BIT__; |
| 34 |
int f = __builtin_clz (j); |
| 35 |
int g = __builtin_clz (k); |
| 36 |
int h = l ? __builtin_clz (l) : __SIZEOF_INT__ * __CHAR_BIT__; |
| 37 |
a[4] = e; |
| 38 |
a[5] = f; |
| 39 |
a[6] = g; |
| 40 |
a[7] = h; |
| 41 |
} |
| 42 |
|
| 43 |
void |
| 44 |
baz (void) |
| 45 |
{ |
| 46 |
int i = a[8]; |
| 47 |
int j = a[9]; |
| 48 |
int k = a[10]; |
| 49 |
int l = a[11]; |
| 50 |
int e = __builtin_clz (i); |
| 51 |
int f = j ? __builtin_clz (j) : __SIZEOF_INT__ * __CHAR_BIT__; |
| 52 |
int g = __builtin_clz (k); |
| 53 |
int h = l ? __builtin_clz (l) : __SIZEOF_INT__ * __CHAR_BIT__; |
| 54 |
a[8] = e; |
| 55 |
a[9] = f; |
| 56 |
a[10] = g; |
| 57 |
a[11] = h; |
| 58 |
} |