https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85473
--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> --- Something like this diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index dc80b34f302..99feb5ea629 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -37141,11 +37141,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, arg1 = CALL_EXPR_ARG (exp, 1); op0 = expand_normal (arg0); op1 = expand_normal (arg1); - mode0 = (TARGET_64BIT ? DImode : SImode); - op0 = force_reg (mode0, op0); - if (!memory_operand (op1, mode0)) - op1 = gen_rtx_MEM (mode0, op1); + op0 = ix86_zero_extend_to_Pmode (op0); + if (!memory_operand (op1, XImode)) + op1 = gen_rtx_MEM (XImode, op1); insn = (TARGET_64BIT ? gen_movdir64b_di (op0, op1) diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index a134ca88014..d01e3c631b5 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -20697,8 +20697,8 @@ [(set_attr "type" "other")]) (define_insn "movdir64b_<mode>" - [(unspec_volatile:SWI48[(match_operand:SWI48 0 "register_operand" "r") - (match_operand:SWI48 1 "memory_operand")] + [(unspec_volatile:XI [(match_operand:P 0 "register_operand" "r") + (match_operand:XI 1 "memory_operand")] UNSPECV_MOVDIR64B)] "TARGET_MOVDIR64B" "movdir64b\t{%1, %0|%0, %1}"