[Bug tree-optimization/123258] Multiplication by -1 not hoisted
mjr19 at cam dot ac.uk
gcc-bugzilla@gcc.gnu.org
Tue Dec 23 13:18:41 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123258
--- Comment #3 from mjr19 at cam dot ac.uk ---
An even simpler example of gfortran's failure to move a negation out of a loop
is
subroutine foo(a,b,n)
double precision::a(*),b
integer::i,n
do i=1,n
a(i)=a(i)*(-b)
end do
end subroutine foo
although in this case the extra xor in the loop loses little, as it has no
impact on the vectorisation. It does tie up an extra register though.
More information about the Gcc-bugs
mailing list