enforce the proper range for the i386 N constraint.
authorChris Lattner <sabre@nondot.org>
Sun, 25 Mar 2007 01:57:35 +0000 (01:57 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 25 Mar 2007 01:57:35 +0000 (01:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35319 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp

index 2f9763d6f965514accf9b17c677c13bf1f9711a9..3796f3090c77af10d03b33d6865a97fb9f1424d2 100644 (file)
@@ -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;