diff mbox

PATCH: Don't allow nonmemory_operand on movabs for x32

Message ID CAFULd4aJE6jZnw0RJG-RmoEv2WejHAWdBnOCfTa--8W4cXtZBA@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak July 27, 2011, 11:40 a.m. UTC
On Wed, Jul 27, 2011 at 6:14 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:

> For x32, movabs is only supported with register and constant operands.
> OK for trunk?

As said on the PR49798, assembler should handle R_X86_64_64 relocations

Anyway, the x86_64_movabs_operand predicate can be simplified to
clearly show what it does.

2011-07-27  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/predicates.md (x86_64_movabs_operand): Reject
	pic32_bit_opreand operands.
	* config/i386/i386.c (ix86_expand_move): Check x86_64_movabs_operand
	in DImode.

Testing on x86_64-pc-linux-gnu in progress.

Uros.

Comments

H.J. Lu July 27, 2011, 12:40 p.m. UTC | #1
On Wed, Jul 27, 2011 at 4:40 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Wed, Jul 27, 2011 at 6:14 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>
>> For x32, movabs is only supported with register and constant operands.
>> OK for trunk?
>
> As said on the PR49798, assembler should handle R_X86_64_64 relocations
>
> Anyway, the x86_64_movabs_operand predicate can be simplified to
> clearly show what it does.
>
> 2011-07-27  Uros Bizjak  <ubizjak@gmail.com>
>
>        * config/i386/predicates.md (x86_64_movabs_operand): Reject
>        pic32_bit_opreand operands.
>        * config/i386/i386.c (ix86_expand_move): Check x86_64_movabs_operand
>        in DImode.
>
> Testing on x86_64-pc-linux-gnu in progress.
>

Please keep in mind that x32 is 32bit. X32 should be very similar to ia32
in address range.
diff mbox

Patch

Index: predicates.md
===================================================================
--- predicates.md	(revision 176816)
+++ predicates.md	(working copy)
@@ -389,15 +389,10 @@ 
   return symbolic_operand (op, mode);
 })
 
-
 ;; Return true if OP is nonmemory operand acceptable by movabs patterns.
 (define_predicate "x86_64_movabs_operand"
-  (if_then_else (not (and (match_test "TARGET_64BIT")
-			  (match_test "flag_pic")))
-    (match_operand 0 "nonmemory_operand")
-    (ior (match_operand 0 "register_operand")
-	 (and (match_operand 0 "const_double_operand")
-	      (match_test "GET_MODE_SIZE (mode) <= 8")))))
+  (and (match_operand 0 "nonmemory_operand")
+       (not (match_operand 0 "pic_32bit_operand"))))
 
 ;; Return true if OP is either a symbol reference or a sum of a symbol
 ;; reference and a constant.
Index: i386.c
===================================================================
--- i386.c	(revision 176816)
+++ i386.c	(working copy)
@@ -15078,7 +15077,7 @@  ix86_expand_move (enum machine_mode mode
 	{
 	  if (MEM_P (op0))
 	    op1 = force_reg (mode, op1);
-	  else if (!TARGET_64BIT || !x86_64_movabs_operand (op1, mode))
+	  else if (!(TARGET_64BIT && x86_64_movabs_operand (op1, DImode)))
 	    {
 	      rtx reg = can_create_pseudo_p () ? NULL_RTX : op0;
 	      op1 = legitimize_pic_address (op1, reg);