Add (bnot (bxor x y)) lowerings for s390x/aarch64 (#5763)

* Add (bnot (bxor x y)) lowerings for s390x/aarch64

I originally thought that s390x's original lowering in #5709, but as was
rightfully pointed out `(bnot (bxor x y))` is equivalent to
`(bxor x (bnot y))` so the special lowering for one should apply as a
special lowering for the other. For the s390x and aarch64 backend that
have already have a fused lowering of the bxor/bnot add a lowering
additionally for the bnot/bxor combination.

* Add bnot(bxor(..)) tests for s390x 128-bit sizes
This commit is contained in:
Alex Crichton
2023-02-13 09:41:18 -06:00
committed by GitHub
parent d99783fc91
commit a0a97f5e8f
5 changed files with 85 additions and 0 deletions

View File

@@ -924,3 +924,26 @@ block0(v0: i128, v1: i128):
; csel x1, x15, x7, ne
; ret
function %bnot_of_bxor(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
v2 = bxor v0, v1
v3 = bnot v2
return v3
}
; block0:
; eon w0, w0, w1
; ret
function %bnot_of_bxor(i128, i128) -> i128 {
block0(v0: i128, v1: i128):
v2 = bxor v0, v1
v3 = bnot v2
return v3
}
; block0:
; eon x0, x0, x2
; eon x1, x1, x3
; ret

View File

@@ -64,3 +64,14 @@ block0(v0: i32, v1: i32):
; block0:
; nxrk %r2, %r3, %r2
; br %r14
function %bnot_of_bxor(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
v2 = bxor v0, v1
v3 = bnot v2
return v3
}
; block0:
; nxrk %r2, %r2, %r3
; br %r14

View File

@@ -632,3 +632,40 @@ block0(v0: i8, v1: i8, v2: i8):
; or %r2, %r3
; br %r14
function %bnot_of_bxor(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
v2 = bxor v0, v1
v3 = bnot v2
return v3
}
; block0:
; xr %r2, %r3
; xilf %r2, 4294967295
; br %r14
function %bnot_of_bxor(i128, i128) -> i128 {
block0(v0: i128, v1: i128):
v2 = bxor v0, v1
v3 = bnot v2
return v3
}
; block0:
; vl %v1, 0(%r3)
; vl %v3, 0(%r4)
; vnx %v6, %v1, %v3
; vst %v6, 0(%r2)
; br %r14
function %bnot_of_bxor(i32x4, i32x4) -> i32x4 {
block0(v0: i32x4, v1: i32x4):
v2 = bxor v0, v1
v3 = bnot v2
return v3
}
; block0:
; vnx %v24, %v24, %v25
; br %r14