-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make @boolToInt always return a u1 #15701
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small style nits.
Signed-off-by: tison <[email protected]>
There seems some more type inconsistent. I'm handling it:
@Vexu could you avoid force push before we are pending for merging? Otherwise it's hard for me to fetch your changes. |
Signed-off-by: tison <[email protected]>
My bad, lol. |
Signed-off-by: tison <[email protected]>
A new issue without source code location. Let me try to reproduce it locally. |
There are plenty of other error you might want to start with if you skip the 3000 lines of noise. |
Signed-off-by: tison <[email protected]>
Fix the test result issue. For translate C issue, locally it logs:
May I ask where this translate logic stay? |
That is generated with |
@Vexu Thanks for your information! I'll appreciate it if you can help in updating the related logics. I took a look at |
It seems now all aarch64 tests passed but x86_64 ones failed. How can our changes be related to arch? Related logs:
|
Note that not all runners run the same tests, and that Specifically, diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig
index a258f732f..594a1381a 100644
--- a/src/arch/x86_64/CodeGen.zig
+++ b/src/arch/x86_64/CodeGen.zig
@@ -10105,18 +10105,22 @@ fn airBitCast(self: *Self, inst: Air.Inst.Index) !void {
const dst_rc = regClassForType(dst_ty);
const src_rc = regClassForType(src_ty);
const src_mcv = try self.resolveInst(ty_op.operand);
- if (dst_rc.supersetOf(src_rc) and self.reuseOperand(inst, ty_op.operand, 0, src_mcv))
- break :result src_mcv;
const src_lock = if (src_mcv.getReg()) |reg| self.register_manager.lockReg(reg) else null;
defer if (src_lock) |lock| self.register_manager.unlockReg(lock);
- const dst_mcv = try self.allocRegOrMem(inst, true);
- try self.genCopy(
- if (!dst_mcv.isMemory() or src_mcv.isMemory()) dst_ty else src_ty,
- dst_mcv,
- src_mcv,
- );
+ const dst_mcv = if (dst_rc.supersetOf(src_rc) and
+ self.reuseOperand(inst, ty_op.operand, 0, src_mcv))
+ src_mcv
+ else dst: {
+ const dst_mcv = try self.allocRegOrMem(inst, true);
+ try self.genCopy(
+ if (!dst_mcv.isMemory() or src_mcv.isMemory()) dst_ty else src_ty,
+ dst_mcv,
+ src_mcv,
+ );
+ break :dst dst_mcv;
+ };
const dst_signedness =
if (dst_ty.isAbiInt()) dst_ty.intInfo(self.target.*).signedness else .unsigned; |
@jacobly0 Thank you! I've merged the latest master branch. Could you approve the CI workflow here? |
The langref should be updated: {#header_open|@boolToInt#}
<pre>{#syntax#}@boolToInt(value: bool) u1{#endsyntax#}</pre>
<p>
Converts {#syntax#}true{#endsyntax#} to {#syntax#}@as(u1, 1){#endsyntax#} and {#syntax#}false{#endsyntax#} to
{#syntax#}@as(u1, 0){#endsyntax#}.
</p>
- <p>
- If the value is known at compile-time, the return type is {#syntax#}comptime_int{#endsyntax#}
- instead of {#syntax#}u1{#endsyntax#}.
- </p>
{#header_close#} Anyway, wouldn't it be better if we just remove
|
@r00ster91 I'm updating the doc... For drop Since it has the similar effect of #7950 and #7950 has been accepted, I'll proceed this patch and wait for ideas on dropping |
Signed-off-by: tison <[email protected]>
Docs updated. |
I'd like to hear Andrew's opinion on #15794 first. |
@Vexu That sounds reasonable. Although, as #7950 was accepted and #7950 doesn't conflict #15794, this pull request can even be a prerequisite of #15794 since it fixes all recipients of |
This closes #7950.
cc @andrewrk @mlugg in case this patch helps.