From patchwork Mon Mar 5 09:38:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [10/10] addr32: Add *zero_extendsidi2_x32. Date: Sun, 04 Mar 2012 23:38:11 -0000 From: Uros Bizjak X-Patchwork-Id: 144634 Message-Id: To: "H.J. Lu" Cc: gcc-patches@gcc.gnu.org, Richard Henderson On Fri, Mar 2, 2012 at 10:14 PM, H.J. Lu wrote: > This is the last patch for Pmode == SImod in x32. In x32, the return value > of the symbol address must be zero-extended to DImode, This patch adds > *zero_extendsidi2_x32 to load the address of a symbol in SImode and > zero-extend it to DImode. It works for x32 since the address size is 32bit. > OK for trunk? Can you please try attached patch instead? It enhances existing insn pattern with required functionality. Uros. Index: i386.md =================================================================== --- i386.md (revision 184917) +++ i386.md (working copy) @@ -3375,10 +3375,10 @@ (define_insn "*zero_extendsidi2_rex64" [(set (match_operand:DI 0 "nonimmediate_operand" - "=r,o,?*Ym,?*y,?*Yi,!*x") + "=r ,o,?*Ym,?*y,?*Yi,!*x") (zero_extend:DI - (match_operand:SI 1 "nonimmediate_operand" - "rm,0,r ,m ,r ,m*x")))] + (match_operand:SI 1 "x86_64_zext_general_operand" + "rmZ,0,r ,m ,r ,m*x")))] "TARGET_64BIT" "@ mov{l}\t{%1, %k0|%k0, %1} Index: predicates.md =================================================================== --- predicates.md (revision 184917) +++ predicates.md (working copy) @@ -341,6 +341,14 @@ (match_operand 0 "general_operand"))) ;; Return true if OP is general operand representable on x86_64 +;; as zero extended constant. +(define_predicate "x86_64_zext_general_operand" + (if_then_else (match_test "TARGET_64BIT") + (ior (match_operand 0 "nonimmediate_operand") + (match_operand 0 "x86_64_zext_immediate_operand")) + (match_operand 0 "general_operand"))) + +;; Return true if OP is general operand representable on x86_64 ;; as either sign extended or zero extended constant. (define_predicate "x86_64_szext_general_operand" (if_then_else (match_test "TARGET_64BIT")