[MC] Requiring MCAsmInfo for MCExpr evaluation?

Ahmed Bougacha ahmed.bougacha at gmail.com
Wed Apr 22 17:49:53 PDT 2015

On Wed, Apr 22, 2015 at 2:43 PM, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
> Looks like we have to store more information in the expressions
> themselves. Would changing
>  Lhr,  ///< Shift right (arithmetic or logical, depending on target)
> to
>  Lshr,  ///< Logical shift right
>  Ashr,  ///< Arithmetic shift right
> solve the problem?

Yup, how about the attached patch?

I tried binutils v2.24 aarch64-linux-gnu-as, and it has the same
behavior.  On Darwin, the only AArch64 assembler is LLVM, and the
previous behavior was wrong, so the change is fine.

We'll see about other targets.  I looked at the assemblers I had lying
around (ARM, AArch64, X86; darwin, linux) and AFAIK, only ancient GAS
(I tried the last Apple-bundled one, v1.38) does the AShr.

Notably, binutils v2.24 for arm-linux-gnueabihf and x86_64-linux-gnu
both do the LShr.  So it's probably fine to do the switch there too,
at the very least?

Are there even targets where AShr is the intended behavior, and not
some 20yo GAS bug?


> Cheers,
> Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mcexpr-lshr.patch
Type: application/octet-stream
Size: 8060 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150422/2f630348/attachment.obj>

More information about the llvm-commits mailing list