zig/test/cases/asm.zig
2017-04-04 19:47:22 -04:00

24 lines
429 B
Zig

const assert = @import("std").debug.assert;
comptime {
if (@compileVar("arch") == Arch.x86_64) {
asm volatile (
\\.globl aoeu;
\\.type aoeu, @function;
\\.set aoeu, derp;
);
}
}
test "module level assembly" {
if (@compileVar("arch") == Arch.x86_64) {
assert(aoeu() == 1234);
}
}
extern fn aoeu() -> i32;
export fn derp() -> i32 {
return 1234;
}