Attached patch fixes PR 32413 by forcing secondary memory for QI and HImode moves between SSE and integer registers. This works together with (existing) ix86_secondary_memory_needed_mode, where QI and HImode secondary memory mode is extended to SImode.
The previous patch that fixe PR 32413 forced the limitation of SSE->integer cost to minimum 8, which was enough to fix the testcase. We want to get rid of this artificial limitation, but still have to prevent unsupported move modes. The patch should have no effect on benchmarks. 2019-09-04 Uroš Bizjak <ubiz...@gmail.com> PR target/32413 * config/i386/i386.c (inline_secondary_memory_needed): Return true for QI and HImode moves between SSE and general registers. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Committed to mainline SVN. Uros.
Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 275375) +++ config/i386/i386.c (working copy) @@ -18328,6 +18328,7 @@ inline_secondary_memory_needed (machine_mode mode, /* Between SSE and general, we have moves no larger than word size. */ if (!(INTEGER_CLASS_P (class1) || INTEGER_CLASS_P (class2)) + || GET_MODE_SIZE (mode) < GET_MODE_SIZE (SImode) || GET_MODE_SIZE (mode) > UNITS_PER_WORD) return true;