int.carbon 54 KB

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