On 15/01/14 10:38, Kugan wrote:
> On 13/01/14 21:05, Richard Earnshaw wrote:
>> On 11/01/14 23:42, Kugan wrote:
>>> Hi,
>>>
>>> aarch64_build_constant incorrectly truncates the immediate when
>>> constants are generated with MOVN. This causes coinor-osi tests to fail
>>> (tracked also in https://bugs.launchpad.net/gcc-linaro/+bug/1263576)
>>>
>>> Attached patch fixes this. Also attaching a reduced testcase that
>>> reproduces this. Tested on aarch64-none-linux-gnu with no new
>>> regressions. Is this OK for trunk?
>>>
>>> Thanks,
>>> Kugan
>>>
>>> gcc/
>>> +2013-10-15  Matthew Gretton-Dann  <matthew.gretton-d...@linaro.org>
>>> +       Kugan Vivekanandarajah  <kug...@linaro.org>
>>> +
>>> +   PR target/59588
>>> +   * config/aarch64/aarch64.c (aarch64_build_constant): Fix incorrect
>>> +   truncation.
>>> +
>>>
>>>
>>> gcc/testsuite/
>>> +2014-01-11  Matthew Gretton-Dann  <matthew.gretton-d...@linaro.org>
>>> +       Kugan Vivekanandarajah  <kug...@linaro.org>
>>> +
>>> +   PR target/59695
>>> +   * g++.dg/pr59695.C: New file.
>>> +
>>>
>>>
>>> p.txt
>>>
>>>
>>> diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
>>> index 3d32ea5..854666f 100644
>>> --- a/gcc/config/aarch64/aarch64.c
>>> +++ b/gcc/config/aarch64/aarch64.c
>>> @@ -2486,7 +2486,7 @@ aarch64_build_constant (int regnum, HOST_WIDE_INT val)
>>>        if (ncount < zcount)
>>>     {
>>>       emit_move_insn (gen_rtx_REG (Pmode, regnum),
>>> -                     GEN_INT ((~val) & 0xffff));
>>> +                     GEN_INT (~((~val) & 0xffff)));
>>
>> I think that would be better written as
>>
>>      GEN_INT (val | ~(HOST_WIDE_INT) 0xffff);
>>
>> Note the cast after the ~ to ensure we invert the right number of bits.
>>
>> Otherwise OK.
>>
> 
> Thanks Richard. Is this OK for back-porting to 4.8 as well?
>

Yes.

R.


Reply via email to