-
Notifications
You must be signed in to change notification settings - Fork 201
Conversation
The test fails with:
Can somebody help me with fixing it? |
The immediate problem is that the x86 backend only supports 3 integer values to be returned in registers, and after splitting the i128 into two, the function would require 4 integer return registers. We'll need to convert functions with return types like that to use out parameters. One way to do that is to require frontends to lower such code to using out parameters instead -- and ideally add helper routines in cranelift-frontend to make it easy for frontends to do this. Another would be to teach the legalization phase in cranelift-codegen to convert such return types into out parameters. I have a mild preference for the former, to keep the code in cranelift-codegen as simple as possible, though either would work. |
For the record, 3 integer types is more than is specified in the System V ABI, but is consistent with LLVM. |
That explains it. Using an out param when a value returned ByValPair consists of two i128 values should workaround this problem for cg_clif then.
When this option is chosen, it would be nice to add a verifier error for more than three ret values on x86. I want to add some legalizations for loading and storing i128 before this is merged. |
I got the cg_clif side working: https://github.com/bjorn3/rustc_codegen_cranelift/pull/627 |
How do you expect to implement things like add/sub/mul on i128 types? |
|
486e40b
to
5be940f
Compare
The linux build timed out during cache unpacking. The macOS build did succeed however. |
Travis is failing during cache (un)packing again. |
Eek, I don't know what's going on with Travis here. If anyone has any ideas of what we should do here, please share :-}. |
I've run into issues with Travis timing out before, and its been doing it more lately. In general going to Travis and clicking restart build helps, have you tried that? (If that doesn't work, then maybe it is timing out downloading caches?) |
I've now clicked "restart build". |
Travis is green |
@bnjbvr could you review this? |
Yes, I could get to it; unfortunately I'm a bit in a review debt situation, so there might be many other things before I can come back to this. |
Thanks! |
Sorry, I realistically don't have the time these days to review this, deferring to Dan. |
…ct number of arguments
… during legalization
Rebased |
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.
Cool, thanks for seeing this all the way through!
I can finally move cg_clif back to upstream Cranelift 🎉 |
cc #354
This adds a i128 type. While only
iconcat
andisplit
support them, this makes it easiercg_clif
to handle 128 bit integers, as the low and high bits are bundled together.cg_clif
would need a bigger change to special casei128
as not consisting of just oneValue
. It also makes it easier to inspect the ir generated bycg_clif
, as there is no need to think about which two values together represent thei128
.You can create an
i128
value by usingiconcat
with twoi64
values: first the lsb, then the msb (on little endian)TODO