1 /* { dg-do compile } */
2 /* { dg-options "-O2 -funswitch-loops -fdump-tree-unswitch-optimized" } */
3 /* { dg-require-effective-target int32 } */
6 foo(double *a
, double *b
, double *c
, double *d
, double *r
, int size
, int order
)
8 for (int i
= 0; i
< size
; i
++)
20 tmp
= 3 * a
[i
] - 2 * b
[i
];
21 tmp2
= 5 * b
[i
] - 2 * c
[i
];
24 tmp
= 9 * a
[i
] + 2 * b
[i
] + c
[i
];
25 tmp2
= 4 * b
[i
] + 2 * c
[i
] + 8 * d
[i
];
28 tmp
= 3 * a
[i
] + 2 * b
[i
] - c
[i
];
29 tmp2
= b
[i
] - 2 * c
[i
] + 8 * d
[i
];
32 __builtin_unreachable ();
35 double x
= 3 * tmp
+ d
[i
] + tmp
;
36 double y
= 3.4f
* tmp
+ d
[i
] + tmp2
;
43 /* { dg-final { scan-tree-dump-times "unswitching loop . on .switch. with condition: order.* \\+ 4294967291.*order.* == 9" 1 "unswitch" } } */
44 /* { dg-final { scan-tree-dump-times "unswitching loop . on .switch. with condition: order.* == 1" 1 "unswitch" } } */
45 /* { dg-final { scan-tree-dump-times "unswitching loop . on .switch. with condition: order.* == 2" 1 "unswitch" } } */
46 /* { dg-final { scan-tree-dump-times "unswitching loop . on .switch. with condition: order.* == 3" 1 "unswitch" } } */