| ... | @@ -53,9 +53,12 @@ tracked_allocas: std.AutoHashMapUnmanaged(Id, ?Id) = .empty, | ... | @@ -53,9 +53,12 @@ tracked_allocas: std.AutoHashMapUnmanaged(Id, ?Id) = .empty, |
| 53 | loop_switches: std.AutoHashMapUnmanaged(Air.Inst.Index, LoopSwitch) = .empty, | 53 | loop_switches: std.AutoHashMapUnmanaged(Air.Inst.Index, LoopSwitch) = .empty, |
| 54 | id_scratch: std.ArrayList(Id) = .empty, | 54 | id_scratch: std.ArrayList(Id) = .empty, |
| 55 | | 55 | |
| | 56 | fn hasInt64(target: *const std.Target) bool { |
| | 57 | return target.cpu.arch == .spirv64 or target.cpu.has(.spirv, .int64); |
| | 58 | } |
| | 59 | |
| 56 | fn bigIntBits(cg: *const CodeGen) u16 { | 60 | fn bigIntBits(cg: *const CodeGen) u16 { |
| 57 | const target = cg.zcu.getTarget(); | 61 | return if (hasInt64(cg.zcu.getTarget())) 64 else 32; |
| 58 | return if (target.cpu.has(.spirv, .int64)) 64 else 32; | | |
| 59 | } | 62 | } |
| 60 | | 63 | |
| 61 | fn limbType(cg: *const CodeGen) Type { | 64 | fn limbType(cg: *const CodeGen) Type { |
| ... | @@ -487,7 +490,7 @@ pub fn backingIntBits(cg: *const CodeGen, bits: u16) struct { u16, bool } { | ... | @@ -487,7 +490,7 @@ pub fn backingIntBits(cg: *const CodeGen, bits: u16) struct { u16, bool } { |
| 487 | .{ .bits = 8, .enabled = target.cpu.has(.spirv, .int8) }, | 490 | .{ .bits = 8, .enabled = target.cpu.has(.spirv, .int8) }, |
| 488 | .{ .bits = 16, .enabled = target.cpu.has(.spirv, .int16) }, | 491 | .{ .bits = 16, .enabled = target.cpu.has(.spirv, .int16) }, |
| 489 | .{ .bits = 32, .enabled = true }, | 492 | .{ .bits = 32, .enabled = true }, |
| 490 | .{ .bits = 64, .enabled = target.cpu.has(.spirv, .int64) or target.cpu.arch == .spirv64 }, | 493 | .{ .bits = 64, .enabled = hasInt64(target) }, |
| 491 | }; | 494 | }; |
| 492 | | 495 | |
| 493 | for (ints) |int| { | 496 | for (ints) |int| { |
| ... | @@ -5273,7 +5276,7 @@ fn airMulOverflow(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -5273,7 +5276,7 @@ fn airMulOverflow(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5273 | // of the result too. | 5276 | // of the result too. |
| 5274 | | 5277 | |
| 5275 | const target = cg.zcu.getTarget(); | 5278 | const target = cg.zcu.getTarget(); |
| 5276 | const largest_int_bits: u16 = if (target.cpu.has(.spirv, .int64) or target.cpu.arch == .spirv64) 64 else 32; | 5279 | const largest_int_bits: u16 = if (hasInt64(target)) 64 else 32; |
| 5277 | // If non-null, the number of bits that the multiplication should be performed in. If | 5280 | // If non-null, the number of bits that the multiplication should be performed in. If |
| 5278 | // null, we have to use wide multiplication. | 5281 | // null, we have to use wide multiplication. |
| 5279 | const maybe_op_ty_bits: ?u16 = switch (info.bits) { | 5282 | const maybe_op_ty_bits: ?u16 = switch (info.bits) { |