| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- // 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
- //
- // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/primitives.carbon
- //
- // 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
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/neq.carbon
- // --- int_neq.carbon
- fn Neq(a: i32, b: i32) -> bool = "int.neq";
- class True {}
- class False {}
- fn F(true_: True, false_: False) {
- false_ as (if Neq(1, 1) then True else False);
- true_ as (if Neq(1, 2) then True else False);
- }
- fn RuntimeCallIsValid(a: i32, b: i32) -> bool {
- //@dump-sem-ir-begin
- return Neq(a, b);
- //@dump-sem-ir-end
- }
- // CHECK:STDOUT: --- int_neq.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
- // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
- // CHECK:STDOUT: %Neq.type: type = fn_type @Neq [concrete]
- // CHECK:STDOUT: %Neq: %Neq.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @RuntimeCallIsValid(%a.param: %i32, %b.param: %i32) -> bool {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %Neq.ref: %Neq.type = name_ref Neq, file.%Neq.decl [concrete = constants.%Neq]
- // CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a
- // CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b
- // CHECK:STDOUT: %Neq.call: init bool = call %Neq.ref(%a.ref, %b.ref)
- // CHECK:STDOUT: return %Neq.call to %return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|