aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorjoachimschmidt557 <joachim.schmidt557@outlook.com>2022-02-12 21:12:18 +0100
committerjoachimschmidt557 <joachim.schmidt557@outlook.com>2022-02-14 22:09:44 +0100
commit783e216e7d49ce30032cd768ca266f5f08773bf4 (patch)
tree13bc364a2fec50885949698da74ebc83241d21af /test
parent1c37622659f70115b698b5924472c2268bca63a8 (diff)
downloadzig-783e216e7d49ce30032cd768ca266f5f08773bf4.tar.gz
zig-783e216e7d49ce30032cd768ca266f5f08773bf4.zip
stage2 AArch64: Fix issue in binOp and add regression test
Diffstat (limited to 'test')
-rw-r--r--test/stage2/aarch64.zig62
1 files changed, 44 insertions, 18 deletions
diff --git a/test/stage2/aarch64.zig b/test/stage2/aarch64.zig
index 580a375aef..b16a29f56f 100644
--- a/test/stage2/aarch64.zig
+++ b/test/stage2/aarch64.zig
@@ -17,15 +17,8 @@ pub fn addCases(ctx: *TestContext) !void {
var case = ctx.exe("linux_aarch64 hello world", linux_aarch64);
// Regular old hello world
case.addCompareOutput(
- \\pub export fn _start() noreturn {
+ \\pub fn main() void {
\\ print();
- \\ exit();
- \\}
- \\
- \\fn doNothing() void {}
- \\
- \\fn answer() u64 {
- \\ return 0x1234abcd1234abcd;
\\}
\\
\\fn print() void {
@@ -38,16 +31,6 @@ pub fn addCases(ctx: *TestContext) !void {
\\ : "memory", "cc"
\\ );
\\}
- \\
- \\fn exit() noreturn {
- \\ asm volatile ("svc #0"
- \\ :
- \\ : [number] "{x8}" (93),
- \\ [arg1] "{x0}" (0)
- \\ : "memory", "cc"
- \\ );
- \\ unreachable;
- \\}
,
"Hello, World!\n",
);
@@ -129,6 +112,49 @@ pub fn addCases(ctx: *TestContext) !void {
);
}
+ {
+ var case = ctx.exe("large add function", linux_aarch64);
+
+ case.addCompareOutput(
+ \\pub fn main() void {
+ \\ assert(add(3, 4) == 791);
+ \\}
+ \\
+ \\fn add(a: u32, b: u32) u32 {
+ \\ const x: u32 = blk: {
+ \\ const c = a + b; // 7
+ \\ const d = a + c; // 10
+ \\ const e = d + b; // 14
+ \\ const f = d + e; // 24
+ \\ const g = e + f; // 38
+ \\ const h = f + g; // 62
+ \\ const i = g + h; // 100
+ \\ const j = i + d; // 110
+ \\ const k = i + j; // 210
+ \\ const l = k + c; // 217
+ \\ const m = l + d; // 227
+ \\ const n = m + e; // 241
+ \\ const o = n + f; // 265
+ \\ const p = o + g; // 303
+ \\ const q = p + h; // 365
+ \\ const r = q + i; // 465
+ \\ const s = r + j; // 575
+ \\ const t = s + k; // 785
+ \\ break :blk t;
+ \\ };
+ \\ const y = x + a; // 788
+ \\ const z = y + a; // 791
+ \\ return z;
+ \\}
+ \\
+ \\fn assert(ok: bool) void {
+ \\ if (!ok) unreachable;
+ \\}
+ ,
+ "",
+ );
+ }
+
// macOS tests
{
var case = ctx.exe("hello world with updates", macos_aarch64);