For PR950:
The long awaited CAST patch. This introduces 12 new instructions into LLVM
to replace the cast instruction. Corresponding changes throughout LLVM are
provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the
exception of 175.vpr which fails only on a slight floating point output
difference.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31931 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AsmParser/Lexer.l.cvs b/lib/AsmParser/Lexer.l.cvs
index 4df84f6..b47ae91 100644
--- a/lib/AsmParser/Lexer.l.cvs
+++ b/lib/AsmParser/Lexer.l.cvs
@@ -51,6 +51,17 @@
   llvmAsmlval.type.obsolete = true; \
   return sym
 
+// Construct a token value for a non-obsolete type
+#define RET_TY(CType, sym) \
+  llvmAsmlval.TypeVal.type = new PATypeHolder(CType); \
+  llvmAsmlval.TypeVal.signedness = isSignless; \
+  return sym
+
+// Construct a token value for an obsolete token
+#define RET_TY_OBSOLETE(CType, sign, sym) \
+  llvmAsmlval.TypeVal.type = new PATypeHolder(CType); \
+  llvmAsmlval.TypeVal.signedness = sign; \
+  return sym
 
 namespace llvm {
 
@@ -238,19 +249,19 @@
 x86_stdcallcc   { return X86_STDCALLCC_TOK; }
 x86_fastcallcc  { return X86_FASTCALLCC_TOK; }
 
-void            { llvmAsmlval.PrimType = Type::VoidTy  ; return VOID;   }
-bool            { llvmAsmlval.PrimType = Type::BoolTy  ; return BOOL;   }
-sbyte           { llvmAsmlval.PrimType = Type::SByteTy ; return SBYTE;  }
-ubyte           { llvmAsmlval.PrimType = Type::UByteTy ; return UBYTE;  }
-short           { llvmAsmlval.PrimType = Type::ShortTy ; return SHORT;  }
-ushort          { llvmAsmlval.PrimType = Type::UShortTy; return USHORT; }
-int             { llvmAsmlval.PrimType = Type::IntTy   ; return INT;    }
-uint            { llvmAsmlval.PrimType = Type::UIntTy  ; return UINT;   }
-long            { llvmAsmlval.PrimType = Type::LongTy  ; return LONG;   }
-ulong           { llvmAsmlval.PrimType = Type::ULongTy ; return ULONG;  }
-float           { llvmAsmlval.PrimType = Type::FloatTy ; return FLOAT;  }
-double          { llvmAsmlval.PrimType = Type::DoubleTy; return DOUBLE; }
-label           { llvmAsmlval.PrimType = Type::LabelTy ; return LABEL;  }
+void            { RET_TY(Type::VoidTy, VOID);  }
+bool            { RET_TY(Type::BoolTy, BOOL);  }
+sbyte           { RET_TY_OBSOLETE(Type::SByteTy, isSigned,   SBYTE); }
+ubyte           { RET_TY_OBSOLETE(Type::UByteTy, isUnsigned, UBYTE); }
+short           { RET_TY_OBSOLETE(Type::ShortTy, isSigned,   SHORT); }
+ushort          { RET_TY_OBSOLETE(Type::UShortTy,isUnsigned, USHORT); }
+int             { RET_TY_OBSOLETE(Type::IntTy,   isSigned,   INT);    }
+uint            { RET_TY_OBSOLETE(Type::UIntTy,  isUnsigned, UINT);   }
+long            { RET_TY_OBSOLETE(Type::LongTy,  isSigned,   LONG);   }
+ulong           { RET_TY_OBSOLETE(Type::ULongTy, isUnsigned, ULONG);  }
+float           { RET_TY(Type::FloatTy, FLOAT);  }
+double          { RET_TY(Type::DoubleTy, DOUBLE); }
+label           { RET_TY(Type::LabelTy,  LABEL);  }
 type            { return TYPE;   }
 opaque          { return OPAQUE; }
 
@@ -277,10 +288,24 @@
 
 phi             { RET_TOK(OtherOpVal, PHI, PHI_TOK); }
 call            { RET_TOK(OtherOpVal, Call, CALL); }
-cast            { RET_TOK(OtherOpVal, Cast, CAST); }
+cast            { RET_TOK_OBSOLETE(CastOpVal, Trunc, TRUNC); }
+trunc           { RET_TOK(CastOpVal, Trunc, TRUNC); }
+zext            { RET_TOK(CastOpVal, ZExt, ZEXT); }
+sext            { RET_TOK(CastOpVal, SExt, SEXT); }
+fptrunc         { RET_TOK(CastOpVal, FPTrunc, FPTRUNC); }
+fpext           { RET_TOK(CastOpVal, FPExt, FPEXT); }
+uitofp          { RET_TOK(CastOpVal, UIToFP, UITOFP); }
+sitofp          { RET_TOK(CastOpVal, SIToFP, SITOFP); }
+fptoui          { RET_TOK(CastOpVal, FPToUI, FPTOUI); }
+fptosi          { RET_TOK(CastOpVal, FPToSI, FPTOSI); }
+inttoptr        { RET_TOK(CastOpVal, IntToPtr, INTTOPTR); }
+ptrtoint        { RET_TOK(CastOpVal, PtrToInt, PTRTOINT); }
+bitcast         { RET_TOK(CastOpVal, BitCast, BITCAST); }
 select          { RET_TOK(OtherOpVal, Select, SELECT); }
 shl             { RET_TOK(OtherOpVal, Shl, SHL); }
-shr             { RET_TOK(OtherOpVal, Shr, SHR); }
+shr             { RET_TOK_OBSOLETE(OtherOpVal, LShr, LSHR); }
+lshr            { RET_TOK(OtherOpVal, LShr, LSHR); }
+ashr            { RET_TOK(OtherOpVal, AShr, ASHR); }
 vanext          { return VANEXT_old; }
 vaarg           { return VAARG_old; }
 va_arg          { RET_TOK(OtherOpVal, VAArg , VAARG); }