commit f6b95166ebfce9faf3cc0806c6feb089e6922a2e (tree)
parent 47b136e3b353932d754c359ae63a1206842d0d70
Author: Koakuma <koachan@protonmail.com>
Date: Thu, 14 Apr 2022 21:59:25 +0700
stage2: sparcv9: Add simple test case
Diffstat:
1 file changed, 39 insertions(+), 0 deletions(-)
diff --git a/test/stage2/sparcv9.zig b/test/stage2/sparcv9.zig
@@ -0,0 +1,39 @@
+const std = @import("std");
+const TestContext = @import("../../src/test.zig").TestContext;
+
+const linux_sparcv9 = std.zig.CrossTarget{
+ .cpu_arch = .sparcv9,
+ .os_tag = .linux,
+};
+
+pub fn addCases(ctx: *TestContext) !void {
+ {
+ var case = ctx.exe("sparcv9 hello world", linux_sparcv9);
+ // Regular old hello world
+ case.addCompareOutput(
+ \\const msg = "Hello, World!\n";
+ \\
+ \\pub export fn _start() noreturn {
+ \\ asm volatile ("ta 0x6d"
+ \\ :
+ \\ : [number] "{g1}" (4),
+ \\ [arg1] "{o0}" (1),
+ \\ [arg2] "{o1}" (@ptrToInt(msg)),
+ \\ [arg3] "{o2}" (msg.len)
+ \\ : "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", "memory"
+ \\ );
+ \\
+ \\ asm volatile ("ta 0x6d"
+ \\ :
+ \\ : [number] "{g1}" (1),
+ \\ [arg1] "{o0}" (0)
+ \\ : "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", "memory"
+ \\ );
+ \\
+ \\ unreachable;
+ \\}
+ ,
+ "Hello, World!\n",
+ );
+ }
+}