1 /* { dg-do compile } */
2 /* { dg-options "-O2 -funswitch-loops -fdump-tree-unswitch-optimized --param=max-unswitch-insns=1000" } */
3 /* { dg-require-effective-target size32plus } */
7 foo(double *a
, double *b
, double *c
, double *d
, double *r
, int size
, int order
)
9 for (int i
= 0; i
< size
; i
++)
23 tmp
= 3 * a
[i
] - 2 * b
[i
];
24 tmp2
= 5 * b
[i
] - 2 * c
[i
];
27 tmp
= 9 * a
[i
] + 2 * b
[i
] + c
[i
];
28 tmp2
= 4 * b
[i
] + 2 * c
[i
] + 8 * d
[i
];
31 tmp
= 3 * a
[i
] + 2 * b
[i
] - c
[i
];
32 tmp2
= b
[i
] - 2 * c
[i
] + 8 * d
[i
];
35 __builtin_unreachable ();
38 double x
= 3 * tmp
+ d
[i
] + tmp
;
39 double y
= 3.4f
* tmp
+ d
[i
] + tmp2
;
47 double aa
[N
], bb
[N
], cc
[N
], dd
[N
], rr
[N
];
51 for (int i
= 0; i
< 100 * 1000; i
++)
52 foo (aa
, bb
, cc
, dd
, rr
, N
, i
% 4);
56 /* Test that we actually unswitched something. */
57 /* { dg-final { scan-tree-dump-times "unswitching loop . on .switch. with condition: order.* <= 0" 1 "unswitch" } } */
58 /* { dg-final { scan-tree-dump-times "unswitching loop . on .switch. with condition: order.* == 0" 1 "unswitch" } } */
59 /* { dg-final { scan-tree-dump-times "unswitching loop . on .switch. with condition: order.* == 1" 1 "unswitch" } } */
60 /* { dg-final { scan-tree-dump-times "unswitching loop . on .switch. with condition: order.* == 2" 1 "unswitch" } } */
61 /* { dg-final { scan-tree-dump-times "unswitching loop . on .switch. with condition: order.* == 3" 1 "unswitch" } } */