Legalize some more i8/i16 intructions (#524)

* Legalize some more i8/i16 intructions
This commit is contained in:
bjorn3
2018-09-26 01:10:23 +02:00
committed by Dan Gohman
parent 2c53e2102c
commit 2eec1469a8
9 changed files with 368 additions and 116 deletions

View File

@@ -0,0 +1,36 @@
test compile
target x86_64
; regex: V=v\d+
function u0:0(i8, i8) fast {
fn0 = %black_box(i8)
ss0 = explicit_slot 1 ; black box
ebb0(v0: i8, v1: i8):
v99 = stack_addr.i64 ss0
; check: istore8 $(V), $(V)
v2 = band v0, v1
store v2, v99
v3 = bor v0, v1
store v3, v99
v4 = bxor v0, v1
store v4, v99
v5 = bnot v0
store v5, v99
v6 = band_not v0, v1
store v6, v99
v7 = bor_not v0, v1
store v7, v99
v8 = bxor_not v0, v1
store v8, v99
v9 = band_imm v0, 42
store v9, v99
v10 = bor_imm v0, 42
store v10, v99
v11 = bxor_imm v0, 42
store v11, v99
return
}

View File

@@ -0,0 +1,19 @@
test compile
target x86_64
; regex: V=v\d+
function u0:0(i8, i8) -> i8 fast {
ebb0(v0: i8, v1: i8):
v2 = icmp_imm sle v0, 0
; check: $(e1=$V) = sextend.i32 v0
; nextln: v2 = icmp_imm sle $e1, 0
v3 = bint.i8 v2
v4 = icmp eq v0, v1
; check: $(e2=$V) = uextend.i32 v0
; nextln: $(e3=$V) = uextend.i32 v1
; nextln: v4 = icmp eq $e2, $e3
v5 = bint.i8 v4
v6 = iadd v3, v5
return v6
}

View File

@@ -0,0 +1,24 @@
test compile
target x86_64
; regex: V=v\d+
function u0:0(i8, i8) -> i8 fast {
ebb0(v0: i8, v1: i8):
v2 = ishl v0, v1
; check: $(e1=$V) = uextend.i32 v0
; check: $(r1=$V) = ishl $e1, v1
; check v2 = ireduce.i8 $r1
v3 = ushr v0, v1
; check: $(e2=$V) = uextend.i32 v0
; check: $(r2=$V) = ushr $e2, v1
; check v2 = ireduce.i8 $r2
v4 = sshr v0, v1
; check: $(e3=$V) = sextend.i32 v0
; check: $(r3=$V) = sshr $e3, v1
; check v2 = ireduce.i8 $r3
v5 = iadd v2, v3
v6 = iadd v4, v5
return v6
}

View File

@@ -0,0 +1,15 @@
test compile
target x86_64
; regex: V=v\d+
function u0:0(i8, i8) -> i8 fast {
ebb0(v0: i8, v1: i8):
v2 = urem v0, v1
; check: $(a=$V) = uextend.i32 v0
; nextln: $(b=$V) = uextend.i32 v1
; nextln: $(c=$V) = iconst.i32 0
; nextln: $(V), $(r=$V) = x86_udivmodx $a, $c, $b
; nextln: v2 = ireduce.i8 $r
return v2
}