forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
riscv64: Implement a few misc SIMD instructions (bytecodealliance#6598)
* riscv64: Add immediate rule to `gen_vec_mask` * riscv64: Implement `scalar_to_vector` * riscv64: Implement vector `select` * riscv64: Implement SIMD `iabs` * wasmtime: Enable SIMD memory64 tests for riscv64 * cranelift: Update targets for `simd-select` tests
- Loading branch information
Showing
13 changed files
with
753 additions
and
93 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
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
166 changes: 166 additions & 0 deletions
166
cranelift/filetests/filetests/isa/riscv64/simd-iabs.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,166 @@ | ||
test compile precise-output | ||
set unwind_info=false | ||
target riscv64 has_v | ||
|
||
function %iabs_i8x16(i8x16) -> i8x16 { | ||
block0(v0: i8x16): | ||
v1 = iabs 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) | ||
; vneg.v v4,v1 #avl=16, #vtype=(e8, m1, ta, ma) | ||
; vmax.vv v6,v1,v4 #avl=16, #vtype=(e8, m1, ta, ma) | ||
; vse8.v v6,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, 0x42, 0x10, 0x0e | ||
; .byte 0x57, 0x03, 0x12, 0x1e | ||
; .byte 0x27, 0x03, 0x05, 0x02 | ||
; ld ra, 8(sp) | ||
; ld s0, 0(sp) | ||
; addi sp, sp, 0x10 | ||
; ret | ||
|
||
function %iabs_i16x8(i16x8) -> i16x8 { | ||
block0(v0: i16x8): | ||
v1 = iabs 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) | ||
; vneg.v v4,v1 #avl=8, #vtype=(e16, m1, ta, ma) | ||
; vmax.vv v6,v1,v4 #avl=8, #vtype=(e16, m1, ta, ma) | ||
; vse8.v v6,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, 0x84, 0xcc | ||
; .byte 0x57, 0x42, 0x10, 0x0e | ||
; .byte 0x57, 0x03, 0x12, 0x1e | ||
; .byte 0x57, 0x70, 0x08, 0xcc | ||
; .byte 0x27, 0x03, 0x05, 0x02 | ||
; ld ra, 8(sp) | ||
; ld s0, 0(sp) | ||
; addi sp, sp, 0x10 | ||
; ret | ||
|
||
function %iabs_i32x4(i32x4) -> i32x4 { | ||
block0(v0: i32x4): | ||
v1 = iabs 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) | ||
; vneg.v v4,v1 #avl=4, #vtype=(e32, m1, ta, ma) | ||
; vmax.vv v6,v1,v4 #avl=4, #vtype=(e32, m1, ta, ma) | ||
; vse8.v v6,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, 0x42, 0x10, 0x0e | ||
; .byte 0x57, 0x03, 0x12, 0x1e | ||
; .byte 0x57, 0x70, 0x08, 0xcc | ||
; .byte 0x27, 0x03, 0x05, 0x02 | ||
; ld ra, 8(sp) | ||
; ld s0, 0(sp) | ||
; addi sp, sp, 0x10 | ||
; ret | ||
|
||
function %iabs_i64x2(i64x2) -> i64x2 { | ||
block0(v0: i64x2): | ||
v1 = iabs 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) | ||
; vneg.v v4,v1 #avl=2, #vtype=(e64, m1, ta, ma) | ||
; vmax.vv v6,v1,v4 #avl=2, #vtype=(e64, m1, ta, ma) | ||
; vse8.v v6,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, 0x81, 0xcd | ||
; .byte 0x57, 0x42, 0x10, 0x0e | ||
; .byte 0x57, 0x03, 0x12, 0x1e | ||
; .byte 0x57, 0x70, 0x08, 0xcc | ||
; .byte 0x27, 0x03, 0x05, 0x02 | ||
; ld ra, 8(sp) | ||
; ld s0, 0(sp) | ||
; addi sp, sp, 0x10 | ||
; ret | ||
|
Oops, something went wrong.