[PATCH] D64574: [X86] Teach convertToThreeAddress to handle SUB with immediate
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 11 10:35:33 PDT 2019
craig.topper created this revision.
craig.topper added reviewers: spatel, RKSimon.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
We mostly avoid sub with immediate but there are a couple cases that can create them. One is the add 128, %rax -> sub -128, %rax trick in isel. The other is when a SUB immediate gets created for a compare where both the flags and the subtract value is used. If we are unable to linearize the SelectionDAG to satisfy the flag user and the sub result user from the same instruction, we will clone the sub immediate for the two uses. The one that produces flags will eventually become a compare. The other will have its flag output dead, and could then be considered for LEA creation.
This showed up in the current codegen for PR42571.
https://reviews.llvm.org/D64574
Files:
llvm/lib/Target/X86/X86InstrArithmetic.td
llvm/lib/Target/X86/X86InstrInfo.cpp
llvm/test/CodeGen/X86/add.ll
llvm/test/CodeGen/X86/bmi-intrinsics-fast-isel-x86_64.ll
llvm/test/CodeGen/X86/bmi-intrinsics-fast-isel.ll
llvm/test/CodeGen/X86/tbm-intrinsics-fast-isel-x86_64.ll
llvm/test/CodeGen/X86/tbm-intrinsics-fast-isel.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64574.209255.patch
Type: text/x-patch
Size: 18092 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190711/fc5999b8/attachment.bin>
More information about the llvm-commits
mailing list