File tree Expand file tree Collapse file tree
lit/check_monomorphization Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- // RUN: %aslrun %s --import=FFI_Call128 --export=FFI_Extract128_32 -- extra-c=%S/ffi_export_00.c | filecheck %s
1+ // RUN: %aslrun %s --extra-c=%S/ffi_export_00.c | filecheck %s
22// Copyright (C) 2025-2026 Intel Corporation
33
44// UNSUPPORTED: interpreter
55
6+ foreign import function "FFI_Call128" = FFI_Call128 with {};
7+ foreign export function "FFI_Extract128_32" = FFI_Extract128_32 with {};
8+
69// Function imported from C
710function FFI_Call128(x : Bits(128)) -> Bits(32);
811
Original file line number Diff line number Diff line change 1- // RUN: %aslrun %s --configuration=%S/ffi_export_01.json -- extra-c=%S/ffi_export_01.c | filecheck %s
1+ // RUN: %aslrun %s --extra-c=%S/ffi_export_01.c | filecheck %s
22// Copyright (C) 2025-2026 Intel Corporation
33
44// UNSUPPORTED: interpreter
55
6+ foreign export type "E" = E;
7+ foreign export function "FFI_bits8" = FFI_bits8 with {};
8+ foreign export function "FFI_bits16" = FFI_bits16 with {};
9+ foreign export function "FFI_bits32" = FFI_bits32 with {};
10+ foreign export function "FFI_bits64" = FFI_bits64 with {};
11+ foreign export function "FFI_bits2" = FFI_bits2 with {};
12+ foreign export function "FFI_bits17" = FFI_bits17 with {};
13+ foreign export function "FFI_bits65" = FFI_bits65 with {};
14+ foreign export function "FFI_bits127" = FFI_bits127 with {};
15+ foreign export function "FFI_bits128" = FFI_bits128 with {};
16+ foreign export function "FFI_string" = FFI_string with {};
17+ foreign export function "FFI_E" = FFI_E with {};
18+ foreign export function "FFI_Boolean" = FFI_Boolean with {};
19+ foreign export function "FFI_integer" = FFI_integer with {};
20+ foreign export function "FFI_sint17" = FFI_sint17 with {};
21+ foreign export function "FFI_int_bool" = FFI_int_bool with {};
22+
23+ foreign import function "FFI_test_exports" = FFI_test_exports with {};
24+
625enumeration E = { A, B, C };
726
827// to be exported
Load diff This file was deleted.
Original file line number Diff line number Diff line change 1- // RUN: %aslrun %s --import=FFI_Invert32 --import=FFI_Invert128 -- extra-c=%S/ffi_import_00.c | filecheck %s
1+ // RUN: %aslrun %s --extra-c=%S/ffi_import_00.c | filecheck %s
22// Copyright (C) 2025-2026 Intel Corporation
33
44// UNSUPPORTED: interpreter
55
6+ foreign import function "FFI_Invert32" = FFI_Invert with { size => 32 };
7+ foreign import function "FFI_Invert128" = FFI_Invert with { size => 128 };
8+
69// The following functions will be replaced by
710// a version that is defined externally.
811// Normally, the internal and external version have
912// similar behaviour but, for testing purposes, the
1013// internal version is the identity function
1114// and the external version inverts its argument.
12- function FFI_Invert32(x : Bits(32)) -> Bits(32)
13- begin
14- return x;
15- end
16-
17- function FFI_Invert128(x : Bits(128)) -> Bits(128)
18- begin
19- return x;
20- end
15+ function FFI_Invert(implicit size : {0..}, x : Bits(size)) -> Bits(size);
2116
2217function main() -> Builtin::Foreign::CInt
2318begin
24- Std::Print::Bits::Hex(FFI_Invert32 (32'x3)); Print("\n");
19+ Std::Print::Bits::Hex(FFI_Invert (32'x3)); Print("\n");
2520 // CHECK: 32'xfffffffc
2621
27- Std::Print::Bits::Hex(FFI_Invert128 (128'x3)); Print("\n");
22+ Std::Print::Bits::Hex(FFI_Invert (128'x3)); Print("\n");
2823 // CHECK: 128'xfffffffffffffffffffffffffffffffc
2924
3025 return Builtin::Foreign::CInt::From_Integer(0);
Original file line number Diff line number Diff line change 1- // RUN: %aslrun %s --configuration=%S/ffi_import_01.json -- extra-c=%S/ffi_import_01.c | filecheck %s
1+ // RUN: %aslrun %s --extra-c=%S/ffi_import_01.c | filecheck %s
22// Copyright (C) 2025-2026 Intel Corporation
33
44// UNSUPPORTED: interpreter
55
6+ foreign export type "E" = E;
7+ foreign import function "FFI_null_bits8" = FFI_null_bits8 with {};
8+ foreign import function "FFI_null_bits16" = FFI_null_bits16 with {};
9+ foreign import function "FFI_null_bits32" = FFI_null_bits32 with {};
10+ foreign import function "FFI_null_bits64" = FFI_null_bits64 with {};
11+ foreign import function "FFI_null_bits2" = FFI_null_bits2 with {};
12+ foreign import function "FFI_null_bits17" = FFI_null_bits17 with {};
13+ foreign import function "FFI_null_bits65" = FFI_null_bits65 with {};
14+ foreign import function "FFI_null_bits127" = FFI_null_bits127 with {};
15+ foreign import function "FFI_null_bits128" = FFI_null_bits128 with {};
16+ foreign import function "FFI_null_string" = FFI_null_string with {};
17+ foreign import function "FFI_null_E" = FFI_null_E with {};
18+ foreign import function "FFI_null_Boolean" = FFI_null_Boolean with {};
19+ foreign import function "FFI_null_integer" = FFI_null_integer with {};
20+ foreign import function "FFI_null_sint17" = FFI_null_sint17 with {};
21+ foreign import function "FFI_int_bool" = FFI_int_bool with {};
22+
623enumeration E = { A, B, C };
724
825// to be defined externally
Load diff This file was deleted.
Load diff This file was deleted.
Original file line number Diff line number Diff line change 1- // RUN: %iii --batchmode --configuration=%S/config.json -- project=%S/iii.prj %s | filecheck %s
1+ // RUN: %iii --batchmode --project=%S/iii.prj %s | filecheck %s
22// Copyright (C) 2024-2026 Intel Corporation
33
44function C(x : Bits(N)) -> Integer
1616 return B(0b0);
1717end
1818
19+ foreign export function "A" = A with {};
20+
1921// CHECK: WARNING: Bitwidth parameters are not statically known in the following definitions.
2022// CHECK-NEXT: This will cause code generation to fail.
2123//
You can’t perform that action at this time.
0 commit comments