A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
riscv64: allow f16 vector bit operations without Zvfh (#14545)
SUNG JE PARK5461cd4e973a
diff --git a/cranelift/codegen/src/isa/riscv64/inst.isle b/cranelift/codegen/src/isa/riscv64/inst.isleindex 482914a4e8..2c9e70fd4f 100644--- a/cranelift/codegen/src/isa/riscv64/inst.isle+++ b/cranelift/codegen/src/isa/riscv64/inst.isle@@ -1072,6 +1072,11 @@(decl ty_supported_vec (Type) Type)(extern extractor ty_supported_vec ty_supported_vec)+;; Some vector operations only need the bit representation to be supported.+;; Check support using the corresponding integer vector type.+(decl ty_supported_vec_repr (Type) Type)+(extern extractor ty_supported_vec_repr ty_supported_vec_repr)+;; Helper that matches types which are stored in a pair of integer registers (I128 and F128)(decl ty_reg_pair (Type) Type)(extern extractor ty_reg_pair ty_reg_pair)@@ -3056,13 +3061,13 @@;; and int-to-float bitcasts, so this can only recurse once.(decl rec gen_bitcast (Reg Type Type) Reg)-(rule 9 (gen_bitcast r (ty_supported_float_size $F16) (ty_supported_vec _)) (if-let false (has_zvfh)) (rv_vfmv_sf r (vstate_from_type $F32)))-(rule 8 (gen_bitcast r (ty_supported_vec ty) (ty_supported_float_size $F16)) (if-let false (has_zvfh)) (gen_bitcast (gen_bitcast r ty $I16) $I16 $F16))-(rule 7 (gen_bitcast r (ty_supported_float_min src_ty) (ty_supported_vec _)) (rv_vfmv_sf r src_ty))-(rule 6 (gen_bitcast r (ty_supported_vec _) (ty_supported_float_min dst_ty)) (rv_vfmv_fs r dst_ty))+(rule 9 (gen_bitcast r (ty_supported_float_size $F16) (ty_supported_vec_repr _)) (if-let false (has_zvfh)) (rv_vfmv_sf r (vstate_from_type $F32)))+(rule 8 (gen_bitcast r (ty_supported_vec_repr ty) (ty_supported_float_size $F16)) (if-let false (has_zvfh)) (gen_bitcast (gen_bitcast r ty $I16) $I16 $F16))+(rule 7 (gen_bitcast r (ty_supported_float_min src_ty) (ty_supported_vec_repr _)) (rv_vfmv_sf r src_ty))+(rule 6 (gen_bitcast r (ty_supported_vec_repr _) (ty_supported_float_min dst_ty)) (rv_vfmv_fs r dst_ty))-(rule 5 (gen_bitcast r (ty_int_ref_scalar_64_extract src_ty) (ty_supported_vec _)) (rv_vmv_sx r src_ty))-(rule 4 (gen_bitcast r (ty_supported_vec _) (ty_int_ref_scalar_64_extract dst_ty)) (rv_vmv_xs r dst_ty))+(rule 5 (gen_bitcast r (ty_int_ref_scalar_64_extract src_ty) (ty_supported_vec_repr _)) (rv_vmv_sx r src_ty))+(rule 4 (gen_bitcast r (ty_supported_vec_repr _) (ty_int_ref_scalar_64_extract dst_ty)) (rv_vmv_xs r dst_ty))(rule 3 (gen_bitcast r (ty_supported_float_min $F16) $I16) (rv_fmvxh r))(rule 2 (gen_bitcast r (ty_supported_float_size $F16) $I16) (rv_fmvxw r))(rule 2 (gen_bitcast r (ty_supported_float_size $F32) $I32) (rv_fmvxw r))@@ -3077,7 +3082,7 @@(rule 0 (gen_bitcast r $I64 (ty_supported_float_size $F64)) (rv_fmvdx r))(rule -1 (gen_bitcast r (ty_supported_float_size _) (ty_supported_float_size _)) r)(rule -2 (gen_bitcast r (ty_int_ref_scalar_64_extract _) (ty_int_ref_scalar_64_extract _)) r)-(rule -3 (gen_bitcast r (ty_supported_vec _) (ty_supported_vec _)) r)+(rule -3 (gen_bitcast r (ty_supported_vec_repr _) (ty_supported_vec_repr _)) r)(decl move_f_to_x (FReg Type) XReg)(rule (move_f_to_x r ty) (gen_bitcast r ty (float_int_of_same_size ty)))diff --git a/cranelift/codegen/src/isa/riscv64/lower.isle b/cranelift/codegen/src/isa/riscv64/lower.isleindex c58b4df833..aaf29497db 100644--- a/cranelift/codegen/src/isa/riscv64/lower.isle+++ b/cranelift/codegen/src/isa/riscv64/lower.isle@@ -11,7 +11,7 @@;; ;;;; Rules for `vconst` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-(rule (lower (vconst (ty_supported_vec ty) n))+(rule (lower (vconst (ty_supported_vec_repr ty) n))(gen_constant ty (const_to_vconst n)));;;; Rules for `f16const` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;@@ -766,11 +766,11 @@(value_regs low high)));; Zvbb: band(x, bnot(y)) -> vandn.vv-(rule 18 (lower (band (ty_supported_vec ty) x (bnot _ y)))+(rule 18 (lower (band (ty_supported_vec_repr ty) x (bnot _ y)))(if-let true (has_zvbb))(rv_vandn_vv x y (unmasked) ty))-(rule 19 (lower (band (ty_supported_vec ty) (bnot _ y) x))+(rule 19 (lower (band (ty_supported_vec_repr ty) (bnot _ y) x))(if-let true (has_zvbb))(rv_vandn_vv x y (unmasked) ty))@@ -784,7 +784,7 @@(if (ty_vector_not_float ty))(rv_vandn_vx x y (unmasked) ty))-(rule 9 (lower (band (ty_supported_vec ty) x y))+(rule 9 (lower (band (ty_supported_vec_repr ty) x y))(rv_vand_vv x y (unmasked) ty))(rule 10 (lower (band (ty_supported_vec ty) x (splat _ y)))@@ -795,11 +795,11 @@(if (ty_vector_not_float ty))(rv_vand_vx y x (unmasked) ty))-(rule 12 (lower (band (ty_supported_vec ty) x y))+(rule 12 (lower (band (ty_supported_vec_repr ty) x y))(if-let y_imm (replicated_imm5 y))(rv_vand_vi x y_imm (unmasked) ty))-(rule 13 (lower (band (ty_supported_vec ty) x y))+(rule 13 (lower (band (ty_supported_vec_repr ty) x y))(if-let x_imm (replicated_imm5 x))(rv_vand_vi y x_imm (unmasked) ty))@@ -919,7 +919,7 @@(high XReg (rv_orn (value_regs_get x 1) (value_regs_get y 1))))(value_regs low high)))-(rule 9 (lower (bor (ty_supported_vec ty) x y))+(rule 9 (lower (bor (ty_supported_vec_repr ty) x y))(rv_vor_vv x y (unmasked) ty))(rule 10 (lower (bor (ty_supported_vec ty) x (splat _ y)))@@ -930,11 +930,11 @@(if (ty_vector_not_float ty))(rv_vor_vx y x (unmasked) ty))-(rule 12 (lower (bor (ty_supported_vec ty) x y))+(rule 12 (lower (bor (ty_supported_vec_repr ty) x y))(if-let y_imm (replicated_imm5 y))(rv_vor_vi x y_imm (unmasked) ty))-(rule 13 (lower (bor (ty_supported_vec ty) x y))+(rule 13 (lower (bor (ty_supported_vec_repr ty) x y))(if-let x_imm (replicated_imm5 x))(rv_vor_vi y x_imm (unmasked) ty))@@ -983,7 +983,7 @@(rule 4 (lower (bxor (ty_supported_float_size ty) x y))(lower_float_binary (AluOPRRR.Xor) x y ty))-(rule 5 (lower (bxor (ty_supported_vec ty) x y))+(rule 5 (lower (bxor (ty_supported_vec_repr ty) x y))(rv_vxor_vv x y (unmasked) ty))(rule 6 (lower (bxor (ty_supported_vec ty) x (splat _ y)))@@ -994,11 +994,11 @@(if (ty_vector_not_float ty))(rv_vxor_vx y x (unmasked) ty))-(rule 8 (lower (bxor (ty_supported_vec ty) x y))+(rule 8 (lower (bxor (ty_supported_vec_repr ty) x y))(if-let y_imm (replicated_imm5 y))(rv_vxor_vi x y_imm (unmasked) ty))-(rule 9 (lower (bxor (ty_supported_vec ty) x y))+(rule 9 (lower (bxor (ty_supported_vec_repr ty) x y))(if-let x_imm (replicated_imm5 x))(rv_vxor_vi y x_imm (unmasked) ty))@@ -1043,7 +1043,7 @@(rv_not (value_regs_get x 0))(rv_not (value_regs_get x 1))))-(rule 3 (lower (bnot (ty_supported_vec ty) x))+(rule 3 (lower (bnot (ty_supported_vec_repr ty) x))(rv_vnot_v x (unmasked) ty))(rule 4 (lower (bnot (ty_int_ref_scalar_64_extract _) (bxor _ x y)))@@ -1994,7 +1994,7 @@(rule 2 (lower (select (ty_reg_pair _) c x y))(gen_select_regs (is_nonzero_cmp c) x y))-(rule 1 (lower (select (ty_supported_vec _) c x y))+(rule 1 (lower (select (ty_supported_vec_repr _) c x y))(gen_select_vreg (is_nonzero_cmp c) x y))(rule 0 (lower (select (ty_supported_float_size _) c x y))@@ -2212,7 +2212,7 @@(hi XReg (gen_load (amode addr offset_plus_8) (LoadOP.Ld) flags)))(value_regs lo hi)))-(rule 2 (lower (load (ty_supported_vec ty) (little_or_native_endian flags) addr offset))+(rule 2 (lower (load (ty_supported_vec_repr ty) (little_or_native_endian flags) addr offset))(let ((eew VecElementWidth (element_width_from_type ty))(amode AMode (amode addr offset)))(vec_load eew (VecAMode.UnitStride amode) flags (unmasked) ty)))@@ -2283,7 +2283,7 @@(let ((_ InstOutput (rv_store (amode addr offset) (StoreOP.Sd) flags (value_regs_get src 0))))(rv_store (amode addr offset_plus_8) (StoreOP.Sd) flags (value_regs_get src 1))))-(rule 2 (lower (store (little_or_native_endian flags) src @ (value_type (ty_supported_vec ty)) addr offset))+(rule 2 (lower (store (little_or_native_endian flags) src @ (value_type (ty_supported_vec_repr ty)) addr offset))(let ((eew VecElementWidth (element_width_from_type ty))(amode AMode (amode addr offset)))(vec_store eew (VecAMode.UnitStride amode) src flags (unmasked) ty)))@@ -2625,14 +2625,14 @@;; These rules should probably be handled in `gen_bitcast`, but it's convenient to have that return;; a single register, instead of a `ValueRegs`-(rule 3 (lower (bitcast (ty_reg_pair _) _ v @ (value_type (ty_supported_vec _))))+(rule 3 (lower (bitcast (ty_reg_pair _) _ v @ (value_type (ty_supported_vec_repr _))))(value_regs(gen_extractlane $I64X2 v 0)(gen_extractlane $I64X2 v 1)));; Move the high half into a vector register, and then use vslide1up to move it up and;; insert the lower half in one instruction.-(rule 2 (lower (bitcast (ty_supported_vec _) _ v @ (value_type (ty_reg_pair _))))+(rule 2 (lower (bitcast (ty_supported_vec_repr _) _ v @ (value_type (ty_reg_pair _))))(let ((lo XReg (value_regs_get v 0))(hi XReg (value_regs_get v 1))(vstate VState (vstate_from_type $I64X2))diff --git a/cranelift/codegen/src/isa/riscv64/lower/isle.rs b/cranelift/codegen/src/isa/riscv64/lower/isle.rsindex e5da2eccb6..12b7dd9eb4 100644--- a/cranelift/codegen/src/isa/riscv64/lower/isle.rs+++ b/cranelift/codegen/src/isa/riscv64/lower/isle.rs@@ -253,6 +253,14 @@ impl generated_code::Context for RV64IsleContext<'_, '_, MInst, Riscv64Backend>self.ty_supported(ty).filter(|ty| ty.is_vector())}+ fn ty_supported_vec_repr(&mut self, ty: Type) -> Option<Type> {+ if ty.is_vector() && self.ty_supported_vec(ty.as_int()).is_some() {+ Some(ty)+ } else {+ None+ }+ }+fn ty_reg_pair(&mut self, ty: Type) -> Option<Type> {match ty {I128 | F128 => Some(ty),diff --git a/cranelift/filetests/filetests/isa/riscv64/simd-const-f16.clif b/cranelift/filetests/filetests/isa/riscv64/simd-const-f16.clifindex 2419d83ac4..44896dd1d1 100644--- a/cranelift/filetests/filetests/isa/riscv64/simd-const-f16.clif+++ b/cranelift/filetests/filetests/isa/riscv64/simd-const-f16.clif@@ -2,6 +2,7 @@ test compile precise-outputset enable_multi_ret_implicit_sretset unwind_info=falsetarget riscv64 has_v has_zvfh+target riscv64 has_v has_zvfh=falsefunction %const_f16x8() -> f16x8 {diff --git a/cranelift/filetests/filetests/isa/riscv64/simd-f16-no-zvfh.clif b/cranelift/filetests/filetests/isa/riscv64/simd-f16-no-zvfh.clifnew file mode 100644index 0000000000..dcb3ee49ae--- /dev/null+++ b/cranelift/filetests/filetests/isa/riscv64/simd-f16-no-zvfh.clif@@ -0,0 +1,449 @@+test compile precise-output+set enable_multi_ret_implicit_sret+set unwind_info=false+target riscv64 has_v has_zvfh=false++function %copy_f16x8(i64, i64) {+block0(v0: i64, v1: i64):+ v2 = load.f16x8 v0+ store v2, v1+ return+}++; VCode:+; block0:+; vle16.v v8,0(a0) #avl=8, #vtype=(e16, m1, ta, ma)+; vse16.v v8,0(a1) #avl=8, #vtype=(e16, m1, ta, ma)+; ret+;+; Disassembled:+; block0: ; offset 0x0+; .byte 0x57, 0x70, 0x84, 0xcc+; .byte 0x07, 0x54, 0x05, 0x02 ; trap: heap_oob+; .byte 0x27, 0xd4, 0x05, 0x02 ; trap: heap_oob+; ret++function %bitcast_f16x8_to_i16x8(f16x8) -> i16x8 {+block0(v0: f16x8):+ v1 = bitcast.i16x8 v0+ return v1+}++; VCode:+; addi sp,sp,-16+; sd ra,8(sp)+; sd fp,0(sp)+; mv fp,sp+; block0:+; vle8.v v8,-16(incoming_arg) #avl=16, #vtype=(e8, m1, ta, ma)+; vse8.v v8,0(a0) #avl=16, #vtype=(e8, m1, ta, ma)+; ld ra,8(sp)+; ld fp,0(sp)+; addi sp,sp,16+; ret+;+; Disassembled:+; block0: ; offset 0x0+; addi sp, sp, -0x10+; sd ra, 8(sp)+; sd s0, 0(sp)+; mv s0, sp+; block1: ; offset 0x10+; .byte 0x57, 0x70, 0x08, 0xcc+; addi t6, sp, 0x10+; .byte 0x07, 0x84, 0x0f, 0x02+; .byte 0x27, 0x04, 0x05, 0x02+; ld ra, 8(sp)+; ld s0, 0(sp)+; addi sp, sp, 0x10+; ret++function %bitcast_f16x8_to_i128(f16x8) -> i128 {+block0(v0: f16x8):+ v1 = bitcast.i128 little v0+ return v1+}++; VCode:+; addi sp,sp,-16+; sd ra,8(sp)+; sd fp,0(sp)+; mv fp,sp+; block0:+; vle8.v v8,-16(incoming_arg) #avl=16, #vtype=(e8, m1, ta, ma)+; vmv.x.s a0,v8 #avl=2, #vtype=(e64, m1, ta, ma)+; vslidedown.vi v8,v8,1 #avl=2, #vtype=(e64, m1, ta, ma)+; vmv.x.s a1,v8 #avl=2, #vtype=(e64, m1, ta, ma)+; ld ra,8(sp)+; ld fp,0(sp)+; addi sp,sp,16+; ret+;+; Disassembled:+; block0: ; offset 0x0+; addi sp, sp, -0x10+; sd ra, 8(sp)+; sd s0, 0(sp)+; mv s0, sp+; block1: ; offset 0x10+; .byte 0x57, 0x70, 0x08, 0xcc+; addi t6, sp, 0x10+; .byte 0x07, 0x84, 0x0f, 0x02+; .byte 0x57, 0x70, 0x81, 0xcd+; .byte 0x57, 0x25, 0x80, 0x42+; .byte 0x57, 0xb4, 0x80, 0x3e+; .byte 0xd7, 0x25, 0x80, 0x42+; ld ra, 8(sp)+; ld s0, 0(sp)+; addi sp, sp, 0x10+; ret++function %bitcast_i128_to_f16x8(i128) -> f16x8 {+block0(v0: i128):+ v1 = bitcast.f16x8 little v0+ return v1+}++; VCode:+; block0:+; vmv.s.x v8,a2 #avl=2, #vtype=(e64, m1, ta, ma)+; vmv1r.v v9,v8+; vslide1up.vx v9,v8,a1 #avl=2, #vtype=(e64, m1, ta, ma)+; vse8.v v9,0(a0) #avl=16, #vtype=(e8, m1, ta, ma)+; ret+;+; Disassembled:+; block0: ; offset 0x0+; .byte 0x57, 0x70, 0x81, 0xcd+; .byte 0x57, 0x64, 0x06, 0x42+; .byte 0xd7, 0x34, 0x80, 0x9e+; .byte 0xd7, 0xe4, 0x85, 0x3a+; .byte 0x57, 0x70, 0x08, 0xcc+; .byte 0xa7, 0x04, 0x05, 0x02+; ret++function %select_f16x8(i64, f16x8, f16x8) -> f16x8 {+block0(v0: i64, v1: f16x8, v2: f16x8):+ v3 = select v0, v1, v2+ return v3+}++; VCode:+; addi sp,sp,-16+; sd ra,8(sp)+; sd fp,0(sp)+; mv fp,sp+; block0:+; vle8.v v8,-32(incoming_arg) #avl=16, #vtype=(e8, m1, ta, ma)+; vle8.v v9,-16(incoming_arg) #avl=16, #vtype=(e8, m1, ta, ma)+; select v8,v8,v9##condition=(a1 ne zero)+; vse8.v v8,0(a0) #avl=16, #vtype=(e8, m1, ta, ma)+; ld ra,8(sp)+; ld fp,0(sp)+; addi sp,sp,16+; ret+;+; Disassembled:+; block0: ; offset 0x0+; addi sp, sp, -0x10+; sd ra, 8(sp)+; sd s0, 0(sp)+; mv s0, sp+; block1: ; offset 0x10+; .byte 0x57, 0x70, 0x08, 0xcc+; addi t6, sp, 0x10+; .byte 0x07, 0x84, 0x0f, 0x02+; addi t6, sp, 0x20+; .byte 0x87, 0x84, 0x0f, 0x02+; bnez a1, 8+; .byte 0x57, 0x34, 0x90, 0x9e+; .byte 0x27, 0x04, 0x05, 0x02+; ld ra, 8(sp)+; ld s0, 0(sp)+; addi sp, sp, 0x10+; ret++function %band_f16x8(f16x8, f16x8) -> f16x8 {+block0(v0: f16x8, v1: f16x8):+ v2 = band v0, v1+ return v2+}++; VCode:+; addi sp,sp,-16+; sd ra,8(sp)+; sd fp,0(sp)+; mv fp,sp+; block0:+; vle8.v v8,-32(incoming_arg) #avl=16, #vtype=(e8, m1, ta, ma)+; vle8.v v9,-16(incoming_arg) #avl=16, #vtype=(e8, m1, ta, ma)+; vand.vv v8,v8,v9 #avl=8, #vtype=(e16, m1, ta, ma)+; vse8.v v8,0(a0) #avl=16, #vtype=(e8, m1, ta, ma)+; ld ra,8(sp)+; ld fp,0(sp)+; addi sp,sp,16+; ret+;+; Disassembled:+; block0: ; offset 0x0+; addi sp, sp, -0x10+; sd ra, 8(sp)+; sd s0, 0(sp)+; mv s0, sp+; block1: ; offset 0x10+; .byte 0x57, 0x70, 0x08, 0xcc+; addi t6, sp, 0x10+; .byte 0x07, 0x84, 0x0f, 0x02+; addi t6, sp, 0x20+; .byte 0x87, 0x84, 0x0f, 0x02+; .byte 0x57, 0x70, 0x84, 0xcc+; .byte 0x57, 0x84, 0x84, 0x26+; .byte 0x57, 0x70, 0x08, 0xcc+; .byte 0x27, 0x04, 0x05, 0x02+; ld ra, 8(sp)+; ld s0, 0(sp)+; addi sp, sp, 0x10+; ret++function %band_const_f16x8(f16x8) -> f16x8 {+block0(v0: f16x8):+ v1 = vconst.f16x8 0x00050005000500050005000500050005+ v2 = band v0, v1+ return v2+}++; VCode:+; addi sp,sp,-16+; sd ra,8(sp)+; sd fp,0(sp)+; mv fp,sp+; block0:+; vle8.v v8,-16(incoming_arg) #avl=16, #vtype=(e8, m1, ta, ma)+; vand.vi v8,v8,5 #avl=8, #vtype=(e16, m1, ta, ma)+; vse8.v v8,0(a0) #avl=16, #vtype=(e8, m1, ta, ma)+; ld ra,8(sp)+; ld fp,0(sp)+; addi sp,sp,16+; ret+;+; Disassembled:+; block0: ; offset 0x0+; addi sp, sp, -0x10+; sd ra, 8(sp)+; sd s0, 0(sp)+; mv s0, sp+; block1: ; offset 0x10+; .byte 0x57, 0x70, 0x08, 0xcc+; addi t6, sp, 0x10+; .byte 0x07, 0x84, 0x0f, 0x02+; .byte 0x57, 0x70, 0x84, 0xcc+; .byte 0x57, 0xb4, 0x82, 0x26+; .byte 0x57, 0x70, 0x08, 0xcc+; .byte 0x27, 0x04, 0x05, 0x02+; ld ra, 8(sp)+; ld s0, 0(sp)+; addi sp, sp, 0x10+; ret++function %bor_f16x8(f16x8, f16x8) -> f16x8 {+block0(v0: f16x8, v1: f16x8):+ v2 = bor v0, v1+ return v2+}++; VCode:+; addi sp,sp,-16+; sd ra,8(sp)+; sd fp,0(sp)+; mv fp,sp+; block0:+; vle8.v v8,-32(incoming_arg) #avl=16, #vtype=(e8, m1, ta, ma)+; vle8.v v9,-16(incoming_arg) #avl=16, #vtype=(e8, m1, ta, ma)+; vor.vv v8,v8,v9 #avl=8, #vtype=(e16, m1, ta, ma)+; vse8.v v8,0(a0) #avl=16, #vtype=(e8, m1, ta, ma)+; ld ra,8(sp)+; ld fp,0(sp)+; addi sp,sp,16+; ret+;+; Disassembled:+; block0: ; offset 0x0+; addi sp, sp, -0x10+; sd ra, 8(sp)+; sd s0, 0(sp)+; mv s0, sp+; block1: ; offset 0x10+; .byte 0x57, 0x70, 0x08, 0xcc+; addi t6, sp, 0x10+; .byte 0x07, 0x84, 0x0f, 0x02+; addi t6, sp, 0x20+; .byte 0x87, 0x84, 0x0f, 0x02+; .byte 0x57, 0x70, 0x84, 0xcc+; .byte 0x57, 0x84, 0x84, 0x2a+; .byte 0x57, 0x70, 0x08, 0xcc+; .byte 0x27, 0x04, 0x05, 0x02+; ld ra, 8(sp)+; ld s0, 0(sp)+; addi sp, sp, 0x10+; ret++function %bor_const_f16x8(f16x8) -> f16x8 {+block0(v0: f16x8):+ v1 = vconst.f16x8 0x00050005000500050005000500050005+ v2 = bor v0, v1+ return v2+}++; VCode:+; addi sp,sp,-16+; sd ra,8(sp)+; sd fp,0(sp)+; mv fp,sp+; block0:+; vle8.v v8,-16(incoming_arg) #avl=16, #vtype=(e8, m1, ta, ma)+; vor.vi v8,v8,5 #avl=8, #vtype=(e16, m1, ta, ma)+; vse8.v v8,0(a0) #avl=16, #vtype=(e8, m1, ta, ma)+; ld ra,8(sp)+; ld fp,0(sp)+; addi sp,sp,16+; ret+;+; Disassembled:+; block0: ; offset 0x0+; addi sp, sp, -0x10+; sd ra, 8(sp)+; sd s0, 0(sp)+; mv s0, sp+; block1: ; offset 0x10+; .byte 0x57, 0x70, 0x08, 0xcc+; addi t6, sp, 0x10+; .byte 0x07, 0x84, 0x0f, 0x02+; .byte 0x57, 0x70, 0x84, 0xcc+; .byte 0x57, 0xb4, 0x82, 0x2a+; .byte 0x57, 0x70, 0x08, 0xcc+; .byte 0x27, 0x04, 0x05, 0x02+; ld ra, 8(sp)+; ld s0, 0(sp)+; addi sp, sp, 0x10+; ret++function %bxor_f16x8(f16x8, f16x8) -> f16x8 {+block0(v0: f16x8, v1: f16x8):+ v2 = bxor v0, v1+ return v2+}++; VCode:+; addi sp,sp,-16+; sd ra,8(sp)+; sd fp,0(sp)+; mv fp,sp+; block0:+; vle8.v v8,-32(incoming_arg) #avl=16, #vtype=(e8, m1, ta, ma)+; vle8.v v9,-16(incoming_arg) #avl=16, #vtype=(e8, m1, ta, ma)+; vxor.vv v8,v8,v9 #avl=8, #vtype=(e16, m1, ta, ma)+; vse8.v v8,0(a0) #avl=16, #vtype=(e8, m1, ta, ma)+; ld ra,8(sp)+; ld fp,0(sp)+; addi sp,sp,16+; ret+;+; Disassembled:+; block0: ; offset 0x0+; addi sp, sp, -0x10+; sd ra, 8(sp)+; sd s0, 0(sp)+; mv s0, sp+; block1: ; offset 0x10+; .byte 0x57, 0x70, 0x08, 0xcc+; addi t6, sp, 0x10+; .byte 0x07, 0x84, 0x0f, 0x02+; addi t6, sp, 0x20+; .byte 0x87, 0x84, 0x0f, 0x02+; .byte 0x57, 0x70, 0x84, 0xcc+; .byte 0x57, 0x84, 0x84, 0x2e+; .byte 0x57, 0x70, 0x08, 0xcc+; .byte 0x27, 0x04, 0x05, 0x02+; ld ra, 8(sp)+; ld s0, 0(sp)+; addi sp, sp, 0x10+; ret++function %bxor_const_f16x8(f16x8) -> f16x8 {+block0(v0: f16x8):+ v1 = vconst.f16x8 0xfff0fff0fff0fff0fff0fff0fff0fff0+ v2 = bxor v0, v1+ return v2+}++; VCode:+; addi sp,sp,-16+; sd ra,8(sp)+; sd fp,0(sp)+; mv fp,sp+; block0:+; vle8.v v8,-16(incoming_arg) #avl=16, #vtype=(e8, m1, ta, ma)+; vxor.vi v8,v8,-16 #avl=8, #vtype=(e16, m1, ta, ma)+; vse8.v v8,0(a0) #avl=16, #vtype=(e8, m1, ta, ma)+; ld ra,8(sp)+; ld fp,0(sp)+; addi sp,sp,16+; ret+;+; Disassembled:+; block0: ; offset 0x0+; addi sp, sp, -0x10+; sd ra, 8(sp)+; sd s0, 0(sp)+; mv s0, sp+; block1: ; offset 0x10+; .byte 0x57, 0x70, 0x08, 0xcc+; addi t6, sp, 0x10+; .byte 0x07, 0x84, 0x0f, 0x02+; .byte 0x57, 0x70, 0x84, 0xcc+; .byte 0x57, 0x34, 0x88, 0x2e+; .byte 0x57, 0x70, 0x08, 0xcc+; .byte 0x27, 0x04, 0x05, 0x02+; ld ra, 8(sp)+; ld s0, 0(sp)+; addi sp, sp, 0x10+; ret++function %bnot_f16x8(f16x8) -> f16x8 {+block0(v0: f16x8):+ v1 = bnot v0+ return v1+}++; VCode:+; addi sp,sp,-16+; sd ra,8(sp)+; sd fp,0(sp)+; mv fp,sp+; block0:+; vle8.v v8,-16(incoming_arg) #avl=16, #vtype=(e8, m1, ta, ma)+; vnot.v v8,v8 #avl=8, #vtype=(e16, m1, ta, ma)+; vse8.v v8,0(a0) #avl=16, #vtype=(e8, m1, ta, ma)+; ld ra,8(sp)+; ld fp,0(sp)+; addi sp,sp,16+; ret+;+; Disassembled:+; block0: ; offset 0x0+; addi sp, sp, -0x10+; sd ra, 8(sp)+; sd s0, 0(sp)+; mv s0, sp+; block1: ; offset 0x10+; .byte 0x57, 0x70, 0x08, 0xcc+; addi t6, sp, 0x10+; .byte 0x07, 0x84, 0x0f, 0x02+; .byte 0x57, 0x70, 0x84, 0xcc+; .byte 0x57, 0xb4, 0x8f, 0x2e+; .byte 0x57, 0x70, 0x08, 0xcc+; .byte 0x27, 0x04, 0x05, 0x02+; ld ra, 8(sp)+; ld s0, 0(sp)+; addi sp, sp, 0x10+; retdiff --git a/cranelift/filetests/filetests/isa/riscv64/zvbb.clif b/cranelift/filetests/filetests/isa/riscv64/zvbb.clifindex de5c8a8396..ee746b7e1d 100644--- a/cranelift/filetests/filetests/isa/riscv64/zvbb.clif+++ b/cranelift/filetests/filetests/isa/riscv64/zvbb.clif@@ -1,7 +1,7 @@test compile precise-outputset enable_multi_ret_implicit_sretset unwind_info=false-target riscv64 has_v has_zvbb+target riscv64 has_v has_zvbb has_zvfh=falsefunction %vandn_i8x16(i8x16, i8x16) -> i8x16 {block0(v0: i8x16, v1: i8x16):@@ -362,3 +362,45 @@ block0(v0: i64x2, v1: i64):; addi sp, sp, 0x10; ret+function %vandn_f16x8(f16x8, f16x8) -> f16x8 {+block0(v0: f16x8, v1: f16x8):+ v2 = bnot v1+ v3 = band v0, v2+ return v3+}++; VCode:+; addi sp,sp,-16+; sd ra,8(sp)+; sd fp,0(sp)+; mv fp,sp+; block0:+; vle8.v v8,-32(incoming_arg) #avl=16, #vtype=(e8, m1, ta, ma)+; vle8.v v9,-16(incoming_arg) #avl=16, #vtype=(e8, m1, ta, ma)+; vandn.vv v8,v8,v9 #avl=8, #vtype=(e16, m1, ta, ma)+; vse8.v v8,0(a0) #avl=16, #vtype=(e8, m1, ta, ma)+; ld ra,8(sp)+; ld fp,0(sp)+; addi sp,sp,16+; ret+;+; Disassembled:+; block0: ; offset 0x0+; addi sp, sp, -0x10+; sd ra, 8(sp)+; sd s0, 0(sp)+; mv s0, sp+; block1: ; offset 0x10+; .byte 0x57, 0x70, 0x08, 0xcc+; addi t6, sp, 0x10+; .byte 0x07, 0x84, 0x0f, 0x02+; addi t6, sp, 0x20+; .byte 0x87, 0x84, 0x0f, 0x02+; .byte 0x57, 0x70, 0x84, 0xcc+; .byte 0x57, 0x84, 0x84, 0x06+; .byte 0x57, 0x70, 0x08, 0xcc+; .byte 0x27, 0x04, 0x05, 0x02+; ld ra, 8(sp)+; ld s0, 0(sp)+; addi sp, sp, 0x10+; ret