aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-09-28 22:50:24 +0000
committerChris Lattner <sabre@nondot.org>2005-09-28 22:50:24 +0000
commit88add100b3db715df4275c8ab408e6b51f28ff8f (patch)
treea22c2eafd1b7c8334cd3a36a0af8851332ce8016 /lib
parent4a7de219b4bd776e5ae89f3cf5f6638afac4e5d3 (diff)
downloadexternal_llvm-88add100b3db715df4275c8ab408e6b51f28ff8f.zip
external_llvm-88add100b3db715df4275c8ab408e6b51f28ff8f.tar.gz
external_llvm-88add100b3db715df4275c8ab408e6b51f28ff8f.tar.bz2
disentangle FP from INT versions of div/mul
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23511 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/PowerPC/PPCISelDAGToDAG.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
index 0fd4e02..bea50f7 100644
--- a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
+++ b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
@@ -820,7 +820,6 @@ SDOperand PPC32DAGToDAGISel::Select(SDOperand Op) {
Select(N->getOperand(1)));
return SDOperand(N, 0);
}
- case ISD::FMUL:
case ISD::MUL: {
unsigned Imm, Opc;
if (isIntImmediate(N->getOperand(1), Imm) && isInt16(Imm)) {
@@ -828,18 +827,17 @@ SDOperand PPC32DAGToDAGISel::Select(SDOperand Op) {
Select(N->getOperand(0)), getI32Imm(Lo16(Imm)));
return SDOperand(N, 0);
}
- switch (N->getValueType(0)) {
- default: assert(0 && "Unhandled multiply type!");
- case MVT::i32: Opc = PPC::MULLW; break;
- case MVT::f32: Opc = PPC::FMULS; break;
- case MVT::f64: Opc = PPC::FMUL; break;
- }
- CurDAG->SelectNodeTo(N, Opc, N->getValueType(0), Select(N->getOperand(0)),
+ CurDAG->SelectNodeTo(N, PPC::MULLW, MVT::i32, Select(N->getOperand(0)),
Select(N->getOperand(1)));
return SDOperand(N, 0);
}
- case ISD::SDIV:
- case ISD::FDIV: {
+ case ISD::FMUL: {
+ unsigned Opc = N->getValueType(0) == MVT::f32 ? PPC::FMULS : PPC::FMUL;
+ CurDAG->SelectNodeTo(N, Opc, N->getValueType(0), Select(N->getOperand(0)),
+ Select(N->getOperand(1)));
+ return SDOperand(N, 0);
+ }
+ case ISD::SDIV: {
unsigned Imm;
if (isIntImmediate(N->getOperand(1), Imm)) {
if ((signed)Imm > 0 && isPowerOf2_32(Imm)) {
@@ -869,17 +867,17 @@ SDOperand PPC32DAGToDAGISel::Select(SDOperand Op) {
}
}
- unsigned Opc;
- switch (N->getValueType(0)) {
- default: assert(0 && "Unknown type to ISD::SDIV");
- case MVT::i32: Opc = PPC::DIVW; break;
- case MVT::f32: Opc = PPC::FDIVS; break;
- case MVT::f64: Opc = PPC::FDIV; break;
- }
- CurDAG->SelectNodeTo(N, Opc, N->getValueType(0), Select(N->getOperand(0)),
+ CurDAG->SelectNodeTo(N, PPC::DIVW, MVT::i32, Select(N->getOperand(0)),
Select(N->getOperand(1)));
return SDOperand(N, 0);
}
+ case ISD::FDIV: {
+ unsigned Opc = N->getValueType(0) == MVT::f32 ? PPC::FDIVS : PPC::FDIV;
+ CurDAG->SelectNodeTo(N, Opc, N->getValueType(0), Select(N->getOperand(0)),
+ Select(N->getOperand(1)));
+ return SDOperand(N, 0);
+ }
+
case ISD::UDIV: {
// If this is a divide by constant, we can emit code using some magic
// constants to implement it as a multiply instead.