| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-O2 -std=c99 -fno-unwind-tables -fno-asynchronous-unwind-tables" } */ |
| 3 |
/* { dg-final { check-function-bodies "**" "" "" { target { le } } } } */ |
| 4 |
|
| 5 |
#include <stdbool.h> |
| 6 |
|
| 7 |
void h(void); |
| 8 |
|
| 9 |
/* |
| 10 |
** g1: |
| 11 |
** tbnz w[0-9]+, #?0, .L([0-9]+) |
| 12 |
** ret |
| 13 |
** ... |
| 14 |
*/ |
| 15 |
void g1(bool x) |
| 16 |
{ |
| 17 |
if (__builtin_expect (x, 0)) |
| 18 |
h (); |
| 19 |
} |
| 20 |
|
| 21 |
/* |
| 22 |
** g2: |
| 23 |
** tbz w[0-9]+, #?0, .L([0-9]+) |
| 24 |
** b h |
| 25 |
** ... |
| 26 |
*/ |
| 27 |
void g2(bool x) |
| 28 |
{ |
| 29 |
if (__builtin_expect (x, 1)) |
| 30 |
h (); |
| 31 |
} |
| 32 |
|
| 33 |
/* |
| 34 |
** g3_ge: |
| 35 |
** tbnz w[0-9]+, #?31, .L[0-9]+ |
| 36 |
** b h |
| 37 |
** ... |
| 38 |
*/ |
| 39 |
void g3_ge(int x) |
| 40 |
{ |
| 41 |
if (__builtin_expect (x >= 0, 1)) |
| 42 |
h (); |
| 43 |
} |
| 44 |
|
| 45 |
/* |
| 46 |
** g3_gt: |
| 47 |
** cmp w[0-9]+, 0 |
| 48 |
** ble .L[0-9]+ |
| 49 |
** b h |
| 50 |
** ... |
| 51 |
*/ |
| 52 |
void g3_gt(int x) |
| 53 |
{ |
| 54 |
if (__builtin_expect (x > 0, 1)) |
| 55 |
h (); |
| 56 |
} |
| 57 |
|
| 58 |
/* |
| 59 |
** g3_lt: |
| 60 |
** tbz w[0-9]+, #?31, .L[0-9]+ |
| 61 |
** b h |
| 62 |
** ... |
| 63 |
*/ |
| 64 |
void g3_lt(int x) |
| 65 |
{ |
| 66 |
if (__builtin_expect (x < 0, 1)) |
| 67 |
h (); |
| 68 |
} |
| 69 |
|
| 70 |
/* |
| 71 |
** g3_le: |
| 72 |
** cmp w[0-9]+, 0 |
| 73 |
** bgt .L[0-9]+ |
| 74 |
** b h |
| 75 |
** ... |
| 76 |
*/ |
| 77 |
void g3_le(int x) |
| 78 |
{ |
| 79 |
if (__builtin_expect (x <= 0, 1)) |
| 80 |
h (); |
| 81 |
} |
| 82 |
|
| 83 |
/* |
| 84 |
** g5: |
| 85 |
** mov w[0-9]+, 65279 |
| 86 |
** tst w[0-9]+, w[0-9]+ |
| 87 |
** beq .L[0-9]+ |
| 88 |
** b h |
| 89 |
** ... |
| 90 |
*/ |
| 91 |
void g5(int x) |
| 92 |
{ |
| 93 |
if (__builtin_expect (x & 0xfeff, 1)) |
| 94 |
h (); |
| 95 |
} |