authorgravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-04-14 21:59:25+07:00
committergravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-04-14 22:18:06+07:00
logf6b95166ebfce9faf3cc0806c6feb089e6922a2e
treefe8bdee3a233e8cda99ceafcbc605b4e974aecd6
parent47b136e3b353932d754c359ae63a1206842d0d70

stage2: sparcv9: Add simple test case


1 files changed, 39 insertions(+), 0 deletions(-)

test/stage2/sparcv9.zig created+39
......@@ -0,0 +1,39 @@
1const std = @import("std");
2const TestContext = @import("../../src/test.zig").TestContext;
3
4const linux_sparcv9 = std.zig.CrossTarget{
5 .cpu_arch = .sparcv9,
6 .os_tag = .linux,
7};
8
9pub fn addCases(ctx: *TestContext) !void {
10 {
11 var case = ctx.exe("sparcv9 hello world", linux_sparcv9);
12 // Regular old hello world
13 case.addCompareOutput(
14 \\const msg = "Hello, World!\n";
15 \\
16 \\pub export fn _start() noreturn {
17 \\ asm volatile ("ta 0x6d"
18 \\ :
19 \\ : [number] "{g1}" (4),
20 \\ [arg1] "{o0}" (1),
21 \\ [arg2] "{o1}" (@ptrToInt(msg)),
22 \\ [arg3] "{o2}" (msg.len)
23 \\ : "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", "memory"
24 \\ );
25 \\
26 \\ asm volatile ("ta 0x6d"
27 \\ :
28 \\ : [number] "{g1}" (1),
29 \\ [arg1] "{o0}" (0)
30 \\ : "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", "memory"
31 \\ );
32 \\
33 \\ unreachable;
34 \\}
35 ,
36 "Hello, World!\n",
37 );
38 }
39}