[codegen] add encodings for isub borrow variants

Add encodings for isub borrow variants (isub_bout, isub_bin,
isub_borrow) for x86_32, enabling the legalization for isub.i64 to work.

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1576675
Bug: https://github.com/CraneStation/cranelift/issues/765
This commit is contained in:
Ujjwal Sharma
2019-09-01 04:01:45 +05:30
committed by Benjamin Bouvier
parent 1c28d43f00
commit dce8ad8229
4 changed files with 36 additions and 10 deletions

View File

@@ -477,6 +477,14 @@ ebb0:
; asm: adcl %esi, %ecx
[-,%rcx,%rflags] v704, v705 = iadd_carry v1, v2, v702 ; bin: 11 f1
; Borrow Subtraction
; asm: subl %esi, %ecx
[-,%rcx,%rflags] v706, v707 = isub_bout v1, v2 ; bin: 29 f1
; asm: sbbl %esi, %ecx
[-,%rcx] v708 = isub_bin v1, v2, v707 ; bin: 19 f1
; asm: sbbl %esi, %ecx
[-,%rcx,%rflags] v709, v710 = isub_borrow v1, v2, v707 ; bin: 19 f1
; asm: testl %ecx, %ecx
; asm: je ebb1
brz v1, ebb1 ; bin: 85 c9 74 0e

View File

@@ -8,9 +8,20 @@ function %iadd(i64, i64) -> i64 {
ebb0(v1: i64, v2: i64):
v10 = iadd v1, v2
; check: v1 = iconcat $(v1_lsb=$V), $(v1_msb=$V)
; check: v2 = iconcat $(v2_lsb=$V), $(v2_msb=$V)
; check: $(v10_lsb=$V), $(carry=$V) = iadd_cout $v1_lsb, $v2_lsb
; check: $(v10_msb=$V) = iadd_cin $v1_msb, $v2_msb, $carry
; check: v10 = iconcat $v10_lsb, $v10_msb
; nextln: v2 = iconcat $(v2_lsb=$V), $(v2_msb=$V)
; nextln: $(v10_lsb=$V), $(carry=$V) = iadd_cout $v1_lsb, $v2_lsb
; nextln: $(v10_msb=$V) = iadd_cin $v1_msb, $v2_msb, $carry
; nextln: v10 = iconcat $v10_lsb, $v10_msb
return v10
}
function %isub(i64, i64) -> i64 {
ebb0(v1: i64, v2: i64):
v10 = isub v1, v2
; check: v1 = iconcat $(v1_lsb=$V), $(v1_msb=$V)
; nextln: v2 = iconcat $(v2_lsb=$V), $(v2_msb=$V)
; nextln: $(v10_lsb=$V), $(borrow=$V) = isub_bout $v1_lsb, $v2_lsb
; nextln: $(v10_msb=$V) = isub_bin $v1_msb, $v2_msb, $borrow
; nextln: v10 = iconcat $v10_lsb, $v10_msb
return v10
}