This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Support -mmovbe
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 21 May 2009 15:32:27 +0200
- Subject: Re: PATCH: Support -mmovbe
- References: <20090520201633.GA17824@lucon.org>
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.