| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486 |
- // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
- // Exceptions. See /LICENSE for license information.
- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- //
- // AUTOUPDATE
- // TIP: To test this file alone, run:
- // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/float/mul.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/mul.carbon
- // --- mul_sub.carbon
- fn Mul(a: f64, b: f64) -> f64 = "float.mul";
- fn RuntimeCallIsValid(a: f64, b: f64) -> f64 {
- return Mul(a, b);
- }
- var x: f64 = Mul(2.0, 0.5);
- // --- fail_bad_decl.carbon
- package FailBadDecl;
- // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
- // CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.mul";
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- fn TooFew(a: f64) -> f64 = "float.mul";
- // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
- // CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.mul";
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.mul";
- // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
- // CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.mul";
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- fn BadReturnType(a: f64, b: f64) -> bool = "float.mul";
- fn JustRight(a: f64, b: f64) -> f64 = "float.mul";
- fn RuntimeCallIsValidTooFew(a: f64) -> f64 {
- return TooFew(a);
- }
- fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 {
- return TooMany(a, b, c);
- }
- fn RuntimeCallIsValidBadReturnType(a: f64, b: f64) -> bool {
- return BadReturnType(a, b);
- }
- // CHECK:STDOUT: --- mul_sub.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template]
- // CHECK:STDOUT: %Float.type: type = fn_type @Float [template]
- // CHECK:STDOUT: %Float: %Float.type = struct_value () [template]
- // CHECK:STDOUT: %Mul.type: type = fn_type @Mul [template]
- // CHECK:STDOUT: %Mul: %Mul.type = struct_value () [template]
- // CHECK:STDOUT: %RuntimeCallIsValid.type: type = fn_type @RuntimeCallIsValid [template]
- // CHECK:STDOUT: %RuntimeCallIsValid: %RuntimeCallIsValid.type = struct_value () [template]
- // CHECK:STDOUT: %float.be3: f64 = float_literal 2 [template]
- // CHECK:STDOUT: %float.c22: f64 = float_literal 0.5 [template]
- // CHECK:STDOUT: %float.f4e: f64 = float_literal 1 [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .Float = %Core.Float
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/...
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .Mul = %Mul.decl
- // CHECK:STDOUT: .RuntimeCallIsValid = %RuntimeCallIsValid.decl
- // CHECK:STDOUT: .x = %x
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %Mul.decl: %Mul.type = fn_decl @Mul [template = constants.%Mul] {
- // CHECK:STDOUT: %a.patt: f64 = binding_pattern a
- // CHECK:STDOUT: %a.param_patt: f64 = value_param_pattern %a.patt, runtime_param0
- // CHECK:STDOUT: %b.patt: f64 = binding_pattern b
- // CHECK:STDOUT: %b.param_patt: f64 = value_param_pattern %b.patt, runtime_param1
- // CHECK:STDOUT: %return.patt: f64 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: f64 = out_param_pattern %return.patt, runtime_param2
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %int_64.loc2_27: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc2_27: init type = call constants.%Float(%int_64.loc2_27) [template = f64]
- // CHECK:STDOUT: %.loc2_27.1: type = value_of_initializer %float.make_type.loc2_27 [template = f64]
- // CHECK:STDOUT: %.loc2_27.2: type = converted %float.make_type.loc2_27, %.loc2_27.1 [template = f64]
- // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0
- // CHECK:STDOUT: %.loc2_11.1: type = splice_block %.loc2_11.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc2_11: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc2_11: init type = call constants.%Float(%int_64.loc2_11) [template = f64]
- // CHECK:STDOUT: %.loc2_11.2: type = value_of_initializer %float.make_type.loc2_11 [template = f64]
- // CHECK:STDOUT: %.loc2_11.3: type = converted %float.make_type.loc2_11, %.loc2_11.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: f64 = bind_name a, %a.param
- // CHECK:STDOUT: %b.param: f64 = value_param runtime_param1
- // CHECK:STDOUT: %.loc2_19.1: type = splice_block %.loc2_19.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc2_19: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc2_19: init type = call constants.%Float(%int_64.loc2_19) [template = f64]
- // CHECK:STDOUT: %.loc2_19.2: type = value_of_initializer %float.make_type.loc2_19 [template = f64]
- // CHECK:STDOUT: %.loc2_19.3: type = converted %float.make_type.loc2_19, %.loc2_19.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %b: f64 = bind_name b, %b.param
- // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param2
- // CHECK:STDOUT: %return: ref f64 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %RuntimeCallIsValid.decl: %RuntimeCallIsValid.type = fn_decl @RuntimeCallIsValid [template = constants.%RuntimeCallIsValid] {
- // CHECK:STDOUT: %a.patt: f64 = binding_pattern a
- // CHECK:STDOUT: %a.param_patt: f64 = value_param_pattern %a.patt, runtime_param0
- // CHECK:STDOUT: %b.patt: f64 = binding_pattern b
- // CHECK:STDOUT: %b.param_patt: f64 = value_param_pattern %b.patt, runtime_param1
- // CHECK:STDOUT: %return.patt: f64 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: f64 = out_param_pattern %return.patt, runtime_param2
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %int_64.loc4_42: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc4_42: init type = call constants.%Float(%int_64.loc4_42) [template = f64]
- // CHECK:STDOUT: %.loc4_42.1: type = value_of_initializer %float.make_type.loc4_42 [template = f64]
- // CHECK:STDOUT: %.loc4_42.2: type = converted %float.make_type.loc4_42, %.loc4_42.1 [template = f64]
- // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0
- // CHECK:STDOUT: %.loc4_26.1: type = splice_block %.loc4_26.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc4_26: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc4_26: init type = call constants.%Float(%int_64.loc4_26) [template = f64]
- // CHECK:STDOUT: %.loc4_26.2: type = value_of_initializer %float.make_type.loc4_26 [template = f64]
- // CHECK:STDOUT: %.loc4_26.3: type = converted %float.make_type.loc4_26, %.loc4_26.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: f64 = bind_name a, %a.param
- // CHECK:STDOUT: %b.param: f64 = value_param runtime_param1
- // CHECK:STDOUT: %.loc4_34.1: type = splice_block %.loc4_34.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc4_34: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc4_34: init type = call constants.%Float(%int_64.loc4_34) [template = f64]
- // CHECK:STDOUT: %.loc4_34.2: type = value_of_initializer %float.make_type.loc4_34 [template = f64]
- // CHECK:STDOUT: %.loc4_34.3: type = converted %float.make_type.loc4_34, %.loc4_34.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %b: f64 = bind_name b, %b.param
- // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param2
- // CHECK:STDOUT: %return: ref f64 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %x.patt: f64 = binding_pattern x
- // CHECK:STDOUT: %.loc8_1: f64 = var_pattern %x.patt
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %x.var: ref f64 = var x
- // CHECK:STDOUT: %.loc8_8.1: type = splice_block %.loc8_8.3 [template = f64] {
- // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type: init type = call constants.%Float(%int_64) [template = f64]
- // CHECK:STDOUT: %.loc8_8.2: type = value_of_initializer %float.make_type [template = f64]
- // CHECK:STDOUT: %.loc8_8.3: type = converted %float.make_type, %.loc8_8.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %x: ref f64 = bind_name x, %x.var
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Mul(%a.param_patt: f64, %b.param_patt: f64) -> f64 = "float.mul";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @RuntimeCallIsValid(%a.param_patt: f64, %b.param_patt: f64) -> f64 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %Mul.ref: %Mul.type = name_ref Mul, file.%Mul.decl [template = constants.%Mul]
- // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a
- // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b
- // CHECK:STDOUT: %float.mul: init f64 = call %Mul.ref(%a.ref, %b.ref)
- // CHECK:STDOUT: %.loc5_19.1: f64 = value_of_initializer %float.mul
- // CHECK:STDOUT: %.loc5_19.2: f64 = converted %float.mul, %.loc5_19.1
- // CHECK:STDOUT: return %.loc5_19.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @__global_init() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %Mul.ref: %Mul.type = name_ref Mul, file.%Mul.decl [template = constants.%Mul]
- // CHECK:STDOUT: %float.loc8_18: f64 = float_literal 2 [template = constants.%float.be3]
- // CHECK:STDOUT: %float.loc8_23: f64 = float_literal 0.5 [template = constants.%float.c22]
- // CHECK:STDOUT: %float.mul: init f64 = call %Mul.ref(%float.loc8_18, %float.loc8_23) [template = constants.%float.f4e]
- // CHECK:STDOUT: assign file.%x.var, %float.mul
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_bad_decl.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template]
- // CHECK:STDOUT: %Float.type: type = fn_type @Float [template]
- // CHECK:STDOUT: %Float: %Float.type = struct_value () [template]
- // CHECK:STDOUT: %TooFew.type: type = fn_type @TooFew [template]
- // CHECK:STDOUT: %TooFew: %TooFew.type = struct_value () [template]
- // CHECK:STDOUT: %TooMany.type: type = fn_type @TooMany [template]
- // CHECK:STDOUT: %TooMany: %TooMany.type = struct_value () [template]
- // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template]
- // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template]
- // CHECK:STDOUT: %BadReturnType.type: type = fn_type @BadReturnType [template]
- // CHECK:STDOUT: %BadReturnType: %BadReturnType.type = struct_value () [template]
- // CHECK:STDOUT: %JustRight.type: type = fn_type @JustRight [template]
- // CHECK:STDOUT: %JustRight: %JustRight.type = struct_value () [template]
- // CHECK:STDOUT: %RuntimeCallIsValidTooFew.type: type = fn_type @RuntimeCallIsValidTooFew [template]
- // CHECK:STDOUT: %RuntimeCallIsValidTooFew: %RuntimeCallIsValidTooFew.type = struct_value () [template]
- // CHECK:STDOUT: %RuntimeCallIsValidTooMany.type: type = fn_type @RuntimeCallIsValidTooMany [template]
- // CHECK:STDOUT: %RuntimeCallIsValidTooMany: %RuntimeCallIsValidTooMany.type = struct_value () [template]
- // CHECK:STDOUT: %RuntimeCallIsValidBadReturnType.type: type = fn_type @RuntimeCallIsValidBadReturnType [template]
- // CHECK:STDOUT: %RuntimeCallIsValidBadReturnType: %RuntimeCallIsValidBadReturnType.type = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .Float = %Core.Float
- // CHECK:STDOUT: .Bool = %Core.Bool
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/...
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .TooFew = %TooFew.decl
- // CHECK:STDOUT: .TooMany = %TooMany.decl
- // CHECK:STDOUT: .BadReturnType = %BadReturnType.decl
- // CHECK:STDOUT: .JustRight = %JustRight.decl
- // CHECK:STDOUT: .RuntimeCallIsValidTooFew = %RuntimeCallIsValidTooFew.decl
- // CHECK:STDOUT: .RuntimeCallIsValidTooMany = %RuntimeCallIsValidTooMany.decl
- // CHECK:STDOUT: .RuntimeCallIsValidBadReturnType = %RuntimeCallIsValidBadReturnType.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %TooFew.decl: %TooFew.type = fn_decl @TooFew [template = constants.%TooFew] {
- // CHECK:STDOUT: %a.patt: f64 = binding_pattern a
- // CHECK:STDOUT: %a.param_patt: f64 = value_param_pattern %a.patt, runtime_param0
- // CHECK:STDOUT: %return.patt: f64 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: f64 = out_param_pattern %return.patt, runtime_param1
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %int_64.loc8_22: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc8_22: init type = call constants.%Float(%int_64.loc8_22) [template = f64]
- // CHECK:STDOUT: %.loc8_22.1: type = value_of_initializer %float.make_type.loc8_22 [template = f64]
- // CHECK:STDOUT: %.loc8_22.2: type = converted %float.make_type.loc8_22, %.loc8_22.1 [template = f64]
- // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0
- // CHECK:STDOUT: %.loc8_14.1: type = splice_block %.loc8_14.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc8_14: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc8_14: init type = call constants.%Float(%int_64.loc8_14) [template = f64]
- // CHECK:STDOUT: %.loc8_14.2: type = value_of_initializer %float.make_type.loc8_14 [template = f64]
- // CHECK:STDOUT: %.loc8_14.3: type = converted %float.make_type.loc8_14, %.loc8_14.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: f64 = bind_name a, %a.param
- // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param1
- // CHECK:STDOUT: %return: ref f64 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %TooMany.decl: %TooMany.type = fn_decl @TooMany [template = constants.%TooMany] {
- // CHECK:STDOUT: %a.patt: f64 = binding_pattern a
- // CHECK:STDOUT: %a.param_patt: f64 = value_param_pattern %a.patt, runtime_param0
- // CHECK:STDOUT: %b.patt: f64 = binding_pattern b
- // CHECK:STDOUT: %b.param_patt: f64 = value_param_pattern %b.patt, runtime_param1
- // CHECK:STDOUT: %c.patt: f64 = binding_pattern c
- // CHECK:STDOUT: %c.param_patt: f64 = value_param_pattern %c.patt, runtime_param2
- // CHECK:STDOUT: %return.patt: f64 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: f64 = out_param_pattern %return.patt, runtime_param3
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %int_64.loc13_39: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc13_39: init type = call constants.%Float(%int_64.loc13_39) [template = f64]
- // CHECK:STDOUT: %.loc13_39.1: type = value_of_initializer %float.make_type.loc13_39 [template = f64]
- // CHECK:STDOUT: %.loc13_39.2: type = converted %float.make_type.loc13_39, %.loc13_39.1 [template = f64]
- // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0
- // CHECK:STDOUT: %.loc13_15.1: type = splice_block %.loc13_15.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc13_15: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc13_15: init type = call constants.%Float(%int_64.loc13_15) [template = f64]
- // CHECK:STDOUT: %.loc13_15.2: type = value_of_initializer %float.make_type.loc13_15 [template = f64]
- // CHECK:STDOUT: %.loc13_15.3: type = converted %float.make_type.loc13_15, %.loc13_15.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: f64 = bind_name a, %a.param
- // CHECK:STDOUT: %b.param: f64 = value_param runtime_param1
- // CHECK:STDOUT: %.loc13_23.1: type = splice_block %.loc13_23.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc13_23: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc13_23: init type = call constants.%Float(%int_64.loc13_23) [template = f64]
- // CHECK:STDOUT: %.loc13_23.2: type = value_of_initializer %float.make_type.loc13_23 [template = f64]
- // CHECK:STDOUT: %.loc13_23.3: type = converted %float.make_type.loc13_23, %.loc13_23.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %b: f64 = bind_name b, %b.param
- // CHECK:STDOUT: %c.param: f64 = value_param runtime_param2
- // CHECK:STDOUT: %.loc13_31.1: type = splice_block %.loc13_31.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc13_31: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc13_31: init type = call constants.%Float(%int_64.loc13_31) [template = f64]
- // CHECK:STDOUT: %.loc13_31.2: type = value_of_initializer %float.make_type.loc13_31 [template = f64]
- // CHECK:STDOUT: %.loc13_31.3: type = converted %float.make_type.loc13_31, %.loc13_31.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %c: f64 = bind_name c, %c.param
- // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param3
- // CHECK:STDOUT: %return: ref f64 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %BadReturnType.decl: %BadReturnType.type = fn_decl @BadReturnType [template = constants.%BadReturnType] {
- // CHECK:STDOUT: %a.patt: f64 = binding_pattern a
- // CHECK:STDOUT: %a.param_patt: f64 = value_param_pattern %a.patt, runtime_param0
- // CHECK:STDOUT: %b.patt: f64 = binding_pattern b
- // CHECK:STDOUT: %b.param_patt: f64 = value_param_pattern %b.patt, runtime_param1
- // CHECK:STDOUT: %return.patt: bool = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
- // CHECK:STDOUT: %.loc18_37.1: type = value_of_initializer %bool.make_type [template = bool]
- // CHECK:STDOUT: %.loc18_37.2: type = converted %bool.make_type, %.loc18_37.1 [template = bool]
- // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0
- // CHECK:STDOUT: %.loc18_21.1: type = splice_block %.loc18_21.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc18_21: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc18_21: init type = call constants.%Float(%int_64.loc18_21) [template = f64]
- // CHECK:STDOUT: %.loc18_21.2: type = value_of_initializer %float.make_type.loc18_21 [template = f64]
- // CHECK:STDOUT: %.loc18_21.3: type = converted %float.make_type.loc18_21, %.loc18_21.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: f64 = bind_name a, %a.param
- // CHECK:STDOUT: %b.param: f64 = value_param runtime_param1
- // CHECK:STDOUT: %.loc18_29.1: type = splice_block %.loc18_29.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc18_29: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc18_29: init type = call constants.%Float(%int_64.loc18_29) [template = f64]
- // CHECK:STDOUT: %.loc18_29.2: type = value_of_initializer %float.make_type.loc18_29 [template = f64]
- // CHECK:STDOUT: %.loc18_29.3: type = converted %float.make_type.loc18_29, %.loc18_29.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %b: f64 = bind_name b, %b.param
- // CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2
- // CHECK:STDOUT: %return: ref bool = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %JustRight.decl: %JustRight.type = fn_decl @JustRight [template = constants.%JustRight] {
- // CHECK:STDOUT: %a.patt: f64 = binding_pattern a
- // CHECK:STDOUT: %a.param_patt: f64 = value_param_pattern %a.patt, runtime_param0
- // CHECK:STDOUT: %b.patt: f64 = binding_pattern b
- // CHECK:STDOUT: %b.param_patt: f64 = value_param_pattern %b.patt, runtime_param1
- // CHECK:STDOUT: %return.patt: f64 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: f64 = out_param_pattern %return.patt, runtime_param2
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %int_64.loc19_33: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc19_33: init type = call constants.%Float(%int_64.loc19_33) [template = f64]
- // CHECK:STDOUT: %.loc19_33.1: type = value_of_initializer %float.make_type.loc19_33 [template = f64]
- // CHECK:STDOUT: %.loc19_33.2: type = converted %float.make_type.loc19_33, %.loc19_33.1 [template = f64]
- // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0
- // CHECK:STDOUT: %.loc19_17.1: type = splice_block %.loc19_17.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc19_17: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc19_17: init type = call constants.%Float(%int_64.loc19_17) [template = f64]
- // CHECK:STDOUT: %.loc19_17.2: type = value_of_initializer %float.make_type.loc19_17 [template = f64]
- // CHECK:STDOUT: %.loc19_17.3: type = converted %float.make_type.loc19_17, %.loc19_17.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: f64 = bind_name a, %a.param
- // CHECK:STDOUT: %b.param: f64 = value_param runtime_param1
- // CHECK:STDOUT: %.loc19_25.1: type = splice_block %.loc19_25.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc19_25: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc19_25: init type = call constants.%Float(%int_64.loc19_25) [template = f64]
- // CHECK:STDOUT: %.loc19_25.2: type = value_of_initializer %float.make_type.loc19_25 [template = f64]
- // CHECK:STDOUT: %.loc19_25.3: type = converted %float.make_type.loc19_25, %.loc19_25.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %b: f64 = bind_name b, %b.param
- // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param2
- // CHECK:STDOUT: %return: ref f64 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %RuntimeCallIsValidTooFew.decl: %RuntimeCallIsValidTooFew.type = fn_decl @RuntimeCallIsValidTooFew [template = constants.%RuntimeCallIsValidTooFew] {
- // CHECK:STDOUT: %a.patt: f64 = binding_pattern a
- // CHECK:STDOUT: %a.param_patt: f64 = value_param_pattern %a.patt, runtime_param0
- // CHECK:STDOUT: %return.patt: f64 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: f64 = out_param_pattern %return.patt, runtime_param1
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %int_64.loc21_40: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc21_40: init type = call constants.%Float(%int_64.loc21_40) [template = f64]
- // CHECK:STDOUT: %.loc21_40.1: type = value_of_initializer %float.make_type.loc21_40 [template = f64]
- // CHECK:STDOUT: %.loc21_40.2: type = converted %float.make_type.loc21_40, %.loc21_40.1 [template = f64]
- // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0
- // CHECK:STDOUT: %.loc21_32.1: type = splice_block %.loc21_32.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc21_32: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc21_32: init type = call constants.%Float(%int_64.loc21_32) [template = f64]
- // CHECK:STDOUT: %.loc21_32.2: type = value_of_initializer %float.make_type.loc21_32 [template = f64]
- // CHECK:STDOUT: %.loc21_32.3: type = converted %float.make_type.loc21_32, %.loc21_32.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: f64 = bind_name a, %a.param
- // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param1
- // CHECK:STDOUT: %return: ref f64 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %RuntimeCallIsValidTooMany.decl: %RuntimeCallIsValidTooMany.type = fn_decl @RuntimeCallIsValidTooMany [template = constants.%RuntimeCallIsValidTooMany] {
- // CHECK:STDOUT: %a.patt: f64 = binding_pattern a
- // CHECK:STDOUT: %a.param_patt: f64 = value_param_pattern %a.patt, runtime_param0
- // CHECK:STDOUT: %b.patt: f64 = binding_pattern b
- // CHECK:STDOUT: %b.param_patt: f64 = value_param_pattern %b.patt, runtime_param1
- // CHECK:STDOUT: %c.patt: f64 = binding_pattern c
- // CHECK:STDOUT: %c.param_patt: f64 = value_param_pattern %c.patt, runtime_param2
- // CHECK:STDOUT: %return.patt: f64 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: f64 = out_param_pattern %return.patt, runtime_param3
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %int_64.loc25_57: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc25_57: init type = call constants.%Float(%int_64.loc25_57) [template = f64]
- // CHECK:STDOUT: %.loc25_57.1: type = value_of_initializer %float.make_type.loc25_57 [template = f64]
- // CHECK:STDOUT: %.loc25_57.2: type = converted %float.make_type.loc25_57, %.loc25_57.1 [template = f64]
- // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0
- // CHECK:STDOUT: %.loc25_33.1: type = splice_block %.loc25_33.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc25_33: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc25_33: init type = call constants.%Float(%int_64.loc25_33) [template = f64]
- // CHECK:STDOUT: %.loc25_33.2: type = value_of_initializer %float.make_type.loc25_33 [template = f64]
- // CHECK:STDOUT: %.loc25_33.3: type = converted %float.make_type.loc25_33, %.loc25_33.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: f64 = bind_name a, %a.param
- // CHECK:STDOUT: %b.param: f64 = value_param runtime_param1
- // CHECK:STDOUT: %.loc25_41.1: type = splice_block %.loc25_41.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc25_41: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc25_41: init type = call constants.%Float(%int_64.loc25_41) [template = f64]
- // CHECK:STDOUT: %.loc25_41.2: type = value_of_initializer %float.make_type.loc25_41 [template = f64]
- // CHECK:STDOUT: %.loc25_41.3: type = converted %float.make_type.loc25_41, %.loc25_41.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %b: f64 = bind_name b, %b.param
- // CHECK:STDOUT: %c.param: f64 = value_param runtime_param2
- // CHECK:STDOUT: %.loc25_49.1: type = splice_block %.loc25_49.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc25_49: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc25_49: init type = call constants.%Float(%int_64.loc25_49) [template = f64]
- // CHECK:STDOUT: %.loc25_49.2: type = value_of_initializer %float.make_type.loc25_49 [template = f64]
- // CHECK:STDOUT: %.loc25_49.3: type = converted %float.make_type.loc25_49, %.loc25_49.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %c: f64 = bind_name c, %c.param
- // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param3
- // CHECK:STDOUT: %return: ref f64 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %RuntimeCallIsValidBadReturnType.decl: %RuntimeCallIsValidBadReturnType.type = fn_decl @RuntimeCallIsValidBadReturnType [template = constants.%RuntimeCallIsValidBadReturnType] {
- // CHECK:STDOUT: %a.patt: f64 = binding_pattern a
- // CHECK:STDOUT: %a.param_patt: f64 = value_param_pattern %a.patt, runtime_param0
- // CHECK:STDOUT: %b.patt: f64 = binding_pattern b
- // CHECK:STDOUT: %b.param_patt: f64 = value_param_pattern %b.patt, runtime_param1
- // CHECK:STDOUT: %return.patt: bool = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
- // CHECK:STDOUT: %.loc29_55.1: type = value_of_initializer %bool.make_type [template = bool]
- // CHECK:STDOUT: %.loc29_55.2: type = converted %bool.make_type, %.loc29_55.1 [template = bool]
- // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0
- // CHECK:STDOUT: %.loc29_39.1: type = splice_block %.loc29_39.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc29_39: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc29_39: init type = call constants.%Float(%int_64.loc29_39) [template = f64]
- // CHECK:STDOUT: %.loc29_39.2: type = value_of_initializer %float.make_type.loc29_39 [template = f64]
- // CHECK:STDOUT: %.loc29_39.3: type = converted %float.make_type.loc29_39, %.loc29_39.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: f64 = bind_name a, %a.param
- // CHECK:STDOUT: %b.param: f64 = value_param runtime_param1
- // CHECK:STDOUT: %.loc29_47.1: type = splice_block %.loc29_47.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc29_47: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc29_47: init type = call constants.%Float(%int_64.loc29_47) [template = f64]
- // CHECK:STDOUT: %.loc29_47.2: type = value_of_initializer %float.make_type.loc29_47 [template = f64]
- // CHECK:STDOUT: %.loc29_47.3: type = converted %float.make_type.loc29_47, %.loc29_47.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %b: f64 = bind_name b, %b.param
- // CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2
- // CHECK:STDOUT: %return: ref bool = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @TooFew(%a.param_patt: f64) -> f64;
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @TooMany(%a.param_patt: f64, %b.param_patt: f64, %c.param_patt: f64) -> f64;
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @BadReturnType(%a.param_patt: f64, %b.param_patt: f64) -> bool;
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @JustRight(%a.param_patt: f64, %b.param_patt: f64) -> f64 = "float.mul";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @RuntimeCallIsValidTooFew(%a.param_patt: f64) -> f64 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %TooFew.ref: %TooFew.type = name_ref TooFew, file.%TooFew.decl [template = constants.%TooFew]
- // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a
- // CHECK:STDOUT: %TooFew.call: init f64 = call %TooFew.ref(%a.ref)
- // CHECK:STDOUT: %.loc22_19.1: f64 = value_of_initializer %TooFew.call
- // CHECK:STDOUT: %.loc22_19.2: f64 = converted %TooFew.call, %.loc22_19.1
- // CHECK:STDOUT: return %.loc22_19.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @RuntimeCallIsValidTooMany(%a.param_patt: f64, %b.param_patt: f64, %c.param_patt: f64) -> f64 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %TooMany.ref: %TooMany.type = name_ref TooMany, file.%TooMany.decl [template = constants.%TooMany]
- // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a
- // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b
- // CHECK:STDOUT: %c.ref: f64 = name_ref c, %c
- // CHECK:STDOUT: %TooMany.call: init f64 = call %TooMany.ref(%a.ref, %b.ref, %c.ref)
- // CHECK:STDOUT: %.loc26_26.1: f64 = value_of_initializer %TooMany.call
- // CHECK:STDOUT: %.loc26_26.2: f64 = converted %TooMany.call, %.loc26_26.1
- // CHECK:STDOUT: return %.loc26_26.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @RuntimeCallIsValidBadReturnType(%a.param_patt: f64, %b.param_patt: f64) -> bool {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %BadReturnType.ref: %BadReturnType.type = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%BadReturnType]
- // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a
- // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b
- // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref)
- // CHECK:STDOUT: %.loc30_29.1: bool = value_of_initializer %BadReturnType.call
- // CHECK:STDOUT: %.loc30_29.2: bool = converted %BadReturnType.call, %.loc30_29.1
- // CHECK:STDOUT: return %.loc30_29.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|