Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/minmax-15.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-O -fdump-tree-phiopt" } */
3
4 #include <stdint.h>
5 #include <stdbool.h>
6
7 __attribute__ ((noinline, noipa))
8 uint8_t three_min (uint8_t xc, uint8_t xm, uint8_t xy) {
9 uint8_t xk;
10 if (xc)
11 {
12 if (xc < xm) {
13 xk = (uint8_t) (xc < xy ? xc : xy);
14 } else {
15 xk = (uint8_t) (xm < xy ? xm : xy);
16 }
17 }
18
19 return xk;
20 }
21
22 int
23 main (void)
24 {
25 volatile uint8_t xy = 255;
26 volatile uint8_t xm = 0;
27 volatile uint8_t xc = 127;
28 if (three_min (xc, xm, xy) != 0)
29 __builtin_abort ();
30 return 0;
31 }
32
33 /* There should only be two MIN_EXPR left, the 3rd one was removed. */
34 /* { dg-final { scan-tree-dump-times "MIN_EXPR" 2 "phiopt1" } } */
35 /* { dg-final { scan-tree-dump-times "MAX_EXPR" 0 "phiopt1" } } */