* tree-ssa-loop-manip.c (split_loop_exit_edge): Return the new block.
[official-gcc.git] / gcc / testsuite / gcc.dg / minmax-1.c
blobe279c0e20fe3d8d7b99be181c4e12057085be056
1 /* { dg-do run } */
2 /* { dg-options "-fdump-tree-original" } */
4 /* Check that MIN-MAX and MAX-MIN combinations are folded. */
6 extern void abort (void);
8 #define MIN(a,b) ((a) < (b) ? (a) : (b))
9 #define MAX(a,b) ((a) > (b) ? (a) : (b))
11 int f1(int a, int b)
13 return MIN (MAX (a, b), b); /* == b */
16 int f2(int a, int b)
18 return MAX (MIN (a, b), b); /* == b */
21 int f3(int a, int b)
23 return MIN (MAX (b, a), b); /* == b */
26 int f4(int a, int b)
28 return MAX (MIN (b, a), b); /* == b */
32 int g1(int a, int b)
34 return MIN (a, MAX (a, b)); /* == a */
37 int g2(int a, int b)
39 return MAX (a, MIN (a, b)); /* == a */
42 int g3(int a, int b)
44 return MIN (a, MAX (b, a)); /* == a */
47 int g4(int a, int b)
49 return MAX (a, MIN (b, a)); /* == a */
52 int main(void)
54 if (f1 (1, 2) != 2)
55 abort ();
57 if (f2 (1, 2) != 2)
58 abort ();
60 if (f3 (1, 2) != 2)
61 abort ();
63 if (f4 (1, 2) != 2)
64 abort ();
66 if (g1 (1, 2) != 1)
67 abort ();
69 if (g2 (1, 2) != 1)
70 abort ();
72 if (g3 (1, 2) != 1)
73 abort ();
75 if (g4 (1, 2) != 1)
76 abort ();
78 return 0;
81 /* { dg-final { scan-tree-dump-times "MIN_EXPR" 0 "original"} } */
82 /* { dg-final { scan-tree-dump-times "MAX_EXPR" 0 "original"} } */
83 /* { dg-final { cleanup-tree-dump "original" } } */