smod.carbon 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  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/smod.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/smod.carbon
  10. // --- int_div.carbon
  11. fn Mod(a: i32, b: i32) -> i32 = "int.smod";
  12. var arr: [i32; Mod(5, 3)];
  13. let arr_p: [i32; 2]* = &arr;
  14. fn RuntimeCall(a: i32, b: i32) -> i32 {
  15. return Mod(a, b);
  16. }
  17. // --- fail_overflow.carbon
  18. package FailOverflow;
  19. fn Mod(a: i32, b: i32) -> i32 = "int.smod";
  20. fn Sub(a: i32, b: i32) -> i32 = "int.ssub";
  21. fn Negate(a: i32) -> i32 = "int.snegate";
  22. // -0x7FFF_FFFF % -1 is OK.
  23. let a: i32 = Mod(Negate(0x7FFF_FFFF), Negate(1));
  24. // -0x8000_0000 % 1 is OK.
  25. let b: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), 1);
  26. // -0x8000_0000 / -1 overflows, so -0x8000_0000 % -1 is disallowed, even though
  27. // its result is representable.
  28. // CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation -2147483648 % -1 [CompileTimeIntegerOverflow]
  29. // CHECK:STDERR: let c: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), Negate(1));
  30. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  31. // CHECK:STDERR:
  32. let c: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), Negate(1));
  33. // --- fail_div_by_zero.carbon
  34. package FailDivByZero;
  35. fn Mod(a: i32, b: i32) -> i32 = "int.smod";
  36. // Remainder of division by zero is not defined.
  37. // CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero]
  38. // CHECK:STDERR: let a: i32 = Mod(1, 0);
  39. // CHECK:STDERR: ^~~~~~~~~
  40. // CHECK:STDERR:
  41. let a: i32 = Mod(1, 0);
  42. // CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: error: division by zero [CompileTimeDivisionByZero]
  43. // CHECK:STDERR: let b: i32 = Mod(0, 0);
  44. // CHECK:STDERR: ^~~~~~~~~
  45. let b: i32 = Mod(0, 0);
  46. // CHECK:STDOUT: --- int_div.carbon
  47. // CHECK:STDOUT:
  48. // CHECK:STDOUT: constants {
  49. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  50. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  51. // CHECK:STDOUT: %Mod.type.1: type = fn_type @Mod.1 [template]
  52. // CHECK:STDOUT: %Mod: %Mod.type.1 = struct_value () [template]
  53. // CHECK:STDOUT: %int_2.2: Core.IntLiteral = int_value 2 [template]
  54. // CHECK:STDOUT: %array_type: type = array_type %int_2.2, %i32 [template]
  55. // CHECK:STDOUT: %ptr: type = ptr_type %array_type [template]
  56. // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template]
  57. // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template]
  58. // CHECK:STDOUT: }
  59. // CHECK:STDOUT:
  60. // CHECK:STDOUT: imports {
  61. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  62. // CHECK:STDOUT: .Int = %import_ref.1
  63. // CHECK:STDOUT: .ImplicitAs = %import_ref.5
  64. // CHECK:STDOUT: import Core//prelude
  65. // CHECK:STDOUT: import Core//prelude/...
  66. // CHECK:STDOUT: }
  67. // CHECK:STDOUT: }
  68. // CHECK:STDOUT:
  69. // CHECK:STDOUT: file {
  70. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  71. // CHECK:STDOUT: .Core = imports.%Core
  72. // CHECK:STDOUT: .Mod = %Mod.decl
  73. // CHECK:STDOUT: .arr = %arr
  74. // CHECK:STDOUT: .arr_p = @__global_init.%arr_p
  75. // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl
  76. // CHECK:STDOUT: }
  77. // CHECK:STDOUT: %Core.import = import Core
  78. // CHECK:STDOUT: %Mod.decl: %Mod.type.1 = fn_decl @Mod.1 [template = constants.%Mod] {
  79. // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a
  80. // CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0
  81. // CHECK:STDOUT: %b.patt: %i32 = binding_pattern b
  82. // CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1
  83. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  84. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2
  85. // CHECK:STDOUT: } {
  86. // CHECK:STDOUT: %int_32.loc2_27: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  87. // CHECK:STDOUT: %i32.loc2_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  88. // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0
  89. // CHECK:STDOUT: %.loc2_11: type = splice_block %i32.loc2_11 [template = constants.%i32] {
  90. // CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  91. // CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  92. // CHECK:STDOUT: }
  93. // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param
  94. // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1
  95. // CHECK:STDOUT: %.loc2_19: type = splice_block %i32.loc2_19 [template = constants.%i32] {
  96. // CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  97. // CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  98. // CHECK:STDOUT: }
  99. // CHECK:STDOUT: %b: %i32 = bind_name b, %b.param
  100. // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2
  101. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  102. // CHECK:STDOUT: }
  103. // CHECK:STDOUT: %arr.var: ref %array_type = var arr
  104. // CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var
  105. // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] {
  106. // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a
  107. // CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0
  108. // CHECK:STDOUT: %b.patt: %i32 = binding_pattern b
  109. // CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1
  110. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  111. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2
  112. // CHECK:STDOUT: } {
  113. // CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  114. // CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  115. // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0
  116. // CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] {
  117. // CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  118. // CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  119. // CHECK:STDOUT: }
  120. // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param
  121. // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1
  122. // CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] {
  123. // CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  124. // CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  125. // CHECK:STDOUT: }
  126. // CHECK:STDOUT: %b: %i32 = bind_name b, %b.param
  127. // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2
  128. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  129. // CHECK:STDOUT: }
  130. // CHECK:STDOUT: }
  131. // CHECK:STDOUT:
  132. // CHECK:STDOUT: fn @Mod.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.smod";
  133. // CHECK:STDOUT:
  134. // CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 {
  135. // CHECK:STDOUT: !entry:
  136. // CHECK:STDOUT: %Mod.ref: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod]
  137. // CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a
  138. // CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b
  139. // CHECK:STDOUT: %int.smod: init %i32 = call %Mod.ref(%a.ref, %b.ref)
  140. // CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.smod
  141. // CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int.smod, %.loc8_19.1
  142. // CHECK:STDOUT: return %.loc8_19.2
  143. // CHECK:STDOUT: }
  144. // CHECK:STDOUT:
  145. // CHECK:STDOUT: fn @__global_init() {
  146. // CHECK:STDOUT: !entry:
  147. // CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr
  148. // CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref
  149. // CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr
  150. // CHECK:STDOUT: return
  151. // CHECK:STDOUT: }
  152. // CHECK:STDOUT:
  153. // CHECK:STDOUT: --- fail_overflow.carbon
  154. // CHECK:STDOUT:
  155. // CHECK:STDOUT: constants {
  156. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  157. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  158. // CHECK:STDOUT: %Mod.type.1: type = fn_type @Mod.1 [template]
  159. // CHECK:STDOUT: %Mod: %Mod.type.1 = struct_value () [template]
  160. // CHECK:STDOUT: %Sub.type.1: type = fn_type @Sub.1 [template]
  161. // CHECK:STDOUT: %Sub: %Sub.type.1 = struct_value () [template]
  162. // CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template]
  163. // CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template]
  164. // CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template]
  165. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
  166. // CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template]
  167. // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template]
  168. // CHECK:STDOUT: %interface.5: <witness> = interface_witness (%Convert.10) [template]
  169. // CHECK:STDOUT: %Convert.bound.1: <bound method> = bound_method %int_2147483647.1, %Convert.10 [template]
  170. // CHECK:STDOUT: %Convert.specific_fn.1: <specific function> = specific_function %Convert.bound.1, @Convert.2(%int_32) [template]
  171. // CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template]
  172. // CHECK:STDOUT: %int_-2147483647: %i32 = int_value -2147483647 [template]
  173. // CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template]
  174. // CHECK:STDOUT: %Convert.bound.2: <bound method> = bound_method %int_1.1, %Convert.10 [template]
  175. // CHECK:STDOUT: %Convert.specific_fn.2: <specific function> = specific_function %Convert.bound.2, @Convert.2(%int_32) [template]
  176. // CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template]
  177. // CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template]
  178. // CHECK:STDOUT: %int_0: %i32 = int_value 0 [template]
  179. // CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template]
  180. // CHECK:STDOUT: }
  181. // CHECK:STDOUT:
  182. // CHECK:STDOUT: imports {
  183. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  184. // CHECK:STDOUT: .Int = %import_ref.1
  185. // CHECK:STDOUT: .ImplicitAs = %import_ref.5
  186. // CHECK:STDOUT: import Core//prelude
  187. // CHECK:STDOUT: import Core//prelude/...
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT: }
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: file {
  192. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  193. // CHECK:STDOUT: .Core = imports.%Core
  194. // CHECK:STDOUT: .Mod = %Mod.decl
  195. // CHECK:STDOUT: .Sub = %Sub.decl
  196. // CHECK:STDOUT: .Negate = %Negate.decl
  197. // CHECK:STDOUT: .a = @__global_init.%a
  198. // CHECK:STDOUT: .b = @__global_init.%b
  199. // CHECK:STDOUT: .c = @__global_init.%c
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT: %Core.import = import Core
  202. // CHECK:STDOUT: %Mod.decl: %Mod.type.1 = fn_decl @Mod.1 [template = constants.%Mod] {
  203. // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a
  204. // CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0
  205. // CHECK:STDOUT: %b.patt: %i32 = binding_pattern b
  206. // CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1
  207. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  208. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2
  209. // CHECK:STDOUT: } {
  210. // CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  211. // CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  212. // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0
  213. // CHECK:STDOUT: %.loc4_11: type = splice_block %i32.loc4_11 [template = constants.%i32] {
  214. // CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  215. // CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param
  218. // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1
  219. // CHECK:STDOUT: %.loc4_19: type = splice_block %i32.loc4_19 [template = constants.%i32] {
  220. // CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  221. // CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  222. // CHECK:STDOUT: }
  223. // CHECK:STDOUT: %b: %i32 = bind_name b, %b.param
  224. // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2
  225. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  226. // CHECK:STDOUT: }
  227. // CHECK:STDOUT: %Sub.decl: %Sub.type.1 = fn_decl @Sub.1 [template = constants.%Sub] {
  228. // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a
  229. // CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0
  230. // CHECK:STDOUT: %b.patt: %i32 = binding_pattern b
  231. // CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1
  232. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  233. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2
  234. // CHECK:STDOUT: } {
  235. // CHECK:STDOUT: %int_32.loc5_27: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  236. // CHECK:STDOUT: %i32.loc5_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  237. // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0
  238. // CHECK:STDOUT: %.loc5_11: type = splice_block %i32.loc5_11 [template = constants.%i32] {
  239. // CHECK:STDOUT: %int_32.loc5_11: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  240. // CHECK:STDOUT: %i32.loc5_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  241. // CHECK:STDOUT: }
  242. // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param
  243. // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1
  244. // CHECK:STDOUT: %.loc5_19: type = splice_block %i32.loc5_19 [template = constants.%i32] {
  245. // CHECK:STDOUT: %int_32.loc5_19: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  246. // CHECK:STDOUT: %i32.loc5_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  247. // CHECK:STDOUT: }
  248. // CHECK:STDOUT: %b: %i32 = bind_name b, %b.param
  249. // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2
  250. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  251. // CHECK:STDOUT: }
  252. // CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] {
  253. // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a
  254. // CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0
  255. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  256. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1
  257. // CHECK:STDOUT: } {
  258. // CHECK:STDOUT: %int_32.loc6_22: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  259. // CHECK:STDOUT: %i32.loc6_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  260. // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0
  261. // CHECK:STDOUT: %.loc6: type = splice_block %i32.loc6_14 [template = constants.%i32] {
  262. // CHECK:STDOUT: %int_32.loc6_14: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  263. // CHECK:STDOUT: %i32.loc6_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param
  266. // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1
  267. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  268. // CHECK:STDOUT: }
  269. // CHECK:STDOUT: }
  270. // CHECK:STDOUT:
  271. // CHECK:STDOUT: fn @Mod.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.smod";
  272. // CHECK:STDOUT:
  273. // CHECK:STDOUT: fn @Sub.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.ssub";
  274. // CHECK:STDOUT:
  275. // CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.snegate";
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: fn @__global_init() {
  278. // CHECK:STDOUT: !entry:
  279. // CHECK:STDOUT: %Mod.ref.loc9: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod]
  280. // CHECK:STDOUT: %Negate.ref.loc9_18: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate]
  281. // CHECK:STDOUT: %int_2147483647.loc9: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1]
  282. // CHECK:STDOUT: %impl.elem0.loc9_25: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10]
  283. // CHECK:STDOUT: %Convert.bound.loc9_25: <bound method> = bound_method %int_2147483647.loc9, %impl.elem0.loc9_25 [template = constants.%Convert.bound.1]
  284. // CHECK:STDOUT: %Convert.specific_fn.loc9_25: <specific function> = specific_function %Convert.bound.loc9_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1]
  285. // CHECK:STDOUT: %int.convert_checked.loc9_25: init %i32 = call %Convert.specific_fn.loc9_25(%int_2147483647.loc9) [template = constants.%int_2147483647.2]
  286. // CHECK:STDOUT: %.loc9_25.1: %i32 = value_of_initializer %int.convert_checked.loc9_25 [template = constants.%int_2147483647.2]
  287. // CHECK:STDOUT: %.loc9_25.2: %i32 = converted %int_2147483647.loc9, %.loc9_25.1 [template = constants.%int_2147483647.2]
  288. // CHECK:STDOUT: %int.snegate.loc9_36: init %i32 = call %Negate.ref.loc9_18(%.loc9_25.2) [template = constants.%int_-2147483647]
  289. // CHECK:STDOUT: %Negate.ref.loc9_39: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate]
  290. // CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [template = constants.%int_1.1]
  291. // CHECK:STDOUT: %impl.elem0.loc9_46: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10]
  292. // CHECK:STDOUT: %Convert.bound.loc9_46: <bound method> = bound_method %int_1.loc9, %impl.elem0.loc9_46 [template = constants.%Convert.bound.2]
  293. // CHECK:STDOUT: %Convert.specific_fn.loc9_46: <specific function> = specific_function %Convert.bound.loc9_46, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2]
  294. // CHECK:STDOUT: %int.convert_checked.loc9_46: init %i32 = call %Convert.specific_fn.loc9_46(%int_1.loc9) [template = constants.%int_1.2]
  295. // CHECK:STDOUT: %.loc9_46.1: %i32 = value_of_initializer %int.convert_checked.loc9_46 [template = constants.%int_1.2]
  296. // CHECK:STDOUT: %.loc9_46.2: %i32 = converted %int_1.loc9, %.loc9_46.1 [template = constants.%int_1.2]
  297. // CHECK:STDOUT: %int.snegate.loc9_47: init %i32 = call %Negate.ref.loc9_39(%.loc9_46.2) [template = constants.%int_-1]
  298. // CHECK:STDOUT: %.loc9_36.1: %i32 = value_of_initializer %int.snegate.loc9_36 [template = constants.%int_-2147483647]
  299. // CHECK:STDOUT: %.loc9_36.2: %i32 = converted %int.snegate.loc9_36, %.loc9_36.1 [template = constants.%int_-2147483647]
  300. // CHECK:STDOUT: %.loc9_47.1: %i32 = value_of_initializer %int.snegate.loc9_47 [template = constants.%int_-1]
  301. // CHECK:STDOUT: %.loc9_47.2: %i32 = converted %int.snegate.loc9_47, %.loc9_47.1 [template = constants.%int_-1]
  302. // CHECK:STDOUT: %int.smod.loc9: init %i32 = call %Mod.ref.loc9(%.loc9_36.2, %.loc9_47.2) [template = constants.%int_0]
  303. // CHECK:STDOUT: %.loc9_49.1: %i32 = value_of_initializer %int.smod.loc9 [template = constants.%int_0]
  304. // CHECK:STDOUT: %.loc9_49.2: %i32 = converted %int.smod.loc9, %.loc9_49.1 [template = constants.%int_0]
  305. // CHECK:STDOUT: %a: %i32 = bind_name a, %.loc9_49.2
  306. // CHECK:STDOUT: %Mod.ref.loc12: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod]
  307. // CHECK:STDOUT: %Sub.ref.loc12: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub]
  308. // CHECK:STDOUT: %Negate.ref.loc12: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate]
  309. // CHECK:STDOUT: %int_2147483647.loc12: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1]
  310. // CHECK:STDOUT: %impl.elem0.loc12_29: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10]
  311. // CHECK:STDOUT: %Convert.bound.loc12_29: <bound method> = bound_method %int_2147483647.loc12, %impl.elem0.loc12_29 [template = constants.%Convert.bound.1]
  312. // CHECK:STDOUT: %Convert.specific_fn.loc12_29: <specific function> = specific_function %Convert.bound.loc12_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1]
  313. // CHECK:STDOUT: %int.convert_checked.loc12_29: init %i32 = call %Convert.specific_fn.loc12_29(%int_2147483647.loc12) [template = constants.%int_2147483647.2]
  314. // CHECK:STDOUT: %.loc12_29.1: %i32 = value_of_initializer %int.convert_checked.loc12_29 [template = constants.%int_2147483647.2]
  315. // CHECK:STDOUT: %.loc12_29.2: %i32 = converted %int_2147483647.loc12, %.loc12_29.1 [template = constants.%int_2147483647.2]
  316. // CHECK:STDOUT: %int.snegate.loc12: init %i32 = call %Negate.ref.loc12(%.loc12_29.2) [template = constants.%int_-2147483647]
  317. // CHECK:STDOUT: %int_1.loc12_43: Core.IntLiteral = int_value 1 [template = constants.%int_1.1]
  318. // CHECK:STDOUT: %.loc12_40.1: %i32 = value_of_initializer %int.snegate.loc12 [template = constants.%int_-2147483647]
  319. // CHECK:STDOUT: %.loc12_40.2: %i32 = converted %int.snegate.loc12, %.loc12_40.1 [template = constants.%int_-2147483647]
  320. // CHECK:STDOUT: %impl.elem0.loc12_43: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10]
  321. // CHECK:STDOUT: %Convert.bound.loc12_43: <bound method> = bound_method %int_1.loc12_43, %impl.elem0.loc12_43 [template = constants.%Convert.bound.2]
  322. // CHECK:STDOUT: %Convert.specific_fn.loc12_43: <specific function> = specific_function %Convert.bound.loc12_43, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2]
  323. // CHECK:STDOUT: %int.convert_checked.loc12_43: init %i32 = call %Convert.specific_fn.loc12_43(%int_1.loc12_43) [template = constants.%int_1.2]
  324. // CHECK:STDOUT: %.loc12_43.1: %i32 = value_of_initializer %int.convert_checked.loc12_43 [template = constants.%int_1.2]
  325. // CHECK:STDOUT: %.loc12_43.2: %i32 = converted %int_1.loc12_43, %.loc12_43.1 [template = constants.%int_1.2]
  326. // CHECK:STDOUT: %int.ssub.loc12: init %i32 = call %Sub.ref.loc12(%.loc12_40.2, %.loc12_43.2) [template = constants.%int_-2147483648]
  327. // CHECK:STDOUT: %int_1.loc12_47: Core.IntLiteral = int_value 1 [template = constants.%int_1.1]
  328. // CHECK:STDOUT: %.loc12_44.1: %i32 = value_of_initializer %int.ssub.loc12 [template = constants.%int_-2147483648]
  329. // CHECK:STDOUT: %.loc12_44.2: %i32 = converted %int.ssub.loc12, %.loc12_44.1 [template = constants.%int_-2147483648]
  330. // CHECK:STDOUT: %impl.elem0.loc12_47: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10]
  331. // CHECK:STDOUT: %Convert.bound.loc12_47: <bound method> = bound_method %int_1.loc12_47, %impl.elem0.loc12_47 [template = constants.%Convert.bound.2]
  332. // CHECK:STDOUT: %Convert.specific_fn.loc12_47: <specific function> = specific_function %Convert.bound.loc12_47, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2]
  333. // CHECK:STDOUT: %int.convert_checked.loc12_47: init %i32 = call %Convert.specific_fn.loc12_47(%int_1.loc12_47) [template = constants.%int_1.2]
  334. // CHECK:STDOUT: %.loc12_47.1: %i32 = value_of_initializer %int.convert_checked.loc12_47 [template = constants.%int_1.2]
  335. // CHECK:STDOUT: %.loc12_47.2: %i32 = converted %int_1.loc12_47, %.loc12_47.1 [template = constants.%int_1.2]
  336. // CHECK:STDOUT: %int.smod.loc12: init %i32 = call %Mod.ref.loc12(%.loc12_44.2, %.loc12_47.2) [template = constants.%int_0]
  337. // CHECK:STDOUT: %.loc12_49.1: %i32 = value_of_initializer %int.smod.loc12 [template = constants.%int_0]
  338. // CHECK:STDOUT: %.loc12_49.2: %i32 = converted %int.smod.loc12, %.loc12_49.1 [template = constants.%int_0]
  339. // CHECK:STDOUT: %b: %i32 = bind_name b, %.loc12_49.2
  340. // CHECK:STDOUT: %Mod.ref.loc20: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod]
  341. // CHECK:STDOUT: %Sub.ref.loc20: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub]
  342. // CHECK:STDOUT: %Negate.ref.loc20_22: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate]
  343. // CHECK:STDOUT: %int_2147483647.loc20: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1]
  344. // CHECK:STDOUT: %impl.elem0.loc20_29: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10]
  345. // CHECK:STDOUT: %Convert.bound.loc20_29: <bound method> = bound_method %int_2147483647.loc20, %impl.elem0.loc20_29 [template = constants.%Convert.bound.1]
  346. // CHECK:STDOUT: %Convert.specific_fn.loc20_29: <specific function> = specific_function %Convert.bound.loc20_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1]
  347. // CHECK:STDOUT: %int.convert_checked.loc20_29: init %i32 = call %Convert.specific_fn.loc20_29(%int_2147483647.loc20) [template = constants.%int_2147483647.2]
  348. // CHECK:STDOUT: %.loc20_29.1: %i32 = value_of_initializer %int.convert_checked.loc20_29 [template = constants.%int_2147483647.2]
  349. // CHECK:STDOUT: %.loc20_29.2: %i32 = converted %int_2147483647.loc20, %.loc20_29.1 [template = constants.%int_2147483647.2]
  350. // CHECK:STDOUT: %int.snegate.loc20_40: init %i32 = call %Negate.ref.loc20_22(%.loc20_29.2) [template = constants.%int_-2147483647]
  351. // CHECK:STDOUT: %int_1.loc20_43: Core.IntLiteral = int_value 1 [template = constants.%int_1.1]
  352. // CHECK:STDOUT: %.loc20_40.1: %i32 = value_of_initializer %int.snegate.loc20_40 [template = constants.%int_-2147483647]
  353. // CHECK:STDOUT: %.loc20_40.2: %i32 = converted %int.snegate.loc20_40, %.loc20_40.1 [template = constants.%int_-2147483647]
  354. // CHECK:STDOUT: %impl.elem0.loc20_43: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10]
  355. // CHECK:STDOUT: %Convert.bound.loc20_43: <bound method> = bound_method %int_1.loc20_43, %impl.elem0.loc20_43 [template = constants.%Convert.bound.2]
  356. // CHECK:STDOUT: %Convert.specific_fn.loc20_43: <specific function> = specific_function %Convert.bound.loc20_43, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2]
  357. // CHECK:STDOUT: %int.convert_checked.loc20_43: init %i32 = call %Convert.specific_fn.loc20_43(%int_1.loc20_43) [template = constants.%int_1.2]
  358. // CHECK:STDOUT: %.loc20_43.1: %i32 = value_of_initializer %int.convert_checked.loc20_43 [template = constants.%int_1.2]
  359. // CHECK:STDOUT: %.loc20_43.2: %i32 = converted %int_1.loc20_43, %.loc20_43.1 [template = constants.%int_1.2]
  360. // CHECK:STDOUT: %int.ssub.loc20: init %i32 = call %Sub.ref.loc20(%.loc20_40.2, %.loc20_43.2) [template = constants.%int_-2147483648]
  361. // CHECK:STDOUT: %Negate.ref.loc20_47: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate]
  362. // CHECK:STDOUT: %int_1.loc20_54: Core.IntLiteral = int_value 1 [template = constants.%int_1.1]
  363. // CHECK:STDOUT: %impl.elem0.loc20_54: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10]
  364. // CHECK:STDOUT: %Convert.bound.loc20_54: <bound method> = bound_method %int_1.loc20_54, %impl.elem0.loc20_54 [template = constants.%Convert.bound.2]
  365. // CHECK:STDOUT: %Convert.specific_fn.loc20_54: <specific function> = specific_function %Convert.bound.loc20_54, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2]
  366. // CHECK:STDOUT: %int.convert_checked.loc20_54: init %i32 = call %Convert.specific_fn.loc20_54(%int_1.loc20_54) [template = constants.%int_1.2]
  367. // CHECK:STDOUT: %.loc20_54.1: %i32 = value_of_initializer %int.convert_checked.loc20_54 [template = constants.%int_1.2]
  368. // CHECK:STDOUT: %.loc20_54.2: %i32 = converted %int_1.loc20_54, %.loc20_54.1 [template = constants.%int_1.2]
  369. // CHECK:STDOUT: %int.snegate.loc20_55: init %i32 = call %Negate.ref.loc20_47(%.loc20_54.2) [template = constants.%int_-1]
  370. // CHECK:STDOUT: %.loc20_44.1: %i32 = value_of_initializer %int.ssub.loc20 [template = constants.%int_-2147483648]
  371. // CHECK:STDOUT: %.loc20_44.2: %i32 = converted %int.ssub.loc20, %.loc20_44.1 [template = constants.%int_-2147483648]
  372. // CHECK:STDOUT: %.loc20_55.1: %i32 = value_of_initializer %int.snegate.loc20_55 [template = constants.%int_-1]
  373. // CHECK:STDOUT: %.loc20_55.2: %i32 = converted %int.snegate.loc20_55, %.loc20_55.1 [template = constants.%int_-1]
  374. // CHECK:STDOUT: %int.smod.loc20: init %i32 = call %Mod.ref.loc20(%.loc20_44.2, %.loc20_55.2) [template = constants.%int_0]
  375. // CHECK:STDOUT: %.loc20_57.1: %i32 = value_of_initializer %int.smod.loc20 [template = constants.%int_0]
  376. // CHECK:STDOUT: %.loc20_57.2: %i32 = converted %int.smod.loc20, %.loc20_57.1 [template = constants.%int_0]
  377. // CHECK:STDOUT: %c: %i32 = bind_name c, %.loc20_57.2
  378. // CHECK:STDOUT: return
  379. // CHECK:STDOUT: }
  380. // CHECK:STDOUT:
  381. // CHECK:STDOUT: --- fail_div_by_zero.carbon
  382. // CHECK:STDOUT:
  383. // CHECK:STDOUT: constants {
  384. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  385. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  386. // CHECK:STDOUT: %Mod.type.1: type = fn_type @Mod.1 [template]
  387. // CHECK:STDOUT: %Mod: %Mod.type.1 = struct_value () [template]
  388. // CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template]
  389. // CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template]
  390. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
  391. // CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template]
  392. // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template]
  393. // CHECK:STDOUT: %interface.5: <witness> = interface_witness (%Convert.10) [template]
  394. // CHECK:STDOUT: %Convert.bound.1: <bound method> = bound_method %int_1.1, %Convert.10 [template]
  395. // CHECK:STDOUT: %Convert.specific_fn.1: <specific function> = specific_function %Convert.bound.1, @Convert.2(%int_32) [template]
  396. // CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template]
  397. // CHECK:STDOUT: %Convert.bound.2: <bound method> = bound_method %int_0.1, %Convert.10 [template]
  398. // CHECK:STDOUT: %Convert.specific_fn.2: <specific function> = specific_function %Convert.bound.2, @Convert.2(%int_32) [template]
  399. // CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template]
  400. // CHECK:STDOUT: }
  401. // CHECK:STDOUT:
  402. // CHECK:STDOUT: imports {
  403. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  404. // CHECK:STDOUT: .Int = %import_ref.1
  405. // CHECK:STDOUT: .ImplicitAs = %import_ref.5
  406. // CHECK:STDOUT: import Core//prelude
  407. // CHECK:STDOUT: import Core//prelude/...
  408. // CHECK:STDOUT: }
  409. // CHECK:STDOUT: }
  410. // CHECK:STDOUT:
  411. // CHECK:STDOUT: file {
  412. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  413. // CHECK:STDOUT: .Core = imports.%Core
  414. // CHECK:STDOUT: .Mod = %Mod.decl
  415. // CHECK:STDOUT: .a = @__global_init.%a
  416. // CHECK:STDOUT: .b = @__global_init.%b
  417. // CHECK:STDOUT: }
  418. // CHECK:STDOUT: %Core.import = import Core
  419. // CHECK:STDOUT: %Mod.decl: %Mod.type.1 = fn_decl @Mod.1 [template = constants.%Mod] {
  420. // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a
  421. // CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0
  422. // CHECK:STDOUT: %b.patt: %i32 = binding_pattern b
  423. // CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1
  424. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  425. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2
  426. // CHECK:STDOUT: } {
  427. // CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  428. // CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  429. // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0
  430. // CHECK:STDOUT: %.loc4_11: type = splice_block %i32.loc4_11 [template = constants.%i32] {
  431. // CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  432. // CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  433. // CHECK:STDOUT: }
  434. // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param
  435. // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1
  436. // CHECK:STDOUT: %.loc4_19: type = splice_block %i32.loc4_19 [template = constants.%i32] {
  437. // CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  438. // CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  439. // CHECK:STDOUT: }
  440. // CHECK:STDOUT: %b: %i32 = bind_name b, %b.param
  441. // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2
  442. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  443. // CHECK:STDOUT: }
  444. // CHECK:STDOUT: }
  445. // CHECK:STDOUT:
  446. // CHECK:STDOUT: fn @Mod.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.smod";
  447. // CHECK:STDOUT:
  448. // CHECK:STDOUT: fn @__global_init() {
  449. // CHECK:STDOUT: !entry:
  450. // CHECK:STDOUT: %Mod.ref.loc12: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod]
  451. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1]
  452. // CHECK:STDOUT: %int_0.loc12: Core.IntLiteral = int_value 0 [template = constants.%int_0.1]
  453. // CHECK:STDOUT: %impl.elem0.loc12_18: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10]
  454. // CHECK:STDOUT: %Convert.bound.loc12_18: <bound method> = bound_method %int_1, %impl.elem0.loc12_18 [template = constants.%Convert.bound.1]
  455. // CHECK:STDOUT: %Convert.specific_fn.loc12_18: <specific function> = specific_function %Convert.bound.loc12_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1]
  456. // CHECK:STDOUT: %int.convert_checked.loc12_18: init %i32 = call %Convert.specific_fn.loc12_18(%int_1) [template = constants.%int_1.2]
  457. // CHECK:STDOUT: %.loc12_18.1: %i32 = value_of_initializer %int.convert_checked.loc12_18 [template = constants.%int_1.2]
  458. // CHECK:STDOUT: %.loc12_18.2: %i32 = converted %int_1, %.loc12_18.1 [template = constants.%int_1.2]
  459. // CHECK:STDOUT: %impl.elem0.loc12_21: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10]
  460. // CHECK:STDOUT: %Convert.bound.loc12_21: <bound method> = bound_method %int_0.loc12, %impl.elem0.loc12_21 [template = constants.%Convert.bound.2]
  461. // CHECK:STDOUT: %Convert.specific_fn.loc12_21: <specific function> = specific_function %Convert.bound.loc12_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2]
  462. // CHECK:STDOUT: %int.convert_checked.loc12_21: init %i32 = call %Convert.specific_fn.loc12_21(%int_0.loc12) [template = constants.%int_0.2]
  463. // CHECK:STDOUT: %.loc12_21.1: %i32 = value_of_initializer %int.convert_checked.loc12_21 [template = constants.%int_0.2]
  464. // CHECK:STDOUT: %.loc12_21.2: %i32 = converted %int_0.loc12, %.loc12_21.1 [template = constants.%int_0.2]
  465. // CHECK:STDOUT: %int.smod.loc12: init %i32 = call %Mod.ref.loc12(%.loc12_18.2, %.loc12_21.2) [template = <error>]
  466. // CHECK:STDOUT: %.loc12_23.1: %i32 = value_of_initializer %int.smod.loc12 [template = <error>]
  467. // CHECK:STDOUT: %.loc12_23.2: %i32 = converted %int.smod.loc12, %.loc12_23.1 [template = <error>]
  468. // CHECK:STDOUT: %a: %i32 = bind_name a, %.loc12_23.2
  469. // CHECK:STDOUT: %Mod.ref.loc17: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod]
  470. // CHECK:STDOUT: %int_0.loc17_18: Core.IntLiteral = int_value 0 [template = constants.%int_0.1]
  471. // CHECK:STDOUT: %int_0.loc17_21: Core.IntLiteral = int_value 0 [template = constants.%int_0.1]
  472. // CHECK:STDOUT: %impl.elem0.loc17_18: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10]
  473. // CHECK:STDOUT: %Convert.bound.loc17_18: <bound method> = bound_method %int_0.loc17_18, %impl.elem0.loc17_18 [template = constants.%Convert.bound.2]
  474. // CHECK:STDOUT: %Convert.specific_fn.loc17_18: <specific function> = specific_function %Convert.bound.loc17_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2]
  475. // CHECK:STDOUT: %int.convert_checked.loc17_18: init %i32 = call %Convert.specific_fn.loc17_18(%int_0.loc17_18) [template = constants.%int_0.2]
  476. // CHECK:STDOUT: %.loc17_18.1: %i32 = value_of_initializer %int.convert_checked.loc17_18 [template = constants.%int_0.2]
  477. // CHECK:STDOUT: %.loc17_18.2: %i32 = converted %int_0.loc17_18, %.loc17_18.1 [template = constants.%int_0.2]
  478. // CHECK:STDOUT: %impl.elem0.loc17_21: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10]
  479. // CHECK:STDOUT: %Convert.bound.loc17_21: <bound method> = bound_method %int_0.loc17_21, %impl.elem0.loc17_21 [template = constants.%Convert.bound.2]
  480. // CHECK:STDOUT: %Convert.specific_fn.loc17_21: <specific function> = specific_function %Convert.bound.loc17_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2]
  481. // CHECK:STDOUT: %int.convert_checked.loc17_21: init %i32 = call %Convert.specific_fn.loc17_21(%int_0.loc17_21) [template = constants.%int_0.2]
  482. // CHECK:STDOUT: %.loc17_21.1: %i32 = value_of_initializer %int.convert_checked.loc17_21 [template = constants.%int_0.2]
  483. // CHECK:STDOUT: %.loc17_21.2: %i32 = converted %int_0.loc17_21, %.loc17_21.1 [template = constants.%int_0.2]
  484. // CHECK:STDOUT: %int.smod.loc17: init %i32 = call %Mod.ref.loc17(%.loc17_18.2, %.loc17_21.2) [template = <error>]
  485. // CHECK:STDOUT: %.loc17_23.1: %i32 = value_of_initializer %int.smod.loc17 [template = <error>]
  486. // CHECK:STDOUT: %.loc17_23.2: %i32 = converted %int.smod.loc17, %.loc17_23.1 [template = <error>]
  487. // CHECK:STDOUT: %b: %i32 = bind_name b, %.loc17_23.2
  488. // CHECK:STDOUT: return
  489. // CHECK:STDOUT: }
  490. // CHECK:STDOUT: