Encode iconst.i32 for RISC-V.
For large constants with the low 12 bits clear, we already have the "lui" encoding. Add "addi %x0" encodings for signed 12-bit constants.
This commit is contained in:
@@ -77,6 +77,9 @@ ebb0(v9999: i32):
|
||||
; lui
|
||||
[-,%x7] v140 = iconst.i32 0x12345000 ; bin: 123453b7
|
||||
[-,%x16] v141 = iconst.i32 0xffffffff_fedcb000 ; bin: fedcb837
|
||||
; addi
|
||||
[-,%x7] v142 = iconst.i32 1000 ; bin: 3e800393
|
||||
[-,%x16] v143 = iconst.i32 -905 ; bin: c7700813
|
||||
|
||||
; Copies alias to iadd_imm.
|
||||
[-,%x7] v150 = copy v1 ; bin: 00050393
|
||||
|
||||
@@ -6,7 +6,7 @@ function %RV32I(i32 link [%x1]) -> i32 link [%x1] {
|
||||
|
||||
ebb0(v9999: i32):
|
||||
; iconst.i32 needs legalizing, so it should throw a
|
||||
[R#0,-] v1 = iconst.i32 1 ; error: Instruction failed to re-encode
|
||||
[R#0,-] v1 = iconst.i32 0xf0f0f0f0f0 ; error: Instruction failed to re-encode
|
||||
return v9999
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user