[all-commits] [llvm/llvm-project] 0637df: [DAG] Legalize abs(x) -> smax(x, sub(0, x)) iff smax...
Simon Pilgrim via All-commits
all-commits at lists.llvm.org
Wed Nov 25 07:12:30 PST 2020
Branch: refs/heads/temp-test-main
Home: https://github.com/llvm/llvm-project
Commit: 0637dfe88b02a68f27fbad16ea47b26f91a47c61
https://github.com/llvm/llvm-project/commit/0637dfe88b02a68f27fbad16ea47b26f91a47c61
Author: Simon Pilgrim <llvm-dev at redking.me.uk>
Date: 2020-11-25 (Wed, 25 Nov 2020)
Changed paths:
M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
M llvm/lib/Target/PowerPC/PPCISelLowering.cpp
M llvm/lib/Target/PowerPC/PPCISelLowering.h
M llvm/test/CodeGen/X86/abs.ll
M llvm/test/CodeGen/X86/combine-abs.ll
M llvm/test/CodeGen/X86/viabs.ll
Log Message:
-----------
[DAG] Legalize abs(x) -> smax(x,sub(0,x)) iff smax/sub are legal
If smax() is legal, this is likely to result in smaller codegen expansion for abs(x) than the xor(add,ashr) method.
This is also what PowerPC has been doing for its abs implementation, so it lets us get rid of a load of custom lowering code there (and which was never updated when they added smax lowering).
Alive2: https://alive2.llvm.org/ce/z/xRk3cD
Differential Revision: https://reviews.llvm.org/D92095
More information about the All-commits
mailing list