less_eq.carbon 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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/float/less_eq.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/less_eq.carbon
  10. // --- float_less_eq.carbon
  11. fn LessEq(a: f64, b: f64) -> bool = "float.less_eq";
  12. fn Negate(a: f64) -> f64 = "float.negate";
  13. class True {}
  14. class False {}
  15. fn F(true_: True, false_: False) {
  16. true_ as (if LessEq(1.0, 2.0) then True else False);
  17. true_ as (if LessEq(1.0, 1.0) then True else False);
  18. false_ as (if LessEq(1.0, 0.0) then True else False);
  19. true_ as (if LessEq(Negate(1.0), 0.0) then True else False);
  20. false_ as (if LessEq(0.0, Negate(1.0)) then True else False);
  21. }
  22. fn RuntimeCallIsValid(a: f64, b: f64) -> bool {
  23. return LessEq(a, b);
  24. }
  25. // CHECK:STDOUT: --- float_less_eq.carbon
  26. // CHECK:STDOUT:
  27. // CHECK:STDOUT: constants {
  28. // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template]
  29. // CHECK:STDOUT: %Float.type: type = fn_type @Float [template]
  30. // CHECK:STDOUT: %Float: %Float.type = struct_value () [template]
  31. // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template]
  32. // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template]
  33. // CHECK:STDOUT: %LessEq.type: type = fn_type @LessEq [template]
  34. // CHECK:STDOUT: %LessEq: %LessEq.type = struct_value () [template]
  35. // CHECK:STDOUT: %Negate.type: type = fn_type @Negate [template]
  36. // CHECK:STDOUT: %Negate: %Negate.type = struct_value () [template]
  37. // CHECK:STDOUT: %True: type = class_type @True [template]
  38. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  39. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  40. // CHECK:STDOUT: %False: type = class_type @False [template]
  41. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  42. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  43. // CHECK:STDOUT: %float.f4e: f64 = float_literal 1 [template]
  44. // CHECK:STDOUT: %float.be3: f64 = float_literal 2 [template]
  45. // CHECK:STDOUT: %true: bool = bool_literal true [template]
  46. // CHECK:STDOUT: %float.555: f64 = float_literal 0 [template]
  47. // CHECK:STDOUT: %false: bool = bool_literal false [template]
  48. // CHECK:STDOUT: %float.f51: f64 = float_literal -1 [template]
  49. // CHECK:STDOUT: %RuntimeCallIsValid.type: type = fn_type @RuntimeCallIsValid [template]
  50. // CHECK:STDOUT: %RuntimeCallIsValid: %RuntimeCallIsValid.type = struct_value () [template]
  51. // CHECK:STDOUT: }
  52. // CHECK:STDOUT:
  53. // CHECK:STDOUT: imports {
  54. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  55. // CHECK:STDOUT: .Float = %Core.Float
  56. // CHECK:STDOUT: .Bool = %Core.Bool
  57. // CHECK:STDOUT: import Core//prelude
  58. // CHECK:STDOUT: import Core//prelude/...
  59. // CHECK:STDOUT: }
  60. // CHECK:STDOUT: }
  61. // CHECK:STDOUT:
  62. // CHECK:STDOUT: file {
  63. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  64. // CHECK:STDOUT: .Core = imports.%Core
  65. // CHECK:STDOUT: .LessEq = %LessEq.decl
  66. // CHECK:STDOUT: .Negate = %Negate.decl
  67. // CHECK:STDOUT: .True = %True.decl
  68. // CHECK:STDOUT: .False = %False.decl
  69. // CHECK:STDOUT: .F = %F.decl
  70. // CHECK:STDOUT: .RuntimeCallIsValid = %RuntimeCallIsValid.decl
  71. // CHECK:STDOUT: }
  72. // CHECK:STDOUT: %Core.import = import Core
  73. // CHECK:STDOUT: %LessEq.decl: %LessEq.type = fn_decl @LessEq [template = constants.%LessEq] {
  74. // CHECK:STDOUT: %a.patt: f64 = binding_pattern a
  75. // CHECK:STDOUT: %a.param_patt: f64 = value_param_pattern %a.patt, runtime_param0
  76. // CHECK:STDOUT: %b.patt: f64 = binding_pattern b
  77. // CHECK:STDOUT: %b.param_patt: f64 = value_param_pattern %b.patt, runtime_param1
  78. // CHECK:STDOUT: %return.patt: bool = return_slot_pattern
  79. // CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2
  80. // CHECK:STDOUT: } {
  81. // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
  82. // CHECK:STDOUT: %.loc2_30.1: type = value_of_initializer %bool.make_type [template = bool]
  83. // CHECK:STDOUT: %.loc2_30.2: type = converted %bool.make_type, %.loc2_30.1 [template = bool]
  84. // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0
  85. // CHECK:STDOUT: %.loc2_14.1: type = splice_block %.loc2_14.3 [template = f64] {
  86. // CHECK:STDOUT: %int_64.loc2_14: Core.IntLiteral = int_value 64 [template = constants.%int_64]
  87. // CHECK:STDOUT: %float.make_type.loc2_14: init type = call constants.%Float(%int_64.loc2_14) [template = f64]
  88. // CHECK:STDOUT: %.loc2_14.2: type = value_of_initializer %float.make_type.loc2_14 [template = f64]
  89. // CHECK:STDOUT: %.loc2_14.3: type = converted %float.make_type.loc2_14, %.loc2_14.2 [template = f64]
  90. // CHECK:STDOUT: }
  91. // CHECK:STDOUT: %a: f64 = bind_name a, %a.param
  92. // CHECK:STDOUT: %b.param: f64 = value_param runtime_param1
  93. // CHECK:STDOUT: %.loc2_22.1: type = splice_block %.loc2_22.3 [template = f64] {
  94. // CHECK:STDOUT: %int_64.loc2_22: Core.IntLiteral = int_value 64 [template = constants.%int_64]
  95. // CHECK:STDOUT: %float.make_type.loc2_22: init type = call constants.%Float(%int_64.loc2_22) [template = f64]
  96. // CHECK:STDOUT: %.loc2_22.2: type = value_of_initializer %float.make_type.loc2_22 [template = f64]
  97. // CHECK:STDOUT: %.loc2_22.3: type = converted %float.make_type.loc2_22, %.loc2_22.2 [template = f64]
  98. // CHECK:STDOUT: }
  99. // CHECK:STDOUT: %b: f64 = bind_name b, %b.param
  100. // CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2
  101. // CHECK:STDOUT: %return: ref bool = return_slot %return.param
  102. // CHECK:STDOUT: }
  103. // CHECK:STDOUT: %Negate.decl: %Negate.type = fn_decl @Negate [template = constants.%Negate] {
  104. // CHECK:STDOUT: %a.patt: f64 = binding_pattern a
  105. // CHECK:STDOUT: %a.param_patt: f64 = value_param_pattern %a.patt, runtime_param0
  106. // CHECK:STDOUT: %return.patt: f64 = return_slot_pattern
  107. // CHECK:STDOUT: %return.param_patt: f64 = out_param_pattern %return.patt, runtime_param1
  108. // CHECK:STDOUT: } {
  109. // CHECK:STDOUT: %int_64.loc3_22: Core.IntLiteral = int_value 64 [template = constants.%int_64]
  110. // CHECK:STDOUT: %float.make_type.loc3_22: init type = call constants.%Float(%int_64.loc3_22) [template = f64]
  111. // CHECK:STDOUT: %.loc3_22.1: type = value_of_initializer %float.make_type.loc3_22 [template = f64]
  112. // CHECK:STDOUT: %.loc3_22.2: type = converted %float.make_type.loc3_22, %.loc3_22.1 [template = f64]
  113. // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0
  114. // CHECK:STDOUT: %.loc3_14.1: type = splice_block %.loc3_14.3 [template = f64] {
  115. // CHECK:STDOUT: %int_64.loc3_14: Core.IntLiteral = int_value 64 [template = constants.%int_64]
  116. // CHECK:STDOUT: %float.make_type.loc3_14: init type = call constants.%Float(%int_64.loc3_14) [template = f64]
  117. // CHECK:STDOUT: %.loc3_14.2: type = value_of_initializer %float.make_type.loc3_14 [template = f64]
  118. // CHECK:STDOUT: %.loc3_14.3: type = converted %float.make_type.loc3_14, %.loc3_14.2 [template = f64]
  119. // CHECK:STDOUT: }
  120. // CHECK:STDOUT: %a: f64 = bind_name a, %a.param
  121. // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param1
  122. // CHECK:STDOUT: %return: ref f64 = return_slot %return.param
  123. // CHECK:STDOUT: }
  124. // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} {}
  125. // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} {}
  126. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  127. // CHECK:STDOUT: %true_.patt: %True = binding_pattern true_
  128. // CHECK:STDOUT: %true_.param_patt: %True = value_param_pattern %true_.patt, runtime_param0
  129. // CHECK:STDOUT: %false_.patt: %False = binding_pattern false_
  130. // CHECK:STDOUT: %false_.param_patt: %False = value_param_pattern %false_.patt, runtime_param1
  131. // CHECK:STDOUT: } {
  132. // CHECK:STDOUT: %true_.param: %True = value_param runtime_param0
  133. // CHECK:STDOUT: %True.ref.loc8: type = name_ref True, file.%True.decl [template = constants.%True]
  134. // CHECK:STDOUT: %true_: %True = bind_name true_, %true_.param
  135. // CHECK:STDOUT: %false_.param: %False = value_param runtime_param1
  136. // CHECK:STDOUT: %False.ref.loc8: type = name_ref False, file.%False.decl [template = constants.%False]
  137. // CHECK:STDOUT: %false_: %False = bind_name false_, %false_.param
  138. // CHECK:STDOUT: }
  139. // CHECK:STDOUT: %RuntimeCallIsValid.decl: %RuntimeCallIsValid.type = fn_decl @RuntimeCallIsValid [template = constants.%RuntimeCallIsValid] {
  140. // CHECK:STDOUT: %a.patt: f64 = binding_pattern a
  141. // CHECK:STDOUT: %a.param_patt: f64 = value_param_pattern %a.patt, runtime_param0
  142. // CHECK:STDOUT: %b.patt: f64 = binding_pattern b
  143. // CHECK:STDOUT: %b.param_patt: f64 = value_param_pattern %b.patt, runtime_param1
  144. // CHECK:STDOUT: %return.patt: bool = return_slot_pattern
  145. // CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2
  146. // CHECK:STDOUT: } {
  147. // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
  148. // CHECK:STDOUT: %.loc16_42.1: type = value_of_initializer %bool.make_type [template = bool]
  149. // CHECK:STDOUT: %.loc16_42.2: type = converted %bool.make_type, %.loc16_42.1 [template = bool]
  150. // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0
  151. // CHECK:STDOUT: %.loc16_26.1: type = splice_block %.loc16_26.3 [template = f64] {
  152. // CHECK:STDOUT: %int_64.loc16_26: Core.IntLiteral = int_value 64 [template = constants.%int_64]
  153. // CHECK:STDOUT: %float.make_type.loc16_26: init type = call constants.%Float(%int_64.loc16_26) [template = f64]
  154. // CHECK:STDOUT: %.loc16_26.2: type = value_of_initializer %float.make_type.loc16_26 [template = f64]
  155. // CHECK:STDOUT: %.loc16_26.3: type = converted %float.make_type.loc16_26, %.loc16_26.2 [template = f64]
  156. // CHECK:STDOUT: }
  157. // CHECK:STDOUT: %a: f64 = bind_name a, %a.param
  158. // CHECK:STDOUT: %b.param: f64 = value_param runtime_param1
  159. // CHECK:STDOUT: %.loc16_34.1: type = splice_block %.loc16_34.3 [template = f64] {
  160. // CHECK:STDOUT: %int_64.loc16_34: Core.IntLiteral = int_value 64 [template = constants.%int_64]
  161. // CHECK:STDOUT: %float.make_type.loc16_34: init type = call constants.%Float(%int_64.loc16_34) [template = f64]
  162. // CHECK:STDOUT: %.loc16_34.2: type = value_of_initializer %float.make_type.loc16_34 [template = f64]
  163. // CHECK:STDOUT: %.loc16_34.3: type = converted %float.make_type.loc16_34, %.loc16_34.2 [template = f64]
  164. // CHECK:STDOUT: }
  165. // CHECK:STDOUT: %b: f64 = bind_name b, %b.param
  166. // CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2
  167. // CHECK:STDOUT: %return: ref bool = return_slot %return.param
  168. // CHECK:STDOUT: }
  169. // CHECK:STDOUT: }
  170. // CHECK:STDOUT:
  171. // CHECK:STDOUT: class @True {
  172. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  173. // CHECK:STDOUT: complete_type_witness = %complete_type
  174. // CHECK:STDOUT:
  175. // CHECK:STDOUT: !members:
  176. // CHECK:STDOUT: .Self = constants.%True
  177. // CHECK:STDOUT: }
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: class @False {
  180. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  181. // CHECK:STDOUT: complete_type_witness = %complete_type
  182. // CHECK:STDOUT:
  183. // CHECK:STDOUT: !members:
  184. // CHECK:STDOUT: .Self = constants.%False
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: fn @LessEq(%a.param_patt: f64, %b.param_patt: f64) -> bool = "float.less_eq";
  188. // CHECK:STDOUT:
  189. // CHECK:STDOUT: fn @Negate(%a.param_patt: f64) -> f64 = "float.negate";
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: fn @F(%true_.param_patt: %True, %false_.param_patt: %False) {
  192. // CHECK:STDOUT: !entry:
  193. // CHECK:STDOUT: %true_.ref.loc9: %True = name_ref true_, %true_
  194. // CHECK:STDOUT: %LessEq.ref.loc9: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq]
  195. // CHECK:STDOUT: %float.loc9_23: f64 = float_literal 1 [template = constants.%float.f4e]
  196. // CHECK:STDOUT: %float.loc9_28: f64 = float_literal 2 [template = constants.%float.be3]
  197. // CHECK:STDOUT: %float.less_eq.loc9: init bool = call %LessEq.ref.loc9(%float.loc9_23, %float.loc9_28) [template = constants.%true]
  198. // CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %float.less_eq.loc9 [template = constants.%true]
  199. // CHECK:STDOUT: %.loc9_13.2: bool = converted %float.less_eq.loc9, %.loc9_13.1 [template = constants.%true]
  200. // CHECK:STDOUT: if %.loc9_13.2 br !if.expr.then.loc9 else br !if.expr.else.loc9
  201. // CHECK:STDOUT:
  202. // CHECK:STDOUT: !if.expr.then.loc9:
  203. // CHECK:STDOUT: %True.ref.loc9: type = name_ref True, file.%True.decl [template = constants.%True]
  204. // CHECK:STDOUT: br !if.expr.result.loc9(%True.ref.loc9)
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: !if.expr.else.loc9:
  207. // CHECK:STDOUT: %False.ref.loc9: type = name_ref False, file.%False.decl [template = constants.%False]
  208. // CHECK:STDOUT: br !if.expr.result.loc9(%False.ref.loc9)
  209. // CHECK:STDOUT:
  210. // CHECK:STDOUT: !if.expr.result.loc9:
  211. // CHECK:STDOUT: %.loc9_13.3: type = block_arg !if.expr.result.loc9 [template = constants.%True]
  212. // CHECK:STDOUT: %true_.ref.loc10: %True = name_ref true_, %true_
  213. // CHECK:STDOUT: %LessEq.ref.loc10: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq]
  214. // CHECK:STDOUT: %float.loc10_23: f64 = float_literal 1 [template = constants.%float.f4e]
  215. // CHECK:STDOUT: %float.loc10_28: f64 = float_literal 1 [template = constants.%float.f4e]
  216. // CHECK:STDOUT: %float.less_eq.loc10: init bool = call %LessEq.ref.loc10(%float.loc10_23, %float.loc10_28) [template = constants.%true]
  217. // CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %float.less_eq.loc10 [template = constants.%true]
  218. // CHECK:STDOUT: %.loc10_13.2: bool = converted %float.less_eq.loc10, %.loc10_13.1 [template = constants.%true]
  219. // CHECK:STDOUT: if %.loc10_13.2 br !if.expr.then.loc10 else br !if.expr.else.loc10
  220. // CHECK:STDOUT:
  221. // CHECK:STDOUT: !if.expr.then.loc10:
  222. // CHECK:STDOUT: %True.ref.loc10: type = name_ref True, file.%True.decl [template = constants.%True]
  223. // CHECK:STDOUT: br !if.expr.result.loc10(%True.ref.loc10)
  224. // CHECK:STDOUT:
  225. // CHECK:STDOUT: !if.expr.else.loc10:
  226. // CHECK:STDOUT: %False.ref.loc10: type = name_ref False, file.%False.decl [template = constants.%False]
  227. // CHECK:STDOUT: br !if.expr.result.loc10(%False.ref.loc10)
  228. // CHECK:STDOUT:
  229. // CHECK:STDOUT: !if.expr.result.loc10:
  230. // CHECK:STDOUT: %.loc10_13.3: type = block_arg !if.expr.result.loc10 [template = constants.%True]
  231. // CHECK:STDOUT: %false_.ref.loc11: %False = name_ref false_, %false_
  232. // CHECK:STDOUT: %LessEq.ref.loc11: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq]
  233. // CHECK:STDOUT: %float.loc11_24: f64 = float_literal 1 [template = constants.%float.f4e]
  234. // CHECK:STDOUT: %float.loc11_29: f64 = float_literal 0 [template = constants.%float.555]
  235. // CHECK:STDOUT: %float.less_eq.loc11: init bool = call %LessEq.ref.loc11(%float.loc11_24, %float.loc11_29) [template = constants.%false]
  236. // CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %float.less_eq.loc11 [template = constants.%false]
  237. // CHECK:STDOUT: %.loc11_14.2: bool = converted %float.less_eq.loc11, %.loc11_14.1 [template = constants.%false]
  238. // CHECK:STDOUT: if %.loc11_14.2 br !if.expr.then.loc11 else br !if.expr.else.loc11
  239. // CHECK:STDOUT:
  240. // CHECK:STDOUT: !if.expr.then.loc11:
  241. // CHECK:STDOUT: %True.ref.loc11: type = name_ref True, file.%True.decl [template = constants.%True]
  242. // CHECK:STDOUT: br !if.expr.result.loc11(%True.ref.loc11)
  243. // CHECK:STDOUT:
  244. // CHECK:STDOUT: !if.expr.else.loc11:
  245. // CHECK:STDOUT: %False.ref.loc11: type = name_ref False, file.%False.decl [template = constants.%False]
  246. // CHECK:STDOUT: br !if.expr.result.loc11(%False.ref.loc11)
  247. // CHECK:STDOUT:
  248. // CHECK:STDOUT: !if.expr.result.loc11:
  249. // CHECK:STDOUT: %.loc11_14.3: type = block_arg !if.expr.result.loc11 [template = constants.%False]
  250. // CHECK:STDOUT: %true_.ref.loc12: %True = name_ref true_, %true_
  251. // CHECK:STDOUT: %LessEq.ref.loc12: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq]
  252. // CHECK:STDOUT: %Negate.ref.loc12: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate]
  253. // CHECK:STDOUT: %float.loc12_30: f64 = float_literal 1 [template = constants.%float.f4e]
  254. // CHECK:STDOUT: %float.negate.loc12: init f64 = call %Negate.ref.loc12(%float.loc12_30) [template = constants.%float.f51]
  255. // CHECK:STDOUT: %float.loc12_36: f64 = float_literal 0 [template = constants.%float.555]
  256. // CHECK:STDOUT: %.loc12_33.1: f64 = value_of_initializer %float.negate.loc12 [template = constants.%float.f51]
  257. // CHECK:STDOUT: %.loc12_33.2: f64 = converted %float.negate.loc12, %.loc12_33.1 [template = constants.%float.f51]
  258. // CHECK:STDOUT: %float.less_eq.loc12: init bool = call %LessEq.ref.loc12(%.loc12_33.2, %float.loc12_36) [template = constants.%true]
  259. // CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %float.less_eq.loc12 [template = constants.%true]
  260. // CHECK:STDOUT: %.loc12_13.2: bool = converted %float.less_eq.loc12, %.loc12_13.1 [template = constants.%true]
  261. // CHECK:STDOUT: if %.loc12_13.2 br !if.expr.then.loc12 else br !if.expr.else.loc12
  262. // CHECK:STDOUT:
  263. // CHECK:STDOUT: !if.expr.then.loc12:
  264. // CHECK:STDOUT: %True.ref.loc12: type = name_ref True, file.%True.decl [template = constants.%True]
  265. // CHECK:STDOUT: br !if.expr.result.loc12(%True.ref.loc12)
  266. // CHECK:STDOUT:
  267. // CHECK:STDOUT: !if.expr.else.loc12:
  268. // CHECK:STDOUT: %False.ref.loc12: type = name_ref False, file.%False.decl [template = constants.%False]
  269. // CHECK:STDOUT: br !if.expr.result.loc12(%False.ref.loc12)
  270. // CHECK:STDOUT:
  271. // CHECK:STDOUT: !if.expr.result.loc12:
  272. // CHECK:STDOUT: %.loc12_13.3: type = block_arg !if.expr.result.loc12 [template = constants.%True]
  273. // CHECK:STDOUT: %false_.ref.loc13: %False = name_ref false_, %false_
  274. // CHECK:STDOUT: %LessEq.ref.loc13: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq]
  275. // CHECK:STDOUT: %float.loc13_24: f64 = float_literal 0 [template = constants.%float.555]
  276. // CHECK:STDOUT: %Negate.ref.loc13: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate]
  277. // CHECK:STDOUT: %float.loc13_36: f64 = float_literal 1 [template = constants.%float.f4e]
  278. // CHECK:STDOUT: %float.negate.loc13: init f64 = call %Negate.ref.loc13(%float.loc13_36) [template = constants.%float.f51]
  279. // CHECK:STDOUT: %.loc13_39.1: f64 = value_of_initializer %float.negate.loc13 [template = constants.%float.f51]
  280. // CHECK:STDOUT: %.loc13_39.2: f64 = converted %float.negate.loc13, %.loc13_39.1 [template = constants.%float.f51]
  281. // CHECK:STDOUT: %float.less_eq.loc13: init bool = call %LessEq.ref.loc13(%float.loc13_24, %.loc13_39.2) [template = constants.%false]
  282. // CHECK:STDOUT: %.loc13_14.1: bool = value_of_initializer %float.less_eq.loc13 [template = constants.%false]
  283. // CHECK:STDOUT: %.loc13_14.2: bool = converted %float.less_eq.loc13, %.loc13_14.1 [template = constants.%false]
  284. // CHECK:STDOUT: if %.loc13_14.2 br !if.expr.then.loc13 else br !if.expr.else.loc13
  285. // CHECK:STDOUT:
  286. // CHECK:STDOUT: !if.expr.then.loc13:
  287. // CHECK:STDOUT: %True.ref.loc13: type = name_ref True, file.%True.decl [template = constants.%True]
  288. // CHECK:STDOUT: br !if.expr.result.loc13(%True.ref.loc13)
  289. // CHECK:STDOUT:
  290. // CHECK:STDOUT: !if.expr.else.loc13:
  291. // CHECK:STDOUT: %False.ref.loc13: type = name_ref False, file.%False.decl [template = constants.%False]
  292. // CHECK:STDOUT: br !if.expr.result.loc13(%False.ref.loc13)
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: !if.expr.result.loc13:
  295. // CHECK:STDOUT: %.loc13_14.3: type = block_arg !if.expr.result.loc13 [template = constants.%False]
  296. // CHECK:STDOUT: return
  297. // CHECK:STDOUT: }
  298. // CHECK:STDOUT:
  299. // CHECK:STDOUT: fn @RuntimeCallIsValid(%a.param_patt: f64, %b.param_patt: f64) -> bool {
  300. // CHECK:STDOUT: !entry:
  301. // CHECK:STDOUT: %LessEq.ref: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq]
  302. // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a
  303. // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b
  304. // CHECK:STDOUT: %float.less_eq: init bool = call %LessEq.ref(%a.ref, %b.ref)
  305. // CHECK:STDOUT: %.loc17_22.1: bool = value_of_initializer %float.less_eq
  306. // CHECK:STDOUT: %.loc17_22.2: bool = converted %float.less_eq, %.loc17_22.1
  307. // CHECK:STDOUT: return %.loc17_22.2
  308. // CHECK:STDOUT: }
  309. // CHECK:STDOUT: