| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444 |
- // 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/negate.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/negate.carbon
- // --- float_negate.carbon
- fn Negate(a: f64) -> f64 = "float.negate";
- fn RuntimeCallIsValid(a: f64, b: f64) -> f64 {
- return Negate(a);
- }
- let a: f64 = Negate(1.5);
- // --- fail_bad_decl.carbon
- package FailBadDecl;
- // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature]
- // CHECK:STDERR: fn TooFew() -> f64 = "float.negate";
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- fn TooFew() -> f64 = "float.negate";
- // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature]
- // CHECK:STDERR: fn TooMany(a: f64, b: f64) -> f64 = "float.negate";
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- fn TooMany(a: f64, b: f64) -> f64 = "float.negate";
- // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature]
- // CHECK:STDERR: fn BadReturnType(a: f64) -> bool = "float.negate";
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- fn BadReturnType(a: f64) -> bool = "float.negate";
- fn JustRight(a: f64) -> f64 = "float.negate";
- fn RuntimeCallIsValidTooFew(a: f64) -> f64 {
- // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 1 argument passed to function expecting 0 arguments [CallArgCountMismatch]
- // CHECK:STDERR: return TooFew(a);
- // CHECK:STDERR: ^~~~~~~~~
- // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-17]]:1: note: calling function declared here [InCallToEntity]
- // CHECK:STDERR: fn TooFew() -> f64 = "float.negate";
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- return TooFew(a);
- }
- fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 {
- // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 3 arguments passed to function expecting 2 arguments [CallArgCountMismatch]
- // CHECK:STDERR: return TooMany(a, b, c);
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-23]]:1: note: calling function declared here [InCallToEntity]
- // CHECK:STDERR: fn TooMany(a: f64, b: f64) -> f64 = "float.negate";
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- return TooMany(a, b, c);
- }
- fn RuntimeCallIsValidBadReturnType(a: f64, b: f64) -> bool {
- // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch]
- // CHECK:STDERR: return BadReturnType(a, b);
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-29]]:1: note: calling function declared here [InCallToEntity]
- // CHECK:STDERR: fn BadReturnType(a: f64) -> bool = "float.negate";
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- return BadReturnType(a, b);
- }
- // CHECK:STDOUT: --- float_negate.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: %Negate.type: type = fn_type @Negate [template]
- // CHECK:STDOUT: %Negate: %Negate.type = struct_value () [template]
- // CHECK:STDOUT: %RuntimeCallIsValid.type: type = fn_type @RuntimeCallIsValid [template]
- // CHECK:STDOUT: %RuntimeCallIsValid: %RuntimeCallIsValid.type = struct_value () [template]
- // CHECK:STDOUT: %float.e93: f64 = float_literal 1.5 [template]
- // CHECK:STDOUT: %float.928: f64 = float_literal -1.5 [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: .Negate = %Negate.decl
- // CHECK:STDOUT: .RuntimeCallIsValid = %RuntimeCallIsValid.decl
- // CHECK:STDOUT: .a = %a
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %Negate.decl: %Negate.type = fn_decl @Negate [template = constants.%Negate] {
- // 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.loc2_22: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc2_22: init type = call constants.%Float(%int_64.loc2_22) [template = f64]
- // CHECK:STDOUT: %.loc2_22.1: type = value_of_initializer %float.make_type.loc2_22 [template = f64]
- // CHECK:STDOUT: %.loc2_22.2: type = converted %float.make_type.loc2_22, %.loc2_22.1 [template = f64]
- // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0
- // CHECK:STDOUT: %.loc2_14.1: type = splice_block %.loc2_14.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc2_14: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc2_14: init type = call constants.%Float(%int_64.loc2_14) [template = f64]
- // CHECK:STDOUT: %.loc2_14.2: type = value_of_initializer %float.make_type.loc2_14 [template = f64]
- // CHECK:STDOUT: %.loc2_14.3: type = converted %float.make_type.loc2_14, %.loc2_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: %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: %a.patt: f64 = binding_pattern a
- // CHECK:STDOUT: }
- // 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: %.loc8_24.1: ref f64 = temporary_storage
- // CHECK:STDOUT: %.loc8_24.2: ref f64 = temporary %.loc8_24.1, @__global_init.%float.negate
- // CHECK:STDOUT: %a: ref f64 = bind_name a, %.loc8_24.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Negate(%a.param_patt: f64) -> f64 = "float.negate";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @RuntimeCallIsValid(%a.param_patt: f64, %b.param_patt: f64) -> f64 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %Negate.ref: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate]
- // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a
- // CHECK:STDOUT: %float.negate: init f64 = call %Negate.ref(%a.ref)
- // CHECK:STDOUT: %.loc5_19.1: f64 = value_of_initializer %float.negate
- // CHECK:STDOUT: %.loc5_19.2: f64 = converted %float.negate, %.loc5_19.1
- // CHECK:STDOUT: return %.loc5_19.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @__global_init() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %Negate.ref: %Negate.type = name_ref Negate, file.%Negate.decl [template = constants.%Negate]
- // CHECK:STDOUT: %float: f64 = float_literal 1.5 [template = constants.%float.e93]
- // CHECK:STDOUT: %float.negate: init f64 = call %Negate.ref(%float) [template = constants.%float.928]
- // 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: %return.patt: f64 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: f64 = out_param_pattern %return.patt, runtime_param0
- // CHECK:STDOUT: } {
- // 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_16.1: type = value_of_initializer %float.make_type [template = f64]
- // CHECK:STDOUT: %.loc8_16.2: type = converted %float.make_type, %.loc8_16.1 [template = f64]
- // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param0
- // 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: %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.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.1: type = value_of_initializer %float.make_type.loc13_31 [template = f64]
- // CHECK:STDOUT: %.loc13_31.2: type = converted %float.make_type.loc13_31, %.loc13_31.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: %return.param: ref f64 = out_param runtime_param2
- // 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: %return.patt: bool = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param1
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
- // CHECK:STDOUT: %.loc18_29.1: type = value_of_initializer %bool.make_type [template = bool]
- // CHECK:STDOUT: %.loc18_29.2: type = converted %bool.make_type, %.loc18_29.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: 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: %.loc18_21.2: type = value_of_initializer %float.make_type [template = f64]
- // CHECK:STDOUT: %.loc18_21.3: type = converted %float.make_type, %.loc18_21.2 [template = f64]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: f64 = bind_name a, %a.param
- // CHECK:STDOUT: %return.param: ref bool = out_param runtime_param1
- // 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: %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.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.1: type = value_of_initializer %float.make_type.loc19_25 [template = f64]
- // CHECK:STDOUT: %.loc19_25.2: type = converted %float.make_type.loc19_25, %.loc19_25.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: %return.param: ref f64 = out_param runtime_param1
- // 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.loc32_57: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc32_57: init type = call constants.%Float(%int_64.loc32_57) [template = f64]
- // CHECK:STDOUT: %.loc32_57.1: type = value_of_initializer %float.make_type.loc32_57 [template = f64]
- // CHECK:STDOUT: %.loc32_57.2: type = converted %float.make_type.loc32_57, %.loc32_57.1 [template = f64]
- // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0
- // CHECK:STDOUT: %.loc32_33.1: type = splice_block %.loc32_33.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc32_33: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc32_33: init type = call constants.%Float(%int_64.loc32_33) [template = f64]
- // CHECK:STDOUT: %.loc32_33.2: type = value_of_initializer %float.make_type.loc32_33 [template = f64]
- // CHECK:STDOUT: %.loc32_33.3: type = converted %float.make_type.loc32_33, %.loc32_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: %.loc32_41.1: type = splice_block %.loc32_41.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc32_41: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc32_41: init type = call constants.%Float(%int_64.loc32_41) [template = f64]
- // CHECK:STDOUT: %.loc32_41.2: type = value_of_initializer %float.make_type.loc32_41 [template = f64]
- // CHECK:STDOUT: %.loc32_41.3: type = converted %float.make_type.loc32_41, %.loc32_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: %.loc32_49.1: type = splice_block %.loc32_49.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc32_49: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc32_49: init type = call constants.%Float(%int_64.loc32_49) [template = f64]
- // CHECK:STDOUT: %.loc32_49.2: type = value_of_initializer %float.make_type.loc32_49 [template = f64]
- // CHECK:STDOUT: %.loc32_49.3: type = converted %float.make_type.loc32_49, %.loc32_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: %.loc43_55.1: type = value_of_initializer %bool.make_type [template = bool]
- // CHECK:STDOUT: %.loc43_55.2: type = converted %bool.make_type, %.loc43_55.1 [template = bool]
- // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0
- // CHECK:STDOUT: %.loc43_39.1: type = splice_block %.loc43_39.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc43_39: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc43_39: init type = call constants.%Float(%int_64.loc43_39) [template = f64]
- // CHECK:STDOUT: %.loc43_39.2: type = value_of_initializer %float.make_type.loc43_39 [template = f64]
- // CHECK:STDOUT: %.loc43_39.3: type = converted %float.make_type.loc43_39, %.loc43_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: %.loc43_47.1: type = splice_block %.loc43_47.3 [template = f64] {
- // CHECK:STDOUT: %int_64.loc43_47: Core.IntLiteral = int_value 64 [template = constants.%int_64]
- // CHECK:STDOUT: %float.make_type.loc43_47: init type = call constants.%Float(%int_64.loc43_47) [template = f64]
- // CHECK:STDOUT: %.loc43_47.2: type = value_of_initializer %float.make_type.loc43_47 [template = f64]
- // CHECK:STDOUT: %.loc43_47.3: type = converted %float.make_type.loc43_47, %.loc43_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() -> f64;
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @TooMany(%a.param_patt: f64, %b.param_patt: f64) -> f64;
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @BadReturnType(%a.param_patt: f64) -> bool;
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @JustRight(%a.param_patt: f64) -> f64 = "float.negate";
- // 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: return <error>
- // 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: return <error>
- // 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: return <error>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|