| 1234567891011121314151617181920212223242526272829303132 |
- // 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
- //
- // 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
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/usub.carbon
- // --- int_sub.carbon
- fn Sub(a: i32, b: i32) -> i32 = "int.usub";
- var arr: [i32; Sub(3, 2)];
- let arr_p: [i32; 1]* = &arr;
- fn RuntimeCallIsValid(a: i32, b: i32) -> i32 {
- return Sub(a, b);
- }
- // --- overflow.carbon
- package Overflow;
- 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);
|