mirror of
https://github.com/ziglang/zig.git
synced 2024-12-17 16:50:13 +00:00
22 lines
367 B
Zig
22 lines
367 B
Zig
const std = @import("std");
|
|
const expect = std.testing.expect;
|
|
|
|
comptime {
|
|
asm (
|
|
\\.global my_func;
|
|
\\.type my_func, @function;
|
|
\\my_func:
|
|
\\ lea (%rdi,%rsi,1),%eax
|
|
\\ retq
|
|
);
|
|
}
|
|
|
|
extern fn my_func(a: i32, b: i32) i32;
|
|
|
|
test "global assembly" {
|
|
try expect(my_func(12, 34) == 46);
|
|
}
|
|
|
|
// test
|
|
// target=x86_64-linux
|