diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-03-12 19:55:48 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-03-13 03:41:31 -0400 |
| commit | 0bc96354909c0828b7fd36ce0be5705b7b21d63c (patch) | |
| tree | 2b544abbf34776414478cb5fe4b8baad661337b3 /test/behavior/floatop.zig | |
| parent | 7ec2261dbf7a85f5c215f2dac22b80fca7de1e0f (diff) | |
| download | zig-0bc96354909c0828b7fd36ce0be5705b7b21d63c.tar.gz zig-0bc96354909c0828b7fd36ce0be5705b7b21d63c.zip | |
stage2: add debug info for locals in the LLVM backend
Adds 2 new AIR instructions:
* dbg_var_ptr
* dbg_var_val
Sema no longer emits dbg_stmt AIR instructions when strip=true.
LLVM backend: fixed lowerPtrToVoid when calling ptrAlignment on
the element type is problematic.
LLVM backend: fixed alloca instructions improperly getting debug
location annotated, causing chaotic debug info behavior.
zig_llvm.cpp: fixed incorrect bindings for a function that should use
unsigned integers for line and column.
A bunch of C test cases regressed because the new dbg_var AIR
instructions caused their operands to be alive, exposing latent bugs.
Mostly it's just a problem that the C backend lowers mutable
and const slices to the same C type, so we need to represent that in the
C backend instead of printing two duplicate typedefs.
Diffstat (limited to 'test/behavior/floatop.zig')
| -rw-r--r-- | test/behavior/floatop.zig | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/test/behavior/floatop.zig b/test/behavior/floatop.zig index 11c15e7612..d82637b24d 100644 --- a/test/behavior/floatop.zig +++ b/test/behavior/floatop.zig @@ -302,7 +302,11 @@ fn testExp2() !void { } test "@log" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO comptime try testLog(); try testLog(); @@ -326,13 +330,22 @@ fn testLog() !void { try expect(math.approxEqAbs(ty, @log(@as(ty, 2)), 0.6931471805599, eps)); try expect(math.approxEqAbs(ty, @log(@as(ty, 5)), 1.6094379124341, eps)); } +} + +test "@log with vectors" { + if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO { - var v: Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 }; + var v: @Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 }; var result = @log(v); try expect(math.approxEqAbs(f32, @log(@as(f32, 1.1)), result[0], epsilon)); try expect(math.approxEqAbs(f32, @log(@as(f32, 2.2)), result[1], epsilon)); - try expect(math.approxEqAbs(f32, @log(@as(f32, 0.3)), result[2], epsilon)); + try expect(@log(@as(f32, 0.3)) == result[2]); try expect(math.approxEqAbs(f32, @log(@as(f32, 0.4)), result[3], epsilon)); } } |
