diff options
author | Chris Lattner <sabre@nondot.org> | 2007-05-15 01:31:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-05-15 01:31:05 +0000 |
commit | 0b7472da6f3afceb8342b1d4e0a65d6b933d360b (patch) | |
tree | e0b2e39cd085f19515dffbfd3730b95e26dbf819 /llvm/lib | |
parent | 0f7cbe8370384a82de2b24f6ed8b7dc6b15646cd (diff) | |
download | bcm5719-llvm-0b7472da6f3afceb8342b1d4e0a65d6b933d360b.tar.gz bcm5719-llvm-0b7472da6f3afceb8342b1d4e0a65d6b933d360b.zip |
fix some subtle inline asm selection issues
llvm-svn: 37067
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index 13ab52abd4b..818fcd5f59a 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -3326,31 +3326,39 @@ isOperandValidForConstraint(SDOperand Op, char Letter, SelectionDAG &DAG) { case 'N': case 'O': case 'P': { - if (!isa<ConstantSDNode>(Op)) return SDOperand(0,0);// Must be an immediate. - unsigned Value = cast<ConstantSDNode>(Op)->getValue(); + ConstantSDNode *CST = dyn_cast<ConstantSDNode>(Op); + if (!CST) return SDOperand(0, 0); // Must be an immediate to match. + unsigned Value = CST->getValue(); switch (Letter) { default: assert(0 && "Unknown constraint letter!"); case 'I': // "I" is a signed 16-bit constant. - if ((short)Value == (int)Value) return Op; + if ((short)Value == (int)Value) + return DAG.getTargetConstant(Value, Op.getValueType()); break; case 'J': // "J" is a constant with only the high-order 16 bits nonzero. case 'L': // "L" is a signed 16-bit constant shifted left 16 bits. - if ((short)Value == 0) return Op; + if ((short)Value == 0) + return DAG.getTargetConstant(Value, Op.getValueType()); break; case 'K': // "K" is a constant with only the low-order 16 bits nonzero. - if ((Value >> 16) == 0) return Op; + if ((Value >> 16) == 0) + return DAG.getTargetConstant(Value, Op.getValueType()); break; case 'M': // "M" is a constant that is greater than 31. - if (Value > 31) return Op; + if (Value > 31) + return DAG.getTargetConstant(Value, Op.getValueType()); break; case 'N': // "N" is a positive constant that is an exact power of two. - if ((int)Value > 0 && isPowerOf2_32(Value)) return Op; + if ((int)Value > 0 && isPowerOf2_32(Value)) + return DAG.getTargetConstant(Value, Op.getValueType()); break; case 'O': // "O" is the constant zero. - if (Value == 0) return Op; + if (Value == 0) + return DAG.getTargetConstant(Value, Op.getValueType()); break; case 'P': // "P" is a constant whose negation is a signed 16-bit constant. - if ((short)-Value == (int)-Value) return Op; + if ((short)-Value == (int)-Value) + return DAG.getTargetConstant(Value, Op.getValueType()); break; } break; |