This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PR66776][PATCH][AARCH64] Add cmovdi_insn_uxtw pattern.





> On Aug 6, 2015, at 11:40 AM, Renlin Li <renlin.li@arm.com> wrote:
> 
> Hi all,
> 
> This is a simple patch to add a new cmovdi_insn_uxtw rtx pattern to aarch64 backend.
> 
> For the following simple test case:
> 
> unsigned long
> foo (unsigned int a, unsigned int b, unsigned int c)
> {
>  return a ? b : c;
> }
> 
> With this new pattern, the new code-generation will be:
> 
>    cmp    w0, wzr
>    csel    x0, x2, x1, eq

Your example Shows you have the wrong operand types to csel. In the aarch64 abi arguments don't need to be zero extended and your csel will not be zero extending the arguments.

Note you should also use unsigned long long in the testcase so it is ilp32 and llp64l32 friendly. 

Thanks,
Andrew


>    ret
> 
> Without the path, the old code-generation is like this:
>        uxtw    x1, w1
>        cmp     w0, wzr
>        uxtw    x2, w2
>        csel    x0, x2, x1, eq
>        ret
> 
> 
> aarch64-none-elf regression test Okay. Okay to commit?
> 
> Regards,
> Renlin Li
> 
> gcc/ChangeLog:
> 
> 2015-08-06  Renlin Li  <renlin.li@arm.com>
> 
>        PR target/66776
>        * config/aarch64/aarch64.md (cmovdi_insn_uxtw): New pattern.
> 
> gcc/testsuite/ChangeLog:
> 
> 2015-08-06  Renlin Li  <renlin.li@arm.com>
> 
>        PR target/66776
>        * gcc.target/aarch64/pr66776.c: New.
> 
> 
> 
> <new-1.diff>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]