https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87105
--- Comment #6 from Petr <kobalicek.petr at gmail dot com> --- I think the test-case can even be simplified to something like this: #include <algorithm> #include <cmath> struct Point { double x, y; void reset(double x, double y) { this->x = x; this->y = y; } }; void f1(Point* p, Point* a) { p->reset(std::max(std::sqrt(p->x), a->x), std::max(std::sqrt(p->y), a->y)); } GCC is unable to vectorize it: [-std=c++17 -O3 -mavx2 -fno-math-errno] f1(Point*, Point*): vsqrtsd xmm0, xmm0, QWORD PTR [rdi+8] vmovsd xmm1, QWORD PTR [rsi+8] vsqrtsd xmm2, xmm2, QWORD PTR [rdi] vmaxsd xmm1, xmm1, xmm0 vmovsd xmm0, QWORD PTR [rsi] vmaxsd xmm0, xmm0, xmm2 vunpcklpd xmm0, xmm0, xmm1 vmovups XMMWORD PTR [rdi], xmm0 ret whereas clang can: [-std=c++17 -O3 -mavx2 -fno-math-errno] f1(Point*, Point*): vsqrtpd xmm0, xmmword ptr [rdi] vmovupd xmm1, xmmword ptr [rsi] vmaxpd xmm0, xmm1, xmm0 vmovupd xmmword ptr [rdi], xmm0 ret I think this is a much simpler test-case to start with.