[LLVMdev] Why change "sub x, 5" to "add x, -5" ?
David.Chisnall at cl.cam.ac.uk
Wed Jul 8 08:29:47 PDT 2015
On 8 Jul 2015, at 16:00, Frédéric Heitzmann <frederic.heitzmann at gmail.com> wrote:
> AFAIK, there is no target which has some better encoding with a negative value than with a positive one.
Many don’t have a sub-with-immediate at all, they have an add-with-sign-extended-immediate. Having a single canonical form simplifies matching for these.
More information about the llvm-dev