https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65676
--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> --- Following patch: --cut here-- Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 221888) +++ config/i386/i386.c (working copy) @@ -37509,6 +37509,10 @@ ix86_expand_args_builtin (const struct builtin_des if (memory_operand (op, mode)) num_memory++; + /* Fixup modeless constants to fit required mode. */ + if (GET_MODE (op) == VOIDmode) + op = convert_to_mode (mode, op, 1); + if (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode) { if (optimize || !match || num_memory > 1) --cut here-- fixes the testcase failure. This fixup is needed everywhere we have builtin with QImode operands.