implicit-casts.hlsl 77 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993
  1. // RUN: %clang_cc1 -Wno-unused-value -fsyntax-only -ffreestanding -verify %s
  2. // To test with the classic compiler, run
  3. // %sdxroot%\tools\x86\fxc.exe /T ps_5_1 implicit-casts.hlsl
  4. // we use -Wno-unused-value because we generate some no-op expressions to yield errors
  5. // without also putting them in a static assertion
  6. // __decltype is the GCC way of saying 'decltype', but doesn't require C++11
  7. // _Static_assert is the C11 way of saying 'static_assert', but doesn't require C++11
  8. #ifdef VERIFY_FXC
  9. #define _Static_assert(a,b,c) ;
  10. #define VERIFY_TYPES(typ, exp) {typ _tmp_var_ = exp;}
  11. #else
  12. #define VERIFY_TYPES(typ, exp) _Static_assert(std::is_same<typ, __decltype(exp)>::value, #typ " == __decltype(" #exp ") failed")
  13. #endif
  14. // The following is meant to be processed by the CodeTags extension in the "VS For Everything" Visual Studio extension:
  15. /*<py>
  16. # Some code to allow regeneration of code blocks while preserving expected error comments on unchanged lines
  17. import re
  18. rxComments = re.compile(r'(//.*|/\*.*?\*\/)')
  19. def strip_comments(line):
  20. line = rxComments.sub('', line)
  21. return line.strip()
  22. def save_error_comments(lines):
  23. saved = {}
  24. for line in lines:
  25. key = strip_comments(line)
  26. if key and line.strip() != key:
  27. saved[key] = line
  28. return saved
  29. def restore_error_comments(saved, lines):
  30. return [saved.get(line.strip(), line) for line in lines]
  31. def modify(lines, newlines):
  32. return restore_error_comments(save_error_comments(lines), newlines)
  33. cmp_types = [ # list of (type, shorthand)
  34. ('float', 'f'),
  35. ('int', 'i'),
  36. ('uint', 'u'),
  37. ('bool', 'b'),
  38. ('double', 'd'),
  39. ('int64_t', 'i64'),
  40. ('uint64_t', 'u64'),
  41. ('min16float', 'm16f'),
  42. ]
  43. vec_dims = [1, 2, 4]
  44. mat_dims = [(1,1), (4,1), (1,4), (4,4)]
  45. def scalar_types(cmp_types = cmp_types):
  46. return [{'type': cmp, 'id': id, 'val': (n+1)*100}
  47. for n, (cmp, id) in enumerate(cmp_types)]
  48. def vector_types(cmp_types, vec_dims = vec_dims):
  49. return [{'type': cmp+str(d), 'id': id+str(d), 'val': (n+1)*100 + d}
  50. for n, (cmp, id) in enumerate(cmp_types)
  51. for d in vec_dims]
  52. def matrix_types(cmp_types, mat_dims = mat_dims):
  53. return [{'type': '%s%dx%d' % (cmp, d1, d2), 'id': '%s%dx%d' % (id, d1, d2), 'val': (n+1)*100 + d1*10 + d2}
  54. for n, (cmp, id) in enumerate(cmp_types)
  55. for d1, d2 in mat_dims]
  56. def all_types(cmp_types = cmp_types, vec_dims = vec_dims, mat_dims = mat_dims):
  57. return scalar_types(cmp_types) + vector_types(cmp_types, vec_dims) + matrix_types(cmp_types, mat_dims)
  58. def gen_code(template, combos = all_types()):
  59. return [template % combo for combo in combos]
  60. # For overloaded functions, scalar, vector1 and matrix1x1 are ambiguous,
  61. # so cut the single component vector/matrix out:
  62. overload_types = all_types(cmp_types=cmp_types[:-1], vec_dims=vec_dims[1:], mat_dims=mat_dims[1:])
  63. </py>
  64. */
  65. // <py::lines('GENERATED_CODE')>modify(lines, gen_code('%(type)s g_%(id)s;'))</py>
  66. // GENERATED_CODE:BEGIN
  67. float g_f;
  68. int g_i;
  69. uint g_u;
  70. bool g_b;
  71. double g_d;
  72. int64_t g_i64; /* fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
  73. uint64_t g_u64; /* fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
  74. min16float g_m16f;
  75. float1 g_f1;
  76. float2 g_f2;
  77. float4 g_f4;
  78. int1 g_i1;
  79. int2 g_i2;
  80. int4 g_i4;
  81. uint1 g_u1;
  82. uint2 g_u2;
  83. uint4 g_u4;
  84. bool1 g_b1;
  85. bool2 g_b2;
  86. bool4 g_b4;
  87. double1 g_d1;
  88. double2 g_d2;
  89. double4 g_d4;
  90. int64_t1 g_i641; /* fxc-error {{X3000: unrecognized identifier 'int64_t1'}} */
  91. int64_t2 g_i642; /* fxc-error {{X3000: unrecognized identifier 'int64_t2'}} */
  92. int64_t4 g_i644; /* fxc-error {{X3000: unrecognized identifier 'int64_t4'}} */
  93. uint64_t1 g_u641; /* fxc-error {{X3000: unrecognized identifier 'uint64_t1'}} */
  94. uint64_t2 g_u642; /* fxc-error {{X3000: unrecognized identifier 'uint64_t2'}} */
  95. uint64_t4 g_u644; /* fxc-error {{X3000: unrecognized identifier 'uint64_t4'}} */
  96. min16float1 g_m16f1;
  97. min16float2 g_m16f2;
  98. min16float4 g_m16f4;
  99. float1x1 g_f1x1;
  100. float4x1 g_f4x1;
  101. float1x4 g_f1x4;
  102. float4x4 g_f4x4;
  103. int1x1 g_i1x1;
  104. int4x1 g_i4x1;
  105. int1x4 g_i1x4;
  106. int4x4 g_i4x4;
  107. uint1x1 g_u1x1;
  108. uint4x1 g_u4x1;
  109. uint1x4 g_u1x4;
  110. uint4x4 g_u4x4;
  111. bool1x1 g_b1x1;
  112. bool4x1 g_b4x1;
  113. bool1x4 g_b1x4;
  114. bool4x4 g_b4x4;
  115. double1x1 g_d1x1;
  116. double4x1 g_d4x1;
  117. double1x4 g_d1x4;
  118. double4x4 g_d4x4;
  119. int64_t1x1 g_i641x1; /* fxc-error {{X3000: unrecognized identifier 'int64_t1x1'}} */
  120. int64_t4x1 g_i644x1; /* fxc-error {{X3000: unrecognized identifier 'int64_t4x1'}} */
  121. int64_t1x4 g_i641x4; /* fxc-error {{X3000: unrecognized identifier 'int64_t1x4'}} */
  122. int64_t4x4 g_i644x4; /* fxc-error {{X3000: unrecognized identifier 'int64_t4x4'}} */
  123. uint64_t1x1 g_u641x1; /* fxc-error {{X3000: unrecognized identifier 'uint64_t1x1'}} */
  124. uint64_t4x1 g_u644x1; /* fxc-error {{X3000: unrecognized identifier 'uint64_t4x1'}} */
  125. uint64_t1x4 g_u641x4; /* fxc-error {{X3000: unrecognized identifier 'uint64_t1x4'}} */
  126. uint64_t4x4 g_u644x4; /* fxc-error {{X3000: unrecognized identifier 'uint64_t4x4'}} */
  127. min16float1x1 g_m16f1x1;
  128. min16float4x1 g_m16f4x1;
  129. min16float1x4 g_m16f1x4;
  130. min16float4x4 g_m16f4x4;
  131. // GENERATED_CODE:END
  132. //min16float overload1(min16float v) { return (min16float)600; }
  133. // Skip min16float types for overload functions because they currently cause these errors:
  134. // function return value cannot have __fp16 type; did you forget * ?
  135. // parameters cannot have __fp16 type; did you forget * ?
  136. // <py::lines('GENERATED_CODE')>modify(lines, gen_code('%(type)s overload1(%(type)s v) { return (%(type)s)%(val)s; }', overload_types))</py>
  137. // GENERATED_CODE:BEGIN
  138. float overload1(float v) { return (float)100; }
  139. int overload1(int v) { return (int)200; }
  140. uint overload1(uint v) { return (uint)300; }
  141. bool overload1(bool v) { return (bool)400; }
  142. double overload1(double v) { return (double)500; }
  143. int64_t overload1(int64_t v) { return (int64_t)600; } /* fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
  144. uint64_t overload1(uint64_t v) { return (uint64_t)700; } /* fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
  145. float2 overload1(float2 v) { return (float2)102; }
  146. float4 overload1(float4 v) { return (float4)104; }
  147. int2 overload1(int2 v) { return (int2)202; }
  148. int4 overload1(int4 v) { return (int4)204; }
  149. uint2 overload1(uint2 v) { return (uint2)302; }
  150. uint4 overload1(uint4 v) { return (uint4)304; }
  151. bool2 overload1(bool2 v) { return (bool2)402; }
  152. bool4 overload1(bool4 v) { return (bool4)404; }
  153. double2 overload1(double2 v) { return (double2)502; }
  154. double4 overload1(double4 v) { return (double4)504; }
  155. int64_t2 overload1(int64_t2 v) { return (int64_t2)602; } /* fxc-error {{X3000: unrecognized identifier 'int64_t2'}} */
  156. int64_t4 overload1(int64_t4 v) { return (int64_t4)604; } /* fxc-error {{X3000: unrecognized identifier 'int64_t4'}} */
  157. uint64_t2 overload1(uint64_t2 v) { return (uint64_t2)702; } /* fxc-error {{X3000: unrecognized identifier 'uint64_t2'}} */
  158. uint64_t4 overload1(uint64_t4 v) { return (uint64_t4)704; } /* fxc-error {{X3000: unrecognized identifier 'uint64_t4'}} */
  159. float4x1 overload1(float4x1 v) { return (float4x1)141; }
  160. float1x4 overload1(float1x4 v) { return (float1x4)114; }
  161. float4x4 overload1(float4x4 v) { return (float4x4)144; }
  162. int4x1 overload1(int4x1 v) { return (int4x1)241; }
  163. int1x4 overload1(int1x4 v) { return (int1x4)214; }
  164. int4x4 overload1(int4x4 v) { return (int4x4)244; }
  165. uint4x1 overload1(uint4x1 v) { return (uint4x1)341; }
  166. uint1x4 overload1(uint1x4 v) { return (uint1x4)314; }
  167. uint4x4 overload1(uint4x4 v) { return (uint4x4)344; }
  168. bool4x1 overload1(bool4x1 v) { return (bool4x1)441; }
  169. bool1x4 overload1(bool1x4 v) { return (bool1x4)414; }
  170. bool4x4 overload1(bool4x4 v) { return (bool4x4)444; }
  171. double4x1 overload1(double4x1 v) { return (double4x1)541; }
  172. double1x4 overload1(double1x4 v) { return (double1x4)514; }
  173. double4x4 overload1(double4x4 v) { return (double4x4)544; }
  174. int64_t4x1 overload1(int64_t4x1 v) { return (int64_t4x1)641; } /* fxc-error {{X3000: unrecognized identifier 'int64_t4x1'}} */
  175. int64_t1x4 overload1(int64_t1x4 v) { return (int64_t1x4)614; } /* fxc-error {{X3000: unrecognized identifier 'int64_t1x4'}} */
  176. int64_t4x4 overload1(int64_t4x4 v) { return (int64_t4x4)644; } /* fxc-error {{X3000: unrecognized identifier 'int64_t4x4'}} */
  177. uint64_t4x1 overload1(uint64_t4x1 v) { return (uint64_t4x1)741; } /* fxc-error {{X3000: unrecognized identifier 'uint64_t4x1'}} */
  178. uint64_t1x4 overload1(uint64_t1x4 v) { return (uint64_t1x4)714; } /* fxc-error {{X3000: unrecognized identifier 'uint64_t1x4'}} */
  179. uint64_t4x4 overload1(uint64_t4x4 v) { return (uint64_t4x4)744; } /* fxc-error {{X3000: unrecognized identifier 'uint64_t4x4'}} */
  180. // GENERATED_CODE:END
  181. // <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>
  182. // GENERATED_CODE:BEGIN
  183. float overload2(float v1, float v2) { return (float)100; }
  184. int overload2(int v1, int v2) { return (int)200; }
  185. uint overload2(uint v1, uint v2) { return (uint)300; }
  186. bool overload2(bool v1, bool v2) { return (bool)400; }
  187. double overload2(double v1, double v2) { return (double)500; }
  188. int64_t overload2(int64_t v1, int64_t v2) { return (int64_t)600; } /* fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
  189. uint64_t overload2(uint64_t v1, uint64_t v2) { return (uint64_t)700; } /* fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
  190. float2 overload2(float2 v1, float2 v2) { return (float2)102; }
  191. float4 overload2(float4 v1, float4 v2) { return (float4)104; }
  192. int2 overload2(int2 v1, int2 v2) { return (int2)202; }
  193. int4 overload2(int4 v1, int4 v2) { return (int4)204; }
  194. uint2 overload2(uint2 v1, uint2 v2) { return (uint2)302; }
  195. uint4 overload2(uint4 v1, uint4 v2) { return (uint4)304; }
  196. bool2 overload2(bool2 v1, bool2 v2) { return (bool2)402; }
  197. bool4 overload2(bool4 v1, bool4 v2) { return (bool4)404; }
  198. double2 overload2(double2 v1, double2 v2) { return (double2)502; }
  199. double4 overload2(double4 v1, double4 v2) { return (double4)504; }
  200. int64_t2 overload2(int64_t2 v1, int64_t2 v2) { return (int64_t2)602; } /* fxc-error {{X3000: unrecognized identifier 'int64_t2'}} */
  201. int64_t4 overload2(int64_t4 v1, int64_t4 v2) { return (int64_t4)604; } /* fxc-error {{X3000: unrecognized identifier 'int64_t4'}} */
  202. uint64_t2 overload2(uint64_t2 v1, uint64_t2 v2) { return (uint64_t2)702; } /* fxc-error {{X3000: unrecognized identifier 'uint64_t2'}} */
  203. uint64_t4 overload2(uint64_t4 v1, uint64_t4 v2) { return (uint64_t4)704; } /* fxc-error {{X3000: unrecognized identifier 'uint64_t4'}} */
  204. float4x1 overload2(float4x1 v1, float4x1 v2) { return (float4x1)141; }
  205. float1x4 overload2(float1x4 v1, float1x4 v2) { return (float1x4)114; }
  206. float4x4 overload2(float4x4 v1, float4x4 v2) { return (float4x4)144; }
  207. int4x1 overload2(int4x1 v1, int4x1 v2) { return (int4x1)241; }
  208. int1x4 overload2(int1x4 v1, int1x4 v2) { return (int1x4)214; }
  209. int4x4 overload2(int4x4 v1, int4x4 v2) { return (int4x4)244; }
  210. uint4x1 overload2(uint4x1 v1, uint4x1 v2) { return (uint4x1)341; }
  211. uint1x4 overload2(uint1x4 v1, uint1x4 v2) { return (uint1x4)314; }
  212. uint4x4 overload2(uint4x4 v1, uint4x4 v2) { return (uint4x4)344; }
  213. bool4x1 overload2(bool4x1 v1, bool4x1 v2) { return (bool4x1)441; }
  214. bool1x4 overload2(bool1x4 v1, bool1x4 v2) { return (bool1x4)414; }
  215. bool4x4 overload2(bool4x4 v1, bool4x4 v2) { return (bool4x4)444; }
  216. double4x1 overload2(double4x1 v1, double4x1 v2) { return (double4x1)541; }
  217. double1x4 overload2(double1x4 v1, double1x4 v2) { return (double1x4)514; }
  218. double4x4 overload2(double4x4 v1, double4x4 v2) { return (double4x4)544; }
  219. int64_t4x1 overload2(int64_t4x1 v1, int64_t4x1 v2) { return (int64_t4x1)641; } /* fxc-error {{X3000: unrecognized identifier 'int64_t4x1'}} */
  220. int64_t1x4 overload2(int64_t1x4 v1, int64_t1x4 v2) { return (int64_t1x4)614; } /* fxc-error {{X3000: unrecognized identifier 'int64_t1x4'}} */
  221. int64_t4x4 overload2(int64_t4x4 v1, int64_t4x4 v2) { return (int64_t4x4)644; } /* fxc-error {{X3000: unrecognized identifier 'int64_t4x4'}} */
  222. uint64_t4x1 overload2(uint64_t4x1 v1, uint64_t4x1 v2) { return (uint64_t4x1)741; } /* fxc-error {{X3000: unrecognized identifier 'uint64_t4x1'}} */
  223. uint64_t1x4 overload2(uint64_t1x4 v1, uint64_t1x4 v2) { return (uint64_t1x4)714; } /* fxc-error {{X3000: unrecognized identifier 'uint64_t1x4'}} */
  224. uint64_t4x4 overload2(uint64_t4x4 v1, uint64_t4x4 v2) { return (uint64_t4x4)744; } /* fxc-error {{X3000: unrecognized identifier 'uint64_t4x4'}} */
  225. // GENERATED_CODE:END
  226. float4 test(): SV_Target {
  227. // <py::lines('GENERATED_CODE')>modify(lines, gen_code('%(type)s %(id)s = g_%(id)s;'))</py>
  228. // GENERATED_CODE:BEGIN
  229. float f = g_f;
  230. int i = g_i;
  231. uint u = g_u;
  232. bool b = g_b;
  233. double d = g_d;
  234. int64_t i64 = g_i64; /* fxc-error {{X3000: unrecognized identifier 'i64'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
  235. uint64_t u64 = g_u64; /* fxc-error {{X3000: unrecognized identifier 'u64'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
  236. min16float m16f = g_m16f;
  237. float1 f1 = g_f1;
  238. float2 f2 = g_f2;
  239. float4 f4 = g_f4;
  240. int1 i1 = g_i1;
  241. int2 i2 = g_i2;
  242. int4 i4 = g_i4;
  243. uint1 u1 = g_u1;
  244. uint2 u2 = g_u2;
  245. uint4 u4 = g_u4;
  246. bool1 b1 = g_b1;
  247. bool2 b2 = g_b2;
  248. bool4 b4 = g_b4;
  249. double1 d1 = g_d1;
  250. double2 d2 = g_d2;
  251. double4 d4 = g_d4;
  252. int64_t1 i641 = g_i641; /* fxc-error {{X3000: unrecognized identifier 'i641'}} fxc-error {{X3000: unrecognized identifier 'int64_t1'}} */
  253. int64_t2 i642 = g_i642; /* fxc-error {{X3000: unrecognized identifier 'i642'}} fxc-error {{X3000: unrecognized identifier 'int64_t2'}} */
  254. int64_t4 i644 = g_i644; /* fxc-error {{X3000: unrecognized identifier 'i644'}} fxc-error {{X3000: unrecognized identifier 'int64_t4'}} */
  255. uint64_t1 u641 = g_u641; /* fxc-error {{X3000: unrecognized identifier 'u641'}} fxc-error {{X3000: unrecognized identifier 'uint64_t1'}} */
  256. uint64_t2 u642 = g_u642; /* fxc-error {{X3000: unrecognized identifier 'u642'}} fxc-error {{X3000: unrecognized identifier 'uint64_t2'}} */
  257. uint64_t4 u644 = g_u644; /* fxc-error {{X3000: unrecognized identifier 'u644'}} fxc-error {{X3000: unrecognized identifier 'uint64_t4'}} */
  258. min16float1 m16f1 = g_m16f1;
  259. min16float2 m16f2 = g_m16f2;
  260. min16float4 m16f4 = g_m16f4;
  261. float1x1 f1x1 = g_f1x1;
  262. float4x1 f4x1 = g_f4x1;
  263. float1x4 f1x4 = g_f1x4;
  264. float4x4 f4x4 = g_f4x4;
  265. int1x1 i1x1 = g_i1x1;
  266. int4x1 i4x1 = g_i4x1;
  267. int1x4 i1x4 = g_i1x4;
  268. int4x4 i4x4 = g_i4x4;
  269. uint1x1 u1x1 = g_u1x1;
  270. uint4x1 u4x1 = g_u4x1;
  271. uint1x4 u1x4 = g_u1x4;
  272. uint4x4 u4x4 = g_u4x4;
  273. bool1x1 b1x1 = g_b1x1;
  274. bool4x1 b4x1 = g_b4x1;
  275. bool1x4 b1x4 = g_b1x4;
  276. bool4x4 b4x4 = g_b4x4;
  277. double1x1 d1x1 = g_d1x1;
  278. double4x1 d4x1 = g_d4x1;
  279. double1x4 d1x4 = g_d1x4;
  280. double4x4 d4x4 = g_d4x4;
  281. int64_t1x1 i641x1 = g_i641x1; /* fxc-error {{X3000: unrecognized identifier 'i641x1'}} fxc-error {{X3000: unrecognized identifier 'int64_t1x1'}} */
  282. int64_t4x1 i644x1 = g_i644x1; /* fxc-error {{X3000: unrecognized identifier 'i644x1'}} fxc-error {{X3000: unrecognized identifier 'int64_t4x1'}} */
  283. int64_t1x4 i641x4 = g_i641x4; /* fxc-error {{X3000: unrecognized identifier 'i641x4'}} fxc-error {{X3000: unrecognized identifier 'int64_t1x4'}} */
  284. int64_t4x4 i644x4 = g_i644x4; /* fxc-error {{X3000: unrecognized identifier 'i644x4'}} fxc-error {{X3000: unrecognized identifier 'int64_t4x4'}} */
  285. uint64_t1x1 u641x1 = g_u641x1; /* fxc-error {{X3000: unrecognized identifier 'u641x1'}} fxc-error {{X3000: unrecognized identifier 'uint64_t1x1'}} */
  286. uint64_t4x1 u644x1 = g_u644x1; /* fxc-error {{X3000: unrecognized identifier 'u644x1'}} fxc-error {{X3000: unrecognized identifier 'uint64_t4x1'}} */
  287. uint64_t1x4 u641x4 = g_u641x4; /* fxc-error {{X3000: unrecognized identifier 'u641x4'}} fxc-error {{X3000: unrecognized identifier 'uint64_t1x4'}} */
  288. uint64_t4x4 u644x4 = g_u644x4; /* fxc-error {{X3000: unrecognized identifier 'u644x4'}} fxc-error {{X3000: unrecognized identifier 'uint64_t4x4'}} */
  289. min16float1x1 m16f1x1 = g_m16f1x1;
  290. min16float4x1 m16f4x1 = g_m16f4x1;
  291. min16float1x4 m16f1x4 = g_m16f1x4;
  292. min16float4x4 m16f4x4 = g_m16f4x4;
  293. // GENERATED_CODE:END
  294. float3 f3 = f4; /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
  295. int3x1 i3x1 = i4x4; /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
  296. /*verify-ast
  297. DeclStmt <col:3, col:21>
  298. `-VarDecl <col:3, col:17> col:10 used i3x1 'int3x1':'matrix<int, 3, 1>' cinit
  299. `-ImplicitCastExpr <col:17> 'matrix<int, 3, 1>':'matrix<int, 3, 1>' <HLSLMatrixTruncationCast>
  300. `-ImplicitCastExpr <col:17> 'int4x4':'matrix<int, 4, 4>' <LValueToRValue>
  301. `-DeclRefExpr <col:17> 'int4x4':'matrix<int, 4, 4>' lvalue Var 'i4x4' 'int4x4':'matrix<int, 4, 4>'
  302. */
  303. VERIFY_TYPES(float, f * f1);
  304. VERIFY_TYPES(float4, f * f4);
  305. VERIFY_TYPES(float4, f1 * f4);
  306. VERIFY_TYPES(float4, i4 * f1);
  307. VERIFY_TYPES(float4x4, i4x4 * f);
  308. VERIFY_TYPES(float4x4, f * i4x4);
  309. VERIFY_TYPES(bool, b = i4); /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
  310. VERIFY_TYPES(float4x4, overload1(i4x4 * f));
  311. VERIFY_TYPES(float4x4, overload1(i4x4 * 1.5F));
  312. VERIFY_TYPES(float4x4, overload1(i4x4 * 1.5));
  313. VERIFY_TYPES(double2, overload1(i2 * 1.5L));
  314. VERIFY_TYPES(uint64_t2, overload1(i2 * 2ULL)); /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t2'}} */
  315. VERIFY_TYPES(int64_t2, overload1(i2 * 2LL)); /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t2'}} */
  316. VERIFY_TYPES(float4x4, overload1(f4x4 * 2));
  317. // TODO: Should there be a narrowing warning here due to implicit cast of float to int type?
  318. VERIFY_TYPES(int4x4, overload2(i4x4, f));
  319. VERIFY_TYPES(int4x4, overload2(f, i4x4));
  320. VERIFY_TYPES(uint64_t4x4, overload2(u644x4, d)); /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t4x4'}} */
  321. VERIFY_TYPES(uint64_t4x4, overload2(d, u644x4)); /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t4x4'}} */
  322. VERIFY_TYPES(int64_t4x4, overload2(i644x4, d)); /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t4x4'}} */
  323. VERIFY_TYPES(int64_t4x4, overload2(d, i644x4)); /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t4x4'}} */
  324. // ambiguous:
  325. //VERIFY_TYPES(float4, overload2(f4, i4));
  326. VERIFY_TYPES(float, overload2(f, 1.0));
  327. VERIFY_TYPES(float, overload2(1.0, f));
  328. VERIFY_TYPES(double, overload2(d, 1.0));
  329. VERIFY_TYPES(double, overload2(1.0, d));
  330. VERIFY_TYPES(uint64_t, overload2(u64, 2)); /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
  331. VERIFY_TYPES(uint64_t, overload2(2, u64)); /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'uint64_t'}} */
  332. VERIFY_TYPES(int64_t, overload2(i64, 2)); /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
  333. VERIFY_TYPES(int64_t, overload2(2, i64)); /* fxc-error {{X3000: unrecognized identifier '_tmp_var_'}} fxc-error {{X3000: unrecognized identifier 'int64_t'}} */
  334. i4 = i;
  335. /*verify-ast
  336. BinaryOperator <col:3, col:8> 'int4':'vector<int, 4>' '='
  337. |-DeclRefExpr <col:3> 'int4':'vector<int, 4>' lvalue Var 'i4' 'int4':'vector<int, 4>'
  338. `-ImplicitCastExpr <col:8> 'vector<int, 4>':'vector<int, 4>' <HLSLVectorSplat>
  339. `-ImplicitCastExpr <col:8> 'int' <LValueToRValue>
  340. `-DeclRefExpr <col:8> 'int' lvalue Var 'i' 'int'
  341. */
  342. u64 = d; /* fxc-error {{X3004: undeclared identifier 'u64'}} */
  343. /*verify-ast
  344. BinaryOperator <col:3, col:9> 'uint64_t':'unsigned long long' '='
  345. |-DeclRefExpr <col:3> 'uint64_t':'unsigned long long' lvalue Var 'u64' 'uint64_t':'unsigned long long'
  346. `-ImplicitCastExpr <col:9> 'uint64_t':'unsigned long long' <FloatingToIntegral>
  347. `-ImplicitCastExpr <col:9> 'double' <LValueToRValue>
  348. `-DeclRefExpr <col:9> 'double' lvalue Var 'd' 'double'
  349. */
  350. i4 = i1x4;
  351. /*verify-ast
  352. BinaryOperator <col:3, col:8> 'int4':'vector<int, 4>' '='
  353. |-DeclRefExpr <col:3> 'int4':'vector<int, 4>' lvalue Var 'i4' 'int4':'vector<int, 4>'
  354. `-ImplicitCastExpr <col:8> 'vector<int, 4>':'vector<int, 4>' <HLSLMatrixToVectorCast>
  355. `-ImplicitCastExpr <col:8> 'int1x4':'matrix<int, 1, 4>' <LValueToRValue>
  356. `-DeclRefExpr <col:8> 'int1x4':'matrix<int, 1, 4>' lvalue Var 'i1x4' 'int1x4':'matrix<int, 1, 4>'
  357. */
  358. i4 = i4x1;
  359. /*verify-ast
  360. BinaryOperator <col:3, col:8> 'int4':'vector<int, 4>' '='
  361. |-DeclRefExpr <col:3> 'int4':'vector<int, 4>' lvalue Var 'i4' 'int4':'vector<int, 4>'
  362. `-ImplicitCastExpr <col:8> 'vector<int, 4>':'vector<int, 4>' <HLSLMatrixToVectorCast>
  363. `-ImplicitCastExpr <col:8> 'int4x1':'matrix<int, 4, 1>' <LValueToRValue>
  364. `-DeclRefExpr <col:8> 'int4x1':'matrix<int, 4, 1>' lvalue Var 'i4x1' 'int4x1':'matrix<int, 4, 1>'
  365. */
  366. i4x4 = i;
  367. /*verify-ast
  368. BinaryOperator <col:3, col:10> 'int4x4':'matrix<int, 4, 4>' '='
  369. |-DeclRefExpr <col:3> 'int4x4':'matrix<int, 4, 4>' lvalue Var 'i4x4' 'int4x4':'matrix<int, 4, 4>'
  370. `-ImplicitCastExpr <col:10> 'matrix<int, 4, 4>':'matrix<int, 4, 4>' <HLSLMatrixSplat>
  371. `-ImplicitCastExpr <col:10> 'int' <LValueToRValue>
  372. `-DeclRefExpr <col:10> 'int' lvalue Var 'i' 'int'
  373. */
  374. i = i4x4; /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
  375. /*verify-ast
  376. BinaryOperator <col:3, col:7> 'int' '='
  377. |-DeclRefExpr <col:3> 'int' lvalue Var 'i' 'int'
  378. `-ImplicitCastExpr <col:7> 'int' <HLSLMatrixToScalarCast>
  379. `-ImplicitCastExpr <col:7> 'matrix<int, 1, 1>':'matrix<int, 1, 1>' <HLSLMatrixTruncationCast>
  380. `-ImplicitCastExpr <col:7> 'int4x4':'matrix<int, 4, 4>' <LValueToRValue>
  381. `-DeclRefExpr <col:7> 'int4x4':'matrix<int, 4, 4>' lvalue Var 'i4x4' 'int4x4':'matrix<int, 4, 4>'
  382. */
  383. i4x4 = i4; /* expected-error {{cannot convert from 'int4' to 'int4x4'}} fxc-error {{X3017: cannot implicitly convert from 'int4' to 'int4x4'}} */
  384. /*verify-ast
  385. BinaryOperator <col:3, col:10> 'int4x4':'matrix<int, 4, 4>' '='
  386. |-DeclRefExpr <col:3> 'int4x4':'matrix<int, 4, 4>' lvalue Var 'i4x4' 'int4x4':'matrix<int, 4, 4>'
  387. `-DeclRefExpr <col:10> 'int4':'vector<int, 4>' lvalue Var 'i4' 'int4':'vector<int, 4>'
  388. */
  389. i4x4 = i4x1; /* expected-error {{cannot convert from 'int4x1' to 'int4x4'}} fxc-error {{X3017: cannot implicitly convert from 'int4x1' to 'int4x4'}} */
  390. /*verify-ast
  391. BinaryOperator <col:3, col:10> 'int4x4':'matrix<int, 4, 4>' '='
  392. |-DeclRefExpr <col:3> 'int4x4':'matrix<int, 4, 4>' lvalue Var 'i4x4' 'int4x4':'matrix<int, 4, 4>'
  393. `-DeclRefExpr <col:10> 'int4x1':'matrix<int, 4, 1>' lvalue Var 'i4x1' 'int4x1':'matrix<int, 4, 1>'
  394. */
  395. i4x4 = i1x4; /* expected-error {{cannot convert from 'int1x4' to 'int4x4'}} fxc-error {{X3017: cannot implicitly convert from 'int4' to 'int4x4'}} */
  396. /*verify-ast
  397. BinaryOperator <col:3, col:10> 'int4x4':'matrix<int, 4, 4>' '='
  398. |-DeclRefExpr <col:3> 'int4x4':'matrix<int, 4, 4>' lvalue Var 'i4x4' 'int4x4':'matrix<int, 4, 4>'
  399. `-DeclRefExpr <col:10> 'int1x4':'matrix<int, 1, 4>' lvalue Var 'i1x4' 'int1x4':'matrix<int, 1, 4>'
  400. */
  401. i4 = i1;
  402. /*verify-ast
  403. BinaryOperator <col:3, col:8> 'int4':'vector<int, 4>' '='
  404. |-DeclRefExpr <col:3> 'int4':'vector<int, 4>' lvalue Var 'i4' 'int4':'vector<int, 4>'
  405. `-ImplicitCastExpr <col:8> 'vector<int, 4>':'vector<int, 4>' <HLSLVectorSplat>
  406. `-ImplicitCastExpr <col:8> 'int' <HLSLVectorToScalarCast>
  407. `-ImplicitCastExpr <col:8> 'int1':'vector<int, 1>' <LValueToRValue>
  408. `-DeclRefExpr <col:8> 'int1':'vector<int, 1>' lvalue Var 'i1' 'int1':'vector<int, 1>'
  409. */
  410. b = i;
  411. /*verify-ast
  412. BinaryOperator <col:3, col:7> 'bool' '='
  413. |-DeclRefExpr <col:3> 'bool' lvalue Var 'b' 'bool'
  414. `-ImplicitCastExpr <col:7> 'bool' <IntegralToBoolean>
  415. `-ImplicitCastExpr <col:7> 'int' <LValueToRValue>
  416. `-DeclRefExpr <col:7> 'int' lvalue Var 'i' 'int'
  417. */
  418. b1 = i1;
  419. /*verify-ast
  420. BinaryOperator <col:3, col:8> 'bool1':'vector<bool, 1>' '='
  421. |-DeclRefExpr <col:3> 'bool1':'vector<bool, 1>' lvalue Var 'b1' 'bool1':'vector<bool, 1>'
  422. `-ImplicitCastExpr <col:8> 'vector<bool, 1>' <HLSLCC_IntegralToBoolean>
  423. `-ImplicitCastExpr <col:8> 'int1':'vector<int, 1>' <LValueToRValue>
  424. `-DeclRefExpr <col:8> 'int1':'vector<int, 1>' lvalue Var 'i1' 'int1':'vector<int, 1>'
  425. */
  426. b4 = i1;
  427. /*verify-ast
  428. BinaryOperator <col:3, col:8> 'bool4':'vector<bool, 4>' '='
  429. |-DeclRefExpr <col:3> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
  430. `-ImplicitCastExpr <col:8> 'vector<bool, 4>':'vector<bool, 4>' <HLSLVectorSplat>
  431. `-ImplicitCastExpr <col:8> 'bool' <IntegralToBoolean>
  432. `-ImplicitCastExpr <col:8> 'int' <HLSLVectorToScalarCast>
  433. `-ImplicitCastExpr <col:8> 'int1':'vector<int, 1>' <LValueToRValue>
  434. `-DeclRefExpr <col:8> 'int1':'vector<int, 1>' lvalue Var 'i1' 'int1':'vector<int, 1>'
  435. */
  436. b4 = i4;
  437. /*verify-ast
  438. BinaryOperator <col:3, col:8> 'bool4':'vector<bool, 4>' '='
  439. |-DeclRefExpr <col:3> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
  440. `-ImplicitCastExpr <col:8> 'vector<bool, 4>' <HLSLCC_IntegralToBoolean>
  441. `-ImplicitCastExpr <col:8> 'int4':'vector<int, 4>' <LValueToRValue>
  442. `-DeclRefExpr <col:8> 'int4':'vector<int, 4>' lvalue Var 'i4' 'int4':'vector<int, 4>'
  443. */
  444. b4x4 = i4x4;
  445. /*verify-ast
  446. BinaryOperator <col:3, col:10> 'bool4x4':'matrix<bool, 4, 4>' '='
  447. |-DeclRefExpr <col:3> 'bool4x4':'matrix<bool, 4, 4>' lvalue Var 'b4x4' 'bool4x4':'matrix<bool, 4, 4>'
  448. `-ImplicitCastExpr <col:10> 'matrix<bool, 4, 4>' <HLSLCC_IntegralToBoolean>
  449. `-ImplicitCastExpr <col:10> 'int4x4':'matrix<int, 4, 4>' <LValueToRValue>
  450. `-DeclRefExpr <col:10> 'int4x4':'matrix<int, 4, 4>' lvalue Var 'i4x4' 'int4x4':'matrix<int, 4, 4>'
  451. */
  452. i4 = b4x4; /* expected-error {{cannot convert from 'bool4x4' to 'int4'}} fxc-error {{X3017: cannot implicitly convert from 'bool4x4' to 'int4'}} */
  453. /*verify-ast
  454. BinaryOperator <col:3, col:8> 'int4':'vector<int, 4>' '='
  455. |-DeclRefExpr <col:3> 'int4':'vector<int, 4>' lvalue Var 'i4' 'int4':'vector<int, 4>'
  456. `-DeclRefExpr <col:8> 'bool4x4':'matrix<bool, 4, 4>' lvalue Var 'b4x4' 'bool4x4':'matrix<bool, 4, 4>'
  457. */
  458. i4x1 = b1x4; /* expected-error {{cannot convert from 'bool1x4' to 'int4x1'}} fxc-error {{X3017: cannot implicitly convert from 'bool4' to 'int4x1'}} */
  459. /*verify-ast
  460. BinaryOperator <col:3, col:10> 'int4x1':'matrix<int, 4, 1>' '='
  461. |-DeclRefExpr <col:3> 'int4x1':'matrix<int, 4, 1>' lvalue Var 'i4x1' 'int4x1':'matrix<int, 4, 1>'
  462. `-DeclRefExpr <col:10> 'bool1x4':'matrix<bool, 1, 4>' lvalue Var 'b1x4' 'bool1x4':'matrix<bool, 1, 4>'
  463. */
  464. f = b;
  465. /*verify-ast
  466. BinaryOperator <col:3, col:7> 'float' '='
  467. |-DeclRefExpr <col:3> 'float' lvalue Var 'f' 'float'
  468. `-ImplicitCastExpr <col:7> 'float' <IntegralToFloating>
  469. `-ImplicitCastExpr <col:7> 'bool' <LValueToRValue>
  470. `-DeclRefExpr <col:7> 'bool' lvalue Var 'b' 'bool'
  471. */
  472. f = b4; /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
  473. /*verify-ast
  474. BinaryOperator <col:3, col:7> 'float' '='
  475. |-DeclRefExpr <col:3> 'float' lvalue Var 'f' 'float'
  476. `-ImplicitCastExpr <col:7> 'float' <IntegralToFloating>
  477. `-ImplicitCastExpr <col:7> 'bool' <HLSLVectorToScalarCast>
  478. `-ImplicitCastExpr <col:7> 'vector<bool, 1>':'vector<bool, 1>' <HLSLVectorTruncationCast>
  479. `-ImplicitCastExpr <col:7> 'bool4':'vector<bool, 4>' <LValueToRValue>
  480. `-DeclRefExpr <col:7> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
  481. */
  482. f = i;
  483. /*verify-ast
  484. BinaryOperator <col:3, col:7> 'float' '='
  485. |-DeclRefExpr <col:3> 'float' lvalue Var 'f' 'float'
  486. `-ImplicitCastExpr <col:7> 'float' <IntegralToFloating>
  487. `-ImplicitCastExpr <col:7> 'int' <LValueToRValue>
  488. `-DeclRefExpr <col:7> 'int' lvalue Var 'i' 'int'
  489. */
  490. f4 = i4;
  491. /*verify-ast
  492. BinaryOperator <col:3, col:8> 'float4':'vector<float, 4>' '='
  493. |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
  494. `-ImplicitCastExpr <col:8> 'vector<float, 4>' <HLSLCC_IntegralToFloating>
  495. `-ImplicitCastExpr <col:8> 'int4':'vector<int, 4>' <LValueToRValue>
  496. `-DeclRefExpr <col:8> 'int4':'vector<int, 4>' lvalue Var 'i4' 'int4':'vector<int, 4>'
  497. */
  498. f = i * 0.5;
  499. /*verify-ast
  500. BinaryOperator <col:3, col:11> 'float' '='
  501. |-DeclRefExpr <col:3> 'float' lvalue Var 'f' 'float'
  502. `-BinaryOperator <col:7, col:11> 'float' '*'
  503. |-ImplicitCastExpr <col:7> 'float' <IntegralToFloating>
  504. | `-ImplicitCastExpr <col:7> 'int' <LValueToRValue>
  505. | `-DeclRefExpr <col:7> 'int' lvalue Var 'i' 'int'
  506. `-ImplicitCastExpr <col:11> 'float' <FloatingCast>
  507. `-FloatingLiteral <col:11> 'literal float' 5.000000e-01
  508. */
  509. f4 = i4 * 0.5;
  510. /*verify-ast
  511. BinaryOperator <col:3, col:13> 'float4':'vector<float, 4>' '='
  512. |-DeclRefExpr <col:3> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
  513. `-BinaryOperator <col:8, col:13> 'vector<float, 4>':'vector<float, 4>' '*'
  514. |-ImplicitCastExpr <col:8> 'vector<float, 4>' <HLSLCC_IntegralToFloating>
  515. | `-ImplicitCastExpr <col:8> 'int4':'vector<int, 4>' <LValueToRValue>
  516. | `-DeclRefExpr <col:8> 'int4':'vector<int, 4>' lvalue Var 'i4' 'int4':'vector<int, 4>'
  517. `-ImplicitCastExpr <col:13> 'vector<float, 4>':'vector<float, 4>' <HLSLVectorSplat>
  518. `-ImplicitCastExpr <col:13> 'float' <FloatingCast>
  519. `-FloatingLiteral <col:13> 'literal float' 5.000000e-01
  520. */
  521. m16f = 0.5 * m16f;
  522. /*verify-ast
  523. BinaryOperator <col:3, col:16> 'min16float':'min16float' '='
  524. |-DeclRefExpr <col:3> 'min16float':'min16float' lvalue Var 'm16f' 'min16float':'min16float'
  525. `-BinaryOperator <col:10, col:16> 'min16float':'min16float' '*'
  526. |-ImplicitCastExpr <col:10> 'min16float':'min16float' <FloatingCast>
  527. | `-FloatingLiteral <col:10> 'literal float' 5.000000e-01
  528. `-ImplicitCastExpr <col:16> 'min16float':'min16float' <LValueToRValue>
  529. `-DeclRefExpr <col:16> 'min16float':'min16float' lvalue Var 'm16f' 'min16float':'min16float'
  530. */
  531. 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}} */
  532. /*verify-ast
  533. BinaryOperator <col:3, col:17> 'min16float':'min16float' '='
  534. |-DeclRefExpr <col:3> 'min16float':'min16float' lvalue Var 'm16f' 'min16float':'min16float'
  535. `-ImplicitCastExpr <col:10, col:17> 'min16float':'min16float' <FloatingCast>
  536. `-BinaryOperator <col:10, col:17> 'float' '*'
  537. |-FloatingLiteral <col:10> 'float' 5.000000e-01
  538. `-ImplicitCastExpr <col:17> 'float' <FloatingCast>
  539. `-ImplicitCastExpr <col:17> 'min16float':'min16float' <LValueToRValue>
  540. `-DeclRefExpr <col:17> 'min16float':'min16float' lvalue Var 'm16f' 'min16float':'min16float'
  541. */
  542. 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}} */
  543. /*verify-ast
  544. BinaryOperator <col:3, col:17> 'min16float':'min16float' '='
  545. |-DeclRefExpr <col:3> 'min16float':'min16float' lvalue Var 'm16f' 'min16float':'min16float'
  546. `-ImplicitCastExpr <col:10, col:17> 'min16float':'min16float' <FloatingCast>
  547. `-BinaryOperator <col:10, col:17> 'double' '*'
  548. |-FloatingLiteral <col:10> 'double' 5.000000e-01
  549. `-ImplicitCastExpr <col:17> 'double' <FloatingCast>
  550. `-ImplicitCastExpr <col:17> 'min16float':'min16float' <LValueToRValue>
  551. `-DeclRefExpr <col:17> 'min16float':'min16float' lvalue Var 'm16f' 'min16float':'min16float'
  552. */
  553. 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}} */
  554. /*verify-ast
  555. BinaryOperator <col:3, col:29> 'min16float4x4':'matrix<min16float, 4, 4>' '='
  556. |-DeclRefExpr <col:3> 'min16float4x4':'matrix<min16float, 4, 4>' lvalue Var 'm16f4x4' 'min16float4x4':'matrix<min16float, 4, 4>'
  557. `-BinaryOperator <col:13, col:29> 'matrix<min16float, 4, 4>':'matrix<min16float, 4, 4>' '*'
  558. |-ImplicitCastExpr <col:13> 'matrix<min16float, 4, 4>' <HLSLCC_IntegralToFloating>
  559. | `-ImplicitCastExpr <col:13> 'int4x4':'matrix<int, 4, 4>' <LValueToRValue>
  560. | `-DeclRefExpr <col:13> 'int4x4':'matrix<int, 4, 4>' lvalue Var 'i4x4' 'int4x4':'matrix<int, 4, 4>'
  561. `-ImplicitCastExpr <col:20, col:29> 'matrix<min16float, 4, 4>':'matrix<min16float, 4, 4>' <HLSLMatrixSplat>
  562. `-ParenExpr <col:20, col:29> 'min16float':'min16float'
  563. `-BinaryOperator <col:21, col:28> 'min16float':'min16float' '+'
  564. |-ImplicitCastExpr <col:21> 'min16float':'min16float' <LValueToRValue>
  565. | `-DeclRefExpr <col:21> 'min16float':'min16float' lvalue Var 'm16f' 'min16float':'min16float'
  566. `-ImplicitCastExpr <col:28> 'min16float':'min16float' <IntegralToFloating>
  567. `-IntegerLiteral <col:28> 'literal int' 1
  568. */
  569. VERIFY_TYPES(min16float4x4, m16f4x4 * (0.5 + 1));
  570. m16f4x4 = m16f4x4 * (0.5 + 1);
  571. /*verify-ast
  572. BinaryOperator <col:3, col:31> 'min16float4x4':'matrix<min16float, 4, 4>' '='
  573. |-DeclRefExpr <col:3> 'min16float4x4':'matrix<min16float, 4, 4>' lvalue Var 'm16f4x4' 'min16float4x4':'matrix<min16float, 4, 4>'
  574. `-BinaryOperator <col:13, col:31> 'min16float4x4':'matrix<min16float, 4, 4>' '*'
  575. |-ImplicitCastExpr <col:13> 'min16float4x4':'matrix<min16float, 4, 4>' <LValueToRValue>
  576. | `-DeclRefExpr <col:13> 'min16float4x4':'matrix<min16float, 4, 4>' lvalue Var 'm16f4x4' 'min16float4x4':'matrix<min16float, 4, 4>'
  577. `-ImplicitCastExpr <col:23, col:31> 'matrix<min16float, 4, 4>':'matrix<min16float, 4, 4>' <HLSLMatrixSplat>
  578. `-ImplicitCastExpr <col:23, col:31> 'min16float':'min16float' <FloatingCast>
  579. `-ParenExpr <col:23, col:31> 'literal float'
  580. `-BinaryOperator <col:24, col:30> 'literal float' '+'
  581. |-FloatingLiteral <col:24> 'literal float' 5.000000e-01
  582. `-ImplicitCastExpr <col:30> 'literal float' <IntegralToFloating>
  583. `-IntegerLiteral <col:30> 'literal int' 1
  584. */
  585. b = i4; /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
  586. /*verify-ast
  587. BinaryOperator <col:3, col:7> 'bool' '='
  588. |-DeclRefExpr <col:3> 'bool' lvalue Var 'b' 'bool'
  589. `-ImplicitCastExpr <col:7> 'bool' <IntegralToBoolean>
  590. `-ImplicitCastExpr <col:7> 'int' <HLSLVectorToScalarCast>
  591. `-ImplicitCastExpr <col:7> 'vector<int, 1>':'vector<int, 1>' <HLSLVectorTruncationCast>
  592. `-ImplicitCastExpr <col:7> 'int4':'vector<int, 4>' <LValueToRValue>
  593. `-DeclRefExpr <col:7> 'int4':'vector<int, 4>' lvalue Var 'i4' 'int4':'vector<int, 4>'
  594. */
  595. i.x = f4 + f1x4 * f4x1 / i1; /* expected-error {{cannot convert from 'float4x1' to 'float1x4'}} fxc-error {{X3020: type mismatch}} */
  596. // TODO: fxc passes the following (i4x1 should implicitly cast to float4 for mul op)
  597. f4x4._m02_m11_m20 = i4x1 * f4; /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
  598. /*verify-ast
  599. BinaryOperator <col:3, col:30> 'vector<float, 3>':'vector<float, 3>' '='
  600. |-ExtMatrixElementExpr <col:3, col:8> 'vector<float, 3>':'vector<float, 3>' lvalue vectorcomponent _m02_m11_m20
  601. | `-DeclRefExpr <col:3> 'float4x4':'matrix<float, 4, 4>' lvalue Var 'f4x4' 'float4x4':'matrix<float, 4, 4>'
  602. `-ImplicitCastExpr <col:23, col:30> 'vector<float, 3>':'vector<float, 3>' <HLSLMatrixToVectorCast>
  603. `-ImplicitCastExpr <col:23, col:30> 'matrix<float, 3, 1>':'matrix<float, 3, 1>' <HLSLMatrixTruncationCast>
  604. `-BinaryOperator <col:23, col:30> 'matrix<float, 4, 1>':'matrix<float, 4, 1>' '*'
  605. |-ImplicitCastExpr <col:23> 'matrix<float, 4, 1>' <HLSLCC_IntegralToFloating>
  606. | `-ImplicitCastExpr <col:23> 'int4x1':'matrix<int, 4, 1>' <LValueToRValue>
  607. | `-DeclRefExpr <col:23> 'int4x1':'matrix<int, 4, 1>' lvalue Var 'i4x1' 'int4x1':'matrix<int, 4, 1>'
  608. `-ImplicitCastExpr <col:30> 'matrix<float, 4, 1>':'matrix<float, 4, 1>' <HLSLVectorToMatrixCast>
  609. `-ImplicitCastExpr <col:30> 'float4':'vector<float, 4>' <LValueToRValue>
  610. `-DeclRefExpr <col:30> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
  611. */
  612. f4 = i3x1 * f4; /* expected-error {{cannot convert from 'matrix<float, 3, 1>' to 'float4'}} expected-warning {{implicit truncation of vector type}} fxc-error {{X3017: cannot implicitly convert from 'const float3x1' to 'float4'}} fxc-warning {{X3206: implicit truncation of vector type}} */
  613. f3 = i3x1 * f4; /* expected-warning {{implicit truncation of vector type}} fxc-warning {{X3206: implicit truncation of vector type}} */
  614. /*verify-ast
  615. BinaryOperator <col:3, col:15> 'float3':'vector<float, 3>' '='
  616. |-DeclRefExpr <col:3> 'float3':'vector<float, 3>' lvalue Var 'f3' 'float3':'vector<float, 3>'
  617. `-ImplicitCastExpr <col:8, col:15> 'vector<float, 3>':'vector<float, 3>' <HLSLMatrixToVectorCast>
  618. `-BinaryOperator <col:8, col:15> 'matrix<float, 3, 1>':'matrix<float, 3, 1>' '*'
  619. |-ImplicitCastExpr <col:8> 'matrix<float, 3, 1>' <HLSLCC_IntegralToFloating>
  620. | `-ImplicitCastExpr <col:8> 'int3x1':'matrix<int, 3, 1>' <LValueToRValue>
  621. | `-DeclRefExpr <col:8> 'int3x1':'matrix<int, 3, 1>' lvalue Var 'i3x1' 'int3x1':'matrix<int, 3, 1>'
  622. `-ImplicitCastExpr <col:15> 'matrix<float, 3, 1>':'matrix<float, 3, 1>' <HLSLVectorToMatrixCast>
  623. `-ImplicitCastExpr <col:15> 'vector<float, 3>':'vector<float, 3>' <HLSLVectorTruncationCast>
  624. `-ImplicitCastExpr <col:15> 'float4':'vector<float, 4>' <LValueToRValue>
  625. `-DeclRefExpr <col:15> 'float4':'vector<float, 4>' lvalue Var 'f4' 'float4':'vector<float, 4>'
  626. */
  627. // TODO: Fix ternary operator for HLSL vectorized semantics.
  628. b4 = (b4 * b4) ? b4 : b4;
  629. /*verify-ast
  630. BinaryOperator <col:3, col:25> 'bool4':'vector<bool, 4>' '='
  631. |-DeclRefExpr <col:3> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
  632. `-ConditionalOperator <col:8, col:25> 'vector<bool, 4>'
  633. |-ImplicitCastExpr <col:8, col:16> 'vector<bool, 4>' <HLSLCC_IntegralToBoolean>
  634. | `-ParenExpr <col:8, col:16> 'vector<int, 4>':'vector<int, 4>'
  635. | `-BinaryOperator <col:9, col:14> 'vector<int, 4>':'vector<int, 4>' '*'
  636. | |-ImplicitCastExpr <col:9> 'vector<int, 4>' <HLSLCC_IntegralCast>
  637. | | `-ImplicitCastExpr <col:9> 'bool4':'vector<bool, 4>' <LValueToRValue>
  638. | | `-DeclRefExpr <col:9> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
  639. | `-ImplicitCastExpr <col:14> 'vector<int, 4>' <HLSLCC_IntegralCast>
  640. | `-ImplicitCastExpr <col:14> 'bool4':'vector<bool, 4>' <LValueToRValue>
  641. | `-DeclRefExpr <col:14> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
  642. |-ImplicitCastExpr <col:20> 'bool4':'vector<bool, 4>' <LValueToRValue>
  643. | `-DeclRefExpr <col:20> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
  644. `-ImplicitCastExpr <col:25> 'bool4':'vector<bool, 4>' <LValueToRValue>
  645. `-DeclRefExpr <col:25> 'bool4':'vector<bool, 4>' lvalue Var 'b4' 'bool4':'vector<bool, 4>'
  646. */
  647. return 0.0f;
  648. }
  649. bool1 stresstest() {
  650. float VarZero = float(1.0f);
  651. int VarOne = int(2);
  652. int VarTwo = int(3);
  653. bool VarThree = bool(4);
  654. float VarFour = float(5.0f);
  655. float VarFive = float(6.0f);
  656. int VarSix = int(7);
  657. bool3 VarSeven = bool3(8,9,10);
  658. uint VarEight = uint(11);
  659. bool4 VarNine = bool4(12,13,14,15);
  660. return ((bool1)(-(!(-(((((bool4)(VarTwo - VarTwo)) + ((((((bool4)VarThree) * VarNine) * VarNine) ? VarSeven.yyyx : ((bool4)(VarFour * VarZero))) + ((bool4)((((float)VarSix) * VarFour) * (VarZero ? ((float)VarTwo) : ((float)(VarSeven ? ((bool3)VarTwo) : ((bool3)VarEight)).z)))))) * ((bool4)((((bool)VarFour) + (((bool)VarTwo) + VarThree)) ? ((bool)VarSix) : ((bool)((((int)VarNine.w) - VarSix) + ((VarSix + ((int)VarThree)) ? ((int)VarFour) : VarTwo)))))) ? ((bool4)(+(((bool)(~(VarEight ? ((uint)(VarThree ? ((bool)((VarSix - ((int)VarFour)) - VarSix)) : VarSeven.z)) : ((uint)VarNine.z)))) - (!(+(VarOne * ((int)(~(!((((int)VarSeven.y) - VarSix) ? VarTwo : ((int)VarNine.w))))))))))) : ((bool4)(+((VarZero + ((float)VarNine.z)) ? ((float)VarThree) : VarFive))))))).y);
  661. /*verify-ast
  662. ReturnStmt <col:3, col:771>
  663. `-ParenExpr <col:10, col:771> 'bool1':'vector<bool, 1>'
  664. `-CStyleCastExpr <col:11, col:770> 'bool1':'vector<bool, 1>' <NoOp>
  665. `-ImplicitCastExpr <col:18, col:770> 'vector<bool, 1>':'vector<bool, 1>' <HLSLVectorSplat>
  666. `-ImplicitCastExpr <col:18, col:770> 'bool' <IntegralToBoolean>
  667. `-HLSLVectorElementExpr <col:18, col:770> 'int' y
  668. `-ParenExpr <col:18, col:768> 'vector<int, 4>'
  669. `-UnaryOperator <col:19, col:767> 'vector<int, 4>' prefix '-'
  670. `-ImplicitCastExpr <col:20, col:767> 'vector<int, 4>' <HLSLCC_IntegralCast>
  671. `-ParenExpr <col:20, col:767> 'vector<bool, 4>':'vector<bool, 4>'
  672. `-UnaryOperator <col:21, col:766> 'vector<bool, 4>':'vector<bool, 4>' prefix '!'
  673. `-ImplicitCastExpr <col:22, col:766> 'vector<bool, 4>' <HLSLCC_IntegralToBoolean>
  674. `-ParenExpr <col:22, col:766> 'vector<int, 4>'
  675. `-UnaryOperator <col:23, col:765> 'vector<int, 4>' prefix '-'
  676. `-ImplicitCastExpr <col:24, col:765> 'vector<int, 4>' <HLSLCC_IntegralCast>
  677. `-ParenExpr <col:24, col:765> 'vector<bool, 4>'
  678. `-ConditionalOperator <col:25, col:764> 'vector<bool, 4>'
  679. |-ImplicitCastExpr <col:25, col:457> 'vector<bool, 4>' <HLSLCC_IntegralToBoolean>
  680. | `-ParenExpr <col:25, col:457> 'vector<int, 4>':'vector<int, 4>'
  681. | `-BinaryOperator <col:26, col:456> 'vector<int, 4>':'vector<int, 4>' '*'
  682. | |-ParenExpr <col:26, col:281> 'vector<int, 4>':'vector<int, 4>'
  683. | | `-BinaryOperator <col:27, col:280> 'vector<int, 4>':'vector<int, 4>' '+'
  684. | | |-ImplicitCastExpr <col:27, col:52> 'vector<int, 4>' <HLSLCC_IntegralCast>
  685. | | | `-ParenExpr <col:27, col:52> 'bool4':'vector<bool, 4>'
  686. | | | `-CStyleCastExpr <col:28, col:51> 'bool4':'vector<bool, 4>' <NoOp>
  687. | | | `-ImplicitCastExpr <col:35, col:51> 'vector<bool, 4>':'vector<bool, 4>' <HLSLVectorSplat>
  688. | | | `-ImplicitCastExpr <col:35, col:51> 'bool' <IntegralToBoolean>
  689. | | | `-ParenExpr <col:35, col:51> 'int'
  690. | | | `-BinaryOperator <col:36, col:45> 'int' '-'
  691. | | | |-ImplicitCastExpr <col:36> 'int' <LValueToRValue>
  692. | | | | `-DeclRefExpr <col:36> 'int' lvalue Var 'VarTwo' 'int'
  693. | | | `-ImplicitCastExpr <col:45> 'int' <LValueToRValue>
  694. | | | `-DeclRefExpr <col:45> 'int' lvalue Var 'VarTwo' 'int'
  695. | | `-ParenExpr <col:56, col:280> 'vector<int, 4>':'vector<int, 4>'
  696. | | `-BinaryOperator <col:57, col:279> 'vector<int, 4>':'vector<int, 4>' '+'
  697. | | |-ImplicitCastExpr <col:57, col:146> 'vector<int, 4>' <HLSLCC_IntegralCast>
  698. | | | `-ParenExpr <col:57, col:146> 'vector<bool, 4>'
  699. | | | `-ConditionalOperator <col:58, col:145> 'vector<bool, 4>'
  700. | | | |-ImplicitCastExpr <col:58, col:98> 'vector<bool, 4>' <HLSLCC_IntegralToBoolean>
  701. | | | | `-ParenExpr <col:58, col:98> 'vector<int, 4>':'vector<int, 4>'
  702. | | | | `-BinaryOperator <col:59, col:91> 'vector<int, 4>':'vector<int, 4>' '*'
  703. | | | | |-ParenExpr <col:59, col:87> 'vector<int, 4>':'vector<int, 4>'
  704. | | | | | `-BinaryOperator <col:60, col:80> 'vector<int, 4>':'vector<int, 4>' '*'
  705. | | | | | |-ImplicitCastExpr <col:60, col:76> 'vector<int, 4>' <HLSLCC_IntegralCast>
  706. | | | | | | `-ParenExpr <col:60, col:76> 'bool4':'vector<bool, 4>'
  707. | | | | | | `-CStyleCastExpr <col:61, col:68> 'bool4':'vector<bool, 4>' <NoOp>
  708. | | | | | | `-ImplicitCastExpr <col:68> 'vector<bool, 4>':'vector<bool, 4>' <HLSLVectorSplat>
  709. | | | | | | `-ImplicitCastExpr <col:68> 'bool' <LValueToRValue>
  710. | | | | | | `-DeclRefExpr <col:68> 'bool' lvalue Var 'VarThree' 'bool'
  711. | | | | | `-ImplicitCastExpr <col:80> 'vector<int, 4>' <HLSLCC_IntegralCast>
  712. | | | | | `-ImplicitCastExpr <col:80> 'bool4':'vector<bool, 4>' <LValueToRValue>
  713. | | | | | `-DeclRefExpr <col:80> 'bool4':'vector<bool, 4>' lvalue Var 'VarNine' 'bool4':'vector<bool, 4>'
  714. | | | | `-ImplicitCastExpr <col:91> 'vector<int, 4>' <HLSLCC_IntegralCast>
  715. | | | | `-ImplicitCastExpr <col:91> 'bool4':'vector<bool, 4>' <LValueToRValue>
  716. | | | | `-DeclRefExpr <col:91> 'bool4':'vector<bool, 4>' lvalue Var 'VarNine' 'bool4':'vector<bool, 4>'
  717. | | | |-HLSLVectorElementExpr <col:102, col:111> 'vector<bool, 4>':'vector<bool, 4>' yyyx
  718. | | | | `-DeclRefExpr <col:102> 'bool3':'vector<bool, 3>' lvalue Var 'VarSeven' 'bool3':'vector<bool, 3>'
  719. | | | `-ParenExpr <col:118, col:145> 'bool4':'vector<bool, 4>'
  720. | | | `-CStyleCastExpr <col:119, col:144> 'bool4':'vector<bool, 4>' <NoOp>
  721. | | | `-ImplicitCastExpr <col:126, col:144> 'vector<bool, 4>':'vector<bool, 4>' <HLSLVectorSplat>
  722. | | | `-ImplicitCastExpr <col:126, col:144> 'bool' <FloatingToBoolean>
  723. | | | `-ParenExpr <col:126, col:144> 'float'
  724. | | | `-BinaryOperator <col:127, col:137> 'float' '*'
  725. | | | |-ImplicitCastExpr <col:127> 'float' <LValueToRValue>
  726. | | | | `-DeclRefExpr <col:127> 'float' lvalue Var 'VarFour' 'float'
  727. | | | `-ImplicitCastExpr <col:137> 'float' <LValueToRValue>
  728. | | | `-DeclRefExpr <col:137> 'float' lvalue Var 'VarZero' 'float'
  729. | | `-ImplicitCastExpr <col:150, col:279> 'vector<int, 4>' <HLSLCC_IntegralCast>
  730. | | `-ParenExpr <col:150, col:279> 'bool4':'vector<bool, 4>'
  731. | | `-CStyleCastExpr <col:151, col:278> 'bool4':'vector<bool, 4>' <NoOp>
  732. | | `-ImplicitCastExpr <col:158, col:278> 'vector<bool, 4>':'vector<bool, 4>' <HLSLVectorSplat>
  733. | | `-ImplicitCastExpr <col:158, col:278> 'bool' <FloatingToBoolean>
  734. | | `-ParenExpr <col:158, col:278> 'float'
  735. | | `-BinaryOperator <col:159, col:277> 'float' '*'
  736. | | |-ParenExpr <col:159, col:185> 'float'
  737. | | | `-BinaryOperator <col:160, col:178> 'float' '*'
  738. | | | |-ParenExpr <col:160, col:174> 'float'
  739. | | | | `-CStyleCastExpr <col:161, col:168> 'float' <NoOp>
  740. | | | | `-ImplicitCastExpr <col:168> 'float' <IntegralToFloating>
  741. | | | | `-ImplicitCastExpr <col:168> 'int' <LValueToRValue>
  742. | | | | `-DeclRefExpr <col:168> 'int' lvalue Var 'VarSix' 'int'
  743. | | | `-ImplicitCastExpr <col:178> 'float' <LValueToRValue>
  744. | | | `-DeclRefExpr <col:178> 'float' lvalue Var 'VarFour' 'float'
  745. | | `-ParenExpr <col:189, col:277> 'float'
  746. | | `-ConditionalOperator <col:190, col:276> 'float'
  747. | | |-ImplicitCastExpr <col:190> 'bool' <FloatingToBoolean>
  748. | | | `-ImplicitCastExpr <col:190> 'float' <LValueToRValue>
  749. | | | `-DeclRefExpr <col:190> 'float' lvalue Var 'VarZero' 'float'
  750. | | |-ParenExpr <col:200, col:214> 'float'
  751. | | | `-CStyleCastExpr <col:201, col:208> 'float' <NoOp>
  752. | | | `-ImplicitCastExpr <col:208> 'float' <IntegralToFloating>
  753. | | | `-ImplicitCastExpr <col:208> 'int' <LValueToRValue>
  754. | | | `-DeclRefExpr <col:208> 'int' lvalue Var 'VarTwo' 'int'
  755. | | `-ParenExpr <col:218, col:276> 'float'
  756. | | `-CStyleCastExpr <col:219, col:275> 'float' <NoOp>
  757. | | `-ImplicitCastExpr <col:226, col:275> 'float' <IntegralToFloating>
  758. | | `-HLSLVectorElementExpr <col:226, col:275> 'bool' z
  759. | | `-ParenExpr <col:226, col:273> 'vector<bool, 3>'
  760. | | `-ConditionalOperator <col:227, col:272> 'vector<bool, 3>'
  761. | | |-ImplicitCastExpr <col:227> 'bool3':'vector<bool, 3>' <LValueToRValue>
  762. | | | `-DeclRefExpr <col:227> 'bool3':'vector<bool, 3>' lvalue Var 'VarSeven' 'bool3':'vector<bool, 3>'
  763. | | |-ParenExpr <col:238, col:252> 'bool3':'vector<bool, 3>'
  764. | | | `-CStyleCastExpr <col:239, col:246> 'bool3':'vector<bool, 3>' <NoOp>
  765. | | | `-ImplicitCastExpr <col:246> 'vector<bool, 3>':'vector<bool, 3>' <HLSLVectorSplat>
  766. | | | `-ImplicitCastExpr <col:246> 'bool' <IntegralToBoolean>
  767. | | | `-ImplicitCastExpr <col:246> 'int' <LValueToRValue>
  768. | | | `-DeclRefExpr <col:246> 'int' lvalue Var 'VarTwo' 'int'
  769. | | `-ParenExpr <col:256, col:272> 'bool3':'vector<bool, 3>'
  770. | | `-CStyleCastExpr <col:257, col:264> 'bool3':'vector<bool, 3>' <NoOp>
  771. | | `-ImplicitCastExpr <col:264> 'vector<bool, 3>':'vector<bool, 3>' <HLSLVectorSplat>
  772. | | `-ImplicitCastExpr <col:264> 'bool' <IntegralToBoolean>
  773. | | `-ImplicitCastExpr <col:264> 'uint':'unsigned int' <LValueToRValue>
  774. | | `-DeclRefExpr <col:264> 'uint':'unsigned int' lvalue Var 'VarEight' 'uint':'unsigned int'
  775. | `-ImplicitCastExpr <col:285, col:456> 'vector<int, 4>' <HLSLCC_IntegralCast>
  776. | `-ParenExpr <col:285, col:456> 'bool4':'vector<bool, 4>'
  777. | `-CStyleCastExpr <col:286, col:455> 'bool4':'vector<bool, 4>' <NoOp>
  778. | `-ImplicitCastExpr <col:293, col:455> 'vector<bool, 4>':'vector<bool, 4>' <HLSLVectorSplat>
  779. | `-ParenExpr <col:293, col:455> 'bool'
  780. | `-ConditionalOperator <col:294, col:454> 'bool'
  781. | |-ImplicitCastExpr <col:294, col:340> 'bool' <IntegralToBoolean>
  782. | | `-ParenExpr <col:294, col:340> 'int'
  783. | | `-BinaryOperator <col:295, col:339> 'int' '+'
  784. | | |-ImplicitCastExpr <col:295, col:309> 'int' <IntegralCast>
  785. | | | `-ParenExpr <col:295, col:309> 'bool'
  786. | | | `-CStyleCastExpr <col:296, col:302> 'bool' <NoOp>
  787. | | | `-ImplicitCastExpr <col:302> 'bool' <FloatingToBoolean>
  788. | | | `-ImplicitCastExpr <col:302> 'float' <LValueToRValue>
  789. | | | `-DeclRefExpr <col:302> 'float' lvalue Var 'VarFour' 'float'
  790. | | `-ParenExpr <col:313, col:339> 'int'
  791. | | `-BinaryOperator <col:314, col:331> 'int' '+'
  792. | | |-ImplicitCastExpr <col:314, col:327> 'int' <IntegralCast>
  793. | | | `-ParenExpr <col:314, col:327> 'bool'
  794. | | | `-CStyleCastExpr <col:315, col:321> 'bool' <NoOp>
  795. | | | `-ImplicitCastExpr <col:321> 'bool' <IntegralToBoolean>
  796. | | | `-ImplicitCastExpr <col:321> 'int' <LValueToRValue>
  797. | | | `-DeclRefExpr <col:321> 'int' lvalue Var 'VarTwo' 'int'
  798. | | `-ImplicitCastExpr <col:331> 'int' <IntegralCast>
  799. | | `-ImplicitCastExpr <col:331> 'bool' <LValueToRValue>
  800. | | `-DeclRefExpr <col:331> 'bool' lvalue Var 'VarThree' 'bool'
  801. | |-ParenExpr <col:344, col:357> 'bool'
  802. | | `-CStyleCastExpr <col:345, col:351> 'bool' <NoOp>
  803. | | `-ImplicitCastExpr <col:351> 'bool' <IntegralToBoolean>
  804. | | `-ImplicitCastExpr <col:351> 'int' <LValueToRValue>
  805. | | `-DeclRefExpr <col:351> 'int' lvalue Var 'VarSix' 'int'
  806. | `-ParenExpr <col:361, col:454> 'bool'
  807. | `-CStyleCastExpr <col:362, col:453> 'bool' <NoOp>
  808. | `-ImplicitCastExpr <col:368, col:453> 'bool' <IntegralToBoolean>
  809. | `-ParenExpr <col:368, col:453> 'int'
  810. | `-BinaryOperator <col:369, col:452> 'int' '+'
  811. | |-ParenExpr <col:369, col:395> 'int'
  812. | | `-BinaryOperator <col:370, col:389> 'int' '-'
  813. | | |-ParenExpr <col:370, col:385> 'int'
  814. | | | `-CStyleCastExpr <col:371, col:384> 'int' <NoOp>
  815. | | | `-ImplicitCastExpr <col:376, col:384> 'int' <IntegralCast>
  816. | | | `-ImplicitCastExpr <col:376, col:384> 'bool' <LValueToRValue>
  817. | | | `-HLSLVectorElementExpr <col:376, col:384> 'bool' lvalue vectorcomponent w
  818. | | | `-DeclRefExpr <col:376> 'bool4':'vector<bool, 4>' lvalue Var 'VarNine' 'bool4':'vector<bool, 4>'
  819. | | `-ImplicitCastExpr <col:389> 'int' <LValueToRValue>
  820. | | `-DeclRefExpr <col:389> 'int' lvalue Var 'VarSix' 'int'
  821. | `-ParenExpr <col:399, col:452> 'int'
  822. | `-ConditionalOperator <col:400, col:446> 'int'
  823. | |-ImplicitCastExpr <col:400, col:425> 'bool' <IntegralToBoolean>
  824. | | `-ParenExpr <col:400, col:425> 'int'
  825. | | `-BinaryOperator <col:401, col:424> 'int' '+'
  826. | | |-ImplicitCastExpr <col:401> 'int' <LValueToRValue>
  827. | | | `-DeclRefExpr <col:401> 'int' lvalue Var 'VarSix' 'int'
  828. | | `-ParenExpr <col:410, col:424> 'int'
  829. | | `-CStyleCastExpr <col:411, col:416> 'int' <NoOp>
  830. | | `-ImplicitCastExpr <col:416> 'int' <IntegralCast>
  831. | | `-ImplicitCastExpr <col:416> 'bool' <LValueToRValue>
  832. | | `-DeclRefExpr <col:416> 'bool' lvalue Var 'VarThree' 'bool'
  833. | |-ParenExpr <col:429, col:442> 'int'
  834. | | `-CStyleCastExpr <col:430, col:435> 'int' <NoOp>
  835. | | `-ImplicitCastExpr <col:435> 'int' <FloatingToIntegral>
  836. | | `-ImplicitCastExpr <col:435> 'float' <LValueToRValue>
  837. | | `-DeclRefExpr <col:435> 'float' lvalue Var 'VarFour' 'float'
  838. | `-ImplicitCastExpr <col:446> 'int' <LValueToRValue>
  839. | `-DeclRefExpr <col:446> 'int' lvalue Var 'VarTwo' 'int'
  840. |-ParenExpr <col:461, col:687> 'bool4':'vector<bool, 4>'
  841. | `-CStyleCastExpr <col:462, col:686> 'bool4':'vector<bool, 4>' <NoOp>
  842. | `-ImplicitCastExpr <col:469, col:686> 'vector<bool, 4>':'vector<bool, 4>' <HLSLVectorSplat>
  843. | `-ImplicitCastExpr <col:469, col:686> 'bool' <IntegralToBoolean>
  844. | `-ParenExpr <col:469, col:686> 'int'
  845. | `-UnaryOperator <col:470, col:685> 'int' prefix '+'
  846. | `-ParenExpr <col:471, col:685> 'int'
  847. | `-BinaryOperator <col:472, col:684> 'int' '-'
  848. | |-ImplicitCastExpr <col:472, col:593> 'int' <IntegralCast>
  849. | | `-ParenExpr <col:472, col:593> 'bool'
  850. | | `-CStyleCastExpr <col:473, col:592> 'bool' <NoOp>
  851. | | `-ImplicitCastExpr <col:479, col:592> 'bool' <IntegralToBoolean>
  852. | | `-ParenExpr <col:479, col:592> 'unsigned int'
  853. | | `-UnaryOperator <col:480, col:591> 'unsigned int' prefix '~'
  854. | | `-ParenExpr <col:481, col:591> 'unsigned int'
  855. | | `-ConditionalOperator <col:482, col:590> 'unsigned int'
  856. | | |-ImplicitCastExpr <col:482> 'bool' <IntegralToBoolean>
  857. | | | `-ImplicitCastExpr <col:482> 'uint':'unsigned int' <LValueToRValue>
  858. | | | `-DeclRefExpr <col:482> 'uint':'unsigned int' lvalue Var 'VarEight' 'uint':'unsigned int'
  859. | | |-ParenExpr <col:493, col:570> 'uint':'unsigned int'
  860. | | | `-CStyleCastExpr <col:494, col:569> 'uint':'unsigned int' <NoOp>
  861. | | | `-ImplicitCastExpr <col:500, col:569> 'uint':'unsigned int' <IntegralCast>
  862. | | | `-ParenExpr <col:500, col:569> 'bool'
  863. | | | `-ConditionalOperator <col:501, col:568> 'bool'
  864. | | | |-ImplicitCastExpr <col:501> 'bool' <LValueToRValue>
  865. | | | | `-DeclRefExpr <col:501> 'bool' lvalue Var 'VarThree' 'bool'
  866. | | | |-ParenExpr <col:512, col:555> 'bool'
  867. | | | | `-CStyleCastExpr <col:513, col:554> 'bool' <NoOp>
  868. | | | | `-ImplicitCastExpr <col:519, col:554> 'bool' <IntegralToBoolean>
  869. | | | | `-ParenExpr <col:519, col:554> 'int'
  870. | | | | `-BinaryOperator <col:520, col:548> 'int' '-'
  871. | | | | |-ParenExpr <col:520, col:544> 'int'
  872. | | | | | `-BinaryOperator <col:521, col:543> 'int' '-'
  873. | | | | | |-ImplicitCastExpr <col:521> 'int' <LValueToRValue>
  874. | | | | | | `-DeclRefExpr <col:521> 'int' lvalue Var 'VarSix' 'int'
  875. | | | | | `-ParenExpr <col:530, col:543> 'int'
  876. | | | | | `-CStyleCastExpr <col:531, col:536> 'int' <NoOp>
  877. | | | | | `-ImplicitCastExpr <col:536> 'int' <FloatingToIntegral>
  878. | | | | | `-ImplicitCastExpr <col:536> 'float' <LValueToRValue>
  879. | | | | | `-DeclRefExpr <col:536> 'float' lvalue Var 'VarFour' 'float'
  880. | | | | `-ImplicitCastExpr <col:548> 'int' <LValueToRValue>
  881. | | | | `-DeclRefExpr <col:548> 'int' lvalue Var 'VarSix' 'int'
  882. | | | `-ImplicitCastExpr <col:559, col:568> 'bool' <LValueToRValue>
  883. | | | `-HLSLVectorElementExpr <col:559, col:568> 'bool' lvalue vectorcomponent z
  884. | | | `-DeclRefExpr <col:559> 'bool3':'vector<bool, 3>' lvalue Var 'VarSeven' 'bool3':'vector<bool, 3>'
  885. | | `-ParenExpr <col:574, col:590> 'uint':'unsigned int'
  886. | | `-CStyleCastExpr <col:575, col:589> 'uint':'unsigned int' <NoOp>
  887. | | `-ImplicitCastExpr <col:581, col:589> 'uint':'unsigned int' <IntegralCast>
  888. | | `-ImplicitCastExpr <col:581, col:589> 'bool' <LValueToRValue>
  889. | | `-HLSLVectorElementExpr <col:581, col:589> 'bool' lvalue vectorcomponent z
  890. | | `-DeclRefExpr <col:581> 'bool4':'vector<bool, 4>' lvalue Var 'VarNine' 'bool4':'vector<bool, 4>'
  891. | `-ImplicitCastExpr <col:597, col:684> 'int' <IntegralCast>
  892. | `-ParenExpr <col:597, col:684> 'bool'
  893. | `-UnaryOperator <col:598, col:683> 'bool' prefix '!'
  894. | `-ImplicitCastExpr <col:599, col:683> 'bool' <IntegralToBoolean>
  895. | `-ParenExpr <col:599, col:683> 'int'
  896. | `-UnaryOperator <col:600, col:682> 'int' prefix '+'
  897. | `-ParenExpr <col:601, col:682> 'int'
  898. | `-BinaryOperator <col:602, col:681> 'int' '*'
  899. | |-ImplicitCastExpr <col:602> 'int' <LValueToRValue>
  900. | | `-DeclRefExpr <col:602> 'int' lvalue Var 'VarOne' 'int'
  901. | `-ParenExpr <col:611, col:681> 'int'
  902. | `-CStyleCastExpr <col:612, col:680> 'int' <NoOp>
  903. | `-ParenExpr <col:617, col:680> 'int'
  904. | `-UnaryOperator <col:618, col:679> 'int' prefix '~'
  905. | `-ImplicitCastExpr <col:619, col:679> 'int' <IntegralCast>
  906. | `-ParenExpr <col:619, col:679> 'bool'
  907. | `-UnaryOperator <col:620, col:678> 'bool' prefix '!'
  908. | `-ImplicitCastExpr <col:621, col:678> 'bool' <IntegralToBoolean>
  909. | `-ParenExpr <col:621, col:678> 'int'
  910. | `-ConditionalOperator <col:622, col:677> 'int'
  911. | |-ImplicitCastExpr <col:622, col:649> 'bool' <IntegralToBoolean>
  912. | | `-ParenExpr <col:622, col:649> 'int'
  913. | | `-BinaryOperator <col:623, col:643> 'int' '-'
  914. | | |-ParenExpr <col:623, col:639> 'int'
  915. | | | `-CStyleCastExpr <col:624, col:638> 'int' <NoOp>
  916. | | | `-ImplicitCastExpr <col:629, col:638> 'int' <IntegralCast>
  917. | | | `-ImplicitCastExpr <col:629, col:638> 'bool' <LValueToRValue>
  918. | | | `-HLSLVectorElementExpr <col:629, col:638> 'bool' lvalue vectorcomponent y
  919. | | | `-DeclRefExpr <col:629> 'bool3':'vector<bool, 3>' lvalue Var 'VarSeven' 'bool3':'vector<bool, 3>'
  920. | | `-ImplicitCastExpr <col:643> 'int' <LValueToRValue>
  921. | | `-DeclRefExpr <col:643> 'int' lvalue Var 'VarSix' 'int'
  922. | |-ImplicitCastExpr <col:653> 'int' <LValueToRValue>
  923. | | `-DeclRefExpr <col:653> 'int' lvalue Var 'VarTwo' 'int'
  924. | `-ParenExpr <col:662, col:677> 'int'
  925. | `-CStyleCastExpr <col:663, col:676> 'int' <NoOp>
  926. | `-ImplicitCastExpr <col:668, col:676> 'int' <IntegralCast>
  927. | `-ImplicitCastExpr <col:668, col:676> 'bool' <LValueToRValue>
  928. | `-HLSLVectorElementExpr <col:668, col:676> 'bool' lvalue vectorcomponent w
  929. | `-DeclRefExpr <col:668> 'bool4':'vector<bool, 4>' lvalue Var 'VarNine' 'bool4':'vector<bool, 4>'
  930. `-ParenExpr <col:691, col:764> 'bool4':'vector<bool, 4>'
  931. `-CStyleCastExpr <col:692, col:763> 'bool4':'vector<bool, 4>' <NoOp>
  932. `-ImplicitCastExpr <col:699, col:763> 'vector<bool, 4>':'vector<bool, 4>' <HLSLVectorSplat>
  933. `-ImplicitCastExpr <col:699, col:763> 'bool' <FloatingToBoolean>
  934. `-ParenExpr <col:699, col:763> 'float'
  935. `-UnaryOperator <col:700, col:762> 'float' prefix '+'
  936. `-ParenExpr <col:701, col:762> 'float'
  937. `-ConditionalOperator <col:702, col:755> 'float'
  938. |-ImplicitCastExpr <col:702, col:731> 'bool' <FloatingToBoolean>
  939. | `-ParenExpr <col:702, col:731> 'float'
  940. | `-BinaryOperator <col:703, col:730> 'float' '+'
  941. | |-ImplicitCastExpr <col:703> 'float' <LValueToRValue>
  942. | | `-DeclRefExpr <col:703> 'float' lvalue Var 'VarZero' 'float'
  943. | `-ParenExpr <col:713, col:730> 'float'
  944. | `-CStyleCastExpr <col:714, col:729> 'float' <NoOp>
  945. | `-ImplicitCastExpr <col:721, col:729> 'float' <IntegralToFloating>
  946. | `-ImplicitCastExpr <col:721, col:729> 'bool' <LValueToRValue>
  947. | `-HLSLVectorElementExpr <col:721, col:729> 'bool' lvalue vectorcomponent z
  948. | `-DeclRefExpr <col:721> 'bool4':'vector<bool, 4>' lvalue Var 'VarNine' 'bool4':'vector<bool, 4>'
  949. |-ParenExpr <col:735, col:751> 'float'
  950. | `-CStyleCastExpr <col:736, col:743> 'float' <NoOp>
  951. | `-ImplicitCastExpr <col:743> 'float' <IntegralToFloating>
  952. | `-ImplicitCastExpr <col:743> 'bool' <LValueToRValue>
  953. | `-DeclRefExpr <col:743> 'bool' lvalue Var 'VarThree' 'bool'
  954. `-ImplicitCastExpr <col:755> 'float' <LValueToRValue>
  955. `-DeclRefExpr <col:755> 'float' lvalue Var 'VarFive' 'float'
  956. */
  957. }
  958. float4 main() : SV_Target
  959. {
  960. return test();
  961. }