convert_checked.carbon 191 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/convert_checked.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/convert_checked.carbon
  10. // --- int_ops.carbon
  11. library "[[@TEST_NAME]]";
  12. fn NegateI32(a: i32) -> i32 = "int.snegate";
  13. fn SubI32(a: i32, b: i32) -> i32 = "int.ssub";
  14. fn AddU32(a: u32, b: u32) -> u32 = "int.uadd";
  15. fn IntLiteral() -> type = "int_literal.make_type";
  16. // Size preserving
  17. fn Int32ToInt32(a: i32) -> i32 = "int.convert_checked";
  18. fn Int32ToUint32(a: i32) -> u32 = "int.convert_checked";
  19. fn Uint32ToInt32(a: u32) -> i32 = "int.convert_checked";
  20. fn Uint32ToUint32(a: u32) -> u32 = "int.convert_checked";
  21. fn IntLiteralToIntLiteral(a: IntLiteral()) -> IntLiteral() =
  22. "int.convert_checked";
  23. // Narrowing
  24. fn Int32ToInt16(a: i32) -> i16 = "int.convert_checked";
  25. fn Int32ToUint16(a: i32) -> u16 = "int.convert_checked";
  26. fn Uint32ToInt16(a: u32) -> i16 = "int.convert_checked";
  27. fn Uint32ToUint16(a: u32) -> u16 = "int.convert_checked";
  28. fn IntLiteralToInt16(a: IntLiteral()) -> i16 = "int.convert_checked";
  29. fn IntLiteralToUint16(a: IntLiteral()) -> u16 = "int.convert_checked";
  30. // Widening
  31. fn Int32ToInt64(a: i32) -> i64 = "int.convert_checked";
  32. fn Int32ToUint64(a: i32) -> u64 = "int.convert_checked";
  33. fn Uint32ToInt64(a: u32) -> i64 = "int.convert_checked";
  34. fn Uint32ToUint64(a: u32) -> u64 = "int.convert_checked";
  35. fn Int32ToIntLiteral(a: i32) -> IntLiteral() = "int.convert_checked";
  36. fn Uint32ToUintLiteral(a: u32) -> IntLiteral() = "int.convert_checked";
  37. // --- identity.carbon
  38. library "[[@TEST_NAME]]";
  39. import library "int_ops";
  40. let a: i32 = Int32ToInt32(0);
  41. let b: i32 = Int32ToInt32(0x7FFF_FFFF);
  42. let c: i32 = Int32ToInt32(SubI32(NegateI32(0x7FFF_FFFF), 1));
  43. let d: IntLiteral() = IntLiteralToIntLiteral(Int32ToIntLiteral(NegateI32(1)));
  44. // --- same_size.carbon
  45. library "[[@TEST_NAME]]";
  46. import library "int_ops";
  47. let max: u32 = Int32ToUint32(0x7FFF_FFFF);
  48. let max_roundtrip: i32 = Uint32ToInt32(Int32ToUint32(0x7FFF_FFFF));
  49. // --- truncate.carbon
  50. library "[[@TEST_NAME]]";
  51. import library "int_ops";
  52. let a: u16 = Int32ToUint16(0);
  53. let b: u16 = Int32ToUint16(0xFFFF);
  54. let c: i16 = Int32ToInt16(0x7FFF);
  55. let d: i16 = Int32ToInt16(NegateI32(0x8000));
  56. let e: u16 = Uint32ToUint16(Int32ToUint32(0));
  57. let f: u16 = Uint32ToUint16(Int32ToUint32(0xFFFF));
  58. let g: i16 = Uint32ToInt16(Int32ToUint32(0));
  59. let h: i16 = Uint32ToInt16(Int32ToUint32(0x7FFF));
  60. let lit_i16_min: i16 = IntLiteralToInt16(Int32ToIntLiteral(NegateI32(0x8000)));
  61. let lit_i16_max: i16 = IntLiteralToInt16(Int32ToIntLiteral(0x7FFF));
  62. let lit_u16_min: u16 = IntLiteralToUint16(Int32ToIntLiteral(0));
  63. let lit_u16_max: u16 = IntLiteralToUint16(Int32ToIntLiteral(0xFFFF));
  64. // --- zero_extend.carbon
  65. library "[[@TEST_NAME]]";
  66. import library "int_ops";
  67. let a: u64 = Uint32ToUint64(Int32ToUint32(0));
  68. let b: u64 = Uint32ToUint64(
  69. AddU32(
  70. AddU32(Int32ToUint32(0x7FFF_FFFF), Int32ToUint32(0x7FFF_FFFF)),
  71. Int32ToUint32(1)));
  72. let c: i64 = Uint32ToInt64(Int32ToUint32(0));
  73. let d: i64 = Uint32ToInt64(
  74. AddU32(
  75. AddU32(Int32ToUint32(0x7FFF_FFFF), Int32ToUint32(0x7FFF_FFFF)),
  76. Int32ToUint32(1)));
  77. // --- sign_extend.carbon
  78. library "[[@TEST_NAME]]";
  79. import library "int_ops";
  80. let a: u64 = Int32ToUint64(0);
  81. let b: u64 = Int32ToUint64(0x7FFF_FFFF);
  82. let c: i64 = Int32ToInt64(SubI32(NegateI32(0x7FFF_FFFF), 1));
  83. let d: i64 = Int32ToInt64(0x7FFF_FFFF);
  84. // --- fail_too_large_u32_for_i32.carbon
  85. library "[[@TEST_NAME]]";
  86. import library "int_ops";
  87. let max_plus_one: i32 =
  88. // CHECK:STDERR: fail_too_large_u32_for_i32.carbon:[[@LINE+4]]:3: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType]
  89. // CHECK:STDERR: Uint32ToInt32(
  90. // CHECK:STDERR: ^~~~~~~~~~~~~~
  91. // CHECK:STDERR:
  92. Uint32ToInt32(
  93. AddU32(Int32ToUint32(0x7FFF_FFFF),
  94. Int32ToUint32(1)));
  95. // --- fail_too_large_i32_for_i16.carbon
  96. library "[[@TEST_NAME]]";
  97. import library "int_ops";
  98. // CHECK:STDERR: fail_too_large_i32_for_i16.carbon:[[@LINE+4]]:25: error: integer value 32768 too large for type `i16` [IntTooLargeForType]
  99. // CHECK:STDERR: let max_plus_one: i16 = Int32ToInt16(0x8000);
  100. // CHECK:STDERR: ^~~~~~~~~~~~~
  101. // CHECK:STDERR:
  102. let max_plus_one: i16 = Int32ToInt16(0x8000);
  103. // --- fail_too_large_i32_for_u16.carbon
  104. library "[[@TEST_NAME]]";
  105. import library "int_ops";
  106. // CHECK:STDERR: fail_too_large_i32_for_u16.carbon:[[@LINE+4]]:25: error: integer value 65536 too large for type `u16` [IntTooLargeForType]
  107. // CHECK:STDERR: let max_plus_one: u16 = Int32ToUint16(0x1_0000);
  108. // CHECK:STDERR: ^~~~~~~~~~~~~~
  109. // CHECK:STDERR:
  110. let max_plus_one: u16 = Int32ToUint16(0x1_0000);
  111. // --- fail_too_large_u32_for_i16.carbon
  112. library "[[@TEST_NAME]]";
  113. import library "int_ops";
  114. // CHECK:STDERR: fail_too_large_u32_for_i16.carbon:[[@LINE+4]]:25: error: integer value 32768 too large for type `i16` [IntTooLargeForType]
  115. // CHECK:STDERR: let max_plus_one: i16 = Uint32ToInt16(Int32ToUint32(0x8000));
  116. // CHECK:STDERR: ^~~~~~~~~~~~~~
  117. // CHECK:STDERR:
  118. let max_plus_one: i16 = Uint32ToInt16(Int32ToUint32(0x8000));
  119. // --- fail_too_large_u32_for_u16.carbon
  120. library "[[@TEST_NAME]]";
  121. import library "int_ops";
  122. // CHECK:STDERR: fail_too_large_u32_for_u16.carbon:[[@LINE+4]]:25: error: integer value 65536 too large for type `u16` [IntTooLargeForType]
  123. // CHECK:STDERR: let max_plus_one: u16 = Uint32ToUint16(Int32ToUint32(0x1_0000));
  124. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  125. // CHECK:STDERR:
  126. let max_plus_one: u16 = Uint32ToUint16(Int32ToUint32(0x1_0000));
  127. // --- fail_negative_i32_to_u16.carbon
  128. library "[[@TEST_NAME]]";
  129. import library "int_ops";
  130. // CHECK:STDERR: fail_negative_i32_to_u16.carbon:[[@LINE+4]]:29: error: negative integer value -1 converted to unsigned type `u16` [NegativeIntInUnsignedType]
  131. // CHECK:STDERR: let minus_one_to_u16: u16 = Int32ToUint16(SubI32(0, 1));
  132. // CHECK:STDERR: ^~~~~~~~~~~~~~
  133. // CHECK:STDERR:
  134. let minus_one_to_u16: u16 = Int32ToUint16(SubI32(0, 1));
  135. // --- fail_negative_i32_to_u32.carbon
  136. library "[[@TEST_NAME]]";
  137. import library "int_ops";
  138. // CHECK:STDERR: fail_negative_i32_to_u32.carbon:[[@LINE+4]]:29: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType]
  139. // CHECK:STDERR: let minus_one_to_u32: u32 = Int32ToUint32(SubI32(0, 1));
  140. // CHECK:STDERR: ^~~~~~~~~~~~~~
  141. // CHECK:STDERR:
  142. let minus_one_to_u32: u32 = Int32ToUint32(SubI32(0, 1));
  143. // --- fail_negative_i32_to_u64.carbon
  144. library "[[@TEST_NAME]]";
  145. import library "int_ops";
  146. // CHECK:STDERR: fail_negative_i32_to_u64.carbon:[[@LINE+4]]:29: error: negative integer value -1 converted to unsigned type `u64` [NegativeIntInUnsignedType]
  147. // CHECK:STDERR: let minus_one_to_u64: u64 = Int32ToUint64(SubI32(0, 1));
  148. // CHECK:STDERR: ^~~~~~~~~~~~~~
  149. // CHECK:STDERR:
  150. let minus_one_to_u64: u64 = Int32ToUint64(SubI32(0, 1));
  151. // --- fail_too_small_i32_for_i16.carbon
  152. library "[[@TEST_NAME]]";
  153. import library "int_ops";
  154. // CHECK:STDERR: fail_too_small_i32_for_i16.carbon:[[@LINE+4]]:26: error: integer value -32769 too large for type `i16` [IntTooLargeForType]
  155. // CHECK:STDERR: let min_minus_one: i16 = Int32ToInt16(NegateI32(0x8001));
  156. // CHECK:STDERR: ^~~~~~~~~~~~~
  157. // CHECK:STDERR:
  158. let min_minus_one: i16 = Int32ToInt16(NegateI32(0x8001));
  159. // --- fail_not_constant.carbon
  160. library "[[@TEST_NAME]]";
  161. import library "int_ops";
  162. let not_constant: i32 = 0;
  163. // CHECK:STDERR: fail_not_constant.carbon:[[@LINE+8]]:40: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
  164. // CHECK:STDERR: let convert_not_constant_narrow: i16 = Int32ToInt16(not_constant);
  165. // CHECK:STDERR: ^~~~~~~~~~~~~
  166. // CHECK:STDERR: fail_not_constant.carbon:[[@LINE-7]]:1: in import [InImport]
  167. // CHECK:STDERR: int_ops.carbon:18:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
  168. // CHECK:STDERR: fn Int32ToInt16(a: i32) -> i16 = "int.convert_checked";
  169. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  170. // CHECK:STDERR:
  171. let convert_not_constant_narrow: i16 = Int32ToInt16(not_constant);
  172. // CHECK:STDERR: fail_not_constant.carbon:[[@LINE+8]]:38: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
  173. // CHECK:STDERR: let convert_not_constant_same: i32 = Int32ToInt32(not_constant);
  174. // CHECK:STDERR: ^~~~~~~~~~~~~
  175. // CHECK:STDERR: fail_not_constant.carbon:[[@LINE-17]]:1: in import [InImport]
  176. // CHECK:STDERR: int_ops.carbon:10:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
  177. // CHECK:STDERR: fn Int32ToInt32(a: i32) -> i32 = "int.convert_checked";
  178. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  179. // CHECK:STDERR:
  180. let convert_not_constant_same: i32 = Int32ToInt32(not_constant);
  181. // CHECK:STDERR: fail_not_constant.carbon:[[@LINE+7]]:39: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
  182. // CHECK:STDERR: let convert_not_constant_widen: i64 = Int32ToInt64(not_constant);
  183. // CHECK:STDERR: ^~~~~~~~~~~~~
  184. // CHECK:STDERR: fail_not_constant.carbon:[[@LINE-27]]:1: in import [InImport]
  185. // CHECK:STDERR: int_ops.carbon:26:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
  186. // CHECK:STDERR: fn Int32ToInt64(a: i32) -> i64 = "int.convert_checked";
  187. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  188. let convert_not_constant_widen: i64 = Int32ToInt64(not_constant);
  189. // CHECK:STDOUT: --- int_ops.carbon
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: constants {
  192. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  193. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  194. // CHECK:STDOUT: %NegateI32.type: type = fn_type @NegateI32 [template]
  195. // CHECK:STDOUT: %NegateI32: %NegateI32.type = struct_value () [template]
  196. // CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template]
  197. // CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template]
  198. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32 [template]
  199. // CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template]
  200. // CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template]
  201. // CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template]
  202. // CHECK:STDOUT: %AddU32.type: type = fn_type @AddU32 [template]
  203. // CHECK:STDOUT: %AddU32: %AddU32.type = struct_value () [template]
  204. // CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template]
  205. // CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template]
  206. // CHECK:STDOUT: %Int32ToInt32.type: type = fn_type @Int32ToInt32 [template]
  207. // CHECK:STDOUT: %Int32ToInt32: %Int32ToInt32.type = struct_value () [template]
  208. // CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template]
  209. // CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template]
  210. // CHECK:STDOUT: %Uint32ToInt32.type: type = fn_type @Uint32ToInt32 [template]
  211. // CHECK:STDOUT: %Uint32ToInt32: %Uint32ToInt32.type = struct_value () [template]
  212. // CHECK:STDOUT: %Uint32ToUint32.type: type = fn_type @Uint32ToUint32 [template]
  213. // CHECK:STDOUT: %Uint32ToUint32: %Uint32ToUint32.type = struct_value () [template]
  214. // CHECK:STDOUT: %IntLiteralToIntLiteral.type: type = fn_type @IntLiteralToIntLiteral [template]
  215. // CHECK:STDOUT: %IntLiteralToIntLiteral: %IntLiteralToIntLiteral.type = struct_value () [template]
  216. // CHECK:STDOUT: %.3: Core.IntLiteral = int_value 16 [template]
  217. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  218. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  219. // CHECK:STDOUT: %.4: type = int_type signed, %.3 [template]
  220. // CHECK:STDOUT: %Int32ToInt16.type: type = fn_type @Int32ToInt16 [template]
  221. // CHECK:STDOUT: %Int32ToInt16: %Int32ToInt16.type = struct_value () [template]
  222. // CHECK:STDOUT: %.5: type = int_type unsigned, %.3 [template]
  223. // CHECK:STDOUT: %Int32ToUint16.type: type = fn_type @Int32ToUint16 [template]
  224. // CHECK:STDOUT: %Int32ToUint16: %Int32ToUint16.type = struct_value () [template]
  225. // CHECK:STDOUT: %Uint32ToInt16.type: type = fn_type @Uint32ToInt16 [template]
  226. // CHECK:STDOUT: %Uint32ToInt16: %Uint32ToInt16.type = struct_value () [template]
  227. // CHECK:STDOUT: %Uint32ToUint16.type: type = fn_type @Uint32ToUint16 [template]
  228. // CHECK:STDOUT: %Uint32ToUint16: %Uint32ToUint16.type = struct_value () [template]
  229. // CHECK:STDOUT: %IntLiteralToInt16.type: type = fn_type @IntLiteralToInt16 [template]
  230. // CHECK:STDOUT: %IntLiteralToInt16: %IntLiteralToInt16.type = struct_value () [template]
  231. // CHECK:STDOUT: %IntLiteralToUint16.type: type = fn_type @IntLiteralToUint16 [template]
  232. // CHECK:STDOUT: %IntLiteralToUint16: %IntLiteralToUint16.type = struct_value () [template]
  233. // CHECK:STDOUT: %.6: Core.IntLiteral = int_value 64 [template]
  234. // CHECK:STDOUT: %.7: type = int_type signed, %.6 [template]
  235. // CHECK:STDOUT: %Int32ToInt64.type: type = fn_type @Int32ToInt64 [template]
  236. // CHECK:STDOUT: %Int32ToInt64: %Int32ToInt64.type = struct_value () [template]
  237. // CHECK:STDOUT: %.8: type = int_type unsigned, %.6 [template]
  238. // CHECK:STDOUT: %Int32ToUint64.type: type = fn_type @Int32ToUint64 [template]
  239. // CHECK:STDOUT: %Int32ToUint64: %Int32ToUint64.type = struct_value () [template]
  240. // CHECK:STDOUT: %Uint32ToInt64.type: type = fn_type @Uint32ToInt64 [template]
  241. // CHECK:STDOUT: %Uint32ToInt64: %Uint32ToInt64.type = struct_value () [template]
  242. // CHECK:STDOUT: %Uint32ToUint64.type: type = fn_type @Uint32ToUint64 [template]
  243. // CHECK:STDOUT: %Uint32ToUint64: %Uint32ToUint64.type = struct_value () [template]
  244. // CHECK:STDOUT: %Int32ToIntLiteral.type: type = fn_type @Int32ToIntLiteral [template]
  245. // CHECK:STDOUT: %Int32ToIntLiteral: %Int32ToIntLiteral.type = struct_value () [template]
  246. // CHECK:STDOUT: %Uint32ToUintLiteral.type: type = fn_type @Uint32ToUintLiteral [template]
  247. // CHECK:STDOUT: %Uint32ToUintLiteral: %Uint32ToUintLiteral.type = struct_value () [template]
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: imports {
  251. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  252. // CHECK:STDOUT: .Int32 = %import_ref.1
  253. // CHECK:STDOUT: .UInt = %import_ref.2
  254. // CHECK:STDOUT: .Int = %import_ref.3
  255. // CHECK:STDOUT: import Core//prelude
  256. // CHECK:STDOUT: import Core//prelude/...
  257. // CHECK:STDOUT: }
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: file {
  261. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  262. // CHECK:STDOUT: .Core = imports.%Core
  263. // CHECK:STDOUT: .NegateI32 = %NegateI32.decl
  264. // CHECK:STDOUT: .SubI32 = %SubI32.decl
  265. // CHECK:STDOUT: .AddU32 = %AddU32.decl
  266. // CHECK:STDOUT: .IntLiteral = %IntLiteral.decl
  267. // CHECK:STDOUT: .Int32ToInt32 = %Int32ToInt32.decl
  268. // CHECK:STDOUT: .Int32ToUint32 = %Int32ToUint32.decl
  269. // CHECK:STDOUT: .Uint32ToInt32 = %Uint32ToInt32.decl
  270. // CHECK:STDOUT: .Uint32ToUint32 = %Uint32ToUint32.decl
  271. // CHECK:STDOUT: .IntLiteralToIntLiteral = %IntLiteralToIntLiteral.decl
  272. // CHECK:STDOUT: .Int32ToInt16 = %Int32ToInt16.decl
  273. // CHECK:STDOUT: .Int32ToUint16 = %Int32ToUint16.decl
  274. // CHECK:STDOUT: .Uint32ToInt16 = %Uint32ToInt16.decl
  275. // CHECK:STDOUT: .Uint32ToUint16 = %Uint32ToUint16.decl
  276. // CHECK:STDOUT: .IntLiteralToInt16 = %IntLiteralToInt16.decl
  277. // CHECK:STDOUT: .IntLiteralToUint16 = %IntLiteralToUint16.decl
  278. // CHECK:STDOUT: .Int32ToInt64 = %Int32ToInt64.decl
  279. // CHECK:STDOUT: .Int32ToUint64 = %Int32ToUint64.decl
  280. // CHECK:STDOUT: .Uint32ToInt64 = %Uint32ToInt64.decl
  281. // CHECK:STDOUT: .Uint32ToUint64 = %Uint32ToUint64.decl
  282. // CHECK:STDOUT: .Int32ToIntLiteral = %Int32ToIntLiteral.decl
  283. // CHECK:STDOUT: .Uint32ToUintLiteral = %Uint32ToUintLiteral.decl
  284. // CHECK:STDOUT: }
  285. // CHECK:STDOUT: %Core.import = import Core
  286. // CHECK:STDOUT: %NegateI32.decl: %NegateI32.type = fn_decl @NegateI32 [template = constants.%NegateI32] {
  287. // CHECK:STDOUT: %a.patt: i32 = binding_pattern a
  288. // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0
  289. // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern
  290. // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1
  291. // CHECK:STDOUT: } {
  292. // CHECK:STDOUT: %int.make_type_32.loc4_17: init type = call constants.%Int32() [template = i32]
  293. // CHECK:STDOUT: %.loc4_17.1: type = value_of_initializer %int.make_type_32.loc4_17 [template = i32]
  294. // CHECK:STDOUT: %.loc4_17.2: type = converted %int.make_type_32.loc4_17, %.loc4_17.1 [template = i32]
  295. // CHECK:STDOUT: %int.make_type_32.loc4_25: init type = call constants.%Int32() [template = i32]
  296. // CHECK:STDOUT: %.loc4_25.1: type = value_of_initializer %int.make_type_32.loc4_25 [template = i32]
  297. // CHECK:STDOUT: %.loc4_25.2: type = converted %int.make_type_32.loc4_25, %.loc4_25.1 [template = i32]
  298. // CHECK:STDOUT: %a.param: i32 = value_param runtime_param0
  299. // CHECK:STDOUT: %a: i32 = bind_name a, %a.param
  300. // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1
  301. // CHECK:STDOUT: %return: ref i32 = return_slot %return.param
  302. // CHECK:STDOUT: }
  303. // CHECK:STDOUT: %SubI32.decl: %SubI32.type = fn_decl @SubI32 [template = constants.%SubI32] {
  304. // CHECK:STDOUT: %a.patt: i32 = binding_pattern a
  305. // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0
  306. // CHECK:STDOUT: %b.patt: i32 = binding_pattern b
  307. // CHECK:STDOUT: %b.param_patt: i32 = value_param_pattern %b.patt, runtime_param1
  308. // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern
  309. // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param2
  310. // CHECK:STDOUT: } {
  311. // CHECK:STDOUT: %int.make_type_32.loc5_14: init type = call constants.%Int32() [template = i32]
  312. // CHECK:STDOUT: %.loc5_14.1: type = value_of_initializer %int.make_type_32.loc5_14 [template = i32]
  313. // CHECK:STDOUT: %.loc5_14.2: type = converted %int.make_type_32.loc5_14, %.loc5_14.1 [template = i32]
  314. // CHECK:STDOUT: %int.make_type_32.loc5_22: init type = call constants.%Int32() [template = i32]
  315. // CHECK:STDOUT: %.loc5_22.1: type = value_of_initializer %int.make_type_32.loc5_22 [template = i32]
  316. // CHECK:STDOUT: %.loc5_22.2: type = converted %int.make_type_32.loc5_22, %.loc5_22.1 [template = i32]
  317. // CHECK:STDOUT: %int.make_type_32.loc5_30: init type = call constants.%Int32() [template = i32]
  318. // CHECK:STDOUT: %.loc5_30.1: type = value_of_initializer %int.make_type_32.loc5_30 [template = i32]
  319. // CHECK:STDOUT: %.loc5_30.2: type = converted %int.make_type_32.loc5_30, %.loc5_30.1 [template = i32]
  320. // CHECK:STDOUT: %a.param: i32 = value_param runtime_param0
  321. // CHECK:STDOUT: %a: i32 = bind_name a, %a.param
  322. // CHECK:STDOUT: %b.param: i32 = value_param runtime_param1
  323. // CHECK:STDOUT: %b: i32 = bind_name b, %b.param
  324. // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param2
  325. // CHECK:STDOUT: %return: ref i32 = return_slot %return.param
  326. // CHECK:STDOUT: }
  327. // CHECK:STDOUT: %AddU32.decl: %AddU32.type = fn_decl @AddU32 [template = constants.%AddU32] {
  328. // CHECK:STDOUT: %a.patt: %.2 = binding_pattern a
  329. // CHECK:STDOUT: %a.param_patt: %.2 = value_param_pattern %a.patt, runtime_param0
  330. // CHECK:STDOUT: %b.patt: %.2 = binding_pattern b
  331. // CHECK:STDOUT: %b.param_patt: %.2 = value_param_pattern %b.patt, runtime_param1
  332. // CHECK:STDOUT: %return.patt: %.2 = return_slot_pattern
  333. // CHECK:STDOUT: %return.param_patt: %.2 = out_param_pattern %return.patt, runtime_param2
  334. // CHECK:STDOUT: } {
  335. // CHECK:STDOUT: %.loc6_14.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  336. // CHECK:STDOUT: %int.make_type_unsigned.loc6_14: init type = call constants.%UInt(%.loc6_14.1) [template = constants.%.2]
  337. // CHECK:STDOUT: %.loc6_14.2: type = value_of_initializer %int.make_type_unsigned.loc6_14 [template = constants.%.2]
  338. // CHECK:STDOUT: %.loc6_14.3: type = converted %int.make_type_unsigned.loc6_14, %.loc6_14.2 [template = constants.%.2]
  339. // CHECK:STDOUT: %.loc6_22.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  340. // CHECK:STDOUT: %int.make_type_unsigned.loc6_22: init type = call constants.%UInt(%.loc6_22.1) [template = constants.%.2]
  341. // CHECK:STDOUT: %.loc6_22.2: type = value_of_initializer %int.make_type_unsigned.loc6_22 [template = constants.%.2]
  342. // CHECK:STDOUT: %.loc6_22.3: type = converted %int.make_type_unsigned.loc6_22, %.loc6_22.2 [template = constants.%.2]
  343. // CHECK:STDOUT: %.loc6_30.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  344. // CHECK:STDOUT: %int.make_type_unsigned.loc6_30: init type = call constants.%UInt(%.loc6_30.1) [template = constants.%.2]
  345. // CHECK:STDOUT: %.loc6_30.2: type = value_of_initializer %int.make_type_unsigned.loc6_30 [template = constants.%.2]
  346. // CHECK:STDOUT: %.loc6_30.3: type = converted %int.make_type_unsigned.loc6_30, %.loc6_30.2 [template = constants.%.2]
  347. // CHECK:STDOUT: %a.param: %.2 = value_param runtime_param0
  348. // CHECK:STDOUT: %a: %.2 = bind_name a, %a.param
  349. // CHECK:STDOUT: %b.param: %.2 = value_param runtime_param1
  350. // CHECK:STDOUT: %b: %.2 = bind_name b, %b.param
  351. // CHECK:STDOUT: %return.param: ref %.2 = out_param runtime_param2
  352. // CHECK:STDOUT: %return: ref %.2 = return_slot %return.param
  353. // CHECK:STDOUT: }
  354. // CHECK:STDOUT: %IntLiteral.decl: %IntLiteral.type = fn_decl @IntLiteral [template = constants.%IntLiteral] {
  355. // CHECK:STDOUT: %return.patt: type = return_slot_pattern
  356. // CHECK:STDOUT: %return.param_patt: type = out_param_pattern %return.patt, runtime_param0
  357. // CHECK:STDOUT: } {
  358. // CHECK:STDOUT: %return.param: ref type = out_param runtime_param0
  359. // CHECK:STDOUT: %return: ref type = return_slot %return.param
  360. // CHECK:STDOUT: }
  361. // CHECK:STDOUT: %Int32ToInt32.decl: %Int32ToInt32.type = fn_decl @Int32ToInt32 [template = constants.%Int32ToInt32] {
  362. // CHECK:STDOUT: %a.patt: i32 = binding_pattern a
  363. // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0
  364. // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern
  365. // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1
  366. // CHECK:STDOUT: } {
  367. // CHECK:STDOUT: %int.make_type_32.loc10_20: init type = call constants.%Int32() [template = i32]
  368. // CHECK:STDOUT: %.loc10_20.1: type = value_of_initializer %int.make_type_32.loc10_20 [template = i32]
  369. // CHECK:STDOUT: %.loc10_20.2: type = converted %int.make_type_32.loc10_20, %.loc10_20.1 [template = i32]
  370. // CHECK:STDOUT: %int.make_type_32.loc10_28: init type = call constants.%Int32() [template = i32]
  371. // CHECK:STDOUT: %.loc10_28.1: type = value_of_initializer %int.make_type_32.loc10_28 [template = i32]
  372. // CHECK:STDOUT: %.loc10_28.2: type = converted %int.make_type_32.loc10_28, %.loc10_28.1 [template = i32]
  373. // CHECK:STDOUT: %a.param: i32 = value_param runtime_param0
  374. // CHECK:STDOUT: %a: i32 = bind_name a, %a.param
  375. // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1
  376. // CHECK:STDOUT: %return: ref i32 = return_slot %return.param
  377. // CHECK:STDOUT: }
  378. // CHECK:STDOUT: %Int32ToUint32.decl: %Int32ToUint32.type = fn_decl @Int32ToUint32 [template = constants.%Int32ToUint32] {
  379. // CHECK:STDOUT: %a.patt: i32 = binding_pattern a
  380. // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0
  381. // CHECK:STDOUT: %return.patt: %.2 = return_slot_pattern
  382. // CHECK:STDOUT: %return.param_patt: %.2 = out_param_pattern %return.patt, runtime_param1
  383. // CHECK:STDOUT: } {
  384. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  385. // CHECK:STDOUT: %.loc11_21.1: type = value_of_initializer %int.make_type_32 [template = i32]
  386. // CHECK:STDOUT: %.loc11_21.2: type = converted %int.make_type_32, %.loc11_21.1 [template = i32]
  387. // CHECK:STDOUT: %.loc11_29.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  388. // CHECK:STDOUT: %int.make_type_unsigned: init type = call constants.%UInt(%.loc11_29.1) [template = constants.%.2]
  389. // CHECK:STDOUT: %.loc11_29.2: type = value_of_initializer %int.make_type_unsigned [template = constants.%.2]
  390. // CHECK:STDOUT: %.loc11_29.3: type = converted %int.make_type_unsigned, %.loc11_29.2 [template = constants.%.2]
  391. // CHECK:STDOUT: %a.param: i32 = value_param runtime_param0
  392. // CHECK:STDOUT: %a: i32 = bind_name a, %a.param
  393. // CHECK:STDOUT: %return.param: ref %.2 = out_param runtime_param1
  394. // CHECK:STDOUT: %return: ref %.2 = return_slot %return.param
  395. // CHECK:STDOUT: }
  396. // CHECK:STDOUT: %Uint32ToInt32.decl: %Uint32ToInt32.type = fn_decl @Uint32ToInt32 [template = constants.%Uint32ToInt32] {
  397. // CHECK:STDOUT: %a.patt: %.2 = binding_pattern a
  398. // CHECK:STDOUT: %a.param_patt: %.2 = value_param_pattern %a.patt, runtime_param0
  399. // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern
  400. // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1
  401. // CHECK:STDOUT: } {
  402. // CHECK:STDOUT: %.loc12_21.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  403. // CHECK:STDOUT: %int.make_type_unsigned: init type = call constants.%UInt(%.loc12_21.1) [template = constants.%.2]
  404. // CHECK:STDOUT: %.loc12_21.2: type = value_of_initializer %int.make_type_unsigned [template = constants.%.2]
  405. // CHECK:STDOUT: %.loc12_21.3: type = converted %int.make_type_unsigned, %.loc12_21.2 [template = constants.%.2]
  406. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  407. // CHECK:STDOUT: %.loc12_29.1: type = value_of_initializer %int.make_type_32 [template = i32]
  408. // CHECK:STDOUT: %.loc12_29.2: type = converted %int.make_type_32, %.loc12_29.1 [template = i32]
  409. // CHECK:STDOUT: %a.param: %.2 = value_param runtime_param0
  410. // CHECK:STDOUT: %a: %.2 = bind_name a, %a.param
  411. // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1
  412. // CHECK:STDOUT: %return: ref i32 = return_slot %return.param
  413. // CHECK:STDOUT: }
  414. // CHECK:STDOUT: %Uint32ToUint32.decl: %Uint32ToUint32.type = fn_decl @Uint32ToUint32 [template = constants.%Uint32ToUint32] {
  415. // CHECK:STDOUT: %a.patt: %.2 = binding_pattern a
  416. // CHECK:STDOUT: %a.param_patt: %.2 = value_param_pattern %a.patt, runtime_param0
  417. // CHECK:STDOUT: %return.patt: %.2 = return_slot_pattern
  418. // CHECK:STDOUT: %return.param_patt: %.2 = out_param_pattern %return.patt, runtime_param1
  419. // CHECK:STDOUT: } {
  420. // CHECK:STDOUT: %.loc13_22.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  421. // CHECK:STDOUT: %int.make_type_unsigned.loc13_22: init type = call constants.%UInt(%.loc13_22.1) [template = constants.%.2]
  422. // CHECK:STDOUT: %.loc13_22.2: type = value_of_initializer %int.make_type_unsigned.loc13_22 [template = constants.%.2]
  423. // CHECK:STDOUT: %.loc13_22.3: type = converted %int.make_type_unsigned.loc13_22, %.loc13_22.2 [template = constants.%.2]
  424. // CHECK:STDOUT: %.loc13_30.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  425. // CHECK:STDOUT: %int.make_type_unsigned.loc13_30: init type = call constants.%UInt(%.loc13_30.1) [template = constants.%.2]
  426. // CHECK:STDOUT: %.loc13_30.2: type = value_of_initializer %int.make_type_unsigned.loc13_30 [template = constants.%.2]
  427. // CHECK:STDOUT: %.loc13_30.3: type = converted %int.make_type_unsigned.loc13_30, %.loc13_30.2 [template = constants.%.2]
  428. // CHECK:STDOUT: %a.param: %.2 = value_param runtime_param0
  429. // CHECK:STDOUT: %a: %.2 = bind_name a, %a.param
  430. // CHECK:STDOUT: %return.param: ref %.2 = out_param runtime_param1
  431. // CHECK:STDOUT: %return: ref %.2 = return_slot %return.param
  432. // CHECK:STDOUT: }
  433. // CHECK:STDOUT: %IntLiteralToIntLiteral.decl: %IntLiteralToIntLiteral.type = fn_decl @IntLiteralToIntLiteral [template = constants.%IntLiteralToIntLiteral] {
  434. // CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a
  435. // CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0
  436. // CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern
  437. // CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param1
  438. // CHECK:STDOUT: } {
  439. // CHECK:STDOUT: %IntLiteral.ref.loc14_30: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral]
  440. // CHECK:STDOUT: %int_literal.make_type.loc14_40: init type = call %IntLiteral.ref.loc14_30() [template = Core.IntLiteral]
  441. // CHECK:STDOUT: %.loc14_41.1: type = value_of_initializer %int_literal.make_type.loc14_40 [template = Core.IntLiteral]
  442. // CHECK:STDOUT: %.loc14_41.2: type = converted %int_literal.make_type.loc14_40, %.loc14_41.1 [template = Core.IntLiteral]
  443. // CHECK:STDOUT: %IntLiteral.ref.loc14_47: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral]
  444. // CHECK:STDOUT: %int_literal.make_type.loc14_57: init type = call %IntLiteral.ref.loc14_47() [template = Core.IntLiteral]
  445. // CHECK:STDOUT: %.loc14_58.1: type = value_of_initializer %int_literal.make_type.loc14_57 [template = Core.IntLiteral]
  446. // CHECK:STDOUT: %.loc14_58.2: type = converted %int_literal.make_type.loc14_57, %.loc14_58.1 [template = Core.IntLiteral]
  447. // CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0
  448. // CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param
  449. // CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param1
  450. // CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param
  451. // CHECK:STDOUT: }
  452. // CHECK:STDOUT: %Int32ToInt16.decl: %Int32ToInt16.type = fn_decl @Int32ToInt16 [template = constants.%Int32ToInt16] {
  453. // CHECK:STDOUT: %a.patt: i32 = binding_pattern a
  454. // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0
  455. // CHECK:STDOUT: %return.patt: %.4 = return_slot_pattern
  456. // CHECK:STDOUT: %return.param_patt: %.4 = out_param_pattern %return.patt, runtime_param1
  457. // CHECK:STDOUT: } {
  458. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  459. // CHECK:STDOUT: %.loc18_20.1: type = value_of_initializer %int.make_type_32 [template = i32]
  460. // CHECK:STDOUT: %.loc18_20.2: type = converted %int.make_type_32, %.loc18_20.1 [template = i32]
  461. // CHECK:STDOUT: %.loc18_28.1: Core.IntLiteral = int_value 16 [template = constants.%.3]
  462. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc18_28.1) [template = constants.%.4]
  463. // CHECK:STDOUT: %.loc18_28.2: type = value_of_initializer %int.make_type_signed [template = constants.%.4]
  464. // CHECK:STDOUT: %.loc18_28.3: type = converted %int.make_type_signed, %.loc18_28.2 [template = constants.%.4]
  465. // CHECK:STDOUT: %a.param: i32 = value_param runtime_param0
  466. // CHECK:STDOUT: %a: i32 = bind_name a, %a.param
  467. // CHECK:STDOUT: %return.param: ref %.4 = out_param runtime_param1
  468. // CHECK:STDOUT: %return: ref %.4 = return_slot %return.param
  469. // CHECK:STDOUT: }
  470. // CHECK:STDOUT: %Int32ToUint16.decl: %Int32ToUint16.type = fn_decl @Int32ToUint16 [template = constants.%Int32ToUint16] {
  471. // CHECK:STDOUT: %a.patt: i32 = binding_pattern a
  472. // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0
  473. // CHECK:STDOUT: %return.patt: %.5 = return_slot_pattern
  474. // CHECK:STDOUT: %return.param_patt: %.5 = out_param_pattern %return.patt, runtime_param1
  475. // CHECK:STDOUT: } {
  476. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  477. // CHECK:STDOUT: %.loc19_21.1: type = value_of_initializer %int.make_type_32 [template = i32]
  478. // CHECK:STDOUT: %.loc19_21.2: type = converted %int.make_type_32, %.loc19_21.1 [template = i32]
  479. // CHECK:STDOUT: %.loc19_29.1: Core.IntLiteral = int_value 16 [template = constants.%.3]
  480. // CHECK:STDOUT: %int.make_type_unsigned: init type = call constants.%UInt(%.loc19_29.1) [template = constants.%.5]
  481. // CHECK:STDOUT: %.loc19_29.2: type = value_of_initializer %int.make_type_unsigned [template = constants.%.5]
  482. // CHECK:STDOUT: %.loc19_29.3: type = converted %int.make_type_unsigned, %.loc19_29.2 [template = constants.%.5]
  483. // CHECK:STDOUT: %a.param: i32 = value_param runtime_param0
  484. // CHECK:STDOUT: %a: i32 = bind_name a, %a.param
  485. // CHECK:STDOUT: %return.param: ref %.5 = out_param runtime_param1
  486. // CHECK:STDOUT: %return: ref %.5 = return_slot %return.param
  487. // CHECK:STDOUT: }
  488. // CHECK:STDOUT: %Uint32ToInt16.decl: %Uint32ToInt16.type = fn_decl @Uint32ToInt16 [template = constants.%Uint32ToInt16] {
  489. // CHECK:STDOUT: %a.patt: %.2 = binding_pattern a
  490. // CHECK:STDOUT: %a.param_patt: %.2 = value_param_pattern %a.patt, runtime_param0
  491. // CHECK:STDOUT: %return.patt: %.4 = return_slot_pattern
  492. // CHECK:STDOUT: %return.param_patt: %.4 = out_param_pattern %return.patt, runtime_param1
  493. // CHECK:STDOUT: } {
  494. // CHECK:STDOUT: %.loc20_21.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  495. // CHECK:STDOUT: %int.make_type_unsigned: init type = call constants.%UInt(%.loc20_21.1) [template = constants.%.2]
  496. // CHECK:STDOUT: %.loc20_21.2: type = value_of_initializer %int.make_type_unsigned [template = constants.%.2]
  497. // CHECK:STDOUT: %.loc20_21.3: type = converted %int.make_type_unsigned, %.loc20_21.2 [template = constants.%.2]
  498. // CHECK:STDOUT: %.loc20_29.1: Core.IntLiteral = int_value 16 [template = constants.%.3]
  499. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc20_29.1) [template = constants.%.4]
  500. // CHECK:STDOUT: %.loc20_29.2: type = value_of_initializer %int.make_type_signed [template = constants.%.4]
  501. // CHECK:STDOUT: %.loc20_29.3: type = converted %int.make_type_signed, %.loc20_29.2 [template = constants.%.4]
  502. // CHECK:STDOUT: %a.param: %.2 = value_param runtime_param0
  503. // CHECK:STDOUT: %a: %.2 = bind_name a, %a.param
  504. // CHECK:STDOUT: %return.param: ref %.4 = out_param runtime_param1
  505. // CHECK:STDOUT: %return: ref %.4 = return_slot %return.param
  506. // CHECK:STDOUT: }
  507. // CHECK:STDOUT: %Uint32ToUint16.decl: %Uint32ToUint16.type = fn_decl @Uint32ToUint16 [template = constants.%Uint32ToUint16] {
  508. // CHECK:STDOUT: %a.patt: %.2 = binding_pattern a
  509. // CHECK:STDOUT: %a.param_patt: %.2 = value_param_pattern %a.patt, runtime_param0
  510. // CHECK:STDOUT: %return.patt: %.5 = return_slot_pattern
  511. // CHECK:STDOUT: %return.param_patt: %.5 = out_param_pattern %return.patt, runtime_param1
  512. // CHECK:STDOUT: } {
  513. // CHECK:STDOUT: %.loc21_22.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  514. // CHECK:STDOUT: %int.make_type_unsigned.loc21_22: init type = call constants.%UInt(%.loc21_22.1) [template = constants.%.2]
  515. // CHECK:STDOUT: %.loc21_22.2: type = value_of_initializer %int.make_type_unsigned.loc21_22 [template = constants.%.2]
  516. // CHECK:STDOUT: %.loc21_22.3: type = converted %int.make_type_unsigned.loc21_22, %.loc21_22.2 [template = constants.%.2]
  517. // CHECK:STDOUT: %.loc21_30.1: Core.IntLiteral = int_value 16 [template = constants.%.3]
  518. // CHECK:STDOUT: %int.make_type_unsigned.loc21_30: init type = call constants.%UInt(%.loc21_30.1) [template = constants.%.5]
  519. // CHECK:STDOUT: %.loc21_30.2: type = value_of_initializer %int.make_type_unsigned.loc21_30 [template = constants.%.5]
  520. // CHECK:STDOUT: %.loc21_30.3: type = converted %int.make_type_unsigned.loc21_30, %.loc21_30.2 [template = constants.%.5]
  521. // CHECK:STDOUT: %a.param: %.2 = value_param runtime_param0
  522. // CHECK:STDOUT: %a: %.2 = bind_name a, %a.param
  523. // CHECK:STDOUT: %return.param: ref %.5 = out_param runtime_param1
  524. // CHECK:STDOUT: %return: ref %.5 = return_slot %return.param
  525. // CHECK:STDOUT: }
  526. // CHECK:STDOUT: %IntLiteralToInt16.decl: %IntLiteralToInt16.type = fn_decl @IntLiteralToInt16 [template = constants.%IntLiteralToInt16] {
  527. // CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a
  528. // CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0
  529. // CHECK:STDOUT: %return.patt: %.4 = return_slot_pattern
  530. // CHECK:STDOUT: %return.param_patt: %.4 = out_param_pattern %return.patt, runtime_param1
  531. // CHECK:STDOUT: } {
  532. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral]
  533. // CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral]
  534. // CHECK:STDOUT: %.loc22_36.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral]
  535. // CHECK:STDOUT: %.loc22_36.2: type = converted %int_literal.make_type, %.loc22_36.1 [template = Core.IntLiteral]
  536. // CHECK:STDOUT: %.loc22_42.1: Core.IntLiteral = int_value 16 [template = constants.%.3]
  537. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc22_42.1) [template = constants.%.4]
  538. // CHECK:STDOUT: %.loc22_42.2: type = value_of_initializer %int.make_type_signed [template = constants.%.4]
  539. // CHECK:STDOUT: %.loc22_42.3: type = converted %int.make_type_signed, %.loc22_42.2 [template = constants.%.4]
  540. // CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0
  541. // CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param
  542. // CHECK:STDOUT: %return.param: ref %.4 = out_param runtime_param1
  543. // CHECK:STDOUT: %return: ref %.4 = return_slot %return.param
  544. // CHECK:STDOUT: }
  545. // CHECK:STDOUT: %IntLiteralToUint16.decl: %IntLiteralToUint16.type = fn_decl @IntLiteralToUint16 [template = constants.%IntLiteralToUint16] {
  546. // CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a
  547. // CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0
  548. // CHECK:STDOUT: %return.patt: %.5 = return_slot_pattern
  549. // CHECK:STDOUT: %return.param_patt: %.5 = out_param_pattern %return.patt, runtime_param1
  550. // CHECK:STDOUT: } {
  551. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral]
  552. // CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral]
  553. // CHECK:STDOUT: %.loc23_37.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral]
  554. // CHECK:STDOUT: %.loc23_37.2: type = converted %int_literal.make_type, %.loc23_37.1 [template = Core.IntLiteral]
  555. // CHECK:STDOUT: %.loc23_43.1: Core.IntLiteral = int_value 16 [template = constants.%.3]
  556. // CHECK:STDOUT: %int.make_type_unsigned: init type = call constants.%UInt(%.loc23_43.1) [template = constants.%.5]
  557. // CHECK:STDOUT: %.loc23_43.2: type = value_of_initializer %int.make_type_unsigned [template = constants.%.5]
  558. // CHECK:STDOUT: %.loc23_43.3: type = converted %int.make_type_unsigned, %.loc23_43.2 [template = constants.%.5]
  559. // CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0
  560. // CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param
  561. // CHECK:STDOUT: %return.param: ref %.5 = out_param runtime_param1
  562. // CHECK:STDOUT: %return: ref %.5 = return_slot %return.param
  563. // CHECK:STDOUT: }
  564. // CHECK:STDOUT: %Int32ToInt64.decl: %Int32ToInt64.type = fn_decl @Int32ToInt64 [template = constants.%Int32ToInt64] {
  565. // CHECK:STDOUT: %a.patt: i32 = binding_pattern a
  566. // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0
  567. // CHECK:STDOUT: %return.patt: %.7 = return_slot_pattern
  568. // CHECK:STDOUT: %return.param_patt: %.7 = out_param_pattern %return.patt, runtime_param1
  569. // CHECK:STDOUT: } {
  570. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  571. // CHECK:STDOUT: %.loc26_20.1: type = value_of_initializer %int.make_type_32 [template = i32]
  572. // CHECK:STDOUT: %.loc26_20.2: type = converted %int.make_type_32, %.loc26_20.1 [template = i32]
  573. // CHECK:STDOUT: %.loc26_28.1: Core.IntLiteral = int_value 64 [template = constants.%.6]
  574. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc26_28.1) [template = constants.%.7]
  575. // CHECK:STDOUT: %.loc26_28.2: type = value_of_initializer %int.make_type_signed [template = constants.%.7]
  576. // CHECK:STDOUT: %.loc26_28.3: type = converted %int.make_type_signed, %.loc26_28.2 [template = constants.%.7]
  577. // CHECK:STDOUT: %a.param: i32 = value_param runtime_param0
  578. // CHECK:STDOUT: %a: i32 = bind_name a, %a.param
  579. // CHECK:STDOUT: %return.param: ref %.7 = out_param runtime_param1
  580. // CHECK:STDOUT: %return: ref %.7 = return_slot %return.param
  581. // CHECK:STDOUT: }
  582. // CHECK:STDOUT: %Int32ToUint64.decl: %Int32ToUint64.type = fn_decl @Int32ToUint64 [template = constants.%Int32ToUint64] {
  583. // CHECK:STDOUT: %a.patt: i32 = binding_pattern a
  584. // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0
  585. // CHECK:STDOUT: %return.patt: %.8 = return_slot_pattern
  586. // CHECK:STDOUT: %return.param_patt: %.8 = out_param_pattern %return.patt, runtime_param1
  587. // CHECK:STDOUT: } {
  588. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  589. // CHECK:STDOUT: %.loc27_21.1: type = value_of_initializer %int.make_type_32 [template = i32]
  590. // CHECK:STDOUT: %.loc27_21.2: type = converted %int.make_type_32, %.loc27_21.1 [template = i32]
  591. // CHECK:STDOUT: %.loc27_29.1: Core.IntLiteral = int_value 64 [template = constants.%.6]
  592. // CHECK:STDOUT: %int.make_type_unsigned: init type = call constants.%UInt(%.loc27_29.1) [template = constants.%.8]
  593. // CHECK:STDOUT: %.loc27_29.2: type = value_of_initializer %int.make_type_unsigned [template = constants.%.8]
  594. // CHECK:STDOUT: %.loc27_29.3: type = converted %int.make_type_unsigned, %.loc27_29.2 [template = constants.%.8]
  595. // CHECK:STDOUT: %a.param: i32 = value_param runtime_param0
  596. // CHECK:STDOUT: %a: i32 = bind_name a, %a.param
  597. // CHECK:STDOUT: %return.param: ref %.8 = out_param runtime_param1
  598. // CHECK:STDOUT: %return: ref %.8 = return_slot %return.param
  599. // CHECK:STDOUT: }
  600. // CHECK:STDOUT: %Uint32ToInt64.decl: %Uint32ToInt64.type = fn_decl @Uint32ToInt64 [template = constants.%Uint32ToInt64] {
  601. // CHECK:STDOUT: %a.patt: %.2 = binding_pattern a
  602. // CHECK:STDOUT: %a.param_patt: %.2 = value_param_pattern %a.patt, runtime_param0
  603. // CHECK:STDOUT: %return.patt: %.7 = return_slot_pattern
  604. // CHECK:STDOUT: %return.param_patt: %.7 = out_param_pattern %return.patt, runtime_param1
  605. // CHECK:STDOUT: } {
  606. // CHECK:STDOUT: %.loc28_21.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  607. // CHECK:STDOUT: %int.make_type_unsigned: init type = call constants.%UInt(%.loc28_21.1) [template = constants.%.2]
  608. // CHECK:STDOUT: %.loc28_21.2: type = value_of_initializer %int.make_type_unsigned [template = constants.%.2]
  609. // CHECK:STDOUT: %.loc28_21.3: type = converted %int.make_type_unsigned, %.loc28_21.2 [template = constants.%.2]
  610. // CHECK:STDOUT: %.loc28_29.1: Core.IntLiteral = int_value 64 [template = constants.%.6]
  611. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc28_29.1) [template = constants.%.7]
  612. // CHECK:STDOUT: %.loc28_29.2: type = value_of_initializer %int.make_type_signed [template = constants.%.7]
  613. // CHECK:STDOUT: %.loc28_29.3: type = converted %int.make_type_signed, %.loc28_29.2 [template = constants.%.7]
  614. // CHECK:STDOUT: %a.param: %.2 = value_param runtime_param0
  615. // CHECK:STDOUT: %a: %.2 = bind_name a, %a.param
  616. // CHECK:STDOUT: %return.param: ref %.7 = out_param runtime_param1
  617. // CHECK:STDOUT: %return: ref %.7 = return_slot %return.param
  618. // CHECK:STDOUT: }
  619. // CHECK:STDOUT: %Uint32ToUint64.decl: %Uint32ToUint64.type = fn_decl @Uint32ToUint64 [template = constants.%Uint32ToUint64] {
  620. // CHECK:STDOUT: %a.patt: %.2 = binding_pattern a
  621. // CHECK:STDOUT: %a.param_patt: %.2 = value_param_pattern %a.patt, runtime_param0
  622. // CHECK:STDOUT: %return.patt: %.8 = return_slot_pattern
  623. // CHECK:STDOUT: %return.param_patt: %.8 = out_param_pattern %return.patt, runtime_param1
  624. // CHECK:STDOUT: } {
  625. // CHECK:STDOUT: %.loc29_22.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  626. // CHECK:STDOUT: %int.make_type_unsigned.loc29_22: init type = call constants.%UInt(%.loc29_22.1) [template = constants.%.2]
  627. // CHECK:STDOUT: %.loc29_22.2: type = value_of_initializer %int.make_type_unsigned.loc29_22 [template = constants.%.2]
  628. // CHECK:STDOUT: %.loc29_22.3: type = converted %int.make_type_unsigned.loc29_22, %.loc29_22.2 [template = constants.%.2]
  629. // CHECK:STDOUT: %.loc29_30.1: Core.IntLiteral = int_value 64 [template = constants.%.6]
  630. // CHECK:STDOUT: %int.make_type_unsigned.loc29_30: init type = call constants.%UInt(%.loc29_30.1) [template = constants.%.8]
  631. // CHECK:STDOUT: %.loc29_30.2: type = value_of_initializer %int.make_type_unsigned.loc29_30 [template = constants.%.8]
  632. // CHECK:STDOUT: %.loc29_30.3: type = converted %int.make_type_unsigned.loc29_30, %.loc29_30.2 [template = constants.%.8]
  633. // CHECK:STDOUT: %a.param: %.2 = value_param runtime_param0
  634. // CHECK:STDOUT: %a: %.2 = bind_name a, %a.param
  635. // CHECK:STDOUT: %return.param: ref %.8 = out_param runtime_param1
  636. // CHECK:STDOUT: %return: ref %.8 = return_slot %return.param
  637. // CHECK:STDOUT: }
  638. // CHECK:STDOUT: %Int32ToIntLiteral.decl: %Int32ToIntLiteral.type = fn_decl @Int32ToIntLiteral [template = constants.%Int32ToIntLiteral] {
  639. // CHECK:STDOUT: %a.patt: i32 = binding_pattern a
  640. // CHECK:STDOUT: %a.param_patt: i32 = value_param_pattern %a.patt, runtime_param0
  641. // CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern
  642. // CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param1
  643. // CHECK:STDOUT: } {
  644. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  645. // CHECK:STDOUT: %.loc30_25.1: type = value_of_initializer %int.make_type_32 [template = i32]
  646. // CHECK:STDOUT: %.loc30_25.2: type = converted %int.make_type_32, %.loc30_25.1 [template = i32]
  647. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral]
  648. // CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral]
  649. // CHECK:STDOUT: %.loc30_44.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral]
  650. // CHECK:STDOUT: %.loc30_44.2: type = converted %int_literal.make_type, %.loc30_44.1 [template = Core.IntLiteral]
  651. // CHECK:STDOUT: %a.param: i32 = value_param runtime_param0
  652. // CHECK:STDOUT: %a: i32 = bind_name a, %a.param
  653. // CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param1
  654. // CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param
  655. // CHECK:STDOUT: }
  656. // CHECK:STDOUT: %Uint32ToUintLiteral.decl: %Uint32ToUintLiteral.type = fn_decl @Uint32ToUintLiteral [template = constants.%Uint32ToUintLiteral] {
  657. // CHECK:STDOUT: %a.patt: %.2 = binding_pattern a
  658. // CHECK:STDOUT: %a.param_patt: %.2 = value_param_pattern %a.patt, runtime_param0
  659. // CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern
  660. // CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param1
  661. // CHECK:STDOUT: } {
  662. // CHECK:STDOUT: %.loc31_27.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  663. // CHECK:STDOUT: %int.make_type_unsigned: init type = call constants.%UInt(%.loc31_27.1) [template = constants.%.2]
  664. // CHECK:STDOUT: %.loc31_27.2: type = value_of_initializer %int.make_type_unsigned [template = constants.%.2]
  665. // CHECK:STDOUT: %.loc31_27.3: type = converted %int.make_type_unsigned, %.loc31_27.2 [template = constants.%.2]
  666. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral]
  667. // CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral]
  668. // CHECK:STDOUT: %.loc31_46.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral]
  669. // CHECK:STDOUT: %.loc31_46.2: type = converted %int_literal.make_type, %.loc31_46.1 [template = Core.IntLiteral]
  670. // CHECK:STDOUT: %a.param: %.2 = value_param runtime_param0
  671. // CHECK:STDOUT: %a: %.2 = bind_name a, %a.param
  672. // CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param1
  673. // CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param
  674. // CHECK:STDOUT: }
  675. // CHECK:STDOUT: }
  676. // CHECK:STDOUT:
  677. // CHECK:STDOUT: fn @NegateI32(%a.param_patt: i32) -> i32 = "int.snegate";
  678. // CHECK:STDOUT:
  679. // CHECK:STDOUT: fn @SubI32(%a.param_patt: i32, %b.param_patt: i32) -> i32 = "int.ssub";
  680. // CHECK:STDOUT:
  681. // CHECK:STDOUT: fn @AddU32(%a.param_patt: %.2, %b.param_patt: %.2) -> %.2 = "int.uadd";
  682. // CHECK:STDOUT:
  683. // CHECK:STDOUT: fn @IntLiteral() -> type = "int_literal.make_type";
  684. // CHECK:STDOUT:
  685. // CHECK:STDOUT: fn @Int32ToInt32(%a.param_patt: i32) -> i32 = "int.convert_checked";
  686. // CHECK:STDOUT:
  687. // CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: i32) -> %.2 = "int.convert_checked";
  688. // CHECK:STDOUT:
  689. // CHECK:STDOUT: fn @Uint32ToInt32(%a.param_patt: %.2) -> i32 = "int.convert_checked";
  690. // CHECK:STDOUT:
  691. // CHECK:STDOUT: fn @Uint32ToUint32(%a.param_patt: %.2) -> %.2 = "int.convert_checked";
  692. // CHECK:STDOUT:
  693. // CHECK:STDOUT: fn @IntLiteralToIntLiteral(%a.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.convert_checked";
  694. // CHECK:STDOUT:
  695. // CHECK:STDOUT: fn @Int32ToInt16(%a.param_patt: i32) -> %.4 = "int.convert_checked";
  696. // CHECK:STDOUT:
  697. // CHECK:STDOUT: fn @Int32ToUint16(%a.param_patt: i32) -> %.5 = "int.convert_checked";
  698. // CHECK:STDOUT:
  699. // CHECK:STDOUT: fn @Uint32ToInt16(%a.param_patt: %.2) -> %.4 = "int.convert_checked";
  700. // CHECK:STDOUT:
  701. // CHECK:STDOUT: fn @Uint32ToUint16(%a.param_patt: %.2) -> %.5 = "int.convert_checked";
  702. // CHECK:STDOUT:
  703. // CHECK:STDOUT: fn @IntLiteralToInt16(%a.param_patt: Core.IntLiteral) -> %.4 = "int.convert_checked";
  704. // CHECK:STDOUT:
  705. // CHECK:STDOUT: fn @IntLiteralToUint16(%a.param_patt: Core.IntLiteral) -> %.5 = "int.convert_checked";
  706. // CHECK:STDOUT:
  707. // CHECK:STDOUT: fn @Int32ToInt64(%a.param_patt: i32) -> %.7 = "int.convert_checked";
  708. // CHECK:STDOUT:
  709. // CHECK:STDOUT: fn @Int32ToUint64(%a.param_patt: i32) -> %.8 = "int.convert_checked";
  710. // CHECK:STDOUT:
  711. // CHECK:STDOUT: fn @Uint32ToInt64(%a.param_patt: %.2) -> %.7 = "int.convert_checked";
  712. // CHECK:STDOUT:
  713. // CHECK:STDOUT: fn @Uint32ToUint64(%a.param_patt: %.2) -> %.8 = "int.convert_checked";
  714. // CHECK:STDOUT:
  715. // CHECK:STDOUT: fn @Int32ToIntLiteral(%a.param_patt: i32) -> Core.IntLiteral = "int.convert_checked";
  716. // CHECK:STDOUT:
  717. // CHECK:STDOUT: fn @Uint32ToUintLiteral(%a.param_patt: %.2) -> Core.IntLiteral = "int.convert_checked";
  718. // CHECK:STDOUT:
  719. // CHECK:STDOUT: --- identity.carbon
  720. // CHECK:STDOUT:
  721. // CHECK:STDOUT: constants {
  722. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  723. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  724. // CHECK:STDOUT: %Int32ToInt32.type: type = fn_type @Int32ToInt32 [template]
  725. // CHECK:STDOUT: %Int32ToInt32: %Int32ToInt32.type = struct_value () [template]
  726. // CHECK:STDOUT: %.1: i32 = int_value 0 [template]
  727. // CHECK:STDOUT: %.2: i32 = int_value 2147483647 [template]
  728. // CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template]
  729. // CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template]
  730. // CHECK:STDOUT: %NegateI32.type: type = fn_type @NegateI32 [template]
  731. // CHECK:STDOUT: %NegateI32: %NegateI32.type = struct_value () [template]
  732. // CHECK:STDOUT: %.3: i32 = int_value -2147483647 [template]
  733. // CHECK:STDOUT: %.4: i32 = int_value 1 [template]
  734. // CHECK:STDOUT: %.5: i32 = int_value -2147483648 [template]
  735. // CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template]
  736. // CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template]
  737. // CHECK:STDOUT: %IntLiteralToIntLiteral.type: type = fn_type @IntLiteralToIntLiteral [template]
  738. // CHECK:STDOUT: %IntLiteralToIntLiteral: %IntLiteralToIntLiteral.type = struct_value () [template]
  739. // CHECK:STDOUT: %Int32ToIntLiteral.type: type = fn_type @Int32ToIntLiteral [template]
  740. // CHECK:STDOUT: %Int32ToIntLiteral: %Int32ToIntLiteral.type = struct_value () [template]
  741. // CHECK:STDOUT: %.6: i32 = int_value -1 [template]
  742. // CHECK:STDOUT: %.7: Core.IntLiteral = int_value -1 [template]
  743. // CHECK:STDOUT: }
  744. // CHECK:STDOUT:
  745. // CHECK:STDOUT: imports {
  746. // CHECK:STDOUT: %import_ref.1: %NegateI32.type = import_ref Main//int_ops, inst+25, loaded [template = constants.%NegateI32]
  747. // CHECK:STDOUT: %import_ref.2: %SubI32.type = import_ref Main//int_ops, inst+49, loaded [template = constants.%SubI32]
  748. // CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, inst+89, unloaded
  749. // CHECK:STDOUT: %import_ref.4: %IntLiteral.type = import_ref Main//int_ops, inst+96, loaded [template = constants.%IntLiteral]
  750. // CHECK:STDOUT: %import_ref.5: %Int32ToInt32.type = import_ref Main//int_ops, inst+113, loaded [template = constants.%Int32ToInt32]
  751. // CHECK:STDOUT: %import_ref.6 = import_ref Main//int_ops, inst+131, unloaded
  752. // CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, inst+149, unloaded
  753. // CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, inst+168, unloaded
  754. // CHECK:STDOUT: %import_ref.9: %IntLiteralToIntLiteral.type = import_ref Main//int_ops, inst+187, loaded [template = constants.%IntLiteralToIntLiteral]
  755. // CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, inst+218, unloaded
  756. // CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, inst+237, unloaded
  757. // CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, inst+256, unloaded
  758. // CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, inst+275, unloaded
  759. // CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, inst+294, unloaded
  760. // CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, inst+313, unloaded
  761. // CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, inst+333, unloaded
  762. // CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, inst+352, unloaded
  763. // CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, inst+371, unloaded
  764. // CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, inst+390, unloaded
  765. // CHECK:STDOUT: %import_ref.20: %Int32ToIntLiteral.type = import_ref Main//int_ops, inst+408, loaded [template = constants.%Int32ToIntLiteral]
  766. // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded
  767. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  768. // CHECK:STDOUT: .Int32 = %import_ref.22
  769. // CHECK:STDOUT: import Core//prelude
  770. // CHECK:STDOUT: import Core//prelude/...
  771. // CHECK:STDOUT: }
  772. // CHECK:STDOUT: }
  773. // CHECK:STDOUT:
  774. // CHECK:STDOUT: file {
  775. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  776. // CHECK:STDOUT: .NegateI32 = imports.%import_ref.1
  777. // CHECK:STDOUT: .SubI32 = imports.%import_ref.2
  778. // CHECK:STDOUT: .AddU32 = imports.%import_ref.3
  779. // CHECK:STDOUT: .IntLiteral = imports.%import_ref.4
  780. // CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5
  781. // CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6
  782. // CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7
  783. // CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8
  784. // CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9
  785. // CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10
  786. // CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11
  787. // CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12
  788. // CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13
  789. // CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14
  790. // CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15
  791. // CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16
  792. // CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17
  793. // CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18
  794. // CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19
  795. // CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20
  796. // CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21
  797. // CHECK:STDOUT: .Core = imports.%Core
  798. // CHECK:STDOUT: .a = @__global_init.%a
  799. // CHECK:STDOUT: .b = @__global_init.%b
  800. // CHECK:STDOUT: .c = @__global_init.%c
  801. // CHECK:STDOUT: .d = @__global_init.%d
  802. // CHECK:STDOUT: }
  803. // CHECK:STDOUT: %Core.import = import Core
  804. // CHECK:STDOUT: %default.import = import <invalid>
  805. // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32]
  806. // CHECK:STDOUT: %.loc5_8.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32]
  807. // CHECK:STDOUT: %.loc5_8.2: type = converted %int.make_type_32.loc5, %.loc5_8.1 [template = i32]
  808. // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32]
  809. // CHECK:STDOUT: %.loc6_8.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32]
  810. // CHECK:STDOUT: %.loc6_8.2: type = converted %int.make_type_32.loc6, %.loc6_8.1 [template = i32]
  811. // CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%Int32() [template = i32]
  812. // CHECK:STDOUT: %.loc7_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32]
  813. // CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32]
  814. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.4 [template = constants.%IntLiteral]
  815. // CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral]
  816. // CHECK:STDOUT: %.loc8_19.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral]
  817. // CHECK:STDOUT: %.loc8_19.2: type = converted %int_literal.make_type, %.loc8_19.1 [template = Core.IntLiteral]
  818. // CHECK:STDOUT: }
  819. // CHECK:STDOUT:
  820. // CHECK:STDOUT: fn @Int32ToInt32(%a.param_patt: i32) -> i32 = "int.convert_checked";
  821. // CHECK:STDOUT:
  822. // CHECK:STDOUT: fn @SubI32(%a.param_patt: i32, %b.param_patt: i32) -> i32 = "int.ssub";
  823. // CHECK:STDOUT:
  824. // CHECK:STDOUT: fn @NegateI32(%a.param_patt: i32) -> i32 = "int.snegate";
  825. // CHECK:STDOUT:
  826. // CHECK:STDOUT: fn @IntLiteral() -> type = "int_literal.make_type";
  827. // CHECK:STDOUT:
  828. // CHECK:STDOUT: fn @IntLiteralToIntLiteral(%a.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.convert_checked";
  829. // CHECK:STDOUT:
  830. // CHECK:STDOUT: fn @Int32ToIntLiteral(%a.param_patt: i32) -> Core.IntLiteral = "int.convert_checked";
  831. // CHECK:STDOUT:
  832. // CHECK:STDOUT: fn @__global_init() {
  833. // CHECK:STDOUT: !entry:
  834. // CHECK:STDOUT: %Int32ToInt32.ref.loc5: %Int32ToInt32.type = name_ref Int32ToInt32, imports.%import_ref.5 [template = constants.%Int32ToInt32]
  835. // CHECK:STDOUT: %.loc5_27: i32 = int_value 0 [template = constants.%.1]
  836. // CHECK:STDOUT: %int.convert_checked.loc5: init i32 = call %Int32ToInt32.ref.loc5(%.loc5_27) [template = constants.%.1]
  837. // CHECK:STDOUT: %.loc5_29.1: i32 = value_of_initializer %int.convert_checked.loc5 [template = constants.%.1]
  838. // CHECK:STDOUT: %.loc5_29.2: i32 = converted %int.convert_checked.loc5, %.loc5_29.1 [template = constants.%.1]
  839. // CHECK:STDOUT: %a: i32 = bind_name a, %.loc5_29.2
  840. // CHECK:STDOUT: %Int32ToInt32.ref.loc6: %Int32ToInt32.type = name_ref Int32ToInt32, imports.%import_ref.5 [template = constants.%Int32ToInt32]
  841. // CHECK:STDOUT: %.loc6_27: i32 = int_value 2147483647 [template = constants.%.2]
  842. // CHECK:STDOUT: %int.convert_checked.loc6: init i32 = call %Int32ToInt32.ref.loc6(%.loc6_27) [template = constants.%.2]
  843. // CHECK:STDOUT: %.loc6_39.1: i32 = value_of_initializer %int.convert_checked.loc6 [template = constants.%.2]
  844. // CHECK:STDOUT: %.loc6_39.2: i32 = converted %int.convert_checked.loc6, %.loc6_39.1 [template = constants.%.2]
  845. // CHECK:STDOUT: %b: i32 = bind_name b, %.loc6_39.2
  846. // CHECK:STDOUT: %Int32ToInt32.ref.loc7: %Int32ToInt32.type = name_ref Int32ToInt32, imports.%import_ref.5 [template = constants.%Int32ToInt32]
  847. // CHECK:STDOUT: %SubI32.ref: %SubI32.type = name_ref SubI32, imports.%import_ref.2 [template = constants.%SubI32]
  848. // CHECK:STDOUT: %NegateI32.ref.loc7: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32]
  849. // CHECK:STDOUT: %.loc7_44: i32 = int_value 2147483647 [template = constants.%.2]
  850. // CHECK:STDOUT: %int.snegate.loc7: init i32 = call %NegateI32.ref.loc7(%.loc7_44) [template = constants.%.3]
  851. // CHECK:STDOUT: %.loc7_58: i32 = int_value 1 [template = constants.%.4]
  852. // CHECK:STDOUT: %.loc7_43.1: i32 = value_of_initializer %int.snegate.loc7 [template = constants.%.3]
  853. // CHECK:STDOUT: %.loc7_43.2: i32 = converted %int.snegate.loc7, %.loc7_43.1 [template = constants.%.3]
  854. // CHECK:STDOUT: %int.ssub: init i32 = call %SubI32.ref(%.loc7_43.2, %.loc7_58) [template = constants.%.5]
  855. // CHECK:STDOUT: %.loc7_33.1: i32 = value_of_initializer %int.ssub [template = constants.%.5]
  856. // CHECK:STDOUT: %.loc7_33.2: i32 = converted %int.ssub, %.loc7_33.1 [template = constants.%.5]
  857. // CHECK:STDOUT: %int.convert_checked.loc7: init i32 = call %Int32ToInt32.ref.loc7(%.loc7_33.2) [template = constants.%.5]
  858. // CHECK:STDOUT: %.loc7_61.1: i32 = value_of_initializer %int.convert_checked.loc7 [template = constants.%.5]
  859. // CHECK:STDOUT: %.loc7_61.2: i32 = converted %int.convert_checked.loc7, %.loc7_61.1 [template = constants.%.5]
  860. // CHECK:STDOUT: %c: i32 = bind_name c, %.loc7_61.2
  861. // CHECK:STDOUT: %IntLiteralToIntLiteral.ref: %IntLiteralToIntLiteral.type = name_ref IntLiteralToIntLiteral, imports.%import_ref.9 [template = constants.%IntLiteralToIntLiteral]
  862. // CHECK:STDOUT: %Int32ToIntLiteral.ref: %Int32ToIntLiteral.type = name_ref Int32ToIntLiteral, imports.%import_ref.20 [template = constants.%Int32ToIntLiteral]
  863. // CHECK:STDOUT: %NegateI32.ref.loc8: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32]
  864. // CHECK:STDOUT: %.loc8_74: i32 = int_value 1 [template = constants.%.4]
  865. // CHECK:STDOUT: %int.snegate.loc8: init i32 = call %NegateI32.ref.loc8(%.loc8_74) [template = constants.%.6]
  866. // CHECK:STDOUT: %.loc8_73.1: i32 = value_of_initializer %int.snegate.loc8 [template = constants.%.6]
  867. // CHECK:STDOUT: %.loc8_73.2: i32 = converted %int.snegate.loc8, %.loc8_73.1 [template = constants.%.6]
  868. // CHECK:STDOUT: %int.convert_checked.loc8_63: init Core.IntLiteral = call %Int32ToIntLiteral.ref(%.loc8_73.2) [template = constants.%.7]
  869. // CHECK:STDOUT: %.loc8_63.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc8_63 [template = constants.%.7]
  870. // CHECK:STDOUT: %.loc8_63.2: Core.IntLiteral = converted %int.convert_checked.loc8_63, %.loc8_63.1 [template = constants.%.7]
  871. // CHECK:STDOUT: %int.convert_checked.loc8_45: init Core.IntLiteral = call %IntLiteralToIntLiteral.ref(%.loc8_63.2) [template = constants.%.7]
  872. // CHECK:STDOUT: %.loc8_78.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc8_45 [template = constants.%.7]
  873. // CHECK:STDOUT: %.loc8_78.2: Core.IntLiteral = converted %int.convert_checked.loc8_45, %.loc8_78.1 [template = constants.%.7]
  874. // CHECK:STDOUT: %d: Core.IntLiteral = bind_name d, %.loc8_78.2
  875. // CHECK:STDOUT: return
  876. // CHECK:STDOUT: }
  877. // CHECK:STDOUT:
  878. // CHECK:STDOUT: --- same_size.carbon
  879. // CHECK:STDOUT:
  880. // CHECK:STDOUT: constants {
  881. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32 [template]
  882. // CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template]
  883. // CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template]
  884. // CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template]
  885. // CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template]
  886. // CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template]
  887. // CHECK:STDOUT: %.3: i32 = int_value 2147483647 [template]
  888. // CHECK:STDOUT: %.4: %.2 = int_value 2147483647 [template]
  889. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  890. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  891. // CHECK:STDOUT: %Uint32ToInt32.type: type = fn_type @Uint32ToInt32 [template]
  892. // CHECK:STDOUT: %Uint32ToInt32: %Uint32ToInt32.type = struct_value () [template]
  893. // CHECK:STDOUT: }
  894. // CHECK:STDOUT:
  895. // CHECK:STDOUT: imports {
  896. // CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, inst+25, unloaded
  897. // CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, inst+49, unloaded
  898. // CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, inst+89, unloaded
  899. // CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, inst+96, unloaded
  900. // CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, inst+113, unloaded
  901. // CHECK:STDOUT: %import_ref.6: %Int32ToUint32.type = import_ref Main//int_ops, inst+131, loaded [template = constants.%Int32ToUint32]
  902. // CHECK:STDOUT: %import_ref.7: %Uint32ToInt32.type = import_ref Main//int_ops, inst+149, loaded [template = constants.%Uint32ToInt32]
  903. // CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, inst+168, unloaded
  904. // CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, inst+187, unloaded
  905. // CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, inst+218, unloaded
  906. // CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, inst+237, unloaded
  907. // CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, inst+256, unloaded
  908. // CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, inst+275, unloaded
  909. // CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, inst+294, unloaded
  910. // CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, inst+313, unloaded
  911. // CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, inst+333, unloaded
  912. // CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, inst+352, unloaded
  913. // CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, inst+371, unloaded
  914. // CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, inst+390, unloaded
  915. // CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, inst+408, unloaded
  916. // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded
  917. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  918. // CHECK:STDOUT: .UInt = %import_ref.22
  919. // CHECK:STDOUT: .Int32 = %import_ref.23
  920. // CHECK:STDOUT: import Core//prelude
  921. // CHECK:STDOUT: import Core//prelude/...
  922. // CHECK:STDOUT: }
  923. // CHECK:STDOUT: }
  924. // CHECK:STDOUT:
  925. // CHECK:STDOUT: file {
  926. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  927. // CHECK:STDOUT: .NegateI32 = imports.%import_ref.1
  928. // CHECK:STDOUT: .SubI32 = imports.%import_ref.2
  929. // CHECK:STDOUT: .AddU32 = imports.%import_ref.3
  930. // CHECK:STDOUT: .IntLiteral = imports.%import_ref.4
  931. // CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5
  932. // CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6
  933. // CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7
  934. // CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8
  935. // CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9
  936. // CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10
  937. // CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11
  938. // CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12
  939. // CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13
  940. // CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14
  941. // CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15
  942. // CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16
  943. // CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17
  944. // CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18
  945. // CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19
  946. // CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20
  947. // CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21
  948. // CHECK:STDOUT: .Core = imports.%Core
  949. // CHECK:STDOUT: .max = @__global_init.%max
  950. // CHECK:STDOUT: .max_roundtrip = @__global_init.%max_roundtrip
  951. // CHECK:STDOUT: }
  952. // CHECK:STDOUT: %Core.import = import Core
  953. // CHECK:STDOUT: %default.import = import <invalid>
  954. // CHECK:STDOUT: %.loc5_10.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  955. // CHECK:STDOUT: %int.make_type_unsigned: init type = call constants.%UInt(%.loc5_10.1) [template = constants.%.2]
  956. // CHECK:STDOUT: %.loc5_10.2: type = value_of_initializer %int.make_type_unsigned [template = constants.%.2]
  957. // CHECK:STDOUT: %.loc5_10.3: type = converted %int.make_type_unsigned, %.loc5_10.2 [template = constants.%.2]
  958. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  959. // CHECK:STDOUT: %.loc6_20.1: type = value_of_initializer %int.make_type_32 [template = i32]
  960. // CHECK:STDOUT: %.loc6_20.2: type = converted %int.make_type_32, %.loc6_20.1 [template = i32]
  961. // CHECK:STDOUT: }
  962. // CHECK:STDOUT:
  963. // CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: i32) -> %.2 = "int.convert_checked";
  964. // CHECK:STDOUT:
  965. // CHECK:STDOUT: fn @Uint32ToInt32(%a.param_patt: %.2) -> i32 = "int.convert_checked";
  966. // CHECK:STDOUT:
  967. // CHECK:STDOUT: fn @__global_init() {
  968. // CHECK:STDOUT: !entry:
  969. // CHECK:STDOUT: %Int32ToUint32.ref.loc5: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  970. // CHECK:STDOUT: %.loc5_30: i32 = int_value 2147483647 [template = constants.%.3]
  971. // CHECK:STDOUT: %int.convert_checked.loc5: init %.2 = call %Int32ToUint32.ref.loc5(%.loc5_30) [template = constants.%.4]
  972. // CHECK:STDOUT: %.loc5_42.1: %.2 = value_of_initializer %int.convert_checked.loc5 [template = constants.%.4]
  973. // CHECK:STDOUT: %.loc5_42.2: %.2 = converted %int.convert_checked.loc5, %.loc5_42.1 [template = constants.%.4]
  974. // CHECK:STDOUT: %max: %.2 = bind_name max, %.loc5_42.2
  975. // CHECK:STDOUT: %Uint32ToInt32.ref: %Uint32ToInt32.type = name_ref Uint32ToInt32, imports.%import_ref.7 [template = constants.%Uint32ToInt32]
  976. // CHECK:STDOUT: %Int32ToUint32.ref.loc6: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  977. // CHECK:STDOUT: %.loc6_54: i32 = int_value 2147483647 [template = constants.%.3]
  978. // CHECK:STDOUT: %int.convert_checked.loc6_53: init %.2 = call %Int32ToUint32.ref.loc6(%.loc6_54) [template = constants.%.4]
  979. // CHECK:STDOUT: %.loc6_53.1: %.2 = value_of_initializer %int.convert_checked.loc6_53 [template = constants.%.4]
  980. // CHECK:STDOUT: %.loc6_53.2: %.2 = converted %int.convert_checked.loc6_53, %.loc6_53.1 [template = constants.%.4]
  981. // CHECK:STDOUT: %int.convert_checked.loc6_39: init i32 = call %Uint32ToInt32.ref(%.loc6_53.2) [template = constants.%.3]
  982. // CHECK:STDOUT: %.loc6_67.1: i32 = value_of_initializer %int.convert_checked.loc6_39 [template = constants.%.3]
  983. // CHECK:STDOUT: %.loc6_67.2: i32 = converted %int.convert_checked.loc6_39, %.loc6_67.1 [template = constants.%.3]
  984. // CHECK:STDOUT: %max_roundtrip: i32 = bind_name max_roundtrip, %.loc6_67.2
  985. // CHECK:STDOUT: return
  986. // CHECK:STDOUT: }
  987. // CHECK:STDOUT:
  988. // CHECK:STDOUT: --- truncate.carbon
  989. // CHECK:STDOUT:
  990. // CHECK:STDOUT: constants {
  991. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 16 [template]
  992. // CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template]
  993. // CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template]
  994. // CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template]
  995. // CHECK:STDOUT: %Int32ToUint16.type: type = fn_type @Int32ToUint16 [template]
  996. // CHECK:STDOUT: %Int32ToUint16: %Int32ToUint16.type = struct_value () [template]
  997. // CHECK:STDOUT: %.3: i32 = int_value 0 [template]
  998. // CHECK:STDOUT: %.4: %.2 = int_value 0 [template]
  999. // CHECK:STDOUT: %.5: i32 = int_value 65535 [template]
  1000. // CHECK:STDOUT: %.6: %.2 = int_value 65535 [template]
  1001. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  1002. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  1003. // CHECK:STDOUT: %.7: type = int_type signed, %.1 [template]
  1004. // CHECK:STDOUT: %Int32ToInt16.type: type = fn_type @Int32ToInt16 [template]
  1005. // CHECK:STDOUT: %Int32ToInt16: %Int32ToInt16.type = struct_value () [template]
  1006. // CHECK:STDOUT: %.8: i32 = int_value 32767 [template]
  1007. // CHECK:STDOUT: %.9: %.7 = int_value 32767 [template]
  1008. // CHECK:STDOUT: %NegateI32.type: type = fn_type @NegateI32 [template]
  1009. // CHECK:STDOUT: %NegateI32: %NegateI32.type = struct_value () [template]
  1010. // CHECK:STDOUT: %.10: i32 = int_value 32768 [template]
  1011. // CHECK:STDOUT: %.11: i32 = int_value -32768 [template]
  1012. // CHECK:STDOUT: %.12: %.7 = int_value -32768 [template]
  1013. // CHECK:STDOUT: %Uint32ToUint16.type: type = fn_type @Uint32ToUint16 [template]
  1014. // CHECK:STDOUT: %Uint32ToUint16: %Uint32ToUint16.type = struct_value () [template]
  1015. // CHECK:STDOUT: %.13: Core.IntLiteral = int_value 32 [template]
  1016. // CHECK:STDOUT: %.14: type = int_type unsigned, %.13 [template]
  1017. // CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template]
  1018. // CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template]
  1019. // CHECK:STDOUT: %.15: %.14 = int_value 0 [template]
  1020. // CHECK:STDOUT: %.16: %.14 = int_value 65535 [template]
  1021. // CHECK:STDOUT: %Uint32ToInt16.type: type = fn_type @Uint32ToInt16 [template]
  1022. // CHECK:STDOUT: %Uint32ToInt16: %Uint32ToInt16.type = struct_value () [template]
  1023. // CHECK:STDOUT: %.17: %.7 = int_value 0 [template]
  1024. // CHECK:STDOUT: %.18: %.14 = int_value 32767 [template]
  1025. // CHECK:STDOUT: %IntLiteralToInt16.type: type = fn_type @IntLiteralToInt16 [template]
  1026. // CHECK:STDOUT: %IntLiteralToInt16: %IntLiteralToInt16.type = struct_value () [template]
  1027. // CHECK:STDOUT: %Int32ToIntLiteral.type: type = fn_type @Int32ToIntLiteral [template]
  1028. // CHECK:STDOUT: %Int32ToIntLiteral: %Int32ToIntLiteral.type = struct_value () [template]
  1029. // CHECK:STDOUT: %.19: Core.IntLiteral = int_value -32768 [template]
  1030. // CHECK:STDOUT: %.20: Core.IntLiteral = int_value 32767 [template]
  1031. // CHECK:STDOUT: %IntLiteralToUint16.type: type = fn_type @IntLiteralToUint16 [template]
  1032. // CHECK:STDOUT: %IntLiteralToUint16: %IntLiteralToUint16.type = struct_value () [template]
  1033. // CHECK:STDOUT: %.21: Core.IntLiteral = int_value 0 [template]
  1034. // CHECK:STDOUT: %.22: Core.IntLiteral = int_value 65535 [template]
  1035. // CHECK:STDOUT: }
  1036. // CHECK:STDOUT:
  1037. // CHECK:STDOUT: imports {
  1038. // CHECK:STDOUT: %import_ref.1: %NegateI32.type = import_ref Main//int_ops, inst+25, loaded [template = constants.%NegateI32]
  1039. // CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, inst+49, unloaded
  1040. // CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, inst+89, unloaded
  1041. // CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, inst+96, unloaded
  1042. // CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, inst+113, unloaded
  1043. // CHECK:STDOUT: %import_ref.6: %Int32ToUint32.type = import_ref Main//int_ops, inst+131, loaded [template = constants.%Int32ToUint32]
  1044. // CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, inst+149, unloaded
  1045. // CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, inst+168, unloaded
  1046. // CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, inst+187, unloaded
  1047. // CHECK:STDOUT: %import_ref.10: %Int32ToInt16.type = import_ref Main//int_ops, inst+218, loaded [template = constants.%Int32ToInt16]
  1048. // CHECK:STDOUT: %import_ref.11: %Int32ToUint16.type = import_ref Main//int_ops, inst+237, loaded [template = constants.%Int32ToUint16]
  1049. // CHECK:STDOUT: %import_ref.12: %Uint32ToInt16.type = import_ref Main//int_ops, inst+256, loaded [template = constants.%Uint32ToInt16]
  1050. // CHECK:STDOUT: %import_ref.13: %Uint32ToUint16.type = import_ref Main//int_ops, inst+275, loaded [template = constants.%Uint32ToUint16]
  1051. // CHECK:STDOUT: %import_ref.14: %IntLiteralToInt16.type = import_ref Main//int_ops, inst+294, loaded [template = constants.%IntLiteralToInt16]
  1052. // CHECK:STDOUT: %import_ref.15: %IntLiteralToUint16.type = import_ref Main//int_ops, inst+313, loaded [template = constants.%IntLiteralToUint16]
  1053. // CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, inst+333, unloaded
  1054. // CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, inst+352, unloaded
  1055. // CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, inst+371, unloaded
  1056. // CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, inst+390, unloaded
  1057. // CHECK:STDOUT: %import_ref.20: %Int32ToIntLiteral.type = import_ref Main//int_ops, inst+408, loaded [template = constants.%Int32ToIntLiteral]
  1058. // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded
  1059. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1060. // CHECK:STDOUT: .UInt = %import_ref.22
  1061. // CHECK:STDOUT: .Int = %import_ref.23
  1062. // CHECK:STDOUT: import Core//prelude
  1063. // CHECK:STDOUT: import Core//prelude/...
  1064. // CHECK:STDOUT: }
  1065. // CHECK:STDOUT: }
  1066. // CHECK:STDOUT:
  1067. // CHECK:STDOUT: file {
  1068. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1069. // CHECK:STDOUT: .NegateI32 = imports.%import_ref.1
  1070. // CHECK:STDOUT: .SubI32 = imports.%import_ref.2
  1071. // CHECK:STDOUT: .AddU32 = imports.%import_ref.3
  1072. // CHECK:STDOUT: .IntLiteral = imports.%import_ref.4
  1073. // CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5
  1074. // CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6
  1075. // CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7
  1076. // CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8
  1077. // CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9
  1078. // CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10
  1079. // CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11
  1080. // CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12
  1081. // CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13
  1082. // CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14
  1083. // CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15
  1084. // CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16
  1085. // CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17
  1086. // CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18
  1087. // CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19
  1088. // CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20
  1089. // CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21
  1090. // CHECK:STDOUT: .Core = imports.%Core
  1091. // CHECK:STDOUT: .a = @__global_init.%a
  1092. // CHECK:STDOUT: .b = @__global_init.%b
  1093. // CHECK:STDOUT: .c = @__global_init.%c
  1094. // CHECK:STDOUT: .d = @__global_init.%d
  1095. // CHECK:STDOUT: .e = @__global_init.%e
  1096. // CHECK:STDOUT: .f = @__global_init.%f
  1097. // CHECK:STDOUT: .g = @__global_init.%g
  1098. // CHECK:STDOUT: .h = @__global_init.%h
  1099. // CHECK:STDOUT: .lit_i16_min = @__global_init.%lit_i16_min
  1100. // CHECK:STDOUT: .lit_i16_max = @__global_init.%lit_i16_max
  1101. // CHECK:STDOUT: .lit_u16_min = @__global_init.%lit_u16_min
  1102. // CHECK:STDOUT: .lit_u16_max = @__global_init.%lit_u16_max
  1103. // CHECK:STDOUT: }
  1104. // CHECK:STDOUT: %Core.import = import Core
  1105. // CHECK:STDOUT: %default.import = import <invalid>
  1106. // CHECK:STDOUT: %.loc5_8.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  1107. // CHECK:STDOUT: %int.make_type_unsigned.loc5: init type = call constants.%UInt(%.loc5_8.1) [template = constants.%.2]
  1108. // CHECK:STDOUT: %.loc5_8.2: type = value_of_initializer %int.make_type_unsigned.loc5 [template = constants.%.2]
  1109. // CHECK:STDOUT: %.loc5_8.3: type = converted %int.make_type_unsigned.loc5, %.loc5_8.2 [template = constants.%.2]
  1110. // CHECK:STDOUT: %.loc6_8.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  1111. // CHECK:STDOUT: %int.make_type_unsigned.loc6: init type = call constants.%UInt(%.loc6_8.1) [template = constants.%.2]
  1112. // CHECK:STDOUT: %.loc6_8.2: type = value_of_initializer %int.make_type_unsigned.loc6 [template = constants.%.2]
  1113. // CHECK:STDOUT: %.loc6_8.3: type = converted %int.make_type_unsigned.loc6, %.loc6_8.2 [template = constants.%.2]
  1114. // CHECK:STDOUT: %.loc8_8.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  1115. // CHECK:STDOUT: %int.make_type_signed.loc8: init type = call constants.%Int(%.loc8_8.1) [template = constants.%.7]
  1116. // CHECK:STDOUT: %.loc8_8.2: type = value_of_initializer %int.make_type_signed.loc8 [template = constants.%.7]
  1117. // CHECK:STDOUT: %.loc8_8.3: type = converted %int.make_type_signed.loc8, %.loc8_8.2 [template = constants.%.7]
  1118. // CHECK:STDOUT: %.loc9_8.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  1119. // CHECK:STDOUT: %int.make_type_signed.loc9: init type = call constants.%Int(%.loc9_8.1) [template = constants.%.7]
  1120. // CHECK:STDOUT: %.loc9_8.2: type = value_of_initializer %int.make_type_signed.loc9 [template = constants.%.7]
  1121. // CHECK:STDOUT: %.loc9_8.3: type = converted %int.make_type_signed.loc9, %.loc9_8.2 [template = constants.%.7]
  1122. // CHECK:STDOUT: %.loc11_8.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  1123. // CHECK:STDOUT: %int.make_type_unsigned.loc11: init type = call constants.%UInt(%.loc11_8.1) [template = constants.%.2]
  1124. // CHECK:STDOUT: %.loc11_8.2: type = value_of_initializer %int.make_type_unsigned.loc11 [template = constants.%.2]
  1125. // CHECK:STDOUT: %.loc11_8.3: type = converted %int.make_type_unsigned.loc11, %.loc11_8.2 [template = constants.%.2]
  1126. // CHECK:STDOUT: %.loc12_8.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  1127. // CHECK:STDOUT: %int.make_type_unsigned.loc12: init type = call constants.%UInt(%.loc12_8.1) [template = constants.%.2]
  1128. // CHECK:STDOUT: %.loc12_8.2: type = value_of_initializer %int.make_type_unsigned.loc12 [template = constants.%.2]
  1129. // CHECK:STDOUT: %.loc12_8.3: type = converted %int.make_type_unsigned.loc12, %.loc12_8.2 [template = constants.%.2]
  1130. // CHECK:STDOUT: %.loc14_8.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  1131. // CHECK:STDOUT: %int.make_type_signed.loc14: init type = call constants.%Int(%.loc14_8.1) [template = constants.%.7]
  1132. // CHECK:STDOUT: %.loc14_8.2: type = value_of_initializer %int.make_type_signed.loc14 [template = constants.%.7]
  1133. // CHECK:STDOUT: %.loc14_8.3: type = converted %int.make_type_signed.loc14, %.loc14_8.2 [template = constants.%.7]
  1134. // CHECK:STDOUT: %.loc15_8.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  1135. // CHECK:STDOUT: %int.make_type_signed.loc15: init type = call constants.%Int(%.loc15_8.1) [template = constants.%.7]
  1136. // CHECK:STDOUT: %.loc15_8.2: type = value_of_initializer %int.make_type_signed.loc15 [template = constants.%.7]
  1137. // CHECK:STDOUT: %.loc15_8.3: type = converted %int.make_type_signed.loc15, %.loc15_8.2 [template = constants.%.7]
  1138. // CHECK:STDOUT: %.loc17_18.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  1139. // CHECK:STDOUT: %int.make_type_signed.loc17: init type = call constants.%Int(%.loc17_18.1) [template = constants.%.7]
  1140. // CHECK:STDOUT: %.loc17_18.2: type = value_of_initializer %int.make_type_signed.loc17 [template = constants.%.7]
  1141. // CHECK:STDOUT: %.loc17_18.3: type = converted %int.make_type_signed.loc17, %.loc17_18.2 [template = constants.%.7]
  1142. // CHECK:STDOUT: %.loc18_18.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  1143. // CHECK:STDOUT: %int.make_type_signed.loc18: init type = call constants.%Int(%.loc18_18.1) [template = constants.%.7]
  1144. // CHECK:STDOUT: %.loc18_18.2: type = value_of_initializer %int.make_type_signed.loc18 [template = constants.%.7]
  1145. // CHECK:STDOUT: %.loc18_18.3: type = converted %int.make_type_signed.loc18, %.loc18_18.2 [template = constants.%.7]
  1146. // CHECK:STDOUT: %.loc20_18.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  1147. // CHECK:STDOUT: %int.make_type_unsigned.loc20: init type = call constants.%UInt(%.loc20_18.1) [template = constants.%.2]
  1148. // CHECK:STDOUT: %.loc20_18.2: type = value_of_initializer %int.make_type_unsigned.loc20 [template = constants.%.2]
  1149. // CHECK:STDOUT: %.loc20_18.3: type = converted %int.make_type_unsigned.loc20, %.loc20_18.2 [template = constants.%.2]
  1150. // CHECK:STDOUT: %.loc21_18.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  1151. // CHECK:STDOUT: %int.make_type_unsigned.loc21: init type = call constants.%UInt(%.loc21_18.1) [template = constants.%.2]
  1152. // CHECK:STDOUT: %.loc21_18.2: type = value_of_initializer %int.make_type_unsigned.loc21 [template = constants.%.2]
  1153. // CHECK:STDOUT: %.loc21_18.3: type = converted %int.make_type_unsigned.loc21, %.loc21_18.2 [template = constants.%.2]
  1154. // CHECK:STDOUT: }
  1155. // CHECK:STDOUT:
  1156. // CHECK:STDOUT: fn @Int32ToUint16(%a.param_patt: i32) -> %.2 = "int.convert_checked";
  1157. // CHECK:STDOUT:
  1158. // CHECK:STDOUT: fn @Int32ToInt16(%a.param_patt: i32) -> %.7 = "int.convert_checked";
  1159. // CHECK:STDOUT:
  1160. // CHECK:STDOUT: fn @NegateI32(%a.param_patt: i32) -> i32 = "int.snegate";
  1161. // CHECK:STDOUT:
  1162. // CHECK:STDOUT: fn @Uint32ToUint16(%a.param_patt: %.14) -> %.2 = "int.convert_checked";
  1163. // CHECK:STDOUT:
  1164. // CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: i32) -> %.14 = "int.convert_checked";
  1165. // CHECK:STDOUT:
  1166. // CHECK:STDOUT: fn @Uint32ToInt16(%a.param_patt: %.14) -> %.7 = "int.convert_checked";
  1167. // CHECK:STDOUT:
  1168. // CHECK:STDOUT: fn @IntLiteralToInt16(%a.param_patt: Core.IntLiteral) -> %.7 = "int.convert_checked";
  1169. // CHECK:STDOUT:
  1170. // CHECK:STDOUT: fn @Int32ToIntLiteral(%a.param_patt: i32) -> Core.IntLiteral = "int.convert_checked";
  1171. // CHECK:STDOUT:
  1172. // CHECK:STDOUT: fn @IntLiteralToUint16(%a.param_patt: Core.IntLiteral) -> %.2 = "int.convert_checked";
  1173. // CHECK:STDOUT:
  1174. // CHECK:STDOUT: fn @__global_init() {
  1175. // CHECK:STDOUT: !entry:
  1176. // CHECK:STDOUT: %Int32ToUint16.ref.loc5: %Int32ToUint16.type = name_ref Int32ToUint16, imports.%import_ref.11 [template = constants.%Int32ToUint16]
  1177. // CHECK:STDOUT: %.loc5_28: i32 = int_value 0 [template = constants.%.3]
  1178. // CHECK:STDOUT: %int.convert_checked.loc5: init %.2 = call %Int32ToUint16.ref.loc5(%.loc5_28) [template = constants.%.4]
  1179. // CHECK:STDOUT: %.loc5_30.1: %.2 = value_of_initializer %int.convert_checked.loc5 [template = constants.%.4]
  1180. // CHECK:STDOUT: %.loc5_30.2: %.2 = converted %int.convert_checked.loc5, %.loc5_30.1 [template = constants.%.4]
  1181. // CHECK:STDOUT: %a: %.2 = bind_name a, %.loc5_30.2
  1182. // CHECK:STDOUT: %Int32ToUint16.ref.loc6: %Int32ToUint16.type = name_ref Int32ToUint16, imports.%import_ref.11 [template = constants.%Int32ToUint16]
  1183. // CHECK:STDOUT: %.loc6_28: i32 = int_value 65535 [template = constants.%.5]
  1184. // CHECK:STDOUT: %int.convert_checked.loc6: init %.2 = call %Int32ToUint16.ref.loc6(%.loc6_28) [template = constants.%.6]
  1185. // CHECK:STDOUT: %.loc6_35.1: %.2 = value_of_initializer %int.convert_checked.loc6 [template = constants.%.6]
  1186. // CHECK:STDOUT: %.loc6_35.2: %.2 = converted %int.convert_checked.loc6, %.loc6_35.1 [template = constants.%.6]
  1187. // CHECK:STDOUT: %b: %.2 = bind_name b, %.loc6_35.2
  1188. // CHECK:STDOUT: %Int32ToInt16.ref.loc8: %Int32ToInt16.type = name_ref Int32ToInt16, imports.%import_ref.10 [template = constants.%Int32ToInt16]
  1189. // CHECK:STDOUT: %.loc8_27: i32 = int_value 32767 [template = constants.%.8]
  1190. // CHECK:STDOUT: %int.convert_checked.loc8: init %.7 = call %Int32ToInt16.ref.loc8(%.loc8_27) [template = constants.%.9]
  1191. // CHECK:STDOUT: %.loc8_34.1: %.7 = value_of_initializer %int.convert_checked.loc8 [template = constants.%.9]
  1192. // CHECK:STDOUT: %.loc8_34.2: %.7 = converted %int.convert_checked.loc8, %.loc8_34.1 [template = constants.%.9]
  1193. // CHECK:STDOUT: %c: %.7 = bind_name c, %.loc8_34.2
  1194. // CHECK:STDOUT: %Int32ToInt16.ref.loc9: %Int32ToInt16.type = name_ref Int32ToInt16, imports.%import_ref.10 [template = constants.%Int32ToInt16]
  1195. // CHECK:STDOUT: %NegateI32.ref.loc9: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32]
  1196. // CHECK:STDOUT: %.loc9_37: i32 = int_value 32768 [template = constants.%.10]
  1197. // CHECK:STDOUT: %int.snegate.loc9: init i32 = call %NegateI32.ref.loc9(%.loc9_37) [template = constants.%.11]
  1198. // CHECK:STDOUT: %.loc9_36.1: i32 = value_of_initializer %int.snegate.loc9 [template = constants.%.11]
  1199. // CHECK:STDOUT: %.loc9_36.2: i32 = converted %int.snegate.loc9, %.loc9_36.1 [template = constants.%.11]
  1200. // CHECK:STDOUT: %int.convert_checked.loc9: init %.7 = call %Int32ToInt16.ref.loc9(%.loc9_36.2) [template = constants.%.12]
  1201. // CHECK:STDOUT: %.loc9_45.1: %.7 = value_of_initializer %int.convert_checked.loc9 [template = constants.%.12]
  1202. // CHECK:STDOUT: %.loc9_45.2: %.7 = converted %int.convert_checked.loc9, %.loc9_45.1 [template = constants.%.12]
  1203. // CHECK:STDOUT: %d: %.7 = bind_name d, %.loc9_45.2
  1204. // CHECK:STDOUT: %Uint32ToUint16.ref.loc11: %Uint32ToUint16.type = name_ref Uint32ToUint16, imports.%import_ref.13 [template = constants.%Uint32ToUint16]
  1205. // CHECK:STDOUT: %Int32ToUint32.ref.loc11: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  1206. // CHECK:STDOUT: %.loc11_43: i32 = int_value 0 [template = constants.%.3]
  1207. // CHECK:STDOUT: %int.convert_checked.loc11_42: init %.14 = call %Int32ToUint32.ref.loc11(%.loc11_43) [template = constants.%.15]
  1208. // CHECK:STDOUT: %.loc11_42.1: %.14 = value_of_initializer %int.convert_checked.loc11_42 [template = constants.%.15]
  1209. // CHECK:STDOUT: %.loc11_42.2: %.14 = converted %int.convert_checked.loc11_42, %.loc11_42.1 [template = constants.%.15]
  1210. // CHECK:STDOUT: %int.convert_checked.loc11_28: init %.2 = call %Uint32ToUint16.ref.loc11(%.loc11_42.2) [template = constants.%.4]
  1211. // CHECK:STDOUT: %.loc11_46.1: %.2 = value_of_initializer %int.convert_checked.loc11_28 [template = constants.%.4]
  1212. // CHECK:STDOUT: %.loc11_46.2: %.2 = converted %int.convert_checked.loc11_28, %.loc11_46.1 [template = constants.%.4]
  1213. // CHECK:STDOUT: %e: %.2 = bind_name e, %.loc11_46.2
  1214. // CHECK:STDOUT: %Uint32ToUint16.ref.loc12: %Uint32ToUint16.type = name_ref Uint32ToUint16, imports.%import_ref.13 [template = constants.%Uint32ToUint16]
  1215. // CHECK:STDOUT: %Int32ToUint32.ref.loc12: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  1216. // CHECK:STDOUT: %.loc12_43: i32 = int_value 65535 [template = constants.%.5]
  1217. // CHECK:STDOUT: %int.convert_checked.loc12_42: init %.14 = call %Int32ToUint32.ref.loc12(%.loc12_43) [template = constants.%.16]
  1218. // CHECK:STDOUT: %.loc12_42.1: %.14 = value_of_initializer %int.convert_checked.loc12_42 [template = constants.%.16]
  1219. // CHECK:STDOUT: %.loc12_42.2: %.14 = converted %int.convert_checked.loc12_42, %.loc12_42.1 [template = constants.%.16]
  1220. // CHECK:STDOUT: %int.convert_checked.loc12_28: init %.2 = call %Uint32ToUint16.ref.loc12(%.loc12_42.2) [template = constants.%.6]
  1221. // CHECK:STDOUT: %.loc12_51.1: %.2 = value_of_initializer %int.convert_checked.loc12_28 [template = constants.%.6]
  1222. // CHECK:STDOUT: %.loc12_51.2: %.2 = converted %int.convert_checked.loc12_28, %.loc12_51.1 [template = constants.%.6]
  1223. // CHECK:STDOUT: %f: %.2 = bind_name f, %.loc12_51.2
  1224. // CHECK:STDOUT: %Uint32ToInt16.ref.loc14: %Uint32ToInt16.type = name_ref Uint32ToInt16, imports.%import_ref.12 [template = constants.%Uint32ToInt16]
  1225. // CHECK:STDOUT: %Int32ToUint32.ref.loc14: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  1226. // CHECK:STDOUT: %.loc14_42: i32 = int_value 0 [template = constants.%.3]
  1227. // CHECK:STDOUT: %int.convert_checked.loc14_41: init %.14 = call %Int32ToUint32.ref.loc14(%.loc14_42) [template = constants.%.15]
  1228. // CHECK:STDOUT: %.loc14_41.1: %.14 = value_of_initializer %int.convert_checked.loc14_41 [template = constants.%.15]
  1229. // CHECK:STDOUT: %.loc14_41.2: %.14 = converted %int.convert_checked.loc14_41, %.loc14_41.1 [template = constants.%.15]
  1230. // CHECK:STDOUT: %int.convert_checked.loc14_27: init %.7 = call %Uint32ToInt16.ref.loc14(%.loc14_41.2) [template = constants.%.17]
  1231. // CHECK:STDOUT: %.loc14_45.1: %.7 = value_of_initializer %int.convert_checked.loc14_27 [template = constants.%.17]
  1232. // CHECK:STDOUT: %.loc14_45.2: %.7 = converted %int.convert_checked.loc14_27, %.loc14_45.1 [template = constants.%.17]
  1233. // CHECK:STDOUT: %g: %.7 = bind_name g, %.loc14_45.2
  1234. // CHECK:STDOUT: %Uint32ToInt16.ref.loc15: %Uint32ToInt16.type = name_ref Uint32ToInt16, imports.%import_ref.12 [template = constants.%Uint32ToInt16]
  1235. // CHECK:STDOUT: %Int32ToUint32.ref.loc15: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  1236. // CHECK:STDOUT: %.loc15_42: i32 = int_value 32767 [template = constants.%.8]
  1237. // CHECK:STDOUT: %int.convert_checked.loc15_41: init %.14 = call %Int32ToUint32.ref.loc15(%.loc15_42) [template = constants.%.18]
  1238. // CHECK:STDOUT: %.loc15_41.1: %.14 = value_of_initializer %int.convert_checked.loc15_41 [template = constants.%.18]
  1239. // CHECK:STDOUT: %.loc15_41.2: %.14 = converted %int.convert_checked.loc15_41, %.loc15_41.1 [template = constants.%.18]
  1240. // CHECK:STDOUT: %int.convert_checked.loc15_27: init %.7 = call %Uint32ToInt16.ref.loc15(%.loc15_41.2) [template = constants.%.9]
  1241. // CHECK:STDOUT: %.loc15_50.1: %.7 = value_of_initializer %int.convert_checked.loc15_27 [template = constants.%.9]
  1242. // CHECK:STDOUT: %.loc15_50.2: %.7 = converted %int.convert_checked.loc15_27, %.loc15_50.1 [template = constants.%.9]
  1243. // CHECK:STDOUT: %h: %.7 = bind_name h, %.loc15_50.2
  1244. // CHECK:STDOUT: %IntLiteralToInt16.ref.loc17: %IntLiteralToInt16.type = name_ref IntLiteralToInt16, imports.%import_ref.14 [template = constants.%IntLiteralToInt16]
  1245. // CHECK:STDOUT: %Int32ToIntLiteral.ref.loc17: %Int32ToIntLiteral.type = name_ref Int32ToIntLiteral, imports.%import_ref.20 [template = constants.%Int32ToIntLiteral]
  1246. // CHECK:STDOUT: %NegateI32.ref.loc17: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32]
  1247. // CHECK:STDOUT: %.loc17_70: i32 = int_value 32768 [template = constants.%.10]
  1248. // CHECK:STDOUT: %int.snegate.loc17: init i32 = call %NegateI32.ref.loc17(%.loc17_70) [template = constants.%.11]
  1249. // CHECK:STDOUT: %.loc17_69.1: i32 = value_of_initializer %int.snegate.loc17 [template = constants.%.11]
  1250. // CHECK:STDOUT: %.loc17_69.2: i32 = converted %int.snegate.loc17, %.loc17_69.1 [template = constants.%.11]
  1251. // CHECK:STDOUT: %int.convert_checked.loc17_59: init Core.IntLiteral = call %Int32ToIntLiteral.ref.loc17(%.loc17_69.2) [template = constants.%.19]
  1252. // CHECK:STDOUT: %.loc17_59.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc17_59 [template = constants.%.19]
  1253. // CHECK:STDOUT: %.loc17_59.2: Core.IntLiteral = converted %int.convert_checked.loc17_59, %.loc17_59.1 [template = constants.%.19]
  1254. // CHECK:STDOUT: %int.convert_checked.loc17_41: init %.7 = call %IntLiteralToInt16.ref.loc17(%.loc17_59.2) [template = constants.%.12]
  1255. // CHECK:STDOUT: %.loc17_79.1: %.7 = value_of_initializer %int.convert_checked.loc17_41 [template = constants.%.12]
  1256. // CHECK:STDOUT: %.loc17_79.2: %.7 = converted %int.convert_checked.loc17_41, %.loc17_79.1 [template = constants.%.12]
  1257. // CHECK:STDOUT: %lit_i16_min: %.7 = bind_name lit_i16_min, %.loc17_79.2
  1258. // CHECK:STDOUT: %IntLiteralToInt16.ref.loc18: %IntLiteralToInt16.type = name_ref IntLiteralToInt16, imports.%import_ref.14 [template = constants.%IntLiteralToInt16]
  1259. // CHECK:STDOUT: %Int32ToIntLiteral.ref.loc18: %Int32ToIntLiteral.type = name_ref Int32ToIntLiteral, imports.%import_ref.20 [template = constants.%Int32ToIntLiteral]
  1260. // CHECK:STDOUT: %.loc18_60: i32 = int_value 32767 [template = constants.%.8]
  1261. // CHECK:STDOUT: %int.convert_checked.loc18_59: init Core.IntLiteral = call %Int32ToIntLiteral.ref.loc18(%.loc18_60) [template = constants.%.20]
  1262. // CHECK:STDOUT: %.loc18_59.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc18_59 [template = constants.%.20]
  1263. // CHECK:STDOUT: %.loc18_59.2: Core.IntLiteral = converted %int.convert_checked.loc18_59, %.loc18_59.1 [template = constants.%.20]
  1264. // CHECK:STDOUT: %int.convert_checked.loc18_41: init %.7 = call %IntLiteralToInt16.ref.loc18(%.loc18_59.2) [template = constants.%.9]
  1265. // CHECK:STDOUT: %.loc18_68.1: %.7 = value_of_initializer %int.convert_checked.loc18_41 [template = constants.%.9]
  1266. // CHECK:STDOUT: %.loc18_68.2: %.7 = converted %int.convert_checked.loc18_41, %.loc18_68.1 [template = constants.%.9]
  1267. // CHECK:STDOUT: %lit_i16_max: %.7 = bind_name lit_i16_max, %.loc18_68.2
  1268. // CHECK:STDOUT: %IntLiteralToUint16.ref.loc20: %IntLiteralToUint16.type = name_ref IntLiteralToUint16, imports.%import_ref.15 [template = constants.%IntLiteralToUint16]
  1269. // CHECK:STDOUT: %Int32ToIntLiteral.ref.loc20: %Int32ToIntLiteral.type = name_ref Int32ToIntLiteral, imports.%import_ref.20 [template = constants.%Int32ToIntLiteral]
  1270. // CHECK:STDOUT: %.loc20_61: i32 = int_value 0 [template = constants.%.3]
  1271. // CHECK:STDOUT: %int.convert_checked.loc20_60: init Core.IntLiteral = call %Int32ToIntLiteral.ref.loc20(%.loc20_61) [template = constants.%.21]
  1272. // CHECK:STDOUT: %.loc20_60.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc20_60 [template = constants.%.21]
  1273. // CHECK:STDOUT: %.loc20_60.2: Core.IntLiteral = converted %int.convert_checked.loc20_60, %.loc20_60.1 [template = constants.%.21]
  1274. // CHECK:STDOUT: %int.convert_checked.loc20_42: init %.2 = call %IntLiteralToUint16.ref.loc20(%.loc20_60.2) [template = constants.%.4]
  1275. // CHECK:STDOUT: %.loc20_64.1: %.2 = value_of_initializer %int.convert_checked.loc20_42 [template = constants.%.4]
  1276. // CHECK:STDOUT: %.loc20_64.2: %.2 = converted %int.convert_checked.loc20_42, %.loc20_64.1 [template = constants.%.4]
  1277. // CHECK:STDOUT: %lit_u16_min: %.2 = bind_name lit_u16_min, %.loc20_64.2
  1278. // CHECK:STDOUT: %IntLiteralToUint16.ref.loc21: %IntLiteralToUint16.type = name_ref IntLiteralToUint16, imports.%import_ref.15 [template = constants.%IntLiteralToUint16]
  1279. // CHECK:STDOUT: %Int32ToIntLiteral.ref.loc21: %Int32ToIntLiteral.type = name_ref Int32ToIntLiteral, imports.%import_ref.20 [template = constants.%Int32ToIntLiteral]
  1280. // CHECK:STDOUT: %.loc21_61: i32 = int_value 65535 [template = constants.%.5]
  1281. // CHECK:STDOUT: %int.convert_checked.loc21_60: init Core.IntLiteral = call %Int32ToIntLiteral.ref.loc21(%.loc21_61) [template = constants.%.22]
  1282. // CHECK:STDOUT: %.loc21_60.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc21_60 [template = constants.%.22]
  1283. // CHECK:STDOUT: %.loc21_60.2: Core.IntLiteral = converted %int.convert_checked.loc21_60, %.loc21_60.1 [template = constants.%.22]
  1284. // CHECK:STDOUT: %int.convert_checked.loc21_42: init %.2 = call %IntLiteralToUint16.ref.loc21(%.loc21_60.2) [template = constants.%.6]
  1285. // CHECK:STDOUT: %.loc21_69.1: %.2 = value_of_initializer %int.convert_checked.loc21_42 [template = constants.%.6]
  1286. // CHECK:STDOUT: %.loc21_69.2: %.2 = converted %int.convert_checked.loc21_42, %.loc21_69.1 [template = constants.%.6]
  1287. // CHECK:STDOUT: %lit_u16_max: %.2 = bind_name lit_u16_max, %.loc21_69.2
  1288. // CHECK:STDOUT: return
  1289. // CHECK:STDOUT: }
  1290. // CHECK:STDOUT:
  1291. // CHECK:STDOUT: --- zero_extend.carbon
  1292. // CHECK:STDOUT:
  1293. // CHECK:STDOUT: constants {
  1294. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 64 [template]
  1295. // CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template]
  1296. // CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template]
  1297. // CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template]
  1298. // CHECK:STDOUT: %Uint32ToUint64.type: type = fn_type @Uint32ToUint64 [template]
  1299. // CHECK:STDOUT: %Uint32ToUint64: %Uint32ToUint64.type = struct_value () [template]
  1300. // CHECK:STDOUT: %.3: Core.IntLiteral = int_value 32 [template]
  1301. // CHECK:STDOUT: %.4: type = int_type unsigned, %.3 [template]
  1302. // CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template]
  1303. // CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template]
  1304. // CHECK:STDOUT: %.5: i32 = int_value 0 [template]
  1305. // CHECK:STDOUT: %.6: %.4 = int_value 0 [template]
  1306. // CHECK:STDOUT: %.7: %.2 = int_value 0 [template]
  1307. // CHECK:STDOUT: %AddU32.type: type = fn_type @AddU32 [template]
  1308. // CHECK:STDOUT: %AddU32: %AddU32.type = struct_value () [template]
  1309. // CHECK:STDOUT: %.8: i32 = int_value 2147483647 [template]
  1310. // CHECK:STDOUT: %.9: %.4 = int_value 2147483647 [template]
  1311. // CHECK:STDOUT: %.10: %.4 = int_value 4294967294 [template]
  1312. // CHECK:STDOUT: %.11: i32 = int_value 1 [template]
  1313. // CHECK:STDOUT: %.12: %.4 = int_value 1 [template]
  1314. // CHECK:STDOUT: %.13: %.4 = int_value 4294967295 [template]
  1315. // CHECK:STDOUT: %.14: %.2 = int_value 4294967295 [template]
  1316. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  1317. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  1318. // CHECK:STDOUT: %.15: type = int_type signed, %.1 [template]
  1319. // CHECK:STDOUT: %Uint32ToInt64.type: type = fn_type @Uint32ToInt64 [template]
  1320. // CHECK:STDOUT: %Uint32ToInt64: %Uint32ToInt64.type = struct_value () [template]
  1321. // CHECK:STDOUT: %.16: %.15 = int_value 0 [template]
  1322. // CHECK:STDOUT: %.17: %.15 = int_value 4294967295 [template]
  1323. // CHECK:STDOUT: }
  1324. // CHECK:STDOUT:
  1325. // CHECK:STDOUT: imports {
  1326. // CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, inst+25, unloaded
  1327. // CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, inst+49, unloaded
  1328. // CHECK:STDOUT: %import_ref.3: %AddU32.type = import_ref Main//int_ops, inst+89, loaded [template = constants.%AddU32]
  1329. // CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, inst+96, unloaded
  1330. // CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, inst+113, unloaded
  1331. // CHECK:STDOUT: %import_ref.6: %Int32ToUint32.type = import_ref Main//int_ops, inst+131, loaded [template = constants.%Int32ToUint32]
  1332. // CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, inst+149, unloaded
  1333. // CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, inst+168, unloaded
  1334. // CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, inst+187, unloaded
  1335. // CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, inst+218, unloaded
  1336. // CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, inst+237, unloaded
  1337. // CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, inst+256, unloaded
  1338. // CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, inst+275, unloaded
  1339. // CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, inst+294, unloaded
  1340. // CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, inst+313, unloaded
  1341. // CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, inst+333, unloaded
  1342. // CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, inst+352, unloaded
  1343. // CHECK:STDOUT: %import_ref.18: %Uint32ToInt64.type = import_ref Main//int_ops, inst+371, loaded [template = constants.%Uint32ToInt64]
  1344. // CHECK:STDOUT: %import_ref.19: %Uint32ToUint64.type = import_ref Main//int_ops, inst+390, loaded [template = constants.%Uint32ToUint64]
  1345. // CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, inst+408, unloaded
  1346. // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded
  1347. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1348. // CHECK:STDOUT: .UInt = %import_ref.22
  1349. // CHECK:STDOUT: .Int = %import_ref.23
  1350. // CHECK:STDOUT: import Core//prelude
  1351. // CHECK:STDOUT: import Core//prelude/...
  1352. // CHECK:STDOUT: }
  1353. // CHECK:STDOUT: }
  1354. // CHECK:STDOUT:
  1355. // CHECK:STDOUT: file {
  1356. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1357. // CHECK:STDOUT: .NegateI32 = imports.%import_ref.1
  1358. // CHECK:STDOUT: .SubI32 = imports.%import_ref.2
  1359. // CHECK:STDOUT: .AddU32 = imports.%import_ref.3
  1360. // CHECK:STDOUT: .IntLiteral = imports.%import_ref.4
  1361. // CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5
  1362. // CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6
  1363. // CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7
  1364. // CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8
  1365. // CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9
  1366. // CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10
  1367. // CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11
  1368. // CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12
  1369. // CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13
  1370. // CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14
  1371. // CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15
  1372. // CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16
  1373. // CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17
  1374. // CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18
  1375. // CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19
  1376. // CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20
  1377. // CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21
  1378. // CHECK:STDOUT: .Core = imports.%Core
  1379. // CHECK:STDOUT: .a = @__global_init.%a
  1380. // CHECK:STDOUT: .b = @__global_init.%b
  1381. // CHECK:STDOUT: .c = @__global_init.%c
  1382. // CHECK:STDOUT: .d = @__global_init.%d
  1383. // CHECK:STDOUT: }
  1384. // CHECK:STDOUT: %Core.import = import Core
  1385. // CHECK:STDOUT: %default.import = import <invalid>
  1386. // CHECK:STDOUT: %.loc5_8.1: Core.IntLiteral = int_value 64 [template = constants.%.1]
  1387. // CHECK:STDOUT: %int.make_type_unsigned.loc5: init type = call constants.%UInt(%.loc5_8.1) [template = constants.%.2]
  1388. // CHECK:STDOUT: %.loc5_8.2: type = value_of_initializer %int.make_type_unsigned.loc5 [template = constants.%.2]
  1389. // CHECK:STDOUT: %.loc5_8.3: type = converted %int.make_type_unsigned.loc5, %.loc5_8.2 [template = constants.%.2]
  1390. // CHECK:STDOUT: %.loc6_8.1: Core.IntLiteral = int_value 64 [template = constants.%.1]
  1391. // CHECK:STDOUT: %int.make_type_unsigned.loc6: init type = call constants.%UInt(%.loc6_8.1) [template = constants.%.2]
  1392. // CHECK:STDOUT: %.loc6_8.2: type = value_of_initializer %int.make_type_unsigned.loc6 [template = constants.%.2]
  1393. // CHECK:STDOUT: %.loc6_8.3: type = converted %int.make_type_unsigned.loc6, %.loc6_8.2 [template = constants.%.2]
  1394. // CHECK:STDOUT: %.loc11_8.1: Core.IntLiteral = int_value 64 [template = constants.%.1]
  1395. // CHECK:STDOUT: %int.make_type_signed.loc11: init type = call constants.%Int(%.loc11_8.1) [template = constants.%.15]
  1396. // CHECK:STDOUT: %.loc11_8.2: type = value_of_initializer %int.make_type_signed.loc11 [template = constants.%.15]
  1397. // CHECK:STDOUT: %.loc11_8.3: type = converted %int.make_type_signed.loc11, %.loc11_8.2 [template = constants.%.15]
  1398. // CHECK:STDOUT: %.loc12_8.1: Core.IntLiteral = int_value 64 [template = constants.%.1]
  1399. // CHECK:STDOUT: %int.make_type_signed.loc12: init type = call constants.%Int(%.loc12_8.1) [template = constants.%.15]
  1400. // CHECK:STDOUT: %.loc12_8.2: type = value_of_initializer %int.make_type_signed.loc12 [template = constants.%.15]
  1401. // CHECK:STDOUT: %.loc12_8.3: type = converted %int.make_type_signed.loc12, %.loc12_8.2 [template = constants.%.15]
  1402. // CHECK:STDOUT: }
  1403. // CHECK:STDOUT:
  1404. // CHECK:STDOUT: fn @Uint32ToUint64(%a.param_patt: %.4) -> %.2 = "int.convert_checked";
  1405. // CHECK:STDOUT:
  1406. // CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: i32) -> %.4 = "int.convert_checked";
  1407. // CHECK:STDOUT:
  1408. // CHECK:STDOUT: fn @AddU32(%a.param_patt: %.4, %b.param_patt: %.4) -> %.4 = "int.uadd";
  1409. // CHECK:STDOUT:
  1410. // CHECK:STDOUT: fn @Uint32ToInt64(%a.param_patt: %.4) -> %.15 = "int.convert_checked";
  1411. // CHECK:STDOUT:
  1412. // CHECK:STDOUT: fn @__global_init() {
  1413. // CHECK:STDOUT: !entry:
  1414. // CHECK:STDOUT: %Uint32ToUint64.ref.loc5: %Uint32ToUint64.type = name_ref Uint32ToUint64, imports.%import_ref.19 [template = constants.%Uint32ToUint64]
  1415. // CHECK:STDOUT: %Int32ToUint32.ref.loc5: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  1416. // CHECK:STDOUT: %.loc5_43: i32 = int_value 0 [template = constants.%.5]
  1417. // CHECK:STDOUT: %int.convert_checked.loc5_42: init %.4 = call %Int32ToUint32.ref.loc5(%.loc5_43) [template = constants.%.6]
  1418. // CHECK:STDOUT: %.loc5_42.1: %.4 = value_of_initializer %int.convert_checked.loc5_42 [template = constants.%.6]
  1419. // CHECK:STDOUT: %.loc5_42.2: %.4 = converted %int.convert_checked.loc5_42, %.loc5_42.1 [template = constants.%.6]
  1420. // CHECK:STDOUT: %int.convert_checked.loc5_28: init %.2 = call %Uint32ToUint64.ref.loc5(%.loc5_42.2) [template = constants.%.7]
  1421. // CHECK:STDOUT: %.loc5_46.1: %.2 = value_of_initializer %int.convert_checked.loc5_28 [template = constants.%.7]
  1422. // CHECK:STDOUT: %.loc5_46.2: %.2 = converted %int.convert_checked.loc5_28, %.loc5_46.1 [template = constants.%.7]
  1423. // CHECK:STDOUT: %a: %.2 = bind_name a, %.loc5_46.2
  1424. // CHECK:STDOUT: %Uint32ToUint64.ref.loc6: %Uint32ToUint64.type = name_ref Uint32ToUint64, imports.%import_ref.19 [template = constants.%Uint32ToUint64]
  1425. // CHECK:STDOUT: %AddU32.ref.loc7: %AddU32.type = name_ref AddU32, imports.%import_ref.3 [template = constants.%AddU32]
  1426. // CHECK:STDOUT: %AddU32.ref.loc8: %AddU32.type = name_ref AddU32, imports.%import_ref.3 [template = constants.%AddU32]
  1427. // CHECK:STDOUT: %Int32ToUint32.ref.loc8_12: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  1428. // CHECK:STDOUT: %.loc8_26: i32 = int_value 2147483647 [template = constants.%.8]
  1429. // CHECK:STDOUT: %int.convert_checked.loc8_25: init %.4 = call %Int32ToUint32.ref.loc8_12(%.loc8_26) [template = constants.%.9]
  1430. // CHECK:STDOUT: %Int32ToUint32.ref.loc8_40: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  1431. // CHECK:STDOUT: %.loc8_54: i32 = int_value 2147483647 [template = constants.%.8]
  1432. // CHECK:STDOUT: %int.convert_checked.loc8_53: init %.4 = call %Int32ToUint32.ref.loc8_40(%.loc8_54) [template = constants.%.9]
  1433. // CHECK:STDOUT: %.loc8_25.1: %.4 = value_of_initializer %int.convert_checked.loc8_25 [template = constants.%.9]
  1434. // CHECK:STDOUT: %.loc8_25.2: %.4 = converted %int.convert_checked.loc8_25, %.loc8_25.1 [template = constants.%.9]
  1435. // CHECK:STDOUT: %.loc8_53.1: %.4 = value_of_initializer %int.convert_checked.loc8_53 [template = constants.%.9]
  1436. // CHECK:STDOUT: %.loc8_53.2: %.4 = converted %int.convert_checked.loc8_53, %.loc8_53.1 [template = constants.%.9]
  1437. // CHECK:STDOUT: %int.uadd.loc8: init %.4 = call %AddU32.ref.loc8(%.loc8_25.2, %.loc8_53.2) [template = constants.%.10]
  1438. // CHECK:STDOUT: %Int32ToUint32.ref.loc9: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  1439. // CHECK:STDOUT: %.loc9_19: i32 = int_value 1 [template = constants.%.11]
  1440. // CHECK:STDOUT: %int.convert_checked.loc9: init %.4 = call %Int32ToUint32.ref.loc9(%.loc9_19) [template = constants.%.12]
  1441. // CHECK:STDOUT: %.loc8_11.1: %.4 = value_of_initializer %int.uadd.loc8 [template = constants.%.10]
  1442. // CHECK:STDOUT: %.loc8_11.2: %.4 = converted %int.uadd.loc8, %.loc8_11.1 [template = constants.%.10]
  1443. // CHECK:STDOUT: %.loc9_18.1: %.4 = value_of_initializer %int.convert_checked.loc9 [template = constants.%.12]
  1444. // CHECK:STDOUT: %.loc9_18.2: %.4 = converted %int.convert_checked.loc9, %.loc9_18.1 [template = constants.%.12]
  1445. // CHECK:STDOUT: %int.uadd.loc7: init %.4 = call %AddU32.ref.loc7(%.loc8_11.2, %.loc9_18.2) [template = constants.%.13]
  1446. // CHECK:STDOUT: %.loc7_9.1: %.4 = value_of_initializer %int.uadd.loc7 [template = constants.%.13]
  1447. // CHECK:STDOUT: %.loc7_9.2: %.4 = converted %int.uadd.loc7, %.loc7_9.1 [template = constants.%.13]
  1448. // CHECK:STDOUT: %int.convert_checked.loc6: init %.2 = call %Uint32ToUint64.ref.loc6(%.loc7_9.2) [template = constants.%.14]
  1449. // CHECK:STDOUT: %.loc9_23.1: %.2 = value_of_initializer %int.convert_checked.loc6 [template = constants.%.14]
  1450. // CHECK:STDOUT: %.loc9_23.2: %.2 = converted %int.convert_checked.loc6, %.loc9_23.1 [template = constants.%.14]
  1451. // CHECK:STDOUT: %b: %.2 = bind_name b, %.loc9_23.2
  1452. // CHECK:STDOUT: %Uint32ToInt64.ref.loc11: %Uint32ToInt64.type = name_ref Uint32ToInt64, imports.%import_ref.18 [template = constants.%Uint32ToInt64]
  1453. // CHECK:STDOUT: %Int32ToUint32.ref.loc11: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  1454. // CHECK:STDOUT: %.loc11_42: i32 = int_value 0 [template = constants.%.5]
  1455. // CHECK:STDOUT: %int.convert_checked.loc11_41: init %.4 = call %Int32ToUint32.ref.loc11(%.loc11_42) [template = constants.%.6]
  1456. // CHECK:STDOUT: %.loc11_41.1: %.4 = value_of_initializer %int.convert_checked.loc11_41 [template = constants.%.6]
  1457. // CHECK:STDOUT: %.loc11_41.2: %.4 = converted %int.convert_checked.loc11_41, %.loc11_41.1 [template = constants.%.6]
  1458. // CHECK:STDOUT: %int.convert_checked.loc11_27: init %.15 = call %Uint32ToInt64.ref.loc11(%.loc11_41.2) [template = constants.%.16]
  1459. // CHECK:STDOUT: %.loc11_45.1: %.15 = value_of_initializer %int.convert_checked.loc11_27 [template = constants.%.16]
  1460. // CHECK:STDOUT: %.loc11_45.2: %.15 = converted %int.convert_checked.loc11_27, %.loc11_45.1 [template = constants.%.16]
  1461. // CHECK:STDOUT: %c: %.15 = bind_name c, %.loc11_45.2
  1462. // CHECK:STDOUT: %Uint32ToInt64.ref.loc12: %Uint32ToInt64.type = name_ref Uint32ToInt64, imports.%import_ref.18 [template = constants.%Uint32ToInt64]
  1463. // CHECK:STDOUT: %AddU32.ref.loc13: %AddU32.type = name_ref AddU32, imports.%import_ref.3 [template = constants.%AddU32]
  1464. // CHECK:STDOUT: %AddU32.ref.loc14: %AddU32.type = name_ref AddU32, imports.%import_ref.3 [template = constants.%AddU32]
  1465. // CHECK:STDOUT: %Int32ToUint32.ref.loc14_12: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  1466. // CHECK:STDOUT: %.loc14_26: i32 = int_value 2147483647 [template = constants.%.8]
  1467. // CHECK:STDOUT: %int.convert_checked.loc14_25: init %.4 = call %Int32ToUint32.ref.loc14_12(%.loc14_26) [template = constants.%.9]
  1468. // CHECK:STDOUT: %Int32ToUint32.ref.loc14_40: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  1469. // CHECK:STDOUT: %.loc14_54: i32 = int_value 2147483647 [template = constants.%.8]
  1470. // CHECK:STDOUT: %int.convert_checked.loc14_53: init %.4 = call %Int32ToUint32.ref.loc14_40(%.loc14_54) [template = constants.%.9]
  1471. // CHECK:STDOUT: %.loc14_25.1: %.4 = value_of_initializer %int.convert_checked.loc14_25 [template = constants.%.9]
  1472. // CHECK:STDOUT: %.loc14_25.2: %.4 = converted %int.convert_checked.loc14_25, %.loc14_25.1 [template = constants.%.9]
  1473. // CHECK:STDOUT: %.loc14_53.1: %.4 = value_of_initializer %int.convert_checked.loc14_53 [template = constants.%.9]
  1474. // CHECK:STDOUT: %.loc14_53.2: %.4 = converted %int.convert_checked.loc14_53, %.loc14_53.1 [template = constants.%.9]
  1475. // CHECK:STDOUT: %int.uadd.loc14: init %.4 = call %AddU32.ref.loc14(%.loc14_25.2, %.loc14_53.2) [template = constants.%.10]
  1476. // CHECK:STDOUT: %Int32ToUint32.ref.loc15: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  1477. // CHECK:STDOUT: %.loc15_19: i32 = int_value 1 [template = constants.%.11]
  1478. // CHECK:STDOUT: %int.convert_checked.loc15: init %.4 = call %Int32ToUint32.ref.loc15(%.loc15_19) [template = constants.%.12]
  1479. // CHECK:STDOUT: %.loc14_11.1: %.4 = value_of_initializer %int.uadd.loc14 [template = constants.%.10]
  1480. // CHECK:STDOUT: %.loc14_11.2: %.4 = converted %int.uadd.loc14, %.loc14_11.1 [template = constants.%.10]
  1481. // CHECK:STDOUT: %.loc15_18.1: %.4 = value_of_initializer %int.convert_checked.loc15 [template = constants.%.12]
  1482. // CHECK:STDOUT: %.loc15_18.2: %.4 = converted %int.convert_checked.loc15, %.loc15_18.1 [template = constants.%.12]
  1483. // CHECK:STDOUT: %int.uadd.loc13: init %.4 = call %AddU32.ref.loc13(%.loc14_11.2, %.loc15_18.2) [template = constants.%.13]
  1484. // CHECK:STDOUT: %.loc13_9.1: %.4 = value_of_initializer %int.uadd.loc13 [template = constants.%.13]
  1485. // CHECK:STDOUT: %.loc13_9.2: %.4 = converted %int.uadd.loc13, %.loc13_9.1 [template = constants.%.13]
  1486. // CHECK:STDOUT: %int.convert_checked.loc12: init %.15 = call %Uint32ToInt64.ref.loc12(%.loc13_9.2) [template = constants.%.17]
  1487. // CHECK:STDOUT: %.loc15_23.1: %.15 = value_of_initializer %int.convert_checked.loc12 [template = constants.%.17]
  1488. // CHECK:STDOUT: %.loc15_23.2: %.15 = converted %int.convert_checked.loc12, %.loc15_23.1 [template = constants.%.17]
  1489. // CHECK:STDOUT: %d: %.15 = bind_name d, %.loc15_23.2
  1490. // CHECK:STDOUT: return
  1491. // CHECK:STDOUT: }
  1492. // CHECK:STDOUT:
  1493. // CHECK:STDOUT: --- sign_extend.carbon
  1494. // CHECK:STDOUT:
  1495. // CHECK:STDOUT: constants {
  1496. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 64 [template]
  1497. // CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template]
  1498. // CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template]
  1499. // CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template]
  1500. // CHECK:STDOUT: %Int32ToUint64.type: type = fn_type @Int32ToUint64 [template]
  1501. // CHECK:STDOUT: %Int32ToUint64: %Int32ToUint64.type = struct_value () [template]
  1502. // CHECK:STDOUT: %.3: i32 = int_value 0 [template]
  1503. // CHECK:STDOUT: %.4: %.2 = int_value 0 [template]
  1504. // CHECK:STDOUT: %.5: i32 = int_value 2147483647 [template]
  1505. // CHECK:STDOUT: %.6: %.2 = int_value 2147483647 [template]
  1506. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  1507. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  1508. // CHECK:STDOUT: %.7: type = int_type signed, %.1 [template]
  1509. // CHECK:STDOUT: %Int32ToInt64.type: type = fn_type @Int32ToInt64 [template]
  1510. // CHECK:STDOUT: %Int32ToInt64: %Int32ToInt64.type = struct_value () [template]
  1511. // CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template]
  1512. // CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template]
  1513. // CHECK:STDOUT: %NegateI32.type: type = fn_type @NegateI32 [template]
  1514. // CHECK:STDOUT: %NegateI32: %NegateI32.type = struct_value () [template]
  1515. // CHECK:STDOUT: %.8: i32 = int_value -2147483647 [template]
  1516. // CHECK:STDOUT: %.9: i32 = int_value 1 [template]
  1517. // CHECK:STDOUT: %.10: i32 = int_value -2147483648 [template]
  1518. // CHECK:STDOUT: %.11: %.7 = int_value -2147483648 [template]
  1519. // CHECK:STDOUT: %.12: %.7 = int_value 2147483647 [template]
  1520. // CHECK:STDOUT: }
  1521. // CHECK:STDOUT:
  1522. // CHECK:STDOUT: imports {
  1523. // CHECK:STDOUT: %import_ref.1: %NegateI32.type = import_ref Main//int_ops, inst+25, loaded [template = constants.%NegateI32]
  1524. // CHECK:STDOUT: %import_ref.2: %SubI32.type = import_ref Main//int_ops, inst+49, loaded [template = constants.%SubI32]
  1525. // CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, inst+89, unloaded
  1526. // CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, inst+96, unloaded
  1527. // CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, inst+113, unloaded
  1528. // CHECK:STDOUT: %import_ref.6 = import_ref Main//int_ops, inst+131, unloaded
  1529. // CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, inst+149, unloaded
  1530. // CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, inst+168, unloaded
  1531. // CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, inst+187, unloaded
  1532. // CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, inst+218, unloaded
  1533. // CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, inst+237, unloaded
  1534. // CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, inst+256, unloaded
  1535. // CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, inst+275, unloaded
  1536. // CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, inst+294, unloaded
  1537. // CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, inst+313, unloaded
  1538. // CHECK:STDOUT: %import_ref.16: %Int32ToInt64.type = import_ref Main//int_ops, inst+333, loaded [template = constants.%Int32ToInt64]
  1539. // CHECK:STDOUT: %import_ref.17: %Int32ToUint64.type = import_ref Main//int_ops, inst+352, loaded [template = constants.%Int32ToUint64]
  1540. // CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, inst+371, unloaded
  1541. // CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, inst+390, unloaded
  1542. // CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, inst+408, unloaded
  1543. // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded
  1544. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1545. // CHECK:STDOUT: .UInt = %import_ref.22
  1546. // CHECK:STDOUT: .Int = %import_ref.23
  1547. // CHECK:STDOUT: import Core//prelude
  1548. // CHECK:STDOUT: import Core//prelude/...
  1549. // CHECK:STDOUT: }
  1550. // CHECK:STDOUT: }
  1551. // CHECK:STDOUT:
  1552. // CHECK:STDOUT: file {
  1553. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1554. // CHECK:STDOUT: .NegateI32 = imports.%import_ref.1
  1555. // CHECK:STDOUT: .SubI32 = imports.%import_ref.2
  1556. // CHECK:STDOUT: .AddU32 = imports.%import_ref.3
  1557. // CHECK:STDOUT: .IntLiteral = imports.%import_ref.4
  1558. // CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5
  1559. // CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6
  1560. // CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7
  1561. // CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8
  1562. // CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9
  1563. // CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10
  1564. // CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11
  1565. // CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12
  1566. // CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13
  1567. // CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14
  1568. // CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15
  1569. // CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16
  1570. // CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17
  1571. // CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18
  1572. // CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19
  1573. // CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20
  1574. // CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21
  1575. // CHECK:STDOUT: .Core = imports.%Core
  1576. // CHECK:STDOUT: .a = @__global_init.%a
  1577. // CHECK:STDOUT: .b = @__global_init.%b
  1578. // CHECK:STDOUT: .c = @__global_init.%c
  1579. // CHECK:STDOUT: .d = @__global_init.%d
  1580. // CHECK:STDOUT: }
  1581. // CHECK:STDOUT: %Core.import = import Core
  1582. // CHECK:STDOUT: %default.import = import <invalid>
  1583. // CHECK:STDOUT: %.loc5_8.1: Core.IntLiteral = int_value 64 [template = constants.%.1]
  1584. // CHECK:STDOUT: %int.make_type_unsigned.loc5: init type = call constants.%UInt(%.loc5_8.1) [template = constants.%.2]
  1585. // CHECK:STDOUT: %.loc5_8.2: type = value_of_initializer %int.make_type_unsigned.loc5 [template = constants.%.2]
  1586. // CHECK:STDOUT: %.loc5_8.3: type = converted %int.make_type_unsigned.loc5, %.loc5_8.2 [template = constants.%.2]
  1587. // CHECK:STDOUT: %.loc6_8.1: Core.IntLiteral = int_value 64 [template = constants.%.1]
  1588. // CHECK:STDOUT: %int.make_type_unsigned.loc6: init type = call constants.%UInt(%.loc6_8.1) [template = constants.%.2]
  1589. // CHECK:STDOUT: %.loc6_8.2: type = value_of_initializer %int.make_type_unsigned.loc6 [template = constants.%.2]
  1590. // CHECK:STDOUT: %.loc6_8.3: type = converted %int.make_type_unsigned.loc6, %.loc6_8.2 [template = constants.%.2]
  1591. // CHECK:STDOUT: %.loc8_8.1: Core.IntLiteral = int_value 64 [template = constants.%.1]
  1592. // CHECK:STDOUT: %int.make_type_signed.loc8: init type = call constants.%Int(%.loc8_8.1) [template = constants.%.7]
  1593. // CHECK:STDOUT: %.loc8_8.2: type = value_of_initializer %int.make_type_signed.loc8 [template = constants.%.7]
  1594. // CHECK:STDOUT: %.loc8_8.3: type = converted %int.make_type_signed.loc8, %.loc8_8.2 [template = constants.%.7]
  1595. // CHECK:STDOUT: %.loc9_8.1: Core.IntLiteral = int_value 64 [template = constants.%.1]
  1596. // CHECK:STDOUT: %int.make_type_signed.loc9: init type = call constants.%Int(%.loc9_8.1) [template = constants.%.7]
  1597. // CHECK:STDOUT: %.loc9_8.2: type = value_of_initializer %int.make_type_signed.loc9 [template = constants.%.7]
  1598. // CHECK:STDOUT: %.loc9_8.3: type = converted %int.make_type_signed.loc9, %.loc9_8.2 [template = constants.%.7]
  1599. // CHECK:STDOUT: }
  1600. // CHECK:STDOUT:
  1601. // CHECK:STDOUT: fn @Int32ToUint64(%a.param_patt: i32) -> %.2 = "int.convert_checked";
  1602. // CHECK:STDOUT:
  1603. // CHECK:STDOUT: fn @Int32ToInt64(%a.param_patt: i32) -> %.7 = "int.convert_checked";
  1604. // CHECK:STDOUT:
  1605. // CHECK:STDOUT: fn @SubI32(%a.param_patt: i32, %b.param_patt: i32) -> i32 = "int.ssub";
  1606. // CHECK:STDOUT:
  1607. // CHECK:STDOUT: fn @NegateI32(%a.param_patt: i32) -> i32 = "int.snegate";
  1608. // CHECK:STDOUT:
  1609. // CHECK:STDOUT: fn @__global_init() {
  1610. // CHECK:STDOUT: !entry:
  1611. // CHECK:STDOUT: %Int32ToUint64.ref.loc5: %Int32ToUint64.type = name_ref Int32ToUint64, imports.%import_ref.17 [template = constants.%Int32ToUint64]
  1612. // CHECK:STDOUT: %.loc5_28: i32 = int_value 0 [template = constants.%.3]
  1613. // CHECK:STDOUT: %int.convert_checked.loc5: init %.2 = call %Int32ToUint64.ref.loc5(%.loc5_28) [template = constants.%.4]
  1614. // CHECK:STDOUT: %.loc5_30.1: %.2 = value_of_initializer %int.convert_checked.loc5 [template = constants.%.4]
  1615. // CHECK:STDOUT: %.loc5_30.2: %.2 = converted %int.convert_checked.loc5, %.loc5_30.1 [template = constants.%.4]
  1616. // CHECK:STDOUT: %a: %.2 = bind_name a, %.loc5_30.2
  1617. // CHECK:STDOUT: %Int32ToUint64.ref.loc6: %Int32ToUint64.type = name_ref Int32ToUint64, imports.%import_ref.17 [template = constants.%Int32ToUint64]
  1618. // CHECK:STDOUT: %.loc6_28: i32 = int_value 2147483647 [template = constants.%.5]
  1619. // CHECK:STDOUT: %int.convert_checked.loc6: init %.2 = call %Int32ToUint64.ref.loc6(%.loc6_28) [template = constants.%.6]
  1620. // CHECK:STDOUT: %.loc6_40.1: %.2 = value_of_initializer %int.convert_checked.loc6 [template = constants.%.6]
  1621. // CHECK:STDOUT: %.loc6_40.2: %.2 = converted %int.convert_checked.loc6, %.loc6_40.1 [template = constants.%.6]
  1622. // CHECK:STDOUT: %b: %.2 = bind_name b, %.loc6_40.2
  1623. // CHECK:STDOUT: %Int32ToInt64.ref.loc8: %Int32ToInt64.type = name_ref Int32ToInt64, imports.%import_ref.16 [template = constants.%Int32ToInt64]
  1624. // CHECK:STDOUT: %SubI32.ref: %SubI32.type = name_ref SubI32, imports.%import_ref.2 [template = constants.%SubI32]
  1625. // CHECK:STDOUT: %NegateI32.ref: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32]
  1626. // CHECK:STDOUT: %.loc8_44: i32 = int_value 2147483647 [template = constants.%.5]
  1627. // CHECK:STDOUT: %int.snegate: init i32 = call %NegateI32.ref(%.loc8_44) [template = constants.%.8]
  1628. // CHECK:STDOUT: %.loc8_58: i32 = int_value 1 [template = constants.%.9]
  1629. // CHECK:STDOUT: %.loc8_43.1: i32 = value_of_initializer %int.snegate [template = constants.%.8]
  1630. // CHECK:STDOUT: %.loc8_43.2: i32 = converted %int.snegate, %.loc8_43.1 [template = constants.%.8]
  1631. // CHECK:STDOUT: %int.ssub: init i32 = call %SubI32.ref(%.loc8_43.2, %.loc8_58) [template = constants.%.10]
  1632. // CHECK:STDOUT: %.loc8_33.1: i32 = value_of_initializer %int.ssub [template = constants.%.10]
  1633. // CHECK:STDOUT: %.loc8_33.2: i32 = converted %int.ssub, %.loc8_33.1 [template = constants.%.10]
  1634. // CHECK:STDOUT: %int.convert_checked.loc8: init %.7 = call %Int32ToInt64.ref.loc8(%.loc8_33.2) [template = constants.%.11]
  1635. // CHECK:STDOUT: %.loc8_61.1: %.7 = value_of_initializer %int.convert_checked.loc8 [template = constants.%.11]
  1636. // CHECK:STDOUT: %.loc8_61.2: %.7 = converted %int.convert_checked.loc8, %.loc8_61.1 [template = constants.%.11]
  1637. // CHECK:STDOUT: %c: %.7 = bind_name c, %.loc8_61.2
  1638. // CHECK:STDOUT: %Int32ToInt64.ref.loc9: %Int32ToInt64.type = name_ref Int32ToInt64, imports.%import_ref.16 [template = constants.%Int32ToInt64]
  1639. // CHECK:STDOUT: %.loc9_27: i32 = int_value 2147483647 [template = constants.%.5]
  1640. // CHECK:STDOUT: %int.convert_checked.loc9: init %.7 = call %Int32ToInt64.ref.loc9(%.loc9_27) [template = constants.%.12]
  1641. // CHECK:STDOUT: %.loc9_39.1: %.7 = value_of_initializer %int.convert_checked.loc9 [template = constants.%.12]
  1642. // CHECK:STDOUT: %.loc9_39.2: %.7 = converted %int.convert_checked.loc9, %.loc9_39.1 [template = constants.%.12]
  1643. // CHECK:STDOUT: %d: %.7 = bind_name d, %.loc9_39.2
  1644. // CHECK:STDOUT: return
  1645. // CHECK:STDOUT: }
  1646. // CHECK:STDOUT:
  1647. // CHECK:STDOUT: --- fail_too_large_u32_for_i32.carbon
  1648. // CHECK:STDOUT:
  1649. // CHECK:STDOUT: constants {
  1650. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  1651. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  1652. // CHECK:STDOUT: %Uint32ToInt32.type: type = fn_type @Uint32ToInt32 [template]
  1653. // CHECK:STDOUT: %Uint32ToInt32: %Uint32ToInt32.type = struct_value () [template]
  1654. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32 [template]
  1655. // CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template]
  1656. // CHECK:STDOUT: %AddU32.type: type = fn_type @AddU32 [template]
  1657. // CHECK:STDOUT: %AddU32: %AddU32.type = struct_value () [template]
  1658. // CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template]
  1659. // CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template]
  1660. // CHECK:STDOUT: %.3: i32 = int_value 2147483647 [template]
  1661. // CHECK:STDOUT: %.4: %.2 = int_value 2147483647 [template]
  1662. // CHECK:STDOUT: %.5: i32 = int_value 1 [template]
  1663. // CHECK:STDOUT: %.6: %.2 = int_value 1 [template]
  1664. // CHECK:STDOUT: %.7: %.2 = int_value 2147483648 [template]
  1665. // CHECK:STDOUT: %.8: i32 = int_value 2147483648 [template]
  1666. // CHECK:STDOUT: }
  1667. // CHECK:STDOUT:
  1668. // CHECK:STDOUT: imports {
  1669. // CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, inst+25, unloaded
  1670. // CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, inst+49, unloaded
  1671. // CHECK:STDOUT: %import_ref.3: %AddU32.type = import_ref Main//int_ops, inst+89, loaded [template = constants.%AddU32]
  1672. // CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, inst+96, unloaded
  1673. // CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, inst+113, unloaded
  1674. // CHECK:STDOUT: %import_ref.6: %Int32ToUint32.type = import_ref Main//int_ops, inst+131, loaded [template = constants.%Int32ToUint32]
  1675. // CHECK:STDOUT: %import_ref.7: %Uint32ToInt32.type = import_ref Main//int_ops, inst+149, loaded [template = constants.%Uint32ToInt32]
  1676. // CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, inst+168, unloaded
  1677. // CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, inst+187, unloaded
  1678. // CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, inst+218, unloaded
  1679. // CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, inst+237, unloaded
  1680. // CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, inst+256, unloaded
  1681. // CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, inst+275, unloaded
  1682. // CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, inst+294, unloaded
  1683. // CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, inst+313, unloaded
  1684. // CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, inst+333, unloaded
  1685. // CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, inst+352, unloaded
  1686. // CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, inst+371, unloaded
  1687. // CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, inst+390, unloaded
  1688. // CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, inst+408, unloaded
  1689. // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded
  1690. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1691. // CHECK:STDOUT: .Int32 = %import_ref.22
  1692. // CHECK:STDOUT: import Core//prelude
  1693. // CHECK:STDOUT: import Core//prelude/...
  1694. // CHECK:STDOUT: }
  1695. // CHECK:STDOUT: }
  1696. // CHECK:STDOUT:
  1697. // CHECK:STDOUT: file {
  1698. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1699. // CHECK:STDOUT: .NegateI32 = imports.%import_ref.1
  1700. // CHECK:STDOUT: .SubI32 = imports.%import_ref.2
  1701. // CHECK:STDOUT: .AddU32 = imports.%import_ref.3
  1702. // CHECK:STDOUT: .IntLiteral = imports.%import_ref.4
  1703. // CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5
  1704. // CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6
  1705. // CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7
  1706. // CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8
  1707. // CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9
  1708. // CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10
  1709. // CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11
  1710. // CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12
  1711. // CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13
  1712. // CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14
  1713. // CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15
  1714. // CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16
  1715. // CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17
  1716. // CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18
  1717. // CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19
  1718. // CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20
  1719. // CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21
  1720. // CHECK:STDOUT: .Core = imports.%Core
  1721. // CHECK:STDOUT: .max_plus_one = @__global_init.%max_plus_one
  1722. // CHECK:STDOUT: }
  1723. // CHECK:STDOUT: %Core.import = import Core
  1724. // CHECK:STDOUT: %default.import = import <invalid>
  1725. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  1726. // CHECK:STDOUT: %.loc5_19.1: type = value_of_initializer %int.make_type_32 [template = i32]
  1727. // CHECK:STDOUT: %.loc5_19.2: type = converted %int.make_type_32, %.loc5_19.1 [template = i32]
  1728. // CHECK:STDOUT: }
  1729. // CHECK:STDOUT:
  1730. // CHECK:STDOUT: fn @Uint32ToInt32(%a.param_patt: %.2) -> i32 = "int.convert_checked";
  1731. // CHECK:STDOUT:
  1732. // CHECK:STDOUT: fn @AddU32(%a.param_patt: %.2, %b.param_patt: %.2) -> %.2 = "int.uadd";
  1733. // CHECK:STDOUT:
  1734. // CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: i32) -> %.2 = "int.convert_checked";
  1735. // CHECK:STDOUT:
  1736. // CHECK:STDOUT: fn @__global_init() {
  1737. // CHECK:STDOUT: !entry:
  1738. // CHECK:STDOUT: %Uint32ToInt32.ref: %Uint32ToInt32.type = name_ref Uint32ToInt32, imports.%import_ref.7 [template = constants.%Uint32ToInt32]
  1739. // CHECK:STDOUT: %AddU32.ref: %AddU32.type = name_ref AddU32, imports.%import_ref.3 [template = constants.%AddU32]
  1740. // CHECK:STDOUT: %Int32ToUint32.ref.loc11: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  1741. // CHECK:STDOUT: %.loc11_26: i32 = int_value 2147483647 [template = constants.%.3]
  1742. // CHECK:STDOUT: %int.convert_checked.loc11: init %.2 = call %Int32ToUint32.ref.loc11(%.loc11_26) [template = constants.%.4]
  1743. // CHECK:STDOUT: %Int32ToUint32.ref.loc12: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  1744. // CHECK:STDOUT: %.loc12_26: i32 = int_value 1 [template = constants.%.5]
  1745. // CHECK:STDOUT: %int.convert_checked.loc12: init %.2 = call %Int32ToUint32.ref.loc12(%.loc12_26) [template = constants.%.6]
  1746. // CHECK:STDOUT: %.loc11_25.1: %.2 = value_of_initializer %int.convert_checked.loc11 [template = constants.%.4]
  1747. // CHECK:STDOUT: %.loc11_25.2: %.2 = converted %int.convert_checked.loc11, %.loc11_25.1 [template = constants.%.4]
  1748. // CHECK:STDOUT: %.loc12_25.1: %.2 = value_of_initializer %int.convert_checked.loc12 [template = constants.%.6]
  1749. // CHECK:STDOUT: %.loc12_25.2: %.2 = converted %int.convert_checked.loc12, %.loc12_25.1 [template = constants.%.6]
  1750. // CHECK:STDOUT: %int.uadd: init %.2 = call %AddU32.ref(%.loc11_25.2, %.loc12_25.2) [template = constants.%.7]
  1751. // CHECK:STDOUT: %.loc11_11.1: %.2 = value_of_initializer %int.uadd [template = constants.%.7]
  1752. // CHECK:STDOUT: %.loc11_11.2: %.2 = converted %int.uadd, %.loc11_11.1 [template = constants.%.7]
  1753. // CHECK:STDOUT: %int.convert_checked.loc10: init i32 = call %Uint32ToInt32.ref(%.loc11_11.2) [template = constants.%.8]
  1754. // CHECK:STDOUT: %.loc12_30.1: i32 = value_of_initializer %int.convert_checked.loc10 [template = constants.%.8]
  1755. // CHECK:STDOUT: %.loc12_30.2: i32 = converted %int.convert_checked.loc10, %.loc12_30.1 [template = constants.%.8]
  1756. // CHECK:STDOUT: %max_plus_one: i32 = bind_name max_plus_one, %.loc12_30.2
  1757. // CHECK:STDOUT: return
  1758. // CHECK:STDOUT: }
  1759. // CHECK:STDOUT:
  1760. // CHECK:STDOUT: --- fail_too_large_i32_for_i16.carbon
  1761. // CHECK:STDOUT:
  1762. // CHECK:STDOUT: constants {
  1763. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 16 [template]
  1764. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  1765. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  1766. // CHECK:STDOUT: %.2: type = int_type signed, %.1 [template]
  1767. // CHECK:STDOUT: %Int32ToInt16.type: type = fn_type @Int32ToInt16 [template]
  1768. // CHECK:STDOUT: %Int32ToInt16: %Int32ToInt16.type = struct_value () [template]
  1769. // CHECK:STDOUT: %.3: i32 = int_value 32768 [template]
  1770. // CHECK:STDOUT: %.4: %.2 = int_value 32768 [template]
  1771. // CHECK:STDOUT: }
  1772. // CHECK:STDOUT:
  1773. // CHECK:STDOUT: imports {
  1774. // CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, inst+25, unloaded
  1775. // CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, inst+49, unloaded
  1776. // CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, inst+89, unloaded
  1777. // CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, inst+96, unloaded
  1778. // CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, inst+113, unloaded
  1779. // CHECK:STDOUT: %import_ref.6 = import_ref Main//int_ops, inst+131, unloaded
  1780. // CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, inst+149, unloaded
  1781. // CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, inst+168, unloaded
  1782. // CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, inst+187, unloaded
  1783. // CHECK:STDOUT: %import_ref.10: %Int32ToInt16.type = import_ref Main//int_ops, inst+218, loaded [template = constants.%Int32ToInt16]
  1784. // CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, inst+237, unloaded
  1785. // CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, inst+256, unloaded
  1786. // CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, inst+275, unloaded
  1787. // CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, inst+294, unloaded
  1788. // CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, inst+313, unloaded
  1789. // CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, inst+333, unloaded
  1790. // CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, inst+352, unloaded
  1791. // CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, inst+371, unloaded
  1792. // CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, inst+390, unloaded
  1793. // CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, inst+408, unloaded
  1794. // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded
  1795. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1796. // CHECK:STDOUT: .Int = %import_ref.22
  1797. // CHECK:STDOUT: import Core//prelude
  1798. // CHECK:STDOUT: import Core//prelude/...
  1799. // CHECK:STDOUT: }
  1800. // CHECK:STDOUT: }
  1801. // CHECK:STDOUT:
  1802. // CHECK:STDOUT: file {
  1803. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1804. // CHECK:STDOUT: .NegateI32 = imports.%import_ref.1
  1805. // CHECK:STDOUT: .SubI32 = imports.%import_ref.2
  1806. // CHECK:STDOUT: .AddU32 = imports.%import_ref.3
  1807. // CHECK:STDOUT: .IntLiteral = imports.%import_ref.4
  1808. // CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5
  1809. // CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6
  1810. // CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7
  1811. // CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8
  1812. // CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9
  1813. // CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10
  1814. // CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11
  1815. // CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12
  1816. // CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13
  1817. // CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14
  1818. // CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15
  1819. // CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16
  1820. // CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17
  1821. // CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18
  1822. // CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19
  1823. // CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20
  1824. // CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21
  1825. // CHECK:STDOUT: .Core = imports.%Core
  1826. // CHECK:STDOUT: .max_plus_one = @__global_init.%max_plus_one
  1827. // CHECK:STDOUT: }
  1828. // CHECK:STDOUT: %Core.import = import Core
  1829. // CHECK:STDOUT: %default.import = import <invalid>
  1830. // CHECK:STDOUT: %.loc9_19.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  1831. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc9_19.1) [template = constants.%.2]
  1832. // CHECK:STDOUT: %.loc9_19.2: type = value_of_initializer %int.make_type_signed [template = constants.%.2]
  1833. // CHECK:STDOUT: %.loc9_19.3: type = converted %int.make_type_signed, %.loc9_19.2 [template = constants.%.2]
  1834. // CHECK:STDOUT: }
  1835. // CHECK:STDOUT:
  1836. // CHECK:STDOUT: fn @Int32ToInt16(%a.param_patt: i32) -> %.2 = "int.convert_checked";
  1837. // CHECK:STDOUT:
  1838. // CHECK:STDOUT: fn @__global_init() {
  1839. // CHECK:STDOUT: !entry:
  1840. // CHECK:STDOUT: %Int32ToInt16.ref: %Int32ToInt16.type = name_ref Int32ToInt16, imports.%import_ref.10 [template = constants.%Int32ToInt16]
  1841. // CHECK:STDOUT: %.loc9_38: i32 = int_value 32768 [template = constants.%.3]
  1842. // CHECK:STDOUT: %int.convert_checked: init %.2 = call %Int32ToInt16.ref(%.loc9_38) [template = constants.%.4]
  1843. // CHECK:STDOUT: %.loc9_45.1: %.2 = value_of_initializer %int.convert_checked [template = constants.%.4]
  1844. // CHECK:STDOUT: %.loc9_45.2: %.2 = converted %int.convert_checked, %.loc9_45.1 [template = constants.%.4]
  1845. // CHECK:STDOUT: %max_plus_one: %.2 = bind_name max_plus_one, %.loc9_45.2
  1846. // CHECK:STDOUT: return
  1847. // CHECK:STDOUT: }
  1848. // CHECK:STDOUT:
  1849. // CHECK:STDOUT: --- fail_too_large_i32_for_u16.carbon
  1850. // CHECK:STDOUT:
  1851. // CHECK:STDOUT: constants {
  1852. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 16 [template]
  1853. // CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template]
  1854. // CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template]
  1855. // CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template]
  1856. // CHECK:STDOUT: %Int32ToUint16.type: type = fn_type @Int32ToUint16 [template]
  1857. // CHECK:STDOUT: %Int32ToUint16: %Int32ToUint16.type = struct_value () [template]
  1858. // CHECK:STDOUT: %.3: i32 = int_value 65536 [template]
  1859. // CHECK:STDOUT: %.4: %.2 = int_value 65536 [template]
  1860. // CHECK:STDOUT: }
  1861. // CHECK:STDOUT:
  1862. // CHECK:STDOUT: imports {
  1863. // CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, inst+25, unloaded
  1864. // CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, inst+49, unloaded
  1865. // CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, inst+89, unloaded
  1866. // CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, inst+96, unloaded
  1867. // CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, inst+113, unloaded
  1868. // CHECK:STDOUT: %import_ref.6 = import_ref Main//int_ops, inst+131, unloaded
  1869. // CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, inst+149, unloaded
  1870. // CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, inst+168, unloaded
  1871. // CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, inst+187, unloaded
  1872. // CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, inst+218, unloaded
  1873. // CHECK:STDOUT: %import_ref.11: %Int32ToUint16.type = import_ref Main//int_ops, inst+237, loaded [template = constants.%Int32ToUint16]
  1874. // CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, inst+256, unloaded
  1875. // CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, inst+275, unloaded
  1876. // CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, inst+294, unloaded
  1877. // CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, inst+313, unloaded
  1878. // CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, inst+333, unloaded
  1879. // CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, inst+352, unloaded
  1880. // CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, inst+371, unloaded
  1881. // CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, inst+390, unloaded
  1882. // CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, inst+408, unloaded
  1883. // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded
  1884. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1885. // CHECK:STDOUT: .UInt = %import_ref.22
  1886. // CHECK:STDOUT: import Core//prelude
  1887. // CHECK:STDOUT: import Core//prelude/...
  1888. // CHECK:STDOUT: }
  1889. // CHECK:STDOUT: }
  1890. // CHECK:STDOUT:
  1891. // CHECK:STDOUT: file {
  1892. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1893. // CHECK:STDOUT: .NegateI32 = imports.%import_ref.1
  1894. // CHECK:STDOUT: .SubI32 = imports.%import_ref.2
  1895. // CHECK:STDOUT: .AddU32 = imports.%import_ref.3
  1896. // CHECK:STDOUT: .IntLiteral = imports.%import_ref.4
  1897. // CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5
  1898. // CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6
  1899. // CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7
  1900. // CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8
  1901. // CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9
  1902. // CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10
  1903. // CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11
  1904. // CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12
  1905. // CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13
  1906. // CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14
  1907. // CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15
  1908. // CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16
  1909. // CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17
  1910. // CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18
  1911. // CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19
  1912. // CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20
  1913. // CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21
  1914. // CHECK:STDOUT: .Core = imports.%Core
  1915. // CHECK:STDOUT: .max_plus_one = @__global_init.%max_plus_one
  1916. // CHECK:STDOUT: }
  1917. // CHECK:STDOUT: %Core.import = import Core
  1918. // CHECK:STDOUT: %default.import = import <invalid>
  1919. // CHECK:STDOUT: %.loc9_19.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  1920. // CHECK:STDOUT: %int.make_type_unsigned: init type = call constants.%UInt(%.loc9_19.1) [template = constants.%.2]
  1921. // CHECK:STDOUT: %.loc9_19.2: type = value_of_initializer %int.make_type_unsigned [template = constants.%.2]
  1922. // CHECK:STDOUT: %.loc9_19.3: type = converted %int.make_type_unsigned, %.loc9_19.2 [template = constants.%.2]
  1923. // CHECK:STDOUT: }
  1924. // CHECK:STDOUT:
  1925. // CHECK:STDOUT: fn @Int32ToUint16(%a.param_patt: i32) -> %.2 = "int.convert_checked";
  1926. // CHECK:STDOUT:
  1927. // CHECK:STDOUT: fn @__global_init() {
  1928. // CHECK:STDOUT: !entry:
  1929. // CHECK:STDOUT: %Int32ToUint16.ref: %Int32ToUint16.type = name_ref Int32ToUint16, imports.%import_ref.11 [template = constants.%Int32ToUint16]
  1930. // CHECK:STDOUT: %.loc9_39: i32 = int_value 65536 [template = constants.%.3]
  1931. // CHECK:STDOUT: %int.convert_checked: init %.2 = call %Int32ToUint16.ref(%.loc9_39) [template = constants.%.4]
  1932. // CHECK:STDOUT: %.loc9_48.1: %.2 = value_of_initializer %int.convert_checked [template = constants.%.4]
  1933. // CHECK:STDOUT: %.loc9_48.2: %.2 = converted %int.convert_checked, %.loc9_48.1 [template = constants.%.4]
  1934. // CHECK:STDOUT: %max_plus_one: %.2 = bind_name max_plus_one, %.loc9_48.2
  1935. // CHECK:STDOUT: return
  1936. // CHECK:STDOUT: }
  1937. // CHECK:STDOUT:
  1938. // CHECK:STDOUT: --- fail_too_large_u32_for_i16.carbon
  1939. // CHECK:STDOUT:
  1940. // CHECK:STDOUT: constants {
  1941. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 16 [template]
  1942. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  1943. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  1944. // CHECK:STDOUT: %.2: type = int_type signed, %.1 [template]
  1945. // CHECK:STDOUT: %Uint32ToInt16.type: type = fn_type @Uint32ToInt16 [template]
  1946. // CHECK:STDOUT: %Uint32ToInt16: %Uint32ToInt16.type = struct_value () [template]
  1947. // CHECK:STDOUT: %.3: Core.IntLiteral = int_value 32 [template]
  1948. // CHECK:STDOUT: %.4: type = int_type unsigned, %.3 [template]
  1949. // CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template]
  1950. // CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template]
  1951. // CHECK:STDOUT: %.5: i32 = int_value 32768 [template]
  1952. // CHECK:STDOUT: %.6: %.4 = int_value 32768 [template]
  1953. // CHECK:STDOUT: %.7: %.2 = int_value 32768 [template]
  1954. // CHECK:STDOUT: }
  1955. // CHECK:STDOUT:
  1956. // CHECK:STDOUT: imports {
  1957. // CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, inst+25, unloaded
  1958. // CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, inst+49, unloaded
  1959. // CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, inst+89, unloaded
  1960. // CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, inst+96, unloaded
  1961. // CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, inst+113, unloaded
  1962. // CHECK:STDOUT: %import_ref.6: %Int32ToUint32.type = import_ref Main//int_ops, inst+131, loaded [template = constants.%Int32ToUint32]
  1963. // CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, inst+149, unloaded
  1964. // CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, inst+168, unloaded
  1965. // CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, inst+187, unloaded
  1966. // CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, inst+218, unloaded
  1967. // CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, inst+237, unloaded
  1968. // CHECK:STDOUT: %import_ref.12: %Uint32ToInt16.type = import_ref Main//int_ops, inst+256, loaded [template = constants.%Uint32ToInt16]
  1969. // CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, inst+275, unloaded
  1970. // CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, inst+294, unloaded
  1971. // CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, inst+313, unloaded
  1972. // CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, inst+333, unloaded
  1973. // CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, inst+352, unloaded
  1974. // CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, inst+371, unloaded
  1975. // CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, inst+390, unloaded
  1976. // CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, inst+408, unloaded
  1977. // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded
  1978. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1979. // CHECK:STDOUT: .Int = %import_ref.22
  1980. // CHECK:STDOUT: import Core//prelude
  1981. // CHECK:STDOUT: import Core//prelude/...
  1982. // CHECK:STDOUT: }
  1983. // CHECK:STDOUT: }
  1984. // CHECK:STDOUT:
  1985. // CHECK:STDOUT: file {
  1986. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1987. // CHECK:STDOUT: .NegateI32 = imports.%import_ref.1
  1988. // CHECK:STDOUT: .SubI32 = imports.%import_ref.2
  1989. // CHECK:STDOUT: .AddU32 = imports.%import_ref.3
  1990. // CHECK:STDOUT: .IntLiteral = imports.%import_ref.4
  1991. // CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5
  1992. // CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6
  1993. // CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7
  1994. // CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8
  1995. // CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9
  1996. // CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10
  1997. // CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11
  1998. // CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12
  1999. // CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13
  2000. // CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14
  2001. // CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15
  2002. // CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16
  2003. // CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17
  2004. // CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18
  2005. // CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19
  2006. // CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20
  2007. // CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21
  2008. // CHECK:STDOUT: .Core = imports.%Core
  2009. // CHECK:STDOUT: .max_plus_one = @__global_init.%max_plus_one
  2010. // CHECK:STDOUT: }
  2011. // CHECK:STDOUT: %Core.import = import Core
  2012. // CHECK:STDOUT: %default.import = import <invalid>
  2013. // CHECK:STDOUT: %.loc9_19.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  2014. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc9_19.1) [template = constants.%.2]
  2015. // CHECK:STDOUT: %.loc9_19.2: type = value_of_initializer %int.make_type_signed [template = constants.%.2]
  2016. // CHECK:STDOUT: %.loc9_19.3: type = converted %int.make_type_signed, %.loc9_19.2 [template = constants.%.2]
  2017. // CHECK:STDOUT: }
  2018. // CHECK:STDOUT:
  2019. // CHECK:STDOUT: fn @Uint32ToInt16(%a.param_patt: %.4) -> %.2 = "int.convert_checked";
  2020. // CHECK:STDOUT:
  2021. // CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: i32) -> %.4 = "int.convert_checked";
  2022. // CHECK:STDOUT:
  2023. // CHECK:STDOUT: fn @__global_init() {
  2024. // CHECK:STDOUT: !entry:
  2025. // CHECK:STDOUT: %Uint32ToInt16.ref: %Uint32ToInt16.type = name_ref Uint32ToInt16, imports.%import_ref.12 [template = constants.%Uint32ToInt16]
  2026. // CHECK:STDOUT: %Int32ToUint32.ref: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  2027. // CHECK:STDOUT: %.loc9_53: i32 = int_value 32768 [template = constants.%.5]
  2028. // CHECK:STDOUT: %int.convert_checked.loc9_52: init %.4 = call %Int32ToUint32.ref(%.loc9_53) [template = constants.%.6]
  2029. // CHECK:STDOUT: %.loc9_52.1: %.4 = value_of_initializer %int.convert_checked.loc9_52 [template = constants.%.6]
  2030. // CHECK:STDOUT: %.loc9_52.2: %.4 = converted %int.convert_checked.loc9_52, %.loc9_52.1 [template = constants.%.6]
  2031. // CHECK:STDOUT: %int.convert_checked.loc9_38: init %.2 = call %Uint32ToInt16.ref(%.loc9_52.2) [template = constants.%.7]
  2032. // CHECK:STDOUT: %.loc9_61.1: %.2 = value_of_initializer %int.convert_checked.loc9_38 [template = constants.%.7]
  2033. // CHECK:STDOUT: %.loc9_61.2: %.2 = converted %int.convert_checked.loc9_38, %.loc9_61.1 [template = constants.%.7]
  2034. // CHECK:STDOUT: %max_plus_one: %.2 = bind_name max_plus_one, %.loc9_61.2
  2035. // CHECK:STDOUT: return
  2036. // CHECK:STDOUT: }
  2037. // CHECK:STDOUT:
  2038. // CHECK:STDOUT: --- fail_too_large_u32_for_u16.carbon
  2039. // CHECK:STDOUT:
  2040. // CHECK:STDOUT: constants {
  2041. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 16 [template]
  2042. // CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template]
  2043. // CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template]
  2044. // CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template]
  2045. // CHECK:STDOUT: %Uint32ToUint16.type: type = fn_type @Uint32ToUint16 [template]
  2046. // CHECK:STDOUT: %Uint32ToUint16: %Uint32ToUint16.type = struct_value () [template]
  2047. // CHECK:STDOUT: %.3: Core.IntLiteral = int_value 32 [template]
  2048. // CHECK:STDOUT: %.4: type = int_type unsigned, %.3 [template]
  2049. // CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template]
  2050. // CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template]
  2051. // CHECK:STDOUT: %.5: i32 = int_value 65536 [template]
  2052. // CHECK:STDOUT: %.6: %.4 = int_value 65536 [template]
  2053. // CHECK:STDOUT: %.7: %.2 = int_value 65536 [template]
  2054. // CHECK:STDOUT: }
  2055. // CHECK:STDOUT:
  2056. // CHECK:STDOUT: imports {
  2057. // CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, inst+25, unloaded
  2058. // CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, inst+49, unloaded
  2059. // CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, inst+89, unloaded
  2060. // CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, inst+96, unloaded
  2061. // CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, inst+113, unloaded
  2062. // CHECK:STDOUT: %import_ref.6: %Int32ToUint32.type = import_ref Main//int_ops, inst+131, loaded [template = constants.%Int32ToUint32]
  2063. // CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, inst+149, unloaded
  2064. // CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, inst+168, unloaded
  2065. // CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, inst+187, unloaded
  2066. // CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, inst+218, unloaded
  2067. // CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, inst+237, unloaded
  2068. // CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, inst+256, unloaded
  2069. // CHECK:STDOUT: %import_ref.13: %Uint32ToUint16.type = import_ref Main//int_ops, inst+275, loaded [template = constants.%Uint32ToUint16]
  2070. // CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, inst+294, unloaded
  2071. // CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, inst+313, unloaded
  2072. // CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, inst+333, unloaded
  2073. // CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, inst+352, unloaded
  2074. // CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, inst+371, unloaded
  2075. // CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, inst+390, unloaded
  2076. // CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, inst+408, unloaded
  2077. // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded
  2078. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  2079. // CHECK:STDOUT: .UInt = %import_ref.22
  2080. // CHECK:STDOUT: import Core//prelude
  2081. // CHECK:STDOUT: import Core//prelude/...
  2082. // CHECK:STDOUT: }
  2083. // CHECK:STDOUT: }
  2084. // CHECK:STDOUT:
  2085. // CHECK:STDOUT: file {
  2086. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  2087. // CHECK:STDOUT: .NegateI32 = imports.%import_ref.1
  2088. // CHECK:STDOUT: .SubI32 = imports.%import_ref.2
  2089. // CHECK:STDOUT: .AddU32 = imports.%import_ref.3
  2090. // CHECK:STDOUT: .IntLiteral = imports.%import_ref.4
  2091. // CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5
  2092. // CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6
  2093. // CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7
  2094. // CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8
  2095. // CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9
  2096. // CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10
  2097. // CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11
  2098. // CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12
  2099. // CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13
  2100. // CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14
  2101. // CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15
  2102. // CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16
  2103. // CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17
  2104. // CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18
  2105. // CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19
  2106. // CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20
  2107. // CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21
  2108. // CHECK:STDOUT: .Core = imports.%Core
  2109. // CHECK:STDOUT: .max_plus_one = @__global_init.%max_plus_one
  2110. // CHECK:STDOUT: }
  2111. // CHECK:STDOUT: %Core.import = import Core
  2112. // CHECK:STDOUT: %default.import = import <invalid>
  2113. // CHECK:STDOUT: %.loc9_19.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  2114. // CHECK:STDOUT: %int.make_type_unsigned: init type = call constants.%UInt(%.loc9_19.1) [template = constants.%.2]
  2115. // CHECK:STDOUT: %.loc9_19.2: type = value_of_initializer %int.make_type_unsigned [template = constants.%.2]
  2116. // CHECK:STDOUT: %.loc9_19.3: type = converted %int.make_type_unsigned, %.loc9_19.2 [template = constants.%.2]
  2117. // CHECK:STDOUT: }
  2118. // CHECK:STDOUT:
  2119. // CHECK:STDOUT: fn @Uint32ToUint16(%a.param_patt: %.4) -> %.2 = "int.convert_checked";
  2120. // CHECK:STDOUT:
  2121. // CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: i32) -> %.4 = "int.convert_checked";
  2122. // CHECK:STDOUT:
  2123. // CHECK:STDOUT: fn @__global_init() {
  2124. // CHECK:STDOUT: !entry:
  2125. // CHECK:STDOUT: %Uint32ToUint16.ref: %Uint32ToUint16.type = name_ref Uint32ToUint16, imports.%import_ref.13 [template = constants.%Uint32ToUint16]
  2126. // CHECK:STDOUT: %Int32ToUint32.ref: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  2127. // CHECK:STDOUT: %.loc9_54: i32 = int_value 65536 [template = constants.%.5]
  2128. // CHECK:STDOUT: %int.convert_checked.loc9_53: init %.4 = call %Int32ToUint32.ref(%.loc9_54) [template = constants.%.6]
  2129. // CHECK:STDOUT: %.loc9_53.1: %.4 = value_of_initializer %int.convert_checked.loc9_53 [template = constants.%.6]
  2130. // CHECK:STDOUT: %.loc9_53.2: %.4 = converted %int.convert_checked.loc9_53, %.loc9_53.1 [template = constants.%.6]
  2131. // CHECK:STDOUT: %int.convert_checked.loc9_39: init %.2 = call %Uint32ToUint16.ref(%.loc9_53.2) [template = constants.%.7]
  2132. // CHECK:STDOUT: %.loc9_64.1: %.2 = value_of_initializer %int.convert_checked.loc9_39 [template = constants.%.7]
  2133. // CHECK:STDOUT: %.loc9_64.2: %.2 = converted %int.convert_checked.loc9_39, %.loc9_64.1 [template = constants.%.7]
  2134. // CHECK:STDOUT: %max_plus_one: %.2 = bind_name max_plus_one, %.loc9_64.2
  2135. // CHECK:STDOUT: return
  2136. // CHECK:STDOUT: }
  2137. // CHECK:STDOUT:
  2138. // CHECK:STDOUT: --- fail_negative_i32_to_u16.carbon
  2139. // CHECK:STDOUT:
  2140. // CHECK:STDOUT: constants {
  2141. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 16 [template]
  2142. // CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template]
  2143. // CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template]
  2144. // CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template]
  2145. // CHECK:STDOUT: %Int32ToUint16.type: type = fn_type @Int32ToUint16 [template]
  2146. // CHECK:STDOUT: %Int32ToUint16: %Int32ToUint16.type = struct_value () [template]
  2147. // CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template]
  2148. // CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template]
  2149. // CHECK:STDOUT: %.3: i32 = int_value 0 [template]
  2150. // CHECK:STDOUT: %.4: i32 = int_value 1 [template]
  2151. // CHECK:STDOUT: %.5: i32 = int_value -1 [template]
  2152. // CHECK:STDOUT: %.6: %.2 = int_value 18446744073709551615 [template]
  2153. // CHECK:STDOUT: }
  2154. // CHECK:STDOUT:
  2155. // CHECK:STDOUT: imports {
  2156. // CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, inst+25, unloaded
  2157. // CHECK:STDOUT: %import_ref.2: %SubI32.type = import_ref Main//int_ops, inst+49, loaded [template = constants.%SubI32]
  2158. // CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, inst+89, unloaded
  2159. // CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, inst+96, unloaded
  2160. // CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, inst+113, unloaded
  2161. // CHECK:STDOUT: %import_ref.6 = import_ref Main//int_ops, inst+131, unloaded
  2162. // CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, inst+149, unloaded
  2163. // CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, inst+168, unloaded
  2164. // CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, inst+187, unloaded
  2165. // CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, inst+218, unloaded
  2166. // CHECK:STDOUT: %import_ref.11: %Int32ToUint16.type = import_ref Main//int_ops, inst+237, loaded [template = constants.%Int32ToUint16]
  2167. // CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, inst+256, unloaded
  2168. // CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, inst+275, unloaded
  2169. // CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, inst+294, unloaded
  2170. // CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, inst+313, unloaded
  2171. // CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, inst+333, unloaded
  2172. // CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, inst+352, unloaded
  2173. // CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, inst+371, unloaded
  2174. // CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, inst+390, unloaded
  2175. // CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, inst+408, unloaded
  2176. // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded
  2177. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  2178. // CHECK:STDOUT: .UInt = %import_ref.22
  2179. // CHECK:STDOUT: import Core//prelude
  2180. // CHECK:STDOUT: import Core//prelude/...
  2181. // CHECK:STDOUT: }
  2182. // CHECK:STDOUT: }
  2183. // CHECK:STDOUT:
  2184. // CHECK:STDOUT: file {
  2185. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  2186. // CHECK:STDOUT: .NegateI32 = imports.%import_ref.1
  2187. // CHECK:STDOUT: .SubI32 = imports.%import_ref.2
  2188. // CHECK:STDOUT: .AddU32 = imports.%import_ref.3
  2189. // CHECK:STDOUT: .IntLiteral = imports.%import_ref.4
  2190. // CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5
  2191. // CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6
  2192. // CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7
  2193. // CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8
  2194. // CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9
  2195. // CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10
  2196. // CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11
  2197. // CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12
  2198. // CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13
  2199. // CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14
  2200. // CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15
  2201. // CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16
  2202. // CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17
  2203. // CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18
  2204. // CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19
  2205. // CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20
  2206. // CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21
  2207. // CHECK:STDOUT: .Core = imports.%Core
  2208. // CHECK:STDOUT: .minus_one_to_u16 = @__global_init.%minus_one_to_u16
  2209. // CHECK:STDOUT: }
  2210. // CHECK:STDOUT: %Core.import = import Core
  2211. // CHECK:STDOUT: %default.import = import <invalid>
  2212. // CHECK:STDOUT: %.loc9_23.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  2213. // CHECK:STDOUT: %int.make_type_unsigned: init type = call constants.%UInt(%.loc9_23.1) [template = constants.%.2]
  2214. // CHECK:STDOUT: %.loc9_23.2: type = value_of_initializer %int.make_type_unsigned [template = constants.%.2]
  2215. // CHECK:STDOUT: %.loc9_23.3: type = converted %int.make_type_unsigned, %.loc9_23.2 [template = constants.%.2]
  2216. // CHECK:STDOUT: }
  2217. // CHECK:STDOUT:
  2218. // CHECK:STDOUT: fn @Int32ToUint16(%a.param_patt: i32) -> %.2 = "int.convert_checked";
  2219. // CHECK:STDOUT:
  2220. // CHECK:STDOUT: fn @SubI32(%a.param_patt: i32, %b.param_patt: i32) -> i32 = "int.ssub";
  2221. // CHECK:STDOUT:
  2222. // CHECK:STDOUT: fn @__global_init() {
  2223. // CHECK:STDOUT: !entry:
  2224. // CHECK:STDOUT: %Int32ToUint16.ref: %Int32ToUint16.type = name_ref Int32ToUint16, imports.%import_ref.11 [template = constants.%Int32ToUint16]
  2225. // CHECK:STDOUT: %SubI32.ref: %SubI32.type = name_ref SubI32, imports.%import_ref.2 [template = constants.%SubI32]
  2226. // CHECK:STDOUT: %.loc9_50: i32 = int_value 0 [template = constants.%.3]
  2227. // CHECK:STDOUT: %.loc9_53: i32 = int_value 1 [template = constants.%.4]
  2228. // CHECK:STDOUT: %int.ssub: init i32 = call %SubI32.ref(%.loc9_50, %.loc9_53) [template = constants.%.5]
  2229. // CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.ssub [template = constants.%.5]
  2230. // CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.ssub, %.loc9_49.1 [template = constants.%.5]
  2231. // CHECK:STDOUT: %int.convert_checked: init %.2 = call %Int32ToUint16.ref(%.loc9_49.2) [template = constants.%.6]
  2232. // CHECK:STDOUT: %.loc9_56.1: %.2 = value_of_initializer %int.convert_checked [template = constants.%.6]
  2233. // CHECK:STDOUT: %.loc9_56.2: %.2 = converted %int.convert_checked, %.loc9_56.1 [template = constants.%.6]
  2234. // CHECK:STDOUT: %minus_one_to_u16: %.2 = bind_name minus_one_to_u16, %.loc9_56.2
  2235. // CHECK:STDOUT: return
  2236. // CHECK:STDOUT: }
  2237. // CHECK:STDOUT:
  2238. // CHECK:STDOUT: --- fail_negative_i32_to_u32.carbon
  2239. // CHECK:STDOUT:
  2240. // CHECK:STDOUT: constants {
  2241. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32 [template]
  2242. // CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template]
  2243. // CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template]
  2244. // CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template]
  2245. // CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template]
  2246. // CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template]
  2247. // CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template]
  2248. // CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template]
  2249. // CHECK:STDOUT: %.3: i32 = int_value 0 [template]
  2250. // CHECK:STDOUT: %.4: i32 = int_value 1 [template]
  2251. // CHECK:STDOUT: %.5: i32 = int_value -1 [template]
  2252. // CHECK:STDOUT: %.6: %.2 = int_value 18446744073709551615 [template]
  2253. // CHECK:STDOUT: }
  2254. // CHECK:STDOUT:
  2255. // CHECK:STDOUT: imports {
  2256. // CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, inst+25, unloaded
  2257. // CHECK:STDOUT: %import_ref.2: %SubI32.type = import_ref Main//int_ops, inst+49, loaded [template = constants.%SubI32]
  2258. // CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, inst+89, unloaded
  2259. // CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, inst+96, unloaded
  2260. // CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, inst+113, unloaded
  2261. // CHECK:STDOUT: %import_ref.6: %Int32ToUint32.type = import_ref Main//int_ops, inst+131, loaded [template = constants.%Int32ToUint32]
  2262. // CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, inst+149, unloaded
  2263. // CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, inst+168, unloaded
  2264. // CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, inst+187, unloaded
  2265. // CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, inst+218, unloaded
  2266. // CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, inst+237, unloaded
  2267. // CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, inst+256, unloaded
  2268. // CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, inst+275, unloaded
  2269. // CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, inst+294, unloaded
  2270. // CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, inst+313, unloaded
  2271. // CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, inst+333, unloaded
  2272. // CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, inst+352, unloaded
  2273. // CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, inst+371, unloaded
  2274. // CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, inst+390, unloaded
  2275. // CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, inst+408, unloaded
  2276. // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded
  2277. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  2278. // CHECK:STDOUT: .UInt = %import_ref.22
  2279. // CHECK:STDOUT: import Core//prelude
  2280. // CHECK:STDOUT: import Core//prelude/...
  2281. // CHECK:STDOUT: }
  2282. // CHECK:STDOUT: }
  2283. // CHECK:STDOUT:
  2284. // CHECK:STDOUT: file {
  2285. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  2286. // CHECK:STDOUT: .NegateI32 = imports.%import_ref.1
  2287. // CHECK:STDOUT: .SubI32 = imports.%import_ref.2
  2288. // CHECK:STDOUT: .AddU32 = imports.%import_ref.3
  2289. // CHECK:STDOUT: .IntLiteral = imports.%import_ref.4
  2290. // CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5
  2291. // CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6
  2292. // CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7
  2293. // CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8
  2294. // CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9
  2295. // CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10
  2296. // CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11
  2297. // CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12
  2298. // CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13
  2299. // CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14
  2300. // CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15
  2301. // CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16
  2302. // CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17
  2303. // CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18
  2304. // CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19
  2305. // CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20
  2306. // CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21
  2307. // CHECK:STDOUT: .Core = imports.%Core
  2308. // CHECK:STDOUT: .minus_one_to_u32 = @__global_init.%minus_one_to_u32
  2309. // CHECK:STDOUT: }
  2310. // CHECK:STDOUT: %Core.import = import Core
  2311. // CHECK:STDOUT: %default.import = import <invalid>
  2312. // CHECK:STDOUT: %.loc9_23.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  2313. // CHECK:STDOUT: %int.make_type_unsigned: init type = call constants.%UInt(%.loc9_23.1) [template = constants.%.2]
  2314. // CHECK:STDOUT: %.loc9_23.2: type = value_of_initializer %int.make_type_unsigned [template = constants.%.2]
  2315. // CHECK:STDOUT: %.loc9_23.3: type = converted %int.make_type_unsigned, %.loc9_23.2 [template = constants.%.2]
  2316. // CHECK:STDOUT: }
  2317. // CHECK:STDOUT:
  2318. // CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: i32) -> %.2 = "int.convert_checked";
  2319. // CHECK:STDOUT:
  2320. // CHECK:STDOUT: fn @SubI32(%a.param_patt: i32, %b.param_patt: i32) -> i32 = "int.ssub";
  2321. // CHECK:STDOUT:
  2322. // CHECK:STDOUT: fn @__global_init() {
  2323. // CHECK:STDOUT: !entry:
  2324. // CHECK:STDOUT: %Int32ToUint32.ref: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32]
  2325. // CHECK:STDOUT: %SubI32.ref: %SubI32.type = name_ref SubI32, imports.%import_ref.2 [template = constants.%SubI32]
  2326. // CHECK:STDOUT: %.loc9_50: i32 = int_value 0 [template = constants.%.3]
  2327. // CHECK:STDOUT: %.loc9_53: i32 = int_value 1 [template = constants.%.4]
  2328. // CHECK:STDOUT: %int.ssub: init i32 = call %SubI32.ref(%.loc9_50, %.loc9_53) [template = constants.%.5]
  2329. // CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.ssub [template = constants.%.5]
  2330. // CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.ssub, %.loc9_49.1 [template = constants.%.5]
  2331. // CHECK:STDOUT: %int.convert_checked: init %.2 = call %Int32ToUint32.ref(%.loc9_49.2) [template = constants.%.6]
  2332. // CHECK:STDOUT: %.loc9_56.1: %.2 = value_of_initializer %int.convert_checked [template = constants.%.6]
  2333. // CHECK:STDOUT: %.loc9_56.2: %.2 = converted %int.convert_checked, %.loc9_56.1 [template = constants.%.6]
  2334. // CHECK:STDOUT: %minus_one_to_u32: %.2 = bind_name minus_one_to_u32, %.loc9_56.2
  2335. // CHECK:STDOUT: return
  2336. // CHECK:STDOUT: }
  2337. // CHECK:STDOUT:
  2338. // CHECK:STDOUT: --- fail_negative_i32_to_u64.carbon
  2339. // CHECK:STDOUT:
  2340. // CHECK:STDOUT: constants {
  2341. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 64 [template]
  2342. // CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template]
  2343. // CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template]
  2344. // CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template]
  2345. // CHECK:STDOUT: %Int32ToUint64.type: type = fn_type @Int32ToUint64 [template]
  2346. // CHECK:STDOUT: %Int32ToUint64: %Int32ToUint64.type = struct_value () [template]
  2347. // CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template]
  2348. // CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template]
  2349. // CHECK:STDOUT: %.3: i32 = int_value 0 [template]
  2350. // CHECK:STDOUT: %.4: i32 = int_value 1 [template]
  2351. // CHECK:STDOUT: %.5: i32 = int_value -1 [template]
  2352. // CHECK:STDOUT: %.6: %.2 = int_value 18446744073709551615 [template]
  2353. // CHECK:STDOUT: }
  2354. // CHECK:STDOUT:
  2355. // CHECK:STDOUT: imports {
  2356. // CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, inst+25, unloaded
  2357. // CHECK:STDOUT: %import_ref.2: %SubI32.type = import_ref Main//int_ops, inst+49, loaded [template = constants.%SubI32]
  2358. // CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, inst+89, unloaded
  2359. // CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, inst+96, unloaded
  2360. // CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, inst+113, unloaded
  2361. // CHECK:STDOUT: %import_ref.6 = import_ref Main//int_ops, inst+131, unloaded
  2362. // CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, inst+149, unloaded
  2363. // CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, inst+168, unloaded
  2364. // CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, inst+187, unloaded
  2365. // CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, inst+218, unloaded
  2366. // CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, inst+237, unloaded
  2367. // CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, inst+256, unloaded
  2368. // CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, inst+275, unloaded
  2369. // CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, inst+294, unloaded
  2370. // CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, inst+313, unloaded
  2371. // CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, inst+333, unloaded
  2372. // CHECK:STDOUT: %import_ref.17: %Int32ToUint64.type = import_ref Main//int_ops, inst+352, loaded [template = constants.%Int32ToUint64]
  2373. // CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, inst+371, unloaded
  2374. // CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, inst+390, unloaded
  2375. // CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, inst+408, unloaded
  2376. // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded
  2377. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  2378. // CHECK:STDOUT: .UInt = %import_ref.22
  2379. // CHECK:STDOUT: import Core//prelude
  2380. // CHECK:STDOUT: import Core//prelude/...
  2381. // CHECK:STDOUT: }
  2382. // CHECK:STDOUT: }
  2383. // CHECK:STDOUT:
  2384. // CHECK:STDOUT: file {
  2385. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  2386. // CHECK:STDOUT: .NegateI32 = imports.%import_ref.1
  2387. // CHECK:STDOUT: .SubI32 = imports.%import_ref.2
  2388. // CHECK:STDOUT: .AddU32 = imports.%import_ref.3
  2389. // CHECK:STDOUT: .IntLiteral = imports.%import_ref.4
  2390. // CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5
  2391. // CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6
  2392. // CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7
  2393. // CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8
  2394. // CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9
  2395. // CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10
  2396. // CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11
  2397. // CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12
  2398. // CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13
  2399. // CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14
  2400. // CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15
  2401. // CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16
  2402. // CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17
  2403. // CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18
  2404. // CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19
  2405. // CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20
  2406. // CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21
  2407. // CHECK:STDOUT: .Core = imports.%Core
  2408. // CHECK:STDOUT: .minus_one_to_u64 = @__global_init.%minus_one_to_u64
  2409. // CHECK:STDOUT: }
  2410. // CHECK:STDOUT: %Core.import = import Core
  2411. // CHECK:STDOUT: %default.import = import <invalid>
  2412. // CHECK:STDOUT: %.loc9_23.1: Core.IntLiteral = int_value 64 [template = constants.%.1]
  2413. // CHECK:STDOUT: %int.make_type_unsigned: init type = call constants.%UInt(%.loc9_23.1) [template = constants.%.2]
  2414. // CHECK:STDOUT: %.loc9_23.2: type = value_of_initializer %int.make_type_unsigned [template = constants.%.2]
  2415. // CHECK:STDOUT: %.loc9_23.3: type = converted %int.make_type_unsigned, %.loc9_23.2 [template = constants.%.2]
  2416. // CHECK:STDOUT: }
  2417. // CHECK:STDOUT:
  2418. // CHECK:STDOUT: fn @Int32ToUint64(%a.param_patt: i32) -> %.2 = "int.convert_checked";
  2419. // CHECK:STDOUT:
  2420. // CHECK:STDOUT: fn @SubI32(%a.param_patt: i32, %b.param_patt: i32) -> i32 = "int.ssub";
  2421. // CHECK:STDOUT:
  2422. // CHECK:STDOUT: fn @__global_init() {
  2423. // CHECK:STDOUT: !entry:
  2424. // CHECK:STDOUT: %Int32ToUint64.ref: %Int32ToUint64.type = name_ref Int32ToUint64, imports.%import_ref.17 [template = constants.%Int32ToUint64]
  2425. // CHECK:STDOUT: %SubI32.ref: %SubI32.type = name_ref SubI32, imports.%import_ref.2 [template = constants.%SubI32]
  2426. // CHECK:STDOUT: %.loc9_50: i32 = int_value 0 [template = constants.%.3]
  2427. // CHECK:STDOUT: %.loc9_53: i32 = int_value 1 [template = constants.%.4]
  2428. // CHECK:STDOUT: %int.ssub: init i32 = call %SubI32.ref(%.loc9_50, %.loc9_53) [template = constants.%.5]
  2429. // CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.ssub [template = constants.%.5]
  2430. // CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.ssub, %.loc9_49.1 [template = constants.%.5]
  2431. // CHECK:STDOUT: %int.convert_checked: init %.2 = call %Int32ToUint64.ref(%.loc9_49.2) [template = constants.%.6]
  2432. // CHECK:STDOUT: %.loc9_56.1: %.2 = value_of_initializer %int.convert_checked [template = constants.%.6]
  2433. // CHECK:STDOUT: %.loc9_56.2: %.2 = converted %int.convert_checked, %.loc9_56.1 [template = constants.%.6]
  2434. // CHECK:STDOUT: %minus_one_to_u64: %.2 = bind_name minus_one_to_u64, %.loc9_56.2
  2435. // CHECK:STDOUT: return
  2436. // CHECK:STDOUT: }
  2437. // CHECK:STDOUT:
  2438. // CHECK:STDOUT: --- fail_too_small_i32_for_i16.carbon
  2439. // CHECK:STDOUT:
  2440. // CHECK:STDOUT: constants {
  2441. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 16 [template]
  2442. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  2443. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  2444. // CHECK:STDOUT: %.2: type = int_type signed, %.1 [template]
  2445. // CHECK:STDOUT: %Int32ToInt16.type: type = fn_type @Int32ToInt16 [template]
  2446. // CHECK:STDOUT: %Int32ToInt16: %Int32ToInt16.type = struct_value () [template]
  2447. // CHECK:STDOUT: %NegateI32.type: type = fn_type @NegateI32 [template]
  2448. // CHECK:STDOUT: %NegateI32: %NegateI32.type = struct_value () [template]
  2449. // CHECK:STDOUT: %.3: i32 = int_value 32769 [template]
  2450. // CHECK:STDOUT: %.4: i32 = int_value -32769 [template]
  2451. // CHECK:STDOUT: %.5: %.2 = int_value -32769 [template]
  2452. // CHECK:STDOUT: }
  2453. // CHECK:STDOUT:
  2454. // CHECK:STDOUT: imports {
  2455. // CHECK:STDOUT: %import_ref.1: %NegateI32.type = import_ref Main//int_ops, inst+25, loaded [template = constants.%NegateI32]
  2456. // CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, inst+49, unloaded
  2457. // CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, inst+89, unloaded
  2458. // CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, inst+96, unloaded
  2459. // CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, inst+113, unloaded
  2460. // CHECK:STDOUT: %import_ref.6 = import_ref Main//int_ops, inst+131, unloaded
  2461. // CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, inst+149, unloaded
  2462. // CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, inst+168, unloaded
  2463. // CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, inst+187, unloaded
  2464. // CHECK:STDOUT: %import_ref.10: %Int32ToInt16.type = import_ref Main//int_ops, inst+218, loaded [template = constants.%Int32ToInt16]
  2465. // CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, inst+237, unloaded
  2466. // CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, inst+256, unloaded
  2467. // CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, inst+275, unloaded
  2468. // CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, inst+294, unloaded
  2469. // CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, inst+313, unloaded
  2470. // CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, inst+333, unloaded
  2471. // CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, inst+352, unloaded
  2472. // CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, inst+371, unloaded
  2473. // CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, inst+390, unloaded
  2474. // CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, inst+408, unloaded
  2475. // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded
  2476. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  2477. // CHECK:STDOUT: .Int = %import_ref.22
  2478. // CHECK:STDOUT: import Core//prelude
  2479. // CHECK:STDOUT: import Core//prelude/...
  2480. // CHECK:STDOUT: }
  2481. // CHECK:STDOUT: }
  2482. // CHECK:STDOUT:
  2483. // CHECK:STDOUT: file {
  2484. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  2485. // CHECK:STDOUT: .NegateI32 = imports.%import_ref.1
  2486. // CHECK:STDOUT: .SubI32 = imports.%import_ref.2
  2487. // CHECK:STDOUT: .AddU32 = imports.%import_ref.3
  2488. // CHECK:STDOUT: .IntLiteral = imports.%import_ref.4
  2489. // CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5
  2490. // CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6
  2491. // CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7
  2492. // CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8
  2493. // CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9
  2494. // CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10
  2495. // CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11
  2496. // CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12
  2497. // CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13
  2498. // CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14
  2499. // CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15
  2500. // CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16
  2501. // CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17
  2502. // CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18
  2503. // CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19
  2504. // CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20
  2505. // CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21
  2506. // CHECK:STDOUT: .Core = imports.%Core
  2507. // CHECK:STDOUT: .min_minus_one = @__global_init.%min_minus_one
  2508. // CHECK:STDOUT: }
  2509. // CHECK:STDOUT: %Core.import = import Core
  2510. // CHECK:STDOUT: %default.import = import <invalid>
  2511. // CHECK:STDOUT: %.loc9_20.1: Core.IntLiteral = int_value 16 [template = constants.%.1]
  2512. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc9_20.1) [template = constants.%.2]
  2513. // CHECK:STDOUT: %.loc9_20.2: type = value_of_initializer %int.make_type_signed [template = constants.%.2]
  2514. // CHECK:STDOUT: %.loc9_20.3: type = converted %int.make_type_signed, %.loc9_20.2 [template = constants.%.2]
  2515. // CHECK:STDOUT: }
  2516. // CHECK:STDOUT:
  2517. // CHECK:STDOUT: fn @Int32ToInt16(%a.param_patt: i32) -> %.2 = "int.convert_checked";
  2518. // CHECK:STDOUT:
  2519. // CHECK:STDOUT: fn @NegateI32(%a.param_patt: i32) -> i32 = "int.snegate";
  2520. // CHECK:STDOUT:
  2521. // CHECK:STDOUT: fn @__global_init() {
  2522. // CHECK:STDOUT: !entry:
  2523. // CHECK:STDOUT: %Int32ToInt16.ref: %Int32ToInt16.type = name_ref Int32ToInt16, imports.%import_ref.10 [template = constants.%Int32ToInt16]
  2524. // CHECK:STDOUT: %NegateI32.ref: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32]
  2525. // CHECK:STDOUT: %.loc9_49: i32 = int_value 32769 [template = constants.%.3]
  2526. // CHECK:STDOUT: %int.snegate: init i32 = call %NegateI32.ref(%.loc9_49) [template = constants.%.4]
  2527. // CHECK:STDOUT: %.loc9_48.1: i32 = value_of_initializer %int.snegate [template = constants.%.4]
  2528. // CHECK:STDOUT: %.loc9_48.2: i32 = converted %int.snegate, %.loc9_48.1 [template = constants.%.4]
  2529. // CHECK:STDOUT: %int.convert_checked: init %.2 = call %Int32ToInt16.ref(%.loc9_48.2) [template = constants.%.5]
  2530. // CHECK:STDOUT: %.loc9_57.1: %.2 = value_of_initializer %int.convert_checked [template = constants.%.5]
  2531. // CHECK:STDOUT: %.loc9_57.2: %.2 = converted %int.convert_checked, %.loc9_57.1 [template = constants.%.5]
  2532. // CHECK:STDOUT: %min_minus_one: %.2 = bind_name min_minus_one, %.loc9_57.2
  2533. // CHECK:STDOUT: return
  2534. // CHECK:STDOUT: }
  2535. // CHECK:STDOUT:
  2536. // CHECK:STDOUT: --- fail_not_constant.carbon
  2537. // CHECK:STDOUT:
  2538. // CHECK:STDOUT: constants {
  2539. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  2540. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  2541. // CHECK:STDOUT: %.1: i32 = int_value 0 [template]
  2542. // CHECK:STDOUT: %.2: Core.IntLiteral = int_value 16 [template]
  2543. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  2544. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  2545. // CHECK:STDOUT: %.3: type = int_type signed, %.2 [template]
  2546. // CHECK:STDOUT: %Int32ToInt16.type: type = fn_type @Int32ToInt16 [template]
  2547. // CHECK:STDOUT: %Int32ToInt16: %Int32ToInt16.type = struct_value () [template]
  2548. // CHECK:STDOUT: %Int32ToInt32.type: type = fn_type @Int32ToInt32 [template]
  2549. // CHECK:STDOUT: %Int32ToInt32: %Int32ToInt32.type = struct_value () [template]
  2550. // CHECK:STDOUT: %.4: Core.IntLiteral = int_value 64 [template]
  2551. // CHECK:STDOUT: %.5: type = int_type signed, %.4 [template]
  2552. // CHECK:STDOUT: %Int32ToInt64.type: type = fn_type @Int32ToInt64 [template]
  2553. // CHECK:STDOUT: %Int32ToInt64: %Int32ToInt64.type = struct_value () [template]
  2554. // CHECK:STDOUT: }
  2555. // CHECK:STDOUT:
  2556. // CHECK:STDOUT: imports {
  2557. // CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, inst+25, unloaded
  2558. // CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, inst+49, unloaded
  2559. // CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, inst+89, unloaded
  2560. // CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, inst+96, unloaded
  2561. // CHECK:STDOUT: %import_ref.5: %Int32ToInt32.type = import_ref Main//int_ops, inst+113, loaded [template = constants.%Int32ToInt32]
  2562. // CHECK:STDOUT: %import_ref.6 = import_ref Main//int_ops, inst+131, unloaded
  2563. // CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, inst+149, unloaded
  2564. // CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, inst+168, unloaded
  2565. // CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, inst+187, unloaded
  2566. // CHECK:STDOUT: %import_ref.10: %Int32ToInt16.type = import_ref Main//int_ops, inst+218, loaded [template = constants.%Int32ToInt16]
  2567. // CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, inst+237, unloaded
  2568. // CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, inst+256, unloaded
  2569. // CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, inst+275, unloaded
  2570. // CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, inst+294, unloaded
  2571. // CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, inst+313, unloaded
  2572. // CHECK:STDOUT: %import_ref.16: %Int32ToInt64.type = import_ref Main//int_ops, inst+333, loaded [template = constants.%Int32ToInt64]
  2573. // CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, inst+352, unloaded
  2574. // CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, inst+371, unloaded
  2575. // CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, inst+390, unloaded
  2576. // CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, inst+408, unloaded
  2577. // CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, inst+427, unloaded
  2578. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  2579. // CHECK:STDOUT: .Int32 = %import_ref.22
  2580. // CHECK:STDOUT: .Int = %import_ref.23
  2581. // CHECK:STDOUT: import Core//prelude
  2582. // CHECK:STDOUT: import Core//prelude/...
  2583. // CHECK:STDOUT: }
  2584. // CHECK:STDOUT: }
  2585. // CHECK:STDOUT:
  2586. // CHECK:STDOUT: file {
  2587. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  2588. // CHECK:STDOUT: .NegateI32 = imports.%import_ref.1
  2589. // CHECK:STDOUT: .SubI32 = imports.%import_ref.2
  2590. // CHECK:STDOUT: .AddU32 = imports.%import_ref.3
  2591. // CHECK:STDOUT: .IntLiteral = imports.%import_ref.4
  2592. // CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5
  2593. // CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6
  2594. // CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7
  2595. // CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8
  2596. // CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9
  2597. // CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10
  2598. // CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11
  2599. // CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12
  2600. // CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13
  2601. // CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14
  2602. // CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15
  2603. // CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16
  2604. // CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17
  2605. // CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18
  2606. // CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19
  2607. // CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20
  2608. // CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21
  2609. // CHECK:STDOUT: .Core = imports.%Core
  2610. // CHECK:STDOUT: .not_constant = @__global_init.%not_constant
  2611. // CHECK:STDOUT: .convert_not_constant_narrow = @__global_init.%convert_not_constant_narrow
  2612. // CHECK:STDOUT: .convert_not_constant_same = @__global_init.%convert_not_constant_same
  2613. // CHECK:STDOUT: .convert_not_constant_widen = @__global_init.%convert_not_constant_widen
  2614. // CHECK:STDOUT: }
  2615. // CHECK:STDOUT: %Core.import = import Core
  2616. // CHECK:STDOUT: %default.import = import <invalid>
  2617. // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32]
  2618. // CHECK:STDOUT: %.loc5_19.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32]
  2619. // CHECK:STDOUT: %.loc5_19.2: type = converted %int.make_type_32.loc5, %.loc5_19.1 [template = i32]
  2620. // CHECK:STDOUT: %.loc15_34.1: Core.IntLiteral = int_value 16 [template = constants.%.2]
  2621. // CHECK:STDOUT: %int.make_type_signed.loc15: init type = call constants.%Int(%.loc15_34.1) [template = constants.%.3]
  2622. // CHECK:STDOUT: %.loc15_34.2: type = value_of_initializer %int.make_type_signed.loc15 [template = constants.%.3]
  2623. // CHECK:STDOUT: %.loc15_34.3: type = converted %int.make_type_signed.loc15, %.loc15_34.2 [template = constants.%.3]
  2624. // CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%Int32() [template = i32]
  2625. // CHECK:STDOUT: %.loc25_32.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32]
  2626. // CHECK:STDOUT: %.loc25_32.2: type = converted %int.make_type_32.loc25, %.loc25_32.1 [template = i32]
  2627. // CHECK:STDOUT: %.loc34_33.1: Core.IntLiteral = int_value 64 [template = constants.%.4]
  2628. // CHECK:STDOUT: %int.make_type_signed.loc34: init type = call constants.%Int(%.loc34_33.1) [template = constants.%.5]
  2629. // CHECK:STDOUT: %.loc34_33.2: type = value_of_initializer %int.make_type_signed.loc34 [template = constants.%.5]
  2630. // CHECK:STDOUT: %.loc34_33.3: type = converted %int.make_type_signed.loc34, %.loc34_33.2 [template = constants.%.5]
  2631. // CHECK:STDOUT: }
  2632. // CHECK:STDOUT:
  2633. // CHECK:STDOUT: fn @Int32ToInt16(%a.param_patt: i32) -> %.3 = "int.convert_checked";
  2634. // CHECK:STDOUT:
  2635. // CHECK:STDOUT: fn @Int32ToInt32(%a.param_patt: i32) -> i32 = "int.convert_checked";
  2636. // CHECK:STDOUT:
  2637. // CHECK:STDOUT: fn @Int32ToInt64(%a.param_patt: i32) -> %.5 = "int.convert_checked";
  2638. // CHECK:STDOUT:
  2639. // CHECK:STDOUT: fn @__global_init() {
  2640. // CHECK:STDOUT: !entry:
  2641. // CHECK:STDOUT: %.loc5: i32 = int_value 0 [template = constants.%.1]
  2642. // CHECK:STDOUT: %not_constant: i32 = bind_name not_constant, %.loc5
  2643. // CHECK:STDOUT: %Int32ToInt16.ref: %Int32ToInt16.type = name_ref Int32ToInt16, imports.%import_ref.10 [template = constants.%Int32ToInt16]
  2644. // CHECK:STDOUT: %not_constant.ref.loc15: i32 = name_ref not_constant, %not_constant
  2645. // CHECK:STDOUT: %int.convert_checked.loc15: init %.3 = call %Int32ToInt16.ref(%not_constant.ref.loc15)
  2646. // CHECK:STDOUT: %.loc15_66.1: %.3 = value_of_initializer %int.convert_checked.loc15
  2647. // CHECK:STDOUT: %.loc15_66.2: %.3 = converted %int.convert_checked.loc15, %.loc15_66.1
  2648. // CHECK:STDOUT: %convert_not_constant_narrow: %.3 = bind_name convert_not_constant_narrow, %.loc15_66.2
  2649. // CHECK:STDOUT: %Int32ToInt32.ref: %Int32ToInt32.type = name_ref Int32ToInt32, imports.%import_ref.5 [template = constants.%Int32ToInt32]
  2650. // CHECK:STDOUT: %not_constant.ref.loc25: i32 = name_ref not_constant, %not_constant
  2651. // CHECK:STDOUT: %int.convert_checked.loc25: init i32 = call %Int32ToInt32.ref(%not_constant.ref.loc25)
  2652. // CHECK:STDOUT: %.loc25_64.1: i32 = value_of_initializer %int.convert_checked.loc25
  2653. // CHECK:STDOUT: %.loc25_64.2: i32 = converted %int.convert_checked.loc25, %.loc25_64.1
  2654. // CHECK:STDOUT: %convert_not_constant_same: i32 = bind_name convert_not_constant_same, %.loc25_64.2
  2655. // CHECK:STDOUT: %Int32ToInt64.ref: %Int32ToInt64.type = name_ref Int32ToInt64, imports.%import_ref.16 [template = constants.%Int32ToInt64]
  2656. // CHECK:STDOUT: %not_constant.ref.loc34: i32 = name_ref not_constant, %not_constant
  2657. // CHECK:STDOUT: %int.convert_checked.loc34: init %.5 = call %Int32ToInt64.ref(%not_constant.ref.loc34)
  2658. // CHECK:STDOUT: %.loc34_65.1: %.5 = value_of_initializer %int.convert_checked.loc34
  2659. // CHECK:STDOUT: %.loc34_65.2: %.5 = converted %int.convert_checked.loc34, %.loc34_65.1
  2660. // CHECK:STDOUT: %convert_not_constant_widen: %.5 = bind_name convert_not_constant_widen, %.loc34_65.2
  2661. // CHECK:STDOUT: return
  2662. // CHECK:STDOUT: }
  2663. // CHECK:STDOUT: