https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119351

--- Comment #14 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
There seems to be an one error in the pre-header when calculating the initial
vector IV.

The starting values are calculated as:

sub     z27.s, z23.s, z31.s                                                    
                                                                               
                                                                               
                                  add     z24.s, z27.s, z26.s

with

(gdb) p $z31.s
$5 = {f = {4.20389539e-45, 4.20389539e-45, 4.20389539e-45, 4.20389539e-45}, u =
{3, 3, 3, 3}, s = {3, 3, 3, 3}}
(gdb) p $z27.s
$6 = {f = {-nan(0x7ffffd), -nan(0x7ffffe), -nan(0x7fffff), 0}, u = {4294967293,
4294967294, 4294967295, 0}, s = {-3, -2, -1, 0}}
(gdb) p $z23.s
$7 = {f = {0, 1.40129846e-45, 2.80259693e-45, 4.20389539e-45}, u = {0, 1, 2,
3}, s = {0, 1, 2, 3}}
(gdb) p $z26.s
$8 = {f = {2.80259693e-45, 2.80259693e-45, 2.80259693e-45, 2.80259693e-45}, u =
{2, 2, 2, 2}, s = {2, 2, 2, 2}}
(gdb) p $z24.s
$13 = {f = {-nan(0x7fffff), 0, 1.40129846e-45, 2.80259693e-45}, u =
{4294967295, 0, 1, 2}, s = {-1, 0, 1, 2}}

so the first iteration starts with z24 at -1 instead of 0. 

z24 seems to be the the induction value for ci_y which is updated correctly
inside the loop.  But for some reason the starting value is wrong.

This code is generated by the code creating the starting value for the PHI
ci_y_2061 = PHI <ci_y_2060(441), 0(402)> in the outer loop.

It generates

  _3534 = (sizetype) _1650;
  _3533 = (sizetype) ci_y_1923;
  _3532 = _3533 + _3534;
  _3531 = _3532 + 1;
  _3530 = _3531 * 4;
  # PT = nonlocal escaped null
  vectp.4956_3535 = _1654 + _3530;
  _3529 = (unsigned long) vectp.4956_3535;
  _3528 = _3529 >> 2;
  _3527 = (unsigned int) _3528;
  _3526 = _3527 & 3;
  _3524 = (intD.10) _3526;
  _3523 = {_3524, _3524, _3524, _3524};
  _3522 = {ci_y_1923, ci_y_1923, ci_y_1923, ci_y_1923};
  _3521 = { 0, 1, 2, 3 } - _3523;
  _3518 = _3522 + _3521;

Which I'm not quite sure why it did so yet.  As the phi inside the loop is

# ci_y_2062 = PHI <_1752(479), ci_y_2061(403)>
..
_1752 = ci_y_2062 + 1

So I would have expected the value in the initial _3518 to just be
_3518 = { 0, 1, 2, 3 } + _3522;

looking into how it generates this..

Reply via email to