R600/SI: Do abs/neg folding with ComplexPatterns

Abs/neg folding has moved out of foldOperands and into the instruction
selection phase using complex patterns.  As a consequence of this
change, we now prefer to select the 64-bit encoding for most
instructions and the modifier operands have been dropped from
integer VOP3 instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214467 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Tom Stellard
2014-08-01 00:32:39 +00:00
parent f3b62dfcb2
commit 17c8fefc9f
16 changed files with 1069 additions and 696 deletions

View File

@@ -566,8 +566,6 @@ MachineBasicBlock * SITargetLowering::EmitInstrWithCustomInserter(
.addReg(MI->getOperand(1).getReg())
.addImm(1) // SRC1 modifiers
.addReg(MI->getOperand(2).getReg())
.addImm(0) // SRC2 modifiers
.addImm(0) // src2
.addImm(0) // CLAMP
.addImm(0); // OMOD
MI->eraseFromParent();
@@ -1636,39 +1634,23 @@ SDNode *SITargetLowering::foldOperands(MachineSDNode *Node,
continue;
if (!Operand.isMachineOpcode())
continue;
if (Operand.getMachineOpcode() == AMDGPU::FNEG_SI) {
Ops.pop_back();
Ops.push_back(Operand.getOperand(0));
InputModifiers[i] = 1;
Promote2e64 = true;
if (!DescE64)
continue;
Desc = DescE64;
DescE64 = nullptr;
}
else if (Operand.getMachineOpcode() == AMDGPU::FABS_SI) {
Ops.pop_back();
Ops.push_back(Operand.getOperand(0));
InputModifiers[i] = 2;
Promote2e64 = true;
if (!DescE64)
continue;
Desc = DescE64;
DescE64 = nullptr;
}
}
if (Promote2e64) {
std::vector<SDValue> OldOps(Ops);
Ops.clear();
bool HasModifiers = TII->hasModifiers(Desc->Opcode);
for (unsigned i = 0; i < OldOps.size(); ++i) {
// src_modifier
Ops.push_back(DAG.getTargetConstant(InputModifiers[i], MVT::i32));
if (HasModifiers)
Ops.push_back(DAG.getTargetConstant(InputModifiers[i], MVT::i32));
Ops.push_back(OldOps[i]);
}
// Add the modifier flags while promoting
for (unsigned i = 0; i < 2; ++i)
Ops.push_back(DAG.getTargetConstant(0, MVT::i32));
if (HasModifiers) {
for (unsigned i = 0; i < 2; ++i)
Ops.push_back(DAG.getTargetConstant(0, MVT::i32));
}
}
// Add optional chain and glue