aarch64: add new from scratch self-hosted backend by jacobly0 · Pull Request #24536 · ziglang/zig

1 min read Original article ↗

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick, but this is odd -- surely we shouldn't be adding bigints to the pool at all if something smaller works?

Skimming the list of tags, it looks like we don't have a representation for the i64 case (.int_small), but we do for the u64 case. I think we should probably change int_small to an i64, because I suspect (but have not confirmed) that small negative values are significantly more common than values >= 1<<63. Then, this block would be:

.storage = s: {
    assert(big_int.toInt(i64) == null); // if this fit we would have used `Tag.int_small` instead
    if (big_int.toInt(u64)) |x| break :s .{ .u64 = x };
    break :s .{ .big_int = big_int };
},