This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Replace TARGET_64BIT with a pointer


On Mon, Jun 2, 2008 at 5:55 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Jun 2, 2008 at 6:32 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Mon, Jun 02, 2008 at 01:52:37PM +0200, Uros Bizjak wrote:
>>> On Mon, Jun 2, 2008 at 10:26 AM, Richard Guenther
>>> <richard.guenther@gmail.com> wrote:
>>>
>>> >> i386.c has many codes like
>>> >>
>>> >>  if (TARGET_64BIT)
>>> >>    output_asm_insn ("pop{q}\t%0", xops);
>>> >>  else
>>> >>    output_asm_insn ("pop{l}\t%0", xops);
>>> >>
>>> >> On stack branch, there are more codes like that.  This patch changes
>>> >> it to
>>> >>
>>> >>  output_asm_insn (ix86_pop1, xops);
>>> >>
>>> >> It will simplify i386.c. There are no regressions on Linux/Intel64.
>>> >> OK for trunk?
>>> >
>>> > IMHO it is less nice to not see what the asm is in the insn.  Can't you
>>> > use a new % specifier that expands to either {q} or {l} dependent on
>>> > TARGET_64BIT?
>>>
>>> There already is %z modifier. I guess this one should be
>>> fixed/enhanced to also generate "q" for  64bit integer operands in the
>>> same way as "l" is generated for 32bit int operands.
>>>
>>
>> Here is a patch to use %z. I am testing it on Linux/ia32 and
>> Linux/Intel64.  OK for trunk if it passes?
>>
>> Thanks.
>>
>> H.J.
>> ----
>> 2008-06-02  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>        *  config/i386/i386.c (ix86_gen_leave): New.
>>        (ix86_gen_pop1): Likewise.
>>        (ix86_gen_add3): Likewise.
>>        (ix86_gen_sub3): Likewise.
>>        (ix86_gen_sub3_carry): Likewise.
>>        (ix86_gen_one_cmpl2): Likewise.
>>        (ix86_gen_monitor): Likewise.
>>        (GAS_MNEMONICS): Likewise.
>>        (override_options): Initialize ix86_gen_leave, ix86_gen_pop1,
>>        ix86_gen_add3, ix86_gen_sub3, ix86_gen_sub3_carry,
>>        ix86_gen_one_cmpl2 and ix86_gen_monitor.
>>        (ix86_file_end): Use mov%z0 instead of mov{q}/mov{l}.
>>        (output_set_got): Use mov%z0, pop%z0 and add%z0 instead of
>>        mov{q}/mov{l}, pop{q}/pop{l} and add{q}/add{l}.
>>        (ix86_expand_epilogue): Updated.
>>        (print_operand): Handle integer register operand for 'z'.
>>        (ix86_expand_strlensi_unroll_1): Likewise.
>>        (ix86_expand_strlen): Likewise.
>>        (ix86_expand_builtin): Likewise.
>>        (x86_output_mi_thunk): Use mov%z1 and add%z1 instead of
>>        mov{q}/mov{l} and add{q}/add{l}.
>>
>
> There are no regressions on Linux/ia32 and Linux/Intel64.  OK for
> trunk?

OK, but please consider following code to print_operand()  that is IMO
more readable that redefining GAS_MNEMONIC:

--cut here--
	    case 8:
	      if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT)
		{
		  if (MEM_P (x))
		    {
#ifdef GAS_MNEMONICS
		      putc ('q', file);
#else
		      putc ('l', file);
		      putc ('l', file);
#endif
		      return;
		    }
		  else
		    putc ('q', file);
		}
	      else
	        putc ('l', file);
	      return;
--cut here--

MEM_P (x) is used to be consistent with HImode operand (size 2)
handling, that has the same problem with 's' (x87) and 'w' (integer)
insn suffix.

Thanks,
Uros.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]