| ... | @@ -18,6 +18,11 @@ const linux_riscv64 = std.zig.CrossTarget{ | ... | @@ -18,6 +18,11 @@ const linux_riscv64 = std.zig.CrossTarget{ |
| 18 | .os_tag = .linux, | 18 | .os_tag = .linux, |
| 19 | }; | 19 | }; |
| 20 | | 20 | |
| | 21 | const linux_arm = std.zig.CrossTarget{ |
| | 22 | .cpu_arch = .arm, |
| | 23 | .os_tag = .linux, |
| | 24 | }; |
| | 25 | |
| 21 | const wasi = std.zig.CrossTarget{ | 26 | const wasi = std.zig.CrossTarget{ |
| 22 | .cpu_arch = .wasm32, | 27 | .cpu_arch = .wasm32, |
| 23 | .os_tag = .wasi, | 28 | .os_tag = .wasi, |
| ... | @@ -181,6 +186,41 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -181,6 +186,41 @@ pub fn addCases(ctx: *TestContext) !void { |
| 181 | ); | 186 | ); |
| 182 | } | 187 | } |
| 183 | | 188 | |
| | 189 | { |
| | 190 | var case = ctx.exe("hello world", linux_arm); |
| | 191 | // Regular old hello world |
| | 192 | case.addCompareOutput( |
| | 193 | \\export fn _start() noreturn { |
| | 194 | \\ print(); |
| | 195 | \\ exit(); |
| | 196 | \\} |
| | 197 | \\ |
| | 198 | \\fn print() void { |
| | 199 | \\ asm volatile ("svc #0" |
| | 200 | \\ : |
| | 201 | \\ : [number] "{r7}" (4), |
| | 202 | \\ [arg1] "{r0}" (1), |
| | 203 | \\ [arg2] "{r1}" (@ptrToInt("Hello, World!\n")), |
| | 204 | \\ [arg3] "{r2}" (14) |
| | 205 | \\ : "memory" |
| | 206 | \\ ); |
| | 207 | \\ return; |
| | 208 | \\} |
| | 209 | \\ |
| | 210 | \\fn exit() noreturn { |
| | 211 | \\ asm volatile ("svc #0" |
| | 212 | \\ : |
| | 213 | \\ : [number] "{r7}" (1), |
| | 214 | \\ [arg1] "{r0}" (0) |
| | 215 | \\ : "memory" |
| | 216 | \\ ); |
| | 217 | \\ unreachable; |
| | 218 | \\} |
| | 219 | , |
| | 220 | "Hello, World!\n", |
| | 221 | ); |
| | 222 | } |
| | 223 | |
| 184 | { | 224 | { |
| 185 | var case = ctx.exe("adding numbers at comptime", linux_x64); | 225 | var case = ctx.exe("adding numbers at comptime", linux_x64); |
| 186 | case.addCompareOutput( | 226 | case.addCompareOutput( |