https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95740
--- Comment #4 from Hongtao.liu <crazylht at gmail dot com> --- It can be fixed by 2 files changed, 4 insertions(+), 2 deletions(-) gcc/config/i386/i386.c | 2 +- gcc/config/i386/i386.h | 4 +++- modified gcc/config/i386/i386.c @@ -19194,7 +19194,7 @@ ix86_preferred_reload_class (rtx x, reg_class_t regclass) /* Prefer SSE regs only, if we can use them for math. */ if (SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH) - return SSE_CLASS_P (regclass) ? regclass : NO_REGS; + return INT_SSE_CLASS_P (regclass) ? regclass : NO_REGS; /* Generally when we see PLUS here, it's the function invariant (plus soft-fp const_int). Which can only be computed into general modified gcc/config/i386/i386.h @@ -1283,7 +1283,9 @@ enum reg_class reg_class_subset_p ((CLASS), FLOAT_REGS) #define SSE_CLASS_P(CLASS) \ reg_class_subset_p ((CLASS), ALL_SSE_REGS) -#define MMX_CLASS_P(CLASS) \ +#define INT_SSE_CLASS_P(CLASS) \ + reg_class_subset_p ((CLASS), INT_SSE_REGS) +#define MMX_CLASS_P(CLASS) \ ((CLASS) == MMX_REGS) #define MASK_CLASS_P(CLASS) \ reg_class_subset_p ((CLASS), ALL_MASK_REGS) I'm testing performance impact.