[MC] Requiring MCAsmInfo for MCExpr evaluation?

Rafael EspĂ­ndola rafael.espindola at gmail.com
Fri Apr 24 08:07:24 PDT 2015


+  bool useLogicalShr()

shouldUseLogicalShr() is probably a bit better.


This changes the behaviour of AArch64 MachO, right? Can we leave that
as is for now and change it in another patch?

For ELF we should match what current gas does. From your description,
maybe the best to do for now is:

* Set UseLogicalShr to true by default.
* Set UseLogicalShr to false in MCAsmInfoDarwin.

Cheers,
Rafael




On 22 April 2015 at 20:49, Ahmed Bougacha <ahmed.bougacha at gmail.com> wrote:
> 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?
>
> -Ahmed
>
>> Cheers,
>> Rafael




More information about the llvm-commits mailing list