riscv64: Initial SIMD Vector Implementation (#6240)
* riscv64: Remove unused code * riscv64: Add vector types * riscv64: Initial Vector ABI Load/Stores * riscv64: Vector Loads/Stores * riscv64: Fix `vsetvli` encoding error * riscv64: Add SIMD `iadd` runtests * riscv64: Rename `VecSew` The SEW name is correct, but only for VType. We also use this type in loads/stores as the Efective Element Width, so the name isn't quite correct in that case. * ci: Add V extension to RISC-V QEMU * riscv64: Misc Cleanups * riscv64: Check V extension in `load`/`store` for SIMD * riscv64: Fix `sumop` doc comment * cranelift: Fix comment typo * riscv64: Add convert for VType and VecElementWidth * riscv64: Remove VecElementWidth converter
This commit is contained in:
578
cranelift/filetests/filetests/isa/riscv64/simd-abi.clif
Normal file
578
cranelift/filetests/filetests/isa/riscv64/simd-abi.clif
Normal file
@@ -0,0 +1,578 @@
|
||||
test compile precise-output
|
||||
target riscv64 has_v
|
||||
|
||||
;; Tests both ABI and Regalloc spill/reload.
|
||||
function %simd_spill(
|
||||
i32x4, i32x4, i32x4, i32x4, i32x4, i32x4, i32x4, i32x4,
|
||||
i32x4, i32x4, i32x4, i32x4, i32x4, i32x4, i32x4, i32x4,
|
||||
i32x4, i32x4, i32x4, i32x4, i32x4, i32x4, i32x4, i32x4,
|
||||
i32x4, i32x4, i32x4, i32x4, i32x4, i32x4, i32x4, i32x4,
|
||||
;; These cannot fit in registers.
|
||||
i32x4, i32x4
|
||||
) ->
|
||||
i32x4, i32x4, i32x4, i32x4, i32x4, i32x4, i32x4, i32x4,
|
||||
i32x4, i32x4, i32x4, i32x4, i32x4, i32x4, i32x4, i32x4,
|
||||
i32x4, i32x4, i32x4, i32x4, i32x4, i32x4, i32x4, i32x4,
|
||||
i32x4, i32x4, i32x4, i32x4, i32x4, i32x4, i32x4, i32x4,
|
||||
;; These cannot fit in registers.
|
||||
i32x4, i32x4 system_v
|
||||
{
|
||||
block0(
|
||||
v0:i32x4, v1:i32x4, v2:i32x4, v3:i32x4, v4:i32x4, v5:i32x4, v6:i32x4, v7:i32x4,
|
||||
v8:i32x4, v9:i32x4, v10:i32x4, v11:i32x4, v12:i32x4, v13:i32x4, v14:i32x4, v15:i32x4,
|
||||
v16:i32x4, v17:i32x4, v18:i32x4, v19:i32x4, v20:i32x4, v21:i32x4, v22:i32x4, v23:i32x4,
|
||||
v24:i32x4, v25:i32x4, v26:i32x4, v27:i32x4, v28:i32x4, v29:i32x4, v30:i32x4, v31:i32x4,
|
||||
v32:i32x4, v33:i32x4
|
||||
):
|
||||
;; This just reverses the args
|
||||
return v33, v32,
|
||||
v31, v30, v29, v28, v27, v26, v25, v24,
|
||||
v23, v22, v21, v20, v19, v18, v17, v16,
|
||||
v15, v14, v13, v12, v11, v10, v9, v8,
|
||||
v7, v6, v5, v4, v3, v2, v1, v0
|
||||
}
|
||||
|
||||
; VCode:
|
||||
; add sp,-16
|
||||
; sd ra,8(sp)
|
||||
; sd fp,0(sp)
|
||||
; mv fp,sp
|
||||
; fsd fs0,-8(sp)
|
||||
; fsd fs2,-16(sp)
|
||||
; fsd fs3,-24(sp)
|
||||
; fsd fs4,-32(sp)
|
||||
; fsd fs5,-40(sp)
|
||||
; fsd fs6,-48(sp)
|
||||
; fsd fs7,-56(sp)
|
||||
; fsd fs8,-64(sp)
|
||||
; fsd fs9,-72(sp)
|
||||
; fsd fs10,-80(sp)
|
||||
; fsd fs11,-88(sp)
|
||||
; add sp,-112
|
||||
; block0:
|
||||
; fsd fa0,0(nominal_sp)
|
||||
; fsd fa1,8(nominal_sp)
|
||||
; vle8.v v28,16(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v29,32(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v30,48(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v31,64(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v0,80(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v1,96(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v2,112(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v3,128(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v5,144(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v7,160(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v4,176(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v6,192(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v25,208(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v27,224(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v9,240(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v19,256(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v21,272(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v23,288(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v26,304(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v8,320(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v18,336(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v20,352(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v22,368(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v24,384(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v11,400(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vle8.v v10,416(fp) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v24,0(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v22,16(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v20,32(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v18,48(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v8,64(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v26,80(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v23,96(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v21,112(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v19,128(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v9,144(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v27,160(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v25,176(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v6,192(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v4,208(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v7,224(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v5,240(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v3,256(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v2,272(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v1,288(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v0,304(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v31,320(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v30,336(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v29,352(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v28,368(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v17,384(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v16,400(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v15,416(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v14,432(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v13,448(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vse8.v v12,464(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; fld fa4,8(nominal_sp)
|
||||
; vse8.v v14,480(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; fld fa7,0(nominal_sp)
|
||||
; vse8.v v17,496(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; add sp,+112
|
||||
; fld fs0,-8(sp)
|
||||
; fld fs2,-16(sp)
|
||||
; fld fs3,-24(sp)
|
||||
; fld fs4,-32(sp)
|
||||
; fld fs5,-40(sp)
|
||||
; fld fs6,-48(sp)
|
||||
; fld fs7,-56(sp)
|
||||
; fld fs8,-64(sp)
|
||||
; fld fs9,-72(sp)
|
||||
; fld fs10,-80(sp)
|
||||
; fld fs11,-88(sp)
|
||||
; 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
|
||||
; fsd fs0, -8(sp)
|
||||
; fsd fs2, -0x10(sp)
|
||||
; fsd fs3, -0x18(sp)
|
||||
; fsd fs4, -0x20(sp)
|
||||
; fsd fs5, -0x28(sp)
|
||||
; fsd fs6, -0x30(sp)
|
||||
; fsd fs7, -0x38(sp)
|
||||
; fsd fs8, -0x40(sp)
|
||||
; fsd fs9, -0x48(sp)
|
||||
; fsd fs10, -0x50(sp)
|
||||
; fsd fs11, -0x58(sp)
|
||||
; addi sp, sp, -0x70
|
||||
; block1: ; offset 0x40
|
||||
; fsd fa0, 0(sp)
|
||||
; fsd fa1, 8(sp)
|
||||
; .byte 0x57, 0x70, 0x08, 0xcc
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x10, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x07, 0x8e, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x20, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x87, 0x8e, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x30, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x07, 0x8f, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x40, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x87, 0x8f, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x50, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x07, 0x80, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x60, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x87, 0x80, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x70, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x07, 0x81, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x80, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x87, 0x81, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x90, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x87, 0x82, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xa0, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x87, 0x83, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xb0, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x07, 0x82, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xc0, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x07, 0x83, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xd0, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x87, 0x8c, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xe0, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x87, 0x8d, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xf0, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x87, 0x84, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x00, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x87, 0x89, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x10, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x87, 0x8a, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x20, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x87, 0x8b, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x30, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x07, 0x8d, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x40, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x07, 0x84, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x50, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x07, 0x89, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x60, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x07, 0x8a, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x70, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x07, 0x8b, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x80, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x07, 0x8c, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x90, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x87, 0x85, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xa0, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, s0
|
||||
; .byte 0x07, 0x85, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x8c, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x10, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x8b, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x20, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x8a, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x30, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x89, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x40, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x84, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x50, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x8d, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x60, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0xa7, 0x8b, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x70, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0xa7, 0x8a, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x80, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0xa7, 0x89, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x90, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0xa7, 0x84, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xa0, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0xa7, 0x8d, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xb0, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0xa7, 0x8c, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xc0, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x83, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xd0, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x82, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xe0, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0xa7, 0x83, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xf0, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0xa7, 0x82, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x00, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0xa7, 0x81, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x10, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x81, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x20, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0xa7, 0x80, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x30, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x80, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x40, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0xa7, 0x8f, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x50, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x8f, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x60, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0xa7, 0x8e, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x70, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x8e, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x80, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0xa7, 0x88, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x90, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x88, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xa0, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0xa7, 0x87, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xb0, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x87, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xc0, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0xa7, 0x86, 0x0f, 0x02
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xd0, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x86, 0x0f, 0x02
|
||||
; fld fa4, 8(sp)
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xe0, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x87, 0x0f, 0x02
|
||||
; fld fa7, 0(sp)
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0xf0, 0x01, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0xa7, 0x88, 0x0f, 0x02
|
||||
; addi sp, sp, 0x70
|
||||
; fld fs0, -8(sp)
|
||||
; fld fs2, -0x10(sp)
|
||||
; fld fs3, -0x18(sp)
|
||||
; fld fs4, -0x20(sp)
|
||||
; fld fs5, -0x28(sp)
|
||||
; fld fs6, -0x30(sp)
|
||||
; fld fs7, -0x38(sp)
|
||||
; fld fs8, -0x40(sp)
|
||||
; fld fs9, -0x48(sp)
|
||||
; fld fs10, -0x50(sp)
|
||||
; fld fs11, -0x58(sp)
|
||||
; ld ra, 8(sp)
|
||||
; ld s0, 0(sp)
|
||||
; addi sp, sp, 0x10
|
||||
; ret
|
||||
|
||||
73
cranelift/filetests/filetests/isa/riscv64/simd-iadd.clif
Normal file
73
cranelift/filetests/filetests/isa/riscv64/simd-iadd.clif
Normal file
@@ -0,0 +1,73 @@
|
||||
test compile precise-output
|
||||
set unwind_info=false
|
||||
target riscv64 has_v
|
||||
|
||||
|
||||
function %iadd_i8x16(i8x16, i8x16) -> i8x16 {
|
||||
block0(v0: i8x16, v1: i8x16):
|
||||
v2 = iadd v0, v1
|
||||
return v2
|
||||
}
|
||||
|
||||
; VCode:
|
||||
; block0:
|
||||
; vadd.vv v10,v11,v10 #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; ret
|
||||
;
|
||||
; Disassembled:
|
||||
; block0: ; offset 0x0
|
||||
; .byte 0x57, 0x70, 0x08, 0xcc
|
||||
; .byte 0x57, 0x05, 0xb5, 0x02
|
||||
; ret
|
||||
|
||||
function %iadd_i16x8(i16x8, i16x8) -> i16x8 {
|
||||
block0(v0: i16x8, v1: i16x8):
|
||||
v2 = iadd v0, v1
|
||||
return v2
|
||||
}
|
||||
|
||||
; VCode:
|
||||
; block0:
|
||||
; vadd.vv v10,v11,v10 #avl=8, #vtype=(e16, m1, ta, ma)
|
||||
; ret
|
||||
;
|
||||
; Disassembled:
|
||||
; block0: ; offset 0x0
|
||||
; .byte 0x57, 0x70, 0x84, 0xcc
|
||||
; .byte 0x57, 0x05, 0xb5, 0x02
|
||||
; ret
|
||||
|
||||
function %iadd_i32x4(i32x4, i32x4) -> i32x4 {
|
||||
block0(v0: i32x4, v1: i32x4):
|
||||
v2 = iadd v0, v1
|
||||
return v2
|
||||
}
|
||||
|
||||
; VCode:
|
||||
; block0:
|
||||
; vadd.vv v10,v11,v10 #avl=4, #vtype=(e32, m1, ta, ma)
|
||||
; ret
|
||||
;
|
||||
; Disassembled:
|
||||
; block0: ; offset 0x0
|
||||
; .byte 0x57, 0x70, 0x02, 0xcd
|
||||
; .byte 0x57, 0x05, 0xb5, 0x02
|
||||
; ret
|
||||
|
||||
function %iadd_i64x2(i64x2, i64x2) -> i64x2 {
|
||||
block0(v0: i64x2, v1: i64x2):
|
||||
v2 = iadd v0, v1
|
||||
return v2
|
||||
}
|
||||
|
||||
; VCode:
|
||||
; block0:
|
||||
; vadd.vv v10,v11,v10 #avl=2, #vtype=(e64, m1, ta, ma)
|
||||
; ret
|
||||
;
|
||||
; Disassembled:
|
||||
; block0: ; offset 0x0
|
||||
; .byte 0x57, 0x70, 0x81, 0xcd
|
||||
; .byte 0x57, 0x05, 0xb5, 0x02
|
||||
; ret
|
||||
|
||||
97
cranelift/filetests/filetests/isa/riscv64/simd-loads.clif
Normal file
97
cranelift/filetests/filetests/isa/riscv64/simd-loads.clif
Normal file
@@ -0,0 +1,97 @@
|
||||
test compile precise-output
|
||||
set unwind_info=false
|
||||
target riscv64 has_v
|
||||
|
||||
|
||||
function %load_i8x16(i64) -> i8x16 {
|
||||
block0(v0: i64):
|
||||
v1 = load.i8x16 v0
|
||||
return v1
|
||||
}
|
||||
|
||||
; VCode:
|
||||
; block0:
|
||||
; vle8.v v10,0(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; ret
|
||||
;
|
||||
; Disassembled:
|
||||
; block0: ; offset 0x0
|
||||
; .byte 0x57, 0x70, 0x08, 0xcc
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x07, 0x85, 0x0f, 0x02
|
||||
; ret
|
||||
|
||||
function %load_i16x8(i64) -> i16x8 {
|
||||
block0(v0: i64):
|
||||
v1 = load.i16x8 v0
|
||||
return v1
|
||||
}
|
||||
|
||||
; VCode:
|
||||
; block0:
|
||||
; vle16.v v10,0(a0) #avl=8, #vtype=(e16, m1, ta, ma)
|
||||
; ret
|
||||
;
|
||||
; Disassembled:
|
||||
; block0: ; offset 0x0
|
||||
; .byte 0x57, 0x70, 0x84, 0xcc
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x07, 0xd5, 0x0f, 0x02
|
||||
; ret
|
||||
|
||||
function %load_i32x4(i64) -> i32x4 {
|
||||
block0(v0: i64):
|
||||
v1 = load.i32x4 v0
|
||||
return v1
|
||||
}
|
||||
|
||||
; VCode:
|
||||
; block0:
|
||||
; vle32.v v10,0(a0) #avl=4, #vtype=(e32, m1, ta, ma)
|
||||
; ret
|
||||
;
|
||||
; Disassembled:
|
||||
; block0: ; offset 0x0
|
||||
; .byte 0x57, 0x70, 0x02, 0xcd
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x07, 0xe5, 0x0f, 0x02
|
||||
; ret
|
||||
|
||||
function %load_i64x2(i64) -> i64x2 {
|
||||
block0(v0: i64):
|
||||
v1 = load.i64x2 v0
|
||||
return v1
|
||||
}
|
||||
|
||||
; VCode:
|
||||
; block0:
|
||||
; vle64.v v10,0(a0) #avl=2, #vtype=(e64, m1, ta, ma)
|
||||
; ret
|
||||
;
|
||||
; Disassembled:
|
||||
; block0: ; offset 0x0
|
||||
; .byte 0x57, 0x70, 0x81, 0xcd
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x07, 0xf5, 0x0f, 0x02
|
||||
; ret
|
||||
|
||||
97
cranelift/filetests/filetests/isa/riscv64/simd-stores.clif
Normal file
97
cranelift/filetests/filetests/isa/riscv64/simd-stores.clif
Normal file
@@ -0,0 +1,97 @@
|
||||
test compile precise-output
|
||||
set unwind_info=false
|
||||
target riscv64 has_v
|
||||
|
||||
|
||||
function %store_i8x16(i64, i8x16) {
|
||||
block0(v0: i64, v1: i8x16):
|
||||
store.i8x16 v1, v0
|
||||
return
|
||||
}
|
||||
|
||||
; VCode:
|
||||
; block0:
|
||||
; vse8.v v10,0(a0) #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; ret
|
||||
;
|
||||
; Disassembled:
|
||||
; block0: ; offset 0x0
|
||||
; .byte 0x57, 0x70, 0x08, 0xcc
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0x85, 0x0f, 0x02
|
||||
; ret
|
||||
|
||||
function %store_i16x8(i64, i16x8) {
|
||||
block0(v0: i64, v1: i16x8):
|
||||
store.i16x8 v1, v0
|
||||
return
|
||||
}
|
||||
|
||||
; VCode:
|
||||
; block0:
|
||||
; vse16.v v10,0(a0) #avl=8, #vtype=(e16, m1, ta, ma)
|
||||
; ret
|
||||
;
|
||||
; Disassembled:
|
||||
; block0: ; offset 0x0
|
||||
; .byte 0x57, 0x70, 0x84, 0xcc
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0xd5, 0x0f, 0x02
|
||||
; ret
|
||||
|
||||
function %store_i32x4(i64, i32x4) {
|
||||
block0(v0: i64, v1: i32x4):
|
||||
store.i32x4 v1, v0
|
||||
return
|
||||
}
|
||||
|
||||
; VCode:
|
||||
; block0:
|
||||
; vse32.v v10,0(a0) #avl=4, #vtype=(e32, m1, ta, ma)
|
||||
; ret
|
||||
;
|
||||
; Disassembled:
|
||||
; block0: ; offset 0x0
|
||||
; .byte 0x57, 0x70, 0x02, 0xcd
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0xe5, 0x0f, 0x02
|
||||
; ret
|
||||
|
||||
function %store_i64x2(i64, i64x2) {
|
||||
block0(v0: i64, v1: i64x2):
|
||||
store.i64x2 v1, v0
|
||||
return
|
||||
}
|
||||
|
||||
; VCode:
|
||||
; block0:
|
||||
; vse64.v v10,0(a0) #avl=2, #vtype=(e64, m1, ta, ma)
|
||||
; ret
|
||||
;
|
||||
; Disassembled:
|
||||
; block0: ; offset 0x0
|
||||
; .byte 0x57, 0x70, 0x81, 0xcd
|
||||
; auipc t6, 0
|
||||
; ld t6, 0xc(t6)
|
||||
; j 0xc
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; .byte 0x00, 0x00, 0x00, 0x00
|
||||
; add t6, t6, a0
|
||||
; .byte 0x27, 0xf5, 0x0f, 0x02
|
||||
; ret
|
||||
|
||||
68
cranelift/filetests/filetests/isa/riscv64/simd-vstate.clif
Normal file
68
cranelift/filetests/filetests/isa/riscv64/simd-vstate.clif
Normal file
@@ -0,0 +1,68 @@
|
||||
test compile precise-output
|
||||
set unwind_info=false
|
||||
target riscv64 has_v
|
||||
|
||||
;; Interleaves vector operations to ensure that `vsetivli` is emitted
|
||||
function %iadd_multi(i8x16, i16x8) -> i8x16, i16x8 {
|
||||
block0(v0: i8x16, v1: i16x8):
|
||||
v4 = iadd v0, v0
|
||||
v5 = iadd v1, v1
|
||||
v6 = iadd v5, v5
|
||||
return v4, v6
|
||||
}
|
||||
|
||||
; VCode:
|
||||
; block0:
|
||||
; vadd.vv v10,v10,v10 #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; vadd.vv v5,v11,v11 #avl=8, #vtype=(e16, m1, ta, ma)
|
||||
; vadd.vv v11,v5,v5 #avl=8, #vtype=(e16, m1, ta, ma)
|
||||
; ret
|
||||
;
|
||||
; Disassembled:
|
||||
; block0: ; offset 0x0
|
||||
; .byte 0x57, 0x70, 0x08, 0xcc
|
||||
; .byte 0x57, 0x05, 0xa5, 0x02
|
||||
; .byte 0x57, 0x70, 0x84, 0xcc
|
||||
; .byte 0xd7, 0x82, 0xb5, 0x02
|
||||
; .byte 0xd7, 0x85, 0x52, 0x02
|
||||
; ret
|
||||
|
||||
;; When the block changes, we need to reemit the vector state instruction
|
||||
;; Even if vtype is the same.
|
||||
function %(i8x16, i8x16) -> i8x16 {
|
||||
block0(v0: i8x16, v1: i8x16):
|
||||
v2 = iadd v0, v1
|
||||
jump block1(v1, v2)
|
||||
|
||||
block1(v3: i8x16, v4: i8x16):
|
||||
v5 = iadd v3, v4
|
||||
jump block2(v4, v5)
|
||||
|
||||
block2(v6: i8x16, v7: i8x16):
|
||||
v8 = iadd v6, v7
|
||||
return v8
|
||||
}
|
||||
|
||||
; VCode:
|
||||
; block0:
|
||||
; vadd.vv v5,v11,v10 #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; j label1
|
||||
; block1:
|
||||
; vadd.vv v6,v5,v11 #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; j label2
|
||||
; block2:
|
||||
; vadd.vv v10,v6,v5 #avl=16, #vtype=(e8, m1, ta, ma)
|
||||
; ret
|
||||
;
|
||||
; Disassembled:
|
||||
; block0: ; offset 0x0
|
||||
; .byte 0x57, 0x70, 0x08, 0xcc
|
||||
; .byte 0xd7, 0x02, 0xb5, 0x02
|
||||
; block1: ; offset 0x8
|
||||
; .byte 0x57, 0x70, 0x08, 0xcc
|
||||
; .byte 0x57, 0x83, 0x55, 0x02
|
||||
; block2: ; offset 0x10
|
||||
; .byte 0x57, 0x70, 0x08, 0xcc
|
||||
; .byte 0x57, 0x85, 0x62, 0x02
|
||||
; ret
|
||||
|
||||
@@ -6,21 +6,6 @@ set enable_simd
|
||||
target x86_64
|
||||
target x86_64 skylake
|
||||
|
||||
function %iadd_i32x4(i32x4, i32x4) -> i32x4 {
|
||||
block0(v0:i32x4, v1:i32x4):
|
||||
v2 = iadd v0, v1
|
||||
return v2
|
||||
}
|
||||
; run: %iadd_i32x4([1 1 1 1], [1 2 3 4]) == [2 3 4 5]
|
||||
|
||||
function %iadd_i8x16_with_overflow() -> i8x16 {
|
||||
block0:
|
||||
v0 = vconst.i8x16 [255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255]
|
||||
v1 = vconst.i8x16 [2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2]
|
||||
v2 = iadd v0, v1
|
||||
return v2
|
||||
}
|
||||
; run: %iadd_i8x16_with_overflow() == [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]
|
||||
|
||||
function %isub_i32x4(i32x4, i32x4) -> i32x4 {
|
||||
block0(v0: i32x4, v1: i32x4):
|
||||
|
||||
44
cranelift/filetests/filetests/runtests/simd-iadd.clif
Normal file
44
cranelift/filetests/filetests/runtests/simd-iadd.clif
Normal file
@@ -0,0 +1,44 @@
|
||||
test interpret
|
||||
test run
|
||||
target aarch64
|
||||
target s390x
|
||||
set enable_simd
|
||||
target x86_64
|
||||
target x86_64 skylake
|
||||
target riscv64 has_v
|
||||
|
||||
|
||||
function %iadd_i8x16(i8x16, i8x16) -> i8x16 {
|
||||
block0(v0:i8x16, v1:i8x16):
|
||||
v2 = iadd v0, v1
|
||||
return v2
|
||||
}
|
||||
; run: %iadd_i8x16([1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1], [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16]) == [2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17]
|
||||
; run: %iadd_i8x16([2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2], [-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]) == [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]
|
||||
|
||||
|
||||
function %iadd_i16x8(i16x8, i16x8) -> i16x8 {
|
||||
block0(v0:i16x8, v1:i16x8):
|
||||
v2 = iadd v0, v1
|
||||
return v2
|
||||
}
|
||||
; run: %iadd_i16x8([1 1 1 1 1 1 1 1], [1 2 3 4 5 6 7 8]) == [2 3 4 5 6 7 8 9]
|
||||
; run: %iadd_i16x8([2 2 2 2 2 2 2 2], [-1 -1 -1 -1 -1 -1 -1 -1]) == [1 1 1 1 1 1 1 1]
|
||||
|
||||
|
||||
function %iadd_i32x4(i32x4, i32x4) -> i32x4 {
|
||||
block0(v0:i32x4, v1:i32x4):
|
||||
v2 = iadd v0, v1
|
||||
return v2
|
||||
}
|
||||
; run: %iadd_i32x4([1 1 1 1], [1 2 3 4]) == [2 3 4 5]
|
||||
; run: %iadd_i32x4([2 2 2 2], [-1 -1 -1 -1]) == [1 1 1 1]
|
||||
|
||||
|
||||
function %iadd_i64x2(i64x2, i64x2) -> i64x2 {
|
||||
block0(v0:i64x2, v1:i64x2):
|
||||
v2 = iadd v0, v1
|
||||
return v2
|
||||
}
|
||||
; run: %iadd_i64x2([1 1], [1 2]) == [2 3]
|
||||
; run: %iadd_i64x2([2 2], [-1 -1]) == [1 1]
|
||||
Reference in New Issue
Block a user