mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 14:01:05 +01:00
Generalize the f64 support to support other sizes. Also provide interop support for `float`, `_Float16`, and `__float128`. Also lay some groundwork for non-standard floating-point types, though we don't have any syntax to name them yet.
49 lines
1.9 KiB
Plaintext
49 lines
1.9 KiB
Plaintext
// 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/float/mul_assign.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/mul_assign.carbon
|
|
|
|
// --- call.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
fn Builtin(a: f64*, b: f64) = "float.mul_assign";
|
|
|
|
fn Call(a: f64*, b: f64) {
|
|
Builtin(a, b);
|
|
}
|
|
|
|
// --- fail_bad_decl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature]
|
|
// CHECK:STDERR: fn NotPtr(a: f64, b: f64) = "float.mul_assign";
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
fn NotPtr(a: f64, b: f64) = "float.mul_assign";
|
|
|
|
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature]
|
|
// CHECK:STDERR: fn MixedTypes(a: f64*, b: f32) = "float.mul_assign";
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
fn MixedTypes(a: f64*, b: f32) = "float.mul_assign";
|
|
|
|
// --- fail_literal.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
fn Literal() -> type = "float_literal.make_type";
|
|
// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature]
|
|
// CHECK:STDERR: fn LiteralRuntime(a: Literal()*, b: Literal()) = "float.mul_assign";
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
fn LiteralRuntime(a: Literal()*, b: Literal()) = "float.mul_assign";
|