Integer subtraction with borrow flags.

This is the x86-style of borrow flags. ARM uses subtract-with-carry
which inverts the sense of the carry flag.
This commit is contained in:
Jakob Stoklund Olesen
2016-09-23 15:47:39 -07:00
parent 9cb3451432
commit f66d84fd95
2 changed files with 82 additions and 8 deletions

View File

@@ -11,3 +11,14 @@ ebb1(v1: i32, v2: i32, v3: i32, v4: i32, v5: i32, v6: i32):
; check: $v30 = iadd_cin $v3, $v6, $v21
return v10, v20, v30
}
function sub_i96(i32, i32, i32, i32, i32, i32) -> i32, i32, i32 {
ebb1(v1: i32, v2: i32, v3: i32, v4: i32, v5: i32, v6: i32):
v10, v11 = isub_bout v1, v4
;check: $v10, $v11 = isub_bout $v1, $v4
v20, v21 = isub_borrow v2, v5, v11
; check: $v20, $v21 = isub_borrow $v2, $v5, $v11
v30 = isub_bin v3, v6, v21
; check: $v30 = isub_bin $v3, $v6, $v21
return v10, v20, v30
}