https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110182
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|c++ |target Summary|GCC generates incorrect |Vector(2) cast from double |results for simple Eigen |to float and subtraction |Casts / Subtractions at -O2 |seems to produce incorrect |or above for a 3 |results at -O2 and above |dimensional vector | --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Looks like a target issue: The gimple level looks like this in GCC 12 for low: vect__178.810_465 = (vector(2) float) _165; vect__202.814_467 = _165 - _165; vect__203.815_466 = (vector(2) float) vect__202.814_467; _172 = SR.808_30 * 6.371e+6; MEM[(struct plain_array *)&high] ={v} {CLOBBER}; MEM <vector(2) float> [(float &)&high] = vect__178.810_465; _184 = (float) _172; MEM[(float &)&high + 8] = _184; MEM[(struct plain_array *)&low] ={v} {CLOBBER}; MEM <vector(2) float> [(float &)&low] = vect__203.815_466; While for GCC 11 we have the casting as scalar: _173 = (float) _298; MEM[(float &)&high] = _173; _296 = BIT_FIELD_REF <_160, 64, 64>; _177 = (float) _296; MEM[(float &)&high + 4] = _177; _179 = (float) _167; MEM[(float &)&high + 8] = _179; MEM[(struct plain_array *)&low] ={v} {CLOBBER}; _192 = (double) _173; _197 = _298 - _192; _198 = (float) _197; MEM[(float &)&low] = _198; _224 = (double) _177; _229 = _296 - _224; _230 = (float) _229; MEM[(float &)&low + 4] = _230; _208 = (double) _179; _213 = _167 - _208; _214 = (float) _213; MEM[(float &)&low + 8] = _214;