int.carbon 73 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267
  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(ref a: i32, b: i32) = "int.sadd_assign";
  55. fn TestSAdd(ref a: i32, b: i32) { SAdd(ref a, b); }
  56. fn SSub(ref a: i32, b: i32) = "int.ssub_assign";
  57. fn TestSSub(ref a: i32, b: i32) { SSub(ref a, b); }
  58. fn SMul(ref a: i32, b: i32) = "int.smul_assign";
  59. fn TestSMul(ref a: i32, b: i32) { SMul(ref a, b); }
  60. fn SDiv(ref a: i32, b: i32) = "int.sdiv_assign";
  61. fn TestSDiv(ref a: i32, b: i32) { SDiv(ref a, b); }
  62. fn SMod(ref a: i32, b: i32) = "int.smod_assign";
  63. fn TestSMod(ref a: i32, b: i32) { SMod(ref a, b); }
  64. fn UAdd(ref a: i32, b: i32) = "int.uadd_assign";
  65. fn TestUAdd(ref a: i32, b: i32) { UAdd(ref a, b); }
  66. fn USub(ref a: i32, b: i32) = "int.usub_assign";
  67. fn TestUSub(ref a: i32, b: i32) { USub(ref a, b); }
  68. fn UMul(ref a: i32, b: i32) = "int.umul_assign";
  69. fn TestUMul(ref a: i32, b: i32) { UMul(ref a, b); }
  70. fn UDiv(ref a: i32, b: i32) = "int.udiv_assign";
  71. fn TestUDiv(ref a: i32, b: i32) { UDiv(ref a, b); }
  72. fn UMod(ref a: i32, b: i32) = "int.umod_assign";
  73. fn TestUMod(ref a: i32, b: i32) { UMod(ref a, b); }
  74. fn And(ref a: i32, b: i32) = "int.and_assign";
  75. fn TestAnd(ref a: i32, b: i32) { And(ref a, b); }
  76. fn Or(ref a: i32, b: i32) = "int.or_assign";
  77. fn TestOr(ref a: i32, b: i32) { Or(ref a, b); }
  78. fn Xor(ref a: i32, b: i32) = "int.xor_assign";
  79. fn TestXor(ref a: i32, b: i32) { Xor(ref a, b); }
  80. fn LeftShift(ref a: i32, b: i32) = "int.left_shift_assign";
  81. fn TestLeftShift(ref a: i32, b: i32) { LeftShift(ref a, b); }
  82. fn ArithmeticRightShift(ref a: i32, b: u32) = "int.right_shift_assign";
  83. fn TestArithmeticRightShift(ref a: i32, b: u32) { ArithmeticRightShift(ref a, b); }
  84. fn LogicalRightShift(ref a: u32, b: u32) = "int.right_shift_assign";
  85. fn TestLogicalRightShift(ref a: u32, b: u32) { LogicalRightShift(ref 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: ; Function Attrs: nounwind
  163. // CHECK:STDOUT: define i32 @_CTestNegate.Main(i32 %a) #0 !dbg !4 {
  164. // CHECK:STDOUT: entry:
  165. // CHECK:STDOUT: %Negate.call = sub i32 0, %a, !dbg !10
  166. // CHECK:STDOUT: ret i32 %Negate.call, !dbg !11
  167. // CHECK:STDOUT: }
  168. // CHECK:STDOUT:
  169. // CHECK:STDOUT: ; Function Attrs: nounwind
  170. // CHECK:STDOUT: define i32 @_CTestAdd.Main(i32 %a, i32 %b) #0 !dbg !12 {
  171. // CHECK:STDOUT: entry:
  172. // CHECK:STDOUT: %Add.call = add i32 %a, %b, !dbg !18
  173. // CHECK:STDOUT: ret i32 %Add.call, !dbg !19
  174. // CHECK:STDOUT: }
  175. // CHECK:STDOUT:
  176. // CHECK:STDOUT: ; Function Attrs: nounwind
  177. // CHECK:STDOUT: define i32 @_CTestSub.Main(i32 %a, i32 %b) #0 !dbg !20 {
  178. // CHECK:STDOUT: entry:
  179. // CHECK:STDOUT: %Sub.call = sub i32 %a, %b, !dbg !24
  180. // CHECK:STDOUT: ret i32 %Sub.call, !dbg !25
  181. // CHECK:STDOUT: }
  182. // CHECK:STDOUT:
  183. // CHECK:STDOUT: ; Function Attrs: nounwind
  184. // CHECK:STDOUT: define i32 @_CTestMul.Main(i32 %a, i32 %b) #0 !dbg !26 {
  185. // CHECK:STDOUT: entry:
  186. // CHECK:STDOUT: %Mul.call = mul i32 %a, %b, !dbg !30
  187. // CHECK:STDOUT: ret i32 %Mul.call, !dbg !31
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT:
  190. // CHECK:STDOUT: ; Function Attrs: nounwind
  191. // CHECK:STDOUT: define i32 @_CTestDiv.Main(i32 %a, i32 %b) #0 !dbg !32 {
  192. // CHECK:STDOUT: entry:
  193. // CHECK:STDOUT: %Div.call = sdiv i32 %a, %b, !dbg !36
  194. // CHECK:STDOUT: ret i32 %Div.call, !dbg !37
  195. // CHECK:STDOUT: }
  196. // CHECK:STDOUT:
  197. // CHECK:STDOUT: ; Function Attrs: nounwind
  198. // CHECK:STDOUT: define i32 @_CTestMod.Main(i32 %a, i32 %b) #0 !dbg !38 {
  199. // CHECK:STDOUT: entry:
  200. // CHECK:STDOUT: %Mod.call = srem i32 %a, %b, !dbg !42
  201. // CHECK:STDOUT: ret i32 %Mod.call, !dbg !43
  202. // CHECK:STDOUT: }
  203. // CHECK:STDOUT:
  204. // CHECK:STDOUT: ; Function Attrs: nounwind
  205. // CHECK:STDOUT: define i32 @_CTestComplement.Main(i32 %a) #0 !dbg !44 {
  206. // CHECK:STDOUT: entry:
  207. // CHECK:STDOUT: %Complement.call = xor i32 -1, %a, !dbg !47
  208. // CHECK:STDOUT: ret i32 %Complement.call, !dbg !48
  209. // CHECK:STDOUT: }
  210. // CHECK:STDOUT:
  211. // CHECK:STDOUT: ; Function Attrs: nounwind
  212. // CHECK:STDOUT: define i32 @_CTestAnd.Main(i32 %a, i32 %b) #0 !dbg !49 {
  213. // CHECK:STDOUT: entry:
  214. // CHECK:STDOUT: %And.call = and i32 %a, %b, !dbg !53
  215. // CHECK:STDOUT: ret i32 %And.call, !dbg !54
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: ; Function Attrs: nounwind
  219. // CHECK:STDOUT: define i32 @_CTestOr.Main(i32 %a, i32 %b) #0 !dbg !55 {
  220. // CHECK:STDOUT: entry:
  221. // CHECK:STDOUT: %Or.call = or i32 %a, %b, !dbg !59
  222. // CHECK:STDOUT: ret i32 %Or.call, !dbg !60
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT:
  225. // CHECK:STDOUT: ; Function Attrs: nounwind
  226. // CHECK:STDOUT: define i32 @_CTestXor.Main(i32 %a, i32 %b) #0 !dbg !61 {
  227. // CHECK:STDOUT: entry:
  228. // CHECK:STDOUT: %Xor.call = xor i32 %a, %b, !dbg !65
  229. // CHECK:STDOUT: ret i32 %Xor.call, !dbg !66
  230. // CHECK:STDOUT: }
  231. // CHECK:STDOUT:
  232. // CHECK:STDOUT: ; Function Attrs: nounwind
  233. // CHECK:STDOUT: define i32 @_CTestLeftShift.Main(i32 %a, i32 %b) #0 !dbg !67 {
  234. // CHECK:STDOUT: entry:
  235. // CHECK:STDOUT: %LeftShift.call = shl i32 %a, %b, !dbg !71
  236. // CHECK:STDOUT: ret i32 %LeftShift.call, !dbg !72
  237. // CHECK:STDOUT: }
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: ; Function Attrs: nounwind
  240. // CHECK:STDOUT: define i32 @_CTestArithmeticRightShift.Main(i32 %a, i32 %b) #0 !dbg !73 {
  241. // CHECK:STDOUT: entry:
  242. // CHECK:STDOUT: %ArithmeticRightShift.call = ashr i32 %a, %b, !dbg !77
  243. // CHECK:STDOUT: ret i32 %ArithmeticRightShift.call, !dbg !78
  244. // CHECK:STDOUT: }
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: ; Function Attrs: nounwind
  247. // CHECK:STDOUT: define i32 @_CTestLogicalRightShift.Main(i32 %a, i32 %b) #0 !dbg !79 {
  248. // CHECK:STDOUT: entry:
  249. // CHECK:STDOUT: %LogicalRightShift.call = lshr i32 %a, %b, !dbg !86
  250. // CHECK:STDOUT: ret i32 %LogicalRightShift.call, !dbg !87
  251. // CHECK:STDOUT: }
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: ; Function Attrs: nounwind
  254. // CHECK:STDOUT: define i1 @_CTestEq.Main(i32 %a, i32 %b) #0 !dbg !88 {
  255. // CHECK:STDOUT: entry:
  256. // CHECK:STDOUT: %Eq.call = icmp eq i32 %a, %b, !dbg !95
  257. // CHECK:STDOUT: ret i1 %Eq.call, !dbg !96
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: ; Function Attrs: nounwind
  261. // CHECK:STDOUT: define i1 @_CTestNeq.Main(i32 %a, i32 %b) #0 !dbg !97 {
  262. // CHECK:STDOUT: entry:
  263. // CHECK:STDOUT: %Neq.call = icmp ne i32 %a, %b, !dbg !101
  264. // CHECK:STDOUT: ret i1 %Neq.call, !dbg !102
  265. // CHECK:STDOUT: }
  266. // CHECK:STDOUT:
  267. // CHECK:STDOUT: ; Function Attrs: nounwind
  268. // CHECK:STDOUT: define i1 @_CTestLess.Main(i32 %a, i32 %b) #0 !dbg !103 {
  269. // CHECK:STDOUT: entry:
  270. // CHECK:STDOUT: %Less.call = icmp slt i32 %a, %b, !dbg !107
  271. // CHECK:STDOUT: ret i1 %Less.call, !dbg !108
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: ; Function Attrs: nounwind
  275. // CHECK:STDOUT: define i1 @_CTestLessEq.Main(i32 %a, i32 %b) #0 !dbg !109 {
  276. // CHECK:STDOUT: entry:
  277. // CHECK:STDOUT: %LessEq.call = icmp sle i32 %a, %b, !dbg !113
  278. // CHECK:STDOUT: ret i1 %LessEq.call, !dbg !114
  279. // CHECK:STDOUT: }
  280. // CHECK:STDOUT:
  281. // CHECK:STDOUT: ; Function Attrs: nounwind
  282. // CHECK:STDOUT: define i1 @_CTestGreater.Main(i32 %a, i32 %b) #0 !dbg !115 {
  283. // CHECK:STDOUT: entry:
  284. // CHECK:STDOUT: %Greater.call = icmp sgt i32 %a, %b, !dbg !119
  285. // CHECK:STDOUT: ret i1 %Greater.call, !dbg !120
  286. // CHECK:STDOUT: }
  287. // CHECK:STDOUT:
  288. // CHECK:STDOUT: ; Function Attrs: nounwind
  289. // CHECK:STDOUT: define i1 @_CTestGreaterEq.Main(i32 %a, i32 %b) #0 !dbg !121 {
  290. // CHECK:STDOUT: entry:
  291. // CHECK:STDOUT: %GreaterEq.call = icmp sge i32 %a, %b, !dbg !125
  292. // CHECK:STDOUT: ret i1 %GreaterEq.call, !dbg !126
  293. // CHECK:STDOUT: }
  294. // CHECK:STDOUT:
  295. // CHECK:STDOUT: attributes #0 = { nounwind }
  296. // CHECK:STDOUT:
  297. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
  298. // CHECK:STDOUT: !llvm.dbg.cu = !{!2}
  299. // CHECK:STDOUT:
  300. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  301. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  302. // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  303. // CHECK:STDOUT: !3 = !DIFile(filename: "basic.carbon", directory: "")
  304. // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestNegate", linkageName: "_CTestNegate.Main", scope: null, file: !3, line: 5, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !8)
  305. // CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
  306. // CHECK:STDOUT: !6 = !{!7, !7}
  307. // CHECK:STDOUT: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  308. // CHECK:STDOUT: !8 = !{!9}
  309. // CHECK:STDOUT: !9 = !DILocalVariable(arg: 1, scope: !4, type: !7)
  310. // CHECK:STDOUT: !10 = !DILocation(line: 5, column: 39, scope: !4)
  311. // CHECK:STDOUT: !11 = !DILocation(line: 5, column: 32, scope: !4)
  312. // CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestAdd", linkageName: "_CTestAdd.Main", scope: null, file: !3, line: 8, type: !13, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15)
  313. // CHECK:STDOUT: !13 = !DISubroutineType(types: !14)
  314. // CHECK:STDOUT: !14 = !{!7, !7, !7}
  315. // CHECK:STDOUT: !15 = !{!16, !17}
  316. // CHECK:STDOUT: !16 = !DILocalVariable(arg: 1, scope: !12, type: !7)
  317. // CHECK:STDOUT: !17 = !DILocalVariable(arg: 2, scope: !12, type: !7)
  318. // CHECK:STDOUT: !18 = !DILocation(line: 8, column: 44, scope: !12)
  319. // CHECK:STDOUT: !19 = !DILocation(line: 8, column: 37, scope: !12)
  320. // CHECK:STDOUT: !20 = distinct !DISubprogram(name: "TestSub", linkageName: "_CTestSub.Main", scope: null, file: !3, line: 11, type: !13, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !21)
  321. // CHECK:STDOUT: !21 = !{!22, !23}
  322. // CHECK:STDOUT: !22 = !DILocalVariable(arg: 1, scope: !20, type: !7)
  323. // CHECK:STDOUT: !23 = !DILocalVariable(arg: 2, scope: !20, type: !7)
  324. // CHECK:STDOUT: !24 = !DILocation(line: 11, column: 44, scope: !20)
  325. // CHECK:STDOUT: !25 = !DILocation(line: 11, column: 37, scope: !20)
  326. // CHECK:STDOUT: !26 = distinct !DISubprogram(name: "TestMul", linkageName: "_CTestMul.Main", scope: null, file: !3, line: 14, type: !13, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !27)
  327. // CHECK:STDOUT: !27 = !{!28, !29}
  328. // CHECK:STDOUT: !28 = !DILocalVariable(arg: 1, scope: !26, type: !7)
  329. // CHECK:STDOUT: !29 = !DILocalVariable(arg: 2, scope: !26, type: !7)
  330. // CHECK:STDOUT: !30 = !DILocation(line: 14, column: 44, scope: !26)
  331. // CHECK:STDOUT: !31 = !DILocation(line: 14, column: 37, scope: !26)
  332. // CHECK:STDOUT: !32 = distinct !DISubprogram(name: "TestDiv", linkageName: "_CTestDiv.Main", scope: null, file: !3, line: 17, type: !13, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !33)
  333. // CHECK:STDOUT: !33 = !{!34, !35}
  334. // CHECK:STDOUT: !34 = !DILocalVariable(arg: 1, scope: !32, type: !7)
  335. // CHECK:STDOUT: !35 = !DILocalVariable(arg: 2, scope: !32, type: !7)
  336. // CHECK:STDOUT: !36 = !DILocation(line: 17, column: 44, scope: !32)
  337. // CHECK:STDOUT: !37 = !DILocation(line: 17, column: 37, scope: !32)
  338. // CHECK:STDOUT: !38 = distinct !DISubprogram(name: "TestMod", linkageName: "_CTestMod.Main", scope: null, file: !3, line: 20, type: !13, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !39)
  339. // CHECK:STDOUT: !39 = !{!40, !41}
  340. // CHECK:STDOUT: !40 = !DILocalVariable(arg: 1, scope: !38, type: !7)
  341. // CHECK:STDOUT: !41 = !DILocalVariable(arg: 2, scope: !38, type: !7)
  342. // CHECK:STDOUT: !42 = !DILocation(line: 20, column: 44, scope: !38)
  343. // CHECK:STDOUT: !43 = !DILocation(line: 20, column: 37, scope: !38)
  344. // CHECK:STDOUT: !44 = distinct !DISubprogram(name: "TestComplement", linkageName: "_CTestComplement.Main", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !45)
  345. // CHECK:STDOUT: !45 = !{!46}
  346. // CHECK:STDOUT: !46 = !DILocalVariable(arg: 1, scope: !44, type: !7)
  347. // CHECK:STDOUT: !47 = !DILocation(line: 23, column: 43, scope: !44)
  348. // CHECK:STDOUT: !48 = !DILocation(line: 23, column: 36, scope: !44)
  349. // CHECK:STDOUT: !49 = distinct !DISubprogram(name: "TestAnd", linkageName: "_CTestAnd.Main", scope: null, file: !3, line: 26, type: !13, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !50)
  350. // CHECK:STDOUT: !50 = !{!51, !52}
  351. // CHECK:STDOUT: !51 = !DILocalVariable(arg: 1, scope: !49, type: !7)
  352. // CHECK:STDOUT: !52 = !DILocalVariable(arg: 2, scope: !49, type: !7)
  353. // CHECK:STDOUT: !53 = !DILocation(line: 26, column: 44, scope: !49)
  354. // CHECK:STDOUT: !54 = !DILocation(line: 26, column: 37, scope: !49)
  355. // CHECK:STDOUT: !55 = distinct !DISubprogram(name: "TestOr", linkageName: "_CTestOr.Main", scope: null, file: !3, line: 29, type: !13, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !56)
  356. // CHECK:STDOUT: !56 = !{!57, !58}
  357. // CHECK:STDOUT: !57 = !DILocalVariable(arg: 1, scope: !55, type: !7)
  358. // CHECK:STDOUT: !58 = !DILocalVariable(arg: 2, scope: !55, type: !7)
  359. // CHECK:STDOUT: !59 = !DILocation(line: 29, column: 43, scope: !55)
  360. // CHECK:STDOUT: !60 = !DILocation(line: 29, column: 36, scope: !55)
  361. // CHECK:STDOUT: !61 = distinct !DISubprogram(name: "TestXor", linkageName: "_CTestXor.Main", scope: null, file: !3, line: 32, type: !13, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !62)
  362. // CHECK:STDOUT: !62 = !{!63, !64}
  363. // CHECK:STDOUT: !63 = !DILocalVariable(arg: 1, scope: !61, type: !7)
  364. // CHECK:STDOUT: !64 = !DILocalVariable(arg: 2, scope: !61, type: !7)
  365. // CHECK:STDOUT: !65 = !DILocation(line: 32, column: 44, scope: !61)
  366. // CHECK:STDOUT: !66 = !DILocation(line: 32, column: 37, scope: !61)
  367. // CHECK:STDOUT: !67 = distinct !DISubprogram(name: "TestLeftShift", linkageName: "_CTestLeftShift.Main", scope: null, file: !3, line: 35, type: !13, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !68)
  368. // CHECK:STDOUT: !68 = !{!69, !70}
  369. // CHECK:STDOUT: !69 = !DILocalVariable(arg: 1, scope: !67, type: !7)
  370. // CHECK:STDOUT: !70 = !DILocalVariable(arg: 2, scope: !67, type: !7)
  371. // CHECK:STDOUT: !71 = !DILocation(line: 35, column: 50, scope: !67)
  372. // CHECK:STDOUT: !72 = !DILocation(line: 35, column: 43, scope: !67)
  373. // CHECK:STDOUT: !73 = distinct !DISubprogram(name: "TestArithmeticRightShift", linkageName: "_CTestArithmeticRightShift.Main", scope: null, file: !3, line: 38, type: !13, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !74)
  374. // CHECK:STDOUT: !74 = !{!75, !76}
  375. // CHECK:STDOUT: !75 = !DILocalVariable(arg: 1, scope: !73, type: !7)
  376. // CHECK:STDOUT: !76 = !DILocalVariable(arg: 2, scope: !73, type: !7)
  377. // CHECK:STDOUT: !77 = !DILocation(line: 38, column: 61, scope: !73)
  378. // CHECK:STDOUT: !78 = !DILocation(line: 38, column: 54, scope: !73)
  379. // CHECK:STDOUT: !79 = distinct !DISubprogram(name: "TestLogicalRightShift", linkageName: "_CTestLogicalRightShift.Main", scope: null, file: !3, line: 41, type: !80, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !83)
  380. // CHECK:STDOUT: !80 = !DISubroutineType(types: !81)
  381. // CHECK:STDOUT: !81 = !{!82, !82, !82}
  382. // CHECK:STDOUT: !82 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_unsigned)
  383. // CHECK:STDOUT: !83 = !{!84, !85}
  384. // CHECK:STDOUT: !84 = !DILocalVariable(arg: 1, scope: !79, type: !82)
  385. // CHECK:STDOUT: !85 = !DILocalVariable(arg: 2, scope: !79, type: !82)
  386. // CHECK:STDOUT: !86 = !DILocation(line: 41, column: 58, scope: !79)
  387. // CHECK:STDOUT: !87 = !DILocation(line: 41, column: 51, scope: !79)
  388. // CHECK:STDOUT: !88 = distinct !DISubprogram(name: "TestEq", linkageName: "_CTestEq.Main", scope: null, file: !3, line: 44, type: !89, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !92)
  389. // CHECK:STDOUT: !89 = !DISubroutineType(types: !90)
  390. // CHECK:STDOUT: !90 = !{!91, !7, !7}
  391. // CHECK:STDOUT: !91 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
  392. // CHECK:STDOUT: !92 = !{!93, !94}
  393. // CHECK:STDOUT: !93 = !DILocalVariable(arg: 1, scope: !88, type: !7)
  394. // CHECK:STDOUT: !94 = !DILocalVariable(arg: 2, scope: !88, type: !7)
  395. // CHECK:STDOUT: !95 = !DILocation(line: 44, column: 44, scope: !88)
  396. // CHECK:STDOUT: !96 = !DILocation(line: 44, column: 37, scope: !88)
  397. // CHECK:STDOUT: !97 = distinct !DISubprogram(name: "TestNeq", linkageName: "_CTestNeq.Main", scope: null, file: !3, line: 47, type: !89, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !98)
  398. // CHECK:STDOUT: !98 = !{!99, !100}
  399. // CHECK:STDOUT: !99 = !DILocalVariable(arg: 1, scope: !97, type: !7)
  400. // CHECK:STDOUT: !100 = !DILocalVariable(arg: 2, scope: !97, type: !7)
  401. // CHECK:STDOUT: !101 = !DILocation(line: 47, column: 45, scope: !97)
  402. // CHECK:STDOUT: !102 = !DILocation(line: 47, column: 38, scope: !97)
  403. // CHECK:STDOUT: !103 = distinct !DISubprogram(name: "TestLess", linkageName: "_CTestLess.Main", scope: null, file: !3, line: 50, type: !89, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !104)
  404. // CHECK:STDOUT: !104 = !{!105, !106}
  405. // CHECK:STDOUT: !105 = !DILocalVariable(arg: 1, scope: !103, type: !7)
  406. // CHECK:STDOUT: !106 = !DILocalVariable(arg: 2, scope: !103, type: !7)
  407. // CHECK:STDOUT: !107 = !DILocation(line: 50, column: 46, scope: !103)
  408. // CHECK:STDOUT: !108 = !DILocation(line: 50, column: 39, scope: !103)
  409. // CHECK:STDOUT: !109 = distinct !DISubprogram(name: "TestLessEq", linkageName: "_CTestLessEq.Main", scope: null, file: !3, line: 53, type: !89, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !110)
  410. // CHECK:STDOUT: !110 = !{!111, !112}
  411. // CHECK:STDOUT: !111 = !DILocalVariable(arg: 1, scope: !109, type: !7)
  412. // CHECK:STDOUT: !112 = !DILocalVariable(arg: 2, scope: !109, type: !7)
  413. // CHECK:STDOUT: !113 = !DILocation(line: 53, column: 48, scope: !109)
  414. // CHECK:STDOUT: !114 = !DILocation(line: 53, column: 41, scope: !109)
  415. // CHECK:STDOUT: !115 = distinct !DISubprogram(name: "TestGreater", linkageName: "_CTestGreater.Main", scope: null, file: !3, line: 56, type: !89, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !116)
  416. // CHECK:STDOUT: !116 = !{!117, !118}
  417. // CHECK:STDOUT: !117 = !DILocalVariable(arg: 1, scope: !115, type: !7)
  418. // CHECK:STDOUT: !118 = !DILocalVariable(arg: 2, scope: !115, type: !7)
  419. // CHECK:STDOUT: !119 = !DILocation(line: 56, column: 49, scope: !115)
  420. // CHECK:STDOUT: !120 = !DILocation(line: 56, column: 42, scope: !115)
  421. // CHECK:STDOUT: !121 = distinct !DISubprogram(name: "TestGreaterEq", linkageName: "_CTestGreaterEq.Main", scope: null, file: !3, line: 59, type: !89, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !122)
  422. // CHECK:STDOUT: !122 = !{!123, !124}
  423. // CHECK:STDOUT: !123 = !DILocalVariable(arg: 1, scope: !121, type: !7)
  424. // CHECK:STDOUT: !124 = !DILocalVariable(arg: 2, scope: !121, type: !7)
  425. // CHECK:STDOUT: !125 = !DILocation(line: 59, column: 51, scope: !121)
  426. // CHECK:STDOUT: !126 = !DILocation(line: 59, column: 44, scope: !121)
  427. // CHECK:STDOUT: ; ModuleID = 'compound_assign.carbon'
  428. // CHECK:STDOUT: source_filename = "compound_assign.carbon"
  429. // CHECK:STDOUT:
  430. // CHECK:STDOUT: ; Function Attrs: nounwind
  431. // CHECK:STDOUT: define void @_CTestSAdd.Main(ptr %a, i32 %b) #0 !dbg !4 {
  432. // CHECK:STDOUT: entry:
  433. // CHECK:STDOUT: %SAdd.call = load i32, ptr %a, align 4, !dbg !11
  434. // CHECK:STDOUT: %SAdd.call1 = add i32 %SAdd.call, %b, !dbg !11
  435. // CHECK:STDOUT: store i32 %SAdd.call1, ptr %a, align 4, !dbg !11
  436. // CHECK:STDOUT: ret void, !dbg !12
  437. // CHECK:STDOUT: }
  438. // CHECK:STDOUT:
  439. // CHECK:STDOUT: ; Function Attrs: nounwind
  440. // CHECK:STDOUT: define void @_CTestSSub.Main(ptr %a, i32 %b) #0 !dbg !13 {
  441. // CHECK:STDOUT: entry:
  442. // CHECK:STDOUT: %SSub.call = load i32, ptr %a, align 4, !dbg !17
  443. // CHECK:STDOUT: %SSub.call1 = sub i32 %SSub.call, %b, !dbg !17
  444. // CHECK:STDOUT: store i32 %SSub.call1, ptr %a, align 4, !dbg !17
  445. // CHECK:STDOUT: ret void, !dbg !18
  446. // CHECK:STDOUT: }
  447. // CHECK:STDOUT:
  448. // CHECK:STDOUT: ; Function Attrs: nounwind
  449. // CHECK:STDOUT: define void @_CTestSMul.Main(ptr %a, i32 %b) #0 !dbg !19 {
  450. // CHECK:STDOUT: entry:
  451. // CHECK:STDOUT: %SMul.call = load i32, ptr %a, align 4, !dbg !23
  452. // CHECK:STDOUT: %SMul.call1 = mul i32 %SMul.call, %b, !dbg !23
  453. // CHECK:STDOUT: store i32 %SMul.call1, ptr %a, align 4, !dbg !23
  454. // CHECK:STDOUT: ret void, !dbg !24
  455. // CHECK:STDOUT: }
  456. // CHECK:STDOUT:
  457. // CHECK:STDOUT: ; Function Attrs: nounwind
  458. // CHECK:STDOUT: define void @_CTestSDiv.Main(ptr %a, i32 %b) #0 !dbg !25 {
  459. // CHECK:STDOUT: entry:
  460. // CHECK:STDOUT: %SDiv.call = load i32, ptr %a, align 4, !dbg !29
  461. // CHECK:STDOUT: %SDiv.call1 = sdiv i32 %SDiv.call, %b, !dbg !29
  462. // CHECK:STDOUT: store i32 %SDiv.call1, ptr %a, align 4, !dbg !29
  463. // CHECK:STDOUT: ret void, !dbg !30
  464. // CHECK:STDOUT: }
  465. // CHECK:STDOUT:
  466. // CHECK:STDOUT: ; Function Attrs: nounwind
  467. // CHECK:STDOUT: define void @_CTestSMod.Main(ptr %a, i32 %b) #0 !dbg !31 {
  468. // CHECK:STDOUT: entry:
  469. // CHECK:STDOUT: %SMod.call = load i32, ptr %a, align 4, !dbg !35
  470. // CHECK:STDOUT: %SMod.call1 = srem i32 %SMod.call, %b, !dbg !35
  471. // CHECK:STDOUT: store i32 %SMod.call1, ptr %a, align 4, !dbg !35
  472. // CHECK:STDOUT: ret void, !dbg !36
  473. // CHECK:STDOUT: }
  474. // CHECK:STDOUT:
  475. // CHECK:STDOUT: ; Function Attrs: nounwind
  476. // CHECK:STDOUT: define void @_CTestUAdd.Main(ptr %a, i32 %b) #0 !dbg !37 {
  477. // CHECK:STDOUT: entry:
  478. // CHECK:STDOUT: %UAdd.call = load i32, ptr %a, align 4, !dbg !41
  479. // CHECK:STDOUT: %UAdd.call1 = add i32 %UAdd.call, %b, !dbg !41
  480. // CHECK:STDOUT: store i32 %UAdd.call1, ptr %a, align 4, !dbg !41
  481. // CHECK:STDOUT: ret void, !dbg !42
  482. // CHECK:STDOUT: }
  483. // CHECK:STDOUT:
  484. // CHECK:STDOUT: ; Function Attrs: nounwind
  485. // CHECK:STDOUT: define void @_CTestUSub.Main(ptr %a, i32 %b) #0 !dbg !43 {
  486. // CHECK:STDOUT: entry:
  487. // CHECK:STDOUT: %USub.call = load i32, ptr %a, align 4, !dbg !47
  488. // CHECK:STDOUT: %USub.call1 = sub i32 %USub.call, %b, !dbg !47
  489. // CHECK:STDOUT: store i32 %USub.call1, ptr %a, align 4, !dbg !47
  490. // CHECK:STDOUT: ret void, !dbg !48
  491. // CHECK:STDOUT: }
  492. // CHECK:STDOUT:
  493. // CHECK:STDOUT: ; Function Attrs: nounwind
  494. // CHECK:STDOUT: define void @_CTestUMul.Main(ptr %a, i32 %b) #0 !dbg !49 {
  495. // CHECK:STDOUT: entry:
  496. // CHECK:STDOUT: %UMul.call = load i32, ptr %a, align 4, !dbg !53
  497. // CHECK:STDOUT: %UMul.call1 = mul i32 %UMul.call, %b, !dbg !53
  498. // CHECK:STDOUT: store i32 %UMul.call1, ptr %a, align 4, !dbg !53
  499. // CHECK:STDOUT: ret void, !dbg !54
  500. // CHECK:STDOUT: }
  501. // CHECK:STDOUT:
  502. // CHECK:STDOUT: ; Function Attrs: nounwind
  503. // CHECK:STDOUT: define void @_CTestUDiv.Main(ptr %a, i32 %b) #0 !dbg !55 {
  504. // CHECK:STDOUT: entry:
  505. // CHECK:STDOUT: %UDiv.call = load i32, ptr %a, align 4, !dbg !59
  506. // CHECK:STDOUT: %UDiv.call1 = udiv i32 %UDiv.call, %b, !dbg !59
  507. // CHECK:STDOUT: store i32 %UDiv.call1, ptr %a, align 4, !dbg !59
  508. // CHECK:STDOUT: ret void, !dbg !60
  509. // CHECK:STDOUT: }
  510. // CHECK:STDOUT:
  511. // CHECK:STDOUT: ; Function Attrs: nounwind
  512. // CHECK:STDOUT: define void @_CTestUMod.Main(ptr %a, i32 %b) #0 !dbg !61 {
  513. // CHECK:STDOUT: entry:
  514. // CHECK:STDOUT: %UMod.call = load i32, ptr %a, align 4, !dbg !65
  515. // CHECK:STDOUT: %UMod.call1 = urem i32 %UMod.call, %b, !dbg !65
  516. // CHECK:STDOUT: store i32 %UMod.call1, ptr %a, align 4, !dbg !65
  517. // CHECK:STDOUT: ret void, !dbg !66
  518. // CHECK:STDOUT: }
  519. // CHECK:STDOUT:
  520. // CHECK:STDOUT: ; Function Attrs: nounwind
  521. // CHECK:STDOUT: define void @_CTestAnd.Main(ptr %a, i32 %b) #0 !dbg !67 {
  522. // CHECK:STDOUT: entry:
  523. // CHECK:STDOUT: %And.call = load i32, ptr %a, align 4, !dbg !71
  524. // CHECK:STDOUT: %And.call1 = and i32 %And.call, %b, !dbg !71
  525. // CHECK:STDOUT: store i32 %And.call1, ptr %a, align 4, !dbg !71
  526. // CHECK:STDOUT: ret void, !dbg !72
  527. // CHECK:STDOUT: }
  528. // CHECK:STDOUT:
  529. // CHECK:STDOUT: ; Function Attrs: nounwind
  530. // CHECK:STDOUT: define void @_CTestOr.Main(ptr %a, i32 %b) #0 !dbg !73 {
  531. // CHECK:STDOUT: entry:
  532. // CHECK:STDOUT: %Or.call = load i32, ptr %a, align 4, !dbg !77
  533. // CHECK:STDOUT: %Or.call1 = or i32 %Or.call, %b, !dbg !77
  534. // CHECK:STDOUT: store i32 %Or.call1, ptr %a, align 4, !dbg !77
  535. // CHECK:STDOUT: ret void, !dbg !78
  536. // CHECK:STDOUT: }
  537. // CHECK:STDOUT:
  538. // CHECK:STDOUT: ; Function Attrs: nounwind
  539. // CHECK:STDOUT: define void @_CTestXor.Main(ptr %a, i32 %b) #0 !dbg !79 {
  540. // CHECK:STDOUT: entry:
  541. // CHECK:STDOUT: %Xor.call = load i32, ptr %a, align 4, !dbg !83
  542. // CHECK:STDOUT: %Xor.call1 = xor i32 %Xor.call, %b, !dbg !83
  543. // CHECK:STDOUT: store i32 %Xor.call1, ptr %a, align 4, !dbg !83
  544. // CHECK:STDOUT: ret void, !dbg !84
  545. // CHECK:STDOUT: }
  546. // CHECK:STDOUT:
  547. // CHECK:STDOUT: ; Function Attrs: nounwind
  548. // CHECK:STDOUT: define void @_CTestLeftShift.Main(ptr %a, i32 %b) #0 !dbg !85 {
  549. // CHECK:STDOUT: entry:
  550. // CHECK:STDOUT: %LeftShift.call = load i32, ptr %a, align 4, !dbg !89
  551. // CHECK:STDOUT: %LeftShift.call1 = shl i32 %LeftShift.call, %b, !dbg !89
  552. // CHECK:STDOUT: store i32 %LeftShift.call1, ptr %a, align 4, !dbg !89
  553. // CHECK:STDOUT: ret void, !dbg !90
  554. // CHECK:STDOUT: }
  555. // CHECK:STDOUT:
  556. // CHECK:STDOUT: ; Function Attrs: nounwind
  557. // CHECK:STDOUT: define void @_CTestArithmeticRightShift.Main(ptr %a, i32 %b) #0 !dbg !91 {
  558. // CHECK:STDOUT: entry:
  559. // CHECK:STDOUT: %ArithmeticRightShift.call = load i32, ptr %a, align 4, !dbg !98
  560. // CHECK:STDOUT: %ArithmeticRightShift.call1 = ashr i32 %ArithmeticRightShift.call, %b, !dbg !98
  561. // CHECK:STDOUT: store i32 %ArithmeticRightShift.call1, ptr %a, align 4, !dbg !98
  562. // CHECK:STDOUT: ret void, !dbg !99
  563. // CHECK:STDOUT: }
  564. // CHECK:STDOUT:
  565. // CHECK:STDOUT: ; Function Attrs: nounwind
  566. // CHECK:STDOUT: define void @_CTestLogicalRightShift.Main(ptr %a, i32 %b) #0 !dbg !100 {
  567. // CHECK:STDOUT: entry:
  568. // CHECK:STDOUT: %LogicalRightShift.call = load i32, ptr %a, align 4, !dbg !106
  569. // CHECK:STDOUT: %LogicalRightShift.call1 = lshr i32 %LogicalRightShift.call, %b, !dbg !106
  570. // CHECK:STDOUT: store i32 %LogicalRightShift.call1, ptr %a, align 4, !dbg !106
  571. // CHECK:STDOUT: ret void, !dbg !107
  572. // CHECK:STDOUT: }
  573. // CHECK:STDOUT:
  574. // CHECK:STDOUT: attributes #0 = { nounwind }
  575. // CHECK:STDOUT:
  576. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
  577. // CHECK:STDOUT: !llvm.dbg.cu = !{!2}
  578. // CHECK:STDOUT:
  579. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  580. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  581. // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  582. // CHECK:STDOUT: !3 = !DIFile(filename: "compound_assign.carbon", directory: "")
  583. // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestSAdd", linkageName: "_CTestSAdd.Main", scope: null, file: !3, line: 5, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !8)
  584. // CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
  585. // CHECK:STDOUT: !6 = !{null, !7, !7}
  586. // CHECK:STDOUT: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  587. // CHECK:STDOUT: !8 = !{!9, !10}
  588. // CHECK:STDOUT: !9 = !DILocalVariable(arg: 1, scope: !4, type: !7)
  589. // CHECK:STDOUT: !10 = !DILocalVariable(arg: 2, scope: !4, type: !7)
  590. // CHECK:STDOUT: !11 = !DILocation(line: 5, column: 35, scope: !4)
  591. // CHECK:STDOUT: !12 = !DILocation(line: 5, column: 1, scope: !4)
  592. // CHECK:STDOUT: !13 = distinct !DISubprogram(name: "TestSSub", linkageName: "_CTestSSub.Main", scope: null, file: !3, line: 8, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !14)
  593. // CHECK:STDOUT: !14 = !{!15, !16}
  594. // CHECK:STDOUT: !15 = !DILocalVariable(arg: 1, scope: !13, type: !7)
  595. // CHECK:STDOUT: !16 = !DILocalVariable(arg: 2, scope: !13, type: !7)
  596. // CHECK:STDOUT: !17 = !DILocation(line: 8, column: 35, scope: !13)
  597. // CHECK:STDOUT: !18 = !DILocation(line: 8, column: 1, scope: !13)
  598. // CHECK:STDOUT: !19 = distinct !DISubprogram(name: "TestSMul", linkageName: "_CTestSMul.Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !20)
  599. // CHECK:STDOUT: !20 = !{!21, !22}
  600. // CHECK:STDOUT: !21 = !DILocalVariable(arg: 1, scope: !19, type: !7)
  601. // CHECK:STDOUT: !22 = !DILocalVariable(arg: 2, scope: !19, type: !7)
  602. // CHECK:STDOUT: !23 = !DILocation(line: 11, column: 35, scope: !19)
  603. // CHECK:STDOUT: !24 = !DILocation(line: 11, column: 1, scope: !19)
  604. // CHECK:STDOUT: !25 = distinct !DISubprogram(name: "TestSDiv", linkageName: "_CTestSDiv.Main", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !26)
  605. // CHECK:STDOUT: !26 = !{!27, !28}
  606. // CHECK:STDOUT: !27 = !DILocalVariable(arg: 1, scope: !25, type: !7)
  607. // CHECK:STDOUT: !28 = !DILocalVariable(arg: 2, scope: !25, type: !7)
  608. // CHECK:STDOUT: !29 = !DILocation(line: 14, column: 35, scope: !25)
  609. // CHECK:STDOUT: !30 = !DILocation(line: 14, column: 1, scope: !25)
  610. // CHECK:STDOUT: !31 = distinct !DISubprogram(name: "TestSMod", linkageName: "_CTestSMod.Main", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !32)
  611. // CHECK:STDOUT: !32 = !{!33, !34}
  612. // CHECK:STDOUT: !33 = !DILocalVariable(arg: 1, scope: !31, type: !7)
  613. // CHECK:STDOUT: !34 = !DILocalVariable(arg: 2, scope: !31, type: !7)
  614. // CHECK:STDOUT: !35 = !DILocation(line: 17, column: 35, scope: !31)
  615. // CHECK:STDOUT: !36 = !DILocation(line: 17, column: 1, scope: !31)
  616. // CHECK:STDOUT: !37 = distinct !DISubprogram(name: "TestUAdd", linkageName: "_CTestUAdd.Main", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !38)
  617. // CHECK:STDOUT: !38 = !{!39, !40}
  618. // CHECK:STDOUT: !39 = !DILocalVariable(arg: 1, scope: !37, type: !7)
  619. // CHECK:STDOUT: !40 = !DILocalVariable(arg: 2, scope: !37, type: !7)
  620. // CHECK:STDOUT: !41 = !DILocation(line: 20, column: 35, scope: !37)
  621. // CHECK:STDOUT: !42 = !DILocation(line: 20, column: 1, scope: !37)
  622. // CHECK:STDOUT: !43 = distinct !DISubprogram(name: "TestUSub", linkageName: "_CTestUSub.Main", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !44)
  623. // CHECK:STDOUT: !44 = !{!45, !46}
  624. // CHECK:STDOUT: !45 = !DILocalVariable(arg: 1, scope: !43, type: !7)
  625. // CHECK:STDOUT: !46 = !DILocalVariable(arg: 2, scope: !43, type: !7)
  626. // CHECK:STDOUT: !47 = !DILocation(line: 23, column: 35, scope: !43)
  627. // CHECK:STDOUT: !48 = !DILocation(line: 23, column: 1, scope: !43)
  628. // CHECK:STDOUT: !49 = distinct !DISubprogram(name: "TestUMul", linkageName: "_CTestUMul.Main", scope: null, file: !3, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !50)
  629. // CHECK:STDOUT: !50 = !{!51, !52}
  630. // CHECK:STDOUT: !51 = !DILocalVariable(arg: 1, scope: !49, type: !7)
  631. // CHECK:STDOUT: !52 = !DILocalVariable(arg: 2, scope: !49, type: !7)
  632. // CHECK:STDOUT: !53 = !DILocation(line: 26, column: 35, scope: !49)
  633. // CHECK:STDOUT: !54 = !DILocation(line: 26, column: 1, scope: !49)
  634. // CHECK:STDOUT: !55 = distinct !DISubprogram(name: "TestUDiv", linkageName: "_CTestUDiv.Main", scope: null, file: !3, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !56)
  635. // CHECK:STDOUT: !56 = !{!57, !58}
  636. // CHECK:STDOUT: !57 = !DILocalVariable(arg: 1, scope: !55, type: !7)
  637. // CHECK:STDOUT: !58 = !DILocalVariable(arg: 2, scope: !55, type: !7)
  638. // CHECK:STDOUT: !59 = !DILocation(line: 29, column: 35, scope: !55)
  639. // CHECK:STDOUT: !60 = !DILocation(line: 29, column: 1, scope: !55)
  640. // CHECK:STDOUT: !61 = distinct !DISubprogram(name: "TestUMod", linkageName: "_CTestUMod.Main", scope: null, file: !3, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !62)
  641. // CHECK:STDOUT: !62 = !{!63, !64}
  642. // CHECK:STDOUT: !63 = !DILocalVariable(arg: 1, scope: !61, type: !7)
  643. // CHECK:STDOUT: !64 = !DILocalVariable(arg: 2, scope: !61, type: !7)
  644. // CHECK:STDOUT: !65 = !DILocation(line: 32, column: 35, scope: !61)
  645. // CHECK:STDOUT: !66 = !DILocation(line: 32, column: 1, scope: !61)
  646. // CHECK:STDOUT: !67 = distinct !DISubprogram(name: "TestAnd", linkageName: "_CTestAnd.Main", scope: null, file: !3, line: 35, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !68)
  647. // CHECK:STDOUT: !68 = !{!69, !70}
  648. // CHECK:STDOUT: !69 = !DILocalVariable(arg: 1, scope: !67, type: !7)
  649. // CHECK:STDOUT: !70 = !DILocalVariable(arg: 2, scope: !67, type: !7)
  650. // CHECK:STDOUT: !71 = !DILocation(line: 35, column: 34, scope: !67)
  651. // CHECK:STDOUT: !72 = !DILocation(line: 35, column: 1, scope: !67)
  652. // CHECK:STDOUT: !73 = distinct !DISubprogram(name: "TestOr", linkageName: "_CTestOr.Main", scope: null, file: !3, line: 38, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !74)
  653. // CHECK:STDOUT: !74 = !{!75, !76}
  654. // CHECK:STDOUT: !75 = !DILocalVariable(arg: 1, scope: !73, type: !7)
  655. // CHECK:STDOUT: !76 = !DILocalVariable(arg: 2, scope: !73, type: !7)
  656. // CHECK:STDOUT: !77 = !DILocation(line: 38, column: 33, scope: !73)
  657. // CHECK:STDOUT: !78 = !DILocation(line: 38, column: 1, scope: !73)
  658. // CHECK:STDOUT: !79 = distinct !DISubprogram(name: "TestXor", linkageName: "_CTestXor.Main", scope: null, file: !3, line: 41, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !80)
  659. // CHECK:STDOUT: !80 = !{!81, !82}
  660. // CHECK:STDOUT: !81 = !DILocalVariable(arg: 1, scope: !79, type: !7)
  661. // CHECK:STDOUT: !82 = !DILocalVariable(arg: 2, scope: !79, type: !7)
  662. // CHECK:STDOUT: !83 = !DILocation(line: 41, column: 34, scope: !79)
  663. // CHECK:STDOUT: !84 = !DILocation(line: 41, column: 1, scope: !79)
  664. // CHECK:STDOUT: !85 = distinct !DISubprogram(name: "TestLeftShift", linkageName: "_CTestLeftShift.Main", scope: null, file: !3, line: 44, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !86)
  665. // CHECK:STDOUT: !86 = !{!87, !88}
  666. // CHECK:STDOUT: !87 = !DILocalVariable(arg: 1, scope: !85, type: !7)
  667. // CHECK:STDOUT: !88 = !DILocalVariable(arg: 2, scope: !85, type: !7)
  668. // CHECK:STDOUT: !89 = !DILocation(line: 44, column: 40, scope: !85)
  669. // CHECK:STDOUT: !90 = !DILocation(line: 44, column: 1, scope: !85)
  670. // CHECK:STDOUT: !91 = distinct !DISubprogram(name: "TestArithmeticRightShift", linkageName: "_CTestArithmeticRightShift.Main", scope: null, file: !3, line: 47, type: !92, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !95)
  671. // CHECK:STDOUT: !92 = !DISubroutineType(types: !93)
  672. // CHECK:STDOUT: !93 = !{null, !7, !94}
  673. // CHECK:STDOUT: !94 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_unsigned)
  674. // CHECK:STDOUT: !95 = !{!96, !97}
  675. // CHECK:STDOUT: !96 = !DILocalVariable(arg: 1, scope: !91, type: !7)
  676. // CHECK:STDOUT: !97 = !DILocalVariable(arg: 2, scope: !91, type: !94)
  677. // CHECK:STDOUT: !98 = !DILocation(line: 47, column: 51, scope: !91)
  678. // CHECK:STDOUT: !99 = !DILocation(line: 47, column: 1, scope: !91)
  679. // CHECK:STDOUT: !100 = distinct !DISubprogram(name: "TestLogicalRightShift", linkageName: "_CTestLogicalRightShift.Main", scope: null, file: !3, line: 50, type: !101, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !103)
  680. // CHECK:STDOUT: !101 = !DISubroutineType(types: !102)
  681. // CHECK:STDOUT: !102 = !{null, !94, !94}
  682. // CHECK:STDOUT: !103 = !{!104, !105}
  683. // CHECK:STDOUT: !104 = !DILocalVariable(arg: 1, scope: !100, type: !94)
  684. // CHECK:STDOUT: !105 = !DILocalVariable(arg: 2, scope: !100, type: !94)
  685. // CHECK:STDOUT: !106 = !DILocation(line: 50, column: 48, scope: !100)
  686. // CHECK:STDOUT: !107 = !DILocation(line: 50, column: 1, scope: !100)
  687. // CHECK:STDOUT: ; ModuleID = 'mixed_shift.carbon'
  688. // CHECK:STDOUT: source_filename = "mixed_shift.carbon"
  689. // CHECK:STDOUT:
  690. // CHECK:STDOUT: ; Function Attrs: nounwind
  691. // CHECK:STDOUT: define i32 @_CTestLeftShiftSmaller.Main(i32 %a, i16 %b) #0 !dbg !4 {
  692. // CHECK:STDOUT: entry:
  693. // CHECK:STDOUT: %LeftShiftSmaller.call.rhs = zext i16 %b to i32, !dbg !12
  694. // CHECK:STDOUT: %LeftShiftSmaller.call = shl i32 %a, %LeftShiftSmaller.call.rhs, !dbg !12
  695. // CHECK:STDOUT: ret i32 %LeftShiftSmaller.call, !dbg !13
  696. // CHECK:STDOUT: }
  697. // CHECK:STDOUT:
  698. // CHECK:STDOUT: ; Function Attrs: nounwind
  699. // CHECK:STDOUT: define i32 @_CTestRightShiftSmaller.Main(i32 %a, i16 %b) #0 !dbg !14 {
  700. // CHECK:STDOUT: entry:
  701. // CHECK:STDOUT: %RightShiftSmaller.call.rhs = zext i16 %b to i32, !dbg !18
  702. // CHECK:STDOUT: %RightShiftSmaller.call = ashr i32 %a, %RightShiftSmaller.call.rhs, !dbg !18
  703. // CHECK:STDOUT: ret i32 %RightShiftSmaller.call, !dbg !19
  704. // CHECK:STDOUT: }
  705. // CHECK:STDOUT:
  706. // CHECK:STDOUT: ; Function Attrs: nounwind
  707. // CHECK:STDOUT: define i16 @_CTestLeftShiftLargerII.Main(i16 %a, i32 %b) #0 !dbg !20 {
  708. // CHECK:STDOUT: entry:
  709. // CHECK:STDOUT: %LeftShiftLargerII.call.rhs = trunc i32 %b to i16, !dbg !26
  710. // CHECK:STDOUT: %LeftShiftLargerII.call = shl i16 %a, %LeftShiftLargerII.call.rhs, !dbg !26
  711. // CHECK:STDOUT: ret i16 %LeftShiftLargerII.call, !dbg !27
  712. // CHECK:STDOUT: }
  713. // CHECK:STDOUT:
  714. // CHECK:STDOUT: ; Function Attrs: nounwind
  715. // CHECK:STDOUT: define i16 @_CTestRightShiftLargerII.Main(i16 %a, i32 %b) #0 !dbg !28 {
  716. // CHECK:STDOUT: entry:
  717. // CHECK:STDOUT: %RightShiftLargerII.call.rhs = trunc i32 %b to i16, !dbg !32
  718. // CHECK:STDOUT: %RightShiftLargerII.call = ashr i16 %a, %RightShiftLargerII.call.rhs, !dbg !32
  719. // CHECK:STDOUT: ret i16 %RightShiftLargerII.call, !dbg !33
  720. // CHECK:STDOUT: }
  721. // CHECK:STDOUT:
  722. // CHECK:STDOUT: ; Function Attrs: nounwind
  723. // CHECK:STDOUT: define i16 @_CTestLeftShiftLargerIU.Main(i16 %a, i32 %b) #0 !dbg !34 {
  724. // CHECK:STDOUT: entry:
  725. // CHECK:STDOUT: %LeftShiftLargerIU.call.rhs = trunc i32 %b to i16, !dbg !41
  726. // CHECK:STDOUT: %LeftShiftLargerIU.call = shl i16 %a, %LeftShiftLargerIU.call.rhs, !dbg !41
  727. // CHECK:STDOUT: ret i16 %LeftShiftLargerIU.call, !dbg !42
  728. // CHECK:STDOUT: }
  729. // CHECK:STDOUT:
  730. // CHECK:STDOUT: ; Function Attrs: nounwind
  731. // CHECK:STDOUT: define i16 @_CTestRightShiftLargerIU.Main(i16 %a, i32 %b) #0 !dbg !43 {
  732. // CHECK:STDOUT: entry:
  733. // CHECK:STDOUT: %RightShiftLargerIU.call.rhs = trunc i32 %b to i16, !dbg !47
  734. // CHECK:STDOUT: %RightShiftLargerIU.call = ashr i16 %a, %RightShiftLargerIU.call.rhs, !dbg !47
  735. // CHECK:STDOUT: ret i16 %RightShiftLargerIU.call, !dbg !48
  736. // CHECK:STDOUT: }
  737. // CHECK:STDOUT:
  738. // CHECK:STDOUT: ; Function Attrs: nounwind
  739. // CHECK:STDOUT: define i16 @_CTestLeftShiftLargerUI.Main(i16 %a, i32 %b) #0 !dbg !49 {
  740. // CHECK:STDOUT: entry:
  741. // CHECK:STDOUT: %LeftShiftLargerUI.call.rhs = trunc i32 %b to i16, !dbg !56
  742. // CHECK:STDOUT: %LeftShiftLargerUI.call = shl i16 %a, %LeftShiftLargerUI.call.rhs, !dbg !56
  743. // CHECK:STDOUT: ret i16 %LeftShiftLargerUI.call, !dbg !57
  744. // CHECK:STDOUT: }
  745. // CHECK:STDOUT:
  746. // CHECK:STDOUT: ; Function Attrs: nounwind
  747. // CHECK:STDOUT: define i16 @_CTestRightShiftLargerUI.Main(i16 %a, i32 %b) #0 !dbg !58 {
  748. // CHECK:STDOUT: entry:
  749. // CHECK:STDOUT: %RightShiftLargerUI.call.rhs = trunc i32 %b to i16, !dbg !62
  750. // CHECK:STDOUT: %RightShiftLargerUI.call = lshr i16 %a, %RightShiftLargerUI.call.rhs, !dbg !62
  751. // CHECK:STDOUT: ret i16 %RightShiftLargerUI.call, !dbg !63
  752. // CHECK:STDOUT: }
  753. // CHECK:STDOUT:
  754. // CHECK:STDOUT: ; Function Attrs: nounwind
  755. // CHECK:STDOUT: define i16 @_CTestLeftShiftLargerUU.Main(i16 %a, i32 %b) #0 !dbg !64 {
  756. // CHECK:STDOUT: entry:
  757. // CHECK:STDOUT: %LeftShiftLargerUU.call.rhs = trunc i32 %b to i16, !dbg !70
  758. // CHECK:STDOUT: %LeftShiftLargerUU.call = shl i16 %a, %LeftShiftLargerUU.call.rhs, !dbg !70
  759. // CHECK:STDOUT: ret i16 %LeftShiftLargerUU.call, !dbg !71
  760. // CHECK:STDOUT: }
  761. // CHECK:STDOUT:
  762. // CHECK:STDOUT: ; Function Attrs: nounwind
  763. // CHECK:STDOUT: define i16 @_CTestRightShiftLargerUU.Main(i16 %a, i32 %b) #0 !dbg !72 {
  764. // CHECK:STDOUT: entry:
  765. // CHECK:STDOUT: %RightShiftLargerUU.call.rhs = trunc i32 %b to i16, !dbg !76
  766. // CHECK:STDOUT: %RightShiftLargerUU.call = lshr i16 %a, %RightShiftLargerUU.call.rhs, !dbg !76
  767. // CHECK:STDOUT: ret i16 %RightShiftLargerUU.call, !dbg !77
  768. // CHECK:STDOUT: }
  769. // CHECK:STDOUT:
  770. // CHECK:STDOUT: attributes #0 = { nounwind }
  771. // CHECK:STDOUT:
  772. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
  773. // CHECK:STDOUT: !llvm.dbg.cu = !{!2}
  774. // CHECK:STDOUT:
  775. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  776. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  777. // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  778. // CHECK:STDOUT: !3 = !DIFile(filename: "mixed_shift.carbon", directory: "")
  779. // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestLeftShiftSmaller", linkageName: "_CTestLeftShiftSmaller.Main", scope: null, file: !3, line: 5, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !9)
  780. // CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
  781. // CHECK:STDOUT: !6 = !{!7, !7, !8}
  782. // CHECK:STDOUT: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  783. // CHECK:STDOUT: !8 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed)
  784. // CHECK:STDOUT: !9 = !{!10, !11}
  785. // CHECK:STDOUT: !10 = !DILocalVariable(arg: 1, scope: !4, type: !7)
  786. // CHECK:STDOUT: !11 = !DILocalVariable(arg: 2, scope: !4, type: !8)
  787. // CHECK:STDOUT: !12 = !DILocation(line: 5, column: 57, scope: !4)
  788. // CHECK:STDOUT: !13 = !DILocation(line: 5, column: 50, scope: !4)
  789. // CHECK:STDOUT: !14 = distinct !DISubprogram(name: "TestRightShiftSmaller", linkageName: "_CTestRightShiftSmaller.Main", scope: null, file: !3, line: 8, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15)
  790. // CHECK:STDOUT: !15 = !{!16, !17}
  791. // CHECK:STDOUT: !16 = !DILocalVariable(arg: 1, scope: !14, type: !7)
  792. // CHECK:STDOUT: !17 = !DILocalVariable(arg: 2, scope: !14, type: !8)
  793. // CHECK:STDOUT: !18 = !DILocation(line: 8, column: 58, scope: !14)
  794. // CHECK:STDOUT: !19 = !DILocation(line: 8, column: 51, scope: !14)
  795. // CHECK:STDOUT: !20 = distinct !DISubprogram(name: "TestLeftShiftLargerII", linkageName: "_CTestLeftShiftLargerII.Main", scope: null, file: !3, line: 11, type: !21, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !23)
  796. // CHECK:STDOUT: !21 = !DISubroutineType(types: !22)
  797. // CHECK:STDOUT: !22 = !{!8, !8, !7}
  798. // CHECK:STDOUT: !23 = !{!24, !25}
  799. // CHECK:STDOUT: !24 = !DILocalVariable(arg: 1, scope: !20, type: !8)
  800. // CHECK:STDOUT: !25 = !DILocalVariable(arg: 2, scope: !20, type: !7)
  801. // CHECK:STDOUT: !26 = !DILocation(line: 11, column: 58, scope: !20)
  802. // CHECK:STDOUT: !27 = !DILocation(line: 11, column: 51, scope: !20)
  803. // CHECK:STDOUT: !28 = distinct !DISubprogram(name: "TestRightShiftLargerII", linkageName: "_CTestRightShiftLargerII.Main", scope: null, file: !3, line: 14, type: !21, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !29)
  804. // CHECK:STDOUT: !29 = !{!30, !31}
  805. // CHECK:STDOUT: !30 = !DILocalVariable(arg: 1, scope: !28, type: !8)
  806. // CHECK:STDOUT: !31 = !DILocalVariable(arg: 2, scope: !28, type: !7)
  807. // CHECK:STDOUT: !32 = !DILocation(line: 14, column: 59, scope: !28)
  808. // CHECK:STDOUT: !33 = !DILocation(line: 14, column: 52, scope: !28)
  809. // CHECK:STDOUT: !34 = distinct !DISubprogram(name: "TestLeftShiftLargerIU", linkageName: "_CTestLeftShiftLargerIU.Main", scope: null, file: !3, line: 17, type: !35, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !38)
  810. // CHECK:STDOUT: !35 = !DISubroutineType(types: !36)
  811. // CHECK:STDOUT: !36 = !{!8, !8, !37}
  812. // CHECK:STDOUT: !37 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_unsigned)
  813. // CHECK:STDOUT: !38 = !{!39, !40}
  814. // CHECK:STDOUT: !39 = !DILocalVariable(arg: 1, scope: !34, type: !8)
  815. // CHECK:STDOUT: !40 = !DILocalVariable(arg: 2, scope: !34, type: !37)
  816. // CHECK:STDOUT: !41 = !DILocation(line: 17, column: 58, scope: !34)
  817. // CHECK:STDOUT: !42 = !DILocation(line: 17, column: 51, scope: !34)
  818. // CHECK:STDOUT: !43 = distinct !DISubprogram(name: "TestRightShiftLargerIU", linkageName: "_CTestRightShiftLargerIU.Main", scope: null, file: !3, line: 20, type: !35, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !44)
  819. // CHECK:STDOUT: !44 = !{!45, !46}
  820. // CHECK:STDOUT: !45 = !DILocalVariable(arg: 1, scope: !43, type: !8)
  821. // CHECK:STDOUT: !46 = !DILocalVariable(arg: 2, scope: !43, type: !37)
  822. // CHECK:STDOUT: !47 = !DILocation(line: 20, column: 59, scope: !43)
  823. // CHECK:STDOUT: !48 = !DILocation(line: 20, column: 52, scope: !43)
  824. // CHECK:STDOUT: !49 = distinct !DISubprogram(name: "TestLeftShiftLargerUI", linkageName: "_CTestLeftShiftLargerUI.Main", scope: null, file: !3, line: 23, type: !50, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !53)
  825. // CHECK:STDOUT: !50 = !DISubroutineType(types: !51)
  826. // CHECK:STDOUT: !51 = !{!52, !52, !7}
  827. // CHECK:STDOUT: !52 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_unsigned)
  828. // CHECK:STDOUT: !53 = !{!54, !55}
  829. // CHECK:STDOUT: !54 = !DILocalVariable(arg: 1, scope: !49, type: !52)
  830. // CHECK:STDOUT: !55 = !DILocalVariable(arg: 2, scope: !49, type: !7)
  831. // CHECK:STDOUT: !56 = !DILocation(line: 23, column: 58, scope: !49)
  832. // CHECK:STDOUT: !57 = !DILocation(line: 23, column: 51, scope: !49)
  833. // CHECK:STDOUT: !58 = distinct !DISubprogram(name: "TestRightShiftLargerUI", linkageName: "_CTestRightShiftLargerUI.Main", scope: null, file: !3, line: 26, type: !50, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !59)
  834. // CHECK:STDOUT: !59 = !{!60, !61}
  835. // CHECK:STDOUT: !60 = !DILocalVariable(arg: 1, scope: !58, type: !52)
  836. // CHECK:STDOUT: !61 = !DILocalVariable(arg: 2, scope: !58, type: !7)
  837. // CHECK:STDOUT: !62 = !DILocation(line: 26, column: 59, scope: !58)
  838. // CHECK:STDOUT: !63 = !DILocation(line: 26, column: 52, scope: !58)
  839. // CHECK:STDOUT: !64 = distinct !DISubprogram(name: "TestLeftShiftLargerUU", linkageName: "_CTestLeftShiftLargerUU.Main", scope: null, file: !3, line: 29, type: !65, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !67)
  840. // CHECK:STDOUT: !65 = !DISubroutineType(types: !66)
  841. // CHECK:STDOUT: !66 = !{!52, !52, !37}
  842. // CHECK:STDOUT: !67 = !{!68, !69}
  843. // CHECK:STDOUT: !68 = !DILocalVariable(arg: 1, scope: !64, type: !52)
  844. // CHECK:STDOUT: !69 = !DILocalVariable(arg: 2, scope: !64, type: !37)
  845. // CHECK:STDOUT: !70 = !DILocation(line: 29, column: 58, scope: !64)
  846. // CHECK:STDOUT: !71 = !DILocation(line: 29, column: 51, scope: !64)
  847. // CHECK:STDOUT: !72 = distinct !DISubprogram(name: "TestRightShiftLargerUU", linkageName: "_CTestRightShiftLargerUU.Main", scope: null, file: !3, line: 32, type: !65, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !73)
  848. // CHECK:STDOUT: !73 = !{!74, !75}
  849. // CHECK:STDOUT: !74 = !DILocalVariable(arg: 1, scope: !72, type: !52)
  850. // CHECK:STDOUT: !75 = !DILocalVariable(arg: 2, scope: !72, type: !37)
  851. // CHECK:STDOUT: !76 = !DILocation(line: 32, column: 59, scope: !72)
  852. // CHECK:STDOUT: !77 = !DILocation(line: 32, column: 52, scope: !72)
  853. // CHECK:STDOUT: ; ModuleID = 'mixed_compare.carbon'
  854. // CHECK:STDOUT: source_filename = "mixed_compare.carbon"
  855. // CHECK:STDOUT:
  856. // CHECK:STDOUT: ; Function Attrs: nounwind
  857. // CHECK:STDOUT: define i1 @_CTestEq_u16_u32.Main(i16 %a, i32 %b) #0 !dbg !4 {
  858. // CHECK:STDOUT: entry:
  859. // CHECK:STDOUT: %Eq_u16_u32.call.lhs = zext i16 %a to i32, !dbg !13
  860. // CHECK:STDOUT: %Eq_u16_u32.call = icmp eq i32 %Eq_u16_u32.call.lhs, %b, !dbg !13
  861. // CHECK:STDOUT: ret i1 %Eq_u16_u32.call, !dbg !14
  862. // CHECK:STDOUT: }
  863. // CHECK:STDOUT:
  864. // CHECK:STDOUT: ; Function Attrs: nounwind
  865. // CHECK:STDOUT: define i1 @_CTestEq_i16_u32.Main(i16 %a, i32 %b) #0 !dbg !15 {
  866. // CHECK:STDOUT: entry:
  867. // CHECK:STDOUT: %Eq_i16_u32.call.lhs = sext i16 %a to i33, !dbg !22
  868. // CHECK:STDOUT: %Eq_i16_u32.call.rhs = zext i32 %b to i33, !dbg !22
  869. // CHECK:STDOUT: %Eq_i16_u32.call = icmp eq i33 %Eq_i16_u32.call.lhs, %Eq_i16_u32.call.rhs, !dbg !22
  870. // CHECK:STDOUT: ret i1 %Eq_i16_u32.call, !dbg !23
  871. // CHECK:STDOUT: }
  872. // CHECK:STDOUT:
  873. // CHECK:STDOUT: ; Function Attrs: nounwind
  874. // CHECK:STDOUT: define i1 @_CTestEq_u16_i32.Main(i16 %a, i32 %b) #0 !dbg !24 {
  875. // CHECK:STDOUT: entry:
  876. // CHECK:STDOUT: %Eq_u16_i32.call.lhs = zext i16 %a to i32, !dbg !31
  877. // CHECK:STDOUT: %Eq_u16_i32.call = icmp eq i32 %Eq_u16_i32.call.lhs, %b, !dbg !31
  878. // CHECK:STDOUT: ret i1 %Eq_u16_i32.call, !dbg !32
  879. // CHECK:STDOUT: }
  880. // CHECK:STDOUT:
  881. // CHECK:STDOUT: ; Function Attrs: nounwind
  882. // CHECK:STDOUT: define i1 @_CTestEq_i16_i32.Main(i16 %a, i32 %b) #0 !dbg !33 {
  883. // CHECK:STDOUT: entry:
  884. // CHECK:STDOUT: %Eq_i16_i32.call.lhs = sext i16 %a to i32, !dbg !39
  885. // CHECK:STDOUT: %Eq_i16_i32.call = icmp eq i32 %Eq_i16_i32.call.lhs, %b, !dbg !39
  886. // CHECK:STDOUT: ret i1 %Eq_i16_i32.call, !dbg !40
  887. // CHECK:STDOUT: }
  888. // CHECK:STDOUT:
  889. // CHECK:STDOUT: ; Function Attrs: nounwind
  890. // CHECK:STDOUT: define i1 @_CTestEq_i32_u32.Main(i32 %a, i32 %b) #0 !dbg !41 {
  891. // CHECK:STDOUT: entry:
  892. // CHECK:STDOUT: %Eq_i32_u32.call.lhs = sext i32 %a to i33, !dbg !47
  893. // CHECK:STDOUT: %Eq_i32_u32.call.rhs = zext i32 %b to i33, !dbg !47
  894. // CHECK:STDOUT: %Eq_i32_u32.call = icmp eq i33 %Eq_i32_u32.call.lhs, %Eq_i32_u32.call.rhs, !dbg !47
  895. // CHECK:STDOUT: ret i1 %Eq_i32_u32.call, !dbg !48
  896. // CHECK:STDOUT: }
  897. // CHECK:STDOUT:
  898. // CHECK:STDOUT: ; Function Attrs: nounwind
  899. // CHECK:STDOUT: define i1 @_CTestLess_u16_u32.Main(i16 %a, i32 %b) #0 !dbg !49 {
  900. // CHECK:STDOUT: entry:
  901. // CHECK:STDOUT: %Less_u16_u32.call.lhs = zext i16 %a to i32, !dbg !53
  902. // CHECK:STDOUT: %Less_u16_u32.call = icmp ult i32 %Less_u16_u32.call.lhs, %b, !dbg !53
  903. // CHECK:STDOUT: ret i1 %Less_u16_u32.call, !dbg !54
  904. // CHECK:STDOUT: }
  905. // CHECK:STDOUT:
  906. // CHECK:STDOUT: ; Function Attrs: nounwind
  907. // CHECK:STDOUT: define i1 @_CTestLess_i16_u32.Main(i16 %a, i32 %b) #0 !dbg !55 {
  908. // CHECK:STDOUT: entry:
  909. // CHECK:STDOUT: %Less_i16_u32.call.lhs = sext i16 %a to i33, !dbg !59
  910. // CHECK:STDOUT: %Less_i16_u32.call.rhs = zext i32 %b to i33, !dbg !59
  911. // CHECK:STDOUT: %Less_i16_u32.call = icmp slt i33 %Less_i16_u32.call.lhs, %Less_i16_u32.call.rhs, !dbg !59
  912. // CHECK:STDOUT: ret i1 %Less_i16_u32.call, !dbg !60
  913. // CHECK:STDOUT: }
  914. // CHECK:STDOUT:
  915. // CHECK:STDOUT: ; Function Attrs: nounwind
  916. // CHECK:STDOUT: define i1 @_CTestLess_u16_i32.Main(i16 %a, i32 %b) #0 !dbg !61 {
  917. // CHECK:STDOUT: entry:
  918. // CHECK:STDOUT: %Less_u16_i32.call.lhs = zext i16 %a to i32, !dbg !65
  919. // CHECK:STDOUT: %Less_u16_i32.call = icmp slt i32 %Less_u16_i32.call.lhs, %b, !dbg !65
  920. // CHECK:STDOUT: ret i1 %Less_u16_i32.call, !dbg !66
  921. // CHECK:STDOUT: }
  922. // CHECK:STDOUT:
  923. // CHECK:STDOUT: ; Function Attrs: nounwind
  924. // CHECK:STDOUT: define i1 @_CTestLess_i16_i32.Main(i16 %a, i32 %b) #0 !dbg !67 {
  925. // CHECK:STDOUT: entry:
  926. // CHECK:STDOUT: %Less_i16_i32.call.lhs = sext i16 %a to i32, !dbg !71
  927. // CHECK:STDOUT: %Less_i16_i32.call = icmp slt i32 %Less_i16_i32.call.lhs, %b, !dbg !71
  928. // CHECK:STDOUT: ret i1 %Less_i16_i32.call, !dbg !72
  929. // CHECK:STDOUT: }
  930. // CHECK:STDOUT:
  931. // CHECK:STDOUT: ; Function Attrs: nounwind
  932. // CHECK:STDOUT: define i1 @_CTestLess_i32_u32.Main(i32 %a, i32 %b) #0 !dbg !73 {
  933. // CHECK:STDOUT: entry:
  934. // CHECK:STDOUT: %Less_i32_u32.call.lhs = sext i32 %a to i33, !dbg !77
  935. // CHECK:STDOUT: %Less_i32_u32.call.rhs = zext i32 %b to i33, !dbg !77
  936. // CHECK:STDOUT: %Less_i32_u32.call = icmp slt i33 %Less_i32_u32.call.lhs, %Less_i32_u32.call.rhs, !dbg !77
  937. // CHECK:STDOUT: ret i1 %Less_i32_u32.call, !dbg !78
  938. // CHECK:STDOUT: }
  939. // CHECK:STDOUT:
  940. // CHECK:STDOUT: attributes #0 = { nounwind }
  941. // CHECK:STDOUT:
  942. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
  943. // CHECK:STDOUT: !llvm.dbg.cu = !{!2}
  944. // CHECK:STDOUT:
  945. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  946. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  947. // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  948. // CHECK:STDOUT: !3 = !DIFile(filename: "mixed_compare.carbon", directory: "")
  949. // 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, retainedNodes: !10)
  950. // CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
  951. // CHECK:STDOUT: !6 = !{!7, !8, !9}
  952. // CHECK:STDOUT: !7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
  953. // CHECK:STDOUT: !8 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_unsigned)
  954. // CHECK:STDOUT: !9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_unsigned)
  955. // CHECK:STDOUT: !10 = !{!11, !12}
  956. // CHECK:STDOUT: !11 = !DILocalVariable(arg: 1, scope: !4, type: !8)
  957. // CHECK:STDOUT: !12 = !DILocalVariable(arg: 2, scope: !4, type: !9)
  958. // CHECK:STDOUT: !13 = !DILocation(line: 10, column: 52, scope: !4)
  959. // CHECK:STDOUT: !14 = !DILocation(line: 10, column: 45, scope: !4)
  960. // CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestEq_i16_u32", linkageName: "_CTestEq_i16_u32.Main", scope: null, file: !3, line: 11, type: !16, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !19)
  961. // CHECK:STDOUT: !16 = !DISubroutineType(types: !17)
  962. // CHECK:STDOUT: !17 = !{!7, !18, !9}
  963. // CHECK:STDOUT: !18 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed)
  964. // CHECK:STDOUT: !19 = !{!20, !21}
  965. // CHECK:STDOUT: !20 = !DILocalVariable(arg: 1, scope: !15, type: !18)
  966. // CHECK:STDOUT: !21 = !DILocalVariable(arg: 2, scope: !15, type: !9)
  967. // CHECK:STDOUT: !22 = !DILocation(line: 11, column: 52, scope: !15)
  968. // CHECK:STDOUT: !23 = !DILocation(line: 11, column: 45, scope: !15)
  969. // CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestEq_u16_i32", linkageName: "_CTestEq_u16_i32.Main", scope: null, file: !3, line: 12, type: !25, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !28)
  970. // CHECK:STDOUT: !25 = !DISubroutineType(types: !26)
  971. // CHECK:STDOUT: !26 = !{!7, !8, !27}
  972. // CHECK:STDOUT: !27 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  973. // CHECK:STDOUT: !28 = !{!29, !30}
  974. // CHECK:STDOUT: !29 = !DILocalVariable(arg: 1, scope: !24, type: !8)
  975. // CHECK:STDOUT: !30 = !DILocalVariable(arg: 2, scope: !24, type: !27)
  976. // CHECK:STDOUT: !31 = !DILocation(line: 12, column: 52, scope: !24)
  977. // CHECK:STDOUT: !32 = !DILocation(line: 12, column: 45, scope: !24)
  978. // CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestEq_i16_i32", linkageName: "_CTestEq_i16_i32.Main", scope: null, file: !3, line: 13, type: !34, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !36)
  979. // CHECK:STDOUT: !34 = !DISubroutineType(types: !35)
  980. // CHECK:STDOUT: !35 = !{!7, !18, !27}
  981. // CHECK:STDOUT: !36 = !{!37, !38}
  982. // CHECK:STDOUT: !37 = !DILocalVariable(arg: 1, scope: !33, type: !18)
  983. // CHECK:STDOUT: !38 = !DILocalVariable(arg: 2, scope: !33, type: !27)
  984. // CHECK:STDOUT: !39 = !DILocation(line: 13, column: 52, scope: !33)
  985. // CHECK:STDOUT: !40 = !DILocation(line: 13, column: 45, scope: !33)
  986. // CHECK:STDOUT: !41 = distinct !DISubprogram(name: "TestEq_i32_u32", linkageName: "_CTestEq_i32_u32.Main", scope: null, file: !3, line: 14, type: !42, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !44)
  987. // CHECK:STDOUT: !42 = !DISubroutineType(types: !43)
  988. // CHECK:STDOUT: !43 = !{!7, !27, !9}
  989. // CHECK:STDOUT: !44 = !{!45, !46}
  990. // CHECK:STDOUT: !45 = !DILocalVariable(arg: 1, scope: !41, type: !27)
  991. // CHECK:STDOUT: !46 = !DILocalVariable(arg: 2, scope: !41, type: !9)
  992. // CHECK:STDOUT: !47 = !DILocation(line: 14, column: 52, scope: !41)
  993. // CHECK:STDOUT: !48 = !DILocation(line: 14, column: 45, scope: !41)
  994. // CHECK:STDOUT: !49 = distinct !DISubprogram(name: "TestLess_u16_u32", linkageName: "_CTestLess_u16_u32.Main", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !50)
  995. // CHECK:STDOUT: !50 = !{!51, !52}
  996. // CHECK:STDOUT: !51 = !DILocalVariable(arg: 1, scope: !49, type: !8)
  997. // CHECK:STDOUT: !52 = !DILocalVariable(arg: 2, scope: !49, type: !9)
  998. // CHECK:STDOUT: !53 = !DILocation(line: 22, column: 54, scope: !49)
  999. // CHECK:STDOUT: !54 = !DILocation(line: 22, column: 47, scope: !49)
  1000. // CHECK:STDOUT: !55 = distinct !DISubprogram(name: "TestLess_i16_u32", linkageName: "_CTestLess_i16_u32.Main", scope: null, file: !3, line: 23, type: !16, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !56)
  1001. // CHECK:STDOUT: !56 = !{!57, !58}
  1002. // CHECK:STDOUT: !57 = !DILocalVariable(arg: 1, scope: !55, type: !18)
  1003. // CHECK:STDOUT: !58 = !DILocalVariable(arg: 2, scope: !55, type: !9)
  1004. // CHECK:STDOUT: !59 = !DILocation(line: 23, column: 54, scope: !55)
  1005. // CHECK:STDOUT: !60 = !DILocation(line: 23, column: 47, scope: !55)
  1006. // CHECK:STDOUT: !61 = distinct !DISubprogram(name: "TestLess_u16_i32", linkageName: "_CTestLess_u16_i32.Main", scope: null, file: !3, line: 24, type: !25, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !62)
  1007. // CHECK:STDOUT: !62 = !{!63, !64}
  1008. // CHECK:STDOUT: !63 = !DILocalVariable(arg: 1, scope: !61, type: !8)
  1009. // CHECK:STDOUT: !64 = !DILocalVariable(arg: 2, scope: !61, type: !27)
  1010. // CHECK:STDOUT: !65 = !DILocation(line: 24, column: 54, scope: !61)
  1011. // CHECK:STDOUT: !66 = !DILocation(line: 24, column: 47, scope: !61)
  1012. // CHECK:STDOUT: !67 = distinct !DISubprogram(name: "TestLess_i16_i32", linkageName: "_CTestLess_i16_i32.Main", scope: null, file: !3, line: 25, type: !34, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !68)
  1013. // CHECK:STDOUT: !68 = !{!69, !70}
  1014. // CHECK:STDOUT: !69 = !DILocalVariable(arg: 1, scope: !67, type: !18)
  1015. // CHECK:STDOUT: !70 = !DILocalVariable(arg: 2, scope: !67, type: !27)
  1016. // CHECK:STDOUT: !71 = !DILocation(line: 25, column: 54, scope: !67)
  1017. // CHECK:STDOUT: !72 = !DILocation(line: 25, column: 47, scope: !67)
  1018. // CHECK:STDOUT: !73 = distinct !DISubprogram(name: "TestLess_i32_u32", linkageName: "_CTestLess_i32_u32.Main", scope: null, file: !3, line: 26, type: !42, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !74)
  1019. // CHECK:STDOUT: !74 = !{!75, !76}
  1020. // CHECK:STDOUT: !75 = !DILocalVariable(arg: 1, scope: !73, type: !27)
  1021. // CHECK:STDOUT: !76 = !DILocalVariable(arg: 2, scope: !73, type: !9)
  1022. // CHECK:STDOUT: !77 = !DILocation(line: 26, column: 54, scope: !73)
  1023. // CHECK:STDOUT: !78 = !DILocation(line: 26, column: 47, scope: !73)
  1024. // CHECK:STDOUT: ; ModuleID = 'convert.carbon'
  1025. // CHECK:STDOUT: source_filename = "convert.carbon"
  1026. // CHECK:STDOUT:
  1027. // CHECK:STDOUT: ; Function Attrs: nounwind
  1028. // CHECK:STDOUT: define i32 @_CTestInt32ToInt32.Main(i32 %a) #0 !dbg !4 {
  1029. // CHECK:STDOUT: entry:
  1030. // CHECK:STDOUT: ret i32 %a, !dbg !10
  1031. // CHECK:STDOUT: }
  1032. // CHECK:STDOUT:
  1033. // CHECK:STDOUT: ; Function Attrs: nounwind
  1034. // CHECK:STDOUT: define i32 @_CTestInt32ToUint32.Main(i32 %a) #0 !dbg !11 {
  1035. // CHECK:STDOUT: entry:
  1036. // CHECK:STDOUT: ret i32 %a, !dbg !17
  1037. // CHECK:STDOUT: }
  1038. // CHECK:STDOUT:
  1039. // CHECK:STDOUT: ; Function Attrs: nounwind
  1040. // CHECK:STDOUT: define i32 @_CTestUint32ToInt32.Main(i32 %a) #0 !dbg !18 {
  1041. // CHECK:STDOUT: entry:
  1042. // CHECK:STDOUT: ret i32 %a, !dbg !23
  1043. // CHECK:STDOUT: }
  1044. // CHECK:STDOUT:
  1045. // CHECK:STDOUT: ; Function Attrs: nounwind
  1046. // CHECK:STDOUT: define i32 @_CTestUint32ToUint32.Main(i32 %a) #0 !dbg !24 {
  1047. // CHECK:STDOUT: entry:
  1048. // CHECK:STDOUT: ret i32 %a, !dbg !29
  1049. // CHECK:STDOUT: }
  1050. // CHECK:STDOUT:
  1051. // CHECK:STDOUT: ; Function Attrs: nounwind
  1052. // CHECK:STDOUT: define i16 @_CTestInt32ToInt16.Main(i32 %a) #0 !dbg !30 {
  1053. // CHECK:STDOUT: entry:
  1054. // CHECK:STDOUT: %Int32ToInt16.call = trunc i32 %a to i16, !dbg !36
  1055. // CHECK:STDOUT: ret i16 %Int32ToInt16.call, !dbg !37
  1056. // CHECK:STDOUT: }
  1057. // CHECK:STDOUT:
  1058. // CHECK:STDOUT: ; Function Attrs: nounwind
  1059. // CHECK:STDOUT: define i16 @_CTestInt32ToUint16.Main(i32 %a) #0 !dbg !38 {
  1060. // CHECK:STDOUT: entry:
  1061. // CHECK:STDOUT: %Int32ToUint16.call = trunc i32 %a to i16, !dbg !44
  1062. // CHECK:STDOUT: ret i16 %Int32ToUint16.call, !dbg !45
  1063. // CHECK:STDOUT: }
  1064. // CHECK:STDOUT:
  1065. // CHECK:STDOUT: ; Function Attrs: nounwind
  1066. // CHECK:STDOUT: define i16 @_CTestUint32ToInt16.Main(i32 %a) #0 !dbg !46 {
  1067. // CHECK:STDOUT: entry:
  1068. // CHECK:STDOUT: %Uint32ToInt16.call = trunc i32 %a to i16, !dbg !51
  1069. // CHECK:STDOUT: ret i16 %Uint32ToInt16.call, !dbg !52
  1070. // CHECK:STDOUT: }
  1071. // CHECK:STDOUT:
  1072. // CHECK:STDOUT: ; Function Attrs: nounwind
  1073. // CHECK:STDOUT: define i16 @_CTestUint32ToUint16.Main(i32 %a) #0 !dbg !53 {
  1074. // CHECK:STDOUT: entry:
  1075. // CHECK:STDOUT: %Uint32ToUint16.call = trunc i32 %a to i16, !dbg !58
  1076. // CHECK:STDOUT: ret i16 %Uint32ToUint16.call, !dbg !59
  1077. // CHECK:STDOUT: }
  1078. // CHECK:STDOUT:
  1079. // CHECK:STDOUT: ; Function Attrs: nounwind
  1080. // CHECK:STDOUT: define i64 @_CTestInt32ToInt64.Main(i32 %a) #0 !dbg !60 {
  1081. // CHECK:STDOUT: entry:
  1082. // CHECK:STDOUT: %Int32ToInt64.call = sext i32 %a to i64, !dbg !66
  1083. // CHECK:STDOUT: ret i64 %Int32ToInt64.call, !dbg !67
  1084. // CHECK:STDOUT: }
  1085. // CHECK:STDOUT:
  1086. // CHECK:STDOUT: ; Function Attrs: nounwind
  1087. // CHECK:STDOUT: define i64 @_CTestInt32ToUint64.Main(i32 %a) #0 !dbg !68 {
  1088. // CHECK:STDOUT: entry:
  1089. // CHECK:STDOUT: %Int32ToUint64.call = sext i32 %a to i64, !dbg !74
  1090. // CHECK:STDOUT: ret i64 %Int32ToUint64.call, !dbg !75
  1091. // CHECK:STDOUT: }
  1092. // CHECK:STDOUT:
  1093. // CHECK:STDOUT: ; Function Attrs: nounwind
  1094. // CHECK:STDOUT: define i64 @_CTestUint32ToInt64.Main(i32 %a) #0 !dbg !76 {
  1095. // CHECK:STDOUT: entry:
  1096. // CHECK:STDOUT: %Uint32ToInt64.call = zext i32 %a to i64, !dbg !81
  1097. // CHECK:STDOUT: ret i64 %Uint32ToInt64.call, !dbg !82
  1098. // CHECK:STDOUT: }
  1099. // CHECK:STDOUT:
  1100. // CHECK:STDOUT: ; Function Attrs: nounwind
  1101. // CHECK:STDOUT: define i64 @_CTestUint32ToUint64.Main(i32 %a) #0 !dbg !83 {
  1102. // CHECK:STDOUT: entry:
  1103. // CHECK:STDOUT: %Uint32ToUint64.call = zext i32 %a to i64, !dbg !88
  1104. // CHECK:STDOUT: ret i64 %Uint32ToUint64.call, !dbg !89
  1105. // CHECK:STDOUT: }
  1106. // CHECK:STDOUT:
  1107. // CHECK:STDOUT: attributes #0 = { nounwind }
  1108. // CHECK:STDOUT:
  1109. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
  1110. // CHECK:STDOUT: !llvm.dbg.cu = !{!2}
  1111. // CHECK:STDOUT:
  1112. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  1113. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  1114. // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  1115. // CHECK:STDOUT: !3 = !DIFile(filename: "convert.carbon", directory: "")
  1116. // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestInt32ToInt32", linkageName: "_CTestInt32ToInt32.Main", scope: null, file: !3, line: 10, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !8)
  1117. // CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
  1118. // CHECK:STDOUT: !6 = !{!7, !7}
  1119. // CHECK:STDOUT: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  1120. // CHECK:STDOUT: !8 = !{!9}
  1121. // CHECK:STDOUT: !9 = !DILocalVariable(arg: 1, scope: !4, type: !7)
  1122. // CHECK:STDOUT: !10 = !DILocation(line: 10, column: 38, scope: !4)
  1123. // CHECK:STDOUT: !11 = distinct !DISubprogram(name: "TestInt32ToUint32", linkageName: "_CTestInt32ToUint32.Main", scope: null, file: !3, line: 11, type: !12, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15)
  1124. // CHECK:STDOUT: !12 = !DISubroutineType(types: !13)
  1125. // CHECK:STDOUT: !13 = !{!14, !7}
  1126. // CHECK:STDOUT: !14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_unsigned)
  1127. // CHECK:STDOUT: !15 = !{!16}
  1128. // CHECK:STDOUT: !16 = !DILocalVariable(arg: 1, scope: !11, type: !7)
  1129. // CHECK:STDOUT: !17 = !DILocation(line: 11, column: 39, scope: !11)
  1130. // CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestUint32ToInt32", linkageName: "_CTestUint32ToInt32.Main", scope: null, file: !3, line: 12, type: !19, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !21)
  1131. // CHECK:STDOUT: !19 = !DISubroutineType(types: !20)
  1132. // CHECK:STDOUT: !20 = !{!7, !14}
  1133. // CHECK:STDOUT: !21 = !{!22}
  1134. // CHECK:STDOUT: !22 = !DILocalVariable(arg: 1, scope: !18, type: !14)
  1135. // CHECK:STDOUT: !23 = !DILocation(line: 12, column: 39, scope: !18)
  1136. // CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestUint32ToUint32", linkageName: "_CTestUint32ToUint32.Main", scope: null, file: !3, line: 13, type: !25, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !27)
  1137. // CHECK:STDOUT: !25 = !DISubroutineType(types: !26)
  1138. // CHECK:STDOUT: !26 = !{!14, !14}
  1139. // CHECK:STDOUT: !27 = !{!28}
  1140. // CHECK:STDOUT: !28 = !DILocalVariable(arg: 1, scope: !24, type: !14)
  1141. // CHECK:STDOUT: !29 = !DILocation(line: 13, column: 40, scope: !24)
  1142. // CHECK:STDOUT: !30 = distinct !DISubprogram(name: "TestInt32ToInt16", linkageName: "_CTestInt32ToInt16.Main", scope: null, file: !3, line: 21, type: !31, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !34)
  1143. // CHECK:STDOUT: !31 = !DISubroutineType(types: !32)
  1144. // CHECK:STDOUT: !32 = !{!33, !7}
  1145. // CHECK:STDOUT: !33 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed)
  1146. // CHECK:STDOUT: !34 = !{!35}
  1147. // CHECK:STDOUT: !35 = !DILocalVariable(arg: 1, scope: !30, type: !7)
  1148. // CHECK:STDOUT: !36 = !DILocation(line: 21, column: 45, scope: !30)
  1149. // CHECK:STDOUT: !37 = !DILocation(line: 21, column: 38, scope: !30)
  1150. // CHECK:STDOUT: !38 = distinct !DISubprogram(name: "TestInt32ToUint16", linkageName: "_CTestInt32ToUint16.Main", scope: null, file: !3, line: 22, type: !39, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !42)
  1151. // CHECK:STDOUT: !39 = !DISubroutineType(types: !40)
  1152. // CHECK:STDOUT: !40 = !{!41, !7}
  1153. // CHECK:STDOUT: !41 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_unsigned)
  1154. // CHECK:STDOUT: !42 = !{!43}
  1155. // CHECK:STDOUT: !43 = !DILocalVariable(arg: 1, scope: !38, type: !7)
  1156. // CHECK:STDOUT: !44 = !DILocation(line: 22, column: 46, scope: !38)
  1157. // CHECK:STDOUT: !45 = !DILocation(line: 22, column: 39, scope: !38)
  1158. // CHECK:STDOUT: !46 = distinct !DISubprogram(name: "TestUint32ToInt16", linkageName: "_CTestUint32ToInt16.Main", scope: null, file: !3, line: 23, type: !47, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !49)
  1159. // CHECK:STDOUT: !47 = !DISubroutineType(types: !48)
  1160. // CHECK:STDOUT: !48 = !{!33, !14}
  1161. // CHECK:STDOUT: !49 = !{!50}
  1162. // CHECK:STDOUT: !50 = !DILocalVariable(arg: 1, scope: !46, type: !14)
  1163. // CHECK:STDOUT: !51 = !DILocation(line: 23, column: 46, scope: !46)
  1164. // CHECK:STDOUT: !52 = !DILocation(line: 23, column: 39, scope: !46)
  1165. // CHECK:STDOUT: !53 = distinct !DISubprogram(name: "TestUint32ToUint16", linkageName: "_CTestUint32ToUint16.Main", scope: null, file: !3, line: 24, type: !54, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !56)
  1166. // CHECK:STDOUT: !54 = !DISubroutineType(types: !55)
  1167. // CHECK:STDOUT: !55 = !{!41, !14}
  1168. // CHECK:STDOUT: !56 = !{!57}
  1169. // CHECK:STDOUT: !57 = !DILocalVariable(arg: 1, scope: !53, type: !14)
  1170. // CHECK:STDOUT: !58 = !DILocation(line: 24, column: 47, scope: !53)
  1171. // CHECK:STDOUT: !59 = !DILocation(line: 24, column: 40, scope: !53)
  1172. // CHECK:STDOUT: !60 = distinct !DISubprogram(name: "TestInt32ToInt64", linkageName: "_CTestInt32ToInt64.Main", scope: null, file: !3, line: 32, type: !61, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !64)
  1173. // CHECK:STDOUT: !61 = !DISubroutineType(types: !62)
  1174. // CHECK:STDOUT: !62 = !{!63, !7}
  1175. // CHECK:STDOUT: !63 = !DIBasicType(name: "int", size: 64, encoding: DW_ATE_signed)
  1176. // CHECK:STDOUT: !64 = !{!65}
  1177. // CHECK:STDOUT: !65 = !DILocalVariable(arg: 1, scope: !60, type: !7)
  1178. // CHECK:STDOUT: !66 = !DILocation(line: 32, column: 45, scope: !60)
  1179. // CHECK:STDOUT: !67 = !DILocation(line: 32, column: 38, scope: !60)
  1180. // CHECK:STDOUT: !68 = distinct !DISubprogram(name: "TestInt32ToUint64", linkageName: "_CTestInt32ToUint64.Main", scope: null, file: !3, line: 33, type: !69, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !72)
  1181. // CHECK:STDOUT: !69 = !DISubroutineType(types: !70)
  1182. // CHECK:STDOUT: !70 = !{!71, !7}
  1183. // CHECK:STDOUT: !71 = !DIBasicType(name: "int", size: 64, encoding: DW_ATE_unsigned)
  1184. // CHECK:STDOUT: !72 = !{!73}
  1185. // CHECK:STDOUT: !73 = !DILocalVariable(arg: 1, scope: !68, type: !7)
  1186. // CHECK:STDOUT: !74 = !DILocation(line: 33, column: 46, scope: !68)
  1187. // CHECK:STDOUT: !75 = !DILocation(line: 33, column: 39, scope: !68)
  1188. // CHECK:STDOUT: !76 = distinct !DISubprogram(name: "TestUint32ToInt64", linkageName: "_CTestUint32ToInt64.Main", scope: null, file: !3, line: 34, type: !77, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !79)
  1189. // CHECK:STDOUT: !77 = !DISubroutineType(types: !78)
  1190. // CHECK:STDOUT: !78 = !{!63, !14}
  1191. // CHECK:STDOUT: !79 = !{!80}
  1192. // CHECK:STDOUT: !80 = !DILocalVariable(arg: 1, scope: !76, type: !14)
  1193. // CHECK:STDOUT: !81 = !DILocation(line: 34, column: 46, scope: !76)
  1194. // CHECK:STDOUT: !82 = !DILocation(line: 34, column: 39, scope: !76)
  1195. // CHECK:STDOUT: !83 = distinct !DISubprogram(name: "TestUint32ToUint64", linkageName: "_CTestUint32ToUint64.Main", scope: null, file: !3, line: 35, type: !84, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !86)
  1196. // CHECK:STDOUT: !84 = !DISubroutineType(types: !85)
  1197. // CHECK:STDOUT: !85 = !{!71, !14}
  1198. // CHECK:STDOUT: !86 = !{!87}
  1199. // CHECK:STDOUT: !87 = !DILocalVariable(arg: 1, scope: !83, type: !14)
  1200. // CHECK:STDOUT: !88 = !DILocation(line: 35, column: 47, scope: !83)
  1201. // CHECK:STDOUT: !89 = !DILocation(line: 35, column: 40, scope: !83)