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: Support -mmovbe


On Thu, May 21, 2009 at 10:38 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> H.J. Lu wrote:
>
>>>>> +(define_insn "*movbedi2"
>>>>> + ï[(set (match_operand:DI 0 "nonimmediate_operand" "=r,m")
>>>>> + ï ï ï (bswap:DI (match_operand:DI 1 "nonimmediate_operand" "m,r")))]
>>>>> + ï"TARGET_MOVBE && TARGET_64BIT"
>>>>> + ï"movbe\t{%1, %0|%0, %1}"
>>>>> + ï[(set_attr "type" "imov")
>>>>> + ï (set_attr "modrm" "1")
>>>>> + ï (set_attr "prefix_0f" "1")
>>>>> + ï (set_attr "prefix_extra" "1")
>>>>> + ï (set_attr "mode" "DI")])
>>>>>
>>>>
>>>> Also the pattern above; it should be integrated with existing bswapdi2.
>>>>
>>>
>>> movbe doesn't support "movbe reg, reg".
>>>
>
> Sure, but attached patch automatically emits bswap in this case.
>
>> It is much cleaner to have a separate pattern since expander is
>>
>
> The constraints on expanders are actually not that important. The
> constraints on the insns pattern operands are what matters, and combine does
> a great job to merge memory operands whenever it can.
>>
>> (define_expand "bswapsi2"
>> Â[(set (match_operand:SI 0 "register_operand" "")
>> Â Â Â Â(bswap:SI (match_operand:SI 1 "register_operand" "")))]
>>
>> The new movbe pattern will be used optimizer.
>>
>
> Please see attached i386.md part of the patch. The patch assumes that
> TARGET_MOVBE also supports bswap insn, so following part is not needed
> anymore:
>
> + Â/* Enable bswap if movbe is enabled. Â*/
> + Âif (TARGET_MOVBE)
> + Â ÂTARGET_BSWAP = 1;
> +
>
>
> BTW: the patch uses shadowing to select between two patterns.
>

Here is the updated patch.  There is no need to check TARGET_BSWAP
for TARGET_64BIT.  OK for trunk?

Thanks.

-- 
H.J.
---
gcc/

2009-05-21  H.J. Lu  <hongjiu.lu@intel.com>
	    Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/cpuid.h (bit_MOVBE): New.

	* config/i386/driver-i386.c (host_detect_local_cpu): Check movbe.

	* config/i386/i386.c (OPTION_MASK_ISA_MOVBE_SET): New.
	(OPTION_MASK_ISA_MOVBE_UNSET): Likewise.
	(ix86_handle_option): Handle OPT_mmovbe.
	(ix86_target_string): Add -mmovbe.
	(pta_flags): Add PTA_MOVBE.
	(processor_alias_table): Add PTA_MOVBE to "atom".
	(override_options): Handle PTA_MOVBE.

	* config/i386/i386.h (TARGET_MOVBE): New.

	* config/i386/i386.md (bswapsi2): Check TARGET_MOVBE.
	(*bswapsi_movbe): New.
        (*bswapdi_movbe): Likewise.
	(bswapdi2): Renamed to ...
	(*bswapdi_1): This.
	(bswapdi2): New expander.

	* config/i386/i386.opt (mmovbe): New.

	* doc/invoke.texi: Document -mmovbe.

gcc/testsuite/

2009-05-21  H.J. Lu  <hongjiu.lu@intel.com>

 	* gcc.target/i386/movbe-1.c: New.
	* gcc.target/i386/movbe-2.c: Likewise.

Attachment: gcc-movbe-2.patch
Description: Text document


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