aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr103660-1.c
blob: f3c207cf6c4660a37185a6ffb6792bb09eaf629c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* PR tree-optimization/103660 */
/* { dg-do compile } */
/* { dg-options "-O1 -fgimple -fdump-tree-forwprop4-raw" } */

#define funcs(OP,n)		\
__GIMPLE()			\
int min_##n(int a, int b) {	\
  _Bool X;			\
  _Bool Y;			\
  int t;			\
  int t1;			\
  int t2;			\
  X = a < b;			\
  Y = a >= b;			\
  t1 = X ? a : 0;		\
  t2 = Y ? b : 0;		\
  t = t1 OP t2;			\
  return t;			\
}				\
__GIMPLE()			\
int f_##n(int a, int b, int c,	\
	 int d) {		\
  _Bool X;			\
  _Bool Y;			\
  int t;			\
  int t1;			\
  int t2;			\
  X = a < b;			\
  Y = a >= b;			\
  t1 = X ? c : 0;		\
  t2 = Y ? d : 0;		\
  t = t1 OP t2;			\
  return t;			\
}

funcs(|, ior)

/* min_ior should produce min<a,b> */
/* f_ior should produce (a < b) ? c : d */
/* { dg-final { scan-tree-dump-not   "bit_ior_expr, " "forwprop4" } } */
/* { dg-final { scan-tree-dump-times "min_expr, "   1 "forwprop4" } } */
/* { dg-final { scan-tree-dump-times "lt_expr, "    1 "forwprop4" } } */
/* { dg-final { scan-tree-dump-times "cond_expr, "  1 "forwprop4" } } */