aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/spirv.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-12-02 19:56:43 +0200
committerVeikka Tuominen <git@vexu.eu>2022-12-03 00:09:23 +0200
commit0e38cc16d51178525e89774ce9151651b6a0e99a (patch)
tree41e3768824dc156b70fccf506362f4fa7277e3ae /src/codegen/spirv.zig
parent7f9e841f746bb3eaf6ac205092a30bc7ed12a068 (diff)
downloadzig-0e38cc16d51178525e89774ce9151651b6a0e99a.tar.gz
zig-0e38cc16d51178525e89774ce9151651b6a0e99a.zip
Sema: fix comparisons between lazy and runtime values
Closes #12498
Diffstat (limited to 'src/codegen/spirv.zig')
-rw-r--r--src/codegen/spirv.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig
index ada3918baf..bd0c8bc53c 100644
--- a/src/codegen/spirv.zig
+++ b/src/codegen/spirv.zig
@@ -360,7 +360,7 @@ pub const DeclGen = struct {
// Note, value is required to be sign-extended, so we don't need to mask off the upper bits.
// See https://www.khronos.org/registry/SPIR-V/specs/unified1/SPIRV.html#Literal
- var int_bits = if (ty.isSignedInt()) @bitCast(u64, val.toSignedInt()) else val.toUnsignedInt(target);
+ var int_bits = if (ty.isSignedInt()) @bitCast(u64, val.toSignedInt(target)) else val.toUnsignedInt(target);
const value: spec.LiteralContextDependentNumber = switch (backing_bits) {
1...32 => .{ .uint32 = @truncate(u32, int_bits) },
@@ -763,7 +763,7 @@ pub const DeclGen = struct {
if (elem.isUndef()) {
self.func.body.writeOperand(spec.LiteralInteger, 0xFFFF_FFFF);
} else {
- const int = elem.toSignedInt();
+ const int = elem.toSignedInt(self.getTarget());
const unsigned = if (int >= 0) @intCast(u32, int) else @intCast(u32, ~int + a_len);
self.func.body.writeOperand(spec.LiteralInteger, unsigned);
}