Add an icmp_imm instruction.

Compare a scalar integer to an immediate constant. Both Intel and RISC-V
ISAs have this operation.

This requires the addition of a new IntCompareImm instruction format.
This commit is contained in:
Jakob Stoklund Olesen
2017-04-03 09:49:44 -07:00
parent 6532cbab6c
commit 2e45365ee1
8 changed files with 48 additions and 6 deletions

View File

@@ -54,14 +54,14 @@ function icmp(i32, i32) {
ebb0(vx0: i32, vx1: i32):
v0 = icmp eq, vx0, vx1
v1 = icmp ult, vx0, vx1
v2 = icmp sge, vx0, vx1
v2 = icmp_imm sge, vx0, -12
v3 = irsub_imm vx1, 45
}
; sameln: function icmp(i32, i32) {
; nextln: ebb0(vx0: i32, vx1: i32):
; nextln: v0 = icmp eq, vx0, vx1
; nextln: v1 = icmp ult, vx0, vx1
; nextln: v2 = icmp sge, vx0, vx1
; nextln: v2 = icmp_imm sge, vx0, -12
; nextln: v3 = irsub_imm vx1, 45
; nextln: }