[PATCH] D42477: [AArch64] Improve v8.1-A code-gen for atomic load-subtract

Oliver Stannard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 05:08:24 PST 2018


olista01 added a comment.

> Geoff Berry suggested to do this in DAG Combine

DAG combine runs after this code, so it is being used to do the optimisations we want. In the *_neg_imm test cases it folds a constant and a sub into a different constant, and in the *_neg_arg test cases it folds two SUBs into nothing.

> Is there no (easy) way to do this in tablegen? I would prefer a tablegen pattern over C code. Even though this C looks nice and tidy.

That's what the current code does (I've left the patterns in for now since they are still needed for global isel). The problem with this is that the patterns get used at the end of the SelectionDAG pass (to emit MachineInstrs), so we'd have to re-implement the folding of subtraction instructions at that level. The alternative would be to add extra DAG patterns which match when the operand is a negative immediate, a subtraction etc, but I didn't do that as it would be duplicating the optimisations done by DAGCombine in a narrower context.


Repository:
  rL LLVM

https://reviews.llvm.org/D42477





More information about the llvm-commits mailing list