egraph opt rules: do (icmp cc x x) == {0,1} only for integer types. (#5438)

We could do these for vectors too, in theory, but for now let's fix the
bug by applying the equivalence only for integer types.

Fixes #5437.
This commit is contained in:
Chris Fallin
2022-12-14 11:50:42 -08:00
committed by GitHub
parent 2e0bc7dab6
commit 8383e4b6bd
2 changed files with 51 additions and 10 deletions

View File

@@ -0,0 +1,41 @@
test compile
set use_egraphs=true
target x86_64
target aarch64
target s390x
function u0:0(i64 vmctx, i64) fast {
gv0 = vmctx
gv1 = load.i64 notrap aligned readonly gv0+8
gv2 = load.i64 notrap aligned gv1
sig0 = (i64 vmctx, i64) fast
fn0 = colocated u0:2 sig0
jt0 = jump_table [block1]
stack_limit = gv2
block0(v0: i64, v1: i64):
@0019 v2 = vconst.i8x16 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
@001b v3 = iconst.i32 0
@001d brz v3, block2 ; v3 = 0
@001d jump block3
block3:
@001f trap unreachable
block2:
@0025 v4 = bitcast.i16x8 little v2 ; v2 = const0
@0025 v5 = bitcast.i16x8 little v2 ; v2 = const0
@0025 v6 = icmp ult v4, v5
@0027 v7 = bitcast.i32x4 little v6
@0027 v8 = vhigh_bits.i32 v7
@002a v9 = iconst.i32 0
@002c brnz v9, block1 ; v9 = 0
@002c jump block4
block4:
@002e call fn0(v0, v0)
@0030 br_table v8, block1, jt0
block1:
@0036 return
}