[codegen] add encodings for iadd carry variants#961
[codegen] add encodings for iadd carry variants#961bnjbvr merged 9 commits intobytecodealliance:masterfrom
Conversation
Add encodings for iadd carry variants (iadd_cout, iadd_cin, iadd_carry) for x86_32, enabling the legalization for iadd.i64 to work. Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1576675 Bug: https://github.com/CraneStation/cranelift/issues/765
|
Could you please add tests? |
|
There is an issue though: |
You could take 64bit as function arguments. You could also explicitly test |
bnjbvr
left a comment
There was a problem hiding this comment.
You're going into the right direction! Since iadd_cin/cout have never been properly encoded, I think the right fix here is actually to change the instruction's format itself.
Yeah, that's simple preopt trying to optimize In the meanwhile, @bjorn3 's suggestion of using parameters sounds great for testing. |
Previously, the carry variants of iadd (iadd_cin, iadd_cout and iadd_carry) were being legalized for isa/riscv since RISC architectures lack a flags register. This forced us to return and accept booleans for these operations, which proved to be problematic and inconvenient, especially for x86. This commit removes support for said statements and all dependent statements for isa/riscv so that we can work on a better legalization strategy in the future.
The type of the carry operands for the carry variants of the iadd instruction (iadd_cin, iadd_cout, iadd_carry) was bool for compatibility reasons for isa/riscv. Since support for these instructions on RISC architectures has been temporarily suspended, we can safely change the type to iflags.
|
@ryzokuken I think you forgot to stage a file in the last commit. The operand type for iadd carry variants hasn't been changed. |
|
Didn't see that commit :) |
bnjbvr
left a comment
There was a problem hiding this comment.
Looks great to me, thanks for adding tests!
|
(I squashed all the commits together because Github doesn't do autosquash on merges; next time feel free to autosquash locally before pushing!) |
…SC ISAs Reintroduce support for iadd carry variants and isub borrow variants for RISC ISAs which had been removed in bytecodealliance#961 and bytecodealliance#962 because of the lack of a proper flags register in RISC architectures.
…SC ISAs Reintroduce support for iadd carry variants and isub borrow variants for RISC ISAs which had been removed in bytecodealliance#961 and bytecodealliance#962 because of the lack of a proper flags register in RISC architectures.
bytecodealliance#1005) Reintroduce support for iadd carry variants and isub borrow variants for RISC ISAs which had been removed in bytecodealliance/cranelift#961 and bytecodealliance/cranelift#962 because of the lack of a proper flags register in RISC architectures.
Add encodings for iadd carry variants (iadd_cout, iadd_cin, iadd_carry)
for x86_32, enabling the legalization for iadd.i64 to work.
Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1576675
Bug: https://github.com/CraneStation/cranelift/issues/765
/cc @bnjbvr @wingo @caitp