[PATCH] D45990: GlobalISel/InstructionSelector: Implement GIR_CopyFConstantAsFPImm
Tom Stellard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 4 19:57:02 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL331579: GlobalISel/InstructionSelector: Implement GIR_CopyFConstantAsFPImm (authored by tstellar, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D45990?vs=143655&id=145343#toc
Repository:
rL LLVM
https://reviews.llvm.org/D45990
Files:
llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelector.h
llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h
Index: llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelector.h
===================================================================
--- llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelector.h
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelector.h
@@ -248,6 +248,12 @@
/// The operand index is implicitly 1.
GIR_CopyConstantAsSImm,
+ /// Render a G_FCONSTANT operator as a sign-extended immediate.
+ /// - NewInsnID - Instruction ID to modify
+ /// - OldInsnID - Instruction ID to copy from
+ /// The operand index is implicitly 1.
+ GIR_CopyFConstantAsFPImm,
+
/// Constrain an instruction operand to a register class.
/// - InsnID - Instruction ID to modify
/// - OpIdx - Operand index
Index: llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h
===================================================================
--- llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h
@@ -662,6 +662,23 @@
break;
}
+ // TODO: Needs a test case once we have a pattern that uses this.
+ case GIR_CopyFConstantAsFPImm: {
+ int64_t NewInsnID = MatchTable[CurrentIdx++];
+ int64_t OldInsnID = MatchTable[CurrentIdx++];
+ assert(OutMIs[NewInsnID] && "Attempted to add to undefined instruction");
+ assert(State.MIs[OldInsnID]->getOpcode() == TargetOpcode::G_FCONSTANT && "Expected G_FCONSTANT");
+ if (State.MIs[OldInsnID]->getOperand(1).isFPImm())
+ OutMIs[NewInsnID].addFPImm(
+ State.MIs[OldInsnID]->getOperand(1).getFPImm());
+ else
+ llvm_unreachable("Expected FPImm operand");
+ DEBUG_WITH_TYPE(TgtInstructionSelector::getName(),
+ dbgs() << CurrentIdx << ": GIR_CopyFPConstantAsFPImm(OutMIs["
+ << NewInsnID << "], MIs[" << OldInsnID << "])\n");
+ break;
+ }
+
case GIR_CustomRenderer: {
int64_t InsnID = MatchTable[CurrentIdx++];
int64_t OldInsnID = MatchTable[CurrentIdx++];
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45990.145343.patch
Type: text/x-patch
Size: 2079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180505/f2fd4376/attachment.bin>
More information about the llvm-commits
mailing list