enforce the proper range for the i386 N constraint.
llvm-svn: 35319
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 2f9763d..3796f30 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -4544,16 +4544,17 @@
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;