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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Blocks|                            |53947
             Target|                            |x86_64-*-*
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2026-05-04
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
#include <x86intrin.h>
#include <algorithm>
float amin(float const & a, float const & b) {
 float r;
 _mm_store_ss( &r, _mm_range_ss(_mm_load_ss(&a),_mm_load_ss(&b),14));
 return r;
}


void aminV(float const * a, float const * b, float * r) {
 _mm_store_ps( r, _mm_range_ps(_mm_load_ps(a),_mm_load_ps(b),14));
}


float amin0( float a, float  b) {
   return std::abs(a) < std::abs(b) ? a : b;
 float r;

}

float x[1024], y[1024], z[1024];

void go() {
  for (int i=0; i<1024; ++i) z[i] = amin(x[i],y[i]);
}

void goV() {
  for (int i=0; i<1024; i+=4) aminV(&x[i],&y[i],&z[i]);
}



void go0() {
  for (int i=0; i<1024; ++i) z[i] = amin0(x[i],y[i]);
}


could possibly handled via combine or (better for costing) by the vectorizer,
but it's applicable to scalar code as well, so target specific for now
(we don't have optabs for 'range' either).


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

Reply via email to