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


H.J. Lu wrote:

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.



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.
Here is the updated patch. There is no need to check TARGET_BSWAP
for TARGET_64BIT. OK for trunk?

This is OK for mainline.


Thanks,
Uros.


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