afonso360 opened PR #3351 from parser-i128
to main
:
Hey,
This PR adds support for parsing
i128
data values, it also cleans up thei128
test suite to pass those values directly to the functions. (We previously passed the bottom and top half ini64
's andiconcat
them together)This causes a bunch of noise in the diff (sorry!). I've separated this into two commits, the first one with the parser changes, and the second one with test suite changes. It might be easier to review it that way.
Since we now pass i128's directly we need to enable the
enable_llvm_abi_extensions
flag. This is because thewindows_fastcall
ABI does not specify how to passi128
values to functions. This is only necessary for the tests to pass on x86_64 windows.It doesn't add support for
iconst.i128
since its instruction format (UnaryImm
) doesen't allow us to include a 128 bit value. We would need to change it toUnaryConst
for that.
afonso360 updated PR #3351 from parser-i128
to main
.
cfallin submitted PR review.
cfallin submitted PR review.
cfallin created PR review comment:
Why is this different (
ne
rather thanle
)? It would be useful to have a comment here explaining why we need to use native endian rather than explicit little endian as in the other cases.
cfallin created PR review comment:
I see the duplication is pre-existing, but it's also unfortunate to continue it here. While it may expand the scope of this PR a bit, I wonder if there's a way to write a single polymorphic implementation? Maybe it can take the signed/unsigned types and require
FromStr
/FromHex
/ whatever encapsulateswrapping_neg
?
afonso360 submitted PR review.
afonso360 created PR review comment:
We actually do need
ne
in the other ones (for big endian systems), however changingle
->ne
is already in a separate PR (#3329).
cfallin submitted PR review.
cfallin created PR review comment:
Ah, yes, this makes sense. Thanks for the nudge -- I re-read the issue and decided to merge #3329 to resolve the immediate regression on s390x (so this line now matches what's on
main
), and created a new issue to track the broader question of endianness in the interpreter.
afonso360 updated PR #3351 from parser-i128
to main
.
afonso360 updated PR #3351 from parser-i128
to main
.
afonso360 submitted PR review.
afonso360 created PR review comment:
I tried doing this as a generic function, but it was proving to be somewhat difficult, most of the functions that we need / could use are not in separate traits, but as functions associated with the primitive types.
FromStr
works, butFromHex
doesen't exist. Casting between signed and unsigned types in a generic function, as far as I can tell is a no go.We could solve pretty much all of these problems by adding a dependency on the num crate, but I don't think this justifies it.
I've implemented this as a macro, hope that is ok.
afonso360 requested cfallin for a review on PR #3351.
cfallin submitted PR review.
cfallin submitted PR review.
cfallin created PR review comment:
Perfect, thank you!
cfallin merged PR #3351.
Last updated: Nov 22 2024 at 16:03 UTC