1 /* { dg-do compile } */
2 /* { dg-options "-Ofast -fdump-tree-optimized-raw" } */
3 
4 float
extract_square(float * a,float * b,float x,float y)5 extract_square (float *a, float *b, float x, float y)
6 {
7   *a = 3 / (y * y);
8   *b = 5 / (y * y);
9 
10   return x / (y * y);
11 }
12 
13 /* Don't expect the 'powmult' (calculation of y * y)
14    to be deleted until a later pass, so look for one
15    more multiplication than strictly necessary.  */
16 float
extract_recip(float * a,float * b,float x,float y,float z)17 extract_recip (float *a, float *b, float x, float y, float z)
18 {
19   *a = 7 / y;
20   *b = x / (y * y);
21 
22   return z / y;
23 }
24 
25 /* 4 multiplications in 'extract_square', and 4 in 'extract_recip'.  */
26 /* { dg-final { scan-tree-dump-times "mult_expr" 8 "optimized" } } */
27 
28 /* 1 division in 'extract_square', 1 division in 'extract_recip'. */
29 /* { dg-final { scan-tree-dump-times "rdiv_expr" 2 "optimized" } } */
30