libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / minmax-12.c
blobcb9188f90e8e12c6244d559e63723177102177ee
1 /* { dg-do run } */
2 /* { dg-options "-O -fdump-tree-phiopt" } */
4 #include <stdint.h>
6 __attribute__ ((noinline, noipa))
7 uint8_t three_minmax3 (uint8_t xc, uint8_t xm, uint8_t xy) {
8 uint8_t xk;
9 xc=~xc;
10 xm=~xm;
11 xy=~xy;
12 if (xc > xm) {
13 xk = (uint8_t) (xy < xc ? xc : xy);
14 } else {
15 xk = (uint8_t) (xm < xy ? xm : xy);
17 return xk;
20 int
21 main (void)
23 volatile uint8_t xy = 255;
24 volatile uint8_t xm = 0;
25 volatile uint8_t xc = 127;
26 if (three_minmax3 (xc, xm, xy) != 0)
27 __builtin_abort ();
28 return 0;
31 /* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "phiopt1" } } */
32 /* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "phiopt1" } } */