sdiv.carbon 38 KB

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