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

Pilar Latiesa <pilarlatiesa at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pilarlatiesa at gmail dot com

--- Comment #1 from Pilar Latiesa <pilarlatiesa at gmail dot com> ---
I also noted that the following testcase:

#include <cmath>

struct TVec { double x, y; };

double dot(TVec const &u, TVec const &v)
  { return u.x * v.x + u.y * v.y; }

double mag(TVec const &u)
{
    if (!(dot(u, u) >= 0.0)) __builtin_unreachable();
    return std::sqrt(dot(u, u));
}

results in:

(with -O3 -march=skylake --param=vrp1-mode=vrp)

mag(TVec const&):
        vmovsd  xmm1, QWORD PTR [rdi+8]
        vmovsd  xmm0, QWORD PTR [rdi]
        vmulsd  xmm1, xmm1, xmm1
        vfmadd132sd     xmm0, xmm1, xmm0
        vsqrtsd xmm0, xmm0, xmm0
        ret

(with -O3 -march=skylake --param=vrp1-mode=ranger)

mag(TVec const&):
        vmovsd  xmm1, QWORD PTR [rdi+8]
        vmovsd  xmm0, QWORD PTR [rdi]
        vmulsd  xmm1, xmm1, xmm1
        vfmadd132sd     xmm0, xmm1, xmm0
        vxorpd  xmm1, xmm1, xmm1
        vucomisd        xmm1, xmm0
        ja      .L11
        vsqrtsd xmm0, xmm0, xmm0
        ret
.L11:
        jmp     sqrt

Reply via email to