Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mcpp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
members = [
"tests/examples/archive",
"tests/examples/asio",
"tests/examples/asm-macos-spike",
"tests/examples/asio-module",
"tests/examples/build-mcpp",
"tests/examples/cjson",
Expand Down
9 changes: 9 additions & 0 deletions tests/examples/asm-macos-spike/asm/add_arm64.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// R2 spike: minimal aarch64 GAS .S — proves mcpp assembles + links a GAS .S TU
// on macos-15 (the #1 macOS unknown; FFmpeg/OpenCV SIMD on arm64 is GAS .S).
// macOS arm64 ABI: w0=arg0, w1=arg1, result in w0; C symbol `asm_add` -> `_asm_add`.
.text
.p2align 2
.globl _asm_add
_asm_add:
add w0, w0, w1
ret
9 changes: 9 additions & 0 deletions tests/examples/asm-macos-spike/mcpp.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# R2 spike (TEMP — remove after the macOS .S path is proven): compile one
# aarch64 GAS .S unit on macos-15 and link it into a test. cfg(macos)-gated so
# the aarch64 asm is only assembled on macOS; a no-op main elsewhere.
[package]
name = "asm-macos-spike-tests"
version = "0.1.0"

[target.'cfg(macos)'.build]
sources = ["asm/add_arm64.S"]
11 changes: 11 additions & 0 deletions tests/examples/asm-macos-spike/tests/spike.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifdef __APPLE__
import std;
extern "C" int asm_add(int, int); // defined in asm/add_arm64.S
int main() {
int r = asm_add(2, 3);
std::println("asm-macos-spike: aarch64 .S linked OK, asm_add(2,3)={}", r);
return r == 5 ? 0 : 1;
}
#else
int main() { return 0; }
#endif
Loading