From f8e60a8ec1cdcfe6b795a94cbe999a424fb5b2ca Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 23 Dec 2024 17:54:30 -0500 Subject: [PATCH 01/13] Fix path to carbon binary in nightly builder (#4737) The path moved from ./bazel-bin/toolchain/install/run_carbon to ./bazel-bin/toolchain/carbon in 13502b7c8907b90bb045dc1512ca65. Part of issue https://github.com/carbon-language/carbon-lang/issues/4734 --- .github/workflows/nightly_release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly_release.yaml b/.github/workflows/nightly_release.yaml index 61eb10a52b76d..6c09b290dd6b1 100644 --- a/.github/workflows/nightly_release.yaml +++ b/.github/workflows/nightly_release.yaml @@ -88,11 +88,11 @@ jobs: - name: Extract the release version run: | # Make sure we can run the toolchain to get the version. - ./bazel-bin/toolchain/install/run_carbon version + ./bazel-bin/toolchain/carbon version # Now stash it in a variable and export it. VERSION=$( \ - ./bazel-bin/toolchain/install/run_carbon version \ + ./bazel-bin/toolchain/carbon version \ | cut -d' ' -f5 | cut -d'+' -f1) echo "release_version=$VERSION" >> $GITHUB_ENV From 1a5107efa4fd01a6dc015507cea3f02a091ffeac Mon Sep 17 00:00:00 2001 From: josh11b <15258583+josh11b@users.noreply.github.com> Date: Mon, 23 Dec 2024 15:05:12 -0800 Subject: [PATCH 02/13] Clarify the logic for invalid impl redeclarations (#4738) Follow up to #4179, specifically re: https://github.com/carbon-language/carbon-lang/pull/4719#discussion_r1894364691 . Co-authored-by: Josh L --- toolchain/check/handle_impl.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/toolchain/check/handle_impl.cpp b/toolchain/check/handle_impl.cpp index 9d257526a8c9b..20e6d0afe93ce 100644 --- a/toolchain/check/handle_impl.cpp +++ b/toolchain/check/handle_impl.cpp @@ -326,13 +326,16 @@ static auto BuildImplDecl(Context& context, Parse::AnyImplDeclId node_id, {.self_id = self_inst_id, .constraint_id = constraint_inst_id}}; // Add the impl declaration. - bool valid_redeclaration = true; + bool invalid_redeclaration = false; auto lookup_bucket_ref = context.impls().GetOrAddLookupBucket(impl_info); for (auto prev_impl_id : lookup_bucket_ref) { if (MergeImplRedecl(context, impl_info, prev_impl_id)) { - valid_redeclaration = IsValidImplRedecl(context, impl_info, prev_impl_id); - if (valid_redeclaration) { + if (IsValidImplRedecl(context, impl_info, prev_impl_id)) { impl_decl.impl_id = prev_impl_id; + } else { + // IsValidImplRedecl() has issued a diagnostic, avoid generating more + // diagnostics for this declaration. + invalid_redeclaration = true; } break; } @@ -369,8 +372,9 @@ static auto BuildImplDecl(Context& context, Parse::AnyImplDeclId node_id, constraint_type_id); } - // Impl definitions are required in the same file as the declaration. - if (!is_definition && valid_redeclaration) { + // Impl definitions are required in the same file as the declaration. We skip + // this requirement if we've already issued an invalid redeclaration error. + if (!is_definition && !invalid_redeclaration) { context.definitions_required().push_back(impl_decl_id); } From 9290ee2bcf5f1a1454e2d201fe6809e749c5052d Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 25 Dec 2024 19:36:33 -0500 Subject: [PATCH 03/13] Use unsigned arithmetic builtins for UInt(N) operations (#4740) We were mistakenly using the signed builtins, which produce the same lowering for add/multiply right now, but don't for division and modulus. When manually flipping SignedOverflowIsUB on, the signed version of add gains the nsw (no signed wrap) flag, while the unsigned version (correctly after this change) does not: ``` // CHECK:STDOUT: define i32 @_Cadd_i32.Main(i32 %a, i32 %b) !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %int.sadd = add nsw i32 %a, %b, !dbg !7 // CHECK:STDOUT: ret i32 %int.sadd, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @_Cadd_u32.Main(i32 %a, i32 %b) !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %int.uadd = add i32 %a, %b, !dbg !10 // CHECK:STDOUT: ret i32 %int.uadd, !dbg !11 // CHECK:STDOUT: } ``` --- core/prelude/types/uint.carbon | 10 +- .../testdata/operators/arithmetic.carbon | 174 ++++++++++++++++++ 2 files changed, 179 insertions(+), 5 deletions(-) create mode 100644 toolchain/lower/testdata/operators/arithmetic.carbon diff --git a/core/prelude/types/uint.carbon b/core/prelude/types/uint.carbon index ef4461cb94130..1894ba1aa2973 100644 --- a/core/prelude/types/uint.carbon +++ b/core/prelude/types/uint.carbon @@ -50,19 +50,19 @@ impl forall [N:! IntLiteral()] UInt(N) as Ordered { // Arithmetic. impl forall [N:! IntLiteral()] UInt(N) as Add { - fn Op[self: Self](other: Self) -> Self = "int.sadd"; + fn Op[self: Self](other: Self) -> Self = "int.uadd"; } impl forall [N:! IntLiteral()] UInt(N) as Div { - fn Op[self: Self](other: Self) -> Self = "int.sdiv"; + fn Op[self: Self](other: Self) -> Self = "int.udiv"; } impl forall [N:! IntLiteral()] UInt(N) as Mod { - fn Op[self: Self](other: Self) -> Self = "int.smod"; + fn Op[self: Self](other: Self) -> Self = "int.umod"; } impl forall [N:! IntLiteral()] UInt(N) as Mul { - fn Op[self: Self](other: Self) -> Self = "int.smul"; + fn Op[self: Self](other: Self) -> Self = "int.umul"; } impl forall [N:! IntLiteral()] UInt(N) as Negate { @@ -70,7 +70,7 @@ impl forall [N:! IntLiteral()] UInt(N) as Negate { } impl forall [N:! IntLiteral()] UInt(N) as Sub { - fn Op[self: Self](other: Self) -> Self = "int.ssub"; + fn Op[self: Self](other: Self) -> Self = "int.usub"; } // Bitwise operators. diff --git a/toolchain/lower/testdata/operators/arithmetic.carbon b/toolchain/lower/testdata/operators/arithmetic.carbon new file mode 100644 index 0000000000000..814cbc02f186c --- /dev/null +++ b/toolchain/lower/testdata/operators/arithmetic.carbon @@ -0,0 +1,174 @@ +// 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/lower/testdata/operators/arithmetic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/operators/arithmetic.carbon + +// Test each of the arithmetic operations, signed and unsigned values may lower +// differently. + +fn add_i32(a: i32, b: i32) -> i32 { return a + b; } +fn add_u32(a: u32, b: u32) -> u32 { return a + b; } + +fn div_i32(a: i32, b: i32) -> i32 { return a / b; } +fn div_u32(a: u32, b: u32) -> u32 { return a / b; } + +fn mod_i32(a: i32, b: i32) -> i32 { return a % b; } +fn mod_u32(a: u32, b: u32) -> u32 { return a % b; } + +fn mul_i32(a: i32, b: i32) -> i32 { return a * b; } +fn mul_u32(a: u32, b: u32) -> u32 { return a * b; } + +fn neg_i32(a: i32) -> i32 { return -a; } +fn neg_u32(a: u32) -> u32 { return -a; } + +fn sub_i32(a: i32, b: i32) -> i32 { return a - b; } +fn sub_u32(a: u32, b: u32) -> u32 { return a - b; } + +// One test for non-32 bit, verify the size is correct. + +fn div_i16(a: i16, b: i16) -> i16 { return a / b; } +fn div_u16(a: u16, b: u16) -> u16 { return a / b; } + +// CHECK:STDOUT: ; ModuleID = 'arithmetic.carbon' +// CHECK:STDOUT: source_filename = "arithmetic.carbon" +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_Cadd_i32.Main(i32 %a, i32 %b) !dbg !4 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.sadd = add i32 %a, %b, !dbg !7 +// CHECK:STDOUT: ret i32 %int.sadd, !dbg !8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_Cadd_u32.Main(i32 %a, i32 %b) !dbg !9 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.uadd = add i32 %a, %b, !dbg !10 +// CHECK:STDOUT: ret i32 %int.uadd, !dbg !11 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_Cdiv_i32.Main(i32 %a, i32 %b) !dbg !12 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.sdiv = sdiv i32 %a, %b, !dbg !13 +// CHECK:STDOUT: ret i32 %int.sdiv, !dbg !14 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_Cdiv_u32.Main(i32 %a, i32 %b) !dbg !15 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.udiv = udiv i32 %a, %b, !dbg !16 +// CHECK:STDOUT: ret i32 %int.udiv, !dbg !17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_Cmod_i32.Main(i32 %a, i32 %b) !dbg !18 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.smod = srem i32 %a, %b, !dbg !19 +// CHECK:STDOUT: ret i32 %int.smod, !dbg !20 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_Cmod_u32.Main(i32 %a, i32 %b) !dbg !21 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.umod = urem i32 %a, %b, !dbg !22 +// CHECK:STDOUT: ret i32 %int.umod, !dbg !23 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_Cmul_i32.Main(i32 %a, i32 %b) !dbg !24 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.smul = mul i32 %a, %b, !dbg !25 +// CHECK:STDOUT: ret i32 %int.smul, !dbg !26 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_Cmul_u32.Main(i32 %a, i32 %b) !dbg !27 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.umul = mul i32 %a, %b, !dbg !28 +// CHECK:STDOUT: ret i32 %int.umul, !dbg !29 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_Cneg_i32.Main(i32 %a) !dbg !30 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.snegate = sub i32 0, %a, !dbg !31 +// CHECK:STDOUT: ret i32 %int.snegate, !dbg !32 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_Cneg_u32.Main(i32 %a) !dbg !33 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.snegate = sub i32 0, %a, !dbg !34 +// CHECK:STDOUT: ret i32 %int.snegate, !dbg !35 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_Csub_i32.Main(i32 %a, i32 %b) !dbg !36 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.ssub = sub i32 %a, %b, !dbg !37 +// CHECK:STDOUT: ret i32 %int.ssub, !dbg !38 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_Csub_u32.Main(i32 %a, i32 %b) !dbg !39 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.usub = sub i32 %a, %b, !dbg !40 +// CHECK:STDOUT: ret i32 %int.usub, !dbg !41 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i16 @_Cdiv_i16.Main(i16 %a, i16 %b) !dbg !42 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.sdiv = sdiv i16 %a, %b, !dbg !43 +// CHECK:STDOUT: ret i16 %int.sdiv, !dbg !44 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i16 @_Cdiv_u16.Main(i16 %a, i16 %b) !dbg !45 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.udiv = udiv i16 %a, %b, !dbg !46 +// CHECK:STDOUT: ret i16 %int.udiv, !dbg !47 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: !llvm.module.flags = !{!0, !1} +// CHECK:STDOUT: !llvm.dbg.cu = !{!2} +// CHECK:STDOUT: +// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} +// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} +// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +// CHECK:STDOUT: !3 = !DIFile(filename: "arithmetic.carbon", directory: "") +// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "add_i32", linkageName: "_Cadd_i32.Main", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !5 = !DISubroutineType(types: !6) +// CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 44, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 14, column: 37, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "add_u32", linkageName: "_Cadd_u32.Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 15, column: 44, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 37, scope: !9) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "div_i32", linkageName: "_Cdiv_i32.Main", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 17, column: 44, scope: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 17, column: 37, scope: !12) +// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "div_u32", linkageName: "_Cdiv_u32.Main", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !16 = !DILocation(line: 18, column: 44, scope: !15) +// CHECK:STDOUT: !17 = !DILocation(line: 18, column: 37, scope: !15) +// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "mod_i32", linkageName: "_Cmod_i32.Main", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !19 = !DILocation(line: 20, column: 44, scope: !18) +// CHECK:STDOUT: !20 = !DILocation(line: 20, column: 37, scope: !18) +// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "mod_u32", linkageName: "_Cmod_u32.Main", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !22 = !DILocation(line: 21, column: 44, scope: !21) +// CHECK:STDOUT: !23 = !DILocation(line: 21, column: 37, scope: !21) +// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "mul_i32", linkageName: "_Cmul_i32.Main", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !25 = !DILocation(line: 23, column: 44, scope: !24) +// CHECK:STDOUT: !26 = !DILocation(line: 23, column: 37, scope: !24) +// CHECK:STDOUT: !27 = distinct !DISubprogram(name: "mul_u32", linkageName: "_Cmul_u32.Main", scope: null, file: !3, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !28 = !DILocation(line: 24, column: 44, scope: !27) +// CHECK:STDOUT: !29 = !DILocation(line: 24, column: 37, scope: !27) +// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "neg_i32", linkageName: "_Cneg_i32.Main", scope: null, file: !3, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !31 = !DILocation(line: 26, column: 36, scope: !30) +// CHECK:STDOUT: !32 = !DILocation(line: 26, column: 29, scope: !30) +// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "neg_u32", linkageName: "_Cneg_u32.Main", scope: null, file: !3, line: 27, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !34 = !DILocation(line: 27, column: 36, scope: !33) +// CHECK:STDOUT: !35 = !DILocation(line: 27, column: 29, scope: !33) +// CHECK:STDOUT: !36 = distinct !DISubprogram(name: "sub_i32", linkageName: "_Csub_i32.Main", scope: null, file: !3, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !37 = !DILocation(line: 29, column: 44, scope: !36) +// CHECK:STDOUT: !38 = !DILocation(line: 29, column: 37, scope: !36) +// CHECK:STDOUT: !39 = distinct !DISubprogram(name: "sub_u32", linkageName: "_Csub_u32.Main", scope: null, file: !3, line: 30, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !40 = !DILocation(line: 30, column: 44, scope: !39) +// CHECK:STDOUT: !41 = !DILocation(line: 30, column: 37, scope: !39) +// CHECK:STDOUT: !42 = distinct !DISubprogram(name: "div_i16", linkageName: "_Cdiv_i16.Main", scope: null, file: !3, line: 34, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !43 = !DILocation(line: 34, column: 44, scope: !42) +// CHECK:STDOUT: !44 = !DILocation(line: 34, column: 37, scope: !42) +// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "div_u16", linkageName: "_Cdiv_u16.Main", scope: null, file: !3, line: 35, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !46 = !DILocation(line: 35, column: 44, scope: !45) +// CHECK:STDOUT: !47 = !DILocation(line: 35, column: 37, scope: !45) From 724fc7623ef483a2c67e73e74d7a2460470d0b5a Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 25 Dec 2024 19:37:42 -0500 Subject: [PATCH 04/13] Fix the forty_two.carbon example in getting started (#4736) The Core.Print function has moved into the "io" library, so it needs to be imported into scope. Part of issue #4734 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5795b9f383827..22e789e5be944 100644 --- a/README.md +++ b/README.md @@ -291,7 +291,7 @@ wget https://github.com/carbon-language/carbon-lang/releases/download/v${VERSION tar -xvf carbon_toolchain-${VERSION}.tar.gz # Create a simple Carbon source file: -echo "fn Run() { Core.Print(42); }" > forty_two.carbon +echo "import Core library \"io\"; fn Run() { Core.Print(42); }" > forty_two.carbon # Compile to an object file: ./carbon_toolchain-${VERSION}/bin/carbon compile \ From 7d8d59cb7e4effe59faa78c9a509a719a4c7407b Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 26 Dec 2024 14:07:47 -0800 Subject: [PATCH 05/13] Make snegate / unegate overflow handling consistent with other builtins. (#4744) Make `int.snegate` ignore the signedness of its operand and unconditionally check for signed overflow like all the other `int.s*` builtins do. Fix the prelude implementation of unary `-` for `Core.UInt` to use `int.unegate` instead of `int.snegate`. Fix the test for unsigned negate to actually test negating unsigned integers, and add some tests that unary `-` also works. --- core/prelude/types/uint.carbon | 2 +- toolchain/check/eval.cpp | 2 +- .../testdata/builtins/int/unegate.carbon | 737 +++++++++++------- .../testdata/operators/arithmetic.carbon | 4 +- 4 files changed, 469 insertions(+), 276 deletions(-) diff --git a/core/prelude/types/uint.carbon b/core/prelude/types/uint.carbon index 1894ba1aa2973..8a706e47ccb99 100644 --- a/core/prelude/types/uint.carbon +++ b/core/prelude/types/uint.carbon @@ -66,7 +66,7 @@ impl forall [N:! IntLiteral()] UInt(N) as Mul { } impl forall [N:! IntLiteral()] UInt(N) as Negate { - fn Op[self: Self]() -> Self = "int.snegate"; + fn Op[self: Self]() -> Self = "int.unegate"; } impl forall [N:! IntLiteral()] UInt(N) as Sub { diff --git a/toolchain/check/eval.cpp b/toolchain/check/eval.cpp index 87c680b54e324..bc118f8c19c80 100644 --- a/toolchain/check/eval.cpp +++ b/toolchain/check/eval.cpp @@ -783,7 +783,7 @@ static auto PerformBuiltinUnaryIntOp(Context& context, SemIRLoc loc, switch (builtin_kind) { case SemIR::BuiltinFunctionKind::IntSNegate: - if (is_signed && op_val.isMinSignedValue()) { + if (op_val.isMinSignedValue()) { CARBON_DIAGNOSTIC(CompileTimeIntegerNegateOverflow, Error, "integer overflow in negation of {0}", TypedInt); context.emitter().Emit(loc, CompileTimeIntegerNegateOverflow, diff --git a/toolchain/check/testdata/builtins/int/unegate.carbon b/toolchain/check/testdata/builtins/int/unegate.carbon index 992d31025089b..2575e374f3657 100644 --- a/toolchain/check/testdata/builtins/int/unegate.carbon +++ b/toolchain/check/testdata/builtins/int/unegate.carbon @@ -10,14 +10,14 @@ // --- int_negate.carbon -fn Negate(a: i32) -> i32 = "int.unegate"; +fn Negate(a: u32) -> u32 = "int.unegate"; -var arr: [i32; Negate(Negate(123))]; -let arr_p: [i32; 123]* = &arr; +var arr: [u32; Negate(Negate(123))]; +let arr_p: [u32; 123]* = &arr; -let n: i32 = Negate(1); +let n: u32 = Negate(1); -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCall(a: u32, b: u32) -> u32 { return Negate(a); } @@ -26,75 +26,75 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { package FailBadDecl; // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooFew() -> i32 = "int.unegate"; +// CHECK:STDERR: fn TooFew() -> u32 = "int.unegate"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: -fn TooFew() -> i32 = "int.unegate"; +fn TooFew() -> u32 = "int.unegate"; // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature] -// CHECK:STDERR: fn TooMany(a: i32, b: i32) -> i32 = "int.unegate"; +// CHECK:STDERR: fn TooMany(a: u32, b: u32) -> u32 = "int.unegate"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: -fn TooMany(a: i32, b: i32) -> i32 = "int.unegate"; +fn TooMany(a: u32, b: u32) -> u32 = "int.unegate"; // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature] -// CHECK:STDERR: fn BadReturnType(a: i32) -> bool = "int.unegate"; +// CHECK:STDERR: fn BadReturnType(a: u32) -> bool = "int.unegate"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: -fn BadReturnType(a: i32) -> bool = "int.unegate"; -fn JustRight(a: i32) -> i32 = "int.unegate"; +fn BadReturnType(a: u32) -> bool = "int.unegate"; +fn JustRight(a: u32) -> u32 = "int.unegate"; // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: var too_few: [i32; TooFew()]; +// CHECK:STDERR: var too_few: [u32; TooFew()]; // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: -var too_few: [i32; TooFew()]; +var too_few: [u32; TooFew()]; // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: var too_many: [i32; TooMany(1, 2)]; +// CHECK:STDERR: var too_many: [u32; TooMany(1, 2)]; // CHECK:STDERR: ^~~~~~~~~~~~~ // CHECK:STDERR: -var too_many: [i32; TooMany(1, 2)]; +var too_many: [u32; TooMany(1, 2)]; // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: error: array bound is not a constant [InvalidArrayExpr] -// CHECK:STDERR: var bad_return_type: [i32; BadReturnType(1)]; +// CHECK:STDERR: var bad_return_type: [u32; BadReturnType(1)]; // CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: -var bad_return_type: [i32; BadReturnType(1)]; +var bad_return_type: [u32; BadReturnType(1)]; // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:21: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch] -// CHECK:STDERR: var bad_call: [i32; JustRight(1, 2)]; +// CHECK:STDERR: var bad_call: [u32; JustRight(1, 2)]; // CHECK:STDERR: ^~~~~~~~~~~~~~~ // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: note: calling function declared here [InCallToEntity] -// CHECK:STDERR: fn JustRight(a: i32) -> i32 = "int.unegate"; +// CHECK:STDERR: fn JustRight(a: u32) -> u32 = "int.unegate"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: -var bad_call: [i32; JustRight(1, 2)]; +var bad_call: [u32; JustRight(1, 2)]; -fn RuntimeCallTooFew(a: i32) -> i32 { +fn RuntimeCallTooFew(a: u32) -> u32 { // 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-42]]:1: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn TooFew() -> i32 = "int.unegate"; + // CHECK:STDERR: fn TooFew() -> u32 = "int.unegate"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: return TooFew(a); } -fn RuntimeCallTooMany(a: i32, b: i32, c: i32) -> i32 { +fn RuntimeCallTooMany(a: u32, b: u32, c: u32) -> u32 { // 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-48]]:1: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn TooMany(a: i32, b: i32) -> i32 = "int.unegate"; + // CHECK:STDERR: fn TooMany(a: u32, b: u32) -> u32 = "int.unegate"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: return TooMany(a, b, c); } -fn RuntimeCallBadReturnType(a: i32, b: i32) -> bool { +fn RuntimeCallBadReturnType(a: u32, b: u32) -> bool { // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+6]]: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-54]]:1: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fn BadReturnType(a: i32) -> bool = "int.unegate"; + // CHECK:STDERR: fn BadReturnType(a: u32) -> bool = "int.unegate"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return BadReturnType(a, b); } @@ -103,41 +103,47 @@ fn RuntimeCallBadReturnType(a: i32, b: i32) -> bool { package Overflow; -fn Negate(a: i32) -> i32 = "int.unegate"; -fn Sub(a: i32, b: i32) -> i32 = "int.usub"; +fn Negate(a: u32) -> u32 = "int.unegate"; -// -(-INT_MAX) is INT_MAX. -let a: i32 = Negate(Negate(0x7FFFFFFF)); +class Expect(N:! u32) {} +fn Test(N:! u32) -> Expect(N) { return {}; } + +fn F() { + // -(-INT_MAX) is INT_MAX. + Test(Negate(Negate(0x7FFF_FFFF))) as Expect(0x7FFF_FFFF); + Test(-(Negate(0x7FFF_FFFF))) as Expect(0x7FFF_FFFF); + // -(-(INT_MAX + 1)) is `INT_MAX + 1`. + Test(Negate(Negate(0x8000_0000))) as Expect(0x8000_0000); + Test(-(Negate(0x8000_0000))) as Expect(0x8000_0000); +} -// -(-INT_MAX - 1) wraps around to INT_MIN. -let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: --- int_negate.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] +// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [template] // CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] // CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] // CHECK:STDOUT: %int_123.1: Core.IntLiteral = int_value 123 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%u32) [template] // CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] // CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %array_type: type = array_type %int_123.1, %i32 [template] +// CHECK:STDOUT: %array_type: type = array_type %int_123.1, %u32 [template] // CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] // CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: %Convert.bound.3: = bound_method %int_1.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template] +// CHECK:STDOUT: %int_1.2: %u32 = int_value 1 [template] +// CHECK:STDOUT: %int_4294967295: %u32 = int_value 4294967295 [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 +// CHECK:STDOUT: .UInt = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... @@ -155,60 +161,60 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %int_32.loc2_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2: type = splice_block %i32.loc2_14 [template = constants.%i32] { +// CHECK:STDOUT: %u32.loc2_22: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 +// CHECK:STDOUT: %.loc2: type = splice_block %u32.loc2_14 [template = constants.%u32] { // CHECK:STDOUT: %int_32.loc2_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %u32.loc2_14: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param +// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %arr.var: ref %array_type = var arr // CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %u32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %u32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { // CHECK:STDOUT: %int_32.loc9_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc9_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc9_19: type = splice_block %i32.loc9_19 [template = constants.%i32] { +// CHECK:STDOUT: %u32.loc9_35: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 +// CHECK:STDOUT: %.loc9_19: type = splice_block %u32.loc9_19 [template = constants.%u32] { // CHECK:STDOUT: %int_32.loc9_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc9_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %u32.loc9_19: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc9_27: type = splice_block %i32.loc9_27 [template = constants.%i32] { +// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %u32 = value_param runtime_param1 +// CHECK:STDOUT: %.loc9_27: type = splice_block %u32.loc9_27 [template = constants.%u32] { // CHECK:STDOUT: %int_32.loc9_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc9_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %u32.loc9_27: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] // CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: %b: %u32 = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param2 +// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.unegate"; +// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %u32) -> %u32 = "int.unegate"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { +// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %u32, %b.param_patt: %u32) -> %u32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Negate.ref: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %int.unegate: init %i32 = call %Negate.ref(%a.ref) -// CHECK:STDOUT: %.loc10_19.1: %i32 = value_of_initializer %int.unegate -// CHECK:STDOUT: %.loc10_19.2: %i32 = converted %int.unegate, %.loc10_19.1 +// CHECK:STDOUT: %a.ref: %u32 = name_ref a, %a +// CHECK:STDOUT: %int.unegate: init %u32 = call %Negate.ref(%a.ref) +// CHECK:STDOUT: %.loc10_19.1: %u32 = value_of_initializer %int.unegate +// CHECK:STDOUT: %.loc10_19.2: %u32 = converted %int.unegate, %.loc10_19.1 // CHECK:STDOUT: return %.loc10_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -222,13 +228,13 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %impl.elem0: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] // CHECK:STDOUT: %Convert.bound: = bound_method %int_1, %impl.elem0 [template = constants.%Convert.bound.3] // CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked: init %i32 = call %Convert.specific_fn(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc7_21.1: %i32 = value_of_initializer %int.convert_checked [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc7_21.2: %i32 = converted %int_1, %.loc7_21.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.unegate: init %i32 = call %Negate.ref(%.loc7_21.2) [template = constants.%int_-1] -// CHECK:STDOUT: %.loc7_23.1: %i32 = value_of_initializer %int.unegate [template = constants.%int_-1] -// CHECK:STDOUT: %.loc7_23.2: %i32 = converted %int.unegate, %.loc7_23.1 [template = constants.%int_-1] -// CHECK:STDOUT: %n: %i32 = bind_name n, %.loc7_23.2 +// CHECK:STDOUT: %int.convert_checked: init %u32 = call %Convert.specific_fn(%int_1) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc7_21.1: %u32 = value_of_initializer %int.convert_checked [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc7_21.2: %u32 = converted %int_1, %.loc7_21.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.unegate: init %u32 = call %Negate.ref(%.loc7_21.2) [template = constants.%int_4294967295] +// CHECK:STDOUT: %.loc7_23.1: %u32 = value_of_initializer %int.unegate [template = constants.%int_4294967295] +// CHECK:STDOUT: %.loc7_23.2: %u32 = converted %int.unegate, %.loc7_23.1 [template = constants.%int_4294967295] +// CHECK:STDOUT: %n: %u32 = bind_name n, %.loc7_23.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -236,7 +242,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] +// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [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] @@ -257,7 +263,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 +// CHECK:STDOUT: .UInt = %import_ref.1 // CHECK:STDOUT: .Bool = %import_ref.5 // CHECK:STDOUT: .ImplicitAs = %import_ref.6 // CHECK:STDOUT: import Core//prelude @@ -282,73 +288,73 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %TooFew.decl: %TooFew.type = fn_decl @TooFew [template = constants.%TooFew] { -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param0 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param0 +// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %TooMany.decl: %TooMany.type = fn_decl @TooMany [template = constants.%TooMany] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %u32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %u32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { // CHECK:STDOUT: %int_32.loc13_31: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc13_31: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc13_15: type = splice_block %i32.loc13_15 [template = constants.%i32] { +// CHECK:STDOUT: %u32.loc13_31: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 +// CHECK:STDOUT: %.loc13_15: type = splice_block %u32.loc13_15 [template = constants.%u32] { // CHECK:STDOUT: %int_32.loc13_15: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc13_15: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %u32.loc13_15: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc13_23: type = splice_block %i32.loc13_23 [template = constants.%i32] { +// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %u32 = value_param runtime_param1 +// CHECK:STDOUT: %.loc13_23: type = splice_block %u32.loc13_23 [template = constants.%u32] { // CHECK:STDOUT: %int_32.loc13_23: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc13_23: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %u32.loc13_23: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] // CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: %b: %u32 = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param2 +// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %BadReturnType.decl: %BadReturnType.type = fn_decl @BadReturnType [template = constants.%BadReturnType] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %u32 = 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: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc18_21: type = splice_block %i32 [template = constants.%i32] { +// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 +// CHECK:STDOUT: %.loc18_21: type = splice_block %u32 [template = constants.%u32] { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: %a: %u32 = 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: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %int_32.loc19_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc19_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc19: type = splice_block %i32.loc19_17 [template = constants.%i32] { +// CHECK:STDOUT: %u32.loc19_25: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 +// CHECK:STDOUT: %.loc19: type = splice_block %u32.loc19_17 [template = constants.%u32] { // CHECK:STDOUT: %int_32.loc19_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc19_17: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %u32.loc19_17: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param +// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %too_few.var: ref = var too_few // CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var @@ -359,112 +365,112 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %bad_call.var: ref = var bad_call // CHECK:STDOUT: %bad_call: ref = bind_name bad_call, %bad_call.var // CHECK:STDOUT: %RuntimeCallTooFew.decl: %RuntimeCallTooFew.type = fn_decl @RuntimeCallTooFew [template = constants.%RuntimeCallTooFew] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %int_32.loc46_33: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc46_33: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc46: type = splice_block %i32.loc46_25 [template = constants.%i32] { +// CHECK:STDOUT: %u32.loc46_33: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 +// CHECK:STDOUT: %.loc46: type = splice_block %u32.loc46_25 [template = constants.%u32] { // CHECK:STDOUT: %int_32.loc46_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc46_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %u32.loc46_25: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param +// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %RuntimeCallTooMany.decl: %RuntimeCallTooMany.type = fn_decl @RuntimeCallTooMany [template = constants.%RuntimeCallTooMany] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %c.patt: %i32 = binding_pattern c -// CHECK:STDOUT: %c.param_patt: %i32 = value_param_pattern %c.patt, runtime_param2 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param3 +// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %u32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %u32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %c.patt: %u32 = binding_pattern c +// CHECK:STDOUT: %c.param_patt: %u32 = value_param_pattern %c.patt, runtime_param2 +// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param3 // CHECK:STDOUT: } { // CHECK:STDOUT: %int_32.loc57_50: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc57_50: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc57_26: type = splice_block %i32.loc57_26 [template = constants.%i32] { +// CHECK:STDOUT: %u32.loc57_50: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 +// CHECK:STDOUT: %.loc57_26: type = splice_block %u32.loc57_26 [template = constants.%u32] { // CHECK:STDOUT: %int_32.loc57_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc57_26: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %u32.loc57_26: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc57_34: type = splice_block %i32.loc57_34 [template = constants.%i32] { +// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %u32 = value_param runtime_param1 +// CHECK:STDOUT: %.loc57_34: type = splice_block %u32.loc57_34 [template = constants.%u32] { // CHECK:STDOUT: %int_32.loc57_34: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc57_34: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %u32.loc57_34: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] // CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %c.param: %i32 = value_param runtime_param2 -// CHECK:STDOUT: %.loc57_42: type = splice_block %i32.loc57_42 [template = constants.%i32] { +// CHECK:STDOUT: %b: %u32 = bind_name b, %b.param +// CHECK:STDOUT: %c.param: %u32 = value_param runtime_param2 +// CHECK:STDOUT: %.loc57_42: type = splice_block %u32.loc57_42 [template = constants.%u32] { // CHECK:STDOUT: %int_32.loc57_42: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc57_42: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %u32.loc57_42: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] // CHECK:STDOUT: } -// CHECK:STDOUT: %c: %i32 = bind_name c, %c.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param3 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: %c: %u32 = bind_name c, %c.param +// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param3 +// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %RuntimeCallBadReturnType.decl: %RuntimeCallBadReturnType.type = fn_decl @RuntimeCallBadReturnType [template = constants.%RuntimeCallBadReturnType] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %u32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %u32 = 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: %.loc68_48.1: type = value_of_initializer %bool.make_type [template = bool] // CHECK:STDOUT: %.loc68_48.2: type = converted %bool.make_type, %.loc68_48.1 [template = bool] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc68_32: type = splice_block %i32.loc68_32 [template = constants.%i32] { +// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 +// CHECK:STDOUT: %.loc68_32: type = splice_block %u32.loc68_32 [template = constants.%u32] { // CHECK:STDOUT: %int_32.loc68_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc68_32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %u32.loc68_32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc68_40: type = splice_block %i32.loc68_40 [template = constants.%i32] { +// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %u32 = value_param runtime_param1 +// CHECK:STDOUT: %.loc68_40: type = splice_block %u32.loc68_40 [template = constants.%u32] { // CHECK:STDOUT: %int_32.loc68_40: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc68_40: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %u32.loc68_40: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] // CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: %b: %u32 = 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() -> %i32; +// CHECK:STDOUT: fn @TooFew() -> %u32; // CHECK:STDOUT: -// CHECK:STDOUT: fn @TooMany(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32; +// CHECK:STDOUT: fn @TooMany(%a.param_patt: %u32, %b.param_patt: %u32) -> %u32; // CHECK:STDOUT: -// CHECK:STDOUT: fn @BadReturnType(%a.param_patt: %i32) -> bool; +// CHECK:STDOUT: fn @BadReturnType(%a.param_patt: %u32) -> bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @JustRight(%a.param_patt: %i32) -> %i32 = "int.unegate"; +// CHECK:STDOUT: fn @JustRight(%a.param_patt: %u32) -> %u32 = "int.unegate"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooFew(%a.param_patt: %i32) -> %i32 { +// CHECK:STDOUT: fn @RuntimeCallTooFew(%a.param_patt: %u32) -> %u32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %TooFew.ref: %TooFew.type = name_ref TooFew, file.%TooFew.decl [template = constants.%TooFew] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a +// CHECK:STDOUT: %a.ref: %u32 = name_ref a, %a // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooMany(%a.param_patt: %i32, %b.param_patt: %i32, %c.param_patt: %i32) -> %i32 { +// CHECK:STDOUT: fn @RuntimeCallTooMany(%a.param_patt: %u32, %b.param_patt: %u32, %c.param_patt: %u32) -> %u32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %TooMany.ref: %TooMany.type = name_ref TooMany, file.%TooMany.decl [template = constants.%TooMany] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %c.ref: %i32 = name_ref c, %c +// CHECK:STDOUT: %a.ref: %u32 = name_ref a, %a +// CHECK:STDOUT: %b.ref: %u32 = name_ref b, %b +// CHECK:STDOUT: %c.ref: %u32 = name_ref c, %c // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a.param_patt: %i32, %b.param_patt: %i32) -> bool { +// CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a.param_patt: %u32, %b.param_patt: %u32) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %BadReturnType.ref: %BadReturnType.type = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%BadReturnType] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b +// CHECK:STDOUT: %a.ref: %u32 = name_ref a, %a +// CHECK:STDOUT: %b.ref: %u32 = name_ref b, %b // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -472,31 +478,56 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] +// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [template] // CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] // CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %Sub.type.1: type = fn_type @Sub.1 [template] -// CHECK:STDOUT: %Sub: %Sub.type.1 = struct_value () [template] +// CHECK:STDOUT: %N.2: %u32 = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt.2: %u32 = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N.2) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete.2: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%u32) [template] // CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] // CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] // CHECK:STDOUT: %Convert.bound.1: = bound_method %int_2147483647.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %int_-2147483647: %i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_1.1, %Convert.10 [template] +// CHECK:STDOUT: %int_2147483647.2: %u32 = int_value 2147483647 [template] +// CHECK:STDOUT: %int_2147483649: %u32 = int_value 2147483649 [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_2147483647.2) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%int_2147483647.2) [template] +// CHECK:STDOUT: %Op.type.13: type = fn_type @Op.13 [template] +// CHECK:STDOUT: %Op.type.14: type = fn_type @Op.5, @impl.11(%int_32) [template] +// CHECK:STDOUT: %Op.14: %Op.type.14 = struct_value () [template] +// CHECK:STDOUT: %interface.20: = interface_witness (%Op.14) [template] +// CHECK:STDOUT: %Op.bound.1: = bound_method %int_2147483649, %Op.14 [template] +// CHECK:STDOUT: %Op.specific_fn.1: = specific_function %Op.bound.1, @Op.5(%int_32) [template] +// CHECK:STDOUT: %int_2147483648.1: Core.IntLiteral = int_value 2147483648 [template] +// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2147483648.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %int_2147483648.2: %u32 = int_value 2147483648 [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_2147483648.2) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%int_2147483648.2) [template] +// CHECK:STDOUT: %Op.bound.2: = bound_method %int_2147483648.2, %Op.14 [template] +// CHECK:STDOUT: %Op.specific_fn.2: = specific_function %Op.bound.2, @Op.5(%int_32) [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 +// CHECK:STDOUT: .UInt = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 +// CHECK:STDOUT: .Negate = %import_ref.193 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -506,104 +537,266 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .Sub = %Sub.decl -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %int_32.loc4_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4: type = splice_block %i32.loc4_14 [template = constants.%i32] { +// CHECK:STDOUT: %u32.loc4_22: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 +// CHECK:STDOUT: %.loc4: type = splice_block %u32.loc4_14 [template = constants.%u32] { // CHECK:STDOUT: %int_32.loc4_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %u32.loc4_14: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param +// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param1 +// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.decl: %Sub.type.1 = fn_decl @Sub.1 [template = constants.%Sub] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %N.patt.loc6_14.1: %u32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: %u32 = value_param_pattern %N.patt.loc6_14.1, runtime_param [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.2)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc5_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc5_11: type = splice_block %i32.loc5_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc5_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %N.param: %u32 = value_param runtime_param +// CHECK:STDOUT: %.loc6: type = splice_block %u32 [template = constants.%u32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc5_19: type = splice_block %i32.loc5_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc5_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %N.loc6_14.1: %u32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_14.2 (constants.%N.2)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %N.patt.loc7_9.1: %u32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: %u32 = value_param_pattern %N.patt.loc7_9.1, runtime_param [symbolic = %N.patt.loc7_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_29.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_29.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %N.ref: %u32 = name_ref N, %N.loc7_9.1 [symbolic = %N.loc7_9.2 (constants.%N.2)] +// CHECK:STDOUT: %Expect.loc7_29.1: type = class_type @Expect, @Expect(constants.%N.2) [symbolic = %Expect.loc7_29.2 (constants.%Expect.1)] +// CHECK:STDOUT: %N.param: %u32 = value_param runtime_param +// CHECK:STDOUT: %.loc7_13: type = splice_block %u32 [template = constants.%u32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] // CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: %N.loc7_9.1: %u32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc7_9.2 (constants.%N.2)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_29.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_29.2 (%Expect.1) = return_slot %return.param // CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.unegate"; +// CHECK:STDOUT: generic class @Expect(%N.loc6_14.1: %u32) { +// CHECK:STDOUT: %N.loc6_14.2: %u32 = bind_symbolic_name N, 0 [symbolic = %N.loc6_14.2 (constants.%N.2)] +// CHECK:STDOUT: %N.patt.loc6_14.2: %u32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.2)] // CHECK:STDOUT: -// CHECK:STDOUT: fn @Sub.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.usub"; +// CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %u32) -> %u32 = "int.unegate"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%N.loc7_9.1: %u32) { +// CHECK:STDOUT: %N.loc7_9.2: %u32 = bind_symbolic_name N, 0 [symbolic = %N.loc7_9.2 (constants.%N.2)] +// CHECK:STDOUT: %N.patt.loc7_9.2: %u32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %Expect.loc7_29.2: type = class_type @Expect, @Expect(%N.loc7_9.2) [symbolic = %Expect.loc7_29.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_29.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete.2)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_29.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%N.param_patt: %u32) -> %return.param_patt: @Test.%Expect.loc7_29.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc7_41.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_41.2: init @Test.%Expect.loc7_29.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_42: init @Test.%Expect.loc7_29.2 (%Expect.1) = converted %.loc7_41.1, %.loc7_41.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_42 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Negate.ref.loc8_14: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %Negate.ref.loc8_21: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc8: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc8: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8: = bound_method %int_2147483647.loc8, %impl.elem0.loc8 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc8: = specific_function %Convert.bound.loc8, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc8: init %i32 = call %Convert.specific_fn.loc8(%int_2147483647.loc8) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_28.1: %i32 = value_of_initializer %int.convert_checked.loc8 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_28.2: %i32 = converted %int_2147483647.loc8, %.loc8_28.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.unegate.loc8_38: init %i32 = call %Negate.ref.loc8_21(%.loc8_28.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc8_38.1: %i32 = value_of_initializer %int.unegate.loc8_38 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc8_38.2: %i32 = converted %int.unegate.loc8_38, %.loc8_38.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int.unegate.loc8_39: init %i32 = call %Negate.ref.loc8_14(%.loc8_38.2) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_40.1: %i32 = value_of_initializer %int.unegate.loc8_39 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_40.2: %i32 = converted %int.unegate.loc8_39, %.loc8_40.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc8_40.2 -// CHECK:STDOUT: %Negate.ref.loc11_14: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %Sub.ref: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Negate.ref.loc11_25: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc11: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc11_32: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_32: = bound_method %int_2147483647.loc11, %impl.elem0.loc11_32 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc11_32: = specific_function %Convert.bound.loc11_32, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc11_32: init %i32 = call %Convert.specific_fn.loc11_32(%int_2147483647.loc11) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc11_32.1: %i32 = value_of_initializer %int.convert_checked.loc11_32 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc11_32.2: %i32 = converted %int_2147483647.loc11, %.loc11_32.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.unegate.loc11_42: init %i32 = call %Negate.ref.loc11_25(%.loc11_32.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc11_42.1: %i32 = value_of_initializer %int.unegate.loc11_42 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc11_42.2: %i32 = converted %int.unegate.loc11_42, %.loc11_42.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc11_45: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_45: = bound_method %int_1, %impl.elem0.loc11_45 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc11_45: = specific_function %Convert.bound.loc11_45, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc11_45: init %i32 = call %Convert.specific_fn.loc11_45(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc11_45.1: %i32 = value_of_initializer %int.convert_checked.loc11_45 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc11_45.2: %i32 = converted %int_1, %.loc11_45.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.usub: init %i32 = call %Sub.ref(%.loc11_42.2, %.loc11_45.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc11_46.1: %i32 = value_of_initializer %int.usub [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc11_46.2: %i32 = converted %int.usub, %.loc11_46.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %int.unegate.loc11_47: init %i32 = call %Negate.ref.loc11_14(%.loc11_46.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc11_48.1: %i32 = value_of_initializer %int.unegate.loc11_47 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc11_48.2: %i32 = converted %int.unegate.loc11_47, %.loc11_48.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc11_48.2 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Negate.ref.loc11_8: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] +// CHECK:STDOUT: %Negate.ref.loc11_15: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] +// CHECK:STDOUT: %int_2147483647.loc11_22: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %impl.elem0.loc11_22: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_22: = bound_method %int_2147483647.loc11_22, %impl.elem0.loc11_22 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_22: = specific_function %Convert.bound.loc11_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc11_22: init %u32 = call %Convert.specific_fn.loc11_22(%int_2147483647.loc11_22) [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc11_22.1: %u32 = value_of_initializer %int.convert_checked.loc11_22 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc11_22.2: %u32 = converted %int_2147483647.loc11_22, %.loc11_22.1 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %int.unegate.loc11_33: init %u32 = call %Negate.ref.loc11_15(%.loc11_22.2) [template = constants.%int_2147483649] +// CHECK:STDOUT: %.loc11_33.1: %u32 = value_of_initializer %int.unegate.loc11_33 [template = constants.%int_2147483649] +// CHECK:STDOUT: %.loc11_33.2: %u32 = converted %int.unegate.loc11_33, %.loc11_33.1 [template = constants.%int_2147483649] +// CHECK:STDOUT: %int.unegate.loc11_34: init %u32 = call %Negate.ref.loc11_8(%.loc11_33.2) [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc11_35.1: %u32 = value_of_initializer %int.unegate.loc11_34 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc11_35.2: %u32 = converted %int.unegate.loc11_34, %.loc11_35.1 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%int_2147483647.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc11_35.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.2 = call %Test.specific_fn.loc11() to %.loc11_35.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2147483647.loc11_47: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %impl.elem0.loc11_58: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_58: = bound_method %int_2147483647.loc11_47, %impl.elem0.loc11_58 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_58: = specific_function %Convert.bound.loc11_58, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc11_58: init %u32 = call %Convert.specific_fn.loc11_58(%int_2147483647.loc11_47) [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc11_58.1: %u32 = value_of_initializer %int.convert_checked.loc11_58 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc11_58.2: %u32 = converted %int_2147483647.loc11_47, %.loc11_58.1 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%int_2147483647.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc11_35.4: ref %Expect.2 = temporary %.loc11_35.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Negate.ref.loc12: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] +// CHECK:STDOUT: %int_2147483647.loc12_17: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %impl.elem0.loc12_17: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_17: = bound_method %int_2147483647.loc12_17, %impl.elem0.loc12_17 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc12_17: = specific_function %Convert.bound.loc12_17, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc12_17: init %u32 = call %Convert.specific_fn.loc12_17(%int_2147483647.loc12_17) [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc12_17.1: %u32 = value_of_initializer %int.convert_checked.loc12_17 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc12_17.2: %u32 = converted %int_2147483647.loc12_17, %.loc12_17.1 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %int.unegate.loc12_28: init %u32 = call %Negate.ref.loc12(%.loc12_17.2) [template = constants.%int_2147483649] +// CHECK:STDOUT: %impl.elem0.loc12_8: %Op.type.13 = interface_witness_access constants.%interface.20, element0 [template = constants.%Op.14] +// CHECK:STDOUT: %Op.bound.loc12: = bound_method %int.unegate.loc12_28, %impl.elem0.loc12_8 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %Op.specific_fn.loc12: = specific_function %Op.bound.loc12, @Op.5(constants.%int_32) [template = constants.%Op.specific_fn.1] +// CHECK:STDOUT: %.loc12_28.1: %u32 = value_of_initializer %int.unegate.loc12_28 [template = constants.%int_2147483649] +// CHECK:STDOUT: %.loc12_28.2: %u32 = converted %int.unegate.loc12_28, %.loc12_28.1 [template = constants.%int_2147483649] +// CHECK:STDOUT: %int.unegate.loc12_8: init %u32 = call %Op.specific_fn.loc12(%.loc12_28.2) [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc12_30.1: %u32 = value_of_initializer %int.unegate.loc12_8 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc12_30.2: %u32 = converted %int.unegate.loc12_8, %.loc12_30.1 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%int_2147483647.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc12_30.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.2 = call %Test.specific_fn.loc12() to %.loc12_30.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2147483647.loc12_42: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %impl.elem0.loc12_53: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_53: = bound_method %int_2147483647.loc12_42, %impl.elem0.loc12_53 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc12_53: = specific_function %Convert.bound.loc12_53, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc12_53: init %u32 = call %Convert.specific_fn.loc12_53(%int_2147483647.loc12_42) [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc12_53.1: %u32 = value_of_initializer %int.convert_checked.loc12_53 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc12_53.2: %u32 = converted %int_2147483647.loc12_42, %.loc12_53.1 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%int_2147483647.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc12_30.4: ref %Expect.2 = temporary %.loc12_30.3, %Test.call.loc12 +// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Negate.ref.loc14_8: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] +// CHECK:STDOUT: %Negate.ref.loc14_15: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] +// CHECK:STDOUT: %int_2147483648.loc14_22: Core.IntLiteral = int_value 2147483648 [template = constants.%int_2147483648.1] +// CHECK:STDOUT: %impl.elem0.loc14_22: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_22: = bound_method %int_2147483648.loc14_22, %impl.elem0.loc14_22 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc14_22: = specific_function %Convert.bound.loc14_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc14_22: init %u32 = call %Convert.specific_fn.loc14_22(%int_2147483648.loc14_22) [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %.loc14_22.1: %u32 = value_of_initializer %int.convert_checked.loc14_22 [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %.loc14_22.2: %u32 = converted %int_2147483648.loc14_22, %.loc14_22.1 [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %int.unegate.loc14_33: init %u32 = call %Negate.ref.loc14_15(%.loc14_22.2) [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %.loc14_33.1: %u32 = value_of_initializer %int.unegate.loc14_33 [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %.loc14_33.2: %u32 = converted %int.unegate.loc14_33, %.loc14_33.1 [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %int.unegate.loc14_34: init %u32 = call %Negate.ref.loc14_8(%.loc14_33.2) [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %.loc14_35.1: %u32 = value_of_initializer %int.unegate.loc14_34 [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %.loc14_35.2: %u32 = converted %int.unegate.loc14_34, %.loc14_35.1 [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%int_2147483648.2) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc14_35.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc14: init %Expect.3 = call %Test.specific_fn.loc14() to %.loc14_35.3 +// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2147483648.loc14_47: Core.IntLiteral = int_value 2147483648 [template = constants.%int_2147483648.1] +// CHECK:STDOUT: %impl.elem0.loc14_58: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_58: = bound_method %int_2147483648.loc14_47, %impl.elem0.loc14_58 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc14_58: = specific_function %Convert.bound.loc14_58, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc14_58: init %u32 = call %Convert.specific_fn.loc14_58(%int_2147483648.loc14_47) [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %.loc14_58.1: %u32 = value_of_initializer %int.convert_checked.loc14_58 [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %.loc14_58.2: %u32 = converted %int_2147483648.loc14_47, %.loc14_58.1 [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%int_2147483648.2) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc14_35.4: ref %Expect.3 = temporary %.loc14_35.3, %Test.call.loc14 +// CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Negate.ref.loc15: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] +// CHECK:STDOUT: %int_2147483648.loc15_17: Core.IntLiteral = int_value 2147483648 [template = constants.%int_2147483648.1] +// CHECK:STDOUT: %impl.elem0.loc15_17: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_17: = bound_method %int_2147483648.loc15_17, %impl.elem0.loc15_17 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc15_17: = specific_function %Convert.bound.loc15_17, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc15_17: init %u32 = call %Convert.specific_fn.loc15_17(%int_2147483648.loc15_17) [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %.loc15_17.1: %u32 = value_of_initializer %int.convert_checked.loc15_17 [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %.loc15_17.2: %u32 = converted %int_2147483648.loc15_17, %.loc15_17.1 [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %int.unegate.loc15_28: init %u32 = call %Negate.ref.loc15(%.loc15_17.2) [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %impl.elem0.loc15_8: %Op.type.13 = interface_witness_access constants.%interface.20, element0 [template = constants.%Op.14] +// CHECK:STDOUT: %Op.bound.loc15: = bound_method %int.unegate.loc15_28, %impl.elem0.loc15_8 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %Op.specific_fn.loc15: = specific_function %Op.bound.loc15, @Op.5(constants.%int_32) [template = constants.%Op.specific_fn.2] +// CHECK:STDOUT: %.loc15_28.1: %u32 = value_of_initializer %int.unegate.loc15_28 [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %.loc15_28.2: %u32 = converted %int.unegate.loc15_28, %.loc15_28.1 [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %int.unegate.loc15_8: init %u32 = call %Op.specific_fn.loc15(%.loc15_28.2) [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %.loc15_30.1: %u32 = value_of_initializer %int.unegate.loc15_8 [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %.loc15_30.2: %u32 = converted %int.unegate.loc15_8, %.loc15_30.1 [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %Test.specific_fn.loc15: = specific_function %Test.ref.loc15, @Test(constants.%int_2147483648.2) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc15_30.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc15: init %Expect.3 = call %Test.specific_fn.loc15() to %.loc15_30.3 +// CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2147483648.loc15_42: Core.IntLiteral = int_value 2147483648 [template = constants.%int_2147483648.1] +// CHECK:STDOUT: %impl.elem0.loc15_53: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_53: = bound_method %int_2147483648.loc15_42, %impl.elem0.loc15_53 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc15_53: = specific_function %Convert.bound.loc15_53, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc15_53: init %u32 = call %Convert.specific_fn.loc15_53(%int_2147483648.loc15_42) [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %.loc15_53.1: %u32 = value_of_initializer %int.convert_checked.loc15_53 [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %.loc15_53.2: %u32 = converted %int_2147483648.loc15_42, %.loc15_53.1 [template = constants.%int_2147483648.2] +// CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%int_2147483648.2) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc15_30.4: ref %Expect.3 = temporary %.loc15_30.3, %Test.call.loc15 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%N.2) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%N.2 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%N.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%N.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%N.2) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%N.2 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%N.2 +// CHECK:STDOUT: %Expect.loc7_29.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_2147483647.2) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_2147483647.2 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_2147483647.2 +// CHECK:STDOUT: %Expect.loc7_29.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_2147483647.2) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_2147483647.2 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_2147483647.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_2147483648.2) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_2147483648.2 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_2147483648.2 +// CHECK:STDOUT: %Expect.loc7_29.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_2147483648.2) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_2147483648.2 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_2147483648.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/lower/testdata/operators/arithmetic.carbon b/toolchain/lower/testdata/operators/arithmetic.carbon index 814cbc02f186c..709107c3094e1 100644 --- a/toolchain/lower/testdata/operators/arithmetic.carbon +++ b/toolchain/lower/testdata/operators/arithmetic.carbon @@ -93,8 +93,8 @@ fn div_u16(a: u16, b: u16) -> u16 { return a / b; } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @_Cneg_u32.Main(i32 %a) !dbg !33 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.snegate = sub i32 0, %a, !dbg !34 -// CHECK:STDOUT: ret i32 %int.snegate, !dbg !35 +// CHECK:STDOUT: %int.unegate = sub i32 0, %a, !dbg !34 +// CHECK:STDOUT: ret i32 %int.unegate, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @_Csub_i32.Main(i32 %a, i32 %b) !dbg !36 { From 89df77707b6009abbc7687ab7e990e72f0b552e9 Mon Sep 17 00:00:00 2001 From: josh11b <15258583+josh11b@users.noreply.github.com> Date: Fri, 27 Dec 2024 18:09:40 -0800 Subject: [PATCH 06/13] Drop references to deleted explorer fuzzer (#4745) Follow up to delete that happened in #4731 . Co-authored-by: Josh L --- explorer/BUILD | 7 ------- explorer/README.md | 5 ----- explorer/parse_and_execute/BUILD | 1 - explorer/syntax/BUILD | 1 - 4 files changed, 14 deletions(-) diff --git a/explorer/BUILD b/explorer/BUILD index 89aced90f7422..015e6f4808c26 100644 --- a/explorer/BUILD +++ b/explorer/BUILD @@ -94,13 +94,6 @@ file_test( ), ) -filegroup( - name = "carbon_files", - srcs = glob(["testdata/**/*.carbon"]), - # Files are used for validating fuzzer completeness. - visibility = ["//explorer/fuzzing:__pkg__"], -) - filegroup( name = "treesitter_testdata", srcs = glob( diff --git a/explorer/README.md b/explorer/README.md index 7e93519eccd64..536b910ad5cb1 100644 --- a/explorer/README.md +++ b/explorer/README.md @@ -133,11 +133,6 @@ To explain this boilerplate: - `bazel run testdata/DIR/FILE.carbon.verbose` -- Runs explorer on the file with tracing enabled. -### Updating fuzzer logic after making AST changes - -Please refer to -[Fuzzer documentation](https://github.com/carbon-language/carbon-lang/blob/trunk/explorer/fuzzing/README.md). - ## Explorer's Trace Output Explorer's Trace Output refers to a detailed record of program phases and their diff --git a/explorer/parse_and_execute/BUILD b/explorer/parse_and_execute/BUILD index 40fa694c346c9..2ff0ec10034bc 100644 --- a/explorer/parse_and_execute/BUILD +++ b/explorer/parse_and_execute/BUILD @@ -6,7 +6,6 @@ load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") package(default_visibility = [ "//explorer:__pkg__", - "//explorer/fuzzing:__pkg__", ]) cc_library( diff --git a/explorer/syntax/BUILD b/explorer/syntax/BUILD index 226d0356d257e..ac553abcb5e2f 100644 --- a/explorer/syntax/BUILD +++ b/explorer/syntax/BUILD @@ -94,7 +94,6 @@ cc_library( # don't spend time linting it. tags = ["no-clang-tidy"], visibility = [ - "//explorer/fuzzing:__pkg__", "//explorer/parse_and_execute:__pkg__", ], deps = [ From d41668350b1315f7680aaa3ced081b5aeb9f54a6 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 30 Dec 2024 16:35:39 -0800 Subject: [PATCH 07/13] Suppress testing SemIR in int builtin tests. (#4748) Add `EXTRA-ARGS:` support to file_test, to add arguments without overriding the default arguments. Use `EXTRA-ARGS: --no-dump-sem-ir` to turn off SemIR dumping and thus SemIR testing in the int builtin tests, which validate correct behavior through diagnostics instead. This doesn't get us any closer to supporting more targeted SemIR dumping / testing, but this seems to be a generally useful feature anyway. Most existing tests using `ARGS` have been switched over to using `EXTRA-ARGS`. Requested in review of #4716. --- testing/file_test/README.md | 10 + testing/file_test/file_test_base.cpp | 23 +- testing/file_test/file_test_base.h | 4 + .../basics/no_prelude/raw_identifier.carbon | 34 +- .../check/testdata/builtins/float/add.carbon | 156 +- .../check/testdata/builtins/float/div.carbon | 156 +- .../check/testdata/builtins/float/eq.carbon | 36 +- .../testdata/builtins/float/greater.carbon | 36 +- .../testdata/builtins/float/greater_eq.carbon | 36 +- .../check/testdata/builtins/float/less.carbon | 36 +- .../testdata/builtins/float/less_eq.carbon | 36 +- .../check/testdata/builtins/float/mul.carbon | 156 +- .../testdata/builtins/float/negate.carbon | 156 +- .../check/testdata/builtins/float/neq.carbon | 36 +- .../check/testdata/builtins/float/sub.carbon | 156 +- .../check/testdata/builtins/int/and.carbon | 112 +- .../testdata/builtins/int/complement.carbon | 125 +- .../builtins/int/convert_checked.carbon | 2723 +---------------- .../check/testdata/builtins/int/eq.carbon | 275 +- .../testdata/builtins/int/greater.carbon | 351 +-- .../testdata/builtins/int/greater_eq.carbon | 351 +-- .../testdata/builtins/int/left_shift.carbon | 385 +-- .../check/testdata/builtins/int/less.carbon | 351 +-- .../testdata/builtins/int/less_eq.carbon | 351 +-- .../builtins/int/make_type_signed.carbon | 528 +--- .../builtins/int/make_type_unsigned.carbon | 336 +- .../check/testdata/builtins/int/neq.carbon | 223 +- .../check/testdata/builtins/int/or.carbon | 112 +- .../testdata/builtins/int/right_shift.carbon | 397 +-- .../check/testdata/builtins/int/sadd.carbon | 510 +-- .../check/testdata/builtins/int/sdiv.carbon | 449 +-- .../check/testdata/builtins/int/smod.carbon | 450 +-- .../check/testdata/builtins/int/smul.carbon | 228 +- .../testdata/builtins/int/snegate.carbon | 506 +-- .../check/testdata/builtins/int/ssub.carbon | 274 +- .../check/testdata/builtins/int/uadd.carbon | 510 +-- .../check/testdata/builtins/int/udiv.carbon | 450 +-- .../check/testdata/builtins/int/umod.carbon | 450 +-- .../check/testdata/builtins/int/umul.carbon | 228 +- .../testdata/builtins/int/unegate.carbon | 694 +---- .../check/testdata/builtins/int/usub.carbon | 274 +- .../check/testdata/builtins/int/xor.carbon | 112 +- .../builtins/int_literal/make_type.carbon | 63 +- .../testdata/function/builtin/call.carbon | 43 + .../multifile_raw_and_textual_ir.carbon | 4 +- .../testdata/compile}/multifile_raw_ir.carbon | 4 +- .../compile}/raw_and_textual_ir.carbon | 4 +- .../testdata/compile}/raw_ir.carbon | 4 +- .../testdata/compile}/textual_ir.carbon | 4 +- toolchain/lex/testdata/basic_syntax.carbon | 2 +- 50 files changed, 689 insertions(+), 12261 deletions(-) rename toolchain/{check/testdata/basics/no_prelude => driver/testdata/compile}/multifile_raw_and_textual_ir.carbon (98%) rename toolchain/{check/testdata/basics/no_prelude => driver/testdata/compile}/multifile_raw_ir.carbon (98%) rename toolchain/{check/testdata/basics/no_prelude => driver/testdata/compile}/raw_and_textual_ir.carbon (98%) rename toolchain/{check/testdata/basics/no_prelude => driver/testdata/compile}/raw_ir.carbon (99%) rename toolchain/{check/testdata/basics/no_prelude => driver/testdata/compile}/textual_ir.carbon (96%) diff --git a/testing/file_test/README.md b/testing/file_test/README.md index 497c9389b526c..fe9219c7fae47 100644 --- a/testing/file_test/README.md +++ b/testing/file_test/README.md @@ -152,6 +152,16 @@ Supported comment markers are: ARGS can be specified at most once. If not provided, the FileTestBase child is responsible for providing default arguments. +- ``` + // EXTRA-ARGS: + ``` + + Same as `ARGS`, including substitution behavior, but appends to the default + argument list instead of replacing it. + + `EXTRA-ARGS` can be specified at most once, and a test cannot specify both + `ARGS` and `EXTRA-ARGS`. + - ``` // SET-CAPTURE-CONSOLE-OUTPUT ``` diff --git a/testing/file_test/file_test_base.cpp b/testing/file_test/file_test_base.cpp index ef34bd1c7cbe2..d5886ef6a76cd 100644 --- a/testing/file_test/file_test_base.cpp +++ b/testing/file_test/file_test_base.cpp @@ -292,6 +292,7 @@ auto FileTestBase::ProcessTestFileAndRun(TestContext& context) // Process arguments. if (context.test_args.empty()) { context.test_args = GetDefaultArgs(); + context.test_args.append(context.extra_args); } CARBON_RETURN_IF_ERROR( DoArgReplacements(context.test_args, context.test_files)); @@ -767,16 +768,23 @@ static auto TryConsumeCheck( return true; } -// Processes ARGS lines when found. Returns true if the line is consumed. +// Processes ARGS and EXTRA-ARGS lines when found. Returns true if the line is +// consumed. static auto TryConsumeArgs(llvm::StringRef line, llvm::StringRef line_trimmed, - llvm::SmallVector* args) + llvm::SmallVector* args, + llvm::SmallVector* extra_args) -> ErrorOr { - if (!line_trimmed.consume_front("// ARGS: ")) { + llvm::SmallVector* arg_list = nullptr; + if (line_trimmed.consume_front("// ARGS: ")) { + arg_list = args; + } else if (line_trimmed.consume_front("// EXTRA-ARGS: ")) { + arg_list = extra_args; + } else { return false; } - if (!args->empty()) { - return ErrorBuilder() << "ARGS was specified multiple times: " + if (!args->empty() || !extra_args->empty()) { + return ErrorBuilder() << "ARGS / EXTRA-ARGS specified multiple times: " << line.str(); } @@ -784,7 +792,7 @@ static auto TryConsumeArgs(llvm::StringRef line, llvm::StringRef line_trimmed, std::pair cursor = llvm::getToken(line_trimmed); while (!cursor.first.empty()) { - args->push_back(std::string(cursor.first)); + arg_list->push_back(std::string(cursor.first)); cursor = llvm::getToken(cursor.second); } @@ -884,7 +892,8 @@ auto FileTestBase::ProcessTestFile(TestContext& context) -> ErrorOr { FileTestLine(split.file_index, line_index, line)); CARBON_ASSIGN_OR_RETURN( - is_consumed, TryConsumeArgs(line, line_trimmed, &context.test_args)); + is_consumed, TryConsumeArgs(line, line_trimmed, &context.test_args, + &context.extra_args)); if (is_consumed) { continue; } diff --git a/testing/file_test/file_test_base.h b/testing/file_test/file_test_base.h index f13e0444f2223..2419bd70c4f44 100644 --- a/testing/file_test/file_test_base.h +++ b/testing/file_test/file_test_base.h @@ -145,6 +145,10 @@ class FileTestBase : public testing::Test { // Arguments for the test, generated from ARGS. llvm::SmallVector test_args; + // Extra arguments for the test, generated from EXTRA-ARGS. Unlike ARGS, + // setting EXTRA-ARGS does not suppress the default arguments. + llvm::SmallVector extra_args; + // Files in the test, generated by content and splits. llvm::SmallVector test_files; diff --git a/toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon b/toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon index a4b6bfabd3e22..42a0129abcdb9 100644 --- a/toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon +++ b/toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon @@ -2,10 +2,6 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// ARGS: compile --no-prelude-import --phase=check --dump-sem-ir %s -// -// Check that the command-line flag to dump textual IR works. -// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon @@ -48,12 +44,12 @@ fn C(r#if: ()) -> () { // CHECK:STDOUT: %return.patt: %empty_tuple.type = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %empty_tuple.type = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc15_17.1: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc15_17.2: type = converted %.loc15_17.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc11_17.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc11_17.2: type = converted %.loc11_17.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] // CHECK:STDOUT: %n.param: %empty_tuple.type = value_param runtime_param0 -// CHECK:STDOUT: %.loc15_10.1: type = splice_block %.loc15_10.3 [template = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc15_10.2: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc15_10.3: type = converted %.loc15_10.2, constants.%empty_tuple.type [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc11_10.1: type = splice_block %.loc11_10.3 [template = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc11_10.2: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc11_10.3: type = converted %.loc11_10.2, constants.%empty_tuple.type [template = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %n: %empty_tuple.type = bind_name n, %n.param // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param runtime_param1 @@ -65,12 +61,12 @@ fn C(r#if: ()) -> () { // CHECK:STDOUT: %return.patt: %empty_tuple.type = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %empty_tuple.type = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc19_19.1: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc19_19.2: type = converted %.loc19_19.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc15_19.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc15_19.2: type = converted %.loc15_19.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] // CHECK:STDOUT: %n.param: %empty_tuple.type = value_param runtime_param0 -// CHECK:STDOUT: %.loc19_12.1: type = splice_block %.loc19_12.3 [template = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc19_12.2: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc19_12.3: type = converted %.loc19_12.2, constants.%empty_tuple.type [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc15_12.1: type = splice_block %.loc15_12.3 [template = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc15_12.2: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc15_12.3: type = converted %.loc15_12.2, constants.%empty_tuple.type [template = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %n: %empty_tuple.type = bind_name n, %n.param // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param runtime_param1 @@ -82,12 +78,12 @@ fn C(r#if: ()) -> () { // CHECK:STDOUT: %return.patt: %empty_tuple.type = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %empty_tuple.type = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc23_20.1: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc23_20.2: type = converted %.loc23_20.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc19_20.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc19_20.2: type = converted %.loc19_20.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] // CHECK:STDOUT: %if.param: %empty_tuple.type = value_param runtime_param0 -// CHECK:STDOUT: %.loc23_13.1: type = splice_block %.loc23_13.3 [template = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc23_13.2: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc23_13.3: type = converted %.loc23_13.2, constants.%empty_tuple.type [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc19_13.1: type = splice_block %.loc19_13.3 [template = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc19_13.2: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc19_13.3: type = converted %.loc19_13.2, constants.%empty_tuple.type [template = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %if: %empty_tuple.type = bind_name r#if, %if.param // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param runtime_param1 diff --git a/toolchain/check/testdata/builtins/float/add.carbon b/toolchain/check/testdata/builtins/float/add.carbon index 794e1fd90c17b..ad666ec1684a7 100644 --- a/toolchain/check/testdata/builtins/float/add.carbon +++ b/toolchain/check/testdata/builtins/float/add.carbon @@ -12,7 +12,7 @@ fn Add(a: f64, b: f64) -> f64 = "float.add"; -fn RuntimeCall(a: f64, b: f64) -> f64 { +fn RuntimeCallIsValid(a: f64, b: f64) -> f64 { return Add(a, b); } @@ -38,15 +38,15 @@ fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.add"; fn BadReturnType(a: f64, b: f64) -> bool = "float.add"; fn JustRight(a: f64, b: f64) -> f64 = "float.add"; -fn RuntimeCallTooFew(a: f64) -> f64 { +fn RuntimeCallIsValidTooFew(a: f64) -> f64 { return TooFew(a); } -fn RuntimeCallTooMany(a: f64, b: f64, c: f64) -> f64 { +fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 { return TooMany(a, b, c); } -fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { +fn RuntimeCallIsValidBadReturnType(a: f64, b: f64) -> bool { return BadReturnType(a, b); } @@ -58,8 +58,8 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: %Float: %Float.type = struct_value () [template] // CHECK:STDOUT: %Add.type: type = fn_type @Add [template] // CHECK:STDOUT: %Add: %Add.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallIsValid.type: type = fn_type @RuntimeCallIsValid [template] +// CHECK:STDOUT: %RuntimeCallIsValid: %RuntimeCallIsValid.type = struct_value () [template] // CHECK:STDOUT: %float.1: f64 = float_literal 2.2000000000000002 [template] // CHECK:STDOUT: %float.2: f64 = float_literal 2.3000000000000003 [template] // CHECK:STDOUT: %float.3: f64 = float_literal 4.5 [template] @@ -77,7 +77,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .Add = %Add.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl +// CHECK:STDOUT: .RuntimeCallIsValid = %RuntimeCallIsValid.decl // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core @@ -112,7 +112,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param2 // CHECK:STDOUT: %return: ref f64 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { +// 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 @@ -120,24 +120,24 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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_35: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc4_35: init type = call constants.%Float(%int_64.loc4_35) [template = f64] -// CHECK:STDOUT: %.loc4_35.1: type = value_of_initializer %float.make_type.loc4_35 [template = f64] -// CHECK:STDOUT: %.loc4_35.2: type = converted %float.make_type.loc4_35, %.loc4_35.1 [template = f64] +// 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_19.1: type = splice_block %.loc4_19.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc4_19: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc4_19: init type = call constants.%Float(%int_64.loc4_19) [template = f64] -// CHECK:STDOUT: %.loc4_19.2: type = value_of_initializer %float.make_type.loc4_19 [template = f64] -// CHECK:STDOUT: %.loc4_19.3: type = converted %float.make_type.loc4_19, %.loc4_19.2 [template = f64] +// 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_27.1: type = splice_block %.loc4_27.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc4_27: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc4_27: init type = call constants.%Float(%int_64.loc4_27) [template = f64] -// CHECK:STDOUT: %.loc4_27.2: type = value_of_initializer %float.make_type.loc4_27 [template = f64] -// CHECK:STDOUT: %.loc4_27.3: type = converted %float.make_type.loc4_27, %.loc4_27.2 [template = f64] +// 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 @@ -149,7 +149,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @Add(%a.param_patt: f64, %b.param_patt: f64) -> f64 = "float.add"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: f64, %b.param_patt: f64) -> f64 { +// CHECK:STDOUT: fn @RuntimeCallIsValid(%a.param_patt: f64, %b.param_patt: f64) -> f64 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Add.ref: %Add.type = name_ref Add, file.%Add.decl [template = constants.%Add] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a @@ -186,12 +186,12 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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: %RuntimeCallTooFew.type: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %RuntimeCallTooFew: %RuntimeCallTooFew.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallTooMany.type: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %RuntimeCallTooMany: %RuntimeCallTooMany.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType.type: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType: %RuntimeCallBadReturnType.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 { @@ -210,9 +210,9 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: .TooMany = %TooMany.decl // CHECK:STDOUT: .BadReturnType = %BadReturnType.decl // CHECK:STDOUT: .JustRight = %JustRight.decl -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.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] { @@ -338,28 +338,28 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param2 // CHECK:STDOUT: %return: ref f64 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooFew.decl: %RuntimeCallTooFew.type = fn_decl @RuntimeCallTooFew [template = constants.%RuntimeCallTooFew] { +// 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.loc20_33: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc20_33: init type = call constants.%Float(%int_64.loc20_33) [template = f64] -// CHECK:STDOUT: %.loc20_33.1: type = value_of_initializer %float.make_type.loc20_33 [template = f64] -// CHECK:STDOUT: %.loc20_33.2: type = converted %float.make_type.loc20_33, %.loc20_33.1 [template = f64] +// CHECK:STDOUT: %int_64.loc20_40: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc20_40: init type = call constants.%Float(%int_64.loc20_40) [template = f64] +// CHECK:STDOUT: %.loc20_40.1: type = value_of_initializer %float.make_type.loc20_40 [template = f64] +// CHECK:STDOUT: %.loc20_40.2: type = converted %float.make_type.loc20_40, %.loc20_40.1 [template = f64] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc20_25.1: type = splice_block %.loc20_25.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc20_25: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc20_25: init type = call constants.%Float(%int_64.loc20_25) [template = f64] -// CHECK:STDOUT: %.loc20_25.2: type = value_of_initializer %float.make_type.loc20_25 [template = f64] -// CHECK:STDOUT: %.loc20_25.3: type = converted %float.make_type.loc20_25, %.loc20_25.2 [template = f64] +// CHECK:STDOUT: %.loc20_32.1: type = splice_block %.loc20_32.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc20_32: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc20_32: init type = call constants.%Float(%int_64.loc20_32) [template = f64] +// CHECK:STDOUT: %.loc20_32.2: type = value_of_initializer %float.make_type.loc20_32 [template = f64] +// CHECK:STDOUT: %.loc20_32.3: type = converted %float.make_type.loc20_32, %.loc20_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: %RuntimeCallTooMany.decl: %RuntimeCallTooMany.type = fn_decl @RuntimeCallTooMany [template = constants.%RuntimeCallTooMany] { +// 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 @@ -369,38 +369,38 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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.loc24_50: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc24_50: init type = call constants.%Float(%int_64.loc24_50) [template = f64] -// CHECK:STDOUT: %.loc24_50.1: type = value_of_initializer %float.make_type.loc24_50 [template = f64] -// CHECK:STDOUT: %.loc24_50.2: type = converted %float.make_type.loc24_50, %.loc24_50.1 [template = f64] +// CHECK:STDOUT: %int_64.loc24_57: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc24_57: init type = call constants.%Float(%int_64.loc24_57) [template = f64] +// CHECK:STDOUT: %.loc24_57.1: type = value_of_initializer %float.make_type.loc24_57 [template = f64] +// CHECK:STDOUT: %.loc24_57.2: type = converted %float.make_type.loc24_57, %.loc24_57.1 [template = f64] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc24_26.1: type = splice_block %.loc24_26.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc24_26: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc24_26: init type = call constants.%Float(%int_64.loc24_26) [template = f64] -// CHECK:STDOUT: %.loc24_26.2: type = value_of_initializer %float.make_type.loc24_26 [template = f64] -// CHECK:STDOUT: %.loc24_26.3: type = converted %float.make_type.loc24_26, %.loc24_26.2 [template = f64] +// CHECK:STDOUT: %.loc24_33.1: type = splice_block %.loc24_33.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc24_33: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc24_33: init type = call constants.%Float(%int_64.loc24_33) [template = f64] +// CHECK:STDOUT: %.loc24_33.2: type = value_of_initializer %float.make_type.loc24_33 [template = f64] +// CHECK:STDOUT: %.loc24_33.3: type = converted %float.make_type.loc24_33, %.loc24_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: %.loc24_34.1: type = splice_block %.loc24_34.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc24_34: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc24_34: init type = call constants.%Float(%int_64.loc24_34) [template = f64] -// CHECK:STDOUT: %.loc24_34.2: type = value_of_initializer %float.make_type.loc24_34 [template = f64] -// CHECK:STDOUT: %.loc24_34.3: type = converted %float.make_type.loc24_34, %.loc24_34.2 [template = f64] +// CHECK:STDOUT: %.loc24_41.1: type = splice_block %.loc24_41.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc24_41: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc24_41: init type = call constants.%Float(%int_64.loc24_41) [template = f64] +// CHECK:STDOUT: %.loc24_41.2: type = value_of_initializer %float.make_type.loc24_41 [template = f64] +// CHECK:STDOUT: %.loc24_41.3: type = converted %float.make_type.loc24_41, %.loc24_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: %.loc24_42.1: type = splice_block %.loc24_42.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc24_42: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc24_42: init type = call constants.%Float(%int_64.loc24_42) [template = f64] -// CHECK:STDOUT: %.loc24_42.2: type = value_of_initializer %float.make_type.loc24_42 [template = f64] -// CHECK:STDOUT: %.loc24_42.3: type = converted %float.make_type.loc24_42, %.loc24_42.2 [template = f64] +// CHECK:STDOUT: %.loc24_49.1: type = splice_block %.loc24_49.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc24_49: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc24_49: init type = call constants.%Float(%int_64.loc24_49) [template = f64] +// CHECK:STDOUT: %.loc24_49.2: type = value_of_initializer %float.make_type.loc24_49 [template = f64] +// CHECK:STDOUT: %.loc24_49.3: type = converted %float.make_type.loc24_49, %.loc24_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: %RuntimeCallBadReturnType.decl: %RuntimeCallBadReturnType.type = fn_decl @RuntimeCallBadReturnType [template = constants.%RuntimeCallBadReturnType] { +// 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 @@ -409,22 +409,22 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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: %.loc28_48.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc28_48.2: type = converted %bool.make_type, %.loc28_48.1 [template = bool] +// CHECK:STDOUT: %.loc28_55.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc28_55.2: type = converted %bool.make_type, %.loc28_55.1 [template = bool] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc28_32.1: type = splice_block %.loc28_32.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc28_32: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc28_32: init type = call constants.%Float(%int_64.loc28_32) [template = f64] -// CHECK:STDOUT: %.loc28_32.2: type = value_of_initializer %float.make_type.loc28_32 [template = f64] -// CHECK:STDOUT: %.loc28_32.3: type = converted %float.make_type.loc28_32, %.loc28_32.2 [template = f64] +// CHECK:STDOUT: %.loc28_39.1: type = splice_block %.loc28_39.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc28_39: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc28_39: init type = call constants.%Float(%int_64.loc28_39) [template = f64] +// CHECK:STDOUT: %.loc28_39.2: type = value_of_initializer %float.make_type.loc28_39 [template = f64] +// CHECK:STDOUT: %.loc28_39.3: type = converted %float.make_type.loc28_39, %.loc28_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: %.loc28_40.1: type = splice_block %.loc28_40.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc28_40: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc28_40: init type = call constants.%Float(%int_64.loc28_40) [template = f64] -// CHECK:STDOUT: %.loc28_40.2: type = value_of_initializer %float.make_type.loc28_40 [template = f64] -// CHECK:STDOUT: %.loc28_40.3: type = converted %float.make_type.loc28_40, %.loc28_40.2 [template = f64] +// CHECK:STDOUT: %.loc28_47.1: type = splice_block %.loc28_47.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc28_47: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc28_47: init type = call constants.%Float(%int_64.loc28_47) [template = f64] +// CHECK:STDOUT: %.loc28_47.2: type = value_of_initializer %float.make_type.loc28_47 [template = f64] +// CHECK:STDOUT: %.loc28_47.3: type = converted %float.make_type.loc28_47, %.loc28_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 @@ -440,7 +440,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @JustRight(%a.param_patt: f64, %b.param_patt: f64) -> f64 = "float.add"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooFew(%a.param_patt: f64) -> f64 { +// 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 @@ -450,7 +450,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: return %.loc21_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooMany(%a.param_patt: f64, %b.param_patt: f64, %c.param_patt: f64) -> f64 { +// 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 @@ -462,7 +462,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: return %.loc25_26.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a.param_patt: f64, %b.param_patt: f64) -> bool { +// 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 diff --git a/toolchain/check/testdata/builtins/float/div.carbon b/toolchain/check/testdata/builtins/float/div.carbon index b0689dad6808d..791c9a610dd16 100644 --- a/toolchain/check/testdata/builtins/float/div.carbon +++ b/toolchain/check/testdata/builtins/float/div.carbon @@ -12,7 +12,7 @@ fn Div(a: f64, b: f64) -> f64 = "float.div"; -fn RuntimeCall(a: f64, b: f64) -> f64 { +fn RuntimeCallIsValid(a: f64, b: f64) -> f64 { return Div(a, b); } @@ -40,15 +40,15 @@ fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.div"; fn BadReturnType(a: f64, b: f64) -> bool = "float.div"; fn JustRight(a: f64, b: f64) -> f64 = "float.div"; -fn RuntimeCallTooFew(a: f64) -> f64 { +fn RuntimeCallIsValidTooFew(a: f64) -> f64 { return TooFew(a); } -fn RuntimeCallTooMany(a: f64, b: f64, c: f64) -> f64 { +fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 { return TooMany(a, b, c); } -fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { +fn RuntimeCallIsValidBadReturnType(a: f64, b: f64) -> bool { return BadReturnType(a, b); } @@ -60,8 +60,8 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: %Float: %Float.type = struct_value () [template] // CHECK:STDOUT: %Div.type: type = fn_type @Div [template] // CHECK:STDOUT: %Div: %Div.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallIsValid.type: type = fn_type @RuntimeCallIsValid [template] +// CHECK:STDOUT: %RuntimeCallIsValid: %RuntimeCallIsValid.type = struct_value () [template] // CHECK:STDOUT: %float.1: f64 = float_literal 10 [template] // CHECK:STDOUT: %float.2: f64 = float_literal 2.5 [template] // CHECK:STDOUT: %float.3: f64 = float_literal 4 [template] @@ -83,7 +83,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .Div = %Div.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl +// CHECK:STDOUT: .RuntimeCallIsValid = %RuntimeCallIsValid.decl // CHECK:STDOUT: .a = %a // CHECK:STDOUT: .b = @__global_init.%b // CHECK:STDOUT: .c = @__global_init.%c @@ -120,7 +120,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param2 // CHECK:STDOUT: %return: ref f64 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { +// 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 @@ -128,24 +128,24 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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_35: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc4_35: init type = call constants.%Float(%int_64.loc4_35) [template = f64] -// CHECK:STDOUT: %.loc4_35.1: type = value_of_initializer %float.make_type.loc4_35 [template = f64] -// CHECK:STDOUT: %.loc4_35.2: type = converted %float.make_type.loc4_35, %.loc4_35.1 [template = f64] +// 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_19.1: type = splice_block %.loc4_19.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc4_19: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc4_19: init type = call constants.%Float(%int_64.loc4_19) [template = f64] -// CHECK:STDOUT: %.loc4_19.2: type = value_of_initializer %float.make_type.loc4_19 [template = f64] -// CHECK:STDOUT: %.loc4_19.3: type = converted %float.make_type.loc4_19, %.loc4_19.2 [template = f64] +// 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_27.1: type = splice_block %.loc4_27.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc4_27: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc4_27: init type = call constants.%Float(%int_64.loc4_27) [template = f64] -// CHECK:STDOUT: %.loc4_27.2: type = value_of_initializer %float.make_type.loc4_27 [template = f64] -// CHECK:STDOUT: %.loc4_27.3: type = converted %float.make_type.loc4_27, %.loc4_27.2 [template = f64] +// 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 @@ -157,7 +157,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @Div(%a.param_patt: f64, %b.param_patt: f64) -> f64 = "float.div"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: f64, %b.param_patt: f64) -> f64 { +// CHECK:STDOUT: fn @RuntimeCallIsValid(%a.param_patt: f64, %b.param_patt: f64) -> f64 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Div.ref: %Div.type = name_ref Div, file.%Div.decl [template = constants.%Div] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a @@ -208,12 +208,12 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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: %RuntimeCallTooFew.type: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %RuntimeCallTooFew: %RuntimeCallTooFew.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallTooMany.type: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %RuntimeCallTooMany: %RuntimeCallTooMany.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType.type: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType: %RuntimeCallBadReturnType.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 { @@ -232,9 +232,9 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: .TooMany = %TooMany.decl // CHECK:STDOUT: .BadReturnType = %BadReturnType.decl // CHECK:STDOUT: .JustRight = %JustRight.decl -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.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] { @@ -360,28 +360,28 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param2 // CHECK:STDOUT: %return: ref f64 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooFew.decl: %RuntimeCallTooFew.type = fn_decl @RuntimeCallTooFew [template = constants.%RuntimeCallTooFew] { +// 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.loc20_33: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc20_33: init type = call constants.%Float(%int_64.loc20_33) [template = f64] -// CHECK:STDOUT: %.loc20_33.1: type = value_of_initializer %float.make_type.loc20_33 [template = f64] -// CHECK:STDOUT: %.loc20_33.2: type = converted %float.make_type.loc20_33, %.loc20_33.1 [template = f64] +// CHECK:STDOUT: %int_64.loc20_40: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc20_40: init type = call constants.%Float(%int_64.loc20_40) [template = f64] +// CHECK:STDOUT: %.loc20_40.1: type = value_of_initializer %float.make_type.loc20_40 [template = f64] +// CHECK:STDOUT: %.loc20_40.2: type = converted %float.make_type.loc20_40, %.loc20_40.1 [template = f64] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc20_25.1: type = splice_block %.loc20_25.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc20_25: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc20_25: init type = call constants.%Float(%int_64.loc20_25) [template = f64] -// CHECK:STDOUT: %.loc20_25.2: type = value_of_initializer %float.make_type.loc20_25 [template = f64] -// CHECK:STDOUT: %.loc20_25.3: type = converted %float.make_type.loc20_25, %.loc20_25.2 [template = f64] +// CHECK:STDOUT: %.loc20_32.1: type = splice_block %.loc20_32.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc20_32: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc20_32: init type = call constants.%Float(%int_64.loc20_32) [template = f64] +// CHECK:STDOUT: %.loc20_32.2: type = value_of_initializer %float.make_type.loc20_32 [template = f64] +// CHECK:STDOUT: %.loc20_32.3: type = converted %float.make_type.loc20_32, %.loc20_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: %RuntimeCallTooMany.decl: %RuntimeCallTooMany.type = fn_decl @RuntimeCallTooMany [template = constants.%RuntimeCallTooMany] { +// 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 @@ -391,38 +391,38 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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.loc24_50: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc24_50: init type = call constants.%Float(%int_64.loc24_50) [template = f64] -// CHECK:STDOUT: %.loc24_50.1: type = value_of_initializer %float.make_type.loc24_50 [template = f64] -// CHECK:STDOUT: %.loc24_50.2: type = converted %float.make_type.loc24_50, %.loc24_50.1 [template = f64] +// CHECK:STDOUT: %int_64.loc24_57: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc24_57: init type = call constants.%Float(%int_64.loc24_57) [template = f64] +// CHECK:STDOUT: %.loc24_57.1: type = value_of_initializer %float.make_type.loc24_57 [template = f64] +// CHECK:STDOUT: %.loc24_57.2: type = converted %float.make_type.loc24_57, %.loc24_57.1 [template = f64] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc24_26.1: type = splice_block %.loc24_26.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc24_26: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc24_26: init type = call constants.%Float(%int_64.loc24_26) [template = f64] -// CHECK:STDOUT: %.loc24_26.2: type = value_of_initializer %float.make_type.loc24_26 [template = f64] -// CHECK:STDOUT: %.loc24_26.3: type = converted %float.make_type.loc24_26, %.loc24_26.2 [template = f64] +// CHECK:STDOUT: %.loc24_33.1: type = splice_block %.loc24_33.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc24_33: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc24_33: init type = call constants.%Float(%int_64.loc24_33) [template = f64] +// CHECK:STDOUT: %.loc24_33.2: type = value_of_initializer %float.make_type.loc24_33 [template = f64] +// CHECK:STDOUT: %.loc24_33.3: type = converted %float.make_type.loc24_33, %.loc24_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: %.loc24_34.1: type = splice_block %.loc24_34.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc24_34: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc24_34: init type = call constants.%Float(%int_64.loc24_34) [template = f64] -// CHECK:STDOUT: %.loc24_34.2: type = value_of_initializer %float.make_type.loc24_34 [template = f64] -// CHECK:STDOUT: %.loc24_34.3: type = converted %float.make_type.loc24_34, %.loc24_34.2 [template = f64] +// CHECK:STDOUT: %.loc24_41.1: type = splice_block %.loc24_41.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc24_41: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc24_41: init type = call constants.%Float(%int_64.loc24_41) [template = f64] +// CHECK:STDOUT: %.loc24_41.2: type = value_of_initializer %float.make_type.loc24_41 [template = f64] +// CHECK:STDOUT: %.loc24_41.3: type = converted %float.make_type.loc24_41, %.loc24_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: %.loc24_42.1: type = splice_block %.loc24_42.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc24_42: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc24_42: init type = call constants.%Float(%int_64.loc24_42) [template = f64] -// CHECK:STDOUT: %.loc24_42.2: type = value_of_initializer %float.make_type.loc24_42 [template = f64] -// CHECK:STDOUT: %.loc24_42.3: type = converted %float.make_type.loc24_42, %.loc24_42.2 [template = f64] +// CHECK:STDOUT: %.loc24_49.1: type = splice_block %.loc24_49.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc24_49: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc24_49: init type = call constants.%Float(%int_64.loc24_49) [template = f64] +// CHECK:STDOUT: %.loc24_49.2: type = value_of_initializer %float.make_type.loc24_49 [template = f64] +// CHECK:STDOUT: %.loc24_49.3: type = converted %float.make_type.loc24_49, %.loc24_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: %RuntimeCallBadReturnType.decl: %RuntimeCallBadReturnType.type = fn_decl @RuntimeCallBadReturnType [template = constants.%RuntimeCallBadReturnType] { +// 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 @@ -431,22 +431,22 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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: %.loc28_48.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc28_48.2: type = converted %bool.make_type, %.loc28_48.1 [template = bool] +// CHECK:STDOUT: %.loc28_55.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc28_55.2: type = converted %bool.make_type, %.loc28_55.1 [template = bool] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc28_32.1: type = splice_block %.loc28_32.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc28_32: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc28_32: init type = call constants.%Float(%int_64.loc28_32) [template = f64] -// CHECK:STDOUT: %.loc28_32.2: type = value_of_initializer %float.make_type.loc28_32 [template = f64] -// CHECK:STDOUT: %.loc28_32.3: type = converted %float.make_type.loc28_32, %.loc28_32.2 [template = f64] +// CHECK:STDOUT: %.loc28_39.1: type = splice_block %.loc28_39.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc28_39: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc28_39: init type = call constants.%Float(%int_64.loc28_39) [template = f64] +// CHECK:STDOUT: %.loc28_39.2: type = value_of_initializer %float.make_type.loc28_39 [template = f64] +// CHECK:STDOUT: %.loc28_39.3: type = converted %float.make_type.loc28_39, %.loc28_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: %.loc28_40.1: type = splice_block %.loc28_40.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc28_40: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc28_40: init type = call constants.%Float(%int_64.loc28_40) [template = f64] -// CHECK:STDOUT: %.loc28_40.2: type = value_of_initializer %float.make_type.loc28_40 [template = f64] -// CHECK:STDOUT: %.loc28_40.3: type = converted %float.make_type.loc28_40, %.loc28_40.2 [template = f64] +// CHECK:STDOUT: %.loc28_47.1: type = splice_block %.loc28_47.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc28_47: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc28_47: init type = call constants.%Float(%int_64.loc28_47) [template = f64] +// CHECK:STDOUT: %.loc28_47.2: type = value_of_initializer %float.make_type.loc28_47 [template = f64] +// CHECK:STDOUT: %.loc28_47.3: type = converted %float.make_type.loc28_47, %.loc28_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 @@ -462,7 +462,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @JustRight(%a.param_patt: f64, %b.param_patt: f64) -> f64 = "float.div"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooFew(%a.param_patt: f64) -> f64 { +// 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 @@ -472,7 +472,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: return %.loc21_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooMany(%a.param_patt: f64, %b.param_patt: f64, %c.param_patt: f64) -> f64 { +// 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 @@ -484,7 +484,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: return %.loc25_26.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a.param_patt: f64, %b.param_patt: f64) -> bool { +// 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 diff --git a/toolchain/check/testdata/builtins/float/eq.carbon b/toolchain/check/testdata/builtins/float/eq.carbon index be58640e98c5c..bc8ab7a3a0b03 100644 --- a/toolchain/check/testdata/builtins/float/eq.carbon +++ b/toolchain/check/testdata/builtins/float/eq.carbon @@ -20,7 +20,7 @@ fn F(true_: True, false_: False) { false_ as (if Eq(1.0, 2.0) then True else False); } -fn RuntimeCall(a: f64, b: f64) -> bool { +fn RuntimeCallIsValid(a: f64, b: f64) -> bool { return Eq(a, b); } @@ -53,8 +53,8 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: %true: bool = bool_literal true [template] // CHECK:STDOUT: %float.2: f64 = float_literal 2 [template] // CHECK:STDOUT: %false: bool = bool_literal false [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallIsValid.type: type = fn_type @RuntimeCallIsValid [template] +// CHECK:STDOUT: %RuntimeCallIsValid: %RuntimeCallIsValid.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -73,7 +73,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl // CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl +// CHECK:STDOUT: .RuntimeCallIsValid = %RuntimeCallIsValid.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Eq.decl: %Eq.type = fn_decl @Eq [template = constants.%Eq] { @@ -121,7 +121,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: %False.ref.loc7: type = name_ref False, file.%False.decl [template = constants.%False] // CHECK:STDOUT: %false_: %False = bind_name false_, %false_.param // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { +// 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 @@ -130,22 +130,22 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // 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: %.loc12_35.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc12_35.2: type = converted %bool.make_type, %.loc12_35.1 [template = bool] +// CHECK:STDOUT: %.loc12_42.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc12_42.2: type = converted %bool.make_type, %.loc12_42.1 [template = bool] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc12_19.1: type = splice_block %.loc12_19.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc12_19: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc12_19: init type = call constants.%Float(%int_64.loc12_19) [template = f64] -// CHECK:STDOUT: %.loc12_19.2: type = value_of_initializer %float.make_type.loc12_19 [template = f64] -// CHECK:STDOUT: %.loc12_19.3: type = converted %float.make_type.loc12_19, %.loc12_19.2 [template = f64] +// CHECK:STDOUT: %.loc12_26.1: type = splice_block %.loc12_26.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc12_26: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc12_26: init type = call constants.%Float(%int_64.loc12_26) [template = f64] +// CHECK:STDOUT: %.loc12_26.2: type = value_of_initializer %float.make_type.loc12_26 [template = f64] +// CHECK:STDOUT: %.loc12_26.3: type = converted %float.make_type.loc12_26, %.loc12_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: %.loc12_27.1: type = splice_block %.loc12_27.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc12_27: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc12_27: init type = call constants.%Float(%int_64.loc12_27) [template = f64] -// CHECK:STDOUT: %.loc12_27.2: type = value_of_initializer %float.make_type.loc12_27 [template = f64] -// CHECK:STDOUT: %.loc12_27.3: type = converted %float.make_type.loc12_27, %.loc12_27.2 [template = f64] +// CHECK:STDOUT: %.loc12_34.1: type = splice_block %.loc12_34.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc12_34: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc12_34: init type = call constants.%Float(%int_64.loc12_34) [template = f64] +// CHECK:STDOUT: %.loc12_34.2: type = value_of_initializer %float.make_type.loc12_34 [template = f64] +// CHECK:STDOUT: %.loc12_34.3: type = converted %float.make_type.loc12_34, %.loc12_34.2 [template = f64] // CHECK:STDOUT: } // CHECK:STDOUT: %b: f64 = bind_name b, %b.param // CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2 @@ -214,7 +214,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: f64, %b.param_patt: f64) -> bool { +// CHECK:STDOUT: fn @RuntimeCallIsValid(%a.param_patt: f64, %b.param_patt: f64) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Eq.ref: %Eq.type = name_ref Eq, file.%Eq.decl [template = constants.%Eq] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a diff --git a/toolchain/check/testdata/builtins/float/greater.carbon b/toolchain/check/testdata/builtins/float/greater.carbon index 320082ce15665..c1eb849504c6c 100644 --- a/toolchain/check/testdata/builtins/float/greater.carbon +++ b/toolchain/check/testdata/builtins/float/greater.carbon @@ -24,7 +24,7 @@ fn F(true_: True, false_: False) { true_ as (if Greater(0.0, Negate(1.0)) then True else False); } -fn RuntimeCall(a: f64, b: f64) -> bool { +fn RuntimeCallIsValid(a: f64, b: f64) -> bool { return Greater(a, b); } @@ -52,8 +52,8 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %float.3: f64 = float_literal 0 [template] // CHECK:STDOUT: %true: bool = bool_literal true [template] // CHECK:STDOUT: %float.4: f64 = float_literal -1 [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallIsValid.type: type = fn_type @RuntimeCallIsValid [template] +// CHECK:STDOUT: %RuntimeCallIsValid: %RuntimeCallIsValid.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -73,7 +73,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl // CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl +// CHECK:STDOUT: .RuntimeCallIsValid = %RuntimeCallIsValid.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Greater.decl: %Greater.type = fn_decl @Greater [template = constants.%Greater] { @@ -142,7 +142,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %False.ref.loc8: type = name_ref False, file.%False.decl [template = constants.%False] // CHECK:STDOUT: %false_: %False = bind_name false_, %false_.param // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { +// 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 @@ -151,22 +151,22 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // 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: %.loc16_35.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type, %.loc16_35.1 [template = bool] +// CHECK:STDOUT: %.loc16_42.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc16_42.2: type = converted %bool.make_type, %.loc16_42.1 [template = bool] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc16_19.1: type = splice_block %.loc16_19.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc16_19: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc16_19: init type = call constants.%Float(%int_64.loc16_19) [template = f64] -// CHECK:STDOUT: %.loc16_19.2: type = value_of_initializer %float.make_type.loc16_19 [template = f64] -// CHECK:STDOUT: %.loc16_19.3: type = converted %float.make_type.loc16_19, %.loc16_19.2 [template = f64] +// CHECK:STDOUT: %.loc16_26.1: type = splice_block %.loc16_26.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc16_26: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc16_26: init type = call constants.%Float(%int_64.loc16_26) [template = f64] +// CHECK:STDOUT: %.loc16_26.2: type = value_of_initializer %float.make_type.loc16_26 [template = f64] +// CHECK:STDOUT: %.loc16_26.3: type = converted %float.make_type.loc16_26, %.loc16_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: %.loc16_27.1: type = splice_block %.loc16_27.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc16_27: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc16_27: init type = call constants.%Float(%int_64.loc16_27) [template = f64] -// CHECK:STDOUT: %.loc16_27.2: type = value_of_initializer %float.make_type.loc16_27 [template = f64] -// CHECK:STDOUT: %.loc16_27.3: type = converted %float.make_type.loc16_27, %.loc16_27.2 [template = f64] +// CHECK:STDOUT: %.loc16_34.1: type = splice_block %.loc16_34.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc16_34: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc16_34: init type = call constants.%Float(%int_64.loc16_34) [template = f64] +// CHECK:STDOUT: %.loc16_34.2: type = value_of_initializer %float.make_type.loc16_34 [template = f64] +// CHECK:STDOUT: %.loc16_34.3: type = converted %float.make_type.loc16_34, %.loc16_34.2 [template = f64] // CHECK:STDOUT: } // CHECK:STDOUT: %b: f64 = bind_name b, %b.param // CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2 @@ -302,7 +302,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: f64, %b.param_patt: f64) -> bool { +// CHECK:STDOUT: fn @RuntimeCallIsValid(%a.param_patt: f64, %b.param_patt: f64) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Greater.ref: %Greater.type = name_ref Greater, file.%Greater.decl [template = constants.%Greater] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a diff --git a/toolchain/check/testdata/builtins/float/greater_eq.carbon b/toolchain/check/testdata/builtins/float/greater_eq.carbon index 9217e14d2669a..948627bfdb417 100644 --- a/toolchain/check/testdata/builtins/float/greater_eq.carbon +++ b/toolchain/check/testdata/builtins/float/greater_eq.carbon @@ -24,7 +24,7 @@ fn F(true_: True, false_: False) { true_ as (if GreaterEq(0.0, Negate(1.0)) then True else False); } -fn RuntimeCall(a: f64, b: f64) -> bool { +fn RuntimeCallIsValid(a: f64, b: f64) -> bool { return GreaterEq(a, b); } @@ -52,8 +52,8 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %true: bool = bool_literal true [template] // CHECK:STDOUT: %float.3: f64 = float_literal 0 [template] // CHECK:STDOUT: %float.4: f64 = float_literal -1 [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallIsValid.type: type = fn_type @RuntimeCallIsValid [template] +// CHECK:STDOUT: %RuntimeCallIsValid: %RuntimeCallIsValid.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -73,7 +73,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl // CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl +// CHECK:STDOUT: .RuntimeCallIsValid = %RuntimeCallIsValid.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %GreaterEq.decl: %GreaterEq.type = fn_decl @GreaterEq [template = constants.%GreaterEq] { @@ -142,7 +142,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %False.ref.loc8: type = name_ref False, file.%False.decl [template = constants.%False] // CHECK:STDOUT: %false_: %False = bind_name false_, %false_.param // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { +// 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 @@ -151,22 +151,22 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // 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: %.loc16_35.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type, %.loc16_35.1 [template = bool] +// CHECK:STDOUT: %.loc16_42.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc16_42.2: type = converted %bool.make_type, %.loc16_42.1 [template = bool] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc16_19.1: type = splice_block %.loc16_19.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc16_19: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc16_19: init type = call constants.%Float(%int_64.loc16_19) [template = f64] -// CHECK:STDOUT: %.loc16_19.2: type = value_of_initializer %float.make_type.loc16_19 [template = f64] -// CHECK:STDOUT: %.loc16_19.3: type = converted %float.make_type.loc16_19, %.loc16_19.2 [template = f64] +// CHECK:STDOUT: %.loc16_26.1: type = splice_block %.loc16_26.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc16_26: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc16_26: init type = call constants.%Float(%int_64.loc16_26) [template = f64] +// CHECK:STDOUT: %.loc16_26.2: type = value_of_initializer %float.make_type.loc16_26 [template = f64] +// CHECK:STDOUT: %.loc16_26.3: type = converted %float.make_type.loc16_26, %.loc16_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: %.loc16_27.1: type = splice_block %.loc16_27.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc16_27: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc16_27: init type = call constants.%Float(%int_64.loc16_27) [template = f64] -// CHECK:STDOUT: %.loc16_27.2: type = value_of_initializer %float.make_type.loc16_27 [template = f64] -// CHECK:STDOUT: %.loc16_27.3: type = converted %float.make_type.loc16_27, %.loc16_27.2 [template = f64] +// CHECK:STDOUT: %.loc16_34.1: type = splice_block %.loc16_34.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc16_34: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc16_34: init type = call constants.%Float(%int_64.loc16_34) [template = f64] +// CHECK:STDOUT: %.loc16_34.2: type = value_of_initializer %float.make_type.loc16_34 [template = f64] +// CHECK:STDOUT: %.loc16_34.3: type = converted %float.make_type.loc16_34, %.loc16_34.2 [template = f64] // CHECK:STDOUT: } // CHECK:STDOUT: %b: f64 = bind_name b, %b.param // CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2 @@ -302,7 +302,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: f64, %b.param_patt: f64) -> bool { +// CHECK:STDOUT: fn @RuntimeCallIsValid(%a.param_patt: f64, %b.param_patt: f64) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %GreaterEq.ref: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a diff --git a/toolchain/check/testdata/builtins/float/less.carbon b/toolchain/check/testdata/builtins/float/less.carbon index 4c01a6cca77ae..413596f128107 100644 --- a/toolchain/check/testdata/builtins/float/less.carbon +++ b/toolchain/check/testdata/builtins/float/less.carbon @@ -24,7 +24,7 @@ fn F(true_: True, false_: False) { false_ as (if Less(0.0, Negate(1.0)) then True else False); } -fn RuntimeCall(a: f64, b: f64) -> bool { +fn RuntimeCallIsValid(a: f64, b: f64) -> bool { return Less(a, b); } @@ -52,8 +52,8 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %false: bool = bool_literal false [template] // CHECK:STDOUT: %float.3: f64 = float_literal 0 [template] // CHECK:STDOUT: %float.4: f64 = float_literal -1 [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallIsValid.type: type = fn_type @RuntimeCallIsValid [template] +// CHECK:STDOUT: %RuntimeCallIsValid: %RuntimeCallIsValid.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -73,7 +73,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl // CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl +// CHECK:STDOUT: .RuntimeCallIsValid = %RuntimeCallIsValid.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Less.decl: %Less.type = fn_decl @Less [template = constants.%Less] { @@ -142,7 +142,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %False.ref.loc8: type = name_ref False, file.%False.decl [template = constants.%False] // CHECK:STDOUT: %false_: %False = bind_name false_, %false_.param // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { +// 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 @@ -151,22 +151,22 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // 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: %.loc16_35.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type, %.loc16_35.1 [template = bool] +// CHECK:STDOUT: %.loc16_42.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc16_42.2: type = converted %bool.make_type, %.loc16_42.1 [template = bool] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc16_19.1: type = splice_block %.loc16_19.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc16_19: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc16_19: init type = call constants.%Float(%int_64.loc16_19) [template = f64] -// CHECK:STDOUT: %.loc16_19.2: type = value_of_initializer %float.make_type.loc16_19 [template = f64] -// CHECK:STDOUT: %.loc16_19.3: type = converted %float.make_type.loc16_19, %.loc16_19.2 [template = f64] +// CHECK:STDOUT: %.loc16_26.1: type = splice_block %.loc16_26.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc16_26: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc16_26: init type = call constants.%Float(%int_64.loc16_26) [template = f64] +// CHECK:STDOUT: %.loc16_26.2: type = value_of_initializer %float.make_type.loc16_26 [template = f64] +// CHECK:STDOUT: %.loc16_26.3: type = converted %float.make_type.loc16_26, %.loc16_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: %.loc16_27.1: type = splice_block %.loc16_27.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc16_27: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc16_27: init type = call constants.%Float(%int_64.loc16_27) [template = f64] -// CHECK:STDOUT: %.loc16_27.2: type = value_of_initializer %float.make_type.loc16_27 [template = f64] -// CHECK:STDOUT: %.loc16_27.3: type = converted %float.make_type.loc16_27, %.loc16_27.2 [template = f64] +// CHECK:STDOUT: %.loc16_34.1: type = splice_block %.loc16_34.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc16_34: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc16_34: init type = call constants.%Float(%int_64.loc16_34) [template = f64] +// CHECK:STDOUT: %.loc16_34.2: type = value_of_initializer %float.make_type.loc16_34 [template = f64] +// CHECK:STDOUT: %.loc16_34.3: type = converted %float.make_type.loc16_34, %.loc16_34.2 [template = f64] // CHECK:STDOUT: } // CHECK:STDOUT: %b: f64 = bind_name b, %b.param // CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2 @@ -302,7 +302,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: f64, %b.param_patt: f64) -> bool { +// CHECK:STDOUT: fn @RuntimeCallIsValid(%a.param_patt: f64, %b.param_patt: f64) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Less.ref: %Less.type = name_ref Less, file.%Less.decl [template = constants.%Less] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a diff --git a/toolchain/check/testdata/builtins/float/less_eq.carbon b/toolchain/check/testdata/builtins/float/less_eq.carbon index bfc6829dfc7b6..fbfa262c3da8c 100644 --- a/toolchain/check/testdata/builtins/float/less_eq.carbon +++ b/toolchain/check/testdata/builtins/float/less_eq.carbon @@ -24,7 +24,7 @@ fn F(true_: True, false_: False) { false_ as (if LessEq(0.0, Negate(1.0)) then True else False); } -fn RuntimeCall(a: f64, b: f64) -> bool { +fn RuntimeCallIsValid(a: f64, b: f64) -> bool { return LessEq(a, b); } @@ -52,8 +52,8 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %float.3: f64 = float_literal 0 [template] // CHECK:STDOUT: %false: bool = bool_literal false [template] // CHECK:STDOUT: %float.4: f64 = float_literal -1 [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallIsValid.type: type = fn_type @RuntimeCallIsValid [template] +// CHECK:STDOUT: %RuntimeCallIsValid: %RuntimeCallIsValid.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -73,7 +73,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl // CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl +// CHECK:STDOUT: .RuntimeCallIsValid = %RuntimeCallIsValid.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %LessEq.decl: %LessEq.type = fn_decl @LessEq [template = constants.%LessEq] { @@ -142,7 +142,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %False.ref.loc8: type = name_ref False, file.%False.decl [template = constants.%False] // CHECK:STDOUT: %false_: %False = bind_name false_, %false_.param // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { +// 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 @@ -151,22 +151,22 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // 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: %.loc16_35.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type, %.loc16_35.1 [template = bool] +// CHECK:STDOUT: %.loc16_42.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc16_42.2: type = converted %bool.make_type, %.loc16_42.1 [template = bool] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc16_19.1: type = splice_block %.loc16_19.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc16_19: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc16_19: init type = call constants.%Float(%int_64.loc16_19) [template = f64] -// CHECK:STDOUT: %.loc16_19.2: type = value_of_initializer %float.make_type.loc16_19 [template = f64] -// CHECK:STDOUT: %.loc16_19.3: type = converted %float.make_type.loc16_19, %.loc16_19.2 [template = f64] +// CHECK:STDOUT: %.loc16_26.1: type = splice_block %.loc16_26.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc16_26: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc16_26: init type = call constants.%Float(%int_64.loc16_26) [template = f64] +// CHECK:STDOUT: %.loc16_26.2: type = value_of_initializer %float.make_type.loc16_26 [template = f64] +// CHECK:STDOUT: %.loc16_26.3: type = converted %float.make_type.loc16_26, %.loc16_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: %.loc16_27.1: type = splice_block %.loc16_27.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc16_27: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc16_27: init type = call constants.%Float(%int_64.loc16_27) [template = f64] -// CHECK:STDOUT: %.loc16_27.2: type = value_of_initializer %float.make_type.loc16_27 [template = f64] -// CHECK:STDOUT: %.loc16_27.3: type = converted %float.make_type.loc16_27, %.loc16_27.2 [template = f64] +// CHECK:STDOUT: %.loc16_34.1: type = splice_block %.loc16_34.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc16_34: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc16_34: init type = call constants.%Float(%int_64.loc16_34) [template = f64] +// CHECK:STDOUT: %.loc16_34.2: type = value_of_initializer %float.make_type.loc16_34 [template = f64] +// CHECK:STDOUT: %.loc16_34.3: type = converted %float.make_type.loc16_34, %.loc16_34.2 [template = f64] // CHECK:STDOUT: } // CHECK:STDOUT: %b: f64 = bind_name b, %b.param // CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2 @@ -302,7 +302,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: f64, %b.param_patt: f64) -> bool { +// CHECK:STDOUT: fn @RuntimeCallIsValid(%a.param_patt: f64, %b.param_patt: f64) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %LessEq.ref: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a diff --git a/toolchain/check/testdata/builtins/float/mul.carbon b/toolchain/check/testdata/builtins/float/mul.carbon index 03dc958966f7c..d1a42c514827c 100644 --- a/toolchain/check/testdata/builtins/float/mul.carbon +++ b/toolchain/check/testdata/builtins/float/mul.carbon @@ -12,7 +12,7 @@ fn Mul(a: f64, b: f64) -> f64 = "float.mul"; -fn RuntimeCall(a: f64, b: f64) -> f64 { +fn RuntimeCallIsValid(a: f64, b: f64) -> f64 { return Mul(a, b); } @@ -38,15 +38,15 @@ fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.mul"; fn BadReturnType(a: f64, b: f64) -> bool = "float.mul"; fn JustRight(a: f64, b: f64) -> f64 = "float.mul"; -fn RuntimeCallTooFew(a: f64) -> f64 { +fn RuntimeCallIsValidTooFew(a: f64) -> f64 { return TooFew(a); } -fn RuntimeCallTooMany(a: f64, b: f64, c: f64) -> f64 { +fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 { return TooMany(a, b, c); } -fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { +fn RuntimeCallIsValidBadReturnType(a: f64, b: f64) -> bool { return BadReturnType(a, b); } @@ -58,8 +58,8 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallIsValid.type: type = fn_type @RuntimeCallIsValid [template] +// CHECK:STDOUT: %RuntimeCallIsValid: %RuntimeCallIsValid.type = struct_value () [template] // CHECK:STDOUT: %float.1: f64 = float_literal 2 [template] // CHECK:STDOUT: %float.2: f64 = float_literal 0.5 [template] // CHECK:STDOUT: %float.3: f64 = float_literal 1 [template] @@ -77,7 +77,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .Mul = %Mul.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl +// CHECK:STDOUT: .RuntimeCallIsValid = %RuntimeCallIsValid.decl // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core @@ -112,7 +112,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param2 // CHECK:STDOUT: %return: ref f64 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { +// 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 @@ -120,24 +120,24 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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_35: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc4_35: init type = call constants.%Float(%int_64.loc4_35) [template = f64] -// CHECK:STDOUT: %.loc4_35.1: type = value_of_initializer %float.make_type.loc4_35 [template = f64] -// CHECK:STDOUT: %.loc4_35.2: type = converted %float.make_type.loc4_35, %.loc4_35.1 [template = f64] +// 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_19.1: type = splice_block %.loc4_19.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc4_19: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc4_19: init type = call constants.%Float(%int_64.loc4_19) [template = f64] -// CHECK:STDOUT: %.loc4_19.2: type = value_of_initializer %float.make_type.loc4_19 [template = f64] -// CHECK:STDOUT: %.loc4_19.3: type = converted %float.make_type.loc4_19, %.loc4_19.2 [template = f64] +// 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_27.1: type = splice_block %.loc4_27.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc4_27: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc4_27: init type = call constants.%Float(%int_64.loc4_27) [template = f64] -// CHECK:STDOUT: %.loc4_27.2: type = value_of_initializer %float.make_type.loc4_27 [template = f64] -// CHECK:STDOUT: %.loc4_27.3: type = converted %float.make_type.loc4_27, %.loc4_27.2 [template = f64] +// 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 @@ -149,7 +149,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @Mul(%a.param_patt: f64, %b.param_patt: f64) -> f64 = "float.mul"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: f64, %b.param_patt: f64) -> f64 { +// 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 @@ -186,12 +186,12 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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: %RuntimeCallTooFew.type: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %RuntimeCallTooFew: %RuntimeCallTooFew.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallTooMany.type: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %RuntimeCallTooMany: %RuntimeCallTooMany.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType.type: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType: %RuntimeCallBadReturnType.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 { @@ -210,9 +210,9 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: .TooMany = %TooMany.decl // CHECK:STDOUT: .BadReturnType = %BadReturnType.decl // CHECK:STDOUT: .JustRight = %JustRight.decl -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.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] { @@ -338,28 +338,28 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param2 // CHECK:STDOUT: %return: ref f64 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooFew.decl: %RuntimeCallTooFew.type = fn_decl @RuntimeCallTooFew [template = constants.%RuntimeCallTooFew] { +// 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.loc20_33: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc20_33: init type = call constants.%Float(%int_64.loc20_33) [template = f64] -// CHECK:STDOUT: %.loc20_33.1: type = value_of_initializer %float.make_type.loc20_33 [template = f64] -// CHECK:STDOUT: %.loc20_33.2: type = converted %float.make_type.loc20_33, %.loc20_33.1 [template = f64] +// CHECK:STDOUT: %int_64.loc20_40: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc20_40: init type = call constants.%Float(%int_64.loc20_40) [template = f64] +// CHECK:STDOUT: %.loc20_40.1: type = value_of_initializer %float.make_type.loc20_40 [template = f64] +// CHECK:STDOUT: %.loc20_40.2: type = converted %float.make_type.loc20_40, %.loc20_40.1 [template = f64] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc20_25.1: type = splice_block %.loc20_25.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc20_25: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc20_25: init type = call constants.%Float(%int_64.loc20_25) [template = f64] -// CHECK:STDOUT: %.loc20_25.2: type = value_of_initializer %float.make_type.loc20_25 [template = f64] -// CHECK:STDOUT: %.loc20_25.3: type = converted %float.make_type.loc20_25, %.loc20_25.2 [template = f64] +// CHECK:STDOUT: %.loc20_32.1: type = splice_block %.loc20_32.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc20_32: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc20_32: init type = call constants.%Float(%int_64.loc20_32) [template = f64] +// CHECK:STDOUT: %.loc20_32.2: type = value_of_initializer %float.make_type.loc20_32 [template = f64] +// CHECK:STDOUT: %.loc20_32.3: type = converted %float.make_type.loc20_32, %.loc20_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: %RuntimeCallTooMany.decl: %RuntimeCallTooMany.type = fn_decl @RuntimeCallTooMany [template = constants.%RuntimeCallTooMany] { +// 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 @@ -369,38 +369,38 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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.loc24_50: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc24_50: init type = call constants.%Float(%int_64.loc24_50) [template = f64] -// CHECK:STDOUT: %.loc24_50.1: type = value_of_initializer %float.make_type.loc24_50 [template = f64] -// CHECK:STDOUT: %.loc24_50.2: type = converted %float.make_type.loc24_50, %.loc24_50.1 [template = f64] +// CHECK:STDOUT: %int_64.loc24_57: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc24_57: init type = call constants.%Float(%int_64.loc24_57) [template = f64] +// CHECK:STDOUT: %.loc24_57.1: type = value_of_initializer %float.make_type.loc24_57 [template = f64] +// CHECK:STDOUT: %.loc24_57.2: type = converted %float.make_type.loc24_57, %.loc24_57.1 [template = f64] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc24_26.1: type = splice_block %.loc24_26.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc24_26: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc24_26: init type = call constants.%Float(%int_64.loc24_26) [template = f64] -// CHECK:STDOUT: %.loc24_26.2: type = value_of_initializer %float.make_type.loc24_26 [template = f64] -// CHECK:STDOUT: %.loc24_26.3: type = converted %float.make_type.loc24_26, %.loc24_26.2 [template = f64] +// CHECK:STDOUT: %.loc24_33.1: type = splice_block %.loc24_33.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc24_33: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc24_33: init type = call constants.%Float(%int_64.loc24_33) [template = f64] +// CHECK:STDOUT: %.loc24_33.2: type = value_of_initializer %float.make_type.loc24_33 [template = f64] +// CHECK:STDOUT: %.loc24_33.3: type = converted %float.make_type.loc24_33, %.loc24_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: %.loc24_34.1: type = splice_block %.loc24_34.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc24_34: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc24_34: init type = call constants.%Float(%int_64.loc24_34) [template = f64] -// CHECK:STDOUT: %.loc24_34.2: type = value_of_initializer %float.make_type.loc24_34 [template = f64] -// CHECK:STDOUT: %.loc24_34.3: type = converted %float.make_type.loc24_34, %.loc24_34.2 [template = f64] +// CHECK:STDOUT: %.loc24_41.1: type = splice_block %.loc24_41.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc24_41: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc24_41: init type = call constants.%Float(%int_64.loc24_41) [template = f64] +// CHECK:STDOUT: %.loc24_41.2: type = value_of_initializer %float.make_type.loc24_41 [template = f64] +// CHECK:STDOUT: %.loc24_41.3: type = converted %float.make_type.loc24_41, %.loc24_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: %.loc24_42.1: type = splice_block %.loc24_42.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc24_42: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc24_42: init type = call constants.%Float(%int_64.loc24_42) [template = f64] -// CHECK:STDOUT: %.loc24_42.2: type = value_of_initializer %float.make_type.loc24_42 [template = f64] -// CHECK:STDOUT: %.loc24_42.3: type = converted %float.make_type.loc24_42, %.loc24_42.2 [template = f64] +// CHECK:STDOUT: %.loc24_49.1: type = splice_block %.loc24_49.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc24_49: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc24_49: init type = call constants.%Float(%int_64.loc24_49) [template = f64] +// CHECK:STDOUT: %.loc24_49.2: type = value_of_initializer %float.make_type.loc24_49 [template = f64] +// CHECK:STDOUT: %.loc24_49.3: type = converted %float.make_type.loc24_49, %.loc24_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: %RuntimeCallBadReturnType.decl: %RuntimeCallBadReturnType.type = fn_decl @RuntimeCallBadReturnType [template = constants.%RuntimeCallBadReturnType] { +// 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 @@ -409,22 +409,22 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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: %.loc28_48.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc28_48.2: type = converted %bool.make_type, %.loc28_48.1 [template = bool] +// CHECK:STDOUT: %.loc28_55.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc28_55.2: type = converted %bool.make_type, %.loc28_55.1 [template = bool] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc28_32.1: type = splice_block %.loc28_32.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc28_32: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc28_32: init type = call constants.%Float(%int_64.loc28_32) [template = f64] -// CHECK:STDOUT: %.loc28_32.2: type = value_of_initializer %float.make_type.loc28_32 [template = f64] -// CHECK:STDOUT: %.loc28_32.3: type = converted %float.make_type.loc28_32, %.loc28_32.2 [template = f64] +// CHECK:STDOUT: %.loc28_39.1: type = splice_block %.loc28_39.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc28_39: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc28_39: init type = call constants.%Float(%int_64.loc28_39) [template = f64] +// CHECK:STDOUT: %.loc28_39.2: type = value_of_initializer %float.make_type.loc28_39 [template = f64] +// CHECK:STDOUT: %.loc28_39.3: type = converted %float.make_type.loc28_39, %.loc28_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: %.loc28_40.1: type = splice_block %.loc28_40.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc28_40: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc28_40: init type = call constants.%Float(%int_64.loc28_40) [template = f64] -// CHECK:STDOUT: %.loc28_40.2: type = value_of_initializer %float.make_type.loc28_40 [template = f64] -// CHECK:STDOUT: %.loc28_40.3: type = converted %float.make_type.loc28_40, %.loc28_40.2 [template = f64] +// CHECK:STDOUT: %.loc28_47.1: type = splice_block %.loc28_47.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc28_47: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc28_47: init type = call constants.%Float(%int_64.loc28_47) [template = f64] +// CHECK:STDOUT: %.loc28_47.2: type = value_of_initializer %float.make_type.loc28_47 [template = f64] +// CHECK:STDOUT: %.loc28_47.3: type = converted %float.make_type.loc28_47, %.loc28_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 @@ -440,7 +440,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @JustRight(%a.param_patt: f64, %b.param_patt: f64) -> f64 = "float.mul"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooFew(%a.param_patt: f64) -> f64 { +// 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 @@ -450,7 +450,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: return %.loc21_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooMany(%a.param_patt: f64, %b.param_patt: f64, %c.param_patt: f64) -> f64 { +// 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 @@ -462,7 +462,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: return %.loc25_26.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a.param_patt: f64, %b.param_patt: f64) -> bool { +// 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 diff --git a/toolchain/check/testdata/builtins/float/negate.carbon b/toolchain/check/testdata/builtins/float/negate.carbon index 65db87190d176..3d48c413aacce 100644 --- a/toolchain/check/testdata/builtins/float/negate.carbon +++ b/toolchain/check/testdata/builtins/float/negate.carbon @@ -12,7 +12,7 @@ fn Negate(a: f64) -> f64 = "float.negate"; -fn RuntimeCall(a: f64, b: f64) -> f64 { +fn RuntimeCallIsValid(a: f64, b: f64) -> f64 { return Negate(a); } @@ -39,7 +39,7 @@ fn TooMany(a: f64, b: f64) -> f64 = "float.negate"; fn BadReturnType(a: f64) -> bool = "float.negate"; fn JustRight(a: f64) -> f64 = "float.negate"; -fn RuntimeCallTooFew(a: f64) -> f64 { +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: ^~~~~~~~~ @@ -50,7 +50,7 @@ fn RuntimeCallTooFew(a: f64) -> f64 { return TooFew(a); } -fn RuntimeCallTooMany(a: f64, b: f64, c: f64) -> f64 { +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: ^~~~~~~~~~~~~~~~ @@ -61,7 +61,7 @@ fn RuntimeCallTooMany(a: f64, b: f64, c: f64) -> f64 { return TooMany(a, b, c); } -fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { +fn RuntimeCallIsValidBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+6]]:10: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch] // CHECK:STDERR: return BadReturnType(a, b); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ @@ -79,8 +79,8 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallIsValid.type: type = fn_type @RuntimeCallIsValid [template] +// CHECK:STDOUT: %RuntimeCallIsValid: %RuntimeCallIsValid.type = struct_value () [template] // CHECK:STDOUT: %float.1: f64 = float_literal 1.5 [template] // CHECK:STDOUT: %float.2: f64 = float_literal -1.5 [template] // CHECK:STDOUT: } @@ -97,7 +97,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl +// CHECK:STDOUT: .RuntimeCallIsValid = %RuntimeCallIsValid.decl // CHECK:STDOUT: .a = @__global_init.%a // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core @@ -122,7 +122,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param1 // CHECK:STDOUT: %return: ref f64 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { +// 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 @@ -130,24 +130,24 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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_35: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc4_35: init type = call constants.%Float(%int_64.loc4_35) [template = f64] -// CHECK:STDOUT: %.loc4_35.1: type = value_of_initializer %float.make_type.loc4_35 [template = f64] -// CHECK:STDOUT: %.loc4_35.2: type = converted %float.make_type.loc4_35, %.loc4_35.1 [template = f64] +// 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_19.1: type = splice_block %.loc4_19.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc4_19: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc4_19: init type = call constants.%Float(%int_64.loc4_19) [template = f64] -// CHECK:STDOUT: %.loc4_19.2: type = value_of_initializer %float.make_type.loc4_19 [template = f64] -// CHECK:STDOUT: %.loc4_19.3: type = converted %float.make_type.loc4_19, %.loc4_19.2 [template = f64] +// 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_27.1: type = splice_block %.loc4_27.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc4_27: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc4_27: init type = call constants.%Float(%int_64.loc4_27) [template = f64] -// CHECK:STDOUT: %.loc4_27.2: type = value_of_initializer %float.make_type.loc4_27 [template = f64] -// CHECK:STDOUT: %.loc4_27.3: type = converted %float.make_type.loc4_27, %.loc4_27.2 [template = f64] +// 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 @@ -157,7 +157,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @Negate(%a.param_patt: f64) -> f64 = "float.negate"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: f64, %b.param_patt: f64) -> f64 { +// 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 @@ -194,12 +194,12 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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: %RuntimeCallTooFew.type: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %RuntimeCallTooFew: %RuntimeCallTooFew.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallTooMany.type: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %RuntimeCallTooMany: %RuntimeCallTooMany.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType.type: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType: %RuntimeCallBadReturnType.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 { @@ -218,9 +218,9 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: .TooMany = %TooMany.decl // CHECK:STDOUT: .BadReturnType = %BadReturnType.decl // CHECK:STDOUT: .JustRight = %JustRight.decl -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.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] { @@ -306,28 +306,28 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param1 // CHECK:STDOUT: %return: ref f64 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooFew.decl: %RuntimeCallTooFew.type = fn_decl @RuntimeCallTooFew [template = constants.%RuntimeCallTooFew] { +// 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_33: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc21_33: init type = call constants.%Float(%int_64.loc21_33) [template = f64] -// CHECK:STDOUT: %.loc21_33.1: type = value_of_initializer %float.make_type.loc21_33 [template = f64] -// CHECK:STDOUT: %.loc21_33.2: type = converted %float.make_type.loc21_33, %.loc21_33.1 [template = f64] +// 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_25.1: type = splice_block %.loc21_25.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc21_25: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc21_25: init type = call constants.%Float(%int_64.loc21_25) [template = f64] -// CHECK:STDOUT: %.loc21_25.2: type = value_of_initializer %float.make_type.loc21_25 [template = f64] -// CHECK:STDOUT: %.loc21_25.3: type = converted %float.make_type.loc21_25, %.loc21_25.2 [template = f64] +// 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: %RuntimeCallTooMany.decl: %RuntimeCallTooMany.type = fn_decl @RuntimeCallTooMany [template = constants.%RuntimeCallTooMany] { +// 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 @@ -337,38 +337,38 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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_50: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc32_50: init type = call constants.%Float(%int_64.loc32_50) [template = f64] -// CHECK:STDOUT: %.loc32_50.1: type = value_of_initializer %float.make_type.loc32_50 [template = f64] -// CHECK:STDOUT: %.loc32_50.2: type = converted %float.make_type.loc32_50, %.loc32_50.1 [template = f64] +// 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_26.1: type = splice_block %.loc32_26.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc32_26: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc32_26: init type = call constants.%Float(%int_64.loc32_26) [template = f64] -// CHECK:STDOUT: %.loc32_26.2: type = value_of_initializer %float.make_type.loc32_26 [template = f64] -// CHECK:STDOUT: %.loc32_26.3: type = converted %float.make_type.loc32_26, %.loc32_26.2 [template = f64] +// 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_34.1: type = splice_block %.loc32_34.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc32_34: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc32_34: init type = call constants.%Float(%int_64.loc32_34) [template = f64] -// CHECK:STDOUT: %.loc32_34.2: type = value_of_initializer %float.make_type.loc32_34 [template = f64] -// CHECK:STDOUT: %.loc32_34.3: type = converted %float.make_type.loc32_34, %.loc32_34.2 [template = f64] +// 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_42.1: type = splice_block %.loc32_42.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc32_42: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc32_42: init type = call constants.%Float(%int_64.loc32_42) [template = f64] -// CHECK:STDOUT: %.loc32_42.2: type = value_of_initializer %float.make_type.loc32_42 [template = f64] -// CHECK:STDOUT: %.loc32_42.3: type = converted %float.make_type.loc32_42, %.loc32_42.2 [template = f64] +// 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: %RuntimeCallBadReturnType.decl: %RuntimeCallBadReturnType.type = fn_decl @RuntimeCallBadReturnType [template = constants.%RuntimeCallBadReturnType] { +// 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 @@ -377,22 +377,22 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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_48.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc43_48.2: type = converted %bool.make_type, %.loc43_48.1 [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_32.1: type = splice_block %.loc43_32.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc43_32: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc43_32: init type = call constants.%Float(%int_64.loc43_32) [template = f64] -// CHECK:STDOUT: %.loc43_32.2: type = value_of_initializer %float.make_type.loc43_32 [template = f64] -// CHECK:STDOUT: %.loc43_32.3: type = converted %float.make_type.loc43_32, %.loc43_32.2 [template = f64] +// 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_40.1: type = splice_block %.loc43_40.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc43_40: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc43_40: init type = call constants.%Float(%int_64.loc43_40) [template = f64] -// CHECK:STDOUT: %.loc43_40.2: type = value_of_initializer %float.make_type.loc43_40 [template = f64] -// CHECK:STDOUT: %.loc43_40.3: type = converted %float.make_type.loc43_40, %.loc43_40.2 [template = f64] +// 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 @@ -408,14 +408,14 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @JustRight(%a.param_patt: f64) -> f64 = "float.negate"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooFew(%a.param_patt: f64) -> f64 { +// 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 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooMany(%a.param_patt: f64, %b.param_patt: f64, %c.param_patt: f64) -> f64 { +// 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 @@ -424,7 +424,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a.param_patt: f64, %b.param_patt: f64) -> bool { +// 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 diff --git a/toolchain/check/testdata/builtins/float/neq.carbon b/toolchain/check/testdata/builtins/float/neq.carbon index e0364272e5f60..7e6d5002d58d6 100644 --- a/toolchain/check/testdata/builtins/float/neq.carbon +++ b/toolchain/check/testdata/builtins/float/neq.carbon @@ -20,7 +20,7 @@ fn F(true_: True, false_: False) { false_ as (if Neq(1.0, 1.0) then True else False); } -fn RuntimeCall(a: f64, b: f64) -> bool { +fn RuntimeCallIsValid(a: f64, b: f64) -> bool { return Neq(a, b); } @@ -53,8 +53,8 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: %float.2: f64 = float_literal 2 [template] // CHECK:STDOUT: %true: bool = bool_literal true [template] // CHECK:STDOUT: %false: bool = bool_literal false [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallIsValid.type: type = fn_type @RuntimeCallIsValid [template] +// CHECK:STDOUT: %RuntimeCallIsValid: %RuntimeCallIsValid.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -73,7 +73,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl // CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl +// CHECK:STDOUT: .RuntimeCallIsValid = %RuntimeCallIsValid.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Neq.decl: %Neq.type = fn_decl @Neq [template = constants.%Neq] { @@ -121,7 +121,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: %False.ref.loc7: type = name_ref False, file.%False.decl [template = constants.%False] // CHECK:STDOUT: %false_: %False = bind_name false_, %false_.param // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { +// 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 @@ -130,22 +130,22 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // 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: %.loc12_35.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc12_35.2: type = converted %bool.make_type, %.loc12_35.1 [template = bool] +// CHECK:STDOUT: %.loc12_42.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc12_42.2: type = converted %bool.make_type, %.loc12_42.1 [template = bool] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc12_19.1: type = splice_block %.loc12_19.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc12_19: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc12_19: init type = call constants.%Float(%int_64.loc12_19) [template = f64] -// CHECK:STDOUT: %.loc12_19.2: type = value_of_initializer %float.make_type.loc12_19 [template = f64] -// CHECK:STDOUT: %.loc12_19.3: type = converted %float.make_type.loc12_19, %.loc12_19.2 [template = f64] +// CHECK:STDOUT: %.loc12_26.1: type = splice_block %.loc12_26.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc12_26: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc12_26: init type = call constants.%Float(%int_64.loc12_26) [template = f64] +// CHECK:STDOUT: %.loc12_26.2: type = value_of_initializer %float.make_type.loc12_26 [template = f64] +// CHECK:STDOUT: %.loc12_26.3: type = converted %float.make_type.loc12_26, %.loc12_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: %.loc12_27.1: type = splice_block %.loc12_27.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc12_27: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc12_27: init type = call constants.%Float(%int_64.loc12_27) [template = f64] -// CHECK:STDOUT: %.loc12_27.2: type = value_of_initializer %float.make_type.loc12_27 [template = f64] -// CHECK:STDOUT: %.loc12_27.3: type = converted %float.make_type.loc12_27, %.loc12_27.2 [template = f64] +// CHECK:STDOUT: %.loc12_34.1: type = splice_block %.loc12_34.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc12_34: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc12_34: init type = call constants.%Float(%int_64.loc12_34) [template = f64] +// CHECK:STDOUT: %.loc12_34.2: type = value_of_initializer %float.make_type.loc12_34 [template = f64] +// CHECK:STDOUT: %.loc12_34.3: type = converted %float.make_type.loc12_34, %.loc12_34.2 [template = f64] // CHECK:STDOUT: } // CHECK:STDOUT: %b: f64 = bind_name b, %b.param // CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2 @@ -214,7 +214,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: f64, %b.param_patt: f64) -> bool { +// CHECK:STDOUT: fn @RuntimeCallIsValid(%a.param_patt: f64, %b.param_patt: f64) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Neq.ref: %Neq.type = name_ref Neq, file.%Neq.decl [template = constants.%Neq] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a diff --git a/toolchain/check/testdata/builtins/float/sub.carbon b/toolchain/check/testdata/builtins/float/sub.carbon index 07303628f1cc6..03add0c7e2126 100644 --- a/toolchain/check/testdata/builtins/float/sub.carbon +++ b/toolchain/check/testdata/builtins/float/sub.carbon @@ -12,7 +12,7 @@ fn Sub(a: f64, b: f64) -> f64 = "float.sub"; -fn RuntimeCall(a: f64, b: f64) -> f64 { +fn RuntimeCallIsValid(a: f64, b: f64) -> f64 { return Sub(a, b); } @@ -38,15 +38,15 @@ fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.sub"; fn BadReturnType(a: f64, b: f64) -> bool = "float.sub"; fn JustRight(a: f64, b: f64) -> f64 = "float.sub"; -fn RuntimeCallTooFew(a: f64) -> f64 { +fn RuntimeCallIsValidTooFew(a: f64) -> f64 { return TooFew(a); } -fn RuntimeCallTooMany(a: f64, b: f64, c: f64) -> f64 { +fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 { return TooMany(a, b, c); } -fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { +fn RuntimeCallIsValidBadReturnType(a: f64, b: f64) -> bool { return BadReturnType(a, b); } @@ -58,8 +58,8 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: %Float: %Float.type = struct_value () [template] // CHECK:STDOUT: %Sub.type: type = fn_type @Sub [template] // CHECK:STDOUT: %Sub: %Sub.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallIsValid.type: type = fn_type @RuntimeCallIsValid [template] +// CHECK:STDOUT: %RuntimeCallIsValid: %RuntimeCallIsValid.type = struct_value () [template] // CHECK:STDOUT: %float.1: f64 = float_literal 2 [template] // CHECK:STDOUT: %float.2: f64 = float_literal 0.5 [template] // CHECK:STDOUT: %float.3: f64 = float_literal 1.5 [template] @@ -77,7 +77,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .Sub = %Sub.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl +// CHECK:STDOUT: .RuntimeCallIsValid = %RuntimeCallIsValid.decl // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core @@ -112,7 +112,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param2 // CHECK:STDOUT: %return: ref f64 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { +// 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 @@ -120,24 +120,24 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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_35: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc4_35: init type = call constants.%Float(%int_64.loc4_35) [template = f64] -// CHECK:STDOUT: %.loc4_35.1: type = value_of_initializer %float.make_type.loc4_35 [template = f64] -// CHECK:STDOUT: %.loc4_35.2: type = converted %float.make_type.loc4_35, %.loc4_35.1 [template = f64] +// 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_19.1: type = splice_block %.loc4_19.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc4_19: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc4_19: init type = call constants.%Float(%int_64.loc4_19) [template = f64] -// CHECK:STDOUT: %.loc4_19.2: type = value_of_initializer %float.make_type.loc4_19 [template = f64] -// CHECK:STDOUT: %.loc4_19.3: type = converted %float.make_type.loc4_19, %.loc4_19.2 [template = f64] +// 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_27.1: type = splice_block %.loc4_27.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc4_27: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc4_27: init type = call constants.%Float(%int_64.loc4_27) [template = f64] -// CHECK:STDOUT: %.loc4_27.2: type = value_of_initializer %float.make_type.loc4_27 [template = f64] -// CHECK:STDOUT: %.loc4_27.3: type = converted %float.make_type.loc4_27, %.loc4_27.2 [template = f64] +// 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 @@ -149,7 +149,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @Sub(%a.param_patt: f64, %b.param_patt: f64) -> f64 = "float.sub"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: f64, %b.param_patt: f64) -> f64 { +// CHECK:STDOUT: fn @RuntimeCallIsValid(%a.param_patt: f64, %b.param_patt: f64) -> f64 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Sub.ref: %Sub.type = name_ref Sub, file.%Sub.decl [template = constants.%Sub] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a @@ -186,12 +186,12 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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: %RuntimeCallTooFew.type: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %RuntimeCallTooFew: %RuntimeCallTooFew.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallTooMany.type: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %RuntimeCallTooMany: %RuntimeCallTooMany.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType.type: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType: %RuntimeCallBadReturnType.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 { @@ -210,9 +210,9 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: .TooMany = %TooMany.decl // CHECK:STDOUT: .BadReturnType = %BadReturnType.decl // CHECK:STDOUT: .JustRight = %JustRight.decl -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.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] { @@ -338,28 +338,28 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: %return.param: ref f64 = out_param runtime_param2 // CHECK:STDOUT: %return: ref f64 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooFew.decl: %RuntimeCallTooFew.type = fn_decl @RuntimeCallTooFew [template = constants.%RuntimeCallTooFew] { +// 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.loc20_33: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc20_33: init type = call constants.%Float(%int_64.loc20_33) [template = f64] -// CHECK:STDOUT: %.loc20_33.1: type = value_of_initializer %float.make_type.loc20_33 [template = f64] -// CHECK:STDOUT: %.loc20_33.2: type = converted %float.make_type.loc20_33, %.loc20_33.1 [template = f64] +// CHECK:STDOUT: %int_64.loc20_40: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc20_40: init type = call constants.%Float(%int_64.loc20_40) [template = f64] +// CHECK:STDOUT: %.loc20_40.1: type = value_of_initializer %float.make_type.loc20_40 [template = f64] +// CHECK:STDOUT: %.loc20_40.2: type = converted %float.make_type.loc20_40, %.loc20_40.1 [template = f64] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc20_25.1: type = splice_block %.loc20_25.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc20_25: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc20_25: init type = call constants.%Float(%int_64.loc20_25) [template = f64] -// CHECK:STDOUT: %.loc20_25.2: type = value_of_initializer %float.make_type.loc20_25 [template = f64] -// CHECK:STDOUT: %.loc20_25.3: type = converted %float.make_type.loc20_25, %.loc20_25.2 [template = f64] +// CHECK:STDOUT: %.loc20_32.1: type = splice_block %.loc20_32.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc20_32: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc20_32: init type = call constants.%Float(%int_64.loc20_32) [template = f64] +// CHECK:STDOUT: %.loc20_32.2: type = value_of_initializer %float.make_type.loc20_32 [template = f64] +// CHECK:STDOUT: %.loc20_32.3: type = converted %float.make_type.loc20_32, %.loc20_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: %RuntimeCallTooMany.decl: %RuntimeCallTooMany.type = fn_decl @RuntimeCallTooMany [template = constants.%RuntimeCallTooMany] { +// 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 @@ -369,38 +369,38 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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.loc24_50: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc24_50: init type = call constants.%Float(%int_64.loc24_50) [template = f64] -// CHECK:STDOUT: %.loc24_50.1: type = value_of_initializer %float.make_type.loc24_50 [template = f64] -// CHECK:STDOUT: %.loc24_50.2: type = converted %float.make_type.loc24_50, %.loc24_50.1 [template = f64] +// CHECK:STDOUT: %int_64.loc24_57: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc24_57: init type = call constants.%Float(%int_64.loc24_57) [template = f64] +// CHECK:STDOUT: %.loc24_57.1: type = value_of_initializer %float.make_type.loc24_57 [template = f64] +// CHECK:STDOUT: %.loc24_57.2: type = converted %float.make_type.loc24_57, %.loc24_57.1 [template = f64] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc24_26.1: type = splice_block %.loc24_26.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc24_26: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc24_26: init type = call constants.%Float(%int_64.loc24_26) [template = f64] -// CHECK:STDOUT: %.loc24_26.2: type = value_of_initializer %float.make_type.loc24_26 [template = f64] -// CHECK:STDOUT: %.loc24_26.3: type = converted %float.make_type.loc24_26, %.loc24_26.2 [template = f64] +// CHECK:STDOUT: %.loc24_33.1: type = splice_block %.loc24_33.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc24_33: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc24_33: init type = call constants.%Float(%int_64.loc24_33) [template = f64] +// CHECK:STDOUT: %.loc24_33.2: type = value_of_initializer %float.make_type.loc24_33 [template = f64] +// CHECK:STDOUT: %.loc24_33.3: type = converted %float.make_type.loc24_33, %.loc24_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: %.loc24_34.1: type = splice_block %.loc24_34.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc24_34: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc24_34: init type = call constants.%Float(%int_64.loc24_34) [template = f64] -// CHECK:STDOUT: %.loc24_34.2: type = value_of_initializer %float.make_type.loc24_34 [template = f64] -// CHECK:STDOUT: %.loc24_34.3: type = converted %float.make_type.loc24_34, %.loc24_34.2 [template = f64] +// CHECK:STDOUT: %.loc24_41.1: type = splice_block %.loc24_41.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc24_41: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc24_41: init type = call constants.%Float(%int_64.loc24_41) [template = f64] +// CHECK:STDOUT: %.loc24_41.2: type = value_of_initializer %float.make_type.loc24_41 [template = f64] +// CHECK:STDOUT: %.loc24_41.3: type = converted %float.make_type.loc24_41, %.loc24_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: %.loc24_42.1: type = splice_block %.loc24_42.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc24_42: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc24_42: init type = call constants.%Float(%int_64.loc24_42) [template = f64] -// CHECK:STDOUT: %.loc24_42.2: type = value_of_initializer %float.make_type.loc24_42 [template = f64] -// CHECK:STDOUT: %.loc24_42.3: type = converted %float.make_type.loc24_42, %.loc24_42.2 [template = f64] +// CHECK:STDOUT: %.loc24_49.1: type = splice_block %.loc24_49.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc24_49: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc24_49: init type = call constants.%Float(%int_64.loc24_49) [template = f64] +// CHECK:STDOUT: %.loc24_49.2: type = value_of_initializer %float.make_type.loc24_49 [template = f64] +// CHECK:STDOUT: %.loc24_49.3: type = converted %float.make_type.loc24_49, %.loc24_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: %RuntimeCallBadReturnType.decl: %RuntimeCallBadReturnType.type = fn_decl @RuntimeCallBadReturnType [template = constants.%RuntimeCallBadReturnType] { +// 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 @@ -409,22 +409,22 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // 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: %.loc28_48.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc28_48.2: type = converted %bool.make_type, %.loc28_48.1 [template = bool] +// CHECK:STDOUT: %.loc28_55.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc28_55.2: type = converted %bool.make_type, %.loc28_55.1 [template = bool] // CHECK:STDOUT: %a.param: f64 = value_param runtime_param0 -// CHECK:STDOUT: %.loc28_32.1: type = splice_block %.loc28_32.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc28_32: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc28_32: init type = call constants.%Float(%int_64.loc28_32) [template = f64] -// CHECK:STDOUT: %.loc28_32.2: type = value_of_initializer %float.make_type.loc28_32 [template = f64] -// CHECK:STDOUT: %.loc28_32.3: type = converted %float.make_type.loc28_32, %.loc28_32.2 [template = f64] +// CHECK:STDOUT: %.loc28_39.1: type = splice_block %.loc28_39.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc28_39: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc28_39: init type = call constants.%Float(%int_64.loc28_39) [template = f64] +// CHECK:STDOUT: %.loc28_39.2: type = value_of_initializer %float.make_type.loc28_39 [template = f64] +// CHECK:STDOUT: %.loc28_39.3: type = converted %float.make_type.loc28_39, %.loc28_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: %.loc28_40.1: type = splice_block %.loc28_40.3 [template = f64] { -// CHECK:STDOUT: %int_64.loc28_40: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc28_40: init type = call constants.%Float(%int_64.loc28_40) [template = f64] -// CHECK:STDOUT: %.loc28_40.2: type = value_of_initializer %float.make_type.loc28_40 [template = f64] -// CHECK:STDOUT: %.loc28_40.3: type = converted %float.make_type.loc28_40, %.loc28_40.2 [template = f64] +// CHECK:STDOUT: %.loc28_47.1: type = splice_block %.loc28_47.3 [template = f64] { +// CHECK:STDOUT: %int_64.loc28_47: Core.IntLiteral = int_value 64 [template = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc28_47: init type = call constants.%Float(%int_64.loc28_47) [template = f64] +// CHECK:STDOUT: %.loc28_47.2: type = value_of_initializer %float.make_type.loc28_47 [template = f64] +// CHECK:STDOUT: %.loc28_47.3: type = converted %float.make_type.loc28_47, %.loc28_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 @@ -440,7 +440,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @JustRight(%a.param_patt: f64, %b.param_patt: f64) -> f64 = "float.sub"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooFew(%a.param_patt: f64) -> f64 { +// 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 @@ -450,7 +450,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: return %.loc21_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooMany(%a.param_patt: f64, %b.param_patt: f64, %c.param_patt: f64) -> f64 { +// 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 @@ -462,7 +462,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: return %.loc25_26.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a.param_patt: f64, %b.param_patt: f64) -> bool { +// 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 diff --git a/toolchain/check/testdata/builtins/int/and.carbon b/toolchain/check/testdata/builtins/int/and.carbon index 11a19c0b6943a..325f6f0ff821d 100644 --- a/toolchain/check/testdata/builtins/int/and.carbon +++ b/toolchain/check/testdata/builtins/int/and.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/and.carbon @@ -15,114 +17,6 @@ fn And(a: i32, b: i32) -> i32 = "int.and"; var arr: [i32; And(12, 10)]; let arr_p: [i32; 8]* = &arr; -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return And(a, b); } - -// CHECK:STDOUT: --- int_and.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %And.type: type = fn_type @And [template] -// CHECK:STDOUT: %And: %And.type = struct_value () [template] -// CHECK:STDOUT: %int_8.2: Core.IntLiteral = int_value 8 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_8.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .And = %And.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %And.decl: %And.type = fn_decl @And [template = constants.%And] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_11: type = splice_block %i32.loc2_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_19: type = splice_block %i32.loc2_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @And(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.and"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %And.ref: %And.type = name_ref And, file.%And.decl [template = constants.%And] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.and: init %i32 = call %And.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.and -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int.and, %.loc8_19.1 -// CHECK:STDOUT: return %.loc8_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/complement.carbon b/toolchain/check/testdata/builtins/int/complement.carbon index ee858a1a98150..ddcb047d88f73 100644 --- a/toolchain/check/testdata/builtins/int/complement.carbon +++ b/toolchain/check/testdata/builtins/int/complement.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/complement.carbon @@ -16,127 +18,6 @@ fn And(a: i32, b: i32) -> i32 = "int.and"; var arr: [i32; And(Complement(0x123456), 0xFFFFFF)]; let arr_p: [i32; 0xEDCBA9]* = &arr; -fn RuntimeCall(a: i32) -> i32 { +fn RuntimeCallIsValid(a: i32) -> i32 { return Complement(a); } - -// CHECK:STDOUT: --- int_complement.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Complement.type: type = fn_type @Complement [template] -// CHECK:STDOUT: %Complement: %Complement.type = struct_value () [template] -// CHECK:STDOUT: %And.type: type = fn_type @And [template] -// CHECK:STDOUT: %And: %And.type = struct_value () [template] -// CHECK:STDOUT: %int_15584169.2: Core.IntLiteral = int_value 15584169 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_15584169.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Complement = %Complement.decl -// CHECK:STDOUT: .And = %And.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Complement.decl: %Complement.type = fn_decl @Complement [template = constants.%Complement] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_26: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2: type = splice_block %i32.loc2_18 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_18: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_18: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %And.decl: %And.type = fn_decl @And [template = constants.%And] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc3_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc3_11: type = splice_block %i32.loc3_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc3_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc3_19: type = splice_block %i32.loc3_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc3_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc8_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc8_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc8: type = splice_block %i32.loc8_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc8_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc8_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Complement(%a.param_patt: %i32) -> %i32 = "int.complement"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @And(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.and"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Complement.ref: %Complement.type = name_ref Complement, file.%Complement.decl [template = constants.%Complement] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %int.complement: init %i32 = call %Complement.ref(%a.ref) -// CHECK:STDOUT: %.loc9_23.1: %i32 = value_of_initializer %int.complement -// CHECK:STDOUT: %.loc9_23.2: %i32 = converted %int.complement, %.loc9_23.1 -// CHECK:STDOUT: return %.loc9_23.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/convert_checked.carbon b/toolchain/check/testdata/builtins/int/convert_checked.carbon index 5212383db342b..ec0a6a84f18f9 100644 --- a/toolchain/check/testdata/builtins/int/convert_checked.carbon +++ b/toolchain/check/testdata/builtins/int/convert_checked.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/convert_checked.carbon @@ -247,2724 +249,3 @@ let convert_not_constant_same: i32 = Int32ToInt32(not_constant); // CHECK:STDERR: fn Int32ToInt64(a: i32) -> i64 = "int.convert_checked"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); - -// CHECK:STDOUT: --- int_ops.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %NegateI32.type: type = fn_type @NegateI32 [template] -// CHECK:STDOUT: %NegateI32: %NegateI32.type = struct_value () [template] -// CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template] -// CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [template] -// CHECK:STDOUT: %AddU32.type: type = fn_type @AddU32 [template] -// CHECK:STDOUT: %AddU32: %AddU32.type = struct_value () [template] -// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] -// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] -// CHECK:STDOUT: %Int32ToInt32.type: type = fn_type @Int32ToInt32 [template] -// CHECK:STDOUT: %Int32ToInt32: %Int32ToInt32.type = struct_value () [template] -// CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template] -// CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template] -// CHECK:STDOUT: %Uint32ToInt32.type: type = fn_type @Uint32ToInt32 [template] -// CHECK:STDOUT: %Uint32ToInt32: %Uint32ToInt32.type = struct_value () [template] -// CHECK:STDOUT: %Uint32ToUint32.type: type = fn_type @Uint32ToUint32 [template] -// CHECK:STDOUT: %Uint32ToUint32: %Uint32ToUint32.type = struct_value () [template] -// CHECK:STDOUT: %IntLiteralToIntLiteral.type: type = fn_type @IntLiteralToIntLiteral [template] -// CHECK:STDOUT: %IntLiteralToIntLiteral: %IntLiteralToIntLiteral.type = struct_value () [template] -// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [template] -// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [template] -// CHECK:STDOUT: %Int32ToInt16.type: type = fn_type @Int32ToInt16 [template] -// CHECK:STDOUT: %Int32ToInt16: %Int32ToInt16.type = struct_value () [template] -// CHECK:STDOUT: %u16: type = class_type @UInt, @UInt(%int_16) [template] -// CHECK:STDOUT: %Int32ToUint16.type: type = fn_type @Int32ToUint16 [template] -// CHECK:STDOUT: %Int32ToUint16: %Int32ToUint16.type = struct_value () [template] -// CHECK:STDOUT: %Uint32ToInt16.type: type = fn_type @Uint32ToInt16 [template] -// CHECK:STDOUT: %Uint32ToInt16: %Uint32ToInt16.type = struct_value () [template] -// CHECK:STDOUT: %Uint32ToUint16.type: type = fn_type @Uint32ToUint16 [template] -// CHECK:STDOUT: %Uint32ToUint16: %Uint32ToUint16.type = struct_value () [template] -// CHECK:STDOUT: %IntLiteralToInt16.type: type = fn_type @IntLiteralToInt16 [template] -// CHECK:STDOUT: %IntLiteralToInt16: %IntLiteralToInt16.type = struct_value () [template] -// CHECK:STDOUT: %IntLiteralToUint16.type: type = fn_type @IntLiteralToUint16 [template] -// CHECK:STDOUT: %IntLiteralToUint16: %IntLiteralToUint16.type = struct_value () [template] -// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template] -// CHECK:STDOUT: %i64: type = class_type @Int, @Int(%int_64) [template] -// CHECK:STDOUT: %Int32ToInt64.type: type = fn_type @Int32ToInt64 [template] -// CHECK:STDOUT: %Int32ToInt64: %Int32ToInt64.type = struct_value () [template] -// CHECK:STDOUT: %u64: type = class_type @UInt, @UInt(%int_64) [template] -// CHECK:STDOUT: %Int32ToUint64.type: type = fn_type @Int32ToUint64 [template] -// CHECK:STDOUT: %Int32ToUint64: %Int32ToUint64.type = struct_value () [template] -// CHECK:STDOUT: %Uint32ToInt64.type: type = fn_type @Uint32ToInt64 [template] -// CHECK:STDOUT: %Uint32ToInt64: %Uint32ToInt64.type = struct_value () [template] -// CHECK:STDOUT: %Uint32ToUint64.type: type = fn_type @Uint32ToUint64 [template] -// CHECK:STDOUT: %Uint32ToUint64: %Uint32ToUint64.type = struct_value () [template] -// CHECK:STDOUT: %Int32ToIntLiteral.type: type = fn_type @Int32ToIntLiteral [template] -// CHECK:STDOUT: %Int32ToIntLiteral: %Int32ToIntLiteral.type = struct_value () [template] -// CHECK:STDOUT: %Uint32ToUintLiteral.type: type = fn_type @Uint32ToUintLiteral [template] -// CHECK:STDOUT: %Uint32ToUintLiteral: %Uint32ToUintLiteral.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .UInt = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .NegateI32 = %NegateI32.decl -// CHECK:STDOUT: .SubI32 = %SubI32.decl -// CHECK:STDOUT: .AddU32 = %AddU32.decl -// CHECK:STDOUT: .IntLiteral = %IntLiteral.decl -// CHECK:STDOUT: .Int32ToInt32 = %Int32ToInt32.decl -// CHECK:STDOUT: .Int32ToUint32 = %Int32ToUint32.decl -// CHECK:STDOUT: .Uint32ToInt32 = %Uint32ToInt32.decl -// CHECK:STDOUT: .Uint32ToUint32 = %Uint32ToUint32.decl -// CHECK:STDOUT: .IntLiteralToIntLiteral = %IntLiteralToIntLiteral.decl -// CHECK:STDOUT: .Int32ToInt16 = %Int32ToInt16.decl -// CHECK:STDOUT: .Int32ToUint16 = %Int32ToUint16.decl -// CHECK:STDOUT: .Uint32ToInt16 = %Uint32ToInt16.decl -// CHECK:STDOUT: .Uint32ToUint16 = %Uint32ToUint16.decl -// CHECK:STDOUT: .IntLiteralToInt16 = %IntLiteralToInt16.decl -// CHECK:STDOUT: .IntLiteralToUint16 = %IntLiteralToUint16.decl -// CHECK:STDOUT: .Int32ToInt64 = %Int32ToInt64.decl -// CHECK:STDOUT: .Int32ToUint64 = %Int32ToUint64.decl -// CHECK:STDOUT: .Uint32ToInt64 = %Uint32ToInt64.decl -// CHECK:STDOUT: .Uint32ToUint64 = %Uint32ToUint64.decl -// CHECK:STDOUT: .Int32ToIntLiteral = %Int32ToIntLiteral.decl -// CHECK:STDOUT: .Uint32ToUintLiteral = %Uint32ToUintLiteral.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %NegateI32.decl: %NegateI32.type = fn_decl @NegateI32 [template = constants.%NegateI32] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4: type = splice_block %i32.loc4_17 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_17: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %SubI32.decl: %SubI32.type = fn_decl @SubI32 [template = constants.%SubI32] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc5_30: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_30: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc5_14: type = splice_block %i32.loc5_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc5_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc5_22: type = splice_block %i32.loc5_22 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc5_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %AddU32.decl: %AddU32.type = fn_decl @AddU32 [template = constants.%AddU32] { -// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %u32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %u32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc6_30: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc6_30: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc6_14: type = splice_block %u32.loc6_14 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc6_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc6_14: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %u32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc6_22: type = splice_block %u32.loc6_22 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc6_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc6_22: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %u32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %IntLiteral.decl: %IntLiteral.type = fn_decl @IntLiteral [template = constants.%IntLiteral] { -// CHECK:STDOUT: %return.patt: type = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: type = out_param_pattern %return.patt, runtime_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %return.param: ref type = out_param runtime_param0 -// CHECK:STDOUT: %return: ref type = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Int32ToInt32.decl: %Int32ToInt32.type = fn_decl @Int32ToInt32 [template = constants.%Int32ToInt32] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc10_28: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc10_28: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc10: type = splice_block %i32.loc10_20 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc10_20: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc10_20: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Int32ToUint32.decl: %Int32ToUint32.type = fn_decl @Int32ToUint32 [template = constants.%Int32ToUint32] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc11_29: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc11: type = splice_block %i32 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc11_21: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Uint32ToInt32.decl: %Uint32ToInt32.type = fn_decl @Uint32ToInt32 [template = constants.%Uint32ToInt32] { -// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc12_29: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc12: type = splice_block %u32 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc12_21: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Uint32ToUint32.decl: %Uint32ToUint32.type = fn_decl @Uint32ToUint32 [template = constants.%Uint32ToUint32] { -// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc13_30: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc13_30: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc13: type = splice_block %u32.loc13_22 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc13_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc13_22: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %IntLiteralToIntLiteral.decl: %IntLiteralToIntLiteral.type = fn_decl @IntLiteralToIntLiteral [template = constants.%IntLiteralToIntLiteral] { -// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a -// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %IntLiteral.ref.loc14_47: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral] -// CHECK:STDOUT: %int_literal.make_type.loc14_58: init type = call %IntLiteral.ref.loc14_47() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc14_58.1: type = value_of_initializer %int_literal.make_type.loc14_58 [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc14_58.2: type = converted %int_literal.make_type.loc14_58, %.loc14_58.1 [template = Core.IntLiteral] -// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 -// CHECK:STDOUT: %.loc14_41.1: type = splice_block %.loc14_41.3 [template = Core.IntLiteral] { -// CHECK:STDOUT: %IntLiteral.ref.loc14_30: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral] -// CHECK:STDOUT: %int_literal.make_type.loc14_41: init type = call %IntLiteral.ref.loc14_30() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc14_41.2: type = value_of_initializer %int_literal.make_type.loc14_41 [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc14_41.3: type = converted %int_literal.make_type.loc14_41, %.loc14_41.2 [template = Core.IntLiteral] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param1 -// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Int32ToInt16.decl: %Int32ToInt16.type = fn_decl @Int32ToInt16 [template = constants.%Int32ToInt16] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i16 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i16 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [template = constants.%int_16] -// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [template = constants.%i16] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc18: type = splice_block %i32 [template = constants.%i32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i16 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i16 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Int32ToUint16.decl: %Int32ToUint16.type = fn_decl @Int32ToUint16 [template = constants.%Int32ToUint16] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %u16 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u16 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [template = constants.%int_16] -// CHECK:STDOUT: %u16: type = class_type @UInt, @UInt(constants.%int_16) [template = constants.%u16] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc19: type = splice_block %i32 [template = constants.%i32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %u16 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %u16 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Uint32ToInt16.decl: %Uint32ToInt16.type = fn_decl @Uint32ToInt16 [template = constants.%Uint32ToInt16] { -// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i16 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i16 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [template = constants.%int_16] -// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [template = constants.%i16] -// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc20: type = splice_block %u32 [template = constants.%u32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i16 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i16 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Uint32ToUint16.decl: %Uint32ToUint16.type = fn_decl @Uint32ToUint16 [template = constants.%Uint32ToUint16] { -// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %u16 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u16 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [template = constants.%int_16] -// CHECK:STDOUT: %u16: type = class_type @UInt, @UInt(constants.%int_16) [template = constants.%u16] -// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc21: type = splice_block %u32 [template = constants.%u32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %u16 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %u16 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %IntLiteralToInt16.decl: %IntLiteralToInt16.type = fn_decl @IntLiteralToInt16 [template = constants.%IntLiteralToInt16] { -// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a -// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i16 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i16 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [template = constants.%int_16] -// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [template = constants.%i16] -// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 -// CHECK:STDOUT: %.loc22_36.1: type = splice_block %.loc22_36.3 [template = Core.IntLiteral] { -// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral] -// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc22_36.2: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc22_36.3: type = converted %int_literal.make_type, %.loc22_36.2 [template = Core.IntLiteral] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i16 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i16 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %IntLiteralToUint16.decl: %IntLiteralToUint16.type = fn_decl @IntLiteralToUint16 [template = constants.%IntLiteralToUint16] { -// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a -// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %u16 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u16 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [template = constants.%int_16] -// CHECK:STDOUT: %u16: type = class_type @UInt, @UInt(constants.%int_16) [template = constants.%u16] -// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 -// CHECK:STDOUT: %.loc23_37.1: type = splice_block %.loc23_37.3 [template = Core.IntLiteral] { -// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral] -// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc23_37.2: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc23_37.3: type = converted %int_literal.make_type, %.loc23_37.2 [template = Core.IntLiteral] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %u16 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %u16 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Int32ToInt64.decl: %Int32ToInt64.type = fn_decl @Int32ToInt64 [template = constants.%Int32ToInt64] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i64 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i64 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %i64: type = class_type @Int, @Int(constants.%int_64) [template = constants.%i64] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc26: type = splice_block %i32 [template = constants.%i32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i64 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i64 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Int32ToUint64.decl: %Int32ToUint64.type = fn_decl @Int32ToUint64 [template = constants.%Int32ToUint64] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %u64 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u64 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %u64: type = class_type @UInt, @UInt(constants.%int_64) [template = constants.%u64] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc27: type = splice_block %i32 [template = constants.%i32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %u64 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %u64 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Uint32ToInt64.decl: %Uint32ToInt64.type = fn_decl @Uint32ToInt64 [template = constants.%Uint32ToInt64] { -// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i64 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i64 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %i64: type = class_type @Int, @Int(constants.%int_64) [template = constants.%i64] -// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc28: type = splice_block %u32 [template = constants.%u32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i64 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i64 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Uint32ToUint64.decl: %Uint32ToUint64.type = fn_decl @Uint32ToUint64 [template = constants.%Uint32ToUint64] { -// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %u64 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u64 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %u64: type = class_type @UInt, @UInt(constants.%int_64) [template = constants.%u64] -// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc29: type = splice_block %u32 [template = constants.%u32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %u64 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %u64 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Int32ToIntLiteral.decl: %Int32ToIntLiteral.type = fn_decl @Int32ToIntLiteral [template = constants.%Int32ToIntLiteral] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral] -// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc30_44.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc30_44.2: type = converted %int_literal.make_type, %.loc30_44.1 [template = Core.IntLiteral] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc30_25: type = splice_block %i32 [template = constants.%i32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param1 -// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Uint32ToUintLiteral.decl: %Uint32ToUintLiteral.type = fn_decl @Uint32ToUintLiteral [template = constants.%Uint32ToUintLiteral] { -// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral] -// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc31_46.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc31_46.2: type = converted %int_literal.make_type, %.loc31_46.1 [template = Core.IntLiteral] -// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc31_27: type = splice_block %u32 [template = constants.%u32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param1 -// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @NegateI32(%a.param_patt: %i32) -> %i32 = "int.snegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @SubI32(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.ssub"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @AddU32(%a.param_patt: %u32, %b.param_patt: %u32) -> %u32 = "int.uadd"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @IntLiteral() -> type = "int_literal.make_type"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToInt32(%a.param_patt: %i32) -> %i32 = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: %i32) -> %u32 = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToInt32(%a.param_patt: %u32) -> %i32 = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToUint32(%a.param_patt: %u32) -> %u32 = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @IntLiteralToIntLiteral(%a.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToInt16(%a.param_patt: %i32) -> %i16 = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToUint16(%a.param_patt: %i32) -> %u16 = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToInt16(%a.param_patt: %u32) -> %i16 = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToUint16(%a.param_patt: %u32) -> %u16 = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @IntLiteralToInt16(%a.param_patt: Core.IntLiteral) -> %i16 = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @IntLiteralToUint16(%a.param_patt: Core.IntLiteral) -> %u16 = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToInt64(%a.param_patt: %i32) -> %i64 = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToUint64(%a.param_patt: %i32) -> %u64 = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToInt64(%a.param_patt: %u32) -> %i64 = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToUint64(%a.param_patt: %u32) -> %u64 = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToIntLiteral(%a.param_patt: %i32) -> Core.IntLiteral = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToUintLiteral(%a.param_patt: %u32) -> Core.IntLiteral = "int.convert_checked"; -// CHECK:STDOUT: -// CHECK:STDOUT: --- identity.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Int32ToInt32.type: type = fn_type @Int32ToInt32 [template] -// CHECK:STDOUT: %Int32ToInt32: %Int32ToInt32.type = struct_value () [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2147483647.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template] -// CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template] -// CHECK:STDOUT: %NegateI32.type: type = fn_type @NegateI32 [template] -// CHECK:STDOUT: %NegateI32: %NegateI32.type = struct_value () [template] -// CHECK:STDOUT: %int_-2147483647: %i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] -// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] -// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] -// CHECK:STDOUT: %IntLiteralToIntLiteral.type: type = fn_type @IntLiteralToIntLiteral [template] -// CHECK:STDOUT: %IntLiteralToIntLiteral: %IntLiteralToIntLiteral.type = struct_value () [template] -// CHECK:STDOUT: %Int32ToIntLiteral.type: type = fn_type @Int32ToIntLiteral [template] -// CHECK:STDOUT: %Int32ToIntLiteral: %Int32ToIntLiteral.type = struct_value () [template] -// CHECK:STDOUT: %int_-1.1: %i32 = int_value -1 [template] -// CHECK:STDOUT: %int_-1.2: Core.IntLiteral = int_value -1 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1: %NegateI32.type = import_ref Main//int_ops, NegateI32, loaded [template = constants.%NegateI32] -// CHECK:STDOUT: %import_ref.2: %SubI32.type = import_ref Main//int_ops, SubI32, loaded [template = constants.%SubI32] -// CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, AddU32, unloaded -// CHECK:STDOUT: %import_ref.4: %IntLiteral.type = import_ref Main//int_ops, IntLiteral, loaded [template = constants.%IntLiteral] -// CHECK:STDOUT: %import_ref.5: %Int32ToInt32.type = import_ref Main//int_ops, Int32ToInt32, loaded [template = constants.%Int32ToInt32] -// CHECK:STDOUT: %import_ref.6 = import_ref Main//int_ops, Int32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, Uint32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, Uint32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.9: %IntLiteralToIntLiteral.type = import_ref Main//int_ops, IntLiteralToIntLiteral, loaded [template = constants.%IntLiteralToIntLiteral] -// CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, Int32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, Int32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, Uint32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, Uint32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, IntLiteralToInt16, unloaded -// CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, IntLiteralToUint16, unloaded -// CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, Int32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, Int32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, Uint32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, Uint32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.20: %Int32ToIntLiteral.type = import_ref Main//int_ops, Int32ToIntLiteral, loaded [template = constants.%Int32ToIntLiteral] -// CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, Uint32ToUintLiteral, unloaded -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.22 -// CHECK:STDOUT: .ImplicitAs = %import_ref.26 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .NegateI32 = imports.%import_ref.1 -// CHECK:STDOUT: .SubI32 = imports.%import_ref.2 -// CHECK:STDOUT: .AddU32 = imports.%import_ref.3 -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.4 -// CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5 -// CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6 -// CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7 -// CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8 -// CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9 -// CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10 -// CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11 -// CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12 -// CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13 -// CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14 -// CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15 -// CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16 -// CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17 -// CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18 -// CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19 -// CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20 -// CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: .c = @__global_init.%c -// CHECK:STDOUT: .d = @__global_init.%d -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToInt32(%a.param_patt: %i32) -> %i32 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @SubI32(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.ssub" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @NegateI32(%a.param_patt: %i32) -> %i32 = "int.snegate" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @IntLiteral() -> type = "int_literal.make_type" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @IntLiteralToIntLiteral(%a.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToIntLiteral(%a.param_patt: %i32) -> Core.IntLiteral = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Int32ToInt32.ref.loc5: %Int32ToInt32.type = name_ref Int32ToInt32, imports.%import_ref.5 [template = constants.%Int32ToInt32] -// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc5: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc5: = bound_method %int_0, %impl.elem0.loc5 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc5: = specific_function %Convert.bound.loc5, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc5_27: init %i32 = call %Convert.specific_fn.loc5(%int_0) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc5_27.1: %i32 = value_of_initializer %int.convert_checked.loc5_27 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc5_27.2: %i32 = converted %int_0, %.loc5_27.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.convert_checked.loc5_28: init %i32 = call %Int32ToInt32.ref.loc5(%.loc5_27.2) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc5_29.1: %i32 = value_of_initializer %int.convert_checked.loc5_28 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc5_29.2: %i32 = converted %int.convert_checked.loc5_28, %.loc5_29.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc5_29.2 -// CHECK:STDOUT: %Int32ToInt32.ref.loc6: %Int32ToInt32.type = name_ref Int32ToInt32, imports.%import_ref.5 [template = constants.%Int32ToInt32] -// CHECK:STDOUT: %int_2147483647.loc6: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc6: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc6: = bound_method %int_2147483647.loc6, %impl.elem0.loc6 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc6: = specific_function %Convert.bound.loc6, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc6_27: init %i32 = call %Convert.specific_fn.loc6(%int_2147483647.loc6) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_27.1: %i32 = value_of_initializer %int.convert_checked.loc6_27 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_27.2: %i32 = converted %int_2147483647.loc6, %.loc6_27.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.convert_checked.loc6_38: init %i32 = call %Int32ToInt32.ref.loc6(%.loc6_27.2) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_39.1: %i32 = value_of_initializer %int.convert_checked.loc6_38 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_39.2: %i32 = converted %int.convert_checked.loc6_38, %.loc6_39.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc6_39.2 -// CHECK:STDOUT: %Int32ToInt32.ref.loc7: %Int32ToInt32.type = name_ref Int32ToInt32, imports.%import_ref.5 [template = constants.%Int32ToInt32] -// CHECK:STDOUT: %SubI32.ref: %SubI32.type = name_ref SubI32, imports.%import_ref.2 [template = constants.%SubI32] -// CHECK:STDOUT: %NegateI32.ref.loc7: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32] -// CHECK:STDOUT: %int_2147483647.loc7: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc7_44: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc7_44: = bound_method %int_2147483647.loc7, %impl.elem0.loc7_44 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc7_44: = specific_function %Convert.bound.loc7_44, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc7_44: init %i32 = call %Convert.specific_fn.loc7_44(%int_2147483647.loc7) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc7_44.1: %i32 = value_of_initializer %int.convert_checked.loc7_44 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc7_44.2: %i32 = converted %int_2147483647.loc7, %.loc7_44.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.snegate.loc7: init %i32 = call %NegateI32.ref.loc7(%.loc7_44.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1.loc7: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc7_55.1: %i32 = value_of_initializer %int.snegate.loc7 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc7_55.2: %i32 = converted %int.snegate.loc7, %.loc7_55.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc7_58: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc7_58: = bound_method %int_1.loc7, %impl.elem0.loc7_58 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc7_58: = specific_function %Convert.bound.loc7_58, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc7_58: init %i32 = call %Convert.specific_fn.loc7_58(%int_1.loc7) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc7_58.1: %i32 = value_of_initializer %int.convert_checked.loc7_58 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc7_58.2: %i32 = converted %int_1.loc7, %.loc7_58.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.ssub: init %i32 = call %SubI32.ref(%.loc7_55.2, %.loc7_58.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc7_59.1: %i32 = value_of_initializer %int.ssub [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc7_59.2: %i32 = converted %int.ssub, %.loc7_59.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %int.convert_checked.loc7_60: init %i32 = call %Int32ToInt32.ref.loc7(%.loc7_59.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc7_61.1: %i32 = value_of_initializer %int.convert_checked.loc7_60 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc7_61.2: %i32 = converted %int.convert_checked.loc7_60, %.loc7_61.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %c: %i32 = bind_name c, %.loc7_61.2 -// CHECK:STDOUT: %IntLiteralToIntLiteral.ref: %IntLiteralToIntLiteral.type = name_ref IntLiteralToIntLiteral, imports.%import_ref.9 [template = constants.%IntLiteralToIntLiteral] -// CHECK:STDOUT: %Int32ToIntLiteral.ref: %Int32ToIntLiteral.type = name_ref Int32ToIntLiteral, imports.%import_ref.20 [template = constants.%Int32ToIntLiteral] -// CHECK:STDOUT: %NegateI32.ref.loc8: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32] -// CHECK:STDOUT: %int_1.loc8: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc8: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8: = bound_method %int_1.loc8, %impl.elem0.loc8 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc8: = specific_function %Convert.bound.loc8, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc8_74: init %i32 = call %Convert.specific_fn.loc8(%int_1.loc8) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_74.1: %i32 = value_of_initializer %int.convert_checked.loc8_74 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_74.2: %i32 = converted %int_1.loc8, %.loc8_74.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc8: init %i32 = call %NegateI32.ref.loc8(%.loc8_74.2) [template = constants.%int_-1.1] -// CHECK:STDOUT: %.loc8_75.1: %i32 = value_of_initializer %int.snegate.loc8 [template = constants.%int_-1.1] -// CHECK:STDOUT: %.loc8_75.2: %i32 = converted %int.snegate.loc8, %.loc8_75.1 [template = constants.%int_-1.1] -// CHECK:STDOUT: %int.convert_checked.loc8_76: init Core.IntLiteral = call %Int32ToIntLiteral.ref(%.loc8_75.2) [template = constants.%int_-1.2] -// CHECK:STDOUT: %.loc8_76.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc8_76 [template = constants.%int_-1.2] -// CHECK:STDOUT: %.loc8_76.2: Core.IntLiteral = converted %int.convert_checked.loc8_76, %.loc8_76.1 [template = constants.%int_-1.2] -// CHECK:STDOUT: %int.convert_checked.loc8_77: init Core.IntLiteral = call %IntLiteralToIntLiteral.ref(%.loc8_76.2) [template = constants.%int_-1.2] -// CHECK:STDOUT: %.loc8_78.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc8_77 [template = constants.%int_-1.2] -// CHECK:STDOUT: %.loc8_78.2: Core.IntLiteral = converted %int.convert_checked.loc8_77, %.loc8_78.1 [template = constants.%int_-1.2] -// CHECK:STDOUT: %d: Core.IntLiteral = bind_name d, %.loc8_78.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- same_size.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [template] -// CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template] -// CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_2147483647.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %int_2147483647.3: %u32 = int_value 2147483647 [template] -// CHECK:STDOUT: %Uint32ToInt32.type: type = fn_type @Uint32ToInt32 [template] -// CHECK:STDOUT: %Uint32ToInt32: %Uint32ToInt32.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, NegateI32, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, SubI32, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, AddU32, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, Int32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.6: %Int32ToUint32.type = import_ref Main//int_ops, Int32ToUint32, loaded [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %import_ref.7: %Uint32ToInt32.type = import_ref Main//int_ops, Uint32ToInt32, loaded [template = constants.%Uint32ToInt32] -// CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, Uint32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, IntLiteralToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, Int32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, Int32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, Uint32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, Uint32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, IntLiteralToInt16, unloaded -// CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, IntLiteralToUint16, unloaded -// CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, Int32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, Int32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, Uint32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, Uint32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, Int32ToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, Uint32ToUintLiteral, unloaded -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .UInt = %import_ref.22 -// CHECK:STDOUT: .ImplicitAs = %import_ref.29 -// CHECK:STDOUT: .Int = %import_ref.217 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .NegateI32 = imports.%import_ref.1 -// CHECK:STDOUT: .SubI32 = imports.%import_ref.2 -// CHECK:STDOUT: .AddU32 = imports.%import_ref.3 -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.4 -// CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5 -// CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6 -// CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7 -// CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8 -// CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9 -// CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10 -// CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11 -// CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12 -// CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13 -// CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14 -// CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15 -// CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16 -// CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17 -// CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18 -// CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19 -// CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20 -// CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .max = @__global_init.%max -// CHECK:STDOUT: .max_roundtrip = @__global_init.%max_roundtrip -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: %i32) -> %u32 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToInt32(%a.param_patt: %u32) -> %i32 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Int32ToUint32.ref.loc5: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_2147483647.loc5: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc5: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc5: = bound_method %int_2147483647.loc5, %impl.elem0.loc5 [template = constants.%Convert.bound] -// CHECK:STDOUT: %Convert.specific_fn.loc5: = specific_function %Convert.bound.loc5, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn] -// CHECK:STDOUT: %int.convert_checked.loc5_30: init %i32 = call %Convert.specific_fn.loc5(%int_2147483647.loc5) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc5_30.1: %i32 = value_of_initializer %int.convert_checked.loc5_30 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc5_30.2: %i32 = converted %int_2147483647.loc5, %.loc5_30.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.convert_checked.loc5_41: init %u32 = call %Int32ToUint32.ref.loc5(%.loc5_30.2) [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %.loc5_42.1: %u32 = value_of_initializer %int.convert_checked.loc5_41 [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %.loc5_42.2: %u32 = converted %int.convert_checked.loc5_41, %.loc5_42.1 [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %max: %u32 = bind_name max, %.loc5_42.2 -// CHECK:STDOUT: %Uint32ToInt32.ref: %Uint32ToInt32.type = name_ref Uint32ToInt32, imports.%import_ref.7 [template = constants.%Uint32ToInt32] -// CHECK:STDOUT: %Int32ToUint32.ref.loc6: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_2147483647.loc6: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc6: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc6: = bound_method %int_2147483647.loc6, %impl.elem0.loc6 [template = constants.%Convert.bound] -// CHECK:STDOUT: %Convert.specific_fn.loc6: = specific_function %Convert.bound.loc6, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn] -// CHECK:STDOUT: %int.convert_checked.loc6_54: init %i32 = call %Convert.specific_fn.loc6(%int_2147483647.loc6) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_54.1: %i32 = value_of_initializer %int.convert_checked.loc6_54 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_54.2: %i32 = converted %int_2147483647.loc6, %.loc6_54.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.convert_checked.loc6_65: init %u32 = call %Int32ToUint32.ref.loc6(%.loc6_54.2) [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %.loc6_65.1: %u32 = value_of_initializer %int.convert_checked.loc6_65 [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %.loc6_65.2: %u32 = converted %int.convert_checked.loc6_65, %.loc6_65.1 [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %int.convert_checked.loc6_66: init %i32 = call %Uint32ToInt32.ref(%.loc6_65.2) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_67.1: %i32 = value_of_initializer %int.convert_checked.loc6_66 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_67.2: %i32 = converted %int.convert_checked.loc6_66, %.loc6_67.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %max_roundtrip: %i32 = bind_name max_roundtrip, %.loc6_67.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- truncate.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [template] -// CHECK:STDOUT: %u16: type = class_type @UInt, @UInt(%int_16) [template] -// CHECK:STDOUT: %Int32ToUint16.type: type = fn_type @Int32ToUint16 [template] -// CHECK:STDOUT: %Int32ToUint16: %Int32ToUint16.type = struct_value () [template] -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: %int_0.3: %u16 = int_value 0 [template] -// CHECK:STDOUT: %int_65535.1: Core.IntLiteral = int_value 65535 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_65535.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_65535.2: %i32 = int_value 65535 [template] -// CHECK:STDOUT: %int_65535.3: %u16 = int_value 65535 [template] -// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [template] -// CHECK:STDOUT: %Int32ToInt16.type: type = fn_type @Int32ToInt16 [template] -// CHECK:STDOUT: %Int32ToInt16: %Int32ToInt16.type = struct_value () [template] -// CHECK:STDOUT: %int_32767.1: Core.IntLiteral = int_value 32767 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_32767.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_32767.2: %i32 = int_value 32767 [template] -// CHECK:STDOUT: %int_32767.3: %i16 = int_value 32767 [template] -// CHECK:STDOUT: %NegateI32.type: type = fn_type @NegateI32 [template] -// CHECK:STDOUT: %NegateI32: %NegateI32.type = struct_value () [template] -// CHECK:STDOUT: %int_32768.1: Core.IntLiteral = int_value 32768 [template] -// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_32768.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_32768.2: %i32 = int_value 32768 [template] -// CHECK:STDOUT: %int_-32768.1: %i32 = int_value -32768 [template] -// CHECK:STDOUT: %int_-32768.2: %i16 = int_value -32768 [template] -// CHECK:STDOUT: %Uint32ToUint16.type: type = fn_type @Uint32ToUint16 [template] -// CHECK:STDOUT: %Uint32ToUint16: %Uint32ToUint16.type = struct_value () [template] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [template] -// CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template] -// CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template] -// CHECK:STDOUT: %int_0.4: %u32 = int_value 0 [template] -// CHECK:STDOUT: %int_65535.4: %u32 = int_value 65535 [template] -// CHECK:STDOUT: %Uint32ToInt16.type: type = fn_type @Uint32ToInt16 [template] -// CHECK:STDOUT: %Uint32ToInt16: %Uint32ToInt16.type = struct_value () [template] -// CHECK:STDOUT: %int_0.5: %i16 = int_value 0 [template] -// CHECK:STDOUT: %int_32767.4: %u32 = int_value 32767 [template] -// CHECK:STDOUT: %IntLiteralToInt16.type: type = fn_type @IntLiteralToInt16 [template] -// CHECK:STDOUT: %IntLiteralToInt16: %IntLiteralToInt16.type = struct_value () [template] -// CHECK:STDOUT: %Int32ToIntLiteral.type: type = fn_type @Int32ToIntLiteral [template] -// CHECK:STDOUT: %Int32ToIntLiteral: %Int32ToIntLiteral.type = struct_value () [template] -// CHECK:STDOUT: %int_-32768.3: Core.IntLiteral = int_value -32768 [template] -// CHECK:STDOUT: %IntLiteralToUint16.type: type = fn_type @IntLiteralToUint16 [template] -// CHECK:STDOUT: %IntLiteralToUint16: %IntLiteralToUint16.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1: %NegateI32.type = import_ref Main//int_ops, NegateI32, loaded [template = constants.%NegateI32] -// CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, SubI32, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, AddU32, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, Int32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.6: %Int32ToUint32.type = import_ref Main//int_ops, Int32ToUint32, loaded [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, Uint32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, Uint32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, IntLiteralToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.10: %Int32ToInt16.type = import_ref Main//int_ops, Int32ToInt16, loaded [template = constants.%Int32ToInt16] -// CHECK:STDOUT: %import_ref.11: %Int32ToUint16.type = import_ref Main//int_ops, Int32ToUint16, loaded [template = constants.%Int32ToUint16] -// CHECK:STDOUT: %import_ref.12: %Uint32ToInt16.type = import_ref Main//int_ops, Uint32ToInt16, loaded [template = constants.%Uint32ToInt16] -// CHECK:STDOUT: %import_ref.13: %Uint32ToUint16.type = import_ref Main//int_ops, Uint32ToUint16, loaded [template = constants.%Uint32ToUint16] -// CHECK:STDOUT: %import_ref.14: %IntLiteralToInt16.type = import_ref Main//int_ops, IntLiteralToInt16, loaded [template = constants.%IntLiteralToInt16] -// CHECK:STDOUT: %import_ref.15: %IntLiteralToUint16.type = import_ref Main//int_ops, IntLiteralToUint16, loaded [template = constants.%IntLiteralToUint16] -// CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, Int32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, Int32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, Uint32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, Uint32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.20: %Int32ToIntLiteral.type = import_ref Main//int_ops, Int32ToIntLiteral, loaded [template = constants.%Int32ToIntLiteral] -// CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, Uint32ToUintLiteral, unloaded -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .UInt = %import_ref.22 -// CHECK:STDOUT: .ImplicitAs = %import_ref.29 -// CHECK:STDOUT: .Int = %import_ref.217 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .NegateI32 = imports.%import_ref.1 -// CHECK:STDOUT: .SubI32 = imports.%import_ref.2 -// CHECK:STDOUT: .AddU32 = imports.%import_ref.3 -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.4 -// CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5 -// CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6 -// CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7 -// CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8 -// CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9 -// CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10 -// CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11 -// CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12 -// CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13 -// CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14 -// CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15 -// CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16 -// CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17 -// CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18 -// CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19 -// CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20 -// CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: .c = @__global_init.%c -// CHECK:STDOUT: .d = @__global_init.%d -// CHECK:STDOUT: .e = @__global_init.%e -// CHECK:STDOUT: .f = @__global_init.%f -// CHECK:STDOUT: .g = @__global_init.%g -// CHECK:STDOUT: .h = @__global_init.%h -// CHECK:STDOUT: .lit_i16_min = @__global_init.%lit_i16_min -// CHECK:STDOUT: .lit_i16_max = @__global_init.%lit_i16_max -// CHECK:STDOUT: .lit_u16_min = @__global_init.%lit_u16_min -// CHECK:STDOUT: .lit_u16_max = @__global_init.%lit_u16_max -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToUint16(%a.param_patt: %i32) -> %u16 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToInt16(%a.param_patt: %i32) -> %i16 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @NegateI32(%a.param_patt: %i32) -> %i32 = "int.snegate" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToUint16(%a.param_patt: %u32) -> %u16 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: %i32) -> %u32 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToInt16(%a.param_patt: %u32) -> %i16 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @IntLiteralToInt16(%a.param_patt: Core.IntLiteral) -> %i16 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToIntLiteral(%a.param_patt: %i32) -> Core.IntLiteral = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @IntLiteralToUint16(%a.param_patt: Core.IntLiteral) -> %u16 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Int32ToUint16.ref.loc5: %Int32ToUint16.type = name_ref Int32ToUint16, imports.%import_ref.11 [template = constants.%Int32ToUint16] -// CHECK:STDOUT: %int_0.loc5: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc5: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc5: = bound_method %int_0.loc5, %impl.elem0.loc5 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc5: = specific_function %Convert.bound.loc5, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc5_28: init %i32 = call %Convert.specific_fn.loc5(%int_0.loc5) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc5_28.1: %i32 = value_of_initializer %int.convert_checked.loc5_28 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc5_28.2: %i32 = converted %int_0.loc5, %.loc5_28.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.convert_checked.loc5_29: init %u16 = call %Int32ToUint16.ref.loc5(%.loc5_28.2) [template = constants.%int_0.3] -// CHECK:STDOUT: %.loc5_30.1: %u16 = value_of_initializer %int.convert_checked.loc5_29 [template = constants.%int_0.3] -// CHECK:STDOUT: %.loc5_30.2: %u16 = converted %int.convert_checked.loc5_29, %.loc5_30.1 [template = constants.%int_0.3] -// CHECK:STDOUT: %a: %u16 = bind_name a, %.loc5_30.2 -// CHECK:STDOUT: %Int32ToUint16.ref.loc6: %Int32ToUint16.type = name_ref Int32ToUint16, imports.%import_ref.11 [template = constants.%Int32ToUint16] -// CHECK:STDOUT: %int_65535.loc6: Core.IntLiteral = int_value 65535 [template = constants.%int_65535.1] -// CHECK:STDOUT: %impl.elem0.loc6: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc6: = bound_method %int_65535.loc6, %impl.elem0.loc6 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc6: = specific_function %Convert.bound.loc6, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc6_28: init %i32 = call %Convert.specific_fn.loc6(%int_65535.loc6) [template = constants.%int_65535.2] -// CHECK:STDOUT: %.loc6_28.1: %i32 = value_of_initializer %int.convert_checked.loc6_28 [template = constants.%int_65535.2] -// CHECK:STDOUT: %.loc6_28.2: %i32 = converted %int_65535.loc6, %.loc6_28.1 [template = constants.%int_65535.2] -// CHECK:STDOUT: %int.convert_checked.loc6_34: init %u16 = call %Int32ToUint16.ref.loc6(%.loc6_28.2) [template = constants.%int_65535.3] -// CHECK:STDOUT: %.loc6_35.1: %u16 = value_of_initializer %int.convert_checked.loc6_34 [template = constants.%int_65535.3] -// CHECK:STDOUT: %.loc6_35.2: %u16 = converted %int.convert_checked.loc6_34, %.loc6_35.1 [template = constants.%int_65535.3] -// CHECK:STDOUT: %b: %u16 = bind_name b, %.loc6_35.2 -// CHECK:STDOUT: %Int32ToInt16.ref.loc8: %Int32ToInt16.type = name_ref Int32ToInt16, imports.%import_ref.10 [template = constants.%Int32ToInt16] -// CHECK:STDOUT: %int_32767.loc8: Core.IntLiteral = int_value 32767 [template = constants.%int_32767.1] -// CHECK:STDOUT: %impl.elem0.loc8: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8: = bound_method %int_32767.loc8, %impl.elem0.loc8 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc8: = specific_function %Convert.bound.loc8, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc8_27: init %i32 = call %Convert.specific_fn.loc8(%int_32767.loc8) [template = constants.%int_32767.2] -// CHECK:STDOUT: %.loc8_27.1: %i32 = value_of_initializer %int.convert_checked.loc8_27 [template = constants.%int_32767.2] -// CHECK:STDOUT: %.loc8_27.2: %i32 = converted %int_32767.loc8, %.loc8_27.1 [template = constants.%int_32767.2] -// CHECK:STDOUT: %int.convert_checked.loc8_33: init %i16 = call %Int32ToInt16.ref.loc8(%.loc8_27.2) [template = constants.%int_32767.3] -// CHECK:STDOUT: %.loc8_34.1: %i16 = value_of_initializer %int.convert_checked.loc8_33 [template = constants.%int_32767.3] -// CHECK:STDOUT: %.loc8_34.2: %i16 = converted %int.convert_checked.loc8_33, %.loc8_34.1 [template = constants.%int_32767.3] -// CHECK:STDOUT: %c: %i16 = bind_name c, %.loc8_34.2 -// CHECK:STDOUT: %Int32ToInt16.ref.loc9: %Int32ToInt16.type = name_ref Int32ToInt16, imports.%import_ref.10 [template = constants.%Int32ToInt16] -// CHECK:STDOUT: %NegateI32.ref.loc9: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32] -// CHECK:STDOUT: %int_32768.loc9: Core.IntLiteral = int_value 32768 [template = constants.%int_32768.1] -// CHECK:STDOUT: %impl.elem0.loc9: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9: = bound_method %int_32768.loc9, %impl.elem0.loc9 [template = constants.%Convert.bound.4] -// CHECK:STDOUT: %Convert.specific_fn.loc9: = specific_function %Convert.bound.loc9, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] -// CHECK:STDOUT: %int.convert_checked.loc9_37: init %i32 = call %Convert.specific_fn.loc9(%int_32768.loc9) [template = constants.%int_32768.2] -// CHECK:STDOUT: %.loc9_37.1: %i32 = value_of_initializer %int.convert_checked.loc9_37 [template = constants.%int_32768.2] -// CHECK:STDOUT: %.loc9_37.2: %i32 = converted %int_32768.loc9, %.loc9_37.1 [template = constants.%int_32768.2] -// CHECK:STDOUT: %int.snegate.loc9: init %i32 = call %NegateI32.ref.loc9(%.loc9_37.2) [template = constants.%int_-32768.1] -// CHECK:STDOUT: %.loc9_43.1: %i32 = value_of_initializer %int.snegate.loc9 [template = constants.%int_-32768.1] -// CHECK:STDOUT: %.loc9_43.2: %i32 = converted %int.snegate.loc9, %.loc9_43.1 [template = constants.%int_-32768.1] -// CHECK:STDOUT: %int.convert_checked.loc9_44: init %i16 = call %Int32ToInt16.ref.loc9(%.loc9_43.2) [template = constants.%int_-32768.2] -// CHECK:STDOUT: %.loc9_45.1: %i16 = value_of_initializer %int.convert_checked.loc9_44 [template = constants.%int_-32768.2] -// CHECK:STDOUT: %.loc9_45.2: %i16 = converted %int.convert_checked.loc9_44, %.loc9_45.1 [template = constants.%int_-32768.2] -// CHECK:STDOUT: %d: %i16 = bind_name d, %.loc9_45.2 -// CHECK:STDOUT: %Uint32ToUint16.ref.loc11: %Uint32ToUint16.type = name_ref Uint32ToUint16, imports.%import_ref.13 [template = constants.%Uint32ToUint16] -// CHECK:STDOUT: %Int32ToUint32.ref.loc11: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_0.loc11: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc11: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11: = bound_method %int_0.loc11, %impl.elem0.loc11 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc11: = specific_function %Convert.bound.loc11, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc11_43: init %i32 = call %Convert.specific_fn.loc11(%int_0.loc11) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_43.1: %i32 = value_of_initializer %int.convert_checked.loc11_43 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_43.2: %i32 = converted %int_0.loc11, %.loc11_43.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.convert_checked.loc11_44: init %u32 = call %Int32ToUint32.ref.loc11(%.loc11_43.2) [template = constants.%int_0.4] -// CHECK:STDOUT: %.loc11_44.1: %u32 = value_of_initializer %int.convert_checked.loc11_44 [template = constants.%int_0.4] -// CHECK:STDOUT: %.loc11_44.2: %u32 = converted %int.convert_checked.loc11_44, %.loc11_44.1 [template = constants.%int_0.4] -// CHECK:STDOUT: %int.convert_checked.loc11_45: init %u16 = call %Uint32ToUint16.ref.loc11(%.loc11_44.2) [template = constants.%int_0.3] -// CHECK:STDOUT: %.loc11_46.1: %u16 = value_of_initializer %int.convert_checked.loc11_45 [template = constants.%int_0.3] -// CHECK:STDOUT: %.loc11_46.2: %u16 = converted %int.convert_checked.loc11_45, %.loc11_46.1 [template = constants.%int_0.3] -// CHECK:STDOUT: %e: %u16 = bind_name e, %.loc11_46.2 -// CHECK:STDOUT: %Uint32ToUint16.ref.loc12: %Uint32ToUint16.type = name_ref Uint32ToUint16, imports.%import_ref.13 [template = constants.%Uint32ToUint16] -// CHECK:STDOUT: %Int32ToUint32.ref.loc12: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_65535.loc12: Core.IntLiteral = int_value 65535 [template = constants.%int_65535.1] -// CHECK:STDOUT: %impl.elem0.loc12: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12: = bound_method %int_65535.loc12, %impl.elem0.loc12 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc12: = specific_function %Convert.bound.loc12, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc12_43: init %i32 = call %Convert.specific_fn.loc12(%int_65535.loc12) [template = constants.%int_65535.2] -// CHECK:STDOUT: %.loc12_43.1: %i32 = value_of_initializer %int.convert_checked.loc12_43 [template = constants.%int_65535.2] -// CHECK:STDOUT: %.loc12_43.2: %i32 = converted %int_65535.loc12, %.loc12_43.1 [template = constants.%int_65535.2] -// CHECK:STDOUT: %int.convert_checked.loc12_49: init %u32 = call %Int32ToUint32.ref.loc12(%.loc12_43.2) [template = constants.%int_65535.4] -// CHECK:STDOUT: %.loc12_49.1: %u32 = value_of_initializer %int.convert_checked.loc12_49 [template = constants.%int_65535.4] -// CHECK:STDOUT: %.loc12_49.2: %u32 = converted %int.convert_checked.loc12_49, %.loc12_49.1 [template = constants.%int_65535.4] -// CHECK:STDOUT: %int.convert_checked.loc12_50: init %u16 = call %Uint32ToUint16.ref.loc12(%.loc12_49.2) [template = constants.%int_65535.3] -// CHECK:STDOUT: %.loc12_51.1: %u16 = value_of_initializer %int.convert_checked.loc12_50 [template = constants.%int_65535.3] -// CHECK:STDOUT: %.loc12_51.2: %u16 = converted %int.convert_checked.loc12_50, %.loc12_51.1 [template = constants.%int_65535.3] -// CHECK:STDOUT: %f: %u16 = bind_name f, %.loc12_51.2 -// CHECK:STDOUT: %Uint32ToInt16.ref.loc14: %Uint32ToInt16.type = name_ref Uint32ToInt16, imports.%import_ref.12 [template = constants.%Uint32ToInt16] -// CHECK:STDOUT: %Int32ToUint32.ref.loc14: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_0.loc14: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc14: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc14: = bound_method %int_0.loc14, %impl.elem0.loc14 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc14: = specific_function %Convert.bound.loc14, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc14_42: init %i32 = call %Convert.specific_fn.loc14(%int_0.loc14) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc14_42.1: %i32 = value_of_initializer %int.convert_checked.loc14_42 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc14_42.2: %i32 = converted %int_0.loc14, %.loc14_42.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.convert_checked.loc14_43: init %u32 = call %Int32ToUint32.ref.loc14(%.loc14_42.2) [template = constants.%int_0.4] -// CHECK:STDOUT: %.loc14_43.1: %u32 = value_of_initializer %int.convert_checked.loc14_43 [template = constants.%int_0.4] -// CHECK:STDOUT: %.loc14_43.2: %u32 = converted %int.convert_checked.loc14_43, %.loc14_43.1 [template = constants.%int_0.4] -// CHECK:STDOUT: %int.convert_checked.loc14_44: init %i16 = call %Uint32ToInt16.ref.loc14(%.loc14_43.2) [template = constants.%int_0.5] -// CHECK:STDOUT: %.loc14_45.1: %i16 = value_of_initializer %int.convert_checked.loc14_44 [template = constants.%int_0.5] -// CHECK:STDOUT: %.loc14_45.2: %i16 = converted %int.convert_checked.loc14_44, %.loc14_45.1 [template = constants.%int_0.5] -// CHECK:STDOUT: %g: %i16 = bind_name g, %.loc14_45.2 -// CHECK:STDOUT: %Uint32ToInt16.ref.loc15: %Uint32ToInt16.type = name_ref Uint32ToInt16, imports.%import_ref.12 [template = constants.%Uint32ToInt16] -// CHECK:STDOUT: %Int32ToUint32.ref.loc15: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_32767.loc15: Core.IntLiteral = int_value 32767 [template = constants.%int_32767.1] -// CHECK:STDOUT: %impl.elem0.loc15: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15: = bound_method %int_32767.loc15, %impl.elem0.loc15 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc15: = specific_function %Convert.bound.loc15, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc15_42: init %i32 = call %Convert.specific_fn.loc15(%int_32767.loc15) [template = constants.%int_32767.2] -// CHECK:STDOUT: %.loc15_42.1: %i32 = value_of_initializer %int.convert_checked.loc15_42 [template = constants.%int_32767.2] -// CHECK:STDOUT: %.loc15_42.2: %i32 = converted %int_32767.loc15, %.loc15_42.1 [template = constants.%int_32767.2] -// CHECK:STDOUT: %int.convert_checked.loc15_48: init %u32 = call %Int32ToUint32.ref.loc15(%.loc15_42.2) [template = constants.%int_32767.4] -// CHECK:STDOUT: %.loc15_48.1: %u32 = value_of_initializer %int.convert_checked.loc15_48 [template = constants.%int_32767.4] -// CHECK:STDOUT: %.loc15_48.2: %u32 = converted %int.convert_checked.loc15_48, %.loc15_48.1 [template = constants.%int_32767.4] -// CHECK:STDOUT: %int.convert_checked.loc15_49: init %i16 = call %Uint32ToInt16.ref.loc15(%.loc15_48.2) [template = constants.%int_32767.3] -// CHECK:STDOUT: %.loc15_50.1: %i16 = value_of_initializer %int.convert_checked.loc15_49 [template = constants.%int_32767.3] -// CHECK:STDOUT: %.loc15_50.2: %i16 = converted %int.convert_checked.loc15_49, %.loc15_50.1 [template = constants.%int_32767.3] -// CHECK:STDOUT: %h: %i16 = bind_name h, %.loc15_50.2 -// CHECK:STDOUT: %IntLiteralToInt16.ref.loc17: %IntLiteralToInt16.type = name_ref IntLiteralToInt16, imports.%import_ref.14 [template = constants.%IntLiteralToInt16] -// CHECK:STDOUT: %Int32ToIntLiteral.ref.loc17: %Int32ToIntLiteral.type = name_ref Int32ToIntLiteral, imports.%import_ref.20 [template = constants.%Int32ToIntLiteral] -// CHECK:STDOUT: %NegateI32.ref.loc17: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32] -// CHECK:STDOUT: %int_32768.loc17: Core.IntLiteral = int_value 32768 [template = constants.%int_32768.1] -// CHECK:STDOUT: %impl.elem0.loc17: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc17: = bound_method %int_32768.loc17, %impl.elem0.loc17 [template = constants.%Convert.bound.4] -// CHECK:STDOUT: %Convert.specific_fn.loc17: = specific_function %Convert.bound.loc17, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] -// CHECK:STDOUT: %int.convert_checked.loc17_70: init %i32 = call %Convert.specific_fn.loc17(%int_32768.loc17) [template = constants.%int_32768.2] -// CHECK:STDOUT: %.loc17_70.1: %i32 = value_of_initializer %int.convert_checked.loc17_70 [template = constants.%int_32768.2] -// CHECK:STDOUT: %.loc17_70.2: %i32 = converted %int_32768.loc17, %.loc17_70.1 [template = constants.%int_32768.2] -// CHECK:STDOUT: %int.snegate.loc17: init %i32 = call %NegateI32.ref.loc17(%.loc17_70.2) [template = constants.%int_-32768.1] -// CHECK:STDOUT: %.loc17_76.1: %i32 = value_of_initializer %int.snegate.loc17 [template = constants.%int_-32768.1] -// CHECK:STDOUT: %.loc17_76.2: %i32 = converted %int.snegate.loc17, %.loc17_76.1 [template = constants.%int_-32768.1] -// CHECK:STDOUT: %int.convert_checked.loc17_77: init Core.IntLiteral = call %Int32ToIntLiteral.ref.loc17(%.loc17_76.2) [template = constants.%int_-32768.3] -// CHECK:STDOUT: %.loc17_77.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc17_77 [template = constants.%int_-32768.3] -// CHECK:STDOUT: %.loc17_77.2: Core.IntLiteral = converted %int.convert_checked.loc17_77, %.loc17_77.1 [template = constants.%int_-32768.3] -// CHECK:STDOUT: %int.convert_checked.loc17_78: init %i16 = call %IntLiteralToInt16.ref.loc17(%.loc17_77.2) [template = constants.%int_-32768.2] -// CHECK:STDOUT: %.loc17_79.1: %i16 = value_of_initializer %int.convert_checked.loc17_78 [template = constants.%int_-32768.2] -// CHECK:STDOUT: %.loc17_79.2: %i16 = converted %int.convert_checked.loc17_78, %.loc17_79.1 [template = constants.%int_-32768.2] -// CHECK:STDOUT: %lit_i16_min: %i16 = bind_name lit_i16_min, %.loc17_79.2 -// CHECK:STDOUT: %IntLiteralToInt16.ref.loc18: %IntLiteralToInt16.type = name_ref IntLiteralToInt16, imports.%import_ref.14 [template = constants.%IntLiteralToInt16] -// CHECK:STDOUT: %Int32ToIntLiteral.ref.loc18: %Int32ToIntLiteral.type = name_ref Int32ToIntLiteral, imports.%import_ref.20 [template = constants.%Int32ToIntLiteral] -// CHECK:STDOUT: %int_32767.loc18: Core.IntLiteral = int_value 32767 [template = constants.%int_32767.1] -// CHECK:STDOUT: %impl.elem0.loc18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc18: = bound_method %int_32767.loc18, %impl.elem0.loc18 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc18: = specific_function %Convert.bound.loc18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc18_60: init %i32 = call %Convert.specific_fn.loc18(%int_32767.loc18) [template = constants.%int_32767.2] -// CHECK:STDOUT: %.loc18_60.1: %i32 = value_of_initializer %int.convert_checked.loc18_60 [template = constants.%int_32767.2] -// CHECK:STDOUT: %.loc18_60.2: %i32 = converted %int_32767.loc18, %.loc18_60.1 [template = constants.%int_32767.2] -// CHECK:STDOUT: %int.convert_checked.loc18_66: init Core.IntLiteral = call %Int32ToIntLiteral.ref.loc18(%.loc18_60.2) [template = constants.%int_32767.1] -// CHECK:STDOUT: %.loc18_66.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc18_66 [template = constants.%int_32767.1] -// CHECK:STDOUT: %.loc18_66.2: Core.IntLiteral = converted %int.convert_checked.loc18_66, %.loc18_66.1 [template = constants.%int_32767.1] -// CHECK:STDOUT: %int.convert_checked.loc18_67: init %i16 = call %IntLiteralToInt16.ref.loc18(%.loc18_66.2) [template = constants.%int_32767.3] -// CHECK:STDOUT: %.loc18_68.1: %i16 = value_of_initializer %int.convert_checked.loc18_67 [template = constants.%int_32767.3] -// CHECK:STDOUT: %.loc18_68.2: %i16 = converted %int.convert_checked.loc18_67, %.loc18_68.1 [template = constants.%int_32767.3] -// CHECK:STDOUT: %lit_i16_max: %i16 = bind_name lit_i16_max, %.loc18_68.2 -// CHECK:STDOUT: %IntLiteralToUint16.ref.loc20: %IntLiteralToUint16.type = name_ref IntLiteralToUint16, imports.%import_ref.15 [template = constants.%IntLiteralToUint16] -// CHECK:STDOUT: %Int32ToIntLiteral.ref.loc20: %Int32ToIntLiteral.type = name_ref Int32ToIntLiteral, imports.%import_ref.20 [template = constants.%Int32ToIntLiteral] -// CHECK:STDOUT: %int_0.loc20: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc20: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc20: = bound_method %int_0.loc20, %impl.elem0.loc20 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc20: = specific_function %Convert.bound.loc20, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc20_61: init %i32 = call %Convert.specific_fn.loc20(%int_0.loc20) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc20_61.1: %i32 = value_of_initializer %int.convert_checked.loc20_61 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc20_61.2: %i32 = converted %int_0.loc20, %.loc20_61.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.convert_checked.loc20_62: init Core.IntLiteral = call %Int32ToIntLiteral.ref.loc20(%.loc20_61.2) [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc20_62.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc20_62 [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc20_62.2: Core.IntLiteral = converted %int.convert_checked.loc20_62, %.loc20_62.1 [template = constants.%int_0.1] -// CHECK:STDOUT: %int.convert_checked.loc20_63: init %u16 = call %IntLiteralToUint16.ref.loc20(%.loc20_62.2) [template = constants.%int_0.3] -// CHECK:STDOUT: %.loc20_64.1: %u16 = value_of_initializer %int.convert_checked.loc20_63 [template = constants.%int_0.3] -// CHECK:STDOUT: %.loc20_64.2: %u16 = converted %int.convert_checked.loc20_63, %.loc20_64.1 [template = constants.%int_0.3] -// CHECK:STDOUT: %lit_u16_min: %u16 = bind_name lit_u16_min, %.loc20_64.2 -// CHECK:STDOUT: %IntLiteralToUint16.ref.loc21: %IntLiteralToUint16.type = name_ref IntLiteralToUint16, imports.%import_ref.15 [template = constants.%IntLiteralToUint16] -// CHECK:STDOUT: %Int32ToIntLiteral.ref.loc21: %Int32ToIntLiteral.type = name_ref Int32ToIntLiteral, imports.%import_ref.20 [template = constants.%Int32ToIntLiteral] -// CHECK:STDOUT: %int_65535.loc21: Core.IntLiteral = int_value 65535 [template = constants.%int_65535.1] -// CHECK:STDOUT: %impl.elem0.loc21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc21: = bound_method %int_65535.loc21, %impl.elem0.loc21 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc21: = specific_function %Convert.bound.loc21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc21_61: init %i32 = call %Convert.specific_fn.loc21(%int_65535.loc21) [template = constants.%int_65535.2] -// CHECK:STDOUT: %.loc21_61.1: %i32 = value_of_initializer %int.convert_checked.loc21_61 [template = constants.%int_65535.2] -// CHECK:STDOUT: %.loc21_61.2: %i32 = converted %int_65535.loc21, %.loc21_61.1 [template = constants.%int_65535.2] -// CHECK:STDOUT: %int.convert_checked.loc21_67: init Core.IntLiteral = call %Int32ToIntLiteral.ref.loc21(%.loc21_61.2) [template = constants.%int_65535.1] -// CHECK:STDOUT: %.loc21_67.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc21_67 [template = constants.%int_65535.1] -// CHECK:STDOUT: %.loc21_67.2: Core.IntLiteral = converted %int.convert_checked.loc21_67, %.loc21_67.1 [template = constants.%int_65535.1] -// CHECK:STDOUT: %int.convert_checked.loc21_68: init %u16 = call %IntLiteralToUint16.ref.loc21(%.loc21_67.2) [template = constants.%int_65535.3] -// CHECK:STDOUT: %.loc21_69.1: %u16 = value_of_initializer %int.convert_checked.loc21_68 [template = constants.%int_65535.3] -// CHECK:STDOUT: %.loc21_69.2: %u16 = converted %int.convert_checked.loc21_68, %.loc21_69.1 [template = constants.%int_65535.3] -// CHECK:STDOUT: %lit_u16_max: %u16 = bind_name lit_u16_max, %.loc21_69.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- zero_extend.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template] -// CHECK:STDOUT: %u64: type = class_type @UInt, @UInt(%int_64) [template] -// CHECK:STDOUT: %Uint32ToUint64.type: type = fn_type @Uint32ToUint64 [template] -// CHECK:STDOUT: %Uint32ToUint64: %Uint32ToUint64.type = struct_value () [template] -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [template] -// CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template] -// CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: %int_0.3: %u32 = int_value 0 [template] -// CHECK:STDOUT: %int_0.4: %u64 = int_value 0 [template] -// CHECK:STDOUT: %AddU32.type: type = fn_type @AddU32 [template] -// CHECK:STDOUT: %AddU32: %AddU32.type = struct_value () [template] -// CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2147483647.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %int_2147483647.3: %u32 = int_value 2147483647 [template] -// CHECK:STDOUT: %int_4294967294: %u32 = int_value 4294967294 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_1.3: %u32 = int_value 1 [template] -// CHECK:STDOUT: %int_4294967295.1: %u32 = int_value 4294967295 [template] -// CHECK:STDOUT: %int_4294967295.2: %u64 = int_value 4294967295 [template] -// CHECK:STDOUT: %i64: type = class_type @Int, @Int(%int_64) [template] -// CHECK:STDOUT: %Uint32ToInt64.type: type = fn_type @Uint32ToInt64 [template] -// CHECK:STDOUT: %Uint32ToInt64: %Uint32ToInt64.type = struct_value () [template] -// CHECK:STDOUT: %int_0.5: %i64 = int_value 0 [template] -// CHECK:STDOUT: %int_4294967295.3: %i64 = int_value 4294967295 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, NegateI32, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, SubI32, unloaded -// CHECK:STDOUT: %import_ref.3: %AddU32.type = import_ref Main//int_ops, AddU32, loaded [template = constants.%AddU32] -// CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, Int32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.6: %Int32ToUint32.type = import_ref Main//int_ops, Int32ToUint32, loaded [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, Uint32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, Uint32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, IntLiteralToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, Int32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, Int32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, Uint32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, Uint32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, IntLiteralToInt16, unloaded -// CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, IntLiteralToUint16, unloaded -// CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, Int32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, Int32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.18: %Uint32ToInt64.type = import_ref Main//int_ops, Uint32ToInt64, loaded [template = constants.%Uint32ToInt64] -// CHECK:STDOUT: %import_ref.19: %Uint32ToUint64.type = import_ref Main//int_ops, Uint32ToUint64, loaded [template = constants.%Uint32ToUint64] -// CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, Int32ToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, Uint32ToUintLiteral, unloaded -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .UInt = %import_ref.22 -// CHECK:STDOUT: .ImplicitAs = %import_ref.29 -// CHECK:STDOUT: .Int = %import_ref.217 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .NegateI32 = imports.%import_ref.1 -// CHECK:STDOUT: .SubI32 = imports.%import_ref.2 -// CHECK:STDOUT: .AddU32 = imports.%import_ref.3 -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.4 -// CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5 -// CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6 -// CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7 -// CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8 -// CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9 -// CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10 -// CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11 -// CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12 -// CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13 -// CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14 -// CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15 -// CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16 -// CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17 -// CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18 -// CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19 -// CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20 -// CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: .c = @__global_init.%c -// CHECK:STDOUT: .d = @__global_init.%d -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToUint64(%a.param_patt: %u32) -> %u64 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: %i32) -> %u32 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @AddU32(%a.param_patt: %u32, %b.param_patt: %u32) -> %u32 = "int.uadd" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToInt64(%a.param_patt: %u32) -> %i64 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Uint32ToUint64.ref.loc5: %Uint32ToUint64.type = name_ref Uint32ToUint64, imports.%import_ref.19 [template = constants.%Uint32ToUint64] -// CHECK:STDOUT: %Int32ToUint32.ref.loc5: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_0.loc5: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc5: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc5: = bound_method %int_0.loc5, %impl.elem0.loc5 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc5: = specific_function %Convert.bound.loc5, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc5_43: init %i32 = call %Convert.specific_fn.loc5(%int_0.loc5) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc5_43.1: %i32 = value_of_initializer %int.convert_checked.loc5_43 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc5_43.2: %i32 = converted %int_0.loc5, %.loc5_43.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.convert_checked.loc5_44: init %u32 = call %Int32ToUint32.ref.loc5(%.loc5_43.2) [template = constants.%int_0.3] -// CHECK:STDOUT: %.loc5_44.1: %u32 = value_of_initializer %int.convert_checked.loc5_44 [template = constants.%int_0.3] -// CHECK:STDOUT: %.loc5_44.2: %u32 = converted %int.convert_checked.loc5_44, %.loc5_44.1 [template = constants.%int_0.3] -// CHECK:STDOUT: %int.convert_checked.loc5_45: init %u64 = call %Uint32ToUint64.ref.loc5(%.loc5_44.2) [template = constants.%int_0.4] -// CHECK:STDOUT: %.loc5_46.1: %u64 = value_of_initializer %int.convert_checked.loc5_45 [template = constants.%int_0.4] -// CHECK:STDOUT: %.loc5_46.2: %u64 = converted %int.convert_checked.loc5_45, %.loc5_46.1 [template = constants.%int_0.4] -// CHECK:STDOUT: %a: %u64 = bind_name a, %.loc5_46.2 -// CHECK:STDOUT: %Uint32ToUint64.ref.loc6: %Uint32ToUint64.type = name_ref Uint32ToUint64, imports.%import_ref.19 [template = constants.%Uint32ToUint64] -// CHECK:STDOUT: %AddU32.ref.loc7: %AddU32.type = name_ref AddU32, imports.%import_ref.3 [template = constants.%AddU32] -// CHECK:STDOUT: %AddU32.ref.loc8: %AddU32.type = name_ref AddU32, imports.%import_ref.3 [template = constants.%AddU32] -// CHECK:STDOUT: %Int32ToUint32.ref.loc8_12: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_2147483647.loc8_26: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc8_26: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_26: = bound_method %int_2147483647.loc8_26, %impl.elem0.loc8_26 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc8_26: = specific_function %Convert.bound.loc8_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc8_26: init %i32 = call %Convert.specific_fn.loc8_26(%int_2147483647.loc8_26) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_26.1: %i32 = value_of_initializer %int.convert_checked.loc8_26 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_26.2: %i32 = converted %int_2147483647.loc8_26, %.loc8_26.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.convert_checked.loc8_37: init %u32 = call %Int32ToUint32.ref.loc8_12(%.loc8_26.2) [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %Int32ToUint32.ref.loc8_40: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_2147483647.loc8_54: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc8_54: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_54: = bound_method %int_2147483647.loc8_54, %impl.elem0.loc8_54 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc8_54: = specific_function %Convert.bound.loc8_54, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc8_54: init %i32 = call %Convert.specific_fn.loc8_54(%int_2147483647.loc8_54) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_54.1: %i32 = value_of_initializer %int.convert_checked.loc8_54 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_54.2: %i32 = converted %int_2147483647.loc8_54, %.loc8_54.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.convert_checked.loc8_65: init %u32 = call %Int32ToUint32.ref.loc8_40(%.loc8_54.2) [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %.loc8_37.1: %u32 = value_of_initializer %int.convert_checked.loc8_37 [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %.loc8_37.2: %u32 = converted %int.convert_checked.loc8_37, %.loc8_37.1 [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %.loc8_65.1: %u32 = value_of_initializer %int.convert_checked.loc8_65 [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %.loc8_65.2: %u32 = converted %int.convert_checked.loc8_65, %.loc8_65.1 [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %int.uadd.loc8: init %u32 = call %AddU32.ref.loc8(%.loc8_37.2, %.loc8_65.2) [template = constants.%int_4294967294] -// CHECK:STDOUT: %Int32ToUint32.ref.loc9: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc9: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9: = bound_method %int_1.loc9, %impl.elem0.loc9 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc9: = specific_function %Convert.bound.loc9, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc9_19: init %i32 = call %Convert.specific_fn.loc9(%int_1.loc9) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_19.1: %i32 = value_of_initializer %int.convert_checked.loc9_19 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_19.2: %i32 = converted %int_1.loc9, %.loc9_19.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.convert_checked.loc9_20: init %u32 = call %Int32ToUint32.ref.loc9(%.loc9_19.2) [template = constants.%int_1.3] -// CHECK:STDOUT: %.loc8_66.1: %u32 = value_of_initializer %int.uadd.loc8 [template = constants.%int_4294967294] -// CHECK:STDOUT: %.loc8_66.2: %u32 = converted %int.uadd.loc8, %.loc8_66.1 [template = constants.%int_4294967294] -// CHECK:STDOUT: %.loc9_20.1: %u32 = value_of_initializer %int.convert_checked.loc9_20 [template = constants.%int_1.3] -// CHECK:STDOUT: %.loc9_20.2: %u32 = converted %int.convert_checked.loc9_20, %.loc9_20.1 [template = constants.%int_1.3] -// CHECK:STDOUT: %int.uadd.loc9: init %u32 = call %AddU32.ref.loc7(%.loc8_66.2, %.loc9_20.2) [template = constants.%int_4294967295.1] -// CHECK:STDOUT: %.loc9_21.1: %u32 = value_of_initializer %int.uadd.loc9 [template = constants.%int_4294967295.1] -// CHECK:STDOUT: %.loc9_21.2: %u32 = converted %int.uadd.loc9, %.loc9_21.1 [template = constants.%int_4294967295.1] -// CHECK:STDOUT: %int.convert_checked.loc9_22: init %u64 = call %Uint32ToUint64.ref.loc6(%.loc9_21.2) [template = constants.%int_4294967295.2] -// CHECK:STDOUT: %.loc9_23.1: %u64 = value_of_initializer %int.convert_checked.loc9_22 [template = constants.%int_4294967295.2] -// CHECK:STDOUT: %.loc9_23.2: %u64 = converted %int.convert_checked.loc9_22, %.loc9_23.1 [template = constants.%int_4294967295.2] -// CHECK:STDOUT: %b: %u64 = bind_name b, %.loc9_23.2 -// CHECK:STDOUT: %Uint32ToInt64.ref.loc11: %Uint32ToInt64.type = name_ref Uint32ToInt64, imports.%import_ref.18 [template = constants.%Uint32ToInt64] -// CHECK:STDOUT: %Int32ToUint32.ref.loc11: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_0.loc11: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc11: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11: = bound_method %int_0.loc11, %impl.elem0.loc11 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc11: = specific_function %Convert.bound.loc11, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc11_42: init %i32 = call %Convert.specific_fn.loc11(%int_0.loc11) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_42.1: %i32 = value_of_initializer %int.convert_checked.loc11_42 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_42.2: %i32 = converted %int_0.loc11, %.loc11_42.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.convert_checked.loc11_43: init %u32 = call %Int32ToUint32.ref.loc11(%.loc11_42.2) [template = constants.%int_0.3] -// CHECK:STDOUT: %.loc11_43.1: %u32 = value_of_initializer %int.convert_checked.loc11_43 [template = constants.%int_0.3] -// CHECK:STDOUT: %.loc11_43.2: %u32 = converted %int.convert_checked.loc11_43, %.loc11_43.1 [template = constants.%int_0.3] -// CHECK:STDOUT: %int.convert_checked.loc11_44: init %i64 = call %Uint32ToInt64.ref.loc11(%.loc11_43.2) [template = constants.%int_0.5] -// CHECK:STDOUT: %.loc11_45.1: %i64 = value_of_initializer %int.convert_checked.loc11_44 [template = constants.%int_0.5] -// CHECK:STDOUT: %.loc11_45.2: %i64 = converted %int.convert_checked.loc11_44, %.loc11_45.1 [template = constants.%int_0.5] -// CHECK:STDOUT: %c: %i64 = bind_name c, %.loc11_45.2 -// CHECK:STDOUT: %Uint32ToInt64.ref.loc12: %Uint32ToInt64.type = name_ref Uint32ToInt64, imports.%import_ref.18 [template = constants.%Uint32ToInt64] -// CHECK:STDOUT: %AddU32.ref.loc13: %AddU32.type = name_ref AddU32, imports.%import_ref.3 [template = constants.%AddU32] -// CHECK:STDOUT: %AddU32.ref.loc14: %AddU32.type = name_ref AddU32, imports.%import_ref.3 [template = constants.%AddU32] -// CHECK:STDOUT: %Int32ToUint32.ref.loc14_12: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_2147483647.loc14_26: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc14_26: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc14_26: = bound_method %int_2147483647.loc14_26, %impl.elem0.loc14_26 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc14_26: = specific_function %Convert.bound.loc14_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc14_26: init %i32 = call %Convert.specific_fn.loc14_26(%int_2147483647.loc14_26) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc14_26.1: %i32 = value_of_initializer %int.convert_checked.loc14_26 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc14_26.2: %i32 = converted %int_2147483647.loc14_26, %.loc14_26.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.convert_checked.loc14_37: init %u32 = call %Int32ToUint32.ref.loc14_12(%.loc14_26.2) [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %Int32ToUint32.ref.loc14_40: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_2147483647.loc14_54: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc14_54: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc14_54: = bound_method %int_2147483647.loc14_54, %impl.elem0.loc14_54 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc14_54: = specific_function %Convert.bound.loc14_54, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc14_54: init %i32 = call %Convert.specific_fn.loc14_54(%int_2147483647.loc14_54) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc14_54.1: %i32 = value_of_initializer %int.convert_checked.loc14_54 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc14_54.2: %i32 = converted %int_2147483647.loc14_54, %.loc14_54.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.convert_checked.loc14_65: init %u32 = call %Int32ToUint32.ref.loc14_40(%.loc14_54.2) [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %.loc14_37.1: %u32 = value_of_initializer %int.convert_checked.loc14_37 [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %.loc14_37.2: %u32 = converted %int.convert_checked.loc14_37, %.loc14_37.1 [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %.loc14_65.1: %u32 = value_of_initializer %int.convert_checked.loc14_65 [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %.loc14_65.2: %u32 = converted %int.convert_checked.loc14_65, %.loc14_65.1 [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %int.uadd.loc14: init %u32 = call %AddU32.ref.loc14(%.loc14_37.2, %.loc14_65.2) [template = constants.%int_4294967294] -// CHECK:STDOUT: %Int32ToUint32.ref.loc15: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc15: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15: = bound_method %int_1.loc15, %impl.elem0.loc15 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc15: = specific_function %Convert.bound.loc15, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc15_19: init %i32 = call %Convert.specific_fn.loc15(%int_1.loc15) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc15_19.1: %i32 = value_of_initializer %int.convert_checked.loc15_19 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc15_19.2: %i32 = converted %int_1.loc15, %.loc15_19.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.convert_checked.loc15_20: init %u32 = call %Int32ToUint32.ref.loc15(%.loc15_19.2) [template = constants.%int_1.3] -// CHECK:STDOUT: %.loc14_66.1: %u32 = value_of_initializer %int.uadd.loc14 [template = constants.%int_4294967294] -// CHECK:STDOUT: %.loc14_66.2: %u32 = converted %int.uadd.loc14, %.loc14_66.1 [template = constants.%int_4294967294] -// CHECK:STDOUT: %.loc15_20.1: %u32 = value_of_initializer %int.convert_checked.loc15_20 [template = constants.%int_1.3] -// CHECK:STDOUT: %.loc15_20.2: %u32 = converted %int.convert_checked.loc15_20, %.loc15_20.1 [template = constants.%int_1.3] -// CHECK:STDOUT: %int.uadd.loc15: init %u32 = call %AddU32.ref.loc13(%.loc14_66.2, %.loc15_20.2) [template = constants.%int_4294967295.1] -// CHECK:STDOUT: %.loc15_21.1: %u32 = value_of_initializer %int.uadd.loc15 [template = constants.%int_4294967295.1] -// CHECK:STDOUT: %.loc15_21.2: %u32 = converted %int.uadd.loc15, %.loc15_21.1 [template = constants.%int_4294967295.1] -// CHECK:STDOUT: %int.convert_checked.loc15_22: init %i64 = call %Uint32ToInt64.ref.loc12(%.loc15_21.2) [template = constants.%int_4294967295.3] -// CHECK:STDOUT: %.loc15_23.1: %i64 = value_of_initializer %int.convert_checked.loc15_22 [template = constants.%int_4294967295.3] -// CHECK:STDOUT: %.loc15_23.2: %i64 = converted %int.convert_checked.loc15_22, %.loc15_23.1 [template = constants.%int_4294967295.3] -// CHECK:STDOUT: %d: %i64 = bind_name d, %.loc15_23.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- sign_extend.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template] -// CHECK:STDOUT: %u64: type = class_type @UInt, @UInt(%int_64) [template] -// CHECK:STDOUT: %Int32ToUint64.type: type = fn_type @Int32ToUint64 [template] -// CHECK:STDOUT: %Int32ToUint64: %Int32ToUint64.type = struct_value () [template] -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: %int_0.3: %u64 = int_value 0 [template] -// CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2147483647.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %int_2147483647.3: %u64 = int_value 2147483647 [template] -// CHECK:STDOUT: %i64: type = class_type @Int, @Int(%int_64) [template] -// CHECK:STDOUT: %Int32ToInt64.type: type = fn_type @Int32ToInt64 [template] -// CHECK:STDOUT: %Int32ToInt64: %Int32ToInt64.type = struct_value () [template] -// CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template] -// CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template] -// CHECK:STDOUT: %NegateI32.type: type = fn_type @NegateI32 [template] -// CHECK:STDOUT: %NegateI32: %NegateI32.type = struct_value () [template] -// CHECK:STDOUT: %int_-2147483647: %i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-2147483648.1: %i32 = int_value -2147483648 [template] -// CHECK:STDOUT: %int_-2147483648.2: %i64 = int_value -2147483648 [template] -// CHECK:STDOUT: %int_2147483647.4: %i64 = int_value 2147483647 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1: %NegateI32.type = import_ref Main//int_ops, NegateI32, loaded [template = constants.%NegateI32] -// CHECK:STDOUT: %import_ref.2: %SubI32.type = import_ref Main//int_ops, SubI32, loaded [template = constants.%SubI32] -// CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, AddU32, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, Int32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.6 = import_ref Main//int_ops, Int32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, Uint32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, Uint32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, IntLiteralToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, Int32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, Int32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, Uint32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, Uint32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, IntLiteralToInt16, unloaded -// CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, IntLiteralToUint16, unloaded -// CHECK:STDOUT: %import_ref.16: %Int32ToInt64.type = import_ref Main//int_ops, Int32ToInt64, loaded [template = constants.%Int32ToInt64] -// CHECK:STDOUT: %import_ref.17: %Int32ToUint64.type = import_ref Main//int_ops, Int32ToUint64, loaded [template = constants.%Int32ToUint64] -// CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, Uint32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, Uint32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, Int32ToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, Uint32ToUintLiteral, unloaded -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .UInt = %import_ref.22 -// CHECK:STDOUT: .ImplicitAs = %import_ref.29 -// CHECK:STDOUT: .Int = %import_ref.217 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .NegateI32 = imports.%import_ref.1 -// CHECK:STDOUT: .SubI32 = imports.%import_ref.2 -// CHECK:STDOUT: .AddU32 = imports.%import_ref.3 -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.4 -// CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5 -// CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6 -// CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7 -// CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8 -// CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9 -// CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10 -// CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11 -// CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12 -// CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13 -// CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14 -// CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15 -// CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16 -// CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17 -// CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18 -// CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19 -// CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20 -// CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: .c = @__global_init.%c -// CHECK:STDOUT: .d = @__global_init.%d -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToUint64(%a.param_patt: %i32) -> %u64 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToInt64(%a.param_patt: %i32) -> %i64 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @SubI32(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.ssub" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @NegateI32(%a.param_patt: %i32) -> %i32 = "int.snegate" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Int32ToUint64.ref.loc5: %Int32ToUint64.type = name_ref Int32ToUint64, imports.%import_ref.17 [template = constants.%Int32ToUint64] -// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc5: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc5: = bound_method %int_0, %impl.elem0.loc5 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc5: = specific_function %Convert.bound.loc5, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc5_28: init %i32 = call %Convert.specific_fn.loc5(%int_0) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc5_28.1: %i32 = value_of_initializer %int.convert_checked.loc5_28 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc5_28.2: %i32 = converted %int_0, %.loc5_28.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.convert_checked.loc5_29: init %u64 = call %Int32ToUint64.ref.loc5(%.loc5_28.2) [template = constants.%int_0.3] -// CHECK:STDOUT: %.loc5_30.1: %u64 = value_of_initializer %int.convert_checked.loc5_29 [template = constants.%int_0.3] -// CHECK:STDOUT: %.loc5_30.2: %u64 = converted %int.convert_checked.loc5_29, %.loc5_30.1 [template = constants.%int_0.3] -// CHECK:STDOUT: %a: %u64 = bind_name a, %.loc5_30.2 -// CHECK:STDOUT: %Int32ToUint64.ref.loc6: %Int32ToUint64.type = name_ref Int32ToUint64, imports.%import_ref.17 [template = constants.%Int32ToUint64] -// CHECK:STDOUT: %int_2147483647.loc6: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc6: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc6: = bound_method %int_2147483647.loc6, %impl.elem0.loc6 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc6: = specific_function %Convert.bound.loc6, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc6_28: init %i32 = call %Convert.specific_fn.loc6(%int_2147483647.loc6) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_28.1: %i32 = value_of_initializer %int.convert_checked.loc6_28 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_28.2: %i32 = converted %int_2147483647.loc6, %.loc6_28.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.convert_checked.loc6_39: init %u64 = call %Int32ToUint64.ref.loc6(%.loc6_28.2) [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %.loc6_40.1: %u64 = value_of_initializer %int.convert_checked.loc6_39 [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %.loc6_40.2: %u64 = converted %int.convert_checked.loc6_39, %.loc6_40.1 [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %b: %u64 = bind_name b, %.loc6_40.2 -// CHECK:STDOUT: %Int32ToInt64.ref.loc8: %Int32ToInt64.type = name_ref Int32ToInt64, imports.%import_ref.16 [template = constants.%Int32ToInt64] -// CHECK:STDOUT: %SubI32.ref: %SubI32.type = name_ref SubI32, imports.%import_ref.2 [template = constants.%SubI32] -// CHECK:STDOUT: %NegateI32.ref: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32] -// CHECK:STDOUT: %int_2147483647.loc8: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc8_44: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_44: = bound_method %int_2147483647.loc8, %impl.elem0.loc8_44 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc8_44: = specific_function %Convert.bound.loc8_44, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc8_44: init %i32 = call %Convert.specific_fn.loc8_44(%int_2147483647.loc8) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_44.1: %i32 = value_of_initializer %int.convert_checked.loc8_44 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_44.2: %i32 = converted %int_2147483647.loc8, %.loc8_44.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.snegate: init %i32 = call %NegateI32.ref(%.loc8_44.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc8_55.1: %i32 = value_of_initializer %int.snegate [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc8_55.2: %i32 = converted %int.snegate, %.loc8_55.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc8_58: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_58: = bound_method %int_1, %impl.elem0.loc8_58 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc8_58: = specific_function %Convert.bound.loc8_58, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc8_58: init %i32 = call %Convert.specific_fn.loc8_58(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_58.1: %i32 = value_of_initializer %int.convert_checked.loc8_58 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_58.2: %i32 = converted %int_1, %.loc8_58.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.ssub: init %i32 = call %SubI32.ref(%.loc8_55.2, %.loc8_58.2) [template = constants.%int_-2147483648.1] -// CHECK:STDOUT: %.loc8_59.1: %i32 = value_of_initializer %int.ssub [template = constants.%int_-2147483648.1] -// CHECK:STDOUT: %.loc8_59.2: %i32 = converted %int.ssub, %.loc8_59.1 [template = constants.%int_-2147483648.1] -// CHECK:STDOUT: %int.convert_checked.loc8_60: init %i64 = call %Int32ToInt64.ref.loc8(%.loc8_59.2) [template = constants.%int_-2147483648.2] -// CHECK:STDOUT: %.loc8_61.1: %i64 = value_of_initializer %int.convert_checked.loc8_60 [template = constants.%int_-2147483648.2] -// CHECK:STDOUT: %.loc8_61.2: %i64 = converted %int.convert_checked.loc8_60, %.loc8_61.1 [template = constants.%int_-2147483648.2] -// CHECK:STDOUT: %c: %i64 = bind_name c, %.loc8_61.2 -// CHECK:STDOUT: %Int32ToInt64.ref.loc9: %Int32ToInt64.type = name_ref Int32ToInt64, imports.%import_ref.16 [template = constants.%Int32ToInt64] -// CHECK:STDOUT: %int_2147483647.loc9: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc9: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9: = bound_method %int_2147483647.loc9, %impl.elem0.loc9 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9: = specific_function %Convert.bound.loc9, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_27: init %i32 = call %Convert.specific_fn.loc9(%int_2147483647.loc9) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc9_27.1: %i32 = value_of_initializer %int.convert_checked.loc9_27 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc9_27.2: %i32 = converted %int_2147483647.loc9, %.loc9_27.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.convert_checked.loc9_38: init %i64 = call %Int32ToInt64.ref.loc9(%.loc9_27.2) [template = constants.%int_2147483647.4] -// CHECK:STDOUT: %.loc9_39.1: %i64 = value_of_initializer %int.convert_checked.loc9_38 [template = constants.%int_2147483647.4] -// CHECK:STDOUT: %.loc9_39.2: %i64 = converted %int.convert_checked.loc9_38, %.loc9_39.1 [template = constants.%int_2147483647.4] -// CHECK:STDOUT: %d: %i64 = bind_name d, %.loc9_39.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_too_large_u32_for_i32.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Uint32ToInt32.type: type = fn_type @Uint32ToInt32 [template] -// CHECK:STDOUT: %Uint32ToInt32: %Uint32ToInt32.type = struct_value () [template] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [template] -// CHECK:STDOUT: %AddU32.type: type = fn_type @AddU32 [template] -// CHECK:STDOUT: %AddU32: %AddU32.type = struct_value () [template] -// CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template] -// CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template] -// CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_2147483647.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %int_2147483647.3: %u32 = int_value 2147483647 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_1.3: %u32 = int_value 1 [template] -// CHECK:STDOUT: %int_2147483648.1: %u32 = int_value 2147483648 [template] -// CHECK:STDOUT: %int_2147483648.2: %i32 = int_value 2147483648 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, NegateI32, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, SubI32, unloaded -// CHECK:STDOUT: %import_ref.3: %AddU32.type = import_ref Main//int_ops, AddU32, loaded [template = constants.%AddU32] -// CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, Int32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.6: %Int32ToUint32.type = import_ref Main//int_ops, Int32ToUint32, loaded [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %import_ref.7: %Uint32ToInt32.type = import_ref Main//int_ops, Uint32ToInt32, loaded [template = constants.%Uint32ToInt32] -// CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, Uint32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, IntLiteralToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, Int32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, Int32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, Uint32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, Uint32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, IntLiteralToInt16, unloaded -// CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, IntLiteralToUint16, unloaded -// CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, Int32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, Int32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, Uint32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, Uint32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, Int32ToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, Uint32ToUintLiteral, unloaded -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.22 -// CHECK:STDOUT: .ImplicitAs = %import_ref.29 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .NegateI32 = imports.%import_ref.1 -// CHECK:STDOUT: .SubI32 = imports.%import_ref.2 -// CHECK:STDOUT: .AddU32 = imports.%import_ref.3 -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.4 -// CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5 -// CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6 -// CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7 -// CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8 -// CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9 -// CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10 -// CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11 -// CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12 -// CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13 -// CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14 -// CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15 -// CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16 -// CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17 -// CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18 -// CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19 -// CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20 -// CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .max_plus_one = @__global_init.%max_plus_one -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToInt32(%a.param_patt: %u32) -> %i32 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @AddU32(%a.param_patt: %u32, %b.param_patt: %u32) -> %u32 = "int.uadd" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: %i32) -> %u32 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Uint32ToInt32.ref: %Uint32ToInt32.type = name_ref Uint32ToInt32, imports.%import_ref.7 [template = constants.%Uint32ToInt32] -// CHECK:STDOUT: %AddU32.ref: %AddU32.type = name_ref AddU32, imports.%import_ref.3 [template = constants.%AddU32] -// CHECK:STDOUT: %Int32ToUint32.ref.loc11: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_2147483647: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc11: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11: = bound_method %int_2147483647, %impl.elem0.loc11 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc11: = specific_function %Convert.bound.loc11, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc11_26: init %i32 = call %Convert.specific_fn.loc11(%int_2147483647) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc11_26.1: %i32 = value_of_initializer %int.convert_checked.loc11_26 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc11_26.2: %i32 = converted %int_2147483647, %.loc11_26.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.convert_checked.loc11_37: init %u32 = call %Int32ToUint32.ref.loc11(%.loc11_26.2) [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %Int32ToUint32.ref.loc12: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc12: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12: = bound_method %int_1, %impl.elem0.loc12 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc12: = specific_function %Convert.bound.loc12, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc12_26: init %i32 = call %Convert.specific_fn.loc12(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_26.1: %i32 = value_of_initializer %int.convert_checked.loc12_26 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_26.2: %i32 = converted %int_1, %.loc12_26.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.convert_checked.loc12_27: init %u32 = call %Int32ToUint32.ref.loc12(%.loc12_26.2) [template = constants.%int_1.3] -// CHECK:STDOUT: %.loc11_37.1: %u32 = value_of_initializer %int.convert_checked.loc11_37 [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %.loc11_37.2: %u32 = converted %int.convert_checked.loc11_37, %.loc11_37.1 [template = constants.%int_2147483647.3] -// CHECK:STDOUT: %.loc12_27.1: %u32 = value_of_initializer %int.convert_checked.loc12_27 [template = constants.%int_1.3] -// CHECK:STDOUT: %.loc12_27.2: %u32 = converted %int.convert_checked.loc12_27, %.loc12_27.1 [template = constants.%int_1.3] -// CHECK:STDOUT: %int.uadd: init %u32 = call %AddU32.ref(%.loc11_37.2, %.loc12_27.2) [template = constants.%int_2147483648.1] -// CHECK:STDOUT: %.loc12_28.1: %u32 = value_of_initializer %int.uadd [template = constants.%int_2147483648.1] -// CHECK:STDOUT: %.loc12_28.2: %u32 = converted %int.uadd, %.loc12_28.1 [template = constants.%int_2147483648.1] -// CHECK:STDOUT: %int.convert_checked.loc12_29: init %i32 = call %Uint32ToInt32.ref(%.loc12_28.2) [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc12_30.1: %i32 = value_of_initializer %int.convert_checked.loc12_29 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc12_30.2: %i32 = converted %int.convert_checked.loc12_29, %.loc12_30.1 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %max_plus_one: %i32 = bind_name max_plus_one, %.loc12_30.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_too_large_i32_for_i16.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [template] -// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [template] -// CHECK:STDOUT: %Int32ToInt16.type: type = fn_type @Int32ToInt16 [template] -// CHECK:STDOUT: %Int32ToInt16: %Int32ToInt16.type = struct_value () [template] -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %int_32768.1: Core.IntLiteral = int_value 32768 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_32768.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_32768.2: %i32 = int_value 32768 [template] -// CHECK:STDOUT: %int_32768.3: %i16 = int_value 32768 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, NegateI32, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, SubI32, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, AddU32, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, Int32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.6 = import_ref Main//int_ops, Int32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, Uint32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, Uint32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, IntLiteralToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.10: %Int32ToInt16.type = import_ref Main//int_ops, Int32ToInt16, loaded [template = constants.%Int32ToInt16] -// CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, Int32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, Uint32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, Uint32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, IntLiteralToInt16, unloaded -// CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, IntLiteralToUint16, unloaded -// CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, Int32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, Int32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, Uint32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, Uint32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, Int32ToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, Uint32ToUintLiteral, unloaded -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.22 -// CHECK:STDOUT: .ImplicitAs = %import_ref.26 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .NegateI32 = imports.%import_ref.1 -// CHECK:STDOUT: .SubI32 = imports.%import_ref.2 -// CHECK:STDOUT: .AddU32 = imports.%import_ref.3 -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.4 -// CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5 -// CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6 -// CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7 -// CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8 -// CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9 -// CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10 -// CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11 -// CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12 -// CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13 -// CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14 -// CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15 -// CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16 -// CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17 -// CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18 -// CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19 -// CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20 -// CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .max_plus_one = @__global_init.%max_plus_one -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToInt16(%a.param_patt: %i32) -> %i16 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Int32ToInt16.ref: %Int32ToInt16.type = name_ref Int32ToInt16, imports.%import_ref.10 [template = constants.%Int32ToInt16] -// CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [template = constants.%int_32768.1] -// CHECK:STDOUT: %impl.elem0: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_32768, %impl.elem0 [template = constants.%Convert.bound] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn] -// CHECK:STDOUT: %int.convert_checked.loc9_38: init %i32 = call %Convert.specific_fn(%int_32768) [template = constants.%int_32768.2] -// CHECK:STDOUT: %.loc9_38.1: %i32 = value_of_initializer %int.convert_checked.loc9_38 [template = constants.%int_32768.2] -// CHECK:STDOUT: %.loc9_38.2: %i32 = converted %int_32768, %.loc9_38.1 [template = constants.%int_32768.2] -// CHECK:STDOUT: %int.convert_checked.loc9_44: init %i16 = call %Int32ToInt16.ref(%.loc9_38.2) [template = constants.%int_32768.3] -// CHECK:STDOUT: %.loc9_45.1: %i16 = value_of_initializer %int.convert_checked.loc9_44 [template = constants.%int_32768.3] -// CHECK:STDOUT: %.loc9_45.2: %i16 = converted %int.convert_checked.loc9_44, %.loc9_45.1 [template = constants.%int_32768.3] -// CHECK:STDOUT: %max_plus_one: %i16 = bind_name max_plus_one, %.loc9_45.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_too_large_i32_for_u16.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [template] -// CHECK:STDOUT: %u16: type = class_type @UInt, @UInt(%int_16) [template] -// CHECK:STDOUT: %Int32ToUint16.type: type = fn_type @Int32ToUint16 [template] -// CHECK:STDOUT: %Int32ToUint16: %Int32ToUint16.type = struct_value () [template] -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %int_65536.1: Core.IntLiteral = int_value 65536 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_65536.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_65536.2: %i32 = int_value 65536 [template] -// CHECK:STDOUT: %int_65536.3: %u16 = int_value 65536 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, NegateI32, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, SubI32, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, AddU32, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, Int32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.6 = import_ref Main//int_ops, Int32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, Uint32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, Uint32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, IntLiteralToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, Int32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.11: %Int32ToUint16.type = import_ref Main//int_ops, Int32ToUint16, loaded [template = constants.%Int32ToUint16] -// CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, Uint32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, Uint32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, IntLiteralToInt16, unloaded -// CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, IntLiteralToUint16, unloaded -// CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, Int32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, Int32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, Uint32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, Uint32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, Int32ToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, Uint32ToUintLiteral, unloaded -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .UInt = %import_ref.22 -// CHECK:STDOUT: .ImplicitAs = %import_ref.29 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .NegateI32 = imports.%import_ref.1 -// CHECK:STDOUT: .SubI32 = imports.%import_ref.2 -// CHECK:STDOUT: .AddU32 = imports.%import_ref.3 -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.4 -// CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5 -// CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6 -// CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7 -// CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8 -// CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9 -// CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10 -// CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11 -// CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12 -// CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13 -// CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14 -// CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15 -// CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16 -// CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17 -// CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18 -// CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19 -// CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20 -// CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .max_plus_one = @__global_init.%max_plus_one -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToUint16(%a.param_patt: %i32) -> %u16 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Int32ToUint16.ref: %Int32ToUint16.type = name_ref Int32ToUint16, imports.%import_ref.11 [template = constants.%Int32ToUint16] -// CHECK:STDOUT: %int_65536: Core.IntLiteral = int_value 65536 [template = constants.%int_65536.1] -// CHECK:STDOUT: %impl.elem0: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_65536, %impl.elem0 [template = constants.%Convert.bound] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn] -// CHECK:STDOUT: %int.convert_checked.loc9_39: init %i32 = call %Convert.specific_fn(%int_65536) [template = constants.%int_65536.2] -// CHECK:STDOUT: %.loc9_39.1: %i32 = value_of_initializer %int.convert_checked.loc9_39 [template = constants.%int_65536.2] -// CHECK:STDOUT: %.loc9_39.2: %i32 = converted %int_65536, %.loc9_39.1 [template = constants.%int_65536.2] -// CHECK:STDOUT: %int.convert_checked.loc9_47: init %u16 = call %Int32ToUint16.ref(%.loc9_39.2) [template = constants.%int_65536.3] -// CHECK:STDOUT: %.loc9_48.1: %u16 = value_of_initializer %int.convert_checked.loc9_47 [template = constants.%int_65536.3] -// CHECK:STDOUT: %.loc9_48.2: %u16 = converted %int.convert_checked.loc9_47, %.loc9_48.1 [template = constants.%int_65536.3] -// CHECK:STDOUT: %max_plus_one: %u16 = bind_name max_plus_one, %.loc9_48.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_too_large_u32_for_i16.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [template] -// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [template] -// CHECK:STDOUT: %Uint32ToInt16.type: type = fn_type @Uint32ToInt16 [template] -// CHECK:STDOUT: %Uint32ToInt16: %Uint32ToInt16.type = struct_value () [template] -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [template] -// CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template] -// CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %int_32768.1: Core.IntLiteral = int_value 32768 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_32768.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_32768.2: %i32 = int_value 32768 [template] -// CHECK:STDOUT: %int_32768.3: %u32 = int_value 32768 [template] -// CHECK:STDOUT: %int_32768.4: %i16 = int_value 32768 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, NegateI32, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, SubI32, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, AddU32, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, Int32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.6: %Int32ToUint32.type = import_ref Main//int_ops, Int32ToUint32, loaded [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, Uint32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, Uint32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, IntLiteralToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, Int32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, Int32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.12: %Uint32ToInt16.type = import_ref Main//int_ops, Uint32ToInt16, loaded [template = constants.%Uint32ToInt16] -// CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, Uint32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, IntLiteralToInt16, unloaded -// CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, IntLiteralToUint16, unloaded -// CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, Int32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, Int32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, Uint32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, Uint32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, Int32ToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, Uint32ToUintLiteral, unloaded -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.22 -// CHECK:STDOUT: .ImplicitAs = %import_ref.29 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .NegateI32 = imports.%import_ref.1 -// CHECK:STDOUT: .SubI32 = imports.%import_ref.2 -// CHECK:STDOUT: .AddU32 = imports.%import_ref.3 -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.4 -// CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5 -// CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6 -// CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7 -// CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8 -// CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9 -// CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10 -// CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11 -// CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12 -// CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13 -// CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14 -// CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15 -// CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16 -// CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17 -// CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18 -// CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19 -// CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20 -// CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .max_plus_one = @__global_init.%max_plus_one -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToInt16(%a.param_patt: %u32) -> %i16 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: %i32) -> %u32 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Uint32ToInt16.ref: %Uint32ToInt16.type = name_ref Uint32ToInt16, imports.%import_ref.12 [template = constants.%Uint32ToInt16] -// CHECK:STDOUT: %Int32ToUint32.ref: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [template = constants.%int_32768.1] -// CHECK:STDOUT: %impl.elem0: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_32768, %impl.elem0 [template = constants.%Convert.bound] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn] -// CHECK:STDOUT: %int.convert_checked.loc9_53: init %i32 = call %Convert.specific_fn(%int_32768) [template = constants.%int_32768.2] -// CHECK:STDOUT: %.loc9_53.1: %i32 = value_of_initializer %int.convert_checked.loc9_53 [template = constants.%int_32768.2] -// CHECK:STDOUT: %.loc9_53.2: %i32 = converted %int_32768, %.loc9_53.1 [template = constants.%int_32768.2] -// CHECK:STDOUT: %int.convert_checked.loc9_59: init %u32 = call %Int32ToUint32.ref(%.loc9_53.2) [template = constants.%int_32768.3] -// CHECK:STDOUT: %.loc9_59.1: %u32 = value_of_initializer %int.convert_checked.loc9_59 [template = constants.%int_32768.3] -// CHECK:STDOUT: %.loc9_59.2: %u32 = converted %int.convert_checked.loc9_59, %.loc9_59.1 [template = constants.%int_32768.3] -// CHECK:STDOUT: %int.convert_checked.loc9_60: init %i16 = call %Uint32ToInt16.ref(%.loc9_59.2) [template = constants.%int_32768.4] -// CHECK:STDOUT: %.loc9_61.1: %i16 = value_of_initializer %int.convert_checked.loc9_60 [template = constants.%int_32768.4] -// CHECK:STDOUT: %.loc9_61.2: %i16 = converted %int.convert_checked.loc9_60, %.loc9_61.1 [template = constants.%int_32768.4] -// CHECK:STDOUT: %max_plus_one: %i16 = bind_name max_plus_one, %.loc9_61.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_too_large_u32_for_u16.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [template] -// CHECK:STDOUT: %u16: type = class_type @UInt, @UInt(%int_16) [template] -// CHECK:STDOUT: %Uint32ToUint16.type: type = fn_type @Uint32ToUint16 [template] -// CHECK:STDOUT: %Uint32ToUint16: %Uint32ToUint16.type = struct_value () [template] -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [template] -// CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template] -// CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %int_65536.1: Core.IntLiteral = int_value 65536 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_65536.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_65536.2: %i32 = int_value 65536 [template] -// CHECK:STDOUT: %int_65536.3: %u32 = int_value 65536 [template] -// CHECK:STDOUT: %int_65536.4: %u16 = int_value 65536 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, NegateI32, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, SubI32, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, AddU32, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, Int32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.6: %Int32ToUint32.type = import_ref Main//int_ops, Int32ToUint32, loaded [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, Uint32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, Uint32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, IntLiteralToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, Int32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, Int32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, Uint32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.13: %Uint32ToUint16.type = import_ref Main//int_ops, Uint32ToUint16, loaded [template = constants.%Uint32ToUint16] -// CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, IntLiteralToInt16, unloaded -// CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, IntLiteralToUint16, unloaded -// CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, Int32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, Int32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, Uint32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, Uint32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, Int32ToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, Uint32ToUintLiteral, unloaded -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .UInt = %import_ref.22 -// CHECK:STDOUT: .ImplicitAs = %import_ref.29 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .NegateI32 = imports.%import_ref.1 -// CHECK:STDOUT: .SubI32 = imports.%import_ref.2 -// CHECK:STDOUT: .AddU32 = imports.%import_ref.3 -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.4 -// CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5 -// CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6 -// CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7 -// CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8 -// CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9 -// CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10 -// CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11 -// CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12 -// CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13 -// CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14 -// CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15 -// CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16 -// CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17 -// CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18 -// CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19 -// CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20 -// CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .max_plus_one = @__global_init.%max_plus_one -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Uint32ToUint16(%a.param_patt: %u32) -> %u16 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: %i32) -> %u32 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Uint32ToUint16.ref: %Uint32ToUint16.type = name_ref Uint32ToUint16, imports.%import_ref.13 [template = constants.%Uint32ToUint16] -// CHECK:STDOUT: %Int32ToUint32.ref: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %int_65536: Core.IntLiteral = int_value 65536 [template = constants.%int_65536.1] -// CHECK:STDOUT: %impl.elem0: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_65536, %impl.elem0 [template = constants.%Convert.bound] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn] -// CHECK:STDOUT: %int.convert_checked.loc9_54: init %i32 = call %Convert.specific_fn(%int_65536) [template = constants.%int_65536.2] -// CHECK:STDOUT: %.loc9_54.1: %i32 = value_of_initializer %int.convert_checked.loc9_54 [template = constants.%int_65536.2] -// CHECK:STDOUT: %.loc9_54.2: %i32 = converted %int_65536, %.loc9_54.1 [template = constants.%int_65536.2] -// CHECK:STDOUT: %int.convert_checked.loc9_62: init %u32 = call %Int32ToUint32.ref(%.loc9_54.2) [template = constants.%int_65536.3] -// CHECK:STDOUT: %.loc9_62.1: %u32 = value_of_initializer %int.convert_checked.loc9_62 [template = constants.%int_65536.3] -// CHECK:STDOUT: %.loc9_62.2: %u32 = converted %int.convert_checked.loc9_62, %.loc9_62.1 [template = constants.%int_65536.3] -// CHECK:STDOUT: %int.convert_checked.loc9_63: init %u16 = call %Uint32ToUint16.ref(%.loc9_62.2) [template = constants.%int_65536.4] -// CHECK:STDOUT: %.loc9_64.1: %u16 = value_of_initializer %int.convert_checked.loc9_63 [template = constants.%int_65536.4] -// CHECK:STDOUT: %.loc9_64.2: %u16 = converted %int.convert_checked.loc9_63, %.loc9_64.1 [template = constants.%int_65536.4] -// CHECK:STDOUT: %max_plus_one: %u16 = bind_name max_plus_one, %.loc9_64.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_negative_i32_to_u16.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [template] -// CHECK:STDOUT: %u16: type = class_type @UInt, @UInt(%int_16) [template] -// CHECK:STDOUT: %Int32ToUint16.type: type = fn_type @Int32ToUint16 [template] -// CHECK:STDOUT: %Int32ToUint16: %Int32ToUint16.type = struct_value () [template] -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template] -// CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-1.1: %i32 = int_value -1 [template] -// CHECK:STDOUT: %int_-1.2: %u16 = int_value 18446744073709551615 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, NegateI32, unloaded -// CHECK:STDOUT: %import_ref.2: %SubI32.type = import_ref Main//int_ops, SubI32, loaded [template = constants.%SubI32] -// CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, AddU32, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, Int32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.6 = import_ref Main//int_ops, Int32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, Uint32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, Uint32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, IntLiteralToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, Int32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.11: %Int32ToUint16.type = import_ref Main//int_ops, Int32ToUint16, loaded [template = constants.%Int32ToUint16] -// CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, Uint32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, Uint32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, IntLiteralToInt16, unloaded -// CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, IntLiteralToUint16, unloaded -// CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, Int32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, Int32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, Uint32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, Uint32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, Int32ToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, Uint32ToUintLiteral, unloaded -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .UInt = %import_ref.22 -// CHECK:STDOUT: .ImplicitAs = %import_ref.29 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .NegateI32 = imports.%import_ref.1 -// CHECK:STDOUT: .SubI32 = imports.%import_ref.2 -// CHECK:STDOUT: .AddU32 = imports.%import_ref.3 -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.4 -// CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5 -// CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6 -// CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7 -// CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8 -// CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9 -// CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10 -// CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11 -// CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12 -// CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13 -// CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14 -// CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15 -// CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16 -// CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17 -// CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18 -// CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19 -// CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20 -// CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .minus_one_to_u16 = @__global_init.%minus_one_to_u16 -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToUint16(%a.param_patt: %i32) -> %u16 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @SubI32(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.ssub" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Int32ToUint16.ref: %Int32ToUint16.type = name_ref Int32ToUint16, imports.%import_ref.11 [template = constants.%Int32ToUint16] -// CHECK:STDOUT: %SubI32.ref: %SubI32.type = name_ref SubI32, imports.%import_ref.2 [template = constants.%SubI32] -// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc9_50: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_50: = bound_method %int_0, %impl.elem0.loc9_50 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_50: = specific_function %Convert.bound.loc9_50, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_50: init %i32 = call %Convert.specific_fn.loc9_50(%int_0) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc9_50.1: %i32 = value_of_initializer %int.convert_checked.loc9_50 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc9_50.2: %i32 = converted %int_0, %.loc9_50.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %impl.elem0.loc9_53: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_53: = bound_method %int_1, %impl.elem0.loc9_53 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_53: = specific_function %Convert.bound.loc9_53, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_53: init %i32 = call %Convert.specific_fn.loc9_53(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_53.1: %i32 = value_of_initializer %int.convert_checked.loc9_53 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_53.2: %i32 = converted %int_1, %.loc9_53.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.ssub: init %i32 = call %SubI32.ref(%.loc9_50.2, %.loc9_53.2) [template = constants.%int_-1.1] -// CHECK:STDOUT: %.loc9_54.1: %i32 = value_of_initializer %int.ssub [template = constants.%int_-1.1] -// CHECK:STDOUT: %.loc9_54.2: %i32 = converted %int.ssub, %.loc9_54.1 [template = constants.%int_-1.1] -// CHECK:STDOUT: %int.convert_checked.loc9_55: init %u16 = call %Int32ToUint16.ref(%.loc9_54.2) [template = constants.%int_-1.2] -// CHECK:STDOUT: %.loc9_56.1: %u16 = value_of_initializer %int.convert_checked.loc9_55 [template = constants.%int_-1.2] -// CHECK:STDOUT: %.loc9_56.2: %u16 = converted %int.convert_checked.loc9_55, %.loc9_56.1 [template = constants.%int_-1.2] -// CHECK:STDOUT: %minus_one_to_u16: %u16 = bind_name minus_one_to_u16, %.loc9_56.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_negative_i32_to_u32.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [template] -// CHECK:STDOUT: %Int32ToUint32.type: type = fn_type @Int32ToUint32 [template] -// CHECK:STDOUT: %Int32ToUint32: %Int32ToUint32.type = struct_value () [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template] -// CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-1.1: %i32 = int_value -1 [template] -// CHECK:STDOUT: %int_-1.2: %u32 = int_value 18446744073709551615 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, NegateI32, unloaded -// CHECK:STDOUT: %import_ref.2: %SubI32.type = import_ref Main//int_ops, SubI32, loaded [template = constants.%SubI32] -// CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, AddU32, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, Int32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.6: %Int32ToUint32.type = import_ref Main//int_ops, Int32ToUint32, loaded [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, Uint32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, Uint32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, IntLiteralToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, Int32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, Int32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, Uint32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, Uint32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, IntLiteralToInt16, unloaded -// CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, IntLiteralToUint16, unloaded -// CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, Int32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, Int32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, Uint32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, Uint32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, Int32ToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, Uint32ToUintLiteral, unloaded -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .UInt = %import_ref.22 -// CHECK:STDOUT: .ImplicitAs = %import_ref.29 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .NegateI32 = imports.%import_ref.1 -// CHECK:STDOUT: .SubI32 = imports.%import_ref.2 -// CHECK:STDOUT: .AddU32 = imports.%import_ref.3 -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.4 -// CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5 -// CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6 -// CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7 -// CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8 -// CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9 -// CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10 -// CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11 -// CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12 -// CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13 -// CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14 -// CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15 -// CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16 -// CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17 -// CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18 -// CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19 -// CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20 -// CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .minus_one_to_u32 = @__global_init.%minus_one_to_u32 -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToUint32(%a.param_patt: %i32) -> %u32 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @SubI32(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.ssub" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Int32ToUint32.ref: %Int32ToUint32.type = name_ref Int32ToUint32, imports.%import_ref.6 [template = constants.%Int32ToUint32] -// CHECK:STDOUT: %SubI32.ref: %SubI32.type = name_ref SubI32, imports.%import_ref.2 [template = constants.%SubI32] -// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc9_50: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_50: = bound_method %int_0, %impl.elem0.loc9_50 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_50: = specific_function %Convert.bound.loc9_50, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_50: init %i32 = call %Convert.specific_fn.loc9_50(%int_0) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc9_50.1: %i32 = value_of_initializer %int.convert_checked.loc9_50 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc9_50.2: %i32 = converted %int_0, %.loc9_50.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %impl.elem0.loc9_53: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_53: = bound_method %int_1, %impl.elem0.loc9_53 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_53: = specific_function %Convert.bound.loc9_53, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_53: init %i32 = call %Convert.specific_fn.loc9_53(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_53.1: %i32 = value_of_initializer %int.convert_checked.loc9_53 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_53.2: %i32 = converted %int_1, %.loc9_53.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.ssub: init %i32 = call %SubI32.ref(%.loc9_50.2, %.loc9_53.2) [template = constants.%int_-1.1] -// CHECK:STDOUT: %.loc9_54.1: %i32 = value_of_initializer %int.ssub [template = constants.%int_-1.1] -// CHECK:STDOUT: %.loc9_54.2: %i32 = converted %int.ssub, %.loc9_54.1 [template = constants.%int_-1.1] -// CHECK:STDOUT: %int.convert_checked.loc9_55: init %u32 = call %Int32ToUint32.ref(%.loc9_54.2) [template = constants.%int_-1.2] -// CHECK:STDOUT: %.loc9_56.1: %u32 = value_of_initializer %int.convert_checked.loc9_55 [template = constants.%int_-1.2] -// CHECK:STDOUT: %.loc9_56.2: %u32 = converted %int.convert_checked.loc9_55, %.loc9_56.1 [template = constants.%int_-1.2] -// CHECK:STDOUT: %minus_one_to_u32: %u32 = bind_name minus_one_to_u32, %.loc9_56.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_negative_i32_to_u64.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template] -// CHECK:STDOUT: %u64: type = class_type @UInt, @UInt(%int_64) [template] -// CHECK:STDOUT: %Int32ToUint64.type: type = fn_type @Int32ToUint64 [template] -// CHECK:STDOUT: %Int32ToUint64: %Int32ToUint64.type = struct_value () [template] -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %SubI32.type: type = fn_type @SubI32 [template] -// CHECK:STDOUT: %SubI32: %SubI32.type = struct_value () [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-1.1: %i32 = int_value -1 [template] -// CHECK:STDOUT: %int_-1.2: %u64 = int_value 18446744073709551615 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, NegateI32, unloaded -// CHECK:STDOUT: %import_ref.2: %SubI32.type = import_ref Main//int_ops, SubI32, loaded [template = constants.%SubI32] -// CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, AddU32, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, Int32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.6 = import_ref Main//int_ops, Int32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, Uint32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, Uint32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, IntLiteralToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref Main//int_ops, Int32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, Int32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, Uint32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, Uint32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, IntLiteralToInt16, unloaded -// CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, IntLiteralToUint16, unloaded -// CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, Int32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.17: %Int32ToUint64.type = import_ref Main//int_ops, Int32ToUint64, loaded [template = constants.%Int32ToUint64] -// CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, Uint32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, Uint32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, Int32ToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, Uint32ToUintLiteral, unloaded -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .UInt = %import_ref.22 -// CHECK:STDOUT: .ImplicitAs = %import_ref.29 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .NegateI32 = imports.%import_ref.1 -// CHECK:STDOUT: .SubI32 = imports.%import_ref.2 -// CHECK:STDOUT: .AddU32 = imports.%import_ref.3 -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.4 -// CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5 -// CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6 -// CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7 -// CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8 -// CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9 -// CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10 -// CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11 -// CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12 -// CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13 -// CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14 -// CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15 -// CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16 -// CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17 -// CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18 -// CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19 -// CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20 -// CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .minus_one_to_u64 = @__global_init.%minus_one_to_u64 -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToUint64(%a.param_patt: %i32) -> %u64 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @SubI32(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.ssub" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Int32ToUint64.ref: %Int32ToUint64.type = name_ref Int32ToUint64, imports.%import_ref.17 [template = constants.%Int32ToUint64] -// CHECK:STDOUT: %SubI32.ref: %SubI32.type = name_ref SubI32, imports.%import_ref.2 [template = constants.%SubI32] -// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc9_50: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_50: = bound_method %int_0, %impl.elem0.loc9_50 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_50: = specific_function %Convert.bound.loc9_50, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_50: init %i32 = call %Convert.specific_fn.loc9_50(%int_0) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc9_50.1: %i32 = value_of_initializer %int.convert_checked.loc9_50 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc9_50.2: %i32 = converted %int_0, %.loc9_50.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %impl.elem0.loc9_53: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_53: = bound_method %int_1, %impl.elem0.loc9_53 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_53: = specific_function %Convert.bound.loc9_53, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_53: init %i32 = call %Convert.specific_fn.loc9_53(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_53.1: %i32 = value_of_initializer %int.convert_checked.loc9_53 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_53.2: %i32 = converted %int_1, %.loc9_53.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.ssub: init %i32 = call %SubI32.ref(%.loc9_50.2, %.loc9_53.2) [template = constants.%int_-1.1] -// CHECK:STDOUT: %.loc9_54.1: %i32 = value_of_initializer %int.ssub [template = constants.%int_-1.1] -// CHECK:STDOUT: %.loc9_54.2: %i32 = converted %int.ssub, %.loc9_54.1 [template = constants.%int_-1.1] -// CHECK:STDOUT: %int.convert_checked.loc9_55: init %u64 = call %Int32ToUint64.ref(%.loc9_54.2) [template = constants.%int_-1.2] -// CHECK:STDOUT: %.loc9_56.1: %u64 = value_of_initializer %int.convert_checked.loc9_55 [template = constants.%int_-1.2] -// CHECK:STDOUT: %.loc9_56.2: %u64 = converted %int.convert_checked.loc9_55, %.loc9_56.1 [template = constants.%int_-1.2] -// CHECK:STDOUT: %minus_one_to_u64: %u64 = bind_name minus_one_to_u64, %.loc9_56.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_too_small_i32_for_i16.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [template] -// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [template] -// CHECK:STDOUT: %Int32ToInt16.type: type = fn_type @Int32ToInt16 [template] -// CHECK:STDOUT: %Int32ToInt16: %Int32ToInt16.type = struct_value () [template] -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %NegateI32.type: type = fn_type @NegateI32 [template] -// CHECK:STDOUT: %NegateI32: %NegateI32.type = struct_value () [template] -// CHECK:STDOUT: %int_32769.1: Core.IntLiteral = int_value 32769 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_32769.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_32769.2: %i32 = int_value 32769 [template] -// CHECK:STDOUT: %int_-32769.1: %i32 = int_value -32769 [template] -// CHECK:STDOUT: %int_-32769.2: %i16 = int_value -32769 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1: %NegateI32.type = import_ref Main//int_ops, NegateI32, loaded [template = constants.%NegateI32] -// CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, SubI32, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, AddU32, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.5 = import_ref Main//int_ops, Int32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.6 = import_ref Main//int_ops, Int32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, Uint32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, Uint32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, IntLiteralToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.10: %Int32ToInt16.type = import_ref Main//int_ops, Int32ToInt16, loaded [template = constants.%Int32ToInt16] -// CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, Int32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, Uint32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, Uint32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, IntLiteralToInt16, unloaded -// CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, IntLiteralToUint16, unloaded -// CHECK:STDOUT: %import_ref.16 = import_ref Main//int_ops, Int32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, Int32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, Uint32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, Uint32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, Int32ToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, Uint32ToUintLiteral, unloaded -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.22 -// CHECK:STDOUT: .ImplicitAs = %import_ref.26 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .NegateI32 = imports.%import_ref.1 -// CHECK:STDOUT: .SubI32 = imports.%import_ref.2 -// CHECK:STDOUT: .AddU32 = imports.%import_ref.3 -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.4 -// CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5 -// CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6 -// CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7 -// CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8 -// CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9 -// CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10 -// CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11 -// CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12 -// CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13 -// CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14 -// CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15 -// CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16 -// CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17 -// CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18 -// CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19 -// CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20 -// CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .min_minus_one = @__global_init.%min_minus_one -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToInt16(%a.param_patt: %i32) -> %i16 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @NegateI32(%a.param_patt: %i32) -> %i32 = "int.snegate" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Int32ToInt16.ref: %Int32ToInt16.type = name_ref Int32ToInt16, imports.%import_ref.10 [template = constants.%Int32ToInt16] -// CHECK:STDOUT: %NegateI32.ref: %NegateI32.type = name_ref NegateI32, imports.%import_ref.1 [template = constants.%NegateI32] -// CHECK:STDOUT: %int_32769: Core.IntLiteral = int_value 32769 [template = constants.%int_32769.1] -// CHECK:STDOUT: %impl.elem0: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_32769, %impl.elem0 [template = constants.%Convert.bound] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn] -// CHECK:STDOUT: %int.convert_checked.loc9_49: init %i32 = call %Convert.specific_fn(%int_32769) [template = constants.%int_32769.2] -// CHECK:STDOUT: %.loc9_49.1: %i32 = value_of_initializer %int.convert_checked.loc9_49 [template = constants.%int_32769.2] -// CHECK:STDOUT: %.loc9_49.2: %i32 = converted %int_32769, %.loc9_49.1 [template = constants.%int_32769.2] -// CHECK:STDOUT: %int.snegate: init %i32 = call %NegateI32.ref(%.loc9_49.2) [template = constants.%int_-32769.1] -// CHECK:STDOUT: %.loc9_55.1: %i32 = value_of_initializer %int.snegate [template = constants.%int_-32769.1] -// CHECK:STDOUT: %.loc9_55.2: %i32 = converted %int.snegate, %.loc9_55.1 [template = constants.%int_-32769.1] -// CHECK:STDOUT: %int.convert_checked.loc9_56: init %i16 = call %Int32ToInt16.ref(%.loc9_55.2) [template = constants.%int_-32769.2] -// CHECK:STDOUT: %.loc9_57.1: %i16 = value_of_initializer %int.convert_checked.loc9_56 [template = constants.%int_-32769.2] -// CHECK:STDOUT: %.loc9_57.2: %i16 = converted %int.convert_checked.loc9_56, %.loc9_57.1 [template = constants.%int_-32769.2] -// CHECK:STDOUT: %min_minus_one: %i16 = bind_name min_minus_one, %.loc9_57.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_not_constant.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [template] -// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [template] -// CHECK:STDOUT: %Int32ToInt16.type: type = fn_type @Int32ToInt16 [template] -// CHECK:STDOUT: %Int32ToInt16: %Int32ToInt16.type = struct_value () [template] -// CHECK:STDOUT: %Int32ToInt32.type: type = fn_type @Int32ToInt32 [template] -// CHECK:STDOUT: %Int32ToInt32: %Int32ToInt32.type = struct_value () [template] -// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template] -// CHECK:STDOUT: %i64: type = class_type @Int, @Int(%int_64) [template] -// CHECK:STDOUT: %Int32ToInt64.type: type = fn_type @Int32ToInt64 [template] -// CHECK:STDOUT: %Int32ToInt64: %Int32ToInt64.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//int_ops, NegateI32, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref Main//int_ops, SubI32, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref Main//int_ops, AddU32, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref Main//int_ops, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.5: %Int32ToInt32.type = import_ref Main//int_ops, Int32ToInt32, loaded [template = constants.%Int32ToInt32] -// CHECK:STDOUT: %import_ref.6 = import_ref Main//int_ops, Int32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.7 = import_ref Main//int_ops, Uint32ToInt32, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref Main//int_ops, Uint32ToUint32, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref Main//int_ops, IntLiteralToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.10: %Int32ToInt16.type = import_ref Main//int_ops, Int32ToInt16, loaded [template = constants.%Int32ToInt16] -// CHECK:STDOUT: %import_ref.11 = import_ref Main//int_ops, Int32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.12 = import_ref Main//int_ops, Uint32ToInt16, unloaded -// CHECK:STDOUT: %import_ref.13 = import_ref Main//int_ops, Uint32ToUint16, unloaded -// CHECK:STDOUT: %import_ref.14 = import_ref Main//int_ops, IntLiteralToInt16, unloaded -// CHECK:STDOUT: %import_ref.15 = import_ref Main//int_ops, IntLiteralToUint16, unloaded -// CHECK:STDOUT: %import_ref.16: %Int32ToInt64.type = import_ref Main//int_ops, Int32ToInt64, loaded [template = constants.%Int32ToInt64] -// CHECK:STDOUT: %import_ref.17 = import_ref Main//int_ops, Int32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.18 = import_ref Main//int_ops, Uint32ToInt64, unloaded -// CHECK:STDOUT: %import_ref.19 = import_ref Main//int_ops, Uint32ToUint64, unloaded -// CHECK:STDOUT: %import_ref.20 = import_ref Main//int_ops, Int32ToIntLiteral, unloaded -// CHECK:STDOUT: %import_ref.21 = import_ref Main//int_ops, Uint32ToUintLiteral, unloaded -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.22 -// CHECK:STDOUT: .ImplicitAs = %import_ref.26 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .NegateI32 = imports.%import_ref.1 -// CHECK:STDOUT: .SubI32 = imports.%import_ref.2 -// CHECK:STDOUT: .AddU32 = imports.%import_ref.3 -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.4 -// CHECK:STDOUT: .Int32ToInt32 = imports.%import_ref.5 -// CHECK:STDOUT: .Int32ToUint32 = imports.%import_ref.6 -// CHECK:STDOUT: .Uint32ToInt32 = imports.%import_ref.7 -// CHECK:STDOUT: .Uint32ToUint32 = imports.%import_ref.8 -// CHECK:STDOUT: .IntLiteralToIntLiteral = imports.%import_ref.9 -// CHECK:STDOUT: .Int32ToInt16 = imports.%import_ref.10 -// CHECK:STDOUT: .Int32ToUint16 = imports.%import_ref.11 -// CHECK:STDOUT: .Uint32ToInt16 = imports.%import_ref.12 -// CHECK:STDOUT: .Uint32ToUint16 = imports.%import_ref.13 -// CHECK:STDOUT: .IntLiteralToInt16 = imports.%import_ref.14 -// CHECK:STDOUT: .IntLiteralToUint16 = imports.%import_ref.15 -// CHECK:STDOUT: .Int32ToInt64 = imports.%import_ref.16 -// CHECK:STDOUT: .Int32ToUint64 = imports.%import_ref.17 -// CHECK:STDOUT: .Uint32ToInt64 = imports.%import_ref.18 -// CHECK:STDOUT: .Uint32ToUint64 = imports.%import_ref.19 -// CHECK:STDOUT: .Int32ToIntLiteral = imports.%import_ref.20 -// CHECK:STDOUT: .Uint32ToUintLiteral = imports.%import_ref.21 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .not_constant = @__global_init.%not_constant -// CHECK:STDOUT: .convert_not_constant_narrow = @__global_init.%convert_not_constant_narrow -// CHECK:STDOUT: .convert_not_constant_same = @__global_init.%convert_not_constant_same -// CHECK:STDOUT: .convert_not_constant_widen = @__global_init.%convert_not_constant_widen -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToInt16(%a.param_patt: %i32) -> %i16 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToInt32(%a.param_patt: %i32) -> %i32 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int32ToInt64(%a.param_patt: %i32) -> %i64 = "int.convert_checked" [from "int_ops.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_0, %impl.elem0 [template = constants.%Convert.bound] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn] -// CHECK:STDOUT: %int.convert_checked.loc5: init %i32 = call %Convert.specific_fn(%int_0) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc5_26.1: %i32 = value_of_initializer %int.convert_checked.loc5 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc5_26.2: %i32 = converted %int_0, %.loc5_26.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %not_constant: %i32 = bind_name not_constant, %.loc5_26.2 -// CHECK:STDOUT: %Int32ToInt16.ref: %Int32ToInt16.type = name_ref Int32ToInt16, imports.%import_ref.10 [template = constants.%Int32ToInt16] -// CHECK:STDOUT: %not_constant.ref.loc15: %i32 = name_ref not_constant, %not_constant -// CHECK:STDOUT: %int.convert_checked.loc15: init %i16 = call %Int32ToInt16.ref(%not_constant.ref.loc15) -// CHECK:STDOUT: %.loc15_66.1: %i16 = value_of_initializer %int.convert_checked.loc15 -// CHECK:STDOUT: %.loc15_66.2: %i16 = converted %int.convert_checked.loc15, %.loc15_66.1 -// CHECK:STDOUT: %convert_not_constant_narrow: %i16 = bind_name convert_not_constant_narrow, %.loc15_66.2 -// CHECK:STDOUT: %Int32ToInt32.ref: %Int32ToInt32.type = name_ref Int32ToInt32, imports.%import_ref.5 [template = constants.%Int32ToInt32] -// CHECK:STDOUT: %not_constant.ref.loc25: %i32 = name_ref not_constant, %not_constant -// CHECK:STDOUT: %int.convert_checked.loc25: init %i32 = call %Int32ToInt32.ref(%not_constant.ref.loc25) -// CHECK:STDOUT: %.loc25_64.1: %i32 = value_of_initializer %int.convert_checked.loc25 -// CHECK:STDOUT: %.loc25_64.2: %i32 = converted %int.convert_checked.loc25, %.loc25_64.1 -// CHECK:STDOUT: %convert_not_constant_same: %i32 = bind_name convert_not_constant_same, %.loc25_64.2 -// CHECK:STDOUT: %Int32ToInt64.ref: %Int32ToInt64.type = name_ref Int32ToInt64, imports.%import_ref.16 [template = constants.%Int32ToInt64] -// CHECK:STDOUT: %not_constant.ref.loc34: %i32 = name_ref not_constant, %not_constant -// CHECK:STDOUT: %int.convert_checked.loc34: init %i64 = call %Int32ToInt64.ref(%not_constant.ref.loc34) -// CHECK:STDOUT: %.loc34_65.1: %i64 = value_of_initializer %int.convert_checked.loc34 -// CHECK:STDOUT: %.loc34_65.2: %i64 = converted %int.convert_checked.loc34, %.loc34_65.1 -// CHECK:STDOUT: %convert_not_constant_widen: %i64 = bind_name convert_not_constant_widen, %.loc34_65.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/eq.carbon b/toolchain/check/testdata/builtins/int/eq.carbon index 88ec32a2a1d81..2700539af9293 100644 --- a/toolchain/check/testdata/builtins/int/eq.carbon +++ b/toolchain/check/testdata/builtins/int/eq.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/eq.carbon @@ -20,7 +22,7 @@ fn F(true_: True, false_: False) { false_ as (if Eq(1, 2) then True else False); } -fn RuntimeCall(a: i32, b: i32) -> bool { +fn RuntimeCallIsValid(a: i32, b: i32) -> bool { return Eq(a, b); } @@ -32,274 +34,3 @@ package FailBadDecl; // CHECK:STDERR: fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; - -// CHECK:STDOUT: --- int_eq.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] -// CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] -// CHECK:STDOUT: %Eq.type.1: type = fn_type @Eq.1 [template] -// CHECK:STDOUT: %Eq: %Eq.type.1 = struct_value () [template] -// CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] -// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] -// CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %F.type: type = fn_type @F [template] -// CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %true: bool = bool_literal true [template] -// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template] -// CHECK:STDOUT: %false: bool = bool_literal false [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .Bool = %import_ref.5 -// CHECK:STDOUT: .ImplicitAs = %import_ref.6 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Eq = %Eq.decl -// CHECK:STDOUT: .True = %True.decl -// CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Eq.decl: %Eq.type.1 = fn_decl @Eq.1 [template = constants.%Eq] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %.loc2_26.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc2_26.2: type = converted %bool.make_type, %.loc2_26.1 [template = bool] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_10: type = splice_block %i32.loc2_10 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_10: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_10: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_18: type = splice_block %i32.loc2_18 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_18: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_18: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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: %True.decl: type = class_decl @True [template = constants.%True] {} {} -// CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} {} -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { -// CHECK:STDOUT: %true_.patt: %True = binding_pattern true_ -// CHECK:STDOUT: %true_.param_patt: %True = value_param_pattern %true_.patt, runtime_param0 -// CHECK:STDOUT: %false_.patt: %False = binding_pattern false_ -// CHECK:STDOUT: %false_.param_patt: %False = value_param_pattern %false_.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %true_.param: %True = value_param runtime_param0 -// CHECK:STDOUT: %True.ref.loc7: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: %true_: %True = bind_name true_, %true_.param -// CHECK:STDOUT: %false_.param: %False = value_param runtime_param1 -// CHECK:STDOUT: %False.ref.loc7: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: %false_: %False = bind_name false_, %false_.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %.loc12_35.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc12_35.2: type = converted %bool.make_type, %.loc12_35.1 [template = bool] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc12_19: type = splice_block %i32.loc12_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc12_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc12_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc12_27: type = splice_block %i32.loc12_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc12_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc12_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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: class @True { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%True -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @False { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%False -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Eq.1(%a.param_patt: %i32, %b.param_patt: %i32) -> bool = "int.eq"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%true_.param_patt: %True, %false_.param_patt: %False) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %true_.ref: %True = name_ref true_, %true_ -// CHECK:STDOUT: %Eq.ref.loc8: %Eq.type.1 = name_ref Eq, file.%Eq.decl [template = constants.%Eq] -// CHECK:STDOUT: %int_1.loc8_19: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_1.loc8_22: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc8_19: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_19: = bound_method %int_1.loc8_19, %impl.elem0.loc8_19 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc8_19: = specific_function %Convert.bound.loc8_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc8_19: init %i32 = call %Convert.specific_fn.loc8_19(%int_1.loc8_19) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.convert_checked.loc8_19 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int_1.loc8_19, %.loc8_19.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc8_22: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_22: = bound_method %int_1.loc8_22, %impl.elem0.loc8_22 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc8_22: = specific_function %Convert.bound.loc8_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc8_22: init %i32 = call %Convert.specific_fn.loc8_22(%int_1.loc8_22) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_22.1: %i32 = value_of_initializer %int.convert_checked.loc8_22 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_22.2: %i32 = converted %int_1.loc8_22, %.loc8_22.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.eq.loc8: init bool = call %Eq.ref.loc8(%.loc8_19.2, %.loc8_22.2) [template = constants.%true] -// CHECK:STDOUT: %.loc8_13.1: bool = value_of_initializer %int.eq.loc8 [template = constants.%true] -// CHECK:STDOUT: %.loc8_13.2: bool = converted %int.eq.loc8, %.loc8_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc8_13.2 br !if.expr.then.loc8 else br !if.expr.else.loc8 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc8: -// CHECK:STDOUT: %True.ref.loc8: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc8(%True.ref.loc8) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc8: -// CHECK:STDOUT: %False.ref.loc8: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc8(%False.ref.loc8) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc8: -// CHECK:STDOUT: %.loc8_13.3: type = block_arg !if.expr.result.loc8 [template = constants.%True] -// CHECK:STDOUT: %false_.ref: %False = name_ref false_, %false_ -// CHECK:STDOUT: %Eq.ref.loc9: %Eq.type.1 = name_ref Eq, file.%Eq.decl [template = constants.%Eq] -// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %impl.elem0.loc9_20: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_20: = bound_method %int_1.loc9, %impl.elem0.loc9_20 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_20: = specific_function %Convert.bound.loc9_20, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_20: init %i32 = call %Convert.specific_fn.loc9_20(%int_1.loc9) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_20.1: %i32 = value_of_initializer %int.convert_checked.loc9_20 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_20.2: %i32 = converted %int_1.loc9, %.loc9_20.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc9_23: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_23: = bound_method %int_2, %impl.elem0.loc9_23 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_23: = specific_function %Convert.bound.loc9_23, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_23: init %i32 = call %Convert.specific_fn.loc9_23(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_23.1: %i32 = value_of_initializer %int.convert_checked.loc9_23 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_23.2: %i32 = converted %int_2, %.loc9_23.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.eq.loc9: init bool = call %Eq.ref.loc9(%.loc9_20.2, %.loc9_23.2) [template = constants.%false] -// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %int.eq.loc9 [template = constants.%false] -// CHECK:STDOUT: %.loc9_14.2: bool = converted %int.eq.loc9, %.loc9_14.1 [template = constants.%false] -// CHECK:STDOUT: if %.loc9_14.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc9: -// CHECK:STDOUT: %True.ref.loc9: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc9(%True.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc9: -// CHECK:STDOUT: %False.ref.loc9: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc9(%False.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc9: -// CHECK:STDOUT: %.loc9_14.3: type = block_arg !if.expr.result.loc9 [template = constants.%False] -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> bool { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Eq.ref: %Eq.type.1 = name_ref Eq, file.%Eq.decl [template = constants.%Eq] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.eq: init bool = call %Eq.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc13_18.1: bool = value_of_initializer %int.eq -// CHECK:STDOUT: %.loc13_18.2: bool = converted %int.eq, %.loc13_18.1 -// CHECK:STDOUT: return %.loc13_18.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_bad_decl.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %WrongResult.type: type = fn_type @WrongResult [template] -// CHECK:STDOUT: %WrongResult: %WrongResult.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .WrongResult = %WrongResult.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %WrongResult.decl: %WrongResult.type = fn_decl @WrongResult [template = constants.%WrongResult] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @WrongResult(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32; -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/greater.carbon b/toolchain/check/testdata/builtins/int/greater.carbon index 679fa7f939e15..5b5925db71832 100644 --- a/toolchain/check/testdata/builtins/int/greater.carbon +++ b/toolchain/check/testdata/builtins/int/greater.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/greater.carbon @@ -24,353 +26,6 @@ fn F(true_: True, false_: False) { true_ as (if Greater(0, Negate(1)) then True else False); } -fn RuntimeCall(a: i32, b: i32) -> bool { +fn RuntimeCallIsValid(a: i32, b: i32) -> bool { return Greater(a, b); } - -// CHECK:STDOUT: --- int_greater.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] -// CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] -// CHECK:STDOUT: %Greater.type.1: type = fn_type @Greater.1 [template] -// CHECK:STDOUT: %Greater.1: %Greater.type.1 = struct_value () [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] -// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] -// CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %F.type: type = fn_type @F [template] -// CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template] -// CHECK:STDOUT: %false: bool = bool_literal false [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: %true: bool = bool_literal true [template] -// CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .Bool = %import_ref.5 -// CHECK:STDOUT: .ImplicitAs = %import_ref.6 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Greater = %Greater.decl -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .True = %True.decl -// CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Greater.decl: %Greater.type.1 = fn_decl @Greater.1 [template = constants.%Greater.1] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %.loc2_31.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc2_31.2: type = converted %bool.make_type, %.loc2_31.1 [template = bool] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_15: type = splice_block %i32.loc2_15 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_15: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_15: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_23: type = splice_block %i32.loc2_23 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_23: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_23: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc3_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc3: type = splice_block %i32.loc3_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc3_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} {} -// CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} {} -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { -// CHECK:STDOUT: %true_.patt: %True = binding_pattern true_ -// CHECK:STDOUT: %true_.param_patt: %True = value_param_pattern %true_.patt, runtime_param0 -// CHECK:STDOUT: %false_.patt: %False = binding_pattern false_ -// CHECK:STDOUT: %false_.param_patt: %False = value_param_pattern %false_.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %true_.param: %True = value_param runtime_param0 -// CHECK:STDOUT: %True.ref.loc8: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: %true_: %True = bind_name true_, %true_.param -// CHECK:STDOUT: %false_.param: %False = value_param runtime_param1 -// CHECK:STDOUT: %False.ref.loc8: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: %false_: %False = bind_name false_, %false_.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %.loc16_35.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type, %.loc16_35.1 [template = bool] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc16_19: type = splice_block %i32.loc16_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc16_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc16_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc16_27: type = splice_block %i32.loc16_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc16_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc16_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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: class @True { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%True -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @False { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%False -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Greater.1(%a.param_patt: %i32, %b.param_patt: %i32) -> bool = "int.greater"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.snegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%true_.param_patt: %True, %false_.param_patt: %False) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %false_.ref.loc9: %False = name_ref false_, %false_ -// CHECK:STDOUT: %Greater.ref.loc9: %Greater.type.1 = name_ref Greater, file.%Greater.decl [template = constants.%Greater.1] -// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %impl.elem0.loc9_25: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_25: = bound_method %int_1.loc9, %impl.elem0.loc9_25 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_25: = specific_function %Convert.bound.loc9_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_25: init %i32 = call %Convert.specific_fn.loc9_25(%int_1.loc9) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_25.1: %i32 = value_of_initializer %int.convert_checked.loc9_25 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_25.2: %i32 = converted %int_1.loc9, %.loc9_25.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc9_28: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_28: = bound_method %int_2, %impl.elem0.loc9_28 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_28: = specific_function %Convert.bound.loc9_28, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_28: init %i32 = call %Convert.specific_fn.loc9_28(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_28.1: %i32 = value_of_initializer %int.convert_checked.loc9_28 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_28.2: %i32 = converted %int_2, %.loc9_28.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.greater.loc9: init bool = call %Greater.ref.loc9(%.loc9_25.2, %.loc9_28.2) [template = constants.%false] -// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %int.greater.loc9 [template = constants.%false] -// CHECK:STDOUT: %.loc9_14.2: bool = converted %int.greater.loc9, %.loc9_14.1 [template = constants.%false] -// CHECK:STDOUT: if %.loc9_14.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc9: -// CHECK:STDOUT: %True.ref.loc9: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc9(%True.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc9: -// CHECK:STDOUT: %False.ref.loc9: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc9(%False.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc9: -// CHECK:STDOUT: %.loc9_14.3: type = block_arg !if.expr.result.loc9 [template = constants.%False] -// CHECK:STDOUT: %false_.ref.loc10: %False = name_ref false_, %false_ -// CHECK:STDOUT: %Greater.ref.loc10: %Greater.type.1 = name_ref Greater, file.%Greater.decl [template = constants.%Greater.1] -// CHECK:STDOUT: %int_1.loc10_25: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_1.loc10_28: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc10_25: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_25: = bound_method %int_1.loc10_25, %impl.elem0.loc10_25 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_25: = specific_function %Convert.bound.loc10_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_25: init %i32 = call %Convert.specific_fn.loc10_25(%int_1.loc10_25) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_25.1: %i32 = value_of_initializer %int.convert_checked.loc10_25 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_25.2: %i32 = converted %int_1.loc10_25, %.loc10_25.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc10_28: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_28: = bound_method %int_1.loc10_28, %impl.elem0.loc10_28 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_28: = specific_function %Convert.bound.loc10_28, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_28: init %i32 = call %Convert.specific_fn.loc10_28(%int_1.loc10_28) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_28.1: %i32 = value_of_initializer %int.convert_checked.loc10_28 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_28.2: %i32 = converted %int_1.loc10_28, %.loc10_28.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.greater.loc10: init bool = call %Greater.ref.loc10(%.loc10_25.2, %.loc10_28.2) [template = constants.%false] -// CHECK:STDOUT: %.loc10_14.1: bool = value_of_initializer %int.greater.loc10 [template = constants.%false] -// CHECK:STDOUT: %.loc10_14.2: bool = converted %int.greater.loc10, %.loc10_14.1 [template = constants.%false] -// CHECK:STDOUT: if %.loc10_14.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc10: -// CHECK:STDOUT: %True.ref.loc10: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc10(%True.ref.loc10) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc10: -// CHECK:STDOUT: %False.ref.loc10: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc10(%False.ref.loc10) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc10: -// CHECK:STDOUT: %.loc10_14.3: type = block_arg !if.expr.result.loc10 [template = constants.%False] -// CHECK:STDOUT: %true_.ref.loc11: %True = name_ref true_, %true_ -// CHECK:STDOUT: %Greater.ref.loc11: %Greater.type.1 = name_ref Greater, file.%Greater.decl [template = constants.%Greater.1] -// CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_0.loc11: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc11_24: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_24: = bound_method %int_1.loc11, %impl.elem0.loc11_24 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc11_24: = specific_function %Convert.bound.loc11_24, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc11_24: init %i32 = call %Convert.specific_fn.loc11_24(%int_1.loc11) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc11_24.1: %i32 = value_of_initializer %int.convert_checked.loc11_24 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc11_24.2: %i32 = converted %int_1.loc11, %.loc11_24.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc11_27: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_27: = bound_method %int_0.loc11, %impl.elem0.loc11_27 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc11_27: = specific_function %Convert.bound.loc11_27, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc11_27: init %i32 = call %Convert.specific_fn.loc11_27(%int_0.loc11) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_27.1: %i32 = value_of_initializer %int.convert_checked.loc11_27 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_27.2: %i32 = converted %int_0.loc11, %.loc11_27.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.greater.loc11: init bool = call %Greater.ref.loc11(%.loc11_24.2, %.loc11_27.2) [template = constants.%true] -// CHECK:STDOUT: %.loc11_13.1: bool = value_of_initializer %int.greater.loc11 [template = constants.%true] -// CHECK:STDOUT: %.loc11_13.2: bool = converted %int.greater.loc11, %.loc11_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc11_13.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc11: -// CHECK:STDOUT: %True.ref.loc11: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc11(%True.ref.loc11) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc11: -// CHECK:STDOUT: %False.ref.loc11: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc11(%False.ref.loc11) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc11: -// CHECK:STDOUT: %.loc11_13.3: type = block_arg !if.expr.result.loc11 [template = constants.%True] -// CHECK:STDOUT: %false_.ref.loc12: %False = name_ref false_, %false_ -// CHECK:STDOUT: %Greater.ref.loc12: %Greater.type.1 = name_ref Greater, file.%Greater.decl [template = constants.%Greater.1] -// CHECK:STDOUT: %Negate.ref.loc12: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc12: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc12_32: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_32: = bound_method %int_1.loc12, %impl.elem0.loc12_32 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc12_32: = specific_function %Convert.bound.loc12_32, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc12_32: init %i32 = call %Convert.specific_fn.loc12_32(%int_1.loc12) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_32.1: %i32 = value_of_initializer %int.convert_checked.loc12_32 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_32.2: %i32 = converted %int_1.loc12, %.loc12_32.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc12: init %i32 = call %Negate.ref.loc12(%.loc12_32.2) [template = constants.%int_-1] -// CHECK:STDOUT: %int_0.loc12: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc12_33.1: %i32 = value_of_initializer %int.snegate.loc12 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc12_33.2: %i32 = converted %int.snegate.loc12, %.loc12_33.1 [template = constants.%int_-1] -// CHECK:STDOUT: %impl.elem0.loc12_36: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_36: = bound_method %int_0.loc12, %impl.elem0.loc12_36 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc12_36: = specific_function %Convert.bound.loc12_36, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc12_36: init %i32 = call %Convert.specific_fn.loc12_36(%int_0.loc12) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc12_36.1: %i32 = value_of_initializer %int.convert_checked.loc12_36 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc12_36.2: %i32 = converted %int_0.loc12, %.loc12_36.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.greater.loc12: init bool = call %Greater.ref.loc12(%.loc12_33.2, %.loc12_36.2) [template = constants.%false] -// CHECK:STDOUT: %.loc12_14.1: bool = value_of_initializer %int.greater.loc12 [template = constants.%false] -// CHECK:STDOUT: %.loc12_14.2: bool = converted %int.greater.loc12, %.loc12_14.1 [template = constants.%false] -// CHECK:STDOUT: if %.loc12_14.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc12: -// CHECK:STDOUT: %True.ref.loc12: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc12(%True.ref.loc12) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc12: -// CHECK:STDOUT: %False.ref.loc12: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc12(%False.ref.loc12) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc12: -// CHECK:STDOUT: %.loc12_14.3: type = block_arg !if.expr.result.loc12 [template = constants.%False] -// CHECK:STDOUT: %true_.ref.loc13: %True = name_ref true_, %true_ -// CHECK:STDOUT: %Greater.ref.loc13: %Greater.type.1 = name_ref Greater, file.%Greater.decl [template = constants.%Greater.1] -// CHECK:STDOUT: %int_0.loc13: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %Negate.ref.loc13: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc13_34: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_34: = bound_method %int_1.loc13, %impl.elem0.loc13_34 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc13_34: = specific_function %Convert.bound.loc13_34, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc13_34: init %i32 = call %Convert.specific_fn.loc13_34(%int_1.loc13) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_34.1: %i32 = value_of_initializer %int.convert_checked.loc13_34 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_34.2: %i32 = converted %int_1.loc13, %.loc13_34.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc13: init %i32 = call %Negate.ref.loc13(%.loc13_34.2) [template = constants.%int_-1] -// CHECK:STDOUT: %impl.elem0.loc13_24: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_24: = bound_method %int_0.loc13, %impl.elem0.loc13_24 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc13_24: = specific_function %Convert.bound.loc13_24, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc13_24: init %i32 = call %Convert.specific_fn.loc13_24(%int_0.loc13) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_24.1: %i32 = value_of_initializer %int.convert_checked.loc13_24 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_24.2: %i32 = converted %int_0.loc13, %.loc13_24.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_35.1: %i32 = value_of_initializer %int.snegate.loc13 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc13_35.2: %i32 = converted %int.snegate.loc13, %.loc13_35.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.greater.loc13: init bool = call %Greater.ref.loc13(%.loc13_24.2, %.loc13_35.2) [template = constants.%true] -// CHECK:STDOUT: %.loc13_13.1: bool = value_of_initializer %int.greater.loc13 [template = constants.%true] -// CHECK:STDOUT: %.loc13_13.2: bool = converted %int.greater.loc13, %.loc13_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc13_13.2 br !if.expr.then.loc13 else br !if.expr.else.loc13 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc13: -// CHECK:STDOUT: %True.ref.loc13: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc13(%True.ref.loc13) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc13: -// CHECK:STDOUT: %False.ref.loc13: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc13(%False.ref.loc13) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc13: -// CHECK:STDOUT: %.loc13_13.3: type = block_arg !if.expr.result.loc13 [template = constants.%True] -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> bool { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Greater.ref: %Greater.type.1 = name_ref Greater, file.%Greater.decl [template = constants.%Greater.1] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.greater: init bool = call %Greater.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc17_23.1: bool = value_of_initializer %int.greater -// CHECK:STDOUT: %.loc17_23.2: bool = converted %int.greater, %.loc17_23.1 -// CHECK:STDOUT: return %.loc17_23.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/greater_eq.carbon b/toolchain/check/testdata/builtins/int/greater_eq.carbon index 8f865aab5e5e9..952e906458a0a 100644 --- a/toolchain/check/testdata/builtins/int/greater_eq.carbon +++ b/toolchain/check/testdata/builtins/int/greater_eq.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/greater_eq.carbon @@ -24,353 +26,6 @@ fn F(true_: True, false_: False) { true_ as (if GreaterEq(0, Negate(1)) then True else False); } -fn RuntimeCall(a: i32, b: i32) -> bool { +fn RuntimeCallIsValid(a: i32, b: i32) -> bool { return GreaterEq(a, b); } - -// CHECK:STDOUT: --- int_greater_eq.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] -// CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] -// CHECK:STDOUT: %GreaterEq.type: type = fn_type @GreaterEq [template] -// CHECK:STDOUT: %GreaterEq: %GreaterEq.type = struct_value () [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] -// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] -// CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %F.type: type = fn_type @F [template] -// CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template] -// CHECK:STDOUT: %false: bool = bool_literal false [template] -// CHECK:STDOUT: %true: bool = bool_literal true [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .Bool = %import_ref.5 -// CHECK:STDOUT: .ImplicitAs = %import_ref.6 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .GreaterEq = %GreaterEq.decl -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .True = %True.decl -// CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %GreaterEq.decl: %GreaterEq.type = fn_decl @GreaterEq [template = constants.%GreaterEq] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %.loc2_33.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc2_33.2: type = converted %bool.make_type, %.loc2_33.1 [template = bool] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_17: type = splice_block %i32.loc2_17 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_17: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_25: type = splice_block %i32.loc2_25 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc3_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc3: type = splice_block %i32.loc3_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc3_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} {} -// CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} {} -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { -// CHECK:STDOUT: %true_.patt: %True = binding_pattern true_ -// CHECK:STDOUT: %true_.param_patt: %True = value_param_pattern %true_.patt, runtime_param0 -// CHECK:STDOUT: %false_.patt: %False = binding_pattern false_ -// CHECK:STDOUT: %false_.param_patt: %False = value_param_pattern %false_.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %true_.param: %True = value_param runtime_param0 -// CHECK:STDOUT: %True.ref.loc8: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: %true_: %True = bind_name true_, %true_.param -// CHECK:STDOUT: %false_.param: %False = value_param runtime_param1 -// CHECK:STDOUT: %False.ref.loc8: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: %false_: %False = bind_name false_, %false_.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %.loc16_35.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type, %.loc16_35.1 [template = bool] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc16_19: type = splice_block %i32.loc16_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc16_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc16_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc16_27: type = splice_block %i32.loc16_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc16_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc16_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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: class @True { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%True -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @False { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%False -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @GreaterEq(%a.param_patt: %i32, %b.param_patt: %i32) -> bool = "int.greater_eq"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.snegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%true_.param_patt: %True, %false_.param_patt: %False) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %false_.ref.loc9: %False = name_ref false_, %false_ -// CHECK:STDOUT: %GreaterEq.ref.loc9: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] -// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %impl.elem0.loc9_27: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_27: = bound_method %int_1.loc9, %impl.elem0.loc9_27 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_27: = specific_function %Convert.bound.loc9_27, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_27: init %i32 = call %Convert.specific_fn.loc9_27(%int_1.loc9) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_27.1: %i32 = value_of_initializer %int.convert_checked.loc9_27 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_27.2: %i32 = converted %int_1.loc9, %.loc9_27.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc9_30: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_30: = bound_method %int_2, %impl.elem0.loc9_30 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_30: = specific_function %Convert.bound.loc9_30, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_30: init %i32 = call %Convert.specific_fn.loc9_30(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_30.1: %i32 = value_of_initializer %int.convert_checked.loc9_30 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_30.2: %i32 = converted %int_2, %.loc9_30.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.greater_eq.loc9: init bool = call %GreaterEq.ref.loc9(%.loc9_27.2, %.loc9_30.2) [template = constants.%false] -// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %int.greater_eq.loc9 [template = constants.%false] -// CHECK:STDOUT: %.loc9_14.2: bool = converted %int.greater_eq.loc9, %.loc9_14.1 [template = constants.%false] -// CHECK:STDOUT: if %.loc9_14.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc9: -// CHECK:STDOUT: %True.ref.loc9: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc9(%True.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc9: -// CHECK:STDOUT: %False.ref.loc9: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc9(%False.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc9: -// CHECK:STDOUT: %.loc9_14.3: type = block_arg !if.expr.result.loc9 [template = constants.%False] -// CHECK:STDOUT: %true_.ref.loc10: %True = name_ref true_, %true_ -// CHECK:STDOUT: %GreaterEq.ref.loc10: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] -// CHECK:STDOUT: %int_1.loc10_26: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_1.loc10_29: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc10_26: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_26: = bound_method %int_1.loc10_26, %impl.elem0.loc10_26 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_26: = specific_function %Convert.bound.loc10_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_26: init %i32 = call %Convert.specific_fn.loc10_26(%int_1.loc10_26) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_26.1: %i32 = value_of_initializer %int.convert_checked.loc10_26 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_26.2: %i32 = converted %int_1.loc10_26, %.loc10_26.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc10_29: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_29: = bound_method %int_1.loc10_29, %impl.elem0.loc10_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_29: = specific_function %Convert.bound.loc10_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_29: init %i32 = call %Convert.specific_fn.loc10_29(%int_1.loc10_29) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_29.1: %i32 = value_of_initializer %int.convert_checked.loc10_29 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_29.2: %i32 = converted %int_1.loc10_29, %.loc10_29.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.greater_eq.loc10: init bool = call %GreaterEq.ref.loc10(%.loc10_26.2, %.loc10_29.2) [template = constants.%true] -// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %int.greater_eq.loc10 [template = constants.%true] -// CHECK:STDOUT: %.loc10_13.2: bool = converted %int.greater_eq.loc10, %.loc10_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc10_13.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc10: -// CHECK:STDOUT: %True.ref.loc10: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc10(%True.ref.loc10) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc10: -// CHECK:STDOUT: %False.ref.loc10: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc10(%False.ref.loc10) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc10: -// CHECK:STDOUT: %.loc10_13.3: type = block_arg !if.expr.result.loc10 [template = constants.%True] -// CHECK:STDOUT: %true_.ref.loc11: %True = name_ref true_, %true_ -// CHECK:STDOUT: %GreaterEq.ref.loc11: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] -// CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_0.loc11: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc11_26: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_26: = bound_method %int_1.loc11, %impl.elem0.loc11_26 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc11_26: = specific_function %Convert.bound.loc11_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc11_26: init %i32 = call %Convert.specific_fn.loc11_26(%int_1.loc11) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc11_26.1: %i32 = value_of_initializer %int.convert_checked.loc11_26 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc11_26.2: %i32 = converted %int_1.loc11, %.loc11_26.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc11_29: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_29: = bound_method %int_0.loc11, %impl.elem0.loc11_29 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc11_29: = specific_function %Convert.bound.loc11_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc11_29: init %i32 = call %Convert.specific_fn.loc11_29(%int_0.loc11) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_29.1: %i32 = value_of_initializer %int.convert_checked.loc11_29 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_29.2: %i32 = converted %int_0.loc11, %.loc11_29.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.greater_eq.loc11: init bool = call %GreaterEq.ref.loc11(%.loc11_26.2, %.loc11_29.2) [template = constants.%true] -// CHECK:STDOUT: %.loc11_13.1: bool = value_of_initializer %int.greater_eq.loc11 [template = constants.%true] -// CHECK:STDOUT: %.loc11_13.2: bool = converted %int.greater_eq.loc11, %.loc11_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc11_13.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc11: -// CHECK:STDOUT: %True.ref.loc11: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc11(%True.ref.loc11) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc11: -// CHECK:STDOUT: %False.ref.loc11: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc11(%False.ref.loc11) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc11: -// CHECK:STDOUT: %.loc11_13.3: type = block_arg !if.expr.result.loc11 [template = constants.%True] -// CHECK:STDOUT: %false_.ref.loc12: %False = name_ref false_, %false_ -// CHECK:STDOUT: %GreaterEq.ref.loc12: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] -// CHECK:STDOUT: %Negate.ref.loc12: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc12: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc12_34: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_34: = bound_method %int_1.loc12, %impl.elem0.loc12_34 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc12_34: = specific_function %Convert.bound.loc12_34, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc12_34: init %i32 = call %Convert.specific_fn.loc12_34(%int_1.loc12) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_34.1: %i32 = value_of_initializer %int.convert_checked.loc12_34 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_34.2: %i32 = converted %int_1.loc12, %.loc12_34.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc12: init %i32 = call %Negate.ref.loc12(%.loc12_34.2) [template = constants.%int_-1] -// CHECK:STDOUT: %int_0.loc12: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc12_35.1: %i32 = value_of_initializer %int.snegate.loc12 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc12_35.2: %i32 = converted %int.snegate.loc12, %.loc12_35.1 [template = constants.%int_-1] -// CHECK:STDOUT: %impl.elem0.loc12_38: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_38: = bound_method %int_0.loc12, %impl.elem0.loc12_38 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc12_38: = specific_function %Convert.bound.loc12_38, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc12_38: init %i32 = call %Convert.specific_fn.loc12_38(%int_0.loc12) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc12_38.1: %i32 = value_of_initializer %int.convert_checked.loc12_38 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc12_38.2: %i32 = converted %int_0.loc12, %.loc12_38.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.greater_eq.loc12: init bool = call %GreaterEq.ref.loc12(%.loc12_35.2, %.loc12_38.2) [template = constants.%false] -// CHECK:STDOUT: %.loc12_14.1: bool = value_of_initializer %int.greater_eq.loc12 [template = constants.%false] -// CHECK:STDOUT: %.loc12_14.2: bool = converted %int.greater_eq.loc12, %.loc12_14.1 [template = constants.%false] -// CHECK:STDOUT: if %.loc12_14.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc12: -// CHECK:STDOUT: %True.ref.loc12: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc12(%True.ref.loc12) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc12: -// CHECK:STDOUT: %False.ref.loc12: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc12(%False.ref.loc12) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc12: -// CHECK:STDOUT: %.loc12_14.3: type = block_arg !if.expr.result.loc12 [template = constants.%False] -// CHECK:STDOUT: %true_.ref.loc13: %True = name_ref true_, %true_ -// CHECK:STDOUT: %GreaterEq.ref.loc13: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] -// CHECK:STDOUT: %int_0.loc13: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %Negate.ref.loc13: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc13_36: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_36: = bound_method %int_1.loc13, %impl.elem0.loc13_36 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc13_36: = specific_function %Convert.bound.loc13_36, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc13_36: init %i32 = call %Convert.specific_fn.loc13_36(%int_1.loc13) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_36.1: %i32 = value_of_initializer %int.convert_checked.loc13_36 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_36.2: %i32 = converted %int_1.loc13, %.loc13_36.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc13: init %i32 = call %Negate.ref.loc13(%.loc13_36.2) [template = constants.%int_-1] -// CHECK:STDOUT: %impl.elem0.loc13_26: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_26: = bound_method %int_0.loc13, %impl.elem0.loc13_26 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc13_26: = specific_function %Convert.bound.loc13_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc13_26: init %i32 = call %Convert.specific_fn.loc13_26(%int_0.loc13) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_26.1: %i32 = value_of_initializer %int.convert_checked.loc13_26 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_26.2: %i32 = converted %int_0.loc13, %.loc13_26.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_37.1: %i32 = value_of_initializer %int.snegate.loc13 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc13_37.2: %i32 = converted %int.snegate.loc13, %.loc13_37.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.greater_eq.loc13: init bool = call %GreaterEq.ref.loc13(%.loc13_26.2, %.loc13_37.2) [template = constants.%true] -// CHECK:STDOUT: %.loc13_13.1: bool = value_of_initializer %int.greater_eq.loc13 [template = constants.%true] -// CHECK:STDOUT: %.loc13_13.2: bool = converted %int.greater_eq.loc13, %.loc13_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc13_13.2 br !if.expr.then.loc13 else br !if.expr.else.loc13 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc13: -// CHECK:STDOUT: %True.ref.loc13: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc13(%True.ref.loc13) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc13: -// CHECK:STDOUT: %False.ref.loc13: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc13(%False.ref.loc13) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc13: -// CHECK:STDOUT: %.loc13_13.3: type = block_arg !if.expr.result.loc13 [template = constants.%True] -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> bool { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %GreaterEq.ref: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.greater_eq: init bool = call %GreaterEq.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc17_25.1: bool = value_of_initializer %int.greater_eq -// CHECK:STDOUT: %.loc17_25.2: bool = converted %int.greater_eq, %.loc17_25.1 -// CHECK:STDOUT: return %.loc17_25.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/left_shift.carbon b/toolchain/check/testdata/builtins/int/left_shift.carbon index 726997da352e7..47a7036515f12 100644 --- a/toolchain/check/testdata/builtins/int/left_shift.carbon +++ b/toolchain/check/testdata/builtins/int/left_shift.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/left_shift.carbon @@ -15,7 +17,7 @@ fn LeftShift(a: i32, b: i32) -> i32 = "int.left_shift"; var arr: [i32; LeftShift(5, 2)]; let arr_p: [i32; 20]* = &arr; -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return LeftShift(a, b); } @@ -62,384 +64,3 @@ let no_overflow_2: i32 = LeftShift(0, 32); // CHECK:STDERR: let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ let negative: i32 = LeftShift(1, Negate(1)); - -// CHECK:STDOUT: --- int_left_shift.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %LeftShift.type.1: type = fn_type @LeftShift.1 [template] -// CHECK:STDOUT: %LeftShift: %LeftShift.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_20.2: Core.IntLiteral = int_value 20 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_20.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .LeftShift = %LeftShift.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %LeftShift.decl: %LeftShift.type.1 = fn_decl @LeftShift.1 [template = constants.%LeftShift] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_33: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_33: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_17: type = splice_block %i32.loc2_17 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_17: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_25: type = splice_block %i32.loc2_25 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @LeftShift.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.left_shift"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %LeftShift.ref: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.left_shift: init %i32 = call %LeftShift.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_25.1: %i32 = value_of_initializer %int.left_shift -// CHECK:STDOUT: %.loc8_25.2: %i32 = converted %int.left_shift, %.loc8_25.1 -// CHECK:STDOUT: return %.loc8_25.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_bad_shift.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32.1: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32.1) [template] -// CHECK:STDOUT: %LeftShift.type.1: type = fn_type @LeftShift.1 [template] -// CHECK:STDOUT: %LeftShift: %LeftShift.type.1 = struct_value () [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %int_31.1: Core.IntLiteral = int_value 31 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32.1) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32.1) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_31.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32.1) [template] -// CHECK:STDOUT: %int_31.2: %i32 = int_value 31 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_32.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32.1) [template] -// CHECK:STDOUT: %int_32.2: %i32 = int_value 32 [template] -// CHECK:STDOUT: %int_33.1: Core.IntLiteral = int_value 33 [template] -// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_33.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32.1) [template] -// CHECK:STDOUT: %int_33.2: %i32 = int_value 33 [template] -// CHECK:STDOUT: %int_1000.1: Core.IntLiteral = int_value 1000 [template] -// CHECK:STDOUT: %Convert.bound.5: = bound_method %int_1000.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.5: = specific_function %Convert.bound.5, @Convert.2(%int_32.1) [template] -// CHECK:STDOUT: %int_1000.2: %i32 = int_value 1000 [template] -// CHECK:STDOUT: %int_0.1: %i32 = int_value 0 [template] -// CHECK:STDOUT: %int_0.2: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.bound.6: = bound_method %int_0.2, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.6: = specific_function %Convert.bound.6, @Convert.2(%int_32.1) [template] -// CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .LeftShift = %LeftShift.decl -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .size_1 = @__global_init.%size_1 -// CHECK:STDOUT: .size_2 = @__global_init.%size_2 -// CHECK:STDOUT: .size_3 = @__global_init.%size_3 -// CHECK:STDOUT: .overflow_1 = @__global_init.%overflow_1 -// CHECK:STDOUT: .overflow_2 = @__global_init.%overflow_2 -// CHECK:STDOUT: .no_overflow_1 = @__global_init.%no_overflow_1 -// CHECK:STDOUT: .no_overflow_2 = @__global_init.%no_overflow_2 -// CHECK:STDOUT: .negative = @__global_init.%negative -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %LeftShift.decl: %LeftShift.type.1 = fn_decl @LeftShift.1 [template = constants.%LeftShift] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_33: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc4_33: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_17: type = splice_block %i32.loc4_17 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_17: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc4_17: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc4_25: type = splice_block %i32.loc4_25 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_25: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc4_25: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc5_22: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc5_22: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc5: type = splice_block %i32.loc5_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc5_14: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc5_14: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @LeftShift.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.left_shift"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.snegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %LeftShift.ref.loc8: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1.loc8: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_31.loc8: Core.IntLiteral = int_value 31 [template = constants.%int_31.1] -// CHECK:STDOUT: %impl.elem0.loc8_29: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_29: = bound_method %int_1.loc8, %impl.elem0.loc8_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc8_29: = specific_function %Convert.bound.loc8_29, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc8_29: init %i32 = call %Convert.specific_fn.loc8_29(%int_1.loc8) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_29.1: %i32 = value_of_initializer %int.convert_checked.loc8_29 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_29.2: %i32 = converted %int_1.loc8, %.loc8_29.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc8_32: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_32: = bound_method %int_31.loc8, %impl.elem0.loc8_32 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc8_32: = specific_function %Convert.bound.loc8_32, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc8_32: init %i32 = call %Convert.specific_fn.loc8_32(%int_31.loc8) [template = constants.%int_31.2] -// CHECK:STDOUT: %.loc8_32.1: %i32 = value_of_initializer %int.convert_checked.loc8_32 [template = constants.%int_31.2] -// CHECK:STDOUT: %.loc8_32.2: %i32 = converted %int_31.loc8, %.loc8_32.1 [template = constants.%int_31.2] -// CHECK:STDOUT: %int.left_shift.loc8: init %i32 = call %LeftShift.ref.loc8(%.loc8_29.2, %.loc8_32.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc8_35.1: %i32 = value_of_initializer %int.left_shift.loc8 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc8_35.2: %i32 = converted %int.left_shift.loc8, %.loc8_35.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %size_1: %i32 = bind_name size_1, %.loc8_35.2 -// CHECK:STDOUT: %LeftShift.ref.loc13: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_32.loc13: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %impl.elem0.loc13_29: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_29: = bound_method %int_1.loc13, %impl.elem0.loc13_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc13_29: = specific_function %Convert.bound.loc13_29, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc13_29: init %i32 = call %Convert.specific_fn.loc13_29(%int_1.loc13) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_29.1: %i32 = value_of_initializer %int.convert_checked.loc13_29 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_29.2: %i32 = converted %int_1.loc13, %.loc13_29.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc13_32: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_32: = bound_method %int_32.loc13, %impl.elem0.loc13_32 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc13_32: = specific_function %Convert.bound.loc13_32, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc13_32: init %i32 = call %Convert.specific_fn.loc13_32(%int_32.loc13) [template = constants.%int_32.2] -// CHECK:STDOUT: %.loc13_32.1: %i32 = value_of_initializer %int.convert_checked.loc13_32 [template = constants.%int_32.2] -// CHECK:STDOUT: %.loc13_32.2: %i32 = converted %int_32.loc13, %.loc13_32.1 [template = constants.%int_32.2] -// CHECK:STDOUT: %int.left_shift.loc13: init %i32 = call %LeftShift.ref.loc13(%.loc13_29.2, %.loc13_32.2) [template = ] -// CHECK:STDOUT: %.loc13_35.1: %i32 = value_of_initializer %int.left_shift.loc13 [template = ] -// CHECK:STDOUT: %.loc13_35.2: %i32 = converted %int.left_shift.loc13, %.loc13_35.1 [template = ] -// CHECK:STDOUT: %size_2: %i32 = bind_name size_2, %.loc13_35.2 -// CHECK:STDOUT: %LeftShift.ref.loc18: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1.loc18: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_33: Core.IntLiteral = int_value 33 [template = constants.%int_33.1] -// CHECK:STDOUT: %impl.elem0.loc18_29: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc18_29: = bound_method %int_1.loc18, %impl.elem0.loc18_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc18_29: = specific_function %Convert.bound.loc18_29, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc18_29: init %i32 = call %Convert.specific_fn.loc18_29(%int_1.loc18) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc18_29.1: %i32 = value_of_initializer %int.convert_checked.loc18_29 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc18_29.2: %i32 = converted %int_1.loc18, %.loc18_29.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc18_32: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc18_32: = bound_method %int_33, %impl.elem0.loc18_32 [template = constants.%Convert.bound.4] -// CHECK:STDOUT: %Convert.specific_fn.loc18_32: = specific_function %Convert.bound.loc18_32, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.4] -// CHECK:STDOUT: %int.convert_checked.loc18_32: init %i32 = call %Convert.specific_fn.loc18_32(%int_33) [template = constants.%int_33.2] -// CHECK:STDOUT: %.loc18_32.1: %i32 = value_of_initializer %int.convert_checked.loc18_32 [template = constants.%int_33.2] -// CHECK:STDOUT: %.loc18_32.2: %i32 = converted %int_33, %.loc18_32.1 [template = constants.%int_33.2] -// CHECK:STDOUT: %int.left_shift.loc18: init %i32 = call %LeftShift.ref.loc18(%.loc18_29.2, %.loc18_32.2) [template = ] -// CHECK:STDOUT: %.loc18_35.1: %i32 = value_of_initializer %int.left_shift.loc18 [template = ] -// CHECK:STDOUT: %.loc18_35.2: %i32 = converted %int.left_shift.loc18, %.loc18_35.1 [template = ] -// CHECK:STDOUT: %size_3: %i32 = bind_name size_3, %.loc18_35.2 -// CHECK:STDOUT: %LeftShift.ref.loc21: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1000.loc21: Core.IntLiteral = int_value 1000 [template = constants.%int_1000.1] -// CHECK:STDOUT: %int_31.loc21: Core.IntLiteral = int_value 31 [template = constants.%int_31.1] -// CHECK:STDOUT: %impl.elem0.loc21_33: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc21_33: = bound_method %int_1000.loc21, %impl.elem0.loc21_33 [template = constants.%Convert.bound.5] -// CHECK:STDOUT: %Convert.specific_fn.loc21_33: = specific_function %Convert.bound.loc21_33, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.5] -// CHECK:STDOUT: %int.convert_checked.loc21_33: init %i32 = call %Convert.specific_fn.loc21_33(%int_1000.loc21) [template = constants.%int_1000.2] -// CHECK:STDOUT: %.loc21_33.1: %i32 = value_of_initializer %int.convert_checked.loc21_33 [template = constants.%int_1000.2] -// CHECK:STDOUT: %.loc21_33.2: %i32 = converted %int_1000.loc21, %.loc21_33.1 [template = constants.%int_1000.2] -// CHECK:STDOUT: %impl.elem0.loc21_39: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc21_39: = bound_method %int_31.loc21, %impl.elem0.loc21_39 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc21_39: = specific_function %Convert.bound.loc21_39, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc21_39: init %i32 = call %Convert.specific_fn.loc21_39(%int_31.loc21) [template = constants.%int_31.2] -// CHECK:STDOUT: %.loc21_39.1: %i32 = value_of_initializer %int.convert_checked.loc21_39 [template = constants.%int_31.2] -// CHECK:STDOUT: %.loc21_39.2: %i32 = converted %int_31.loc21, %.loc21_39.1 [template = constants.%int_31.2] -// CHECK:STDOUT: %int.left_shift.loc21: init %i32 = call %LeftShift.ref.loc21(%.loc21_33.2, %.loc21_39.2) [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc21_42.1: %i32 = value_of_initializer %int.left_shift.loc21 [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc21_42.2: %i32 = converted %int.left_shift.loc21, %.loc21_42.1 [template = constants.%int_0.1] -// CHECK:STDOUT: %overflow_1: %i32 = bind_name overflow_1, %.loc21_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc26: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1000.loc26: Core.IntLiteral = int_value 1000 [template = constants.%int_1000.1] -// CHECK:STDOUT: %int_32.loc26: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %impl.elem0.loc26_33: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc26_33: = bound_method %int_1000.loc26, %impl.elem0.loc26_33 [template = constants.%Convert.bound.5] -// CHECK:STDOUT: %Convert.specific_fn.loc26_33: = specific_function %Convert.bound.loc26_33, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.5] -// CHECK:STDOUT: %int.convert_checked.loc26_33: init %i32 = call %Convert.specific_fn.loc26_33(%int_1000.loc26) [template = constants.%int_1000.2] -// CHECK:STDOUT: %.loc26_33.1: %i32 = value_of_initializer %int.convert_checked.loc26_33 [template = constants.%int_1000.2] -// CHECK:STDOUT: %.loc26_33.2: %i32 = converted %int_1000.loc26, %.loc26_33.1 [template = constants.%int_1000.2] -// CHECK:STDOUT: %impl.elem0.loc26_39: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc26_39: = bound_method %int_32.loc26, %impl.elem0.loc26_39 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc26_39: = specific_function %Convert.bound.loc26_39, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc26_39: init %i32 = call %Convert.specific_fn.loc26_39(%int_32.loc26) [template = constants.%int_32.2] -// CHECK:STDOUT: %.loc26_39.1: %i32 = value_of_initializer %int.convert_checked.loc26_39 [template = constants.%int_32.2] -// CHECK:STDOUT: %.loc26_39.2: %i32 = converted %int_32.loc26, %.loc26_39.1 [template = constants.%int_32.2] -// CHECK:STDOUT: %int.left_shift.loc26: init %i32 = call %LeftShift.ref.loc26(%.loc26_33.2, %.loc26_39.2) [template = ] -// CHECK:STDOUT: %.loc26_42.1: %i32 = value_of_initializer %int.left_shift.loc26 [template = ] -// CHECK:STDOUT: %.loc26_42.2: %i32 = converted %int.left_shift.loc26, %.loc26_42.1 [template = ] -// CHECK:STDOUT: %overflow_2: %i32 = bind_name overflow_2, %.loc26_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc29: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_0.loc29: Core.IntLiteral = int_value 0 [template = constants.%int_0.2] -// CHECK:STDOUT: %int_31.loc29: Core.IntLiteral = int_value 31 [template = constants.%int_31.1] -// CHECK:STDOUT: %impl.elem0.loc29_36: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc29_36: = bound_method %int_0.loc29, %impl.elem0.loc29_36 [template = constants.%Convert.bound.6] -// CHECK:STDOUT: %Convert.specific_fn.loc29_36: = specific_function %Convert.bound.loc29_36, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.6] -// CHECK:STDOUT: %int.convert_checked.loc29_36: init %i32 = call %Convert.specific_fn.loc29_36(%int_0.loc29) [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc29_36.1: %i32 = value_of_initializer %int.convert_checked.loc29_36 [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc29_36.2: %i32 = converted %int_0.loc29, %.loc29_36.1 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc29_39: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc29_39: = bound_method %int_31.loc29, %impl.elem0.loc29_39 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc29_39: = specific_function %Convert.bound.loc29_39, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc29_39: init %i32 = call %Convert.specific_fn.loc29_39(%int_31.loc29) [template = constants.%int_31.2] -// CHECK:STDOUT: %.loc29_39.1: %i32 = value_of_initializer %int.convert_checked.loc29_39 [template = constants.%int_31.2] -// CHECK:STDOUT: %.loc29_39.2: %i32 = converted %int_31.loc29, %.loc29_39.1 [template = constants.%int_31.2] -// CHECK:STDOUT: %int.left_shift.loc29: init %i32 = call %LeftShift.ref.loc29(%.loc29_36.2, %.loc29_39.2) [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc29_42.1: %i32 = value_of_initializer %int.left_shift.loc29 [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc29_42.2: %i32 = converted %int.left_shift.loc29, %.loc29_42.1 [template = constants.%int_0.1] -// CHECK:STDOUT: %no_overflow_1: %i32 = bind_name no_overflow_1, %.loc29_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc34: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_0.loc34: Core.IntLiteral = int_value 0 [template = constants.%int_0.2] -// CHECK:STDOUT: %int_32.loc34: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %impl.elem0.loc34_36: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc34_36: = bound_method %int_0.loc34, %impl.elem0.loc34_36 [template = constants.%Convert.bound.6] -// CHECK:STDOUT: %Convert.specific_fn.loc34_36: = specific_function %Convert.bound.loc34_36, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.6] -// CHECK:STDOUT: %int.convert_checked.loc34_36: init %i32 = call %Convert.specific_fn.loc34_36(%int_0.loc34) [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc34_36.1: %i32 = value_of_initializer %int.convert_checked.loc34_36 [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc34_36.2: %i32 = converted %int_0.loc34, %.loc34_36.1 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc34_39: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc34_39: = bound_method %int_32.loc34, %impl.elem0.loc34_39 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc34_39: = specific_function %Convert.bound.loc34_39, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc34_39: init %i32 = call %Convert.specific_fn.loc34_39(%int_32.loc34) [template = constants.%int_32.2] -// CHECK:STDOUT: %.loc34_39.1: %i32 = value_of_initializer %int.convert_checked.loc34_39 [template = constants.%int_32.2] -// CHECK:STDOUT: %.loc34_39.2: %i32 = converted %int_32.loc34, %.loc34_39.1 [template = constants.%int_32.2] -// CHECK:STDOUT: %int.left_shift.loc34: init %i32 = call %LeftShift.ref.loc34(%.loc34_36.2, %.loc34_39.2) [template = ] -// CHECK:STDOUT: %.loc34_42.1: %i32 = value_of_initializer %int.left_shift.loc34 [template = ] -// CHECK:STDOUT: %.loc34_42.2: %i32 = converted %int.left_shift.loc34, %.loc34_42.1 [template = ] -// CHECK:STDOUT: %no_overflow_2: %i32 = bind_name no_overflow_2, %.loc34_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc40: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1.loc40_31: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %Negate.ref: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc40_41: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc40_41: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc40_41: = bound_method %int_1.loc40_41, %impl.elem0.loc40_41 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc40_41: = specific_function %Convert.bound.loc40_41, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc40_41: init %i32 = call %Convert.specific_fn.loc40_41(%int_1.loc40_41) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc40_41.1: %i32 = value_of_initializer %int.convert_checked.loc40_41 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc40_41.2: %i32 = converted %int_1.loc40_41, %.loc40_41.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate: init %i32 = call %Negate.ref(%.loc40_41.2) [template = constants.%int_-1] -// CHECK:STDOUT: %impl.elem0.loc40_31: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc40_31: = bound_method %int_1.loc40_31, %impl.elem0.loc40_31 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc40_31: = specific_function %Convert.bound.loc40_31, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc40_31: init %i32 = call %Convert.specific_fn.loc40_31(%int_1.loc40_31) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc40_31.1: %i32 = value_of_initializer %int.convert_checked.loc40_31 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc40_31.2: %i32 = converted %int_1.loc40_31, %.loc40_31.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc40_42.1: %i32 = value_of_initializer %int.snegate [template = constants.%int_-1] -// CHECK:STDOUT: %.loc40_42.2: %i32 = converted %int.snegate, %.loc40_42.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.left_shift.loc40: init %i32 = call %LeftShift.ref.loc40(%.loc40_31.2, %.loc40_42.2) [template = ] -// CHECK:STDOUT: %.loc40_44.1: %i32 = value_of_initializer %int.left_shift.loc40 [template = ] -// CHECK:STDOUT: %.loc40_44.2: %i32 = converted %int.left_shift.loc40, %.loc40_44.1 [template = ] -// CHECK:STDOUT: %negative: %i32 = bind_name negative, %.loc40_44.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/less.carbon b/toolchain/check/testdata/builtins/int/less.carbon index 517e91b8aaa1a..fa6181050d87f 100644 --- a/toolchain/check/testdata/builtins/int/less.carbon +++ b/toolchain/check/testdata/builtins/int/less.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/less.carbon @@ -24,353 +26,6 @@ fn F(true_: True, false_: False) { false_ as (if Less(0, Negate(1)) then True else False); } -fn RuntimeCall(a: i32, b: i32) -> bool { +fn RuntimeCallIsValid(a: i32, b: i32) -> bool { return Less(a, b); } - -// CHECK:STDOUT: --- int_less.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] -// CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] -// CHECK:STDOUT: %Less.type.1: type = fn_type @Less.1 [template] -// CHECK:STDOUT: %Less.1: %Less.type.1 = struct_value () [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] -// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] -// CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %F.type: type = fn_type @F [template] -// CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template] -// CHECK:STDOUT: %true: bool = bool_literal true [template] -// CHECK:STDOUT: %false: bool = bool_literal false [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .Bool = %import_ref.5 -// CHECK:STDOUT: .ImplicitAs = %import_ref.6 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Less = %Less.decl -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .True = %True.decl -// CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Less.decl: %Less.type.1 = fn_decl @Less.1 [template = constants.%Less.1] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %.loc2_28.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc2_28.2: type = converted %bool.make_type, %.loc2_28.1 [template = bool] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_12: type = splice_block %i32.loc2_12 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_12: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_12: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_20: type = splice_block %i32.loc2_20 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_20: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_20: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc3_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc3: type = splice_block %i32.loc3_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc3_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} {} -// CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} {} -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { -// CHECK:STDOUT: %true_.patt: %True = binding_pattern true_ -// CHECK:STDOUT: %true_.param_patt: %True = value_param_pattern %true_.patt, runtime_param0 -// CHECK:STDOUT: %false_.patt: %False = binding_pattern false_ -// CHECK:STDOUT: %false_.param_patt: %False = value_param_pattern %false_.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %true_.param: %True = value_param runtime_param0 -// CHECK:STDOUT: %True.ref.loc8: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: %true_: %True = bind_name true_, %true_.param -// CHECK:STDOUT: %false_.param: %False = value_param runtime_param1 -// CHECK:STDOUT: %False.ref.loc8: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: %false_: %False = bind_name false_, %false_.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %.loc16_35.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type, %.loc16_35.1 [template = bool] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc16_19: type = splice_block %i32.loc16_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc16_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc16_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc16_27: type = splice_block %i32.loc16_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc16_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc16_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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: class @True { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%True -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @False { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%False -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Less.1(%a.param_patt: %i32, %b.param_patt: %i32) -> bool = "int.less"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.snegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%true_.param_patt: %True, %false_.param_patt: %False) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %true_.ref.loc9: %True = name_ref true_, %true_ -// CHECK:STDOUT: %Less.ref.loc9: %Less.type.1 = name_ref Less, file.%Less.decl [template = constants.%Less.1] -// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %impl.elem0.loc9_21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_21: = bound_method %int_1.loc9, %impl.elem0.loc9_21 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_21: = specific_function %Convert.bound.loc9_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_21: init %i32 = call %Convert.specific_fn.loc9_21(%int_1.loc9) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_21.1: %i32 = value_of_initializer %int.convert_checked.loc9_21 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_21.2: %i32 = converted %int_1.loc9, %.loc9_21.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc9_24: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_24: = bound_method %int_2, %impl.elem0.loc9_24 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_24: = specific_function %Convert.bound.loc9_24, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_24: init %i32 = call %Convert.specific_fn.loc9_24(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_24.1: %i32 = value_of_initializer %int.convert_checked.loc9_24 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_24.2: %i32 = converted %int_2, %.loc9_24.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.less.loc9: init bool = call %Less.ref.loc9(%.loc9_21.2, %.loc9_24.2) [template = constants.%true] -// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %int.less.loc9 [template = constants.%true] -// CHECK:STDOUT: %.loc9_13.2: bool = converted %int.less.loc9, %.loc9_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc9_13.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc9: -// CHECK:STDOUT: %True.ref.loc9: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc9(%True.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc9: -// CHECK:STDOUT: %False.ref.loc9: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc9(%False.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc9: -// CHECK:STDOUT: %.loc9_13.3: type = block_arg !if.expr.result.loc9 [template = constants.%True] -// CHECK:STDOUT: %false_.ref.loc10: %False = name_ref false_, %false_ -// CHECK:STDOUT: %Less.ref.loc10: %Less.type.1 = name_ref Less, file.%Less.decl [template = constants.%Less.1] -// CHECK:STDOUT: %int_1.loc10_22: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_1.loc10_25: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc10_22: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_22: = bound_method %int_1.loc10_22, %impl.elem0.loc10_22 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_22: = specific_function %Convert.bound.loc10_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_22: init %i32 = call %Convert.specific_fn.loc10_22(%int_1.loc10_22) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_22.1: %i32 = value_of_initializer %int.convert_checked.loc10_22 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_22.2: %i32 = converted %int_1.loc10_22, %.loc10_22.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc10_25: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_25: = bound_method %int_1.loc10_25, %impl.elem0.loc10_25 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_25: = specific_function %Convert.bound.loc10_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_25: init %i32 = call %Convert.specific_fn.loc10_25(%int_1.loc10_25) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_25.1: %i32 = value_of_initializer %int.convert_checked.loc10_25 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_25.2: %i32 = converted %int_1.loc10_25, %.loc10_25.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.less.loc10: init bool = call %Less.ref.loc10(%.loc10_22.2, %.loc10_25.2) [template = constants.%false] -// CHECK:STDOUT: %.loc10_14.1: bool = value_of_initializer %int.less.loc10 [template = constants.%false] -// CHECK:STDOUT: %.loc10_14.2: bool = converted %int.less.loc10, %.loc10_14.1 [template = constants.%false] -// CHECK:STDOUT: if %.loc10_14.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc10: -// CHECK:STDOUT: %True.ref.loc10: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc10(%True.ref.loc10) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc10: -// CHECK:STDOUT: %False.ref.loc10: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc10(%False.ref.loc10) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc10: -// CHECK:STDOUT: %.loc10_14.3: type = block_arg !if.expr.result.loc10 [template = constants.%False] -// CHECK:STDOUT: %false_.ref.loc11: %False = name_ref false_, %false_ -// CHECK:STDOUT: %Less.ref.loc11: %Less.type.1 = name_ref Less, file.%Less.decl [template = constants.%Less.1] -// CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_0.loc11: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc11_22: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_22: = bound_method %int_1.loc11, %impl.elem0.loc11_22 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc11_22: = specific_function %Convert.bound.loc11_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc11_22: init %i32 = call %Convert.specific_fn.loc11_22(%int_1.loc11) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc11_22.1: %i32 = value_of_initializer %int.convert_checked.loc11_22 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc11_22.2: %i32 = converted %int_1.loc11, %.loc11_22.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc11_25: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_25: = bound_method %int_0.loc11, %impl.elem0.loc11_25 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc11_25: = specific_function %Convert.bound.loc11_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc11_25: init %i32 = call %Convert.specific_fn.loc11_25(%int_0.loc11) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_25.1: %i32 = value_of_initializer %int.convert_checked.loc11_25 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_25.2: %i32 = converted %int_0.loc11, %.loc11_25.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.less.loc11: init bool = call %Less.ref.loc11(%.loc11_22.2, %.loc11_25.2) [template = constants.%false] -// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %int.less.loc11 [template = constants.%false] -// CHECK:STDOUT: %.loc11_14.2: bool = converted %int.less.loc11, %.loc11_14.1 [template = constants.%false] -// CHECK:STDOUT: if %.loc11_14.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc11: -// CHECK:STDOUT: %True.ref.loc11: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc11(%True.ref.loc11) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc11: -// CHECK:STDOUT: %False.ref.loc11: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc11(%False.ref.loc11) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc11: -// CHECK:STDOUT: %.loc11_14.3: type = block_arg !if.expr.result.loc11 [template = constants.%False] -// CHECK:STDOUT: %true_.ref.loc12: %True = name_ref true_, %true_ -// CHECK:STDOUT: %Less.ref.loc12: %Less.type.1 = name_ref Less, file.%Less.decl [template = constants.%Less.1] -// CHECK:STDOUT: %Negate.ref.loc12: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc12: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc12_28: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_28: = bound_method %int_1.loc12, %impl.elem0.loc12_28 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc12_28: = specific_function %Convert.bound.loc12_28, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc12_28: init %i32 = call %Convert.specific_fn.loc12_28(%int_1.loc12) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_28.1: %i32 = value_of_initializer %int.convert_checked.loc12_28 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_28.2: %i32 = converted %int_1.loc12, %.loc12_28.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc12: init %i32 = call %Negate.ref.loc12(%.loc12_28.2) [template = constants.%int_-1] -// CHECK:STDOUT: %int_0.loc12: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc12_29.1: %i32 = value_of_initializer %int.snegate.loc12 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc12_29.2: %i32 = converted %int.snegate.loc12, %.loc12_29.1 [template = constants.%int_-1] -// CHECK:STDOUT: %impl.elem0.loc12_32: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_32: = bound_method %int_0.loc12, %impl.elem0.loc12_32 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc12_32: = specific_function %Convert.bound.loc12_32, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc12_32: init %i32 = call %Convert.specific_fn.loc12_32(%int_0.loc12) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc12_32.1: %i32 = value_of_initializer %int.convert_checked.loc12_32 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc12_32.2: %i32 = converted %int_0.loc12, %.loc12_32.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.less.loc12: init bool = call %Less.ref.loc12(%.loc12_29.2, %.loc12_32.2) [template = constants.%true] -// CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %int.less.loc12 [template = constants.%true] -// CHECK:STDOUT: %.loc12_13.2: bool = converted %int.less.loc12, %.loc12_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc12_13.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc12: -// CHECK:STDOUT: %True.ref.loc12: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc12(%True.ref.loc12) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc12: -// CHECK:STDOUT: %False.ref.loc12: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc12(%False.ref.loc12) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc12: -// CHECK:STDOUT: %.loc12_13.3: type = block_arg !if.expr.result.loc12 [template = constants.%True] -// CHECK:STDOUT: %false_.ref.loc13: %False = name_ref false_, %false_ -// CHECK:STDOUT: %Less.ref.loc13: %Less.type.1 = name_ref Less, file.%Less.decl [template = constants.%Less.1] -// CHECK:STDOUT: %int_0.loc13: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %Negate.ref.loc13: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc13_32: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_32: = bound_method %int_1.loc13, %impl.elem0.loc13_32 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc13_32: = specific_function %Convert.bound.loc13_32, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc13_32: init %i32 = call %Convert.specific_fn.loc13_32(%int_1.loc13) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_32.1: %i32 = value_of_initializer %int.convert_checked.loc13_32 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_32.2: %i32 = converted %int_1.loc13, %.loc13_32.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc13: init %i32 = call %Negate.ref.loc13(%.loc13_32.2) [template = constants.%int_-1] -// CHECK:STDOUT: %impl.elem0.loc13_22: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_22: = bound_method %int_0.loc13, %impl.elem0.loc13_22 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc13_22: = specific_function %Convert.bound.loc13_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc13_22: init %i32 = call %Convert.specific_fn.loc13_22(%int_0.loc13) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_22.1: %i32 = value_of_initializer %int.convert_checked.loc13_22 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_22.2: %i32 = converted %int_0.loc13, %.loc13_22.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_33.1: %i32 = value_of_initializer %int.snegate.loc13 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc13_33.2: %i32 = converted %int.snegate.loc13, %.loc13_33.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.less.loc13: init bool = call %Less.ref.loc13(%.loc13_22.2, %.loc13_33.2) [template = constants.%false] -// CHECK:STDOUT: %.loc13_14.1: bool = value_of_initializer %int.less.loc13 [template = constants.%false] -// CHECK:STDOUT: %.loc13_14.2: bool = converted %int.less.loc13, %.loc13_14.1 [template = constants.%false] -// CHECK:STDOUT: if %.loc13_14.2 br !if.expr.then.loc13 else br !if.expr.else.loc13 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc13: -// CHECK:STDOUT: %True.ref.loc13: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc13(%True.ref.loc13) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc13: -// CHECK:STDOUT: %False.ref.loc13: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc13(%False.ref.loc13) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc13: -// CHECK:STDOUT: %.loc13_14.3: type = block_arg !if.expr.result.loc13 [template = constants.%False] -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> bool { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Less.ref: %Less.type.1 = name_ref Less, file.%Less.decl [template = constants.%Less.1] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.less: init bool = call %Less.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc17_20.1: bool = value_of_initializer %int.less -// CHECK:STDOUT: %.loc17_20.2: bool = converted %int.less, %.loc17_20.1 -// CHECK:STDOUT: return %.loc17_20.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/less_eq.carbon b/toolchain/check/testdata/builtins/int/less_eq.carbon index 3f8d683fed8b7..6ae44f2efd2d0 100644 --- a/toolchain/check/testdata/builtins/int/less_eq.carbon +++ b/toolchain/check/testdata/builtins/int/less_eq.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/less_eq.carbon @@ -24,353 +26,6 @@ fn F(true_: True, false_: False) { false_ as (if LessEq(0, Negate(1)) then True else False); } -fn RuntimeCall(a: i32, b: i32) -> bool { +fn RuntimeCallIsValid(a: i32, b: i32) -> bool { return LessEq(a, b); } - -// CHECK:STDOUT: --- int_less_eq.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] -// CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] -// CHECK:STDOUT: %LessEq.type: type = fn_type @LessEq [template] -// CHECK:STDOUT: %LessEq: %LessEq.type = struct_value () [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] -// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] -// CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %F.type: type = fn_type @F [template] -// CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template] -// CHECK:STDOUT: %true: bool = bool_literal true [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: %false: bool = bool_literal false [template] -// CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .Bool = %import_ref.5 -// CHECK:STDOUT: .ImplicitAs = %import_ref.6 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .LessEq = %LessEq.decl -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .True = %True.decl -// CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %LessEq.decl: %LessEq.type = fn_decl @LessEq [template = constants.%LessEq] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %.loc2_30.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc2_30.2: type = converted %bool.make_type, %.loc2_30.1 [template = bool] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_14: type = splice_block %i32.loc2_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_22: type = splice_block %i32.loc2_22 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc3_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc3: type = splice_block %i32.loc3_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc3_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} {} -// CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} {} -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { -// CHECK:STDOUT: %true_.patt: %True = binding_pattern true_ -// CHECK:STDOUT: %true_.param_patt: %True = value_param_pattern %true_.patt, runtime_param0 -// CHECK:STDOUT: %false_.patt: %False = binding_pattern false_ -// CHECK:STDOUT: %false_.param_patt: %False = value_param_pattern %false_.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %true_.param: %True = value_param runtime_param0 -// CHECK:STDOUT: %True.ref.loc8: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: %true_: %True = bind_name true_, %true_.param -// CHECK:STDOUT: %false_.param: %False = value_param runtime_param1 -// CHECK:STDOUT: %False.ref.loc8: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: %false_: %False = bind_name false_, %false_.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %.loc16_35.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type, %.loc16_35.1 [template = bool] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc16_19: type = splice_block %i32.loc16_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc16_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc16_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc16_27: type = splice_block %i32.loc16_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc16_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc16_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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: class @True { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%True -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @False { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%False -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @LessEq(%a.param_patt: %i32, %b.param_patt: %i32) -> bool = "int.less_eq"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.snegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%true_.param_patt: %True, %false_.param_patt: %False) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %true_.ref.loc9: %True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc9: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] -// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %impl.elem0.loc9_23: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_23: = bound_method %int_1.loc9, %impl.elem0.loc9_23 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_23: = specific_function %Convert.bound.loc9_23, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_23: init %i32 = call %Convert.specific_fn.loc9_23(%int_1.loc9) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_23.1: %i32 = value_of_initializer %int.convert_checked.loc9_23 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_23.2: %i32 = converted %int_1.loc9, %.loc9_23.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc9_26: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_26: = bound_method %int_2, %impl.elem0.loc9_26 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_26: = specific_function %Convert.bound.loc9_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_26: init %i32 = call %Convert.specific_fn.loc9_26(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_26.1: %i32 = value_of_initializer %int.convert_checked.loc9_26 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_26.2: %i32 = converted %int_2, %.loc9_26.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.less_eq.loc9: init bool = call %LessEq.ref.loc9(%.loc9_23.2, %.loc9_26.2) [template = constants.%true] -// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %int.less_eq.loc9 [template = constants.%true] -// CHECK:STDOUT: %.loc9_13.2: bool = converted %int.less_eq.loc9, %.loc9_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc9_13.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc9: -// CHECK:STDOUT: %True.ref.loc9: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc9(%True.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc9: -// CHECK:STDOUT: %False.ref.loc9: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc9(%False.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc9: -// CHECK:STDOUT: %.loc9_13.3: type = block_arg !if.expr.result.loc9 [template = constants.%True] -// CHECK:STDOUT: %true_.ref.loc10: %True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc10: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] -// CHECK:STDOUT: %int_1.loc10_23: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_1.loc10_26: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc10_23: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_23: = bound_method %int_1.loc10_23, %impl.elem0.loc10_23 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_23: = specific_function %Convert.bound.loc10_23, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_23: init %i32 = call %Convert.specific_fn.loc10_23(%int_1.loc10_23) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_23.1: %i32 = value_of_initializer %int.convert_checked.loc10_23 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_23.2: %i32 = converted %int_1.loc10_23, %.loc10_23.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc10_26: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_26: = bound_method %int_1.loc10_26, %impl.elem0.loc10_26 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_26: = specific_function %Convert.bound.loc10_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_26: init %i32 = call %Convert.specific_fn.loc10_26(%int_1.loc10_26) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_26.1: %i32 = value_of_initializer %int.convert_checked.loc10_26 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_26.2: %i32 = converted %int_1.loc10_26, %.loc10_26.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.less_eq.loc10: init bool = call %LessEq.ref.loc10(%.loc10_23.2, %.loc10_26.2) [template = constants.%true] -// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %int.less_eq.loc10 [template = constants.%true] -// CHECK:STDOUT: %.loc10_13.2: bool = converted %int.less_eq.loc10, %.loc10_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc10_13.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc10: -// CHECK:STDOUT: %True.ref.loc10: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc10(%True.ref.loc10) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc10: -// CHECK:STDOUT: %False.ref.loc10: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc10(%False.ref.loc10) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc10: -// CHECK:STDOUT: %.loc10_13.3: type = block_arg !if.expr.result.loc10 [template = constants.%True] -// CHECK:STDOUT: %false_.ref.loc11: %False = name_ref false_, %false_ -// CHECK:STDOUT: %LessEq.ref.loc11: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] -// CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_0.loc11: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc11_24: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_24: = bound_method %int_1.loc11, %impl.elem0.loc11_24 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc11_24: = specific_function %Convert.bound.loc11_24, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc11_24: init %i32 = call %Convert.specific_fn.loc11_24(%int_1.loc11) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc11_24.1: %i32 = value_of_initializer %int.convert_checked.loc11_24 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc11_24.2: %i32 = converted %int_1.loc11, %.loc11_24.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc11_27: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_27: = bound_method %int_0.loc11, %impl.elem0.loc11_27 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc11_27: = specific_function %Convert.bound.loc11_27, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc11_27: init %i32 = call %Convert.specific_fn.loc11_27(%int_0.loc11) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_27.1: %i32 = value_of_initializer %int.convert_checked.loc11_27 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_27.2: %i32 = converted %int_0.loc11, %.loc11_27.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.less_eq.loc11: init bool = call %LessEq.ref.loc11(%.loc11_24.2, %.loc11_27.2) [template = constants.%false] -// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %int.less_eq.loc11 [template = constants.%false] -// CHECK:STDOUT: %.loc11_14.2: bool = converted %int.less_eq.loc11, %.loc11_14.1 [template = constants.%false] -// CHECK:STDOUT: if %.loc11_14.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc11: -// CHECK:STDOUT: %True.ref.loc11: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc11(%True.ref.loc11) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc11: -// CHECK:STDOUT: %False.ref.loc11: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc11(%False.ref.loc11) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc11: -// CHECK:STDOUT: %.loc11_14.3: type = block_arg !if.expr.result.loc11 [template = constants.%False] -// CHECK:STDOUT: %true_.ref.loc12: %True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc12: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] -// CHECK:STDOUT: %Negate.ref.loc12: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc12: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc12_30: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_30: = bound_method %int_1.loc12, %impl.elem0.loc12_30 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc12_30: = specific_function %Convert.bound.loc12_30, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc12_30: init %i32 = call %Convert.specific_fn.loc12_30(%int_1.loc12) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_30.1: %i32 = value_of_initializer %int.convert_checked.loc12_30 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_30.2: %i32 = converted %int_1.loc12, %.loc12_30.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc12: init %i32 = call %Negate.ref.loc12(%.loc12_30.2) [template = constants.%int_-1] -// CHECK:STDOUT: %int_0.loc12: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc12_31.1: %i32 = value_of_initializer %int.snegate.loc12 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc12_31.2: %i32 = converted %int.snegate.loc12, %.loc12_31.1 [template = constants.%int_-1] -// CHECK:STDOUT: %impl.elem0.loc12_34: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_34: = bound_method %int_0.loc12, %impl.elem0.loc12_34 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc12_34: = specific_function %Convert.bound.loc12_34, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc12_34: init %i32 = call %Convert.specific_fn.loc12_34(%int_0.loc12) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc12_34.1: %i32 = value_of_initializer %int.convert_checked.loc12_34 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc12_34.2: %i32 = converted %int_0.loc12, %.loc12_34.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.less_eq.loc12: init bool = call %LessEq.ref.loc12(%.loc12_31.2, %.loc12_34.2) [template = constants.%true] -// CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %int.less_eq.loc12 [template = constants.%true] -// CHECK:STDOUT: %.loc12_13.2: bool = converted %int.less_eq.loc12, %.loc12_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc12_13.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc12: -// CHECK:STDOUT: %True.ref.loc12: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc12(%True.ref.loc12) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc12: -// CHECK:STDOUT: %False.ref.loc12: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc12(%False.ref.loc12) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc12: -// CHECK:STDOUT: %.loc12_13.3: type = block_arg !if.expr.result.loc12 [template = constants.%True] -// CHECK:STDOUT: %false_.ref.loc13: %False = name_ref false_, %false_ -// CHECK:STDOUT: %LessEq.ref.loc13: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] -// CHECK:STDOUT: %int_0.loc13: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %Negate.ref.loc13: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc13_34: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_34: = bound_method %int_1.loc13, %impl.elem0.loc13_34 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc13_34: = specific_function %Convert.bound.loc13_34, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc13_34: init %i32 = call %Convert.specific_fn.loc13_34(%int_1.loc13) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_34.1: %i32 = value_of_initializer %int.convert_checked.loc13_34 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_34.2: %i32 = converted %int_1.loc13, %.loc13_34.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc13: init %i32 = call %Negate.ref.loc13(%.loc13_34.2) [template = constants.%int_-1] -// CHECK:STDOUT: %impl.elem0.loc13_24: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_24: = bound_method %int_0.loc13, %impl.elem0.loc13_24 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc13_24: = specific_function %Convert.bound.loc13_24, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc13_24: init %i32 = call %Convert.specific_fn.loc13_24(%int_0.loc13) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_24.1: %i32 = value_of_initializer %int.convert_checked.loc13_24 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_24.2: %i32 = converted %int_0.loc13, %.loc13_24.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_35.1: %i32 = value_of_initializer %int.snegate.loc13 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc13_35.2: %i32 = converted %int.snegate.loc13, %.loc13_35.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.less_eq.loc13: init bool = call %LessEq.ref.loc13(%.loc13_24.2, %.loc13_35.2) [template = constants.%false] -// CHECK:STDOUT: %.loc13_14.1: bool = value_of_initializer %int.less_eq.loc13 [template = constants.%false] -// CHECK:STDOUT: %.loc13_14.2: bool = converted %int.less_eq.loc13, %.loc13_14.1 [template = constants.%false] -// CHECK:STDOUT: if %.loc13_14.2 br !if.expr.then.loc13 else br !if.expr.else.loc13 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc13: -// CHECK:STDOUT: %True.ref.loc13: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc13(%True.ref.loc13) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc13: -// CHECK:STDOUT: %False.ref.loc13: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc13(%False.ref.loc13) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc13: -// CHECK:STDOUT: %.loc13_14.3: type = block_arg !if.expr.result.loc13 [template = constants.%False] -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> bool { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %LessEq.ref: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.less_eq: init bool = call %LessEq.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc17_22.1: bool = value_of_initializer %int.less_eq -// CHECK:STDOUT: %.loc17_22.2: bool = converted %int.less_eq, %.loc17_22.1 -// CHECK:STDOUT: return %.loc17_22.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/make_type_signed.carbon b/toolchain/check/testdata/builtins/int/make_type_signed.carbon index 7216669f4394d..d03c141203508 100644 --- a/toolchain/check/testdata/builtins/int/make_type_signed.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_signed.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/make_type_signed.carbon @@ -88,529 +90,3 @@ import library "types"; // CHECK:STDERR: var m: Int(1000000000); // CHECK:STDERR: ^~~~~~~~~~~~~~~ var m: Int(1000000000); - -// CHECK:STDOUT: --- types.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] -// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] -// CHECK:STDOUT: %Int.type: type = fn_type @Int [template] -// CHECK:STDOUT: %Int: %Int.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .IntLiteral = %IntLiteral.decl -// CHECK:STDOUT: .Int = %Int.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %IntLiteral.decl: %IntLiteral.type = fn_decl @IntLiteral [template = constants.%IntLiteral] { -// CHECK:STDOUT: %return.patt: type = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: type = out_param_pattern %return.patt, runtime_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %return.param: ref type = out_param runtime_param0 -// CHECK:STDOUT: %return: ref type = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Int.decl: %Int.type = fn_decl @Int [template = constants.%Int] { -// CHECK:STDOUT: %n.patt: Core.IntLiteral = binding_pattern n -// CHECK:STDOUT: %n.param_patt: Core.IntLiteral = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: type = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: type = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %n.param: Core.IntLiteral = value_param runtime_param0 -// CHECK:STDOUT: %.loc5_22.1: type = splice_block %.loc5_22.3 [template = Core.IntLiteral] { -// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral] -// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc5_22.2: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc5_22.3: type = converted %int_literal.make_type, %.loc5_22.2 [template = Core.IntLiteral] -// CHECK:STDOUT: } -// CHECK:STDOUT: %n: Core.IntLiteral = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref type = out_param runtime_param1 -// CHECK:STDOUT: %return: ref type = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @IntLiteral() -> type = "int_literal.make_type"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int(%n.param_patt: Core.IntLiteral) -> type = "int.make_type_signed"; -// CHECK:STDOUT: -// CHECK:STDOUT: --- use_types.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Int.type: type = fn_type @Int [template] -// CHECK:STDOUT: %Int: %Int.type = struct_value () [template] -// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template] -// CHECK:STDOUT: %i64.builtin: type = int_type signed, %int_64 [template] -// CHECK:STDOUT: %F.type: type = fn_type @F [template] -// CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %int_13: Core.IntLiteral = int_value 13 [template] -// CHECK:STDOUT: %i13.builtin: type = int_type signed, %int_13 [template] -// CHECK:STDOUT: %G.type: type = fn_type @G [template] -// CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] -// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] -// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] -// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] -// CHECK:STDOUT: %iN.builtin: type = int_type signed, %N [symbolic] -// CHECK:STDOUT: %Symbolic.type: type = fn_type @Symbolic [template] -// CHECK:STDOUT: %Symbolic: %Symbolic.type = struct_value () [template] -// CHECK:STDOUT: %require_complete: = require_complete_type %iN.builtin [symbolic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Main//types, IntLiteral, loaded [template = constants.%IntLiteral] -// CHECK:STDOUT: %import_ref.2: %Int.type = import_ref Main//types, Int, loaded [template = constants.%Int] -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.1 -// CHECK:STDOUT: .Int = imports.%import_ref.2 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .G = %G.decl -// CHECK:STDOUT: .Symbolic = %Symbolic.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { -// CHECK:STDOUT: %n.patt: %i64.builtin = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %i64.builtin = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i64.builtin = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i64.builtin = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Int.ref.loc6_21: %Int.type = name_ref Int, imports.%import_ref.2 [template = constants.%Int] -// CHECK:STDOUT: %int_64.loc6_25: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %int.make_type_signed.loc6_27: init type = call %Int.ref.loc6_21(%int_64.loc6_25) [template = constants.%i64.builtin] -// CHECK:STDOUT: %.loc6_27.1: type = value_of_initializer %int.make_type_signed.loc6_27 [template = constants.%i64.builtin] -// CHECK:STDOUT: %.loc6_27.2: type = converted %int.make_type_signed.loc6_27, %.loc6_27.1 [template = constants.%i64.builtin] -// CHECK:STDOUT: %n.param: %i64.builtin = value_param runtime_param0 -// CHECK:STDOUT: %.loc6_15.1: type = splice_block %.loc6_15.3 [template = constants.%i64.builtin] { -// CHECK:STDOUT: %Int.ref.loc6_9: %Int.type = name_ref Int, imports.%import_ref.2 [template = constants.%Int] -// CHECK:STDOUT: %int_64.loc6_13: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %int.make_type_signed.loc6_15: init type = call %Int.ref.loc6_9(%int_64.loc6_13) [template = constants.%i64.builtin] -// CHECK:STDOUT: %.loc6_15.2: type = value_of_initializer %int.make_type_signed.loc6_15 [template = constants.%i64.builtin] -// CHECK:STDOUT: %.loc6_15.3: type = converted %int.make_type_signed.loc6_15, %.loc6_15.2 [template = constants.%i64.builtin] -// CHECK:STDOUT: } -// CHECK:STDOUT: %n: %i64.builtin = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref %i64.builtin = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i64.builtin = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] { -// CHECK:STDOUT: %n.patt: %i13.builtin = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %i13.builtin = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i13.builtin = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i13.builtin = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Int.ref.loc10_21: %Int.type = name_ref Int, imports.%import_ref.2 [template = constants.%Int] -// CHECK:STDOUT: %int_13.loc10_25: Core.IntLiteral = int_value 13 [template = constants.%int_13] -// CHECK:STDOUT: %int.make_type_signed.loc10_27: init type = call %Int.ref.loc10_21(%int_13.loc10_25) [template = constants.%i13.builtin] -// CHECK:STDOUT: %.loc10_27.1: type = value_of_initializer %int.make_type_signed.loc10_27 [template = constants.%i13.builtin] -// CHECK:STDOUT: %.loc10_27.2: type = converted %int.make_type_signed.loc10_27, %.loc10_27.1 [template = constants.%i13.builtin] -// CHECK:STDOUT: %n.param: %i13.builtin = value_param runtime_param0 -// CHECK:STDOUT: %.loc10_15.1: type = splice_block %.loc10_15.3 [template = constants.%i13.builtin] { -// CHECK:STDOUT: %Int.ref.loc10_9: %Int.type = name_ref Int, imports.%import_ref.2 [template = constants.%Int] -// CHECK:STDOUT: %int_13.loc10_13: Core.IntLiteral = int_value 13 [template = constants.%int_13] -// CHECK:STDOUT: %int.make_type_signed.loc10_15: init type = call %Int.ref.loc10_9(%int_13.loc10_13) [template = constants.%i13.builtin] -// CHECK:STDOUT: %.loc10_15.2: type = value_of_initializer %int.make_type_signed.loc10_15 [template = constants.%i13.builtin] -// CHECK:STDOUT: %.loc10_15.3: type = converted %int.make_type_signed.loc10_15, %.loc10_15.2 [template = constants.%i13.builtin] -// CHECK:STDOUT: } -// CHECK:STDOUT: %n: %i13.builtin = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref %i13.builtin = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i13.builtin = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Symbolic.decl: %Symbolic.type = fn_decl @Symbolic [template = constants.%Symbolic] { -// CHECK:STDOUT: %N.patt.loc14_13.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc14_13.2 (constants.%N.patt)] -// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc14_13.1, runtime_param [symbolic = %N.patt.loc14_13.2 (constants.%N.patt)] -// CHECK:STDOUT: %x.patt: @Symbolic.%iN.builtin (%iN.builtin) = binding_pattern x -// CHECK:STDOUT: %x.param_patt: @Symbolic.%iN.builtin (%iN.builtin) = value_param_pattern %x.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: @Symbolic.%iN.builtin (%iN.builtin) = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: @Symbolic.%iN.builtin (%iN.builtin) = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Int.ref.loc14_45: %Int.type = name_ref Int, imports.%import_ref.2 [template = constants.%Int] -// CHECK:STDOUT: %N.ref.loc14_49: Core.IntLiteral = name_ref N, %N.loc14_13.1 [symbolic = %N.loc14_13.2 (constants.%N)] -// CHECK:STDOUT: %int.make_type_signed.loc14_50: init type = call %Int.ref.loc14_45(%N.ref.loc14_49) [symbolic = %iN.builtin (constants.%iN.builtin)] -// CHECK:STDOUT: %.loc14_50.1: type = value_of_initializer %int.make_type_signed.loc14_50 [symbolic = %iN.builtin (constants.%iN.builtin)] -// CHECK:STDOUT: %.loc14_50.2: type = converted %int.make_type_signed.loc14_50, %.loc14_50.1 [symbolic = %iN.builtin (constants.%iN.builtin)] -// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param -// CHECK:STDOUT: %.loc14_28.1: type = splice_block %.loc14_28.3 [template = Core.IntLiteral] { -// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] -// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc14_28.2: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc14_28.3: type = converted %int_literal.make_type, %.loc14_28.2 [template = Core.IntLiteral] -// CHECK:STDOUT: } -// CHECK:STDOUT: %N.loc14_13.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc14_13.2 (constants.%N)] -// CHECK:STDOUT: %x.param: @Symbolic.%iN.builtin (%iN.builtin) = value_param runtime_param0 -// CHECK:STDOUT: %.loc14_39.1: type = splice_block %.loc14_39.3 [symbolic = %iN.builtin (constants.%iN.builtin)] { -// CHECK:STDOUT: %Int.ref.loc14_34: %Int.type = name_ref Int, imports.%import_ref.2 [template = constants.%Int] -// CHECK:STDOUT: %N.ref.loc14_38: Core.IntLiteral = name_ref N, %N.loc14_13.1 [symbolic = %N.loc14_13.2 (constants.%N)] -// CHECK:STDOUT: %int.make_type_signed.loc14_39: init type = call %Int.ref.loc14_34(%N.ref.loc14_38) [symbolic = %iN.builtin (constants.%iN.builtin)] -// CHECK:STDOUT: %.loc14_39.2: type = value_of_initializer %int.make_type_signed.loc14_39 [symbolic = %iN.builtin (constants.%iN.builtin)] -// CHECK:STDOUT: %.loc14_39.3: type = converted %int.make_type_signed.loc14_39, %.loc14_39.2 [symbolic = %iN.builtin (constants.%iN.builtin)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %x: @Symbolic.%iN.builtin (%iN.builtin) = bind_name x, %x.param -// CHECK:STDOUT: %return.param: ref @Symbolic.%iN.builtin (%iN.builtin) = out_param runtime_param1 -// CHECK:STDOUT: %return: ref @Symbolic.%iN.builtin (%iN.builtin) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int(%n.param_patt: Core.IntLiteral) -> type = "int.make_type_signed" [from "types.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%n.param_patt: %i64.builtin) -> %i64.builtin { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref: %i64.builtin = name_ref n, %n -// CHECK:STDOUT: return %n.ref -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @G(%n.param_patt: %i13.builtin) -> %i13.builtin { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref: %i13.builtin = name_ref n, %n -// CHECK:STDOUT: return %n.ref -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @IntLiteral() -> type = "int_literal.make_type" [from "types.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Symbolic(%N.loc14_13.1: Core.IntLiteral) { -// CHECK:STDOUT: %N.loc14_13.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc14_13.2 (constants.%N)] -// CHECK:STDOUT: %N.patt.loc14_13.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc14_13.2 (constants.%N.patt)] -// CHECK:STDOUT: %iN.builtin: type = int_type signed, %N.loc14_13.2 [symbolic = %iN.builtin (constants.%iN.builtin)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @Symbolic.%iN.builtin (%iN.builtin) [symbolic = %require_complete (constants.%require_complete)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%N.param_patt: Core.IntLiteral, %x.param_patt: @Symbolic.%iN.builtin (%iN.builtin)) -> @Symbolic.%iN.builtin (%iN.builtin) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %x.ref: @Symbolic.%iN.builtin (%iN.builtin) = name_ref x, %x -// CHECK:STDOUT: return %x.ref -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Symbolic(constants.%N) { -// CHECK:STDOUT: %N.loc14_13.2 => constants.%N -// CHECK:STDOUT: %N.patt.loc14_13.2 => constants.%N -// CHECK:STDOUT: %iN.builtin => constants.%iN.builtin -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- import_types.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Int.type: type = fn_type @Int [template] -// CHECK:STDOUT: %Int: %Int.type = struct_value () [template] -// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template] -// CHECK:STDOUT: %i64.builtin: type = int_type signed, %int_64 [template] -// CHECK:STDOUT: %UseF.type: type = fn_type @UseF [template] -// CHECK:STDOUT: %UseF: %UseF.type = struct_value () [template] -// CHECK:STDOUT: %F.type: type = fn_type @F [template] -// CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %int_13: Core.IntLiteral = int_value 13 [template] -// CHECK:STDOUT: %i13.builtin: type = int_type signed, %int_13 [template] -// CHECK:STDOUT: %UseG.type: type = fn_type @UseG [template] -// CHECK:STDOUT: %UseG: %UseG.type = struct_value () [template] -// CHECK:STDOUT: %G.type: type = fn_type @G [template] -// CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %int_24: Core.IntLiteral = int_value 24 [template] -// CHECK:STDOUT: %i24.builtin: type = int_type signed, %int_24 [template] -// CHECK:STDOUT: %UseSymbolic.type: type = fn_type @UseSymbolic [template] -// CHECK:STDOUT: %UseSymbolic: %UseSymbolic.type = struct_value () [template] -// CHECK:STDOUT: %Symbolic.type: type = fn_type @Symbolic [template] -// CHECK:STDOUT: %Symbolic: %Symbolic.type = struct_value () [template] -// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] -// CHECK:STDOUT: %iN.builtin: type = int_type signed, %N [symbolic] -// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] -// CHECK:STDOUT: %require_complete: = require_complete_type %iN.builtin [symbolic] -// CHECK:STDOUT: %Symbolic.specific_fn: = specific_function %Symbolic, @Symbolic(%int_24) [template] -// CHECK:STDOUT: %complete_type: = complete_type_witness %i24.builtin [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//types, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.2: %Int.type = import_ref Main//types, Int, loaded [template = constants.%Int] -// CHECK:STDOUT: %import_ref.3: %F.type = import_ref Main//use_types, F, loaded [template = constants.%F] -// CHECK:STDOUT: %import_ref.4: %G.type = import_ref Main//use_types, G, loaded [template = constants.%G] -// CHECK:STDOUT: %import_ref.5: %Symbolic.type = import_ref Main//use_types, Symbolic, loaded [template = constants.%Symbolic] -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.1 -// CHECK:STDOUT: .Int = imports.%import_ref.2 -// CHECK:STDOUT: .F = imports.%import_ref.3 -// CHECK:STDOUT: .G = imports.%import_ref.4 -// CHECK:STDOUT: .Symbolic = imports.%import_ref.5 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .UseF = %UseF.decl -// CHECK:STDOUT: .UseG = %UseG.decl -// CHECK:STDOUT: .UseSymbolic = %UseSymbolic.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %UseF.decl: %UseF.type = fn_decl @UseF [template = constants.%UseF] { -// CHECK:STDOUT: %n.patt: %i64.builtin = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %i64.builtin = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i64.builtin = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i64.builtin = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Int.ref.loc7_24: %Int.type = name_ref Int, imports.%import_ref.2 [template = constants.%Int] -// CHECK:STDOUT: %int_64.loc7_28: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %int.make_type_signed.loc7_30: init type = call %Int.ref.loc7_24(%int_64.loc7_28) [template = constants.%i64.builtin] -// CHECK:STDOUT: %.loc7_30.1: type = value_of_initializer %int.make_type_signed.loc7_30 [template = constants.%i64.builtin] -// CHECK:STDOUT: %.loc7_30.2: type = converted %int.make_type_signed.loc7_30, %.loc7_30.1 [template = constants.%i64.builtin] -// CHECK:STDOUT: %n.param: %i64.builtin = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_18.1: type = splice_block %.loc7_18.3 [template = constants.%i64.builtin] { -// CHECK:STDOUT: %Int.ref.loc7_12: %Int.type = name_ref Int, imports.%import_ref.2 [template = constants.%Int] -// CHECK:STDOUT: %int_64.loc7_16: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %int.make_type_signed.loc7_18: init type = call %Int.ref.loc7_12(%int_64.loc7_16) [template = constants.%i64.builtin] -// CHECK:STDOUT: %.loc7_18.2: type = value_of_initializer %int.make_type_signed.loc7_18 [template = constants.%i64.builtin] -// CHECK:STDOUT: %.loc7_18.3: type = converted %int.make_type_signed.loc7_18, %.loc7_18.2 [template = constants.%i64.builtin] -// CHECK:STDOUT: } -// CHECK:STDOUT: %n: %i64.builtin = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref %i64.builtin = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i64.builtin = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %UseG.decl: %UseG.type = fn_decl @UseG [template = constants.%UseG] { -// CHECK:STDOUT: %n.patt: %i13.builtin = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %i13.builtin = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i13.builtin = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i13.builtin = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Int.ref.loc11_24: %Int.type = name_ref Int, imports.%import_ref.2 [template = constants.%Int] -// CHECK:STDOUT: %int_13.loc11_28: Core.IntLiteral = int_value 13 [template = constants.%int_13] -// CHECK:STDOUT: %int.make_type_signed.loc11_30: init type = call %Int.ref.loc11_24(%int_13.loc11_28) [template = constants.%i13.builtin] -// CHECK:STDOUT: %.loc11_30.1: type = value_of_initializer %int.make_type_signed.loc11_30 [template = constants.%i13.builtin] -// CHECK:STDOUT: %.loc11_30.2: type = converted %int.make_type_signed.loc11_30, %.loc11_30.1 [template = constants.%i13.builtin] -// CHECK:STDOUT: %n.param: %i13.builtin = value_param runtime_param0 -// CHECK:STDOUT: %.loc11_18.1: type = splice_block %.loc11_18.3 [template = constants.%i13.builtin] { -// CHECK:STDOUT: %Int.ref.loc11_12: %Int.type = name_ref Int, imports.%import_ref.2 [template = constants.%Int] -// CHECK:STDOUT: %int_13.loc11_16: Core.IntLiteral = int_value 13 [template = constants.%int_13] -// CHECK:STDOUT: %int.make_type_signed.loc11_18: init type = call %Int.ref.loc11_12(%int_13.loc11_16) [template = constants.%i13.builtin] -// CHECK:STDOUT: %.loc11_18.2: type = value_of_initializer %int.make_type_signed.loc11_18 [template = constants.%i13.builtin] -// CHECK:STDOUT: %.loc11_18.3: type = converted %int.make_type_signed.loc11_18, %.loc11_18.2 [template = constants.%i13.builtin] -// CHECK:STDOUT: } -// CHECK:STDOUT: %n: %i13.builtin = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref %i13.builtin = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i13.builtin = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %UseSymbolic.decl: %UseSymbolic.type = fn_decl @UseSymbolic [template = constants.%UseSymbolic] { -// CHECK:STDOUT: %n.patt: %i24.builtin = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %i24.builtin = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i24.builtin = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i24.builtin = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Int.ref.loc15_31: %Int.type = name_ref Int, imports.%import_ref.2 [template = constants.%Int] -// CHECK:STDOUT: %int_24.loc15_35: Core.IntLiteral = int_value 24 [template = constants.%int_24] -// CHECK:STDOUT: %int.make_type_signed.loc15_37: init type = call %Int.ref.loc15_31(%int_24.loc15_35) [template = constants.%i24.builtin] -// CHECK:STDOUT: %.loc15_37.1: type = value_of_initializer %int.make_type_signed.loc15_37 [template = constants.%i24.builtin] -// CHECK:STDOUT: %.loc15_37.2: type = converted %int.make_type_signed.loc15_37, %.loc15_37.1 [template = constants.%i24.builtin] -// CHECK:STDOUT: %n.param: %i24.builtin = value_param runtime_param0 -// CHECK:STDOUT: %.loc15_25.1: type = splice_block %.loc15_25.3 [template = constants.%i24.builtin] { -// CHECK:STDOUT: %Int.ref.loc15_19: %Int.type = name_ref Int, imports.%import_ref.2 [template = constants.%Int] -// CHECK:STDOUT: %int_24.loc15_23: Core.IntLiteral = int_value 24 [template = constants.%int_24] -// CHECK:STDOUT: %int.make_type_signed.loc15_25: init type = call %Int.ref.loc15_19(%int_24.loc15_23) [template = constants.%i24.builtin] -// CHECK:STDOUT: %.loc15_25.2: type = value_of_initializer %int.make_type_signed.loc15_25 [template = constants.%i24.builtin] -// CHECK:STDOUT: %.loc15_25.3: type = converted %int.make_type_signed.loc15_25, %.loc15_25.2 [template = constants.%i24.builtin] -// CHECK:STDOUT: } -// CHECK:STDOUT: %n: %i24.builtin = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref %i24.builtin = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i24.builtin = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int(%n.param_patt: Core.IntLiteral) -> type = "int.make_type_signed" [from "types.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @UseF(%n.param_patt: %i64.builtin) -> %i64.builtin { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.3 [template = constants.%F] -// CHECK:STDOUT: %n.ref: %i64.builtin = name_ref n, %n -// CHECK:STDOUT: %F.call: init %i64.builtin = call %F.ref(%n.ref) -// CHECK:STDOUT: %.loc8_14.1: %i64.builtin = value_of_initializer %F.call -// CHECK:STDOUT: %.loc8_14.2: %i64.builtin = converted %F.call, %.loc8_14.1 -// CHECK:STDOUT: return %.loc8_14.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%n.param_patt: %i64.builtin) -> %i64.builtin [from "use_types.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @UseG(%n.param_patt: %i13.builtin) -> %i13.builtin { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %G.ref: %G.type = name_ref G, imports.%import_ref.4 [template = constants.%G] -// CHECK:STDOUT: %n.ref: %i13.builtin = name_ref n, %n -// CHECK:STDOUT: %G.call: init %i13.builtin = call %G.ref(%n.ref) -// CHECK:STDOUT: %.loc12_14.1: %i13.builtin = value_of_initializer %G.call -// CHECK:STDOUT: %.loc12_14.2: %i13.builtin = converted %G.call, %.loc12_14.1 -// CHECK:STDOUT: return %.loc12_14.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @G(%n.param_patt: %i13.builtin) -> %i13.builtin [from "use_types.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @UseSymbolic(%n.param_patt: %i24.builtin) -> %i24.builtin { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Symbolic.ref: %Symbolic.type = name_ref Symbolic, imports.%import_ref.5 [template = constants.%Symbolic] -// CHECK:STDOUT: %int_24.loc16: Core.IntLiteral = int_value 24 [template = constants.%int_24] -// CHECK:STDOUT: %n.ref: %i24.builtin = name_ref n, %n -// CHECK:STDOUT: %Symbolic.specific_fn: = specific_function %Symbolic.ref, @Symbolic(constants.%int_24) [template = constants.%Symbolic.specific_fn] -// CHECK:STDOUT: %Symbolic.call: init %i24.builtin = call %Symbolic.specific_fn(%n.ref) -// CHECK:STDOUT: %.loc16_25.1: %i24.builtin = value_of_initializer %Symbolic.call -// CHECK:STDOUT: %.loc16_25.2: %i24.builtin = converted %Symbolic.call, %.loc16_25.1 -// CHECK:STDOUT: return %.loc16_25.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Symbolic(constants.%N: Core.IntLiteral) [from "use_types.carbon"] { -// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)] -// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt (constants.%N.patt)] -// CHECK:STDOUT: %iN.builtin: type = int_type signed, %N [symbolic = %iN.builtin (constants.%iN.builtin)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @Symbolic.%iN.builtin (%iN.builtin) [symbolic = %require_complete (constants.%require_complete)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%N.param_patt: Core.IntLiteral, %x.param_patt: @Symbolic.%iN.builtin (%iN.builtin)) -> @Symbolic.%iN.builtin (%iN.builtin); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Symbolic(constants.%N) { -// CHECK:STDOUT: %N => constants.%N -// CHECK:STDOUT: %N.patt => constants.%N -// CHECK:STDOUT: %iN.builtin => constants.%iN.builtin -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Symbolic(constants.%int_24) { -// CHECK:STDOUT: %N => constants.%int_24 -// CHECK:STDOUT: %N.patt => constants.%int_24 -// CHECK:STDOUT: %iN.builtin => constants.%i24.builtin -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete => constants.%complete_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_zero_size.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Int.type: type = fn_type @Int [template] -// CHECK:STDOUT: %Int: %Int.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//types, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.2: %Int.type = import_ref Main//types, Int, loaded [template = constants.%Int] -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.1 -// CHECK:STDOUT: .Int = imports.%import_ref.2 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .n = %n -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %n.var: ref = var n -// CHECK:STDOUT: %n: ref = bind_name n, %n.var -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int(%n.param_patt: Core.IntLiteral) -> type = "int.make_type_signed" [from "types.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_negative_size.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int.2, @Int.2(%int_32) [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %Int.type.2: type = fn_type @Int.1 [template] -// CHECK:STDOUT: %Int.2: %Int.type.2 = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//types, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.2: %Int.type.2 = import_ref Main//types, Int, loaded [template = constants.%Int.2] -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.3 -// CHECK:STDOUT: .ImplicitAs = %import_ref.7 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.1 -// CHECK:STDOUT: .Int = imports.%import_ref.2 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .n = %n -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %n.patt: %i32 = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %i32 = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc6_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_22: type = class_type @Int.2, @Int.2(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %n.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc6: type = splice_block %i32.loc6_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc6_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_14: type = class_type @Int.2, @Int.2(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %n: %i32 = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %n.var: ref = var n -// CHECK:STDOUT: %n: ref = bind_name n, %n.var -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%n.param_patt: %i32) -> %i32 = "int.snegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int.1(%n.param_patt: Core.IntLiteral) -> type = "int.make_type_signed" [from "types.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_oversized.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Int.type: type = fn_type @Int [template] -// CHECK:STDOUT: %Int: %Int.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//types, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.2: %Int.type = import_ref Main//types, Int, loaded [template = constants.%Int] -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.1 -// CHECK:STDOUT: .Int = imports.%import_ref.2 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .m = %m -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %m.var: ref = var m -// CHECK:STDOUT: %m: ref = bind_name m, %m.var -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Int(%n.param_patt: Core.IntLiteral) -> type = "int.make_type_signed" [from "types.carbon"]; -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon index 4ebec9cc81017..6fc8961c2a120 100644 --- a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/make_type_unsigned.carbon @@ -69,337 +71,3 @@ import library "types"; // CHECK:STDERR: var m: UInt(1000000000); // CHECK:STDERR: ^~~~~~~~~~~~~~~~ var m: UInt(1000000000); - -// CHECK:STDOUT: --- types.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] -// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] -// CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template] -// CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .IntLiteral = %IntLiteral.decl -// CHECK:STDOUT: .UInt = %UInt.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %IntLiteral.decl: %IntLiteral.type = fn_decl @IntLiteral [template = constants.%IntLiteral] { -// CHECK:STDOUT: %return.patt: type = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: type = out_param_pattern %return.patt, runtime_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %return.param: ref type = out_param runtime_param0 -// CHECK:STDOUT: %return: ref type = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %UInt.decl: %UInt.type = fn_decl @UInt [template = constants.%UInt] { -// CHECK:STDOUT: %n.patt: Core.IntLiteral = binding_pattern n -// CHECK:STDOUT: %n.param_patt: Core.IntLiteral = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: type = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: type = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %n.param: Core.IntLiteral = value_param runtime_param0 -// CHECK:STDOUT: %.loc5_23.1: type = splice_block %.loc5_23.3 [template = Core.IntLiteral] { -// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral] -// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc5_23.2: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc5_23.3: type = converted %int_literal.make_type, %.loc5_23.2 [template = Core.IntLiteral] -// CHECK:STDOUT: } -// CHECK:STDOUT: %n: Core.IntLiteral = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref type = out_param runtime_param1 -// CHECK:STDOUT: %return: ref type = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @IntLiteral() -> type = "int_literal.make_type"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @UInt(%n.param_patt: Core.IntLiteral) -> type = "int.make_type_unsigned"; -// CHECK:STDOUT: -// CHECK:STDOUT: --- use_types.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template] -// CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template] -// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template] -// CHECK:STDOUT: %u64.builtin: type = int_type unsigned, %int_64 [template] -// CHECK:STDOUT: %F.type: type = fn_type @F [template] -// CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %int_13: Core.IntLiteral = int_value 13 [template] -// CHECK:STDOUT: %u13.builtin: type = int_type unsigned, %int_13 [template] -// CHECK:STDOUT: %G.type: type = fn_type @G [template] -// CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] -// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] -// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] -// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] -// CHECK:STDOUT: %uN.builtin: type = int_type unsigned, %N [symbolic] -// CHECK:STDOUT: %Symbolic.type: type = fn_type @Symbolic [template] -// CHECK:STDOUT: %Symbolic: %Symbolic.type = struct_value () [template] -// CHECK:STDOUT: %require_complete: = require_complete_type %uN.builtin [symbolic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Main//types, IntLiteral, loaded [template = constants.%IntLiteral] -// CHECK:STDOUT: %import_ref.2: %UInt.type = import_ref Main//types, UInt, loaded [template = constants.%UInt] -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.1 -// CHECK:STDOUT: .UInt = imports.%import_ref.2 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .G = %G.decl -// CHECK:STDOUT: .Symbolic = %Symbolic.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { -// CHECK:STDOUT: %n.patt: %u64.builtin = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %u64.builtin = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %u64.builtin = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u64.builtin = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %UInt.ref.loc6_22: %UInt.type = name_ref UInt, imports.%import_ref.2 [template = constants.%UInt] -// CHECK:STDOUT: %int_64.loc6_27: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %int.make_type_unsigned.loc6_29: init type = call %UInt.ref.loc6_22(%int_64.loc6_27) [template = constants.%u64.builtin] -// CHECK:STDOUT: %.loc6_29.1: type = value_of_initializer %int.make_type_unsigned.loc6_29 [template = constants.%u64.builtin] -// CHECK:STDOUT: %.loc6_29.2: type = converted %int.make_type_unsigned.loc6_29, %.loc6_29.1 [template = constants.%u64.builtin] -// CHECK:STDOUT: %n.param: %u64.builtin = value_param runtime_param0 -// CHECK:STDOUT: %.loc6_16.1: type = splice_block %.loc6_16.3 [template = constants.%u64.builtin] { -// CHECK:STDOUT: %UInt.ref.loc6_9: %UInt.type = name_ref UInt, imports.%import_ref.2 [template = constants.%UInt] -// CHECK:STDOUT: %int_64.loc6_14: Core.IntLiteral = int_value 64 [template = constants.%int_64] -// CHECK:STDOUT: %int.make_type_unsigned.loc6_16: init type = call %UInt.ref.loc6_9(%int_64.loc6_14) [template = constants.%u64.builtin] -// CHECK:STDOUT: %.loc6_16.2: type = value_of_initializer %int.make_type_unsigned.loc6_16 [template = constants.%u64.builtin] -// CHECK:STDOUT: %.loc6_16.3: type = converted %int.make_type_unsigned.loc6_16, %.loc6_16.2 [template = constants.%u64.builtin] -// CHECK:STDOUT: } -// CHECK:STDOUT: %n: %u64.builtin = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref %u64.builtin = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %u64.builtin = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] { -// CHECK:STDOUT: %n.patt: %u13.builtin = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %u13.builtin = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %u13.builtin = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u13.builtin = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %UInt.ref.loc10_22: %UInt.type = name_ref UInt, imports.%import_ref.2 [template = constants.%UInt] -// CHECK:STDOUT: %int_13.loc10_27: Core.IntLiteral = int_value 13 [template = constants.%int_13] -// CHECK:STDOUT: %int.make_type_unsigned.loc10_29: init type = call %UInt.ref.loc10_22(%int_13.loc10_27) [template = constants.%u13.builtin] -// CHECK:STDOUT: %.loc10_29.1: type = value_of_initializer %int.make_type_unsigned.loc10_29 [template = constants.%u13.builtin] -// CHECK:STDOUT: %.loc10_29.2: type = converted %int.make_type_unsigned.loc10_29, %.loc10_29.1 [template = constants.%u13.builtin] -// CHECK:STDOUT: %n.param: %u13.builtin = value_param runtime_param0 -// CHECK:STDOUT: %.loc10_16.1: type = splice_block %.loc10_16.3 [template = constants.%u13.builtin] { -// CHECK:STDOUT: %UInt.ref.loc10_9: %UInt.type = name_ref UInt, imports.%import_ref.2 [template = constants.%UInt] -// CHECK:STDOUT: %int_13.loc10_14: Core.IntLiteral = int_value 13 [template = constants.%int_13] -// CHECK:STDOUT: %int.make_type_unsigned.loc10_16: init type = call %UInt.ref.loc10_9(%int_13.loc10_14) [template = constants.%u13.builtin] -// CHECK:STDOUT: %.loc10_16.2: type = value_of_initializer %int.make_type_unsigned.loc10_16 [template = constants.%u13.builtin] -// CHECK:STDOUT: %.loc10_16.3: type = converted %int.make_type_unsigned.loc10_16, %.loc10_16.2 [template = constants.%u13.builtin] -// CHECK:STDOUT: } -// CHECK:STDOUT: %n: %u13.builtin = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref %u13.builtin = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %u13.builtin = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Symbolic.decl: %Symbolic.type = fn_decl @Symbolic [template = constants.%Symbolic] { -// CHECK:STDOUT: %N.patt.loc14_13.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc14_13.2 (constants.%N.patt)] -// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc14_13.1, runtime_param [symbolic = %N.patt.loc14_13.2 (constants.%N.patt)] -// CHECK:STDOUT: %x.patt: @Symbolic.%uN.builtin (%uN.builtin) = binding_pattern x -// CHECK:STDOUT: %x.param_patt: @Symbolic.%uN.builtin (%uN.builtin) = value_param_pattern %x.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: @Symbolic.%uN.builtin (%uN.builtin) = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: @Symbolic.%uN.builtin (%uN.builtin) = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %UInt.ref.loc14_46: %UInt.type = name_ref UInt, imports.%import_ref.2 [template = constants.%UInt] -// CHECK:STDOUT: %N.ref.loc14_51: Core.IntLiteral = name_ref N, %N.loc14_13.1 [symbolic = %N.loc14_13.2 (constants.%N)] -// CHECK:STDOUT: %int.make_type_unsigned.loc14_52: init type = call %UInt.ref.loc14_46(%N.ref.loc14_51) [symbolic = %uN.builtin (constants.%uN.builtin)] -// CHECK:STDOUT: %.loc14_52.1: type = value_of_initializer %int.make_type_unsigned.loc14_52 [symbolic = %uN.builtin (constants.%uN.builtin)] -// CHECK:STDOUT: %.loc14_52.2: type = converted %int.make_type_unsigned.loc14_52, %.loc14_52.1 [symbolic = %uN.builtin (constants.%uN.builtin)] -// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param -// CHECK:STDOUT: %.loc14_28.1: type = splice_block %.loc14_28.3 [template = Core.IntLiteral] { -// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] -// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc14_28.2: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc14_28.3: type = converted %int_literal.make_type, %.loc14_28.2 [template = Core.IntLiteral] -// CHECK:STDOUT: } -// CHECK:STDOUT: %N.loc14_13.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc14_13.2 (constants.%N)] -// CHECK:STDOUT: %x.param: @Symbolic.%uN.builtin (%uN.builtin) = value_param runtime_param0 -// CHECK:STDOUT: %.loc14_40.1: type = splice_block %.loc14_40.3 [symbolic = %uN.builtin (constants.%uN.builtin)] { -// CHECK:STDOUT: %UInt.ref.loc14_34: %UInt.type = name_ref UInt, imports.%import_ref.2 [template = constants.%UInt] -// CHECK:STDOUT: %N.ref.loc14_39: Core.IntLiteral = name_ref N, %N.loc14_13.1 [symbolic = %N.loc14_13.2 (constants.%N)] -// CHECK:STDOUT: %int.make_type_unsigned.loc14_40: init type = call %UInt.ref.loc14_34(%N.ref.loc14_39) [symbolic = %uN.builtin (constants.%uN.builtin)] -// CHECK:STDOUT: %.loc14_40.2: type = value_of_initializer %int.make_type_unsigned.loc14_40 [symbolic = %uN.builtin (constants.%uN.builtin)] -// CHECK:STDOUT: %.loc14_40.3: type = converted %int.make_type_unsigned.loc14_40, %.loc14_40.2 [symbolic = %uN.builtin (constants.%uN.builtin)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %x: @Symbolic.%uN.builtin (%uN.builtin) = bind_name x, %x.param -// CHECK:STDOUT: %return.param: ref @Symbolic.%uN.builtin (%uN.builtin) = out_param runtime_param1 -// CHECK:STDOUT: %return: ref @Symbolic.%uN.builtin (%uN.builtin) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @UInt(%n.param_patt: Core.IntLiteral) -> type = "int.make_type_unsigned" [from "types.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%n.param_patt: %u64.builtin) -> %u64.builtin { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref: %u64.builtin = name_ref n, %n -// CHECK:STDOUT: return %n.ref -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @G(%n.param_patt: %u13.builtin) -> %u13.builtin { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref: %u13.builtin = name_ref n, %n -// CHECK:STDOUT: return %n.ref -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @IntLiteral() -> type = "int_literal.make_type" [from "types.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Symbolic(%N.loc14_13.1: Core.IntLiteral) { -// CHECK:STDOUT: %N.loc14_13.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc14_13.2 (constants.%N)] -// CHECK:STDOUT: %N.patt.loc14_13.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc14_13.2 (constants.%N.patt)] -// CHECK:STDOUT: %uN.builtin: type = int_type unsigned, %N.loc14_13.2 [symbolic = %uN.builtin (constants.%uN.builtin)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @Symbolic.%uN.builtin (%uN.builtin) [symbolic = %require_complete (constants.%require_complete)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%N.param_patt: Core.IntLiteral, %x.param_patt: @Symbolic.%uN.builtin (%uN.builtin)) -> @Symbolic.%uN.builtin (%uN.builtin) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %x.ref: @Symbolic.%uN.builtin (%uN.builtin) = name_ref x, %x -// CHECK:STDOUT: return %x.ref -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Symbolic(constants.%N) { -// CHECK:STDOUT: %N.loc14_13.2 => constants.%N -// CHECK:STDOUT: %N.patt.loc14_13.2 => constants.%N -// CHECK:STDOUT: %uN.builtin => constants.%uN.builtin -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_zero_size.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template] -// CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//types, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.2: %UInt.type = import_ref Main//types, UInt, loaded [template = constants.%UInt] -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.1 -// CHECK:STDOUT: .UInt = imports.%import_ref.2 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .n = %n -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %n.var: ref = var n -// CHECK:STDOUT: %n: ref = bind_name n, %n.var -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @UInt(%n.param_patt: Core.IntLiteral) -> type = "int.make_type_unsigned" [from "types.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_negative_size.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template] -// CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//types, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.2: %UInt.type = import_ref Main//types, UInt, loaded [template = constants.%UInt] -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.3 -// CHECK:STDOUT: .ImplicitAs = %import_ref.7 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.1 -// CHECK:STDOUT: .UInt = imports.%import_ref.2 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .n = %n -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %n.patt: %i32 = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %i32 = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc6_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %n.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc6: type = splice_block %i32.loc6_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc6_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %n: %i32 = bind_name n, %n.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %n.var: ref = var n -// CHECK:STDOUT: %n: ref = bind_name n, %n.var -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%n.param_patt: %i32) -> %i32 = "int.snegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @UInt(%n.param_patt: Core.IntLiteral) -> type = "int.make_type_unsigned" [from "types.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_oversized.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %UInt.type: type = fn_type @UInt [template] -// CHECK:STDOUT: %UInt: %UInt.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//types, IntLiteral, unloaded -// CHECK:STDOUT: %import_ref.2: %UInt.type = import_ref Main//types, UInt, loaded [template = constants.%UInt] -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .IntLiteral = imports.%import_ref.1 -// CHECK:STDOUT: .UInt = imports.%import_ref.2 -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .m = %m -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %m.var: ref = var m -// CHECK:STDOUT: %m: ref = bind_name m, %m.var -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @UInt(%n.param_patt: Core.IntLiteral) -> type = "int.make_type_unsigned" [from "types.carbon"]; -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/neq.carbon b/toolchain/check/testdata/builtins/int/neq.carbon index a593d58007a43..702010fba3aaf 100644 --- a/toolchain/check/testdata/builtins/int/neq.carbon +++ b/toolchain/check/testdata/builtins/int/neq.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/neq.carbon @@ -20,225 +22,6 @@ fn F(true_: True, false_: False) { true_ as (if Neq(1, 2) then True else False); } -fn RuntimeCall(a: i32, b: i32) -> bool { +fn RuntimeCallIsValid(a: i32, b: i32) -> bool { return Neq(a, b); } - -// CHECK:STDOUT: --- int_neq.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] -// CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] -// CHECK:STDOUT: %Neq.type: type = fn_type @Neq [template] -// CHECK:STDOUT: %Neq: %Neq.type = struct_value () [template] -// CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] -// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] -// CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %F.type: type = fn_type @F [template] -// CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %false: bool = bool_literal false [template] -// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template] -// CHECK:STDOUT: %true: bool = bool_literal true [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .Bool = %import_ref.5 -// CHECK:STDOUT: .ImplicitAs = %import_ref.6 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Neq = %Neq.decl -// CHECK:STDOUT: .True = %True.decl -// CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Neq.decl: %Neq.type = fn_decl @Neq [template = constants.%Neq] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %.loc2_27.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc2_27.2: type = converted %bool.make_type, %.loc2_27.1 [template = bool] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_11: type = splice_block %i32.loc2_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_19: type = splice_block %i32.loc2_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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: %True.decl: type = class_decl @True [template = constants.%True] {} {} -// CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} {} -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { -// CHECK:STDOUT: %true_.patt: %True = binding_pattern true_ -// CHECK:STDOUT: %true_.param_patt: %True = value_param_pattern %true_.patt, runtime_param0 -// CHECK:STDOUT: %false_.patt: %False = binding_pattern false_ -// CHECK:STDOUT: %false_.param_patt: %False = value_param_pattern %false_.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %true_.param: %True = value_param runtime_param0 -// CHECK:STDOUT: %True.ref.loc7: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: %true_: %True = bind_name true_, %true_.param -// CHECK:STDOUT: %false_.param: %False = value_param runtime_param1 -// CHECK:STDOUT: %False.ref.loc7: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: %false_: %False = bind_name false_, %false_.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %.loc12_35.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc12_35.2: type = converted %bool.make_type, %.loc12_35.1 [template = bool] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc12_19: type = splice_block %i32.loc12_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc12_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc12_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc12_27: type = splice_block %i32.loc12_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc12_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc12_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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: class @True { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%True -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @False { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%False -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Neq(%a.param_patt: %i32, %b.param_patt: %i32) -> bool = "int.neq"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%true_.param_patt: %True, %false_.param_patt: %False) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %false_.ref: %False = name_ref false_, %false_ -// CHECK:STDOUT: %Neq.ref.loc8: %Neq.type = name_ref Neq, file.%Neq.decl [template = constants.%Neq] -// CHECK:STDOUT: %int_1.loc8_21: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_1.loc8_24: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc8_21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_21: = bound_method %int_1.loc8_21, %impl.elem0.loc8_21 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc8_21: = specific_function %Convert.bound.loc8_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc8_21: init %i32 = call %Convert.specific_fn.loc8_21(%int_1.loc8_21) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_21.1: %i32 = value_of_initializer %int.convert_checked.loc8_21 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_21.2: %i32 = converted %int_1.loc8_21, %.loc8_21.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc8_24: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_24: = bound_method %int_1.loc8_24, %impl.elem0.loc8_24 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc8_24: = specific_function %Convert.bound.loc8_24, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc8_24: init %i32 = call %Convert.specific_fn.loc8_24(%int_1.loc8_24) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_24.1: %i32 = value_of_initializer %int.convert_checked.loc8_24 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_24.2: %i32 = converted %int_1.loc8_24, %.loc8_24.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.neq.loc8: init bool = call %Neq.ref.loc8(%.loc8_21.2, %.loc8_24.2) [template = constants.%false] -// CHECK:STDOUT: %.loc8_14.1: bool = value_of_initializer %int.neq.loc8 [template = constants.%false] -// CHECK:STDOUT: %.loc8_14.2: bool = converted %int.neq.loc8, %.loc8_14.1 [template = constants.%false] -// CHECK:STDOUT: if %.loc8_14.2 br !if.expr.then.loc8 else br !if.expr.else.loc8 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc8: -// CHECK:STDOUT: %True.ref.loc8: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc8(%True.ref.loc8) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc8: -// CHECK:STDOUT: %False.ref.loc8: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc8(%False.ref.loc8) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc8: -// CHECK:STDOUT: %.loc8_14.3: type = block_arg !if.expr.result.loc8 [template = constants.%False] -// CHECK:STDOUT: %true_.ref: %True = name_ref true_, %true_ -// CHECK:STDOUT: %Neq.ref.loc9: %Neq.type = name_ref Neq, file.%Neq.decl [template = constants.%Neq] -// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %impl.elem0.loc9_20: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_20: = bound_method %int_1.loc9, %impl.elem0.loc9_20 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_20: = specific_function %Convert.bound.loc9_20, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_20: init %i32 = call %Convert.specific_fn.loc9_20(%int_1.loc9) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_20.1: %i32 = value_of_initializer %int.convert_checked.loc9_20 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_20.2: %i32 = converted %int_1.loc9, %.loc9_20.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc9_23: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_23: = bound_method %int_2, %impl.elem0.loc9_23 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_23: = specific_function %Convert.bound.loc9_23, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_23: init %i32 = call %Convert.specific_fn.loc9_23(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_23.1: %i32 = value_of_initializer %int.convert_checked.loc9_23 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_23.2: %i32 = converted %int_2, %.loc9_23.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.neq.loc9: init bool = call %Neq.ref.loc9(%.loc9_20.2, %.loc9_23.2) [template = constants.%true] -// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %int.neq.loc9 [template = constants.%true] -// CHECK:STDOUT: %.loc9_13.2: bool = converted %int.neq.loc9, %.loc9_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc9_13.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc9: -// CHECK:STDOUT: %True.ref.loc9: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc9(%True.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc9: -// CHECK:STDOUT: %False.ref.loc9: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc9(%False.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc9: -// CHECK:STDOUT: %.loc9_13.3: type = block_arg !if.expr.result.loc9 [template = constants.%True] -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> bool { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Neq.ref: %Neq.type = name_ref Neq, file.%Neq.decl [template = constants.%Neq] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.neq: init bool = call %Neq.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc13_19.1: bool = value_of_initializer %int.neq -// CHECK:STDOUT: %.loc13_19.2: bool = converted %int.neq, %.loc13_19.1 -// CHECK:STDOUT: return %.loc13_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/or.carbon b/toolchain/check/testdata/builtins/int/or.carbon index 83817e6a1c833..9dbd3cca8b7ef 100644 --- a/toolchain/check/testdata/builtins/int/or.carbon +++ b/toolchain/check/testdata/builtins/int/or.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/or.carbon @@ -15,114 +17,6 @@ fn Or(a: i32, b: i32) -> i32 = "int.or"; var arr: [i32; Or(12, 10)]; let arr_p: [i32; 14]* = &arr; -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return Or(a, b); } - -// CHECK:STDOUT: --- int_or.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Or.type: type = fn_type @Or [template] -// CHECK:STDOUT: %Or: %Or.type = struct_value () [template] -// CHECK:STDOUT: %int_14.2: Core.IntLiteral = int_value 14 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_14.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Or = %Or.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Or.decl: %Or.type = fn_decl @Or [template = constants.%Or] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_26: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_10: type = splice_block %i32.loc2_10 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_10: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_10: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_18: type = splice_block %i32.loc2_18 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_18: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_18: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Or(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.or"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Or.ref: %Or.type = name_ref Or, file.%Or.decl [template = constants.%Or] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.or: init %i32 = call %Or.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_18.1: %i32 = value_of_initializer %int.or -// CHECK:STDOUT: %.loc8_18.2: %i32 = converted %int.or, %.loc8_18.1 -// CHECK:STDOUT: return %.loc8_18.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/right_shift.carbon b/toolchain/check/testdata/builtins/int/right_shift.carbon index b97ad19732e20..ead0fec1966a4 100644 --- a/toolchain/check/testdata/builtins/int/right_shift.carbon +++ b/toolchain/check/testdata/builtins/int/right_shift.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/right_shift.carbon @@ -15,7 +17,7 @@ fn RightShift(a: i32, b: i32) -> i32 = "int.right_shift"; var arr: [i32; RightShift(22, 2)]; let arr_p: [i32; 5]* = &arr; -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return RightShift(a, b); } @@ -63,396 +65,3 @@ let size_3: i32 = RightShift(1, 33); // CHECK:STDERR: let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ let negative: i32 = RightShift(1, Negate(1)); - -// CHECK:STDOUT: --- int_right_shift.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %RightShift.type.1: type = fn_type @RightShift.1 [template] -// CHECK:STDOUT: %RightShift: %RightShift.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_5.2: Core.IntLiteral = int_value 5 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_5.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .RightShift = %RightShift.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %RightShift.decl: %RightShift.type.1 = fn_decl @RightShift.1 [template = constants.%RightShift] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_34: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_34: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_18: type = splice_block %i32.loc2_18 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_18: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_18: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_26: type = splice_block %i32.loc2_26 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_26: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RightShift.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.right_shift"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %RightShift.ref: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.right_shift: init %i32 = call %RightShift.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_26.1: %i32 = value_of_initializer %int.right_shift -// CHECK:STDOUT: %.loc8_26.2: %i32 = converted %int.right_shift, %.loc8_26.1 -// CHECK:STDOUT: return %.loc8_26.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- arith_shift.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %RightShift.type.1: type = fn_type @RightShift.1 [template] -// CHECK:STDOUT: %RightShift: %RightShift.type.1 = struct_value () [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %array_type.1: type = array_type %int_1.1, %i32 [template] -// CHECK:STDOUT: %ptr.1: type = ptr_type %array_type.1 [template] -// CHECK:STDOUT: %int_3.2: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %array_type.2: type = array_type %int_3.2, %i32 [template] -// CHECK:STDOUT: %ptr.2: type = ptr_type %array_type.2 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .RightShift = %RightShift.decl -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .arr1 = %arr1 -// CHECK:STDOUT: .arr1_p = @__global_init.%arr1_p -// CHECK:STDOUT: .arr2 = %arr2 -// CHECK:STDOUT: .arr2_p = @__global_init.%arr2_p -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %RightShift.decl: %RightShift.type.1 = fn_decl @RightShift.1 [template = constants.%RightShift] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc6_34: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_34: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc6_18: type = splice_block %i32.loc6_18 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc6_18: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_18: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc6_26: type = splice_block %i32.loc6_26 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc6_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_26: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7: type = splice_block %i32.loc7_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr1.var: ref %array_type.1 = var arr1 -// CHECK:STDOUT: %arr1: ref %array_type.1 = bind_name arr1, %arr1.var -// CHECK:STDOUT: %arr2.var: ref %array_type.2 = var arr2 -// CHECK:STDOUT: %arr2: ref %array_type.2 = bind_name arr2, %arr2.var -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RightShift.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.right_shift"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.snegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr1.ref: ref %array_type.1 = name_ref arr1, file.%arr1 -// CHECK:STDOUT: %addr.loc11: %ptr.1 = addr_of %arr1.ref -// CHECK:STDOUT: %arr1_p: %ptr.1 = bind_name arr1_p, %addr.loc11 -// CHECK:STDOUT: %arr2.ref: ref %array_type.2 = name_ref arr2, file.%arr2 -// CHECK:STDOUT: %addr.loc15: %ptr.2 = addr_of %arr2.ref -// CHECK:STDOUT: %arr2_p: %ptr.2 = bind_name arr2_p, %addr.loc15 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_bad_shift.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32.1: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32.1) [template] -// CHECK:STDOUT: %RightShift.type.1: type = fn_type @RightShift.1 [template] -// CHECK:STDOUT: %RightShift: %RightShift.type.1 = struct_value () [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %int_31.1: Core.IntLiteral = int_value 31 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32.1) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32.1) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_31.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32.1) [template] -// CHECK:STDOUT: %int_31.2: %i32 = int_value 31 [template] -// CHECK:STDOUT: %int_0: %i32 = int_value 0 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_32.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32.1) [template] -// CHECK:STDOUT: %int_32.2: %i32 = int_value 32 [template] -// CHECK:STDOUT: %int_33.1: Core.IntLiteral = int_value 33 [template] -// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_33.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32.1) [template] -// CHECK:STDOUT: %int_33.2: %i32 = int_value 33 [template] -// CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .RightShift = %RightShift.decl -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .size_1 = @__global_init.%size_1 -// CHECK:STDOUT: .size_2 = @__global_init.%size_2 -// CHECK:STDOUT: .size_3 = @__global_init.%size_3 -// CHECK:STDOUT: .negative = @__global_init.%negative -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %RightShift.decl: %RightShift.type.1 = fn_decl @RightShift.1 [template = constants.%RightShift] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_34: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc4_34: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_18: type = splice_block %i32.loc4_18 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_18: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc4_18: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc4_26: type = splice_block %i32.loc4_26 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_26: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc4_26: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc5_22: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc5_22: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc5: type = splice_block %i32.loc5_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc5_14: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc5_14: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RightShift.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.right_shift"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.snegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %RightShift.ref.loc8: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] -// CHECK:STDOUT: %int_1.loc8: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_31: Core.IntLiteral = int_value 31 [template = constants.%int_31.1] -// CHECK:STDOUT: %impl.elem0.loc8_30: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_30: = bound_method %int_1.loc8, %impl.elem0.loc8_30 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc8_30: = specific_function %Convert.bound.loc8_30, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc8_30: init %i32 = call %Convert.specific_fn.loc8_30(%int_1.loc8) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_30.1: %i32 = value_of_initializer %int.convert_checked.loc8_30 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_30.2: %i32 = converted %int_1.loc8, %.loc8_30.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc8_33: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_33: = bound_method %int_31, %impl.elem0.loc8_33 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc8_33: = specific_function %Convert.bound.loc8_33, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc8_33: init %i32 = call %Convert.specific_fn.loc8_33(%int_31) [template = constants.%int_31.2] -// CHECK:STDOUT: %.loc8_33.1: %i32 = value_of_initializer %int.convert_checked.loc8_33 [template = constants.%int_31.2] -// CHECK:STDOUT: %.loc8_33.2: %i32 = converted %int_31, %.loc8_33.1 [template = constants.%int_31.2] -// CHECK:STDOUT: %int.right_shift.loc8: init %i32 = call %RightShift.ref.loc8(%.loc8_30.2, %.loc8_33.2) [template = constants.%int_0] -// CHECK:STDOUT: %.loc8_36.1: %i32 = value_of_initializer %int.right_shift.loc8 [template = constants.%int_0] -// CHECK:STDOUT: %.loc8_36.2: %i32 = converted %int.right_shift.loc8, %.loc8_36.1 [template = constants.%int_0] -// CHECK:STDOUT: %size_1: %i32 = bind_name size_1, %.loc8_36.2 -// CHECK:STDOUT: %RightShift.ref.loc13: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] -// CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %impl.elem0.loc13_30: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_30: = bound_method %int_1.loc13, %impl.elem0.loc13_30 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc13_30: = specific_function %Convert.bound.loc13_30, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc13_30: init %i32 = call %Convert.specific_fn.loc13_30(%int_1.loc13) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_30.1: %i32 = value_of_initializer %int.convert_checked.loc13_30 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_30.2: %i32 = converted %int_1.loc13, %.loc13_30.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc13_33: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_33: = bound_method %int_32, %impl.elem0.loc13_33 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc13_33: = specific_function %Convert.bound.loc13_33, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc13_33: init %i32 = call %Convert.specific_fn.loc13_33(%int_32) [template = constants.%int_32.2] -// CHECK:STDOUT: %.loc13_33.1: %i32 = value_of_initializer %int.convert_checked.loc13_33 [template = constants.%int_32.2] -// CHECK:STDOUT: %.loc13_33.2: %i32 = converted %int_32, %.loc13_33.1 [template = constants.%int_32.2] -// CHECK:STDOUT: %int.right_shift.loc13: init %i32 = call %RightShift.ref.loc13(%.loc13_30.2, %.loc13_33.2) [template = ] -// CHECK:STDOUT: %.loc13_36.1: %i32 = value_of_initializer %int.right_shift.loc13 [template = ] -// CHECK:STDOUT: %.loc13_36.2: %i32 = converted %int.right_shift.loc13, %.loc13_36.1 [template = ] -// CHECK:STDOUT: %size_2: %i32 = bind_name size_2, %.loc13_36.2 -// CHECK:STDOUT: %RightShift.ref.loc18: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] -// CHECK:STDOUT: %int_1.loc18: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_33: Core.IntLiteral = int_value 33 [template = constants.%int_33.1] -// CHECK:STDOUT: %impl.elem0.loc18_30: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc18_30: = bound_method %int_1.loc18, %impl.elem0.loc18_30 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc18_30: = specific_function %Convert.bound.loc18_30, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc18_30: init %i32 = call %Convert.specific_fn.loc18_30(%int_1.loc18) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc18_30.1: %i32 = value_of_initializer %int.convert_checked.loc18_30 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc18_30.2: %i32 = converted %int_1.loc18, %.loc18_30.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc18_33: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc18_33: = bound_method %int_33, %impl.elem0.loc18_33 [template = constants.%Convert.bound.4] -// CHECK:STDOUT: %Convert.specific_fn.loc18_33: = specific_function %Convert.bound.loc18_33, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.4] -// CHECK:STDOUT: %int.convert_checked.loc18_33: init %i32 = call %Convert.specific_fn.loc18_33(%int_33) [template = constants.%int_33.2] -// CHECK:STDOUT: %.loc18_33.1: %i32 = value_of_initializer %int.convert_checked.loc18_33 [template = constants.%int_33.2] -// CHECK:STDOUT: %.loc18_33.2: %i32 = converted %int_33, %.loc18_33.1 [template = constants.%int_33.2] -// CHECK:STDOUT: %int.right_shift.loc18: init %i32 = call %RightShift.ref.loc18(%.loc18_30.2, %.loc18_33.2) [template = ] -// CHECK:STDOUT: %.loc18_36.1: %i32 = value_of_initializer %int.right_shift.loc18 [template = ] -// CHECK:STDOUT: %.loc18_36.2: %i32 = converted %int.right_shift.loc18, %.loc18_36.1 [template = ] -// CHECK:STDOUT: %size_3: %i32 = bind_name size_3, %.loc18_36.2 -// CHECK:STDOUT: %RightShift.ref.loc24: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] -// CHECK:STDOUT: %int_1.loc24_32: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %Negate.ref: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc24_42: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc24_42: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc24_42: = bound_method %int_1.loc24_42, %impl.elem0.loc24_42 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc24_42: = specific_function %Convert.bound.loc24_42, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc24_42: init %i32 = call %Convert.specific_fn.loc24_42(%int_1.loc24_42) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc24_42.1: %i32 = value_of_initializer %int.convert_checked.loc24_42 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc24_42.2: %i32 = converted %int_1.loc24_42, %.loc24_42.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate: init %i32 = call %Negate.ref(%.loc24_42.2) [template = constants.%int_-1] -// CHECK:STDOUT: %impl.elem0.loc24_32: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc24_32: = bound_method %int_1.loc24_32, %impl.elem0.loc24_32 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc24_32: = specific_function %Convert.bound.loc24_32, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc24_32: init %i32 = call %Convert.specific_fn.loc24_32(%int_1.loc24_32) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc24_32.1: %i32 = value_of_initializer %int.convert_checked.loc24_32 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc24_32.2: %i32 = converted %int_1.loc24_32, %.loc24_32.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc24_43.1: %i32 = value_of_initializer %int.snegate [template = constants.%int_-1] -// CHECK:STDOUT: %.loc24_43.2: %i32 = converted %int.snegate, %.loc24_43.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.right_shift.loc24: init %i32 = call %RightShift.ref.loc24(%.loc24_32.2, %.loc24_43.2) [template = ] -// CHECK:STDOUT: %.loc24_45.1: %i32 = value_of_initializer %int.right_shift.loc24 [template = ] -// CHECK:STDOUT: %.loc24_45.2: %i32 = converted %int.right_shift.loc24, %.loc24_45.1 [template = ] -// CHECK:STDOUT: %negative: %i32 = bind_name negative, %.loc24_45.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/sadd.carbon b/toolchain/check/testdata/builtins/int/sadd.carbon index 853f11cc47754..92a7a741edf4a 100644 --- a/toolchain/check/testdata/builtins/int/sadd.carbon +++ b/toolchain/check/testdata/builtins/int/sadd.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/sadd.carbon @@ -15,7 +17,7 @@ fn Add(a: i32, b: i32) -> i32 = "int.sadd"; var arr: [i32; Add(1, 2)]; let arr_p: [i32; 3]* = &arr; -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return Add(a, b); } @@ -65,15 +67,15 @@ var bad_return_type: [i32; BadReturnType(1, 2)]; // CHECK:STDERR: var bad_call: [i32; JustRight(1, 2, 3)]; -fn RuntimeCallTooFew(a: i32) -> i32 { +fn RuntimeCallIsValidTooFew(a: i32) -> i32 { return TooFew(a); } -fn RuntimeCallTooMany(a: i32, b: i32, c: i32) -> i32 { +fn RuntimeCallIsValidTooMany(a: i32, b: i32, c: i32) -> i32 { return TooMany(a, b, c); } -fn RuntimeCallBadReturnType(a: i32, b: i32) -> bool { +fn RuntimeCallIsValidBadReturnType(a: i32, b: i32) -> bool { return BadReturnType(a, b); } @@ -88,503 +90,3 @@ let a: i32 = Add(0x7FFFFFFF, 0); // CHECK:STDERR: let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ let b: i32 = Add(0x7FFFFFFF, 1); - -// CHECK:STDOUT: --- int_add.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Add.type.1: type = fn_type @Add.1 [template] -// CHECK:STDOUT: %Add: %Add.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_3.2: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_3.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Add = %Add.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Add.decl: %Add.type.1 = fn_decl @Add.1 [template = constants.%Add] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_11: type = splice_block %i32.loc2_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_19: type = splice_block %i32.loc2_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Add.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.sadd"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Add.ref: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.sadd: init %i32 = call %Add.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.sadd -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int.sadd, %.loc8_19.1 -// CHECK:STDOUT: return %.loc8_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_bad_decl.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [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: %RuntimeCallTooFew.type: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %RuntimeCallTooFew: %RuntimeCallTooFew.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallTooMany.type: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %RuntimeCallTooMany: %RuntimeCallTooMany.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType.type: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType: %RuntimeCallBadReturnType.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .Bool = %import_ref.5 -// CHECK:STDOUT: .ImplicitAs = %import_ref.6 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = 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: .too_few = %too_few -// CHECK:STDOUT: .too_many = %too_many -// CHECK:STDOUT: .bad_return_type = %bad_return_type -// CHECK:STDOUT: .bad_call = %bad_call -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.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: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc8_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc8_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc8: type = splice_block %i32.loc8_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc8_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc8_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany.decl: %TooMany.type = fn_decl @TooMany [template = constants.%TooMany] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %c.patt: %i32 = binding_pattern c -// CHECK:STDOUT: %c.param_patt: %i32 = value_param_pattern %c.patt, runtime_param2 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param3 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc13_39: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc13_39: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc13_15: type = splice_block %i32.loc13_15 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc13_15: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc13_15: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc13_23: type = splice_block %i32.loc13_23 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc13_23: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc13_23: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %c.param: %i32 = value_param runtime_param2 -// CHECK:STDOUT: %.loc13_31: type = splice_block %i32.loc13_31 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc13_31: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc13_31: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %c: %i32 = bind_name c, %c.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param3 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType.decl: %BadReturnType.type = fn_decl @BadReturnType [template = constants.%BadReturnType] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc18_21: type = splice_block %i32.loc18_21 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc18_21: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc18_21: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc18_29: type = splice_block %i32.loc18_29 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc18_29: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc18_29: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc19_33: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc19_33: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc19_17: type = splice_block %i32.loc19_17 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc19_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc19_17: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc19_25: type = splice_block %i32.loc19_25 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc19_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc19_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %too_few.var: ref = var too_few -// CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var -// CHECK:STDOUT: %too_many.var: ref = var too_many -// CHECK:STDOUT: %too_many: ref = bind_name too_many, %too_many.var -// CHECK:STDOUT: %bad_return_type.var: ref = var bad_return_type -// CHECK:STDOUT: %bad_return_type: ref = bind_name bad_return_type, %bad_return_type.var -// CHECK:STDOUT: %bad_call.var: ref = var bad_call -// CHECK:STDOUT: %bad_call: ref = bind_name bad_call, %bad_call.var -// CHECK:STDOUT: %RuntimeCallTooFew.decl: %RuntimeCallTooFew.type = fn_decl @RuntimeCallTooFew [template = constants.%RuntimeCallTooFew] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc46_33: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc46_33: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc46: type = splice_block %i32.loc46_25 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc46_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc46_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany.decl: %RuntimeCallTooMany.type = fn_decl @RuntimeCallTooMany [template = constants.%RuntimeCallTooMany] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %c.patt: %i32 = binding_pattern c -// CHECK:STDOUT: %c.param_patt: %i32 = value_param_pattern %c.patt, runtime_param2 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param3 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc50_50: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc50_50: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc50_26: type = splice_block %i32.loc50_26 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc50_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc50_26: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc50_34: type = splice_block %i32.loc50_34 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc50_34: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc50_34: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %c.param: %i32 = value_param runtime_param2 -// CHECK:STDOUT: %.loc50_42: type = splice_block %i32.loc50_42 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc50_42: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc50_42: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %c: %i32 = bind_name c, %c.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param3 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: %RuntimeCallBadReturnType.type = fn_decl @RuntimeCallBadReturnType [template = constants.%RuntimeCallBadReturnType] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %.loc54_48.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc54_48.2: type = converted %bool.make_type, %.loc54_48.1 [template = bool] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc54_32: type = splice_block %i32.loc54_32 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc54_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc54_32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc54_40: type = splice_block %i32.loc54_40 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc54_40: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc54_40: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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: %i32) -> %i32; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @TooMany(%a.param_patt: %i32, %b.param_patt: %i32, %c.param_patt: %i32) -> %i32; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @BadReturnType(%a.param_patt: %i32, %b.param_patt: %i32) -> bool; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @JustRight(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.sadd"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooFew(%a.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: %TooFew.type = name_ref TooFew, file.%TooFew.decl [template = constants.%TooFew] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %TooFew.call: init %i32 = call %TooFew.ref(%a.ref) -// CHECK:STDOUT: %.loc47_19.1: %i32 = value_of_initializer %TooFew.call -// CHECK:STDOUT: %.loc47_19.2: %i32 = converted %TooFew.call, %.loc47_19.1 -// CHECK:STDOUT: return %.loc47_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooMany(%a.param_patt: %i32, %b.param_patt: %i32, %c.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: %TooMany.type = name_ref TooMany, file.%TooMany.decl [template = constants.%TooMany] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %c.ref: %i32 = name_ref c, %c -// CHECK:STDOUT: %TooMany.call: init %i32 = call %TooMany.ref(%a.ref, %b.ref, %c.ref) -// CHECK:STDOUT: %.loc51_26.1: %i32 = value_of_initializer %TooMany.call -// CHECK:STDOUT: %.loc51_26.2: %i32 = converted %TooMany.call, %.loc51_26.1 -// CHECK:STDOUT: return %.loc51_26.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a.param_patt: %i32, %b.param_patt: %i32) -> bool { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: %BadReturnType.type = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%BadReturnType] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc55_29.1: bool = value_of_initializer %BadReturnType.call -// CHECK:STDOUT: %.loc55_29.2: bool = converted %BadReturnType.call, %.loc55_29.1 -// CHECK:STDOUT: return %.loc55_29.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_overflow.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Add.type.1: type = fn_type @Add.1 [template] -// CHECK:STDOUT: %Add: %Add.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_2147483647.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Add = %Add.decl -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Add.decl: %Add.type.1 = fn_decl @Add.1 [template = constants.%Add] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_11: type = splice_block %i32.loc4_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc4_19: type = splice_block %i32.loc4_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Add.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.sadd"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Add.ref.loc6: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] -// CHECK:STDOUT: %int_2147483647.loc6: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc6_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc6_18: = bound_method %int_2147483647.loc6, %impl.elem0.loc6_18 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc6_18: = specific_function %Convert.bound.loc6_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc6_18: init %i32 = call %Convert.specific_fn.loc6_18(%int_2147483647.loc6) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_18.1: %i32 = value_of_initializer %int.convert_checked.loc6_18 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_18.2: %i32 = converted %int_2147483647.loc6, %.loc6_18.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %impl.elem0.loc6_30: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc6_30: = bound_method %int_0, %impl.elem0.loc6_30 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc6_30: = specific_function %Convert.bound.loc6_30, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc6_30: init %i32 = call %Convert.specific_fn.loc6_30(%int_0) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc6_30.1: %i32 = value_of_initializer %int.convert_checked.loc6_30 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc6_30.2: %i32 = converted %int_0, %.loc6_30.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.sadd.loc6: init %i32 = call %Add.ref.loc6(%.loc6_18.2, %.loc6_30.2) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_32.1: %i32 = value_of_initializer %int.sadd.loc6 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_32.2: %i32 = converted %int.sadd.loc6, %.loc6_32.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc6_32.2 -// CHECK:STDOUT: %Add.ref.loc10: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] -// CHECK:STDOUT: %int_2147483647.loc10: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc10_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_18: = bound_method %int_2147483647.loc10, %impl.elem0.loc10_18 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_18: = specific_function %Convert.bound.loc10_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_18: init %i32 = call %Convert.specific_fn.loc10_18(%int_2147483647.loc10) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc10_18.1: %i32 = value_of_initializer %int.convert_checked.loc10_18 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc10_18.2: %i32 = converted %int_2147483647.loc10, %.loc10_18.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %impl.elem0.loc10_30: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_30: = bound_method %int_1, %impl.elem0.loc10_30 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc10_30: = specific_function %Convert.bound.loc10_30, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc10_30: init %i32 = call %Convert.specific_fn.loc10_30(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_30.1: %i32 = value_of_initializer %int.convert_checked.loc10_30 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_30.2: %i32 = converted %int_1, %.loc10_30.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.sadd.loc10: init %i32 = call %Add.ref.loc10(%.loc10_18.2, %.loc10_30.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc10_32.1: %i32 = value_of_initializer %int.sadd.loc10 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc10_32.2: %i32 = converted %int.sadd.loc10, %.loc10_32.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc10_32.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/sdiv.carbon b/toolchain/check/testdata/builtins/int/sdiv.carbon index 9a86c2ad1c3dd..abec5e0bce168 100644 --- a/toolchain/check/testdata/builtins/int/sdiv.carbon +++ b/toolchain/check/testdata/builtins/int/sdiv.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/sdiv.carbon @@ -15,7 +17,7 @@ fn Div(a: i32, b: i32) -> i32 = "int.sdiv"; var arr: [i32; Div(3, 2)]; let arr_p: [i32; 1]* = &arr; -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return Div(a, b); } @@ -56,448 +58,3 @@ let a: i32 = Div(1, 0); // CHECK:STDERR: let b: i32 = Div(0, 0); // CHECK:STDERR: ^~~~~~~~~ let b: i32 = Div(0, 0); - -// CHECK:STDOUT: --- int_div.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Div.type.1: type = fn_type @Div.1 [template] -// CHECK:STDOUT: %Div: %Div.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_1.2: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_1.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Div = %Div.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Div.decl: %Div.type.1 = fn_decl @Div.1 [template = constants.%Div] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_11: type = splice_block %i32.loc2_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_19: type = splice_block %i32.loc2_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Div.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.sdiv"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Div.ref: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.sdiv: init %i32 = call %Div.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.sdiv -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int.sdiv, %.loc8_19.1 -// CHECK:STDOUT: return %.loc8_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_overflow.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Div.type.1: type = fn_type @Div.1 [template] -// CHECK:STDOUT: %Div: %Div.type.1 = struct_value () [template] -// CHECK:STDOUT: %Sub.type.1: type = fn_type @Sub.1 [template] -// CHECK:STDOUT: %Sub: %Sub.type.1 = struct_value () [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_2147483647.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %int_-2147483647: %i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Div = %Div.decl -// CHECK:STDOUT: .Sub = %Sub.decl -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: .c = @__global_init.%c -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Div.decl: %Div.type.1 = fn_decl @Div.1 [template = constants.%Div] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_11: type = splice_block %i32.loc4_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc4_19: type = splice_block %i32.loc4_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.decl: %Sub.type.1 = fn_decl @Sub.1 [template = constants.%Sub] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc5_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc5_11: type = splice_block %i32.loc5_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc5_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc5_19: type = splice_block %i32.loc5_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc5_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc6_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc6: type = splice_block %i32.loc6_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc6_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Div.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.sdiv"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Sub.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.ssub"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.snegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Div.ref.loc9: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %Negate.ref.loc9_18: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc9: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc9_25: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_25: = bound_method %int_2147483647.loc9, %impl.elem0.loc9_25 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_25: = specific_function %Convert.bound.loc9_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_25: init %i32 = call %Convert.specific_fn.loc9_25(%int_2147483647.loc9) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc9_25.1: %i32 = value_of_initializer %int.convert_checked.loc9_25 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc9_25.2: %i32 = converted %int_2147483647.loc9, %.loc9_25.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.snegate.loc9_36: init %i32 = call %Negate.ref.loc9_18(%.loc9_25.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %Negate.ref.loc9_39: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc9_46: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_46: = bound_method %int_1.loc9, %impl.elem0.loc9_46 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_46: = specific_function %Convert.bound.loc9_46, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_46: init %i32 = call %Convert.specific_fn.loc9_46(%int_1.loc9) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_46.1: %i32 = value_of_initializer %int.convert_checked.loc9_46 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_46.2: %i32 = converted %int_1.loc9, %.loc9_46.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc9_47: init %i32 = call %Negate.ref.loc9_39(%.loc9_46.2) [template = constants.%int_-1] -// CHECK:STDOUT: %.loc9_36.1: %i32 = value_of_initializer %int.snegate.loc9_36 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc9_36.2: %i32 = converted %int.snegate.loc9_36, %.loc9_36.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc9_47.1: %i32 = value_of_initializer %int.snegate.loc9_47 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc9_47.2: %i32 = converted %int.snegate.loc9_47, %.loc9_47.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.sdiv.loc9: init %i32 = call %Div.ref.loc9(%.loc9_36.2, %.loc9_47.2) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc9_49.1: %i32 = value_of_initializer %int.sdiv.loc9 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc9_49.2: %i32 = converted %int.sdiv.loc9, %.loc9_49.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc9_49.2 -// CHECK:STDOUT: %Div.ref.loc12: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %Sub.ref.loc12: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Negate.ref.loc12: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc12: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc12_29: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_29: = bound_method %int_2147483647.loc12, %impl.elem0.loc12_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc12_29: = specific_function %Convert.bound.loc12_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc12_29: init %i32 = call %Convert.specific_fn.loc12_29(%int_2147483647.loc12) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc12_29.1: %i32 = value_of_initializer %int.convert_checked.loc12_29 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc12_29.2: %i32 = converted %int_2147483647.loc12, %.loc12_29.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.snegate.loc12: init %i32 = call %Negate.ref.loc12(%.loc12_29.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1.loc12_43: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc12_40.1: %i32 = value_of_initializer %int.snegate.loc12 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc12_40.2: %i32 = converted %int.snegate.loc12, %.loc12_40.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc12_43: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_43: = bound_method %int_1.loc12_43, %impl.elem0.loc12_43 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc12_43: = specific_function %Convert.bound.loc12_43, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc12_43: init %i32 = call %Convert.specific_fn.loc12_43(%int_1.loc12_43) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_43.1: %i32 = value_of_initializer %int.convert_checked.loc12_43 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_43.2: %i32 = converted %int_1.loc12_43, %.loc12_43.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.ssub.loc12: init %i32 = call %Sub.ref.loc12(%.loc12_40.2, %.loc12_43.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %int_1.loc12_47: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc12_44.1: %i32 = value_of_initializer %int.ssub.loc12 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc12_44.2: %i32 = converted %int.ssub.loc12, %.loc12_44.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %impl.elem0.loc12_47: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_47: = bound_method %int_1.loc12_47, %impl.elem0.loc12_47 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc12_47: = specific_function %Convert.bound.loc12_47, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc12_47: init %i32 = call %Convert.specific_fn.loc12_47(%int_1.loc12_47) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_47.1: %i32 = value_of_initializer %int.convert_checked.loc12_47 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_47.2: %i32 = converted %int_1.loc12_47, %.loc12_47.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.sdiv.loc12: init %i32 = call %Div.ref.loc12(%.loc12_44.2, %.loc12_47.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc12_49.1: %i32 = value_of_initializer %int.sdiv.loc12 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc12_49.2: %i32 = converted %int.sdiv.loc12, %.loc12_49.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc12_49.2 -// CHECK:STDOUT: %Div.ref.loc19: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %Sub.ref.loc19: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Negate.ref.loc19_22: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc19: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc19_29: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc19_29: = bound_method %int_2147483647.loc19, %impl.elem0.loc19_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc19_29: = specific_function %Convert.bound.loc19_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc19_29: init %i32 = call %Convert.specific_fn.loc19_29(%int_2147483647.loc19) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc19_29.1: %i32 = value_of_initializer %int.convert_checked.loc19_29 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc19_29.2: %i32 = converted %int_2147483647.loc19, %.loc19_29.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.snegate.loc19_40: init %i32 = call %Negate.ref.loc19_22(%.loc19_29.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1.loc19_43: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc19_40.1: %i32 = value_of_initializer %int.snegate.loc19_40 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc19_40.2: %i32 = converted %int.snegate.loc19_40, %.loc19_40.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc19_43: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc19_43: = bound_method %int_1.loc19_43, %impl.elem0.loc19_43 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc19_43: = specific_function %Convert.bound.loc19_43, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc19_43: init %i32 = call %Convert.specific_fn.loc19_43(%int_1.loc19_43) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc19_43.1: %i32 = value_of_initializer %int.convert_checked.loc19_43 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc19_43.2: %i32 = converted %int_1.loc19_43, %.loc19_43.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.ssub.loc19: init %i32 = call %Sub.ref.loc19(%.loc19_40.2, %.loc19_43.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %Negate.ref.loc19_47: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc19_54: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc19_54: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc19_54: = bound_method %int_1.loc19_54, %impl.elem0.loc19_54 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc19_54: = specific_function %Convert.bound.loc19_54, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc19_54: init %i32 = call %Convert.specific_fn.loc19_54(%int_1.loc19_54) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc19_54.1: %i32 = value_of_initializer %int.convert_checked.loc19_54 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc19_54.2: %i32 = converted %int_1.loc19_54, %.loc19_54.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc19_55: init %i32 = call %Negate.ref.loc19_47(%.loc19_54.2) [template = constants.%int_-1] -// CHECK:STDOUT: %.loc19_44.1: %i32 = value_of_initializer %int.ssub.loc19 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc19_44.2: %i32 = converted %int.ssub.loc19, %.loc19_44.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc19_55.1: %i32 = value_of_initializer %int.snegate.loc19_55 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc19_55.2: %i32 = converted %int.snegate.loc19_55, %.loc19_55.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.sdiv.loc19: init %i32 = call %Div.ref.loc19(%.loc19_44.2, %.loc19_55.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc19_57.1: %i32 = value_of_initializer %int.sdiv.loc19 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc19_57.2: %i32 = converted %int.sdiv.loc19, %.loc19_57.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %c: %i32 = bind_name c, %.loc19_57.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_div_by_zero.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Div.type.1: type = fn_type @Div.1 [template] -// CHECK:STDOUT: %Div: %Div.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Div = %Div.decl -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Div.decl: %Div.type.1 = fn_decl @Div.1 [template = constants.%Div] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_11: type = splice_block %i32.loc4_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc4_19: type = splice_block %i32.loc4_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Div.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.sdiv"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Div.ref.loc10: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_0.loc10: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc10_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_18: = bound_method %int_1, %impl.elem0.loc10_18 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_18: = specific_function %Convert.bound.loc10_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_18: init %i32 = call %Convert.specific_fn.loc10_18(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_18.1: %i32 = value_of_initializer %int.convert_checked.loc10_18 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_18.2: %i32 = converted %int_1, %.loc10_18.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc10_21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_21: = bound_method %int_0.loc10, %impl.elem0.loc10_21 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc10_21: = specific_function %Convert.bound.loc10_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc10_21: init %i32 = call %Convert.specific_fn.loc10_21(%int_0.loc10) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc10_21.1: %i32 = value_of_initializer %int.convert_checked.loc10_21 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc10_21.2: %i32 = converted %int_0.loc10, %.loc10_21.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.sdiv.loc10: init %i32 = call %Div.ref.loc10(%.loc10_18.2, %.loc10_21.2) [template = ] -// CHECK:STDOUT: %.loc10_23.1: %i32 = value_of_initializer %int.sdiv.loc10 [template = ] -// CHECK:STDOUT: %.loc10_23.2: %i32 = converted %int.sdiv.loc10, %.loc10_23.1 [template = ] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc10_23.2 -// CHECK:STDOUT: %Div.ref.loc15: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %int_0.loc15_18: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %int_0.loc15_21: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc15_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15_18: = bound_method %int_0.loc15_18, %impl.elem0.loc15_18 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc15_18: = specific_function %Convert.bound.loc15_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc15_18: init %i32 = call %Convert.specific_fn.loc15_18(%int_0.loc15_18) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc15_18.1: %i32 = value_of_initializer %int.convert_checked.loc15_18 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc15_18.2: %i32 = converted %int_0.loc15_18, %.loc15_18.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %impl.elem0.loc15_21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15_21: = bound_method %int_0.loc15_21, %impl.elem0.loc15_21 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc15_21: = specific_function %Convert.bound.loc15_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc15_21: init %i32 = call %Convert.specific_fn.loc15_21(%int_0.loc15_21) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc15_21.1: %i32 = value_of_initializer %int.convert_checked.loc15_21 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc15_21.2: %i32 = converted %int_0.loc15_21, %.loc15_21.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.sdiv.loc15: init %i32 = call %Div.ref.loc15(%.loc15_18.2, %.loc15_21.2) [template = ] -// CHECK:STDOUT: %.loc15_23.1: %i32 = value_of_initializer %int.sdiv.loc15 [template = ] -// CHECK:STDOUT: %.loc15_23.2: %i32 = converted %int.sdiv.loc15, %.loc15_23.1 [template = ] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc15_23.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/smod.carbon b/toolchain/check/testdata/builtins/int/smod.carbon index c6ae78058e84c..72f5f4f01cd1b 100644 --- a/toolchain/check/testdata/builtins/int/smod.carbon +++ b/toolchain/check/testdata/builtins/int/smod.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/smod.carbon @@ -15,7 +17,7 @@ fn Mod(a: i32, b: i32) -> i32 = "int.smod"; var arr: [i32; Mod(5, 3)]; let arr_p: [i32; 2]* = &arr; -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return Mod(a, b); } @@ -59,449 +61,3 @@ let a: i32 = Mod(1, 0); // CHECK:STDERR: let b: i32 = Mod(0, 0); // CHECK:STDERR: ^~~~~~~~~ let b: i32 = Mod(0, 0); - -// CHECK:STDOUT: --- int_div.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Mod.type.1: type = fn_type @Mod.1 [template] -// CHECK:STDOUT: %Mod: %Mod.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_2.2: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_2.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Mod = %Mod.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Mod.decl: %Mod.type.1 = fn_decl @Mod.1 [template = constants.%Mod] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_11: type = splice_block %i32.loc2_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_19: type = splice_block %i32.loc2_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Mod.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.smod"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mod.ref: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.smod: init %i32 = call %Mod.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.smod -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int.smod, %.loc8_19.1 -// CHECK:STDOUT: return %.loc8_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_overflow.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Mod.type.1: type = fn_type @Mod.1 [template] -// CHECK:STDOUT: %Mod: %Mod.type.1 = struct_value () [template] -// CHECK:STDOUT: %Sub.type.1: type = fn_type @Sub.1 [template] -// CHECK:STDOUT: %Sub: %Sub.type.1 = struct_value () [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_2147483647.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %int_-2147483647: %i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template] -// CHECK:STDOUT: %int_0: %i32 = int_value 0 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Mod = %Mod.decl -// CHECK:STDOUT: .Sub = %Sub.decl -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: .c = @__global_init.%c -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Mod.decl: %Mod.type.1 = fn_decl @Mod.1 [template = constants.%Mod] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_11: type = splice_block %i32.loc4_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc4_19: type = splice_block %i32.loc4_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.decl: %Sub.type.1 = fn_decl @Sub.1 [template = constants.%Sub] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc5_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc5_11: type = splice_block %i32.loc5_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc5_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc5_19: type = splice_block %i32.loc5_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc5_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc6_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc6: type = splice_block %i32.loc6_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc6_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Mod.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.smod"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Sub.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.ssub"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.snegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mod.ref.loc9: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %Negate.ref.loc9_18: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc9: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc9_25: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_25: = bound_method %int_2147483647.loc9, %impl.elem0.loc9_25 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_25: = specific_function %Convert.bound.loc9_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_25: init %i32 = call %Convert.specific_fn.loc9_25(%int_2147483647.loc9) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc9_25.1: %i32 = value_of_initializer %int.convert_checked.loc9_25 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc9_25.2: %i32 = converted %int_2147483647.loc9, %.loc9_25.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.snegate.loc9_36: init %i32 = call %Negate.ref.loc9_18(%.loc9_25.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %Negate.ref.loc9_39: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc9_46: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_46: = bound_method %int_1.loc9, %impl.elem0.loc9_46 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_46: = specific_function %Convert.bound.loc9_46, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_46: init %i32 = call %Convert.specific_fn.loc9_46(%int_1.loc9) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_46.1: %i32 = value_of_initializer %int.convert_checked.loc9_46 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_46.2: %i32 = converted %int_1.loc9, %.loc9_46.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc9_47: init %i32 = call %Negate.ref.loc9_39(%.loc9_46.2) [template = constants.%int_-1] -// CHECK:STDOUT: %.loc9_36.1: %i32 = value_of_initializer %int.snegate.loc9_36 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc9_36.2: %i32 = converted %int.snegate.loc9_36, %.loc9_36.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc9_47.1: %i32 = value_of_initializer %int.snegate.loc9_47 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc9_47.2: %i32 = converted %int.snegate.loc9_47, %.loc9_47.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.smod.loc9: init %i32 = call %Mod.ref.loc9(%.loc9_36.2, %.loc9_47.2) [template = constants.%int_0] -// CHECK:STDOUT: %.loc9_49.1: %i32 = value_of_initializer %int.smod.loc9 [template = constants.%int_0] -// CHECK:STDOUT: %.loc9_49.2: %i32 = converted %int.smod.loc9, %.loc9_49.1 [template = constants.%int_0] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc9_49.2 -// CHECK:STDOUT: %Mod.ref.loc12: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %Sub.ref.loc12: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Negate.ref.loc12: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc12: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc12_29: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_29: = bound_method %int_2147483647.loc12, %impl.elem0.loc12_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc12_29: = specific_function %Convert.bound.loc12_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc12_29: init %i32 = call %Convert.specific_fn.loc12_29(%int_2147483647.loc12) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc12_29.1: %i32 = value_of_initializer %int.convert_checked.loc12_29 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc12_29.2: %i32 = converted %int_2147483647.loc12, %.loc12_29.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.snegate.loc12: init %i32 = call %Negate.ref.loc12(%.loc12_29.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1.loc12_43: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc12_40.1: %i32 = value_of_initializer %int.snegate.loc12 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc12_40.2: %i32 = converted %int.snegate.loc12, %.loc12_40.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc12_43: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_43: = bound_method %int_1.loc12_43, %impl.elem0.loc12_43 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc12_43: = specific_function %Convert.bound.loc12_43, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc12_43: init %i32 = call %Convert.specific_fn.loc12_43(%int_1.loc12_43) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_43.1: %i32 = value_of_initializer %int.convert_checked.loc12_43 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_43.2: %i32 = converted %int_1.loc12_43, %.loc12_43.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.ssub.loc12: init %i32 = call %Sub.ref.loc12(%.loc12_40.2, %.loc12_43.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %int_1.loc12_47: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc12_44.1: %i32 = value_of_initializer %int.ssub.loc12 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc12_44.2: %i32 = converted %int.ssub.loc12, %.loc12_44.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %impl.elem0.loc12_47: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_47: = bound_method %int_1.loc12_47, %impl.elem0.loc12_47 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc12_47: = specific_function %Convert.bound.loc12_47, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc12_47: init %i32 = call %Convert.specific_fn.loc12_47(%int_1.loc12_47) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_47.1: %i32 = value_of_initializer %int.convert_checked.loc12_47 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_47.2: %i32 = converted %int_1.loc12_47, %.loc12_47.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.smod.loc12: init %i32 = call %Mod.ref.loc12(%.loc12_44.2, %.loc12_47.2) [template = constants.%int_0] -// CHECK:STDOUT: %.loc12_49.1: %i32 = value_of_initializer %int.smod.loc12 [template = constants.%int_0] -// CHECK:STDOUT: %.loc12_49.2: %i32 = converted %int.smod.loc12, %.loc12_49.1 [template = constants.%int_0] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc12_49.2 -// CHECK:STDOUT: %Mod.ref.loc20: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %Sub.ref.loc20: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Negate.ref.loc20_22: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc20: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc20_29: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc20_29: = bound_method %int_2147483647.loc20, %impl.elem0.loc20_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc20_29: = specific_function %Convert.bound.loc20_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc20_29: init %i32 = call %Convert.specific_fn.loc20_29(%int_2147483647.loc20) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc20_29.1: %i32 = value_of_initializer %int.convert_checked.loc20_29 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc20_29.2: %i32 = converted %int_2147483647.loc20, %.loc20_29.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.snegate.loc20_40: init %i32 = call %Negate.ref.loc20_22(%.loc20_29.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1.loc20_43: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc20_40.1: %i32 = value_of_initializer %int.snegate.loc20_40 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc20_40.2: %i32 = converted %int.snegate.loc20_40, %.loc20_40.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc20_43: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc20_43: = bound_method %int_1.loc20_43, %impl.elem0.loc20_43 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc20_43: = specific_function %Convert.bound.loc20_43, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc20_43: init %i32 = call %Convert.specific_fn.loc20_43(%int_1.loc20_43) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc20_43.1: %i32 = value_of_initializer %int.convert_checked.loc20_43 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc20_43.2: %i32 = converted %int_1.loc20_43, %.loc20_43.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.ssub.loc20: init %i32 = call %Sub.ref.loc20(%.loc20_40.2, %.loc20_43.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %Negate.ref.loc20_47: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc20_54: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc20_54: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc20_54: = bound_method %int_1.loc20_54, %impl.elem0.loc20_54 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc20_54: = specific_function %Convert.bound.loc20_54, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc20_54: init %i32 = call %Convert.specific_fn.loc20_54(%int_1.loc20_54) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc20_54.1: %i32 = value_of_initializer %int.convert_checked.loc20_54 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc20_54.2: %i32 = converted %int_1.loc20_54, %.loc20_54.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc20_55: init %i32 = call %Negate.ref.loc20_47(%.loc20_54.2) [template = constants.%int_-1] -// CHECK:STDOUT: %.loc20_44.1: %i32 = value_of_initializer %int.ssub.loc20 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc20_44.2: %i32 = converted %int.ssub.loc20, %.loc20_44.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc20_55.1: %i32 = value_of_initializer %int.snegate.loc20_55 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc20_55.2: %i32 = converted %int.snegate.loc20_55, %.loc20_55.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.smod.loc20: init %i32 = call %Mod.ref.loc20(%.loc20_44.2, %.loc20_55.2) [template = constants.%int_0] -// CHECK:STDOUT: %.loc20_57.1: %i32 = value_of_initializer %int.smod.loc20 [template = constants.%int_0] -// CHECK:STDOUT: %.loc20_57.2: %i32 = converted %int.smod.loc20, %.loc20_57.1 [template = constants.%int_0] -// CHECK:STDOUT: %c: %i32 = bind_name c, %.loc20_57.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_div_by_zero.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Mod.type.1: type = fn_type @Mod.1 [template] -// CHECK:STDOUT: %Mod: %Mod.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Mod = %Mod.decl -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Mod.decl: %Mod.type.1 = fn_decl @Mod.1 [template = constants.%Mod] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_11: type = splice_block %i32.loc4_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc4_19: type = splice_block %i32.loc4_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Mod.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.smod"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mod.ref.loc12: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_0.loc12: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc12_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_18: = bound_method %int_1, %impl.elem0.loc12_18 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc12_18: = specific_function %Convert.bound.loc12_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc12_18: init %i32 = call %Convert.specific_fn.loc12_18(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_18.1: %i32 = value_of_initializer %int.convert_checked.loc12_18 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_18.2: %i32 = converted %int_1, %.loc12_18.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc12_21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_21: = bound_method %int_0.loc12, %impl.elem0.loc12_21 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc12_21: = specific_function %Convert.bound.loc12_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc12_21: init %i32 = call %Convert.specific_fn.loc12_21(%int_0.loc12) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc12_21.1: %i32 = value_of_initializer %int.convert_checked.loc12_21 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc12_21.2: %i32 = converted %int_0.loc12, %.loc12_21.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.smod.loc12: init %i32 = call %Mod.ref.loc12(%.loc12_18.2, %.loc12_21.2) [template = ] -// CHECK:STDOUT: %.loc12_23.1: %i32 = value_of_initializer %int.smod.loc12 [template = ] -// CHECK:STDOUT: %.loc12_23.2: %i32 = converted %int.smod.loc12, %.loc12_23.1 [template = ] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc12_23.2 -// CHECK:STDOUT: %Mod.ref.loc17: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %int_0.loc17_18: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %int_0.loc17_21: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc17_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc17_18: = bound_method %int_0.loc17_18, %impl.elem0.loc17_18 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc17_18: = specific_function %Convert.bound.loc17_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc17_18: init %i32 = call %Convert.specific_fn.loc17_18(%int_0.loc17_18) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc17_18.1: %i32 = value_of_initializer %int.convert_checked.loc17_18 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc17_18.2: %i32 = converted %int_0.loc17_18, %.loc17_18.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %impl.elem0.loc17_21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc17_21: = bound_method %int_0.loc17_21, %impl.elem0.loc17_21 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc17_21: = specific_function %Convert.bound.loc17_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc17_21: init %i32 = call %Convert.specific_fn.loc17_21(%int_0.loc17_21) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc17_21.1: %i32 = value_of_initializer %int.convert_checked.loc17_21 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc17_21.2: %i32 = converted %int_0.loc17_21, %.loc17_21.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.smod.loc17: init %i32 = call %Mod.ref.loc17(%.loc17_18.2, %.loc17_21.2) [template = ] -// CHECK:STDOUT: %.loc17_23.1: %i32 = value_of_initializer %int.smod.loc17 [template = ] -// CHECK:STDOUT: %.loc17_23.2: %i32 = converted %int.smod.loc17, %.loc17_23.1 [template = ] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc17_23.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/smul.carbon b/toolchain/check/testdata/builtins/int/smul.carbon index 5cf91e233671d..563d39d864353 100644 --- a/toolchain/check/testdata/builtins/int/smul.carbon +++ b/toolchain/check/testdata/builtins/int/smul.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/smul.carbon @@ -15,7 +17,7 @@ fn Mul(a: i32, b: i32) -> i32 = "int.smul"; var arr: [i32; Mul(3, 2)]; let arr_p: [i32; 6]* = &arr; -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return Mul(a, b); } @@ -30,227 +32,3 @@ let a: i32 = Mul(0x7FFF, 0x10000); // CHECK:STDERR: let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ let b: i32 = Mul(0x8000, 0x10000); - -// CHECK:STDOUT: --- int_mul.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Mul.type.1: type = fn_type @Mul.1 [template] -// CHECK:STDOUT: %Mul: %Mul.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_6.2: Core.IntLiteral = int_value 6 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_6.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Mul = %Mul.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Mul.decl: %Mul.type.1 = fn_decl @Mul.1 [template = constants.%Mul] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_11: type = splice_block %i32.loc2_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_19: type = splice_block %i32.loc2_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Mul.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.smul"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mul.ref: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.smul: init %i32 = call %Mul.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.smul -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int.smul, %.loc8_19.1 -// CHECK:STDOUT: return %.loc8_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_overflow.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Mul.type.1: type = fn_type @Mul.1 [template] -// CHECK:STDOUT: %Mul: %Mul.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_32767.1: Core.IntLiteral = int_value 32767 [template] -// CHECK:STDOUT: %int_65536.1: Core.IntLiteral = int_value 65536 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_32767.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_32767.2: %i32 = int_value 32767 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_65536.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_65536.2: %i32 = int_value 65536 [template] -// CHECK:STDOUT: %int_2147418112: %i32 = int_value 2147418112 [template] -// CHECK:STDOUT: %int_32768.1: Core.IntLiteral = int_value 32768 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_32768.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_32768.2: %i32 = int_value 32768 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Mul = %Mul.decl -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Mul.decl: %Mul.type.1 = fn_decl @Mul.1 [template = constants.%Mul] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_11: type = splice_block %i32.loc4_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc4_19: type = splice_block %i32.loc4_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Mul.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.smul"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mul.ref.loc6: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] -// CHECK:STDOUT: %int_32767: Core.IntLiteral = int_value 32767 [template = constants.%int_32767.1] -// CHECK:STDOUT: %int_65536.loc6: Core.IntLiteral = int_value 65536 [template = constants.%int_65536.1] -// CHECK:STDOUT: %impl.elem0.loc6_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc6_18: = bound_method %int_32767, %impl.elem0.loc6_18 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc6_18: = specific_function %Convert.bound.loc6_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc6_18: init %i32 = call %Convert.specific_fn.loc6_18(%int_32767) [template = constants.%int_32767.2] -// CHECK:STDOUT: %.loc6_18.1: %i32 = value_of_initializer %int.convert_checked.loc6_18 [template = constants.%int_32767.2] -// CHECK:STDOUT: %.loc6_18.2: %i32 = converted %int_32767, %.loc6_18.1 [template = constants.%int_32767.2] -// CHECK:STDOUT: %impl.elem0.loc6_26: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc6_26: = bound_method %int_65536.loc6, %impl.elem0.loc6_26 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc6_26: = specific_function %Convert.bound.loc6_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc6_26: init %i32 = call %Convert.specific_fn.loc6_26(%int_65536.loc6) [template = constants.%int_65536.2] -// CHECK:STDOUT: %.loc6_26.1: %i32 = value_of_initializer %int.convert_checked.loc6_26 [template = constants.%int_65536.2] -// CHECK:STDOUT: %.loc6_26.2: %i32 = converted %int_65536.loc6, %.loc6_26.1 [template = constants.%int_65536.2] -// CHECK:STDOUT: %int.smul.loc6: init %i32 = call %Mul.ref.loc6(%.loc6_18.2, %.loc6_26.2) [template = constants.%int_2147418112] -// CHECK:STDOUT: %.loc6_34.1: %i32 = value_of_initializer %int.smul.loc6 [template = constants.%int_2147418112] -// CHECK:STDOUT: %.loc6_34.2: %i32 = converted %int.smul.loc6, %.loc6_34.1 [template = constants.%int_2147418112] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc6_34.2 -// CHECK:STDOUT: %Mul.ref.loc10: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] -// CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [template = constants.%int_32768.1] -// CHECK:STDOUT: %int_65536.loc10: Core.IntLiteral = int_value 65536 [template = constants.%int_65536.1] -// CHECK:STDOUT: %impl.elem0.loc10_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_18: = bound_method %int_32768, %impl.elem0.loc10_18 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc10_18: = specific_function %Convert.bound.loc10_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc10_18: init %i32 = call %Convert.specific_fn.loc10_18(%int_32768) [template = constants.%int_32768.2] -// CHECK:STDOUT: %.loc10_18.1: %i32 = value_of_initializer %int.convert_checked.loc10_18 [template = constants.%int_32768.2] -// CHECK:STDOUT: %.loc10_18.2: %i32 = converted %int_32768, %.loc10_18.1 [template = constants.%int_32768.2] -// CHECK:STDOUT: %impl.elem0.loc10_26: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_26: = bound_method %int_65536.loc10, %impl.elem0.loc10_26 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc10_26: = specific_function %Convert.bound.loc10_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc10_26: init %i32 = call %Convert.specific_fn.loc10_26(%int_65536.loc10) [template = constants.%int_65536.2] -// CHECK:STDOUT: %.loc10_26.1: %i32 = value_of_initializer %int.convert_checked.loc10_26 [template = constants.%int_65536.2] -// CHECK:STDOUT: %.loc10_26.2: %i32 = converted %int_65536.loc10, %.loc10_26.1 [template = constants.%int_65536.2] -// CHECK:STDOUT: %int.smul.loc10: init %i32 = call %Mul.ref.loc10(%.loc10_18.2, %.loc10_26.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc10_34.1: %i32 = value_of_initializer %int.smul.loc10 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc10_34.2: %i32 = converted %int.smul.loc10, %.loc10_34.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc10_34.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/snegate.carbon b/toolchain/check/testdata/builtins/int/snegate.carbon index d680c18e6bcdc..a0c03f880e7c1 100644 --- a/toolchain/check/testdata/builtins/int/snegate.carbon +++ b/toolchain/check/testdata/builtins/int/snegate.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/snegate.carbon @@ -17,7 +19,7 @@ let arr_p: [i32; 123]* = &arr; let n: i32 = Negate(1); -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return Negate(a); } @@ -67,7 +69,7 @@ var bad_return_type: [i32; BadReturnType(1)]; // CHECK:STDERR: var bad_call: [i32; JustRight(1, 2)]; -fn RuntimeCallTooFew(a: i32) -> i32 { +fn RuntimeCallIsValidTooFew(a: i32) -> i32 { // 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: ^~~~~~~~~ @@ -78,7 +80,7 @@ fn RuntimeCallTooFew(a: i32) -> i32 { return TooFew(a); } -fn RuntimeCallTooMany(a: i32, b: i32, c: i32) -> i32 { +fn RuntimeCallIsValidTooMany(a: i32, b: i32, c: i32) -> i32 { // 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: ^~~~~~~~~~~~~~~~ @@ -89,7 +91,7 @@ fn RuntimeCallTooMany(a: i32, b: i32, c: i32) -> i32 { return TooMany(a, b, c); } -fn RuntimeCallBadReturnType(a: i32, b: i32) -> bool { +fn RuntimeCallIsValidBadReturnType(a: i32, b: i32) -> 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: ^~~~~~~~~~~~~~~~~~~ @@ -115,499 +117,3 @@ let a: i32 = Negate(Negate(0x7FFFFFFF)); // CHECK:STDERR: let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); - -// CHECK:STDOUT: --- int_negate.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_123.1: Core.IntLiteral = int_value 123 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %array_type: type = array_type %int_123.1, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .n = @__global_init.%n -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2: type = splice_block %i32.loc2_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc9_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc9_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc9_19: type = splice_block %i32.loc9_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc9_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc9_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc9_27: type = splice_block %i32.loc9_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc9_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc9_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.snegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Negate.ref: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %int.snegate: init %i32 = call %Negate.ref(%a.ref) -// CHECK:STDOUT: %.loc10_19.1: %i32 = value_of_initializer %int.snegate -// CHECK:STDOUT: %.loc10_19.2: %i32 = converted %int.snegate, %.loc10_19.1 -// CHECK:STDOUT: return %.loc10_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: %Negate.ref: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_1, %impl.elem0 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked: init %i32 = call %Convert.specific_fn(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc7_21.1: %i32 = value_of_initializer %int.convert_checked [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc7_21.2: %i32 = converted %int_1, %.loc7_21.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate: init %i32 = call %Negate.ref(%.loc7_21.2) [template = constants.%int_-1] -// CHECK:STDOUT: %.loc7_23.1: %i32 = value_of_initializer %int.snegate [template = constants.%int_-1] -// CHECK:STDOUT: %.loc7_23.2: %i32 = converted %int.snegate, %.loc7_23.1 [template = constants.%int_-1] -// CHECK:STDOUT: %n: %i32 = bind_name n, %.loc7_23.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_bad_decl.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [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: %RuntimeCallTooFew.type: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %RuntimeCallTooFew: %RuntimeCallTooFew.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallTooMany.type: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %RuntimeCallTooMany: %RuntimeCallTooMany.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType.type: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType: %RuntimeCallBadReturnType.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .Bool = %import_ref.5 -// CHECK:STDOUT: .ImplicitAs = %import_ref.6 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = 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: .too_few = %too_few -// CHECK:STDOUT: .too_many = %too_many -// CHECK:STDOUT: .bad_return_type = %bad_return_type -// CHECK:STDOUT: .bad_call = %bad_call -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.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: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param0 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany.decl: %TooMany.type = fn_decl @TooMany [template = constants.%TooMany] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc13_31: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc13_31: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc13_15: type = splice_block %i32.loc13_15 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc13_15: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc13_15: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc13_23: type = splice_block %i32.loc13_23 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc13_23: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc13_23: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType.decl: %BadReturnType.type = fn_decl @BadReturnType [template = constants.%BadReturnType] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = 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: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc18_21: type = splice_block %i32 [template = constants.%i32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = 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: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc19_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc19_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc19: type = splice_block %i32.loc19_17 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc19_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc19_17: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %too_few.var: ref = var too_few -// CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var -// CHECK:STDOUT: %too_many.var: ref = var too_many -// CHECK:STDOUT: %too_many: ref = bind_name too_many, %too_many.var -// CHECK:STDOUT: %bad_return_type.var: ref = var bad_return_type -// CHECK:STDOUT: %bad_return_type: ref = bind_name bad_return_type, %bad_return_type.var -// CHECK:STDOUT: %bad_call.var: ref = var bad_call -// CHECK:STDOUT: %bad_call: ref = bind_name bad_call, %bad_call.var -// CHECK:STDOUT: %RuntimeCallTooFew.decl: %RuntimeCallTooFew.type = fn_decl @RuntimeCallTooFew [template = constants.%RuntimeCallTooFew] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc46_33: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc46_33: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc46: type = splice_block %i32.loc46_25 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc46_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc46_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany.decl: %RuntimeCallTooMany.type = fn_decl @RuntimeCallTooMany [template = constants.%RuntimeCallTooMany] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %c.patt: %i32 = binding_pattern c -// CHECK:STDOUT: %c.param_patt: %i32 = value_param_pattern %c.patt, runtime_param2 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param3 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc57_50: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc57_50: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc57_26: type = splice_block %i32.loc57_26 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc57_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc57_26: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc57_34: type = splice_block %i32.loc57_34 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc57_34: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc57_34: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %c.param: %i32 = value_param runtime_param2 -// CHECK:STDOUT: %.loc57_42: type = splice_block %i32.loc57_42 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc57_42: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc57_42: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %c: %i32 = bind_name c, %c.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param3 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: %RuntimeCallBadReturnType.type = fn_decl @RuntimeCallBadReturnType [template = constants.%RuntimeCallBadReturnType] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %.loc68_48.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc68_48.2: type = converted %bool.make_type, %.loc68_48.1 [template = bool] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc68_32: type = splice_block %i32.loc68_32 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc68_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc68_32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc68_40: type = splice_block %i32.loc68_40 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc68_40: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc68_40: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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() -> %i32; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @TooMany(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @BadReturnType(%a.param_patt: %i32) -> bool; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @JustRight(%a.param_patt: %i32) -> %i32 = "int.snegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooFew(%a.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: %TooFew.type = name_ref TooFew, file.%TooFew.decl [template = constants.%TooFew] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooMany(%a.param_patt: %i32, %b.param_patt: %i32, %c.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: %TooMany.type = name_ref TooMany, file.%TooMany.decl [template = constants.%TooMany] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %c.ref: %i32 = name_ref c, %c -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a.param_patt: %i32, %b.param_patt: %i32) -> bool { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: %BadReturnType.type = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%BadReturnType] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_overflow.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %Sub.type.1: type = fn_type @Sub.1 [template] -// CHECK:STDOUT: %Sub: %Sub.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_2147483647.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %int_-2147483647: %i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .Sub = %Sub.decl -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4: type = splice_block %i32.loc4_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.decl: %Sub.type.1 = fn_decl @Sub.1 [template = constants.%Sub] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc5_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc5_11: type = splice_block %i32.loc5_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc5_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc5_19: type = splice_block %i32.loc5_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc5_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.snegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Sub.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.ssub"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Negate.ref.loc8_14: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %Negate.ref.loc8_21: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc8: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc8: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8: = bound_method %int_2147483647.loc8, %impl.elem0.loc8 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc8: = specific_function %Convert.bound.loc8, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc8: init %i32 = call %Convert.specific_fn.loc8(%int_2147483647.loc8) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_28.1: %i32 = value_of_initializer %int.convert_checked.loc8 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_28.2: %i32 = converted %int_2147483647.loc8, %.loc8_28.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.snegate.loc8_38: init %i32 = call %Negate.ref.loc8_21(%.loc8_28.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc8_38.1: %i32 = value_of_initializer %int.snegate.loc8_38 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc8_38.2: %i32 = converted %int.snegate.loc8_38, %.loc8_38.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int.snegate.loc8_39: init %i32 = call %Negate.ref.loc8_14(%.loc8_38.2) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_40.1: %i32 = value_of_initializer %int.snegate.loc8_39 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_40.2: %i32 = converted %int.snegate.loc8_39, %.loc8_40.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc8_40.2 -// CHECK:STDOUT: %Negate.ref.loc14_14: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %Sub.ref: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Negate.ref.loc14_25: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc14: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc14_32: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc14_32: = bound_method %int_2147483647.loc14, %impl.elem0.loc14_32 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc14_32: = specific_function %Convert.bound.loc14_32, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc14_32: init %i32 = call %Convert.specific_fn.loc14_32(%int_2147483647.loc14) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc14_32.1: %i32 = value_of_initializer %int.convert_checked.loc14_32 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc14_32.2: %i32 = converted %int_2147483647.loc14, %.loc14_32.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.snegate.loc14_42: init %i32 = call %Negate.ref.loc14_25(%.loc14_32.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc14_42.1: %i32 = value_of_initializer %int.snegate.loc14_42 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc14_42.2: %i32 = converted %int.snegate.loc14_42, %.loc14_42.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc14_45: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc14_45: = bound_method %int_1, %impl.elem0.loc14_45 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc14_45: = specific_function %Convert.bound.loc14_45, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc14_45: init %i32 = call %Convert.specific_fn.loc14_45(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc14_45.1: %i32 = value_of_initializer %int.convert_checked.loc14_45 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc14_45.2: %i32 = converted %int_1, %.loc14_45.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.ssub: init %i32 = call %Sub.ref(%.loc14_42.2, %.loc14_45.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc14_46.1: %i32 = value_of_initializer %int.ssub [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc14_46.2: %i32 = converted %int.ssub, %.loc14_46.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %int.snegate.loc14_47: init %i32 = call %Negate.ref.loc14_14(%.loc14_46.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc14_48.1: %i32 = value_of_initializer %int.snegate.loc14_47 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc14_48.2: %i32 = converted %int.snegate.loc14_47, %.loc14_48.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc14_48.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/ssub.carbon b/toolchain/check/testdata/builtins/int/ssub.carbon index d80d5d28a5ecd..c27bfe561aac8 100644 --- a/toolchain/check/testdata/builtins/int/ssub.carbon +++ b/toolchain/check/testdata/builtins/int/ssub.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/ssub.carbon @@ -15,7 +17,7 @@ fn Sub(a: i32, b: i32) -> i32 = "int.ssub"; var arr: [i32; Sub(3, 2)]; let arr_p: [i32; 1]* = &arr; -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return Sub(a, b); } @@ -31,273 +33,3 @@ let b: i32 = Sub(Sub(0, 0x7FFFFFFF), 1); // CHECK:STDERR: let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); - -// CHECK:STDOUT: --- int_sub.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Sub.type.1: type = fn_type @Sub.1 [template] -// CHECK:STDOUT: %Sub: %Sub.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_1.2: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_1.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Sub = %Sub.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Sub.decl: %Sub.type.1 = fn_decl @Sub.1 [template = constants.%Sub] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_11: type = splice_block %i32.loc2_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_19: type = splice_block %i32.loc2_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Sub.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.ssub"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Sub.ref: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.ssub: init %i32 = call %Sub.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.ssub -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int.ssub, %.loc8_19.1 -// CHECK:STDOUT: return %.loc8_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_overflow.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Sub.type.1: type = fn_type @Sub.1 [template] -// CHECK:STDOUT: %Sub: %Sub.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2147483647.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %int_-2147483647: %i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] -// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_2.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Sub = %Sub.decl -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: .c = @__global_init.%c -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Sub.decl: %Sub.type.1 = fn_decl @Sub.1 [template = constants.%Sub] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_11: type = splice_block %i32.loc4_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc4_19: type = splice_block %i32.loc4_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Sub.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.ssub"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Sub.ref.loc6: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %int_0.loc6: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %int_2147483647.loc6: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc6_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc6_18: = bound_method %int_0.loc6, %impl.elem0.loc6_18 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc6_18: = specific_function %Convert.bound.loc6_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc6_18: init %i32 = call %Convert.specific_fn.loc6_18(%int_0.loc6) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc6_18.1: %i32 = value_of_initializer %int.convert_checked.loc6_18 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc6_18.2: %i32 = converted %int_0.loc6, %.loc6_18.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %impl.elem0.loc6_21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc6_21: = bound_method %int_2147483647.loc6, %impl.elem0.loc6_21 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc6_21: = specific_function %Convert.bound.loc6_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc6_21: init %i32 = call %Convert.specific_fn.loc6_21(%int_2147483647.loc6) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_21.1: %i32 = value_of_initializer %int.convert_checked.loc6_21 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_21.2: %i32 = converted %int_2147483647.loc6, %.loc6_21.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.ssub.loc6: init %i32 = call %Sub.ref.loc6(%.loc6_18.2, %.loc6_21.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc6_32.1: %i32 = value_of_initializer %int.ssub.loc6 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc6_32.2: %i32 = converted %int.ssub.loc6, %.loc6_32.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc6_32.2 -// CHECK:STDOUT: %Sub.ref.loc7_14: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Sub.ref.loc7_18: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %int_0.loc7: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %int_2147483647.loc7: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc7_22: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc7_22: = bound_method %int_0.loc7, %impl.elem0.loc7_22 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc7_22: = specific_function %Convert.bound.loc7_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc7_22: init %i32 = call %Convert.specific_fn.loc7_22(%int_0.loc7) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc7_22.1: %i32 = value_of_initializer %int.convert_checked.loc7_22 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc7_22.2: %i32 = converted %int_0.loc7, %.loc7_22.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %impl.elem0.loc7_25: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc7_25: = bound_method %int_2147483647.loc7, %impl.elem0.loc7_25 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc7_25: = specific_function %Convert.bound.loc7_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc7_25: init %i32 = call %Convert.specific_fn.loc7_25(%int_2147483647.loc7) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc7_25.1: %i32 = value_of_initializer %int.convert_checked.loc7_25 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc7_25.2: %i32 = converted %int_2147483647.loc7, %.loc7_25.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.ssub.loc7_35: init %i32 = call %Sub.ref.loc7_18(%.loc7_22.2, %.loc7_25.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc7_35.1: %i32 = value_of_initializer %int.ssub.loc7_35 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc7_35.2: %i32 = converted %int.ssub.loc7_35, %.loc7_35.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc7_38: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc7_38: = bound_method %int_1, %impl.elem0.loc7_38 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc7_38: = specific_function %Convert.bound.loc7_38, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc7_38: init %i32 = call %Convert.specific_fn.loc7_38(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc7_38.1: %i32 = value_of_initializer %int.convert_checked.loc7_38 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc7_38.2: %i32 = converted %int_1, %.loc7_38.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.ssub.loc7_39: init %i32 = call %Sub.ref.loc7_14(%.loc7_35.2, %.loc7_38.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc7_40.1: %i32 = value_of_initializer %int.ssub.loc7_39 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc7_40.2: %i32 = converted %int.ssub.loc7_39, %.loc7_40.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc7_40.2 -// CHECK:STDOUT: %Sub.ref.loc11_14: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Sub.ref.loc11_18: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %int_0.loc11: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %int_2147483647.loc11: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc11_22: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_22: = bound_method %int_0.loc11, %impl.elem0.loc11_22 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc11_22: = specific_function %Convert.bound.loc11_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc11_22: init %i32 = call %Convert.specific_fn.loc11_22(%int_0.loc11) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_22.1: %i32 = value_of_initializer %int.convert_checked.loc11_22 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_22.2: %i32 = converted %int_0.loc11, %.loc11_22.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %impl.elem0.loc11_25: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_25: = bound_method %int_2147483647.loc11, %impl.elem0.loc11_25 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc11_25: = specific_function %Convert.bound.loc11_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc11_25: init %i32 = call %Convert.specific_fn.loc11_25(%int_2147483647.loc11) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc11_25.1: %i32 = value_of_initializer %int.convert_checked.loc11_25 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc11_25.2: %i32 = converted %int_2147483647.loc11, %.loc11_25.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.ssub.loc11_35: init %i32 = call %Sub.ref.loc11_18(%.loc11_22.2, %.loc11_25.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %.loc11_35.1: %i32 = value_of_initializer %int.ssub.loc11_35 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc11_35.2: %i32 = converted %int.ssub.loc11_35, %.loc11_35.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc11_38: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_38: = bound_method %int_2, %impl.elem0.loc11_38 [template = constants.%Convert.bound.4] -// CHECK:STDOUT: %Convert.specific_fn.loc11_38: = specific_function %Convert.bound.loc11_38, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] -// CHECK:STDOUT: %int.convert_checked.loc11_38: init %i32 = call %Convert.specific_fn.loc11_38(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc11_38.1: %i32 = value_of_initializer %int.convert_checked.loc11_38 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc11_38.2: %i32 = converted %int_2, %.loc11_38.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.ssub.loc11_39: init %i32 = call %Sub.ref.loc11_14(%.loc11_35.2, %.loc11_38.2) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc11_40.1: %i32 = value_of_initializer %int.ssub.loc11_39 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc11_40.2: %i32 = converted %int.ssub.loc11_39, %.loc11_40.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %c: %i32 = bind_name c, %.loc11_40.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/uadd.carbon b/toolchain/check/testdata/builtins/int/uadd.carbon index c6695f0488ac5..cd7ac70b6b990 100644 --- a/toolchain/check/testdata/builtins/int/uadd.carbon +++ b/toolchain/check/testdata/builtins/int/uadd.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/uadd.carbon @@ -15,7 +17,7 @@ fn Add(a: i32, b: i32) -> i32 = "int.uadd"; var arr: [i32; Add(1, 2)]; let arr_p: [i32; 3]* = &arr; -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return Add(a, b); } @@ -64,15 +66,15 @@ var bad_return_type: [i32; BadReturnType(1, 2)]; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var bad_call: [i32; JustRight(1, 2, 3)]; -fn RuntimeCallTooFew(a: i32) -> i32 { +fn RuntimeCallIsValidTooFew(a: i32) -> i32 { return TooFew(a); } -fn RuntimeCallTooMany(a: i32, b: i32, c: i32) -> i32 { +fn RuntimeCallIsValidTooMany(a: i32, b: i32, c: i32) -> i32 { return TooMany(a, b, c); } -fn RuntimeCallBadReturnType(a: i32, b: i32) -> bool { +fn RuntimeCallIsValidBadReturnType(a: i32, b: i32) -> bool { return BadReturnType(a, b); } @@ -85,503 +87,3 @@ fn Add(a: i32, b: i32) -> i32 = "int.uadd"; // Overflow is OK. let a: i32 = Add(0x7FFFFFFF, 0); let b: i32 = Add(0x7FFFFFFF, 1); - -// CHECK:STDOUT: --- int_add.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Add.type.1: type = fn_type @Add.1 [template] -// CHECK:STDOUT: %Add: %Add.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_3.2: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_3.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Add = %Add.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Add.decl: %Add.type.1 = fn_decl @Add.1 [template = constants.%Add] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_11: type = splice_block %i32.loc2_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_19: type = splice_block %i32.loc2_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Add.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.uadd"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Add.ref: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.uadd: init %i32 = call %Add.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.uadd -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int.uadd, %.loc8_19.1 -// CHECK:STDOUT: return %.loc8_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_bad_decl.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [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: %RuntimeCallTooFew.type: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %RuntimeCallTooFew: %RuntimeCallTooFew.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallTooMany.type: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %RuntimeCallTooMany: %RuntimeCallTooMany.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType.type: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType: %RuntimeCallBadReturnType.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .Bool = %import_ref.5 -// CHECK:STDOUT: .ImplicitAs = %import_ref.6 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = 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: .too_few = %too_few -// CHECK:STDOUT: .too_many = %too_many -// CHECK:STDOUT: .bad_return_type = %bad_return_type -// CHECK:STDOUT: .bad_call = %bad_call -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.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: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc8_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc8_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc8: type = splice_block %i32.loc8_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc8_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc8_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany.decl: %TooMany.type = fn_decl @TooMany [template = constants.%TooMany] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %c.patt: %i32 = binding_pattern c -// CHECK:STDOUT: %c.param_patt: %i32 = value_param_pattern %c.patt, runtime_param2 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param3 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc13_39: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc13_39: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc13_15: type = splice_block %i32.loc13_15 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc13_15: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc13_15: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc13_23: type = splice_block %i32.loc13_23 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc13_23: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc13_23: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %c.param: %i32 = value_param runtime_param2 -// CHECK:STDOUT: %.loc13_31: type = splice_block %i32.loc13_31 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc13_31: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc13_31: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %c: %i32 = bind_name c, %c.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param3 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType.decl: %BadReturnType.type = fn_decl @BadReturnType [template = constants.%BadReturnType] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc18_21: type = splice_block %i32.loc18_21 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc18_21: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc18_21: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc18_29: type = splice_block %i32.loc18_29 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc18_29: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc18_29: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc19_33: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc19_33: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc19_17: type = splice_block %i32.loc19_17 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc19_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc19_17: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc19_25: type = splice_block %i32.loc19_25 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc19_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc19_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %too_few.var: ref = var too_few -// CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var -// CHECK:STDOUT: %too_many.var: ref = var too_many -// CHECK:STDOUT: %too_many: ref = bind_name too_many, %too_many.var -// CHECK:STDOUT: %bad_return_type.var: ref = var bad_return_type -// CHECK:STDOUT: %bad_return_type: ref = bind_name bad_return_type, %bad_return_type.var -// CHECK:STDOUT: %bad_call.var: ref = var bad_call -// CHECK:STDOUT: %bad_call: ref = bind_name bad_call, %bad_call.var -// CHECK:STDOUT: %RuntimeCallTooFew.decl: %RuntimeCallTooFew.type = fn_decl @RuntimeCallTooFew [template = constants.%RuntimeCallTooFew] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc45_33: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc45_33: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc45: type = splice_block %i32.loc45_25 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc45_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc45_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany.decl: %RuntimeCallTooMany.type = fn_decl @RuntimeCallTooMany [template = constants.%RuntimeCallTooMany] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %c.patt: %i32 = binding_pattern c -// CHECK:STDOUT: %c.param_patt: %i32 = value_param_pattern %c.patt, runtime_param2 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param3 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc49_50: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc49_50: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc49_26: type = splice_block %i32.loc49_26 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc49_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc49_26: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc49_34: type = splice_block %i32.loc49_34 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc49_34: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc49_34: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %c.param: %i32 = value_param runtime_param2 -// CHECK:STDOUT: %.loc49_42: type = splice_block %i32.loc49_42 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc49_42: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc49_42: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %c: %i32 = bind_name c, %c.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param3 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: %RuntimeCallBadReturnType.type = fn_decl @RuntimeCallBadReturnType [template = constants.%RuntimeCallBadReturnType] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = 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: %.loc53_48.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc53_48.2: type = converted %bool.make_type, %.loc53_48.1 [template = bool] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc53_32: type = splice_block %i32.loc53_32 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc53_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc53_32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc53_40: type = splice_block %i32.loc53_40 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc53_40: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc53_40: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = 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: %i32) -> %i32; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @TooMany(%a.param_patt: %i32, %b.param_patt: %i32, %c.param_patt: %i32) -> %i32; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @BadReturnType(%a.param_patt: %i32, %b.param_patt: %i32) -> bool; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @JustRight(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.uadd"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooFew(%a.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: %TooFew.type = name_ref TooFew, file.%TooFew.decl [template = constants.%TooFew] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %TooFew.call: init %i32 = call %TooFew.ref(%a.ref) -// CHECK:STDOUT: %.loc46_19.1: %i32 = value_of_initializer %TooFew.call -// CHECK:STDOUT: %.loc46_19.2: %i32 = converted %TooFew.call, %.loc46_19.1 -// CHECK:STDOUT: return %.loc46_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooMany(%a.param_patt: %i32, %b.param_patt: %i32, %c.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: %TooMany.type = name_ref TooMany, file.%TooMany.decl [template = constants.%TooMany] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %c.ref: %i32 = name_ref c, %c -// CHECK:STDOUT: %TooMany.call: init %i32 = call %TooMany.ref(%a.ref, %b.ref, %c.ref) -// CHECK:STDOUT: %.loc50_26.1: %i32 = value_of_initializer %TooMany.call -// CHECK:STDOUT: %.loc50_26.2: %i32 = converted %TooMany.call, %.loc50_26.1 -// CHECK:STDOUT: return %.loc50_26.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a.param_patt: %i32, %b.param_patt: %i32) -> bool { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: %BadReturnType.type = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%BadReturnType] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc54_29.1: bool = value_of_initializer %BadReturnType.call -// CHECK:STDOUT: %.loc54_29.2: bool = converted %BadReturnType.call, %.loc54_29.1 -// CHECK:STDOUT: return %.loc54_29.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- overflow.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Add.type.1: type = fn_type @Add.1 [template] -// CHECK:STDOUT: %Add: %Add.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_2147483647.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Add = %Add.decl -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Add.decl: %Add.type.1 = fn_decl @Add.1 [template = constants.%Add] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_11: type = splice_block %i32.loc4_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc4_19: type = splice_block %i32.loc4_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Add.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.uadd"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Add.ref.loc7: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] -// CHECK:STDOUT: %int_2147483647.loc7: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc7_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc7_18: = bound_method %int_2147483647.loc7, %impl.elem0.loc7_18 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc7_18: = specific_function %Convert.bound.loc7_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc7_18: init %i32 = call %Convert.specific_fn.loc7_18(%int_2147483647.loc7) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc7_18.1: %i32 = value_of_initializer %int.convert_checked.loc7_18 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc7_18.2: %i32 = converted %int_2147483647.loc7, %.loc7_18.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %impl.elem0.loc7_30: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc7_30: = bound_method %int_0, %impl.elem0.loc7_30 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc7_30: = specific_function %Convert.bound.loc7_30, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc7_30: init %i32 = call %Convert.specific_fn.loc7_30(%int_0) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc7_30.1: %i32 = value_of_initializer %int.convert_checked.loc7_30 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc7_30.2: %i32 = converted %int_0, %.loc7_30.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.uadd.loc7: init %i32 = call %Add.ref.loc7(%.loc7_18.2, %.loc7_30.2) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc7_32.1: %i32 = value_of_initializer %int.uadd.loc7 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc7_32.2: %i32 = converted %int.uadd.loc7, %.loc7_32.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc7_32.2 -// CHECK:STDOUT: %Add.ref.loc8: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] -// CHECK:STDOUT: %int_2147483647.loc8: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc8_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_18: = bound_method %int_2147483647.loc8, %impl.elem0.loc8_18 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc8_18: = specific_function %Convert.bound.loc8_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc8_18: init %i32 = call %Convert.specific_fn.loc8_18(%int_2147483647.loc8) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_18.1: %i32 = value_of_initializer %int.convert_checked.loc8_18 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_18.2: %i32 = converted %int_2147483647.loc8, %.loc8_18.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %impl.elem0.loc8_30: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_30: = bound_method %int_1, %impl.elem0.loc8_30 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc8_30: = specific_function %Convert.bound.loc8_30, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc8_30: init %i32 = call %Convert.specific_fn.loc8_30(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_30.1: %i32 = value_of_initializer %int.convert_checked.loc8_30 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_30.2: %i32 = converted %int_1, %.loc8_30.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.uadd.loc8: init %i32 = call %Add.ref.loc8(%.loc8_18.2, %.loc8_30.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc8_32.1: %i32 = value_of_initializer %int.uadd.loc8 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc8_32.2: %i32 = converted %int.uadd.loc8, %.loc8_32.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc8_32.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/udiv.carbon b/toolchain/check/testdata/builtins/int/udiv.carbon index 605d5ac2801ee..1efe7a8938583 100644 --- a/toolchain/check/testdata/builtins/int/udiv.carbon +++ b/toolchain/check/testdata/builtins/int/udiv.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/udiv.carbon @@ -15,7 +17,7 @@ fn Div(a: i32, b: i32) -> i32 = "int.udiv"; var arr: [i32; Div(3, 2)]; let arr_p: [i32; 1]* = &arr; -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return Div(a, b); } @@ -52,449 +54,3 @@ let a: i32 = Div(1, 0); // CHECK:STDERR: let b: i32 = Div(0, 0); // CHECK:STDERR: ^~~~~~~~~ let b: i32 = Div(0, 0); - -// CHECK:STDOUT: --- int_div.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Div.type.1: type = fn_type @Div.1 [template] -// CHECK:STDOUT: %Div: %Div.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_1.2: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_1.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Div = %Div.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Div.decl: %Div.type.1 = fn_decl @Div.1 [template = constants.%Div] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_11: type = splice_block %i32.loc2_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_19: type = splice_block %i32.loc2_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Div.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.udiv"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Div.ref: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.udiv: init %i32 = call %Div.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.udiv -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int.udiv, %.loc8_19.1 -// CHECK:STDOUT: return %.loc8_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- overflow.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Div.type.1: type = fn_type @Div.1 [template] -// CHECK:STDOUT: %Div: %Div.type.1 = struct_value () [template] -// CHECK:STDOUT: %Sub.type.1: type = fn_type @Sub.1 [template] -// CHECK:STDOUT: %Sub: %Sub.type.1 = struct_value () [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_2147483647.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %int_-2147483647: %i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template] -// CHECK:STDOUT: %int_0: %i32 = int_value 0 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Div = %Div.decl -// CHECK:STDOUT: .Sub = %Sub.decl -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: .c = @__global_init.%c -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Div.decl: %Div.type.1 = fn_decl @Div.1 [template = constants.%Div] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_11: type = splice_block %i32.loc4_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc4_19: type = splice_block %i32.loc4_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.decl: %Sub.type.1 = fn_decl @Sub.1 [template = constants.%Sub] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc5_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc5_11: type = splice_block %i32.loc5_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc5_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc5_19: type = splice_block %i32.loc5_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc5_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc6_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc6: type = splice_block %i32.loc6_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc6_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Div.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.udiv"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Sub.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.usub"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.unegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Div.ref.loc9: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %Negate.ref.loc9_18: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc9: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc9_25: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_25: = bound_method %int_2147483647.loc9, %impl.elem0.loc9_25 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_25: = specific_function %Convert.bound.loc9_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_25: init %i32 = call %Convert.specific_fn.loc9_25(%int_2147483647.loc9) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc9_25.1: %i32 = value_of_initializer %int.convert_checked.loc9_25 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc9_25.2: %i32 = converted %int_2147483647.loc9, %.loc9_25.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.unegate.loc9_36: init %i32 = call %Negate.ref.loc9_18(%.loc9_25.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %Negate.ref.loc9_39: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc9_46: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_46: = bound_method %int_1.loc9, %impl.elem0.loc9_46 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_46: = specific_function %Convert.bound.loc9_46, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_46: init %i32 = call %Convert.specific_fn.loc9_46(%int_1.loc9) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_46.1: %i32 = value_of_initializer %int.convert_checked.loc9_46 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_46.2: %i32 = converted %int_1.loc9, %.loc9_46.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.unegate.loc9_47: init %i32 = call %Negate.ref.loc9_39(%.loc9_46.2) [template = constants.%int_-1] -// CHECK:STDOUT: %.loc9_36.1: %i32 = value_of_initializer %int.unegate.loc9_36 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc9_36.2: %i32 = converted %int.unegate.loc9_36, %.loc9_36.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc9_47.1: %i32 = value_of_initializer %int.unegate.loc9_47 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc9_47.2: %i32 = converted %int.unegate.loc9_47, %.loc9_47.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.udiv.loc9: init %i32 = call %Div.ref.loc9(%.loc9_36.2, %.loc9_47.2) [template = constants.%int_0] -// CHECK:STDOUT: %.loc9_49.1: %i32 = value_of_initializer %int.udiv.loc9 [template = constants.%int_0] -// CHECK:STDOUT: %.loc9_49.2: %i32 = converted %int.udiv.loc9, %.loc9_49.1 [template = constants.%int_0] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc9_49.2 -// CHECK:STDOUT: %Div.ref.loc12: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %Sub.ref.loc12: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Negate.ref.loc12: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc12: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc12_29: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_29: = bound_method %int_2147483647.loc12, %impl.elem0.loc12_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc12_29: = specific_function %Convert.bound.loc12_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc12_29: init %i32 = call %Convert.specific_fn.loc12_29(%int_2147483647.loc12) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc12_29.1: %i32 = value_of_initializer %int.convert_checked.loc12_29 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc12_29.2: %i32 = converted %int_2147483647.loc12, %.loc12_29.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.unegate.loc12: init %i32 = call %Negate.ref.loc12(%.loc12_29.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1.loc12_43: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc12_40.1: %i32 = value_of_initializer %int.unegate.loc12 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc12_40.2: %i32 = converted %int.unegate.loc12, %.loc12_40.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc12_43: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_43: = bound_method %int_1.loc12_43, %impl.elem0.loc12_43 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc12_43: = specific_function %Convert.bound.loc12_43, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc12_43: init %i32 = call %Convert.specific_fn.loc12_43(%int_1.loc12_43) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_43.1: %i32 = value_of_initializer %int.convert_checked.loc12_43 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_43.2: %i32 = converted %int_1.loc12_43, %.loc12_43.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.usub.loc12: init %i32 = call %Sub.ref.loc12(%.loc12_40.2, %.loc12_43.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %int_1.loc12_47: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc12_44.1: %i32 = value_of_initializer %int.usub.loc12 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc12_44.2: %i32 = converted %int.usub.loc12, %.loc12_44.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %impl.elem0.loc12_47: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_47: = bound_method %int_1.loc12_47, %impl.elem0.loc12_47 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc12_47: = specific_function %Convert.bound.loc12_47, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc12_47: init %i32 = call %Convert.specific_fn.loc12_47(%int_1.loc12_47) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_47.1: %i32 = value_of_initializer %int.convert_checked.loc12_47 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_47.2: %i32 = converted %int_1.loc12_47, %.loc12_47.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.udiv.loc12: init %i32 = call %Div.ref.loc12(%.loc12_44.2, %.loc12_47.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc12_49.1: %i32 = value_of_initializer %int.udiv.loc12 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc12_49.2: %i32 = converted %int.udiv.loc12, %.loc12_49.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc12_49.2 -// CHECK:STDOUT: %Div.ref.loc15: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %Sub.ref.loc15: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Negate.ref.loc15_22: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc15: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc15_29: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15_29: = bound_method %int_2147483647.loc15, %impl.elem0.loc15_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc15_29: = specific_function %Convert.bound.loc15_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc15_29: init %i32 = call %Convert.specific_fn.loc15_29(%int_2147483647.loc15) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc15_29.1: %i32 = value_of_initializer %int.convert_checked.loc15_29 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc15_29.2: %i32 = converted %int_2147483647.loc15, %.loc15_29.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.unegate.loc15_40: init %i32 = call %Negate.ref.loc15_22(%.loc15_29.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1.loc15_43: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc15_40.1: %i32 = value_of_initializer %int.unegate.loc15_40 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc15_40.2: %i32 = converted %int.unegate.loc15_40, %.loc15_40.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc15_43: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15_43: = bound_method %int_1.loc15_43, %impl.elem0.loc15_43 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc15_43: = specific_function %Convert.bound.loc15_43, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc15_43: init %i32 = call %Convert.specific_fn.loc15_43(%int_1.loc15_43) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc15_43.1: %i32 = value_of_initializer %int.convert_checked.loc15_43 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc15_43.2: %i32 = converted %int_1.loc15_43, %.loc15_43.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.usub.loc15: init %i32 = call %Sub.ref.loc15(%.loc15_40.2, %.loc15_43.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %Negate.ref.loc15_47: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc15_54: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc15_54: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15_54: = bound_method %int_1.loc15_54, %impl.elem0.loc15_54 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc15_54: = specific_function %Convert.bound.loc15_54, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc15_54: init %i32 = call %Convert.specific_fn.loc15_54(%int_1.loc15_54) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc15_54.1: %i32 = value_of_initializer %int.convert_checked.loc15_54 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc15_54.2: %i32 = converted %int_1.loc15_54, %.loc15_54.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.unegate.loc15_55: init %i32 = call %Negate.ref.loc15_47(%.loc15_54.2) [template = constants.%int_-1] -// CHECK:STDOUT: %.loc15_44.1: %i32 = value_of_initializer %int.usub.loc15 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc15_44.2: %i32 = converted %int.usub.loc15, %.loc15_44.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc15_55.1: %i32 = value_of_initializer %int.unegate.loc15_55 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc15_55.2: %i32 = converted %int.unegate.loc15_55, %.loc15_55.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.udiv.loc15: init %i32 = call %Div.ref.loc15(%.loc15_44.2, %.loc15_55.2) [template = constants.%int_0] -// CHECK:STDOUT: %.loc15_57.1: %i32 = value_of_initializer %int.udiv.loc15 [template = constants.%int_0] -// CHECK:STDOUT: %.loc15_57.2: %i32 = converted %int.udiv.loc15, %.loc15_57.1 [template = constants.%int_0] -// CHECK:STDOUT: %c: %i32 = bind_name c, %.loc15_57.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_div_by_zero.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Div.type.1: type = fn_type @Div.1 [template] -// CHECK:STDOUT: %Div: %Div.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Div = %Div.decl -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Div.decl: %Div.type.1 = fn_decl @Div.1 [template = constants.%Div] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_11: type = splice_block %i32.loc4_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc4_19: type = splice_block %i32.loc4_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Div.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.udiv"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Div.ref.loc10: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_0.loc10: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc10_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_18: = bound_method %int_1, %impl.elem0.loc10_18 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_18: = specific_function %Convert.bound.loc10_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_18: init %i32 = call %Convert.specific_fn.loc10_18(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_18.1: %i32 = value_of_initializer %int.convert_checked.loc10_18 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_18.2: %i32 = converted %int_1, %.loc10_18.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc10_21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_21: = bound_method %int_0.loc10, %impl.elem0.loc10_21 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc10_21: = specific_function %Convert.bound.loc10_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc10_21: init %i32 = call %Convert.specific_fn.loc10_21(%int_0.loc10) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc10_21.1: %i32 = value_of_initializer %int.convert_checked.loc10_21 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc10_21.2: %i32 = converted %int_0.loc10, %.loc10_21.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.udiv.loc10: init %i32 = call %Div.ref.loc10(%.loc10_18.2, %.loc10_21.2) [template = ] -// CHECK:STDOUT: %.loc10_23.1: %i32 = value_of_initializer %int.udiv.loc10 [template = ] -// CHECK:STDOUT: %.loc10_23.2: %i32 = converted %int.udiv.loc10, %.loc10_23.1 [template = ] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc10_23.2 -// CHECK:STDOUT: %Div.ref.loc15: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %int_0.loc15_18: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %int_0.loc15_21: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc15_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15_18: = bound_method %int_0.loc15_18, %impl.elem0.loc15_18 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc15_18: = specific_function %Convert.bound.loc15_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc15_18: init %i32 = call %Convert.specific_fn.loc15_18(%int_0.loc15_18) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc15_18.1: %i32 = value_of_initializer %int.convert_checked.loc15_18 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc15_18.2: %i32 = converted %int_0.loc15_18, %.loc15_18.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %impl.elem0.loc15_21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15_21: = bound_method %int_0.loc15_21, %impl.elem0.loc15_21 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc15_21: = specific_function %Convert.bound.loc15_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc15_21: init %i32 = call %Convert.specific_fn.loc15_21(%int_0.loc15_21) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc15_21.1: %i32 = value_of_initializer %int.convert_checked.loc15_21 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc15_21.2: %i32 = converted %int_0.loc15_21, %.loc15_21.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.udiv.loc15: init %i32 = call %Div.ref.loc15(%.loc15_18.2, %.loc15_21.2) [template = ] -// CHECK:STDOUT: %.loc15_23.1: %i32 = value_of_initializer %int.udiv.loc15 [template = ] -// CHECK:STDOUT: %.loc15_23.2: %i32 = converted %int.udiv.loc15, %.loc15_23.1 [template = ] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc15_23.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/umod.carbon b/toolchain/check/testdata/builtins/int/umod.carbon index 623a0c99ee172..dc6067eb2d641 100644 --- a/toolchain/check/testdata/builtins/int/umod.carbon +++ b/toolchain/check/testdata/builtins/int/umod.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/umod.carbon @@ -15,7 +17,7 @@ fn Mod(a: i32, b: i32) -> i32 = "int.umod"; var arr: [i32; Mod(5, 3)]; let arr_p: [i32; 2]* = &arr; -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return Mod(a, b); } @@ -54,449 +56,3 @@ let a: i32 = Mod(1, 0); // CHECK:STDERR: let b: i32 = Mod(0, 0); // CHECK:STDERR: ^~~~~~~~~ let b: i32 = Mod(0, 0); - -// CHECK:STDOUT: --- int_div.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Mod.type.1: type = fn_type @Mod.1 [template] -// CHECK:STDOUT: %Mod: %Mod.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_2.2: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_2.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Mod = %Mod.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Mod.decl: %Mod.type.1 = fn_decl @Mod.1 [template = constants.%Mod] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_11: type = splice_block %i32.loc2_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_19: type = splice_block %i32.loc2_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Mod.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.umod"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mod.ref: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.umod: init %i32 = call %Mod.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.umod -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int.umod, %.loc8_19.1 -// CHECK:STDOUT: return %.loc8_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- overflow.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Mod.type.1: type = fn_type @Mod.1 [template] -// CHECK:STDOUT: %Mod: %Mod.type.1 = struct_value () [template] -// CHECK:STDOUT: %Sub.type.1: type = fn_type @Sub.1 [template] -// CHECK:STDOUT: %Sub: %Sub.type.1 = struct_value () [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_2147483647.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %int_-2147483647: %i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] -// CHECK:STDOUT: %int_0: %i32 = int_value 0 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Mod = %Mod.decl -// CHECK:STDOUT: .Sub = %Sub.decl -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: .c = @__global_init.%c -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Mod.decl: %Mod.type.1 = fn_decl @Mod.1 [template = constants.%Mod] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_11: type = splice_block %i32.loc4_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc4_19: type = splice_block %i32.loc4_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.decl: %Sub.type.1 = fn_decl @Sub.1 [template = constants.%Sub] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc5_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc5_11: type = splice_block %i32.loc5_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc5_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc5_19: type = splice_block %i32.loc5_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc5_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc6_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc6: type = splice_block %i32.loc6_14 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc6_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Mod.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.umod"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Sub.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.usub"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.unegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mod.ref.loc9: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %Negate.ref.loc9_18: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc9: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc9_25: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_25: = bound_method %int_2147483647.loc9, %impl.elem0.loc9_25 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_25: = specific_function %Convert.bound.loc9_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_25: init %i32 = call %Convert.specific_fn.loc9_25(%int_2147483647.loc9) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc9_25.1: %i32 = value_of_initializer %int.convert_checked.loc9_25 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc9_25.2: %i32 = converted %int_2147483647.loc9, %.loc9_25.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.unegate.loc9_36: init %i32 = call %Negate.ref.loc9_18(%.loc9_25.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %Negate.ref.loc9_39: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc9_46: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_46: = bound_method %int_1.loc9, %impl.elem0.loc9_46 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_46: = specific_function %Convert.bound.loc9_46, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_46: init %i32 = call %Convert.specific_fn.loc9_46(%int_1.loc9) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_46.1: %i32 = value_of_initializer %int.convert_checked.loc9_46 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_46.2: %i32 = converted %int_1.loc9, %.loc9_46.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.unegate.loc9_47: init %i32 = call %Negate.ref.loc9_39(%.loc9_46.2) [template = constants.%int_-1] -// CHECK:STDOUT: %.loc9_36.1: %i32 = value_of_initializer %int.unegate.loc9_36 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc9_36.2: %i32 = converted %int.unegate.loc9_36, %.loc9_36.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc9_47.1: %i32 = value_of_initializer %int.unegate.loc9_47 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc9_47.2: %i32 = converted %int.unegate.loc9_47, %.loc9_47.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.umod.loc9: init %i32 = call %Mod.ref.loc9(%.loc9_36.2, %.loc9_47.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc9_49.1: %i32 = value_of_initializer %int.umod.loc9 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc9_49.2: %i32 = converted %int.umod.loc9, %.loc9_49.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc9_49.2 -// CHECK:STDOUT: %Mod.ref.loc12: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %Sub.ref.loc12: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Negate.ref.loc12: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc12: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc12_29: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_29: = bound_method %int_2147483647.loc12, %impl.elem0.loc12_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc12_29: = specific_function %Convert.bound.loc12_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc12_29: init %i32 = call %Convert.specific_fn.loc12_29(%int_2147483647.loc12) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc12_29.1: %i32 = value_of_initializer %int.convert_checked.loc12_29 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc12_29.2: %i32 = converted %int_2147483647.loc12, %.loc12_29.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.unegate.loc12: init %i32 = call %Negate.ref.loc12(%.loc12_29.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1.loc12_43: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc12_40.1: %i32 = value_of_initializer %int.unegate.loc12 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc12_40.2: %i32 = converted %int.unegate.loc12, %.loc12_40.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc12_43: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_43: = bound_method %int_1.loc12_43, %impl.elem0.loc12_43 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc12_43: = specific_function %Convert.bound.loc12_43, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc12_43: init %i32 = call %Convert.specific_fn.loc12_43(%int_1.loc12_43) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_43.1: %i32 = value_of_initializer %int.convert_checked.loc12_43 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_43.2: %i32 = converted %int_1.loc12_43, %.loc12_43.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.usub.loc12: init %i32 = call %Sub.ref.loc12(%.loc12_40.2, %.loc12_43.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %int_1.loc12_47: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc12_44.1: %i32 = value_of_initializer %int.usub.loc12 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc12_44.2: %i32 = converted %int.usub.loc12, %.loc12_44.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %impl.elem0.loc12_47: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_47: = bound_method %int_1.loc12_47, %impl.elem0.loc12_47 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc12_47: = specific_function %Convert.bound.loc12_47, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc12_47: init %i32 = call %Convert.specific_fn.loc12_47(%int_1.loc12_47) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_47.1: %i32 = value_of_initializer %int.convert_checked.loc12_47 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_47.2: %i32 = converted %int_1.loc12_47, %.loc12_47.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.umod.loc12: init %i32 = call %Mod.ref.loc12(%.loc12_44.2, %.loc12_47.2) [template = constants.%int_0] -// CHECK:STDOUT: %.loc12_49.1: %i32 = value_of_initializer %int.umod.loc12 [template = constants.%int_0] -// CHECK:STDOUT: %.loc12_49.2: %i32 = converted %int.umod.loc12, %.loc12_49.1 [template = constants.%int_0] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc12_49.2 -// CHECK:STDOUT: %Mod.ref.loc15: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %Sub.ref.loc15: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Negate.ref.loc15_22: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc15: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc15_29: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15_29: = bound_method %int_2147483647.loc15, %impl.elem0.loc15_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc15_29: = specific_function %Convert.bound.loc15_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc15_29: init %i32 = call %Convert.specific_fn.loc15_29(%int_2147483647.loc15) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc15_29.1: %i32 = value_of_initializer %int.convert_checked.loc15_29 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc15_29.2: %i32 = converted %int_2147483647.loc15, %.loc15_29.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.unegate.loc15_40: init %i32 = call %Negate.ref.loc15_22(%.loc15_29.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1.loc15_43: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc15_40.1: %i32 = value_of_initializer %int.unegate.loc15_40 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc15_40.2: %i32 = converted %int.unegate.loc15_40, %.loc15_40.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc15_43: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15_43: = bound_method %int_1.loc15_43, %impl.elem0.loc15_43 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc15_43: = specific_function %Convert.bound.loc15_43, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc15_43: init %i32 = call %Convert.specific_fn.loc15_43(%int_1.loc15_43) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc15_43.1: %i32 = value_of_initializer %int.convert_checked.loc15_43 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc15_43.2: %i32 = converted %int_1.loc15_43, %.loc15_43.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.usub.loc15: init %i32 = call %Sub.ref.loc15(%.loc15_40.2, %.loc15_43.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %Negate.ref.loc15_47: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc15_54: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc15_54: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15_54: = bound_method %int_1.loc15_54, %impl.elem0.loc15_54 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc15_54: = specific_function %Convert.bound.loc15_54, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc15_54: init %i32 = call %Convert.specific_fn.loc15_54(%int_1.loc15_54) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc15_54.1: %i32 = value_of_initializer %int.convert_checked.loc15_54 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc15_54.2: %i32 = converted %int_1.loc15_54, %.loc15_54.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.unegate.loc15_55: init %i32 = call %Negate.ref.loc15_47(%.loc15_54.2) [template = constants.%int_-1] -// CHECK:STDOUT: %.loc15_44.1: %i32 = value_of_initializer %int.usub.loc15 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc15_44.2: %i32 = converted %int.usub.loc15, %.loc15_44.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc15_55.1: %i32 = value_of_initializer %int.unegate.loc15_55 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc15_55.2: %i32 = converted %int.unegate.loc15_55, %.loc15_55.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.umod.loc15: init %i32 = call %Mod.ref.loc15(%.loc15_44.2, %.loc15_55.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc15_57.1: %i32 = value_of_initializer %int.umod.loc15 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc15_57.2: %i32 = converted %int.umod.loc15, %.loc15_57.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %c: %i32 = bind_name c, %.loc15_57.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_div_by_zero.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Mod.type.1: type = fn_type @Mod.1 [template] -// CHECK:STDOUT: %Mod: %Mod.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Mod = %Mod.decl -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Mod.decl: %Mod.type.1 = fn_decl @Mod.1 [template = constants.%Mod] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_11: type = splice_block %i32.loc4_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc4_19: type = splice_block %i32.loc4_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Mod.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.umod"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mod.ref.loc12: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_0.loc12: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc12_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_18: = bound_method %int_1, %impl.elem0.loc12_18 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc12_18: = specific_function %Convert.bound.loc12_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc12_18: init %i32 = call %Convert.specific_fn.loc12_18(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_18.1: %i32 = value_of_initializer %int.convert_checked.loc12_18 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_18.2: %i32 = converted %int_1, %.loc12_18.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc12_21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_21: = bound_method %int_0.loc12, %impl.elem0.loc12_21 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc12_21: = specific_function %Convert.bound.loc12_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc12_21: init %i32 = call %Convert.specific_fn.loc12_21(%int_0.loc12) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc12_21.1: %i32 = value_of_initializer %int.convert_checked.loc12_21 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc12_21.2: %i32 = converted %int_0.loc12, %.loc12_21.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.umod.loc12: init %i32 = call %Mod.ref.loc12(%.loc12_18.2, %.loc12_21.2) [template = ] -// CHECK:STDOUT: %.loc12_23.1: %i32 = value_of_initializer %int.umod.loc12 [template = ] -// CHECK:STDOUT: %.loc12_23.2: %i32 = converted %int.umod.loc12, %.loc12_23.1 [template = ] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc12_23.2 -// CHECK:STDOUT: %Mod.ref.loc17: %Mod.type.1 = name_ref Mod, file.%Mod.decl [template = constants.%Mod] -// CHECK:STDOUT: %int_0.loc17_18: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %int_0.loc17_21: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc17_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc17_18: = bound_method %int_0.loc17_18, %impl.elem0.loc17_18 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc17_18: = specific_function %Convert.bound.loc17_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc17_18: init %i32 = call %Convert.specific_fn.loc17_18(%int_0.loc17_18) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc17_18.1: %i32 = value_of_initializer %int.convert_checked.loc17_18 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc17_18.2: %i32 = converted %int_0.loc17_18, %.loc17_18.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %impl.elem0.loc17_21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc17_21: = bound_method %int_0.loc17_21, %impl.elem0.loc17_21 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc17_21: = specific_function %Convert.bound.loc17_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc17_21: init %i32 = call %Convert.specific_fn.loc17_21(%int_0.loc17_21) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc17_21.1: %i32 = value_of_initializer %int.convert_checked.loc17_21 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc17_21.2: %i32 = converted %int_0.loc17_21, %.loc17_21.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.umod.loc17: init %i32 = call %Mod.ref.loc17(%.loc17_18.2, %.loc17_21.2) [template = ] -// CHECK:STDOUT: %.loc17_23.1: %i32 = value_of_initializer %int.umod.loc17 [template = ] -// CHECK:STDOUT: %.loc17_23.2: %i32 = converted %int.umod.loc17, %.loc17_23.1 [template = ] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc17_23.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/umul.carbon b/toolchain/check/testdata/builtins/int/umul.carbon index 3446d1bae5ebd..40d89a11cd87f 100644 --- a/toolchain/check/testdata/builtins/int/umul.carbon +++ b/toolchain/check/testdata/builtins/int/umul.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/umul.carbon @@ -15,7 +17,7 @@ fn Mul(a: i32, b: i32) -> i32 = "int.umul"; var arr: [i32; Mul(3, 2)]; let arr_p: [i32; 6]* = &arr; -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return Mul(a, b); } @@ -27,227 +29,3 @@ fn Mul(a: i32, b: i32) -> i32 = "int.umul"; let a: i32 = Mul(0x7FFF, 0x10000); let b: i32 = Mul(0x8000, 0x10000); - -// CHECK:STDOUT: --- int_mul.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Mul.type.1: type = fn_type @Mul.1 [template] -// CHECK:STDOUT: %Mul: %Mul.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_6.2: Core.IntLiteral = int_value 6 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_6.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Mul = %Mul.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Mul.decl: %Mul.type.1 = fn_decl @Mul.1 [template = constants.%Mul] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_11: type = splice_block %i32.loc2_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_19: type = splice_block %i32.loc2_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Mul.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.umul"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mul.ref: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.umul: init %i32 = call %Mul.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.umul -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int.umul, %.loc8_19.1 -// CHECK:STDOUT: return %.loc8_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- overflow.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Mul.type.1: type = fn_type @Mul.1 [template] -// CHECK:STDOUT: %Mul: %Mul.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_32767.1: Core.IntLiteral = int_value 32767 [template] -// CHECK:STDOUT: %int_65536.1: Core.IntLiteral = int_value 65536 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_32767.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_32767.2: %i32 = int_value 32767 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_65536.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_65536.2: %i32 = int_value 65536 [template] -// CHECK:STDOUT: %int_2147418112: %i32 = int_value 2147418112 [template] -// CHECK:STDOUT: %int_32768.1: Core.IntLiteral = int_value 32768 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_32768.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_32768.2: %i32 = int_value 32768 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Mul = %Mul.decl -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Mul.decl: %Mul.type.1 = fn_decl @Mul.1 [template = constants.%Mul] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_11: type = splice_block %i32.loc4_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc4_19: type = splice_block %i32.loc4_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Mul.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.umul"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mul.ref.loc6: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] -// CHECK:STDOUT: %int_32767: Core.IntLiteral = int_value 32767 [template = constants.%int_32767.1] -// CHECK:STDOUT: %int_65536.loc6: Core.IntLiteral = int_value 65536 [template = constants.%int_65536.1] -// CHECK:STDOUT: %impl.elem0.loc6_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc6_18: = bound_method %int_32767, %impl.elem0.loc6_18 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc6_18: = specific_function %Convert.bound.loc6_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc6_18: init %i32 = call %Convert.specific_fn.loc6_18(%int_32767) [template = constants.%int_32767.2] -// CHECK:STDOUT: %.loc6_18.1: %i32 = value_of_initializer %int.convert_checked.loc6_18 [template = constants.%int_32767.2] -// CHECK:STDOUT: %.loc6_18.2: %i32 = converted %int_32767, %.loc6_18.1 [template = constants.%int_32767.2] -// CHECK:STDOUT: %impl.elem0.loc6_26: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc6_26: = bound_method %int_65536.loc6, %impl.elem0.loc6_26 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc6_26: = specific_function %Convert.bound.loc6_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc6_26: init %i32 = call %Convert.specific_fn.loc6_26(%int_65536.loc6) [template = constants.%int_65536.2] -// CHECK:STDOUT: %.loc6_26.1: %i32 = value_of_initializer %int.convert_checked.loc6_26 [template = constants.%int_65536.2] -// CHECK:STDOUT: %.loc6_26.2: %i32 = converted %int_65536.loc6, %.loc6_26.1 [template = constants.%int_65536.2] -// CHECK:STDOUT: %int.umul.loc6: init %i32 = call %Mul.ref.loc6(%.loc6_18.2, %.loc6_26.2) [template = constants.%int_2147418112] -// CHECK:STDOUT: %.loc6_34.1: %i32 = value_of_initializer %int.umul.loc6 [template = constants.%int_2147418112] -// CHECK:STDOUT: %.loc6_34.2: %i32 = converted %int.umul.loc6, %.loc6_34.1 [template = constants.%int_2147418112] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc6_34.2 -// CHECK:STDOUT: %Mul.ref.loc7: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] -// CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [template = constants.%int_32768.1] -// CHECK:STDOUT: %int_65536.loc7: Core.IntLiteral = int_value 65536 [template = constants.%int_65536.1] -// CHECK:STDOUT: %impl.elem0.loc7_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc7_18: = bound_method %int_32768, %impl.elem0.loc7_18 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc7_18: = specific_function %Convert.bound.loc7_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc7_18: init %i32 = call %Convert.specific_fn.loc7_18(%int_32768) [template = constants.%int_32768.2] -// CHECK:STDOUT: %.loc7_18.1: %i32 = value_of_initializer %int.convert_checked.loc7_18 [template = constants.%int_32768.2] -// CHECK:STDOUT: %.loc7_18.2: %i32 = converted %int_32768, %.loc7_18.1 [template = constants.%int_32768.2] -// CHECK:STDOUT: %impl.elem0.loc7_26: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc7_26: = bound_method %int_65536.loc7, %impl.elem0.loc7_26 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc7_26: = specific_function %Convert.bound.loc7_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc7_26: init %i32 = call %Convert.specific_fn.loc7_26(%int_65536.loc7) [template = constants.%int_65536.2] -// CHECK:STDOUT: %.loc7_26.1: %i32 = value_of_initializer %int.convert_checked.loc7_26 [template = constants.%int_65536.2] -// CHECK:STDOUT: %.loc7_26.2: %i32 = converted %int_65536.loc7, %.loc7_26.1 [template = constants.%int_65536.2] -// CHECK:STDOUT: %int.umul.loc7: init %i32 = call %Mul.ref.loc7(%.loc7_18.2, %.loc7_26.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc7_34.1: %i32 = value_of_initializer %int.umul.loc7 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc7_34.2: %i32 = converted %int.umul.loc7, %.loc7_34.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc7_34.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/unegate.carbon b/toolchain/check/testdata/builtins/int/unegate.carbon index 2575e374f3657..0bbd88372f7d4 100644 --- a/toolchain/check/testdata/builtins/int/unegate.carbon +++ b/toolchain/check/testdata/builtins/int/unegate.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/unegate.carbon @@ -17,7 +19,7 @@ let arr_p: [u32; 123]* = &arr; let n: u32 = Negate(1); -fn RuntimeCall(a: u32, b: u32) -> u32 { +fn RuntimeCallIsValid(a: u32, b: u32) -> u32 { return Negate(a); } @@ -67,7 +69,7 @@ var bad_return_type: [u32; BadReturnType(1)]; // CHECK:STDERR: var bad_call: [u32; JustRight(1, 2)]; -fn RuntimeCallTooFew(a: u32) -> u32 { +fn RuntimeCallIsValidTooFew(a: u32) -> u32 { // 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: ^~~~~~~~~ @@ -78,7 +80,7 @@ fn RuntimeCallTooFew(a: u32) -> u32 { return TooFew(a); } -fn RuntimeCallTooMany(a: u32, b: u32, c: u32) -> u32 { +fn RuntimeCallIsValidTooMany(a: u32, b: u32, c: u32) -> u32 { // 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: ^~~~~~~~~~~~~~~~ @@ -89,7 +91,7 @@ fn RuntimeCallTooMany(a: u32, b: u32, c: u32) -> u32 { return TooMany(a, b, c); } -fn RuntimeCallBadReturnType(a: u32, b: u32) -> bool { +fn RuntimeCallIsValidBadReturnType(a: u32, b: u32) -> bool { // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+6]]:10: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch] // CHECK:STDERR: return BadReturnType(a, b); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ @@ -116,687 +118,3 @@ fn F() { Test(Negate(Negate(0x8000_0000))) as Expect(0x8000_0000); Test(-(Negate(0x8000_0000))) as Expect(0x8000_0000); } - - -// CHECK:STDOUT: --- int_negate.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_123.1: Core.IntLiteral = int_value 123 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%u32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %array_type: type = array_type %int_123.1, %u32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %u32 = int_value 1 [template] -// CHECK:STDOUT: %int_4294967295: %u32 = int_value 4294967295 [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .UInt = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .n = @__global_init.%n -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc2_22: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2: type = splice_block %u32.loc2_14 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc2_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc2_14: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %u32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %u32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc9_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc9_35: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc9_19: type = splice_block %u32.loc9_19 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc9_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc9_19: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %u32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc9_27: type = splice_block %u32.loc9_27 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc9_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc9_27: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %u32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %u32) -> %u32 = "int.unegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %u32, %b.param_patt: %u32) -> %u32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Negate.ref: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %a.ref: %u32 = name_ref a, %a -// CHECK:STDOUT: %int.unegate: init %u32 = call %Negate.ref(%a.ref) -// CHECK:STDOUT: %.loc10_19.1: %u32 = value_of_initializer %int.unegate -// CHECK:STDOUT: %.loc10_19.2: %u32 = converted %int.unegate, %.loc10_19.1 -// CHECK:STDOUT: return %.loc10_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: %Negate.ref: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_1, %impl.elem0 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked: init %u32 = call %Convert.specific_fn(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc7_21.1: %u32 = value_of_initializer %int.convert_checked [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc7_21.2: %u32 = converted %int_1, %.loc7_21.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.unegate: init %u32 = call %Negate.ref(%.loc7_21.2) [template = constants.%int_4294967295] -// CHECK:STDOUT: %.loc7_23.1: %u32 = value_of_initializer %int.unegate [template = constants.%int_4294967295] -// CHECK:STDOUT: %.loc7_23.2: %u32 = converted %int.unegate, %.loc7_23.1 [template = constants.%int_4294967295] -// CHECK:STDOUT: %n: %u32 = bind_name n, %.loc7_23.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_bad_decl.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [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: %RuntimeCallTooFew.type: type = fn_type @RuntimeCallTooFew [template] -// CHECK:STDOUT: %RuntimeCallTooFew: %RuntimeCallTooFew.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallTooMany.type: type = fn_type @RuntimeCallTooMany [template] -// CHECK:STDOUT: %RuntimeCallTooMany: %RuntimeCallTooMany.type = struct_value () [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType.type: type = fn_type @RuntimeCallBadReturnType [template] -// CHECK:STDOUT: %RuntimeCallBadReturnType: %RuntimeCallBadReturnType.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .UInt = %import_ref.1 -// CHECK:STDOUT: .Bool = %import_ref.5 -// CHECK:STDOUT: .ImplicitAs = %import_ref.6 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = 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: .too_few = %too_few -// CHECK:STDOUT: .too_many = %too_many -// CHECK:STDOUT: .bad_return_type = %bad_return_type -// CHECK:STDOUT: .bad_call = %bad_call -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.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: %u32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param0 -// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany.decl: %TooMany.type = fn_decl @TooMany [template = constants.%TooMany] { -// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %u32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %u32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc13_31: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc13_31: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc13_15: type = splice_block %u32.loc13_15 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc13_15: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc13_15: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %u32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc13_23: type = splice_block %u32.loc13_23 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc13_23: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc13_23: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %u32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType.decl: %BadReturnType.type = fn_decl @BadReturnType [template = constants.%BadReturnType] { -// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = 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: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc18_21: type = splice_block %u32 [template = constants.%u32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = 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: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc19_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc19_25: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc19: type = splice_block %u32.loc19_17 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc19_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc19_17: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %too_few.var: ref = var too_few -// CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var -// CHECK:STDOUT: %too_many.var: ref = var too_many -// CHECK:STDOUT: %too_many: ref = bind_name too_many, %too_many.var -// CHECK:STDOUT: %bad_return_type.var: ref = var bad_return_type -// CHECK:STDOUT: %bad_return_type: ref = bind_name bad_return_type, %bad_return_type.var -// CHECK:STDOUT: %bad_call.var: ref = var bad_call -// CHECK:STDOUT: %bad_call: ref = bind_name bad_call, %bad_call.var -// CHECK:STDOUT: %RuntimeCallTooFew.decl: %RuntimeCallTooFew.type = fn_decl @RuntimeCallTooFew [template = constants.%RuntimeCallTooFew] { -// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc46_33: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc46_33: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc46: type = splice_block %u32.loc46_25 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc46_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc46_25: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany.decl: %RuntimeCallTooMany.type = fn_decl @RuntimeCallTooMany [template = constants.%RuntimeCallTooMany] { -// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %u32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %u32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %c.patt: %u32 = binding_pattern c -// CHECK:STDOUT: %c.param_patt: %u32 = value_param_pattern %c.patt, runtime_param2 -// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param3 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc57_50: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc57_50: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc57_26: type = splice_block %u32.loc57_26 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc57_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc57_26: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %u32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc57_34: type = splice_block %u32.loc57_34 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc57_34: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc57_34: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %u32 = bind_name b, %b.param -// CHECK:STDOUT: %c.param: %u32 = value_param runtime_param2 -// CHECK:STDOUT: %.loc57_42: type = splice_block %u32.loc57_42 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc57_42: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc57_42: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %c: %u32 = bind_name c, %c.param -// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param3 -// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: %RuntimeCallBadReturnType.type = fn_decl @RuntimeCallBadReturnType [template = constants.%RuntimeCallBadReturnType] { -// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %u32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %u32 = 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: %.loc68_48.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc68_48.2: type = converted %bool.make_type, %.loc68_48.1 [template = bool] -// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc68_32: type = splice_block %u32.loc68_32 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc68_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc68_32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %u32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc68_40: type = splice_block %u32.loc68_40 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc68_40: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc68_40: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %u32 = 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() -> %u32; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @TooMany(%a.param_patt: %u32, %b.param_patt: %u32) -> %u32; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @BadReturnType(%a.param_patt: %u32) -> bool; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @JustRight(%a.param_patt: %u32) -> %u32 = "int.unegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooFew(%a.param_patt: %u32) -> %u32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: %TooFew.type = name_ref TooFew, file.%TooFew.decl [template = constants.%TooFew] -// CHECK:STDOUT: %a.ref: %u32 = name_ref a, %a -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallTooMany(%a.param_patt: %u32, %b.param_patt: %u32, %c.param_patt: %u32) -> %u32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: %TooMany.type = name_ref TooMany, file.%TooMany.decl [template = constants.%TooMany] -// CHECK:STDOUT: %a.ref: %u32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %u32 = name_ref b, %b -// CHECK:STDOUT: %c.ref: %u32 = name_ref c, %c -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a.param_patt: %u32, %b.param_patt: %u32) -> bool { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: %BadReturnType.type = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%BadReturnType] -// CHECK:STDOUT: %a.ref: %u32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %u32 = name_ref b, %b -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- overflow.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %N.2: %u32 = bind_symbolic_name N, 0 [symbolic] -// CHECK:STDOUT: %N.patt.2: %u32 = symbolic_binding_pattern N, 0 [symbolic] -// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] -// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] -// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N.2) [symbolic] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] -// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] -// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] -// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] -// CHECK:STDOUT: %require_complete.2: = require_complete_type %Expect.1 [symbolic] -// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] -// CHECK:STDOUT: %F.type: type = fn_type @F [template] -// CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%u32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_2147483647.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %u32 = int_value 2147483647 [template] -// CHECK:STDOUT: %int_2147483649: %u32 = int_value 2147483649 [template] -// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_2147483647.2) [template] -// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%int_2147483647.2) [template] -// CHECK:STDOUT: %Op.type.13: type = fn_type @Op.13 [template] -// CHECK:STDOUT: %Op.type.14: type = fn_type @Op.5, @impl.11(%int_32) [template] -// CHECK:STDOUT: %Op.14: %Op.type.14 = struct_value () [template] -// CHECK:STDOUT: %interface.20: = interface_witness (%Op.14) [template] -// CHECK:STDOUT: %Op.bound.1: = bound_method %int_2147483649, %Op.14 [template] -// CHECK:STDOUT: %Op.specific_fn.1: = specific_function %Op.bound.1, @Op.5(%int_32) [template] -// CHECK:STDOUT: %int_2147483648.1: Core.IntLiteral = int_value 2147483648 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2147483648.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483648.2: %u32 = int_value 2147483648 [template] -// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_2147483648.2) [template] -// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%int_2147483648.2) [template] -// CHECK:STDOUT: %Op.bound.2: = bound_method %int_2147483648.2, %Op.14 [template] -// CHECK:STDOUT: %Op.specific_fn.2: = specific_function %Op.bound.2, @Op.5(%int_32) [template] -// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] -// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .UInt = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Negate = %import_ref.193 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .Expect = %Expect.decl -// CHECK:STDOUT: .Test = %Test.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc4_22: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4: type = splice_block %u32.loc4_14 [template = constants.%u32] { -// CHECK:STDOUT: %int_32.loc4_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32.loc4_14: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { -// CHECK:STDOUT: %N.patt.loc6_14.1: %u32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.2)] -// CHECK:STDOUT: %N.param_patt: %u32 = value_param_pattern %N.patt.loc6_14.1, runtime_param [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.2)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %N.param: %u32 = value_param runtime_param -// CHECK:STDOUT: %.loc6: type = splice_block %u32 [template = constants.%u32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %N.loc6_14.1: %u32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_14.2 (constants.%N.2)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { -// CHECK:STDOUT: %N.patt.loc7_9.1: %u32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt.2)] -// CHECK:STDOUT: %N.param_patt: %u32 = value_param_pattern %N.patt.loc7_9.1, runtime_param [symbolic = %N.patt.loc7_9.2 (constants.%N.patt.2)] -// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_29.2 (%Expect.1) = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_29.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] -// CHECK:STDOUT: %N.ref: %u32 = name_ref N, %N.loc7_9.1 [symbolic = %N.loc7_9.2 (constants.%N.2)] -// CHECK:STDOUT: %Expect.loc7_29.1: type = class_type @Expect, @Expect(constants.%N.2) [symbolic = %Expect.loc7_29.2 (constants.%Expect.1)] -// CHECK:STDOUT: %N.param: %u32 = value_param runtime_param -// CHECK:STDOUT: %.loc7_13: type = splice_block %u32 [template = constants.%u32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %N.loc7_9.1: %u32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc7_9.2 (constants.%N.2)] -// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_29.2 (%Expect.1) = out_param runtime_param0 -// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_29.2 (%Expect.1) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic class @Expect(%N.loc6_14.1: %u32) { -// CHECK:STDOUT: %N.loc6_14.2: %u32 = bind_symbolic_name N, 0 [symbolic = %N.loc6_14.2 (constants.%N.2)] -// CHECK:STDOUT: %N.patt.loc6_14.2: %u32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.2)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: class { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Expect.1 -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %u32) -> %u32 = "int.unegate"; -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Test(%N.loc7_9.1: %u32) { -// CHECK:STDOUT: %N.loc7_9.2: %u32 = bind_symbolic_name N, 0 [symbolic = %N.loc7_9.2 (constants.%N.2)] -// CHECK:STDOUT: %N.patt.loc7_9.2: %u32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt.2)] -// CHECK:STDOUT: %Expect.loc7_29.2: type = class_type @Expect, @Expect(%N.loc7_9.2) [symbolic = %Expect.loc7_29.2 (constants.%Expect.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_29.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete.2)] -// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_29.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%N.param_patt: %u32) -> %return.param_patt: @Test.%Expect.loc7_29.2 (%Expect.1) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_41.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc7_41.2: init @Test.%Expect.loc7_29.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] -// CHECK:STDOUT: %.loc7_42: init @Test.%Expect.loc7_29.2 (%Expect.1) = converted %.loc7_41.1, %.loc7_41.2 [symbolic = %Expect.val (constants.%Expect.val.1)] -// CHECK:STDOUT: return %.loc7_42 to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] -// CHECK:STDOUT: %Negate.ref.loc11_8: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %Negate.ref.loc11_15: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc11_22: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc11_22: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_22: = bound_method %int_2147483647.loc11_22, %impl.elem0.loc11_22 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc11_22: = specific_function %Convert.bound.loc11_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc11_22: init %u32 = call %Convert.specific_fn.loc11_22(%int_2147483647.loc11_22) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc11_22.1: %u32 = value_of_initializer %int.convert_checked.loc11_22 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc11_22.2: %u32 = converted %int_2147483647.loc11_22, %.loc11_22.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.unegate.loc11_33: init %u32 = call %Negate.ref.loc11_15(%.loc11_22.2) [template = constants.%int_2147483649] -// CHECK:STDOUT: %.loc11_33.1: %u32 = value_of_initializer %int.unegate.loc11_33 [template = constants.%int_2147483649] -// CHECK:STDOUT: %.loc11_33.2: %u32 = converted %int.unegate.loc11_33, %.loc11_33.1 [template = constants.%int_2147483649] -// CHECK:STDOUT: %int.unegate.loc11_34: init %u32 = call %Negate.ref.loc11_8(%.loc11_33.2) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc11_35.1: %u32 = value_of_initializer %int.unegate.loc11_34 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc11_35.2: %u32 = converted %int.unegate.loc11_34, %.loc11_35.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%int_2147483647.2) [template = constants.%Test.specific_fn.1] -// CHECK:STDOUT: %.loc11_35.3: ref %Expect.2 = temporary_storage -// CHECK:STDOUT: %Test.call.loc11: init %Expect.2 = call %Test.specific_fn.loc11() to %.loc11_35.3 -// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] -// CHECK:STDOUT: %int_2147483647.loc11_47: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc11_58: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_58: = bound_method %int_2147483647.loc11_47, %impl.elem0.loc11_58 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc11_58: = specific_function %Convert.bound.loc11_58, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc11_58: init %u32 = call %Convert.specific_fn.loc11_58(%int_2147483647.loc11_47) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc11_58.1: %u32 = value_of_initializer %int.convert_checked.loc11_58 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc11_58.2: %u32 = converted %int_2147483647.loc11_47, %.loc11_58.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%int_2147483647.2) [template = constants.%Expect.2] -// CHECK:STDOUT: %.loc11_35.4: ref %Expect.2 = temporary %.loc11_35.3, %Test.call.loc11 -// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] -// CHECK:STDOUT: %Negate.ref.loc12: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc12_17: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc12_17: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_17: = bound_method %int_2147483647.loc12_17, %impl.elem0.loc12_17 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc12_17: = specific_function %Convert.bound.loc12_17, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc12_17: init %u32 = call %Convert.specific_fn.loc12_17(%int_2147483647.loc12_17) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc12_17.1: %u32 = value_of_initializer %int.convert_checked.loc12_17 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc12_17.2: %u32 = converted %int_2147483647.loc12_17, %.loc12_17.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.unegate.loc12_28: init %u32 = call %Negate.ref.loc12(%.loc12_17.2) [template = constants.%int_2147483649] -// CHECK:STDOUT: %impl.elem0.loc12_8: %Op.type.13 = interface_witness_access constants.%interface.20, element0 [template = constants.%Op.14] -// CHECK:STDOUT: %Op.bound.loc12: = bound_method %int.unegate.loc12_28, %impl.elem0.loc12_8 [template = constants.%Op.bound.1] -// CHECK:STDOUT: %Op.specific_fn.loc12: = specific_function %Op.bound.loc12, @Op.5(constants.%int_32) [template = constants.%Op.specific_fn.1] -// CHECK:STDOUT: %.loc12_28.1: %u32 = value_of_initializer %int.unegate.loc12_28 [template = constants.%int_2147483649] -// CHECK:STDOUT: %.loc12_28.2: %u32 = converted %int.unegate.loc12_28, %.loc12_28.1 [template = constants.%int_2147483649] -// CHECK:STDOUT: %int.unegate.loc12_8: init %u32 = call %Op.specific_fn.loc12(%.loc12_28.2) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc12_30.1: %u32 = value_of_initializer %int.unegate.loc12_8 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc12_30.2: %u32 = converted %int.unegate.loc12_8, %.loc12_30.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%int_2147483647.2) [template = constants.%Test.specific_fn.1] -// CHECK:STDOUT: %.loc12_30.3: ref %Expect.2 = temporary_storage -// CHECK:STDOUT: %Test.call.loc12: init %Expect.2 = call %Test.specific_fn.loc12() to %.loc12_30.3 -// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] -// CHECK:STDOUT: %int_2147483647.loc12_42: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc12_53: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_53: = bound_method %int_2147483647.loc12_42, %impl.elem0.loc12_53 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc12_53: = specific_function %Convert.bound.loc12_53, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc12_53: init %u32 = call %Convert.specific_fn.loc12_53(%int_2147483647.loc12_42) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc12_53.1: %u32 = value_of_initializer %int.convert_checked.loc12_53 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc12_53.2: %u32 = converted %int_2147483647.loc12_42, %.loc12_53.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%int_2147483647.2) [template = constants.%Expect.2] -// CHECK:STDOUT: %.loc12_30.4: ref %Expect.2 = temporary %.loc12_30.3, %Test.call.loc12 -// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] -// CHECK:STDOUT: %Negate.ref.loc14_8: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %Negate.ref.loc14_15: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483648.loc14_22: Core.IntLiteral = int_value 2147483648 [template = constants.%int_2147483648.1] -// CHECK:STDOUT: %impl.elem0.loc14_22: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc14_22: = bound_method %int_2147483648.loc14_22, %impl.elem0.loc14_22 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc14_22: = specific_function %Convert.bound.loc14_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc14_22: init %u32 = call %Convert.specific_fn.loc14_22(%int_2147483648.loc14_22) [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc14_22.1: %u32 = value_of_initializer %int.convert_checked.loc14_22 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc14_22.2: %u32 = converted %int_2147483648.loc14_22, %.loc14_22.1 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %int.unegate.loc14_33: init %u32 = call %Negate.ref.loc14_15(%.loc14_22.2) [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc14_33.1: %u32 = value_of_initializer %int.unegate.loc14_33 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc14_33.2: %u32 = converted %int.unegate.loc14_33, %.loc14_33.1 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %int.unegate.loc14_34: init %u32 = call %Negate.ref.loc14_8(%.loc14_33.2) [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc14_35.1: %u32 = value_of_initializer %int.unegate.loc14_34 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc14_35.2: %u32 = converted %int.unegate.loc14_34, %.loc14_35.1 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%int_2147483648.2) [template = constants.%Test.specific_fn.2] -// CHECK:STDOUT: %.loc14_35.3: ref %Expect.3 = temporary_storage -// CHECK:STDOUT: %Test.call.loc14: init %Expect.3 = call %Test.specific_fn.loc14() to %.loc14_35.3 -// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] -// CHECK:STDOUT: %int_2147483648.loc14_47: Core.IntLiteral = int_value 2147483648 [template = constants.%int_2147483648.1] -// CHECK:STDOUT: %impl.elem0.loc14_58: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc14_58: = bound_method %int_2147483648.loc14_47, %impl.elem0.loc14_58 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc14_58: = specific_function %Convert.bound.loc14_58, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc14_58: init %u32 = call %Convert.specific_fn.loc14_58(%int_2147483648.loc14_47) [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc14_58.1: %u32 = value_of_initializer %int.convert_checked.loc14_58 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc14_58.2: %u32 = converted %int_2147483648.loc14_47, %.loc14_58.1 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%int_2147483648.2) [template = constants.%Expect.3] -// CHECK:STDOUT: %.loc14_35.4: ref %Expect.3 = temporary %.loc14_35.3, %Test.call.loc14 -// CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] -// CHECK:STDOUT: %Negate.ref.loc15: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483648.loc15_17: Core.IntLiteral = int_value 2147483648 [template = constants.%int_2147483648.1] -// CHECK:STDOUT: %impl.elem0.loc15_17: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15_17: = bound_method %int_2147483648.loc15_17, %impl.elem0.loc15_17 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc15_17: = specific_function %Convert.bound.loc15_17, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc15_17: init %u32 = call %Convert.specific_fn.loc15_17(%int_2147483648.loc15_17) [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc15_17.1: %u32 = value_of_initializer %int.convert_checked.loc15_17 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc15_17.2: %u32 = converted %int_2147483648.loc15_17, %.loc15_17.1 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %int.unegate.loc15_28: init %u32 = call %Negate.ref.loc15(%.loc15_17.2) [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %impl.elem0.loc15_8: %Op.type.13 = interface_witness_access constants.%interface.20, element0 [template = constants.%Op.14] -// CHECK:STDOUT: %Op.bound.loc15: = bound_method %int.unegate.loc15_28, %impl.elem0.loc15_8 [template = constants.%Op.bound.2] -// CHECK:STDOUT: %Op.specific_fn.loc15: = specific_function %Op.bound.loc15, @Op.5(constants.%int_32) [template = constants.%Op.specific_fn.2] -// CHECK:STDOUT: %.loc15_28.1: %u32 = value_of_initializer %int.unegate.loc15_28 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc15_28.2: %u32 = converted %int.unegate.loc15_28, %.loc15_28.1 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %int.unegate.loc15_8: init %u32 = call %Op.specific_fn.loc15(%.loc15_28.2) [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc15_30.1: %u32 = value_of_initializer %int.unegate.loc15_8 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc15_30.2: %u32 = converted %int.unegate.loc15_8, %.loc15_30.1 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %Test.specific_fn.loc15: = specific_function %Test.ref.loc15, @Test(constants.%int_2147483648.2) [template = constants.%Test.specific_fn.2] -// CHECK:STDOUT: %.loc15_30.3: ref %Expect.3 = temporary_storage -// CHECK:STDOUT: %Test.call.loc15: init %Expect.3 = call %Test.specific_fn.loc15() to %.loc15_30.3 -// CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] -// CHECK:STDOUT: %int_2147483648.loc15_42: Core.IntLiteral = int_value 2147483648 [template = constants.%int_2147483648.1] -// CHECK:STDOUT: %impl.elem0.loc15_53: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15_53: = bound_method %int_2147483648.loc15_42, %impl.elem0.loc15_53 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc15_53: = specific_function %Convert.bound.loc15_53, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc15_53: init %u32 = call %Convert.specific_fn.loc15_53(%int_2147483648.loc15_42) [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc15_53.1: %u32 = value_of_initializer %int.convert_checked.loc15_53 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %.loc15_53.2: %u32 = converted %int_2147483648.loc15_42, %.loc15_53.1 [template = constants.%int_2147483648.2] -// CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%int_2147483648.2) [template = constants.%Expect.3] -// CHECK:STDOUT: %.loc15_30.4: ref %Expect.3 = temporary %.loc15_30.3, %Test.call.loc15 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Expect(constants.%N.2) { -// CHECK:STDOUT: %N.loc6_14.2 => constants.%N.2 -// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%N.2 -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Expect(@Test.%N.loc7_9.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%N.2) { -// CHECK:STDOUT: %N.loc7_9.2 => constants.%N.2 -// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%N.2 -// CHECK:STDOUT: %Expect.loc7_29.2 => constants.%Expect.1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%int_2147483647.2) { -// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_2147483647.2 -// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_2147483647.2 -// CHECK:STDOUT: %Expect.loc7_29.2 => constants.%Expect.2 -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete => constants.%complete_type.3 -// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Expect(constants.%int_2147483647.2) { -// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_2147483647.2 -// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_2147483647.2 -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%int_2147483648.2) { -// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_2147483648.2 -// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_2147483648.2 -// CHECK:STDOUT: %Expect.loc7_29.2 => constants.%Expect.3 -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete => constants.%complete_type.3 -// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Expect(constants.%int_2147483648.2) { -// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_2147483648.2 -// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_2147483648.2 -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/usub.carbon b/toolchain/check/testdata/builtins/int/usub.carbon index 728eb51c14050..662d33f36fbac 100644 --- a/toolchain/check/testdata/builtins/int/usub.carbon +++ b/toolchain/check/testdata/builtins/int/usub.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/usub.carbon @@ -15,7 +17,7 @@ fn Sub(a: i32, b: i32) -> i32 = "int.usub"; var arr: [i32; Sub(3, 2)]; let arr_p: [i32; 1]* = &arr; -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return Sub(a, b); } @@ -28,273 +30,3 @@ fn Sub(a: i32, b: i32) -> i32 = "int.usub"; let a: i32 = Sub(0, 0x7FFFFFFF); let b: i32 = Sub(Sub(0, 0x7FFFFFFF), 1); let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); - -// CHECK:STDOUT: --- int_sub.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Sub.type.1: type = fn_type @Sub.1 [template] -// CHECK:STDOUT: %Sub: %Sub.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_1.2: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_1.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Sub = %Sub.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Sub.decl: %Sub.type.1 = fn_decl @Sub.1 [template = constants.%Sub] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_11: type = splice_block %i32.loc2_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_19: type = splice_block %i32.loc2_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Sub.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.usub"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Sub.ref: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.usub: init %i32 = call %Sub.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.usub -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int.usub, %.loc8_19.1 -// CHECK:STDOUT: return %.loc8_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- overflow.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Sub.type.1: type = fn_type @Sub.1 [template] -// CHECK:STDOUT: %Sub: %Sub.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_0.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2147483647.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %int_-2147483647: %i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] -// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_2.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Sub = %Sub.decl -// CHECK:STDOUT: .a = @__global_init.%a -// CHECK:STDOUT: .b = @__global_init.%b -// CHECK:STDOUT: .c = @__global_init.%c -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Sub.decl: %Sub.type.1 = fn_decl @Sub.1 [template = constants.%Sub] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_11: type = splice_block %i32.loc4_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc4_19: type = splice_block %i32.loc4_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Sub.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.usub"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Sub.ref.loc6: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %int_0.loc6: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %int_2147483647.loc6: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc6_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc6_18: = bound_method %int_0.loc6, %impl.elem0.loc6_18 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc6_18: = specific_function %Convert.bound.loc6_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc6_18: init %i32 = call %Convert.specific_fn.loc6_18(%int_0.loc6) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc6_18.1: %i32 = value_of_initializer %int.convert_checked.loc6_18 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc6_18.2: %i32 = converted %int_0.loc6, %.loc6_18.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %impl.elem0.loc6_21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc6_21: = bound_method %int_2147483647.loc6, %impl.elem0.loc6_21 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc6_21: = specific_function %Convert.bound.loc6_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc6_21: init %i32 = call %Convert.specific_fn.loc6_21(%int_2147483647.loc6) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_21.1: %i32 = value_of_initializer %int.convert_checked.loc6_21 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc6_21.2: %i32 = converted %int_2147483647.loc6, %.loc6_21.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.usub.loc6: init %i32 = call %Sub.ref.loc6(%.loc6_18.2, %.loc6_21.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc6_32.1: %i32 = value_of_initializer %int.usub.loc6 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc6_32.2: %i32 = converted %int.usub.loc6, %.loc6_32.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc6_32.2 -// CHECK:STDOUT: %Sub.ref.loc7_14: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Sub.ref.loc7_18: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %int_0.loc7: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %int_2147483647.loc7: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc7_22: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc7_22: = bound_method %int_0.loc7, %impl.elem0.loc7_22 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc7_22: = specific_function %Convert.bound.loc7_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc7_22: init %i32 = call %Convert.specific_fn.loc7_22(%int_0.loc7) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc7_22.1: %i32 = value_of_initializer %int.convert_checked.loc7_22 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc7_22.2: %i32 = converted %int_0.loc7, %.loc7_22.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %impl.elem0.loc7_25: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc7_25: = bound_method %int_2147483647.loc7, %impl.elem0.loc7_25 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc7_25: = specific_function %Convert.bound.loc7_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc7_25: init %i32 = call %Convert.specific_fn.loc7_25(%int_2147483647.loc7) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc7_25.1: %i32 = value_of_initializer %int.convert_checked.loc7_25 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc7_25.2: %i32 = converted %int_2147483647.loc7, %.loc7_25.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.usub.loc7_35: init %i32 = call %Sub.ref.loc7_18(%.loc7_22.2, %.loc7_25.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc7_35.1: %i32 = value_of_initializer %int.usub.loc7_35 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc7_35.2: %i32 = converted %int.usub.loc7_35, %.loc7_35.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc7_38: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc7_38: = bound_method %int_1, %impl.elem0.loc7_38 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc7_38: = specific_function %Convert.bound.loc7_38, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc7_38: init %i32 = call %Convert.specific_fn.loc7_38(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc7_38.1: %i32 = value_of_initializer %int.convert_checked.loc7_38 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc7_38.2: %i32 = converted %int_1, %.loc7_38.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.usub.loc7_39: init %i32 = call %Sub.ref.loc7_14(%.loc7_35.2, %.loc7_38.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc7_40.1: %i32 = value_of_initializer %int.usub.loc7_39 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc7_40.2: %i32 = converted %int.usub.loc7_39, %.loc7_40.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc7_40.2 -// CHECK:STDOUT: %Sub.ref.loc8_14: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Sub.ref.loc8_18: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %int_0.loc8: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %int_2147483647.loc8: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc8_22: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_22: = bound_method %int_0.loc8, %impl.elem0.loc8_22 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc8_22: = specific_function %Convert.bound.loc8_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc8_22: init %i32 = call %Convert.specific_fn.loc8_22(%int_0.loc8) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc8_22.1: %i32 = value_of_initializer %int.convert_checked.loc8_22 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc8_22.2: %i32 = converted %int_0.loc8, %.loc8_22.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %impl.elem0.loc8_25: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_25: = bound_method %int_2147483647.loc8, %impl.elem0.loc8_25 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc8_25: = specific_function %Convert.bound.loc8_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc8_25: init %i32 = call %Convert.specific_fn.loc8_25(%int_2147483647.loc8) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_25.1: %i32 = value_of_initializer %int.convert_checked.loc8_25 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_25.2: %i32 = converted %int_2147483647.loc8, %.loc8_25.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.usub.loc8_35: init %i32 = call %Sub.ref.loc8_18(%.loc8_22.2, %.loc8_25.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %.loc8_35.1: %i32 = value_of_initializer %int.usub.loc8_35 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc8_35.2: %i32 = converted %int.usub.loc8_35, %.loc8_35.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc8_38: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_38: = bound_method %int_2, %impl.elem0.loc8_38 [template = constants.%Convert.bound.4] -// CHECK:STDOUT: %Convert.specific_fn.loc8_38: = specific_function %Convert.bound.loc8_38, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] -// CHECK:STDOUT: %int.convert_checked.loc8_38: init %i32 = call %Convert.specific_fn.loc8_38(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc8_38.1: %i32 = value_of_initializer %int.convert_checked.loc8_38 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc8_38.2: %i32 = converted %int_2, %.loc8_38.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.usub.loc8_39: init %i32 = call %Sub.ref.loc8_14(%.loc8_35.2, %.loc8_38.2) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_40.1: %i32 = value_of_initializer %int.usub.loc8_39 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_40.2: %i32 = converted %int.usub.loc8_39, %.loc8_40.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %c: %i32 = bind_name c, %.loc8_40.2 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/xor.carbon b/toolchain/check/testdata/builtins/int/xor.carbon index f3503f7d002b8..5471c38e8b83f 100644 --- a/toolchain/check/testdata/builtins/int/xor.carbon +++ b/toolchain/check/testdata/builtins/int/xor.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/xor.carbon @@ -15,114 +17,6 @@ fn Xor(a: i32, b: i32) -> i32 = "int.xor"; var arr: [i32; Xor(12, 10)]; let arr_p: [i32; 6]* = &arr; -fn RuntimeCall(a: i32, b: i32) -> i32 { +fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return Xor(a, b); } - -// CHECK:STDOUT: --- int_xor.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %Xor.type: type = fn_type @Xor [template] -// CHECK:STDOUT: %Xor: %Xor.type = struct_value () [template] -// CHECK:STDOUT: %int_6.2: Core.IntLiteral = int_value 6 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_6.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] -// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] -// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Xor = %Xor.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Xor.decl: %Xor.type = fn_decl @Xor [template = constants.%Xor] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc2_11: type = splice_block %i32.loc2_11 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc2_19: type = splice_block %i32.loc2_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b -// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Xor(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.xor"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Xor.ref: %Xor.type = name_ref Xor, file.%Xor.decl [template = constants.%Xor] -// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a -// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b -// CHECK:STDOUT: %int.xor: init %i32 = call %Xor.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.xor -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int.xor, %.loc8_19.1 -// CHECK:STDOUT: return %.loc8_19.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int_literal/make_type.carbon b/toolchain/check/testdata/builtins/int_literal/make_type.carbon index df724bca53bac..e2e1a9a0ef779 100644 --- a/toolchain/check/testdata/builtins/int_literal/make_type.carbon +++ b/toolchain/check/testdata/builtins/int_literal/make_type.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// EXTRA-ARGS: --no-dump-sem-ir +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int_literal/make_type.carbon @@ -21,64 +23,3 @@ library "[[@TEST_NAME]]"; import library "types"; var i: IntLiteral(); - -// CHECK:STDOUT: --- types.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] -// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .IntLiteral = %IntLiteral.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %IntLiteral.decl: %IntLiteral.type = fn_decl @IntLiteral [template = constants.%IntLiteral] { -// CHECK:STDOUT: %return.patt: type = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: type = out_param_pattern %return.patt, runtime_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %return.param: ref type = out_param runtime_param0 -// CHECK:STDOUT: %return: ref type = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @IntLiteral() -> type = "int_literal.make_type"; -// CHECK:STDOUT: -// CHECK:STDOUT: --- use_types.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] -// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref: %IntLiteral.type = import_ref Main//types, IntLiteral, loaded [template = constants.%IntLiteral] -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .IntLiteral = imports.%import_ref -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .i = %i -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %i.var: ref Core.IntLiteral = var i -// CHECK:STDOUT: %i: ref Core.IntLiteral = bind_name i, %i.var -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @IntLiteral() -> type = "int_literal.make_type" [from "types.carbon"]; -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/builtin/call.carbon b/toolchain/check/testdata/function/builtin/call.carbon index d30611da114ce..970039f374e07 100644 --- a/toolchain/check/testdata/function/builtin/call.carbon +++ b/toolchain/check/testdata/function/builtin/call.carbon @@ -12,6 +12,10 @@ fn Add(a: i32, b: i32) -> i32 = "int.sadd"; var arr: [i32; Add(1, 2)]; +fn RuntimeCall(a: i32, b: i32) -> i32 { + return Add(a, b); +} + // CHECK:STDOUT: --- call.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -21,6 +25,8 @@ var arr: [i32; Add(1, 2)]; // CHECK:STDOUT: %Add: %Add.type.1 = struct_value () [template] // CHECK:STDOUT: %int_3.2: Core.IntLiteral = int_value 3 [template] // CHECK:STDOUT: %array_type: type = array_type %int_3.2, %i32 [template] +// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -37,6 +43,7 @@ var arr: [i32; Add(1, 2)]; // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .Add = %Add.decl // CHECK:STDOUT: .arr = %arr +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Add.decl: %Add.type.1 = fn_decl @Add.1 [template = constants.%Add] { @@ -66,7 +73,43 @@ var arr: [i32; Add(1, 2)]; // CHECK:STDOUT: } // CHECK:STDOUT: %arr.var: ref %array_type = var arr // CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var +// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { +// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32.loc15_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc15_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 +// CHECK:STDOUT: %.loc15_19: type = splice_block %i32.loc15_19 [template = constants.%i32] { +// CHECK:STDOUT: %int_32.loc15_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc15_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 +// CHECK:STDOUT: %.loc15_27: type = splice_block %i32.loc15_27 [template = constants.%i32] { +// CHECK:STDOUT: %int_32.loc15_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc15_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 +// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Add.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.sadd"; // CHECK:STDOUT: +// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Add.ref: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] +// CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a +// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b +// CHECK:STDOUT: %int.sadd: init %i32 = call %Add.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc16_19.1: %i32 = value_of_initializer %int.sadd +// CHECK:STDOUT: %.loc16_19.2: %i32 = converted %int.sadd, %.loc16_19.1 +// CHECK:STDOUT: return %.loc16_19.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/no_prelude/multifile_raw_and_textual_ir.carbon b/toolchain/driver/testdata/compile/multifile_raw_and_textual_ir.carbon similarity index 98% rename from toolchain/check/testdata/basics/no_prelude/multifile_raw_and_textual_ir.carbon rename to toolchain/driver/testdata/compile/multifile_raw_and_textual_ir.carbon index fb22d00d7cb53..33010f8bd9e95 100644 --- a/toolchain/check/testdata/basics/no_prelude/multifile_raw_and_textual_ir.carbon +++ b/toolchain/driver/testdata/compile/multifile_raw_and_textual_ir.carbon @@ -8,9 +8,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/multifile_raw_and_textual_ir.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/multifile_raw_and_textual_ir.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/multifile_raw_and_textual_ir.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/multifile_raw_and_textual_ir.carbon // --- a.carbon package A; diff --git a/toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon b/toolchain/driver/testdata/compile/multifile_raw_ir.carbon similarity index 98% rename from toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon rename to toolchain/driver/testdata/compile/multifile_raw_ir.carbon index 8e17cd105bf22..36494f4e14d65 100644 --- a/toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon +++ b/toolchain/driver/testdata/compile/multifile_raw_ir.carbon @@ -8,9 +8,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/multifile_raw_ir.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/multifile_raw_ir.carbon // --- a.carbon package A; diff --git a/toolchain/check/testdata/basics/no_prelude/raw_and_textual_ir.carbon b/toolchain/driver/testdata/compile/raw_and_textual_ir.carbon similarity index 98% rename from toolchain/check/testdata/basics/no_prelude/raw_and_textual_ir.carbon rename to toolchain/driver/testdata/compile/raw_and_textual_ir.carbon index 378532c838d4b..8c60a327f3468 100644 --- a/toolchain/check/testdata/basics/no_prelude/raw_and_textual_ir.carbon +++ b/toolchain/driver/testdata/compile/raw_and_textual_ir.carbon @@ -8,9 +8,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/raw_and_textual_ir.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/raw_and_textual_ir.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/raw_and_textual_ir.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/raw_and_textual_ir.carbon fn Foo(n: ()) -> ((), ()) { return (n, ()); diff --git a/toolchain/check/testdata/basics/no_prelude/raw_ir.carbon b/toolchain/driver/testdata/compile/raw_ir.carbon similarity index 99% rename from toolchain/check/testdata/basics/no_prelude/raw_ir.carbon rename to toolchain/driver/testdata/compile/raw_ir.carbon index 08379ee715fd3..dc39b0cf19850 100644 --- a/toolchain/check/testdata/basics/no_prelude/raw_ir.carbon +++ b/toolchain/driver/testdata/compile/raw_ir.carbon @@ -8,9 +8,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/raw_ir.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/raw_ir.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/raw_ir.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/raw_ir.carbon fn Foo[T:! type](n: T) -> (T, ()) { return (n, ()); diff --git a/toolchain/check/testdata/basics/no_prelude/textual_ir.carbon b/toolchain/driver/testdata/compile/textual_ir.carbon similarity index 96% rename from toolchain/check/testdata/basics/no_prelude/textual_ir.carbon rename to toolchain/driver/testdata/compile/textual_ir.carbon index 20d9a62ec5fbf..1e584e27a39cf 100644 --- a/toolchain/check/testdata/basics/no_prelude/textual_ir.carbon +++ b/toolchain/driver/testdata/compile/textual_ir.carbon @@ -8,9 +8,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/textual_ir.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/textual_ir.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/textual_ir.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/textual_ir.carbon fn Foo(n: ()) -> ((), ()) { return (n, ()); diff --git a/toolchain/lex/testdata/basic_syntax.carbon b/toolchain/lex/testdata/basic_syntax.carbon index 1f0b2a996a2cd..c3a64f7bcec14 100644 --- a/toolchain/lex/testdata/basic_syntax.carbon +++ b/toolchain/lex/testdata/basic_syntax.carbon @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // Dump all tokens so that we include the file start and end. -// ARGS: compile --phase=lex --dump-tokens %s +// EXTRA-ARGS: --no-omit-file-boundary-tokens // // AUTOUPDATE // TIP: To test this file alone, run: From afdf8466367a1d112c7a3b9590e72041a6f460f0 Mon Sep 17 00:00:00 2001 From: ezbr <69321728+ezbr@users.noreply.github.com> Date: Mon, 30 Dec 2024 21:34:30 -0500 Subject: [PATCH 08/13] Align StaticRandomData to cacheline size. (#4741) Align StaticRandomData to cacheline size to ensure the whole array is on the same cacheline. --- common/hashing.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/hashing.h b/common/hashing.h index c101a68e651c3..aea263b87f002 100644 --- a/common/hashing.h +++ b/common/hashing.h @@ -408,7 +408,7 @@ class Hasher { // | sed -e "s/.\{4\}/&'/g" \ // | sed -e "s/\(.\{4\}'.\{4\}'.\{4\}'.\{4\}\)'/0x\1,\n/g" // ``` - static constexpr std::array StaticRandomData = { + alignas(64) static constexpr std::array StaticRandomData = { 0x243f'6a88'85a3'08d3, 0x1319'8a2e'0370'7344, 0xa409'3822'299f'31d0, 0x082e'fa98'ec4e'6c89, 0x4528'21e6'38d0'1377, 0xbe54'66cf'34e9'0c6c, 0xc0ac'29b7'c97c'50dd, 0x3f84'd5b5'b547'0917, From 4bbc189d55f458a9916a90ab9b3e2995e8df6b54 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 30 Dec 2024 19:30:35 -0800 Subject: [PATCH 09/13] Don't produce a follow-on error message if we try to perform an impl lookup during error recovery. (#4749) --- toolchain/check/impl_lookup.cpp | 5 + .../builtin/fail_type_mismatch_once.carbon | 13 ++- .../overloaded/fail_error_recovery.carbon | 92 +++++++++++++++++++ 3 files changed, 103 insertions(+), 7 deletions(-) create mode 100644 toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon diff --git a/toolchain/check/impl_lookup.cpp b/toolchain/check/impl_lookup.cpp index 197ea33ae3b15..c07f26622a064 100644 --- a/toolchain/check/impl_lookup.cpp +++ b/toolchain/check/impl_lookup.cpp @@ -8,6 +8,7 @@ #include "toolchain/check/generic.h" #include "toolchain/check/import_ref.h" #include "toolchain/sem_ir/ids.h" +#include "toolchain/sem_ir/typed_insts.h" namespace Carbon::Check { @@ -113,6 +114,10 @@ auto LookupInterfaceWitness(Context& context, SemIR::LocId loc_id, SemIR::ConstantId type_const_id, SemIR::ConstantId interface_const_id) -> SemIR::InstId { + if (type_const_id == SemIR::ErrorInst::SingletonConstantId || + interface_const_id == SemIR::ErrorInst::SingletonConstantId) { + return SemIR::ErrorInst::SingletonInstId; + } auto import_irs = FindAssociatedImportIRs(context, type_const_id, interface_const_id); for (auto import_ir : import_irs) { diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon index ca3606c738a3e..1c2b8af30c588 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon @@ -11,13 +11,9 @@ fn Main() -> i32 { // The following line has two mismatches, but after the first, it shouldn't // keep erroring. - // CHECK:STDERR: fail_type_mismatch_once.carbon:[[@LINE+7]]:10: error: cannot access member of interface `Core.Add` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: fail_type_mismatch_once.carbon:[[@LINE+3]]:10: error: cannot access member of interface `Core.Add` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return 12 + 3.4 + 12; // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: - // CHECK:STDERR: fail_type_mismatch_once.carbon:[[@LINE+3]]:10: error: cannot access member of interface `Core.Add` in type `` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return 12 + 3.4 + 12; - // CHECK:STDERR: ^~~~~~~~~~~~~ return 12 + 3.4 + 12; } @@ -30,6 +26,7 @@ fn Main() -> i32 { // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] // CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template] // CHECK:STDOUT: %float: f64 = float_literal 3.4000000000000004 [template] +// CHECK:STDOUT: %Op.type: type = fn_type @Op [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -60,9 +57,11 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> %i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_12.loc21_10: Core.IntLiteral = int_value 12 [template = constants.%int_12] +// CHECK:STDOUT: %int_12.loc17_10: Core.IntLiteral = int_value 12 [template = constants.%int_12] // CHECK:STDOUT: %float: f64 = float_literal 3.4000000000000004 [template = constants.%float] -// CHECK:STDOUT: %int_12.loc21_21: Core.IntLiteral = int_value 12 [template = constants.%int_12] +// CHECK:STDOUT: %int_12.loc17_21: Core.IntLiteral = int_value 12 [template = constants.%int_12] +// CHECK:STDOUT: %impl.elem0: %Op.type = interface_witness_access , element0 [template = ] +// CHECK:STDOUT: %Op.bound: = bound_method , %impl.elem0 [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon b/toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon new file mode 100644 index 0000000000000..3cfe71e01f63e --- /dev/null +++ b/toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon @@ -0,0 +1,92 @@ +// 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/operators/overloaded/fail_error_recovery.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon + +// Each of these should only produce one error, and shouldn't complain that +// `` doesn't implement an operator. + +fn F() { + // CHECK:STDERR: fail_error_recovery.carbon:[[@LINE+4]]:3: error: name `undeclared` not found [NameNotFound] + // CHECK:STDERR: undeclared + 1; + // CHECK:STDERR: ^~~~~~~~~~ + // CHECK:STDERR: + undeclared + 1; +} + +fn G(n: i32) { + // CHECK:STDERR: fail_error_recovery.carbon:[[@LINE+3]]:7: error: name `undeclared` not found [NameNotFound] + // CHECK:STDERR: n + undeclared; + // CHECK:STDERR: ^~~~~~~~~~ + n + undeclared; +} + +// CHECK:STDOUT: --- fail_error_recovery.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] +// CHECK:STDOUT: %G.type: type = fn_type @G [template] +// CHECK:STDOUT: %G: %G.type = struct_value () [template] +// CHECK:STDOUT: %Op.type.14: type = fn_type @Op.2, @impl.7(%int_32) [template] +// CHECK:STDOUT: %Op.14: %Op.type.14 = struct_value () [template] +// CHECK:STDOUT: %interface.19: = interface_witness (%Op.14) [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .Add = %import_ref.1 +// CHECK:STDOUT: .Int = %import_ref.6 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] { +// CHECK:STDOUT: %n.patt: %i32 = binding_pattern n +// CHECK:STDOUT: %n.param_patt: %i32 = value_param_pattern %n.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %n.param: %i32 = value_param runtime_param0 +// CHECK:STDOUT: %.loc22: type = splice_block %i32 [template = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %n: %i32 = bind_name n, %n.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %undeclared.ref: = name_ref undeclared, [template = ] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0: %Op.type.1 = interface_witness_access , element0 [template = ] +// CHECK:STDOUT: %Op.bound: = bound_method %undeclared.ref, %impl.elem0 [template = ] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @G(%n.param_patt: %i32) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n +// CHECK:STDOUT: %undeclared.ref: = name_ref undeclared, [template = ] +// CHECK:STDOUT: %impl.elem0: %Op.type.1 = interface_witness_access constants.%interface.19, element0 [template = constants.%Op.14] +// CHECK:STDOUT: %Op.bound: = bound_method %n.ref, %impl.elem0 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: From 9d090613012bf2bc09181ae24bc5856f06e8e8d7 Mon Sep 17 00:00:00 2001 From: ezbr <69321728+ezbr@users.noreply.github.com> Date: Mon, 30 Dec 2024 23:32:13 -0500 Subject: [PATCH 10/13] Avoid misaligned loads from StaticRandomData in the size [4, 8] hashing case. (#4743) Avoid misaligned loads from StaticRandomData in the size [4, 8] hashing case. We can use aligned loads in this case for lower latency. We introduce the SampleAlignedRandomData function for this purpose. --- common/hashing.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/hashing.h b/common/hashing.h index aea263b87f002..1c87a820a3181 100644 --- a/common/hashing.h +++ b/common/hashing.h @@ -387,6 +387,14 @@ class Hasher { return data; } + // As above, but for small offsets, we can use aligned loads, which are + // faster. The offset must be in the range [0, 8). + static auto SampleAlignedRandomData(ssize_t offset) -> uint64_t { + CARBON_DCHECK(static_cast(offset) < + sizeof(StaticRandomData) / sizeof(uint64_t)); + return StaticRandomData[offset]; + } + // Random data taken from the hexadecimal digits of Pi's fractional component, // written in lexical order for convenience of reading. The resulting // byte-stream will be different due to little-endian integers. These can be @@ -950,7 +958,7 @@ inline auto Hasher::HashSizedBytes(llvm::ArrayRef bytes) -> void { // Note that we don't drop to the `WeakMix` routine here because we want // to use sampled random data to encode the size, which may not be as // effective without the full 128-bit folded result. - buffer = Mix(data ^ buffer, SampleRandomData(size)); + buffer = Mix(data ^ buffer, SampleAlignedRandomData(size - 1)); CARBON_MCA_END("dynamic-8b"); return; } From 384e1cbb925dcab830eb5cfbcc90bf3490436f7c Mon Sep 17 00:00:00 2001 From: Vitaly Goldshteyn Date: Tue, 31 Dec 2024 05:32:52 +0100 Subject: [PATCH 11/13] Update Read*To* to improve operation dependency graph. (#4746) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Benchmarks for StringRef key seem slightly positive. ``` name old CYCLES/op new CYCLES/op delta BM_MapContainsHit>/1/256 24.2 ± 0% 23.9 ± 0% -1.14% (p=0.000 n=54+55) BM_MapContainsHit>/2/256 24.2 ± 0% 23.9 ± 0% -1.15% (p=0.000 n=53+54) BM_MapContainsHit>/3/256 24.2 ± 0% 23.9 ± 0% -1.15% (p=0.000 n=53+54) BM_MapContainsHit>/4/256 24.2 ± 0% 23.9 ± 0% -1.14% (p=0.000 n=56+57) BM_MapContainsHit>/8/256 25.4 ± 3% 26.3 ± 4% +3.61% (p=0.000 n=57+57) BM_MapContainsHit>/16/256 29.1 ± 2% 29.0 ± 2% -0.28% (p=0.030 n=56+57) BM_MapContainsHit>/32/256 29.2 ± 2% 29.0 ± 1% -0.59% (p=0.000 n=57+55) BM_MapContainsHit>/64/256 30.1 ± 2% 30.0 ± 2% -0.43% (p=0.045 n=57+57) BM_MapContainsHit>/256/256 30.5 ± 1% 30.3 ± 1% -0.56% (p=0.000 n=56+56) BM_MapContainsHit>/256/64 29.2 ± 1% 29.2 ± 2% ~ (p=0.513 n=55+57) BM_MapContainsHit>/256/128 29.6 ± 1% 29.5 ± 1% -0.34% (p=0.002 n=55+57) BM_MapContainsHit>/4096/256 32.0 ± 2% 31.9 ± 2% ~ (p=0.082 n=55+57) BM_MapContainsHit>/4096/1024 37.8 ± 2% 37.8 ± 1% ~ (p=0.751 n=57+55) BM_MapContainsHit>/4096/2048 45.3 ± 2% 45.5 ± 2% +0.46% (p=0.001 n=57+57) BM_MapContainsHit>/65536/256 34.3 ± 2% 34.2 ± 2% -0.46% (p=0.000 n=57+56) BM_MapContainsHit>/65536/16384 72.4 ± 3% 72.3 ± 2% ~ (p=0.458 n=54+50) BM_MapContainsHit>/65536/32768 77.7 ± 3% 77.6 ± 3% ~ (p=0.774 n=56+57) BM_MapContainsHit>/1048576/256 34.9 ± 1% 34.8 ± 2% ~ (p=0.051 n=56+57) BM_MapContainsHit>/1048576/262144 115 ± 5% 115 ± 5% ~ (p=0.660 n=57+55) BM_MapContainsHit>/1048576/524288 145 ± 4% 145 ± 5% ~ (p=0.917 n=57+55) BM_MapContainsHit>/16777216/256 36.5 ± 2% 36.5 ± 2% ~ (p=0.250 n=57+57) BM_MapContainsHit>/16777216/4194304 288 ± 3% 287 ± 4% ~ (p=0.058 n=56+55) BM_MapContainsHit>/16777216/8388608 303 ± 2% 302 ± 3% -0.47% (p=0.044 n=53+54) BM_MapContainsHit>/56/256 29.1 ± 3% 29.0 ± 3% ~ (p=0.147 n=56+57) BM_MapContainsHit>/224/256 30.7 ± 2% 30.6 ± 2% ~ (p=0.140 n=56+55) BM_MapContainsHit>/3584/256 31.4 ± 1% 31.3 ± 1% -0.42% (p=0.003 n=53+54) BM_MapContainsHit>/3584/896 35.8 ± 2% 36.0 ± 2% +0.58% (p=0.000 n=57+57) BM_MapContainsHit>/3584/1792 43.5 ± 1% 43.6 ± 2% +0.21% (p=0.032 n=51+57) BM_MapContainsHit>/57344/256 34.3 ± 2% 34.1 ± 1% -0.43% (p=0.003 n=57+57) BM_MapContainsHit>/57344/14336 67.1 ± 2% 66.8 ± 2% ~ (p=0.057 n=57+57) BM_MapContainsHit>/57344/28672 72.8 ± 3% 72.5 ± 3% -0.45% (p=0.032 n=57+57) BM_MapContainsHit>/917504/256 34.7 ± 2% 34.6 ± 2% ~ (p=0.065 n=56+57) BM_MapContainsHit>/917504/229376 104 ± 4% 104 ± 5% ~ (p=0.853 n=55+55) BM_MapContainsHit>/917504/458752 114 ± 6% 114 ± 5% ~ (p=0.643 n=56+55) BM_MapContainsHit>/14680064/256 36.4 ± 2% 36.2 ± 2% -0.58% (p=0.001 n=56+55) BM_MapContainsHit>/14680064/3670016 271 ± 2% 271 ± 4% ~ (p=0.632 n=55+55) BM_MapContainsHit>/14680064/7340032 285 ± 3% 285 ± 3% ~ (p=0.658 n=57+55) BM_MapContainsMiss>/1 19.3 ± 1% 19.3 ± 2% ~ (p=0.201 n=55+57) BM_MapContainsMiss>/2 19.4 ± 1% 19.3 ± 1% ~ (p=0.191 n=56+56) BM_MapContainsMiss>/3 19.4 ± 1% 19.4 ± 2% ~ (p=0.422 n=55+56) BM_MapContainsMiss>/4 19.4 ± 1% 19.4 ± 1% ~ (p=0.179 n=56+57) BM_MapContainsMiss>/8 19.5 ± 2% 19.5 ± 1% ~ (p=0.148 n=54+57) BM_MapContainsMiss>/16 19.7 ± 2% 19.6 ± 2% ~ (p=0.204 n=54+57) BM_MapContainsMiss>/32 20.0 ± 3% 20.0 ± 3% ~ (p=0.917 n=56+54) BM_MapContainsMiss>/64 19.8 ± 3% 19.8 ± 3% ~ (p=0.245 n=57+54) BM_MapContainsMiss>/256 20.1 ± 3% 20.1 ± 3% ~ (p=0.307 n=57+56) BM_MapContainsMiss>/4096 20.1 ± 3% 20.2 ± 2% ~ (p=0.070 n=57+56) BM_MapContainsMiss>/65536 20.5 ± 3% 20.5 ± 3% ~ (p=0.174 n=56+57) BM_MapContainsMiss>/1048576 20.9 ± 2% 20.8 ± 3% ~ (p=0.476 n=53+55) BM_MapContainsMiss>/16777216 22.2 ± 4% 22.2 ± 3% ~ (p=0.807 n=57+57) BM_MapContainsMiss>/56 24.9 ±28% 23.9 ±16% ~ (p=0.058 n=57+56) BM_MapContainsMiss>/224 27.1 ±19% 26.6 ±19% ~ (p=0.122 n=57+56) BM_MapContainsMiss>/3584 28.9 ±10% 28.7 ±10% ~ (p=0.405 n=56+57) BM_MapContainsMiss>/57344 30.5 ± 7% 31.2 ± 7% +2.32% (p=0.000 n=57+56) BM_MapContainsMiss>/917504 31.8 ± 7% 31.7 ± 7% ~ (p=0.713 n=57+56) BM_MapContainsMiss>/14680064 33.4 ± 9% 33.5 ± 7% ~ (p=0.921 n=56+56) BM_MapLookupHit>/1/256 49.3 ± 0% 48.2 ± 0% -2.17% (p=0.000 n=55+57) BM_MapLookupHit>/2/256 49.3 ± 0% 48.2 ± 0% -2.17% (p=0.000 n=56+56) BM_MapLookupHit>/3/256 49.3 ± 0% 48.2 ± 0% -2.17% (p=0.000 n=54+55) BM_MapLookupHit>/4/256 49.3 ± 0% 48.2 ± 0% -2.17% (p=0.000 n=54+53) BM_MapLookupHit>/8/256 49.0 ± 0% 48.0 ± 0% -2.02% (p=0.000 n=51+51) BM_MapLookupHit>/16/256 51.8 ± 1% 51.3 ± 1% -0.89% (p=0.000 n=50+57) BM_MapLookupHit>/32/256 51.8 ± 1% 51.3 ± 1% -1.07% (p=0.000 n=56+56) BM_MapLookupHit>/64/256 52.4 ± 1% 51.8 ± 1% -1.12% (p=0.000 n=57+56) BM_MapLookupHit>/256/256 54.6 ± 1% 54.1 ± 1% -0.94% (p=0.000 n=53+56) BM_MapLookupHit>/256/64 51.9 ± 1% 51.4 ± 1% -0.95% (p=0.000 n=55+56) BM_MapLookupHit>/256/128 52.5 ± 1% 52.0 ± 1% -1.07% (p=0.000 n=57+57) BM_MapLookupHit>/4096/256 62.0 ± 3% 61.6 ± 3% -0.62% (p=0.002 n=55+57) BM_MapLookupHit>/4096/1024 74.6 ± 1% 73.5 ± 1% -1.38% (p=0.000 n=56+56) BM_MapLookupHit>/4096/2048 80.9 ± 1% 79.8 ± 1% -1.34% (p=0.000 n=57+56) BM_MapLookupHit>/65536/256 72.0 ± 2% 71.4 ± 2% -0.77% (p=0.000 n=56+55) BM_MapLookupHit>/65536/16384 145 ± 4% 145 ± 3% ~ (p=0.662 n=57+55) BM_MapLookupHit>/65536/32768 155 ± 4% 156 ± 4% ~ (p=0.541 n=57+54) BM_MapLookupHit>/1048576/256 73.1 ± 2% 72.5 ± 2% -0.73% (p=0.000 n=56+57) BM_MapLookupHit>/1048576/262144 281 ± 7% 283 ± 5% ~ (p=0.284 n=57+49) BM_MapLookupHit>/1048576/524288 342 ± 5% 342 ± 5% ~ (p=0.684 n=57+53) BM_MapLookupHit>/16777216/256 77.5 ± 2% 76.9 ± 2% -0.74% (p=0.000 n=55+54) BM_MapLookupHit>/16777216/4194304 750 ± 3% 749 ± 3% ~ (p=0.458 n=57+53) BM_MapLookupHit>/16777216/8388608 802 ± 2% 801 ± 3% ~ (p=0.518 n=57+55) BM_MapLookupHit>/56/256 51.9 ± 1% 51.3 ± 1% -1.10% (p=0.000 n=57+57) BM_MapLookupHit>/224/256 54.0 ± 1% 53.5 ± 1% -1.01% (p=0.000 n=56+57) BM_MapLookupHit>/3584/256 58.8 ± 2% 58.1 ± 2% -1.28% (p=0.000 n=56+57) BM_MapLookupHit>/3584/896 69.7 ± 2% 68.7 ± 1% -1.35% (p=0.000 n=57+57) BM_MapLookupHit>/3584/1792 77.1 ± 1% 76.0 ± 1% -1.45% (p=0.000 n=55+57) BM_MapLookupHit>/57344/256 71.3 ± 2% 70.7 ± 3% -0.85% (p=0.000 n=55+57) BM_MapLookupHit>/57344/14336 128 ± 3% 128 ± 3% ~ (p=0.556 n=57+56) BM_MapLookupHit>/57344/28672 140 ± 4% 140 ± 3% ~ (p=0.735 n=57+51) BM_MapLookupHit>/917504/256 72.8 ± 2% 72.3 ± 2% -0.76% (p=0.000 n=57+57) BM_MapLookupHit>/917504/229376 242 ± 7% 243 ± 6% ~ (p=0.303 n=57+55) BM_MapLookupHit>/917504/458752 264 ± 7% 264 ± 6% ~ (p=0.823 n=57+55) BM_MapLookupHit>/14680064/256 76.4 ± 2% 75.8 ± 3% -0.78% (p=0.000 n=57+56) BM_MapLookupHit>/14680064/3670016 696 ± 3% 698 ± 3% ~ (p=0.189 n=56+53) BM_MapLookupHit>/14680064/7340032 749 ± 3% 750 ± 3% ~ (p=0.266 n=55+55) BM_MapUpdateHit>/1/256 34.9 ± 0% 35.0 ± 0% +0.36% (p=0.000 n=56+50) BM_MapUpdateHit>/2/256 34.9 ± 0% 35.0 ± 0% +0.35% (p=0.000 n=55+53) BM_MapUpdateHit>/3/256 34.9 ± 0% 35.0 ± 0% +0.35% (p=0.000 n=55+55) BM_MapUpdateHit>/4/256 34.9 ± 0% 35.0 ± 0% +0.36% (p=0.000 n=56+55) BM_MapUpdateHit>/8/256 37.5 ± 3% 37.6 ± 2% ~ (p=0.081 n=57+56) BM_MapUpdateHit>/16/256 39.4 ± 1% 39.5 ± 2% ~ (p=0.054 n=55+57) BM_MapUpdateHit>/32/256 40.0 ± 3% 39.9 ± 4% ~ (p=0.449 n=56+55) BM_MapUpdateHit>/64/256 40.0 ± 1% 40.1 ± 2% ~ (p=0.796 n=54+54) BM_MapUpdateHit>/256/256 41.1 ± 2% 41.2 ± 2% ~ (p=0.061 n=53+50) BM_MapUpdateHit>/256/64 39.6 ± 2% 39.6 ± 2% ~ (p=0.695 n=55+52) BM_MapUpdateHit>/256/128 40.2 ± 2% 40.1 ± 2% ~ (p=0.507 n=53+49) BM_MapUpdateHit>/4096/256 43.4 ± 2% 43.5 ± 2% ~ (p=0.300 n=53+56) BM_MapUpdateHit>/4096/1024 50.9 ± 2% 51.8 ± 2% +1.79% (p=0.000 n=56+57) BM_MapUpdateHit>/4096/2048 58.2 ± 1% 58.3 ± 1% ~ (p=0.072 n=57+57) BM_MapUpdateHit>/65536/256 46.1 ± 1% 46.1 ± 2% ~ (p=0.197 n=54+53) BM_MapUpdateHit>/65536/16384 88.1 ± 5% 88.9 ± 4% +0.90% (p=0.011 n=57+57) BM_MapUpdateHit>/65536/32768 92.4 ± 3% 93.6 ± 3% +1.35% (p=0.000 n=57+57) BM_MapUpdateHit>/1048576/256 46.6 ± 2% 46.7 ± 2% ~ (p=0.687 n=51+56) BM_MapUpdateHit>/1048576/262144 144 ± 7% 145 ± 6% ~ (p=0.130 n=57+55) BM_MapUpdateHit>/1048576/524288 181 ± 4% 182 ± 4% ~ (p=0.057 n=56+55) BM_MapUpdateHit>/16777216/256 48.9 ± 2% 48.7 ± 2% -0.30% (p=0.042 n=56+53) BM_MapUpdateHit>/16777216/4194304 351 ± 2% 350 ± 3% ~ (p=0.287 n=57+55) BM_MapUpdateHit>/16777216/8388608 368 ± 3% 367 ± 3% ~ (p=0.710 n=57+55) BM_MapUpdateHit>/56/256 39.7 ± 3% 39.6 ± 3% ~ (p=0.572 n=57+56) BM_MapUpdateHit>/224/256 41.7 ± 2% 41.6 ± 3% ~ (p=0.233 n=55+56) BM_MapUpdateHit>/3584/256 42.6 ± 2% 42.5 ± 2% ~ (p=0.309 n=54+55) BM_MapUpdateHit>/3584/896 49.1 ± 1% 49.8 ± 1% +1.51% (p=0.000 n=57+56) BM_MapUpdateHit>/3584/1792 57.0 ± 1% 57.1 ± 2% +0.30% (p=0.022 n=56+57) BM_MapUpdateHit>/57344/256 46.1 ± 2% 46.0 ± 1% -0.28% (p=0.013 n=55+53) BM_MapUpdateHit>/57344/14336 82.0 ± 2% 82.6 ± 2% +0.71% (p=0.000 n=57+56) BM_MapUpdateHit>/57344/28672 88.7 ± 2% 89.8 ± 2% +1.22% (p=0.000 n=57+53) BM_MapUpdateHit>/917504/256 46.5 ± 1% 46.5 ± 2% ~ (p=0.961 n=53+55) BM_MapUpdateHit>/917504/229376 126 ± 5% 128 ± 5% +1.64% (p=0.000 n=57+54) BM_MapUpdateHit>/917504/458752 140 ± 5% 141 ± 6% ~ (p=0.162 n=57+55) BM_MapUpdateHit>/14680064/256 48.5 ± 2% 48.3 ± 2% ~ (p=0.094 n=55+54) BM_MapUpdateHit>/14680064/3670016 328 ± 4% 328 ± 3% ~ (p=0.925 n=57+56) BM_MapUpdateHit>/14680064/7340032 345 ± 3% 345 ± 3% ~ (p=0.489 n=57+55) BM_MapEraseUpdateHit>/1/256 76.0 ± 0% 75.9 ± 0% -0.03% (p=0.006 n=54+47) BM_MapEraseUpdateHit>/2/256 71.3 ± 1% 72.1 ± 5% ~ (p=0.750 n=52+54) BM_MapEraseUpdateHit>/3/256 70.9 ± 2% 70.7 ± 2% ~ (p=0.095 n=54+52) BM_MapEraseUpdateHit>/4/256 70.4 ± 2% 70.6 ± 3% ~ (p=0.458 n=47+56) BM_MapEraseUpdateHit>/8/256 75.0 ± 1% 74.2 ± 1% -1.16% (p=0.000 n=52+54) BM_MapEraseUpdateHit>/16/256 80.5 ± 3% 79.0 ± 3% -1.88% (p=0.000 n=51+53) BM_MapEraseUpdateHit>/32/256 83.2 ± 4% 82.3 ± 5% -1.01% (p=0.009 n=56+57) BM_MapEraseUpdateHit>/64/256 80.6 ± 3% 79.4 ± 4% -1.48% (p=0.000 n=52+54) BM_MapEraseUpdateHit>/256/256 83.6 ± 3% 82.6 ± 5% -1.23% (p=0.000 n=54+56) BM_MapEraseUpdateHit>/256/64 79.1 ± 6% 78.8 ± 8% ~ (p=0.359 n=55+56) BM_MapEraseUpdateHit>/256/128 81.1 ± 6% 80.3 ± 9% -1.04% (p=0.010 n=55+56) BM_MapEraseUpdateHit>/4096/256 85.5 ± 5% 84.1 ± 4% -1.61% (p=0.000 n=54+57) BM_MapEraseUpdateHit>/4096/1024 95.7 ± 3% 95.2 ± 2% -0.47% (p=0.033 n=56+55) BM_MapEraseUpdateHit>/4096/2048 101 ± 2% 101 ± 1% -0.68% (p=0.000 n=56+54) BM_MapEraseUpdateHit>/65536/256 90.5 ± 4% 88.1 ± 4% -2.57% (p=0.000 n=56+55) BM_MapEraseUpdateHit>/65536/16384 134 ± 3% 133 ± 2% -0.71% (p=0.002 n=57+57) BM_MapEraseUpdateHit>/65536/32768 142 ± 3% 141 ± 2% -0.90% (p=0.000 n=57+56) BM_MapEraseUpdateHit>/1048576/256 91.2 ± 3% 89.3 ± 4% -2.08% (p=0.000 n=56+55) BM_MapEraseUpdateHit>/1048576/262144 209 ± 5% 208 ± 5% ~ (p=0.170 n=57+54) BM_MapEraseUpdateHit>/1048576/524288 243 ± 5% 240 ± 5% -1.05% (p=0.020 n=57+55) BM_MapEraseUpdateHit>/16777216/256 94.3 ± 3% 92.5 ± 5% -1.91% (p=0.000 n=55+56) BM_MapEraseUpdateHit>/16777216/4194304 542 ± 3% 537 ± 4% -1.02% (p=0.000 n=57+56) BM_MapEraseUpdateHit>/16777216/8388608 566 ± 3% 561 ± 4% -1.01% (p=0.000 n=57+56) BM_MapEraseUpdateHit>/56/256 83.7 ±10% 81.3 ± 8% -2.84% (p=0.000 n=55+56) BM_MapEraseUpdateHit>/224/256 88.7 ± 8% 86.6 ± 9% -2.40% (p=0.001 n=57+55) BM_MapEraseUpdateHit>/3584/256 94.0 ± 5% 91.3 ± 4% -2.83% (p=0.000 n=56+56) BM_MapEraseUpdateHit>/3584/896 118 ± 4% 118 ± 5% ~ (p=0.930 n=57+55) BM_MapEraseUpdateHit>/3584/1792 143 ± 4% 141 ± 4% -1.10% (p=0.002 n=57+55) BM_MapEraseUpdateHit>/57344/256 102 ± 4% 100 ± 4% -2.31% (p=0.000 n=56+57) BM_MapEraseUpdateHit>/57344/14336 191 ± 2% 190 ± 1% -0.32% (p=0.024 n=57+55) BM_MapEraseUpdateHit>/57344/28672 197 ± 2% 197 ± 1% ~ (p=0.059 n=57+55) BM_MapEraseUpdateHit>/917504/256 103 ± 4% 101 ± 4% -1.99% (p=0.000 n=57+56) BM_MapEraseUpdateHit>/917504/229376 280 ± 3% 279 ± 3% ~ (p=0.145 n=57+52) BM_MapEraseUpdateHit>/917504/458752 298 ± 4% 296 ± 3% ~ (p=0.116 n=57+56) BM_MapEraseUpdateHit>/14680064/256 107 ± 4% 104 ± 4% -2.11% (p=0.000 n=55+56) BM_MapEraseUpdateHit>/14680064/3670016 613 ± 3% 612 ± 2% ~ (p=0.224 n=57+55) BM_MapEraseUpdateHit>/14680064/7340032 637 ± 2% 635 ± 1% ~ (p=0.075 n=56+55) BM_MapInsertSeq>/1 132 ± 0% 132 ± 0% -0.26% (p=0.000 n=47+41) BM_MapInsertSeq>/2 160 ± 0% 161 ± 4% +0.57% (p=0.001 n=45+57) BM_MapInsertSeq>/3 188 ± 2% 189 ± 3% ~ (p=0.327 n=54+54) BM_MapInsertSeq>/4 217 ± 3% 218 ± 5% ~ (p=0.240 n=54+56) BM_MapInsertSeq>/8 342 ± 5% 341 ± 4% ~ (p=0.282 n=53+54) BM_MapInsertSeq>/16 640 ± 3% 648 ± 8% +1.26% (p=0.023 n=49+54) BM_MapInsertSeq>/32 1.20k ± 8% 1.20k ± 8% ~ (p=0.423 n=53+54) BM_MapInsertSeq>/64 3.57k ± 8% 3.55k ± 6% ~ (p=0.557 n=57+54) BM_MapInsertSeq>/256 18.6k ± 5% 18.6k ± 6% ~ (p=0.799 n=57+57) BM_MapInsertSeq>/4096 492k ± 4% 491k ± 3% ~ (p=0.378 n=56+57) BM_MapInsertSeq>/65536 10.5M ± 2% 10.4M ± 1% ~ (p=0.143 n=57+48) BM_MapInsertSeq>/1048576 323M ± 2% 322M ± 3% ~ (p=0.098 n=56+56) BM_MapInsertSeq>/16777216 7.07G ± 3% 7.05G ± 4% ~ (p=0.195 n=56+57) BM_MapInsertSeq>/56 2.04k ± 8% 2.03k ± 7% ~ (p=0.124 n=52+55) BM_MapInsertSeq>/224 12.0k ± 5% 12.0k ± 4% ~ (p=0.467 n=57+55) BM_MapInsertSeq>/3584 294k ± 5% 292k ± 4% ~ (p=0.188 n=56+57) BM_MapInsertSeq>/57344 6.40M ± 2% 6.39M ± 1% ~ (p=0.381 n=57+56) BM_MapInsertSeq>/917504 199M ± 3% 199M ± 3% ~ (p=0.977 n=57+57) BM_MapInsertSeq>/14680064 4.56G ± 3% 4.55G ± 3% ~ (p=0.129 n=55+56) ``` --- common/hashing.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/hashing.h b/common/hashing.h index 1c87a820a3181..a8dee4c81664a 100644 --- a/common/hashing.h +++ b/common/hashing.h @@ -711,7 +711,7 @@ inline auto Hasher::Read1To3(const std::byte* data, ssize_t size) -> uint64_t { uint64_t byte0 = static_cast(data[0]); uint64_t byte1 = static_cast(data[size - 1]); uint64_t byte2 = static_cast(data[size >> 1]); - return byte0 | (byte1 << 16) | (byte2 << 8); + return (byte0 << 8) | (byte1 << 16) | byte2; } inline auto Hasher::Read4To8(const std::byte* data, ssize_t size) -> uint64_t { @@ -719,7 +719,7 @@ inline auto Hasher::Read4To8(const std::byte* data, ssize_t size) -> uint64_t { std::memcpy(&low, data, sizeof(low)); uint32_t high; std::memcpy(&high, data + size - sizeof(high), sizeof(high)); - return low | (static_cast(high) << 32); + return (static_cast(low) << 32) | high; } inline auto Hasher::Read8To16(const std::byte* data, ssize_t size) From 624950c62cef42458f5f96752805284a41824eaa Mon Sep 17 00:00:00 2001 From: Vitaly Goldshteyn Date: Tue, 31 Dec 2024 06:44:37 +0100 Subject: [PATCH 12/13] Store hash in the probed_indices array in common/raw_hashtable.h to avoid its recomputation. (#4726) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Store hash in probed_indices array to avoid its recomputation. Benchmarks on ARM (altra, aarch64). ``` name old CYCLES/op new CYCLES/op delta BM_MapInsertSeq>/1 119 ± 2% 119 ± 1% ~ (p=0.961 n=55+54) BM_MapInsertSeq>/2 133 ± 1% 134 ± 1% ~ (p=0.342 n=56+57) BM_MapInsertSeq>/3 150 ± 1% 150 ± 1% ~ (p=0.856 n=56+57) BM_MapInsertSeq>/4 167 ± 2% 167 ± 2% ~ (p=0.430 n=56+57) BM_MapInsertSeq>/8 234 ± 5% 234 ± 3% ~ (p=0.957 n=57+57) BM_MapInsertSeq>/16 368 ± 4% 368 ± 4% ~ (p=0.762 n=57+57) BM_MapInsertSeq>/32 650 ± 4% 650 ± 4% ~ (p=0.955 n=57+57) BM_MapInsertSeq>/64 1.93k ± 4% 1.98k ± 4% +2.35% (p=0.000 n=57+57) BM_MapInsertSeq>/256 9.68k ± 5% 9.85k ± 3% +1.74% (p=0.000 n=57+57) BM_MapInsertSeq>/4096 177k ± 3% 163k ± 2% -8.17% (p=0.000 n=57+57) BM_MapInsertSeq>/65536 3.99M ± 3% 3.87M ± 4% -3.12% (p=0.000 n=56+56) BM_MapInsertSeq>/1048576 90.5M ± 5% 91.3M ± 6% +0.87% (p=0.025 n=55+55) BM_MapInsertSeq>/16777216 2.77G ± 8% 2.74G ± 9% ~ (p=0.076 n=57+57) BM_MapInsertSeq>/56 1.05k ± 5% 1.05k ± 5% ~ (p=0.727 n=57+57) BM_MapInsertSeq>/224 6.29k ± 5% 6.37k ± 4% +1.32% (p=0.000 n=57+57) BM_MapInsertSeq>/3584 124k ± 4% 109k ± 3% -12.46% (p=0.000 n=57+57) BM_MapInsertSeq>/57344 2.67M ± 4% 2.50M ± 4% -6.40% (p=0.000 n=57+57) BM_MapInsertSeq>/917504 65.3M ± 6% 65.8M ± 6% +0.89% (p=0.050 n=55+56) BM_MapInsertSeq>/14680064 2.17G ±10% 2.14G ± 9% -1.55% (p=0.032 n=57+57) BM_MapInsertSeq>/1 122 ± 1% 122 ± 1% ~ (p=0.415 n=56+56) BM_MapInsertSeq>/2 136 ± 1% 136 ± 1% ~ (p=0.861 n=56+57) BM_MapInsertSeq>/3 153 ± 1% 153 ± 1% ~ (p=0.607 n=56+57) BM_MapInsertSeq>/4 170 ± 2% 174 ± 3% +2.34% (p=0.001 n=56+57) BM_MapInsertSeq>/8 238 ± 4% 242 ± 3% +1.59% (p=0.000 n=57+57) BM_MapInsertSeq>/16 382 ± 4% 383 ± 4% ~ (p=0.977 n=57+57) BM_MapInsertSeq>/32 701 ± 7% 682 ± 5% -2.69% (p=0.000 n=57+57) BM_MapInsertSeq>/64 2.13k ± 6% 2.09k ± 3% -1.89% (p=0.000 n=57+57) BM_MapInsertSeq>/256 10.3k ± 3% 10.2k ± 3% -0.94% (p=0.000 n=57+57) BM_MapInsertSeq>/4096 184k ± 2% 179k ± 2% -2.62% (p=0.000 n=57+57) BM_MapInsertSeq>/65536 3.63M ± 2% 3.68M ± 3% +1.22% (p=0.000 n=54+57) BM_MapInsertSeq>/1048576 129M ±10% 129M ±10% ~ (p=0.874 n=57+57) BM_MapInsertSeq>/16777216 3.27G ±11% 3.24G ±10% ~ (p=0.451 n=57+57) BM_MapInsertSeq>/56 1.18k ± 9% 1.10k ± 5% -6.52% (p=0.000 n=57+57) BM_MapInsertSeq>/224 6.76k ± 5% 6.59k ± 4% -2.55% (p=0.000 n=57+57) BM_MapInsertSeq>/3584 117k ± 2% 115k ± 3% -1.93% (p=0.000 n=57+57) BM_MapInsertSeq>/57344 2.22M ± 3% 2.24M ± 2% +0.87% (p=0.000 n=57+57) BM_MapInsertSeq>/917504 95.0M ± 8% 94.8M ± 9% ~ (p=0.894 n=55+57) BM_MapInsertSeq>/14680064 2.42G ±14% 2.40G ±13% ~ (p=0.852 n=57+57) BM_MapInsertSeq>/1 124 ± 1% 124 ± 1% ~ (p=0.604 n=56+55) BM_MapInsertSeq>/2 140 ± 1% 140 ± 1% ~ (p=0.181 n=56+56) BM_MapInsertSeq>/3 158 ± 1% 158 ± 3% ~ (p=1.000 n=56+57) BM_MapInsertSeq>/4 176 ± 2% 176 ± 3% ~ (p=0.125 n=56+57) BM_MapInsertSeq>/8 247 ± 4% 247 ± 2% ~ (p=0.614 n=57+57) BM_MapInsertSeq>/16 391 ± 3% 391 ± 2% ~ (p=0.993 n=57+57) BM_MapInsertSeq>/32 690 ± 3% 691 ± 3% ~ (p=0.224 n=57+57) BM_MapInsertSeq>/64 2.17k ± 3% 2.22k ± 3% +1.94% (p=0.000 n=57+57) BM_MapInsertSeq>/256 11.1k ± 3% 11.3k ± 3% +1.58% (p=0.000 n=57+57) BM_MapInsertSeq>/4096 204k ± 2% 193k ± 2% -5.65% (p=0.000 n=57+57) BM_MapInsertSeq>/65536 5.19M ± 3% 5.09M ± 3% -2.05% (p=0.000 n=56+56) BM_MapInsertSeq>/1048576 124M ±10% 123M ± 6% ~ (p=0.626 n=57+57) BM_MapInsertSeq>/16777216 3.30G ± 9% 3.25G ± 8% -1.39% (p=0.019 n=57+57) BM_MapInsertSeq>/56 1.12k ± 3% 1.12k ± 3% ~ (p=0.482 n=57+57) BM_MapInsertSeq>/224 7.04k ± 4% 7.14k ± 3% +1.36% (p=0.000 n=57+57) BM_MapInsertSeq>/3584 138k ± 2% 126k ± 2% -8.89% (p=0.000 n=57+57) BM_MapInsertSeq>/57344 3.48M ± 4% 3.34M ± 4% -3.93% (p=0.000 n=56+56) BM_MapInsertSeq>/917504 84.4M ± 7% 84.9M ± 6% ~ (p=0.159 n=56+57) BM_MapInsertSeq>/14680064 2.42G ± 9% 2.40G ±10% ~ (p=0.300 n=57+57) BM_MapInsertSeq>/1 168 ± 0% 168 ± 0% ~ (p=0.555 n=56+55) BM_MapInsertSeq>/2 208 ± 0% 208 ± 0% ~ (p=0.722 n=52+53) BM_MapInsertSeq>/3 248 ± 0% 248 ± 0% ~ (p=0.248 n=53+54) BM_MapInsertSeq>/4 288 ± 0% 288 ± 0% ~ (p=0.185 n=54+55) BM_MapInsertSeq>/8 457 ± 0% 457 ± 0% ~ (p=0.665 n=53+53) BM_MapInsertSeq>/16 867 ± 1% 867 ± 1% ~ (p=0.174 n=47+52) BM_MapInsertSeq>/32 1.61k ± 3% 1.62k ± 4% ~ (p=0.402 n=57+57) BM_MapInsertSeq>/64 4.96k ± 9% 4.89k ± 5% -1.37% (p=0.046 n=57+54) BM_MapInsertSeq>/256 26.9k ± 8% 26.5k ± 8% -1.51% (p=0.004 n=56+55) BM_MapInsertSeq>/4096 600k ± 3% 588k ± 2% -2.07% (p=0.000 n=57+57) BM_MapInsertSeq>/65536 13.9M ± 3% 13.5M ± 2% -2.99% (p=0.000 n=55+56) BM_MapInsertSeq>/1048576 407M ± 7% 393M ± 5% -3.27% (p=0.000 n=56+57) BM_MapInsertSeq>/16777216 10.2G ± 8% 9.9G ± 5% -3.50% (p=0.000 n=57+57) BM_MapInsertSeq>/56 2.81k ± 5% 2.81k ± 4% ~ (p=0.809 n=56+56) BM_MapInsertSeq>/224 17.9k ± 6% 17.6k ± 5% -1.20% (p=0.035 n=57+52) BM_MapInsertSeq>/3584 374k ± 3% 367k ± 3% -1.80% (p=0.000 n=57+57) BM_MapInsertSeq>/57344 8.64M ± 3% 8.53M ± 2% -1.29% (p=0.000 n=55+55) BM_MapInsertSeq>/917504 247M ± 6% 244M ± 5% -1.19% (p=0.021 n=56+57) BM_MapInsertSeq>/14680064 6.81G ± 8% 6.64G ± 6% -2.46% (p=0.000 n=57+57) ``` Benchmarks on x86 ``` name old cpu/op new cpu/op delta BM_MapInsertSeq>/1 32.9ns ± 3% 32.6ns ± 3% -0.84% (p=0.027 n=54+51) BM_MapInsertSeq>/2 35.9ns ± 3% 35.7ns ± 4% ~ (p=0.123 n=54+54) BM_MapInsertSeq>/3 39.7ns ± 3% 47.4ns ± 4% +19.40% (p=0.000 n=55+56) BM_MapInsertSeq>/4 52.7ns ± 3% 52.1ns ± 4% -1.22% (p=0.000 n=57+57) BM_MapInsertSeq>/8 78.1ns ± 3% 78.3ns ± 3% ~ (p=0.141 n=50+57) BM_MapInsertSeq>/16 135ns ± 3% 135ns ± 4% ~ (p=0.936 n=53+57) BM_MapInsertSeq>/32 249ns ± 3% 241ns ± 3% -3.28% (p=0.000 n=55+57) BM_MapInsertSeq>/64 631ns ± 3% 618ns ± 3% -2.21% (p=0.000 n=57+57) BM_MapInsertSeq>/256 2.62µs ± 3% 2.36µs ± 4% -10.02% (p=0.000 n=52+53) BM_MapInsertSeq>/4096 39.2µs ± 3% 37.9µs ± 4% -3.40% (p=0.000 n=57+56) BM_MapInsertSeq>/65536 972µs ± 3% 955µs ± 3% -1.76% (p=0.000 n=57+57) BM_MapInsertSeq>/1048576 16.2ms ± 4% 16.3ms ± 5% ~ (p=0.231 n=52+54) BM_MapInsertSeq>/16777216 651ms ± 3% 648ms ± 2% -0.42% (p=0.048 n=57+56) BM_MapInsertSeq>/56 418ns ± 3% 401ns ± 3% -4.10% (p=0.000 n=54+57) BM_MapInsertSeq>/224 1.79µs ± 3% 1.61µs ± 3% -10.20% (p=0.000 n=57+57) BM_MapInsertSeq>/3584 26.0µs ± 3% 24.9µs ± 4% -4.13% (p=0.000 n=57+56) BM_MapInsertSeq>/57344 560µs ± 3% 549µs ± 3% -2.11% (p=0.000 n=56+57) BM_MapInsertSeq>/917504 10.4ms ± 3% 10.4ms ± 3% ~ (p=0.805 n=56+56) BM_MapInsertSeq>/14680064 422ms ± 2% 421ms ± 3% ~ (p=0.269 n=57+56) BM_MapInsertSeq>/1 33.7ns ± 3% 33.7ns ± 3% ~ (p=0.620 n=55+55) BM_MapInsertSeq>/2 36.7ns ± 3% 36.5ns ± 3% ~ (p=0.160 n=55+56) BM_MapInsertSeq>/3 41.1ns ± 2% 41.0ns ± 4% ~ (p=0.284 n=54+56) BM_MapInsertSeq>/4 45.0ns ± 3% 53.9ns ± 4% +19.70% (p=0.000 n=57+56) BM_MapInsertSeq>/8 77.1ns ± 3% 80.9ns ± 4% +4.98% (p=0.000 n=55+57) BM_MapInsertSeq>/16 130ns ± 3% 136ns ± 4% +4.42% (p=0.000 n=56+57) BM_MapInsertSeq>/32 244ns ± 3% 246ns ± 4% +0.95% (p=0.000 n=57+57) BM_MapInsertSeq>/64 620ns ± 3% 674ns ± 3% +8.83% (p=0.000 n=55+57) BM_MapInsertSeq>/256 2.93µs ± 3% 2.88µs ± 3% -1.73% (p=0.000 n=56+56) BM_MapInsertSeq>/4096 54.0µs ± 3% 50.8µs ± 4% -6.01% (p=0.000 n=57+57) BM_MapInsertSeq>/65536 1.18ms ± 2% 1.17ms ± 4% ~ (p=0.083 n=57+57) BM_MapInsertSeq>/1048576 28.9ms ± 4% 29.1ms ± 5% +0.91% (p=0.007 n=55+56) BM_MapInsertSeq>/16777216 914ms ± 2% 919ms ± 3% +0.56% (p=0.015 n=56+57) BM_MapInsertSeq>/56 404ns ± 3% 427ns ± 4% +5.60% (p=0.000 n=57+57) BM_MapInsertSeq>/224 1.88µs ± 3% 1.87µs ± 4% -0.68% (p=0.013 n=55+53) BM_MapInsertSeq>/3584 34.2µs ± 3% 32.9µs ± 4% -4.02% (p=0.000 n=56+57) BM_MapInsertSeq>/57344 768µs ± 3% 756µs ± 3% -1.53% (p=0.000 n=57+57) BM_MapInsertSeq>/917504 16.4ms ± 5% 16.5ms ± 7% ~ (p=0.303 n=56+57) BM_MapInsertSeq>/14680064 607ms ± 2% 613ms ± 3% +0.92% (p=0.000 n=57+57) BM_MapInsertSeq>/1 34.1ns ± 3% 34.2ns ± 4% ~ (p=0.288 n=57+57) BM_MapInsertSeq>/2 37.4ns ± 3% 37.5ns ± 3% ~ (p=0.316 n=57+57) BM_MapInsertSeq>/3 41.8ns ± 4% 49.1ns ± 3% +17.45% (p=0.000 n=57+56) BM_MapInsertSeq>/4 54.6ns ± 3% 53.9ns ± 5% -1.35% (p=0.000 n=57+57) BM_MapInsertSeq>/8 81.4ns ± 3% 81.4ns ± 4% ~ (p=0.956 n=56+57) BM_MapInsertSeq>/16 139ns ± 3% 139ns ± 3% ~ (p=0.754 n=57+56) BM_MapInsertSeq>/32 256ns ± 3% 250ns ± 4% -2.32% (p=0.000 n=57+57) BM_MapInsertSeq>/64 705ns ± 4% 687ns ± 3% -2.56% (p=0.000 n=53+57) BM_MapInsertSeq>/256 2.95µs ± 5% 3.05µs ± 3% +3.42% (p=0.000 n=52+55) BM_MapInsertSeq>/4096 49.6µs ± 3% 50.8µs ± 4% +2.44% (p=0.000 n=55+57) BM_MapInsertSeq>/65536 1.39ms ± 3% 1.40ms ± 3% +0.65% (p=0.004 n=57+56) BM_MapInsertSeq>/1048576 37.7ms ± 4% 38.1ms ± 4% +1.07% (p=0.001 n=57+57) BM_MapInsertSeq>/16777216 1.20s ± 3% 1.20s ± 3% +0.50% (p=0.040 n=57+57) BM_MapInsertSeq>/56 432ns ± 3% 414ns ± 3% -3.99% (p=0.000 n=57+57) BM_MapInsertSeq>/224 1.92µs ± 4% 1.89µs ± 4% -1.48% (p=0.000 n=52+55) BM_MapInsertSeq>/3584 31.5µs ± 4% 32.1µs ± 4% +1.89% (p=0.000 n=57+57) BM_MapInsertSeq>/57344 757µs ± 3% 748µs ± 3% -1.28% (p=0.000 n=57+57) BM_MapInsertSeq>/917504 21.9ms ± 4% 22.1ms ± 5% ~ (p=0.096 n=57+57) BM_MapInsertSeq>/14680064 735ms ± 3% 737ms ± 3% ~ (p=0.208 n=57+57) BM_MapInsertSeq>/1 41.5ns ± 3% 41.4ns ± 4% ~ (p=0.790 n=54+56) BM_MapInsertSeq>/2 50.6ns ± 4% 50.6ns ± 5% ~ (p=0.684 n=53+57) BM_MapInsertSeq>/3 59.7ns ± 4% 59.4ns ± 4% ~ (p=0.277 n=55+53) BM_MapInsertSeq>/4 68.5ns ± 5% 68.2ns ± 5% ~ (p=0.623 n=54+55) BM_MapInsertSeq>/8 107ns ± 5% 107ns ± 9% ~ (p=0.359 n=54+57) BM_MapInsertSeq>/16 200ns ± 6% 200ns ± 6% ~ (p=0.772 n=56+57) BM_MapInsertSeq>/32 373ns ± 8% 371ns ± 7% ~ (p=0.541 n=57+57) BM_MapInsertSeq>/64 1.11µs ± 9% 1.09µs ± 8% -2.09% (p=0.003 n=56+56) BM_MapInsertSeq>/256 5.61µs ± 5% 5.48µs ± 7% -2.42% (p=0.000 n=54+56) BM_MapInsertSeq>/4096 153µs ± 4% 147µs ± 6% -3.80% (p=0.000 n=54+57) BM_MapInsertSeq>/65536 3.24ms ± 3% 3.10ms ± 3% -4.19% (p=0.000 n=57+57) BM_MapInsertSeq>/1048576 100ms ± 2% 98ms ± 3% -1.97% (p=0.000 n=56+57) BM_MapInsertSeq>/16777216 2.45s ± 2% 2.40s ± 3% -2.09% (p=0.000 n=57+57) BM_MapInsertSeq>/56 637ns ± 8% 630ns ± 8% ~ (p=0.101 n=56+56) BM_MapInsertSeq>/224 3.77µs ± 6% 3.68µs ± 6% -2.42% (p=0.000 n=56+56) BM_MapInsertSeq>/3584 92.1µs ± 7% 88.4µs ± 6% -4.04% (p=0.000 n=57+56) BM_MapInsertSeq>/57344 1.99ms ± 4% 1.92ms ± 3% -3.47% (p=0.000 n=57+57) BM_MapInsertSeq>/917504 62.1ms ± 4% 60.9ms ± 3% -1.93% (p=0.000 n=57+57) BM_MapInsertSeq>/14680064 1.53s ± 3% 1.50s ± 3% -1.85% (p=0.000 n=57+57) ``` --------- Co-authored-by: Chandler Carruth Co-authored-by: Carbon Infra Bot --- common/raw_hashtable.h | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/common/raw_hashtable.h b/common/raw_hashtable.h index 8200117b2578b..9613f303c2b9f 100644 --- a/common/raw_hashtable.h +++ b/common/raw_hashtable.h @@ -570,16 +570,13 @@ class BaseImpl { auto CopySlotsFrom(const BaseImpl& arg) -> void; auto MoveFrom(BaseImpl&& arg, Storage* small_storage) -> void; - template - auto InsertIntoEmpty(LookupKeyT lookup_key, KeyContextT key_context) - -> EntryT*; + auto InsertIntoEmpty(HashCode hash) -> EntryT*; static auto ComputeNextAllocSize(ssize_t old_alloc_size) -> ssize_t; static auto GrowthThresholdForAllocSize(ssize_t alloc_size) -> ssize_t; auto GrowToNextAllocSize(KeyContextT key_context) -> void; - template - auto GrowAndInsert(LookupKeyT lookup_key, KeyContextT key_context) -> EntryT*; + auto GrowAndInsert(HashCode hash, KeyContextT key_context) -> EntryT*; ViewImplT view_impl_; int growth_budget_; @@ -974,7 +971,7 @@ auto BaseImpl::InsertImpl( // empty slot. Without the growth budget we'll have to completely rehash and // so we can just bail here. if (LLVM_UNLIKELY(growth_budget_ == 0)) { - return {GrowAndInsert(lookup_key, key_context), true}; + return {GrowAndInsert(hash, key_context), true}; } --growth_budget_; @@ -1029,8 +1026,9 @@ BaseImpl::GrowToAllocSizeImpl( for (ssize_t byte_index : present_matched_range) { ++count; ssize_t index = group_index + byte_index; - EntryT* new_entry = - InsertIntoEmpty(old_entries[index].key(), key_context); + HashCode hash = + key_context.HashKey(old_entries[index].key(), ComputeSeed()); + EntryT* new_entry = InsertIntoEmpty(hash); new_entry->MoveFrom(std::move(old_entries[index])); } } @@ -1291,11 +1289,8 @@ auto BaseImpl::MoveFrom( // these are true, typically just after growth, we can dramatically simplify the // insert position search. template -template -[[clang::noinline]] auto -BaseImpl::InsertIntoEmpty( - LookupKeyT lookup_key, KeyContextT key_context) -> EntryT* { - HashCode hash = key_context.HashKey(lookup_key, ComputeSeed()); +auto BaseImpl::InsertIntoEmpty( + HashCode hash) -> EntryT* { auto [hash_index, tag] = hash.ExtractIndexAndTag<7>(); uint8_t* local_metadata = metadata(); EntryT* local_entries = entries(); @@ -1375,7 +1370,7 @@ auto BaseImpl::GrowToNextAllocSize( // the group walk rather than after the group walk. In practice, between the // statistical rareness and using a large small size buffer here on the stack, // we can handle this most efficiently with temporary, additional storage. - llvm::SmallVector probed_indices; + llvm::SmallVector, 128> probed_indices; // Create locals for the old state of the table. ssize_t old_size = alloc_size(); @@ -1449,7 +1444,7 @@ auto BaseImpl::GrowToNextAllocSize( ssize_t old_hash_index = hash.ExtractIndexAndTag<7>().first & ComputeProbeMaskFromSize(old_size); if (LLVM_UNLIKELY(old_hash_index != group_index)) { - probed_indices.push_back(old_index); + probed_indices.push_back({old_index, hash}); if constexpr (MetadataGroup::FastByteClear) { low_g.ClearByte(byte_index); high_g.ClearByte(byte_index); @@ -1510,9 +1505,8 @@ auto BaseImpl::GrowToNextAllocSize( // We then need to do a normal insertion for anything that was probed before // growth, but we know we'll find an empty slot, so leverage that. - for (ssize_t old_index : probed_indices) { - EntryT* new_entry = - InsertIntoEmpty(old_entries[old_index].key(), key_context); + for (auto [old_index, hash] : probed_indices) { + EntryT* new_entry = InsertIntoEmpty(hash); new_entry->MoveFrom(std::move(old_entries[old_index])); } CARBON_DCHECK(count == @@ -1538,16 +1532,15 @@ auto BaseImpl::GrowToNextAllocSize( // that this function can be directly called and the result returned from // `InsertImpl`. template -template [[clang::noinline]] auto BaseImpl::GrowAndInsert( - LookupKeyT lookup_key, KeyContextT key_context) -> EntryT* { + HashCode hash, KeyContextT key_context) -> EntryT* { GrowToNextAllocSize(key_context); // And insert the lookup_key into an index in the newly grown map and return // that index for use. --growth_budget_; - return InsertIntoEmpty(lookup_key, key_context); + return InsertIntoEmpty(hash); } template From 4a7aefefaa07bf5fe40f7ceb2990f792ea1e6f91 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 30 Dec 2024 22:36:43 -0800 Subject: [PATCH 13/13] Add support for operators on `Core.IntLiteral`. (#4716) Fixes integer builtins to produce the correct values (and not CHECK-fail) when used on integer literals. Also adds impls to the prelude to use the new builtins to perform operations on integer literals. Perhaps most importantly, this allows directly initializing `i32` values with negative numbers, as the negation operation on integer literals now works. For testing I've added tests for use of literals with one operator in each class (addition, multiplication, ordering, bitwise, etc) for which there are distinct rules or overflow behavior, rather than exhaustively testing all the combinations. This is aimed at finding a good tradeoff between maintainability of the tests and thorough test coverage. Also fixes lowering of heterogeneous shifts and comparisons. These are currently disabled when one of the operands is an integer literal, but we may want to allow that when the integer literal operand has a known constant value. --- core/io.carbon | 3 +- core/prelude/operators/arithmetic.carbon | 29 ++ core/prelude/operators/bitwise.carbon | 29 ++ core/prelude/operators/comparison.carbon | 17 + toolchain/base/int.h | 11 +- toolchain/check/eval.cpp | 342 +++++++++---- toolchain/check/testdata/array/base.carbon | 2 +- .../testdata/basics/builtin_types.carbon | 2 +- .../fail_numeric_literal_overflow.carbon | 2 +- .../testdata/basics/numeric_literals.carbon | 2 +- .../testdata/builtins/float/make_type.carbon | 4 +- .../check/testdata/builtins/int/and.carbon | 99 ++++ .../testdata/builtins/int/complement.carbon | 37 ++ .../check/testdata/builtins/int/eq.carbon | 71 ++- .../testdata/builtins/int/greater_eq.carbon | 38 ++ .../testdata/builtins/int/left_shift.carbon | 190 +++++++- .../testdata/builtins/int/less_eq.carbon | 72 +++ .../testdata/builtins/int/right_shift.carbon | 111 ++++- .../check/testdata/builtins/int/sadd.carbon | 62 ++- .../check/testdata/builtins/int/sdiv.carbon | 42 +- .../check/testdata/builtins/int/smod.carbon | 2 +- .../check/testdata/builtins/int/smul.carbon | 46 +- .../testdata/builtins/int/snegate.carbon | 25 +- .../check/testdata/builtins/int/ssub.carbon | 2 +- .../check/testdata/builtins/print/char.carbon | 6 +- .../check/testdata/builtins/print/int.carbon | 6 +- .../testdata/class/generic/import.carbon | 20 +- toolchain/check/testdata/class/import.carbon | 38 +- .../testdata/function/builtin/method.carbon | 2 +- .../testdata/if_expr/control_flow.carbon | 2 +- .../if_expr/fail_not_in_function.carbon | 2 +- .../index/fail_negative_indexing.carbon | 38 +- .../builtin/fail_type_mismatch_once.carbon | 13 +- .../builtin/fail_unimplemented_op.carbon | 10 +- .../overloaded/bit_complement.carbon | 4 +- .../testdata/operators/overloaded/dec.carbon | 4 +- .../testdata/operators/overloaded/eq.carbon | 2 +- .../overloaded/fail_error_recovery.carbon | 2 +- .../operators/overloaded/fail_no_impl.carbon | 6 +- .../overloaded/fail_no_impl_for_arg.carbon | 2 +- .../testdata/operators/overloaded/inc.carbon | 4 +- .../operators/overloaded/negate.carbon | 4 +- .../packages/implicit_imports_prelude.carbon | 2 +- .../check/testdata/pointer/import.carbon | 2 +- .../testdata/return/returned_var_scope.carbon | 2 +- toolchain/check/testdata/struct/import.carbon | 30 +- .../access/fail_negative_indexing.carbon | 17 +- .../tuple/access/index_not_literal.carbon | 2 +- toolchain/check/testdata/tuple/import.carbon | 30 +- toolchain/diagnostics/diagnostic_kind.def | 2 + toolchain/lower/constant.cpp | 11 +- toolchain/lower/file_context.h | 6 + toolchain/lower/function_context.h | 5 + toolchain/lower/handle_call.cpp | 101 +++- toolchain/lower/testdata/builtins/int.carbon | 460 +++++++++++++++--- .../testdata/builtins/int_literal.carbon | 33 ++ .../lower/testdata/builtins/print_read.carbon | 2 +- toolchain/sem_ir/builtin_function_kind.cpp | 144 ++++-- toolchain/sem_ir/builtin_function_kind.h | 3 +- 59 files changed, 1838 insertions(+), 419 deletions(-) diff --git a/core/io.carbon b/core/io.carbon index 80c1aa3acf051..b5a917e37a45f 100644 --- a/core/io.carbon +++ b/core/io.carbon @@ -15,5 +15,4 @@ fn PrintChar(x: i32) -> i32 = "print.char"; fn ReadChar() -> i32 = "read.char"; // TODO: Change this to a global constant once they are fully supported. -// TODO: Use simply -1 once we support negate on an IntLiteral. -fn EOF() -> i32 { return -(1 as i32); } +fn EOF() -> i32 { return -1; } diff --git a/core/prelude/operators/arithmetic.carbon b/core/prelude/operators/arithmetic.carbon index 693d0571f2b42..36705e2cc5678 100644 --- a/core/prelude/operators/arithmetic.carbon +++ b/core/prelude/operators/arithmetic.carbon @@ -4,6 +4,8 @@ package Core library "prelude/operators/arithmetic"; +import library "prelude/types/int_literal"; + // Addition: `a + b`. interface Add { fn Op[self: Self](other: Self) -> Self; @@ -68,3 +70,30 @@ interface Mod { interface ModAssign { fn Op[addr self: Self*](other: Self); } + + +// Operations for IntLiteral. These need to be here because IntLiteral has no +// associated library of its own. +impl IntLiteral() as Add { + fn Op[self: Self](other: Self) -> Self = "int.sadd"; +} + +impl IntLiteral() as Div { + fn Op[self: Self](other: Self) -> Self = "int.sdiv"; +} + +impl IntLiteral() as Mod { + fn Op[self: Self](other: Self) -> Self = "int.smod"; +} + +impl IntLiteral() as Mul { + fn Op[self: Self](other: Self) -> Self = "int.smul"; +} + +impl IntLiteral() as Negate { + fn Op[self: Self]() -> Self = "int.snegate"; +} + +impl IntLiteral() as Sub { + fn Op[self: Self](other: Self) -> Self = "int.ssub"; +} diff --git a/core/prelude/operators/bitwise.carbon b/core/prelude/operators/bitwise.carbon index 30e665c294063..1eecda4b94b06 100644 --- a/core/prelude/operators/bitwise.carbon +++ b/core/prelude/operators/bitwise.carbon @@ -4,6 +4,8 @@ package Core library "prelude/operators/bitwise"; +import library "prelude/types/int_literal"; + // Bit complement: `^a`. interface BitComplement { fn Op[self: Self]() -> Self; @@ -58,3 +60,30 @@ interface RightShift { interface RightShiftAssign { fn Op[addr self: Self*](other: Self); } + + +// Operations for IntLiteral. These need to be here because IntLiteral has no +// associated library of its own. +impl IntLiteral() as BitAnd { + fn Op[self: Self](other: Self) -> Self = "int.and"; +} + +impl IntLiteral() as BitComplement { + fn Op[self: Self]() -> Self = "int.complement"; +} + +impl IntLiteral() as BitOr { + fn Op[self: Self](other: Self) -> Self = "int.or"; +} + +impl IntLiteral() as BitXor { + fn Op[self: Self](other: Self) -> Self = "int.xor"; +} + +impl IntLiteral() as LeftShift { + fn Op[self: Self](other: Self) -> Self = "int.left_shift"; +} + +impl IntLiteral() as RightShift { + fn Op[self: Self](other: Self) -> Self = "int.right_shift"; +} diff --git a/core/prelude/operators/comparison.carbon b/core/prelude/operators/comparison.carbon index 7a76a70361f83..45d48b3fbfa2e 100644 --- a/core/prelude/operators/comparison.carbon +++ b/core/prelude/operators/comparison.carbon @@ -5,6 +5,7 @@ package Core library "prelude/operators/comparison"; export import library "prelude/types/bool"; +import library "prelude/types/int_literal"; // Equality comparison: `a == b` and `a != b`. interface Eq { @@ -28,3 +29,19 @@ impl bool as Eq { fn Equal[self: Self](other: Self) -> bool = "bool.eq"; fn NotEqual[self: Self](other: Self) -> bool = "bool.neq"; } + + +// Operations for IntLiteral. These need to be here because IntLiteral has no +// associated library of its own. +impl IntLiteral() as Eq { + fn Equal[self: Self](other: Self) -> bool = "int.eq"; + fn NotEqual[self: Self](other: Self) -> bool = "int.neq"; +} + +impl IntLiteral() as Ordered { + // TODO: fn Compare + fn Less[self: Self](other: Self) -> bool = "int.less"; + fn LessOrEquivalent[self: Self](other: Self) -> bool = "int.less_eq"; + fn Greater[self: Self](other: Self) -> bool = "int.greater"; + fn GreaterOrEquivalent[self: Self](other: Self) -> bool = "int.greater_eq"; +} diff --git a/toolchain/base/int.h b/toolchain/base/int.h index 712afb3fa75c8..918180fa467b4 100644 --- a/toolchain/base/int.h +++ b/toolchain/base/int.h @@ -232,6 +232,14 @@ constexpr int32_t IntId::InvalidIndex = Invalid.AsIndex(); // an array of `APInt` values and represented as an index in the ID. class IntStore { public: + // The maximum supported bit width of an integer type. + // TODO: Pick a maximum size and document it in the design. For now + // we use 2^^23, because that's the largest size that LLVM supports. + static constexpr int MaxIntWidth = 1 << 23; + + // Pick a canonical bit width for the provided number of significant bits. + static auto CanonicalBitWidth(int significant_bits) -> int; + // Accepts a signed `int64_t` and uses the mathematical signed integer value // of it as the added integer value. // @@ -395,9 +403,6 @@ class IntStore { return IntId::Invalid; } - // Pick a canonical bit width for the provided number of significant bits. - static auto CanonicalBitWidth(int significant_bits) -> int; - // Canonicalize an incoming signed APInt to the correct bit width. static auto CanonicalizeSigned(llvm::APInt value) -> llvm::APInt; diff --git a/toolchain/check/eval.cpp b/toolchain/check/eval.cpp index bc118f8c19c80..aa25e17109603 100644 --- a/toolchain/check/eval.cpp +++ b/toolchain/check/eval.cpp @@ -667,17 +667,14 @@ static auto ValidateIntType(Context& context, SemIRLoc loc, {.type = bit_width->type_id, .value = bit_width_val}); return false; } - // TODO: Pick a maximum size and document it in the design. For now - // we use 2^^23, because that's the largest size that LLVM supports. - constexpr int MaxIntWidth = 1 << 23; - if (bit_width_val.ugt(MaxIntWidth)) { + if (bit_width_val.ugt(IntStore::MaxIntWidth)) { CARBON_DIAGNOSTIC(IntWidthTooLarge, Error, "integer type width of {0} is greater than the " "maximum supported width of {1}", TypedInt, int); context.emitter().Emit(loc, IntWidthTooLarge, {.type = bit_width->type_id, .value = bit_width_val}, - MaxIntWidth); + IntStore::MaxIntWidth); return false; } return true; @@ -769,6 +766,15 @@ static auto DiagnoseDivisionByZero(Context& context, SemIRLoc loc) -> void { context.emitter().Emit(loc, CompileTimeDivisionByZero); } +// Get an integer at a suitable bit-width: either `bit_width_id` if it is valid, +// or the canonical width from the value store if not. +static auto GetIntAtSuitableWidth(Context& context, IntId int_id, + IntId bit_width_id) -> llvm::APInt { + return bit_width_id.is_valid() + ? context.ints().GetAtWidth(int_id, bit_width_id) + : context.ints().Get(int_id); +} + // Performs a builtin unary integer -> integer operation. static auto PerformBuiltinUnaryIntOp(Context& context, SemIRLoc loc, SemIR::BuiltinFunctionKind builtin_kind, @@ -777,24 +783,34 @@ static auto PerformBuiltinUnaryIntOp(Context& context, SemIRLoc loc, auto op = context.insts().GetAs(arg_id); auto [is_signed, bit_width_id] = context.sem_ir().types().GetIntTypeInfo(op.type_id); - CARBON_CHECK(bit_width_id != IntId::Invalid, - "Cannot evaluate a generic bit width integer: {0}", op); - llvm::APInt op_val = context.ints().GetAtWidth(op.int_id, bit_width_id); + llvm::APInt op_val = GetIntAtSuitableWidth(context, op.int_id, bit_width_id); switch (builtin_kind) { case SemIR::BuiltinFunctionKind::IntSNegate: if (op_val.isMinSignedValue()) { - CARBON_DIAGNOSTIC(CompileTimeIntegerNegateOverflow, Error, - "integer overflow in negation of {0}", TypedInt); - context.emitter().Emit(loc, CompileTimeIntegerNegateOverflow, - {.type = op.type_id, .value = op_val}); + if (bit_width_id.is_valid()) { + CARBON_DIAGNOSTIC(CompileTimeIntegerNegateOverflow, Error, + "integer overflow in negation of {0}", TypedInt); + context.emitter().Emit(loc, CompileTimeIntegerNegateOverflow, + {.type = op.type_id, .value = op_val}); + } else { + // Widen the integer so we don't overflow into the sign bit. + op_val = op_val.sext(op_val.getBitWidth() + + llvm::APInt::APINT_BITS_PER_WORD); + } } op_val.negate(); break; case SemIR::BuiltinFunctionKind::IntUNegate: + CARBON_CHECK(bit_width_id.is_valid(), "Unsigned negate on unsized int"); op_val.negate(); break; case SemIR::BuiltinFunctionKind::IntComplement: + // TODO: Should we have separate builtins for signed and unsigned + // complement? Like with signed/unsigned negate, these operations do + // different things to the integer value, even though they do the same + // thing to the bits. We treat IntLiteral complement as signed complement, + // given that the result of unsigned complement depends on the bit width. op_val.flipAllBits(); break; default: @@ -804,80 +820,53 @@ static auto PerformBuiltinUnaryIntOp(Context& context, SemIRLoc loc, return MakeIntResult(context, op.type_id, is_signed, std::move(op_val)); } -// Performs a builtin binary integer -> integer operation. -static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, - SemIR::BuiltinFunctionKind builtin_kind, - SemIR::InstId lhs_id, - SemIR::InstId rhs_id) - -> SemIR::ConstantId { - auto lhs = context.insts().GetAs(lhs_id); - auto rhs = context.insts().GetAs(rhs_id); - - // Check for division by zero. - switch (builtin_kind) { - case SemIR::BuiltinFunctionKind::IntSDiv: - case SemIR::BuiltinFunctionKind::IntSMod: - case SemIR::BuiltinFunctionKind::IntUDiv: - case SemIR::BuiltinFunctionKind::IntUMod: - if (context.ints().Get(rhs.int_id).isZero()) { - DiagnoseDivisionByZero(context, loc); - return SemIR::ErrorInst::SingletonConstantId; - } - break; - default: - break; - } - - auto [lhs_is_signed, lhs_bit_width_id] = - context.sem_ir().types().GetIntTypeInfo(lhs.type_id); - llvm::APInt lhs_val = context.ints().GetAtWidth(lhs.int_id, lhs_bit_width_id); - - llvm::APInt result_val; - - // First handle shift, which can directly use the canonical RHS and doesn't - // overflow. - switch (builtin_kind) { - // Bit shift. - case SemIR::BuiltinFunctionKind::IntLeftShift: - case SemIR::BuiltinFunctionKind::IntRightShift: { - const auto& rhs_orig_val = context.ints().Get(rhs.int_id); - if (rhs_orig_val.uge(lhs_val.getBitWidth()) || - (rhs_orig_val.isNegative() && lhs_is_signed)) { - CARBON_DIAGNOSTIC( - CompileTimeShiftOutOfRange, Error, - "shift distance not in range [0, {0}) in {1} {2:<<|>>} {3}", - unsigned, TypedInt, BoolAsSelect, TypedInt); - context.emitter().Emit( - loc, CompileTimeShiftOutOfRange, lhs_val.getBitWidth(), - {.type = lhs.type_id, .value = lhs_val}, - builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift, - {.type = rhs.type_id, .value = rhs_orig_val}); - // TODO: Is it useful to recover by returning 0 or -1? - return SemIR::ErrorInst::SingletonConstantId; - } +namespace { +// A pair of APInts that are the operands of a binary operator. We use an +// aggregate rather than `std::pair` to allow RVO of the individual ints. +struct APIntBinaryOperands { + llvm::APInt lhs; + llvm::APInt rhs; +}; +} // namespace - if (builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift) { - result_val = lhs_val.shl(rhs_orig_val); - } else if (lhs_is_signed) { - result_val = lhs_val.ashr(rhs_orig_val); +// Get a pair of integers at the same suitable bit-width: either their actual +// width if they have a fixed width, or the smallest canonical width in which +// they both fit otherwise. +static auto GetIntsAtSuitableWidth(Context& context, IntId lhs_id, IntId rhs_id, + IntId bit_width_id) -> APIntBinaryOperands { + // Unsized operands: take the wider of the bit widths. + if (!bit_width_id.is_valid()) { + APIntBinaryOperands result = {.lhs = context.ints().Get(lhs_id), + .rhs = context.ints().Get(rhs_id)}; + if (result.lhs.getBitWidth() != result.rhs.getBitWidth()) { + if (result.lhs.getBitWidth() > result.rhs.getBitWidth()) { + result.rhs = result.rhs.sext(result.lhs.getBitWidth()); } else { - result_val = lhs_val.lshr(rhs_orig_val); + result.lhs = result.lhs.sext(result.rhs.getBitWidth()); } - return MakeIntResult(context, lhs.type_id, lhs_is_signed, - std::move(result_val)); } - - default: - // Break to do additional setup for other builtin kinds. - break; + return result; } - // Other operations are already checked to be homogeneous, so we can extend - // the RHS with the LHS bit width. - CARBON_CHECK(rhs.type_id == lhs.type_id, "Heterogeneous builtin integer op!"); - llvm::APInt rhs_val = context.ints().GetAtWidth(rhs.int_id, lhs_bit_width_id); + return {.lhs = context.ints().GetAtWidth(lhs_id, bit_width_id), + .rhs = context.ints().GetAtWidth(rhs_id, bit_width_id)}; +} + +namespace { +// The result of performing a binary int operation. +struct BinaryIntOpResult { + llvm::APInt result_val; + bool overflow; + Lex::TokenKind op_token; +}; +} // namespace - // We may also need to diagnose overflow for these operations. +// Computes the result of a homogeneous binary (int, int) -> int operation. +static auto ComputeBinaryIntOpResult(SemIR::BuiltinFunctionKind builtin_kind, + const llvm::APInt& lhs_val, + const llvm::APInt& rhs_val) + -> BinaryIntOpResult { + llvm::APInt result_val; bool overflow = false; Lex::TokenKind op_token = Lex::TokenKind::Not; @@ -943,23 +932,165 @@ static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, case SemIR::BuiltinFunctionKind::IntLeftShift: case SemIR::BuiltinFunctionKind::IntRightShift: - CARBON_FATAL("Handled specially above."); + CARBON_FATAL("Non-homogeneous operation handled separately."); default: CARBON_FATAL("Unexpected operation kind."); } + return {.result_val = std::move(result_val), + .overflow = overflow, + .op_token = op_token}; +} + +// Performs a builtin integer bit shift operation. +static auto PerformBuiltinIntShiftOp(Context& context, SemIRLoc loc, + SemIR::BuiltinFunctionKind builtin_kind, + SemIR::InstId lhs_id, SemIR::InstId rhs_id) + -> SemIR::ConstantId { + auto lhs = context.insts().GetAs(lhs_id); + auto rhs = context.insts().GetAs(rhs_id); + + auto [lhs_is_signed, lhs_bit_width_id] = + context.sem_ir().types().GetIntTypeInfo(lhs.type_id); + + llvm::APInt lhs_val = + GetIntAtSuitableWidth(context, lhs.int_id, lhs_bit_width_id); + const auto& rhs_orig_val = context.ints().Get(rhs.int_id); + if (lhs_bit_width_id.is_valid() && rhs_orig_val.uge(lhs_val.getBitWidth())) { + CARBON_DIAGNOSTIC( + CompileTimeShiftOutOfRange, Error, + "shift distance >= type width of {0} in `{1} {2:<<|>>} {3}`", unsigned, + TypedInt, BoolAsSelect, TypedInt); + context.emitter().Emit( + loc, CompileTimeShiftOutOfRange, lhs_val.getBitWidth(), + {.type = lhs.type_id, .value = lhs_val}, + builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift, + {.type = rhs.type_id, .value = rhs_orig_val}); + // TODO: Is it useful to recover by returning 0 or -1? + return SemIR::ErrorInst::SingletonConstantId; + } + + if (rhs_orig_val.isNegative() && + context.sem_ir().types().IsSignedInt(rhs.type_id)) { + CARBON_DIAGNOSTIC(CompileTimeShiftNegative, Error, + "shift distance negative in `{0} {1:<<|>>} {2}`", + TypedInt, BoolAsSelect, TypedInt); + context.emitter().Emit( + loc, CompileTimeShiftNegative, {.type = lhs.type_id, .value = lhs_val}, + builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift, + {.type = rhs.type_id, .value = rhs_orig_val}); + // TODO: Is it useful to recover by returning 0 or -1? + return SemIR::ErrorInst::SingletonConstantId; + } + + llvm::APInt result_val; + if (builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift) { + if (!lhs_bit_width_id.is_valid() && !lhs_val.isZero()) { + // Ensure we don't generate a ridiculously large integer through a bit + // shift. + auto width = rhs_orig_val.trySExtValue(); + if (!width || + *width > IntStore::MaxIntWidth - lhs_val.getSignificantBits()) { + CARBON_DIAGNOSTIC(CompileTimeUnsizedShiftOutOfRange, Error, + "shift distance of {0} would result in an " + "integer whose width is greater than the " + "maximum supported width of {1}", + TypedInt, int); + context.emitter().Emit(loc, CompileTimeUnsizedShiftOutOfRange, + {.type = rhs.type_id, .value = rhs_orig_val}, + IntStore::MaxIntWidth); + return SemIR::ErrorInst::SingletonConstantId; + } + lhs_val = lhs_val.sext( + IntStore::CanonicalBitWidth(lhs_val.getSignificantBits() + *width)); + } + + result_val = + lhs_val.shl(rhs_orig_val.getLimitedValue(lhs_val.getBitWidth())); + } else if (lhs_is_signed) { + result_val = + lhs_val.ashr(rhs_orig_val.getLimitedValue(lhs_val.getBitWidth())); + } else { + CARBON_CHECK(lhs_bit_width_id.is_valid(), "Logical shift on unsized int"); + result_val = + lhs_val.lshr(rhs_orig_val.getLimitedValue(lhs_val.getBitWidth())); + } + return MakeIntResult(context, lhs.type_id, lhs_is_signed, + std::move(result_val)); +} + +// Performs a homogeneous builtin binary integer -> integer operation. +static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, + SemIR::BuiltinFunctionKind builtin_kind, + SemIR::InstId lhs_id, + SemIR::InstId rhs_id) + -> SemIR::ConstantId { + auto lhs = context.insts().GetAs(lhs_id); + auto rhs = context.insts().GetAs(rhs_id); + + CARBON_CHECK(rhs.type_id == lhs.type_id, "Heterogeneous builtin integer op!"); + auto type_id = lhs.type_id; + auto [is_signed, bit_width_id] = + context.sem_ir().types().GetIntTypeInfo(type_id); + auto [lhs_val, rhs_val] = + GetIntsAtSuitableWidth(context, lhs.int_id, rhs.int_id, bit_width_id); + + // Check for division by zero. + switch (builtin_kind) { + case SemIR::BuiltinFunctionKind::IntSDiv: + case SemIR::BuiltinFunctionKind::IntSMod: + case SemIR::BuiltinFunctionKind::IntUDiv: + case SemIR::BuiltinFunctionKind::IntUMod: + if (rhs_val.isZero()) { + DiagnoseDivisionByZero(context, loc); + return SemIR::ErrorInst::SingletonConstantId; + } + break; + default: + break; + } + + BinaryIntOpResult result = + ComputeBinaryIntOpResult(builtin_kind, lhs_val, rhs_val); + + if (result.overflow && !bit_width_id.is_valid()) { + // Retry with a larger bit width. Most operations can only overflow by one + // bit, but signed n-bit multiplication can overflow to 2n-1 bits. We don't + // need to handle unsigned multiplication here because it's not permitted + // for unsized integers. + // + // Note that we speculatively first perform the calculation in the width of + // the wider operand: smaller operations are faster and overflow to a wider + // integer is unlikely to be needed, especially given that the width will + // have been rounded up to a multiple of 64 bits by the int store. + CARBON_CHECK(builtin_kind != SemIR::BuiltinFunctionKind::IntUMul, + "Unsigned arithmetic requires a fixed bitwidth"); + int new_width = + builtin_kind == SemIR::BuiltinFunctionKind::IntSMul + ? lhs_val.getBitWidth() * 2 + : IntStore::CanonicalBitWidth(lhs_val.getBitWidth() + 1); + new_width = std::min(new_width, IntStore::MaxIntWidth); + lhs_val = context.ints().GetAtWidth(lhs.int_id, new_width); + rhs_val = context.ints().GetAtWidth(rhs.int_id, new_width); + + // Note that this can in theory still overflow if we limited `new_width` to + // `MaxIntWidth`. In that case we fall through to the signed overflow + // diagnostic below. + result = ComputeBinaryIntOpResult(builtin_kind, lhs_val, rhs_val); + CARBON_CHECK(!result.overflow || new_width == IntStore::MaxIntWidth); + } - if (overflow) { + if (result.overflow) { CARBON_DIAGNOSTIC(CompileTimeIntegerOverflow, Error, - "integer overflow in calculation {0} {1} {2}", TypedInt, + "integer overflow in calculation `{0} {1} {2}`", TypedInt, Lex::TokenKind, TypedInt); context.emitter().Emit(loc, CompileTimeIntegerOverflow, - {.type = lhs.type_id, .value = lhs_val}, op_token, - {.type = rhs.type_id, .value = rhs_val}); + {.type = type_id, .value = lhs_val}, result.op_token, + {.type = type_id, .value = rhs_val}); } - return MakeIntResult(context, lhs.type_id, lhs_is_signed, - std::move(result_val)); + return MakeIntResult(context, type_id, is_signed, + std::move(result.result_val)); } // Performs a builtin integer comparison. @@ -971,15 +1102,8 @@ static auto PerformBuiltinIntComparison(Context& context, -> SemIR::ConstantId { auto lhs = context.insts().GetAs(lhs_id); auto rhs = context.insts().GetAs(rhs_id); - CARBON_CHECK(lhs.type_id == rhs.type_id, - "Builtin comparison with mismatched types!"); - - auto [is_signed, bit_width_id] = - context.sem_ir().types().GetIntTypeInfo(lhs.type_id); - CARBON_CHECK(bit_width_id != IntId::Invalid, - "Cannot evaluate a generic bit width integer: {0}", lhs); - llvm::APInt lhs_val = context.ints().GetAtWidth(lhs.int_id, bit_width_id); - llvm::APInt rhs_val = context.ints().GetAtWidth(rhs.int_id, bit_width_id); + llvm::APInt lhs_val = context.ints().Get(lhs.int_id); + llvm::APInt rhs_val = context.ints().Get(rhs.int_id); bool result; switch (builtin_kind) { @@ -990,16 +1114,16 @@ static auto PerformBuiltinIntComparison(Context& context, result = (lhs_val != rhs_val); break; case SemIR::BuiltinFunctionKind::IntLess: - result = is_signed ? lhs_val.slt(rhs_val) : lhs_val.ult(rhs_val); + result = lhs_val.slt(rhs_val); break; case SemIR::BuiltinFunctionKind::IntLessEq: - result = is_signed ? lhs_val.sle(rhs_val) : lhs_val.ule(rhs_val); + result = lhs_val.sle(rhs_val); break; case SemIR::BuiltinFunctionKind::IntGreater: - result = is_signed ? lhs_val.sgt(rhs_val) : lhs_val.sgt(rhs_val); + result = lhs_val.sgt(rhs_val); break; case SemIR::BuiltinFunctionKind::IntGreaterEq: - result = is_signed ? lhs_val.sge(rhs_val) : lhs_val.sge(rhs_val); + result = lhs_val.sge(rhs_val); break; default: CARBON_FATAL("Unexpected operation kind."); @@ -1176,7 +1300,7 @@ static auto MakeConstantForBuiltinCall(Context& context, SemIRLoc loc, return PerformBuiltinUnaryIntOp(context, loc, builtin_kind, arg_ids[0]); } - // Binary integer -> integer operations. + // Homogeneous binary integer -> integer operations. case SemIR::BuiltinFunctionKind::IntSAdd: case SemIR::BuiltinFunctionKind::IntSSub: case SemIR::BuiltinFunctionKind::IntSMul: @@ -1189,9 +1313,7 @@ static auto MakeConstantForBuiltinCall(Context& context, SemIRLoc loc, case SemIR::BuiltinFunctionKind::IntUMod: case SemIR::BuiltinFunctionKind::IntAnd: case SemIR::BuiltinFunctionKind::IntOr: - case SemIR::BuiltinFunctionKind::IntXor: - case SemIR::BuiltinFunctionKind::IntLeftShift: - case SemIR::BuiltinFunctionKind::IntRightShift: { + case SemIR::BuiltinFunctionKind::IntXor: { if (phase != Phase::Template) { break; } @@ -1199,6 +1321,16 @@ static auto MakeConstantForBuiltinCall(Context& context, SemIRLoc loc, arg_ids[1]); } + // Bit shift operations. + case SemIR::BuiltinFunctionKind::IntLeftShift: + case SemIR::BuiltinFunctionKind::IntRightShift: { + if (phase != Phase::Template) { + break; + } + return PerformBuiltinIntShiftOp(context, loc, builtin_kind, arg_ids[0], + arg_ids[1]); + } + // Integer comparisons. case SemIR::BuiltinFunctionKind::IntEq: case SemIR::BuiltinFunctionKind::IntNeq: @@ -1311,7 +1443,9 @@ static auto MakeConstantForCall(EvalContext& eval_context, SemIRLoc loc, // If any operand of the call is non-constant, the call is non-constant. // TODO: Some builtin calls might allow some operands to be non-constant. if (!has_constant_operands) { - if (builtin_kind.IsCompTimeOnly()) { + if (builtin_kind.IsCompTimeOnly( + eval_context.sem_ir(), eval_context.inst_blocks().Get(call.args_id), + call.type_id)) { CARBON_DIAGNOSTIC(NonConstantCallToCompTimeOnlyFunction, Error, "non-constant call to compile-time-only function"); CARBON_DIAGNOSTIC(CompTimeOnlyFunctionHere, Note, diff --git a/toolchain/check/testdata/array/base.carbon b/toolchain/check/testdata/array/base.carbon index f186bef623c60..1bde258854861 100644 --- a/toolchain/check/testdata/array/base.carbon +++ b/toolchain/check/testdata/array/base.carbon @@ -49,7 +49,7 @@ var c: [(); 5] = ((), (), (), (), (),); // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Float = %import_ref.193 +// CHECK:STDOUT: .Float = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/basics/builtin_types.carbon b/toolchain/check/testdata/basics/builtin_types.carbon index a049b21d2cfcb..3937cb3a97156 100644 --- a/toolchain/check/testdata/basics/builtin_types.carbon +++ b/toolchain/check/testdata/basics/builtin_types.carbon @@ -34,7 +34,7 @@ var test_type: type = i32; // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Float = %import_ref.193 +// CHECK:STDOUT: .Float = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon b/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon index 454ace1a461b8..a5952ca460bac 100644 --- a/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon +++ b/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon @@ -60,7 +60,7 @@ let e: f64 = 5.0e39999999999999999993; // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Float = %import_ref.193 +// CHECK:STDOUT: .Float = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/basics/numeric_literals.carbon b/toolchain/check/testdata/basics/numeric_literals.carbon index 90f6965dfedf3..110e85d0d1529 100644 --- a/toolchain/check/testdata/basics/numeric_literals.carbon +++ b/toolchain/check/testdata/basics/numeric_literals.carbon @@ -77,7 +77,7 @@ fn F() { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Float = %import_ref.193 +// CHECK:STDOUT: .Float = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/float/make_type.carbon b/toolchain/check/testdata/builtins/float/make_type.carbon index 26b97383e7c95..1148e06d10954 100644 --- a/toolchain/check/testdata/builtins/float/make_type.carbon +++ b/toolchain/check/testdata/builtins/float/make_type.carbon @@ -102,7 +102,7 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: %import_ref.1: %Float.type = import_ref Main//types, Float, loaded [template = constants.%Float] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Int = %import_ref.193 +// CHECK:STDOUT: .Int = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -176,7 +176,7 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: %import_ref.1: %Float.type = import_ref Main//types, Float, loaded [template = constants.%Float] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Int = %import_ref.193 +// CHECK:STDOUT: .Int = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/and.carbon b/toolchain/check/testdata/builtins/int/and.carbon index 325f6f0ff821d..944f35971a047 100644 --- a/toolchain/check/testdata/builtins/int/and.carbon +++ b/toolchain/check/testdata/builtins/int/and.carbon @@ -12,6 +12,8 @@ // --- int_and.carbon +library "[[@TEST_NAME]]"; + fn And(a: i32, b: i32) -> i32 = "int.and"; var arr: [i32; And(12, 10)]; @@ -20,3 +22,100 @@ let arr_p: [i32; 8]* = &arr; fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return And(a, b); } + +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn And(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; + +class Expect(N:! Core.IntLiteral()) {} +fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; } + +fn F() { + Test(And(1, 2)) as Expect(0); + Test(And(12, 10)) as Expect(8); + + Test(And(1, -1)) as Expect(1); + Test(And(-2, -3)) as Expect(-4); + // Ensure the sign bit is treated properly even for 64-bit numbers. + Test(And(0x7FFF_FFFF_FFFF_FFFF, -3)) as Expect(0x7FFF_FFFF_FFFF_FFFD); + Test(And(0x8000_0000_0000_0000, -1)) as Expect(0x8000_0000_0000_0000); +} + +// --- fail_literal_runtime.carbon + +library "[[@TEST_NAME]]"; + +fn AndLit(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; + +fn F(a: Core.IntLiteral()) -> Core.IntLiteral() { + // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+7]]:10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: return AndLit(5, a); + // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-6]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn AndLit(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + return AndLit(5, a); +} + +// --- fail_bad_decl.carbon + +library "[[@TEST_NAME]]"; + +// Heterogeneous "and" is not supported. +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] +// CHECK:STDERR: fn MixedAnd1(a: i32, b: Core.IntLiteral()) -> i32 = "int.and"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn MixedAnd1(a: i32, b: Core.IntLiteral()) -> i32 = "int.and"; +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] +// CHECK:STDERR: fn MixedAnd2(a: Core.IntLiteral(), b: i32) -> i32 = "int.and"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn MixedAnd2(a: Core.IntLiteral(), b: i32) -> i32 = "int.and"; +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] +// CHECK:STDERR: fn MixedAnd3(a: i32, b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn MixedAnd3(a: i32, b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] +// CHECK:STDERR: fn MixedAnd4(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.and"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn MixedAnd4(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.and"; + +// --- fail_runtime_literal.carbon + +library "[[@TEST_NAME]]"; + +fn And(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; + +fn Test(n: Core.IntLiteral()) { + // OK + And(1, 1); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: And(n, 1); + // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-8]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn And(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + And(n, 1); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: And(1, n); + // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-16]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn And(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + And(1, n); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+6]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: And(n, n); + // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-24]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn And(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + And(n, n); +} diff --git a/toolchain/check/testdata/builtins/int/complement.carbon b/toolchain/check/testdata/builtins/int/complement.carbon index ddcb047d88f73..7fddbd691d72b 100644 --- a/toolchain/check/testdata/builtins/int/complement.carbon +++ b/toolchain/check/testdata/builtins/int/complement.carbon @@ -12,6 +12,8 @@ // --- int_complement.carbon +library "[[@TEST_NAME]]"; + fn Complement(a: i32) -> i32 = "int.complement"; fn And(a: i32, b: i32) -> i32 = "int.and"; @@ -21,3 +23,38 @@ let arr_p: [i32; 0xEDCBA9]* = &arr; fn RuntimeCallIsValid(a: i32) -> i32 { return Complement(a); } + +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn Complement(a: Core.IntLiteral()) -> Core.IntLiteral() = "int.complement"; + +class Expect(N:! Core.IntLiteral()) {} +fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; } + +fn F() { + Test(Complement(0)) as Expect(-1); + Test(Complement(1)) as Expect(-2); + Test(Complement(-1)) as Expect(0); + Test(Complement(-0x7FFF_FFFF_FFFF_FFFF)) as Expect(0x7FFF_FFFF_FFFF_FFFE); + Test(Complement(-0x8000_0000_0000_0000)) as Expect(0x7FFF_FFFF_FFFF_FFFF); + Test(Complement(0x7FFF_FFFF_FFFF_FFFF)) as Expect(-0x8000_0000_0000_0000); + Test(Complement(0x8000_0000_0000_0000)) as Expect(-0x8000_0000_0000_0001); +} + +// --- fail_literal_runtime.carbon + +library "[[@TEST_NAME]]"; + +fn Complement(a: Core.IntLiteral()) -> Core.IntLiteral() = "int.complement"; + +fn F(a: Core.IntLiteral()) -> Core.IntLiteral() { + // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+6]]:10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: return Complement(a); + // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-6]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn Complement(a: Core.IntLiteral()) -> Core.IntLiteral() = "int.complement"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + return Complement(a); +} diff --git a/toolchain/check/testdata/builtins/int/eq.carbon b/toolchain/check/testdata/builtins/int/eq.carbon index 2700539af9293..efea564018822 100644 --- a/toolchain/check/testdata/builtins/int/eq.carbon +++ b/toolchain/check/testdata/builtins/int/eq.carbon @@ -12,6 +12,8 @@ // --- int_eq.carbon +library "[[@TEST_NAME]]"; + fn Eq(a: i32, b: i32) -> bool = "int.eq"; class True {} @@ -30,7 +32,74 @@ fn RuntimeCallIsValid(a: i32, b: i32) -> bool { package FailBadDecl; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error: invalid signature for builtin function "int.eq" [InvalidBuiltinSignature] +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.eq" [InvalidBuiltinSignature] // CHECK:STDERR: fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; + +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn Eq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.eq"; + +class Expect(B:! bool) {} +fn Test(B:! bool) -> Expect(B) { return {}; } + +fn F() { + Test(Eq(5, 5)) as Expect(true); + Test(Eq(5, 6)) as Expect(false); + Test(Eq(-1, -1)) as Expect(true); + Test(Eq(-1, 1)) as Expect(false); +} + +// --- mixed.carbon + +library "[[@TEST_NAME]]"; + +fn Eq(a: Core.IntLiteral(), b: i32) -> bool = "int.eq"; + +class Expect(B:! bool) {} +fn Test(B:! bool) -> Expect(B) { return {}; } + +fn F() { + Test(Eq(5, 5)) as Expect(true); + Test(Eq(5, 6)) as Expect(false); + Test(Eq(-1, -1)) as Expect(true); + Test(Eq(-1, 1)) as Expect(false); +} + +// --- fail_runtime_literal.carbon + +library "[[@TEST_NAME]]"; + +fn Eq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.eq"; + +fn Test(n: Core.IntLiteral()) { + // OK + Eq(1, 1); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: Eq(n, 1); + // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-8]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn Eq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.eq"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + Eq(n, 1); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: Eq(1, n); + // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-16]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn Eq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.eq"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + Eq(1, n); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+6]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: Eq(n, n); + // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-24]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn Eq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.eq"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Eq(n, n); +} diff --git a/toolchain/check/testdata/builtins/int/greater_eq.carbon b/toolchain/check/testdata/builtins/int/greater_eq.carbon index 952e906458a0a..54e978d3a40f7 100644 --- a/toolchain/check/testdata/builtins/int/greater_eq.carbon +++ b/toolchain/check/testdata/builtins/int/greater_eq.carbon @@ -12,6 +12,8 @@ // --- int_greater_eq.carbon +library "[[@TEST_NAME]]"; + fn GreaterEq(a: i32, b: i32) -> bool = "int.greater_eq"; fn Negate(a: i32) -> i32 = "int.snegate"; @@ -29,3 +31,39 @@ fn F(true_: True, false_: False) { fn RuntimeCallIsValid(a: i32, b: i32) -> bool { return GreaterEq(a, b); } + +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn GreaterEq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.greater_eq"; + +class Expect(B:! bool) {} +fn Test(B:! bool) -> Expect(B) { return {}; } + +fn F() { + Test(GreaterEq(5, 5)) as Expect(true); + Test(GreaterEq(5, 6)) as Expect(false); + Test(GreaterEq(6, 5)) as Expect(true); + Test(GreaterEq(-1, -1)) as Expect(true); + Test(GreaterEq(-1, 1)) as Expect(false); + Test(GreaterEq(1, -1)) as Expect(true); +} + +// --- mixed.carbon + +library "[[@TEST_NAME]]"; + +fn GreaterEq(a: Core.IntLiteral(), b: i32) -> bool = "int.greater_eq"; + +class Expect(B:! bool) {} +fn Test(B:! bool) -> Expect(B) { return {}; } + +fn F() { + Test(GreaterEq(5, 5)) as Expect(true); + Test(GreaterEq(5, 6)) as Expect(false); + Test(GreaterEq(6, 5)) as Expect(true); + Test(GreaterEq(-1, -1)) as Expect(true); + Test(GreaterEq(-1, 1)) as Expect(false); + Test(GreaterEq(1, -1)) as Expect(true); +} diff --git a/toolchain/check/testdata/builtins/int/left_shift.carbon b/toolchain/check/testdata/builtins/int/left_shift.carbon index 47a7036515f12..b749abe4942fa 100644 --- a/toolchain/check/testdata/builtins/int/left_shift.carbon +++ b/toolchain/check/testdata/builtins/int/left_shift.carbon @@ -10,34 +10,109 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/left_shift.carbon -// --- int_left_shift.carbon +// --- i32.carbon + +library "[[@TEST_NAME]]"; + +class Expect(N:! i32) {} +fn Test(N:! i32) -> Expect(N) { return {}; } fn LeftShift(a: i32, b: i32) -> i32 = "int.left_shift"; -var arr: [i32; LeftShift(5, 2)]; -let arr_p: [i32; 20]* = &arr; +fn F() { + Test(LeftShift(0, 0)) as Expect(0); + Test(LeftShift(0, 1)) as Expect(0); + Test(LeftShift(0, 30)) as Expect(0); + Test(LeftShift(1, 30)) as Expect(0x4000_0000); + Test(LeftShift(5, 2)) as Expect(20); + Test(LeftShift(-1, 1)) as Expect(-2); + Test(LeftShift(-2, 1)) as Expect(-4); + Test(LeftShift(-3, 1)) as Expect(-6); +} fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return LeftShift(a, b); } -// TODO: Test mixed types for LHS and RHS. +// --- u32.carbon + +library "[[@TEST_NAME]]"; + +class Expect(N:! u32) {} +fn Test(N:! u32) -> Expect(N) { return {}; } + +fn LeftShift(a: u32, b: i32) -> u32 = "int.left_shift"; + +fn F() { + Test(LeftShift(0, 0)) as Expect(0); + Test(LeftShift(0, 1)) as Expect(0); + Test(LeftShift(0, 30)) as Expect(0); + Test(LeftShift(1, 30)) as Expect(0x4000_0000); + Test(LeftShift(5, 2)) as Expect(20); + Test(LeftShift(0xFFFF_FFFF, 1)) as Expect(0xFFFF_FFFE); + Test(LeftShift(0xFFFF_FFFE, 1)) as Expect(0xFFFF_FFFC); + Test(LeftShift(0xABCD_EF01, 8)) as Expect(0xCDEF_0100); +} + +fn RuntimeCall(a: u32, b: i32) -> u32 { + return LeftShift(a, b); +} + +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn LeftShift(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.left_shift"; + +class Expect(N:! Core.IntLiteral()) {} +fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; } + +fn F() { + // Zero can be shifted by any amount. + Test(LeftShift(0, 0)) as Expect(0); + Test(LeftShift(0, 0)) as Expect(0); + Test(LeftShift(0, 1)) as Expect(0); + Test(LeftShift(0, 30)) as Expect(0); + Test(LeftShift(0, 1_000_000_000)) as Expect(0); + + // Positive numbers can be shifted. + Test(LeftShift(1, 0)) as Expect(1); + Test(LeftShift(1, 1)) as Expect(2); + Test(LeftShift(2, 1)) as Expect(4); + Test(LeftShift(1, 2)) as Expect(4); + Test(LeftShift(3, 2)) as Expect(12); + Test(LeftShift(1, 30)) as Expect(0x4000_0000); + Test(LeftShift(5, 2)) as Expect(20); + + // Negative numbers can be shifted too. + Test(LeftShift(-1, 0)) as Expect(-1); + Test(LeftShift(-1, 1)) as Expect(-2); + Test(LeftShift(-2, 1)) as Expect(-4); + Test(LeftShift(-3, 1)) as Expect(-6); + + // Large numbers can be shifted losslessly. + Test(LeftShift(0xFFFF_FFFF, 1)) as Expect(0x1_FFFF_FFFE); + Test(LeftShift(0xFFFF_FFFE, 1)) as Expect(0x1_FFFF_FFFC); + Test(LeftShift(0xABCD_EF01, 8)) as Expect(0xAB_CDEF_0100); + Test(LeftShift(0x7FFF_FFFF_FFFF_FFFF, 1)) as Expect(0xFFFF_FFFF_FFFF_FFFE); + Test(LeftShift(0xFFFF_FFFF_FFFF_FFFF, 1)) as Expect(0x1_FFFF_FFFF_FFFF_FFFE); +} // --- fail_bad_shift.carbon -package BadShift; +library "[[@TEST_NAME]]"; fn LeftShift(a: i32, b: i32) -> i32 = "int.left_shift"; -fn Negate(a: i32) -> i32 = "int.snegate"; +fn LeftShiftLit(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.left_shift"; -// Shift greater than size is disallowed. +// Shift greater than size is disallowed for sized types. let size_1: i32 = LeftShift(1, 31); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance not in range [0, 32) in 1 << 32 [CompileTimeShiftOutOfRange] +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance >= type width of 32 in `1 << 32` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let size_2: i32 = LeftShift(1, 32); // CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: let size_2: i32 = LeftShift(1, 32); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance not in range [0, 32) in 1 << 33 [CompileTimeShiftOutOfRange] +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance >= type width of 32 in `1 << 33` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let size_3: i32 = LeftShift(1, 33); // CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -45,7 +120,7 @@ let size_3: i32 = LeftShift(1, 33); // Overflow is allowed if the shift distance is in bounds. let overflow_1: i32 = LeftShift(1000, 31); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:23: error: shift distance not in range [0, 32) in 1000 << 32 [CompileTimeShiftOutOfRange] +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:23: error: shift distance >= type width of 32 in `1000 << 32` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let overflow_2: i32 = LeftShift(1000, 32); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -53,14 +128,97 @@ let overflow_2: i32 = LeftShift(1000, 32); // Oversize shifts aren't allowed even if there's no overflow. let no_overflow_1: i32 = LeftShift(0, 31); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:26: error: shift distance not in range [0, 32) in 0 << 32 [CompileTimeShiftOutOfRange] +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:26: error: shift distance >= type width of 32 in `0 << 32` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let no_overflow_2: i32 = LeftShift(0, 32); // CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: let no_overflow_2: i32 = LeftShift(0, 32); -// Negative shifts aren't allowed either. -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+3]]:21: error: shift distance not in range [0, 32) in 1 << -1 [CompileTimeShiftOutOfRange] -// CHECK:STDERR: let negative: i32 = LeftShift(1, Negate(1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ -let negative: i32 = LeftShift(1, Negate(1)); +// Negative shifts aren't allowed either, even for literals, even if the lhs is zero. +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:21: error: shift distance >= type width of 32 in `1 << -1` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: let negative: i32 = LeftShift(1, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let negative: i32 = LeftShift(1, -1); +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:26: error: shift distance >= type width of 32 in `0 << -1` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: let negative_zero: i32 = LeftShift(0, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let negative_zero: i32 = LeftShift(0, -1); +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:39: error: shift distance negative in `1 << -1` [CompileTimeShiftNegative] +// CHECK:STDERR: let negative_lit: Core.IntLiteral() = LeftShiftLit(1, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let negative_lit: Core.IntLiteral() = LeftShiftLit(1, -1); +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:44: error: shift distance negative in `0 << -1` [CompileTimeShiftNegative] +// CHECK:STDERR: let negative_lit_zero: Core.IntLiteral() = LeftShiftLit(0, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let negative_lit_zero: Core.IntLiteral() = LeftShiftLit(0, -1); + +// --- fail_literal_overflow.carbon + +library "[[@TEST_NAME]]"; + +fn LeftShift(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.left_shift"; + +// CHECK:STDERR: fail_literal_overflow.carbon:[[@LINE+4]]:16: error: shift distance of 1000000000 would result in an integer whose width is greater than the maximum supported width of 8388608 [CompileTimeUnsizedShiftOutOfRange] +// CHECK:STDERR: let bad: i32 = LeftShift(1, 1_000_000_000); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let bad: i32 = LeftShift(1, 1_000_000_000); + +// CHECK:STDERR: fail_literal_overflow.carbon:[[@LINE+4]]:25: error: shift distance of 1000000000 would result in an integer whose width is greater than the maximum supported width of 8388608 [CompileTimeUnsizedShiftOutOfRange] +// CHECK:STDERR: let bad_negative: i32 = LeftShift(-1, 1_000_000_000); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let bad_negative: i32 = LeftShift(-1, 1_000_000_000); + +// --- fail_comp_time_only_shift.carbon + +library "[[@TEST_NAME]]"; + +fn LeftShiftByLit(a: i32, b: Core.IntLiteral()) -> i32 = "int.left_shift"; +fn LeftShiftOfLit(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.left_shift"; + +var a_lit: Core.IntLiteral() = 12; +var an_i32: i32 = 34; + +// This can't be valid: we don't have a compile-time or runtime integer value for `a_lit`. +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+7]]:17: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: let bad1: i32 = LeftShiftByLit(an_i32, a_lit); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-10]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: fn LeftShiftByLit(a: i32, b: Core.IntLiteral()) -> i32 = "int.left_shift"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let bad1: i32 = LeftShiftByLit(an_i32, a_lit); + +// TODO: This could be valid because we don't actually need the return value at runtime. +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+7]]:31: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: let bad2: Core.IntLiteral() = LeftShiftOfLit(a_lit, an_i32); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-19]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: fn LeftShiftOfLit(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.left_shift"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let bad2: Core.IntLiteral() = LeftShiftOfLit(a_lit, an_i32); + +// TODO: This could be valid because the literal argument has a constant value. +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+7]]:17: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: let bad3: i32 = LeftShiftByLit(an_i32, 12); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-30]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: fn LeftShiftByLit(a: i32, b: Core.IntLiteral()) -> i32 = "int.left_shift"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let bad3: i32 = LeftShiftByLit(an_i32, 12); + +// TODO: This could be valid because we don't actually need the return value at runtime. +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+6]]:31: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: let bad4: Core.IntLiteral() = LeftShiftOfLit(12, an_i32); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-39]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: fn LeftShiftOfLit(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.left_shift"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +let bad4: Core.IntLiteral() = LeftShiftOfLit(12, an_i32); diff --git a/toolchain/check/testdata/builtins/int/less_eq.carbon b/toolchain/check/testdata/builtins/int/less_eq.carbon index 6ae44f2efd2d0..7b170bfd06dea 100644 --- a/toolchain/check/testdata/builtins/int/less_eq.carbon +++ b/toolchain/check/testdata/builtins/int/less_eq.carbon @@ -12,6 +12,8 @@ // --- int_less_eq.carbon +library "[[@TEST_NAME]]"; + fn LessEq(a: i32, b: i32) -> bool = "int.less_eq"; fn Negate(a: i32) -> i32 = "int.snegate"; @@ -29,3 +31,73 @@ fn F(true_: True, false_: False) { fn RuntimeCallIsValid(a: i32, b: i32) -> bool { return LessEq(a, b); } + +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn LessEq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.less_eq"; + +class Expect(B:! bool) {} +fn Test(B:! bool) -> Expect(B) { return {}; } + +fn F() { + Test(LessEq(5, 5)) as Expect(true); + Test(LessEq(5, 6)) as Expect(true); + Test(LessEq(6, 5)) as Expect(false); + Test(LessEq(-1, -1)) as Expect(true); + Test(LessEq(-1, 1)) as Expect(true); + Test(LessEq(1, -1)) as Expect(false); +} + +// --- mixed.carbon + +library "[[@TEST_NAME]]"; + +fn LessEq(a: Core.IntLiteral(), b: i32) -> bool = "int.less_eq"; + +class Expect(B:! bool) {} +fn Test(B:! bool) -> Expect(B) { return {}; } + +fn F() { + Test(LessEq(5, 5)) as Expect(true); + Test(LessEq(5, 6)) as Expect(true); + Test(LessEq(6, 5)) as Expect(false); + Test(LessEq(-1, -1)) as Expect(true); + Test(LessEq(-1, 1)) as Expect(true); + Test(LessEq(1, -1)) as Expect(false); +} + +// --- fail_runtime_literal.carbon + +library "[[@TEST_NAME]]"; + +fn LessEq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.less_eq"; + +fn Test(n: Core.IntLiteral()) { + // OK + LessEq(1, 1); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: LessEq(n, 1); + // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-8]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn LessEq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.less_eq"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + LessEq(n, 1); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: LessEq(1, n); + // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-16]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn LessEq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.less_eq"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + LessEq(1, n); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+6]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: LessEq(n, n); + // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-24]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn LessEq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.less_eq"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + LessEq(n, n); +} diff --git a/toolchain/check/testdata/builtins/int/right_shift.carbon b/toolchain/check/testdata/builtins/int/right_shift.carbon index ead0fec1966a4..6581455108fb6 100644 --- a/toolchain/check/testdata/builtins/int/right_shift.carbon +++ b/toolchain/check/testdata/builtins/int/right_shift.carbon @@ -10,58 +10,119 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/right_shift.carbon -// --- int_right_shift.carbon +// --- i32.carbon + +library "[[@TEST_NAME]]"; + +class Expect(N:! i32) {} +fn Test(N:! i32) -> Expect(N) { return {}; } fn RightShift(a: i32, b: i32) -> i32 = "int.right_shift"; -var arr: [i32; RightShift(22, 2)]; -let arr_p: [i32; 5]* = &arr; +fn F() { + Test(RightShift(0, 31)) as Expect(0); + Test(RightShift(1, 31)) as Expect(0); + Test(RightShift(1, 0)) as Expect(1); + Test(RightShift(1, 2)) as Expect(0); + Test(RightShift(22, 2)) as Expect(5); + Test(RightShift(-1, 1)) as Expect(-1); + Test(RightShift(-2, 1)) as Expect(-1); + Test(RightShift(-10, 2)) as Expect(-3); +} fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return RightShift(a, b); } -// TODO: Test mixed types for LHS and RHS. +// --- u32.carbon -// --- arith_shift.carbon +library "[[@TEST_NAME]]"; -// TODO: Also test unsigned / logical right shift. +class Expect(N:! u32) {} +fn Test(N:! u32) -> Expect(N) { return {}; } -package ArithShift; +fn RightShift(a: u32, b: i32) -> u32 = "int.right_shift"; -fn RightShift(a: i32, b: i32) -> i32 = "int.right_shift"; -fn Negate(a: i32) -> i32 = "int.snegate"; +fn F() { + Test(RightShift(0, 31)) as Expect(0); + Test(RightShift(1, 31)) as Expect(0); + Test(RightShift(1, 0)) as Expect(1); + Test(RightShift(1, 2)) as Expect(0); + Test(RightShift(22, 2)) as Expect(5); + Test(RightShift(0xFFFF_FFFF, 1)) as Expect(0x7FFF_FFFF); + Test(RightShift(0xABCD_EF01, 8)) as Expect(0xAB_CDEF); +} -// -1 >> 1 is -1. -var arr1: [i32; Negate(RightShift(Negate(1), 1))]; -let arr1_p: [i32; 1]* = &arr1; +fn RuntimeCall(a: u32, b: i32) -> u32 { + return RightShift(a, b); +} -// -10 >> 2 is -3. -var arr2: [i32; Negate(RightShift(Negate(10), 2))]; -let arr2_p: [i32; 3]* = &arr2; +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn RightShift(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.right_shift"; + +class Expect(N:! Core.IntLiteral()) {} +fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; } + +fn F() { + Test(RightShift(0, 31)) as Expect(0); + Test(RightShift(1, 31)) as Expect(0); + Test(RightShift(1, 0)) as Expect(1); + Test(RightShift(1, 2)) as Expect(0); + Test(RightShift(22, 2)) as Expect(5); + Test(RightShift(-1, 1)) as Expect(-1); + Test(RightShift(-2, 1)) as Expect(-1); + Test(RightShift(-10, 2)) as Expect(-3); + Test(RightShift(0xFFFF_FFFF, 1)) as Expect(0x7FFF_FFFF); + Test(RightShift(0xABCD_EF01, 8)) as Expect(0xAB_CDEF); + + Test(RightShift(0x1234_5678, 1_000_000_000)) as Expect(0); + Test(RightShift(-0x1234_5678, 1_000_000_000)) as Expect(-1); + Test(RightShift(0xFFFF_FFFF_FFFF_FFFF, 1_000_000_000)) as Expect(0); + Test(RightShift(0x7FFF_FFFF_FFFF_FFFF, 1_000_000_000)) as Expect(0); + Test(RightShift(-0x7FFF_FFFF_FFFF_FFFF, 1_000_000_000)) as Expect(-1); + Test(RightShift(-0x8000_0000_0000_0000, 1_000_000_000)) as Expect(-1); +} // --- fail_bad_shift.carbon -package BadShift; +library "[[@TEST_NAME]]"; fn RightShift(a: i32, b: i32) -> i32 = "int.right_shift"; -fn Negate(a: i32) -> i32 = "int.snegate"; +fn RightShiftLit(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.right_shift"; -// Shift greater than size is disallowed. +// Shift greater than size is disallowed for sized types. let size_1: i32 = RightShift(1, 31); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance not in range [0, 32) in 1 >> 32 [CompileTimeShiftOutOfRange] +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance >= type width of 32 in `1 >> 32` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let size_2: i32 = RightShift(1, 32); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: let size_2: i32 = RightShift(1, 32); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance not in range [0, 32) in 1 >> 33 [CompileTimeShiftOutOfRange] +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance >= type width of 32 in `1 >> 33` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let size_3: i32 = RightShift(1, 33); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: let size_3: i32 = RightShift(1, 33); -// Negative shifts aren't allowed either. -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+3]]:21: error: shift distance not in range [0, 32) in 1 >> -1 [CompileTimeShiftOutOfRange] -// CHECK:STDERR: let negative: i32 = RightShift(1, Negate(1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ -let negative: i32 = RightShift(1, Negate(1)); +// Negative shifts aren't allowed either, even for literals, even if the lhs is zero. +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:21: error: shift distance >= type width of 32 in `1 >> -1` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: let negative: i32 = RightShift(1, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let negative: i32 = RightShift(1, -1); +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:26: error: shift distance >= type width of 32 in `0 >> -1` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: let negative_zero: i32 = RightShift(0, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let negative_zero: i32 = RightShift(0, -1); +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:39: error: shift distance negative in `1 >> -1` [CompileTimeShiftNegative] +// CHECK:STDERR: let negative_lit: Core.IntLiteral() = RightShiftLit(1, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let negative_lit: Core.IntLiteral() = RightShiftLit(1, -1); +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+3]]:44: error: shift distance negative in `0 >> -1` [CompileTimeShiftNegative] +// CHECK:STDERR: let negative_lit_zero: Core.IntLiteral() = RightShiftLit(0, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +let negative_lit_zero: Core.IntLiteral() = RightShiftLit(0, -1); diff --git a/toolchain/check/testdata/builtins/int/sadd.carbon b/toolchain/check/testdata/builtins/int/sadd.carbon index 92a7a741edf4a..794ec245313a0 100644 --- a/toolchain/check/testdata/builtins/int/sadd.carbon +++ b/toolchain/check/testdata/builtins/int/sadd.carbon @@ -10,17 +10,47 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/sadd.carbon -// --- int_add.carbon +// --- i32.carbon + +library "[[@TEST_NAME]]"; fn Add(a: i32, b: i32) -> i32 = "int.sadd"; -var arr: [i32; Add(1, 2)]; -let arr_p: [i32; 3]* = &arr; +class Expect(N:! i32) {} +fn Test(N:! i32) -> Expect(N) { return {}; } + +fn F() { + Test(Add(0, 0)) as Expect(0); + Test(Add(1, 2)) as Expect(3); + Test(Add(0x7FFF_FFFE, 1)) as Expect(0x7FFF_FFFF); +} fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return Add(a, b); } +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn Add(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.sadd"; + +class Expect(N:! Core.IntLiteral()) {} +fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; } + +fn F() { + Test(Add(0, 0)) as Expect(0); + Test(Add(1, 2)) as Expect(3); + + // Test some cases that might -- but shouldn't -- overflow. + Test(Add(0x7FFF_FFFE, 1)) as Expect(0x7FFF_FFFF); + Test(Add(0x7FFF_FFFF, 1)) as Expect(0x8000_0000); + Test(Add(0x7FFF_FFFF_FFFF_FFFF, 1)) as Expect(0x8000_0000_0000_0000); + Test(Add(0xFFFF_FFFF_FFFF_FFFF, 1)) as Expect(0x1_0000_0000_0000_0000); + Test(Add(-0x8000_0000_0000_0000, -1)) as Expect(-0x8000_0000_0000_0001); + Test(Add(-0x8000_0000_0000_0000, -0x8000_0000_0000_0000)) as Expect(-0x1_0000_0000_0000_0000); +} + // --- fail_bad_decl.carbon package FailBadDecl; @@ -42,6 +72,28 @@ fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.sadd"; fn BadReturnType(a: i32, b: i32) -> bool = "int.sadd"; fn JustRight(a: i32, b: i32) -> i32 = "int.sadd"; +// Heterogeneous "add" is not supported. +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] +// CHECK:STDERR: fn MixedAdd1(a: i32, b: Core.IntLiteral()) -> i32 = "int.sadd"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn MixedAdd1(a: i32, b: Core.IntLiteral()) -> i32 = "int.sadd"; +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] +// CHECK:STDERR: fn MixedAdd2(a: Core.IntLiteral(), b: i32) -> i32 = "int.sadd"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn MixedAdd2(a: Core.IntLiteral(), b: i32) -> i32 = "int.sadd"; +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] +// CHECK:STDERR: fn MixedAdd3(a: i32, b: Core.IntLiteral()) -> Core.IntLiteral() = "int.sadd"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn MixedAdd3(a: i32, b: Core.IntLiteral()) -> Core.IntLiteral() = "int.sadd"; +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] +// CHECK:STDERR: fn MixedAdd4(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.sadd"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn MixedAdd4(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.sadd"; + // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: var too_few: [i32; TooFew(1)]; // CHECK:STDERR: ^~~~~~~~~ @@ -61,7 +113,7 @@ var bad_return_type: [i32; BadReturnType(1, 2)]; // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:21: error: 3 arguments passed to function expecting 2 arguments [CallArgCountMismatch] // CHECK:STDERR: var bad_call: [i32; JustRight(1, 2, 3)]; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: note: calling function declared here [InCallToEntity] +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-43]]:1: note: calling function declared here [InCallToEntity] // CHECK:STDERR: fn JustRight(a: i32, b: i32) -> i32 = "int.sadd"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -86,7 +138,7 @@ package FailOverflow; fn Add(a: i32, b: i32) -> i32 = "int.sadd"; let a: i32 = Add(0x7FFFFFFF, 0); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation 2147483647 + 1 [CompileTimeIntegerOverflow] +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation `2147483647 + 1` [CompileTimeIntegerOverflow] // CHECK:STDERR: let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ let b: i32 = Add(0x7FFFFFFF, 1); diff --git a/toolchain/check/testdata/builtins/int/sdiv.carbon b/toolchain/check/testdata/builtins/int/sdiv.carbon index abec5e0bce168..f7c87e61ae4a0 100644 --- a/toolchain/check/testdata/builtins/int/sdiv.carbon +++ b/toolchain/check/testdata/builtins/int/sdiv.carbon @@ -30,23 +30,38 @@ fn Sub(a: i32, b: i32) -> i32 = "int.ssub"; fn Negate(a: i32) -> i32 = "int.snegate"; // -0x7FFF_FFFF / -1 is OK. -let a: i32 = Div(Negate(0x7FFF_FFFF), Negate(1)); +let a: i32 = Div(-0x7FFF_FFFF, -1); // -0x8000_0000 / 1 is OK. -let b: i32 = Div(Sub(Negate(0x7FFF_FFFF), 1), 1); +let b: i32 = Div(-0x8000_0000, 1); // -0x8000_0000 / -1 overflows. -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation -2147483648 / -1 [CompileTimeIntegerOverflow] -// CHECK:STDERR: let c: i32 = Div(Sub(Negate(0x7FFF_FFFF), 1), Negate(1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation `-2147483648 / -1` [CompileTimeIntegerOverflow] +// CHECK:STDERR: let c: i32 = Div(-0x8000_0000, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: -let c: i32 = Div(Sub(Negate(0x7FFF_FFFF), 1), Negate(1)); +let c: i32 = Div(-0x8000_0000, -1); + +// --- literal_no_overflow.carbon + +library "[[@TEST_NAME]]"; + +fn Div(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.sdiv"; + +class Expect(N:! Core.IntLiteral()) {} +fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; } + +fn F() { + Test(Div(-0x8000_0000, -1)) as Expect(0x8000_0000); + Test(Div(-0x8000_0000_0000_0000, -1)) as Expect(0x8000_0000_0000_0000); +} // --- fail_div_by_zero.carbon package FailDivByZero; fn Div(a: i32, b: i32) -> i32 = "int.sdiv"; +fn DivLit(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.sdiv"; // CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero] // CHECK:STDERR: let a: i32 = Div(1, 0); @@ -54,7 +69,20 @@ fn Div(a: i32, b: i32) -> i32 = "int.sdiv"; // CHECK:STDERR: let a: i32 = Div(1, 0); -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero] // CHECK:STDERR: let b: i32 = Div(0, 0); // CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: let b: i32 = Div(0, 0); + +// IntLiteral allows "overflow" by widening its representation, but not overflow to infinity. +// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:28: error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: let c: Core.IntLiteral() = DivLit(1, 0); +// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: +let c: Core.IntLiteral() = DivLit(1, 0); + +// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:28: error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: let d: Core.IntLiteral() = DivLit(0, 0); +// CHECK:STDERR: ^~~~~~~~~~~~ +let d: Core.IntLiteral() = DivLit(0, 0); diff --git a/toolchain/check/testdata/builtins/int/smod.carbon b/toolchain/check/testdata/builtins/int/smod.carbon index 72f5f4f01cd1b..dbcd590aa4017 100644 --- a/toolchain/check/testdata/builtins/int/smod.carbon +++ b/toolchain/check/testdata/builtins/int/smod.carbon @@ -37,7 +37,7 @@ let b: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), 1); // -0x8000_0000 / -1 overflows, so -0x8000_0000 % -1 is disallowed, even though // its result is representable. -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation -2147483648 % -1 [CompileTimeIntegerOverflow] +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation `-2147483648 % -1` [CompileTimeIntegerOverflow] // CHECK:STDERR: let c: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), Negate(1)); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/builtins/int/smul.carbon b/toolchain/check/testdata/builtins/int/smul.carbon index 563d39d864353..403efe866b399 100644 --- a/toolchain/check/testdata/builtins/int/smul.carbon +++ b/toolchain/check/testdata/builtins/int/smul.carbon @@ -10,17 +10,55 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/smul.carbon -// --- int_mul.carbon +// --- i32.carbon + +library "[[@TEST_NAME]]"; fn Mul(a: i32, b: i32) -> i32 = "int.smul"; -var arr: [i32; Mul(3, 2)]; -let arr_p: [i32; 6]* = &arr; +class Expect(N:! i32) {} +fn Test(N:! i32) -> Expect(N) { return {}; } + +fn F() { + Test(Mul(0, 0)) as Expect(0); + Test(Mul(0, 3)) as Expect(0); + Test(Mul(1, 2)) as Expect(2); + Test(Mul(3, 2)) as Expect(6); + Test(Mul(0x7FFF_FFFF, 1)) as Expect(0x7FFF_FFFF); + Test(Mul(0x7FFF_FFFF, -1)) as Expect(-0x7FFF_FFFF); +} fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return Mul(a, b); } +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn Mul(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.smul"; + +class Expect(N:! Core.IntLiteral()) {} +fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; } + +fn F() { + Test(Mul(0, 0)) as Expect(0); + Test(Mul(0, 3)) as Expect(0); + Test(Mul(1, 2)) as Expect(2); + Test(Mul(3, 2)) as Expect(6); + Test(Mul(0x7FFF_FFFF, 1)) as Expect(0x7FFF_FFFF); + Test(Mul(0x7FFF_FFFF, -1)) as Expect(-0x7FFF_FFFF); + + // Test some cases that might -- but shouldn't -- overflow. + Test(Mul(0x8000_0000_0000_0000, 1)) as Expect(0x8000_0000_0000_0000); + Test(Mul(0x8000_0000_0000_0000, -1)) as Expect(-0x8000_0000_0000_0000); + Test(Mul(-0x8000_0000_0000_0000, 1)) as Expect(-0x8000_0000_0000_0000); + Test(Mul(-0x8000_0000_0000_0000, -1)) as Expect(0x8000_0000_0000_0000); + Test(Mul(-0x8000_0000_0000_0000, -1)) as Expect(0x8000_0000_0000_0000); + Test(Mul(-0x8000_0000_0000_0000, -0x8000_0000_0000_0000)) + as Expect(0x4000_0000_0000_0000_0000_0000_0000_0000); +} + // --- fail_overflow.carbon package FailOverflow; @@ -28,7 +66,7 @@ package FailOverflow; fn Mul(a: i32, b: i32) -> i32 = "int.smul"; let a: i32 = Mul(0x7FFF, 0x10000); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation 32768 * 65536 [CompileTimeIntegerOverflow] +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation `32768 * 65536` [CompileTimeIntegerOverflow] // CHECK:STDERR: let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ let b: i32 = Mul(0x8000, 0x10000); diff --git a/toolchain/check/testdata/builtins/int/snegate.carbon b/toolchain/check/testdata/builtins/int/snegate.carbon index a0c03f880e7c1..93b3d41d66a3e 100644 --- a/toolchain/check/testdata/builtins/int/snegate.carbon +++ b/toolchain/check/testdata/builtins/int/snegate.carbon @@ -23,6 +23,21 @@ fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { return Negate(a); } +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn Negate(a: Core.IntLiteral()) -> Core.IntLiteral() = "int.snegate"; + +class Expect(N:! Core.IntLiteral()) {} +fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; } + +fn F() { + Test(Negate(0)) as Expect(0); + Test(Negate(1)) as Expect(0 - 1); + Test(Negate(0 - 0x8000_0000_0000_0000)) as Expect(0x8000_0000_0000_0000); +} + // --- fail_bad_decl.carbon package FailBadDecl; @@ -110,10 +125,10 @@ fn Negate(a: i32) -> i32 = "int.snegate"; fn Sub(a: i32, b: i32) -> i32 = "int.ssub"; // -(-INT_MAX) is INT_MAX. -let a: i32 = Negate(Negate(0x7FFFFFFF)); +let a: i32 = Negate(Negate(0x7FFF_FFFF)); -// -(-INT_MAX - 1) is too large for i32. +// -INT_MIN is too large for i32. // CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in negation of -2147483648 [CompileTimeIntegerNegateOverflow] -// CHECK:STDERR: let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); +// CHECK:STDERR: let b: i32 = Negate(-0x8000_0000); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +let b: i32 = Negate(-0x8000_0000); diff --git a/toolchain/check/testdata/builtins/int/ssub.carbon b/toolchain/check/testdata/builtins/int/ssub.carbon index c27bfe561aac8..a7cdfe90ca12b 100644 --- a/toolchain/check/testdata/builtins/int/ssub.carbon +++ b/toolchain/check/testdata/builtins/int/ssub.carbon @@ -29,7 +29,7 @@ fn Sub(a: i32, b: i32) -> i32 = "int.ssub"; let a: i32 = Sub(0, 0x7FFFFFFF); let b: i32 = Sub(Sub(0, 0x7FFFFFFF), 1); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation -2147483647 - 2 [CompileTimeIntegerOverflow] +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation `-2147483647 - 2` [CompileTimeIntegerOverflow] // CHECK:STDERR: let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); diff --git a/toolchain/check/testdata/builtins/print/char.carbon b/toolchain/check/testdata/builtins/print/char.carbon index a6a1a1b8f9501..79d3d4ae90951 100644 --- a/toolchain/check/testdata/builtins/print/char.carbon +++ b/toolchain/check/testdata/builtins/print/char.carbon @@ -46,12 +46,12 @@ fn Main() { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .PrintChar = %import_ref.193 +// CHECK:STDOUT: .PrintChar = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//io // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.193: %PrintChar.type.2 = import_ref Core//io, PrintChar, loaded [template = constants.%PrintChar.2] +// CHECK:STDOUT: %import_ref.229: %PrintChar.type.2 = import_ref Core//io, PrintChar, loaded [template = constants.%PrintChar.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -95,7 +95,7 @@ fn Main() { // CHECK:STDOUT: %.loc16_13.2: %i32 = converted %int_1, %.loc16_13.1 [template = constants.%int_1.2] // CHECK:STDOUT: %print.char.loc16: init %i32 = call %PrintChar.ref.loc16(%.loc16_13.2) // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] -// CHECK:STDOUT: %PrintChar.ref.loc17: %PrintChar.type.2 = name_ref PrintChar, imports.%import_ref.193 [template = constants.%PrintChar.2] +// CHECK:STDOUT: %PrintChar.ref.loc17: %PrintChar.type.2 = name_ref PrintChar, imports.%import_ref.229 [template = constants.%PrintChar.2] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] // CHECK:STDOUT: %impl.elem0.loc17: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] // CHECK:STDOUT: %Convert.bound.loc17: = bound_method %int_2, %impl.elem0.loc17 [template = constants.%Convert.bound.2] diff --git a/toolchain/check/testdata/builtins/print/int.carbon b/toolchain/check/testdata/builtins/print/int.carbon index 3725d6cc5f586..d114966529d62 100644 --- a/toolchain/check/testdata/builtins/print/int.carbon +++ b/toolchain/check/testdata/builtins/print/int.carbon @@ -48,12 +48,12 @@ fn Main() { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Print = %import_ref.193 +// CHECK:STDOUT: .Print = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//io // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.193: %Print.type.2 = import_ref Core//io, Print, loaded [template = constants.%Print.2] +// CHECK:STDOUT: %import_ref.229: %Print.type.2 = import_ref Core//io, Print, loaded [template = constants.%Print.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -91,7 +91,7 @@ fn Main() { // CHECK:STDOUT: %.loc16_9.2: %i32 = converted %int_1, %.loc16_9.1 [template = constants.%int_1.2] // CHECK:STDOUT: %print.int.loc16: init %empty_tuple.type = call %Print.ref.loc16(%.loc16_9.2) // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] -// CHECK:STDOUT: %Print.ref.loc18: %Print.type.2 = name_ref Print, imports.%import_ref.193 [template = constants.%Print.2] +// CHECK:STDOUT: %Print.ref.loc18: %Print.type.2 = name_ref Print, imports.%import_ref.229 [template = constants.%Print.2] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] // CHECK:STDOUT: %impl.elem0.loc18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] // CHECK:STDOUT: %Convert.bound.loc18: = bound_method %int_2, %impl.elem0.loc18 [template = constants.%Convert.bound.2] diff --git a/toolchain/check/testdata/class/generic/import.carbon b/toolchain/check/testdata/class/generic/import.carbon index e180b5a83d385..3e773962f29eb 100644 --- a/toolchain/check/testdata/class/generic/import.carbon +++ b/toolchain/check/testdata/class/generic/import.carbon @@ -282,15 +282,15 @@ class Class(U:! type) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.2: %CompleteClass.type = import_ref Main//foo, CompleteClass, loaded [template = constants.%CompleteClass.generic] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.197 -// CHECK:STDOUT: .ImplicitAs = %import_ref.198 +// CHECK:STDOUT: .Int = %import_ref.233 +// CHECK:STDOUT: .ImplicitAs = %import_ref.234 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.193: = import_ref Main//foo, loc9_1, loaded [template = constants.%complete_type.4] -// CHECK:STDOUT: %import_ref.194 = import_ref Main//foo, inst37 [no loc], unloaded -// CHECK:STDOUT: %import_ref.195 = import_ref Main//foo, loc7_8, unloaded -// CHECK:STDOUT: %import_ref.196 = import_ref Main//foo, loc8_17, unloaded +// CHECK:STDOUT: %import_ref.229: = import_ref Main//foo, loc9_1, loaded [template = constants.%complete_type.4] +// CHECK:STDOUT: %import_ref.230 = import_ref Main//foo, inst37 [no loc], unloaded +// CHECK:STDOUT: %import_ref.231 = import_ref Main//foo, loc7_8, unloaded +// CHECK:STDOUT: %import_ref.232 = import_ref Main//foo, loc8_17, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -357,10 +357,10 @@ class Class(U:! type) { // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.194 -// CHECK:STDOUT: .n = imports.%import_ref.195 -// CHECK:STDOUT: .F = imports.%import_ref.196 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.193 +// CHECK:STDOUT: .Self = imports.%import_ref.230 +// CHECK:STDOUT: .n = imports.%import_ref.231 +// CHECK:STDOUT: .F = imports.%import_ref.232 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.229 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/import.carbon b/toolchain/check/testdata/class/import.carbon index acbd0a629481f..4c9dc7b152020 100644 --- a/toolchain/check/testdata/class/import.carbon +++ b/toolchain/check/testdata/class/import.carbon @@ -204,14 +204,14 @@ fn Run() { // CHECK:STDOUT: %import_ref.10: = import_ref Main//a, loc9_1, loaded [template = constants.%complete_type.3] // CHECK:STDOUT: %import_ref.11 = import_ref Main//a, inst21 [no loc], unloaded // CHECK:STDOUT: %import_ref.12: %Field.elem = import_ref Main//a, loc8_8, loaded [template = %.1] -// CHECK:STDOUT: %import_ref.201: = import_ref Main//a, loc16_1, loaded [template = constants.%complete_type.1] -// CHECK:STDOUT: %import_ref.202 = import_ref Main//a, inst56 [no loc], unloaded -// CHECK:STDOUT: %import_ref.203: %F.type = import_ref Main//a, loc14_21, loaded [template = constants.%F] -// CHECK:STDOUT: %import_ref.204: %G.type = import_ref Main//a, loc15_27, loaded [template = constants.%G] -// CHECK:STDOUT: %import_ref.205: = import_ref Main//a, loc16_1, loaded [template = constants.%complete_type.1] -// CHECK:STDOUT: %import_ref.206 = import_ref Main//a, inst56 [no loc], unloaded -// CHECK:STDOUT: %import_ref.207 = import_ref Main//a, loc14_21, unloaded -// CHECK:STDOUT: %import_ref.208 = import_ref Main//a, loc15_27, unloaded +// CHECK:STDOUT: %import_ref.237: = import_ref Main//a, loc16_1, loaded [template = constants.%complete_type.1] +// CHECK:STDOUT: %import_ref.238 = import_ref Main//a, inst56 [no loc], unloaded +// CHECK:STDOUT: %import_ref.239: %F.type = import_ref Main//a, loc14_21, loaded [template = constants.%F] +// CHECK:STDOUT: %import_ref.240: %G.type = import_ref Main//a, loc15_27, loaded [template = constants.%G] +// CHECK:STDOUT: %import_ref.241: = import_ref Main//a, loc16_1, loaded [template = constants.%complete_type.1] +// CHECK:STDOUT: %import_ref.242 = import_ref Main//a, inst56 [no loc], unloaded +// CHECK:STDOUT: %import_ref.243 = import_ref Main//a, loc14_21, unloaded +// CHECK:STDOUT: %import_ref.244 = import_ref Main//a, loc15_27, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -243,18 +243,18 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: class @ForwardDeclared.1 [from "a.carbon"] { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.202 -// CHECK:STDOUT: .F = imports.%import_ref.203 -// CHECK:STDOUT: .G = imports.%import_ref.204 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.201 +// CHECK:STDOUT: .Self = imports.%import_ref.238 +// CHECK:STDOUT: .F = imports.%import_ref.239 +// CHECK:STDOUT: .G = imports.%import_ref.240 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.237 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @ForwardDeclared.2 [from "a.carbon"] { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.206 -// CHECK:STDOUT: .F = imports.%import_ref.207 -// CHECK:STDOUT: .G = imports.%import_ref.208 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.205 +// CHECK:STDOUT: .Self = imports.%import_ref.242 +// CHECK:STDOUT: .F = imports.%import_ref.243 +// CHECK:STDOUT: .G = imports.%import_ref.244 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.241 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Incomplete [from "a.carbon"]; @@ -298,12 +298,12 @@ fn Run() { // CHECK:STDOUT: %.loc12_30: init %ForwardDeclared.1 = converted %.loc12_29.1, %.loc12_29.2 [template = constants.%ForwardDeclared.val] // CHECK:STDOUT: assign %c.var, %.loc12_30 // CHECK:STDOUT: %c.ref.loc13: ref %ForwardDeclared.1 = name_ref c, %c -// CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.203 [template = constants.%F] +// CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.239 [template = constants.%F] // CHECK:STDOUT: %F.bound: = bound_method %c.ref.loc13, %F.ref // CHECK:STDOUT: %.loc13: %ForwardDeclared.1 = bind_value %c.ref.loc13 // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.bound(%.loc13) // CHECK:STDOUT: %c.ref.loc14: ref %ForwardDeclared.1 = name_ref c, %c -// CHECK:STDOUT: %G.ref: %G.type = name_ref G, imports.%import_ref.204 [template = constants.%G] +// CHECK:STDOUT: %G.ref: %G.type = name_ref G, imports.%import_ref.240 [template = constants.%G] // CHECK:STDOUT: %G.bound: = bound_method %c.ref.loc14, %G.ref // CHECK:STDOUT: %addr.loc14: %ptr.3 = addr_of %c.ref.loc14 // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.bound(%addr.loc14) @@ -319,5 +319,5 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F[%self.param_patt: %ForwardDeclared.1]() [from "a.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @G[addr .inst942: %ptr.3]() [from "a.carbon"]; +// CHECK:STDOUT: fn @G[addr .inst990: %ptr.3]() [from "a.carbon"]; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/builtin/method.carbon b/toolchain/check/testdata/function/builtin/method.carbon index 9b5435af48154..837849b12aade 100644 --- a/toolchain/check/testdata/function/builtin/method.carbon +++ b/toolchain/check/testdata/function/builtin/method.carbon @@ -42,7 +42,7 @@ var arr: [i32; (1 as i32).(I.F)(2)]; // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .As = %import_ref.5 -// CHECK:STDOUT: .ImplicitAs = %import_ref.193 +// CHECK:STDOUT: .ImplicitAs = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/if_expr/control_flow.carbon b/toolchain/check/testdata/if_expr/control_flow.carbon index 908bd65f8232d..704a40a6f9f22 100644 --- a/toolchain/check/testdata/if_expr/control_flow.carbon +++ b/toolchain/check/testdata/if_expr/control_flow.carbon @@ -46,7 +46,7 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Bool = %import_ref.193 +// CHECK:STDOUT: .Bool = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon index b3a19ff0101fa..6d2dcd0d36892 100644 --- a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon +++ b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon @@ -67,7 +67,7 @@ class C { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Float = %import_ref.193 +// CHECK:STDOUT: .Float = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_negative_indexing.carbon b/toolchain/check/testdata/index/fail_negative_indexing.carbon index 9e3d86e8803cb..b6dcd848bb138 100644 --- a/toolchain/check/testdata/index/fail_negative_indexing.carbon +++ b/toolchain/check/testdata/index/fail_negative_indexing.carbon @@ -9,7 +9,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_negative_indexing.carbon var c: [i32; 2] = (42, 42); -// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+3]]:16: error: cannot access member of interface `Core.Negate` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+3]]:16: error: array index `-10` is past the end of type `[i32; 2]` [ArrayIndexOutOfBounds] // CHECK:STDERR: var d: i32 = c[-10]; // CHECK:STDERR: ^~~ var d: i32 = c[-10]; @@ -29,19 +29,28 @@ var d: i32 = c[-10]; // CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] // CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_42.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_42.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] // CHECK:STDOUT: %int_42.2: %i32 = int_value 42 [template] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: %array: %array_type = tuple_value (%int_42.2, %int_42.2) [template] // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template] +// CHECK:STDOUT: %Op.type.13: type = fn_type @Op.13 [template] +// CHECK:STDOUT: %Op.type.14: type = fn_type @Op.14 [template] +// CHECK:STDOUT: %Op.14: %Op.type.14 = struct_value () [template] +// CHECK:STDOUT: %interface.20: = interface_witness (%Op.14) [template] +// CHECK:STDOUT: %Op.bound: = bound_method %int_10, %Op.14 [template] +// CHECK:STDOUT: %int_-10.1: Core.IntLiteral = int_value -10 [template] +// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_-10.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_-10.2: %i32 = int_value -10 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Negate = %import_ref.193 +// CHECK:STDOUT: .Negate = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -66,16 +75,16 @@ var d: i32 = c[-10]; // CHECK:STDOUT: %int_42.loc11_24: Core.IntLiteral = int_value 42 [template = constants.%int_42.1] // CHECK:STDOUT: %.loc11_26.1: %tuple.type = tuple_literal (%int_42.loc11_20, %int_42.loc11_24) // CHECK:STDOUT: %impl.elem0.loc11_26.1: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_26.1: = bound_method %int_42.loc11_20, %impl.elem0.loc11_26.1 [template = constants.%Convert.bound] -// CHECK:STDOUT: %Convert.specific_fn.loc11_26.1: = specific_function %Convert.bound.loc11_26.1, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn] +// CHECK:STDOUT: %Convert.bound.loc11_26.1: = bound_method %int_42.loc11_20, %impl.elem0.loc11_26.1 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_26.1: = specific_function %Convert.bound.loc11_26.1, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] // CHECK:STDOUT: %int.convert_checked.loc11_26.1: init %i32 = call %Convert.specific_fn.loc11_26.1(%int_42.loc11_20) [template = constants.%int_42.2] // CHECK:STDOUT: %.loc11_26.2: init %i32 = converted %int_42.loc11_20, %int.convert_checked.loc11_26.1 [template = constants.%int_42.2] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0] // CHECK:STDOUT: %.loc11_26.3: ref %i32 = array_index file.%c.var, %int_0 // CHECK:STDOUT: %.loc11_26.4: init %i32 = initialize_from %.loc11_26.2 to %.loc11_26.3 [template = constants.%int_42.2] // CHECK:STDOUT: %impl.elem0.loc11_26.2: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_26.2: = bound_method %int_42.loc11_24, %impl.elem0.loc11_26.2 [template = constants.%Convert.bound] -// CHECK:STDOUT: %Convert.specific_fn.loc11_26.2: = specific_function %Convert.bound.loc11_26.2, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn] +// CHECK:STDOUT: %Convert.bound.loc11_26.2: = bound_method %int_42.loc11_24, %impl.elem0.loc11_26.2 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_26.2: = specific_function %Convert.bound.loc11_26.2, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] // CHECK:STDOUT: %int.convert_checked.loc11_26.2: init %i32 = call %Convert.specific_fn.loc11_26.2(%int_42.loc11_24) [template = constants.%int_42.2] // CHECK:STDOUT: %.loc11_26.5: init %i32 = converted %int_42.loc11_24, %int.convert_checked.loc11_26.2 [template = constants.%int_42.2] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1] @@ -86,9 +95,20 @@ var d: i32 = c[-10]; // CHECK:STDOUT: assign file.%c.var, %.loc11_27 // CHECK:STDOUT: %c.ref: ref %array_type = name_ref c, file.%c // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template = constants.%int_10] +// CHECK:STDOUT: %impl.elem0.loc15_16.1: %Op.type.13 = interface_witness_access constants.%interface.20, element0 [template = constants.%Op.14] +// CHECK:STDOUT: %Op.bound: = bound_method %int_10, %impl.elem0.loc15_16.1 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %Op.bound(%int_10) [template = constants.%int_-10.1] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %.loc15_19.1: ref %i32 = array_index %c.ref, [template = ] +// CHECK:STDOUT: %impl.elem0.loc15_16.2: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15: = bound_method %int.snegate, %impl.elem0.loc15_16.2 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc15: = specific_function %Convert.bound.loc15, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %.loc15_16.1: Core.IntLiteral = value_of_initializer %int.snegate [template = constants.%int_-10.1] +// CHECK:STDOUT: %.loc15_16.2: Core.IntLiteral = converted %int.snegate, %.loc15_16.1 [template = constants.%int_-10.1] +// CHECK:STDOUT: %int.convert_checked.loc15: init %i32 = call %Convert.specific_fn.loc15(%.loc15_16.2) [template = constants.%int_-10.2] +// CHECK:STDOUT: %.loc15_16.3: %i32 = value_of_initializer %int.convert_checked.loc15 [template = constants.%int_-10.2] +// CHECK:STDOUT: %.loc15_16.4: %i32 = converted %int.snegate, %.loc15_16.3 [template = constants.%int_-10.2] +// CHECK:STDOUT: %.loc15_19.1: ref %i32 = array_index %c.ref, %.loc15_16.4 [template = ] // CHECK:STDOUT: %.loc15_19.2: %i32 = bind_value %.loc15_19.1 // CHECK:STDOUT: assign file.%d.var, %.loc15_19.2 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon index 1c2b8af30c588..37bdaab74288d 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon @@ -11,10 +11,10 @@ fn Main() -> i32 { // The following line has two mismatches, but after the first, it shouldn't // keep erroring. - // CHECK:STDERR: fail_type_mismatch_once.carbon:[[@LINE+3]]:10: error: cannot access member of interface `Core.Add` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return 12 + 3.4 + 12; + // CHECK:STDERR: fail_type_mismatch_once.carbon:[[@LINE+3]]:10: error: cannot access member of interface `Core.Add` in type `{}` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: return {} + 3.4 + 12; // CHECK:STDERR: ^~~~~~~~ - return 12 + 3.4 + 12; + return {} + 3.4 + 12; } // CHECK:STDOUT: --- fail_type_mismatch_once.carbon @@ -24,9 +24,10 @@ fn Main() -> i32 { // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %float: f64 = float_literal 3.4000000000000004 [template] // CHECK:STDOUT: %Op.type: type = fn_type @Op [template] +// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -57,9 +58,9 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> %i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_12.loc17_10: Core.IntLiteral = int_value 12 [template = constants.%int_12] +// CHECK:STDOUT: %.loc17: %empty_struct_type = struct_literal () // CHECK:STDOUT: %float: f64 = float_literal 3.4000000000000004 [template = constants.%float] -// CHECK:STDOUT: %int_12.loc17_21: Core.IntLiteral = int_value 12 [template = constants.%int_12] +// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template = constants.%int_12] // CHECK:STDOUT: %impl.elem0: %Op.type = interface_witness_access , element0 [template = ] // CHECK:STDOUT: %Op.bound: = bound_method , %impl.elem0 [template = ] // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon index b67d0fa9bf4c1..4b7c3eb7e1938 100644 --- a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon @@ -9,10 +9,10 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon fn Main() -> i32 { - // CHECK:STDERR: fail_unimplemented_op.carbon:[[@LINE+3]]:10: error: cannot access member of interface `Core.Add` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return 12 + 34; + // CHECK:STDERR: fail_unimplemented_op.carbon:[[@LINE+3]]:10: error: cannot access member of interface `Core.Add` in type `{}` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: return {} + 34; // CHECK:STDERR: ^~~~~~~ - return 12 + 34; + return {} + 34; } // CHECK:STDOUT: --- fail_unimplemented_op.carbon @@ -22,7 +22,7 @@ fn Main() -> i32 { // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %int_34: Core.IntLiteral = int_value 34 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -54,7 +54,7 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> %i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template = constants.%int_12] +// CHECK:STDOUT: %.loc15: %empty_struct_type = struct_literal () // CHECK:STDOUT: %int_34: Core.IntLiteral = int_value 34 [template = constants.%int_34] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/overloaded/bit_complement.carbon b/toolchain/check/testdata/operators/overloaded/bit_complement.carbon index cbacbb9dcdd89..cb1d942f31620 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_complement.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_complement.carbon @@ -57,7 +57,7 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {} -// CHECK:STDOUT: impl_decl @impl [template] {} { +// CHECK:STDOUT: impl_decl @impl.1 [template] {} { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %BitComplement.ref: type = name_ref BitComplement, imports.%import_ref.1 [template = constants.%BitComplement.type] @@ -77,7 +77,7 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %C.ref as %BitComplement.ref { +// CHECK:STDOUT: impl @impl.1: %C.ref as %BitComplement.ref { // CHECK:STDOUT: %Op.decl: %Op.type.1 = fn_decl @Op.1 [template = constants.%Op.1] { // CHECK:STDOUT: %self.patt: %C = binding_pattern self // CHECK:STDOUT: %self.param_patt: %C = value_param_pattern %self.patt, runtime_param0 diff --git a/toolchain/check/testdata/operators/overloaded/dec.carbon b/toolchain/check/testdata/operators/overloaded/dec.carbon index 48c67c69529a9..036345b6a5e76 100644 --- a/toolchain/check/testdata/operators/overloaded/dec.carbon +++ b/toolchain/check/testdata/operators/overloaded/dec.carbon @@ -58,7 +58,7 @@ fn TestOp() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {} -// CHECK:STDOUT: impl_decl @impl [template] {} { +// CHECK:STDOUT: impl_decl @impl.1 [template] {} { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %Dec.ref: type = name_ref Dec, imports.%import_ref.1 [template = constants.%Dec.type] @@ -66,7 +66,7 @@ fn TestOp() { // CHECK:STDOUT: %TestOp.decl: %TestOp.type = fn_decl @TestOp [template = constants.%TestOp] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %C.ref as %Dec.ref { +// CHECK:STDOUT: impl @impl.1: %C.ref as %Dec.ref { // CHECK:STDOUT: %Op.decl: %Op.type.1 = fn_decl @Op.1 [template = constants.%Op.1] { // CHECK:STDOUT: %self.patt: %ptr.1 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %ptr.1 = value_param_pattern %self.patt, runtime_param0 diff --git a/toolchain/check/testdata/operators/overloaded/eq.carbon b/toolchain/check/testdata/operators/overloaded/eq.carbon index bc531ae1a361b..0a6cbd1a8a9b5 100644 --- a/toolchain/check/testdata/operators/overloaded/eq.carbon +++ b/toolchain/check/testdata/operators/overloaded/eq.carbon @@ -377,7 +377,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Eq = %import_ref.1 // CHECK:STDOUT: .Bool = %import_ref.7 -// CHECK:STDOUT: .ImplicitAs = %import_ref.12 +// CHECK:STDOUT: .ImplicitAs = %import_ref.27 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon b/toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon index 3cfe71e01f63e..7caf31184ebc3 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon @@ -37,7 +37,7 @@ fn G(n: i32) { // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] -// CHECK:STDOUT: %Op.type.14: type = fn_type @Op.2, @impl.7(%int_32) [template] +// CHECK:STDOUT: %Op.type.14: type = fn_type @Op.2, @impl.13(%int_32) [template] // CHECK:STDOUT: %Op.14: %Op.type.14 = struct_value () [template] // CHECK:STDOUT: %interface.19: = interface_witness (%Op.14) [template] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon b/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon index 361503889b22b..4828300334357 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon @@ -59,9 +59,9 @@ fn TestRef(b: C) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Negate = %import_ref.1 -// CHECK:STDOUT: .Add = %import_ref.6 -// CHECK:STDOUT: .AddAssign = %import_ref.11 -// CHECK:STDOUT: .Inc = %import_ref.16 +// CHECK:STDOUT: .Add = %import_ref.39 +// CHECK:STDOUT: .AddAssign = %import_ref.41 +// CHECK:STDOUT: .Inc = %import_ref.46 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon index dc9336622e968..e3fabdff6aeae 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon @@ -78,7 +78,7 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Add = %import_ref.1 // CHECK:STDOUT: .AddAssign = %import_ref.5 -// CHECK:STDOUT: .ImplicitAs = %import_ref.10 +// CHECK:STDOUT: .ImplicitAs = %import_ref.43 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/overloaded/inc.carbon b/toolchain/check/testdata/operators/overloaded/inc.carbon index 20892ea4a5ddd..87045188460c8 100644 --- a/toolchain/check/testdata/operators/overloaded/inc.carbon +++ b/toolchain/check/testdata/operators/overloaded/inc.carbon @@ -58,7 +58,7 @@ fn TestOp() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {} -// CHECK:STDOUT: impl_decl @impl [template] {} { +// CHECK:STDOUT: impl_decl @impl.1 [template] {} { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %Inc.ref: type = name_ref Inc, imports.%import_ref.1 [template = constants.%Inc.type] @@ -66,7 +66,7 @@ fn TestOp() { // CHECK:STDOUT: %TestOp.decl: %TestOp.type = fn_decl @TestOp [template = constants.%TestOp] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %C.ref as %Inc.ref { +// CHECK:STDOUT: impl @impl.1: %C.ref as %Inc.ref { // CHECK:STDOUT: %Op.decl: %Op.type.1 = fn_decl @Op.1 [template = constants.%Op.1] { // CHECK:STDOUT: %self.patt: %ptr.1 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %ptr.1 = value_param_pattern %self.patt, runtime_param0 diff --git a/toolchain/check/testdata/operators/overloaded/negate.carbon b/toolchain/check/testdata/operators/overloaded/negate.carbon index 907f48a5bae64..532c6cf0faa00 100644 --- a/toolchain/check/testdata/operators/overloaded/negate.carbon +++ b/toolchain/check/testdata/operators/overloaded/negate.carbon @@ -57,7 +57,7 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {} -// CHECK:STDOUT: impl_decl @impl [template] {} { +// CHECK:STDOUT: impl_decl @impl.1 [template] {} { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %Negate.ref: type = name_ref Negate, imports.%import_ref.1 [template = constants.%Negate.type] @@ -77,7 +77,7 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %C.ref as %Negate.ref { +// CHECK:STDOUT: impl @impl.1: %C.ref as %Negate.ref { // CHECK:STDOUT: %Op.decl: %Op.type.1 = fn_decl @Op.1 [template = constants.%Op.1] { // CHECK:STDOUT: %self.patt: %C = binding_pattern self // CHECK:STDOUT: %self.param_patt: %C = value_param_pattern %self.patt, runtime_param0 diff --git a/toolchain/check/testdata/packages/implicit_imports_prelude.carbon b/toolchain/check/testdata/packages/implicit_imports_prelude.carbon index cf73aceba5fcc..1b170c1d4c4ca 100644 --- a/toolchain/check/testdata/packages/implicit_imports_prelude.carbon +++ b/toolchain/check/testdata/packages/implicit_imports_prelude.carbon @@ -78,7 +78,7 @@ var b: i32 = a; // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1: ref %i32 = import_ref Main//lib, a, loaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.191 +// CHECK:STDOUT: .Int = %import_ref.227 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/import.carbon b/toolchain/check/testdata/pointer/import.carbon index c5906b3482eb7..6818ae8c6d3cb 100644 --- a/toolchain/check/testdata/pointer/import.carbon +++ b/toolchain/check/testdata/pointer/import.carbon @@ -86,7 +86,7 @@ var a: i32* = a_ref; // CHECK:STDOUT: %import_ref.1 = import_ref Implicit//default, a_orig, unloaded // CHECK:STDOUT: %import_ref.2: ref %ptr = import_ref Implicit//default, a_ref, loaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.192 +// CHECK:STDOUT: .Int = %import_ref.228 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/returned_var_scope.carbon b/toolchain/check/testdata/return/returned_var_scope.carbon index 1038f900fb4ef..1595999ccc5fc 100644 --- a/toolchain/check/testdata/return/returned_var_scope.carbon +++ b/toolchain/check/testdata/return/returned_var_scope.carbon @@ -57,7 +57,7 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Bool = %import_ref.193 +// CHECK:STDOUT: .Bool = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/import.carbon b/toolchain/check/testdata/struct/import.carbon index 7d607e20dfb61..c65e6c5380aed 100644 --- a/toolchain/check/testdata/struct/import.carbon +++ b/toolchain/check/testdata/struct/import.carbon @@ -270,13 +270,13 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, C, loaded [template = constants.%C.generic] // CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, F, loaded [template = constants.%F] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.194 -// CHECK:STDOUT: .ImplicitAs = %import_ref.197 +// CHECK:STDOUT: .Int = %import_ref.230 +// CHECK:STDOUT: .ImplicitAs = %import_ref.233 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.195: = import_ref Implicit//default, loc8_34, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.196 = import_ref Implicit//default, inst940 [no loc], unloaded +// CHECK:STDOUT: %import_ref.231: = import_ref Implicit//default, loc8_34, loaded [template = constants.%complete_type.3] +// CHECK:STDOUT: %import_ref.232 = import_ref Implicit//default, inst988 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -309,8 +309,8 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.196 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.195 +// CHECK:STDOUT: .Self = imports.%import_ref.232 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.231 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -395,8 +395,8 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.194: = import_ref Implicit//default, loc8_34, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.195 = import_ref Implicit//default, inst940 [no loc], unloaded +// CHECK:STDOUT: %import_ref.230: = import_ref Implicit//default, loc8_34, loaded [template = constants.%complete_type.3] +// CHECK:STDOUT: %import_ref.231 = import_ref Implicit//default, inst988 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -423,8 +423,8 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.195 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.194 +// CHECK:STDOUT: .Self = imports.%import_ref.231 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.230 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -481,12 +481,12 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, C, loaded [template = constants.%C.generic] // CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, F, loaded [template = constants.%F] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .ImplicitAs = %import_ref.196 +// CHECK:STDOUT: .ImplicitAs = %import_ref.232 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.194: = import_ref Implicit//default, loc8_34, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.195 = import_ref Implicit//default, inst940 [no loc], unloaded +// CHECK:STDOUT: %import_ref.230: = import_ref Implicit//default, loc8_34, loaded [template = constants.%complete_type.3] +// CHECK:STDOUT: %import_ref.231 = import_ref Implicit//default, inst988 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -513,8 +513,8 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.195 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.194 +// CHECK:STDOUT: .Self = imports.%import_ref.231 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.230 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/tuple/access/fail_negative_indexing.carbon b/toolchain/check/testdata/tuple/access/fail_negative_indexing.carbon index 976149262c8e0..2f507ee2ec84e 100644 --- a/toolchain/check/testdata/tuple/access/fail_negative_indexing.carbon +++ b/toolchain/check/testdata/tuple/access/fail_negative_indexing.carbon @@ -9,9 +9,9 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuple/access/fail_negative_indexing.carbon var a: (i32, i32) = (12, 6); -// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+3]]:17: error: cannot access member of interface `Core.Negate` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+3]]:14: error: tuple element index `-10` is past the end of type `(i32, i32)` [TupleIndexOutOfBounds] // CHECK:STDERR: var b: i32 = a.(-10); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: ^~~~~~~ var b: i32 = a.(-10); // CHECK:STDOUT: --- fail_negative_indexing.carbon @@ -35,13 +35,19 @@ var b: i32 = a.(-10); // CHECK:STDOUT: %int_6.2: %i32 = int_value 6 [template] // CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%int_12.2, %int_6.2) [template] // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template] +// CHECK:STDOUT: %Op.type.13: type = fn_type @Op.13 [template] +// CHECK:STDOUT: %Op.type.14: type = fn_type @Op.14 [template] +// CHECK:STDOUT: %Op.14: %Op.type.14 = struct_value () [template] +// CHECK:STDOUT: %interface.20: = interface_witness (%Op.14) [template] +// CHECK:STDOUT: %Op.bound: = bound_method %int_10, %Op.14 [template] +// CHECK:STDOUT: %int_-10: Core.IntLiteral = int_value -10 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Negate = %import_ref.193 +// CHECK:STDOUT: .Negate = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -84,6 +90,11 @@ var b: i32 = a.(-10); // CHECK:STDOUT: assign file.%a.var, %.loc11_28 // CHECK:STDOUT: %a.ref: ref %tuple.type.2 = name_ref a, file.%a // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template = constants.%int_10] +// CHECK:STDOUT: %impl.elem0.loc15: %Op.type.13 = interface_witness_access constants.%interface.20, element0 [template = constants.%Op.14] +// CHECK:STDOUT: %Op.bound: = bound_method %int_10, %impl.elem0.loc15 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %Op.bound(%int_10) [template = constants.%int_-10] +// CHECK:STDOUT: %.loc15_17.1: Core.IntLiteral = value_of_initializer %int.snegate [template = constants.%int_-10] +// CHECK:STDOUT: %.loc15_17.2: Core.IntLiteral = converted %int.snegate, %.loc15_17.1 [template = constants.%int_-10] // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuple/access/index_not_literal.carbon b/toolchain/check/testdata/tuple/access/index_not_literal.carbon index f7aa408e6be4e..9069ce6973bac 100644 --- a/toolchain/check/testdata/tuple/access/index_not_literal.carbon +++ b/toolchain/check/testdata/tuple/access/index_not_literal.carbon @@ -61,7 +61,7 @@ var d: i32 = a.({.index = 1 as i32}.index); // CHECK:STDOUT: .Bool = %import_ref.1 // CHECK:STDOUT: .Int = %import_ref.2 // CHECK:STDOUT: .ImplicitAs = %import_ref.6 -// CHECK:STDOUT: .As = %import_ref.194 +// CHECK:STDOUT: .As = %import_ref.230 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuple/import.carbon b/toolchain/check/testdata/tuple/import.carbon index 3df6812364ee9..08bdb0906afad 100644 --- a/toolchain/check/testdata/tuple/import.carbon +++ b/toolchain/check/testdata/tuple/import.carbon @@ -287,13 +287,13 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, C, loaded [template = constants.%C.generic] // CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, F, loaded [template = constants.%F] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.194 -// CHECK:STDOUT: .ImplicitAs = %import_ref.197 +// CHECK:STDOUT: .Int = %import_ref.230 +// CHECK:STDOUT: .ImplicitAs = %import_ref.233 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.195: = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.196 = import_ref Implicit//default, inst975 [no loc], unloaded +// CHECK:STDOUT: %import_ref.231: = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.3] +// CHECK:STDOUT: %import_ref.232 = import_ref Implicit//default, inst1023 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -326,8 +326,8 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.196 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.195 +// CHECK:STDOUT: .Self = imports.%import_ref.232 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.231 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -420,8 +420,8 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.194: = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.195 = import_ref Implicit//default, inst975 [no loc], unloaded +// CHECK:STDOUT: %import_ref.230: = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.3] +// CHECK:STDOUT: %import_ref.231 = import_ref Implicit//default, inst1023 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -448,8 +448,8 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.195 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.194 +// CHECK:STDOUT: .Self = imports.%import_ref.231 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.230 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -506,12 +506,12 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, C, loaded [template = constants.%C.generic] // CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, F, loaded [template = constants.%F] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .ImplicitAs = %import_ref.196 +// CHECK:STDOUT: .ImplicitAs = %import_ref.232 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.194: = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.195 = import_ref Implicit//default, inst975 [no loc], unloaded +// CHECK:STDOUT: %import_ref.230: = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.3] +// CHECK:STDOUT: %import_ref.231 = import_ref Implicit//default, inst1023 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -538,8 +538,8 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.195 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.194 +// CHECK:STDOUT: .Self = imports.%import_ref.231 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.230 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/diagnostics/diagnostic_kind.def b/toolchain/diagnostics/diagnostic_kind.def index 457768bb6c8b1..da22969879331 100644 --- a/toolchain/diagnostics/diagnostic_kind.def +++ b/toolchain/diagnostics/diagnostic_kind.def @@ -306,7 +306,9 @@ CARBON_DIAGNOSTIC_KIND(CompileTimeDivisionByZero) CARBON_DIAGNOSTIC_KIND(CompileTimeIntegerOverflow) CARBON_DIAGNOSTIC_KIND(CompileTimeIntegerNegateOverflow) CARBON_DIAGNOSTIC_KIND(CompileTimeFloatBitWidth) +CARBON_DIAGNOSTIC_KIND(CompileTimeShiftNegative) CARBON_DIAGNOSTIC_KIND(CompileTimeShiftOutOfRange) +CARBON_DIAGNOSTIC_KIND(CompileTimeUnsizedShiftOutOfRange) CARBON_DIAGNOSTIC_KIND(ContinueOutsideLoop) CARBON_DIAGNOSTIC_KIND(CopyOfUncopyableType) CARBON_DIAGNOSTIC_KIND(CoreNameNotFound) diff --git a/toolchain/lower/constant.cpp b/toolchain/lower/constant.cpp index ee32d091a910b..cfc956579e3ef 100644 --- a/toolchain/lower/constant.cpp +++ b/toolchain/lower/constant.cpp @@ -48,6 +48,11 @@ class ConstantContext { return nullptr; } + // Gets the value to use for an integer literal. + auto GetIntLiteralAsValue() const -> llvm::Constant* { + return file_context_->GetIntLiteralAsValue(); + } + // Gets a callable's function. Returns nullptr for a builtin. auto GetFunction(SemIR::FunctionId function_id) -> llvm::Function* { return file_context_->GetFunction(function_id); @@ -187,9 +192,9 @@ static auto EmitAsConstant(ConstantContext& context, SemIR::IntValue inst) // represented as an LLVM integer type. auto* int_type = llvm::dyn_cast(type); if (!int_type) { - auto* struct_type = llvm::dyn_cast(type); - CARBON_CHECK(struct_type && struct_type->getNumElements() == 0); - return llvm::ConstantStruct::get(struct_type); + auto* int_literal_value = context.GetIntLiteralAsValue(); + CARBON_CHECK(int_literal_value->getType() == type); + return int_literal_value; } auto val = context.sem_ir().ints().Get(inst.int_id); diff --git a/toolchain/lower/file_context.h b/toolchain/lower/file_context.h index c2f1d57722493..2c1fd28011b6f 100644 --- a/toolchain/lower/file_context.h +++ b/toolchain/lower/file_context.h @@ -68,6 +68,12 @@ class FileContext { return llvm::ConstantStruct::get(GetTypeType()); } + // Returns a lowered value to use for a value of int literal type. + auto GetIntLiteralAsValue() -> llvm::Constant* { + // TODO: Consider adding a named struct type for integer literals. + return llvm::ConstantStruct::get(llvm::StructType::get(llvm_context())); + } + // Returns a global value for the given instruction. auto GetGlobal(SemIR::InstId inst_id) -> llvm::Value*; diff --git a/toolchain/lower/function_context.h b/toolchain/lower/function_context.h index eef1a7370cac7..de2aff947aa49 100644 --- a/toolchain/lower/function_context.h +++ b/toolchain/lower/function_context.h @@ -89,6 +89,11 @@ class FunctionContext { return file_context_->GetTypeAsValue(); } + // Returns a lowered value to use for a value of int literal type. + auto GetIntLiteralAsValue() -> llvm::Constant* { + return file_context_->GetIntLiteralAsValue(); + } + // Returns the instruction immediately after all the existing static allocas. // This is the insert point for future static allocas. auto GetInstructionAfterAllocas() const -> llvm::Instruction* { diff --git a/toolchain/lower/handle_call.cpp b/toolchain/lower/handle_call.cpp index 9ea2dc5e6b83d..d246ed27455d5 100644 --- a/toolchain/lower/handle_call.cpp +++ b/toolchain/lower/handle_call.cpp @@ -65,6 +65,79 @@ static auto IsSignedInt(FunctionContext& context, SemIR::InstId int_id) context.sem_ir().insts().Get(int_id).type_id()); } +// Creates a zext or sext instruction depending on the signedness of the +// operand. +static auto CreateZExtOrSExt(FunctionContext& context, llvm::Value* value, + llvm::Type* type, bool is_signed, + const llvm::Twine& name = "") -> llvm::Value* { + return is_signed ? context.builder().CreateSExt(value, type, name) + : context.builder().CreateZExt(value, type, name); +} + +// Handles a call to a builtin integer bit shift operator. +static auto HandleIntShift(FunctionContext& context, SemIR::InstId inst_id, + llvm::Instruction::BinaryOps bin_op, + SemIR::InstId lhs_id, SemIR::InstId rhs_id) -> void { + llvm::Value* lhs = context.GetValue(lhs_id); + llvm::Value* rhs = context.GetValue(rhs_id); + + // Weirdly, LLVM requires the operands of bit shift operators to be of the + // same type. We can always use the width of the LHS, because if the RHS + // doesn't fit in that then the cast is out of range anyway. Zero-extending is + // always fine because it's an error for the RHS to be negative. + // + // TODO: In a development build we should trap if the RHS is signed and + // negative or greater than or equal to the number of bits in the left-hand + // type. + rhs = context.builder().CreateZExtOrTrunc(rhs, lhs->getType(), "rhs"); + + context.SetLocal(inst_id, context.builder().CreateBinOp(bin_op, lhs, rhs)); +} + +// Handles a call to a builtin integer comparison operator. +static auto HandleIntComparison(FunctionContext& context, SemIR::InstId inst_id, + SemIR::BuiltinFunctionKind builtin_kind, + SemIR::InstId lhs_id, SemIR::InstId rhs_id) + -> void { + llvm::Value* lhs = context.GetValue(lhs_id); + llvm::Value* rhs = context.GetValue(rhs_id); + const auto* lhs_type = cast(lhs->getType()); + const auto* rhs_type = cast(rhs->getType()); + + // We perform a signed comparison if either operand is signed. + bool lhs_signed = IsSignedInt(context, lhs_id); + bool rhs_signed = IsSignedInt(context, rhs_id); + bool cmp_signed = lhs_signed || rhs_signed; + + // Compute the width for the comparison. This is the smallest width that + // fits both types, after widening them to include a sign bit if + // necessary. + auto width_for_cmp = [&](const llvm::IntegerType* type, bool is_signed) { + unsigned width = type->getBitWidth(); + if (!is_signed && cmp_signed) { + // We're performing a signed comparison but this input is unsigned. + // Widen it by at least one bit to provide a sign bit. + ++width; + } + return width; + }; + // TODO: This might be an awkward size, such as 33 or 65 bits, for a + // signed/unsigned comparison. Would it be better to round this up to a + // "nicer" bit width? + unsigned cmp_width = std::max(width_for_cmp(lhs_type, lhs_signed), + width_for_cmp(rhs_type, rhs_signed)); + auto* cmp_type = llvm::IntegerType::get(context.llvm_context(), cmp_width); + + // Widen the operands as needed. + lhs = CreateZExtOrSExt(context, lhs, cmp_type, lhs_signed, "lhs"); + rhs = CreateZExtOrSExt(context, rhs, cmp_type, rhs_signed, "rhs"); + + context.SetLocal( + inst_id, + context.builder().CreateICmp( + GetBuiltinICmpPredicate(builtin_kind, cmp_signed), lhs, rhs)); +} + // Handles a call to a builtin function. static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id, SemIR::BuiltinFunctionKind builtin_kind, @@ -245,19 +318,15 @@ static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id, return; } case SemIR::BuiltinFunctionKind::IntLeftShift: { - context.SetLocal( - inst_id, context.builder().CreateShl(context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]))); + HandleIntShift(context, inst_id, llvm::Instruction::Shl, arg_ids[0], + arg_ids[1]); return; } case SemIR::BuiltinFunctionKind::IntRightShift: { - context.SetLocal( - inst_id, - IsSignedInt(context, inst_id) - ? context.builder().CreateAShr(context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1])) - : context.builder().CreateLShr(context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]))); + HandleIntShift(context, inst_id, + IsSignedInt(context, inst_id) ? llvm::Instruction::AShr + : llvm::Instruction::LShr, + arg_ids[0], arg_ids[1]); return; } case SemIR::BuiltinFunctionKind::IntEq: @@ -268,12 +337,8 @@ static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id, case SemIR::BuiltinFunctionKind::IntGreaterEq: case SemIR::BuiltinFunctionKind::BoolEq: case SemIR::BuiltinFunctionKind::BoolNeq: { - context.SetLocal( - inst_id, - context.builder().CreateICmp( - GetBuiltinICmpPredicate(builtin_kind, - IsSignedInt(context, arg_ids[0])), - context.GetValue(arg_ids[0]), context.GetValue(arg_ids[1]))); + HandleIntComparison(context, inst_id, builtin_kind, arg_ids[0], + arg_ids[1]); return; } case SemIR::BuiltinFunctionKind::FloatNegate: { @@ -320,7 +385,9 @@ static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id, case SemIR::BuiltinFunctionKind::IntConvertChecked: { // TODO: Check this statically. - CARBON_CHECK(builtin_kind.IsCompTimeOnly()); + CARBON_CHECK(builtin_kind.IsCompTimeOnly( + context.sem_ir(), arg_ids, + context.sem_ir().insts().Get(inst_id).type_id())); CARBON_FATAL("Missing constant value for call to comptime-only function"); } } diff --git a/toolchain/lower/testdata/builtins/int.carbon b/toolchain/lower/testdata/builtins/int.carbon index 51ee33fd7c20f..d9273ef196cef 100644 --- a/toolchain/lower/testdata/builtins/int.carbon +++ b/toolchain/lower/testdata/builtins/int.carbon @@ -8,6 +8,10 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/builtins/int.carbon +// --- basic.carbon + +library "[[@TEST_NAME]]"; + fn Negate(a: i32) -> i32 = "int.snegate"; fn TestNegate(a: i32) -> i32 { return Negate(a); } @@ -41,8 +45,11 @@ fn TestXor(a: i32, b: i32) -> i32 { return Xor(a, b); } fn LeftShift(a: i32, b: i32) -> i32 = "int.left_shift"; fn TestLeftShift(a: i32, b: i32) -> i32 { return LeftShift(a, b); } -fn RightShift(a: i32, b: i32) -> i32 = "int.right_shift"; -fn TestRightShift(a: i32, b: i32) -> i32 { return RightShift(a, b); } +fn ArithmeticRightShift(a: i32, b: i32) -> i32 = "int.right_shift"; +fn TestArithmeticRightShift(a: i32, b: i32) -> i32 { return ArithmeticRightShift(a, b); } + +fn LogicalRightShift(a: u32, b: u32) -> u32 = "int.right_shift"; +fn TestLogicalRightShift(a: u32, b: u32) -> u32 { return LogicalRightShift(a, b); } fn Eq(a: i32, b: i32) -> bool = "int.eq"; fn TestEq(a: i32, b: i32) -> bool { return Eq(a, b); } @@ -62,8 +69,68 @@ fn TestGreater(a: i32, b: i32) -> bool { return Greater(a, b); } fn GreaterEq(a: i32, b: i32) -> bool = "int.greater_eq"; fn TestGreaterEq(a: i32, b: i32) -> bool { return GreaterEq(a, b); } -// CHECK:STDOUT: ; ModuleID = 'int.carbon' -// CHECK:STDOUT: source_filename = "int.carbon" +// --- mixed_shift.carbon + +library "[[@TEST_NAME]]"; + +fn LeftShiftSmaller(a: i32, b: i16) -> i32 = "int.left_shift"; +fn TestLeftShiftSmaller(a: i32, b: i16) -> i32 { return LeftShiftSmaller(a, b); } + +fn RightShiftSmaller(a: i32, b: i16) -> i32 = "int.right_shift"; +fn TestRightShiftSmaller(a: i32, b: i16) -> i32 { return RightShiftSmaller(a, b); } + +fn LeftShiftLargerII(a: i16, b: i32) -> i16 = "int.left_shift"; +fn TestLeftShiftLargerII(a: i16, b: i32) -> i16 { return LeftShiftLargerII(a, b); } + +fn RightShiftLargerII(a: i16, b: i32) -> i16 = "int.right_shift"; +fn TestRightShiftLargerII(a: i16, b: i32) -> i16 { return RightShiftLargerII(a, b); } + +fn LeftShiftLargerIU(a: i16, b: u32) -> i16 = "int.left_shift"; +fn TestLeftShiftLargerIU(a: i16, b: u32) -> i16 { return LeftShiftLargerIU(a, b); } + +fn RightShiftLargerIU(a: i16, b: u32) -> i16 = "int.right_shift"; +fn TestRightShiftLargerIU(a: i16, b: u32) -> i16 { return RightShiftLargerIU(a, b); } + +fn LeftShiftLargerUI(a: u16, b: i32) -> u16 = "int.left_shift"; +fn TestLeftShiftLargerUI(a: u16, b: i32) -> u16 { return LeftShiftLargerUI(a, b); } + +fn RightShiftLargerUI(a: u16, b: i32) -> u16 = "int.right_shift"; +fn TestRightShiftLargerUI(a: u16, b: i32) -> u16 { return RightShiftLargerUI(a, b); } + +fn LeftShiftLargerUU(a: u16, b: u32) -> u16 = "int.left_shift"; +fn TestLeftShiftLargerUU(a: u16, b: u32) -> u16 { return LeftShiftLargerUU(a, b); } + +fn RightShiftLargerUU(a: u16, b: u32) -> u16 = "int.right_shift"; +fn TestRightShiftLargerUU(a: u16, b: u32) -> u16 { return RightShiftLargerUU(a, b); } + +// --- mixed_compare.carbon + +fn Eq_u16_u32(a: u16, b: u32) -> bool = "int.eq"; +fn Eq_i16_u32(a: i16, b: u32) -> bool = "int.eq"; +fn Eq_u16_i32(a: u16, b: i32) -> bool = "int.eq"; +fn Eq_i16_i32(a: i16, b: i32) -> bool = "int.eq"; +fn Eq_i32_u32(a: i32, b: u32) -> bool = "int.eq"; + +fn TestEq_u16_u32(a: u16, b: u32) -> bool { return Eq_u16_u32(a, b); } +fn TestEq_i16_u32(a: i16, b: u32) -> bool { return Eq_i16_u32(a, b); } +fn TestEq_u16_i32(a: u16, b: i32) -> bool { return Eq_u16_i32(a, b); } +fn TestEq_i16_i32(a: i16, b: i32) -> bool { return Eq_i16_i32(a, b); } +fn TestEq_i32_u32(a: i32, b: u32) -> bool { return Eq_i32_u32(a, b); } + +fn Less_u16_u32(a: u16, b: u32) -> bool = "int.less"; +fn Less_i16_u32(a: i16, b: u32) -> bool = "int.less"; +fn Less_u16_i32(a: u16, b: i32) -> bool = "int.less"; +fn Less_i16_i32(a: i16, b: i32) -> bool = "int.less"; +fn Less_i32_u32(a: i32, b: u32) -> bool = "int.less"; + +fn TestLess_u16_u32(a: u16, b: u32) -> bool { return Less_u16_u32(a, b); } +fn TestLess_i16_u32(a: i16, b: u32) -> bool { return Less_i16_u32(a, b); } +fn TestLess_u16_i32(a: u16, b: i32) -> bool { return Less_u16_i32(a, b); } +fn TestLess_i16_i32(a: i16, b: i32) -> bool { return Less_i16_i32(a, b); } +fn TestLess_i32_u32(a: i32, b: u32) -> bool { return Less_i32_u32(a, b); } + +// CHECK:STDOUT: ; ModuleID = 'basic.carbon' +// CHECK:STDOUT: source_filename = "basic.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @_CTestNegate.Main(i32 %a) !dbg !4 { // CHECK:STDOUT: entry: @@ -131,46 +198,307 @@ fn TestGreaterEq(a: i32, b: i32) -> bool { return GreaterEq(a, b); } // CHECK:STDOUT: ret i32 %int.left_shift, !dbg !38 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestRightShift.Main(i32 %a, i32 %b) !dbg !39 { +// CHECK:STDOUT: define i32 @_CTestArithmeticRightShift.Main(i32 %a, i32 %b) !dbg !39 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %int.right_shift = ashr i32 %a, %b, !dbg !40 // CHECK:STDOUT: ret i32 %int.right_shift, !dbg !41 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestEq.Main(i32 %a, i32 %b) !dbg !42 { +// CHECK:STDOUT: define i32 @_CTestLogicalRightShift.Main(i32 %a, i32 %b) !dbg !42 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.right_shift = lshr i32 %a, %b, !dbg !43 +// CHECK:STDOUT: ret i32 %int.right_shift, !dbg !44 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestEq.Main(i32 %a, i32 %b) !dbg !45 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.eq = icmp eq i32 %a, %b, !dbg !46 +// CHECK:STDOUT: ret i1 %int.eq, !dbg !47 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestNeq.Main(i32 %a, i32 %b) !dbg !48 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.neq = icmp ne i32 %a, %b, !dbg !49 +// CHECK:STDOUT: ret i1 %int.neq, !dbg !50 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestLess.Main(i32 %a, i32 %b) !dbg !51 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.less = icmp slt i32 %a, %b, !dbg !52 +// CHECK:STDOUT: ret i1 %int.less, !dbg !53 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestLessEq.Main(i32 %a, i32 %b) !dbg !54 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.less_eq = icmp sle i32 %a, %b, !dbg !55 +// CHECK:STDOUT: ret i1 %int.less_eq, !dbg !56 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestGreater.Main(i32 %a, i32 %b) !dbg !57 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.greater = icmp sgt i32 %a, %b, !dbg !58 +// CHECK:STDOUT: ret i1 %int.greater, !dbg !59 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestGreaterEq.Main(i32 %a, i32 %b) !dbg !60 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.greater_eq = icmp sge i32 %a, %b, !dbg !61 +// CHECK:STDOUT: ret i1 %int.greater_eq, !dbg !62 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: !llvm.module.flags = !{!0, !1} +// CHECK:STDOUT: !llvm.dbg.cu = !{!2} +// CHECK:STDOUT: +// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} +// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} +// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +// CHECK:STDOUT: !3 = !DIFile(filename: "basic.carbon", directory: "") +// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestNegate", linkageName: "_CTestNegate.Main", scope: null, file: !3, line: 5, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !5 = !DISubroutineType(types: !6) +// CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 5, column: 39, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 5, column: 32, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestAdd", linkageName: "_CTestAdd.Main", scope: null, file: !3, line: 8, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 8, column: 44, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 8, column: 37, scope: !9) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestSub", linkageName: "_CTestSub.Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 11, column: 44, scope: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 11, column: 37, scope: !12) +// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestMul", linkageName: "_CTestMul.Main", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !16 = !DILocation(line: 14, column: 44, scope: !15) +// CHECK:STDOUT: !17 = !DILocation(line: 14, column: 37, scope: !15) +// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestDiv", linkageName: "_CTestDiv.Main", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !19 = !DILocation(line: 17, column: 44, scope: !18) +// CHECK:STDOUT: !20 = !DILocation(line: 17, column: 37, scope: !18) +// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestMod", linkageName: "_CTestMod.Main", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !22 = !DILocation(line: 20, column: 44, scope: !21) +// CHECK:STDOUT: !23 = !DILocation(line: 20, column: 37, scope: !21) +// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestComplement", linkageName: "_CTestComplement.Main", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !25 = !DILocation(line: 23, column: 43, scope: !24) +// CHECK:STDOUT: !26 = !DILocation(line: 23, column: 36, scope: !24) +// CHECK:STDOUT: !27 = distinct !DISubprogram(name: "TestAnd", linkageName: "_CTestAnd.Main", scope: null, file: !3, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !28 = !DILocation(line: 26, column: 44, scope: !27) +// CHECK:STDOUT: !29 = !DILocation(line: 26, column: 37, scope: !27) +// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "TestOr", linkageName: "_CTestOr.Main", scope: null, file: !3, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !31 = !DILocation(line: 29, column: 43, scope: !30) +// CHECK:STDOUT: !32 = !DILocation(line: 29, column: 36, scope: !30) +// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestXor", linkageName: "_CTestXor.Main", scope: null, file: !3, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !34 = !DILocation(line: 32, column: 44, scope: !33) +// CHECK:STDOUT: !35 = !DILocation(line: 32, column: 37, scope: !33) +// CHECK:STDOUT: !36 = distinct !DISubprogram(name: "TestLeftShift", linkageName: "_CTestLeftShift.Main", scope: null, file: !3, line: 35, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !37 = !DILocation(line: 35, column: 50, scope: !36) +// CHECK:STDOUT: !38 = !DILocation(line: 35, column: 43, scope: !36) +// CHECK:STDOUT: !39 = distinct !DISubprogram(name: "TestArithmeticRightShift", linkageName: "_CTestArithmeticRightShift.Main", scope: null, file: !3, line: 38, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !40 = !DILocation(line: 38, column: 61, scope: !39) +// CHECK:STDOUT: !41 = !DILocation(line: 38, column: 54, scope: !39) +// CHECK:STDOUT: !42 = distinct !DISubprogram(name: "TestLogicalRightShift", linkageName: "_CTestLogicalRightShift.Main", scope: null, file: !3, line: 41, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !43 = !DILocation(line: 41, column: 58, scope: !42) +// CHECK:STDOUT: !44 = !DILocation(line: 41, column: 51, scope: !42) +// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "TestEq", linkageName: "_CTestEq.Main", scope: null, file: !3, line: 44, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !46 = !DILocation(line: 44, column: 44, scope: !45) +// CHECK:STDOUT: !47 = !DILocation(line: 44, column: 37, scope: !45) +// CHECK:STDOUT: !48 = distinct !DISubprogram(name: "TestNeq", linkageName: "_CTestNeq.Main", scope: null, file: !3, line: 47, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !49 = !DILocation(line: 47, column: 45, scope: !48) +// CHECK:STDOUT: !50 = !DILocation(line: 47, column: 38, scope: !48) +// CHECK:STDOUT: !51 = distinct !DISubprogram(name: "TestLess", linkageName: "_CTestLess.Main", scope: null, file: !3, line: 50, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !52 = !DILocation(line: 50, column: 46, scope: !51) +// CHECK:STDOUT: !53 = !DILocation(line: 50, column: 39, scope: !51) +// CHECK:STDOUT: !54 = distinct !DISubprogram(name: "TestLessEq", linkageName: "_CTestLessEq.Main", scope: null, file: !3, line: 53, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !55 = !DILocation(line: 53, column: 48, scope: !54) +// CHECK:STDOUT: !56 = !DILocation(line: 53, column: 41, scope: !54) +// CHECK:STDOUT: !57 = distinct !DISubprogram(name: "TestGreater", linkageName: "_CTestGreater.Main", scope: null, file: !3, line: 56, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !58 = !DILocation(line: 56, column: 49, scope: !57) +// CHECK:STDOUT: !59 = !DILocation(line: 56, column: 42, scope: !57) +// CHECK:STDOUT: !60 = distinct !DISubprogram(name: "TestGreaterEq", linkageName: "_CTestGreaterEq.Main", scope: null, file: !3, line: 59, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !61 = !DILocation(line: 59, column: 51, scope: !60) +// CHECK:STDOUT: !62 = !DILocation(line: 59, column: 44, scope: !60) +// CHECK:STDOUT: ; ModuleID = 'mixed_shift.carbon' +// CHECK:STDOUT: source_filename = "mixed_shift.carbon" +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_CTestLeftShiftSmaller.Main(i32 %a, i16 %b) !dbg !4 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.left_shift.rhs = zext i16 %b to i32, !dbg !7 +// CHECK:STDOUT: %int.left_shift = shl i32 %a, %int.left_shift.rhs, !dbg !7 +// CHECK:STDOUT: ret i32 %int.left_shift, !dbg !8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_CTestRightShiftSmaller.Main(i32 %a, i16 %b) !dbg !9 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.right_shift.rhs = zext i16 %b to i32, !dbg !10 +// CHECK:STDOUT: %int.right_shift = ashr i32 %a, %int.right_shift.rhs, !dbg !10 +// CHECK:STDOUT: ret i32 %int.right_shift, !dbg !11 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i16 @_CTestLeftShiftLargerII.Main(i16 %a, i32 %b) !dbg !12 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.left_shift.rhs = trunc i32 %b to i16, !dbg !13 +// CHECK:STDOUT: %int.left_shift = shl i16 %a, %int.left_shift.rhs, !dbg !13 +// CHECK:STDOUT: ret i16 %int.left_shift, !dbg !14 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i16 @_CTestRightShiftLargerII.Main(i16 %a, i32 %b) !dbg !15 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.right_shift.rhs = trunc i32 %b to i16, !dbg !16 +// CHECK:STDOUT: %int.right_shift = ashr i16 %a, %int.right_shift.rhs, !dbg !16 +// CHECK:STDOUT: ret i16 %int.right_shift, !dbg !17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i16 @_CTestLeftShiftLargerIU.Main(i16 %a, i32 %b) !dbg !18 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.left_shift.rhs = trunc i32 %b to i16, !dbg !19 +// CHECK:STDOUT: %int.left_shift = shl i16 %a, %int.left_shift.rhs, !dbg !19 +// CHECK:STDOUT: ret i16 %int.left_shift, !dbg !20 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i16 @_CTestRightShiftLargerIU.Main(i16 %a, i32 %b) !dbg !21 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.right_shift.rhs = trunc i32 %b to i16, !dbg !22 +// CHECK:STDOUT: %int.right_shift = ashr i16 %a, %int.right_shift.rhs, !dbg !22 +// CHECK:STDOUT: ret i16 %int.right_shift, !dbg !23 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i16 @_CTestLeftShiftLargerUI.Main(i16 %a, i32 %b) !dbg !24 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.left_shift.rhs = trunc i32 %b to i16, !dbg !25 +// CHECK:STDOUT: %int.left_shift = shl i16 %a, %int.left_shift.rhs, !dbg !25 +// CHECK:STDOUT: ret i16 %int.left_shift, !dbg !26 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i16 @_CTestRightShiftLargerUI.Main(i16 %a, i32 %b) !dbg !27 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.right_shift.rhs = trunc i32 %b to i16, !dbg !28 +// CHECK:STDOUT: %int.right_shift = lshr i16 %a, %int.right_shift.rhs, !dbg !28 +// CHECK:STDOUT: ret i16 %int.right_shift, !dbg !29 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i16 @_CTestLeftShiftLargerUU.Main(i16 %a, i32 %b) !dbg !30 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.left_shift.rhs = trunc i32 %b to i16, !dbg !31 +// CHECK:STDOUT: %int.left_shift = shl i16 %a, %int.left_shift.rhs, !dbg !31 +// CHECK:STDOUT: ret i16 %int.left_shift, !dbg !32 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i16 @_CTestRightShiftLargerUU.Main(i16 %a, i32 %b) !dbg !33 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.right_shift.rhs = trunc i32 %b to i16, !dbg !34 +// CHECK:STDOUT: %int.right_shift = lshr i16 %a, %int.right_shift.rhs, !dbg !34 +// CHECK:STDOUT: ret i16 %int.right_shift, !dbg !35 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: !llvm.module.flags = !{!0, !1} +// CHECK:STDOUT: !llvm.dbg.cu = !{!2} +// CHECK:STDOUT: +// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} +// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} +// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +// CHECK:STDOUT: !3 = !DIFile(filename: "mixed_shift.carbon", directory: "") +// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestLeftShiftSmaller", linkageName: "_CTestLeftShiftSmaller.Main", scope: null, file: !3, line: 5, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !5 = !DISubroutineType(types: !6) +// CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 5, column: 57, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 5, column: 50, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestRightShiftSmaller", linkageName: "_CTestRightShiftSmaller.Main", scope: null, file: !3, line: 8, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 8, column: 58, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 8, column: 51, scope: !9) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestLeftShiftLargerII", linkageName: "_CTestLeftShiftLargerII.Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 11, column: 58, scope: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 11, column: 51, scope: !12) +// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestRightShiftLargerII", linkageName: "_CTestRightShiftLargerII.Main", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !16 = !DILocation(line: 14, column: 59, scope: !15) +// CHECK:STDOUT: !17 = !DILocation(line: 14, column: 52, scope: !15) +// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestLeftShiftLargerIU", linkageName: "_CTestLeftShiftLargerIU.Main", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !19 = !DILocation(line: 17, column: 58, scope: !18) +// CHECK:STDOUT: !20 = !DILocation(line: 17, column: 51, scope: !18) +// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestRightShiftLargerIU", linkageName: "_CTestRightShiftLargerIU.Main", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !22 = !DILocation(line: 20, column: 59, scope: !21) +// CHECK:STDOUT: !23 = !DILocation(line: 20, column: 52, scope: !21) +// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestLeftShiftLargerUI", linkageName: "_CTestLeftShiftLargerUI.Main", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !25 = !DILocation(line: 23, column: 58, scope: !24) +// CHECK:STDOUT: !26 = !DILocation(line: 23, column: 51, scope: !24) +// CHECK:STDOUT: !27 = distinct !DISubprogram(name: "TestRightShiftLargerUI", linkageName: "_CTestRightShiftLargerUI.Main", scope: null, file: !3, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !28 = !DILocation(line: 26, column: 59, scope: !27) +// CHECK:STDOUT: !29 = !DILocation(line: 26, column: 52, scope: !27) +// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "TestLeftShiftLargerUU", linkageName: "_CTestLeftShiftLargerUU.Main", scope: null, file: !3, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !31 = !DILocation(line: 29, column: 58, scope: !30) +// CHECK:STDOUT: !32 = !DILocation(line: 29, column: 51, scope: !30) +// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestRightShiftLargerUU", linkageName: "_CTestRightShiftLargerUU.Main", scope: null, file: !3, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !34 = !DILocation(line: 32, column: 59, scope: !33) +// CHECK:STDOUT: !35 = !DILocation(line: 32, column: 52, scope: !33) +// CHECK:STDOUT: ; ModuleID = 'mixed_compare.carbon' +// CHECK:STDOUT: source_filename = "mixed_compare.carbon" +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestEq_u16_u32.Main(i16 %a, i32 %b) !dbg !4 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.eq.lhs = zext i16 %a to i32, !dbg !7 +// CHECK:STDOUT: %int.eq = icmp eq i32 %int.eq.lhs, %b, !dbg !7 +// CHECK:STDOUT: ret i1 %int.eq, !dbg !8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestEq_i16_u32.Main(i16 %a, i32 %b) !dbg !9 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.eq.lhs = sext i16 %a to i33, !dbg !10 +// CHECK:STDOUT: %int.eq.rhs = zext i32 %b to i33, !dbg !10 +// CHECK:STDOUT: %int.eq = icmp eq i33 %int.eq.lhs, %int.eq.rhs, !dbg !10 +// CHECK:STDOUT: ret i1 %int.eq, !dbg !11 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestEq_u16_i32.Main(i16 %a, i32 %b) !dbg !12 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.eq.lhs = zext i16 %a to i32, !dbg !13 +// CHECK:STDOUT: %int.eq = icmp eq i32 %int.eq.lhs, %b, !dbg !13 +// CHECK:STDOUT: ret i1 %int.eq, !dbg !14 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestEq_i16_i32.Main(i16 %a, i32 %b) !dbg !15 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.eq.lhs = sext i16 %a to i32, !dbg !16 +// CHECK:STDOUT: %int.eq = icmp eq i32 %int.eq.lhs, %b, !dbg !16 +// CHECK:STDOUT: ret i1 %int.eq, !dbg !17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestEq_i32_u32.Main(i32 %a, i32 %b) !dbg !18 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.eq = icmp eq i32 %a, %b, !dbg !43 -// CHECK:STDOUT: ret i1 %int.eq, !dbg !44 +// CHECK:STDOUT: %int.eq.lhs = sext i32 %a to i33, !dbg !19 +// CHECK:STDOUT: %int.eq.rhs = zext i32 %b to i33, !dbg !19 +// CHECK:STDOUT: %int.eq = icmp eq i33 %int.eq.lhs, %int.eq.rhs, !dbg !19 +// CHECK:STDOUT: ret i1 %int.eq, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestNeq.Main(i32 %a, i32 %b) !dbg !45 { +// CHECK:STDOUT: define i1 @_CTestLess_u16_u32.Main(i16 %a, i32 %b) !dbg !21 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.neq = icmp ne i32 %a, %b, !dbg !46 -// CHECK:STDOUT: ret i1 %int.neq, !dbg !47 +// CHECK:STDOUT: %int.less.lhs = zext i16 %a to i32, !dbg !22 +// CHECK:STDOUT: %int.less = icmp ult i32 %int.less.lhs, %b, !dbg !22 +// CHECK:STDOUT: ret i1 %int.less, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestLess.Main(i32 %a, i32 %b) !dbg !48 { +// CHECK:STDOUT: define i1 @_CTestLess_i16_u32.Main(i16 %a, i32 %b) !dbg !24 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.less = icmp slt i32 %a, %b, !dbg !49 -// CHECK:STDOUT: ret i1 %int.less, !dbg !50 +// CHECK:STDOUT: %int.less.lhs = sext i16 %a to i33, !dbg !25 +// CHECK:STDOUT: %int.less.rhs = zext i32 %b to i33, !dbg !25 +// CHECK:STDOUT: %int.less = icmp slt i33 %int.less.lhs, %int.less.rhs, !dbg !25 +// CHECK:STDOUT: ret i1 %int.less, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestLessEq.Main(i32 %a, i32 %b) !dbg !51 { +// CHECK:STDOUT: define i1 @_CTestLess_u16_i32.Main(i16 %a, i32 %b) !dbg !27 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.less_eq = icmp sle i32 %a, %b, !dbg !52 -// CHECK:STDOUT: ret i1 %int.less_eq, !dbg !53 +// CHECK:STDOUT: %int.less.lhs = zext i16 %a to i32, !dbg !28 +// CHECK:STDOUT: %int.less = icmp slt i32 %int.less.lhs, %b, !dbg !28 +// CHECK:STDOUT: ret i1 %int.less, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestGreater.Main(i32 %a, i32 %b) !dbg !54 { +// CHECK:STDOUT: define i1 @_CTestLess_i16_i32.Main(i16 %a, i32 %b) !dbg !30 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.greater = icmp sgt i32 %a, %b, !dbg !55 -// CHECK:STDOUT: ret i1 %int.greater, !dbg !56 +// CHECK:STDOUT: %int.less.lhs = sext i16 %a to i32, !dbg !31 +// CHECK:STDOUT: %int.less = icmp slt i32 %int.less.lhs, %b, !dbg !31 +// CHECK:STDOUT: ret i1 %int.less, !dbg !32 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestGreaterEq.Main(i32 %a, i32 %b) !dbg !57 { +// CHECK:STDOUT: define i1 @_CTestLess_i32_u32.Main(i32 %a, i32 %b) !dbg !33 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.greater_eq = icmp sge i32 %a, %b, !dbg !58 -// CHECK:STDOUT: ret i1 %int.greater_eq, !dbg !59 +// CHECK:STDOUT: %int.less.lhs = sext i32 %a to i33, !dbg !34 +// CHECK:STDOUT: %int.less.rhs = zext i32 %b to i33, !dbg !34 +// CHECK:STDOUT: %int.less = icmp slt i33 %int.less.lhs, %int.less.rhs, !dbg !34 +// CHECK:STDOUT: ret i1 %int.less, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -179,60 +507,36 @@ fn TestGreaterEq(a: i32, b: i32) -> bool { return GreaterEq(a, b); } // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) -// CHECK:STDOUT: !3 = !DIFile(filename: "int.carbon", directory: "") -// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestNegate", linkageName: "_CTestNegate.Main", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !3 = !DIFile(filename: "mixed_compare.carbon", directory: "") +// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestEq_u16_u32", linkageName: "_CTestEq_u16_u32.Main", scope: null, file: !3, line: 8, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 39, scope: !4) -// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 32, scope: !4) -// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestAdd", linkageName: "_CTestAdd.Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !10 = !DILocation(line: 15, column: 44, scope: !9) -// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 37, scope: !9) -// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestSub", linkageName: "_CTestSub.Main", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !13 = !DILocation(line: 18, column: 44, scope: !12) -// CHECK:STDOUT: !14 = !DILocation(line: 18, column: 37, scope: !12) -// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestMul", linkageName: "_CTestMul.Main", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !16 = !DILocation(line: 21, column: 44, scope: !15) -// CHECK:STDOUT: !17 = !DILocation(line: 21, column: 37, scope: !15) -// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestDiv", linkageName: "_CTestDiv.Main", scope: null, file: !3, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !19 = !DILocation(line: 24, column: 44, scope: !18) -// CHECK:STDOUT: !20 = !DILocation(line: 24, column: 37, scope: !18) -// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestMod", linkageName: "_CTestMod.Main", scope: null, file: !3, line: 27, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !22 = !DILocation(line: 27, column: 44, scope: !21) -// CHECK:STDOUT: !23 = !DILocation(line: 27, column: 37, scope: !21) -// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestComplement", linkageName: "_CTestComplement.Main", scope: null, file: !3, line: 30, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !25 = !DILocation(line: 30, column: 43, scope: !24) -// CHECK:STDOUT: !26 = !DILocation(line: 30, column: 36, scope: !24) -// CHECK:STDOUT: !27 = distinct !DISubprogram(name: "TestAnd", linkageName: "_CTestAnd.Main", scope: null, file: !3, line: 33, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !28 = !DILocation(line: 33, column: 44, scope: !27) -// CHECK:STDOUT: !29 = !DILocation(line: 33, column: 37, scope: !27) -// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "TestOr", linkageName: "_CTestOr.Main", scope: null, file: !3, line: 36, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !31 = !DILocation(line: 36, column: 43, scope: !30) -// CHECK:STDOUT: !32 = !DILocation(line: 36, column: 36, scope: !30) -// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestXor", linkageName: "_CTestXor.Main", scope: null, file: !3, line: 39, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !34 = !DILocation(line: 39, column: 44, scope: !33) -// CHECK:STDOUT: !35 = !DILocation(line: 39, column: 37, scope: !33) -// CHECK:STDOUT: !36 = distinct !DISubprogram(name: "TestLeftShift", linkageName: "_CTestLeftShift.Main", scope: null, file: !3, line: 42, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !37 = !DILocation(line: 42, column: 50, scope: !36) -// CHECK:STDOUT: !38 = !DILocation(line: 42, column: 43, scope: !36) -// CHECK:STDOUT: !39 = distinct !DISubprogram(name: "TestRightShift", linkageName: "_CTestRightShift.Main", scope: null, file: !3, line: 45, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !40 = !DILocation(line: 45, column: 51, scope: !39) -// CHECK:STDOUT: !41 = !DILocation(line: 45, column: 44, scope: !39) -// CHECK:STDOUT: !42 = distinct !DISubprogram(name: "TestEq", linkageName: "_CTestEq.Main", scope: null, file: !3, line: 48, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !43 = !DILocation(line: 48, column: 44, scope: !42) -// CHECK:STDOUT: !44 = !DILocation(line: 48, column: 37, scope: !42) -// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "TestNeq", linkageName: "_CTestNeq.Main", scope: null, file: !3, line: 51, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !46 = !DILocation(line: 51, column: 45, scope: !45) -// CHECK:STDOUT: !47 = !DILocation(line: 51, column: 38, scope: !45) -// CHECK:STDOUT: !48 = distinct !DISubprogram(name: "TestLess", linkageName: "_CTestLess.Main", scope: null, file: !3, line: 54, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !49 = !DILocation(line: 54, column: 46, scope: !48) -// CHECK:STDOUT: !50 = !DILocation(line: 54, column: 39, scope: !48) -// CHECK:STDOUT: !51 = distinct !DISubprogram(name: "TestLessEq", linkageName: "_CTestLessEq.Main", scope: null, file: !3, line: 57, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !52 = !DILocation(line: 57, column: 48, scope: !51) -// CHECK:STDOUT: !53 = !DILocation(line: 57, column: 41, scope: !51) -// CHECK:STDOUT: !54 = distinct !DISubprogram(name: "TestGreater", linkageName: "_CTestGreater.Main", scope: null, file: !3, line: 60, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !55 = !DILocation(line: 60, column: 49, scope: !54) -// CHECK:STDOUT: !56 = !DILocation(line: 60, column: 42, scope: !54) -// CHECK:STDOUT: !57 = distinct !DISubprogram(name: "TestGreaterEq", linkageName: "_CTestGreaterEq.Main", scope: null, file: !3, line: 63, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !58 = !DILocation(line: 63, column: 51, scope: !57) -// CHECK:STDOUT: !59 = !DILocation(line: 63, column: 44, scope: !57) +// CHECK:STDOUT: !7 = !DILocation(line: 8, column: 52, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 8, column: 45, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestEq_i16_u32", linkageName: "_CTestEq_i16_u32.Main", scope: null, file: !3, line: 9, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 9, column: 52, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 9, column: 45, scope: !9) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestEq_u16_i32", linkageName: "_CTestEq_u16_i32.Main", scope: null, file: !3, line: 10, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 10, column: 52, scope: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 10, column: 45, scope: !12) +// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestEq_i16_i32", linkageName: "_CTestEq_i16_i32.Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !16 = !DILocation(line: 11, column: 52, scope: !15) +// CHECK:STDOUT: !17 = !DILocation(line: 11, column: 45, scope: !15) +// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestEq_i32_u32", linkageName: "_CTestEq_i32_u32.Main", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !19 = !DILocation(line: 12, column: 52, scope: !18) +// CHECK:STDOUT: !20 = !DILocation(line: 12, column: 45, scope: !18) +// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestLess_u16_u32", linkageName: "_CTestLess_u16_u32.Main", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !22 = !DILocation(line: 20, column: 54, scope: !21) +// CHECK:STDOUT: !23 = !DILocation(line: 20, column: 47, scope: !21) +// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestLess_i16_u32", linkageName: "_CTestLess_i16_u32.Main", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !25 = !DILocation(line: 21, column: 54, scope: !24) +// CHECK:STDOUT: !26 = !DILocation(line: 21, column: 47, scope: !24) +// CHECK:STDOUT: !27 = distinct !DISubprogram(name: "TestLess_u16_i32", linkageName: "_CTestLess_u16_i32.Main", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !28 = !DILocation(line: 22, column: 54, scope: !27) +// CHECK:STDOUT: !29 = !DILocation(line: 22, column: 47, scope: !27) +// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "TestLess_i16_i32", linkageName: "_CTestLess_i16_i32.Main", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !31 = !DILocation(line: 23, column: 54, scope: !30) +// CHECK:STDOUT: !32 = !DILocation(line: 23, column: 47, scope: !30) +// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestLess_i32_u32", linkageName: "_CTestLess_i32_u32.Main", scope: null, file: !3, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !34 = !DILocation(line: 24, column: 54, scope: !33) +// CHECK:STDOUT: !35 = !DILocation(line: 24, column: 47, scope: !33) diff --git a/toolchain/lower/testdata/builtins/int_literal.carbon b/toolchain/lower/testdata/builtins/int_literal.carbon index afe16953ddbf9..db93678405de3 100644 --- a/toolchain/lower/testdata/builtins/int_literal.carbon +++ b/toolchain/lower/testdata/builtins/int_literal.carbon @@ -14,6 +14,18 @@ fn Copy(x: Make()) -> Make() { return x; } +fn MinusOne() -> i32 { + return -1; +} + +fn IntMax() -> i32 { + return 0x1_0000_0000_0000_0000 / 0x2_0000_0000 - 1; +} + +fn IntMin() -> i32 { + return -0x8000_0000; +} + // CHECK:STDOUT: ; ModuleID = 'int_literal.carbon' // CHECK:STDOUT: source_filename = "int_literal.carbon" // CHECK:STDOUT: @@ -22,6 +34,21 @@ fn Copy(x: Make()) -> Make() { // CHECK:STDOUT: ret {} %x, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_CMinusOne.Main() !dbg !8 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: ret i32 -1, !dbg !9 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_CIntMax.Main() !dbg !10 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: ret i32 2147483647, !dbg !11 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_CIntMin.Main() !dbg !12 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: ret i32 -2147483648, !dbg !13 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -33,3 +60,9 @@ fn Copy(x: Make()) -> Make() { // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} // CHECK:STDOUT: !7 = !DILocation(line: 14, column: 3, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "MinusOne", linkageName: "_CMinusOne.Main", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 18, column: 3, scope: !8) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "IntMax", linkageName: "_CIntMax.Main", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 22, column: 3, scope: !10) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "IntMin", linkageName: "_CIntMin.Main", scope: null, file: !3, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 26, column: 3, scope: !12) diff --git a/toolchain/lower/testdata/builtins/print_read.carbon b/toolchain/lower/testdata/builtins/print_read.carbon index 8834eea2d5190..5e2b582f39774 100644 --- a/toolchain/lower/testdata/builtins/print_read.carbon +++ b/toolchain/lower/testdata/builtins/print_read.carbon @@ -16,7 +16,7 @@ fn ReadChar() -> i32 = "read.char"; fn Main() { Core.Print(1); - let EOF: i32 = -(1 as i32); + let EOF: i32 = -1; while (ReadChar() != EOF) { // "Hi" if (PrintChar(0x48) != EOF) { diff --git a/toolchain/sem_ir/builtin_function_kind.cpp b/toolchain/sem_ir/builtin_function_kind.cpp index 3146f6c55f8f0..875165cf6ef9f 100644 --- a/toolchain/sem_ir/builtin_function_kind.cpp +++ b/toolchain/sem_ir/builtin_function_kind.cpp @@ -79,15 +79,21 @@ struct NoReturn { // Constraint that a type is `bool`. using Bool = BuiltinType; +// Constraint that requires the type to be a sized integer type. +struct AnySizedInt { + static auto Check(const File& sem_ir, ValidateState& /*state*/, + TypeId type_id) -> bool { + return sem_ir.types().Is(type_id); + } +}; + // Constraint that requires the type to be an integer type. struct AnyInt { static auto Check(const File& sem_ir, ValidateState& state, TypeId type_id) -> bool { - if (BuiltinType::Check(sem_ir, state, - type_id)) { - return true; - } - return sem_ir.types().Is(type_id); + return AnySizedInt::Check(sem_ir, state, type_id) || + BuiltinType::Check(sem_ir, state, + type_id); } }; @@ -188,6 +194,10 @@ using IntT = TypeParam<0, AnyInt>; // generic type parameter that is constrained to be an integer type. using IntU = TypeParam<1, AnyInt>; +// Convenience name used in the builtin type signatures below for a first +// generic type parameter that is constrained to be a sized integer type. +using SizedIntT = TypeParam<0, AnySizedInt>; + // Convenience name used in the builtin type signatures below for a first // generic type parameter that is constrained to be an float type. using FloatT = TypeParam<0, AnyFloat>; @@ -196,16 +206,16 @@ using FloatT = TypeParam<0, AnyFloat>; constexpr BuiltinInfo None = {"", nullptr}; // Prints a single character. -constexpr BuiltinInfo PrintChar = {"print.char", - ValidateSignatureAnyInt>}; +constexpr BuiltinInfo PrintChar = { + "print.char", ValidateSignatureAnySizedInt>}; // Prints an integer. -constexpr BuiltinInfo PrintInt = {"print.int", - ValidateSignatureNoReturn>}; +constexpr BuiltinInfo PrintInt = { + "print.int", ValidateSignatureNoReturn>}; // Reads a single character from stdin. constexpr BuiltinInfo ReadChar = {"read.char", - ValidateSignatureAnyInt>}; + ValidateSignatureAnySizedInt>}; // Returns the `Core.IntLiteral` type. constexpr BuiltinInfo IntLiteralMakeType = {"int_literal.make_type", @@ -257,28 +267,28 @@ constexpr BuiltinInfo IntSMod = {"int.smod", ValidateSignatureIntT>}; // "int.unegate": unsigned integer negation. -constexpr BuiltinInfo IntUNegate = {"int.unegate", - ValidateSignatureIntT>}; +constexpr BuiltinInfo IntUNegate = { + "int.unegate", ValidateSignatureSizedIntT>}; // "int.uadd": unsigned integer addition. -constexpr BuiltinInfo IntUAdd = {"int.uadd", - ValidateSignatureIntT>}; +constexpr BuiltinInfo IntUAdd = { + "int.uadd", ValidateSignatureSizedIntT>}; // "int.usub": unsigned integer subtraction. -constexpr BuiltinInfo IntUSub = {"int.usub", - ValidateSignatureIntT>}; +constexpr BuiltinInfo IntUSub = { + "int.usub", ValidateSignatureSizedIntT>}; // "int.umul": unsigned integer multiplication. -constexpr BuiltinInfo IntUMul = {"int.umul", - ValidateSignatureIntT>}; +constexpr BuiltinInfo IntUMul = { + "int.umul", ValidateSignatureSizedIntT>}; // "int.udiv": unsigned integer division. -constexpr BuiltinInfo IntUDiv = {"int.udiv", - ValidateSignatureIntT>}; +constexpr BuiltinInfo IntUDiv = { + "int.udiv", ValidateSignatureSizedIntT>}; // "int.mod": integer modulo. -constexpr BuiltinInfo IntUMod = {"int.umod", - ValidateSignatureIntT>}; +constexpr BuiltinInfo IntUMod = { + "int.umod", ValidateSignatureSizedIntT>}; // "int.complement": integer bitwise complement. constexpr BuiltinInfo IntComplement = {"int.complement", @@ -306,27 +316,27 @@ constexpr BuiltinInfo IntRightShift = { // "int.eq": integer equality comparison. constexpr BuiltinInfo IntEq = {"int.eq", - ValidateSignatureBool>}; + ValidateSignatureBool>}; // "int.neq": integer non-equality comparison. constexpr BuiltinInfo IntNeq = {"int.neq", - ValidateSignatureBool>}; + ValidateSignatureBool>}; // "int.less": integer less than comparison. constexpr BuiltinInfo IntLess = {"int.less", - ValidateSignatureBool>}; + ValidateSignatureBool>}; // "int.less_eq": integer less than or equal comparison. constexpr BuiltinInfo IntLessEq = {"int.less_eq", - ValidateSignatureBool>}; + ValidateSignatureBool>}; // "int.greater": integer greater than comparison. constexpr BuiltinInfo IntGreater = {"int.greater", - ValidateSignatureBool>}; + ValidateSignatureBool>}; // "int.greater_eq": integer greater than or equal comparison. constexpr BuiltinInfo IntGreaterEq = { - "int.greater_eq", ValidateSignatureBool>}; + "int.greater_eq", ValidateSignatureBool>}; // "float.negate": float negation. constexpr BuiltinInfo FloatNegate = {"float.negate", @@ -411,8 +421,82 @@ auto BuiltinFunctionKind::IsValidType(const File& sem_ir, return ValidateFns[AsInt()](sem_ir, arg_types, return_type); } -auto BuiltinFunctionKind::IsCompTimeOnly() const -> bool { - return *this == BuiltinFunctionKind::IntConvertChecked; +auto BuiltinFunctionKind::IsCompTimeOnly(const File& sem_ir, + llvm::ArrayRef arg_ids, + TypeId return_type_id) const -> bool { + // Some builtin functions are unconditionally compile-time-only, or + // unconditionally usable at runtime. However, we need to take extra care for + // builtins operating on an arbitrary integer type, because `Core.IntLiteral` + // has an empty runtime representation and a value of that type isn't + // necessarily a compile-time constant. For example, given: + // + // var n: Core.IntLiteral() = 123; + // + // we would be unable to lower a runtime operation such as `(1 as i32) << n` + // because the runtime representation of `n` doesn't track its value at all. + // So we treat operations involving `Core.IntLiteral` as being + // compile-time-only. + switch (*this) { + case IntConvertChecked: + // Checked integer conversions are compile-time only. + return true; + + case IntSNegate: + case IntComplement: + case IntSAdd: + case IntSSub: + case IntSMul: + case IntSDiv: + case IntSMod: + case IntAnd: + case IntOr: + case IntXor: + // Integer builtins producing an IntLiteral are compile-time only. + // TODO: We could allow these at runtime and just produce an empty struct + // result. Should we? + return sem_ir.types().Is(return_type_id); + + case IntLeftShift: + case IntRightShift: + // Shifts by an integer literal amount are compile-time only. We don't + // have a value for the shift amount at runtime in general. + // TODO: Decide how shifting a non-literal by a literal amount should + // work. We could support these with a builtin in the case where the shift + // amount has a compile-time value, or we could perform a conversion in + // the prelude. + if (sem_ir.types().Is( + sem_ir.insts().Get(arg_ids[1]).type_id())) { + return true; + } + + // Integer builtins producing an IntLiteral are compile-time only. + // TODO: We could allow these at runtime and just produce an empty struct + // result. Should we? + return sem_ir.types().Is(return_type_id); + + case IntEq: + case IntNeq: + case IntLess: + case IntLessEq: + case IntGreater: + case IntGreaterEq: + // Comparisons involving an integer literal operand are compile-time only. + // We don't have a value for an integer literal operand argument at + // runtime in general. + // TODO: Figure out how mixed literal / non-literal comparisons should + // work. We could support these with builtins in the case where the + // operand has a compile-time value, or we could perform a conversion in + // the prelude. + return sem_ir.types().Is( + sem_ir.insts().Get(arg_ids[0]).type_id()) || + sem_ir.types().Is( + sem_ir.insts().Get(arg_ids[1]).type_id()); + + default: + // TODO: Should the sized MakeType functions be compile-time only? We + // can't produce diagnostics for bad sizes at runtime. + return false; + } } } // namespace Carbon::SemIR diff --git a/toolchain/sem_ir/builtin_function_kind.h b/toolchain/sem_ir/builtin_function_kind.h index ab1ba4507f886..7207a31657ea6 100644 --- a/toolchain/sem_ir/builtin_function_kind.h +++ b/toolchain/sem_ir/builtin_function_kind.h @@ -37,7 +37,8 @@ class BuiltinFunctionKind : public CARBON_ENUM_BASE(BuiltinFunctionKind) { TypeId return_type) const -> bool; // Returns whether this is a compile-time-only function. - auto IsCompTimeOnly() const -> bool; + auto IsCompTimeOnly(const File& sem_ir, llvm::ArrayRef arg_ids, + TypeId return_type_id) const -> bool; }; #define CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(Name) \