aboutsummaryrefslogtreecommitdiff
path: root/src/arch/wasm/CodeGen.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-12-03 00:42:11 -0500
committerGitHub <noreply@github.com>2022-12-03 00:42:11 -0500
commitfdbb0fb7b9c08ebff1b7e45ef89f7160f350d44c (patch)
tree714f2766c64ace45df1f7d67ca70be0c88193184 /src/arch/wasm/CodeGen.zig
parentc43ac67f82cb5a022df67729aa1e6bebc22cfff2 (diff)
parentb500e0eb179218f5eb03408c09b5e5a928f0c46e (diff)
downloadzig-fdbb0fb7b9c08ebff1b7e45ef89f7160f350d44c.tar.gz
zig-fdbb0fb7b9c08ebff1b7e45ef89f7160f350d44c.zip
Merge pull request #13744 from Vexu/stage2-fixes
Improve error messages, fix dependency loops
Diffstat (limited to 'src/arch/wasm/CodeGen.zig')
-rw-r--r--src/arch/wasm/CodeGen.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig
index c424c7b59d..1d24076154 100644
--- a/src/arch/wasm/CodeGen.zig
+++ b/src/arch/wasm/CodeGen.zig
@@ -2670,11 +2670,11 @@ fn lowerConstant(func: *CodeGen, arg_val: Value, ty: Type) InnerError!WValue {
switch (int_info.signedness) {
.signed => switch (int_info.bits) {
0...32 => return WValue{ .imm32 = @intCast(u32, toTwosComplement(
- val.toSignedInt(),
+ val.toSignedInt(target),
@intCast(u6, int_info.bits),
)) },
33...64 => return WValue{ .imm64 = toTwosComplement(
- val.toSignedInt(),
+ val.toSignedInt(target),
@intCast(u7, int_info.bits),
) },
else => unreachable,
@@ -2841,15 +2841,15 @@ fn valueAsI32(func: *const CodeGen, val: Value, ty: Type) i32 {
}
},
.Int => switch (ty.intInfo(func.target).signedness) {
- .signed => return @truncate(i32, val.toSignedInt()),
+ .signed => return @truncate(i32, val.toSignedInt(target)),
.unsigned => return @bitCast(i32, @truncate(u32, val.toUnsignedInt(target))),
},
.ErrorSet => {
const kv = func.bin_file.base.options.module.?.getErrorValue(val.getError().?) catch unreachable; // passed invalid `Value` to function
return @bitCast(i32, kv.value);
},
- .Bool => return @intCast(i32, val.toSignedInt()),
- .Pointer => return @intCast(i32, val.toSignedInt()),
+ .Bool => return @intCast(i32, val.toSignedInt(target)),
+ .Pointer => return @intCast(i32, val.toSignedInt(target)),
else => unreachable, // Programmer called this function for an illegal type
}
}