https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78154
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Funny I thought this was fixed already but I was wrong. Anyways I had posted a patch over 4 years ago for this: https://gcc.gnu.org/ml/gcc-patches/2012-09/msg00056.html IIRC the reason why I wrote this patch was to fix some missed optimizations while compiling the linux kernel on MIPS64 but I can't remember what I turned on in the config to produce this kind of code.