[PATCH] D83964: GlobalISel: Augment addsat/subsat lowering with an optional type
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 16 09:58:56 PDT 2020
arsenm created this revision.
arsenm added reviewers: foad, dsanders, paquette, aemerson, aditya_nandakumar.
Herald added subscribers: kerbowa, hiraditya, tpr, rovka, nhaehnle, wdng, jvesely.
Herald added a project: LLVM.
Extend and perform the lowering in the wider type if provided. This
provides a sort of lower with combined widen scalar action.
widenScalar will always widen and produce the original opcode in a
wider type, whereas this will use different opcodes.
This ends up saving an instruction in the uaddsat case. If you know
you are widening, the add in the wider result can't overflow so only
the clamp of the maximum value is needed. In other cases, it can avoid
introducing more instructions that need further widening, saving
avoiding intermediate legalization artifacts.
Use this to handle the sub-32 bit cases for AMDGPU when the clamp
modifier isn't available. This brings the results closer to
SelectionDAG, which duplicates nearly identical expansions of these in
both LegalizeIntegerTypes and LegalizeDAG.
https://reviews.llvm.org/D83964
Files:
llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h
llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-saddsat.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-ssubsat.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-uaddsat.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-usubsat.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/saddsat.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/ssubsat.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/uaddsat.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/usubsat.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83964.278526.patch
Type: text/x-patch
Size: 298496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200716/0c570761/attachment-0001.bin>
More information about the llvm-commits
mailing list