aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-05-17 19:30:38 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-05-17 19:30:38 -0700
commit615d45da779842715a3ab65b59233e9cfb4fa122 (patch)
tree9c269e8fa9beded00954d82ebc0c95d56c485322 /test
parent1d3f76bbda90f810a24845c15516235d91ee12ad (diff)
parent0dd0c9620d66afcfabaf3dcb21b636530fd0ccba (diff)
downloadzig-615d45da779842715a3ab65b59233e9cfb4fa122.tar.gz
zig-615d45da779842715a3ab65b59233e9cfb4fa122.zip
Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
Conflicts: * src/codegen/spirv.zig * src/link/SpirV.zig We're going to want to improve the stage2 test harness to print the source file name when a compile error occurs otherwise std lib contributors are going to see some confusing CI failures when they cause stage2 AstGen compile errors.
Diffstat (limited to 'test')
-rw-r--r--test/stage2/arm.zig39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/stage2/arm.zig b/test/stage2/arm.zig
index e00a5e8bfb..6b4f569757 100644
--- a/test/stage2/arm.zig
+++ b/test/stage2/arm.zig
@@ -367,5 +367,44 @@ pub fn addCases(ctx: *TestContext) !void {
,
"",
);
+
+ case.addCompareOutput(
+ \\pub fn main() void {
+ \\ assert(addMul(3, 4) == 357747496);
+ \\}
+ \\
+ \\fn addMul(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; // 2170
+ \\ const n = m + e; // 2184
+ \\ const o = n * f; // 52416
+ \\ const p = o + g; // 52454
+ \\ const q = p * h; // 3252148
+ \\ const r = q + i; // 3252248
+ \\ const s = r * j; // 357747280
+ \\ const t = s + k; // 357747490
+ \\ break :blk t;
+ \\ };
+ \\ const y = x + a; // 357747493
+ \\ const z = y + a; // 357747496
+ \\ return z;
+ \\}
+ \\
+ \\fn assert(ok: bool) void {
+ \\ if (!ok) unreachable;
+ \\}
+ ,
+ "",
+ );
}
}