Ver Fonte

Fix implicit casts for dimension and various other related things.

- Fix improper bool early promotion to int in CheckBinOpForHLSL
- Modify VerifierTest.cpp to re-enable parsing by VerifierHelper.py
- Update/fix VerifierHelper.py
- Update/fix various tests, including adding expected fxc comments
- Fix source locations for ValidateCast uses
- ValidateCast will use expression location if no loc provided
- TODO: Fix error on explicit truncation cast that should be ok, as long
  as it's not an l-value "cannot truncate lvalue vector/matrix"
  See binop-dims.hlsl
- TODO: Fix L-Value casts in the future
Tex Riddell há 7 anos atrás
pai
commit
645ea84fcc
31 ficheiros alterados com 2499 adições e 1715 exclusões
  1. 0 9
      tools/clang/include/clang/Sema/SemaHLSL.h
  2. 1 7
      tools/clang/lib/Sema/SemaExpr.cpp
  3. 480 472
      tools/clang/lib/Sema/SemaHLSL.cpp
  4. 9 9
      tools/clang/test/CodeGenHLSL/quick-test/vector-matrix-binops.hlsl
  5. 4 4
      tools/clang/test/HLSL/array-length.hlsl
  6. 2 2
      tools/clang/test/HLSL/attributes.hlsl
  7. 743 0
      tools/clang/test/HLSL/binop-dims.hlsl
  8. 3 3
      tools/clang/test/HLSL/const-assign.hlsl
  9. 25 25
      tools/clang/test/HLSL/const-default.hlsl
  10. 27 27
      tools/clang/test/HLSL/const-expr.hlsl
  11. 1 1
      tools/clang/test/HLSL/derived-to-base.hlsl
  12. 7 8
      tools/clang/test/HLSL/effects-syntax.hlsl
  13. 9 9
      tools/clang/test/HLSL/enums.hlsl
  14. 14 14
      tools/clang/test/HLSL/functions.hlsl
  15. 114 140
      tools/clang/test/HLSL/implicit-casts.hlsl
  16. 211 201
      tools/clang/test/HLSL/indexing-operator.hlsl
  17. 78 78
      tools/clang/test/HLSL/literals.hlsl
  18. 13 13
      tools/clang/test/HLSL/matrix-assignments.hlsl
  19. 7 7
      tools/clang/test/HLSL/matrix-syntax.hlsl
  20. 20 20
      tools/clang/test/HLSL/more-operators.hlsl
  21. 17 17
      tools/clang/test/HLSL/packreg.hlsl
  22. 58 58
      tools/clang/test/HLSL/scalar-assignments.hlsl
  23. 322 305
      tools/clang/test/HLSL/scalar-operators-exact-precision.hlsl
  24. 204 192
      tools/clang/test/HLSL/scalar-operators.hlsl
  25. 4 4
      tools/clang/test/HLSL/semantics.hlsl
  26. 2 2
      tools/clang/test/HLSL/uint4_add3.hlsl
  27. 2 2
      tools/clang/test/HLSL/vector-assignments.hlsl
  28. 49 49
      tools/clang/test/HLSL/vector-conditional.hlsl
  29. 7 7
      tools/clang/test/HLSL/vector-syntax.hlsl
  30. 9 6
      tools/clang/unittests/HLSL/VerifierTest.cpp
  31. 57 24
      utils/hct/VerifierHelper.py

+ 0 - 9
tools/clang/include/clang/Sema/SemaHLSL.h

@@ -64,15 +64,6 @@ clang::Sema::TemplateDeductionResult DeduceTemplateArgumentsForHLSL(
   clang::FunctionDecl *&, 
   clang::sema::TemplateDeductionInfo &);
 
-void DiagnoseAssignmentResultForHLSL(
-  clang::Sema* self,
-  clang::Sema::AssignConvertType ConvTy,
-  clang::SourceLocation Loc,
-  clang::QualType DstType, clang::QualType SrcType,
-  clang::Expr *SrcExpr,
-  clang::Sema::AssignmentAction Action,
-  bool *Complained);
-
 void DiagnoseControlFlowConditionForHLSL(clang::Sema *self,
                                          clang::Expr *condExpr,
                                          llvm::StringRef StmtName);

+ 1 - 7
tools/clang/lib/Sema/SemaExpr.cpp

@@ -7238,7 +7238,7 @@ Sema::CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS,
                                        bool DiagnoseCFAudited) {
   // HLSL Change Starts
   if (getLangOpts().HLSL) {
-    // DiagnoseAssignmentResultForHLSL will take care of diagnostics.
+    // implicit conversion will take care of diagnostics.
     return Compatible;
   }
   // HLSL Change Ends
@@ -11867,12 +11867,6 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
   const ObjCInterfaceDecl *IFace = nullptr;
   const ObjCProtocolDecl *PDecl = nullptr;
 
-  // HLSL Change Starts
-  if (LangOpts.HLSL) {
-    hlsl::DiagnoseAssignmentResultForHLSL(this, ConvTy, Loc, DstType, SrcType, SrcExpr, Action, Complained);
-  }
-  // HLSL Change Ends
-
   switch (ConvTy) {
   case Compatible:
       DiagnoseAssignmentEnum(DstType, SrcType, SrcExpr);

Diff do ficheiro suprimidas por serem muito extensas
+ 480 - 472
tools/clang/lib/Sema/SemaHLSL.cpp


+ 9 - 9
tools/clang/test/CodeGenHLSL/quick-test/vector-matrix-binops.hlsl

@@ -7,12 +7,12 @@
 // CHECK: vector-matrix-binops.hlsl:36:29: warning: implicit truncation of vector type
 // CHECK: vector-matrix-binops.hlsl:37:23: warning: implicit truncation of vector type
 // CHECK: vector-matrix-binops.hlsl:37:16: warning: implicit truncation of vector type
-// CHECK: vector-matrix-binops.hlsl:42:24: error: type mismatch
-// CHECK: vector-matrix-binops.hlsl:43:27: error: type mismatch
+// CHECK: vector-matrix-binops.hlsl:42:26: error: cannot convert from 'float4x4' to 'float4'
+// CHECK: vector-matrix-binops.hlsl:43:29: error: cannot convert from 'float4' to 'float4x4'
 // CHECK: vector-matrix-binops.hlsl:44:26: warning: implicit truncation of vector type
-// CHECK: vector-matrix-binops.hlsl:45:14: warning: implicit truncation of vector type
-// CHECK: vector-matrix-binops.hlsl:58:27: error: type mismatch
-// CHECK: vector-matrix-binops.hlsl:59:27: error: type mismatch
+// CHECK: vector-matrix-binops.hlsl:45:21: warning: implicit truncation of vector type
+// CHECK: vector-matrix-binops.hlsl:58:29: error: cannot convert from 'float3x2' to 'float2x3'
+// CHECK: vector-matrix-binops.hlsl:59:29: error: cannot convert from 'float2x3' to 'float1x4'
 
 void main() {
 
@@ -39,8 +39,8 @@ void main() {
 
     // matrix and vector binary operation - mismatched dimensions
     {
-      float4 res1 = v4 * m44; // expected-error {{type mismatch}}
-      float4x4 res2 = m44 + v4; // expected-error {{type mismatch}}
+      float4 res1 = v4 * m44; // expected-error {{cannot convert from 'float4x4' to 'float4'}}
+      float4x4 res2 = m44 + v4; // expected-error {{cannot convert from 'float4' to 'float4x4'}}
       float3 res3 = v3 * m14; // expected-warning {{implicit truncation of vector type}} 
       float2 res4 = m14 / v2; // expected-warning {{implicit truncation of vector type}} 
     }
@@ -55,7 +55,7 @@ void main() {
     // matrix mismatched dimensions
     {
       float2x3 m23 = float2x3(1, 2, 3, 4, 5, 6);
-      float3x2 res1 = m23 - m32; // expected-error {{type mismatch}}
-      float1x4 res2 = m14 / m23; // expected-error {{type mismatch}}
+      float3x2 res1 = m23 - m32; // expected-error {{error: cannot convert from 'float3x2' to 'float2x3'}}
+      float1x4 res2 = m14 / m23; // expected-error {{cannot convert from 'float2x3' to 'float1x4'}}
     }
 }

+ 4 - 4
tools/clang/test/HLSL/array-length.hlsl

@@ -11,10 +11,10 @@ struct S {
 float main(S s:POSITION) : SV_Target {
     float4 planes3[] = {{ 1.0, 2.0, 3.0, 4.0 }};
     
-    int total = planes1.Length;	// expected-warning {{Length is deprecated}}
-    total += planes2.Length;  	// expected-warning {{Length is deprecated}}
-    total += planes3.Length;    // expected-warning {{Length is deprecated}}
-    total += s.planes.Length;   // expected-warning {{Length is deprecated}}
+    int total = planes1.Length;	// expected-warning {{Length is deprecated}} fxc-pass {{}}
+    total += planes2.Length;  	// expected-warning {{Length is deprecated}} fxc-pass {{}}
+    total += planes3.Length;    // expected-warning {{Length is deprecated}} fxc-pass {{}}
+    total += s.planes.Length;   // expected-warning {{Length is deprecated}} fxc-pass {{}}
 
     return total;
 }

+ 2 - 2
tools/clang/test/HLSL/attributes.hlsl

@@ -225,7 +225,7 @@ HSFoo HSMain( InputPatch<HSFoo, 16> p,
   | |       |       `-DeclRefExpr <col:25> 'uint':'unsigned int' lvalue ParmVar 'PatchID' 'uint':'unsigned int'
   | |       `-ImplicitCastExpr <col:39> 'float' <IntegralToFloating>
   | |         `-IntegerLiteral <col:39> 'literal int' 1
-  | |-CompoundAssignOperator <line:273:5, col:30> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+  | |-CompoundAssignOperator <line:273:5, col:30> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
   | | |-DeclRefExpr <col:5> 'float4':'vector<float, 4>' lvalue Var 'r' 'float4':'vector<float, 4>'
   | | `-CXXMemberCallExpr <col:10, col:30> 'vector<float, 4>'
   | |   |-MemberExpr <col:10, col:20> '<bound member function type>' .Load
@@ -243,7 +243,7 @@ HSFoo HSMain( InputPatch<HSFoo, 16> p,
   | |-BinaryOperator <line:274:5, col:31> 'float3':'vector<float, 3>' '='
   | | |-MemberExpr <col:5, col:12> 'float3':'vector<float, 3>' lvalue .pos
   | | | `-DeclRefExpr <col:5> 'HSFoo' lvalue Var 'output' 'HSFoo'
-  | | `-BinaryOperator <col:18, col:31> 'vector<float, 3>' '+'
+  | | `-BinaryOperator <col:18, col:31> 'float3':'vector<float, 3>' '+'
   | |   |-ImplicitCastExpr <col:18, col:23> 'float3':'vector<float, 3>' <LValueToRValue>
   | |   | `-MemberExpr <col:18, col:23> 'const float3':'const vector<float, 3>' lvalue .pos
   | |   |   `-CXXOperatorCallExpr <col:18, col:21> 'const HSFoo' lvalue

+ 743 - 0
tools/clang/test/HLSL/binop-dims.hlsl

@@ -0,0 +1,743 @@
+// RUN: %clang_cc1 -Wno-unused-value -fsyntax-only -ffreestanding -verify %s
+
+// To test with the classic compiler, run
+// %sdxroot%\tools\x86\fxc.exe /T ps_5_1 uint4add3.hlsl
+// :FXC_VERIFY_ARGUMENTS: /E main /T ps_5_1
+
+// we use -Wno-unused-value because we generate some no-op expressions to yield errors
+// without also putting them in a static assertion
+
+// TODO: Fix LValue casting to match fxc.
+// Currently certain LValue casts will crash CodeGen,
+// so an error has been placed here instead for now.
+// Need to look for the following expected error and fix in the future:
+//    cannot truncate lvalue vector/matrix
+
+/*<py>
+import re
+rxComments = re.compile(r'(//.*|/\*.*?\*\/)')
+def strip_comments(line):
+    line = rxComments.sub('', line)
+    return line.strip()
+def save_error_comments(lines):
+    saved = {}
+    for line in lines:
+        key = strip_comments(line)
+        if key and line.strip() != key:
+            saved[key] = line
+    return saved
+def restore_error_comments(saved, lines):
+    return [saved.get(line.strip(), line) for line in lines]
+def modify(lines, newlines):
+    return restore_error_comments(save_error_comments(lines), newlines)
+
+vars = [('float%s' % n, 'f%s' % n) for n in ('', '1', '2', '4')]
+vars += [('float%dx%d' % (r,c), 'm%dx%d' % (r,c)) for c in (1,2,4) for r in (1,2,4)]
+def gen_code():
+    lines = ['%s %s = 0;' % v for v in vars]
+    for lt, lv in vars:
+      for rt, rv in vars:
+        lines.append('%s = %s + %s;' % (lv, lv, rv))
+        lines.append('%s += %s;' % (lv, rv))
+        lines.append('%s = %s + (%s)%s;' % (lv, lv, lt, rv))
+        lines.append('%s += (%s)%s;' % (lv, lt, rv))
+    return lines
+</py>*/
+
+float4 main(float4 a : A, float3 c :C) : SV_TARGET {
+
+  // <py::lines('GENERATED_CODE')>modify(lines, gen_code())</py>
+  // GENERATED_CODE:BEGIN
+  float f = 0;
+  float1 f1 = 0;
+  float2 f2 = 0;
+  float4 f4 = 0;
+  float1x1 m1x1 = 0;
+  float2x1 m2x1 = 0;
+  float4x1 m4x1 = 0;
+  float1x2 m1x2 = 0;
+  float2x2 m2x2 = 0;
+  float4x2 m4x2 = 0;
+  float1x4 m1x4 = 0;
+  float2x4 m2x4 = 0;
+  float4x4 m4x4 = 0;
+  f = f + f;
+  f += f;
+  f = f + (float)f;
+  f += (float)f;
+  f = f + f1;
+  f += f1;
+  f = f + (float)f1;
+  f += (float)f1;
+  f = f + f2;                                               /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f += f2;                                                  /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f = f + (float)f2;
+  f += (float)f2;
+  f = f + f4;                                               /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f += f4;                                                  /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f = f + (float)f4;
+  f += (float)f4;
+  f = f + m1x1;
+  f += m1x1;
+  f = f + (float)m1x1;
+  f += (float)m1x1;
+  f = f + m2x1;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f += m2x1;                                                /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f = f + (float)m2x1;
+  f += (float)m2x1;
+  f = f + m4x1;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f += m4x1;                                                /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f = f + (float)m4x1;
+  f += (float)m4x1;
+  f = f + m1x2;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f += m1x2;                                                /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f = f + (float)m1x2;
+  f += (float)m1x2;
+  f = f + m2x2;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f += m2x2;                                                /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f = f + (float)m2x2;
+  f += (float)m2x2;
+  f = f + m4x2;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f += m4x2;                                                /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f = f + (float)m4x2;
+  f += (float)m4x2;
+  f = f + m1x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f += m1x4;                                                /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f = f + (float)m1x4;
+  f += (float)m1x4;
+  f = f + m2x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f += m2x4;                                                /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f = f + (float)m2x4;
+  f += (float)m2x4;
+  f = f + m4x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f += m4x4;                                                /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f = f + (float)m4x4;
+  f += (float)m4x4;
+  f1 = f1 + f;
+  f1 += f;
+  f1 = f1 + (float1)f;
+  f1 += (float1)f;
+  f1 = f1 + f1;
+  f1 += f1;
+  f1 = f1 + (float1)f1;
+  f1 += (float1)f1;
+  f1 = f1 + f2;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 += f2;                                                 /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 = f1 + (float1)f2;
+  f1 += (float1)f2;
+  f1 = f1 + f4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 += f4;                                                 /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 = f1 + (float1)f4;
+  f1 += (float1)f4;
+  f1 = f1 + m1x1;
+  f1 += m1x1;
+  f1 = f1 + (float1)m1x1;
+  f1 += (float1)m1x1;
+  f1 = f1 + m2x1;                                           /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 += m2x1;                                               /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 = f1 + (float1)m2x1;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f1 += (float1)m2x1;                                       /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f1 = f1 + m4x1;                                           /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 += m4x1;                                               /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 = f1 + (float1)m4x1;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f1 += (float1)m4x1;                                       /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f1 = f1 + m1x2;                                           /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 += m1x2;                                               /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 = f1 + (float1)m1x2;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f1 += (float1)m1x2;                                       /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f1 = f1 + m2x2;                                           /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 += m2x2;                                               /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 = f1 + (float1)m2x2;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f1 += (float1)m2x2;                                       /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f1 = f1 + m4x2;                                           /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 += m4x2;                                               /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 = f1 + (float1)m4x2;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f1 += (float1)m4x2;                                       /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f1 = f1 + m1x4;                                           /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 += m1x4;                                               /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 = f1 + (float1)m1x4;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f1 += (float1)m1x4;                                       /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f1 = f1 + m2x4;                                           /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 += m2x4;                                               /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 = f1 + (float1)m2x4;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f1 += (float1)m2x4;                                       /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f1 = f1 + m4x4;                                           /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 += m4x4;                                               /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f1 = f1 + (float1)m4x4;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f1 += (float1)m4x4;                                       /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f2 = f2 + f;
+  f2 += f;
+  f2 = f2 + (float2)f;
+  f2 += (float2)f;
+  f2 = f2 + f1;
+  f2 += f1;
+  f2 = f2 + (float2)f1;
+  f2 += (float2)f1;
+  f2 = f2 + f2;
+  f2 += f2;
+  f2 = f2 + (float2)f2;
+  f2 += (float2)f2;
+  f2 = f2 + f4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f2 += f4;                                                 /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f2 = f2 + (float2)f4;
+  f2 += (float2)f4;
+  f2 = f2 + m1x1;
+  f2 += m1x1;
+  f2 = f2 + (float2)m1x1;
+  f2 += (float2)m1x1;
+  f2 = f2 + m2x1;
+  f2 += m2x1;
+  f2 = f2 + (float2)m2x1;
+  f2 += (float2)m2x1;
+  f2 = f2 + m4x1;                                           /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f2 += m4x1;                                               /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f2 = f2 + (float2)m4x1;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f2 += (float2)m4x1;                                       /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f2 = f2 + m1x2;
+  f2 += m1x2;
+  f2 = f2 + (float2)m1x2;
+  f2 += (float2)m1x2;
+  f2 = f2 + m2x2;                                           /* expected-error {{cannot convert from 'float2x2' to 'float2'}} fxc-error {{X3020: type mismatch}} */
+  f2 += m2x2;                                               /* expected-error {{cannot convert from 'float2x2' to 'float2'}} fxc-error {{X3020: type mismatch}} */
+  f2 = f2 + (float2)m2x2;                                   /* expected-error {{cannot convert from 'float2x2' to 'float2'}} fxc-error {{X3017: cannot convert from 'float2x2' to 'float2'}} */
+  f2 += (float2)m2x2;                                       /* expected-error {{cannot convert from 'float2x2' to 'float2'}} fxc-error {{X3017: cannot convert from 'float2x2' to 'float2'}} */
+  f2 = f2 + m4x2;                                           /* expected-error {{cannot convert from 'float4x2' to 'float2'}} fxc-error {{X3020: type mismatch}} */
+  f2 += m4x2;                                               /* expected-error {{cannot convert from 'float4x2' to 'float2'}} fxc-error {{X3020: type mismatch}} */
+  f2 = f2 + (float2)m4x2;                                   /* expected-error {{cannot convert from 'float4x2' to 'float2'}} fxc-error {{X3017: cannot convert from 'float4x2' to 'float2'}} */
+  f2 += (float2)m4x2;                                       /* expected-error {{cannot convert from 'float4x2' to 'float2'}} fxc-error {{X3017: cannot convert from 'float4x2' to 'float2'}} */
+  f2 = f2 + m1x4;                                           /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f2 += m1x4;                                               /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f2 = f2 + (float2)m1x4;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f2 += (float2)m1x4;                                       /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  f2 = f2 + m2x4;                                           /* expected-error {{cannot convert from 'float2x4' to 'float2'}} fxc-error {{X3020: type mismatch}} */
+  f2 += m2x4;                                               /* expected-error {{cannot convert from 'float2x4' to 'float2'}} fxc-error {{X3020: type mismatch}} */
+  f2 = f2 + (float2)m2x4;                                   /* expected-error {{cannot convert from 'float2x4' to 'float2'}} fxc-error {{X3017: cannot convert from 'float2x4' to 'float2'}} */
+  f2 += (float2)m2x4;                                       /* expected-error {{cannot convert from 'float2x4' to 'float2'}} fxc-error {{X3017: cannot convert from 'float2x4' to 'float2'}} */
+  f2 = f2 + m4x4;                                           /* expected-error {{cannot convert from 'float4x4' to 'float2'}} fxc-error {{X3020: type mismatch}} */
+  f2 += m4x4;                                               /* expected-error {{cannot convert from 'float4x4' to 'float2'}} fxc-error {{X3020: type mismatch}} */
+  f2 = f2 + (float2)m4x4;                                   /* expected-error {{cannot convert from 'float4x4' to 'float2'}} fxc-error {{X3017: cannot convert from 'float4x4' to 'float2'}} */
+  f2 += (float2)m4x4;                                       /* expected-error {{cannot convert from 'float4x4' to 'float2'}} fxc-error {{X3017: cannot convert from 'float4x4' to 'float2'}} */
+  f4 = f4 + f;
+  f4 += f;
+  f4 = f4 + (float4)f;
+  f4 += (float4)f;
+  f4 = f4 + f1;
+  f4 += f1;
+  f4 = f4 + (float4)f1;
+  f4 += (float4)f1;
+  f4 = f4 + f2;                                             /* expected-error {{cannot convert from 'float2' to 'float4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f4 += f2;                                                 /* expected-error {{cannot convert from 'float2' to 'float4'}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f4 = f4 + (float4)f2;                                     /* expected-error {{cannot convert from 'float2' to 'float4'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4'}} */
+  f4 += (float4)f2;                                         /* expected-error {{cannot convert from 'float2' to 'float4'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4'}} */
+  f4 = f4 + f4;
+  f4 += f4;
+  f4 = f4 + (float4)f4;
+  f4 += (float4)f4;
+  f4 = f4 + m1x1;
+  f4 += m1x1;
+  f4 = f4 + (float4)m1x1;
+  f4 += (float4)m1x1;
+  f4 = f4 + m2x1;                                           /* expected-error {{cannot convert from 'float2x1' to 'float4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2x1' to 'float4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f4 += m2x1;                                               /* expected-error {{cannot convert from 'float2x1' to 'float4'}} fxc-error {{X3017: cannot implicitly convert from 'const float2x1' to 'float4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f4 = f4 + (float4)m2x1;                                   /* expected-error {{cannot convert from 'float2x1' to 'float4'}} fxc-error {{X3017: cannot convert from 'float2x1' to 'float4'}} */
+  f4 += (float4)m2x1;                                       /* expected-error {{cannot convert from 'float2x1' to 'float4'}} fxc-error {{X3017: cannot convert from 'float2x1' to 'float4'}} */
+  f4 = f4 + m4x1;
+  f4 += m4x1;
+  f4 = f4 + (float4)m4x1;
+  f4 += (float4)m4x1;
+  f4 = f4 + m1x2;                                           /* expected-error {{cannot convert from 'float1x2' to 'float4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f4 += m1x2;                                               /* expected-error {{cannot convert from 'float1x2' to 'float4'}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  f4 = f4 + (float4)m1x2;                                   /* expected-error {{cannot convert from 'float1x2' to 'float4'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4'}} */
+  f4 += (float4)m1x2;                                       /* expected-error {{cannot convert from 'float1x2' to 'float4'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4'}} */
+  f4 = f4 + m2x2;
+  f4 += m2x2;
+  f4 = f4 + (float4)m2x2;
+  f4 += (float4)m2x2;
+  f4 = f4 + m4x2;                                           /* expected-error {{cannot convert from 'float4x2' to 'float4'}} fxc-error {{X3020: type mismatch}} */
+  f4 += m4x2;                                               /* expected-error {{cannot convert from 'float4x2' to 'float4'}} fxc-error {{X3020: type mismatch}} */
+  f4 = f4 + (float4)m4x2;                                   /* expected-error {{cannot convert from 'float4x2' to 'float4'}} fxc-error {{X3017: cannot convert from 'float4x2' to 'float4'}} */
+  f4 += (float4)m4x2;                                       /* expected-error {{cannot convert from 'float4x2' to 'float4'}} fxc-error {{X3017: cannot convert from 'float4x2' to 'float4'}} */
+  f4 = f4 + m1x4;
+  f4 += m1x4;
+  f4 = f4 + (float4)m1x4;
+  f4 += (float4)m1x4;
+  f4 = f4 + m2x4;                                           /* expected-error {{cannot convert from 'float2x4' to 'float4'}} fxc-error {{X3020: type mismatch}} */
+  f4 += m2x4;                                               /* expected-error {{cannot convert from 'float2x4' to 'float4'}} fxc-error {{X3020: type mismatch}} */
+  f4 = f4 + (float4)m2x4;                                   /* expected-error {{cannot convert from 'float2x4' to 'float4'}} fxc-error {{X3017: cannot convert from 'float2x4' to 'float4'}} */
+  f4 += (float4)m2x4;                                       /* expected-error {{cannot convert from 'float2x4' to 'float4'}} fxc-error {{X3017: cannot convert from 'float2x4' to 'float4'}} */
+  f4 = f4 + m4x4;                                           /* expected-error {{cannot convert from 'float4x4' to 'float4'}} fxc-error {{X3020: type mismatch}} */
+  f4 += m4x4;                                               /* expected-error {{cannot convert from 'float4x4' to 'float4'}} fxc-error {{X3020: type mismatch}} */
+  f4 = f4 + (float4)m4x4;                                   /* expected-error {{cannot convert from 'float4x4' to 'float4'}} fxc-error {{X3017: cannot convert from 'float4x4' to 'float4'}} */
+  f4 += (float4)m4x4;                                       /* expected-error {{cannot convert from 'float4x4' to 'float4'}} fxc-error {{X3017: cannot convert from 'float4x4' to 'float4'}} */
+  m1x1 = m1x1 + f;
+  m1x1 += f;
+  m1x1 = m1x1 + (float1x1)f;
+  m1x1 += (float1x1)f;
+  m1x1 = m1x1 + f1;
+  m1x1 += f1;
+  m1x1 = m1x1 + (float1x1)f1;
+  m1x1 += (float1x1)f1;
+  m1x1 = m1x1 + f2;                                         /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 += f2;                                               /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 = m1x1 + (float1x1)f2;
+  m1x1 += (float1x1)f2;
+  m1x1 = m1x1 + f4;                                         /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 += f4;                                               /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 = m1x1 + (float1x1)f4;
+  m1x1 += (float1x1)f4;
+  m1x1 = m1x1 + m1x1;
+  m1x1 += m1x1;
+  m1x1 = m1x1 + (float1x1)m1x1;
+  m1x1 += (float1x1)m1x1;
+  m1x1 = m1x1 + m2x1;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 += m2x1;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 = m1x1 + (float1x1)m2x1;                             /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x1 += (float1x1)m2x1;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x1 = m1x1 + m4x1;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 += m4x1;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 = m1x1 + (float1x1)m4x1;                             /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x1 += (float1x1)m4x1;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x1 = m1x1 + m1x2;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 += m1x2;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 = m1x1 + (float1x1)m1x2;                             /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x1 += (float1x1)m1x2;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x1 = m1x1 + m2x2;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 += m2x2;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 = m1x1 + (float1x1)m2x2;                             /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x1 += (float1x1)m2x2;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x1 = m1x1 + m4x2;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 += m4x2;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 = m1x1 + (float1x1)m4x2;                             /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x1 += (float1x1)m4x2;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x1 = m1x1 + m1x4;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 += m1x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 = m1x1 + (float1x1)m1x4;                             /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x1 += (float1x1)m1x4;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x1 = m1x1 + m2x4;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 += m2x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 = m1x1 + (float1x1)m2x4;                             /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x1 += (float1x1)m2x4;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x1 = m1x1 + m4x4;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 += m4x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x1 = m1x1 + (float1x1)m4x4;                             /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x1 += (float1x1)m4x4;                                   /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m2x1 = m2x1 + f;
+  m2x1 += f;
+  m2x1 = m2x1 + (float2x1)f;
+  m2x1 += (float2x1)f;
+  m2x1 = m2x1 + f1;
+  m2x1 += f1;
+  m2x1 = m2x1 + (float2x1)f1;
+  m2x1 += (float2x1)f1;
+  m2x1 = m2x1 + f2;
+  m2x1 += f2;
+  m2x1 = m2x1 + (float2x1)f2;
+  m2x1 += (float2x1)f2;
+  m2x1 = m2x1 + f4;                                         /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x1 += f4;                                               /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x1 = m2x1 + (float2x1)f4;                               /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m2x1 += (float2x1)f4;                                     /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m2x1 = m2x1 + m1x1;
+  m2x1 += m1x1;
+  m2x1 = m2x1 + (float2x1)m1x1;
+  m2x1 += (float2x1)m1x1;
+  m2x1 = m2x1 + m2x1;
+  m2x1 += m2x1;
+  m2x1 = m2x1 + (float2x1)m2x1;
+  m2x1 += (float2x1)m2x1;
+  m2x1 = m2x1 + m4x1;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x1 += m4x1;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x1 = m2x1 + (float2x1)m4x1;
+  m2x1 += (float2x1)m4x1;
+  m2x1 = m2x1 + m1x2;                                       /* expected-error {{cannot convert from 'float1x2' to 'float2x1'}} fxc-error {{X3020: type mismatch}} */
+  m2x1 += m1x2;                                             /* expected-error {{cannot convert from 'float1x2' to 'float2x1'}} fxc-error {{X3020: type mismatch}} */
+  m2x1 = m2x1 + (float2x1)m1x2;                             /* expected-error {{cannot convert from 'float1x2' to 'float2x1'}} fxc-error {{X3017: cannot convert from 'float2' to 'float2x1'}} */
+  m2x1 += (float2x1)m1x2;                                   /* expected-error {{cannot convert from 'float1x2' to 'float2x1'}} fxc-error {{X3017: cannot convert from 'float2' to 'float2x1'}} */
+  m2x1 = m2x1 + m2x2;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x1 += m2x2;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x1 = m2x1 + (float2x1)m2x2;
+  m2x1 += (float2x1)m2x2;
+  m2x1 = m2x1 + m4x2;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x1 += m4x2;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x1 = m2x1 + (float2x1)m4x2;
+  m2x1 += (float2x1)m4x2;
+  m2x1 = m2x1 + m1x4;                                       /* expected-error {{cannot convert from 'float1x4' to 'float2x1'}} fxc-error {{X3020: type mismatch}} */
+  m2x1 += m1x4;                                             /* expected-error {{cannot convert from 'float1x4' to 'float2x1'}} fxc-error {{X3020: type mismatch}} */
+  m2x1 = m2x1 + (float2x1)m1x4;                             /* expected-error {{cannot convert from 'float1x4' to 'float2x1'}} fxc-error {{X3017: cannot convert from 'float4' to 'float2x1'}} */
+  m2x1 += (float2x1)m1x4;                                   /* expected-error {{cannot convert from 'float1x4' to 'float2x1'}} fxc-error {{X3017: cannot convert from 'float4' to 'float2x1'}} */
+  m2x1 = m2x1 + m2x4;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x1 += m2x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x1 = m2x1 + (float2x1)m2x4;
+  m2x1 += (float2x1)m2x4;
+  m2x1 = m2x1 + m4x4;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x1 += m4x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x1 = m2x1 + (float2x1)m4x4;
+  m2x1 += (float2x1)m4x4;
+  m4x1 = m4x1 + f;
+  m4x1 += f;
+  m4x1 = m4x1 + (float4x1)f;
+  m4x1 += (float4x1)f;
+  m4x1 = m4x1 + f1;
+  m4x1 += f1;
+  m4x1 = m4x1 + (float4x1)f1;
+  m4x1 += (float4x1)f1;
+  m4x1 = m4x1 + f2;                                         /* expected-error {{cannot convert from 'float2' to 'float4x1'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float4x1'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x1 += f2;                                               /* expected-error {{cannot convert from 'float2' to 'float4x1'}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float4x1'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x1 = m4x1 + (float4x1)f2;                               /* expected-error {{cannot convert from 'float2' to 'float4x1'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4x1'}} */
+  m4x1 += (float4x1)f2;                                     /* expected-error {{cannot convert from 'float2' to 'float4x1'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4x1'}} */
+  m4x1 = m4x1 + f4;
+  m4x1 += f4;
+  m4x1 = m4x1 + (float4x1)f4;
+  m4x1 += (float4x1)f4;
+  m4x1 = m4x1 + m1x1;
+  m4x1 += m1x1;
+  m4x1 = m4x1 + (float4x1)m1x1;
+  m4x1 += (float4x1)m1x1;
+  m4x1 = m4x1 + m2x1;                                       /* expected-error {{cannot convert from 'float2x1' to 'float4x1'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2x1' to 'float4x1'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x1 += m2x1;                                             /* expected-error {{cannot convert from 'float2x1' to 'float4x1'}} fxc-error {{X3017: cannot implicitly convert from 'const float2x1' to 'float4x1'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x1 = m4x1 + (float4x1)m2x1;                             /* expected-error {{cannot convert from 'float2x1' to 'float4x1'}} fxc-error {{X3017: cannot convert from 'float2x1' to 'float4x1'}} */
+  m4x1 += (float4x1)m2x1;                                   /* expected-error {{cannot convert from 'float2x1' to 'float4x1'}} fxc-error {{X3017: cannot convert from 'float2x1' to 'float4x1'}} */
+  m4x1 = m4x1 + m4x1;
+  m4x1 += m4x1;
+  m4x1 = m4x1 + (float4x1)m4x1;
+  m4x1 += (float4x1)m4x1;
+  m4x1 = m4x1 + m1x2;                                       /* expected-error {{cannot convert from 'float1x2' to 'float4x1'}} fxc-error {{X3020: type mismatch}} */
+  m4x1 += m1x2;                                             /* expected-error {{cannot convert from 'float1x2' to 'float4x1'}} fxc-error {{X3020: type mismatch}} */
+  m4x1 = m4x1 + (float4x1)m1x2;                             /* expected-error {{cannot convert from 'float1x2' to 'float4x1'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4x1'}} */
+  m4x1 += (float4x1)m1x2;                                   /* expected-error {{cannot convert from 'float1x2' to 'float4x1'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4x1'}} */
+  m4x1 = m4x1 + m2x2;                                       /* expected-error {{cannot convert from 'float2x2' to 'float4x1'}} fxc-error {{X3020: type mismatch}} */
+  m4x1 += m2x2;                                             /* expected-error {{cannot convert from 'float2x2' to 'float4x1'}} fxc-error {{X3020: type mismatch}} */
+  m4x1 = m4x1 + (float4x1)m2x2;                             /* expected-error {{cannot convert from 'float2x2' to 'float4x1'}} fxc-error {{X3017: cannot convert from 'float2x2' to 'float4x1'}} */
+  m4x1 += (float4x1)m2x2;                                   /* expected-error {{cannot convert from 'float2x2' to 'float4x1'}} fxc-error {{X3017: cannot convert from 'float2x2' to 'float4x1'}} */
+  m4x1 = m4x1 + m4x2;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x1 += m4x2;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x1 = m4x1 + (float4x1)m4x2;
+  m4x1 += (float4x1)m4x2;
+  m4x1 = m4x1 + m1x4;                                       /* expected-error {{cannot convert from 'float1x4' to 'float4x1'}} fxc-error {{X3020: type mismatch}} */
+  m4x1 += m1x4;                                             /* expected-error {{cannot convert from 'float1x4' to 'float4x1'}} fxc-error {{X3020: type mismatch}} */
+  m4x1 = m4x1 + (float4x1)m1x4;                             /* expected-error {{cannot convert from 'float1x4' to 'float4x1'}} fxc-error {{X3017: cannot convert from 'float4' to 'float4x1'}} */
+  m4x1 += (float4x1)m1x4;                                   /* expected-error {{cannot convert from 'float1x4' to 'float4x1'}} fxc-error {{X3017: cannot convert from 'float4' to 'float4x1'}} */
+  m4x1 = m4x1 + m2x4;                                       /* expected-error {{cannot convert from 'float2x4' to 'float4x1'}} fxc-error {{X3020: type mismatch}} */
+  m4x1 += m2x4;                                             /* expected-error {{cannot convert from 'float2x4' to 'float4x1'}} fxc-error {{X3020: type mismatch}} */
+  m4x1 = m4x1 + (float4x1)m2x4;                             /* expected-error {{cannot convert from 'float2x4' to 'float4x1'}} fxc-error {{X3017: cannot convert from 'float2x4' to 'float4x1'}} */
+  m4x1 += (float4x1)m2x4;                                   /* expected-error {{cannot convert from 'float2x4' to 'float4x1'}} fxc-error {{X3017: cannot convert from 'float2x4' to 'float4x1'}} */
+  m4x1 = m4x1 + m4x4;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x1 += m4x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x1 = m4x1 + (float4x1)m4x4;
+  m4x1 += (float4x1)m4x4;
+  m1x2 = m1x2 + f;
+  m1x2 += f;
+  m1x2 = m1x2 + (float1x2)f;
+  m1x2 += (float1x2)f;
+  m1x2 = m1x2 + f1;
+  m1x2 += f1;
+  m1x2 = m1x2 + (float1x2)f1;
+  m1x2 += (float1x2)f1;
+  m1x2 = m1x2 + f2;
+  m1x2 += f2;
+  m1x2 = m1x2 + (float1x2)f2;
+  m1x2 += (float1x2)f2;
+  m1x2 = m1x2 + f4;                                         /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x2 += f4;                                               /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x2 = m1x2 + (float1x2)f4;                               /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x2 += (float1x2)f4;                                     /* expected-error {{cannot truncate lvalue vector/matrix}} fxc-pass {{}} */
+  m1x2 = m1x2 + m1x1;
+  m1x2 += m1x1;
+  m1x2 = m1x2 + (float1x2)m1x1;
+  m1x2 += (float1x2)m1x1;
+  m1x2 = m1x2 + m2x1;                                       /* expected-error {{cannot convert from 'float2x1' to 'float1x2'}} fxc-error {{X3020: type mismatch}} */
+  m1x2 += m2x1;                                             /* expected-error {{cannot convert from 'float2x1' to 'float1x2'}} fxc-error {{X3020: type mismatch}} */
+  m1x2 = m1x2 + (float1x2)m2x1;                             /* expected-error {{cannot convert from 'float2x1' to 'float1x2'}} fxc-error {{X3017: cannot convert from 'float2x1' to 'float2'}} */
+  m1x2 += (float1x2)m2x1;                                   /* expected-error {{cannot convert from 'float2x1' to 'float1x2'}} fxc-error {{X3017: cannot convert from 'float2x1' to 'float2'}} */
+  m1x2 = m1x2 + m4x1;                                       /* expected-error {{cannot convert from 'float4x1' to 'float1x2'}} fxc-error {{X3020: type mismatch}} */
+  m1x2 += m4x1;                                             /* expected-error {{cannot convert from 'float4x1' to 'float1x2'}} fxc-error {{X3020: type mismatch}} */
+  m1x2 = m1x2 + (float1x2)m4x1;                             /* expected-error {{cannot convert from 'float4x1' to 'float1x2'}} fxc-error {{X3017: cannot convert from 'float4x1' to 'float2'}} */
+  m1x2 += (float1x2)m4x1;                                   /* expected-error {{cannot convert from 'float4x1' to 'float1x2'}} fxc-error {{X3017: cannot convert from 'float4x1' to 'float2'}} */
+  m1x2 = m1x2 + m1x2;
+  m1x2 += m1x2;
+  m1x2 = m1x2 + (float1x2)m1x2;
+  m1x2 += (float1x2)m1x2;
+  m1x2 = m1x2 + m2x2;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x2 += m2x2;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x2 = m1x2 + (float1x2)m2x2;
+  m1x2 += (float1x2)m2x2;
+  m1x2 = m1x2 + m4x2;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x2 += m4x2;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x2 = m1x2 + (float1x2)m4x2;
+  m1x2 += (float1x2)m4x2;
+  m1x2 = m1x2 + m1x4;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x2 += m1x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x2 = m1x2 + (float1x2)m1x4;
+  m1x2 += (float1x2)m1x4;
+  m1x2 = m1x2 + m2x4;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x2 += m2x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x2 = m1x2 + (float1x2)m2x4;
+  m1x2 += (float1x2)m2x4;
+  m1x2 = m1x2 + m4x4;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x2 += m4x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x2 = m1x2 + (float1x2)m4x4;
+  m1x2 += (float1x2)m4x4;
+  m2x2 = m2x2 + f;
+  m2x2 += f;
+  m2x2 = m2x2 + (float2x2)f;
+  m2x2 += (float2x2)f;
+  m2x2 = m2x2 + f1;
+  m2x2 += f1;
+  m2x2 = m2x2 + (float2x2)f1;
+  m2x2 += (float2x2)f1;
+  m2x2 = m2x2 + f2;                                         /* expected-error {{cannot convert from 'float2' to 'float2x2'}} fxc-error {{X3020: type mismatch}} */
+  m2x2 += f2;                                               /* expected-error {{cannot convert from 'float2' to 'float2x2'}} fxc-error {{X3020: type mismatch}} */
+  m2x2 = m2x2 + (float2x2)f2;                               /* expected-error {{cannot convert from 'float2' to 'float2x2'}} fxc-error {{X3017: cannot convert from 'float2' to 'float2x2'}} */
+  m2x2 += (float2x2)f2;                                     /* expected-error {{cannot convert from 'float2' to 'float2x2'}} fxc-error {{X3017: cannot convert from 'float2' to 'float2x2'}} */
+  m2x2 = m2x2 + f4;
+  m2x2 += f4;
+  m2x2 = m2x2 + (float2x2)f4;
+  m2x2 += (float2x2)f4;
+  m2x2 = m2x2 + m1x1;
+  m2x2 += m1x1;
+  m2x2 = m2x2 + (float2x2)m1x1;
+  m2x2 += (float2x2)m1x1;
+  m2x2 = m2x2 + m2x1;                                       /* expected-error {{cannot convert from 'float2x1' to 'float2x2'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2x1' to 'float2x2'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x2 += m2x1;                                             /* expected-error {{cannot convert from 'float2x1' to 'float2x2'}} fxc-error {{X3017: cannot implicitly convert from 'const float2x1' to 'float2x2'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x2 = m2x2 + (float2x2)m2x1;                             /* expected-error {{cannot convert from 'float2x1' to 'float2x2'}} fxc-error {{X3017: cannot convert from 'float2x1' to 'float2x2'}} */
+  m2x2 += (float2x2)m2x1;                                   /* expected-error {{cannot convert from 'float2x1' to 'float2x2'}} fxc-error {{X3017: cannot convert from 'float2x1' to 'float2x2'}} */
+  m2x2 = m2x2 + m4x1;                                       /* expected-error {{cannot convert from 'float4x1' to 'float2x2'}} fxc-error {{X3020: type mismatch}} */
+  m2x2 += m4x1;                                             /* expected-error {{cannot convert from 'float4x1' to 'float2x2'}} fxc-error {{X3020: type mismatch}} */
+  m2x2 = m2x2 + (float2x2)m4x1;                             /* expected-error {{cannot convert from 'float4x1' to 'float2x2'}} fxc-error {{X3017: cannot convert from 'float4x1' to 'float2x2'}} */
+  m2x2 += (float2x2)m4x1;                                   /* expected-error {{cannot convert from 'float4x1' to 'float2x2'}} fxc-error {{X3017: cannot convert from 'float4x1' to 'float2x2'}} */
+  m2x2 = m2x2 + m1x2;                                       /* expected-error {{cannot convert from 'float1x2' to 'float2x2'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float2x2'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x2 += m1x2;                                             /* expected-error {{cannot convert from 'float1x2' to 'float2x2'}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float2x2'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x2 = m2x2 + (float2x2)m1x2;                             /* expected-error {{cannot convert from 'float1x2' to 'float2x2'}} fxc-error {{X3017: cannot convert from 'float2' to 'float2x2'}} */
+  m2x2 += (float2x2)m1x2;                                   /* expected-error {{cannot convert from 'float1x2' to 'float2x2'}} fxc-error {{X3017: cannot convert from 'float2' to 'float2x2'}} */
+  m2x2 = m2x2 + m2x2;
+  m2x2 += m2x2;
+  m2x2 = m2x2 + (float2x2)m2x2;
+  m2x2 += (float2x2)m2x2;
+  m2x2 = m2x2 + m4x2;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x2 += m4x2;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x2 = m2x2 + (float2x2)m4x2;
+  m2x2 += (float2x2)m4x2;
+  m2x2 = m2x2 + m1x4;                                       /* expected-error {{cannot convert from 'float1x4' to 'float2x2'}} fxc-error {{X3020: type mismatch}} */
+  m2x2 += m1x4;                                             /* expected-error {{cannot convert from 'float1x4' to 'float2x2'}} fxc-error {{X3020: type mismatch}} */
+  m2x2 = m2x2 + (float2x2)m1x4;                             /* expected-error {{cannot convert from 'float1x4' to 'float2x2'}} fxc-error {{X3017: cannot convert from 'float4' to 'float2x2'}} */
+  m2x2 += (float2x2)m1x4;                                   /* expected-error {{cannot convert from 'float1x4' to 'float2x2'}} fxc-error {{X3017: cannot convert from 'float4' to 'float2x2'}} */
+  m2x2 = m2x2 + m2x4;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x2 += m2x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x2 = m2x2 + (float2x2)m2x4;
+  m2x2 += (float2x2)m2x4;
+  m2x2 = m2x2 + m4x4;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x2 += m4x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x2 = m2x2 + (float2x2)m4x4;
+  m2x2 += (float2x2)m4x4;
+  m4x2 = m4x2 + f;
+  m4x2 += f;
+  m4x2 = m4x2 + (float4x2)f;
+  m4x2 += (float4x2)f;
+  m4x2 = m4x2 + f1;
+  m4x2 += f1;
+  m4x2 = m4x2 + (float4x2)f1;
+  m4x2 += (float4x2)f1;
+  m4x2 = m4x2 + f2;                                         /* expected-error {{cannot convert from 'float2' to 'float4x2'}} fxc-error {{X3020: type mismatch}} */
+  m4x2 += f2;                                               /* expected-error {{cannot convert from 'float2' to 'float4x2'}} fxc-error {{X3020: type mismatch}} */
+  m4x2 = m4x2 + (float4x2)f2;                               /* expected-error {{cannot convert from 'float2' to 'float4x2'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4x2'}} */
+  m4x2 += (float4x2)f2;                                     /* expected-error {{cannot convert from 'float2' to 'float4x2'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4x2'}} */
+  m4x2 = m4x2 + f4;                                         /* expected-error {{cannot convert from 'float4' to 'float4x2'}} fxc-error {{X3020: type mismatch}} */
+  m4x2 += f4;                                               /* expected-error {{cannot convert from 'float4' to 'float4x2'}} fxc-error {{X3020: type mismatch}} */
+  m4x2 = m4x2 + (float4x2)f4;                               /* expected-error {{cannot convert from 'float4' to 'float4x2'}} fxc-error {{X3017: cannot convert from 'float4' to 'float4x2'}} */
+  m4x2 += (float4x2)f4;                                     /* expected-error {{cannot convert from 'float4' to 'float4x2'}} fxc-error {{X3017: cannot convert from 'float4' to 'float4x2'}} */
+  m4x2 = m4x2 + m1x1;
+  m4x2 += m1x1;
+  m4x2 = m4x2 + (float4x2)m1x1;
+  m4x2 += (float4x2)m1x1;
+  m4x2 = m4x2 + m2x1;                                       /* expected-error {{cannot convert from 'float2x1' to 'float4x2'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2x1' to 'float4x2'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x2 += m2x1;                                             /* expected-error {{cannot convert from 'float2x1' to 'float4x2'}} fxc-error {{X3017: cannot implicitly convert from 'const float2x1' to 'float4x2'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x2 = m4x2 + (float4x2)m2x1;                             /* expected-error {{cannot convert from 'float2x1' to 'float4x2'}} fxc-error {{X3017: cannot convert from 'float2x1' to 'float4x2'}} */
+  m4x2 += (float4x2)m2x1;                                   /* expected-error {{cannot convert from 'float2x1' to 'float4x2'}} fxc-error {{X3017: cannot convert from 'float2x1' to 'float4x2'}} */
+  m4x2 = m4x2 + m4x1;                                       /* expected-error {{cannot convert from 'float4x1' to 'float4x2'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float4x1' to 'float4x2'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x2 += m4x1;                                             /* expected-error {{cannot convert from 'float4x1' to 'float4x2'}} fxc-error {{X3017: cannot implicitly convert from 'const float4x1' to 'float4x2'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x2 = m4x2 + (float4x2)m4x1;                             /* expected-error {{cannot convert from 'float4x1' to 'float4x2'}} fxc-error {{X3017: cannot convert from 'float4x1' to 'float4x2'}} */
+  m4x2 += (float4x2)m4x1;                                   /* expected-error {{cannot convert from 'float4x1' to 'float4x2'}} fxc-error {{X3017: cannot convert from 'float4x1' to 'float4x2'}} */
+  m4x2 = m4x2 + m1x2;                                       /* expected-error {{cannot convert from 'float1x2' to 'float4x2'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float4x2'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x2 += m1x2;                                             /* expected-error {{cannot convert from 'float1x2' to 'float4x2'}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float4x2'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x2 = m4x2 + (float4x2)m1x2;                             /* expected-error {{cannot convert from 'float1x2' to 'float4x2'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4x2'}} */
+  m4x2 += (float4x2)m1x2;                                   /* expected-error {{cannot convert from 'float1x2' to 'float4x2'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4x2'}} */
+  m4x2 = m4x2 + m2x2;                                       /* expected-error {{cannot convert from 'float2x2' to 'float4x2'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2x2' to 'float4x2'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x2 += m2x2;                                             /* expected-error {{cannot convert from 'float2x2' to 'float4x2'}} fxc-error {{X3017: cannot implicitly convert from 'const float2x2' to 'float4x2'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x2 = m4x2 + (float4x2)m2x2;                             /* expected-error {{cannot convert from 'float2x2' to 'float4x2'}} fxc-error {{X3017: cannot convert from 'float2x2' to 'float4x2'}} */
+  m4x2 += (float4x2)m2x2;                                   /* expected-error {{cannot convert from 'float2x2' to 'float4x2'}} fxc-error {{X3017: cannot convert from 'float2x2' to 'float4x2'}} */
+  m4x2 = m4x2 + m4x2;
+  m4x2 += m4x2;
+  m4x2 = m4x2 + (float4x2)m4x2;
+  m4x2 += (float4x2)m4x2;
+  m4x2 = m4x2 + m1x4;                                       /* expected-error {{cannot convert from 'float1x4' to 'float4x2'}} fxc-error {{X3020: type mismatch}} */
+  m4x2 += m1x4;                                             /* expected-error {{cannot convert from 'float1x4' to 'float4x2'}} fxc-error {{X3020: type mismatch}} */
+  m4x2 = m4x2 + (float4x2)m1x4;                             /* expected-error {{cannot convert from 'float1x4' to 'float4x2'}} fxc-error {{X3017: cannot convert from 'float4' to 'float4x2'}} */
+  m4x2 += (float4x2)m1x4;                                   /* expected-error {{cannot convert from 'float1x4' to 'float4x2'}} fxc-error {{X3017: cannot convert from 'float4' to 'float4x2'}} */
+  m4x2 = m4x2 + m2x4;                                       /* expected-error {{cannot convert from 'float2x4' to 'float4x2'}} fxc-error {{X3020: type mismatch}} */
+  m4x2 += m2x4;                                             /* expected-error {{cannot convert from 'float2x4' to 'float4x2'}} fxc-error {{X3020: type mismatch}} */
+  m4x2 = m4x2 + (float4x2)m2x4;                             /* expected-error {{cannot convert from 'float2x4' to 'float4x2'}} fxc-error {{X3017: cannot convert from 'float2x4' to 'float4x2'}} */
+  m4x2 += (float4x2)m2x4;                                   /* expected-error {{cannot convert from 'float2x4' to 'float4x2'}} fxc-error {{X3017: cannot convert from 'float2x4' to 'float4x2'}} */
+  m4x2 = m4x2 + m4x4;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x2 += m4x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x2 = m4x2 + (float4x2)m4x4;
+  m4x2 += (float4x2)m4x4;
+  m1x4 = m1x4 + f;
+  m1x4 += f;
+  m1x4 = m1x4 + (float1x4)f;
+  m1x4 += (float1x4)f;
+  m1x4 = m1x4 + f1;
+  m1x4 += f1;
+  m1x4 = m1x4 + (float1x4)f1;
+  m1x4 += (float1x4)f1;
+  m1x4 = m1x4 + f2;                                         /* expected-error {{cannot convert from 'float2' to 'float1x4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x4 += f2;                                               /* expected-error {{cannot convert from 'float2' to 'float1x4'}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x4 = m1x4 + (float1x4)f2;                               /* expected-error {{cannot convert from 'float2' to 'float1x4'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4'}} */
+  m1x4 += (float1x4)f2;                                     /* expected-error {{cannot convert from 'float2' to 'float1x4'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4'}} */
+  m1x4 = m1x4 + f4;
+  m1x4 += f4;
+  m1x4 = m1x4 + (float1x4)f4;
+  m1x4 += (float1x4)f4;
+  m1x4 = m1x4 + m1x1;
+  m1x4 += m1x1;
+  m1x4 = m1x4 + (float1x4)m1x1;
+  m1x4 += (float1x4)m1x1;
+  m1x4 = m1x4 + m2x1;                                       /* expected-error {{cannot convert from 'float2x1' to 'float1x4'}} fxc-error {{X3020: type mismatch}} */
+  m1x4 += m2x1;                                             /* expected-error {{cannot convert from 'float2x1' to 'float1x4'}} fxc-error {{X3020: type mismatch}} */
+  m1x4 = m1x4 + (float1x4)m2x1;                             /* expected-error {{cannot convert from 'float2x1' to 'float1x4'}} fxc-error {{X3017: cannot convert from 'float2x1' to 'float4'}} */
+  m1x4 += (float1x4)m2x1;                                   /* expected-error {{cannot convert from 'float2x1' to 'float1x4'}} fxc-error {{X3017: cannot convert from 'float2x1' to 'float4'}} */
+  m1x4 = m1x4 + m4x1;                                       /* expected-error {{cannot convert from 'float4x1' to 'float1x4'}} fxc-error {{X3020: type mismatch}} */
+  m1x4 += m4x1;                                             /* expected-error {{cannot convert from 'float4x1' to 'float1x4'}} fxc-error {{X3020: type mismatch}} */
+  m1x4 = m1x4 + (float1x4)m4x1;                             /* expected-error {{cannot convert from 'float4x1' to 'float1x4'}} fxc-error {{X3017: cannot convert from 'float4x1' to 'float4'}} */
+  m1x4 += (float1x4)m4x1;                                   /* expected-error {{cannot convert from 'float4x1' to 'float1x4'}} fxc-error {{X3017: cannot convert from 'float4x1' to 'float4'}} */
+  m1x4 = m1x4 + m1x2;                                       /* expected-error {{cannot convert from 'float1x2' to 'float1x4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x4 += m1x2;                                             /* expected-error {{cannot convert from 'float1x2' to 'float1x4'}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x4 = m1x4 + (float1x4)m1x2;                             /* expected-error {{cannot convert from 'float1x2' to 'float1x4'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4'}} */
+  m1x4 += (float1x4)m1x2;                                   /* expected-error {{cannot convert from 'float1x2' to 'float1x4'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4'}} */
+  m1x4 = m1x4 + m2x2;                                       /* expected-error {{cannot convert from 'float2x2' to 'float1x4'}} fxc-error {{X3020: type mismatch}} */
+  m1x4 += m2x2;                                             /* expected-error {{cannot convert from 'float2x2' to 'float1x4'}} fxc-error {{X3020: type mismatch}} */
+  m1x4 = m1x4 + (float1x4)m2x2;                             /* expected-error {{cannot convert from 'float2x2' to 'float1x4'}} fxc-error {{X3017: cannot convert from 'float2x2' to 'float4'}} */
+  m1x4 += (float1x4)m2x2;                                   /* expected-error {{cannot convert from 'float2x2' to 'float1x4'}} fxc-error {{X3017: cannot convert from 'float2x2' to 'float4'}} */
+  m1x4 = m1x4 + m4x2;                                       /* expected-error {{cannot convert from 'float4x2' to 'float1x4'}} fxc-error {{X3020: type mismatch}} */
+  m1x4 += m4x2;                                             /* expected-error {{cannot convert from 'float4x2' to 'float1x4'}} fxc-error {{X3020: type mismatch}} */
+  m1x4 = m1x4 + (float1x4)m4x2;                             /* expected-error {{cannot convert from 'float4x2' to 'float1x4'}} fxc-error {{X3017: cannot convert from 'float4x2' to 'float4'}} */
+  m1x4 += (float1x4)m4x2;                                   /* expected-error {{cannot convert from 'float4x2' to 'float1x4'}} fxc-error {{X3017: cannot convert from 'float4x2' to 'float4'}} */
+  m1x4 = m1x4 + m1x4;
+  m1x4 += m1x4;
+  m1x4 = m1x4 + (float1x4)m1x4;
+  m1x4 += (float1x4)m1x4;
+  m1x4 = m1x4 + m2x4;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x4 += m2x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x4 = m1x4 + (float1x4)m2x4;
+  m1x4 += (float1x4)m2x4;
+  m1x4 = m1x4 + m4x4;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x4 += m4x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m1x4 = m1x4 + (float1x4)m4x4;
+  m1x4 += (float1x4)m4x4;
+  m2x4 = m2x4 + f;
+  m2x4 += f;
+  m2x4 = m2x4 + (float2x4)f;
+  m2x4 += (float2x4)f;
+  m2x4 = m2x4 + f1;
+  m2x4 += f1;
+  m2x4 = m2x4 + (float2x4)f1;
+  m2x4 += (float2x4)f1;
+  m2x4 = m2x4 + f2;                                         /* expected-error {{cannot convert from 'float2' to 'float2x4'}} fxc-error {{X3020: type mismatch}} */
+  m2x4 += f2;                                               /* expected-error {{cannot convert from 'float2' to 'float2x4'}} fxc-error {{X3020: type mismatch}} */
+  m2x4 = m2x4 + (float2x4)f2;                               /* expected-error {{cannot convert from 'float2' to 'float2x4'}} fxc-error {{X3017: cannot convert from 'float2' to 'float2x4'}} */
+  m2x4 += (float2x4)f2;                                     /* expected-error {{cannot convert from 'float2' to 'float2x4'}} fxc-error {{X3017: cannot convert from 'float2' to 'float2x4'}} */
+  m2x4 = m2x4 + f4;                                         /* expected-error {{cannot convert from 'float4' to 'float2x4'}} fxc-error {{X3020: type mismatch}} */
+  m2x4 += f4;                                               /* expected-error {{cannot convert from 'float4' to 'float2x4'}} fxc-error {{X3020: type mismatch}} */
+  m2x4 = m2x4 + (float2x4)f4;                               /* expected-error {{cannot convert from 'float4' to 'float2x4'}} fxc-error {{X3017: cannot convert from 'float4' to 'float2x4'}} */
+  m2x4 += (float2x4)f4;                                     /* expected-error {{cannot convert from 'float4' to 'float2x4'}} fxc-error {{X3017: cannot convert from 'float4' to 'float2x4'}} */
+  m2x4 = m2x4 + m1x1;
+  m2x4 += m1x1;
+  m2x4 = m2x4 + (float2x4)m1x1;
+  m2x4 += (float2x4)m1x1;
+  m2x4 = m2x4 + m2x1;                                       /* expected-error {{cannot convert from 'float2x1' to 'float2x4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2x1' to 'float2x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x4 += m2x1;                                             /* expected-error {{cannot convert from 'float2x1' to 'float2x4'}} fxc-error {{X3017: cannot implicitly convert from 'const float2x1' to 'float2x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x4 = m2x4 + (float2x4)m2x1;                             /* expected-error {{cannot convert from 'float2x1' to 'float2x4'}} fxc-error {{X3017: cannot convert from 'float2x1' to 'float2x4'}} */
+  m2x4 += (float2x4)m2x1;                                   /* expected-error {{cannot convert from 'float2x1' to 'float2x4'}} fxc-error {{X3017: cannot convert from 'float2x1' to 'float2x4'}} */
+  m2x4 = m2x4 + m4x1;                                       /* expected-error {{cannot convert from 'float4x1' to 'float2x4'}} fxc-error {{X3020: type mismatch}} */
+  m2x4 += m4x1;                                             /* expected-error {{cannot convert from 'float4x1' to 'float2x4'}} fxc-error {{X3020: type mismatch}} */
+  m2x4 = m2x4 + (float2x4)m4x1;                             /* expected-error {{cannot convert from 'float4x1' to 'float2x4'}} fxc-error {{X3017: cannot convert from 'float4x1' to 'float2x4'}} */
+  m2x4 += (float2x4)m4x1;                                   /* expected-error {{cannot convert from 'float4x1' to 'float2x4'}} fxc-error {{X3017: cannot convert from 'float4x1' to 'float2x4'}} */
+  m2x4 = m2x4 + m1x2;                                       /* expected-error {{cannot convert from 'float1x2' to 'float2x4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float2x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x4 += m1x2;                                             /* expected-error {{cannot convert from 'float1x2' to 'float2x4'}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float2x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x4 = m2x4 + (float2x4)m1x2;                             /* expected-error {{cannot convert from 'float1x2' to 'float2x4'}} fxc-error {{X3017: cannot convert from 'float2' to 'float2x4'}} */
+  m2x4 += (float2x4)m1x2;                                   /* expected-error {{cannot convert from 'float1x2' to 'float2x4'}} fxc-error {{X3017: cannot convert from 'float2' to 'float2x4'}} */
+  m2x4 = m2x4 + m2x2;                                       /* expected-error {{cannot convert from 'float2x2' to 'float2x4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2x2' to 'float2x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x4 += m2x2;                                             /* expected-error {{cannot convert from 'float2x2' to 'float2x4'}} fxc-error {{X3017: cannot implicitly convert from 'const float2x2' to 'float2x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x4 = m2x4 + (float2x4)m2x2;                             /* expected-error {{cannot convert from 'float2x2' to 'float2x4'}} fxc-error {{X3017: cannot convert from 'float2x2' to 'float2x4'}} */
+  m2x4 += (float2x4)m2x2;                                   /* expected-error {{cannot convert from 'float2x2' to 'float2x4'}} fxc-error {{X3017: cannot convert from 'float2x2' to 'float2x4'}} */
+  m2x4 = m2x4 + m4x2;                                       /* expected-error {{cannot convert from 'float4x2' to 'float2x4'}} fxc-error {{X3020: type mismatch}} */
+  m2x4 += m4x2;                                             /* expected-error {{cannot convert from 'float4x2' to 'float2x4'}} fxc-error {{X3020: type mismatch}} */
+  m2x4 = m2x4 + (float2x4)m4x2;                             /* expected-error {{cannot convert from 'float4x2' to 'float2x4'}} fxc-error {{X3017: cannot convert from 'float4x2' to 'float2x4'}} */
+  m2x4 += (float2x4)m4x2;                                   /* expected-error {{cannot convert from 'float4x2' to 'float2x4'}} fxc-error {{X3017: cannot convert from 'float4x2' to 'float2x4'}} */
+  m2x4 = m2x4 + m1x4;                                       /* expected-error {{cannot convert from 'float1x4' to 'float2x4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float4' to 'float2x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x4 += m1x4;                                             /* expected-error {{cannot convert from 'float1x4' to 'float2x4'}} fxc-error {{X3017: cannot implicitly convert from 'const float4' to 'float2x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x4 = m2x4 + (float2x4)m1x4;                             /* expected-error {{cannot convert from 'float1x4' to 'float2x4'}} fxc-error {{X3017: cannot convert from 'float4' to 'float2x4'}} */
+  m2x4 += (float2x4)m1x4;                                   /* expected-error {{cannot convert from 'float1x4' to 'float2x4'}} fxc-error {{X3017: cannot convert from 'float4' to 'float2x4'}} */
+  m2x4 = m2x4 + m2x4;
+  m2x4 += m2x4;
+  m2x4 = m2x4 + (float2x4)m2x4;
+  m2x4 += (float2x4)m2x4;
+  m2x4 = m2x4 + m4x4;                                       /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x4 += m4x4;                                             /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m2x4 = m2x4 + (float2x4)m4x4;
+  m2x4 += (float2x4)m4x4;
+  m4x4 = m4x4 + f;
+  m4x4 += f;
+  m4x4 = m4x4 + (float4x4)f;
+  m4x4 += (float4x4)f;
+  m4x4 = m4x4 + f1;
+  m4x4 += f1;
+  m4x4 = m4x4 + (float4x4)f1;
+  m4x4 += (float4x4)f1;
+  m4x4 = m4x4 + f2;                                         /* expected-error {{cannot convert from 'float2' to 'float4x4'}} fxc-error {{X3020: type mismatch}} */
+  m4x4 += f2;                                               /* expected-error {{cannot convert from 'float2' to 'float4x4'}} fxc-error {{X3020: type mismatch}} */
+  m4x4 = m4x4 + (float4x4)f2;                               /* expected-error {{cannot convert from 'float2' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4x4'}} */
+  m4x4 += (float4x4)f2;                                     /* expected-error {{cannot convert from 'float2' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4x4'}} */
+  m4x4 = m4x4 + f4;                                         /* expected-error {{cannot convert from 'float4' to 'float4x4'}} fxc-error {{X3020: type mismatch}} */
+  m4x4 += f4;                                               /* expected-error {{cannot convert from 'float4' to 'float4x4'}} fxc-error {{X3020: type mismatch}} */
+  m4x4 = m4x4 + (float4x4)f4;                               /* expected-error {{cannot convert from 'float4' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float4' to 'float4x4'}} */
+  m4x4 += (float4x4)f4;                                     /* expected-error {{cannot convert from 'float4' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float4' to 'float4x4'}} */
+  m4x4 = m4x4 + m1x1;
+  m4x4 += m1x1;
+  m4x4 = m4x4 + (float4x4)m1x1;
+  m4x4 += (float4x4)m1x1;
+  m4x4 = m4x4 + m2x1;                                       /* expected-error {{cannot convert from 'float2x1' to 'float4x4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2x1' to 'float4x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x4 += m2x1;                                             /* expected-error {{cannot convert from 'float2x1' to 'float4x4'}} fxc-error {{X3017: cannot implicitly convert from 'const float2x1' to 'float4x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x4 = m4x4 + (float4x4)m2x1;                             /* expected-error {{cannot convert from 'float2x1' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float2x1' to 'float4x4'}} */
+  m4x4 += (float4x4)m2x1;                                   /* expected-error {{cannot convert from 'float2x1' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float2x1' to 'float4x4'}} */
+  m4x4 = m4x4 + m4x1;                                       /* expected-error {{cannot convert from 'float4x1' to 'float4x4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float4x1' to 'float4x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x4 += m4x1;                                             /* expected-error {{cannot convert from 'float4x1' to 'float4x4'}} fxc-error {{X3017: cannot implicitly convert from 'const float4x1' to 'float4x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x4 = m4x4 + (float4x4)m4x1;                             /* expected-error {{cannot convert from 'float4x1' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float4x1' to 'float4x4'}} */
+  m4x4 += (float4x4)m4x1;                                   /* expected-error {{cannot convert from 'float4x1' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float4x1' to 'float4x4'}} */
+  m4x4 = m4x4 + m1x2;                                       /* expected-error {{cannot convert from 'float1x2' to 'float4x4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float4x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x4 += m1x2;                                             /* expected-error {{cannot convert from 'float1x2' to 'float4x4'}} fxc-error {{X3017: cannot implicitly convert from 'const float2' to 'float4x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x4 = m4x4 + (float4x4)m1x2;                             /* expected-error {{cannot convert from 'float1x2' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4x4'}} */
+  m4x4 += (float4x4)m1x2;                                   /* expected-error {{cannot convert from 'float1x2' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float2' to 'float4x4'}} */
+  m4x4 = m4x4 + m2x2;                                       /* expected-error {{cannot convert from 'float2x2' to 'float4x4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2x2' to 'float4x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x4 += m2x2;                                             /* expected-error {{cannot convert from 'float2x2' to 'float4x4'}} fxc-error {{X3017: cannot implicitly convert from 'const float2x2' to 'float4x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x4 = m4x4 + (float4x4)m2x2;                             /* expected-error {{cannot convert from 'float2x2' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float2x2' to 'float4x4'}} */
+  m4x4 += (float4x4)m2x2;                                   /* expected-error {{cannot convert from 'float2x2' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float2x2' to 'float4x4'}} */
+  m4x4 = m4x4 + m4x2;                                       /* expected-error {{cannot convert from 'float4x2' to 'float4x4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float4x2' to 'float4x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x4 += m4x2;                                             /* expected-error {{cannot convert from 'float4x2' to 'float4x4'}} fxc-error {{X3017: cannot implicitly convert from 'const float4x2' to 'float4x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x4 = m4x4 + (float4x4)m4x2;                             /* expected-error {{cannot convert from 'float4x2' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float4x2' to 'float4x4'}} */
+  m4x4 += (float4x4)m4x2;                                   /* expected-error {{cannot convert from 'float4x2' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float4x2' to 'float4x4'}} */
+  m4x4 = m4x4 + m1x4;                                       /* expected-error {{cannot convert from 'float1x4' to 'float4x4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float4' to 'float4x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x4 += m1x4;                                             /* expected-error {{cannot convert from 'float1x4' to 'float4x4'}} fxc-error {{X3017: cannot implicitly convert from 'const float4' to 'float4x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x4 = m4x4 + (float4x4)m1x4;                             /* expected-error {{cannot convert from 'float1x4' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float4' to 'float4x4'}} */
+  m4x4 += (float4x4)m1x4;                                   /* expected-error {{cannot convert from 'float1x4' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float4' to 'float4x4'}} */
+  m4x4 = m4x4 + m2x4;                                       /* expected-error {{cannot convert from 'float2x4' to 'float4x4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float2x4' to 'float4x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x4 += m2x4;                                             /* expected-error {{cannot convert from 'float2x4' to 'float4x4'}} fxc-error {{X3017: cannot implicitly convert from 'const float2x4' to 'float4x4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  m4x4 = m4x4 + (float4x4)m2x4;                             /* expected-error {{cannot convert from 'float2x4' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float2x4' to 'float4x4'}} */
+  m4x4 += (float4x4)m2x4;                                   /* expected-error {{cannot convert from 'float2x4' to 'float4x4'}} fxc-error {{X3017: cannot convert from 'float2x4' to 'float4x4'}} */
+  m4x4 = m4x4 + m4x4;
+  m4x4 += m4x4;
+  m4x4 = m4x4 + (float4x4)m4x4;
+  m4x4 += (float4x4)m4x4;
+  // GENERATED_CODE:END
+
+  return 0;
+}

+ 3 - 3
tools/clang/test/HLSL/const-assign.hlsl

@@ -2,8 +2,8 @@
 
 float4 main() : SV_TARGET
 {
-    const float c = 2.0; // expected-note {{variable 'c' declared const here}} expected-note {{variable 'c' declared const here}}
-    c = c + 3.0; // expected-error {{cannot assign to variable 'c' with const-qualified type 'const float'}}
-    c += 3.0; // expected-error {{cannot assign to variable 'c' with const-qualified type 'const float'}}
+    const float c = 2.0; // expected-note {{variable 'c' declared const here}} expected-note {{variable 'c' declared const here}} fxc-pass {{}}
+    c = c + 3.0; // expected-error {{cannot assign to variable 'c' with const-qualified type 'const float'}} fxc-error {{X3025: l-value specifies const object}}
+    c += 3.0; // expected-error {{cannot assign to variable 'c' with const-qualified type 'const float'}} fxc-pass {{}}
     return (float4)c;
 }

+ 25 - 25
tools/clang/test/HLSL/const-default.hlsl

@@ -1,19 +1,19 @@
 // RUN: %clang_cc1 -fsyntax-only -Wno-unused-value  -ffreestanding -verify %s
 
-float g_float1;                                             /* expected-note {{variable 'g_float1' declared const here}} expected-note {{variable 'g_float1' declared const here}} */
-int4 g_vec1;                                                /* expected-note {{variable 'g_vec1' declared const here}} expected-note {{variable 'g_vec1' declared const here}} */
-uint64_t3x4 g_mat1;
+float g_float1;                                             /* expected-note {{variable 'g_float1' declared const here}} expected-note {{variable 'g_float1' declared const here}} fxc-pass {{}} */
+int4 g_vec1;                                                /* expected-note {{variable 'g_vec1' declared const here}} expected-note {{variable 'g_vec1' declared const here}} fxc-pass {{}} */
+uint64_t3x4 g_mat1;                                         /* fxc-error {{X3000: unrecognized identifier 'uint64_t3x4'}} */
 
 cbuffer g_cbuffer {
-    min12int m_buffer_min12int;                             /* expected-note {{variable 'm_buffer_min12int' declared const here}} expected-warning {{min12int is promoted to min16int}} */
-    float4 m_buffer_float4;                                 /* expected-note {{variable 'm_buffer_float4' declared const here}} */
+    min12int m_buffer_min12int;                             /* expected-note {{variable 'm_buffer_min12int' declared const here}} expected-warning {{min12int is promoted to min16int}} fxc-pass {{}} */
+    float4 m_buffer_float4;                                 /* expected-note {{variable 'm_buffer_float4' declared const here}} fxc-pass {{}} */
     int3x4 m_buffer_int3x4;
 }
 
 tbuffer g_tbuffer {
-    float m_tbuffer_float;                                  /* expected-note {{variable 'm_tbuffer_float' declared const here}} */
-    int3 m_tbuffer_int3;                                    /* expected-note {{variable 'm_tbuffer_int3' declared const here}} */
-    double2x1 m_tbuffer_double2x1;                          /* expected-note {{variable 'm_tbuffer_double2x1' declared const here}} */
+    float m_tbuffer_float;                                  /* expected-note {{variable 'm_tbuffer_float' declared const here}} fxc-pass {{}} */
+    int3 m_tbuffer_int3;                                    /* expected-note {{variable 'm_tbuffer_int3' declared const here}} fxc-pass {{}} */
+    double2x1 m_tbuffer_double2x1;                          /* expected-note {{variable 'm_tbuffer_double2x1' declared const here}} fxc-pass {{}} */
 }
 
 struct MyStruct {
@@ -26,23 +26,23 @@ TextureBuffer<MyStruct> g_texture_buffer;
 
 float4 main() : SV_TARGET
 {
-    g_float1 = g_float1 + 10.0;                             /* expected-error {{cannot assign to variable 'g_float1' with const-qualified type 'const float'}} */
-    g_float1 += 3.5;                                         /* expected-error {{cannot assign to variable 'g_float1' with const-qualified type 'const float'}} */
-    g_vec1 = g_vec1 + 3;                                    /* expected-error {{cannot assign to variable 'g_vec1' with const-qualified type 'const int4'}} */
-    g_vec1 -= 1;                                            /* expected-error {{cannot assign to variable 'g_vec1' with const-qualified type 'const int4'}} */
-    g_mat1._12 = 3;                                         /* expected-error {{read-only variable is not assignable}} */
-    g_mat1._34 *= 4;                                        /* expected-error {{read-only variable is not assignable}} */
-    m_buffer_min12int = 12;                                 /* expected-error {{cannot assign to variable 'm_buffer_min12int' with const-qualified type 'const min12int'}} */
-    m_buffer_float4 += 3.4;                                 /* expected-error {{cannot assign to variable 'm_buffer_float4' with const-qualified type 'const float4'}} */
-    m_buffer_int3x4._m01 -= 10;                             /* expected-error {{read-only variable is not assignable}} */
-    m_tbuffer_float *= 2;                                   /* expected-error {{cannot assign to variable 'm_tbuffer_float' with const-qualified type 'const float'}} */
-    m_tbuffer_int3 = 10;                                    /* expected-error {{cannot assign to variable 'm_tbuffer_int3' with const-qualified type 'const int3'}} */
-    m_tbuffer_double2x1 *= 3;                               /* expected-error {{cannot assign to variable 'm_tbuffer_double2x1' with const-qualified type 'const double2x1'}} */
-
-    g_const_buffer.my_float3.x = 1.5;                       /* expected-error {{read-only variable is not assignable}} */
-    g_const_buffer.my_int3x4._21 -= 2;                      /* expected-error {{read-only variable is not assignable}} */
-    g_texture_buffer.my_float3.y += 2.0;                      /* expected-error {{read-only variable is not assignable}} */
-    g_texture_buffer.my_int3x4._14 = 3;                     /* expected-error {{read-only variable is not assignable}} */
+    g_float1 = g_float1 + 10.0;                             /* expected-error {{cannot assign to variable 'g_float1' with const-qualified type 'const float'}} fxc-error {{X3025: global variables are implicitly constant, enable compatibility mode to allow modification}} */
+    g_float1 += 3.5;                                         /* expected-error {{cannot assign to variable 'g_float1' with const-qualified type 'const float'}} fxc-error {{X3025: global variables are implicitly constant, enable compatibility mode to allow modification}} */
+    g_vec1 = g_vec1 + 3;                                    /* expected-error {{cannot assign to variable 'g_vec1' with const-qualified type 'const int4'}} fxc-error {{X3025: global variables are implicitly constant, enable compatibility mode to allow modification}} */
+    g_vec1 -= 1;                                            /* expected-error {{cannot assign to variable 'g_vec1' with const-qualified type 'const int4'}} fxc-error {{X3025: global variables are implicitly constant, enable compatibility mode to allow modification}} */
+    g_mat1._12 = 3;                                         /* expected-error {{read-only variable is not assignable}} fxc-error {{X3004: undeclared identifier 'g_mat1'}} */
+    g_mat1._34 *= 4;                                        /* expected-error {{read-only variable is not assignable}} fxc-error {{X3004: undeclared identifier 'g_mat1'}} */
+    m_buffer_min12int = 12;                                 /* expected-error {{cannot assign to variable 'm_buffer_min12int' with const-qualified type 'const min12int'}} fxc-error {{X3025: global variables are implicitly constant, enable compatibility mode to allow modification}} */
+    m_buffer_float4 += 3.4;                                 /* expected-error {{cannot assign to variable 'm_buffer_float4' with const-qualified type 'const float4'}} fxc-error {{X3025: global variables are implicitly constant, enable compatibility mode to allow modification}} */
+    m_buffer_int3x4._m01 -= 10;                             /* expected-error {{read-only variable is not assignable}} fxc-error {{X3025: global variables are implicitly constant, enable compatibility mode to allow modification}} */
+    m_tbuffer_float *= 2;                                   /* expected-error {{cannot assign to variable 'm_tbuffer_float' with const-qualified type 'const float'}} fxc-error {{X3025: global variables are implicitly constant, enable compatibility mode to allow modification}} */
+    m_tbuffer_int3 = 10;                                    /* expected-error {{cannot assign to variable 'm_tbuffer_int3' with const-qualified type 'const int3'}} fxc-error {{X3025: global variables are implicitly constant, enable compatibility mode to allow modification}} */
+    m_tbuffer_double2x1 *= 3;                               /* expected-error {{cannot assign to variable 'm_tbuffer_double2x1' with const-qualified type 'const double2x1'}} fxc-error {{X3025: global variables are implicitly constant, enable compatibility mode to allow modification}} */
+
+    g_const_buffer.my_float3.x = 1.5;                       /* expected-error {{read-only variable is not assignable}} fxc-error {{X3025: global variables are implicitly constant, enable compatibility mode to allow modification}} */
+    g_const_buffer.my_int3x4._21 -= 2;                      /* expected-error {{read-only variable is not assignable}} fxc-error {{X3025: global variables are implicitly constant, enable compatibility mode to allow modification}} */
+    g_texture_buffer.my_float3.y += 2.0;                      /* expected-error {{read-only variable is not assignable}} fxc-error {{X3025: global variables are implicitly constant, enable compatibility mode to allow modification}} */
+    g_texture_buffer.my_int3x4._14 = 3;                     /* expected-error {{read-only variable is not assignable}} fxc-error {{X3025: global variables are implicitly constant, enable compatibility mode to allow modification}} */
 
     return (float4)g_float1;
 }

+ 27 - 27
tools/clang/test/HLSL/const-expr.hlsl

@@ -4,7 +4,7 @@ float overload1(float f) { return 1; }                        /* expected-note {
 double overload1(double f) { return 2; }                       /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} fxc-pass {{}} */
 int overload1(int i) { return 3; }                             /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} fxc-pass {{}} */
 uint overload1(uint i) { return 4; }                           /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} fxc-pass {{}} */
-min12int overload1(min12int i) { return 5; }                   /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} fxc-pass {{}} expected-warning {{min12int is promoted to min16int}} expected-warning {{min12int is promoted to min16int}} */
+min12int overload1(min12int i) { return 5; }                   /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-warning {{min12int is promoted to min16int}} expected-warning {{min12int is promoted to min16int}} fxc-pass {{}} */
 
 
 static const float2 g_f2_arr[8] =
@@ -37,24 +37,24 @@ float fn_f_f(float r)
     `-VarDecl <col:3, col:79> col:12 used rotationMatrix 'float2x2':'matrix<float, 2, 2>' cinit
       `-InitListExpr <col:29, col:79> 'float2x2':'matrix<float, 2, 2>'
         |-ImplicitCastExpr <col:31, col:40> 'float' <LValueToRValue>
-        | `-HLSLVectorElementExpr <col:31, col:40> 'float' lvalue vectorcomponent x
-        |   `-DeclRefExpr <col:31> 'float2':'vector<float, 2>' lvalue Var 'rotation' 'float2':'vector<float, 2>'
+        | `-HLSLVectorElementExpr <col:31, col:40> 'const float' lvalue vectorcomponent x
+        |   `-DeclRefExpr <col:31> 'const float2':'const vector<float, 2>' lvalue Var 'rotation' 'const float2':'const vector<float, 2>'
         |-ImplicitCastExpr <col:43, col:52> 'float' <LValueToRValue>
-        | `-HLSLVectorElementExpr <col:43, col:52> 'float' lvalue vectorcomponent y
-        |   `-DeclRefExpr <col:43> 'float2':'vector<float, 2>' lvalue Var 'rotation' 'float2':'vector<float, 2>'
+        | `-HLSLVectorElementExpr <col:43, col:52> 'const float' lvalue vectorcomponent y
+        |   `-DeclRefExpr <col:43> 'const float2':'const vector<float, 2>' lvalue Var 'rotation' 'const float2':'const vector<float, 2>'
         |-UnaryOperator <col:55, col:65> 'float' prefix '-'
         | `-ImplicitCastExpr <col:56, col:65> 'float' <LValueToRValue>
-        |   `-HLSLVectorElementExpr <col:56, col:65> 'float' lvalue vectorcomponent y
-        |     `-DeclRefExpr <col:56> 'float2':'vector<float, 2>' lvalue Var 'rotation' 'float2':'vector<float, 2>'
+        |   `-HLSLVectorElementExpr <col:56, col:65> 'const float' lvalue vectorcomponent y
+        |     `-DeclRefExpr <col:56> 'const float2':'const vector<float, 2>' lvalue Var 'rotation' 'const float2':'const vector<float, 2>'
         `-ImplicitCastExpr <col:68, col:77> 'float' <LValueToRValue>
-          `-HLSLVectorElementExpr <col:68, col:77> 'float' lvalue vectorcomponent x
-            `-DeclRefExpr <col:68> 'float2':'vector<float, 2>' lvalue Var 'rotation' 'float2':'vector<float, 2>'
+          `-HLSLVectorElementExpr <col:68, col:77> 'const float' lvalue vectorcomponent x
+            `-DeclRefExpr <col:68> 'const float2':'const vector<float, 2>' lvalue Var 'rotation' 'const float2':'const vector<float, 2>'
   */
   float2 offs = mul(g_f2_arr[tap], rotationMatrix) * r;
   /*verify-ast
     DeclStmt <col:3, col:55>
     `-VarDecl <col:3, col:54> col:10 used offs 'float2':'vector<float, 2>' cinit
-      `-BinaryOperator <col:17, col:54> 'vector<float, 2>' '*'
+      `-BinaryOperator <col:17, col:54> 'vector<float, 2>':'vector<float, 2>' '*'
         |-CallExpr <col:17, col:50> 'vector<float, 2>':'vector<float, 2>'
         | |-ImplicitCastExpr <col:17> 'vector<float, 2> (*)(vector<float, 2>, matrix<float, 2, 2>)' <FunctionToPointerDecay>
         | | `-DeclRefExpr <col:17> 'vector<float, 2> (vector<float, 2>, matrix<float, 2, 2>)' lvalue Function 'mul' 'vector<float, 2> (vector<float, 2>, matrix<float, 2, 2>)'
@@ -116,8 +116,8 @@ uint fn_f3_f3io_u(float3 wn, inout float3 tsn)
 
   tsn *= float3 (1.0 / sqrt_6, 1.0 / sqrt_2, 1.0 / sqrt_3);
   /*verify-ast
-    CompoundAssignOperator <col:3, col:58> 'float3':'vector<float, 3>' lvalue '*=' ComputeLHSTy='vector<float, 3>' ComputeResultTy='vector<float, 3>'
-    |-DeclRefExpr <col:3> 'float3':'vector<float, 3>' lvalue ParmVar 'tsn' 'float3 &'
+    CompoundAssignOperator <col:3, col:58> 'float3':'vector<float, 3>' lvalue '*=' ComputeLHSTy='float3':'vector<float, 3>' ComputeResultTy='float3':'vector<float, 3>'
+    |-DeclRefExpr <col:3> 'float3':'vector<float, 3>' lvalue ParmVar 'tsn' 'float3 &__restrict'
     `-CXXFunctionalCastExpr <col:10, col:58> 'float3':'vector<float, 3>' functional cast to float3 <NoOp>
       `-InitListExpr <col:18, col:52> 'float3':'vector<float, 3>'
         |-BinaryOperator <col:18, col:24> 'float' '/'
@@ -160,22 +160,22 @@ void fn_const_eval() {
   float f_ice_rem[u % 2];
   float f_ice_shl[u << 1];
   float f_ice_shr[u >> 1];
-  float f_ice_ternary[u > 1 ? 3 : 4];
-  float f_ice_lt[u < 1 ? 3 : 4];
-  float f_ice_le[u <= 1 ? 3 : 4];
-  float f_ice_gt[u > 1 ? 3 : 4];
-  float f_ice_ge[u >= 1 ? 3 : 4];
-  float f_ice_eq[u == 1 ? 3 : 4];
-  float f_ice_ne[u != 1 ? 3 : 4];
+  float f_ice_ternary[u > 1 ? 3 : 4];                          /* fxc-error {{X3058: array dimensions must be literal scalar expressions}} */
+  float f_ice_lt[u < 1 ? 3 : 4];                               /* fxc-error {{X3058: array dimensions must be literal scalar expressions}} */
+  float f_ice_le[u <= 1 ? 3 : 4];                              /* fxc-error {{X3058: array dimensions must be literal scalar expressions}} */
+  float f_ice_gt[u > 1 ? 3 : 4];                               /* fxc-error {{X3058: array dimensions must be literal scalar expressions}} */
+  float f_ice_ge[u >= 1 ? 3 : 4];                              /* fxc-error {{X3058: array dimensions must be literal scalar expressions}} */
+  float f_ice_eq[u == 1 ? 3 : 4];                              /* fxc-error {{X3058: array dimensions must be literal scalar expressions}} */
+  float f_ice_ne[u != 1 ? 3 : 4];                              /* fxc-error {{X3058: array dimensions must be literal scalar expressions}} */
   float f_ice_bin_and[u & 0x1];
   float f_ice_bin_or[u | 0x1];
   float f_ice_bin_xor[u ^ 0x1];
-  float f_ice_log_and[u && true ? 3 : 4];
-  float f_ice_log_or[u || false ? 3 : 4];
+  float f_ice_log_and[u && true ? 3 : 4];                      /* fxc-error {{X3058: array dimensions must be literal scalar expressions}} */
+  float f_ice_log_or[u || false ? 3 : 4];                      /* fxc-error {{X3058: array dimensions must be literal scalar expressions}} */
 
   // This fails, as it should, but the error recovery isn't very good
   // and the error messages could be improved.
-  float f_ice_assign[u_var = 3]; // expected-error {{expected ']'}} expected-note {{to match this '['}} expected-error {{variable length arrays are not supported in HLSL}}
+  float f_ice_assign[u_var = 3]; // expected-error {{expected ']'}} expected-error {{variable length arrays are not supported in HLSL}} expected-note {{to match this '['}} fxc-error {{X3058: array dimensions must be literal scalar expressions}}
 
   // Data types:
   // Check with all primitive types.
@@ -287,8 +287,8 @@ void fn_const_eval() {
   // but the intrin_max subexpression isn't one (even if the binary comparsion
   // expression is).
   // _Static_assert(intrin_max == 2, "expected 2");
-  _Static_assert(max(1, 2) == 2, "expected 2");
-  _Static_assert(max(1, -2) == 1, "expected 1");
+  _Static_assert(max(1, 2) == 2, "expected 2");             /* fxc-error {{X3004: undeclared identifier '_Static_assert'}} */
+  _Static_assert(max(1, -2) == 1, "expected 1");            /* fxc-error {{X3004: undeclared identifier '_Static_assert'}} */
   //    (UINT)hlsl::IntrinsicOp::IOP_min, 3, g_Intrinsics_Args96,
 //    (UINT)hlsl::IntrinsicOp::IOP_modf, 3, g_Intrinsics_Args97,
 //    (UINT)hlsl::IntrinsicOp::IOP_msad4, 4, g_Intrinsics_Args98,
@@ -377,9 +377,9 @@ void fn_ice() {
 
   // Note: here dxc is different from fxc, where a const integral vector can be used in ICE.
   // It would be desirable to have this supported.
-  float arr_vc_One[vc_One.x];  /* expected-error {{variable length arrays are not supported in HLSL}} */
-  float arr_vc_Two[vc_Two.x];  /* expected-error {{variable length arrays are not supported in HLSL}} */
+  float arr_vc_One[vc_One.x];  /* expected-error {{variable length arrays are not supported in HLSL}} fxc-pass {{}} */
+  float arr_vc_Two[vc_Two.x];  /* expected-error {{variable length arrays are not supported in HLSL}} fxc-pass {{}} */
 }
 
 void cs_main() {
-}
+}

+ 1 - 1
tools/clang/test/HLSL/derived-to-base.hlsl

@@ -56,7 +56,7 @@ float main() : A {
             `-DeclRefExpr <col:26> 'DerivedAgain' lvalue Var 'da2' 'DerivedAgain'
     */
 
-    da1          = (DerivedAgain)d; // expected-error {{cannot convert from 'Derived' to 'DerivedAgain'}}
+    da1          = (DerivedAgain)d; // expected-error {{cannot convert from 'Derived' to 'DerivedAgain'}} fxc-error {{X3017: cannot convert from 'struct Derived' to 'struct DerivedAgain'}}
 
     return 1.0;
 }

+ 7 - 8
tools/clang/test/HLSL/effects-syntax.hlsl

@@ -58,8 +58,7 @@ float4 main() : SV_Target
   int PixelShadeR = 1;
   RenderTargetView rtv { state=foo; };                      /* expected-warning {{effect object ignored - effect syntax is deprecated}} expected-warning {{effect state block ignored - effect syntax is deprecated}} fxc-pass {{}} */
   /*verify-ast
-    DeclStmt <col:3, col:38>
-    `-VarDecl <col:3, col:20> col:20 invalid rtv 'RenderTargetView':'deprecated effect object'
+    No matching AST found for line!
   */
   Texture2D l_tex { state=foo; };                           /* expected-warning {{effect state block ignored - effect syntax is deprecated}} fxc-pass {{}} */
   /*verify-ast
@@ -104,12 +103,12 @@ float4 main() : SV_Target
 texture tex1 < int foo=1; > { state=foo; };   // Case insensitive!    /* expected-warning {{effect object ignored - effect syntax is deprecated}} expected-warning {{effect state block ignored - effect syntax is deprecated}} expected-warning {{possible effect annotation ignored - effect syntax is deprecated}} fxc-pass {{}} */
 static const PixelShader ps1 { state=foo; };                /* expected-warning {{effect object ignored - effect syntax is deprecated}} expected-warning {{effect state block ignored - effect syntax is deprecated}} fxc-pass {{}} */
 /*verify-ast
-  VarDecl <col:1, col:26> col:26 invalid ps1 'const PixelShader':'const deprecated effect object' static
+  No matching AST found for line!
 */
 // expected-note@? {{'PixelShader' declared here}}
 PixelShadeR ps < int foo=1;>  = ps1;   // Case insensitive! /* expected-error {{unknown type name 'PixelShadeR'; did you mean 'PixelShader'?}} expected-warning {{effect object ignored - effect syntax is deprecated}} expected-warning {{possible effect annotation ignored - effect syntax is deprecated}} fxc-pass {{}} */
 /*verify-ast
-  VarDecl <col:1, col:13> col:13 invalid ps 'PixelShader':'deprecated effect object'
+  No matching AST found for line!
 */
 // expected-note@? {{'VertexShader' declared here}}
 VertexShadeR vs;        // Case insensitive!                /* expected-error {{unknown type name 'VertexShadeR'; did you mean 'VertexShader'?}} expected-warning {{effect object ignored - effect syntax is deprecated}} fxc-pass {{}} */
@@ -162,25 +161,25 @@ technique11                                                 /* expected-warning
 // We don't bother handling weird casing, so this will be a syntax error:
 TechNiQue                                                   /* expected-error {{HLSL requires a type specifier for all declarations}} fxc-pass {{}} */
 /*verify-ast
-  VarDecl <col:1> col:1 invalid TechNiQue 'int'
+  VarDecl <col:1> col:1 invalid TechNiQue 'const int'
 */
 {                                                           /* expected-warning {{effect state block ignored - effect syntax is deprecated}} fxc-pass {{}} */
   pass {}
 }                                                           /* expected-error {{expected ';' after top level declarator}} fxc-pass {{}} */
 int foobar3;
 /*verify-ast
-  VarDecl <col:1, col:5> col:5 foobar3 'int'
+  VarDecl <col:1, col:5> col:5 foobar3 'const int'
 */
 TechNique T5                                                /* expected-error {{unknown type name 'TechNique'}} fxc-pass {{}} */
 /*verify-ast
-  VarDecl <col:1, col:11> col:11 invalid T5 'int'
+  VarDecl <col:1, col:11> col:11 invalid T5 'const int'
 */
 {                                                           /* expected-warning {{effect state block ignored - effect syntax is deprecated}} fxc-pass {{}} */
   pass {}
 }                                                           /* expected-error {{expected ';' after top level declarator}} fxc-pass {{}} */
 int foobar4;
 /*verify-ast
-  VarDecl <col:1, col:5> col:5 foobar4 'int'
+  VarDecl <col:1, col:5> col:5 foobar4 'const int'
 */
 int foobar5[] {1, 2, 3};                                        /* expected-error {{definition of variable with array type needs an explicit size or an initializer}} expected-warning {{effect state block ignored - effect syntax is deprecated. To use braces as an initializer use them with equal signs.}} fxc-error {{X3000: syntax error: unexpected integer constant}} */
 int foobar6[4] {1, 2, 3, 4};                                    /* expected-warning {{effect state block ignored - effect syntax is deprecated. To use braces as an initializer use them with equal signs.}} fxc-error {{X3000: syntax error: unexpected integer constant}} */

+ 9 - 9
tools/clang/test/HLSL/enums.hlsl

@@ -156,9 +156,9 @@ int4 main() : SV_Target {
     unary1--;                                       /* expected-error {{numeric type expected}} */
     ++unary1;                                       /* expected-error {{numeric type expected}} */
     --unary1;                                       /* expected-error {{numeric type expected}} */
-    
-    int unaryInt = !unary0;                                       
-    unaryInt = ~unary0;                                        
+
+    int unaryInt = !unary0;
+    unaryInt = ~unary0;
     unaryInt = !unary1;                  /* expected-error {{numeric type expected}} */
     unaryInt = ~unary1;                  /* expected-error {{int or unsigned int type required}} */
 
@@ -198,16 +198,16 @@ int4 main() : SV_Target {
     float FaddU = MyEnumUInt::FOURU + 283.48f;
     float Fadd64 = MyEnum64::ZERO64  - 8471.0f;
 
-    if (MyEnum == ONE) 
+    if (MyEnum == ONE)
       ;
-    if (MyEnum != ONE) 
+    if (MyEnum != ONE)
       ;
-    if (MyEnum > ONE) 
+    if (MyEnum > ONE)
       ;
 
-    if (MyEnumClass == MyEnumClass::ONEC) 
+    if (MyEnumClass == MyEnumClass::ONEC)
       ;
-    if (MyEnumClass != MyEnumClass::ONEC) 
+    if (MyEnumClass != MyEnumClass::ONEC)
       ;
     if (MyEnumClass < MyEnumClass::ONEC) /* expected-error {{numeric type expected}} */
       ;
@@ -215,4 +215,4 @@ int4 main() : SV_Target {
     if (MyEnum == MyEnumClass::ONEC) ;  /* expected-error {{type mismatch}} */
 
     return 1;
-}
+}

+ 14 - 14
tools/clang/test/HLSL/functions.hlsl

@@ -111,14 +111,14 @@ float4 component_fun(uint input) {
     |-HLSLVectorElementExpr <col:3, col:10> 'vector<float, 3>':'vector<float, 3>' lvalue vectorcomponent rgb
     | `-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'output' 'float4':'vector<float, 4>'
     `-ConditionalOperator <col:16, col:105> 'vector<float, 3>'
-      |-ParenExpr <col:16, col:39> 'const bool'
-      | `-BinaryOperator <col:17, col:31> 'const bool' '<='
+      |-ParenExpr <col:16, col:39> 'vector<bool, 3>':'vector<bool, 3>'
+      | `-BinaryOperator <col:17, col:31> 'vector<bool, 3>':'vector<bool, 3>' '<='
       |   |-ImplicitCastExpr <col:17, col:24> 'vector<float, 3>':'vector<float, 3>' <LValueToRValue>
       |   | `-HLSLVectorElementExpr <col:17, col:24> 'vector<float, 3>':'vector<float, 3>' lvalue vectorcomponent rgb
       |   |   `-DeclRefExpr <col:17> 'float4':'vector<float, 4>' lvalue Var 'output' 'float4':'vector<float, 4>'
       |   `-ImplicitCastExpr <col:31> 'vector<float, 3>':'vector<float, 3>' <HLSLVectorSplat>
       |     `-FloatingLiteral <col:31> 'float' 4.045000e-02
-      |-BinaryOperator <col:43, col:56> 'vector<float, 3>' '/'
+      |-BinaryOperator <col:43, col:56> 'vector<float, 3>':'vector<float, 3>' '/'
       | |-ImplicitCastExpr <col:43, col:50> 'vector<float, 3>':'vector<float, 3>' <LValueToRValue>
       | | `-HLSLVectorElementExpr <col:43, col:50> 'vector<float, 3>':'vector<float, 3>' lvalue vectorcomponent rgb
       | |   `-DeclRefExpr <col:43> 'float4':'vector<float, 4>' lvalue Var 'output' 'float4':'vector<float, 4>'
@@ -127,9 +127,9 @@ float4 component_fun(uint input) {
       `-CallExpr <col:65, col:105> 'vector<float, 3>':'vector<float, 3>'
         |-ImplicitCastExpr <col:65> 'vector<float, 3> (*)(vector<float, 3>, vector<float, 3>)' <FunctionToPointerDecay>
         | `-DeclRefExpr <col:65> 'vector<float, 3> (vector<float, 3>, vector<float, 3>)' lvalue Function 'pow' 'vector<float, 3> (vector<float, 3>, vector<float, 3>)'
-        |-BinaryOperator <col:69, col:93> 'vector<float, 3>' '/'
-        | |-ParenExpr <col:69, col:89> 'vector<float, 3>'
-        | | `-BinaryOperator <col:70, col:83> 'vector<float, 3>' '+'
+        |-BinaryOperator <col:69, col:93> 'vector<float, 3>':'vector<float, 3>' '/'
+        | |-ParenExpr <col:69, col:89> 'vector<float, 3>':'vector<float, 3>'
+        | | `-BinaryOperator <col:70, col:83> 'vector<float, 3>':'vector<float, 3>' '+'
         | |   |-ImplicitCastExpr <col:70, col:77> 'vector<float, 3>':'vector<float, 3>' <LValueToRValue>
         | |   | `-HLSLVectorElementExpr <col:70, col:77> 'vector<float, 3>':'vector<float, 3>' lvalue vectorcomponent rgb
         | |   |   `-DeclRefExpr <col:70> 'float4':'vector<float, 4>' lvalue Var 'output' 'float4':'vector<float, 4>'
@@ -220,19 +220,19 @@ void fn_uint_oload3(inout uint u) { }
 void fn_uint_oload3(out uint u) { }
 
 // function redefinitions
-void fn_redef(min10float x) {}      /* expected-warning {{min10float is promoted to min16float}} */
-void fn_redef(min16float x) {}      /* */
+void fn_redef(min10float x) {}      /* expected-warning {{min10float is promoted to min16float}} fxc-pass {{}} */
+void fn_redef(min16float x) {}
 
 
-void fn_redef2(min12int x) {}       /* expected-warning {{min12int is promoted to min16int}} */
-void fn_redef2(min16int x) {}       /* */
+void fn_redef2(min12int x) {}       /* expected-warning {{min12int is promoted to min16int}} fxc-pass {{}} */
+void fn_redef2(min16int x) {}
 
-void fn_redef3(half x) {}           /* */
-void fn_redef3(float x) {}          /* */
+void fn_redef3(half x) {}
+void fn_redef3(float x) {}
 
 typedef min16int My16Int;
-void fn_redef4(min16int x) {}       /* expected-note {{previous definition is here}} */
-void fn_redef4(My16Int x) {}        /* expected-error {{redefinition of 'fn_redef4'}} */
+void fn_redef4(min16int x) {}       /* expected-note {{previous definition is here}} fxc-pass {{}} */
+void fn_redef4(My16Int x) {}        /* expected-error {{redefinition of 'fn_redef4'}} fxc-pass {{}} */
 
 void inout_calls() {
   uint u = 1;

+ 114 - 140
tools/clang/test/HLSL/implicit-casts.hlsl

@@ -76,8 +76,8 @@ int g_i;
 uint g_u;
 bool g_b;
 double g_d;
-int64_t g_i64;
-uint64_t g_u64;
+int64_t g_i64;                                              /* fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+uint64_t g_u64;                                             /* fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
 min16float g_m16f;
 float1 g_f1;
 float2 g_f2;
@@ -94,12 +94,12 @@ bool4 g_b4;
 double1 g_d1;
 double2 g_d2;
 double4 g_d4;
-int64_t1 g_i641;
-int64_t2 g_i642;
-int64_t4 g_i644;
-uint64_t1 g_u641;
-uint64_t2 g_u642;
-uint64_t4 g_u644;
+int64_t1 g_i641;                                            /* fxc-error {{X3000: unrecognized identifier 'int64_t1'}} */
+int64_t2 g_i642;                                            /* fxc-error {{X3000: unrecognized identifier 'int64_t2'}} */
+int64_t4 g_i644;                                            /* fxc-error {{X3000: unrecognized identifier 'int64_t4'}} */
+uint64_t1 g_u641;                                           /* fxc-error {{X3000: unrecognized identifier 'uint64_t1'}} */
+uint64_t2 g_u642;                                           /* fxc-error {{X3000: unrecognized identifier 'uint64_t2'}} */
+uint64_t4 g_u644;                                           /* fxc-error {{X3000: unrecognized identifier 'uint64_t4'}} */
 min16float1 g_m16f1;
 min16float2 g_m16f2;
 min16float4 g_m16f4;
@@ -123,14 +123,14 @@ double1x1 g_d1x1;
 double4x1 g_d4x1;
 double1x4 g_d1x4;
 double4x4 g_d4x4;
-int64_t1x1 g_i641x1;
-int64_t4x1 g_i644x1;
-int64_t1x4 g_i641x4;
-int64_t4x4 g_i644x4;
-uint64_t1x1 g_u641x1;
-uint64_t4x1 g_u644x1;
-uint64_t1x4 g_u641x4;
-uint64_t4x4 g_u644x4;
+int64_t1x1 g_i641x1;                                        /* fxc-error {{X3000: unrecognized identifier 'int64_t1x1'}} */
+int64_t4x1 g_i644x1;                                        /* fxc-error {{X3000: unrecognized identifier 'int64_t4x1'}} */
+int64_t1x4 g_i641x4;                                        /* fxc-error {{X3000: unrecognized identifier 'int64_t1x4'}} */
+int64_t4x4 g_i644x4;                                        /* fxc-error {{X3000: unrecognized identifier 'int64_t4x4'}} */
+uint64_t1x1 g_u641x1;                                       /* fxc-error {{X3000: unrecognized identifier 'uint64_t1x1'}} */
+uint64_t4x1 g_u644x1;                                       /* fxc-error {{X3000: unrecognized identifier 'uint64_t4x1'}} */
+uint64_t1x4 g_u641x4;                                       /* fxc-error {{X3000: unrecognized identifier 'uint64_t1x4'}} */
+uint64_t4x4 g_u644x4;                                       /* fxc-error {{X3000: unrecognized identifier 'uint64_t4x4'}} */
 min16float1x1 g_m16f1x1;
 min16float4x1 g_m16f4x1;
 min16float1x4 g_m16f1x4;
@@ -149,8 +149,8 @@ int overload1(int v) { return (int)200; }
 uint overload1(uint v) { return (uint)300; }
 bool overload1(bool v) { return (bool)400; }
 double overload1(double v) { return (double)500; }
-int64_t overload1(int64_t v) { return (int64_t)600; }
-uint64_t overload1(uint64_t v) { return (uint64_t)700; }
+int64_t overload1(int64_t v) { return (int64_t)600; }       /* fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+uint64_t overload1(uint64_t v) { return (uint64_t)700; }    /* fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
 float2 overload1(float2 v) { return (float2)102; }
 float4 overload1(float4 v) { return (float4)104; }
 int2 overload1(int2 v) { return (int2)202; }
@@ -161,10 +161,10 @@ bool2 overload1(bool2 v) { return (bool2)402; }
 bool4 overload1(bool4 v) { return (bool4)404; }
 double2 overload1(double2 v) { return (double2)502; }
 double4 overload1(double4 v) { return (double4)504; }
-int64_t2 overload1(int64_t2 v) { return (int64_t2)602; }
-int64_t4 overload1(int64_t4 v) { return (int64_t4)604; }
-uint64_t2 overload1(uint64_t2 v) { return (uint64_t2)702; }
-uint64_t4 overload1(uint64_t4 v) { return (uint64_t4)704; }
+int64_t2 overload1(int64_t2 v) { return (int64_t2)602; }    /* fxc-error {{X3000: unrecognized identifier 'int64_t2'}} */
+int64_t4 overload1(int64_t4 v) { return (int64_t4)604; }    /* fxc-error {{X3000: unrecognized identifier 'int64_t4'}} */
+uint64_t2 overload1(uint64_t2 v) { return (uint64_t2)702; }    /* fxc-error {{X3000: unrecognized identifier 'uint64_t2'}} */
+uint64_t4 overload1(uint64_t4 v) { return (uint64_t4)704; }    /* fxc-error {{X3000: unrecognized identifier 'uint64_t4'}} */
 float4x1 overload1(float4x1 v) { return (float4x1)141; }
 float1x4 overload1(float1x4 v) { return (float1x4)114; }
 float4x4 overload1(float4x4 v) { return (float4x4)144; }
@@ -180,12 +180,12 @@ bool4x4 overload1(bool4x4 v) { return (bool4x4)444; }
 double4x1 overload1(double4x1 v) { return (double4x1)541; }
 double1x4 overload1(double1x4 v) { return (double1x4)514; }
 double4x4 overload1(double4x4 v) { return (double4x4)544; }
-int64_t4x1 overload1(int64_t4x1 v) { return (int64_t4x1)641; }
-int64_t1x4 overload1(int64_t1x4 v) { return (int64_t1x4)614; }
-int64_t4x4 overload1(int64_t4x4 v) { return (int64_t4x4)644; }
-uint64_t4x1 overload1(uint64_t4x1 v) { return (uint64_t4x1)741; }
-uint64_t1x4 overload1(uint64_t1x4 v) { return (uint64_t1x4)714; }
-uint64_t4x4 overload1(uint64_t4x4 v) { return (uint64_t4x4)744; }
+int64_t4x1 overload1(int64_t4x1 v) { return (int64_t4x1)641; }    /* fxc-error {{X3000: unrecognized identifier 'int64_t4x1'}} */
+int64_t1x4 overload1(int64_t1x4 v) { return (int64_t1x4)614; }    /* fxc-error {{X3000: unrecognized identifier 'int64_t1x4'}} */
+int64_t4x4 overload1(int64_t4x4 v) { return (int64_t4x4)644; }    /* fxc-error {{X3000: unrecognized identifier 'int64_t4x4'}} */
+uint64_t4x1 overload1(uint64_t4x1 v) { return (uint64_t4x1)741; }    /* fxc-error {{X3000: unrecognized identifier 'uint64_t4x1'}} */
+uint64_t1x4 overload1(uint64_t1x4 v) { return (uint64_t1x4)714; }    /* fxc-error {{X3000: unrecognized identifier 'uint64_t1x4'}} */
+uint64_t4x4 overload1(uint64_t4x4 v) { return (uint64_t4x4)744; }    /* fxc-error {{X3000: unrecognized identifier 'uint64_t4x4'}} */
 // GENERATED_CODE:END
 
 // <py::lines('GENERATED_CODE')>modify(lines, gen_code('%(type)s overload2(%(type)s v1, %(type)s v2) { return (%(type)s)%(val)s; }', overload_types))</py>
@@ -195,8 +195,8 @@ int overload2(int v1, int v2) { return (int)200; }
 uint overload2(uint v1, uint v2) { return (uint)300; }
 bool overload2(bool v1, bool v2) { return (bool)400; }
 double overload2(double v1, double v2) { return (double)500; }
-int64_t overload2(int64_t v1, int64_t v2) { return (int64_t)600; }
-uint64_t overload2(uint64_t v1, uint64_t v2) { return (uint64_t)700; }
+int64_t overload2(int64_t v1, int64_t v2) { return (int64_t)600; }    /* fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+uint64_t overload2(uint64_t v1, uint64_t v2) { return (uint64_t)700; }    /* fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
 float2 overload2(float2 v1, float2 v2) { return (float2)102; }
 float4 overload2(float4 v1, float4 v2) { return (float4)104; }
 int2 overload2(int2 v1, int2 v2) { return (int2)202; }
@@ -207,10 +207,10 @@ bool2 overload2(bool2 v1, bool2 v2) { return (bool2)402; }
 bool4 overload2(bool4 v1, bool4 v2) { return (bool4)404; }
 double2 overload2(double2 v1, double2 v2) { return (double2)502; }
 double4 overload2(double4 v1, double4 v2) { return (double4)504; }
-int64_t2 overload2(int64_t2 v1, int64_t2 v2) { return (int64_t2)602; }
-int64_t4 overload2(int64_t4 v1, int64_t4 v2) { return (int64_t4)604; }
-uint64_t2 overload2(uint64_t2 v1, uint64_t2 v2) { return (uint64_t2)702; }
-uint64_t4 overload2(uint64_t4 v1, uint64_t4 v2) { return (uint64_t4)704; }
+int64_t2 overload2(int64_t2 v1, int64_t2 v2) { return (int64_t2)602; }    /* fxc-error {{X3000: unrecognized identifier 'int64_t2'}} */
+int64_t4 overload2(int64_t4 v1, int64_t4 v2) { return (int64_t4)604; }    /* fxc-error {{X3000: unrecognized identifier 'int64_t4'}} */
+uint64_t2 overload2(uint64_t2 v1, uint64_t2 v2) { return (uint64_t2)702; }    /* fxc-error {{X3000: unrecognized identifier 'uint64_t2'}} */
+uint64_t4 overload2(uint64_t4 v1, uint64_t4 v2) { return (uint64_t4)704; }    /* fxc-error {{X3000: unrecognized identifier 'uint64_t4'}} */
 float4x1 overload2(float4x1 v1, float4x1 v2) { return (float4x1)141; }
 float1x4 overload2(float1x4 v1, float1x4 v2) { return (float1x4)114; }
 float4x4 overload2(float4x4 v1, float4x4 v2) { return (float4x4)144; }
@@ -226,12 +226,12 @@ bool4x4 overload2(bool4x4 v1, bool4x4 v2) { return (bool4x4)444; }
 double4x1 overload2(double4x1 v1, double4x1 v2) { return (double4x1)541; }
 double1x4 overload2(double1x4 v1, double1x4 v2) { return (double1x4)514; }
 double4x4 overload2(double4x4 v1, double4x4 v2) { return (double4x4)544; }
-int64_t4x1 overload2(int64_t4x1 v1, int64_t4x1 v2) { return (int64_t4x1)641; }
-int64_t1x4 overload2(int64_t1x4 v1, int64_t1x4 v2) { return (int64_t1x4)614; }
-int64_t4x4 overload2(int64_t4x4 v1, int64_t4x4 v2) { return (int64_t4x4)644; }
-uint64_t4x1 overload2(uint64_t4x1 v1, uint64_t4x1 v2) { return (uint64_t4x1)741; }
-uint64_t1x4 overload2(uint64_t1x4 v1, uint64_t1x4 v2) { return (uint64_t1x4)714; }
-uint64_t4x4 overload2(uint64_t4x4 v1, uint64_t4x4 v2) { return (uint64_t4x4)744; }
+int64_t4x1 overload2(int64_t4x1 v1, int64_t4x1 v2) { return (int64_t4x1)641; }    /* fxc-error {{X3000: unrecognized identifier 'int64_t4x1'}} */
+int64_t1x4 overload2(int64_t1x4 v1, int64_t1x4 v2) { return (int64_t1x4)614; }    /* fxc-error {{X3000: unrecognized identifier 'int64_t1x4'}} */
+int64_t4x4 overload2(int64_t4x4 v1, int64_t4x4 v2) { return (int64_t4x4)644; }    /* fxc-error {{X3000: unrecognized identifier 'int64_t4x4'}} */
+uint64_t4x1 overload2(uint64_t4x1 v1, uint64_t4x1 v2) { return (uint64_t4x1)741; }    /* fxc-error {{X3000: unrecognized identifier 'uint64_t4x1'}} */
+uint64_t1x4 overload2(uint64_t1x4 v1, uint64_t1x4 v2) { return (uint64_t1x4)714; }    /* fxc-error {{X3000: unrecognized identifier 'uint64_t1x4'}} */
+uint64_t4x4 overload2(uint64_t4x4 v1, uint64_t4x4 v2) { return (uint64_t4x4)744; }    /* fxc-error {{X3000: unrecognized identifier 'uint64_t4x4'}} */
 // GENERATED_CODE:END
 
 
@@ -243,8 +243,8 @@ float4 test(): SV_Target {
   uint u = g_u;
   bool b = g_b;
   double d = g_d;
-  int64_t i64 = g_i64;
-  uint64_t u64 = g_u64;
+  int64_t i64 = g_i64;                                      /* fxc-error {{X3000: unrecognized identifier 'i64'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+  uint64_t u64 = g_u64;                                     /* fxc-error {{X3000: unrecognized identifier 'u64'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
   min16float m16f = g_m16f;
   float1 f1 = g_f1;
   float2 f2 = g_f2;
@@ -261,12 +261,12 @@ float4 test(): SV_Target {
   double1 d1 = g_d1;
   double2 d2 = g_d2;
   double4 d4 = g_d4;
-  int64_t1 i641 = g_i641;
-  int64_t2 i642 = g_i642;
-  int64_t4 i644 = g_i644;
-  uint64_t1 u641 = g_u641;
-  uint64_t2 u642 = g_u642;
-  uint64_t4 u644 = g_u644;
+  int64_t1 i641 = g_i641;                                   /* fxc-error {{X3000: unrecognized identifier 'i641'}} fxc-error {{X3000: unrecognized identifier 'int64_t1'}} */
+  int64_t2 i642 = g_i642;                                   /* fxc-error {{X3000: unrecognized identifier 'i642'}} fxc-error {{X3000: unrecognized identifier 'int64_t2'}} */
+  int64_t4 i644 = g_i644;                                   /* fxc-error {{X3000: unrecognized identifier 'i644'}} fxc-error {{X3000: unrecognized identifier 'int64_t4'}} */
+  uint64_t1 u641 = g_u641;                                  /* fxc-error {{X3000: unrecognized identifier 'u641'}} fxc-error {{X3000: unrecognized identifier 'uint64_t1'}} */
+  uint64_t2 u642 = g_u642;                                  /* fxc-error {{X3000: unrecognized identifier 'u642'}} fxc-error {{X3000: unrecognized identifier 'uint64_t2'}} */
+  uint64_t4 u644 = g_u644;                                  /* fxc-error {{X3000: unrecognized identifier 'u644'}} fxc-error {{X3000: unrecognized identifier 'uint64_t4'}} */
   min16float1 m16f1 = g_m16f1;
   min16float2 m16f2 = g_m16f2;
   min16float4 m16f4 = g_m16f4;
@@ -290,14 +290,14 @@ float4 test(): SV_Target {
   double4x1 d4x1 = g_d4x1;
   double1x4 d1x4 = g_d1x4;
   double4x4 d4x4 = g_d4x4;
-  int64_t1x1 i641x1 = g_i641x1;
-  int64_t4x1 i644x1 = g_i644x1;
-  int64_t1x4 i641x4 = g_i641x4;
-  int64_t4x4 i644x4 = g_i644x4;
-  uint64_t1x1 u641x1 = g_u641x1;
-  uint64_t4x1 u644x1 = g_u644x1;
-  uint64_t1x4 u641x4 = g_u641x4;
-  uint64_t4x4 u644x4 = g_u644x4;
+  int64_t1x1 i641x1 = g_i641x1;                             /* fxc-error {{X3000: unrecognized identifier 'i641x1'}} fxc-error {{X3000: unrecognized identifier 'int64_t1x1'}} */
+  int64_t4x1 i644x1 = g_i644x1;                             /* fxc-error {{X3000: unrecognized identifier 'i644x1'}} fxc-error {{X3000: unrecognized identifier 'int64_t4x1'}} */
+  int64_t1x4 i641x4 = g_i641x4;                             /* fxc-error {{X3000: unrecognized identifier 'i641x4'}} fxc-error {{X3000: unrecognized identifier 'int64_t1x4'}} */
+  int64_t4x4 i644x4 = g_i644x4;                             /* fxc-error {{X3000: unrecognized identifier 'i644x4'}} fxc-error {{X3000: unrecognized identifier 'int64_t4x4'}} */
+  uint64_t1x1 u641x1 = g_u641x1;                            /* fxc-error {{X3000: unrecognized identifier 'u641x1'}} fxc-error {{X3000: unrecognized identifier 'uint64_t1x1'}} */
+  uint64_t4x1 u644x1 = g_u644x1;                            /* fxc-error {{X3000: unrecognized identifier 'u644x1'}} fxc-error {{X3000: unrecognized identifier 'uint64_t4x1'}} */
+  uint64_t1x4 u641x4 = g_u641x4;                            /* fxc-error {{X3000: unrecognized identifier 'u641x4'}} fxc-error {{X3000: unrecognized identifier 'uint64_t1x4'}} */
+  uint64_t4x4 u644x4 = g_u644x4;                            /* fxc-error {{X3000: unrecognized identifier 'u644x4'}} fxc-error {{X3000: unrecognized identifier 'uint64_t4x4'}} */
   min16float1x1 m16f1x1 = g_m16f1x1;
   min16float4x1 m16f4x1 = g_m16f4x1;
   min16float1x4 m16f1x4 = g_m16f1x4;
@@ -326,18 +326,18 @@ float4 test(): SV_Target {
   VERIFY_TYPES(float4x4, overload1(i4x4 * 1.5F));
   VERIFY_TYPES(float4x4, overload1(i4x4 * 1.5));
   VERIFY_TYPES(double2, overload1(i2 * 1.5L));
-  VERIFY_TYPES(uint64_t2, overload1(i2 * 2ULL));
-  VERIFY_TYPES(int64_t2, overload1(i2 * 2LL));
+  VERIFY_TYPES(uint64_t2, overload1(i2 * 2ULL));            /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t2'}} */
+  VERIFY_TYPES(int64_t2, overload1(i2 * 2LL));  /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t2'}} */
   VERIFY_TYPES(float4x4, overload1(f4x4 * 2));
 
   // TODO: Should there be a narrowing warning here due to implicit cast of float to int type?
   VERIFY_TYPES(int4x4, overload2(i4x4, f));
   VERIFY_TYPES(int4x4, overload2(f, i4x4));
 
-  VERIFY_TYPES(uint64_t4x4, overload2(u644x4, d));
-  VERIFY_TYPES(uint64_t4x4, overload2(d, u644x4));
-  VERIFY_TYPES(int64_t4x4, overload2(i644x4, d));
-  VERIFY_TYPES(int64_t4x4, overload2(d, i644x4));
+  VERIFY_TYPES(uint64_t4x4, overload2(u644x4, d));          /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t4x4'}} */
+  VERIFY_TYPES(uint64_t4x4, overload2(d, u644x4));          /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t4x4'}} */
+  VERIFY_TYPES(int64_t4x4, overload2(i644x4, d));           /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t4x4'}} */
+  VERIFY_TYPES(int64_t4x4, overload2(d, i644x4));           /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t4x4'}} */
 
   // ambiguous:
   //VERIFY_TYPES(float4, overload2(f4, i4));
@@ -346,10 +346,10 @@ float4 test(): SV_Target {
   VERIFY_TYPES(float, overload2(1.0, f));
   VERIFY_TYPES(double, overload2(d, 1.0));
   VERIFY_TYPES(double, overload2(1.0, d));
-  VERIFY_TYPES(uint64_t, overload2(u64, 2));
-  VERIFY_TYPES(uint64_t, overload2(2, u64));
-  VERIFY_TYPES(int64_t, overload2(i64, 2));
-  VERIFY_TYPES(int64_t, overload2(2, i64));
+  VERIFY_TYPES(uint64_t, overload2(u64, 2));    /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+  VERIFY_TYPES(uint64_t, overload2(2, u64));    /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+  VERIFY_TYPES(int64_t, overload2(i64, 2));     /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+  VERIFY_TYPES(int64_t, overload2(2, i64));     /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
 
   i4 = i;
   /*verify-ast
@@ -360,13 +360,13 @@ float4 test(): SV_Target {
         `-DeclRefExpr <col:8> 'int' lvalue Var 'i' 'int'
   */
 
-  u64 = d;
+  u64 = d;                                      /* fxc-error {{X3004: undeclared identifier 'u64'}} */
   /*verify-ast
     BinaryOperator <col:3, col:9> 'uint64_t':'unsigned long long' '='
     |-DeclRefExpr <col:3> 'uint64_t':'unsigned long long' lvalue Var 'u64' 'uint64_t':'unsigned long long'
     `-ImplicitCastExpr <col:9> 'uint64_t':'unsigned long long' <FloatingToIntegral>
       `-ImplicitCastExpr <col:9> 'double' <LValueToRValue>
-        `-DeclRefExpr <col:9> 'double' lvalue Var 0x1627fd8 'd' 'double'
+        `-DeclRefExpr <col:9> 'double' lvalue Var 'd' 'double'
   */
   i4 = i1x4;
   /*verify-ast
@@ -487,7 +487,7 @@ float4 test(): SV_Target {
   /*verify-ast
     BinaryOperator <col:3, col:7> 'float' '='
     |-DeclRefExpr <col:3> 'float' lvalue Var 'f' 'float'
-    `-ImplicitCastExpr <col:7> 'float' <FloatingCast>
+    `-ImplicitCastExpr <col:7> 'float' <IntegralToFloating>
       `-ImplicitCastExpr <col:7> 'bool' <LValueToRValue>
         `-DeclRefExpr <col:7> 'bool' lvalue Var 'b' 'bool'
   */
@@ -495,7 +495,7 @@ float4 test(): SV_Target {
   /*verify-ast
     BinaryOperator <col:3, col:7> 'float' '='
     |-DeclRefExpr <col:3> 'float' lvalue Var 'f' 'float'
-    `-ImplicitCastExpr <col:7> 'float' <FloatingCast>
+    `-ImplicitCastExpr <col:7> 'float' <IntegralToFloating>
       `-ImplicitCastExpr <col:7> 'bool' <HLSLVectorToScalarCast>
         `-ImplicitCastExpr <col:7> 'vector<bool, 1>':'vector<bool, 1>' <HLSLVectorTruncationCast>
           `-ImplicitCastExpr <col:7> 'bool4':'vector<bool, 4>' <LValueToRValue>
@@ -533,7 +533,7 @@ float4 test(): SV_Target {
   /*verify-ast
     BinaryOperator <col:3, col:13> 'float4':'vector<float, 4>' '='
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-    `-BinaryOperator <col:8, col:13> 'vector<float, 4>' '*'
+    `-BinaryOperator <col:8, col:13> 'vector<float, 4>':'vector<float, 4>' '*'
       |-ImplicitCastExpr <col:8> 'vector<float, 4>' <HLSLCC_IntegralToFloating>
       | `-ImplicitCastExpr <col:8> 'int4':'vector<int, 4>' <LValueToRValue>
       |   `-DeclRefExpr <col:8> 'int4':'vector<int, 4>' lvalue Var 'i4' 'int4':'vector<int, 4>'
@@ -543,50 +543,50 @@ float4 test(): SV_Target {
   */
   m16f = 0.5 * m16f;
   /*verify-ast
-    BinaryOperator <col:3, col:16> 'min16float':'__fp16' '='
-    |-DeclRefExpr <col:3> 'min16float':'__fp16' lvalue Var 'm16f' 'min16float':'__fp16'
-    `-BinaryOperator <col:10, col:16> '__fp16' '*'
-      |-ImplicitCastExpr <col:10> '__fp16' <FloatingCast>
+    BinaryOperator <col:3, col:16> 'min16float':'min16float' '='
+    |-DeclRefExpr <col:3> 'min16float':'min16float' lvalue Var 'm16f' 'min16float':'min16float'
+    `-BinaryOperator <col:10, col:16> 'min16float':'min16float' '*'
+      |-ImplicitCastExpr <col:10> 'min16float':'min16float' <FloatingCast>
       | `-FloatingLiteral <col:10> 'literal float' 5.000000e-01
-      `-ImplicitCastExpr <col:16> 'min16float':'__fp16' <LValueToRValue>
-        `-DeclRefExpr <col:16> 'min16float':'__fp16' lvalue Var 'm16f' 'min16float':'__fp16'
+      `-ImplicitCastExpr <col:16> 'min16float':'min16float' <LValueToRValue>
+        `-DeclRefExpr <col:16> 'min16float':'min16float' lvalue Var 'm16f' 'min16float':'min16float'
   */
   m16f = 0.5F * m16f;                           /* expected-warning {{conversion from larger type 'float' to smaller type 'min16float', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} */
   /*verify-ast
-    BinaryOperator <col:3, col:17> 'min16float':'__fp16' '='
-    |-DeclRefExpr <col:3> 'min16float':'__fp16' lvalue Var 'm16f' 'min16float':'__fp16'
-    `-ImplicitCastExpr <col:10, col:17> 'min16float':'__fp16' <FloatingCast>
+    BinaryOperator <col:3, col:17> 'min16float':'min16float' '='
+    |-DeclRefExpr <col:3> 'min16float':'min16float' lvalue Var 'm16f' 'min16float':'min16float'
+    `-ImplicitCastExpr <col:10, col:17> 'min16float':'min16float' <FloatingCast>
       `-BinaryOperator <col:10, col:17> 'float' '*'
         |-FloatingLiteral <col:10> 'float' 5.000000e-01
         `-ImplicitCastExpr <col:17> 'float' <FloatingCast>
-          `-ImplicitCastExpr <col:17> 'min16float':'__fp16' <LValueToRValue>
-            `-DeclRefExpr <col:17> 'min16float':'__fp16' lvalue Var 'm16f' 'min16float':'__fp16'
+          `-ImplicitCastExpr <col:17> 'min16float':'min16float' <LValueToRValue>
+            `-DeclRefExpr <col:17> 'min16float':'min16float' lvalue Var 'm16f' 'min16float':'min16float'
   */
   m16f = 0.5L * m16f;                           /* expected-warning {{conversion from larger type 'double' to smaller type 'min16float', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} */
   /*verify-ast
-    BinaryOperator <col:3, col:17> 'min16float':'__fp16' '='
-    |-DeclRefExpr <col:3> 'min16float':'__fp16' lvalue Var 'm16f' 'min16float':'__fp16'
-    `-ImplicitCastExpr <col:10, col:17> 'min16float':'__fp16' <FloatingCast>
+    BinaryOperator <col:3, col:17> 'min16float':'min16float' '='
+    |-DeclRefExpr <col:3> 'min16float':'min16float' lvalue Var 'm16f' 'min16float':'min16float'
+    `-ImplicitCastExpr <col:10, col:17> 'min16float':'min16float' <FloatingCast>
       `-BinaryOperator <col:10, col:17> 'double' '*'
         |-FloatingLiteral <col:10> 'double' 5.000000e-01
         `-ImplicitCastExpr <col:17> 'double' <FloatingCast>
-          `-ImplicitCastExpr <col:17> 'min16float':'__fp16' <LValueToRValue>
-            `-DeclRefExpr <col:17> 'min16float':'__fp16' lvalue Var 'm16f' 'min16float':'__fp16'
+          `-ImplicitCastExpr <col:17> 'min16float':'min16float' <LValueToRValue>
+            `-DeclRefExpr <col:17> 'min16float':'min16float' lvalue Var 'm16f' 'min16float':'min16float'
   */
-  m16f4x4 = i4x4 * (m16f + 1);                  /* fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} */
+  m16f4x4 = i4x4 * (m16f + 1);                  /* expected-warning {{conversion from larger type 'int4x4' to smaller type 'matrix<min16float, 4, 4>', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} */
   /*verify-ast
     BinaryOperator <col:3, col:29> 'min16float4x4':'matrix<min16float, 4, 4>' '='
     |-DeclRefExpr <col:3> 'min16float4x4':'matrix<min16float, 4, 4>' lvalue Var 'm16f4x4' 'min16float4x4':'matrix<min16float, 4, 4>'
-    `-BinaryOperator <col:13, col:29> 'matrix<min16float, 4, 4>' '*'
+    `-BinaryOperator <col:13, col:29> 'matrix<min16float, 4, 4>':'matrix<min16float, 4, 4>' '*'
       |-ImplicitCastExpr <col:13> 'matrix<min16float, 4, 4>' <HLSLCC_IntegralToFloating>
       | `-ImplicitCastExpr <col:13> 'int4x4':'matrix<int, 4, 4>' <LValueToRValue>
       |   `-DeclRefExpr <col:13> 'int4x4':'matrix<int, 4, 4>' lvalue Var 'i4x4' 'int4x4':'matrix<int, 4, 4>'
       `-ImplicitCastExpr <col:20, col:29> 'matrix<min16float, 4, 4>':'matrix<min16float, 4, 4>' <HLSLMatrixSplat>
-        `-ParenExpr <col:20, col:29> '__fp16'
-          `-BinaryOperator <col:21, col:28> '__fp16' '+'
-            |-ImplicitCastExpr <col:21> 'min16float':'__fp16' <LValueToRValue>
-            | `-DeclRefExpr <col:21> 'min16float':'__fp16' lvalue Var 'm16f' 'min16float':'__fp16'
-            `-ImplicitCastExpr <col:28> '__fp16' <IntegralToFloating>
+        `-ParenExpr <col:20, col:29> 'min16float':'min16float'
+          `-BinaryOperator <col:21, col:28> 'min16float':'min16float' '+'
+            |-ImplicitCastExpr <col:21> 'min16float':'min16float' <LValueToRValue>
+            | `-DeclRefExpr <col:21> 'min16float':'min16float' lvalue Var 'm16f' 'min16float':'min16float'
+            `-ImplicitCastExpr <col:28> 'min16float':'min16float' <IntegralToFloating>
               `-IntegerLiteral <col:28> 'literal int' 1
   */
   VERIFY_TYPES(min16float4x4, m16f4x4 * (0.5 + 1));
@@ -594,11 +594,11 @@ float4 test(): SV_Target {
   /*verify-ast
     BinaryOperator <col:3, col:31> 'min16float4x4':'matrix<min16float, 4, 4>' '='
     |-DeclRefExpr <col:3> 'min16float4x4':'matrix<min16float, 4, 4>' lvalue Var 'm16f4x4' 'min16float4x4':'matrix<min16float, 4, 4>'
-    `-BinaryOperator <col:13, col:31> 'matrix<min16float, 4, 4>' '*'
+    `-BinaryOperator <col:13, col:31> 'min16float4x4':'matrix<min16float, 4, 4>' '*'
       |-ImplicitCastExpr <col:13> 'min16float4x4':'matrix<min16float, 4, 4>' <LValueToRValue>
       | `-DeclRefExpr <col:13> 'min16float4x4':'matrix<min16float, 4, 4>' lvalue Var 'm16f4x4' 'min16float4x4':'matrix<min16float, 4, 4>'
       `-ImplicitCastExpr <col:23, col:31> 'matrix<min16float, 4, 4>':'matrix<min16float, 4, 4>' <HLSLMatrixSplat>
-        `-ImplicitCastExpr <col:23, col:31> 'min16float':'__fp16' <FloatingCast>
+        `-ImplicitCastExpr <col:23, col:31> 'min16float':'min16float' <FloatingCast>
           `-ParenExpr <col:23, col:31> 'literal float'
             `-BinaryOperator <col:24, col:30> 'literal float' '+'
               |-FloatingLiteral <col:24> 'literal float' 5.000000e-01
@@ -617,33 +617,7 @@ float4 test(): SV_Target {
             `-DeclRefExpr <col:7> 'int4':'vector<int, 4>' lvalue Var 'i4' 'int4':'vector<int, 4>'
   */
 
-  // TODO: FXC fails this case, but passes other similar cases.  What should we do?
-  i.x = f4 + f1x4 * f4x1 / i1;                  /* expected-warning {{implicit truncation of vector type}} fxc-error {{X3020: type mismatch}} */
-  /*verify-ast
-    BinaryOperator <col:3, col:28> 'int' '='
-    |-HLSLVectorElementExpr <col:3, col:5> 'int' lvalue vectorcomponent x
-    | `-ImplicitCastExpr <col:3> 'vector<int, 1>':'vector<int, 1>' lvalue <HLSLVectorSplat>
-    |   `-DeclRefExpr <col:3> 'int' lvalue Var 'i' 'int'
-    `-ImplicitCastExpr <col:9, col:28> 'int' <FloatingToIntegral>
-      `-ImplicitCastExpr <col:9, col:28> 'float' <HLSLVectorToScalarCast>
-        `-ImplicitCastExpr <col:9, col:28> 'vector<float, 1>':'vector<float, 1>' <HLSLVectorTruncationCast>
-          `-BinaryOperator <col:9, col:28> 'vector<float, 4>' '+'
-            |-ImplicitCastExpr <col:9> 'float4':'vector<float, 4>' <LValueToRValue>
-            | `-DeclRefExpr <col:9> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-            `-BinaryOperator <col:14, col:28> 'vector<float, 4>' '/'
-              |-BinaryOperator <col:14, col:21> 'vector<float, 4>' '*'
-              | |-ImplicitCastExpr <col:14> 'vector<float, 4>':'vector<float, 4>' <HLSLMatrixToVectorCast>
-              | | `-ImplicitCastExpr <col:14> 'float1x4':'matrix<float, 1, 4>' <LValueToRValue>
-              | |   `-DeclRefExpr <col:14> 'float1x4':'matrix<float, 1, 4>' lvalue Var 'f1x4' 'float1x4':'matrix<float, 1, 4>'
-              | `-ImplicitCastExpr <col:21> 'vector<float, 4>':'vector<float, 4>' <HLSLMatrixToVectorCast>
-              |   `-ImplicitCastExpr <col:21> 'float4x1':'matrix<float, 4, 1>' <LValueToRValue>
-              |     `-DeclRefExpr <col:21> 'float4x1':'matrix<float, 4, 1>' lvalue Var 'f4x1' 'float4x1':'matrix<float, 4, 1>'
-              `-ImplicitCastExpr <col:28> 'vector<float, 4>':'vector<float, 4>' <HLSLVectorSplat>
-                `-ImplicitCastExpr <col:28> 'float' <IntegralToFloating>
-                  `-ImplicitCastExpr <col:28> 'int' <HLSLVectorToScalarCast>
-                    `-ImplicitCastExpr <col:28> 'int1':'vector<int, 1>' <LValueToRValue>
-                      `-DeclRefExpr <col:28> 'int1':'vector<int, 1>' lvalue Var 'i1' 'int1':'vector<int, 1>'
-  */
+  i.x = f4 + f1x4 * f4x1 / i1;                  /* expected-error {{cannot convert from 'float4x1' to 'float1x4'}} fxc-error {{X3020: type mismatch}} */
 
   // TODO: fxc passes the following (i4x1 should implicitly cast to float4 for mul op)
   f4x4._m02_m11_m20 = i4x1 * f4;                /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
@@ -653,7 +627,7 @@ float4 test(): SV_Target {
     | `-DeclRefExpr <col:3> 'float4x4':'matrix<float, 4, 4>' lvalue Var 'f4x4' 'float4x4':'matrix<float, 4, 4>'
     `-ImplicitCastExpr <col:23, col:30> 'vector<float, 3>':'vector<float, 3>' <HLSLMatrixToVectorCast>
       `-ImplicitCastExpr <col:23, col:30> 'matrix<float, 3, 1>':'matrix<float, 3, 1>' <HLSLMatrixTruncationCast>
-        `-BinaryOperator <col:23, col:30> 'matrix<float, 4, 1>' '*'
+        `-BinaryOperator <col:23, col:30> 'matrix<float, 4, 1>':'matrix<float, 4, 1>' '*'
           |-ImplicitCastExpr <col:23> 'matrix<float, 4, 1>' <HLSLCC_IntegralToFloating>
           | `-ImplicitCastExpr <col:23> 'int4x1':'matrix<int, 4, 1>' <LValueToRValue>
           |   `-DeclRefExpr <col:23> 'int4x1':'matrix<int, 4, 1>' lvalue Var 'i4x1' 'int4x1':'matrix<int, 4, 1>'
@@ -668,7 +642,7 @@ float4 test(): SV_Target {
     BinaryOperator <col:3, col:15> 'float3':'vector<float, 3>' '='
     |-DeclRefExpr <col:3> 'float3':'vector<float, 3>' lvalue Var 'f3' 'float3':'vector<float, 3>'
     `-ImplicitCastExpr <col:8, col:15> 'vector<float, 3>':'vector<float, 3>' <HLSLMatrixToVectorCast>
-      `-BinaryOperator <col:8, col:15> 'matrix<float, 3, 1>' '*'
+      `-BinaryOperator <col:8, col:15> 'matrix<float, 3, 1>':'matrix<float, 3, 1>' '*'
         |-ImplicitCastExpr <col:8> 'matrix<float, 3, 1>' <HLSLCC_IntegralToFloating>
         | `-ImplicitCastExpr <col:8> 'int3x1':'matrix<int, 3, 1>' <LValueToRValue>
         |   `-DeclRefExpr <col:8> 'int3x1':'matrix<int, 3, 1>' lvalue Var 'i3x1' 'int3x1':'matrix<int, 3, 1>'
@@ -685,8 +659,8 @@ float4 test(): SV_Target {
     |-DeclRefExpr <col:3> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
     `-ConditionalOperator <col:8, col:25> 'vector<bool, 4>'
       |-ImplicitCastExpr <col:8, col:16> 'vector<bool, 4>' <HLSLCC_IntegralToBoolean>
-      | `-ParenExpr <col:8, col:16> 'vector<int, 4>'
-      |   `-BinaryOperator <col:9, col:14> 'vector<int, 4>' '*'
+      | `-ParenExpr <col:8, col:16> 'vector<int, 4>':'vector<int, 4>'
+      |   `-BinaryOperator <col:9, col:14> 'vector<int, 4>':'vector<int, 4>' '*'
       |     |-ImplicitCastExpr <col:9> 'vector<int, 4>' <HLSLCC_IntegralCast>
       |     | `-ImplicitCastExpr <col:9> 'bool4':'vector<bool, 4>' <LValueToRValue>
       |     |   `-DeclRefExpr <col:9> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
@@ -734,10 +708,10 @@ bool1 stresstest() {
                                 `-ParenExpr <col:24, col:765> 'vector<bool, 4>'
                                   `-ConditionalOperator <col:25, col:764> 'vector<bool, 4>'
                                     |-ImplicitCastExpr <col:25, col:457> 'vector<bool, 4>' <HLSLCC_IntegralToBoolean>
-                                    | `-ParenExpr <col:25, col:457> 'vector<int, 4>'
-                                    |   `-BinaryOperator <col:26, col:456> 'vector<int, 4>' '*'
-                                    |     |-ParenExpr <col:26, col:281> 'vector<int, 4>'
-                                    |     | `-BinaryOperator <col:27, col:280> 'vector<int, 4>' '+'
+                                    | `-ParenExpr <col:25, col:457> 'vector<int, 4>':'vector<int, 4>'
+                                    |   `-BinaryOperator <col:26, col:456> 'vector<int, 4>':'vector<int, 4>' '*'
+                                    |     |-ParenExpr <col:26, col:281> 'vector<int, 4>':'vector<int, 4>'
+                                    |     | `-BinaryOperator <col:27, col:280> 'vector<int, 4>':'vector<int, 4>' '+'
                                     |     |   |-ImplicitCastExpr <col:27, col:52> 'vector<int, 4>' <HLSLCC_IntegralCast>
                                     |     |   | `-ParenExpr <col:27, col:52> 'bool4':'vector<bool, 4>'
                                     |     |   |   `-CStyleCastExpr <col:28, col:51> 'bool4':'vector<bool, 4>' <NoOp>
@@ -749,16 +723,16 @@ bool1 stresstest() {
                                     |     |   |             | `-DeclRefExpr <col:36> 'int' lvalue Var 'VarTwo' 'int'
                                     |     |   |             `-ImplicitCastExpr <col:45> 'int' <LValueToRValue>
                                     |     |   |               `-DeclRefExpr <col:45> 'int' lvalue Var 'VarTwo' 'int'
-                                    |     |   `-ParenExpr <col:56, col:280> 'vector<int, 4>'
-                                    |     |     `-BinaryOperator <col:57, col:279> 'vector<int, 4>' '+'
+                                    |     |   `-ParenExpr <col:56, col:280> 'vector<int, 4>':'vector<int, 4>'
+                                    |     |     `-BinaryOperator <col:57, col:279> 'vector<int, 4>':'vector<int, 4>' '+'
                                     |     |       |-ImplicitCastExpr <col:57, col:146> 'vector<int, 4>' <HLSLCC_IntegralCast>
                                     |     |       | `-ParenExpr <col:57, col:146> 'vector<bool, 4>'
                                     |     |       |   `-ConditionalOperator <col:58, col:145> 'vector<bool, 4>'
                                     |     |       |     |-ImplicitCastExpr <col:58, col:98> 'vector<bool, 4>' <HLSLCC_IntegralToBoolean>
-                                    |     |       |     | `-ParenExpr <col:58, col:98> 'vector<int, 4>'
-                                    |     |       |     |   `-BinaryOperator <col:59, col:91> 'vector<int, 4>' '*'
-                                    |     |       |     |     |-ParenExpr <col:59, col:87> 'vector<int, 4>'
-                                    |     |       |     |     | `-BinaryOperator <col:60, col:80> 'vector<int, 4>' '*'
+                                    |     |       |     | `-ParenExpr <col:58, col:98> 'vector<int, 4>':'vector<int, 4>'
+                                    |     |       |     |   `-BinaryOperator <col:59, col:91> 'vector<int, 4>':'vector<int, 4>' '*'
+                                    |     |       |     |     |-ParenExpr <col:59, col:87> 'vector<int, 4>':'vector<int, 4>'
+                                    |     |       |     |     | `-BinaryOperator <col:60, col:80> 'vector<int, 4>':'vector<int, 4>' '*'
                                     |     |       |     |     |   |-ImplicitCastExpr <col:60, col:76> 'vector<int, 4>' <HLSLCC_IntegralCast>
                                     |     |       |     |     |   | `-ParenExpr <col:60, col:76> 'bool4':'vector<bool, 4>'
                                     |     |       |     |     |   |   `-CStyleCastExpr <col:61, col:68> 'bool4':'vector<bool, 4>' <NoOp>
@@ -811,7 +785,7 @@ bool1 stresstest() {
                                     |     |                         |       `-DeclRefExpr <col:208> 'int' lvalue Var 'VarTwo' 'int'
                                     |     |                         `-ParenExpr <col:218, col:276> 'float'
                                     |     |                           `-CStyleCastExpr <col:219, col:275> 'float' <NoOp>
-                                    |     |                             `-ImplicitCastExpr <col:226, col:275> 'float' <FloatingCast>
+                                    |     |                             `-ImplicitCastExpr <col:226, col:275> 'float' <IntegralToFloating>
                                     |     |                               `-HLSLVectorElementExpr <col:226, col:275> 'bool' z
                                     |     |                                 `-ParenExpr <col:226, col:273> 'vector<bool, 3>'
                                     |     |                                   `-ConditionalOperator <col:227, col:272> 'vector<bool, 3>'
@@ -999,13 +973,13 @@ bool1 stresstest() {
                                                     |     | `-DeclRefExpr <col:703> 'float' lvalue Var 'VarZero' 'float'
                                                     |     `-ParenExpr <col:713, col:730> 'float'
                                                     |       `-CStyleCastExpr <col:714, col:729> 'float' <NoOp>
-                                                    |         `-ImplicitCastExpr <col:721, col:729> 'float' <FloatingCast>
+                                                    |         `-ImplicitCastExpr <col:721, col:729> 'float' <IntegralToFloating>
                                                     |           `-ImplicitCastExpr <col:721, col:729> 'bool' <LValueToRValue>
                                                     |             `-HLSLVectorElementExpr <col:721, col:729> 'bool' lvalue vectorcomponent z
                                                     |               `-DeclRefExpr <col:721> 'bool4':'vector<bool, 4>' lvalue Var 'VarNine' 'bool4':'vector<bool, 4>'
                                                     |-ParenExpr <col:735, col:751> 'float'
                                                     | `-CStyleCastExpr <col:736, col:743> 'float' <NoOp>
-                                                    |   `-ImplicitCastExpr <col:743> 'float' <FloatingCast>
+                                                    |   `-ImplicitCastExpr <col:743> 'float' <IntegralToFloating>
                                                     |     `-ImplicitCastExpr <col:743> 'bool' <LValueToRValue>
                                                     |       `-DeclRefExpr <col:743> 'bool' lvalue Var 'VarThree' 'bool'
                                                     `-ImplicitCastExpr <col:755> 'float' <LValueToRValue>

+ 211 - 201
tools/clang/test/HLSL/indexing-operator.hlsl

@@ -70,40 +70,40 @@ float4 test_scalar_indexing()
   float4 f4 = 0;
   f4 += g_b[0];
   /*verify-ast
-    CompoundAssignOperator <col:3, col:14> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:14> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-    `-CXXOperatorCallExpr <col:9, col:14> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:12, col:14> 'vector<float, 4> (*)(vector<uint, 1>) const' <FunctionToPointerDecay>
-      | `-DeclRefExpr <col:12, col:14> 'vector<float, 4> (vector<uint, 1>) const' lvalue CXXMethod 'operator[]' 'vector<float, 4> (vector<uint, 1>) const'
-      |-ImplicitCastExpr <col:9> 'const Buffer<vector<float, 4> >' lvalue <NoOp>
-      | `-DeclRefExpr <col:9> 'Buffer':'Buffer<vector<float, 4> >' lvalue Var 'g_b' 'Buffer':'Buffer<vector<float, 4> >'
-      `-ImplicitCastExpr <col:13> 'vector<uint, 1>':'vector<uint, 1>' <HLSLVectorSplat>
+    `-ImplicitCastExpr <col:9, col:14> 'vector<float, 4>' <LValueToRValue>
+      `-CXXOperatorCallExpr <col:9, col:14> 'const vector<float, 4>' lvalue
+        |-ImplicitCastExpr <col:12, col:14> 'const vector<float, 4> &(*)(unsigned int) const' <FunctionToPointerDecay>
+        | `-DeclRefExpr <col:12, col:14> 'const vector<float, 4> &(unsigned int) const' lvalue CXXMethod 'operator[]' 'const vector<float, 4> &(unsigned int) const'
+        |-ImplicitCastExpr <col:9> 'const Buffer<vector<float, 4> >' lvalue <NoOp>
+        | `-DeclRefExpr <col:9> 'Buffer':'Buffer<vector<float, 4> >' lvalue Var 'g_b' 'Buffer':'Buffer<vector<float, 4> >'
         `-ImplicitCastExpr <col:13> 'unsigned int' <IntegralCast>
           `-IntegerLiteral <col:13> 'literal int' 0
   */
   f4 += g_t1d[0];
   /*verify-ast
-    CompoundAssignOperator <col:3, col:16> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:16> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-    `-CXXOperatorCallExpr <col:9, col:16> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:14, col:16> 'vector<float, 4> (*)(vector<uint, 1>) const' <FunctionToPointerDecay>
-      | `-DeclRefExpr <col:14, col:16> 'vector<float, 4> (vector<uint, 1>) const' lvalue CXXMethod 'operator[]' 'vector<float, 4> (vector<uint, 1>) const'
-      |-ImplicitCastExpr <col:9> 'const Texture1D<vector<float, 4> >' lvalue <NoOp>
-      | `-DeclRefExpr <col:9> 'Texture1D':'Texture1D<vector<float, 4> >' lvalue Var 'g_t1d' 'Texture1D':'Texture1D<vector<float, 4> >'
-      `-ImplicitCastExpr <col:15> 'vector<uint, 1>':'vector<uint, 1>' <HLSLVectorSplat>
+    `-ImplicitCastExpr <col:9, col:16> 'vector<float, 4>' <LValueToRValue>
+      `-CXXOperatorCallExpr <col:9, col:16> 'const vector<float, 4>' lvalue
+        |-ImplicitCastExpr <col:14, col:16> 'const vector<float, 4> &(*)(unsigned int) const' <FunctionToPointerDecay>
+        | `-DeclRefExpr <col:14, col:16> 'const vector<float, 4> &(unsigned int) const' lvalue CXXMethod 'operator[]' 'const vector<float, 4> &(unsigned int) const'
+        |-ImplicitCastExpr <col:9> 'const Texture1D<vector<float, 4> >' lvalue <NoOp>
+        | `-DeclRefExpr <col:9> 'Texture1D':'Texture1D<vector<float, 4> >' lvalue Var 'g_t1d' 'Texture1D':'Texture1D<vector<float, 4> >'
         `-ImplicitCastExpr <col:15> 'unsigned int' <IntegralCast>
           `-IntegerLiteral <col:15> 'literal int' 0
   */
   f4 += g_sb[0];
   /*verify-ast
-    CompoundAssignOperator <col:3, col:15> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:15> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-    `-CXXOperatorCallExpr <col:9, col:15> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:13, col:15> 'vector<float, 4> (*)(vector<uint, 1>) const' <FunctionToPointerDecay>
-      | `-DeclRefExpr <col:13, col:15> 'vector<float, 4> (vector<uint, 1>) const' lvalue CXXMethod 'operator[]' 'vector<float, 4> (vector<uint, 1>) const'
-      |-ImplicitCastExpr <col:9> 'const StructuredBuffer<vector<float, 4> >' lvalue <NoOp>
-      | `-DeclRefExpr <col:9> 'StructuredBuffer<float4>':'StructuredBuffer<vector<float, 4> >' lvalue Var 'g_sb' 'StructuredBuffer<float4>':'StructuredBuffer<vector<float, 4> >'
-      `-ImplicitCastExpr <col:14> 'vector<uint, 1>':'vector<uint, 1>' <HLSLVectorSplat>
+    `-ImplicitCastExpr <col:9, col:15> 'vector<float, 4>' <LValueToRValue>
+      `-CXXOperatorCallExpr <col:9, col:15> 'const vector<float, 4>' lvalue
+        |-ImplicitCastExpr <col:13, col:15> 'const vector<float, 4> &(*)(unsigned int) const' <FunctionToPointerDecay>
+        | `-DeclRefExpr <col:13, col:15> 'const vector<float, 4> &(unsigned int) const' lvalue CXXMethod 'operator[]' 'const vector<float, 4> &(unsigned int) const'
+        |-ImplicitCastExpr <col:9> 'const StructuredBuffer<vector<float, 4> >' lvalue <NoOp>
+        | `-DeclRefExpr <col:9> 'StructuredBuffer<float4>':'StructuredBuffer<vector<float, 4> >' lvalue Var 'g_sb' 'StructuredBuffer<float4>':'StructuredBuffer<vector<float, 4> >'
         `-ImplicitCastExpr <col:14> 'unsigned int' <IntegralCast>
           `-IntegerLiteral <col:14> 'literal int' 0
   */
@@ -138,29 +138,31 @@ float4 test_vector2_indexing()
   f4 += g_sb[offset]; // expected-error {{no viable overloaded operator[] for type 'StructuredBuffer<float4>'}} expected-note {{candidate function [with element = const vector<float, 4> &] not viable: no known conversion from 'int2' to 'unsigned int' for 1st argument}} fxc-error {{X3120: invalid type for index - index must be a scalar, or a vector with the correct number of dimensions}}
   f4 += g_t1da[offset];
   /*verify-ast
-    CompoundAssignOperator <col:3, col:22> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:22> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-    `-CXXOperatorCallExpr <col:9, col:22> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:15, col:22> 'vector<float, 4> (*)(vector<uint, 2>) const' <FunctionToPointerDecay>
-      | `-DeclRefExpr <col:15, col:22> 'vector<float, 4> (vector<uint, 2>) const' lvalue CXXMethod 'operator[]' 'vector<float, 4> (vector<uint, 2>) const'
-      |-ImplicitCastExpr <col:9> 'const Texture1DArray<vector<float, 4> >' lvalue <NoOp>
-      | `-DeclRefExpr <col:9> 'Texture1DArray':'Texture1DArray<vector<float, 4> >' lvalue Var 'g_t1da' 'Texture1DArray':'Texture1DArray<vector<float, 4> >'
-      `-ImplicitCastExpr <col:16> 'vector<uint, 2>' <HLSLCC_IntegralCast>
-        `-ImplicitCastExpr <col:16> 'int2':'vector<int, 2>' <LValueToRValue>
-          `-DeclRefExpr <col:16> 'int2':'vector<int, 2>' lvalue Var 'offset' 'int2':'vector<int, 2>'
+    `-ImplicitCastExpr <col:9, col:22> 'vector<float, 4>' <LValueToRValue>
+      `-CXXOperatorCallExpr <col:9, col:22> 'const vector<float, 4>' lvalue
+        |-ImplicitCastExpr <col:15, col:22> 'const vector<float, 4> &(*)(vector<uint, 2>) const' <FunctionToPointerDecay>
+        | `-DeclRefExpr <col:15, col:22> 'const vector<float, 4> &(vector<uint, 2>) const' lvalue CXXMethod 'operator[]' 'const vector<float, 4> &(vector<uint, 2>) const'
+        |-ImplicitCastExpr <col:9> 'const Texture1DArray<vector<float, 4> >' lvalue <NoOp>
+        | `-DeclRefExpr <col:9> 'Texture1DArray':'Texture1DArray<vector<float, 4> >' lvalue Var 'g_t1da' 'Texture1DArray':'Texture1DArray<vector<float, 4> >'
+        `-ImplicitCastExpr <col:16> 'vector<unsigned int, 2>' <HLSLCC_IntegralCast>
+          `-ImplicitCastExpr <col:16> 'int2':'vector<int, 2>' <LValueToRValue>
+            `-DeclRefExpr <col:16> 'int2':'vector<int, 2>' lvalue Var 'offset' 'int2':'vector<int, 2>'
   */
   f4 += g_t2d[offset];
   /*verify-ast
-    CompoundAssignOperator <col:3, col:21> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:21> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-    `-CXXOperatorCallExpr <col:9, col:21> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:14, col:21> 'vector<float, 4> (*)(vector<uint, 2>) const' <FunctionToPointerDecay>
-      | `-DeclRefExpr <col:14, col:21> 'vector<float, 4> (vector<uint, 2>) const' lvalue CXXMethod 'operator[]' 'vector<float, 4> (vector<uint, 2>) const'
-      |-ImplicitCastExpr <col:9> 'const Texture2D<vector<float, 4> >' lvalue <NoOp>
-      | `-DeclRefExpr <col:9> 'Texture2D':'Texture2D<vector<float, 4> >' lvalue Var 'g_t2d' 'Texture2D':'Texture2D<vector<float, 4> >'
-      `-ImplicitCastExpr <col:15> 'vector<uint, 2>' <HLSLCC_IntegralCast>
-        `-ImplicitCastExpr <col:15> 'int2':'vector<int, 2>' <LValueToRValue>
-          `-DeclRefExpr <col:15> 'int2':'vector<int, 2>' lvalue Var 'offset' 'int2':'vector<int, 2>'
+    `-ImplicitCastExpr <col:9, col:21> 'vector<float, 4>' <LValueToRValue>
+      `-CXXOperatorCallExpr <col:9, col:21> 'const vector<float, 4>' lvalue
+        |-ImplicitCastExpr <col:14, col:21> 'const vector<float, 4> &(*)(vector<uint, 2>) const' <FunctionToPointerDecay>
+        | `-DeclRefExpr <col:14, col:21> 'const vector<float, 4> &(vector<uint, 2>) const' lvalue CXXMethod 'operator[]' 'const vector<float, 4> &(vector<uint, 2>) const'
+        |-ImplicitCastExpr <col:9> 'const Texture2D<vector<float, 4> >' lvalue <NoOp>
+        | `-DeclRefExpr <col:9> 'Texture2D':'Texture2D<vector<float, 4> >' lvalue Var 'g_t2d' 'Texture2D':'Texture2D<vector<float, 4> >'
+        `-ImplicitCastExpr <col:15> 'vector<unsigned int, 2>' <HLSLCC_IntegralCast>
+          `-ImplicitCastExpr <col:15> 'int2':'vector<int, 2>' <LValueToRValue>
+            `-DeclRefExpr <col:15> 'int2':'vector<int, 2>' lvalue Var 'offset' 'int2':'vector<int, 2>'
   */
   // fxc error X3120: invalid type for index - index must be a scalar, or a vector with the correct number of dimensions
   f4 += g_t2da[offset]; // expected-error {{no viable overloaded operator[] for type 'Texture2DArray'}} expected-note {{candidate function [with element = const vector<float, 4> &] not viable: no known conversion from 'vector<int, 2>' to 'vector<uint, 3>' for 1st argument}} fxc-error {{X3120: invalid type for index - index must be a scalar, or a vector with the correct number of dimensions}}
@@ -192,44 +194,47 @@ float4 test_vector3_indexing()
   f4 += g_t2d[offset]; // expected-error {{no viable overloaded operator[] for type 'Texture2D'}} expected-note {{candidate function [with element = const vector<float, 4> &] not viable: no known conversion from 'vector<int, 3>' to 'vector<uint, 2>' for 1st argument}} fxc-error {{X3120: invalid type for index - index must be a scalar, or a vector with the correct number of dimensions}}
   f4 += g_t2da[offset];
   /*verify-ast
-    CompoundAssignOperator <col:3, col:22> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:22> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-    `-CXXOperatorCallExpr <col:9, col:22> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:15, col:22> 'vector<float, 4> (*)(vector<uint, 3>) const' <FunctionToPointerDecay>
-      | `-DeclRefExpr <col:15, col:22> 'vector<float, 4> (vector<uint, 3>) const' lvalue CXXMethod 'operator[]' 'vector<float, 4> (vector<uint, 3>) const'
-      |-ImplicitCastExpr <col:9> 'const Texture2DArray<vector<float, 4> >' lvalue <NoOp>
-      | `-DeclRefExpr <col:9> 'Texture2DArray':'Texture2DArray<vector<float, 4> >' lvalue Var 'g_t2da' 'Texture2DArray':'Texture2DArray<vector<float, 4> >'
-      `-ImplicitCastExpr <col:16> 'vector<uint, 3>' <HLSLCC_IntegralCast>
-        `-ImplicitCastExpr <col:16> 'int3':'vector<int, 3>' <LValueToRValue>
-          `-DeclRefExpr <col:16> 'int3':'vector<int, 3>' lvalue Var 'offset' 'int3':'vector<int, 3>'
+    `-ImplicitCastExpr <col:9, col:22> 'vector<float, 4>' <LValueToRValue>
+      `-CXXOperatorCallExpr <col:9, col:22> 'const vector<float, 4>' lvalue
+        |-ImplicitCastExpr <col:15, col:22> 'const vector<float, 4> &(*)(vector<uint, 3>) const' <FunctionToPointerDecay>
+        | `-DeclRefExpr <col:15, col:22> 'const vector<float, 4> &(vector<uint, 3>) const' lvalue CXXMethod 'operator[]' 'const vector<float, 4> &(vector<uint, 3>) const'
+        |-ImplicitCastExpr <col:9> 'const Texture2DArray<vector<float, 4> >' lvalue <NoOp>
+        | `-DeclRefExpr <col:9> 'Texture2DArray':'Texture2DArray<vector<float, 4> >' lvalue Var 'g_t2da' 'Texture2DArray':'Texture2DArray<vector<float, 4> >'
+        `-ImplicitCastExpr <col:16> 'vector<unsigned int, 3>' <HLSLCC_IntegralCast>
+          `-ImplicitCastExpr <col:16> 'int3':'vector<int, 3>' <LValueToRValue>
+            `-DeclRefExpr <col:16> 'int3':'vector<int, 3>' lvalue Var 'offset' 'int3':'vector<int, 3>'
   */
   // fxc error X3120: invalid type for index - index must be a scalar, or a vector with the correct number of dimensions
   f4 += g_t2dms[offset]; // expected-error {{no viable overloaded operator[] for type 'Texture2DMS<float4, 8>'}} expected-note {{candidate function [with element = const vector<float, 4> &] not viable: no known conversion from 'vector<int, 3>' to 'vector<uint, 2>' for 1st argument}} fxc-error {{X3120: invalid type for index - index must be a scalar, or a vector with the correct number of dimensions}}
   f4 += g_t2dmsa[offset];
   /*verify-ast
-    CompoundAssignOperator <col:3, col:24> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:24> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-    `-CXXOperatorCallExpr <col:9, col:24> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:17, col:24> 'vector<float, 4> (*)(vector<uint, 3>) const' <FunctionToPointerDecay>
-      | `-DeclRefExpr <col:17, col:24> 'vector<float, 4> (vector<uint, 3>) const' lvalue CXXMethod 'operator[]' 'vector<float, 4> (vector<uint, 3>) const'
-      |-ImplicitCastExpr <col:9> 'const Texture2DMSArray<vector<float, 4>, 8>' lvalue <NoOp>
-      | `-DeclRefExpr <col:9> 'Texture2DMSArray<float4, 8>':'Texture2DMSArray<vector<float, 4>, 8>' lvalue Var 'g_t2dmsa' 'Texture2DMSArray<float4, 8>':'Texture2DMSArray<vector<float, 4>, 8>'
-      `-ImplicitCastExpr <col:18> 'vector<uint, 3>' <HLSLCC_IntegralCast>
-        `-ImplicitCastExpr <col:18> 'int3':'vector<int, 3>' <LValueToRValue>
-          `-DeclRefExpr <col:18> 'int3':'vector<int, 3>' lvalue Var 'offset' 'int3':'vector<int, 3>'
+    `-ImplicitCastExpr <col:9, col:24> 'vector<float, 4>' <LValueToRValue>
+      `-CXXOperatorCallExpr <col:9, col:24> 'const vector<float, 4>' lvalue
+        |-ImplicitCastExpr <col:17, col:24> 'const vector<float, 4> &(*)(vector<uint, 3>) const' <FunctionToPointerDecay>
+        | `-DeclRefExpr <col:17, col:24> 'const vector<float, 4> &(vector<uint, 3>) const' lvalue CXXMethod 'operator[]' 'const vector<float, 4> &(vector<uint, 3>) const'
+        |-ImplicitCastExpr <col:9> 'const Texture2DMSArray<vector<float, 4>, 8>' lvalue <NoOp>
+        | `-DeclRefExpr <col:9> 'Texture2DMSArray<float4, 8>':'Texture2DMSArray<vector<float, 4>, 8>' lvalue Var 'g_t2dmsa' 'Texture2DMSArray<float4, 8>':'Texture2DMSArray<vector<float, 4>, 8>'
+        `-ImplicitCastExpr <col:18> 'vector<unsigned int, 3>' <HLSLCC_IntegralCast>
+          `-ImplicitCastExpr <col:18> 'int3':'vector<int, 3>' <LValueToRValue>
+            `-DeclRefExpr <col:18> 'int3':'vector<int, 3>' lvalue Var 'offset' 'int3':'vector<int, 3>'
   */
   f4 += g_t3d[offset];
   /*verify-ast
-    CompoundAssignOperator <col:3, col:21> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:21> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-    `-CXXOperatorCallExpr <col:9, col:21> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:14, col:21> 'vector<float, 4> (*)(vector<uint, 3>) const' <FunctionToPointerDecay>
-      | `-DeclRefExpr <col:14, col:21> 'vector<float, 4> (vector<uint, 3>) const' lvalue CXXMethod 'operator[]' 'vector<float, 4> (vector<uint, 3>) const'
-      |-ImplicitCastExpr <col:9> 'const Texture3D<vector<float, 4> >' lvalue <NoOp>
-      | `-DeclRefExpr <col:9> 'Texture3D':'Texture3D<vector<float, 4> >' lvalue Var 'g_t3d' 'Texture3D':'Texture3D<vector<float, 4> >'
-      `-ImplicitCastExpr <col:15> 'vector<uint, 3>' <HLSLCC_IntegralCast>
-        `-ImplicitCastExpr <col:15> 'int3':'vector<int, 3>' <LValueToRValue>
-          `-DeclRefExpr <col:15> 'int3':'vector<int, 3>' lvalue Var 'offset' 'int3':'vector<int, 3>'
+    `-ImplicitCastExpr <col:9, col:21> 'vector<float, 4>' <LValueToRValue>
+      `-CXXOperatorCallExpr <col:9, col:21> 'const vector<float, 4>' lvalue
+        |-ImplicitCastExpr <col:14, col:21> 'const vector<float, 4> &(*)(vector<uint, 3>) const' <FunctionToPointerDecay>
+        | `-DeclRefExpr <col:14, col:21> 'const vector<float, 4> &(vector<uint, 3>) const' lvalue CXXMethod 'operator[]' 'const vector<float, 4> &(vector<uint, 3>) const'
+        |-ImplicitCastExpr <col:9> 'const Texture3D<vector<float, 4> >' lvalue <NoOp>
+        | `-DeclRefExpr <col:9> 'Texture3D':'Texture3D<vector<float, 4> >' lvalue Var 'g_t3d' 'Texture3D':'Texture3D<vector<float, 4> >'
+        `-ImplicitCastExpr <col:15> 'vector<unsigned int, 3>' <HLSLCC_IntegralCast>
+          `-ImplicitCastExpr <col:15> 'int3':'vector<int, 3>' <LValueToRValue>
+            `-DeclRefExpr <col:15> 'int3':'vector<int, 3>' lvalue Var 'offset' 'int3':'vector<int, 3>'
   */
   // fxc error X3121: array, matrix, vector, or indexable object type expected in index expression
   f4 += g_tc[offset]; // expected-error {{type 'TextureCube' does not provide a subscript operator}} fxc-error {{X3121: array, matrix, vector, or indexable object type expected in index expression}}
@@ -280,21 +285,21 @@ float4 test_mips_double_indexing()
   f4 += g_b.mips[mipSlice][pos]; // expected-error {{no member named 'mips' in 'Buffer<vector<float, 4> >'}} fxc-error {{X3018: invalid subscript 'mips'}}
   f4 += g_t1d.mips[mipSlice][pos];
   /*verify-ast
-    CompoundAssignOperator <col:3, col:33> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:33> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-    `-CXXOperatorCallExpr <col:9, col:33> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:29, col:33> 'vector<float, 4> (*)(vector<uint, 1>) const' <FunctionToPointerDecay>
-      | `-DeclRefExpr <col:29, col:33> 'vector<float, 4> (vector<uint, 1>) const' lvalue CXXMethod 'operator[]' 'vector<float, 4> (vector<uint, 1>) const'
-      |-ImplicitCastExpr <col:9, col:28> 'const Texture1D<vector<float, 4> >::mips_slice_type' <NoOp>
-      | `-CXXOperatorCallExpr <col:9, col:28> 'Texture1D<vector<float, 4> >::mips_slice_type'
-      |   |-ImplicitCastExpr <col:19, col:28> 'Texture1D<vector<float, 4> >::mips_slice_type (*)(unsigned int) const' <FunctionToPointerDecay>
-      |   | `-DeclRefExpr <col:19, col:28> 'Texture1D<vector<float, 4> >::mips_slice_type (unsigned int) const' lvalue CXXMethod 'operator[]' 'Texture1D<vector<float, 4> >::mips_slice_type (unsigned int) const'
-      |   |-ImplicitCastExpr <col:9, col:15> 'const Texture1D<vector<float, 4> >::mips_type' lvalue <NoOp>
-      |   | `-MemberExpr <col:9, col:15> 'Texture1D<vector<float, 4> >::mips_type' lvalue .mips
-      |   |   `-DeclRefExpr <col:9> 'Texture1D':'Texture1D<vector<float, 4> >' lvalue Var 'g_t1d' 'Texture1D':'Texture1D<vector<float, 4> >'
-      |   `-ImplicitCastExpr <col:20> 'uint':'unsigned int' <LValueToRValue>
-      |     `-DeclRefExpr <col:20> 'uint':'unsigned int' lvalue Var 'mipSlice' 'uint':'unsigned int'
-      `-ImplicitCastExpr <col:30> 'vector<uint, 1>':'vector<uint, 1>' <HLSLVectorSplat>
+    `-ImplicitCastExpr <col:9, col:33> 'vector<float, 4>' <LValueToRValue>
+      `-CXXOperatorCallExpr <col:9, col:33> 'const vector<float, 4>' lvalue
+        |-ImplicitCastExpr <col:29, col:33> 'const vector<float, 4> &(*)(unsigned int) const' <FunctionToPointerDecay>
+        | `-DeclRefExpr <col:29, col:33> 'const vector<float, 4> &(unsigned int) const' lvalue CXXMethod 'operator[]' 'const vector<float, 4> &(unsigned int) const'
+        |-ImplicitCastExpr <col:9, col:28> 'const Texture1D<vector<float, 4> >::mips_slice_type' xvalue <NoOp>
+        | `-CXXOperatorCallExpr <col:9, col:28> 'Texture1D<vector<float, 4> >::mips_slice_type' xvalue
+        |   |-ImplicitCastExpr <col:19, col:28> 'Texture1D<vector<float, 4> >::mips_slice_type &&(*)(unsigned int) const' <FunctionToPointerDecay>
+        |   | `-DeclRefExpr <col:19, col:28> 'Texture1D<vector<float, 4> >::mips_slice_type &&(unsigned int) const' lvalue CXXMethod 'operator[]' 'Texture1D<vector<float, 4> >::mips_slice_type &&(unsigned int) const'
+        |   |-ImplicitCastExpr <col:9, col:15> 'const Texture1D<vector<float, 4> >::mips_type' lvalue <NoOp>
+        |   | `-MemberExpr <col:9, col:15> 'Texture1D<vector<float, 4> >::mips_type' lvalue .mips
+        |   |   `-DeclRefExpr <col:9> 'Texture1D':'Texture1D<vector<float, 4> >' lvalue Var 'g_t1d' 'Texture1D':'Texture1D<vector<float, 4> >'
+        |   `-ImplicitCastExpr <col:20> 'uint':'unsigned int' <LValueToRValue>
+        |     `-DeclRefExpr <col:20> 'uint':'unsigned int' lvalue Var 'mipSlice' 'uint':'unsigned int'
         `-ImplicitCastExpr <col:30> 'uint':'unsigned int' <LValueToRValue>
           `-DeclRefExpr <col:30> 'uint':'unsigned int' lvalue Var 'pos' 'uint':'unsigned int'
   */
@@ -304,64 +309,67 @@ float4 test_mips_double_indexing()
   f4 += g_t1da.mips[mipSlice][pos]; // expected-error {{no viable overloaded operator[] for type 'Texture1DArray<vector<float, 4> >::mips_slice_type'}} expected-note {{candidate function [with element = const vector<float, 4> &] not viable: no known conversion from 'uint' to 'vector<uint, 2>' for 1st argument}} fxc-error {{X3120: invalid type for index - index must be a scalar, or a vector with the correct number of dimensions}}
   f4 += g_t1da.mips[mipSlice][pos2];
   /*verify-ast
-    CompoundAssignOperator <col:3, col:35> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:35> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-    `-CXXOperatorCallExpr <col:9, col:35> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:30, col:35> 'vector<float, 4> (*)(vector<uint, 2>) const' <FunctionToPointerDecay>
-      | `-DeclRefExpr <col:30, col:35> 'vector<float, 4> (vector<uint, 2>) const' lvalue CXXMethod 'operator[]' 'vector<float, 4> (vector<uint, 2>) const'
-      |-ImplicitCastExpr <col:9, col:29> 'const Texture1DArray<vector<float, 4> >::mips_slice_type' <NoOp>
-      | `-CXXOperatorCallExpr <col:9, col:29> 'Texture1DArray<vector<float, 4> >::mips_slice_type'
-      |   |-ImplicitCastExpr <col:20, col:29> 'Texture1DArray<vector<float, 4> >::mips_slice_type (*)(unsigned int) const' <FunctionToPointerDecay>
-      |   | `-DeclRefExpr <col:20, col:29> 'Texture1DArray<vector<float, 4> >::mips_slice_type (unsigned int) const' lvalue CXXMethod 'operator[]' 'Texture1DArray<vector<float, 4> >::mips_slice_type (unsigned int) const'
-      |   |-ImplicitCastExpr <col:9, col:16> 'const Texture1DArray<vector<float, 4> >::mips_type' lvalue <NoOp>
-      |   | `-MemberExpr <col:9, col:16> 'Texture1DArray<vector<float, 4> >::mips_type' lvalue .mips
-      |   |   `-DeclRefExpr <col:9> 'Texture1DArray':'Texture1DArray<vector<float, 4> >' lvalue Var 'g_t1da' 'Texture1DArray':'Texture1DArray<vector<float, 4> >'
-      |   `-ImplicitCastExpr <col:21> 'uint':'unsigned int' <LValueToRValue>
-      |     `-DeclRefExpr <col:21> 'uint':'unsigned int' lvalue Var 'mipSlice' 'uint':'unsigned int'
-      `-ImplicitCastExpr <col:31> 'uint2':'vector<uint, 2>' <LValueToRValue>
-        `-DeclRefExpr <col:31> 'uint2':'vector<uint, 2>' lvalue Var 'pos2' 'uint2':'vector<uint, 2>'
+    `-ImplicitCastExpr <col:9, col:35> 'vector<float, 4>' <LValueToRValue>
+      `-CXXOperatorCallExpr <col:9, col:35> 'const vector<float, 4>' lvalue
+        |-ImplicitCastExpr <col:30, col:35> 'const vector<float, 4> &(*)(vector<uint, 2>) const' <FunctionToPointerDecay>
+        | `-DeclRefExpr <col:30, col:35> 'const vector<float, 4> &(vector<uint, 2>) const' lvalue CXXMethod 'operator[]' 'const vector<float, 4> &(vector<uint, 2>) const'
+        |-ImplicitCastExpr <col:9, col:29> 'const Texture1DArray<vector<float, 4> >::mips_slice_type' xvalue <NoOp>
+        | `-CXXOperatorCallExpr <col:9, col:29> 'Texture1DArray<vector<float, 4> >::mips_slice_type' xvalue
+        |   |-ImplicitCastExpr <col:20, col:29> 'Texture1DArray<vector<float, 4> >::mips_slice_type &&(*)(unsigned int) const' <FunctionToPointerDecay>
+        |   | `-DeclRefExpr <col:20, col:29> 'Texture1DArray<vector<float, 4> >::mips_slice_type &&(unsigned int) const' lvalue CXXMethod 'operator[]' 'Texture1DArray<vector<float, 4> >::mips_slice_type &&(unsigned int) const'
+        |   |-ImplicitCastExpr <col:9, col:16> 'const Texture1DArray<vector<float, 4> >::mips_type' lvalue <NoOp>
+        |   | `-MemberExpr <col:9, col:16> 'Texture1DArray<vector<float, 4> >::mips_type' lvalue .mips
+        |   |   `-DeclRefExpr <col:9> 'Texture1DArray':'Texture1DArray<vector<float, 4> >' lvalue Var 'g_t1da' 'Texture1DArray':'Texture1DArray<vector<float, 4> >'
+        |   `-ImplicitCastExpr <col:21> 'uint':'unsigned int' <LValueToRValue>
+        |     `-DeclRefExpr <col:21> 'uint':'unsigned int' lvalue Var 'mipSlice' 'uint':'unsigned int'
+        `-ImplicitCastExpr <col:31> 'uint2':'vector<unsigned int, 2>' <LValueToRValue>
+          `-DeclRefExpr <col:31> 'uint2':'vector<unsigned int, 2>' lvalue Var 'pos2' 'uint2':'vector<unsigned int, 2>'
   */
   // fxc error X3120: invalid type for index - index must be a scalar, or a vector with the correct number of dimensions
   f4 += g_t2d.mips[mipSlice][pos]; // expected-error {{no viable overloaded operator[] for type 'Texture2D<vector<float, 4> >::mips_slice_type'}} expected-note {{candidate function [with element = const vector<float, 4> &] not viable: no known conversion from 'uint' to 'vector<uint, 2>' for 1st argument}} fxc-error {{X3120: invalid type for index - index must be a scalar, or a vector with the correct number of dimensions}}
   f4 += g_t2d.mips[mipSlice][pos2];
   /*verify-ast
-    CompoundAssignOperator <col:3, col:34> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:34> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-    `-CXXOperatorCallExpr <col:9, col:34> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:29, col:34> 'vector<float, 4> (*)(vector<uint, 2>) const' <FunctionToPointerDecay>
-      | `-DeclRefExpr <col:29, col:34> 'vector<float, 4> (vector<uint, 2>) const' lvalue CXXMethod 'operator[]' 'vector<float, 4> (vector<uint, 2>) const'
-      |-ImplicitCastExpr <col:9, col:28> 'const Texture2D<vector<float, 4> >::mips_slice_type' <NoOp>
-      | `-CXXOperatorCallExpr <col:9, col:28> 'Texture2D<vector<float, 4> >::mips_slice_type'
-      |   |-ImplicitCastExpr <col:19, col:28> 'Texture2D<vector<float, 4> >::mips_slice_type (*)(unsigned int) const' <FunctionToPointerDecay>
-      |   | `-DeclRefExpr <col:19, col:28> 'Texture2D<vector<float, 4> >::mips_slice_type (unsigned int) const' lvalue CXXMethod 'operator[]' 'Texture2D<vector<float, 4> >::mips_slice_type (unsigned int) const'
-      |   |-ImplicitCastExpr <col:9, col:15> 'const Texture2D<vector<float, 4> >::mips_type' lvalue <NoOp>
-      |   | `-MemberExpr <col:9, col:15> 'Texture2D<vector<float, 4> >::mips_type' lvalue .mips
-      |   |   `-DeclRefExpr <col:9> 'Texture2D':'Texture2D<vector<float, 4> >' lvalue Var 'g_t2d' 'Texture2D':'Texture2D<vector<float, 4> >'
-      |   `-ImplicitCastExpr <col:20> 'uint':'unsigned int' <LValueToRValue>
-      |     `-DeclRefExpr <col:20> 'uint':'unsigned int' lvalue Var 'mipSlice' 'uint':'unsigned int'
-      `-ImplicitCastExpr <col:30> 'uint2':'vector<uint, 2>' <LValueToRValue>
-        `-DeclRefExpr <col:30> 'uint2':'vector<uint, 2>' lvalue Var 'pos2' 'uint2':'vector<uint, 2>'
+    `-ImplicitCastExpr <col:9, col:34> 'vector<float, 4>' <LValueToRValue>
+      `-CXXOperatorCallExpr <col:9, col:34> 'const vector<float, 4>' lvalue
+        |-ImplicitCastExpr <col:29, col:34> 'const vector<float, 4> &(*)(vector<uint, 2>) const' <FunctionToPointerDecay>
+        | `-DeclRefExpr <col:29, col:34> 'const vector<float, 4> &(vector<uint, 2>) const' lvalue CXXMethod 'operator[]' 'const vector<float, 4> &(vector<uint, 2>) const'
+        |-ImplicitCastExpr <col:9, col:28> 'const Texture2D<vector<float, 4> >::mips_slice_type' xvalue <NoOp>
+        | `-CXXOperatorCallExpr <col:9, col:28> 'Texture2D<vector<float, 4> >::mips_slice_type' xvalue
+        |   |-ImplicitCastExpr <col:19, col:28> 'Texture2D<vector<float, 4> >::mips_slice_type &&(*)(unsigned int) const' <FunctionToPointerDecay>
+        |   | `-DeclRefExpr <col:19, col:28> 'Texture2D<vector<float, 4> >::mips_slice_type &&(unsigned int) const' lvalue CXXMethod 'operator[]' 'Texture2D<vector<float, 4> >::mips_slice_type &&(unsigned int) const'
+        |   |-ImplicitCastExpr <col:9, col:15> 'const Texture2D<vector<float, 4> >::mips_type' lvalue <NoOp>
+        |   | `-MemberExpr <col:9, col:15> 'Texture2D<vector<float, 4> >::mips_type' lvalue .mips
+        |   |   `-DeclRefExpr <col:9> 'Texture2D':'Texture2D<vector<float, 4> >' lvalue Var 'g_t2d' 'Texture2D':'Texture2D<vector<float, 4> >'
+        |   `-ImplicitCastExpr <col:20> 'uint':'unsigned int' <LValueToRValue>
+        |     `-DeclRefExpr <col:20> 'uint':'unsigned int' lvalue Var 'mipSlice' 'uint':'unsigned int'
+        `-ImplicitCastExpr <col:30> 'uint2':'vector<unsigned int, 2>' <LValueToRValue>
+          `-DeclRefExpr <col:30> 'uint2':'vector<unsigned int, 2>' lvalue Var 'pos2' 'uint2':'vector<unsigned int, 2>'
   */
   // fxc error X3120: invalid type for index - index must be a scalar, or a vector with the correct number of dimensions
   f4 += g_t2da.mips[mipSlice][pos]; // expected-error {{no viable overloaded operator[] for type 'Texture2DArray<vector<float, 4> >::mips_slice_type'}} expected-note {{candidate function [with element = const vector<float, 4> &] not viable: no known conversion from 'uint' to 'vector<uint, 3>' for 1st argument}} fxc-error {{X3120: invalid type for index - index must be a scalar, or a vector with the correct number of dimensions}}
   f4 += g_t2da.mips[mipSlice][pos3];
   /*verify-ast
-    CompoundAssignOperator <col:3, col:35> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:35> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-    `-CXXOperatorCallExpr <col:9, col:35> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:30, col:35> 'vector<float, 4> (*)(vector<uint, 3>) const' <FunctionToPointerDecay>
-      | `-DeclRefExpr <col:30, col:35> 'vector<float, 4> (vector<uint, 3>) const' lvalue CXXMethod 'operator[]' 'vector<float, 4> (vector<uint, 3>) const'
-      |-ImplicitCastExpr <col:9, col:29> 'const Texture2DArray<vector<float, 4> >::mips_slice_type' <NoOp>
-      | `-CXXOperatorCallExpr <col:9, col:29> 'Texture2DArray<vector<float, 4> >::mips_slice_type'
-      |   |-ImplicitCastExpr <col:20, col:29> 'Texture2DArray<vector<float, 4> >::mips_slice_type (*)(unsigned int) const' <FunctionToPointerDecay>
-      |   | `-DeclRefExpr <col:20, col:29> 'Texture2DArray<vector<float, 4> >::mips_slice_type (unsigned int) const' lvalue CXXMethod 'operator[]' 'Texture2DArray<vector<float, 4> >::mips_slice_type (unsigned int) const'
-      |   |-ImplicitCastExpr <col:9, col:16> 'const Texture2DArray<vector<float, 4> >::mips_type' lvalue <NoOp>
-      |   | `-MemberExpr <col:9, col:16> 'Texture2DArray<vector<float, 4> >::mips_type' lvalue .mips
-      |   |   `-DeclRefExpr <col:9> 'Texture2DArray':'Texture2DArray<vector<float, 4> >' lvalue Var 'g_t2da' 'Texture2DArray':'Texture2DArray<vector<float, 4> >'
-      |   `-ImplicitCastExpr <col:21> 'uint':'unsigned int' <LValueToRValue>
-      |     `-DeclRefExpr <col:21> 'uint':'unsigned int' lvalue Var 'mipSlice' 'uint':'unsigned int'
-      `-ImplicitCastExpr <col:31> 'uint3':'vector<uint, 3>' <LValueToRValue>
-        `-DeclRefExpr <col:31> 'uint3':'vector<uint, 3>' lvalue Var 'pos3' 'uint3':'vector<uint, 3>'
+    `-ImplicitCastExpr <col:9, col:35> 'vector<float, 4>' <LValueToRValue>
+      `-CXXOperatorCallExpr <col:9, col:35> 'const vector<float, 4>' lvalue
+        |-ImplicitCastExpr <col:30, col:35> 'const vector<float, 4> &(*)(vector<uint, 3>) const' <FunctionToPointerDecay>
+        | `-DeclRefExpr <col:30, col:35> 'const vector<float, 4> &(vector<uint, 3>) const' lvalue CXXMethod 'operator[]' 'const vector<float, 4> &(vector<uint, 3>) const'
+        |-ImplicitCastExpr <col:9, col:29> 'const Texture2DArray<vector<float, 4> >::mips_slice_type' xvalue <NoOp>
+        | `-CXXOperatorCallExpr <col:9, col:29> 'Texture2DArray<vector<float, 4> >::mips_slice_type' xvalue
+        |   |-ImplicitCastExpr <col:20, col:29> 'Texture2DArray<vector<float, 4> >::mips_slice_type &&(*)(unsigned int) const' <FunctionToPointerDecay>
+        |   | `-DeclRefExpr <col:20, col:29> 'Texture2DArray<vector<float, 4> >::mips_slice_type &&(unsigned int) const' lvalue CXXMethod 'operator[]' 'Texture2DArray<vector<float, 4> >::mips_slice_type &&(unsigned int) const'
+        |   |-ImplicitCastExpr <col:9, col:16> 'const Texture2DArray<vector<float, 4> >::mips_type' lvalue <NoOp>
+        |   | `-MemberExpr <col:9, col:16> 'Texture2DArray<vector<float, 4> >::mips_type' lvalue .mips
+        |   |   `-DeclRefExpr <col:9> 'Texture2DArray':'Texture2DArray<vector<float, 4> >' lvalue Var 'g_t2da' 'Texture2DArray':'Texture2DArray<vector<float, 4> >'
+        |   `-ImplicitCastExpr <col:21> 'uint':'unsigned int' <LValueToRValue>
+        |     `-DeclRefExpr <col:21> 'uint':'unsigned int' lvalue Var 'mipSlice' 'uint':'unsigned int'
+        `-ImplicitCastExpr <col:31> 'uint3':'vector<unsigned int, 3>' <LValueToRValue>
+          `-DeclRefExpr <col:31> 'uint3':'vector<unsigned int, 3>' lvalue Var 'pos3' 'uint3':'vector<unsigned int, 3>'
   */
   // fxc error X3018: invalid subscript 'mips'
   f4 += g_t2dms.mips[mipSlice][pos]; // expected-error {{no member named 'mips' in 'Texture2DMS<vector<float, 4>, 8>'}} fxc-error {{X3018: invalid subscript 'mips'}}
@@ -371,22 +379,23 @@ float4 test_mips_double_indexing()
   f4 += g_t3d.mips[mipSlice][pos]; // expected-error {{no viable overloaded operator[] for type 'Texture3D<vector<float, 4> >::mips_slice_type'}} expected-note {{candidate function [with element = const vector<float, 4> &] not viable: no known conversion from 'uint' to 'vector<uint, 3>' for 1st argument}} fxc-error {{X3120: invalid type for index - index must be a scalar, or a vector with the correct number of dimensions}}
   f4 += g_t3d.mips[mipSlice][pos3];
   /*verify-ast
-    CompoundAssignOperator <col:3, col:34> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:34> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-    `-CXXOperatorCallExpr <col:9, col:34> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:29, col:34> 'vector<float, 4> (*)(vector<uint, 3>) const' <FunctionToPointerDecay>
-      | `-DeclRefExpr <col:29, col:34> 'vector<float, 4> (vector<uint, 3>) const' lvalue CXXMethod 'operator[]' 'vector<float, 4> (vector<uint, 3>) const'
-      |-ImplicitCastExpr <col:9, col:28> 'const Texture3D<vector<float, 4> >::mips_slice_type' <NoOp>
-      | `-CXXOperatorCallExpr <col:9, col:28> 'Texture3D<vector<float, 4> >::mips_slice_type'
-      |   |-ImplicitCastExpr <col:19, col:28> 'Texture3D<vector<float, 4> >::mips_slice_type (*)(unsigned int) const' <FunctionToPointerDecay>
-      |   | `-DeclRefExpr <col:19, col:28> 'Texture3D<vector<float, 4> >::mips_slice_type (unsigned int) const' lvalue CXXMethod 'operator[]' 'Texture3D<vector<float, 4> >::mips_slice_type (unsigned int) const'
-      |   |-ImplicitCastExpr <col:9, col:15> 'const Texture3D<vector<float, 4> >::mips_type' lvalue <NoOp>
-      |   | `-MemberExpr <col:9, col:15> 'Texture3D<vector<float, 4> >::mips_type' lvalue .mips
-      |   |   `-DeclRefExpr <col:9> 'Texture3D':'Texture3D<vector<float, 4> >' lvalue Var 'g_t3d' 'Texture3D':'Texture3D<vector<float, 4> >'
-      |   `-ImplicitCastExpr <col:20> 'uint':'unsigned int' <LValueToRValue>
-      |     `-DeclRefExpr <col:20> 'uint':'unsigned int' lvalue Var 'mipSlice' 'uint':'unsigned int'
-      `-ImplicitCastExpr <col:30> 'uint3':'vector<uint, 3>' <LValueToRValue>
-        `-DeclRefExpr <col:30> 'uint3':'vector<uint, 3>' lvalue Var 'pos3' 'uint3':'vector<uint, 3>'
+    `-ImplicitCastExpr <col:9, col:34> 'vector<float, 4>' <LValueToRValue>
+      `-CXXOperatorCallExpr <col:9, col:34> 'const vector<float, 4>' lvalue
+        |-ImplicitCastExpr <col:29, col:34> 'const vector<float, 4> &(*)(vector<uint, 3>) const' <FunctionToPointerDecay>
+        | `-DeclRefExpr <col:29, col:34> 'const vector<float, 4> &(vector<uint, 3>) const' lvalue CXXMethod 'operator[]' 'const vector<float, 4> &(vector<uint, 3>) const'
+        |-ImplicitCastExpr <col:9, col:28> 'const Texture3D<vector<float, 4> >::mips_slice_type' xvalue <NoOp>
+        | `-CXXOperatorCallExpr <col:9, col:28> 'Texture3D<vector<float, 4> >::mips_slice_type' xvalue
+        |   |-ImplicitCastExpr <col:19, col:28> 'Texture3D<vector<float, 4> >::mips_slice_type &&(*)(unsigned int) const' <FunctionToPointerDecay>
+        |   | `-DeclRefExpr <col:19, col:28> 'Texture3D<vector<float, 4> >::mips_slice_type &&(unsigned int) const' lvalue CXXMethod 'operator[]' 'Texture3D<vector<float, 4> >::mips_slice_type &&(unsigned int) const'
+        |   |-ImplicitCastExpr <col:9, col:15> 'const Texture3D<vector<float, 4> >::mips_type' lvalue <NoOp>
+        |   | `-MemberExpr <col:9, col:15> 'Texture3D<vector<float, 4> >::mips_type' lvalue .mips
+        |   |   `-DeclRefExpr <col:9> 'Texture3D':'Texture3D<vector<float, 4> >' lvalue Var 'g_t3d' 'Texture3D':'Texture3D<vector<float, 4> >'
+        |   `-ImplicitCastExpr <col:20> 'uint':'unsigned int' <LValueToRValue>
+        |     `-DeclRefExpr <col:20> 'uint':'unsigned int' lvalue Var 'mipSlice' 'uint':'unsigned int'
+        `-ImplicitCastExpr <col:30> 'uint3':'vector<unsigned int, 3>' <LValueToRValue>
+          `-DeclRefExpr <col:30> 'uint3':'vector<unsigned int, 3>' lvalue Var 'pos3' 'uint3':'vector<unsigned int, 3>'
   */
   // fxc error X3018: invalid subscript 'mips'
   f4 += g_tc.mips[mipSlice][pos]; // expected-error {{no member named 'mips' in 'TextureCube<vector<float, 4> >'}} fxc-error {{X3018: invalid subscript 'mips'}}
@@ -437,43 +446,45 @@ float4 test_sample_double_indexing()
   f4 += g_t2dms.sample[sampleSlice][pos]; // expected-error {{no viable overloaded operator[] for type 'Texture2DMS<vector<float, 4>, 8>::sample_slice_type'}} expected-note {{candidate function [with element = const vector<float, 4> &] not viable: no known conversion from 'uint' to 'vector<uint, 2>' for 1st argument}} fxc-error {{X3120: invalid type for index - index must be a scalar, or a vector with the correct number of dimensions}}
   f4 += g_t2dms.sample[sampleSlice][pos2];
   /*verify-ast
-    CompoundAssignOperator <col:3, col:41> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:41> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-    `-CXXOperatorCallExpr <col:9, col:41> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:36, col:41> 'vector<float, 4> (*)(vector<uint, 2>) const' <FunctionToPointerDecay>
-      | `-DeclRefExpr <col:36, col:41> 'vector<float, 4> (vector<uint, 2>) const' lvalue CXXMethod 'operator[]' 'vector<float, 4> (vector<uint, 2>) const'
-      |-ImplicitCastExpr <col:9, col:35> 'const Texture2DMS<vector<float, 4>, 8>::sample_slice_type' <NoOp>
-      | `-CXXOperatorCallExpr <col:9, col:35> 'Texture2DMS<vector<float, 4>, 8>::sample_slice_type'
-      |   |-ImplicitCastExpr <col:23, col:35> 'Texture2DMS<vector<float, 4>, 8>::sample_slice_type (*)(unsigned int) const' <FunctionToPointerDecay>
-      |   | `-DeclRefExpr <col:23, col:35> 'Texture2DMS<vector<float, 4>, 8>::sample_slice_type (unsigned int) const' lvalue CXXMethod 'operator[]' 'Texture2DMS<vector<float, 4>, 8>::sample_slice_type (unsigned int) const'
-      |   |-ImplicitCastExpr <col:9, col:17> 'const Texture2DMS<vector<float, 4>, 8>::sample_type' lvalue <NoOp>
-      |   | `-MemberExpr <col:9, col:17> 'Texture2DMS<vector<float, 4>, 8>::sample_type' lvalue .sample
-      |   |   `-DeclRefExpr <col:9> 'Texture2DMS<float4, 8>':'Texture2DMS<vector<float, 4>, 8>' lvalue Var 'g_t2dms' 'Texture2DMS<float4, 8>':'Texture2DMS<vector<float, 4>, 8>'
-      |   `-ImplicitCastExpr <col:24> 'uint':'unsigned int' <LValueToRValue>
-      |     `-DeclRefExpr <col:24> 'uint':'unsigned int' lvalue Var 'sampleSlice' 'uint':'unsigned int'
-      `-ImplicitCastExpr <col:37> 'uint2':'vector<uint, 2>' <LValueToRValue>
-        `-DeclRefExpr <col:37> 'uint2':'vector<uint, 2>' lvalue Var 'pos2' 'uint2':'vector<uint, 2>'
+    `-ImplicitCastExpr <col:9, col:41> 'vector<float, 4>' <LValueToRValue>
+      `-CXXOperatorCallExpr <col:9, col:41> 'const vector<float, 4>' lvalue
+        |-ImplicitCastExpr <col:36, col:41> 'const vector<float, 4> &(*)(vector<uint, 2>) const' <FunctionToPointerDecay>
+        | `-DeclRefExpr <col:36, col:41> 'const vector<float, 4> &(vector<uint, 2>) const' lvalue CXXMethod 'operator[]' 'const vector<float, 4> &(vector<uint, 2>) const'
+        |-ImplicitCastExpr <col:9, col:35> 'const Texture2DMS<vector<float, 4>, 8>::sample_slice_type' xvalue <NoOp>
+        | `-CXXOperatorCallExpr <col:9, col:35> 'Texture2DMS<vector<float, 4>, 8>::sample_slice_type' xvalue
+        |   |-ImplicitCastExpr <col:23, col:35> 'Texture2DMS<vector<float, 4>, 8>::sample_slice_type &&(*)(unsigned int) const' <FunctionToPointerDecay>
+        |   | `-DeclRefExpr <col:23, col:35> 'Texture2DMS<vector<float, 4>, 8>::sample_slice_type &&(unsigned int) const' lvalue CXXMethod 'operator[]' 'Texture2DMS<vector<float, 4>, 8>::sample_slice_type &&(unsigned int) const'
+        |   |-ImplicitCastExpr <col:9, col:17> 'const Texture2DMS<vector<float, 4>, 8>::sample_type' lvalue <NoOp>
+        |   | `-MemberExpr <col:9, col:17> 'Texture2DMS<vector<float, 4>, 8>::sample_type' lvalue .sample
+        |   |   `-DeclRefExpr <col:9> 'Texture2DMS<float4, 8>':'Texture2DMS<vector<float, 4>, 8>' lvalue Var 'g_t2dms' 'Texture2DMS<float4, 8>':'Texture2DMS<vector<float, 4>, 8>'
+        |   `-ImplicitCastExpr <col:24> 'uint':'unsigned int' <LValueToRValue>
+        |     `-DeclRefExpr <col:24> 'uint':'unsigned int' lvalue Var 'sampleSlice' 'uint':'unsigned int'
+        `-ImplicitCastExpr <col:37> 'uint2':'vector<unsigned int, 2>' <LValueToRValue>
+          `-DeclRefExpr <col:37> 'uint2':'vector<unsigned int, 2>' lvalue Var 'pos2' 'uint2':'vector<unsigned int, 2>'
   */
   // fxc error X3120: invalid type for index - index must be a scalar, or a vector with the correct number of dimensions
   f4 += g_t2dmsa.sample[sampleSlice][pos]; // expected-error {{no viable overloaded operator[] for type 'Texture2DMSArray<vector<float, 4>, 8>::sample_slice_type'}} expected-note {{candidate function [with element = const vector<float, 4> &] not viable: no known conversion from 'uint' to 'vector<uint, 3>' for 1st argument}} fxc-error {{X3120: invalid type for index - index must be a scalar, or a vector with the correct number of dimensions}}
   f4 += g_t2dmsa.sample[sampleSlice][pos3];
   /*verify-ast
-    CompoundAssignOperator <col:3, col:42> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:42> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
-    `-CXXOperatorCallExpr <col:9, col:42> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:37, col:42> 'vector<float, 4> (*)(vector<uint, 3>) const' <FunctionToPointerDecay>
-      | `-DeclRefExpr <col:37, col:42> 'vector<float, 4> (vector<uint, 3>) const' lvalue CXXMethod 'operator[]' 'vector<float, 4> (vector<uint, 3>) const'
-      |-ImplicitCastExpr <col:9, col:36> 'const Texture2DMSArray<vector<float, 4>, 8>::sample_slice_type' <NoOp>
-      | `-CXXOperatorCallExpr <col:9, col:36> 'Texture2DMSArray<vector<float, 4>, 8>::sample_slice_type'
-      |   |-ImplicitCastExpr <col:24, col:36> 'Texture2DMSArray<vector<float, 4>, 8>::sample_slice_type (*)(unsigned int) const' <FunctionToPointerDecay>
-      |   | `-DeclRefExpr <col:24, col:36> 'Texture2DMSArray<vector<float, 4>, 8>::sample_slice_type (unsigned int) const' lvalue CXXMethod 'operator[]' 'Texture2DMSArray<vector<float, 4>, 8>::sample_slice_type (unsigned int) const'
-      |   |-ImplicitCastExpr <col:9, col:18> 'const Texture2DMSArray<vector<float, 4>, 8>::sample_type' lvalue <NoOp>
-      |   | `-MemberExpr <col:9, col:18> 'Texture2DMSArray<vector<float, 4>, 8>::sample_type' lvalue .sample
-      |   |   `-DeclRefExpr <col:9> 'Texture2DMSArray<float4, 8>':'Texture2DMSArray<vector<float, 4>, 8>' lvalue Var 'g_t2dmsa' 'Texture2DMSArray<float4, 8>':'Texture2DMSArray<vector<float, 4>, 8>'
-      |   `-ImplicitCastExpr <col:25> 'uint':'unsigned int' <LValueToRValue>
-      |     `-DeclRefExpr <col:25> 'uint':'unsigned int' lvalue Var 'sampleSlice' 'uint':'unsigned int'
-      `-ImplicitCastExpr <col:38> 'uint3':'vector<uint, 3>' <LValueToRValue>
-        `-DeclRefExpr <col:38> 'uint3':'vector<uint, 3>' lvalue Var 'pos3' 'uint3':'vector<uint, 3>'
+    `-ImplicitCastExpr <col:9, col:42> 'vector<float, 4>' <LValueToRValue>
+      `-CXXOperatorCallExpr <col:9, col:42> 'const vector<float, 4>' lvalue
+        |-ImplicitCastExpr <col:37, col:42> 'const vector<float, 4> &(*)(vector<uint, 3>) const' <FunctionToPointerDecay>
+        | `-DeclRefExpr <col:37, col:42> 'const vector<float, 4> &(vector<uint, 3>) const' lvalue CXXMethod 'operator[]' 'const vector<float, 4> &(vector<uint, 3>) const'
+        |-ImplicitCastExpr <col:9, col:36> 'const Texture2DMSArray<vector<float, 4>, 8>::sample_slice_type' xvalue <NoOp>
+        | `-CXXOperatorCallExpr <col:9, col:36> 'Texture2DMSArray<vector<float, 4>, 8>::sample_slice_type' xvalue
+        |   |-ImplicitCastExpr <col:24, col:36> 'Texture2DMSArray<vector<float, 4>, 8>::sample_slice_type &&(*)(unsigned int) const' <FunctionToPointerDecay>
+        |   | `-DeclRefExpr <col:24, col:36> 'Texture2DMSArray<vector<float, 4>, 8>::sample_slice_type &&(unsigned int) const' lvalue CXXMethod 'operator[]' 'Texture2DMSArray<vector<float, 4>, 8>::sample_slice_type &&(unsigned int) const'
+        |   |-ImplicitCastExpr <col:9, col:18> 'const Texture2DMSArray<vector<float, 4>, 8>::sample_type' lvalue <NoOp>
+        |   | `-MemberExpr <col:9, col:18> 'Texture2DMSArray<vector<float, 4>, 8>::sample_type' lvalue .sample
+        |   |   `-DeclRefExpr <col:9> 'Texture2DMSArray<float4, 8>':'Texture2DMSArray<vector<float, 4>, 8>' lvalue Var 'g_t2dmsa' 'Texture2DMSArray<float4, 8>':'Texture2DMSArray<vector<float, 4>, 8>'
+        |   `-ImplicitCastExpr <col:25> 'uint':'unsigned int' <LValueToRValue>
+        |     `-DeclRefExpr <col:25> 'uint':'unsigned int' lvalue Var 'sampleSlice' 'uint':'unsigned int'
+        `-ImplicitCastExpr <col:38> 'uint3':'vector<unsigned int, 3>' <LValueToRValue>
+          `-DeclRefExpr <col:38> 'uint3':'vector<unsigned int, 3>' lvalue Var 'pos3' 'uint3':'vector<unsigned int, 3>'
   */
   return f4;
 }
@@ -485,12 +496,12 @@ float fn_sb(const StructuredBuffer < my_struct > sb) {
   /*verify-ast
     DeclStmt <col:3, col:23>
     `-VarDecl <col:3, col:21> col:10 used f4 'float4':'vector<float, 4>' cinit
-      `-MemberExpr <col:15, col:21> 'float4':'vector<float, 4>' .f4
-        `-CXXOperatorCallExpr <col:15, col:19> 'my_struct'
-          |-ImplicitCastExpr <col:17, col:19> 'my_struct (*)(vector<uint, 1>) const' <FunctionToPointerDecay>
-          | `-DeclRefExpr <col:17, col:19> 'my_struct (vector<uint, 1>) const' lvalue CXXMethod 'operator[]' 'my_struct (vector<uint, 1>) const'
-          |-DeclRefExpr <col:15> 'const StructuredBuffer<my_struct>':'const StructuredBuffer<my_struct>' lvalue ParmVar 'sb' 'const StructuredBuffer<my_struct>':'const StructuredBuffer<my_struct>'
-          `-ImplicitCastExpr <col:18> 'vector<uint, 1>':'vector<uint, 1>' <HLSLVectorSplat>
+      `-ImplicitCastExpr <col:15, col:21> 'float4':'vector<float, 4>' <LValueToRValue>
+        `-MemberExpr <col:15, col:21> 'const float4':'const vector<float, 4>' lvalue .f4
+          `-CXXOperatorCallExpr <col:15, col:19> 'const my_struct' lvalue
+            |-ImplicitCastExpr <col:17, col:19> 'const my_struct &(*)(unsigned int) const' <FunctionToPointerDecay>
+            | `-DeclRefExpr <col:17, col:19> 'const my_struct &(unsigned int) const' lvalue CXXMethod 'operator[]' 'const my_struct &(unsigned int) const'
+            |-DeclRefExpr <col:15> 'const StructuredBuffer<my_struct>':'const StructuredBuffer<my_struct>' lvalue ParmVar 'sb' 'const StructuredBuffer<my_struct>':'const StructuredBuffer<my_struct>'
             `-ImplicitCastExpr <col:18> 'unsigned int' <IntegralCast>
               `-IntegerLiteral <col:18> 'literal int' 0
   */
@@ -526,60 +537,59 @@ void my_subscripts()
   //
   i22[1.5][0] = 2; // expected-warning {{implicit conversion from 'literal float' to 'unsigned int' changes value from 1.5 to 1}} fxc-pass {{}}
   /*verify-ast
-    BinaryOperator <col:3, col:17> 'float':'float' '='
-    |-CXXOperatorCallExpr <col:3, col:13> 'float':'float' lvalue
-    | |-ImplicitCastExpr <col:11, col:13> 'float &(*)(unsigned int)' <FunctionToPointerDecay>
-    | | `-DeclRefExpr <col:11, col:13> 'float &(unsigned int)' lvalue CXXMethod 'operator[]' 'float &(unsigned int)'
-    | |-CXXOperatorCallExpr <col:3, col:10> 'vector<float, 2>':'vector<float, 2>' lvalue
-    | | |-ImplicitCastExpr <col:6, col:10> 'vector<float, 2> &(*)(unsigned int)' <FunctionToPointerDecay>
-    | | | `-DeclRefExpr <col:6, col:10> 'vector<float, 2> &(unsigned int)' lvalue CXXMethod 'operator[]' 'vector<float, 2> &(unsigned int)'
+    BinaryOperator <col:3, col:17> 'int':'int' '='
+    |-CXXOperatorCallExpr <col:3, col:13> 'int':'int' lvalue
+    | |-ImplicitCastExpr <col:11, col:13> 'int &(*)(unsigned int)' <FunctionToPointerDecay>
+    | | `-DeclRefExpr <col:11, col:13> 'int &(unsigned int)' lvalue CXXMethod 'operator[]' 'int &(unsigned int)'
+    | |-CXXOperatorCallExpr <col:3, col:10> 'vector<int, 2>':'vector<int, 2>' lvalue
+    | | |-ImplicitCastExpr <col:6, col:10> 'vector<int, 2> &(*)(unsigned int)' <FunctionToPointerDecay>
+    | | | `-DeclRefExpr <col:6, col:10> 'vector<int, 2> &(unsigned int)' lvalue CXXMethod 'operator[]' 'vector<int, 2> &(unsigned int)'
     | | |-DeclRefExpr <col:3> 'int2x2':'matrix<int, 2, 2>' lvalue Var 'i22' 'int2x2':'matrix<int, 2, 2>'
     | | `-ImplicitCastExpr <col:7> 'unsigned int' <FloatingToIntegral>
     | |   `-FloatingLiteral <col:7> 'literal float' 1.500000e+00
     | `-ImplicitCastExpr <col:12> 'unsigned int' <IntegralCast>
     |   `-IntegerLiteral <col:12> 'literal int' 0
-    `-ImplicitCastExpr <col:17> 'float':'float' <IntegralToFloating>
+    `-ImplicitCastExpr <col:17> 'int':'int' <IntegralCast>
       `-IntegerLiteral <col:17> 'literal int' 2
   */
   i22[0] = i2;
   /*verify-ast
-    BinaryOperator <col:3, col:12> 'vector<float, 2>':'vector<float, 2>' '='
-    |-CXXOperatorCallExpr <col:3, col:8> 'vector<float, 2>':'vector<float, 2>' lvalue
-    | |-ImplicitCastExpr <col:6, col:8> 'vector<float, 2> &(*)(unsigned int)' <FunctionToPointerDecay>
-    | | `-DeclRefExpr <col:6, col:8> 'vector<float, 2> &(unsigned int)' lvalue CXXMethod 'operator[]' 'vector<float, 2> &(unsigned int)'
+    BinaryOperator <col:3, col:12> 'vector<int, 2>':'vector<int, 2>' '='
+    |-CXXOperatorCallExpr <col:3, col:8> 'vector<int, 2>':'vector<int, 2>' lvalue
+    | |-ImplicitCastExpr <col:6, col:8> 'vector<int, 2> &(*)(unsigned int)' <FunctionToPointerDecay>
+    | | `-DeclRefExpr <col:6, col:8> 'vector<int, 2> &(unsigned int)' lvalue CXXMethod 'operator[]' 'vector<int, 2> &(unsigned int)'
     | |-DeclRefExpr <col:3> 'int2x2':'matrix<int, 2, 2>' lvalue Var 'i22' 'int2x2':'matrix<int, 2, 2>'
     | `-ImplicitCastExpr <col:7> 'unsigned int' <IntegralCast>
     |   `-IntegerLiteral <col:7> 'literal int' 0
-    `-ImplicitCastExpr <col:12> 'vector<float, 2>' <HLSLCC_IntegralToFloating>
-      `-ImplicitCastExpr <col:12> 'int2':'vector<int, 2>' <LValueToRValue>
-        `-DeclRefExpr <col:12> 'int2':'vector<int, 2>' lvalue Var 'i2' 'int2':'vector<int, 2>'
+    `-ImplicitCastExpr <col:12> 'int2':'vector<int, 2>' <LValueToRValue>
+      `-DeclRefExpr <col:12> 'int2':'vector<int, 2>' lvalue Var 'i2' 'int2':'vector<int, 2>'
   */
 
   // Floats are fine.
   i2[1.5f] = 1; // expected-warning {{implicit conversion from 'float' to 'unsigned int' changes value from 1.5 to 1}} fxc-pass {{}}
   /*verify-ast
-    BinaryOperator <col:3, col:14> 'float':'float' '='
-    |-CXXOperatorCallExpr <col:3, col:10> 'float':'float' lvalue
-    | |-ImplicitCastExpr <col:5, col:10> 'float &(*)(unsigned int)' <FunctionToPointerDecay>
-    | | `-DeclRefExpr <col:5, col:10> 'float &(unsigned int)' lvalue CXXMethod 'operator[]' 'float &(unsigned int)'
+    BinaryOperator <col:3, col:14> 'int':'int' '='
+    |-CXXOperatorCallExpr <col:3, col:10> 'int':'int' lvalue
+    | |-ImplicitCastExpr <col:5, col:10> 'int &(*)(unsigned int)' <FunctionToPointerDecay>
+    | | `-DeclRefExpr <col:5, col:10> 'int &(unsigned int)' lvalue CXXMethod 'operator[]' 'int &(unsigned int)'
     | |-DeclRefExpr <col:3> 'int2':'vector<int, 2>' lvalue Var 'i2' 'int2':'vector<int, 2>'
     | `-ImplicitCastExpr <col:6> 'unsigned int' <FloatingToIntegral>
     |   `-FloatingLiteral <col:6> 'float' 1.500000e+00
-    `-ImplicitCastExpr <col:14> 'float':'float' <IntegralToFloating>
+    `-ImplicitCastExpr <col:14> 'int':'int' <IntegralCast>
       `-IntegerLiteral <col:14> 'literal int' 1
   */
   float fone = 1;
   i2[fone] = 1;
   /*verify-ast
-    BinaryOperator <col:3, col:14> 'float':'float' '='
-    |-CXXOperatorCallExpr <col:3, col:10> 'float':'float' lvalue
-    | |-ImplicitCastExpr <col:5, col:10> 'float &(*)(unsigned int)' <FunctionToPointerDecay>
-    | | `-DeclRefExpr <col:5, col:10> 'float &(unsigned int)' lvalue CXXMethod 'operator[]' 'float &(unsigned int)'
+    BinaryOperator <col:3, col:14> 'int':'int' '='
+    |-CXXOperatorCallExpr <col:3, col:10> 'int':'int' lvalue
+    | |-ImplicitCastExpr <col:5, col:10> 'int &(*)(unsigned int)' <FunctionToPointerDecay>
+    | | `-DeclRefExpr <col:5, col:10> 'int &(unsigned int)' lvalue CXXMethod 'operator[]' 'int &(unsigned int)'
     | |-DeclRefExpr <col:3> 'int2':'vector<int, 2>' lvalue Var 'i2' 'int2':'vector<int, 2>'
     | `-ImplicitCastExpr <col:6> 'unsigned int' <FloatingToIntegral>
     |   `-ImplicitCastExpr <col:6> 'float' <LValueToRValue>
     |     `-DeclRefExpr <col:6> 'float' lvalue Var 'fone' 'float'
-    `-ImplicitCastExpr <col:14> 'float':'float' <IntegralToFloating>
+    `-ImplicitCastExpr <col:14> 'int':'int' <IntegralCast>
       `-IntegerLiteral <col:14> 'literal int' 1
   */
   // fxc error X3121: array, matrix, vector, or indexable object type expected in index expression

+ 78 - 78
tools/clang/test/HLSL/literals.hlsl

@@ -18,19 +18,19 @@
 
 float overload1(float v) { return (float)100; }             /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} fxc-pass {{}} */
 int overload1(int v) { return (int)200; }                   /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} fxc-pass {{}} */
-uint overload1(uint v) { return (uint)300; }                /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}}  expected-note {{candidate function}}  expected-note {{candidate function}}  expected-note {{candidate function}}  expected-note {{candidate function}}  fxc-pass {{}} */
-bool overload1(bool v) { return (bool)400; }                /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}}  expected-note {{candidate function}}  expected-note {{candidate function}}  expected-note {{candidate function}}  expected-note {{candidate function}} fxc-pass {{}} */
-double overload1(double v) { return (double)500; }          /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}}  expected-note {{candidate function}}  expected-note {{candidate function}}  expected-note {{candidate function}}  expected-note {{candidate function}} fxc-pass {{}} */
-int64_t overload1(int64_t v) { return (int64_t)600; }                   /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}}  expected-note {{candidate function}}  expected-note {{candidate function}}  expected-note {{candidate function}}  expected-note {{candidate function}} fxc-pass {{}} */
-uint64_t overload1(uint64_t v) { return (uint64_t)700; }                /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}}  expected-note {{candidate function}}  expected-note {{candidate function}}  expected-note {{candidate function}}  expected-note {{candidate function}} fxc-pass {{}} */
+uint overload1(uint v) { return (uint)300; }                /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} fxc-pass {{}} */
+bool overload1(bool v) { return (bool)400; }                /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} fxc-pass {{}} */
+double overload1(double v) { return (double)500; }          /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} fxc-pass {{}} */
+int64_t overload1(int64_t v) { return (int64_t)600; }                   /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+uint64_t overload1(uint64_t v) { return (uint64_t)700; }                /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
 
 float overload2(float v1, float v2) { return (float)100; }
 int overload2(int v1, int v2) { return (int)200; }
 uint overload2(uint v1, uint v2) { return (uint)300; }
 bool overload2(bool v1, bool v2) { return (bool)400; }
 double overload2(double v1, double v2) { return (double)500; }
-int64_t overload2(int64_t v1, int64_t v2) { return (int64_t)600; }
-uint64_t overload2(uint64_t v1, uint64_t v2) { return (uint64_t)700; }
+int64_t overload2(int64_t v1, int64_t v2) { return (int64_t)600; }      /* fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+uint64_t overload2(uint64_t v1, uint64_t v2) { return (uint64_t)700; }  /* fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
 
 min16float m16f;
 min16float4x4 m16f4x4;
@@ -40,26 +40,26 @@ float test() {
   VERIFY_TYPES(float, overload1(1.5));                      /* expected-error {{call to 'overload1' is ambiguous}} fxc-error {{X3067: 'overload1': ambiguous function call}} */
   VERIFY_TYPES(int, overload1(20));                         /* expected-error {{call to 'overload1' is ambiguous}} fxc-error {{X3067: 'overload1': ambiguous function call}} */
   VERIFY_TYPES(int, overload1(-2));                         /* expected-error {{call to 'overload1' is ambiguous}} fxc-error {{X3067: 'overload1': ambiguous function call}} */
-  VERIFY_TYPES(uint64_t, overload1(20));                         /* expected-error {{call to 'overload1' is ambiguous}} fxc-error {{X3067: 'overload1': ambiguous function call}} */
-  VERIFY_TYPES(int64_t, overload1(-2));                         /* expected-error {{call to 'overload1' is ambiguous}} fxc-error {{X3067: 'overload1': ambiguous function call}} */
-  
+  VERIFY_TYPES(uint64_t, overload1(20));                         /* expected-error {{call to 'overload1' is ambiguous}} fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+  VERIFY_TYPES(int64_t, overload1(-2));                         /* expected-error {{call to 'overload1' is ambiguous}} fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+
   // Single-digit literals take a special path:
   VERIFY_TYPES(int, overload1(2));                          /* expected-error {{call to 'overload1' is ambiguous}} fxc-error {{X3067: 'overload1': ambiguous function call}} */
-  VERIFY_TYPES(uint64_t, overload1(2));                          /* expected-error {{call to 'overload1' is ambiguous}} fxc-error {{X3067: 'overload1': ambiguous function call}} */
-  VERIFY_TYPES(int64_t, overload1(2));                          /* expected-error {{call to 'overload1' is ambiguous}} fxc-error {{X3067: 'overload1': ambiguous function call}} */
+  VERIFY_TYPES(uint64_t, overload1(2));                          /* expected-error {{call to 'overload1' is ambiguous}} fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+  VERIFY_TYPES(int64_t, overload1(2));                          /* expected-error {{call to 'overload1' is ambiguous}} fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
 
   // ambiguous to fxc, since it ignores 'L' on literal int
   VERIFY_TYPES(int, overload1(2l));                         /* fxc-error {{X3067: 'overload1': ambiguous function call}} */
   VERIFY_TYPES(int, overload1(2L));                         /* fxc-error {{X3067: 'overload1': ambiguous function call}} */
   VERIFY_TYPES(int, overload1(-2L));                        /* fxc-error {{X3067: 'overload1': ambiguous function call}} */
-  VERIFY_TYPES(int64_t, overload1(2l));                     /* expected-error {{static_assert failed "int64_t == __decltype(overload1(2l)) failed"}}  fxc-error {{X3067: 'overload1': ambiguous function call}} */
-  VERIFY_TYPES(int64_t, overload1(2L));                     /* expected-error {{static_assert failed "int64_t == __decltype(overload1(2L)) failed"}}  fxc-error {{X3067: 'overload1': ambiguous function call}} */
-  VERIFY_TYPES(int64_t, overload1(-2L));                    /* expected-error {{static_assert failed "int64_t == __decltype(overload1(-2L)) failed"}} fxc-error {{X3067: 'overload1': ambiguous function call}} */
-  VERIFY_TYPES(uint64_t, overload1(2l));                    /* expected-error {{static_assert failed "uint64_t == __decltype(overload1(2l)) failed"}} fxc-error {{X3067: 'overload1': ambiguous function call}} */
-  VERIFY_TYPES(uint64_t, overload1(2L));                    /* expected-error {{static_assert failed "uint64_t == __decltype(overload1(2L)) failed"}} fxc-error {{X3067: 'overload1': ambiguous function call}} */
-  VERIFY_TYPES(uint64_t, overload1(-2L));                   /* expected-error {{static_assert failed "uint64_t == __decltype(overload1(-2L)) failed"}} fxc-error {{X3067: 'overload1': ambiguous function call}} */
-
-  
+  VERIFY_TYPES(int64_t, overload1(2l));                     /* expected-error {{static_assert failed "int64_t == __decltype(overload1(2l)) failed"}} fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+  VERIFY_TYPES(int64_t, overload1(2L));                     /* expected-error {{static_assert failed "int64_t == __decltype(overload1(2L)) failed"}} fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+  VERIFY_TYPES(int64_t, overload1(-2L));                    /* expected-error {{static_assert failed "int64_t == __decltype(overload1(-2L)) failed"}} fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+  VERIFY_TYPES(uint64_t, overload1(2l));                    /* expected-error {{static_assert failed "uint64_t == __decltype(overload1(2l)) failed"}} fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+  VERIFY_TYPES(uint64_t, overload1(2L));                    /* expected-error {{static_assert failed "uint64_t == __decltype(overload1(2L)) failed"}} fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+  VERIFY_TYPES(uint64_t, overload1(-2L));                   /* expected-error {{static_assert failed "uint64_t == __decltype(overload1(-2L)) failed"}} fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+
+
   // Not ambiguous due to literal suffix:
   VERIFY_TYPES(float, overload1(1.5f));
   VERIFY_TYPES(float, overload1(1.5F));
@@ -68,11 +68,11 @@ float test() {
   VERIFY_TYPES(uint, overload1(2u));
   VERIFY_TYPES(uint, overload1(2U));
   VERIFY_TYPES(uint, overload1(2UL));
-  VERIFY_TYPES(uint64_t, overload1(2ull));
-  VERIFY_TYPES(uint64_t, overload1(2ULL));
-  VERIFY_TYPES(int64_t, overload1(2ll));
-  VERIFY_TYPES(int64_t, overload1(2LL));
-  
+  VERIFY_TYPES(uint64_t, overload1(2ull));                  /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+  VERIFY_TYPES(uint64_t, overload1(2ULL));                  /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+  VERIFY_TYPES(int64_t, overload1(2ll));                    /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+  VERIFY_TYPES(int64_t, overload1(2LL));                    /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+
   // Not ambiguous due to one literal and one specific:
   VERIFY_TYPES(float, overload2(1.5, 1.5f));
   VERIFY_TYPES(float, overload2(1.5f, 1.5));
@@ -82,44 +82,44 @@ float test() {
   VERIFY_TYPES(uint, overload2(2u, 2));
   VERIFY_TYPES(uint, overload2(2, 2ul));
   VERIFY_TYPES(uint, overload2(2ul, 2));
-  
-  VERIFY_TYPES(uint64_t, overload2(2, 2ull));
-  VERIFY_TYPES(uint64_t, overload2(2ull, 2));
-  VERIFY_TYPES(uint64_t, overload2(2, 2ULL));
-  VERIFY_TYPES(uint64_t, overload2(2ULL, 2));  
-  
-  VERIFY_TYPES(int64_t, overload2(2, 2ll));
-  VERIFY_TYPES(int64_t, overload2(2ll, 2));
-  VERIFY_TYPES(int64_t, overload2(2, 2LL));
-  VERIFY_TYPES(int64_t, overload2(2LL, 2));
+
+  VERIFY_TYPES(uint64_t, overload2(2, 2ull));               /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+  VERIFY_TYPES(uint64_t, overload2(2ull, 2));               /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+  VERIFY_TYPES(uint64_t, overload2(2, 2ULL));               /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+  VERIFY_TYPES(uint64_t, overload2(2ULL, 2));               /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+
+  VERIFY_TYPES(int64_t, overload2(2, 2ll));                 /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+  VERIFY_TYPES(int64_t, overload2(2ll, 2));                 /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+  VERIFY_TYPES(int64_t, overload2(2, 2LL));                 /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+  VERIFY_TYPES(int64_t, overload2(2LL, 2));                 /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
 
   // Verify that intrinsics will accept 64-bit overloads properly.
-  VERIFY_TYPES(uint64_t, abs(2ULL));
-  VERIFY_TYPES(uint, countbits(2ULL));
-  VERIFY_TYPES(uint2, countbits(uint64_t2(2ULL, 3ULL)));
-  VERIFY_TYPES(uint, firstbithigh(2ULL));
-  VERIFY_TYPES(uint2, firstbithigh(uint64_t2(2ULL, 3ULL)));
-  VERIFY_TYPES(uint, firstbitlow(2ULL));
-  VERIFY_TYPES(uint2, firstbitlow(uint64_t2(2ULL, 3ULL)));
+  VERIFY_TYPES(uint64_t, abs(2ULL));                        /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+  VERIFY_TYPES(uint, countbits(2ULL));                      /* fxc-error {{X3000: syntax error: unexpected token 'L'}} fxc-error {{X3013:     countbits(uint)}} fxc-error {{X3013: 'countbits': no matching 0 parameter intrinsic function}} fxc-error {{X3013: Possible intrinsic functions are:}} */
+  VERIFY_TYPES(uint2, countbits(uint64_t2(2ULL, 3ULL)));    /* fxc-error {{X3000: syntax error: unexpected token 'L'}} fxc-error {{X3004: undeclared identifier 'uint64_t2'}} */
+  VERIFY_TYPES(uint, firstbithigh(2ULL));                   /* fxc-error {{X3000: syntax error: unexpected token 'L'}} fxc-error {{X3013:     firstbithigh(int|uint)}} fxc-error {{X3013: 'firstbithigh': no matching 0 parameter intrinsic function}} fxc-error {{X3013: Possible intrinsic functions are:}} */
+  VERIFY_TYPES(uint2, firstbithigh(uint64_t2(2ULL, 3ULL))); /* fxc-error {{X3000: syntax error: unexpected token 'L'}} fxc-error {{X3004: undeclared identifier 'uint64_t2'}} */
+  VERIFY_TYPES(uint, firstbitlow(2ULL));                    /* fxc-error {{X3000: syntax error: unexpected token 'L'}} fxc-error {{X3013:     firstbitlow(uint)}} fxc-error {{X3013: 'firstbitlow': no matching 0 parameter intrinsic function}} fxc-error {{X3013: Possible intrinsic functions are:}} */
+  VERIFY_TYPES(uint2, firstbitlow(uint64_t2(2ULL, 3ULL)));  /* fxc-error {{X3000: syntax error: unexpected token 'L'}} fxc-error {{X3004: undeclared identifier 'uint64_t2'}} */
   VERIFY_TYPES(uint, reversebits(2u));
-  VERIFY_TYPES(uint64_t, reversebits(2ULL));
-  
+  VERIFY_TYPES(uint64_t, reversebits(2ULL));                /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+
   // fxc thinks these are ambiguous since it ignores the 'l' suffix:
   VERIFY_TYPES(int, overload2(2, 2l));                      /* fxc-error {{X3067: 'overload2': ambiguous function call}} */
   VERIFY_TYPES(int, overload2(2l, 2));                      /* fxc-error {{X3067: 'overload2': ambiguous function call}} */
-  VERIFY_TYPES(int64_t, overload2(2, 2l));                  /* expected-error {{static_assert failed "int64_t == __decltype(overload2(2, 2l)) failed"}} fxc-error {{X3067: 'overload2': ambiguous function call}} */
-  VERIFY_TYPES(int64_t, overload2(2l, 2));                  /* expected-error {{static_assert failed "int64_t == __decltype(overload2(2l, 2)) failed"}} fxc-error {{X3067: 'overload2': ambiguous function call}} */
-  VERIFY_TYPES(uint64_t, overload2(2, 2l));                 /* expected-error {{static_assert failed "uint64_t == __decltype(overload2(2, 2l)) failed"}} fxc-error {{X3067: 'overload2': ambiguous function call}} */
-  VERIFY_TYPES(uint64_t, overload2(2l, 2));                 /* expected-error {{static_assert failed "uint64_t == __decltype(overload2(2l, 2)) failed"}} fxc-error {{X3067: 'overload2': ambiguous function call}} */
+  VERIFY_TYPES(int64_t, overload2(2, 2l));                  /* expected-error {{static_assert failed "int64_t == __decltype(overload2(2, 2l)) failed"}} fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+  VERIFY_TYPES(int64_t, overload2(2l, 2));                  /* expected-error {{static_assert failed "int64_t == __decltype(overload2(2l, 2)) failed"}} fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+  VERIFY_TYPES(uint64_t, overload2(2, 2l));                 /* expected-error {{static_assert failed "uint64_t == __decltype(overload2(2, 2l)) failed"}} fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+  VERIFY_TYPES(uint64_t, overload2(2l, 2));                 /* expected-error {{static_assert failed "uint64_t == __decltype(overload2(2l, 2)) failed"}} fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
 
   // long long not supported:
   long long l;                                              /* expected-error {{'long' is a reserved keyword in HLSL}} expected-error {{'long' is a reserved keyword in HLSL}} expected-error {{HLSL requires a type specifier for all declarations}} fxc-error {{X3000: unrecognized identifier 'long'}} */
   VERIFY_TYPES(int, 2LL);                                   /* expected-error {{static_assert failed "int == __decltype(2LL) failed"}} fxc-error {{X3000: syntax error: unexpected token 'L'}} */
   VERIFY_TYPES(int, 2ULL);                                  /* expected-error {{static_assert failed "int == __decltype(2ULL) failed"}} fxc-error {{X3000: syntax error: unexpected token 'L'}} */
-  VERIFY_TYPES(double, overload1(2ULL * 1.5));              /* expected-error {{static_assert failed "double == __decltype(overload1(2ULL * 1.5)) failed"}} fxc-error {{X3000: syntax error: unexpected token 'L'}} */
-  VERIFY_TYPES(double, overload1(2ULL * 1.5L));
-  
-  
+  VERIFY_TYPES(double, overload1(2ULL * 1.5));              /* expected-error {{static_assert failed "double == __decltype(overload1(2ULL * 1.5)) failed"}} fxc-error {{X3000: syntax error: unexpected token 'L'}} fxc-error {{X3013: 'overload1': no matching 0 parameter function}} */
+  VERIFY_TYPES(double, overload1(2ULL * 1.5L));             /* fxc-error {{X3000: syntax error: unexpected token 'L'}} fxc-error {{X3013: 'overload1': no matching 0 parameter function}} */
+
+
   // ensure operator combinations produce the right literal types and concrete types
   VERIFY_TYPES(float, 1.5 * 2 * 1.5f);
   VERIFY_TYPES(float, 1.5 * 2 * 1.5F);
@@ -128,9 +128,9 @@ float test() {
   VERIFY_TYPES(int, 2 * 2L);
   VERIFY_TYPES(uint, 2 * 2U);
   VERIFY_TYPES(uint, 2 * 2UL);
-  VERIFY_TYPES(int64_t, 2 * 2LL);
-  VERIFY_TYPES(uint64_t, 2 * 2ULL);
-  
+  VERIFY_TYPES(int64_t, 2 * 2LL);                           /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
+  VERIFY_TYPES(uint64_t, 2 * 2ULL);                         /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
+
   // Specific width int forces float to be specific-width
   VERIFY_TYPES(float, 1.5 * 2 * 2L);
   VERIFY_TYPES(float, 1.5 * 2 * 2U);
@@ -139,17 +139,17 @@ float test() {
   VERIFY_TYPES(float, m16f * (1.5 * 2 * 2L));
 
   // Infinity literals are floats.
-  _Static_assert(0x7f800000 == asuint(1.#INF), "inf bit pattern");
-  _Static_assert(0xff800000 == asuint(-1.#INF), "-inf bit pattern");
+  _Static_assert(0x7f800000 == asuint(1.#INF), "inf bit pattern");    /* fxc-error {{X1516: not enough actual parameters for macro '_Static_assert'}} fxc-error {{X3004: undeclared identifier '_Static_assert'}} */
+  _Static_assert(0xff800000 == asuint(-1.#INF), "-inf bit pattern");    /* fxc-error {{X1516: not enough actual parameters for macro '_Static_assert'}} fxc-error {{X3004: undeclared identifier '_Static_assert'}} */
   float3 vec_syn = 1.#INF.xxx; // vector syntax
-  float bad_inf_0 = 1#;      /* expected-error {{invalid suffix '#' on integer constant}} */
-  float bad_inf_1 = 1#INF;   /* expected-error {{invalid suffix '#INF' on integer constant}} */
-  float bad_inf_2 = 1.#;     /* expected-error {{invalid suffix '#' on floating constant}} */
-  float bad_inf_3 = 1.#I;    /* expected-error {{invalid suffix '#I' on floating constant}} */
-  float bad_inf_4 = 1.#IN;   /* expected-error {{invalid suffix '#IN' on floating constant}} */
-  float bad_inf_5 = 1.#INFI; /* expected-error {{invalid suffix 'I' on floating constant}} */
-  float bad_inf_6 = 0#INF;   /* expected-error {{invalid suffix '#INF' on integer constant}} */
-  float bad_inf_7 = 0.#INF;  /* expected-error {{invalid suffix '#INF' on floating constant}} */
+  float bad_inf_0 = 1#;      /* expected-error {{invalid suffix '#' on integer constant}} fxc-error {{X3000: syntax error: unexpected token '#'}} */
+  float bad_inf_1 = 1#INF;   /* expected-error {{invalid suffix '#INF' on integer constant}} fxc-error {{X3000: syntax error: unexpected token '#'}} */
+  float bad_inf_2 = 1.#;     /* expected-error {{invalid suffix '#' on floating constant}} fxc-error {{X3000: syntax error: unexpected token '#'}} */
+  float bad_inf_3 = 1.#I;    /* expected-error {{invalid suffix '#I' on floating constant}} fxc-error {{X3000: syntax error: unexpected token '#'}} */
+  float bad_inf_4 = 1.#IN;   /* expected-error {{invalid suffix '#IN' on floating constant}} fxc-error {{X3000: syntax error: unexpected token '#'}} */
+  float bad_inf_5 = 1.#INFI; /* expected-error {{invalid suffix 'I' on floating constant}} fxc-error {{X3000: syntax error: unexpected token 'I'}} */
+  float bad_inf_6 = 0#INF;   /* expected-error {{invalid suffix '#INF' on integer constant}} fxc-error {{X3000: syntax error: unexpected token '#'}} */
+  float bad_inf_7 = 0.#INF;  /* expected-error {{invalid suffix '#INF' on floating constant}} fxc-error {{X3000: syntax error: unexpected token '#'}} */
 
   // Combination of literal float + literal int to literal float, then combined with
   // min-precision float matrix to produce min-precision float matrix - ensures that
@@ -157,14 +157,14 @@ float test() {
   VERIFY_TYPES(min16float4x4, m16f4x4 * (0.5 + 1));
 
   // Ensure Conversion works.
-  VERIFY_TYPE_CONVERSION(min10float, 1.5f);  /* expected-warning {{min10float is promoted to min16float}} */
-  VERIFY_TYPE_CONVERSION(min10float, 0.25l); /* expected-warning {{min10float is promoted to min16float}} */
+  VERIFY_TYPE_CONVERSION(min10float, 1.5f);  /* expected-warning {{min10float is promoted to min16float}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} */
+  VERIFY_TYPE_CONVERSION(min10float, 0.25l); /* expected-warning {{min10float is promoted to min16float}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} */
 
-  VERIFY_TYPE_CONVERSION(min16float, 1.5f);
-  VERIFY_TYPE_CONVERSION(min16float, 2.5l);
+  VERIFY_TYPE_CONVERSION(min16float, 1.5f);  /* fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} */
+  VERIFY_TYPE_CONVERSION(min16float, 2.5l);  /* fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} */
 
   VERIFY_TYPE_CONVERSION(float, 1.5h);
-  VERIFY_TYPE_CONVERSION(float, 1.6l);
+  VERIFY_TYPE_CONVERSION(float, 1.6l);       /* fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} */
 
   VERIFY_TYPE_CONVERSION(double, 1.65h);
   VERIFY_TYPE_CONVERSION(double, 0.25f);
@@ -172,19 +172,19 @@ float test() {
   VERIFY_TYPE_CONVERSION(int, 1L);
   VERIFY_TYPE_CONVERSION(int, 1U);
   VERIFY_TYPE_CONVERSION(int, 1UL);
-  VERIFY_TYPE_CONVERSION(int, 1LL);
+  VERIFY_TYPE_CONVERSION(int, 1LL);          /* fxc-error {{X3000: syntax error: unexpected token 'L'}} */
 
   VERIFY_TYPE_CONVERSION(uint, 1L);
   VERIFY_TYPE_CONVERSION(uint, 1UL);
-  VERIFY_TYPE_CONVERSION(uint, 1LL);
+  VERIFY_TYPE_CONVERSION(uint, 1LL);         /* fxc-error {{X3000: syntax error: unexpected token 'L'}} */
 
-  VERIFY_TYPE_CONVERSION(min12int, 1L);  /* expected-warning {{min12int is promoted to min16int}} */
-  VERIFY_TYPE_CONVERSION(min12int, 1UL); /* expected-warning {{min12int is promoted to min16int}} */
-  VERIFY_TYPE_CONVERSION(min12int, 1LL); /* expected-warning {{min12int is promoted to min16int}} */
+  VERIFY_TYPE_CONVERSION(min12int, 1L);  /* expected-warning {{min12int is promoted to min16int}} fxc-pass {{}} */
+  VERIFY_TYPE_CONVERSION(min12int, 1UL); /* expected-warning {{min12int is promoted to min16int}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} */
+  VERIFY_TYPE_CONVERSION(min12int, 1LL); /* expected-warning {{min12int is promoted to min16int}} fxc-error {{X3000: syntax error: unexpected token 'L'}} */
 
   VERIFY_TYPE_CONVERSION(min16int, 1L);
-  VERIFY_TYPE_CONVERSION(min16int, 1UL);
-  VERIFY_TYPE_CONVERSION(min16int, 1LL);
+  VERIFY_TYPE_CONVERSION(min16int, 1UL); /* fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} */
+  VERIFY_TYPE_CONVERSION(min16int, 1LL); /* fxc-error {{X3000: syntax error: unexpected token 'L'}} */
 
   return 0.0f;
-}
+}

+ 13 - 13
tools/clang/test/HLSL/matrix-assignments.hlsl

@@ -70,11 +70,10 @@ float4 main() : SV_Target {
   /*verify-ast
     DeclStmt <col:3, col:51>
     `-VarDecl <col:3, col:50> col:12 f22_target_clone 'float2x2':'matrix<float, 2, 2>' cinit
-      `-ImplicitCastExpr <col:31, col:50> 'float2x2':'matrix<float, 2, 2>' <LValueToRValue>
-        `-CXXFunctionalCastExpr <col:31, col:50> 'float2x2':'matrix<float, 2, 2>' lvalue functional cast to float2x2 <NoOp>
-          `-InitListExpr <col:40> 'float2x2':'matrix<float, 2, 2>'
-            `-ImplicitCastExpr <col:40> 'float2x2':'matrix<float, 2, 2>' <LValueToRValue>
-              `-DeclRefExpr <col:40> 'float2x2':'matrix<float, 2, 2>' lvalue Var 'f22_target' 'float2x2':'matrix<float, 2, 2>'
+      `-CXXFunctionalCastExpr <col:31, col:50> 'float2x2':'matrix<float, 2, 2>' functional cast to float2x2 <NoOp>
+        `-InitListExpr <col:40> 'float2x2':'matrix<float, 2, 2>'
+          `-ImplicitCastExpr <col:40> 'float2x2':'matrix<float, 2, 2>' <LValueToRValue>
+            `-DeclRefExpr <col:40> 'float2x2':'matrix<float, 2, 2>' lvalue Var 'f22_target' 'float2x2':'matrix<float, 2, 2>'
   */
   // fxc warning X3081: comma expression used where a vector constructor may have been intended
   float2x2 f22_target_cast = (float2x2)(0.1f, 0.2f, 0.3f, 0.4f); // expected-warning {{comma expression used where a constructor list may have been intended}} fxc-warning {{X3081: comma expression used where a vector constructor may have been intended}}
@@ -150,16 +149,17 @@ float4 main() : SV_Target {
   fn1(val);
   /*verify-ast
     CallExpr <col:3, col:10> 'void'
-    |-ImplicitCastExpr <col:3> 'void (*)(float2x3 (&)[2])' <FunctionToPointerDecay>
-    | `-DeclRefExpr <col:3> 'void (float2x3 (&)[2])' lvalue Function 'fn1' 'void (float2x3 (&)[2])'
-    `-DeclRefExpr <col:7> 'float2x3 [2]' lvalue Var 'val' 'float2x3 [2]'
+    |-ImplicitCastExpr <col:3> 'void (*)(float2x3 __restrict[2])' <FunctionToPointerDecay>
+    | `-DeclRefExpr <col:3> 'void (float2x3 __restrict[2])' lvalue Function 'fn1' 'void (float2x3 __restrict[2])'
+    `-ImplicitCastExpr <col:7> 'float2x3 [2]' <LValueToRValue>
+      `-DeclRefExpr <col:7> 'float2x3 [2]' lvalue Var 'val' 'float2x3 [2]'
   */
 
   fn2(val[1]);
   /*verify-ast
     CallExpr <col:3, col:13> 'void'
-    |-ImplicitCastExpr <col:3> 'void (*)(float2x3 &)' <FunctionToPointerDecay>
-    | `-DeclRefExpr <col:3> 'void (float2x3 &)' lvalue Function 'fn2' 'void (float2x3 &)'
+    |-ImplicitCastExpr <col:3> 'void (*)(float2x3 &__restrict)' <FunctionToPointerDecay>
+    | `-DeclRefExpr <col:3> 'void (float2x3 &__restrict)' lvalue Function 'fn2' 'void (float2x3 &__restrict)'
     `-ArraySubscriptExpr <col:7, col:12> 'float2x3':'matrix<float, 2, 3>' lvalue
       |-ImplicitCastExpr <col:7> 'float2x3 [2]' <LValueToRValue>
       | `-DeclRefExpr <col:7> 'float2x3 [2]' lvalue Var 'val' 'float2x3 [2]'
@@ -173,8 +173,8 @@ float4 main() : SV_Target {
   fn3(val[0][0]);
   /*verify-ast
     CallExpr <col:3, col:16> 'void'
-    |-ImplicitCastExpr <col:3> 'void (*)(float3 &)' <FunctionToPointerDecay>
-    | `-DeclRefExpr <col:3> 'void (float3 &)' lvalue Function 'fn3' 'void (float3 &)'
+    |-ImplicitCastExpr <col:3> 'void (*)(float3 &__restrict)' <FunctionToPointerDecay>
+    | `-DeclRefExpr <col:3> 'void (float3 &__restrict)' lvalue Function 'fn3' 'void (float3 &__restrict)'
     `-CXXOperatorCallExpr <col:7, col:15> 'vector<float, 3>':'vector<float, 3>' lvalue
       |-ImplicitCastExpr <col:13, col:15> 'vector<float, 3> &(*)(unsigned int)' <FunctionToPointerDecay>
       | `-DeclRefExpr <col:13, col:15> 'vector<float, 3> &(unsigned int)' lvalue CXXMethod 'operator[]' 'vector<float, 3> &(unsigned int)'
@@ -188,4 +188,4 @@ float4 main() : SV_Target {
 
   return float4(val[0][0] + val[1][0], 1);
 
-}
+}

+ 7 - 7
tools/clang/test/HLSL/matrix-syntax.hlsl

@@ -61,12 +61,12 @@ void matrix_out_of_bounds() {
 
 void matrix_unsigned() {
    unsigned int4x2 intMatrix;
-   unsigned min16int4x3 min16Matrix;
-   unsigned int64_t3x3 int64Matrix;
-   unsigned uint3x4 uintMatrix;
-   unsigned min16uint4x1 min16uintMatrix;
-   unsigned uint64_t2x2 int64uintMatrix;
-   unsigned dword3x2 dwordvector; /* fxc-error {{X3000: unrecognized identifier 'dword3x1'}} */
+   unsigned min16int4x3 min16Matrix; /* fxc-error {{X3085: unsigned can not be used with type}} */
+   unsigned int64_t3x3 int64Matrix;  /* fxc-error {{X3000: syntax error: unexpected token 'int64_t3x3'}} */
+   unsigned uint3x4 uintMatrix;      /* fxc-error {{X3085: unsigned can not be used with type}} */
+   unsigned min16uint4x1 min16uintMatrix;                   /* fxc-error {{X3085: unsigned can not be used with type}} */
+   unsigned uint64_t2x2 int64uintMatrix;                    /* fxc-error {{X3000: syntax error: unexpected token 'uint64_t2x2'}} */
+   unsigned dword3x2 dwordvector; /* fxc-error {{X3000: syntax error: unexpected token 'dword3x2'}} */
 
    unsigned float2x3 floatMatrix; /* expected-error {{'float' cannot be signed or unsigned}} fxc-error {{X3085: unsigned can not be used with type}} */
    unsigned bool3x4 boolvector;   /* expected-error {{'bool' cannot be signed or unsigned}} fxc-error {{X3085: unsigned can not be used with type}} */
@@ -157,4 +157,4 @@ void main() {
     myConstMatrix[0][0] = 3;                                /* expected-error {{cannot assign to variable 'myConstMatrix' with const-qualified type 'const matrix<float, 4, 4>'}} fxc-error {{X3025: l-value specifies const object}} */
     myConstMatrix[3] = float4(1,2,3,4);                     /* expected-error {{cannot assign to variable 'myConstMatrix' with const-qualified type 'const matrix<float, 4, 4>'}} fxc-error {{X3025: l-value specifies const object}} */
 
-}
+}

+ 20 - 20
tools/clang/test/HLSL/more-operators.hlsl

@@ -156,16 +156,16 @@ float4 plain(float4 param4 /* : FOO */) /*: FOO */{
     float float_l = 1;
     double double_l = 1;
     min16float min16float_l = 1;
-    min10float min10float_l = 1;  // expected-warning {{min10float is promoted to min16float}}
+    min10float min10float_l = 1;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
     min16int min16int_l = 1;
-    min12int min12int_l = 1;        // expected-warning {{min12int is promoted to min16int}}
+    min12int min12int_l = 1;        // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
     min16uint min16uint_l = 1;
     SamplerState SamplerState_l = g_SamplerState;
     bool1 bool1_l = 0;
     bool2 bool2_l = 0;
     float3 float3_l = 0;
     double4 double4_l = 0;
-    min10float1x2 min10float1x2_l = 0;  // expected-warning {{min10float is promoted to min16float}}
+    min10float1x2 min10float1x2_l = 0;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
     uint2x3 uint2x3_l = 0;
     min16uint4x4 min16uint4x4_l = 0;
     int3x2 int3x2_l = 0;
@@ -190,9 +190,9 @@ float4 plain(float4 param4 /* : FOO */) /*: FOO */{
     _Static_assert(std::is_same<float, __decltype(-float_l)>::value, "");
     _Static_assert(std::is_same<double, __decltype(-double_l)>::value, "");
     _Static_assert(std::is_same<min16float, __decltype(-min16float_l)>::value, "");
-    _Static_assert(std::is_same<min10float, __decltype(-min10float_l)>::value, "");  // expected-warning {{min10float is promoted to min16float}}
+    _Static_assert(std::is_same<min10float, __decltype(-min10float_l)>::value, "");  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
     _Static_assert(std::is_same<min16int, __decltype(-min16int_l)>::value, "");
-    _Static_assert(std::is_same<min12int, __decltype(-min12int_l)>::value, "");    // expected-warning {{min12int is promoted to min16int}}
+    _Static_assert(std::is_same<min12int, __decltype(-min12int_l)>::value, "");    // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
     _Static_assert(std::is_same<min16uint, __decltype(-min16uint_l)>::value, "");
     (-SamplerState_l); // expected-error {{scalar, vector, or matrix expected}} fxc-error {{X3022: scalar, vector, or matrix expected}}
     (-f3_s_l); // expected-error {{scalar, vector, or matrix expected}} fxc-error {{X3022: scalar, vector, or matrix expected}}
@@ -201,7 +201,7 @@ float4 plain(float4 param4 /* : FOO */) /*: FOO */{
     _Static_assert(std::is_same<int2, __decltype(-bool2_l)>::value, "");
     _Static_assert(std::is_same<float3, __decltype(-float3_l)>::value, "");
     _Static_assert(std::is_same<double4, __decltype(-double4_l)>::value, "");
-    _Static_assert(std::is_same<min10float1x2, __decltype(-min10float1x2_l)>::value, "");      /* expected-warning {{min10float is promoted to min16float}} */
+    _Static_assert(std::is_same<min10float1x2, __decltype(-min10float1x2_l)>::value, "");      /* expected-warning {{min10float is promoted to min16float}} fxc-pass {{}} */
     _Static_assert(std::is_same<uint2x3, __decltype(-uint2x3_l)>::value, "");
     _Static_assert(std::is_same<min16uint4x4, __decltype(-min16uint4x4_l)>::value, "");
     _Static_assert(std::is_same<int3x2, __decltype(-int3x2_l)>::value, "");
@@ -212,9 +212,9 @@ float4 plain(float4 param4 /* : FOO */) /*: FOO */{
     _Static_assert(std::is_same<float, __decltype(+float_l)>::value, "");
     _Static_assert(std::is_same<double, __decltype(+double_l)>::value, "");
     _Static_assert(std::is_same<min16float, __decltype(+min16float_l)>::value, "");
-    _Static_assert(std::is_same<min10float, __decltype(+min10float_l)>::value, "");  // expected-warning {{min10float is promoted to min16float}}
+    _Static_assert(std::is_same<min10float, __decltype(+min10float_l)>::value, "");  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
     _Static_assert(std::is_same<min16int, __decltype(+min16int_l)>::value, "");
-    _Static_assert(std::is_same<min12int, __decltype(+min12int_l)>::value, "");    // expected-warning {{min12int is promoted to min16int}}
+    _Static_assert(std::is_same<min12int, __decltype(+min12int_l)>::value, "");    // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
     _Static_assert(std::is_same<min16uint, __decltype(+min16uint_l)>::value, "");
     (+SamplerState_l); // expected-error {{scalar, vector, or matrix expected}} fxc-error {{X3022: scalar, vector, or matrix expected}}
     (+f3_s_l); // expected-error {{scalar, vector, or matrix expected}} fxc-error {{X3022: scalar, vector, or matrix expected}}
@@ -223,7 +223,7 @@ float4 plain(float4 param4 /* : FOO */) /*: FOO */{
     _Static_assert(std::is_same<int2, __decltype(+bool2_l)>::value, "");
     _Static_assert(std::is_same<float3, __decltype(+float3_l)>::value, "");
     _Static_assert(std::is_same<double4, __decltype(+double4_l)>::value, "");
-    _Static_assert(std::is_same<min10float1x2, __decltype(+min10float1x2_l)>::value, "");      /* expected-warning {{min10float is promoted to min16float}} */
+    _Static_assert(std::is_same<min10float1x2, __decltype(+min10float1x2_l)>::value, "");      /* expected-warning {{min10float is promoted to min16float}} fxc-pass {{}} */
     _Static_assert(std::is_same<uint2x3, __decltype(+uint2x3_l)>::value, "");
     _Static_assert(std::is_same<min16uint4x4, __decltype(+min16uint4x4_l)>::value, "");
     _Static_assert(std::is_same<int3x2, __decltype(+int3x2_l)>::value, "");
@@ -236,7 +236,7 @@ float4 plain(float4 param4 /* : FOO */) /*: FOO */{
     (~min16float_l); // expected-error {{int or unsigned int type required}} fxc-error {{X3082: int or unsigned int type required}}
     (~min10float_l); // expected-error {{int or unsigned int type required}} fxc-error {{X3082: int or unsigned int type required}}
     _Static_assert(std::is_same<min16int, __decltype(~min16int_l)>::value, "");
-    _Static_assert(std::is_same<min12int, __decltype(~min12int_l)>::value, "");    // expected-warning {{min12int is promoted to min16int}}
+    _Static_assert(std::is_same<min12int, __decltype(~min12int_l)>::value, "");    // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
     _Static_assert(std::is_same<min16uint, __decltype(~min16uint_l)>::value, "");
     (~SamplerState_l); // expected-error {{scalar, vector, or matrix expected}} fxc-error {{X3082: int or unsigned int type required}}
     (~f3_s_l); // expected-error {{scalar, vector, or matrix expected}} fxc-error {{X3082: int or unsigned int type required}}
@@ -288,11 +288,11 @@ float4 plain(float4 param4 /* : FOO */) /*: FOO */{
     _Static_assert(std::is_same<min16float&, __decltype(--min16float_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} fxc-pass {{}}
     _Static_assert(std::is_same<min16float, __decltype(min16float_l--)>::value, "");
     _Static_assert(std::is_same<min10float&, __decltype(--min10float_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
-    _Static_assert(std::is_same<min10float, __decltype(min10float_l--)>::value, "");  // expected-warning {{min10float is promoted to min16float}}
+    _Static_assert(std::is_same<min10float, __decltype(min10float_l--)>::value, "");  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
     _Static_assert(std::is_same<min16int&, __decltype(--min16int_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} fxc-pass {{}}
     _Static_assert(std::is_same<min16int, __decltype(min16int_l--)>::value, "");
     _Static_assert(std::is_same<min12int&, __decltype(--min12int_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
-    _Static_assert(std::is_same<min12int, __decltype(min12int_l--)>::value, "");  // expected-warning {{min12int is promoted to min16int}}
+    _Static_assert(std::is_same<min12int, __decltype(min12int_l--)>::value, "");  // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
     _Static_assert(std::is_same<min16uint&, __decltype(--min16uint_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} fxc-pass {{}}
     _Static_assert(std::is_same<min16uint, __decltype(min16uint_l--)>::value, "");
     (--SamplerState_l); // expected-error {{scalar, vector, or matrix expected}} fxc-pass {{}}
@@ -310,7 +310,7 @@ float4 plain(float4 param4 /* : FOO */) /*: FOO */{
     _Static_assert(std::is_same<double4&, __decltype(--double4_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} fxc-pass {{}}
     _Static_assert(std::is_same<double4, __decltype(double4_l--)>::value, "");
     _Static_assert(std::is_same<min10float1x2&, __decltype(--min10float1x2_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
-    _Static_assert(std::is_same<min10float1x2, __decltype(min10float1x2_l--)>::value, "");      /* expected-warning {{min10float is promoted to min16float}} */
+    _Static_assert(std::is_same<min10float1x2, __decltype(min10float1x2_l--)>::value, "");      /* expected-warning {{min10float is promoted to min16float}} fxc-pass {{}} */
     _Static_assert(std::is_same<uint2x3&, __decltype(--uint2x3_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} fxc-pass {{}}
     _Static_assert(std::is_same<uint2x3, __decltype(uint2x3_l--)>::value, "");
     _Static_assert(std::is_same<min16uint4x4&, __decltype(--min16uint4x4_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} fxc-pass {{}}
@@ -332,11 +332,11 @@ float4 plain(float4 param4 /* : FOO */) /*: FOO */{
     _Static_assert(std::is_same<min16float&, __decltype(++min16float_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} fxc-pass {{}}
     _Static_assert(std::is_same<min16float, __decltype(min16float_l++)>::value, "");
     _Static_assert(std::is_same<min10float&, __decltype(++min10float_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
-    _Static_assert(std::is_same<min10float, __decltype(min10float_l++)>::value, "");  // expected-warning {{min10float is promoted to min16float}}
+    _Static_assert(std::is_same<min10float, __decltype(min10float_l++)>::value, "");  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
     _Static_assert(std::is_same<min16int&, __decltype(++min16int_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} fxc-pass {{}}
     _Static_assert(std::is_same<min16int, __decltype(min16int_l++)>::value, "");
     _Static_assert(std::is_same<min12int&, __decltype(++min12int_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
-    _Static_assert(std::is_same<min12int, __decltype(min12int_l++)>::value, "");  // expected-warning {{min12int is promoted to min16int}}
+    _Static_assert(std::is_same<min12int, __decltype(min12int_l++)>::value, "");  // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
     _Static_assert(std::is_same<min16uint&, __decltype(++min16uint_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} fxc-pass {{}}
     _Static_assert(std::is_same<min16uint, __decltype(min16uint_l++)>::value, "");
     (++SamplerState_l); // expected-error {{scalar, vector, or matrix expected}} fxc-pass {{}}
@@ -354,7 +354,7 @@ float4 plain(float4 param4 /* : FOO */) /*: FOO */{
     _Static_assert(std::is_same<double4&, __decltype(++double4_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} fxc-pass {{}}
     _Static_assert(std::is_same<double4, __decltype(double4_l++)>::value, "");
     _Static_assert(std::is_same<min10float1x2&, __decltype(++min10float1x2_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
-    _Static_assert(std::is_same<min10float1x2, __decltype(min10float1x2_l++)>::value, "");  /* expected-warning {{min10float is promoted to min16float}} */
+    _Static_assert(std::is_same<min10float1x2, __decltype(min10float1x2_l++)>::value, "");  /* expected-warning {{min10float is promoted to min16float}} fxc-pass {{}} */
     _Static_assert(std::is_same<uint2x3&, __decltype(++uint2x3_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} fxc-pass {{}}
     _Static_assert(std::is_same<uint2x3, __decltype(uint2x3_l++)>::value, "");
     _Static_assert(std::is_same<min16uint4x4&, __decltype(++min16uint4x4_l)>::value, ""); // expected-error {{pointers are unsupported in HLSL}} fxc-pass {{}}
@@ -482,16 +482,16 @@ Texture2D tex12[12];
 SamplerState samp;
 
 float4 DoSample(Texture2D tex[12], float2 coord) {
-  return tex[3].Sample(samp, -dot(coord, -foo));    // expected-error {{use of undeclared identifier 'foo'}}
+  return tex[3].Sample(samp, -dot(coord, -foo));    // expected-error {{use of undeclared identifier 'foo'}} fxc-error {{X3004: undeclared identifier 'foo'}} fxc-error {{X3013:     dot(floatM|halfM|doubleM|min10floatM|min16floatM|intM|uintM|min12intM|min16intM|min16uintM, floatM|halfM|doubleM|min10floatM|min16floatM|intM|uintM|min12intM|min16intM|min16uintM)}} fxc-error {{X3013: 'dot': no matching 2 parameter intrinsic function}} fxc-error {{X3013: Possible intrinsic functions are:}}
 }
 
 float3 fn(float a, float b)
 {
-    float3 bar = (float3(2,3,4) * foo) ? a : b;     // expected-error {{use of undeclared identifier 'foo'}}
-    return bar < 1 ? float3(foo) : bar;             // expected-error {{use of undeclared identifier 'foo'}}
+    float3 bar = (float3(2,3,4) * foo) ? a : b;     // expected-error {{use of undeclared identifier 'foo'}} fxc-error {{X3004: undeclared identifier 'foo'}}
+    return bar < 1 ? float3(foo) : bar;             // expected-error {{use of undeclared identifier 'foo'}} fxc-error {{X3004: undeclared identifier 'bar'}}
 }
 
 float4 main2(float2 coord : TEXCOORD) : SV_Target
 {
   return DoSample(tex12, fn(coord.x, coord.y).xy);
-}
+}

+ 17 - 17
tools/clang/test/HLSL/packreg.hlsl

@@ -81,7 +81,7 @@ cbuffer MyFloats
 {
   float4 f4_simple : packoffset(c0.x);
   /*verify-ast
-    VarDecl <col:3, col:10> col:10 f4_simple 'float4':'vector<float, 4>'
+    VarDecl parent cbuffer <col:3, col:10> col:10 f4_simple 'const float4':'const vector<float, 4>'
     `-ConstantPacking <col:22> packoffset(c0.x)
   */
   // fxc error X3530: register or offset bind c3.xy not valid
@@ -94,7 +94,7 @@ tbuffer OtherFloats
   float4 f4_t_simple : packoffset(c10.x);
   float3 f3_t_simple : packoffset(c11.y);
   /*verify-ast
-    VarDecl <col:3, col:10> col:10 f3_t_simple 'float3':'vector<float, 3>'
+    VarDecl parent tbuffer <col:3, col:10> col:10 f3_t_simple 'const float3':'const vector<float, 3>'
     `-ConstantPacking <col:24> packoffset(c11.y)
   */
   // fxc error X3530: register or offset bind c3.xy not valid
@@ -109,7 +109,7 @@ sampler myvar_norparen: register(ps, s[2]; ); // expected-error {{expected ')'}}
 sampler myVar : register(ps_5_0, s);
 /*verify-ast
   VarDecl <col:1, col:9> col:9 myVar 'sampler':'SamplerState'
-  `-RegisterAssignment <col:17> register(ps_6_0, s0)
+  `-RegisterAssignment <col:17> register(ps_5_0, s0)
 */
 sampler myVar2 : register(vs, s[8]);
 sampler myVar2_offset : register(vs, s2[8]);
@@ -160,7 +160,7 @@ Texture2D myVar_t_1_1 : register(ps, t1[1]),
 /*verify-ast
   VarDecl <col:1, col:11> col:11 myVar_t_1_1 'Texture2D':'Texture2D<vector<float, 4> >'
   `-RegisterAssignment <col:25> register(ps, t2)
-  VarDecl <col:1, line:147:3> col:3 myVar_t_2_1 'Texture2D':'Texture2D<vector<float, 4> >'
+  VarDecl <col:1, line:167:3> col:3 myVar_t_2_1 'Texture2D':'Texture2D<vector<float, 4> >'
   |-RegisterAssignment <col:17> register(ps, t3)
   `-RegisterAssignment <col:39> register(vs, t0)
 */
@@ -171,7 +171,7 @@ sampler myVar_i : register(ps, i); // expected-error {{invalid register specific
 float4 myVar_b : register(ps, b);
 bool myVar_bool : register(ps, b) : register(ps, c);
 /*verify-ast
-  VarDecl <col:1, col:6> col:6 myVar_bool 'bool'
+  VarDecl <col:1, col:6> col:6 myVar_bool 'const bool'
   |-RegisterAssignment <col:19> register(ps, b0)
   `-RegisterAssignment <col:37> register(ps, c0)
 */
@@ -195,7 +195,7 @@ sampler myVar_s1 : register(ps, s[1], space1);
   `-RegisterAssignment <col:20> register(ps, s1, space1)
 */
 // fxc error X3591: incorrect bind semantic
-sampler myVar_sb : register(ps, s[1], splice); // expected-error {{expected space definition with syntax 'spaceX', where X is an integral value}} fxc-pass {{X3591: incorrect bind semantic}}
+sampler myVar_sb : register(ps, s[1], splice); // expected-error {{expected space definition with syntax 'spaceX', where X is an integral value}} fxc-error {{X3591: incorrect bind semantic}}
 sampler myVar_sz : register(ps, s[1], spacez); // expected-error {{space number should be an integral numeric string}} fxc-error {{X3591: incorrect bind semantic}}
 
 // Legal in fxc due to compatibility mode:
@@ -543,11 +543,11 @@ cbuffer MyBuffer
   float4 Element4 : packoffset(c10) : packoffset(c10);
   float4 Element5 : packoffset(c10) : MY_SEMANTIC : packoffset(c11), Element6 : packoffset(c12) : MY_SEMANTIC2; // expected-warning {{packoffset is overridden by another packoffset annotation}} fxc-pass {{}}
   /*verify-ast
-    VarDecl <col:3, col:10> col:10 Element5 'float4':'vector<float, 4>'
+    VarDecl parent cbuffer <col:3, col:10> col:10 Element5 'const float4':'const vector<float, 4>'
     |-ConstantPacking <col:21> packoffset(c10.x)
     |-SemanticDecl <col:39> "MY_SEMANTIC"
     `-ConstantPacking <col:53> packoffset(c11.x)
-    VarDecl <col:3, col:70> col:70 Element6 'float4':'vector<float, 4>'
+    VarDecl parent cbuffer <col:3, col:70> col:70 Element6 'const float4':'const vector<float, 4>'
     |-ConstantPacking <col:81> packoffset(c12.x)
     `-SemanticDecl <col:99> "MY_SEMANTIC2"
   */
@@ -561,11 +561,11 @@ cbuffer MyBuffer2
   float4 Element10 : packoffset(C20) : packoffset(C20);
   float4 Element11 : packoffset(C20) : MY_SEMANTIC : packoffset(C21), Element12 : packoffset(C22) : MY_SEMANTIC2; // expected-warning {{packoffset is overridden by another packoffset annotation}} fxc-pass {{}}
   /*verify-ast
-    VarDecl <col:3, col:10> col:10 Element11 'float4':'vector<float, 4>'
+    VarDecl parent cbuffer <col:3, col:10> col:10 Element11 'const float4':'const vector<float, 4>'
     |-ConstantPacking <col:22> packoffset(c20.x)
     |-SemanticDecl <col:40> "MY_SEMANTIC"
     `-ConstantPacking <col:54> packoffset(c21.x)
-    VarDecl <col:3, col:71> col:71 Element12 'float4':'vector<float, 4>'
+    VarDecl parent cbuffer <col:3, col:71> col:71 Element12 'const float4':'const vector<float, 4>'
     |-ConstantPacking <col:83> packoffset(c22.x)
     `-SemanticDecl <col:101> "MY_SEMANTIC2"
   */
@@ -579,7 +579,7 @@ cbuffer Parameters : register(b0)
 {
   float4   DiffuseColor   : packoffset(c0) : register(c0);
   /*verify-ast
-    VarDecl <col:3, col:12> col:12 DiffuseColor 'float4':'vector<float, 4>'
+    VarDecl parent cbuffer <col:3, col:12> col:12 DiffuseColor 'const float4':'const vector<float, 4>'
     |-ConstantPacking <col:29> packoffset(c0.x)
     `-RegisterAssignment <col:46> register(c0)
   */
@@ -606,14 +606,14 @@ cbuffer cbPerFrame : register(b1)
 // Nesting case
 cbuffer OuterBuffer : register(b3) {
 /*verify-ast
-  HLSLBufferDecl <col:1, line:602:1> line:586:9 cbuffer OuterBuffer
+  HLSLBufferDecl <col:1, line:623:1> line:607:9 cbuffer OuterBuffer
   |-RegisterAssignment <col:23> register(b3)
-  |-VarDecl <line:597:3, col:9> col:9 used OuterItem0 'float'
-  |-HLSLBufferDecl parent <line:598:3, line:600:3> line:598:11 cbuffer InnerBuffer
+  |-VarDecl parent cbuffer <line:618:3, col:9> col:9 used OuterItem0 'const float'
+  |-HLSLBufferDecl parent <line:619:3, line:621:3> line:619:11 cbuffer InnerBuffer
   | |-RegisterAssignment <col:25> register(b4)
-  | `-VarDecl <line:599:5, col:11> col:11 used InnerItem0 'float'
-  |-EmptyDecl <line:600:4> col:4
-  `-VarDecl <line:601:3, col:9> col:9 used OuterItem1 'float'
+  | `-VarDecl parent cbuffer <line:620:5, col:11> col:11 used InnerItem0 'const float'
+  |-EmptyDecl parent cbuffer <line:621:4> col:4
+  `-VarDecl parent cbuffer <line:622:3, col:9> col:9 used OuterItem1 'const float'
 */
   float OuterItem0;
   cbuffer InnerBuffer : register(b4) {

+ 58 - 58
tools/clang/test/HLSL/scalar-assignments.hlsl

@@ -38,9 +38,9 @@ bool left4; half right4; left4 = right4;
 bool left5; float right5; left5 = right5;
 bool left6; double right6; left6 = right6;
 bool left7; min16float right7; left7 = right7;
-bool left8; min10float right8; left8 = right8;  // expected-warning {{min10float is promoted to min16float}}
+bool left8; min10float right8; left8 = right8;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 bool left9; min16int right9; left9 = right9;
-bool left10; min12int right10; left10 = right10;  // expected-warning {{min12int is promoted to min16int}}
+bool left10; min12int right10; left10 = right10;  // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
 bool left11; min16uint right11; left11 = right11;
 int left12; bool right12; left12 = right12;
 int left13; int right13; left13 = right13;
@@ -50,9 +50,9 @@ int left16; half right16; left16 = right16;
 int left17; float right17; left17 = right17;
 int left18; double right18; left18 = right18; // expected-warning {{conversion from larger type 'double' to smaller type 'int', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
 int left19; min16float right19; left19 = right19;
-int left20; min10float right20; left20 = right20;  // expected-warning {{min10float is promoted to min16float}}
+int left20; min10float right20; left20 = right20;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 int left21; min16int right21; left21 = right21;
-int left22; min12int right22; left22 = right22;  // expected-warning {{min12int is promoted to min16int}}
+int left22; min12int right22; left22 = right22;  // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
 int left23; min16uint right23; left23 = right23;
 uint left24; bool right24; left24 = right24;
 uint left25; int right25; left25 = right25;
@@ -62,9 +62,9 @@ uint left28; half right28; left28 = right28;
 uint left29; float right29; left29 = right29;
 uint left30; double right30; left30 = right30; // expected-warning {{conversion from larger type 'double' to smaller type 'uint', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
 uint left31; min16float right31; left31 = right31;
-uint left32; min10float right32; left32 = right32;  // expected-warning {{min10float is promoted to min16float}}
+uint left32; min10float right32; left32 = right32;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 uint left33; min16int right33; left33 = right33;
-uint left34; min12int right34; left34 = right34;  // expected-warning {{min12int is promoted to min16int}}
+uint left34; min12int right34; left34 = right34;  // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
 uint left35; min16uint right35; left35 = right35;
 dword left36; bool right36; left36 = right36;
 dword left37; int right37; left37 = right37;
@@ -74,9 +74,9 @@ dword left40; half right40; left40 = right40;
 dword left41; float right41; left41 = right41;
 dword left42; double right42; left42 = right42; // expected-warning {{conversion from larger type 'double' to smaller type 'dword', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
 dword left43; min16float right43; left43 = right43;
-dword left44; min10float right44; left44 = right44;  // expected-warning {{min10float is promoted to min16float}}
+dword left44; min10float right44; left44 = right44;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 dword left45; min16int right45; left45 = right45;
-dword left46; min12int right46; left46 = right46;  // expected-warning {{min12int is promoted to min16int}}
+dword left46; min12int right46; left46 = right46;  // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
 dword left47; min16uint right47; left47 = right47;
 half left48; bool right48; left48 = right48;
 half left49; int right49; left49 = right49;
@@ -86,9 +86,9 @@ half left52; half right52; left52 = right52;
 half left53; float right53; left53 = right53;
 half left54; double right54; left54 = right54; // expected-warning {{conversion from larger type 'double' to smaller type 'half', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
 half left55; min16float right55; left55 = right55;
-half left56; min10float right56; left56 = right56;  // expected-warning {{min10float is promoted to min16float}}
+half left56; min10float right56; left56 = right56;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 half left57; min16int right57; left57 = right57;
-half left58; min12int right58; left58 = right58;  // expected-warning {{min12int is promoted to min16int}}
+half left58; min12int right58; left58 = right58;  // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
 half left59; min16uint right59; left59 = right59;
 float left60; bool right60; left60 = right60;
 float left61; int right61; left61 = right61;
@@ -98,9 +98,9 @@ float left64; half right64; left64 = right64;
 float left65; float right65; left65 = right65;
 float left66; double right66; left66 = right66; // expected-warning {{conversion from larger type 'double' to smaller type 'float', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
 float left67; min16float right67; left67 = right67;
-float left68; min10float right68; left68 = right68;  // expected-warning {{min10float is promoted to min16float}}
+float left68; min10float right68; left68 = right68;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 float left69; min16int right69; left69 = right69;
-float left70; min12int right70; left70 = right70;  // expected-warning {{min12int is promoted to min16int}}
+float left70; min12int right70; left70 = right70;  // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
 float left71; min16uint right71; left71 = right71;
 double left72; bool right72; left72 = right72;
 double left73; int right73; left73 = right73;
@@ -110,9 +110,9 @@ double left76; half right76; left76 = right76;
 double left77; float right77; left77 = right77;
 double left78; double right78; left78 = right78;
 double left79; min16float right79; left79 = right79;
-double left80; min10float right80; left80 = right80;  // expected-warning {{min10float is promoted to min16float}}
+double left80; min10float right80; left80 = right80;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 double left81; min16int right81; left81 = right81;
-double left82; min12int right82; left82 = right82;  // expected-warning {{min12int is promoted to min16int}}
+double left82; min12int right82; left82 = right82;  // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
 double left83; min16uint right83; left83 = right83;
 min16float left84; bool right84; left84 = right84;
 min16float left85; int right85; left85 = right85; // expected-warning {{conversion from larger type 'int' to smaller type 'min16float', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
@@ -122,11 +122,11 @@ min16float left88; half right88; left88 = right88; // expected-warning {{convers
 min16float left89; float right89; left89 = right89; // expected-warning {{conversion from larger type 'float' to smaller type 'min16float', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
 min16float left90; double right90; left90 = right90; // expected-warning {{conversion from larger type 'double' to smaller type 'min16float', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
 min16float left91; min16float right91; left91 = right91;
-min16float left92; min10float right92; left92 = right92;  // expected-warning {{min10float is promoted to min16float}}
+min16float left92; min10float right92; left92 = right92;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 min16float left93; min16int right93; left93 = right93;
-min16float left94; min12int right94; left94 = right94;  // expected-warning {{min12int is promoted to min16int}}
+min16float left94; min12int right94; left94 = right94;  // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
 min16float left95; min16uint right95; left95 = right95;
-min10float left96; bool right96; left96 = right96;  // expected-warning {{min10float is promoted to min16float}}
+min10float left96; bool right96; left96 = right96;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 min10float left97; int right97; left97 = right97; // expected-warning {{conversion from larger type 'int' to smaller type 'min10float', possible loss of data}} expected-warning {{min10float is promoted to min16float}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} //
 min10float left98; uint right98; left98 = right98; // expected-warning {{conversion from larger type 'uint' to smaller type 'min10float', possible loss of data}} expected-warning {{min10float is promoted to min16float}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} //
 min10float left99; dword right99; left99 = right99; // expected-warning {{conversion from larger type 'dword' to smaller type 'min10float', possible loss of data}} expected-warning {{min10float is promoted to min16float}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} //
@@ -134,7 +134,7 @@ min10float left100; half right100; left100 = right100; // expected-warning {{con
 min10float left101; float right101; left101 = right101; // expected-warning {{conversion from larger type 'float' to smaller type 'min10float', possible loss of data}} expected-warning {{min10float is promoted to min16float}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} //
 min10float left102; double right102; left102 = right102; // expected-warning {{conversion from larger type 'double' to smaller type 'min10float', possible loss of data}} expected-warning {{min10float is promoted to min16float}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} //
 min10float left103; min16float right103; left103 = right103; // expected-warning {{conversion from larger type 'min16float' to smaller type 'min10float', possible loss of data}} expected-warning {{min10float is promoted to min16float}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
-min10float left104; min10float right104; left104 = right104;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} //
+min10float left104; min10float right104; left104 = right104;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} fxc-pass {{}} //
 min10float left105; min16int right105; left105 = right105; // expected-warning {{conversion from larger type 'min16int' to smaller type 'min10float', possible loss of data}} expected-warning {{min10float is promoted to min16float}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
 min10float left106; min12int right106; left106 = right106; // expected-warning {{conversion from larger type 'min12int' to smaller type 'min10float', possible loss of data}} expected-warning {{min10float is promoted to min16float}} expected-warning {{min12int is promoted to min16int}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
 min10float left107; min16uint right107; left107 = right107; // expected-warning {{conversion from larger type 'min16uint' to smaller type 'min10float', possible loss of data}} expected-warning {{min10float is promoted to min16float}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
@@ -146,11 +146,11 @@ min16int left112; half right112; left112 = right112; // expected-warning {{conve
 min16int left113; float right113; left113 = right113; // expected-warning {{conversion from larger type 'float' to smaller type 'min16int', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
 min16int left114; double right114; left114 = right114; // expected-warning {{conversion from larger type 'double' to smaller type 'min16int', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
 min16int left115; min16float right115; left115 = right115;
-min16int left116; min10float right116; left116 = right116;  // expected-warning {{min10float is promoted to min16float}}
+min16int left116; min10float right116; left116 = right116;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 min16int left117; min16int right117; left117 = right117;
-min16int left118; min12int right118; left118 = right118;  // expected-warning {{min12int is promoted to min16int}}
+min16int left118; min12int right118; left118 = right118;  // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
 min16int left119; min16uint right119; left119 = right119;
-min12int left120; bool right120; left120 = right120;  // expected-warning {{min12int is promoted to min16int}}
+min12int left120; bool right120; left120 = right120;  // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
 min12int left121; int right121; left121 = right121; // expected-warning {{conversion from larger type 'int' to smaller type 'min12int', possible loss of data}} expected-warning {{min12int is promoted to min16int}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} //
 min12int left122; uint right122; left122 = right122; // expected-warning {{conversion from larger type 'uint' to smaller type 'min12int', possible loss of data}} expected-warning {{min12int is promoted to min16int}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} //
 min12int left123; dword right123; left123 = right123; // expected-warning {{conversion from larger type 'dword' to smaller type 'min12int', possible loss of data}} expected-warning {{min12int is promoted to min16int}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} //
@@ -158,9 +158,9 @@ min12int left124; half right124; left124 = right124; // expected-warning {{conve
 min12int left125; float right125; left125 = right125; // expected-warning {{conversion from larger type 'float' to smaller type 'min12int', possible loss of data}} expected-warning {{min12int is promoted to min16int}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} //
 min12int left126; double right126; left126 = right126; // expected-warning {{conversion from larger type 'double' to smaller type 'min12int', possible loss of data}} expected-warning {{min12int is promoted to min16int}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} //
 min12int left127; min16float right127; left127 = right127; // expected-warning {{conversion from larger type 'min16float' to smaller type 'min12int', possible loss of data}} expected-warning {{min12int is promoted to min16int}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
-min12int left128; min10float right128; left128 = right128;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min12int is promoted to min16int}} //
+min12int left128; min10float right128; left128 = right128;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min12int is promoted to min16int}} fxc-pass {{}} //
 min12int left129; min16int right129; left129 = right129; // expected-warning {{conversion from larger type 'min16int' to smaller type 'min12int', possible loss of data}} expected-warning {{min12int is promoted to min16int}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
-min12int left130; min12int right130; left130 = right130;  // expected-warning {{min12int is promoted to min16int}} expected-warning {{min12int is promoted to min16int}} //
+min12int left130; min12int right130; left130 = right130;  // expected-warning {{min12int is promoted to min16int}} expected-warning {{min12int is promoted to min16int}} fxc-pass {{}} //
 min12int left131; min16uint right131; left131 = right131; // expected-warning {{conversion from larger type 'min16uint' to smaller type 'min12int', possible loss of data}} expected-warning {{min12int is promoted to min16int}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
 min16uint left132; bool right132; left132 = right132;
 min16uint left133; int right133; left133 = right133; // expected-warning {{conversion from larger type 'int' to smaller type 'min16uint', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
@@ -170,9 +170,9 @@ min16uint left136; half right136; left136 = right136; // expected-warning {{conv
 min16uint left137; float right137; left137 = right137; // expected-warning {{conversion from larger type 'float' to smaller type 'min16uint', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
 min16uint left138; double right138; left138 = right138; // expected-warning {{conversion from larger type 'double' to smaller type 'min16uint', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}}
 min16uint left139; min16float right139; left139 = right139;
-min16uint left140; min10float right140; left140 = right140;  // expected-warning {{min10float is promoted to min16float}}
+min16uint left140; min10float right140; left140 = right140;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 min16uint left141; min16int right141; left141 = right141;
-min16uint left142; min12int right142; left142 = right142;  // expected-warning {{min12int is promoted to min16int}}
+min16uint left142; min12int right142; left142 = right142;  // expected-warning {{min12int is promoted to min16int}} fxc-pass {{}}
 min16uint left143; min16uint right143; left143 = right143;
 
 // Now with unorm and snorm modifiers.
@@ -198,8 +198,8 @@ min16uint left143; min16uint right143; left143 = right143;
 // float left1003; unorm double right1003; left1003 = right1003;
  float left1004; snorm min16float right1004; left1004 = right1004;
  float left1005; unorm min16float right1005; left1005 = right1005;
- float left1006; snorm min10float right1006; left1006 = right1006;  // expected-warning {{min10float is promoted to min16float}}
- float left1007; unorm min10float right1007; left1007 = right1007;  // expected-warning {{min10float is promoted to min16float}}
+ float left1006; snorm min10float right1006; left1006 = right1006;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
+ float left1007; unorm min10float right1007; left1007 = right1007;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 snorm float left1008;  float right1008; left1008 = right1008;
 snorm float left1009; snorm float right1009; left1009 = right1009;
 snorm float left1010; unorm float right1010; left1010 = right1010;
@@ -209,9 +209,9 @@ snorm float left1010; unorm float right1010; left1010 = right1010;
 snorm float left1014;  min16float right1014; left1014 = right1014;
 snorm float left1015; snorm min16float right1015; left1015 = right1015;
 snorm float left1016; unorm min16float right1016; left1016 = right1016;
-snorm float left1017;  min10float right1017; left1017 = right1017;  // expected-warning {{min10float is promoted to min16float}}
-snorm float left1018; snorm min10float right1018; left1018 = right1018;  // expected-warning {{min10float is promoted to min16float}}
-snorm float left1019; unorm min10float right1019; left1019 = right1019;  // expected-warning {{min10float is promoted to min16float}}
+snorm float left1017;  min10float right1017; left1017 = right1017;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
+snorm float left1018; snorm min10float right1018; left1018 = right1018;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
+snorm float left1019; unorm min10float right1019; left1019 = right1019;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 unorm float left1020;  float right1020; left1020 = right1020;
 unorm float left1021; snorm float right1021; left1021 = right1021;
 unorm float left1022; unorm float right1022; left1022 = right1022;
@@ -221,17 +221,17 @@ unorm float left1022; unorm float right1022; left1022 = right1022;
 unorm float left1026;  min16float right1026; left1026 = right1026;
 unorm float left1027; snorm min16float right1027; left1027 = right1027;
 unorm float left1028; unorm min16float right1028; left1028 = right1028;
-unorm float left1029;  min10float right1029; left1029 = right1029;  // expected-warning {{min10float is promoted to min16float}}
-unorm float left1030; snorm min10float right1030; left1030 = right1030;  // expected-warning {{min10float is promoted to min16float}}
-unorm float left1031; unorm min10float right1031; left1031 = right1031;  // expected-warning {{min10float is promoted to min16float}}
+unorm float left1029;  min10float right1029; left1029 = right1029;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
+unorm float left1030; snorm min10float right1030; left1030 = right1030;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
+unorm float left1031; unorm min10float right1031; left1031 = right1031;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
  double left1032; snorm float right1032; left1032 = right1032;
  double left1033; unorm float right1033; left1033 = right1033;
  double left1034; snorm double right1034; left1034 = right1034;
  double left1035; unorm double right1035; left1035 = right1035;
  double left1036; snorm min16float right1036; left1036 = right1036;
  double left1037; unorm min16float right1037; left1037 = right1037;
- double left1038; snorm min10float right1038; left1038 = right1038;  // expected-warning {{min10float is promoted to min16float}}
- double left1039; unorm min10float right1039; left1039 = right1039;  // expected-warning {{min10float is promoted to min16float}}
+ double left1038; snorm min10float right1038; left1038 = right1038;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
+ double left1039; unorm min10float right1039; left1039 = right1039;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 snorm double left1040;  float right1040; left1040 = right1040;
 snorm double left1041; snorm float right1041; left1041 = right1041;
 snorm double left1042; unorm float right1042; left1042 = right1042;
@@ -241,9 +241,9 @@ snorm double left1045; unorm double right1045; left1045 = right1045;
 snorm double left1046;  min16float right1046; left1046 = right1046;
 snorm double left1047; snorm min16float right1047; left1047 = right1047;
 snorm double left1048; unorm min16float right1048; left1048 = right1048;
-snorm double left1049;  min10float right1049; left1049 = right1049;  // expected-warning {{min10float is promoted to min16float}}
-snorm double left1050; snorm min10float right1050; left1050 = right1050;  // expected-warning {{min10float is promoted to min16float}}
-snorm double left1051; unorm min10float right1051; left1051 = right1051;  // expected-warning {{min10float is promoted to min16float}}
+snorm double left1049;  min10float right1049; left1049 = right1049;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
+snorm double left1050; snorm min10float right1050; left1050 = right1050;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
+snorm double left1051; unorm min10float right1051; left1051 = right1051;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 unorm double left1052;  float right1052; left1052 = right1052;
 unorm double left1053; snorm float right1053; left1053 = right1053;
 unorm double left1054; unorm float right1054; left1054 = right1054;
@@ -253,17 +253,17 @@ unorm double left1057; unorm double right1057; left1057 = right1057;
 unorm double left1058;  min16float right1058; left1058 = right1058;
 unorm double left1059; snorm min16float right1059; left1059 = right1059;
 unorm double left1060; unorm min16float right1060; left1060 = right1060;
-unorm double left1061;  min10float right1061; left1061 = right1061;  // expected-warning {{min10float is promoted to min16float}}
-unorm double left1062; snorm min10float right1062; left1062 = right1062;  // expected-warning {{min10float is promoted to min16float}}
-unorm double left1063; unorm min10float right1063; left1063 = right1063;  // expected-warning {{min10float is promoted to min16float}}
+unorm double left1061;  min10float right1061; left1061 = right1061;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
+unorm double left1062; snorm min10float right1062; left1062 = right1062;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
+unorm double left1063; unorm min10float right1063; left1063 = right1063;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 // min16float left1064; snorm float right1064; left1064 = right1064;
 // min16float left1065; unorm float right1065; left1065 = right1065;
 // min16float left1066; snorm double right1066; left1066 = right1066;
 // min16float left1067; unorm double right1067; left1067 = right1067;
  min16float left1068; snorm min16float right1068; left1068 = right1068;
  min16float left1069; unorm min16float right1069; left1069 = right1069;
- min16float left1070; snorm min10float right1070; left1070 = right1070;  // expected-warning {{min10float is promoted to min16float}}
- min16float left1071; unorm min10float right1071; left1071 = right1071;  // expected-warning {{min10float is promoted to min16float}}
+ min16float left1070; snorm min10float right1070; left1070 = right1070;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
+ min16float left1071; unorm min10float right1071; left1071 = right1071;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 // snorm min16float left1072;  float right1072; left1072 = right1072;
 // snorm min16float left1073; snorm float right1073; left1073 = right1073;
 // snorm min16float left1074; unorm float right1074; left1074 = right1074;
@@ -273,9 +273,9 @@ unorm double left1063; unorm min10float right1063; left1063 = right1063;  // exp
 snorm min16float left1078;  min16float right1078; left1078 = right1078;
 snorm min16float left1079; snorm min16float right1079; left1079 = right1079;
 snorm min16float left1080; unorm min16float right1080; left1080 = right1080;
-snorm min16float left1081;  min10float right1081; left1081 = right1081;  // expected-warning {{min10float is promoted to min16float}}
-snorm min16float left1082; snorm min10float right1082; left1082 = right1082;  // expected-warning {{min10float is promoted to min16float}}
-snorm min16float left1083; unorm min10float right1083; left1083 = right1083;  // expected-warning {{min10float is promoted to min16float}}
+snorm min16float left1081;  min10float right1081; left1081 = right1081;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
+snorm min16float left1082; snorm min10float right1082; left1082 = right1082;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
+snorm min16float left1083; unorm min10float right1083; left1083 = right1083;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 // unorm min16float left1084;  float right1084; left1084 = right1084;
 // unorm min16float left1085; snorm float right1085; left1085 = right1085;
 // unorm min16float left1086; unorm float right1086; left1086 = right1086;
@@ -285,17 +285,17 @@ snorm min16float left1083; unorm min10float right1083; left1083 = right1083;  //
 unorm min16float left1090;  min16float right1090; left1090 = right1090;
 unorm min16float left1091; snorm min16float right1091; left1091 = right1091;
 unorm min16float left1092; unorm min16float right1092; left1092 = right1092;
-unorm min16float left1093;  min10float right1093; left1093 = right1093;  // expected-warning {{min10float is promoted to min16float}}
-unorm min16float left1094; snorm min10float right1094; left1094 = right1094;  // expected-warning {{min10float is promoted to min16float}}
-unorm min16float left1095; unorm min10float right1095; left1095 = right1095;  // expected-warning {{min10float is promoted to min16float}}
+unorm min16float left1093;  min10float right1093; left1093 = right1093;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
+unorm min16float left1094; snorm min10float right1094; left1094 = right1094;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
+unorm min16float left1095; unorm min10float right1095; left1095 = right1095;  // expected-warning {{min10float is promoted to min16float}} fxc-pass {{}}
 // min10float left1096; snorm float right1096; left1096 = right1096;
 // min10float left1097; unorm float right1097; left1097 = right1097;
 // min10float left1098; snorm double right1098; left1098 = right1098;
 // min10float left1099; unorm double right1099; left1099 = right1099;
 // min10float left1100; snorm min16float right1100; left1100 = right1100;
 // min10float left1101; unorm min16float right1101; left1101 = right1101;
- min10float left1102; snorm min10float right1102; left1102 = right1102;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} //
- min10float left1103; unorm min10float right1103; left1103 = right1103;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} //
+ min10float left1102; snorm min10float right1102; left1102 = right1102;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} fxc-pass {{}} //
+ min10float left1103; unorm min10float right1103; left1103 = right1103;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} fxc-pass {{}} //
 // snorm min10float left1104;  float right1104; left1104 = right1104;
 // snorm min10float left1105; snorm float right1105; left1105 = right1105;
 // snorm min10float left1106; unorm float right1106; left1106 = right1106;
@@ -305,9 +305,9 @@ unorm min16float left1095; unorm min10float right1095; left1095 = right1095;  //
 // snorm min10float left1110;  min16float right1110; left1110 = right1110;
 // snorm min10float left1111; snorm min16float right1111; left1111 = right1111;
 // snorm min10float left1112; unorm min16float right1112; left1112 = right1112;
-snorm min10float left1113;  min10float right1113; left1113 = right1113;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} //
-snorm min10float left1114; snorm min10float right1114; left1114 = right1114;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} //
-snorm min10float left1115; unorm min10float right1115; left1115 = right1115;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} //
+snorm min10float left1113;  min10float right1113; left1113 = right1113;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} fxc-pass {{}} //
+snorm min10float left1114; snorm min10float right1114; left1114 = right1114;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} fxc-pass {{}} //
+snorm min10float left1115; unorm min10float right1115; left1115 = right1115;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} fxc-pass {{}} //
 // unorm min10float left1116;  float right1116; left1116 = right1116;
 // unorm min10float left1117; snorm float right1117; left1117 = right1117;
 // unorm min10float left1118; unorm float right1118; left1118 = right1118;
@@ -317,8 +317,8 @@ snorm min10float left1115; unorm min10float right1115; left1115 = right1115;  //
 // unorm min10float left1122;  min16float right1122; left1122 = right1122;
 // unorm min10float left1123; snorm min16float right1123; left1123 = right1123;
 // unorm min10float left1124; unorm min16float right1124; left1124 = right1124;
-unorm min10float left1125;  min10float right1125; left1125 = right1125;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} //
-unorm min10float left1126; snorm min10float right1126; left1126 = right1126;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} //
-unorm min10float left1127; unorm min10float right1127; left1127 = right1127;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} //
+unorm min10float left1125;  min10float right1125; left1125 = right1125;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} fxc-pass {{}} //
+unorm min10float left1126; snorm min10float right1126; left1126 = right1126;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} fxc-pass {{}} //
+unorm min10float left1127; unorm min10float right1127; left1127 = right1127;  // expected-warning {{min10float is promoted to min16float}} expected-warning {{min10float is promoted to min16float}} fxc-pass {{}} //
 
-}
+}

Diff do ficheiro suprimidas por serem muito extensas
+ 322 - 305
tools/clang/test/HLSL/scalar-operators-exact-precision.hlsl


Diff do ficheiro suprimidas por serem muito extensas
+ 204 - 192
tools/clang/test/HLSL/scalar-operators.hlsl


+ 4 - 4
tools/clang/test/HLSL/semantics.hlsl

@@ -16,7 +16,7 @@ cbuffer CBInit : register(b2)
     float g2_foo5 : foo : fubar : packoffset(c5);
     float g2_foo6 : packoffset(c6) : foo : fubar;
     /*verify-ast
-      VarDecl <col:5, col:11> col:11 g2_foo6 'float'
+      VarDecl parent cbuffer <col:5, col:11> col:11 g2_foo6 'const float'
       |-ConstantPacking <col:21> packoffset(c6.x)
       |-SemanticDecl <col:38> "foo"
       `-SemanticDecl <col:44> "fubar"
@@ -28,7 +28,7 @@ cbuffer CBInit2 : register(b3) : cbuffer_semantic           /* fxc-warning {{X32
   HLSLBufferDecl <col:1, line:36:1> line:26:9 cbuffer CBInit2
   |-RegisterAssignment <col:19> register(b3)
   |-SemanticDecl <col:34> "cbuffer_semantic"
-  `-VarDecl <line:35:5, col:11> col:11 g3_foo1 'float'
+  `-VarDecl parent cbuffer <line:35:5, col:11> col:11 g3_foo1 'const float'
     `-SemanticDecl <col:21> "foo"
 */
 {
@@ -48,9 +48,9 @@ struct semantic_on_struct_instance {
   CXXRecordDecl <col:1, line:57:1> line:46:8 struct semantic_on_struct_instance definition
   |-CXXRecordDecl <col:1, col:8> col:8 implicit struct semantic_on_struct_instance
   `-FieldDecl <line:56:5, col:11> col:11 a 'float'
-  VarDecl <col:1, line:57:3> col:3 g_struct 'struct semantic_on_struct_instance':'semantic_on_struct_instance'
+  VarDecl <col:1, line:57:3> col:3 g_struct 'const struct semantic_on_struct_instance':'const semantic_on_struct_instance'
   `-SemanticDecl <col:14> "semantic"
-  VarDecl <col:1, line:58:3> col:3 g_struct2 'struct semantic_on_struct_instance':'semantic_on_struct_instance'
+  VarDecl <col:1, line:58:3> col:3 g_struct2 'const struct semantic_on_struct_instance':'const semantic_on_struct_instance'
   `-SemanticDecl <col:15> "semantic2"
 */
     float a;

+ 2 - 2
tools/clang/test/HLSL/uint4_add3.hlsl

@@ -11,6 +11,6 @@ float4 main(float4 a : A, float3 c :C) : SV_TARGET {
   float4 b = a;
   b += a.xyz;         /* expected-error {{cannot convert from 'vector<float, 3>' to 'float4'}} fxc-error {{X3017: cannot implicitly convert from 'const float3' to 'float4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
   float4 d = 0;
-  d = b+c;            /* expected-error {{cannot convert from 'vector<float, 3>' to 'float4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float3' to 'float4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
+  d = b+c;            /* expected-error {{cannot convert from 'float3' to 'float4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float3' to 'float4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
   return b + d;
-}
+}

+ 2 - 2
tools/clang/test/HLSL/vector-assignments.hlsl

@@ -14,7 +14,7 @@ float2 f2_none;
 
 // Direct initialization fails.
 // fxc error: error X3000: syntax error: unexpected token '('
-float2 f2_direct(0.1f, 0.2f); /* expected-error {{expected ')'}} expected-error {{expected parameter declarator}} expected-note {{to match this '('}} fxc-error {{X3000: syntax error: unexpected token '('}} */ /* */ /* */
+float2 f2_direct(0.1f, 0.2f); /* expected-error {{expected ')'}} expected-error {{expected parameter declarator}} expected-note {{to match this '('}} fxc-error {{X3000: syntax error: unexpected token '('}} */
 
 // Initialization list with members.
 float2 f2_all = { 0.1f, 0.2f };
@@ -82,4 +82,4 @@ pick_one(float2(0.1f, 0.2f));
 // this can be enabled, but it's causing additional problems because there is no HLSL-style ranking
 // of conversions (eg, float4->float4 is better than float4->float3).
 // pick_one(uint2(1, 2));
-}
+}

+ 49 - 49
tools/clang/test/HLSL/vector-conditional.hlsl

@@ -49,7 +49,7 @@ float4 a2[2];
 float4 a3[8];
 float a4[8];
 
-void Select(out Texture2D TOut) { /* expected-note {{candidate function}}  */
+void Select(out Texture2D TOut) { /* expected-note {{candidate function}} fxc-pass {{}} */
   TOut = b4.x ? T1 : T2;
 }
 
@@ -61,16 +61,16 @@ float4 main(float4 v0 : TEXCOORD) : SV_Target
 
   acc += b4.x ? v0 : (v0 + 1.0F);
   /*verify-ast
-    CompoundAssignOperator <col:3, col:32> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:32> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'acc' 'float4':'vector<float, 4>'
     `-ConditionalOperator <col:10, col:32> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:10, col:13> 'bool' <LValueToRValue>
-      | `-HLSLVectorElementExpr <col:10, col:13> 'bool' lvalue vectorcomponent x
-      |   `-DeclRefExpr <col:10> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
+      |-ImplicitCastExpr <col:10, col:13> 'const bool' <LValueToRValue>
+      | `-HLSLVectorElementExpr <col:10, col:13> 'const bool' lvalue vectorcomponent x
+      |   `-DeclRefExpr <col:10> 'const bool4':'const vector<bool, 4>' lvalue Var 'b4' 'const bool4':'const vector<bool, 4>'
       |-ImplicitCastExpr <col:17> 'float4':'vector<float, 4>' <LValueToRValue>
       | `-DeclRefExpr <col:17> 'float4':'vector<float, 4>' lvalue ParmVar 'v0' 'float4':'vector<float, 4>'
-      `-ParenExpr <col:22, col:32> 'vector<float, 4>'
-        `-BinaryOperator <col:23, col:28> 'vector<float, 4>' '+'
+      `-ParenExpr <col:22, col:32> 'float4':'vector<float, 4>'
+        `-BinaryOperator <col:23, col:28> 'float4':'vector<float, 4>' '+'
           |-ImplicitCastExpr <col:23> 'float4':'vector<float, 4>' <LValueToRValue>
           | `-DeclRefExpr <col:23> 'float4':'vector<float, 4>' lvalue ParmVar 'v0' 'float4':'vector<float, 4>'
           `-ImplicitCastExpr <col:28> 'vector<float, 4>':'vector<float, 4>' <HLSLVectorSplat>
@@ -79,12 +79,12 @@ float4 main(float4 v0 : TEXCOORD) : SV_Target
 
   acc += b4.x ? v0 : 1.0F;
   /*verify-ast
-    CompoundAssignOperator <col:3, col:22> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:22> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'acc' 'float4':'vector<float, 4>'
     `-ConditionalOperator <col:10, col:22> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:10, col:13> 'bool' <LValueToRValue>
-      | `-HLSLVectorElementExpr <col:10, col:13> 'bool' lvalue vectorcomponent x
-      |   `-DeclRefExpr <col:10> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
+      |-ImplicitCastExpr <col:10, col:13> 'const bool' <LValueToRValue>
+      | `-HLSLVectorElementExpr <col:10, col:13> 'const bool' lvalue vectorcomponent x
+      |   `-DeclRefExpr <col:10> 'const bool4':'const vector<bool, 4>' lvalue Var 'b4' 'const bool4':'const vector<bool, 4>'
       |-ImplicitCastExpr <col:17> 'float4':'vector<float, 4>' <LValueToRValue>
       | `-DeclRefExpr <col:17> 'float4':'vector<float, 4>' lvalue ParmVar 'v0' 'float4':'vector<float, 4>'
       `-ImplicitCastExpr <col:22> 'vector<float, 4>':'vector<float, 4>' <HLSLVectorSplat>
@@ -93,15 +93,15 @@ float4 main(float4 v0 : TEXCOORD) : SV_Target
 
   acc += b4 ? v0 : (v0 + 1.0F);
   /*verify-ast
-    CompoundAssignOperator <col:3, col:30> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:30> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'acc' 'float4':'vector<float, 4>'
     `-ConditionalOperator <col:10, col:30> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:10> 'bool4':'vector<bool, 4>' <LValueToRValue>
-      | `-DeclRefExpr <col:10> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
+      |-ImplicitCastExpr <col:10> 'const bool4':'const vector<bool, 4>' <LValueToRValue>
+      | `-DeclRefExpr <col:10> 'const bool4':'const vector<bool, 4>' lvalue Var 'b4' 'const bool4':'const vector<bool, 4>'
       |-ImplicitCastExpr <col:15> 'float4':'vector<float, 4>' <LValueToRValue>
       | `-DeclRefExpr <col:15> 'float4':'vector<float, 4>' lvalue ParmVar 'v0' 'float4':'vector<float, 4>'
-      `-ParenExpr <col:20, col:30> 'vector<float, 4>'
-        `-BinaryOperator <col:21, col:26> 'vector<float, 4>' '+'
+      `-ParenExpr <col:20, col:30> 'float4':'vector<float, 4>'
+        `-BinaryOperator <col:21, col:26> 'float4':'vector<float, 4>' '+'
           |-ImplicitCastExpr <col:21> 'float4':'vector<float, 4>' <LValueToRValue>
           | `-DeclRefExpr <col:21> 'float4':'vector<float, 4>' lvalue ParmVar 'v0' 'float4':'vector<float, 4>'
           `-ImplicitCastExpr <col:26> 'vector<float, 4>':'vector<float, 4>' <HLSLVectorSplat>
@@ -110,11 +110,11 @@ float4 main(float4 v0 : TEXCOORD) : SV_Target
 
   acc += b4 ? v0 : 1.0F;
   /*verify-ast
-    CompoundAssignOperator <col:3, col:20> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:20> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'acc' 'float4':'vector<float, 4>'
     `-ConditionalOperator <col:10, col:20> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:10> 'bool4':'vector<bool, 4>' <LValueToRValue>
-      | `-DeclRefExpr <col:10> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
+      |-ImplicitCastExpr <col:10> 'const bool4':'const vector<bool, 4>' <LValueToRValue>
+      | `-DeclRefExpr <col:10> 'const bool4':'const vector<bool, 4>' lvalue Var 'b4' 'const bool4':'const vector<bool, 4>'
       |-ImplicitCastExpr <col:15> 'float4':'vector<float, 4>' <LValueToRValue>
       | `-DeclRefExpr <col:15> 'float4':'vector<float, 4>' lvalue ParmVar 'v0' 'float4':'vector<float, 4>'
       `-ImplicitCastExpr <col:20> 'vector<float, 4>':'vector<float, 4>' <HLSLVectorSplat>
@@ -123,19 +123,19 @@ float4 main(float4 v0 : TEXCOORD) : SV_Target
 
   acc.xy += b4.xy ? v0.xy : (v0 + 1.0F);                    /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
   /*verify-ast
-    CompoundAssignOperator <col:3, col:39> 'vector<float, 2>':'vector<float, 2>' lvalue vectorcomponent '+=' ComputeLHSTy='vector<float, 2>' ComputeResultTy='vector<float, 2>'
+    CompoundAssignOperator <col:3, col:39> 'vector<float, 2>':'vector<float, 2>' lvalue vectorcomponent '+=' ComputeLHSTy='vector<float, 2>':'vector<float, 2>' ComputeResultTy='vector<float, 2>':'vector<float, 2>'
     |-HLSLVectorElementExpr <col:3, col:7> 'vector<float, 2>':'vector<float, 2>' lvalue vectorcomponent xy
     | `-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'acc' 'float4':'vector<float, 4>'
     `-ConditionalOperator <col:13, col:39> 'vector<float, 2>'
-      |-ImplicitCastExpr <col:13, col:16> 'vector<bool, 2>':'vector<bool, 2>' <LValueToRValue>
-      | `-HLSLVectorElementExpr <col:13, col:16> 'vector<bool, 2>':'vector<bool, 2>' lvalue vectorcomponent xy
-      |   `-DeclRefExpr <col:13> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
+      |-ImplicitCastExpr <col:13, col:16> 'const vector<bool, 2>':'const vector<bool, 2>' <LValueToRValue>
+      | `-HLSLVectorElementExpr <col:13, col:16> 'const vector<bool, 2>':'const vector<bool, 2>' lvalue vectorcomponent xy
+      |   `-DeclRefExpr <col:13> 'const bool4':'const vector<bool, 4>' lvalue Var 'b4' 'const bool4':'const vector<bool, 4>'
       |-ImplicitCastExpr <col:21, col:24> 'vector<float, 2>':'vector<float, 2>' <LValueToRValue>
       | `-HLSLVectorElementExpr <col:21, col:24> 'vector<float, 2>':'vector<float, 2>' lvalue vectorcomponent xy
       |   `-DeclRefExpr <col:21> 'float4':'vector<float, 4>' lvalue ParmVar 'v0' 'float4':'vector<float, 4>'
       `-ImplicitCastExpr <col:29, col:39> 'vector<float, 2>':'vector<float, 2>' <HLSLVectorTruncationCast>
-        `-ParenExpr <col:29, col:39> 'vector<float, 4>'
-          `-BinaryOperator <col:30, col:35> 'vector<float, 4>' '+'
+        `-ParenExpr <col:29, col:39> 'float4':'vector<float, 4>'
+          `-BinaryOperator <col:30, col:35> 'float4':'vector<float, 4>' '+'
             |-ImplicitCastExpr <col:30> 'float4':'vector<float, 4>' <LValueToRValue>
             | `-DeclRefExpr <col:30> 'float4':'vector<float, 4>' lvalue ParmVar 'v0' 'float4':'vector<float, 4>'
             `-ImplicitCastExpr <col:35> 'vector<float, 4>':'vector<float, 4>' <HLSLVectorSplat>
@@ -150,11 +150,11 @@ float4 main(float4 v0 : TEXCOORD) : SV_Target
   // lit float/int
   acc += b4 ? v0 : 1.1;
   /*verify-ast
-    CompoundAssignOperator <col:3, col:20> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:20> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'acc' 'float4':'vector<float, 4>'
     `-ConditionalOperator <col:10, col:20> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:10> 'bool4':'vector<bool, 4>' <LValueToRValue>
-      | `-DeclRefExpr <col:10> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
+      |-ImplicitCastExpr <col:10> 'const bool4':'const vector<bool, 4>' <LValueToRValue>
+      | `-DeclRefExpr <col:10> 'const bool4':'const vector<bool, 4>' lvalue Var 'b4' 'const bool4':'const vector<bool, 4>'
       |-ImplicitCastExpr <col:15> 'float4':'vector<float, 4>' <LValueToRValue>
       | `-DeclRefExpr <col:15> 'float4':'vector<float, 4>' lvalue ParmVar 'v0' 'float4':'vector<float, 4>'
       `-ImplicitCastExpr <col:20> 'vector<float, 4>':'vector<float, 4>' <HLSLVectorSplat>
@@ -163,11 +163,11 @@ float4 main(float4 v0 : TEXCOORD) : SV_Target
   */
   acc += b4 ? v0 : -2;
   /*verify-ast
-    CompoundAssignOperator <col:3, col:21> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:21> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'acc' 'float4':'vector<float, 4>'
     `-ConditionalOperator <col:10, col:21> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:10> 'bool4':'vector<bool, 4>' <LValueToRValue>
-      | `-DeclRefExpr <col:10> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
+      |-ImplicitCastExpr <col:10> 'const bool4':'const vector<bool, 4>' <LValueToRValue>
+      | `-DeclRefExpr <col:10> 'const bool4':'const vector<bool, 4>' lvalue Var 'b4' 'const bool4':'const vector<bool, 4>'
       |-ImplicitCastExpr <col:15> 'float4':'vector<float, 4>' <LValueToRValue>
       | `-DeclRefExpr <col:15> 'float4':'vector<float, 4>' lvalue ParmVar 'v0' 'float4':'vector<float, 4>'
       `-ImplicitCastExpr <col:20, col:21> 'vector<float, 4>':'vector<float, 4>' <HLSLVectorSplat>
@@ -179,11 +179,11 @@ float4 main(float4 v0 : TEXCOORD) : SV_Target
   min16float4 mf4 = (min16float4)acc * (min16float4)v0;
   mf4 += b4 ? v0 : mf4;                                     /* expected-warning {{conversion from larger type 'vector<float, 4>' to smaller type 'min16float4', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} */
   /*verify-ast
-    CompoundAssignOperator <col:3, col:20> 'min16float4':'vector<min16float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:20> 'min16float4':'vector<min16float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>':'vector<float, 4>' ComputeResultTy='vector<float, 4>':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'min16float4':'vector<min16float, 4>' lvalue Var 'mf4' 'min16float4':'vector<min16float, 4>'
     `-ConditionalOperator <col:10, col:20> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:10> 'bool4':'vector<bool, 4>' <LValueToRValue>
-      | `-DeclRefExpr <col:10> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
+      |-ImplicitCastExpr <col:10> 'const bool4':'const vector<bool, 4>' <LValueToRValue>
+      | `-DeclRefExpr <col:10> 'const bool4':'const vector<bool, 4>' lvalue Var 'b4' 'const bool4':'const vector<bool, 4>'
       |-ImplicitCastExpr <col:15> 'float4':'vector<float, 4>' <LValueToRValue>
       | `-DeclRefExpr <col:15> 'float4':'vector<float, 4>' lvalue ParmVar 'v0' 'float4':'vector<float, 4>'
       `-ImplicitCastExpr <col:20> 'vector<float, 4>' <HLSLCC_FloatingCast>
@@ -192,11 +192,11 @@ float4 main(float4 v0 : TEXCOORD) : SV_Target
   */
   acc += b4 ? v0 : mf4;
   /*verify-ast
-    CompoundAssignOperator <col:3, col:20> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:20> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'acc' 'float4':'vector<float, 4>'
     `-ConditionalOperator <col:10, col:20> 'vector<float, 4>'
-      |-ImplicitCastExpr <col:10> 'bool4':'vector<bool, 4>' <LValueToRValue>
-      | `-DeclRefExpr <col:10> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
+      |-ImplicitCastExpr <col:10> 'const bool4':'const vector<bool, 4>' <LValueToRValue>
+      | `-DeclRefExpr <col:10> 'const bool4':'const vector<bool, 4>' lvalue Var 'b4' 'const bool4':'const vector<bool, 4>'
       |-ImplicitCastExpr <col:15> 'float4':'vector<float, 4>' <LValueToRValue>
       | `-DeclRefExpr <col:15> 'float4':'vector<float, 4>' lvalue ParmVar 'v0' 'float4':'vector<float, 4>'
       `-ImplicitCastExpr <col:20> 'vector<float, 4>' <HLSLCC_FloatingCast>
@@ -221,7 +221,7 @@ float4 main(float4 v0 : TEXCOORD) : SV_Target
   // Matrix ternary support:
   acc += mul(acc, b4x4 ? m1 : m2);
   /*verify-ast
-    CompoundAssignOperator <col:3, col:33> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<float, 4>' ComputeResultTy='vector<float, 4>'
+    CompoundAssignOperator <col:3, col:33> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='float4':'vector<float, 4>' ComputeResultTy='float4':'vector<float, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'acc' 'float4':'vector<float, 4>'
     `-CallExpr <col:10, col:33> 'vector<float, 4>':'vector<float, 4>'
       |-ImplicitCastExpr <col:10> 'vector<float, 4> (*)(vector<float, 4>, matrix<float, 4, 4>)' <FunctionToPointerDecay>
@@ -229,17 +229,17 @@ float4 main(float4 v0 : TEXCOORD) : SV_Target
       |-ImplicitCastExpr <col:14> 'float4':'vector<float, 4>' <LValueToRValue>
       | `-DeclRefExpr <col:14> 'float4':'vector<float, 4>' lvalue Var 'acc' 'float4':'vector<float, 4>'
       `-ConditionalOperator <col:19, col:31> 'matrix<float, 4, 4>'
-        |-ImplicitCastExpr <col:19> 'bool4x4':'matrix<bool, 4, 4>' <LValueToRValue>
-        | `-DeclRefExpr <col:19> 'bool4x4':'matrix<bool, 4, 4>' lvalue Var 'b4x4' 'bool4x4':'matrix<bool, 4, 4>'
-        |-ImplicitCastExpr <col:26> 'float4x4':'matrix<float, 4, 4>' <LValueToRValue>
-        | `-DeclRefExpr <col:26> 'float4x4':'matrix<float, 4, 4>' lvalue Var 'm1' 'float4x4':'matrix<float, 4, 4>'
-        `-ImplicitCastExpr <col:31> 'float4x4':'matrix<float, 4, 4>' <LValueToRValue>
-          `-DeclRefExpr <col:31> 'float4x4':'matrix<float, 4, 4>' lvalue Var 'm2' 'float4x4':'matrix<float, 4, 4>'
+        |-ImplicitCastExpr <col:19> 'const bool4x4':'const matrix<bool, 4, 4>' <LValueToRValue>
+        | `-DeclRefExpr <col:19> 'const bool4x4':'const matrix<bool, 4, 4>' lvalue Var 'b4x4' 'const bool4x4':'const matrix<bool, 4, 4>'
+        |-ImplicitCastExpr <col:26> 'const float4x4':'const matrix<float, 4, 4>' <LValueToRValue>
+        | `-DeclRefExpr <col:26> 'const float4x4':'const matrix<float, 4, 4>' lvalue Var 'm1' 'const float4x4':'const matrix<float, 4, 4>'
+        `-ImplicitCastExpr <col:31> 'const float4x4':'const matrix<float, 4, 4>' <LValueToRValue>
+          `-DeclRefExpr <col:31> 'const float4x4':'const matrix<float, 4, 4>' lvalue Var 'm2' 'const float4x4':'const matrix<float, 4, 4>'
   */
   // float : double and matrix : scalar
   acc += mul(acc, b4x4 ? m1 : (double)1.0);                 /*  expected-warning {{conversion from larger type 'vector<double, 4>' to smaller type 'float4', possible loss of data}} fxc-warning {{X3205: conversion from larger type to smaller, possible loss of data}} */
   /*verify-ast
-    CompoundAssignOperator <col:3, col:42> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<double, 4>' ComputeResultTy='vector<double, 4>'
+    CompoundAssignOperator <col:3, col:42> 'float4':'vector<float, 4>' lvalue '+=' ComputeLHSTy='vector<double, 4>':'vector<double, 4>' ComputeResultTy='vector<double, 4>':'vector<double, 4>'
     |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'acc' 'float4':'vector<float, 4>'
     `-CallExpr <col:10, col:42> 'vector<double, 4>':'vector<double, 4>'
       |-ImplicitCastExpr <col:10> 'vector<double, 4> (*)(vector<double, 4>, matrix<double, 4, 4>)' <FunctionToPointerDecay>
@@ -248,11 +248,11 @@ float4 main(float4 v0 : TEXCOORD) : SV_Target
       | `-ImplicitCastExpr <col:14> 'float4':'vector<float, 4>' <LValueToRValue>
       |   `-DeclRefExpr <col:14> 'float4':'vector<float, 4>' lvalue Var 'acc' 'float4':'vector<float, 4>'
       `-ConditionalOperator <col:19, col:39> 'matrix<double, 4, 4>'
-        |-ImplicitCastExpr <col:19> 'bool4x4':'matrix<bool, 4, 4>' <LValueToRValue>
-        | `-DeclRefExpr <col:19> 'bool4x4':'matrix<bool, 4, 4>' lvalue Var 'b4x4' 'bool4x4':'matrix<bool, 4, 4>'
+        |-ImplicitCastExpr <col:19> 'const bool4x4':'const matrix<bool, 4, 4>' <LValueToRValue>
+        | `-DeclRefExpr <col:19> 'const bool4x4':'const matrix<bool, 4, 4>' lvalue Var 'b4x4' 'const bool4x4':'const matrix<bool, 4, 4>'
         |-ImplicitCastExpr <col:26> 'matrix<double, 4, 4>' <HLSLCC_FloatingCast>
-        | `-ImplicitCastExpr <col:26> 'float4x4':'matrix<float, 4, 4>' <LValueToRValue>
-        |   `-DeclRefExpr <col:26> 'float4x4':'matrix<float, 4, 4>' lvalue Var 'm1' 'float4x4':'matrix<float, 4, 4>'
+        | `-ImplicitCastExpr <col:26> 'const float4x4':'const matrix<float, 4, 4>' <LValueToRValue>
+        |   `-DeclRefExpr <col:26> 'const float4x4':'const matrix<float, 4, 4>' lvalue Var 'm1' 'const float4x4':'const matrix<float, 4, 4>'
         `-ImplicitCastExpr <col:31, col:39> 'matrix<double, 4, 4>':'matrix<double, 4, 4>' <HLSLMatrixSplat>
           `-CStyleCastExpr <col:31, col:39> 'double' <NoOp>
             `-ImplicitCastExpr <col:39> 'double' <FloatingCast>

+ 7 - 7
tools/clang/test/HLSL/vector-syntax.hlsl

@@ -90,12 +90,12 @@ void vector_out_of_bounds() {
 
 void vector_unsigned() {
    unsigned int4 intvector;
-   unsigned min16int4 min16vector;
-   unsigned int64_t3 int64vector; /* */
-   unsigned uint3 uintvector;
-   unsigned min16uint4 min16uintvector;
-   unsigned uint64_t2 int64uintvector;                      /* */
-   unsigned dword3 dwordvector; /* fxc-error {{X3000: unrecognized identifier 'dword3'}} */
+   unsigned min16int4 min16vector;                          /* fxc-error {{X3085: unsigned can not be used with type}} */
+   unsigned int64_t3 int64vector; /* */                     /* fxc-error {{X3000: syntax error: unexpected token 'int64_t3'}} */
+   unsigned uint3 uintvector;     /* fxc-error {{X3085: unsigned can not be used with type}} */
+   unsigned min16uint4 min16uintvector;                     /* fxc-error {{X3085: unsigned can not be used with type}} */
+   unsigned uint64_t2 int64uintvector;                      /* */    /* fxc-error {{X3000: syntax error: unexpected token 'uint64_t2'}} */
+   unsigned dword3 dwordvector; /* fxc-error {{X3000: syntax error: unexpected token 'dword3'}} */
 
    unsigned float2 floatvector; /* expected-error {{'float' cannot be signed or unsigned}} fxc-error {{X3085: unsigned can not be used with type}} */
    unsigned bool3 boolvector;   /* expected-error {{'bool' cannot be signed or unsigned}} fxc-error {{X3085: unsigned can not be used with type}} */
@@ -180,4 +180,4 @@ float fn() {
 // float4 main(float4 param4 : FOO) : FOO {
 float4 plain(float4 param4 /* : FOO */) /*: FOO */{
   return fn();
-}
+}

+ 9 - 6
tools/clang/unittests/HLSL/VerifierTest.cpp

@@ -18,18 +18,16 @@
 
 #ifdef _WIN32
 #include "WexTestClass.h"
+#define TEST_CLASS_DERIVATION
+#else
+#define TEST_DERIVATION : public ::testing::Test
 #endif
 #include "HlslTestUtils.h"
 
 using namespace std;
 
 // The test fixture.
-#ifdef _WIN32
-class VerifierTest {
-#else
-class VerifierTest : public ::testing::Test {
-#endif
-
+class VerifierTest TEST_CLASS_DERIVATION {
 public:
   BEGIN_TEST_CLASS(VerifierTest)
     TEST_CLASS_PROPERTY(L"Parallel", L"true")
@@ -80,6 +78,7 @@ public:
   TEST_METHOD(RunUint4Add3)
   TEST_METHOD(RunBadInclude)
   TEST_METHOD(RunWave)
+  TEST_METHOD(RunBinopDims)
 
   void CheckVerifies(const wchar_t* path) {
     WEX::TestExecution::SetVerifyOutput verifySettings(WEX::TestExecution::VerifyOutputSettings::LogOnlyFailures);
@@ -309,3 +308,7 @@ TEST_F(VerifierTest, RunBadInclude) {
 TEST_F(VerifierTest, RunWave) {
   CheckVerifiesHLSL(L"wave.hlsl");
 }
+
+TEST_F(VerifierTest, RunBinopDims) {
+  CheckVerifiesHLSL(L"binop-dims.hlsl");
+}

+ 57 - 24
utils/hct/VerifierHelper.py

@@ -48,33 +48,66 @@ HlslVerifierTestCpp = os.path.expandvars(r'${HLSL_SRC_DIR}\tools\clang\unittests
 HlslDataDir = os.path.expandvars(r'${HLSL_SRC_DIR}\tools\clang\test\HLSL')
 HlslBinDir = os.path.expandvars(r'${HLSL_BLD_DIR}\Debug\bin')
 VerifierTests = {
-    'RunAttributes': "attributes.hlsl",
-#    'RunCppErrors': "cpp-errors.hlsl",             # This test doesn't work properly in HLSL (fxc mode)
-    'RunEnums' : "enums.hlsl",
-    'RunIndexingOperator': "indexing-operator.hlsl",
-    'RunIntrinsicExamples': "intrinsic-examples.hlsl",
-    'RunMatrixAssignments': "matrix-assignments.hlsl",
-    'RunMatrixSyntax': "matrix-syntax.hlsl",
-    'RunMoreOperators': "more-operators.hlsl",
-    'RunObjectOperators': "object-operators.hlsl",
-    'RunPackReg': "packreg.hlsl",
+    'RunAttributes': 'attributes.hlsl',
+    'RunBadInclude': 'bad-include.hlsl',
+    'RunBinopDims': 'binop-dims.hlsl',
+    'RunCXX11Attributes': 'cxx11-attributes.hlsl',
+    'RunConstAssign': 'const-assign.hlsl',
+    'RunConstDefault': 'const-default.hlsl',
+    'RunConstExpr': 'const-expr.hlsl',
+    'RunCppErrors': 'cpp-errors.hlsl',
+    'RunCppErrorsHV2015': 'cpp-errors-hv2015.hlsl',
+    'RunDerivedToBaseCasts': 'derived-to-base.hlsl',
+    'RunEffectsSyntax': 'effects-syntax.hlsl',
+    'RunEnums': 'enums.hlsl',
+    'RunFunctions': 'functions.hlsl',
+    'RunImplicitCasts': 'implicit-casts.hlsl',
+    'RunIndexingOperator': 'indexing-operator.hlsl',
+    'RunIntrinsicExamples': 'intrinsic-examples.hlsl',
+    'RunLiterals': 'literals.hlsl',
+    'RunMatrixAssignments': 'matrix-assignments.hlsl',
+    'RunMatrixSyntax': 'matrix-syntax.hlsl',
+    'RunMatrixSyntaxExactPrecision': 'matrix-syntax-exact-precision.hlsl',
+    'RunMoreOperators': 'more-operators.hlsl',
+    'RunObjectOperators': 'object-operators.hlsl',
+    'RunPackReg': 'packreg.hlsl',
     'RunRayTracings': "raytracing.hlsl",
-    'RunScalarAssignments': "scalar-assignments.hlsl",
-    'RunScalarOperatorsAssign': "scalar-operators-assign.hlsl",
-    'RunScalarOperatorsAssignExactPrecision': "scalar-operators-assign.hlsl",
-    'RunScalarOperators': "scalar-operators.hlsl",
-    'RunStructAssignments': "struct-assignments.hlsl",
-    'RunTemplateChecks': "template-checks.hlsl",
-    'RunVarmodsSyntax': "varmods-syntax.hlsl",
-    'RunVectorAssignments': "vector-assignments.hlsl",
-    'RunVectorSyntaxMix': "vector-syntax-mix.c",
-    'RunVectorSyntax': "vector-syntax.hlsl",
-    'RunTypemodsSyntax': "typemods-syntax.hlsl",
-    'RunSemantics': "semantics.hlsl",
+    'RunScalarAssignments': 'scalar-assignments.hlsl',
+    'RunScalarAssignmentsExactPrecision': 'scalar-assignments-exact-precision.hlsl',
+    'RunScalarOperators': 'scalar-operators.hlsl',
+    'RunScalarOperatorsAssign': 'scalar-operators-assign.hlsl',
+    'RunScalarOperatorsAssignExactPrecision': 'scalar-operators-assign-exact-precision.hlsl',
+    'RunScalarOperatorsExactPrecision': 'scalar-operators-exact-precision.hlsl',
+    'RunSemantics': 'semantics.hlsl',
+    'RunString': 'string.hlsl',
+    'RunStructAssignments': 'struct-assignments.hlsl',
+    'RunTemplateChecks': 'template-checks.hlsl',
+    'RunTypemodsSyntax': 'typemods-syntax.hlsl',
+    'RunUint4Add3': 'uint4_add3.hlsl',
+    'RunVarmodsSyntax': 'varmods-syntax.hlsl',
+    'RunVectorAssignments': 'vector-assignments.hlsl',
+    'RunVectorConditional': 'vector-conditional.hlsl',
+    'RunVectorSyntax': 'vector-syntax.hlsl',
+    'RunVectorSyntaxExactPrecision': 'vector-syntax-exact-precision.hlsl',
+    'RunVectorSyntaxMix': 'vector-syntax-mix.hlsl',
+    'RunWave': 'wave.hlsl',
 }
 
 # The following test(s) do not work in fxc mode:
-fxcExcludedTests = ['RunCppErrors']
+fxcExcludedTests = [
+    'RunCppErrors',
+    'RunCppErrorsHV2015',
+    'RunCXX11Attributes',
+    'RunEnums',
+    'RunIntrinsicExamples',
+    'RunMatrixSyntaxExactPrecision',
+    'RunRayTracings',
+    'RunScalarAssignmentsExactPrecision',
+    'RunScalarOperatorsAssignExactPrecision',
+    'RunScalarOperatorsExactPrecision',
+    'RunVectorSyntaxExactPrecision',
+    'RunWave',
+]
 
 # rxRUN = re.compile(r'[ RUN      ] VerifierTest.(\w+)')	# gtest syntax
 rxRUN = re.compile(r'StartGroup: VerifierTest::(\w+)')		# TAEF syntax
@@ -543,7 +576,7 @@ class File(object):
             result[i] = line, diag_col, expected
 
         with open(result_filename, 'wt') as f:
-            f.write('\n'.join(map(lambda line, diag_col, expected: line, result)))
+            f.write('\n'.join(map(lambda (line, diag_col, expected): line, result)))
 
     def TryAst(self, result_filename=None):
         temp_filename = os.path.expandvars(r'${TEMP}\%s' % os.path.split(self.filename)[1])

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff