From 4a63189bf1275aed3f3f170e46eff10b15e61157 Mon Sep 17 00:00:00 2001 From: pfg Date: Sat, 4 Jul 2020 15:30:17 -0700 Subject: [PATCH] stage2: add and @as tests --- test/stage2/compare_output.zig | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/stage2/compare_output.zig b/test/stage2/compare_output.zig index d49f16876e..1f2853707a 100644 --- a/test/stage2/compare_output.zig +++ b/test/stage2/compare_output.zig @@ -118,4 +118,29 @@ pub fn addCases(ctx: *TestContext) !void { \\ ); } + + { + var case = ctx.exe("adding numbers", linux_x64); + case.addCompareOutput( + \\export fn _start() noreturn { + \\ asm volatile ("syscall" + \\ : + \\ : [number] "{rax}" (1), + \\ [arg1] "{rdi}" (1), + \\ [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), + \\ [arg3] "{rdx}" (10 + 4) + \\ : "rcx", "r11", "memory" + \\ ); + \\ asm volatile ("syscall" + \\ : + \\ : [number] "{rax}" (@as(usize, 230) + @as(usize, 1)), + \\ [arg1] "{rdi}" (0) + \\ : "rcx", "r11", "memory" + \\ ); + \\ unreachable; + \\} + , + "Hello, World!\n", + ); + } }