int.carbon 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/builtins/int.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/builtins/int.carbon
  10. // --- basic.carbon
  11. library "[[@TEST_NAME]]";
  12. fn Negate(a: i32) -> i32 = "int.snegate";
  13. fn TestNegate(a: i32) -> i32 { return Negate(a); }
  14. fn Add(a: i32, b: i32) -> i32 = "int.sadd";
  15. fn TestAdd(a: i32, b: i32) -> i32 { return Add(a, b); }
  16. fn Sub(a: i32, b: i32) -> i32 = "int.ssub";
  17. fn TestSub(a: i32, b: i32) -> i32 { return Sub(a, b); }
  18. fn Mul(a: i32, b: i32) -> i32 = "int.smul";
  19. fn TestMul(a: i32, b: i32) -> i32 { return Mul(a, b); }
  20. fn Div(a: i32, b: i32) -> i32 = "int.sdiv";
  21. fn TestDiv(a: i32, b: i32) -> i32 { return Div(a, b); }
  22. fn Mod(a: i32, b: i32) -> i32 = "int.smod";
  23. fn TestMod(a: i32, b: i32) -> i32 { return Mod(a, b); }
  24. fn Complement(a: i32) -> i32 = "int.complement";
  25. fn TestComplement(a: i32) -> i32 { return Complement(a); }
  26. fn And(a: i32, b: i32) -> i32 = "int.and";
  27. fn TestAnd(a: i32, b: i32) -> i32 { return And(a, b); }
  28. fn Or(a: i32, b: i32) -> i32 = "int.or";
  29. fn TestOr(a: i32, b: i32) -> i32 { return Or(a, b); }
  30. fn Xor(a: i32, b: i32) -> i32 = "int.xor";
  31. fn TestXor(a: i32, b: i32) -> i32 { return Xor(a, b); }
  32. fn LeftShift(a: i32, b: i32) -> i32 = "int.left_shift";
  33. fn TestLeftShift(a: i32, b: i32) -> i32 { return LeftShift(a, b); }
  34. fn ArithmeticRightShift(a: i32, b: i32) -> i32 = "int.right_shift";
  35. fn TestArithmeticRightShift(a: i32, b: i32) -> i32 { return ArithmeticRightShift(a, b); }
  36. fn LogicalRightShift(a: u32, b: u32) -> u32 = "int.right_shift";
  37. fn TestLogicalRightShift(a: u32, b: u32) -> u32 { return LogicalRightShift(a, b); }
  38. fn Eq(a: i32, b: i32) -> bool = "int.eq";
  39. fn TestEq(a: i32, b: i32) -> bool { return Eq(a, b); }
  40. fn Neq(a: i32, b: i32) -> bool = "int.neq";
  41. fn TestNeq(a: i32, b: i32) -> bool { return Neq(a, b); }
  42. fn Less(a: i32, b: i32) -> bool = "int.less";
  43. fn TestLess(a: i32, b: i32) -> bool { return Less(a, b); }
  44. fn LessEq(a: i32, b: i32) -> bool = "int.less_eq";
  45. fn TestLessEq(a: i32, b: i32) -> bool { return LessEq(a, b); }
  46. fn Greater(a: i32, b: i32) -> bool = "int.greater";
  47. fn TestGreater(a: i32, b: i32) -> bool { return Greater(a, b); }
  48. fn GreaterEq(a: i32, b: i32) -> bool = "int.greater_eq";
  49. fn TestGreaterEq(a: i32, b: i32) -> bool { return GreaterEq(a, b); }
  50. // --- compound_assign.carbon
  51. library "[[@TEST_NAME]]";
  52. fn SAdd(a: i32*, b: i32) = "int.sadd_assign";
  53. fn TestSAdd(a: i32*, b: i32) { SAdd(a, b); }
  54. fn SSub(a: i32*, b: i32) = "int.ssub_assign";
  55. fn TestSSub(a: i32*, b: i32) { SSub(a, b); }
  56. fn SMul(a: i32*, b: i32) = "int.smul_assign";
  57. fn TestSMul(a: i32*, b: i32) { SMul(a, b); }
  58. fn SDiv(a: i32*, b: i32) = "int.sdiv_assign";
  59. fn TestSDiv(a: i32*, b: i32) { SDiv(a, b); }
  60. fn SMod(a: i32*, b: i32) = "int.smod_assign";
  61. fn TestSMod(a: i32*, b: i32) { SMod(a, b); }
  62. fn UAdd(a: i32*, b: i32) = "int.uadd_assign";
  63. fn TestUAdd(a: i32*, b: i32) { UAdd(a, b); }
  64. fn USub(a: i32*, b: i32) = "int.usub_assign";
  65. fn TestUSub(a: i32*, b: i32) { USub(a, b); }
  66. fn UMul(a: i32*, b: i32) = "int.umul_assign";
  67. fn TestUMul(a: i32*, b: i32) { UMul(a, b); }
  68. fn UDiv(a: i32*, b: i32) = "int.udiv_assign";
  69. fn TestUDiv(a: i32*, b: i32) { UDiv(a, b); }
  70. fn UMod(a: i32*, b: i32) = "int.umod_assign";
  71. fn TestUMod(a: i32*, b: i32) { UMod(a, b); }
  72. fn And(a: i32*, b: i32) = "int.and_assign";
  73. fn TestAnd(a: i32*, b: i32) { And(a, b); }
  74. fn Or(a: i32*, b: i32) = "int.or_assign";
  75. fn TestOr(a: i32*, b: i32) { Or(a, b); }
  76. fn Xor(a: i32*, b: i32) = "int.xor_assign";
  77. fn TestXor(a: i32*, b: i32) { Xor(a, b); }
  78. fn LeftShift(a: i32*, b: i32) = "int.left_shift_assign";
  79. fn TestLeftShift(a: i32*, b: i32) { LeftShift(a, b); }
  80. fn ArithmeticRightShift(a: i32*, b: u32) = "int.right_shift_assign";
  81. fn TestArithmeticRightShift(a: i32*, b: u32) { ArithmeticRightShift(a, b); }
  82. fn LogicalRightShift(a: u32*, b: u32) = "int.right_shift_assign";
  83. fn TestLogicalRightShift(a: u32*, b: u32) { LogicalRightShift(a, b); }
  84. // --- mixed_shift.carbon
  85. library "[[@TEST_NAME]]";
  86. fn LeftShiftSmaller(a: i32, b: i16) -> i32 = "int.left_shift";
  87. fn TestLeftShiftSmaller(a: i32, b: i16) -> i32 { return LeftShiftSmaller(a, b); }
  88. fn RightShiftSmaller(a: i32, b: i16) -> i32 = "int.right_shift";
  89. fn TestRightShiftSmaller(a: i32, b: i16) -> i32 { return RightShiftSmaller(a, b); }
  90. fn LeftShiftLargerII(a: i16, b: i32) -> i16 = "int.left_shift";
  91. fn TestLeftShiftLargerII(a: i16, b: i32) -> i16 { return LeftShiftLargerII(a, b); }
  92. fn RightShiftLargerII(a: i16, b: i32) -> i16 = "int.right_shift";
  93. fn TestRightShiftLargerII(a: i16, b: i32) -> i16 { return RightShiftLargerII(a, b); }
  94. fn LeftShiftLargerIU(a: i16, b: u32) -> i16 = "int.left_shift";
  95. fn TestLeftShiftLargerIU(a: i16, b: u32) -> i16 { return LeftShiftLargerIU(a, b); }
  96. fn RightShiftLargerIU(a: i16, b: u32) -> i16 = "int.right_shift";
  97. fn TestRightShiftLargerIU(a: i16, b: u32) -> i16 { return RightShiftLargerIU(a, b); }
  98. fn LeftShiftLargerUI(a: u16, b: i32) -> u16 = "int.left_shift";
  99. fn TestLeftShiftLargerUI(a: u16, b: i32) -> u16 { return LeftShiftLargerUI(a, b); }
  100. fn RightShiftLargerUI(a: u16, b: i32) -> u16 = "int.right_shift";
  101. fn TestRightShiftLargerUI(a: u16, b: i32) -> u16 { return RightShiftLargerUI(a, b); }
  102. fn LeftShiftLargerUU(a: u16, b: u32) -> u16 = "int.left_shift";
  103. fn TestLeftShiftLargerUU(a: u16, b: u32) -> u16 { return LeftShiftLargerUU(a, b); }
  104. fn RightShiftLargerUU(a: u16, b: u32) -> u16 = "int.right_shift";
  105. fn TestRightShiftLargerUU(a: u16, b: u32) -> u16 { return RightShiftLargerUU(a, b); }
  106. // --- mixed_compare.carbon
  107. library "[[@TEST_NAME]]";
  108. fn Eq_u16_u32(a: u16, b: u32) -> bool = "int.eq";
  109. fn Eq_i16_u32(a: i16, b: u32) -> bool = "int.eq";
  110. fn Eq_u16_i32(a: u16, b: i32) -> bool = "int.eq";
  111. fn Eq_i16_i32(a: i16, b: i32) -> bool = "int.eq";
  112. fn Eq_i32_u32(a: i32, b: u32) -> bool = "int.eq";
  113. fn TestEq_u16_u32(a: u16, b: u32) -> bool { return Eq_u16_u32(a, b); }
  114. fn TestEq_i16_u32(a: i16, b: u32) -> bool { return Eq_i16_u32(a, b); }
  115. fn TestEq_u16_i32(a: u16, b: i32) -> bool { return Eq_u16_i32(a, b); }
  116. fn TestEq_i16_i32(a: i16, b: i32) -> bool { return Eq_i16_i32(a, b); }
  117. fn TestEq_i32_u32(a: i32, b: u32) -> bool { return Eq_i32_u32(a, b); }
  118. fn Less_u16_u32(a: u16, b: u32) -> bool = "int.less";
  119. fn Less_i16_u32(a: i16, b: u32) -> bool = "int.less";
  120. fn Less_u16_i32(a: u16, b: i32) -> bool = "int.less";
  121. fn Less_i16_i32(a: i16, b: i32) -> bool = "int.less";
  122. fn Less_i32_u32(a: i32, b: u32) -> bool = "int.less";
  123. fn TestLess_u16_u32(a: u16, b: u32) -> bool { return Less_u16_u32(a, b); }
  124. fn TestLess_i16_u32(a: i16, b: u32) -> bool { return Less_i16_u32(a, b); }
  125. fn TestLess_u16_i32(a: u16, b: i32) -> bool { return Less_u16_i32(a, b); }
  126. fn TestLess_i16_i32(a: i16, b: i32) -> bool { return Less_i16_i32(a, b); }
  127. fn TestLess_i32_u32(a: i32, b: u32) -> bool { return Less_i32_u32(a, b); }
  128. // --- convert.carbon
  129. library "[[@TEST_NAME]]";
  130. // Size preserving
  131. fn Int32ToInt32(a: i32) -> i32 = "int.convert";
  132. fn Int32ToUint32(a: i32) -> u32 = "int.convert";
  133. fn Uint32ToInt32(a: u32) -> i32 = "int.convert";
  134. fn Uint32ToUint32(a: u32) -> u32 = "int.convert";
  135. fn TestInt32ToInt32(a: i32) -> i32 { return Int32ToInt32(a); }
  136. fn TestInt32ToUint32(a: i32) -> u32 { return Int32ToUint32(a); }
  137. fn TestUint32ToInt32(a: u32) -> i32 { return Uint32ToInt32(a); }
  138. fn TestUint32ToUint32(a: u32) -> u32 { return Uint32ToUint32(a); }
  139. // Narrowing
  140. fn Int32ToInt16(a: i32) -> i16 = "int.convert";
  141. fn Int32ToUint16(a: i32) -> u16 = "int.convert";
  142. fn Uint32ToInt16(a: u32) -> i16 = "int.convert";
  143. fn Uint32ToUint16(a: u32) -> u16 = "int.convert";
  144. fn TestInt32ToInt16(a: i32) -> i16 { return Int32ToInt16(a); }
  145. fn TestInt32ToUint16(a: i32) -> u16 { return Int32ToUint16(a); }
  146. fn TestUint32ToInt16(a: u32) -> i16 { return Uint32ToInt16(a); }
  147. fn TestUint32ToUint16(a: u32) -> u16 { return Uint32ToUint16(a); }
  148. // Widening
  149. fn Int32ToInt64(a: i32) -> i64 = "int.convert";
  150. fn Int32ToUint64(a: i32) -> u64 = "int.convert";
  151. fn Uint32ToInt64(a: u32) -> i64 = "int.convert";
  152. fn Uint32ToUint64(a: u32) -> u64 = "int.convert";
  153. fn TestInt32ToInt64(a: i32) -> i64 { return Int32ToInt64(a); }
  154. fn TestInt32ToUint64(a: i32) -> u64 { return Int32ToUint64(a); }
  155. fn TestUint32ToInt64(a: u32) -> i64 { return Uint32ToInt64(a); }
  156. fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); }
  157. // CHECK:STDOUT: ; ModuleID = 'basic.carbon'
  158. // CHECK:STDOUT: source_filename = "basic.carbon"
  159. // CHECK:STDOUT:
  160. // CHECK:STDOUT: define i32 @_CTestNegate.Main(i32 %a) !dbg !4 {
  161. // CHECK:STDOUT: entry:
  162. // CHECK:STDOUT: %int.snegate = sub i32 0, %a, !dbg !7
  163. // CHECK:STDOUT: ret i32 %int.snegate, !dbg !8
  164. // CHECK:STDOUT: }
  165. // CHECK:STDOUT:
  166. // CHECK:STDOUT: define i32 @_CTestAdd.Main(i32 %a, i32 %b) !dbg !9 {
  167. // CHECK:STDOUT: entry:
  168. // CHECK:STDOUT: %int.sadd = add i32 %a, %b, !dbg !10
  169. // CHECK:STDOUT: ret i32 %int.sadd, !dbg !11
  170. // CHECK:STDOUT: }
  171. // CHECK:STDOUT:
  172. // CHECK:STDOUT: define i32 @_CTestSub.Main(i32 %a, i32 %b) !dbg !12 {
  173. // CHECK:STDOUT: entry:
  174. // CHECK:STDOUT: %int.ssub = sub i32 %a, %b, !dbg !13
  175. // CHECK:STDOUT: ret i32 %int.ssub, !dbg !14
  176. // CHECK:STDOUT: }
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: define i32 @_CTestMul.Main(i32 %a, i32 %b) !dbg !15 {
  179. // CHECK:STDOUT: entry:
  180. // CHECK:STDOUT: %int.smul = mul i32 %a, %b, !dbg !16
  181. // CHECK:STDOUT: ret i32 %int.smul, !dbg !17
  182. // CHECK:STDOUT: }
  183. // CHECK:STDOUT:
  184. // CHECK:STDOUT: define i32 @_CTestDiv.Main(i32 %a, i32 %b) !dbg !18 {
  185. // CHECK:STDOUT: entry:
  186. // CHECK:STDOUT: %int.sdiv = sdiv i32 %a, %b, !dbg !19
  187. // CHECK:STDOUT: ret i32 %int.sdiv, !dbg !20
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT:
  190. // CHECK:STDOUT: define i32 @_CTestMod.Main(i32 %a, i32 %b) !dbg !21 {
  191. // CHECK:STDOUT: entry:
  192. // CHECK:STDOUT: %int.smod = srem i32 %a, %b, !dbg !22
  193. // CHECK:STDOUT: ret i32 %int.smod, !dbg !23
  194. // CHECK:STDOUT: }
  195. // CHECK:STDOUT:
  196. // CHECK:STDOUT: define i32 @_CTestComplement.Main(i32 %a) !dbg !24 {
  197. // CHECK:STDOUT: entry:
  198. // CHECK:STDOUT: %int.complement = xor i32 -1, %a, !dbg !25
  199. // CHECK:STDOUT: ret i32 %int.complement, !dbg !26
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT:
  202. // CHECK:STDOUT: define i32 @_CTestAnd.Main(i32 %a, i32 %b) !dbg !27 {
  203. // CHECK:STDOUT: entry:
  204. // CHECK:STDOUT: %int.and = and i32 %a, %b, !dbg !28
  205. // CHECK:STDOUT: ret i32 %int.and, !dbg !29
  206. // CHECK:STDOUT: }
  207. // CHECK:STDOUT:
  208. // CHECK:STDOUT: define i32 @_CTestOr.Main(i32 %a, i32 %b) !dbg !30 {
  209. // CHECK:STDOUT: entry:
  210. // CHECK:STDOUT: %int.or = or i32 %a, %b, !dbg !31
  211. // CHECK:STDOUT: ret i32 %int.or, !dbg !32
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: define i32 @_CTestXor.Main(i32 %a, i32 %b) !dbg !33 {
  215. // CHECK:STDOUT: entry:
  216. // CHECK:STDOUT: %int.xor = xor i32 %a, %b, !dbg !34
  217. // CHECK:STDOUT: ret i32 %int.xor, !dbg !35
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: define i32 @_CTestLeftShift.Main(i32 %a, i32 %b) !dbg !36 {
  221. // CHECK:STDOUT: entry:
  222. // CHECK:STDOUT: %int.left_shift = shl i32 %a, %b, !dbg !37
  223. // CHECK:STDOUT: ret i32 %int.left_shift, !dbg !38
  224. // CHECK:STDOUT: }
  225. // CHECK:STDOUT:
  226. // CHECK:STDOUT: define i32 @_CTestArithmeticRightShift.Main(i32 %a, i32 %b) !dbg !39 {
  227. // CHECK:STDOUT: entry:
  228. // CHECK:STDOUT: %int.right_shift = ashr i32 %a, %b, !dbg !40
  229. // CHECK:STDOUT: ret i32 %int.right_shift, !dbg !41
  230. // CHECK:STDOUT: }
  231. // CHECK:STDOUT:
  232. // CHECK:STDOUT: define i32 @_CTestLogicalRightShift.Main(i32 %a, i32 %b) !dbg !42 {
  233. // CHECK:STDOUT: entry:
  234. // CHECK:STDOUT: %int.right_shift = lshr i32 %a, %b, !dbg !43
  235. // CHECK:STDOUT: ret i32 %int.right_shift, !dbg !44
  236. // CHECK:STDOUT: }
  237. // CHECK:STDOUT:
  238. // CHECK:STDOUT: define i1 @_CTestEq.Main(i32 %a, i32 %b) !dbg !45 {
  239. // CHECK:STDOUT: entry:
  240. // CHECK:STDOUT: %int.eq = icmp eq i32 %a, %b, !dbg !46
  241. // CHECK:STDOUT: ret i1 %int.eq, !dbg !47
  242. // CHECK:STDOUT: }
  243. // CHECK:STDOUT:
  244. // CHECK:STDOUT: define i1 @_CTestNeq.Main(i32 %a, i32 %b) !dbg !48 {
  245. // CHECK:STDOUT: entry:
  246. // CHECK:STDOUT: %int.neq = icmp ne i32 %a, %b, !dbg !49
  247. // CHECK:STDOUT: ret i1 %int.neq, !dbg !50
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: define i1 @_CTestLess.Main(i32 %a, i32 %b) !dbg !51 {
  251. // CHECK:STDOUT: entry:
  252. // CHECK:STDOUT: %int.less = icmp slt i32 %a, %b, !dbg !52
  253. // CHECK:STDOUT: ret i1 %int.less, !dbg !53
  254. // CHECK:STDOUT: }
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: define i1 @_CTestLessEq.Main(i32 %a, i32 %b) !dbg !54 {
  257. // CHECK:STDOUT: entry:
  258. // CHECK:STDOUT: %int.less_eq = icmp sle i32 %a, %b, !dbg !55
  259. // CHECK:STDOUT: ret i1 %int.less_eq, !dbg !56
  260. // CHECK:STDOUT: }
  261. // CHECK:STDOUT:
  262. // CHECK:STDOUT: define i1 @_CTestGreater.Main(i32 %a, i32 %b) !dbg !57 {
  263. // CHECK:STDOUT: entry:
  264. // CHECK:STDOUT: %int.greater = icmp sgt i32 %a, %b, !dbg !58
  265. // CHECK:STDOUT: ret i1 %int.greater, !dbg !59
  266. // CHECK:STDOUT: }
  267. // CHECK:STDOUT:
  268. // CHECK:STDOUT: define i1 @_CTestGreaterEq.Main(i32 %a, i32 %b) !dbg !60 {
  269. // CHECK:STDOUT: entry:
  270. // CHECK:STDOUT: %int.greater_eq = icmp sge i32 %a, %b, !dbg !61
  271. // CHECK:STDOUT: ret i1 %int.greater_eq, !dbg !62
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
  275. // CHECK:STDOUT: !llvm.dbg.cu = !{!2}
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  278. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  279. // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  280. // CHECK:STDOUT: !3 = !DIFile(filename: "basic.carbon", directory: "")
  281. // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestNegate", linkageName: "_CTestNegate.Main", scope: null, file: !3, line: 5, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  282. // CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
  283. // CHECK:STDOUT: !6 = !{}
  284. // CHECK:STDOUT: !7 = !DILocation(line: 5, column: 39, scope: !4)
  285. // CHECK:STDOUT: !8 = !DILocation(line: 5, column: 32, scope: !4)
  286. // CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestAdd", linkageName: "_CTestAdd.Main", scope: null, file: !3, line: 8, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  287. // CHECK:STDOUT: !10 = !DILocation(line: 8, column: 44, scope: !9)
  288. // CHECK:STDOUT: !11 = !DILocation(line: 8, column: 37, scope: !9)
  289. // CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestSub", linkageName: "_CTestSub.Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  290. // CHECK:STDOUT: !13 = !DILocation(line: 11, column: 44, scope: !12)
  291. // CHECK:STDOUT: !14 = !DILocation(line: 11, column: 37, scope: !12)
  292. // CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestMul", linkageName: "_CTestMul.Main", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  293. // CHECK:STDOUT: !16 = !DILocation(line: 14, column: 44, scope: !15)
  294. // CHECK:STDOUT: !17 = !DILocation(line: 14, column: 37, scope: !15)
  295. // CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestDiv", linkageName: "_CTestDiv.Main", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  296. // CHECK:STDOUT: !19 = !DILocation(line: 17, column: 44, scope: !18)
  297. // CHECK:STDOUT: !20 = !DILocation(line: 17, column: 37, scope: !18)
  298. // CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestMod", linkageName: "_CTestMod.Main", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  299. // CHECK:STDOUT: !22 = !DILocation(line: 20, column: 44, scope: !21)
  300. // CHECK:STDOUT: !23 = !DILocation(line: 20, column: 37, scope: !21)
  301. // CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestComplement", linkageName: "_CTestComplement.Main", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  302. // CHECK:STDOUT: !25 = !DILocation(line: 23, column: 43, scope: !24)
  303. // CHECK:STDOUT: !26 = !DILocation(line: 23, column: 36, scope: !24)
  304. // CHECK:STDOUT: !27 = distinct !DISubprogram(name: "TestAnd", linkageName: "_CTestAnd.Main", scope: null, file: !3, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  305. // CHECK:STDOUT: !28 = !DILocation(line: 26, column: 44, scope: !27)
  306. // CHECK:STDOUT: !29 = !DILocation(line: 26, column: 37, scope: !27)
  307. // CHECK:STDOUT: !30 = distinct !DISubprogram(name: "TestOr", linkageName: "_CTestOr.Main", scope: null, file: !3, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  308. // CHECK:STDOUT: !31 = !DILocation(line: 29, column: 43, scope: !30)
  309. // CHECK:STDOUT: !32 = !DILocation(line: 29, column: 36, scope: !30)
  310. // CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestXor", linkageName: "_CTestXor.Main", scope: null, file: !3, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  311. // CHECK:STDOUT: !34 = !DILocation(line: 32, column: 44, scope: !33)
  312. // CHECK:STDOUT: !35 = !DILocation(line: 32, column: 37, scope: !33)
  313. // CHECK:STDOUT: !36 = distinct !DISubprogram(name: "TestLeftShift", linkageName: "_CTestLeftShift.Main", scope: null, file: !3, line: 35, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  314. // CHECK:STDOUT: !37 = !DILocation(line: 35, column: 50, scope: !36)
  315. // CHECK:STDOUT: !38 = !DILocation(line: 35, column: 43, scope: !36)
  316. // CHECK:STDOUT: !39 = distinct !DISubprogram(name: "TestArithmeticRightShift", linkageName: "_CTestArithmeticRightShift.Main", scope: null, file: !3, line: 38, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  317. // CHECK:STDOUT: !40 = !DILocation(line: 38, column: 61, scope: !39)
  318. // CHECK:STDOUT: !41 = !DILocation(line: 38, column: 54, scope: !39)
  319. // CHECK:STDOUT: !42 = distinct !DISubprogram(name: "TestLogicalRightShift", linkageName: "_CTestLogicalRightShift.Main", scope: null, file: !3, line: 41, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  320. // CHECK:STDOUT: !43 = !DILocation(line: 41, column: 58, scope: !42)
  321. // CHECK:STDOUT: !44 = !DILocation(line: 41, column: 51, scope: !42)
  322. // CHECK:STDOUT: !45 = distinct !DISubprogram(name: "TestEq", linkageName: "_CTestEq.Main", scope: null, file: !3, line: 44, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  323. // CHECK:STDOUT: !46 = !DILocation(line: 44, column: 44, scope: !45)
  324. // CHECK:STDOUT: !47 = !DILocation(line: 44, column: 37, scope: !45)
  325. // CHECK:STDOUT: !48 = distinct !DISubprogram(name: "TestNeq", linkageName: "_CTestNeq.Main", scope: null, file: !3, line: 47, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  326. // CHECK:STDOUT: !49 = !DILocation(line: 47, column: 45, scope: !48)
  327. // CHECK:STDOUT: !50 = !DILocation(line: 47, column: 38, scope: !48)
  328. // CHECK:STDOUT: !51 = distinct !DISubprogram(name: "TestLess", linkageName: "_CTestLess.Main", scope: null, file: !3, line: 50, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  329. // CHECK:STDOUT: !52 = !DILocation(line: 50, column: 46, scope: !51)
  330. // CHECK:STDOUT: !53 = !DILocation(line: 50, column: 39, scope: !51)
  331. // CHECK:STDOUT: !54 = distinct !DISubprogram(name: "TestLessEq", linkageName: "_CTestLessEq.Main", scope: null, file: !3, line: 53, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  332. // CHECK:STDOUT: !55 = !DILocation(line: 53, column: 48, scope: !54)
  333. // CHECK:STDOUT: !56 = !DILocation(line: 53, column: 41, scope: !54)
  334. // CHECK:STDOUT: !57 = distinct !DISubprogram(name: "TestGreater", linkageName: "_CTestGreater.Main", scope: null, file: !3, line: 56, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  335. // CHECK:STDOUT: !58 = !DILocation(line: 56, column: 49, scope: !57)
  336. // CHECK:STDOUT: !59 = !DILocation(line: 56, column: 42, scope: !57)
  337. // CHECK:STDOUT: !60 = distinct !DISubprogram(name: "TestGreaterEq", linkageName: "_CTestGreaterEq.Main", scope: null, file: !3, line: 59, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  338. // CHECK:STDOUT: !61 = !DILocation(line: 59, column: 51, scope: !60)
  339. // CHECK:STDOUT: !62 = !DILocation(line: 59, column: 44, scope: !60)
  340. // CHECK:STDOUT: ; ModuleID = 'compound_assign.carbon'
  341. // CHECK:STDOUT: source_filename = "compound_assign.carbon"
  342. // CHECK:STDOUT:
  343. // CHECK:STDOUT: define void @_CTestSAdd.Main(ptr %a, i32 %b) !dbg !4 {
  344. // CHECK:STDOUT: entry:
  345. // CHECK:STDOUT: %int.sadd_assign = load i32, ptr %a, align 4, !dbg !7
  346. // CHECK:STDOUT: %int.sadd_assign1 = add i32 %int.sadd_assign, %b, !dbg !7
  347. // CHECK:STDOUT: store i32 %int.sadd_assign1, ptr %a, align 4, !dbg !7
  348. // CHECK:STDOUT: ret void, !dbg !8
  349. // CHECK:STDOUT: }
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: define void @_CTestSSub.Main(ptr %a, i32 %b) !dbg !9 {
  352. // CHECK:STDOUT: entry:
  353. // CHECK:STDOUT: %int.ssub_assign = load i32, ptr %a, align 4, !dbg !10
  354. // CHECK:STDOUT: %int.ssub_assign1 = sub i32 %int.ssub_assign, %b, !dbg !10
  355. // CHECK:STDOUT: store i32 %int.ssub_assign1, ptr %a, align 4, !dbg !10
  356. // CHECK:STDOUT: ret void, !dbg !11
  357. // CHECK:STDOUT: }
  358. // CHECK:STDOUT:
  359. // CHECK:STDOUT: define void @_CTestSMul.Main(ptr %a, i32 %b) !dbg !12 {
  360. // CHECK:STDOUT: entry:
  361. // CHECK:STDOUT: %int.smul_assign = load i32, ptr %a, align 4, !dbg !13
  362. // CHECK:STDOUT: %int.smul_assign1 = mul i32 %int.smul_assign, %b, !dbg !13
  363. // CHECK:STDOUT: store i32 %int.smul_assign1, ptr %a, align 4, !dbg !13
  364. // CHECK:STDOUT: ret void, !dbg !14
  365. // CHECK:STDOUT: }
  366. // CHECK:STDOUT:
  367. // CHECK:STDOUT: define void @_CTestSDiv.Main(ptr %a, i32 %b) !dbg !15 {
  368. // CHECK:STDOUT: entry:
  369. // CHECK:STDOUT: %int.sdiv_assign = load i32, ptr %a, align 4, !dbg !16
  370. // CHECK:STDOUT: %int.sdiv_assign1 = sdiv i32 %int.sdiv_assign, %b, !dbg !16
  371. // CHECK:STDOUT: store i32 %int.sdiv_assign1, ptr %a, align 4, !dbg !16
  372. // CHECK:STDOUT: ret void, !dbg !17
  373. // CHECK:STDOUT: }
  374. // CHECK:STDOUT:
  375. // CHECK:STDOUT: define void @_CTestSMod.Main(ptr %a, i32 %b) !dbg !18 {
  376. // CHECK:STDOUT: entry:
  377. // CHECK:STDOUT: %int.smod_assign = load i32, ptr %a, align 4, !dbg !19
  378. // CHECK:STDOUT: %int.smod_assign1 = srem i32 %int.smod_assign, %b, !dbg !19
  379. // CHECK:STDOUT: store i32 %int.smod_assign1, ptr %a, align 4, !dbg !19
  380. // CHECK:STDOUT: ret void, !dbg !20
  381. // CHECK:STDOUT: }
  382. // CHECK:STDOUT:
  383. // CHECK:STDOUT: define void @_CTestUAdd.Main(ptr %a, i32 %b) !dbg !21 {
  384. // CHECK:STDOUT: entry:
  385. // CHECK:STDOUT: %int.uadd_assign = load i32, ptr %a, align 4, !dbg !22
  386. // CHECK:STDOUT: %int.uadd_assign1 = add i32 %int.uadd_assign, %b, !dbg !22
  387. // CHECK:STDOUT: store i32 %int.uadd_assign1, ptr %a, align 4, !dbg !22
  388. // CHECK:STDOUT: ret void, !dbg !23
  389. // CHECK:STDOUT: }
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: define void @_CTestUSub.Main(ptr %a, i32 %b) !dbg !24 {
  392. // CHECK:STDOUT: entry:
  393. // CHECK:STDOUT: %int.usub_assign = load i32, ptr %a, align 4, !dbg !25
  394. // CHECK:STDOUT: %int.usub_assign1 = sub i32 %int.usub_assign, %b, !dbg !25
  395. // CHECK:STDOUT: store i32 %int.usub_assign1, ptr %a, align 4, !dbg !25
  396. // CHECK:STDOUT: ret void, !dbg !26
  397. // CHECK:STDOUT: }
  398. // CHECK:STDOUT:
  399. // CHECK:STDOUT: define void @_CTestUMul.Main(ptr %a, i32 %b) !dbg !27 {
  400. // CHECK:STDOUT: entry:
  401. // CHECK:STDOUT: %int.umul_assign = load i32, ptr %a, align 4, !dbg !28
  402. // CHECK:STDOUT: %int.umul_assign1 = mul i32 %int.umul_assign, %b, !dbg !28
  403. // CHECK:STDOUT: store i32 %int.umul_assign1, ptr %a, align 4, !dbg !28
  404. // CHECK:STDOUT: ret void, !dbg !29
  405. // CHECK:STDOUT: }
  406. // CHECK:STDOUT:
  407. // CHECK:STDOUT: define void @_CTestUDiv.Main(ptr %a, i32 %b) !dbg !30 {
  408. // CHECK:STDOUT: entry:
  409. // CHECK:STDOUT: %int.udiv_assign = load i32, ptr %a, align 4, !dbg !31
  410. // CHECK:STDOUT: %int.udiv_assign1 = udiv i32 %int.udiv_assign, %b, !dbg !31
  411. // CHECK:STDOUT: store i32 %int.udiv_assign1, ptr %a, align 4, !dbg !31
  412. // CHECK:STDOUT: ret void, !dbg !32
  413. // CHECK:STDOUT: }
  414. // CHECK:STDOUT:
  415. // CHECK:STDOUT: define void @_CTestUMod.Main(ptr %a, i32 %b) !dbg !33 {
  416. // CHECK:STDOUT: entry:
  417. // CHECK:STDOUT: %int.umod_assign = load i32, ptr %a, align 4, !dbg !34
  418. // CHECK:STDOUT: %int.umod_assign1 = urem i32 %int.umod_assign, %b, !dbg !34
  419. // CHECK:STDOUT: store i32 %int.umod_assign1, ptr %a, align 4, !dbg !34
  420. // CHECK:STDOUT: ret void, !dbg !35
  421. // CHECK:STDOUT: }
  422. // CHECK:STDOUT:
  423. // CHECK:STDOUT: define void @_CTestAnd.Main(ptr %a, i32 %b) !dbg !36 {
  424. // CHECK:STDOUT: entry:
  425. // CHECK:STDOUT: %int.and_assign = load i32, ptr %a, align 4, !dbg !37
  426. // CHECK:STDOUT: %int.and_assign1 = and i32 %int.and_assign, %b, !dbg !37
  427. // CHECK:STDOUT: store i32 %int.and_assign1, ptr %a, align 4, !dbg !37
  428. // CHECK:STDOUT: ret void, !dbg !38
  429. // CHECK:STDOUT: }
  430. // CHECK:STDOUT:
  431. // CHECK:STDOUT: define void @_CTestOr.Main(ptr %a, i32 %b) !dbg !39 {
  432. // CHECK:STDOUT: entry:
  433. // CHECK:STDOUT: %int.or_assign = load i32, ptr %a, align 4, !dbg !40
  434. // CHECK:STDOUT: %int.or_assign1 = or i32 %int.or_assign, %b, !dbg !40
  435. // CHECK:STDOUT: store i32 %int.or_assign1, ptr %a, align 4, !dbg !40
  436. // CHECK:STDOUT: ret void, !dbg !41
  437. // CHECK:STDOUT: }
  438. // CHECK:STDOUT:
  439. // CHECK:STDOUT: define void @_CTestXor.Main(ptr %a, i32 %b) !dbg !42 {
  440. // CHECK:STDOUT: entry:
  441. // CHECK:STDOUT: %int.xor_assign = load i32, ptr %a, align 4, !dbg !43
  442. // CHECK:STDOUT: %int.xor_assign1 = xor i32 %int.xor_assign, %b, !dbg !43
  443. // CHECK:STDOUT: store i32 %int.xor_assign1, ptr %a, align 4, !dbg !43
  444. // CHECK:STDOUT: ret void, !dbg !44
  445. // CHECK:STDOUT: }
  446. // CHECK:STDOUT:
  447. // CHECK:STDOUT: define void @_CTestLeftShift.Main(ptr %a, i32 %b) !dbg !45 {
  448. // CHECK:STDOUT: entry:
  449. // CHECK:STDOUT: %int.left_shift_assign = load i32, ptr %a, align 4, !dbg !46
  450. // CHECK:STDOUT: %int.left_shift_assign1 = shl i32 %int.left_shift_assign, %b, !dbg !46
  451. // CHECK:STDOUT: store i32 %int.left_shift_assign1, ptr %a, align 4, !dbg !46
  452. // CHECK:STDOUT: ret void, !dbg !47
  453. // CHECK:STDOUT: }
  454. // CHECK:STDOUT:
  455. // CHECK:STDOUT: define void @_CTestArithmeticRightShift.Main(ptr %a, i32 %b) !dbg !48 {
  456. // CHECK:STDOUT: entry:
  457. // CHECK:STDOUT: %int.right_shift_assign = load i32, ptr %a, align 4, !dbg !49
  458. // CHECK:STDOUT: %int.right_shift_assign1 = ashr i32 %int.right_shift_assign, %b, !dbg !49
  459. // CHECK:STDOUT: store i32 %int.right_shift_assign1, ptr %a, align 4, !dbg !49
  460. // CHECK:STDOUT: ret void, !dbg !50
  461. // CHECK:STDOUT: }
  462. // CHECK:STDOUT:
  463. // CHECK:STDOUT: define void @_CTestLogicalRightShift.Main(ptr %a, i32 %b) !dbg !51 {
  464. // CHECK:STDOUT: entry:
  465. // CHECK:STDOUT: %int.right_shift_assign = load i32, ptr %a, align 4, !dbg !52
  466. // CHECK:STDOUT: %int.right_shift_assign1 = lshr i32 %int.right_shift_assign, %b, !dbg !52
  467. // CHECK:STDOUT: store i32 %int.right_shift_assign1, ptr %a, align 4, !dbg !52
  468. // CHECK:STDOUT: ret void, !dbg !53
  469. // CHECK:STDOUT: }
  470. // CHECK:STDOUT:
  471. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
  472. // CHECK:STDOUT: !llvm.dbg.cu = !{!2}
  473. // CHECK:STDOUT:
  474. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  475. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  476. // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  477. // CHECK:STDOUT: !3 = !DIFile(filename: "compound_assign.carbon", directory: "")
  478. // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestSAdd", linkageName: "_CTestSAdd.Main", scope: null, file: !3, line: 5, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  479. // CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
  480. // CHECK:STDOUT: !6 = !{}
  481. // CHECK:STDOUT: !7 = !DILocation(line: 5, column: 32, scope: !4)
  482. // CHECK:STDOUT: !8 = !DILocation(line: 5, column: 1, scope: !4)
  483. // CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestSSub", linkageName: "_CTestSSub.Main", scope: null, file: !3, line: 8, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  484. // CHECK:STDOUT: !10 = !DILocation(line: 8, column: 32, scope: !9)
  485. // CHECK:STDOUT: !11 = !DILocation(line: 8, column: 1, scope: !9)
  486. // CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestSMul", linkageName: "_CTestSMul.Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  487. // CHECK:STDOUT: !13 = !DILocation(line: 11, column: 32, scope: !12)
  488. // CHECK:STDOUT: !14 = !DILocation(line: 11, column: 1, scope: !12)
  489. // CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestSDiv", linkageName: "_CTestSDiv.Main", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  490. // CHECK:STDOUT: !16 = !DILocation(line: 14, column: 32, scope: !15)
  491. // CHECK:STDOUT: !17 = !DILocation(line: 14, column: 1, scope: !15)
  492. // CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestSMod", linkageName: "_CTestSMod.Main", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  493. // CHECK:STDOUT: !19 = !DILocation(line: 17, column: 32, scope: !18)
  494. // CHECK:STDOUT: !20 = !DILocation(line: 17, column: 1, scope: !18)
  495. // CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestUAdd", linkageName: "_CTestUAdd.Main", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  496. // CHECK:STDOUT: !22 = !DILocation(line: 20, column: 32, scope: !21)
  497. // CHECK:STDOUT: !23 = !DILocation(line: 20, column: 1, scope: !21)
  498. // CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestUSub", linkageName: "_CTestUSub.Main", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  499. // CHECK:STDOUT: !25 = !DILocation(line: 23, column: 32, scope: !24)
  500. // CHECK:STDOUT: !26 = !DILocation(line: 23, column: 1, scope: !24)
  501. // CHECK:STDOUT: !27 = distinct !DISubprogram(name: "TestUMul", linkageName: "_CTestUMul.Main", scope: null, file: !3, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  502. // CHECK:STDOUT: !28 = !DILocation(line: 26, column: 32, scope: !27)
  503. // CHECK:STDOUT: !29 = !DILocation(line: 26, column: 1, scope: !27)
  504. // CHECK:STDOUT: !30 = distinct !DISubprogram(name: "TestUDiv", linkageName: "_CTestUDiv.Main", scope: null, file: !3, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  505. // CHECK:STDOUT: !31 = !DILocation(line: 29, column: 32, scope: !30)
  506. // CHECK:STDOUT: !32 = !DILocation(line: 29, column: 1, scope: !30)
  507. // CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestUMod", linkageName: "_CTestUMod.Main", scope: null, file: !3, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  508. // CHECK:STDOUT: !34 = !DILocation(line: 32, column: 32, scope: !33)
  509. // CHECK:STDOUT: !35 = !DILocation(line: 32, column: 1, scope: !33)
  510. // CHECK:STDOUT: !36 = distinct !DISubprogram(name: "TestAnd", linkageName: "_CTestAnd.Main", scope: null, file: !3, line: 35, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  511. // CHECK:STDOUT: !37 = !DILocation(line: 35, column: 31, scope: !36)
  512. // CHECK:STDOUT: !38 = !DILocation(line: 35, column: 1, scope: !36)
  513. // CHECK:STDOUT: !39 = distinct !DISubprogram(name: "TestOr", linkageName: "_CTestOr.Main", scope: null, file: !3, line: 38, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  514. // CHECK:STDOUT: !40 = !DILocation(line: 38, column: 30, scope: !39)
  515. // CHECK:STDOUT: !41 = !DILocation(line: 38, column: 1, scope: !39)
  516. // CHECK:STDOUT: !42 = distinct !DISubprogram(name: "TestXor", linkageName: "_CTestXor.Main", scope: null, file: !3, line: 41, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  517. // CHECK:STDOUT: !43 = !DILocation(line: 41, column: 31, scope: !42)
  518. // CHECK:STDOUT: !44 = !DILocation(line: 41, column: 1, scope: !42)
  519. // CHECK:STDOUT: !45 = distinct !DISubprogram(name: "TestLeftShift", linkageName: "_CTestLeftShift.Main", scope: null, file: !3, line: 44, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  520. // CHECK:STDOUT: !46 = !DILocation(line: 44, column: 37, scope: !45)
  521. // CHECK:STDOUT: !47 = !DILocation(line: 44, column: 1, scope: !45)
  522. // CHECK:STDOUT: !48 = distinct !DISubprogram(name: "TestArithmeticRightShift", linkageName: "_CTestArithmeticRightShift.Main", scope: null, file: !3, line: 47, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  523. // CHECK:STDOUT: !49 = !DILocation(line: 47, column: 48, scope: !48)
  524. // CHECK:STDOUT: !50 = !DILocation(line: 47, column: 1, scope: !48)
  525. // CHECK:STDOUT: !51 = distinct !DISubprogram(name: "TestLogicalRightShift", linkageName: "_CTestLogicalRightShift.Main", scope: null, file: !3, line: 50, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  526. // CHECK:STDOUT: !52 = !DILocation(line: 50, column: 45, scope: !51)
  527. // CHECK:STDOUT: !53 = !DILocation(line: 50, column: 1, scope: !51)
  528. // CHECK:STDOUT: ; ModuleID = 'mixed_shift.carbon'
  529. // CHECK:STDOUT: source_filename = "mixed_shift.carbon"
  530. // CHECK:STDOUT:
  531. // CHECK:STDOUT: define i32 @_CTestLeftShiftSmaller.Main(i32 %a, i16 %b) !dbg !4 {
  532. // CHECK:STDOUT: entry:
  533. // CHECK:STDOUT: %int.left_shift.rhs = zext i16 %b to i32, !dbg !7
  534. // CHECK:STDOUT: %int.left_shift = shl i32 %a, %int.left_shift.rhs, !dbg !7
  535. // CHECK:STDOUT: ret i32 %int.left_shift, !dbg !8
  536. // CHECK:STDOUT: }
  537. // CHECK:STDOUT:
  538. // CHECK:STDOUT: define i32 @_CTestRightShiftSmaller.Main(i32 %a, i16 %b) !dbg !9 {
  539. // CHECK:STDOUT: entry:
  540. // CHECK:STDOUT: %int.right_shift.rhs = zext i16 %b to i32, !dbg !10
  541. // CHECK:STDOUT: %int.right_shift = ashr i32 %a, %int.right_shift.rhs, !dbg !10
  542. // CHECK:STDOUT: ret i32 %int.right_shift, !dbg !11
  543. // CHECK:STDOUT: }
  544. // CHECK:STDOUT:
  545. // CHECK:STDOUT: define i16 @_CTestLeftShiftLargerII.Main(i16 %a, i32 %b) !dbg !12 {
  546. // CHECK:STDOUT: entry:
  547. // CHECK:STDOUT: %int.left_shift.rhs = trunc i32 %b to i16, !dbg !13
  548. // CHECK:STDOUT: %int.left_shift = shl i16 %a, %int.left_shift.rhs, !dbg !13
  549. // CHECK:STDOUT: ret i16 %int.left_shift, !dbg !14
  550. // CHECK:STDOUT: }
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: define i16 @_CTestRightShiftLargerII.Main(i16 %a, i32 %b) !dbg !15 {
  553. // CHECK:STDOUT: entry:
  554. // CHECK:STDOUT: %int.right_shift.rhs = trunc i32 %b to i16, !dbg !16
  555. // CHECK:STDOUT: %int.right_shift = ashr i16 %a, %int.right_shift.rhs, !dbg !16
  556. // CHECK:STDOUT: ret i16 %int.right_shift, !dbg !17
  557. // CHECK:STDOUT: }
  558. // CHECK:STDOUT:
  559. // CHECK:STDOUT: define i16 @_CTestLeftShiftLargerIU.Main(i16 %a, i32 %b) !dbg !18 {
  560. // CHECK:STDOUT: entry:
  561. // CHECK:STDOUT: %int.left_shift.rhs = trunc i32 %b to i16, !dbg !19
  562. // CHECK:STDOUT: %int.left_shift = shl i16 %a, %int.left_shift.rhs, !dbg !19
  563. // CHECK:STDOUT: ret i16 %int.left_shift, !dbg !20
  564. // CHECK:STDOUT: }
  565. // CHECK:STDOUT:
  566. // CHECK:STDOUT: define i16 @_CTestRightShiftLargerIU.Main(i16 %a, i32 %b) !dbg !21 {
  567. // CHECK:STDOUT: entry:
  568. // CHECK:STDOUT: %int.right_shift.rhs = trunc i32 %b to i16, !dbg !22
  569. // CHECK:STDOUT: %int.right_shift = ashr i16 %a, %int.right_shift.rhs, !dbg !22
  570. // CHECK:STDOUT: ret i16 %int.right_shift, !dbg !23
  571. // CHECK:STDOUT: }
  572. // CHECK:STDOUT:
  573. // CHECK:STDOUT: define i16 @_CTestLeftShiftLargerUI.Main(i16 %a, i32 %b) !dbg !24 {
  574. // CHECK:STDOUT: entry:
  575. // CHECK:STDOUT: %int.left_shift.rhs = trunc i32 %b to i16, !dbg !25
  576. // CHECK:STDOUT: %int.left_shift = shl i16 %a, %int.left_shift.rhs, !dbg !25
  577. // CHECK:STDOUT: ret i16 %int.left_shift, !dbg !26
  578. // CHECK:STDOUT: }
  579. // CHECK:STDOUT:
  580. // CHECK:STDOUT: define i16 @_CTestRightShiftLargerUI.Main(i16 %a, i32 %b) !dbg !27 {
  581. // CHECK:STDOUT: entry:
  582. // CHECK:STDOUT: %int.right_shift.rhs = trunc i32 %b to i16, !dbg !28
  583. // CHECK:STDOUT: %int.right_shift = lshr i16 %a, %int.right_shift.rhs, !dbg !28
  584. // CHECK:STDOUT: ret i16 %int.right_shift, !dbg !29
  585. // CHECK:STDOUT: }
  586. // CHECK:STDOUT:
  587. // CHECK:STDOUT: define i16 @_CTestLeftShiftLargerUU.Main(i16 %a, i32 %b) !dbg !30 {
  588. // CHECK:STDOUT: entry:
  589. // CHECK:STDOUT: %int.left_shift.rhs = trunc i32 %b to i16, !dbg !31
  590. // CHECK:STDOUT: %int.left_shift = shl i16 %a, %int.left_shift.rhs, !dbg !31
  591. // CHECK:STDOUT: ret i16 %int.left_shift, !dbg !32
  592. // CHECK:STDOUT: }
  593. // CHECK:STDOUT:
  594. // CHECK:STDOUT: define i16 @_CTestRightShiftLargerUU.Main(i16 %a, i32 %b) !dbg !33 {
  595. // CHECK:STDOUT: entry:
  596. // CHECK:STDOUT: %int.right_shift.rhs = trunc i32 %b to i16, !dbg !34
  597. // CHECK:STDOUT: %int.right_shift = lshr i16 %a, %int.right_shift.rhs, !dbg !34
  598. // CHECK:STDOUT: ret i16 %int.right_shift, !dbg !35
  599. // CHECK:STDOUT: }
  600. // CHECK:STDOUT:
  601. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
  602. // CHECK:STDOUT: !llvm.dbg.cu = !{!2}
  603. // CHECK:STDOUT:
  604. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  605. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  606. // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  607. // CHECK:STDOUT: !3 = !DIFile(filename: "mixed_shift.carbon", directory: "")
  608. // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestLeftShiftSmaller", linkageName: "_CTestLeftShiftSmaller.Main", scope: null, file: !3, line: 5, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  609. // CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
  610. // CHECK:STDOUT: !6 = !{}
  611. // CHECK:STDOUT: !7 = !DILocation(line: 5, column: 57, scope: !4)
  612. // CHECK:STDOUT: !8 = !DILocation(line: 5, column: 50, scope: !4)
  613. // CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestRightShiftSmaller", linkageName: "_CTestRightShiftSmaller.Main", scope: null, file: !3, line: 8, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  614. // CHECK:STDOUT: !10 = !DILocation(line: 8, column: 58, scope: !9)
  615. // CHECK:STDOUT: !11 = !DILocation(line: 8, column: 51, scope: !9)
  616. // CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestLeftShiftLargerII", linkageName: "_CTestLeftShiftLargerII.Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  617. // CHECK:STDOUT: !13 = !DILocation(line: 11, column: 58, scope: !12)
  618. // CHECK:STDOUT: !14 = !DILocation(line: 11, column: 51, scope: !12)
  619. // CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestRightShiftLargerII", linkageName: "_CTestRightShiftLargerII.Main", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  620. // CHECK:STDOUT: !16 = !DILocation(line: 14, column: 59, scope: !15)
  621. // CHECK:STDOUT: !17 = !DILocation(line: 14, column: 52, scope: !15)
  622. // CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestLeftShiftLargerIU", linkageName: "_CTestLeftShiftLargerIU.Main", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  623. // CHECK:STDOUT: !19 = !DILocation(line: 17, column: 58, scope: !18)
  624. // CHECK:STDOUT: !20 = !DILocation(line: 17, column: 51, scope: !18)
  625. // CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestRightShiftLargerIU", linkageName: "_CTestRightShiftLargerIU.Main", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  626. // CHECK:STDOUT: !22 = !DILocation(line: 20, column: 59, scope: !21)
  627. // CHECK:STDOUT: !23 = !DILocation(line: 20, column: 52, scope: !21)
  628. // CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestLeftShiftLargerUI", linkageName: "_CTestLeftShiftLargerUI.Main", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  629. // CHECK:STDOUT: !25 = !DILocation(line: 23, column: 58, scope: !24)
  630. // CHECK:STDOUT: !26 = !DILocation(line: 23, column: 51, scope: !24)
  631. // CHECK:STDOUT: !27 = distinct !DISubprogram(name: "TestRightShiftLargerUI", linkageName: "_CTestRightShiftLargerUI.Main", scope: null, file: !3, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  632. // CHECK:STDOUT: !28 = !DILocation(line: 26, column: 59, scope: !27)
  633. // CHECK:STDOUT: !29 = !DILocation(line: 26, column: 52, scope: !27)
  634. // CHECK:STDOUT: !30 = distinct !DISubprogram(name: "TestLeftShiftLargerUU", linkageName: "_CTestLeftShiftLargerUU.Main", scope: null, file: !3, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  635. // CHECK:STDOUT: !31 = !DILocation(line: 29, column: 58, scope: !30)
  636. // CHECK:STDOUT: !32 = !DILocation(line: 29, column: 51, scope: !30)
  637. // CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestRightShiftLargerUU", linkageName: "_CTestRightShiftLargerUU.Main", scope: null, file: !3, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  638. // CHECK:STDOUT: !34 = !DILocation(line: 32, column: 59, scope: !33)
  639. // CHECK:STDOUT: !35 = !DILocation(line: 32, column: 52, scope: !33)
  640. // CHECK:STDOUT: ; ModuleID = 'mixed_compare.carbon'
  641. // CHECK:STDOUT: source_filename = "mixed_compare.carbon"
  642. // CHECK:STDOUT:
  643. // CHECK:STDOUT: define i1 @_CTestEq_u16_u32.Main(i16 %a, i32 %b) !dbg !4 {
  644. // CHECK:STDOUT: entry:
  645. // CHECK:STDOUT: %int.eq.lhs = zext i16 %a to i32, !dbg !7
  646. // CHECK:STDOUT: %int.eq = icmp eq i32 %int.eq.lhs, %b, !dbg !7
  647. // CHECK:STDOUT: ret i1 %int.eq, !dbg !8
  648. // CHECK:STDOUT: }
  649. // CHECK:STDOUT:
  650. // CHECK:STDOUT: define i1 @_CTestEq_i16_u32.Main(i16 %a, i32 %b) !dbg !9 {
  651. // CHECK:STDOUT: entry:
  652. // CHECK:STDOUT: %int.eq.lhs = sext i16 %a to i33, !dbg !10
  653. // CHECK:STDOUT: %int.eq.rhs = zext i32 %b to i33, !dbg !10
  654. // CHECK:STDOUT: %int.eq = icmp eq i33 %int.eq.lhs, %int.eq.rhs, !dbg !10
  655. // CHECK:STDOUT: ret i1 %int.eq, !dbg !11
  656. // CHECK:STDOUT: }
  657. // CHECK:STDOUT:
  658. // CHECK:STDOUT: define i1 @_CTestEq_u16_i32.Main(i16 %a, i32 %b) !dbg !12 {
  659. // CHECK:STDOUT: entry:
  660. // CHECK:STDOUT: %int.eq.lhs = zext i16 %a to i32, !dbg !13
  661. // CHECK:STDOUT: %int.eq = icmp eq i32 %int.eq.lhs, %b, !dbg !13
  662. // CHECK:STDOUT: ret i1 %int.eq, !dbg !14
  663. // CHECK:STDOUT: }
  664. // CHECK:STDOUT:
  665. // CHECK:STDOUT: define i1 @_CTestEq_i16_i32.Main(i16 %a, i32 %b) !dbg !15 {
  666. // CHECK:STDOUT: entry:
  667. // CHECK:STDOUT: %int.eq.lhs = sext i16 %a to i32, !dbg !16
  668. // CHECK:STDOUT: %int.eq = icmp eq i32 %int.eq.lhs, %b, !dbg !16
  669. // CHECK:STDOUT: ret i1 %int.eq, !dbg !17
  670. // CHECK:STDOUT: }
  671. // CHECK:STDOUT:
  672. // CHECK:STDOUT: define i1 @_CTestEq_i32_u32.Main(i32 %a, i32 %b) !dbg !18 {
  673. // CHECK:STDOUT: entry:
  674. // CHECK:STDOUT: %int.eq.lhs = sext i32 %a to i33, !dbg !19
  675. // CHECK:STDOUT: %int.eq.rhs = zext i32 %b to i33, !dbg !19
  676. // CHECK:STDOUT: %int.eq = icmp eq i33 %int.eq.lhs, %int.eq.rhs, !dbg !19
  677. // CHECK:STDOUT: ret i1 %int.eq, !dbg !20
  678. // CHECK:STDOUT: }
  679. // CHECK:STDOUT:
  680. // CHECK:STDOUT: define i1 @_CTestLess_u16_u32.Main(i16 %a, i32 %b) !dbg !21 {
  681. // CHECK:STDOUT: entry:
  682. // CHECK:STDOUT: %int.less.lhs = zext i16 %a to i32, !dbg !22
  683. // CHECK:STDOUT: %int.less = icmp ult i32 %int.less.lhs, %b, !dbg !22
  684. // CHECK:STDOUT: ret i1 %int.less, !dbg !23
  685. // CHECK:STDOUT: }
  686. // CHECK:STDOUT:
  687. // CHECK:STDOUT: define i1 @_CTestLess_i16_u32.Main(i16 %a, i32 %b) !dbg !24 {
  688. // CHECK:STDOUT: entry:
  689. // CHECK:STDOUT: %int.less.lhs = sext i16 %a to i33, !dbg !25
  690. // CHECK:STDOUT: %int.less.rhs = zext i32 %b to i33, !dbg !25
  691. // CHECK:STDOUT: %int.less = icmp slt i33 %int.less.lhs, %int.less.rhs, !dbg !25
  692. // CHECK:STDOUT: ret i1 %int.less, !dbg !26
  693. // CHECK:STDOUT: }
  694. // CHECK:STDOUT:
  695. // CHECK:STDOUT: define i1 @_CTestLess_u16_i32.Main(i16 %a, i32 %b) !dbg !27 {
  696. // CHECK:STDOUT: entry:
  697. // CHECK:STDOUT: %int.less.lhs = zext i16 %a to i32, !dbg !28
  698. // CHECK:STDOUT: %int.less = icmp slt i32 %int.less.lhs, %b, !dbg !28
  699. // CHECK:STDOUT: ret i1 %int.less, !dbg !29
  700. // CHECK:STDOUT: }
  701. // CHECK:STDOUT:
  702. // CHECK:STDOUT: define i1 @_CTestLess_i16_i32.Main(i16 %a, i32 %b) !dbg !30 {
  703. // CHECK:STDOUT: entry:
  704. // CHECK:STDOUT: %int.less.lhs = sext i16 %a to i32, !dbg !31
  705. // CHECK:STDOUT: %int.less = icmp slt i32 %int.less.lhs, %b, !dbg !31
  706. // CHECK:STDOUT: ret i1 %int.less, !dbg !32
  707. // CHECK:STDOUT: }
  708. // CHECK:STDOUT:
  709. // CHECK:STDOUT: define i1 @_CTestLess_i32_u32.Main(i32 %a, i32 %b) !dbg !33 {
  710. // CHECK:STDOUT: entry:
  711. // CHECK:STDOUT: %int.less.lhs = sext i32 %a to i33, !dbg !34
  712. // CHECK:STDOUT: %int.less.rhs = zext i32 %b to i33, !dbg !34
  713. // CHECK:STDOUT: %int.less = icmp slt i33 %int.less.lhs, %int.less.rhs, !dbg !34
  714. // CHECK:STDOUT: ret i1 %int.less, !dbg !35
  715. // CHECK:STDOUT: }
  716. // CHECK:STDOUT:
  717. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
  718. // CHECK:STDOUT: !llvm.dbg.cu = !{!2}
  719. // CHECK:STDOUT:
  720. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  721. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  722. // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  723. // CHECK:STDOUT: !3 = !DIFile(filename: "mixed_compare.carbon", directory: "")
  724. // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestEq_u16_u32", linkageName: "_CTestEq_u16_u32.Main", scope: null, file: !3, line: 10, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  725. // CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
  726. // CHECK:STDOUT: !6 = !{}
  727. // CHECK:STDOUT: !7 = !DILocation(line: 10, column: 52, scope: !4)
  728. // CHECK:STDOUT: !8 = !DILocation(line: 10, column: 45, scope: !4)
  729. // CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestEq_i16_u32", linkageName: "_CTestEq_i16_u32.Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  730. // CHECK:STDOUT: !10 = !DILocation(line: 11, column: 52, scope: !9)
  731. // CHECK:STDOUT: !11 = !DILocation(line: 11, column: 45, scope: !9)
  732. // CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestEq_u16_i32", linkageName: "_CTestEq_u16_i32.Main", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  733. // CHECK:STDOUT: !13 = !DILocation(line: 12, column: 52, scope: !12)
  734. // CHECK:STDOUT: !14 = !DILocation(line: 12, column: 45, scope: !12)
  735. // CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestEq_i16_i32", linkageName: "_CTestEq_i16_i32.Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  736. // CHECK:STDOUT: !16 = !DILocation(line: 13, column: 52, scope: !15)
  737. // CHECK:STDOUT: !17 = !DILocation(line: 13, column: 45, scope: !15)
  738. // CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestEq_i32_u32", linkageName: "_CTestEq_i32_u32.Main", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  739. // CHECK:STDOUT: !19 = !DILocation(line: 14, column: 52, scope: !18)
  740. // CHECK:STDOUT: !20 = !DILocation(line: 14, column: 45, scope: !18)
  741. // CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestLess_u16_u32", linkageName: "_CTestLess_u16_u32.Main", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  742. // CHECK:STDOUT: !22 = !DILocation(line: 22, column: 54, scope: !21)
  743. // CHECK:STDOUT: !23 = !DILocation(line: 22, column: 47, scope: !21)
  744. // CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestLess_i16_u32", linkageName: "_CTestLess_i16_u32.Main", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  745. // CHECK:STDOUT: !25 = !DILocation(line: 23, column: 54, scope: !24)
  746. // CHECK:STDOUT: !26 = !DILocation(line: 23, column: 47, scope: !24)
  747. // CHECK:STDOUT: !27 = distinct !DISubprogram(name: "TestLess_u16_i32", linkageName: "_CTestLess_u16_i32.Main", scope: null, file: !3, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  748. // CHECK:STDOUT: !28 = !DILocation(line: 24, column: 54, scope: !27)
  749. // CHECK:STDOUT: !29 = !DILocation(line: 24, column: 47, scope: !27)
  750. // CHECK:STDOUT: !30 = distinct !DISubprogram(name: "TestLess_i16_i32", linkageName: "_CTestLess_i16_i32.Main", scope: null, file: !3, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  751. // CHECK:STDOUT: !31 = !DILocation(line: 25, column: 54, scope: !30)
  752. // CHECK:STDOUT: !32 = !DILocation(line: 25, column: 47, scope: !30)
  753. // CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestLess_i32_u32", linkageName: "_CTestLess_i32_u32.Main", scope: null, file: !3, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  754. // CHECK:STDOUT: !34 = !DILocation(line: 26, column: 54, scope: !33)
  755. // CHECK:STDOUT: !35 = !DILocation(line: 26, column: 47, scope: !33)
  756. // CHECK:STDOUT: ; ModuleID = 'convert.carbon'
  757. // CHECK:STDOUT: source_filename = "convert.carbon"
  758. // CHECK:STDOUT:
  759. // CHECK:STDOUT: define i32 @_CTestInt32ToInt32.Main(i32 %a) !dbg !4 {
  760. // CHECK:STDOUT: entry:
  761. // CHECK:STDOUT: ret i32 %a, !dbg !7
  762. // CHECK:STDOUT: }
  763. // CHECK:STDOUT:
  764. // CHECK:STDOUT: define i32 @_CTestInt32ToUint32.Main(i32 %a) !dbg !8 {
  765. // CHECK:STDOUT: entry:
  766. // CHECK:STDOUT: ret i32 %a, !dbg !9
  767. // CHECK:STDOUT: }
  768. // CHECK:STDOUT:
  769. // CHECK:STDOUT: define i32 @_CTestUint32ToInt32.Main(i32 %a) !dbg !10 {
  770. // CHECK:STDOUT: entry:
  771. // CHECK:STDOUT: ret i32 %a, !dbg !11
  772. // CHECK:STDOUT: }
  773. // CHECK:STDOUT:
  774. // CHECK:STDOUT: define i32 @_CTestUint32ToUint32.Main(i32 %a) !dbg !12 {
  775. // CHECK:STDOUT: entry:
  776. // CHECK:STDOUT: ret i32 %a, !dbg !13
  777. // CHECK:STDOUT: }
  778. // CHECK:STDOUT:
  779. // CHECK:STDOUT: define i16 @_CTestInt32ToInt16.Main(i32 %a) !dbg !14 {
  780. // CHECK:STDOUT: entry:
  781. // CHECK:STDOUT: %int.convert = trunc i32 %a to i16, !dbg !15
  782. // CHECK:STDOUT: ret i16 %int.convert, !dbg !16
  783. // CHECK:STDOUT: }
  784. // CHECK:STDOUT:
  785. // CHECK:STDOUT: define i16 @_CTestInt32ToUint16.Main(i32 %a) !dbg !17 {
  786. // CHECK:STDOUT: entry:
  787. // CHECK:STDOUT: %int.convert = trunc i32 %a to i16, !dbg !18
  788. // CHECK:STDOUT: ret i16 %int.convert, !dbg !19
  789. // CHECK:STDOUT: }
  790. // CHECK:STDOUT:
  791. // CHECK:STDOUT: define i16 @_CTestUint32ToInt16.Main(i32 %a) !dbg !20 {
  792. // CHECK:STDOUT: entry:
  793. // CHECK:STDOUT: %int.convert = trunc i32 %a to i16, !dbg !21
  794. // CHECK:STDOUT: ret i16 %int.convert, !dbg !22
  795. // CHECK:STDOUT: }
  796. // CHECK:STDOUT:
  797. // CHECK:STDOUT: define i16 @_CTestUint32ToUint16.Main(i32 %a) !dbg !23 {
  798. // CHECK:STDOUT: entry:
  799. // CHECK:STDOUT: %int.convert = trunc i32 %a to i16, !dbg !24
  800. // CHECK:STDOUT: ret i16 %int.convert, !dbg !25
  801. // CHECK:STDOUT: }
  802. // CHECK:STDOUT:
  803. // CHECK:STDOUT: define i64 @_CTestInt32ToInt64.Main(i32 %a) !dbg !26 {
  804. // CHECK:STDOUT: entry:
  805. // CHECK:STDOUT: %int.convert = sext i32 %a to i64, !dbg !27
  806. // CHECK:STDOUT: ret i64 %int.convert, !dbg !28
  807. // CHECK:STDOUT: }
  808. // CHECK:STDOUT:
  809. // CHECK:STDOUT: define i64 @_CTestInt32ToUint64.Main(i32 %a) !dbg !29 {
  810. // CHECK:STDOUT: entry:
  811. // CHECK:STDOUT: %int.convert = sext i32 %a to i64, !dbg !30
  812. // CHECK:STDOUT: ret i64 %int.convert, !dbg !31
  813. // CHECK:STDOUT: }
  814. // CHECK:STDOUT:
  815. // CHECK:STDOUT: define i64 @_CTestUint32ToInt64.Main(i32 %a) !dbg !32 {
  816. // CHECK:STDOUT: entry:
  817. // CHECK:STDOUT: %int.convert = zext i32 %a to i64, !dbg !33
  818. // CHECK:STDOUT: ret i64 %int.convert, !dbg !34
  819. // CHECK:STDOUT: }
  820. // CHECK:STDOUT:
  821. // CHECK:STDOUT: define i64 @_CTestUint32ToUint64.Main(i32 %a) !dbg !35 {
  822. // CHECK:STDOUT: entry:
  823. // CHECK:STDOUT: %int.convert = zext i32 %a to i64, !dbg !36
  824. // CHECK:STDOUT: ret i64 %int.convert, !dbg !37
  825. // CHECK:STDOUT: }
  826. // CHECK:STDOUT:
  827. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
  828. // CHECK:STDOUT: !llvm.dbg.cu = !{!2}
  829. // CHECK:STDOUT:
  830. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  831. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  832. // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  833. // CHECK:STDOUT: !3 = !DIFile(filename: "convert.carbon", directory: "")
  834. // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestInt32ToInt32", linkageName: "_CTestInt32ToInt32.Main", scope: null, file: !3, line: 10, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  835. // CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
  836. // CHECK:STDOUT: !6 = !{}
  837. // CHECK:STDOUT: !7 = !DILocation(line: 10, column: 38, scope: !4)
  838. // CHECK:STDOUT: !8 = distinct !DISubprogram(name: "TestInt32ToUint32", linkageName: "_CTestInt32ToUint32.Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  839. // CHECK:STDOUT: !9 = !DILocation(line: 11, column: 39, scope: !8)
  840. // CHECK:STDOUT: !10 = distinct !DISubprogram(name: "TestUint32ToInt32", linkageName: "_CTestUint32ToInt32.Main", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  841. // CHECK:STDOUT: !11 = !DILocation(line: 12, column: 39, scope: !10)
  842. // CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestUint32ToUint32", linkageName: "_CTestUint32ToUint32.Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  843. // CHECK:STDOUT: !13 = !DILocation(line: 13, column: 40, scope: !12)
  844. // CHECK:STDOUT: !14 = distinct !DISubprogram(name: "TestInt32ToInt16", linkageName: "_CTestInt32ToInt16.Main", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  845. // CHECK:STDOUT: !15 = !DILocation(line: 21, column: 45, scope: !14)
  846. // CHECK:STDOUT: !16 = !DILocation(line: 21, column: 38, scope: !14)
  847. // CHECK:STDOUT: !17 = distinct !DISubprogram(name: "TestInt32ToUint16", linkageName: "_CTestInt32ToUint16.Main", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  848. // CHECK:STDOUT: !18 = !DILocation(line: 22, column: 46, scope: !17)
  849. // CHECK:STDOUT: !19 = !DILocation(line: 22, column: 39, scope: !17)
  850. // CHECK:STDOUT: !20 = distinct !DISubprogram(name: "TestUint32ToInt16", linkageName: "_CTestUint32ToInt16.Main", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  851. // CHECK:STDOUT: !21 = !DILocation(line: 23, column: 46, scope: !20)
  852. // CHECK:STDOUT: !22 = !DILocation(line: 23, column: 39, scope: !20)
  853. // CHECK:STDOUT: !23 = distinct !DISubprogram(name: "TestUint32ToUint16", linkageName: "_CTestUint32ToUint16.Main", scope: null, file: !3, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  854. // CHECK:STDOUT: !24 = !DILocation(line: 24, column: 47, scope: !23)
  855. // CHECK:STDOUT: !25 = !DILocation(line: 24, column: 40, scope: !23)
  856. // CHECK:STDOUT: !26 = distinct !DISubprogram(name: "TestInt32ToInt64", linkageName: "_CTestInt32ToInt64.Main", scope: null, file: !3, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  857. // CHECK:STDOUT: !27 = !DILocation(line: 32, column: 45, scope: !26)
  858. // CHECK:STDOUT: !28 = !DILocation(line: 32, column: 38, scope: !26)
  859. // CHECK:STDOUT: !29 = distinct !DISubprogram(name: "TestInt32ToUint64", linkageName: "_CTestInt32ToUint64.Main", scope: null, file: !3, line: 33, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  860. // CHECK:STDOUT: !30 = !DILocation(line: 33, column: 46, scope: !29)
  861. // CHECK:STDOUT: !31 = !DILocation(line: 33, column: 39, scope: !29)
  862. // CHECK:STDOUT: !32 = distinct !DISubprogram(name: "TestUint32ToInt64", linkageName: "_CTestUint32ToInt64.Main", scope: null, file: !3, line: 34, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  863. // CHECK:STDOUT: !33 = !DILocation(line: 34, column: 46, scope: !32)
  864. // CHECK:STDOUT: !34 = !DILocation(line: 34, column: 39, scope: !32)
  865. // CHECK:STDOUT: !35 = distinct !DISubprogram(name: "TestUint32ToUint64", linkageName: "_CTestUint32ToUint64.Main", scope: null, file: !3, line: 35, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  866. // CHECK:STDOUT: !36 = !DILocation(line: 35, column: 47, scope: !35)
  867. // CHECK:STDOUT: !37 = !DILocation(line: 35, column: 40, scope: !35)