[PATCH] D23677: [AArch64] Reuse register with known value when generating csneg and csinv instructions.

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 12:11:31 PDT 2016


mcrosier added inline comments.

================
Comment at: test/CodeGen/AArch64/arm64-csel.ll:241
@@ +240,3 @@
+  ret i32 %res
+}
+
----------------
efriedma wrote:
> Currently, trunk generates the following for foo20:
> 
>         cmp     w0, #1
>         orr     w8, wzr, #0x1
>         cneg    w0, w8, ne
>         ret
> 
> This is "w0 == 1 ? 1 : -1"
> 
> 
> With your patch, we generate... this?
> 
>         cmp     w0, #1
>         cneg    w0, w0, ne
>         ret
> 
> Unless I'm missing something, this is "w0 == 1 ? w0 : -w0", which is not the same thing.
Ah, yes..   For example, if w0 holds 5 the cneg would put -5 in w0, rather than -1.


https://reviews.llvm.org/D23677





More information about the llvm-commits mailing list