PATCH [7/n] X32: Handle address output and calls patterns

H.J. Lu hjl.tools@gmail.com
Wed Jul 20 18:03:00 GMT 2011


On Wed, Jul 20, 2011 at 9:42 AM, Richard Henderson <rth@redhat.com> wrote:
>> -       ix86_print_operand (file, x, 0);
>> +       /* Always use 64bit register for indirect branch.  */
>> +       if (REG_P (x) && TARGET_64BIT)
>> +         print_reg (x, 'q', file);
>> +       else
>> +         ix86_print_operand (file, x, 0);
>>         return;
>
> This bit is because of ...
>
>> +(define_insn "*tablejump_1_x32"
>> +  [(set (pc) (zero_extend:DI
>> +            (match_operand:SI 0 "register_operand" "r")))
>> +   (use (label_ref (match_operand 1 "" "")))]
>> +  "TARGET_X32"
>> +  "jmp\t%A0"
>> +  [(set_attr "type" "ibr")
>> +   (set_attr "length_immediate" "0")])
>
> ... this bit, am I right?
>
> Well, clearly the representation here is incorrect, or
> you wouldn't have needed the hack in print_operand.
>
> The jmp instruction does not zero_extend, does it?  It
> really looks at the entire 64-bit register.  Now, while
> generally we've just loaded the register from memory,
> and while generally it ought to be zero_extended in the
> register because of that, this is still an incorrect
> representation.
>
> You should not require a different tablejump_1.  The
> existing Pmode one is sufficient.
>
> What needs changing is the tablejump expander.
> Something like
>
>  if (TARGET_X32)
>    operands[0] = convert_memory_address (Pmode, operands[0]);
>  if (flag_pic)
>    {
>      ...
>    }
>
>
> r~
>

I am testing this patch.  OK for trunk if it works?

Thanks.

-- 
H.J.
----
2011-07-20  H.J. Lu  <hongjiu.lu@intel.com>
	    Uros Bizjak  <ubizjak@gmail.com>
	    Richard Henderson  <rth@redhat.com>

	* config/i386/constraints.md (w): New.

	* config/i386/i386.c (ix86_output_addr_vec_elt): Check
	TARGET_LP64 instead of TARGET_64BIT for ASM_QUAD.

	* config/i386/i386.h (CASE_VECTOR_MODE): Check TARGET_LP64
	instead of TARGET_64BIT.

	* config/i386/i386.md (indirect_jump): Replace
	nonimmediate_operand with indirect_branch_operand.
	(*indirect_jump): Likewise.  Replace constraint "m" with "w".
	(tablejump): Replace nonimmediate_operand with
	indirect_branch_operand.  Convert operand 0 to Pmode for x32.
	(*tablejump_1): Replace nonimmediate_operand with
	indirect_branch_operand.  Replace constraint "m" with "w".
	(*call_vzeroupper): Replace constraint "m" with "w".
	(*call): Likewise.
	(*call_rex64_ms_sysv_vzeroupper): Likewise.
	(*call_rex64_ms_sysv): Likewise.
	(*call_value_vzeroupper): Likewise.
	(*call_value): Likewise.
	(*call_value_rex64_ms_sysv_vzeroupper): Likewise.
	(*call_value_rex64_ms_sysv): Likewise.
	(set_got_offset_rex64): Check TARGET_LP64 instead of
	TARGET_64BIT.

	* config/i386/predicates.md (indirect_branch_operand): New.
	(call_insn_operand): Support x32.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-x32-symbol-6.patch
Type: text/x-diff
Size: 8423 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110720/f8a5a6c0/attachment.bin>


More information about the Gcc-patches mailing list