* gcc.target/i386/pr70021.c: Add -mtune=skylake.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr55116-2.c
blob59bdebe690da67d84476039032fb39e456932a43
1 /* { dg-do compile { target { ! ia32 } } } */
2 /* { dg-options "-O2 -mx32 -maddress-mode=long" } */
4 typedef struct rtx_def *rtx;
5 enum rtx_code { MINUS };
6 union rtunion_def {
7 rtx rt_rtx;
8 };
9 typedef union rtunion_def rtunion;
10 struct rtx_def {
11 enum rtx_code code: 16;
12 union u {
13 rtunion fld[1];
17 rtx simplify_binary_operation (enum rtx_code code, int mode,
18 rtx op0, rtx op1);
19 struct simplify_plus_minus_op_data {
20 rtx op;
21 short neg;
23 void simplify_plus_minus (enum rtx_code code, int mode, rtx op0, rtx op1)
25 struct simplify_plus_minus_op_data ops[8];
26 rtx tem = (rtx) 0;
27 int n_ops = 2, input_ops = 2;
28 int changed, canonicalized = 0;
29 int i, j;
30 __builtin_memset (ops, 0, sizeof (ops));
33 changed = 0;
34 for (i = 0; i < n_ops; i++)
36 rtx this_op = ops[i].op;
37 int this_neg = ops[i].neg;
38 enum rtx_code this_code = ((enum rtx_code) (this_op)->code);
39 switch (this_code)
41 case MINUS:
42 if (n_ops == 7)
43 return;
44 n_ops++;
45 input_ops++;
46 changed = 1;
47 canonicalized |= this_neg;
48 break;
52 while (changed);
53 do
55 j = n_ops - 1;
56 for (i = n_ops - 1; j >= 0; j--)
58 rtx lhs = ops[j].op, rhs = ops[i].op;
59 int lneg = ops[j].neg, rneg = ops[i].neg;
60 if (lhs != 0 && rhs != 0)
62 enum rtx_code ncode = MINUS;
63 if (((enum rtx_code) (lhs)->code) == MINUS)
64 tem = simplify_binary_operation (ncode, mode, lhs, rhs);
65 if (tem && ! (((enum rtx_code) (tem)->code) == MINUS
66 && ((((((tem)->u.fld[0]).rt_rtx))->u.fld[0]).rt_rtx) == lhs
67 && ((((((tem)->u.fld[0]).rt_rtx))->u.fld[1]).rt_rtx) == rhs))
69 lneg &= rneg;
70 ops[i].op = tem;
71 ops[i].neg = lneg;
72 ops[j].op = (rtx) 0;
73 changed = 1;
74 canonicalized = 1;
78 for (i = 0, j = 0; j < n_ops; j++)
79 if (ops[j].op)
81 ops[i] = ops[j];
82 i++;
85 while (changed);