Index: lib/AST/MicrosoftMangle.cpp
===================================================================
--- lib/AST/MicrosoftMangle.cpp	(revision 223995)
+++ lib/AST/MicrosoftMangle.cpp	(working copy)
@@ -1040,8 +1040,10 @@
   // Make sure booleans are encoded as 0/1.
   if (IsBoolean && Value.getBoolValue())
     mangleNumber(1);
+  else if (Value.isSigned())
+    mangleNumber(Value.getSExtValue());
   else
-    mangleNumber(Value.getSExtValue());
+    mangleNumber(Value.getZExtValue());
 }
 
 void MicrosoftCXXNameMangler::mangleExpression(const Expr *E) {
Index: test/CodeGenCXX/mangle-ms-templates.cpp
===================================================================
--- test/CodeGenCXX/mangle-ms-templates.cpp	(revision 223995)
+++ test/CodeGenCXX/mangle-ms-templates.cpp	(working copy)
@@ -24,6 +24,12 @@
   IntTemplate() {}
 };
 
+template<unsigned param>
+class UnsignedIntTemplate {
+public:
+  UnsignedIntTemplate() {}
+};
+
 template<long long param>
 class LongLongTemplate {
  public:
@@ -133,6 +139,10 @@
   IntTemplate<-11> neg_11;
 // CHECK: call {{.*}} @"\01??0?$IntTemplate@$0?L@@@QAE@XZ"
 // X64: call {{.*}} @"\01??0?$IntTemplate@$0?L@@@QEAA@XZ"
+  
+  UnsignedIntTemplate<4294967295> ffffffff;
+// CHECK: call {{.*}} @"\01??0?$UnsignedIntTemplate@$0PPPPPPPP@@@QAE@XZ"
+// X64: call {{.*}} @"\01??0?$UnsignedIntTemplate@$0PPPPPPPP@@@QEAA@XZ"
 
   LongLongTemplate<-9223372036854775807LL-1LL> int64_min;
 // CHECK: call {{.*}} @"\01??0?$LongLongTemplate@$0?IAAAAAAAAAAAAAAA@@@QAE@XZ"
