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 Wed, May 20, 2009 at 10:16 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:

> Intel Atom has movbe instruction. It can be used to implement
> __builtin_bswap32 and __builtin_bswap64. ?OK for trunk?
>
> Thanks.

> +(define_insn "*movbesi2"
> + ?[(set (match_operand:SI 0 "nonimmediate_operand" "=r,m")
> + ? ? ? (bswap:SI (match_operand:SI 1 "nonimmediate_operand" "m,r")))]
> + ?"TARGET_MOVBE"
> + ?"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" "SI")])
> +

The pattern above should be integrated with bswapsi2 insn, so bswap
insn will be emitted for reg-reg case.

> +(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.

Unfortunatelly, we will have a bit of mess with TARGET_BSWAP,
TARGET_MOVBE and TARGET_64BIT.

Uros.


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