arm64: Refactor Inst::Extend handling
This refactors the handling of Inst::Extend and simplifies the lowering of Bextend and Bmask, which allows the use of SBFX instructions for extensions from 1-bit booleans. Other extensions use aliases of BFM, and the code was changed to reflect that, rather than hard coding bit patterns. Also ImmLogic is now implemented, so another hard coded instruction can be removed. As part of looking at boolean handling, `normalize_boolean_result` was changed to `materialize_boolean_result`, such that it can use either CSET or CSETM. Using CSETM saves an instruction (previously CSET + SUB) for booleans bigger than 1-bit. Copyright (c) 2020, Arm Limited.
This commit is contained in:
@@ -281,7 +281,7 @@ block0(v0: i16):
|
||||
|
||||
; check: stp fp, lr, [sp, #-16]!
|
||||
; nextln: mov fp, sp
|
||||
; nextln: uxth x0, w0
|
||||
; nextln: uxth w0, w0
|
||||
; nextln: lsr w1, w0, #1
|
||||
; nextln: and x1, x1, #6148914691236517205
|
||||
; nextln: sub x1, x0, x1
|
||||
@@ -307,7 +307,7 @@ block0(v0: i8):
|
||||
|
||||
; check: stp fp, lr, [sp, #-16]!
|
||||
; nextln: mov fp, sp
|
||||
; nextln: uxtb x0, w0
|
||||
; nextln: uxtb w0, w0
|
||||
; nextln: lsr w1, w0, #1
|
||||
; nextln: and x1, x1, #6148914691236517205
|
||||
; nextln: sub x1, x0, x1
|
||||
@@ -324,3 +324,33 @@ block0(v0: i8):
|
||||
; nextln: mov sp, fp
|
||||
; nextln: ldp fp, lr, [sp], #16
|
||||
; nextln: ret
|
||||
|
||||
function %bextend_b8() -> b32 {
|
||||
block0:
|
||||
v1 = bconst.b8 true
|
||||
v2 = bextend.b32 v1
|
||||
return v2
|
||||
}
|
||||
|
||||
; check: stp fp, lr, [sp, #-16]!
|
||||
; nextln: mov fp, sp
|
||||
; nextln: movz x0, #255
|
||||
; nextln: sxtb w0, w0
|
||||
; nextln: mov sp, fp
|
||||
; nextln: ldp fp, lr, [sp], #16
|
||||
; nextln: ret
|
||||
|
||||
function %bextend_b1() -> b32 {
|
||||
block0:
|
||||
v1 = bconst.b1 true
|
||||
v2 = bextend.b32 v1
|
||||
return v2
|
||||
}
|
||||
|
||||
; check: stp fp, lr, [sp, #-16]!
|
||||
; nextln: mov fp, sp
|
||||
; nextln: movz x0, #1
|
||||
; nextln: sbfx w0, w0, #0, #1
|
||||
; nextln: mov sp, fp
|
||||
; nextln: ldp fp, lr, [sp], #16
|
||||
; nextln: ret
|
||||
|
||||
@@ -25,8 +25,8 @@ block0(v0: i8, v1: i8):
|
||||
|
||||
; check: stp fp, lr, [sp, #-16]!
|
||||
; nextln: mov fp, sp
|
||||
; nextln: uxtb x0, w0
|
||||
; nextln: uxtb x1, w1
|
||||
; nextln: uxtb w0, w0
|
||||
; nextln: uxtb w1, w1
|
||||
; nextln: fmov d0, x0
|
||||
; nextln: fmov d1, x1
|
||||
; nextln: uqadd d0, d0, d1
|
||||
|
||||
@@ -9,7 +9,7 @@ block0(v0: i8):
|
||||
|
||||
; check: stp fp, lr, [sp, #-16]!
|
||||
; nextln: mov fp, sp
|
||||
; nextln: uxtb x0, w0
|
||||
; nextln: uxtb w0, w0
|
||||
; nextln: mov sp, fp
|
||||
; nextln: ldp fp, lr, [sp], #16
|
||||
; nextln: ret
|
||||
@@ -87,7 +87,7 @@ block0(v0: i16):
|
||||
|
||||
; check: stp fp, lr, [sp, #-16]!
|
||||
; nextln: mov fp, sp
|
||||
; nextln: uxth x0, w0
|
||||
; nextln: uxth w0, w0
|
||||
; nextln: mov sp, fp
|
||||
; nextln: ldp fp, lr, [sp], #16
|
||||
; nextln: ret
|
||||
|
||||
Reference in New Issue
Block a user