summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-03-25 01:57:35 +0000
committerChris Lattner <sabre@nondot.org>2007-03-25 01:57:35 +0000
commit03a643aa6962f40538076c808b6bcc19196e73d7 (patch)
tree333ccf1f8b32dc907819ebe2c34b2f6ab0131fd0
parentc8ddca703de922a37003db6b98b1fa8fc8e660aa (diff)
downloadbcm5719-llvm-03a643aa6962f40538076c808b6bcc19196e73d7.tar.gz
bcm5719-llvm-03a643aa6962f40538076c808b6bcc19196e73d7.zip
enforce the proper range for the i386 N constraint.
llvm-svn: 35319
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 2f9763d6f96..3796f3090c7 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -4544,16 +4544,17 @@ isOperandValidForConstraint(SDOperand Op, char Constraint, SelectionDAG &DAG) {
switch (Constraint) {
default: break;
case 'I':
- if (isa<ConstantSDNode>(Op)) {
- unsigned Value = cast<ConstantSDNode>(Op)->getValue();
- if (Value <= 31)
+ if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op)) {
+ if (C->getValue() <= 31)
return Op;
- else
- return SDOperand(0,0);
- } else {
- return SDOperand(0,0);
}
- break;
+ return SDOperand(0,0);
+ case 'N':
+ if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op)) {
+ if (C->getValue() <= 255)
+ return Op;
+ }
+ return SDOperand(0,0);
case 'i':
// Literal immediates are always ok.
if (isa<ConstantSDNode>(Op)) return Op;
OpenPOWER on IntegriCloud