[PATCH] D24822: [SelectionDAG] Expand MULHU and enable division-by-constant for wide types
Nicolai Hähnle via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 22 05:07:58 PDT 2016
nhaehnle created this revision.
nhaehnle added reviewers: spatel, bkramer, venkatra, arsenm, tstellarAMD.
nhaehnle added a subscriber: llvm-commits.
Herald added subscribers: nhaehnle, wdng, jyknight.
Converting division by constant to a multiply and shift requires MULHU, which
may not be available for all legal types.
This change will expand MULHU to a sequence of smaller-width multiplies and
additions when necessary. BuildUDIV is changed to reflect this expansion as
well.
This allows 64-bit division-by-constant to use the more efficient multiply
and shift lowering on AMDGPU.
This also affects a lowering on SPARC in a way that might be less efficient,
see the change in the corresponding test case for the effect. It may be
better for SPARC to return true for isIntDivCheap in the 64-bit case, I'd
appreciate some feedback on that.
https://reviews.llvm.org/D24822
Files:
include/llvm/Target/TargetLowering.h
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/CodeGen/SelectionDAG/TargetLowering.cpp
test/CodeGen/AMDGPU/udiv.ll
test/CodeGen/SPARC/rem.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24822.72153.patch
Type: text/x-patch
Size: 17779 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160922/f7aad5cf/attachment.bin>
More information about the llvm-commits
mailing list