[MC] Requiring MCAsmInfo for MCExpr evaluation?

Ahmed Bougacha ahmed.bougacha at gmail.com
Fri Apr 24 10:25:47 PDT 2015


On Fri, Apr 24, 2015 at 8:07 AM, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
> +  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?

Fair enough.  I'll also first commit the flag separately, defaulting to false.

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

I was worried that other ELF non/old-gas targets might still have the
old behavior.  But I agree, true by default is what makes sense.

Thanks Rafael!

-Ahmed

> * 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