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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #5)
> I see sth like
> 
>   template<typename _RealType, size_t __bits,
>     typename _UniformRandomNumberGenerator>
>     _RealType
>     generate_canonical(_UniformRandomNumberGenerator& __urng)
>     {
> ...
>    __ret = std::nextafter(_RealType(1), _RealType(0));
> 
> instantiated as
> 
> _RealType std::generate_canonical(_UniformRandomNumberGenerator&) [with
> _RealType = double; long unsigned int __bits = 53;
> _UniformRandomNumberGenerator = std::mersenne_twister_engine<long unsigned
> int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15,
> 4022730752, 18, 1812433253>] (struct mersenne_twister_engine & __urng)
> {
> ...
>   const long double __r;
> ^^^
> (but that's unused it seems)
> ...
>   __ret = nextafter (1.0e+0, 0.0);
> 
> and cmath containing
> 
>   constexpr float
>   nextafter(float __x, float __y)
>   { return __builtin_nextafterf(__x, __y); }
> 
>   constexpr long double
>   nextafter(long double __x, long double __y)
>   { return __builtin_nextafterl(__x, __y); }
> 
> 
> 
>   template<typename _Tp, typename _Up>
>     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
>     nextafter(_Tp __x, _Up __y)
>     {
>       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
>       return nextafter(__type(__x), __type(__y));
>     }
> 
> which means std::nextafter will use the long double variant?

Ah, and in the same function:

    _3 = (long double) __tmp;
    _4 = _3 * 4.294967296e+9;
    __tmp = (double) _4;

likely from

      const long double __r = static_cast<long double>(__urng.max())
       - static_cast<long double>(__urng.min()) + 1.0L;

the loop to be vectorized is

  <bb 32> [1.36%]:
  # n_315 = PHI <0(31), n_290(35)>
  # ivtmp_313 = PHI <10000000(31), ivtmp_289(35)>
  _312 = (long unsigned int) n_315;
  _311 = _312 * 4;
  _310 = _82 + _311;
  _309 = *_310;
  _308 = _309 - 5.0e-1;
  _307 = _308 > 0.0;
  _306 = (int) _307;
  _305 = _308 < 0.0;
  _304 = (int) _305;
  _303 = _306 - _304;
  _302 = (float) _303;
  if (_302 < 0.0)
    goto <bb 34>; [36.00%]
  else
    goto <bb 33>; [64.00%]

  <bb 33> [0.87%]:

  <bb 34> [1.37%]:
  # _301 = PHI <&D.56316(32), &D.56315(33)>
  D.56315 ={v} {CLOBBER};
  D.56316 ={v} {CLOBBER};
  _298 = *_301;
  _297 = _298 * 6.99999988079071044921875e-1;
  _296 = _297 + 1.00000001490116119384765625e-1;
  _295 = pretmp_336 + _311;
  *_295 = _296;
  n_290 = n_315 + 1;
  ivtmp_289 = ivtmp_313 - 1;
  if (ivtmp_289 == 0)
    goto <bb 36>; [1.01%]
  else
    goto <bb 35>; [98.99%]

  <bb 35> [1.36%]:
  goto <bb 32>; [100.00%]

which failed to if-convert, quite possibly because of the strange clobbers.
Which means the testcase is likely undefined as well.

Reply via email to