https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117053
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The problem is in ix86_expand_int_spaceship here: + emit_insn (gen_rtx_SET (tmp, gen_rtx_ZERO_EXTEND (GET_MODE (dest), + lt_tmp))); Most likely should have used: emit_insn (gen_zero_extend<mode>si2 (tmp, lt_tmp)) But that requires some magic. This is due to TARGET_ZERO_EXTEND_WITH_AND which is only set for 486 and pentium: /* X86_TUNE_ZERO_EXTEND_WITH_AND: Use AND instruction instead of mozbl/movwl. */ DEF_TUNE (X86_TUNE_ZERO_EXTEND_WITH_AND, "zero_extend_with_and", m_486 | m_PENT)