Patchwork [10/10] addr32: Add *zero_extendsidi2_x32.

login
register
mail settings
Submitter Uros Bizjak
Date March 5, 2012, 9:38 a.m.
Message ID <CAFULd4Z=sL3U8oVbp28jHtabHfmWE=7wyoAEJUHxsgcjAGjK6Q@mail.gmail.com>
Download mbox | patch
Permalink /patch/144634/
State New
Headers show

Comments

Uros Bizjak - March 5, 2012, 9:38 a.m.
On Fri, Mar 2, 2012 at 10:14 PM, H.J. Lu <hongjiu.lu@intel.com> 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.
H.J. Lu - March 6, 2012, 7:44 p.m.
On Mon, Mar 5, 2012 at 1:38 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Fri, Mar 2, 2012 at 10:14 PM, H.J. Lu <hongjiu.lu@intel.com> 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.

It works.  Thanks.
Uros Bizjak - March 7, 2012, 7:45 p.m.
On Tue, Mar 6, 2012 at 8:44 PM, H.J. Lu <hjl.tools@gmail.com> 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.
>
> It works.  Thanks.

Committed to mainline with following ChangeLog:

2012-03-07  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/predicates.md (x86_64_zext_general_operand): New.
	* config/i386/i386.md (*zero_extendsidi2_rex64): Change operand 1
	predicate to x86_64_zext_general_operand.  Accept "Z" constraint.

Tested on x86_64-pc-linux-gnu.

Uros.

Patch

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")