Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr87007-5.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-Ofast -march=skylake-avx512 -mfpmath=sse -fno-tree-vectorize -fdump-tree-cddce3-details -fdump-tree-lsplit-optimized -fno-ssa-phiopt" } */
3 /* Load of d2/d3 is hoisted out, the loop is split, store of d1 and sqrt
4 are sunk out of the loop and the loop is elided. One vsqrtsd with
5 memory operand needs a xor to avoid partial dependence. */
6 /* Phi-OPT needs to be disabled otherwise, sqrt calls are merged which is better
7 but we are testing to make sure the partial register stall for SSE is still avoided
8 for sqrts. */
9
10 #include<math.h>
11
12 extern double d1, d2, d3;
13 void
14 foo (int n, int k)
15 {
16 for (int i = 0; i != n; i++)
17 if(i < k)
18 d1 = sqrt (d2);
19 else
20 d1 = sqrt (d3);
21 }
22
23 /* { dg-final { scan-tree-dump "optimized: loop split" "lsplit" } } */
24 /* { dg-final { scan-tree-dump-times "removing loop" 2 "cddce3" } } */
25 /* { dg-final { scan-assembler-times "vxorps\[^\n\r\]*xmm\[0-9\]" 1 } } */