Revert "Cranelift: Rewrite or(and(x, y), not(y)) => or(x, not(y)) (#5676)" (#5682)

This reverts commit 8c9eb9939b.

Fixes #5680
This commit is contained in:
Trevor Elliott
2023-01-31 18:53:23 -08:00
committed by GitHub
parent 0c66a1bba7
commit 268f6bfc1d
5 changed files with 1 additions and 112 deletions

View File

@@ -40,7 +40,7 @@ block0(v0: i32):
return v3
; check: v4 = iconst.i32 0xffff_ffe0
; check: v5 = band v0, v4
; check: return v5
; return v5
}
function %unsigned_shift_right_shift_left_i64(i64) -> i64 {
@@ -86,45 +86,3 @@ block0(v0: i64):
; check: v5 = band v0, v4
; return v5
}
function %or_and_y_with_not_y(i8, i8) -> i8 {
block0(v0: i8, v1: i8):
v2 = band v0, v1
v3 = bnot v1
v4 = bor v2, v3
return v4
; check: v5 = bor v0, v3
; check: return v5
}
function %or_and_constant_with_not_constant(i8) -> i8 {
block0(v0: i8):
v1 = iconst.i8 -4
v2 = band v0, v1
v3 = iconst.i8 3
v4 = bor v2, v3
return v4
; check: v5 = bor v0, v3
; check: return v5
}
function %or_and_y_with_not_y(i8, i8) -> i8 {
block0(v0: i8, v1: i8):
v2 = band v0, v1
v3 = bnot v1
v4 = bor v3, v2
return v4
; check: v5 = bor v0, v3
; check: return v5
}
function %or_and_constant_with_not_constant(i8) -> i8 {
block0(v0: i8):
v1 = iconst.i8 -4
v2 = band v0, v1
v3 = iconst.i8 3
v4 = bor v3, v2
return v4
; check: v6 = bor v0, v3
; check: return v6
}

View File

@@ -1,34 +0,0 @@
;; Test the rewrite: `or(and(x, y), not(y)) => or(x, not(y))`
test interpret
test run
target aarch64
target x86_64
target riscv64
target s390x
function %or_and_y_with_not_y(i8, i8) -> i8 {
block0(v0: i8, v1: i8):
v2 = band v0, v1
v3 = bnot v1
v4 = bor v2, v3
return v4
}
; run: %or_and_y_with_not_y(0xff, 0x0a) == 0xff
; run: %or_and_y_with_not_y(0xff, 0xb0) == 0xff
; run: %or_and_y_with_not_y(0xaa, 0x0a) == 0xff
; run: %or_and_y_with_not_y(0xaa, 0xb0) == 0xef
; run: %or_and_y_with_not_y(0x00, 0x0a) == 0xf5
; run: %or_and_y_with_not_y(0x00, 0xb0) == 0x4f
function %or_and_constant_with_not_constant(i8) -> i8 {
block0(v0: i8):
v1 = iconst.i8 -4
v2 = band v0, v1
v3 = iconst.i8 3
v4 = bor v2, v3
return v4
}
; run: %or_and_constant_with_not_constant(0xff) == 0xff
; run: %or_and_constant_with_not_constant(0xaa) == 0xab
; run: %or_and_constant_with_not_constant(0x00) == 0x03