[llvm-dev] Endianness for multi-word types

Tim Shen via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 1 15:00:24 PST 2015


On Tue, Dec 1, 2015 at 2:00 PM Tim Northover <t.p.northover at gmail.com>
wrote:

> On 1 December 2015 at 13:41, Tim Shen via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> > As a simple solution, when see a LLVM IR bitcast, instead of generating
> > (ISD::BITCAST x), can we generate (exchange_hi_lo (ISD::BITCAST x))
> instead?
>
> An LLVM bitcast is defined to be equivalent to a store/load pair.
> Changing that for ISD::BITCAST would be very surprising, and  I
> wouldn't recommend it. It's a very useful invariant for reasoning
> about what should happen.
>
> When we had to work around similar endian nightmares in ARM I think we
> ended up creating AArch64ISD::NVCAST to represent a true nop cast.
>

This works as well, so:
(bitcast (fabs x)) -> (exchange_hi_lo (and (nvcast x) (not signbit))).

Should I move AArch64ISD::NVCAST to ISD?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151201/6e79b3e5/attachment.html>


More information about the llvm-dev mailing list