-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
riscv64: Implement SIMD floating point conversion instructions (#6924)
* riscv64: Implement SIMD `fvpromote_low`/`fvdemote` * riscv64: Implement SIMD `fcvt_from_{u,s}int` * riscv64: Implement SIMD `fcvt_to_{u,s}int_sat` * riscv64: Use `i8_to_imm5` constructor
- Loading branch information
Showing
17 changed files
with
477 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
cranelift/filetests/filetests/isa/riscv64/simd-fcvt-from-sint.clif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
test compile precise-output | ||
set unwind_info=false | ||
target riscv64 has_v | ||
|
||
function %fcvt_from_sint(i32x4) -> f32x4 { | ||
block0(v0: i32x4): | ||
v1 = fcvt_from_sint.f32x4 v0 | ||
return v1 | ||
} | ||
|
||
; VCode: | ||
; add sp,-16 | ||
; sd ra,8(sp) | ||
; sd fp,0(sp) | ||
; mv fp,sp | ||
; block0: | ||
; vle8.v v1,16(fp) #avl=16, #vtype=(e8, m1, ta, ma) | ||
; vfcvt.f.x.v v4,v1 #avl=4, #vtype=(e32, m1, ta, ma) | ||
; vse8.v v4,0(a0) #avl=16, #vtype=(e8, m1, ta, ma) | ||
; ld ra,8(sp) | ||
; ld fp,0(sp) | ||
; add sp,+16 | ||
; ret | ||
; | ||
; Disassembled: | ||
; block0: ; offset 0x0 | ||
; addi sp, sp, -0x10 | ||
; sd ra, 8(sp) | ||
; sd s0, 0(sp) | ||
; ori s0, sp, 0 | ||
; block1: ; offset 0x10 | ||
; .byte 0x57, 0x70, 0x08, 0xcc | ||
; addi t6, s0, 0x10 | ||
; .byte 0x87, 0x80, 0x0f, 0x02 | ||
; .byte 0x57, 0x70, 0x02, 0xcd | ||
; .byte 0x57, 0x92, 0x11, 0x4a | ||
; .byte 0x57, 0x70, 0x08, 0xcc | ||
; .byte 0x27, 0x02, 0x05, 0x02 | ||
; ld ra, 8(sp) | ||
; ld s0, 0(sp) | ||
; addi sp, sp, 0x10 | ||
; ret | ||
|
43 changes: 43 additions & 0 deletions
43
cranelift/filetests/filetests/isa/riscv64/simd-fcvt-from-uint.clif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
test compile precise-output | ||
set unwind_info=false | ||
target riscv64 has_v | ||
|
||
function %fcvt_from_uint(i32x4) -> f32x4 { | ||
block0(v0: i32x4): | ||
v1 = fcvt_from_uint.f32x4 v0 | ||
return v1 | ||
} | ||
|
||
; VCode: | ||
; add sp,-16 | ||
; sd ra,8(sp) | ||
; sd fp,0(sp) | ||
; mv fp,sp | ||
; block0: | ||
; vle8.v v1,16(fp) #avl=16, #vtype=(e8, m1, ta, ma) | ||
; vfcvt.f.xu.v v4,v1 #avl=4, #vtype=(e32, m1, ta, ma) | ||
; vse8.v v4,0(a0) #avl=16, #vtype=(e8, m1, ta, ma) | ||
; ld ra,8(sp) | ||
; ld fp,0(sp) | ||
; add sp,+16 | ||
; ret | ||
; | ||
; Disassembled: | ||
; block0: ; offset 0x0 | ||
; addi sp, sp, -0x10 | ||
; sd ra, 8(sp) | ||
; sd s0, 0(sp) | ||
; ori s0, sp, 0 | ||
; block1: ; offset 0x10 | ||
; .byte 0x57, 0x70, 0x08, 0xcc | ||
; addi t6, s0, 0x10 | ||
; .byte 0x87, 0x80, 0x0f, 0x02 | ||
; .byte 0x57, 0x70, 0x02, 0xcd | ||
; .byte 0x57, 0x12, 0x11, 0x4a | ||
; .byte 0x57, 0x70, 0x08, 0xcc | ||
; .byte 0x27, 0x02, 0x05, 0x02 | ||
; ld ra, 8(sp) | ||
; ld s0, 0(sp) | ||
; addi sp, sp, 0x10 | ||
; ret | ||
|
47 changes: 47 additions & 0 deletions
47
cranelift/filetests/filetests/isa/riscv64/simd-fcvt-to-sint-sat.clif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
test compile precise-output | ||
set unwind_info=false | ||
target riscv64 has_v | ||
|
||
function %fcvt_to_sint_sat(f32x4) -> i32x4 { | ||
block0(v0:f32x4): | ||
v1 = fcvt_to_sint_sat.i32x4 v0 | ||
return v1 | ||
} | ||
|
||
; VCode: | ||
; add sp,-16 | ||
; sd ra,8(sp) | ||
; sd fp,0(sp) | ||
; mv fp,sp | ||
; block0: | ||
; vle8.v v1,16(fp) #avl=16, #vtype=(e8, m1, ta, ma) | ||
; vmfne.vv v0,v1,v1 #avl=4, #vtype=(e32, m1, ta, ma) | ||
; vfcvt.rtz.x.f.v v6,v1 #avl=4, #vtype=(e32, m1, ta, ma) | ||
; vmerge.vim v8,v6,0,v0.t #avl=4, #vtype=(e32, m1, ta, ma) | ||
; vse8.v v8,0(a0) #avl=16, #vtype=(e8, m1, ta, ma) | ||
; ld ra,8(sp) | ||
; ld fp,0(sp) | ||
; add sp,+16 | ||
; ret | ||
; | ||
; Disassembled: | ||
; block0: ; offset 0x0 | ||
; addi sp, sp, -0x10 | ||
; sd ra, 8(sp) | ||
; sd s0, 0(sp) | ||
; ori s0, sp, 0 | ||
; block1: ; offset 0x10 | ||
; .byte 0x57, 0x70, 0x08, 0xcc | ||
; addi t6, s0, 0x10 | ||
; .byte 0x87, 0x80, 0x0f, 0x02 | ||
; .byte 0x57, 0x70, 0x02, 0xcd | ||
; .byte 0x57, 0x90, 0x10, 0x72 | ||
; .byte 0x57, 0x93, 0x13, 0x4a | ||
; .byte 0x57, 0x34, 0x60, 0x5c | ||
; .byte 0x57, 0x70, 0x08, 0xcc | ||
; .byte 0x27, 0x04, 0x05, 0x02 | ||
; ld ra, 8(sp) | ||
; ld s0, 0(sp) | ||
; addi sp, sp, 0x10 | ||
; ret | ||
|
Oops, something went wrong.