ARM v8.1 simd + v8.3 complex insns
v3 cover ARM v8.1 simd + v8.3 complex insns
I believe I've incorporated all of Peter's feedback from v2. This is based on target-arm.next, which now contains Alex's fp16 work.
Re-tested our standard aarch64 risu tests with -cpu cortex-a57, and against the new risu tests I posted this morning for aa64 and aa32.
r~
Richard Henderson (16):
target/arm: Add ARM_FEATURE_V8_RDM
target/arm: Refactor disas_simd_indexed decode target/arm: Refactor disas_simd_indexed size checks target/arm: Decode aa64 armv8.1 scalar three same extra target/arm: Decode aa64 armv8.1 three same extra target/arm: Decode aa64 armv8.1 scalar/vector x indexed element target/arm: Decode aa32 armv8.1 three same target/arm: Decode aa32 armv8.1 two reg and a scalar target/arm: Enable ARM_FEATURE_V8_RDM
target/arm: Add ARM_FEATURE_V8_FCMA
target/arm: Decode aa64 armv8.3 fcadd
target/arm: Decode aa64 armv8.3 fcmla
target/arm: Decode aa32 armv8.3 3-same
target/arm: Decode aa32 armv8.3 2-reg-index target/arm: Decode t32 simd 3reg and 2reg_scalar extension target/arm: Enable ARM_FEATURE_V8_FCMA
target/arm/cpu.h | 2 + target/arm/helper.h | 31 +++ linux-user/elfload.c | 2 + target/arm/cpu.c | 2 + target/arm/cpu64.c | 2 + target/arm/translate-a64.c | 514 ++++++++++++++++++++++++++++++++++++--------- target/arm/translate.c | 275 +++++++++++++++++++++--- target/arm/vec_helper.c | 429 +++++++++++++++++++++++++++++++++++++ target/arm/Makefile.objs | 2 +- 9 files changed, 1133 insertions(+), 126 deletions(-) create mode 100644 target/arm/vec_helper.c
Signature · 1 line
2.14.3
PATCH v3 1/16 target/arm: Add ARM_FEATURE_V8_RDM
Not enabled anywhere yet.
--- target/arm/cpu.h | 1 + linux-user/elfload.c | 1 + 2 files changed, 2 insertions(+)
target/arm/cpu.h +1 -0
@@ -1427,6 +1427,7 @@ enum arm_features {ARM_FEATURE_V8_SHA3 ,/* implements SHA3 part of v8 Crypto Extensions */ ARM_FEATURE_V8_SM3 ,/* implements SM3 part of v8 Crypto Extensions */ ARM_FEATURE_V8_SM4 ,/* implements SM4 part of v8 Crypto Extensions */ +ARM_FEATURE_V8_RDM ,/* implements v8.1 simd round multiply */ ARM_FEATURE_V8_FP16, /* implements v8.2 half-precision float */ };
linux-user/elfload.c +1 -0
@@ -551,6 +551,7 @@ static uint32_t get_elf_hwcap(void)GET_FEATURE (ARM_FEATURE_V8_SM3 ,ARM_HWCAP_A64_SM3 );GET_FEATURE (ARM_FEATURE_V8_SM4 ,ARM_HWCAP_A64_SM4 );GET_FEATURE (ARM_FEATURE_V8_SHA512 ,ARM_HWCAP_A64_SHA512 ); +GET_FEATURE (ARM_FEATURE_V8_RDM ,ARM_HWCAP_A64_ASIMDRDM );#undef GET_FEATUREreturn hwcaps;
Signature · 1 line
2.14.3
PATCH v3 2/16 target/arm: Refactor disas_simd_indexed decode
In reply to Richard HendersonInclude the U bit in the switches rather than testing separately.
--- target/arm/translate-a64.c | 129 +++++++++++++++++++++------------------------ 1 file changed, 61 insertions(+), 68 deletions(-)
target/arm/translate-a64.c +61 -68
@@ -11787,49 +11787,39 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn)int index;TCGv_ptr fpst; -switch (opcode) { -case 0x0 :/* MLA */ -case 0x4 :/* MLS */ -if (!u || is_scalar) { +switch (16 * u + opcode) { +case 0x08 :/* MUL */ +case 0x10 :/* MLA */ +case 0x14 :/* MLS */ +if (is_scalar) {unallocated_encoding (s);return ; }break ; -case 0x2 :/* SMLAL, SMLAL2, UMLAL, UMLAL2 */ -case 0x6 :/* SMLSL, SMLSL2, UMLSL, UMLSL2 */ -case 0xa :/* SMULL, SMULL2, UMULL, UMULL2 */ +case 0x02 :/* SMLAL, SMLAL2 */ +case 0x12 :/* UMLAL, UMLAL2 */ +case 0x06 :/* SMLSL, SMLSL2 */ +case 0x16 :/* UMLSL, UMLSL2 */ +case 0x0a :/* SMULL, SMULL2 */ +case 0x1a :/* UMULL, UMULL2 */ if (is_scalar) {unallocated_encoding (s);return ; } is_long = true;break ; -case 0x3 :/* SQDMLAL, SQDMLAL2 */ -case 0x7 :/* SQDMLSL, SQDMLSL2 */ -case 0xb :/* SQDMULL, SQDMULL2 */ +case 0x03 :/* SQDMLAL, SQDMLAL2 */ +case 0x07 :/* SQDMLSL, SQDMLSL2 */ +case 0x0b :/* SQDMULL, SQDMULL2 */ is_long = true; -/* fall through */ -case 0xc :/* SQDMULH */ -case 0xd :/* SQRDMULH */ -if (u) { -unallocated_encoding (s); -return ; - }break ; -case 0x8 :/* MUL */ -if (u || is_scalar) { -unallocated_encoding (s); -return ; - } +case 0x0c :/* SQDMULH */ +case 0x0d :/* SQRDMULH */ break ; -case 0x1 :/* FMLA */ -case 0x5 :/* FMLS */ -if (u) { -unallocated_encoding (s); -return ; - } -/* fall through */ -case 0x9 :/* FMUL, FMULX */ +case 0x01 :/* FMLA */ +case 0x05 :/* FMLS */ +case 0x09 :/* FMUL */ +case 0x19 :/* FMULX */ if (size ==1 ) {unallocated_encoding (s);return ;
@@ -11909,21 +11899,20 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn)read_vec_element (s, tcg_op, rn, pass,MO_64 ); -switch (opcode) { -case 0x5 :/* FMLS */ +switch (16 * u + opcode) { +case 0x05 :/* FMLS */ /* As usual for ARM, separate negation for fused multiply-add */ gen_helper_vfp_negd (tcg_op, tcg_op);/* fall through */ -case 0x1 :/* FMLA */ +case 0x01 :/* FMLA */ read_vec_element (s, tcg_res, rd, pass,MO_64 );gen_helper_vfp_muladdd (tcg_res, tcg_op, tcg_idx, tcg_res, fpst);break ; -case 0x9 :/* FMUL, FMULX */ -if (u) { -gen_helper_vfp_mulxd (tcg_res, tcg_op, tcg_idx, fpst); - }else { -gen_helper_vfp_muld (tcg_res, tcg_op, tcg_idx, fpst); - } +case 0x09 :/* FMUL */ +gen_helper_vfp_muld (tcg_res, tcg_op, tcg_idx, fpst); +break ; +case 0x19 :/* FMULX */ +gen_helper_vfp_mulxd (tcg_res, tcg_op, tcg_idx, fpst);break ;default :g_assert_not_reached ();
@@ -11966,10 +11955,10 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn)read_vec_element_i32 (s, tcg_op, rn, pass, is_scalar ? size :MO_32 ); -switch (opcode) { -case 0x0 :/* MLA */ -case 0x4 :/* MLS */ -case 0x8 :/* MUL */ +switch (16 * u + opcode) { +case 0x08 :/* MUL */ +case 0x10 :/* MLA */ +case 0x14 :/* MLS */ {static NeonGenTwoOpFn *const fns[2 ][2 ] = { { gen_helper_neon_add_u16, gen_helper_neon_sub_u16 },
@@ -11991,8 +11980,8 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn)genfn (tcg_res, tcg_op, tcg_res);break ; } -case 0x5 :/* FMLS */ -case 0x1 :/* FMLA */ +case 0x05 :/* FMLS */ +case 0x01 :/* FMLA */ read_vec_element_i32 (s, tcg_res, rd, pass, is_scalar ? size :MO_32 );switch (size) {
@@ -12023,39 +12012,43 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn)g_assert_not_reached (); }break ; -case 0x9 :/* FMUL, FMULX */ +case 0x09 :/* FMUL */ switch (size) {case 1 : -if (u) { -if (is_scalar) { -gen_helper_advsimd_mulxh (tcg_res, tcg_op, - tcg_idx, fpst); - }else { -gen_helper_advsimd_mulx2h (tcg_res, tcg_op, - tcg_idx, fpst); - } +if (is_scalar) { +gen_helper_advsimd_mulh (tcg_res, tcg_op, + tcg_idx, fpst); }else { -if (is_scalar) { -gen_helper_advsimd_mulh (tcg_res, tcg_op, - tcg_idx, fpst); - }else { -gen_helper_advsimd_mul2h (tcg_res, tcg_op, - tcg_idx, fpst); - } +gen_helper_advsimd_mul2h (tcg_res, tcg_op, + tcg_idx, fpst); }break ;case 2 : -if (u) { -gen_helper_vfp_mulxs (tcg_res, tcg_op, tcg_idx, fpst); - }else { -gen_helper_vfp_muls (tcg_res, tcg_op, tcg_idx, fpst); - } +gen_helper_vfp_muls (tcg_res, tcg_op, tcg_idx, fpst);break ;default :g_assert_not_reached (); }break ; -case 0xc :/* SQDMULH */ +case 0x19 :/* FMULX */ +switch (size) { +case 1 : +if (is_scalar) { +gen_helper_advsimd_mulxh (tcg_res, tcg_op, + tcg_idx, fpst); + }else { +gen_helper_advsimd_mulx2h (tcg_res, tcg_op, + tcg_idx, fpst); + } +break ; +case 2 : +gen_helper_vfp_mulxs (tcg_res, tcg_op, tcg_idx, fpst); +break ; +default : +g_assert_not_reached (); + } +break ; +case 0x0c :/* SQDMULH */ if (size ==1 ) {gen_helper_neon_qdmulh_s16 (tcg_res, cpu_env, tcg_op, tcg_idx);
@@ -12064,7 +12057,7 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn) tcg_op, tcg_idx); }break ; -case 0xd :/* SQRDMULH */ +case 0x0d :/* SQRDMULH */ if (size ==1 ) {gen_helper_neon_qrdmulh_s16 (tcg_res, cpu_env, tcg_op, tcg_idx);
Signature · 1 line
2.14.3
Re: [Qemu-arm] [PATCH v3 02/16] target/arm: Refactor disas_simd_indexed decode
Quoted 6 lines · Richard Henderson
Include the U bit in the switches rather than testing separately.
Signed-off-by Richard Henderson <[email protected]>--- target/arm/translate-a64.c | 129 +++++++++++++++++++++------------------------ 1 file changed, 61 insertions(+), 68 deletions(-)
thanks
-- PMM
PATCH v3 3/16 target/arm: Refactor disas_simd_indexed size checks
In reply to Richard HendersonThe integer size check was already outside of the opcode switch; move the floating-point size check outside as well. Unify the size vs index adjustment between fp and integer paths.
--- target/arm/translate-a64.c | 65 +++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 33 deletions(-)
target/arm/translate-a64.c +32 -33
@@ -11820,10 +11820,6 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn)case 0x05 :/* FMLS */ case 0x09 :/* FMUL */ case 0x19 :/* FMULX */ -if (size ==1 ) { -unallocated_encoding (s); -return ; - } is_fp = true;break ;default :
@@ -11834,45 +11830,48 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn)if (is_fp) {/* convert insn encoded size to TCGMemOp size */ switch (size) { -case 2 :/* single precision */ - size =MO_32 ; - index = h <<1 | l; - rm |= (m <<4 ); -break ; -case 3 :/* double precision */ - size =MO_64 ; -if (l || !is_q) { +case 0 :/* half-precision */ +if (!arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) {unallocated_encoding (s);return ; } - index = h; - rm |= (m <<4 ); -break ; -case 0 :/* half precision */ size =MO_16 ; - index = h <<2 | l <<1 | m; - is_fp16 = true; -if (arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { -break ; - } -/* fallthru */ -default :/* unallocated */ -unallocated_encoding (s); -return ; - } - }else { -switch (size) { -case 1 : - index = h <<2 | l <<1 | m;break ; -case 2 : - index = h <<1 | l; - rm |= (m <<4 ); +case MO_32 :/* single precision */ +case MO_64 :/* double precision */ break ;default :unallocated_encoding (s);return ; } + }else { +switch (size) { +case MO_8 : +case MO_64 : +unallocated_encoding (s); +return ; + } + } + +/* Given TCGMemOp size, adjust register and indexing. */ +switch (size) { +case MO_16 : + index = h <<2 | l <<1 | m; +break ; +case MO_32 : + index = h <<1 | l; + rm |= m <<4 ; +break ; +case MO_64 : +if (l || !is_q) { +unallocated_encoding (s); +return ; + } + index = h; + rm |= m <<4 ; +break ; +default : +g_assert_not_reached (); }if (!fp_access_check (s)) {
Signature · 1 line
2.14.3
Re: [Qemu-arm] [PATCH v3 03/16] target/arm: Refactor disas_simd_indexed size checks
Quoted 6 lines · Richard Henderson
The integer size check was already outside of the opcode switch; move the floating-point size check outside as well. Unify the size vs index adjustment between fp and integer paths.
Signed-off-by Richard Henderson <[email protected]>---
thanks
-- PMM
PATCH v3 4/16 target/arm: Decode aa64 armv8.1 scalar three same extra
In reply to Richard Henderson--- target/arm/helper.h | 4 ++ target/arm/translate-a64.c | 84 ++++++++++++++++++++++++++++++++++ target/arm/vec_helper.c | 109 +++++++++++++++++++++++++++++++++++++++++++++ target/arm/Makefile.objs | 2 +- 4 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 target/arm/vec_helper.c
target/arm/helper.h +4 -0
@@ -365,8 +365,12 @@ DEF_HELPER_FLAGS_1(neon_rbit_u8, TCG_CALL_NO_RWG_SE, i32, i32) DEF_HELPER_3(neon_qdmulh_s16, i32, env, i32, i32) DEF_HELPER_3(neon_qrdmulh_s16, i32, env, i32, i32) +DEF_HELPER_4(neon_qrdmlah_s16, i32, env, i32, i32, i32) +DEF_HELPER_4(neon_qrdmlsh_s16, i32, env, i32, i32, i32) DEF_HELPER_3(neon_qdmulh_s32, i32, env, i32, i32) DEF_HELPER_3(neon_qrdmulh_s32, i32, env, i32, i32) +DEF_HELPER_4(neon_qrdmlah_s32, i32, env, s32, s32, s32) +DEF_HELPER_4(neon_qrdmlsh_s32, i32, env, s32, s32, s32) DEF_HELPER_1(neon_narrow_u8, i32, i64)DEF_HELPER_1 (neon_narrow_u16, i32, i64)
target/arm/translate-a64.c +84 -0
96 lines not on this page · raw message
target/arm/vec_helper.c new file +109 -0
109 lines not on this page · raw message
target/arm/Makefile.objs +1 -1
@@ -5,7 +5,7 @@ obj-$(call land,$(CONFIG_KVM),$(call lnot,$(TARGET_AARCH64))) += kvm32.o obj-$(call land,$(CONFIG_KVM),$(TARGET_AARCH64)) += kvm64.o obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o obj-y += translate.o op_helper.o helper.o cpu.o -obj-y += neon_helper.o iwmmxt_helper.o +obj-y += neon_helper.o iwmmxt_helper.o vec_helper.o obj-y += gdbstub.o obj-$(TARGET_AARCH64) += cpu64.o translate-a64.o helper-a64.o gdbstub64.o obj-y += crypto_helper.o
Signature · 1 line
2.14.3
PATCH v3 5/16 target/arm: Decode aa64 armv8.1 three same extra
In reply to Richard Henderson--- target/arm/helper.h | 9 +++++ target/arm/translate-a64.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++ target/arm/vec_helper.c | 74 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 166 insertions(+)
target/arm/helper.h +9 -0
@@ -569,6 +569,15 @@ DEF_HELPER_2(dc_zva, void, env, i64) DEF_HELPER_FLAGS_2(neon_pmull_64_lo, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(neon_pmull_64_hi, TCG_CALL_NO_RWG_SE, i64, i64, i64) +DEF_HELPER_FLAGS_5 (gvec_qrdmlah_s16,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_qrdmlsh_s16,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_qrdmlah_s32,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_qrdmlsh_s32,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +#ifdef TARGET_AARCH64 #include "helper-a64.h" #endif
target/arm/translate-a64.c +83 -0
101 lines not on this page · raw message
target/arm/vec_helper.c +74 -0
101 lines not on this page · raw message
Signature · 1 line
2.14.3
PATCH v3 6/16 target/arm: Decode aa64 armv8.1 scalar/vector x indexed element
In reply to Richard Henderson--- target/arm/translate-a64.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
target/arm/translate-a64.c +29 -0
@@ -11987,6 +11987,13 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn)case 0x19 :/* FMULX */ is_fp = true;break ; +case 0x1d :/* SQRDMLAH */ +case 0x1f :/* SQRDMLSH */ +if (!arm_dc_feature (s,ARM_FEATURE_V8_RDM )) { +unallocated_encoding (s); +return ; + } +break ;default :unallocated_encoding (s);return ;
@@ -12230,6 +12237,28 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn) tcg_op, tcg_idx); }break ; +case 0x1d :/* SQRDMLAH */ +read_vec_element_i32 (s, tcg_res, rd, pass, + is_scalar ? size :MO_32 ); +if (size ==1 ) { +gen_helper_neon_qrdmlah_s16 (tcg_res, cpu_env, + tcg_op, tcg_idx, tcg_res); + }else { +gen_helper_neon_qrdmlah_s32 (tcg_res, cpu_env, + tcg_op, tcg_idx, tcg_res); + } +break ; +case 0x1f :/* SQRDMLSH */ +read_vec_element_i32 (s, tcg_res, rd, pass, + is_scalar ? size :MO_32 ); +if (size ==1 ) { +gen_helper_neon_qrdmlsh_s16 (tcg_res, cpu_env, + tcg_op, tcg_idx, tcg_res); + }else { +gen_helper_neon_qrdmlsh_s32 (tcg_res, cpu_env, + tcg_op, tcg_idx, tcg_res); + } +break ;default :g_assert_not_reached (); }
Signature · 1 line
2.14.3
PATCH v3 7/16 target/arm: Decode aa32 armv8.1 three same
In reply to Richard Henderson--- target/arm/translate.c | 86 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 67 insertions(+), 19 deletions(-)
target/arm/translate.c +67 -19
@@ -25,6 +25,7 @@#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg-op.h" +#include "tcg-op-gvec.h" #include "qemu/log.h" #include "qemu/bitops.h" #include "arm_ldst.h"
@@ -5374,9 +5375,9 @@ static void gen_neon_narrow_op(int op, int u, int size,#define NEON_3R_VPMAX 20#define NEON_3R_VPMIN 21#define NEON_3R_VQDMULH_VQRDMULH 22 -#define NEON_3R_VPADD 23 +#define NEON_3R_VPADD_VQRDMLAH 23#define NEON_3R_SHA 24/* SHA1C,SHA1P,SHA1M,SHA1SU0,SHA256H{2},SHA256SU1 */ -#define NEON_3R_VFM 25/* VFMA, VFMS : float fused multiply-add */ +#define NEON_3R_VFM_VQRDMLSH 25/* VFMA, VFMS, VQRDMLSH */ #define NEON_3R_FLOAT_ARITH 26/* float VADD, VSUB, VPADD, VABD */ #define NEON_3R_FLOAT_MULTIPLY 27/* float VMLA, VMLS, VMUL */ #define NEON_3R_FLOAT_CMP 28/* float VCEQ, VCGE, VCGT */
@@ -5408,9 +5409,9 @@ static const uint8_t neon_3r_sizes[] = { [NEON_3R_VPMAX] = 0x7, [NEON_3R_VPMIN] = 0x7, [NEON_3R_VQDMULH_VQRDMULH] = 0x6, - [NEON_3R_VPADD] = 0x7, + [NEON_3R_VPADD_VQRDMLAH] = 0x7, [NEON_3R_SHA] = 0xf, /* size field encodes op type */ - [NEON_3R_VFM] = 0x5, /* size bit 1 encodes op */ + [NEON_3R_VFM_VQRDMLSH] = 0x7, /* For VFM, size bit 1 encodes op */ [NEON_3R_FLOAT_ARITH] = 0x5, /* size bit 1 encodes op */ [NEON_3R_FLOAT_MULTIPLY] = 0x5, /* size bit 1 encodes op */ [NEON_3R_FLOAT_CMP] = 0x5, /* size bit 1 encodes op */
@@ -5589,6 +5590,22 @@ static const uint8_t neon_2rm_sizes[] = { [NEON_2RM_VCVT_UF] = 0x4, }; + +/* Expand v8.1 simd helper. */ +static int do_v81_helper (DisasContext *s,gen_helper_gvec_3_ptr *fn, +int q,int rd,int rn,int rm) +{ +if (arm_dc_feature (s,ARM_FEATURE_V8_RDM )) { +int opr_sz = (1 + q) *8 ; +tcg_gen_gvec_3_ptr (vfp_reg_offset (1 , rd), +vfp_reg_offset (1 , rn), +vfp_reg_offset (1 , rm), cpu_env, + opr_sz, opr_sz,0 , fn); +return 0 ; + } +return 1 ; +} +/* Translate a NEON data processing instruction. Return nonzero if the instruction is invalid. We process data in a mixture of 32-bit and 64-bit chunks.
@@ -5641,12 +5658,13 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)if (q && ((rd | rn | rm) &1 )) {return 1 ; } -/* -* The SHA-1/SHA-256 3-register instructions require special treatment -* here, as their size field is overloaded as an op type selector, and -* they all consume their input in a single pass. -*/ -if (op ==NEON_3R_SHA ) { +switch (op) { +case NEON_3R_SHA : +/* The SHA-1/SHA-256 3-register instructions require special +* treatment here, as their size field is overloaded as an +* op type selector, and they all consume their input in a +* single pass. +*/ if (!q) {return 1 ; }
@@ -5683,6 +5701,40 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)tcg_temp_free_ptr (ptr2);tcg_temp_free_ptr (ptr3);return 0 ; + +case NEON_3R_VPADD_VQRDMLAH : +if (!u) { +break ;/* VPADD */ + } +/* VQRDMLAH */ +switch (size) { +case 1 : +return do_v81_helper (s, gen_helper_gvec_qrdmlah_s16, + q, rd, rn, rm); +case 2 : +return do_v81_helper (s, gen_helper_gvec_qrdmlah_s32, + q, rd, rn, rm); + } +return 1 ; + +case NEON_3R_VFM_VQRDMLSH : +if (!u) { +/* VFM, VFMS */ +if (size ==1 ) { +return 1 ; + } +break ; + } +/* VQRDMLSH */ +switch (size) { +case 1 : +return do_v81_helper (s, gen_helper_gvec_qrdmlsh_s16, + q, rd, rn, rm); +case 2 : +return do_v81_helper (s, gen_helper_gvec_qrdmlsh_s32, + q, rd, rn, rm); + } +return 1 ; }if (size ==3 && op !=NEON_3R_LOGIC ) {/* 64-bit element instructions. */
@@ -5768,11 +5820,7 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) rm = rtmp; }break ; -case NEON_3R_VPADD : -if (u) { -return 1 ; - } -/* Fall through */ +case NEON_3R_VPADD_VQRDMLAH :case NEON_3R_VPMAX :case NEON_3R_VPMIN : pairwise =1 ;
@@ -5806,8 +5854,8 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)return 1 ; }break ; -case NEON_3R_VFM : -if (!arm_dc_feature (s,ARM_FEATURE_VFP4 ) || u) { +case NEON_3R_VFM_VQRDMLSH : +if (!arm_dc_feature (s,ARM_FEATURE_VFP4 )) {return 1 ; }break ;
@@ -6004,7 +6052,7 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) } }break ; -case NEON_3R_VPADD : +case NEON_3R_VPADD_VQRDMLAH :switch (size) {case 0 :gen_helper_neon_padd_u8 (tmp, tmp, tmp2);break ;case 1 :gen_helper_neon_padd_u16 (tmp, tmp, tmp2);break ;
@@ -6103,7 +6151,7 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) } }break ; -case NEON_3R_VFM : +case NEON_3R_VFM_VQRDMLSH : {/* VFMA, VFMS: fused multiply-add */ TCGv_ptr fpstatus =get_fpstatus_ptr (1 );
Signature · 1 line
2.14.3
PATCH v3 8/16 target/arm: Decode aa32 armv8.1 two reg and a scalar
In reply to Richard Henderson--- target/arm/translate.c | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-)
target/arm/translate.c +42 -4
@@ -76,6 +76,10 @@ static const char *regnames[] = {"r0" ,"r1" ,"r2" ,"r3" ,"r4" ,"r5" ,"r6" ,"r7" , "r8", "r9", "r10", "r11", "r12", "r13", "r14", "pc" }; +/* Function prototypes for gen_ functions calling Neon helpers. */ +typedef void NeonGenThreeOpEnvFn (TCGv_i32 ,TCGv_env ,TCGv_i32 , +TCGv_i32 ,TCGv_i32 ); +/* initialize TCG globals. */ void arm_translate_init (void ) {
@@ -6985,11 +6989,45 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) }neon_store_reg64 (cpu_V0, rd + pass); } - -break ; -default :/* 14 and 15 are RESERVED */ -return 1 ; +case 14 :/* VQRDMLAH scalar */ +case 15 :/* VQRDMLSH scalar */ + { +NeonGenThreeOpEnvFn *fn; + +if (!arm_dc_feature (s,ARM_FEATURE_V8_RDM )) { +return 1 ; + } +if (u && ((rd | rn) &1 )) { +return 1 ; + } +if (op ==14 ) { +if (size ==1 ) { + fn = gen_helper_neon_qrdmlah_s16; + }else { + fn = gen_helper_neon_qrdmlah_s32; + } + }else { +if (size ==1 ) { + fn = gen_helper_neon_qrdmlsh_s16; + }else { + fn = gen_helper_neon_qrdmlsh_s32; + } + } + + tmp2 =neon_get_scalar (size, rm); +for (pass =0 ; pass < (u ?4 :2 ); pass++) { + tmp =neon_load_reg (rn, pass); + tmp3 =neon_load_reg (rd, pass); +fn (tmp, cpu_env, tmp, tmp2, tmp3); +tcg_temp_free_i32 (tmp3); +neon_store_reg (rd, pass, tmp); + } +tcg_temp_free_i32 (tmp2); + } +break ; +default : +g_assert_not_reached (); } } }else {/* size == 3 */
Signature · 1 line
2.14.3
PATCH v3 9/16 target/arm: Enable ARM_FEATURE_V8_RDM
In reply to Richard HendersonEnable it for the "any" CPU used by *-linux-user.
--- target/arm/cpu.c | 1 + target/arm/cpu64.c | 1 + 2 files changed, 2 insertions(+)
target/arm/cpu.c +1 -0
@@ -1650,6 +1650,7 @@ static void arm_any_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V8_SHA256 );set_feature (&cpu->env,ARM_FEATURE_V8_PMULL );set_feature (&cpu->env,ARM_FEATURE_CRC ); +set_feature (&cpu->env,ARM_FEATURE_V8_RDM ); cpu->midr = 0xffffffff; }#endif
target/arm/cpu64.c +1 -0
@@ -230,6 +230,7 @@ static void aarch64_any_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V8_SM4 );set_feature (&cpu->env,ARM_FEATURE_V8_PMULL );set_feature (&cpu->env,ARM_FEATURE_CRC ); +set_feature (&cpu->env,ARM_FEATURE_V8_RDM );set_feature (&cpu->env,ARM_FEATURE_V8_FP16 ); cpu->ctr =0x80038003 ;/* 32 byte I and D cacheline size, VIPT icache */ cpu->dcz_blocksize =7 ;/* 512 bytes */
Signature · 1 line
2.14.3
Re: [Qemu-devel] [PATCH v3 09/16] target/arm: Enable ARM_FEATURE_V8_RDM
Quoted 25 lines · Richard Henderson
Enable it for the "any" CPU used by *-linux-user.
Signed-off-by Richard Henderson <[email protected]>--- target/arm/cpu.c | 1 + target/arm/cpu64.c | 1 + 2 files changed, 2 insertions(+)target/arm/cpu.c +1
-0@@ -1650,6 +1650,7 @@ static void arm_any_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V8_SHA256 );set_feature (&cpu->env,ARM_FEATURE_V8_PMULL );set_feature (&cpu->env,ARM_FEATURE_CRC ); +set_feature (&cpu->env,ARM_FEATURE_V8_RDM ); cpu->midr = 0xffffffff; }#endif target/arm/cpu64.c +0
-0
target/arm/cpu64.c static void aarch64_any_initfn(Object *obj)
Quoted 8 lines
target/arm/cpu64.c +1
-1@@ -230,6 +230,7 @@ static void aarch64_any_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V8_SM4 );set_feature (&cpu->env,ARM_FEATURE_V8_PMULL );set_feature (&cpu->env,ARM_FEATURE_CRC ); +set_feature (&cpu->env,ARM_FEATURE_V8_RDM );set_feature (&cpu->env,ARM_FEATURE_V8_FP16 ); cpu->ctr =0x80038003 ;/* 32 byte I and D cacheline size, VIPT icache */ cpu->dcz_blocksize =7 ;/* 512 bytes */ --
thanks
-- PMM
PATCH v3 10/16 target/arm: Add ARM_FEATURE_V8_FCMA
In reply to Richard HendersonNot enabled anywhere yet.
--- target/arm/cpu.h | 1 + linux-user/elfload.c | 1 + 2 files changed, 2 insertions(+)
target/arm/cpu.h +1 -0
@@ -1429,6 +1429,7 @@ enum arm_features {ARM_FEATURE_V8_SM4 ,/* implements SM4 part of v8 Crypto Extensions */ ARM_FEATURE_V8_RDM ,/* implements v8.1 simd round multiply */ ARM_FEATURE_V8_FP16 ,/* implements v8.2 half-precision float */ + ARM_FEATURE_V8_FCMA, /* has complex number part of v8.3 extensions. */ };static inline int arm_feature (CPUARMState *env,int feature)
linux-user/elfload.c +1 -0
@@ -552,6 +552,7 @@ static uint32_t get_elf_hwcap(void)GET_FEATURE (ARM_FEATURE_V8_SM4 ,ARM_HWCAP_A64_SM4 );GET_FEATURE (ARM_FEATURE_V8_SHA512 ,ARM_HWCAP_A64_SHA512 );GET_FEATURE (ARM_FEATURE_V8_RDM ,ARM_HWCAP_A64_ASIMDRDM ); +GET_FEATURE (ARM_FEATURE_V8_FCMA ,ARM_HWCAP_A64_FCMA );#undef GET_FEATUREreturn hwcaps;
Signature · 1 line
2.14.3
PATCH v3 11/16 target/arm: Decode aa64 armv8.3 fcadd
In reply to Richard Henderson--- target/arm/helper.h | 7 ++++ target/arm/translate-a64.c | 48 ++++++++++++++++++++++- target/arm/vec_helper.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 151 insertions(+), 1 deletion(-)
target/arm/helper.h +7 -0
@@ -578,6 +578,13 @@ DEF_HELPER_FLAGS_5(gvec_qrdmlah_s32, TCG_CALL_NO_RWG,DEF_HELPER_FLAGS_5 (gvec_qrdmlsh_s32,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcaddh,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcadds,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcaddd,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +#ifdef TARGET_AARCH64 #include "helper-a64.h" #endif
target/arm/translate-a64.c +47 -1
72 lines not on this page · raw message
target/arm/vec_helper.c +97 -0
108 lines not on this page · raw message
Signature · 1 line
2.14.3
PATCH v3 12/16 target/arm: Decode aa64 armv8.3 fcmla
In reply to Richard Henderson--- target/arm/helper.h | 11 ++++ target/arm/translate-a64.c | 94 +++++++++++++++++++++++++--- target/arm/vec_helper.c | 149 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 246 insertions(+), 8 deletions(-)
target/arm/helper.h +11 -0
@@ -585,6 +585,17 @@ DEF_HELPER_FLAGS_5(gvec_fcadds, TCG_CALL_NO_RWG,DEF_HELPER_FLAGS_5 (gvec_fcaddd,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcmlah,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcmlah_idx,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcmlas,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcmlas_idx,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcmlad,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +#ifdef TARGET_AARCH64 #include "helper-a64.h" #endif
target/arm/translate-a64.c +86 -8
151 lines not on this page · raw message
target/arm/vec_helper.c +149 -0
152 lines not on this page · raw message
Signature · 1 line
2.14.3
Re: [Qemu-arm] [Qemu-devel] [PATCH v3 12/16] target/arm: Decode aa64 armv8.3 fcmla
Quoted 64 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/helper.h | 11 ++++ target/arm/translate-a64.c | 94 +++++++++++++++++++++++++--- target/arm/vec_helper.c | 149 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 246 insertions(+), 8 deletions(-)target/arm/helper.h +11
-0@@ -585,6 +585,17 @@ DEF_HELPER_FLAGS_5(gvec_fcadds, TCG_CALL_NO_RWG,DEF_HELPER_FLAGS_5 (gvec_fcaddd,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcmlah,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcmlah_idx,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcmlas,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcmlas_idx,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcmlad,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +#ifdef TARGET_AARCH64 #include "helper-a64.h" #endif target/arm/translate-a64.c +20
-0@@ -10842,6 +10842,10 @@ static void disas_simd_three_reg_same_extra(DisasContext *s, uint32_t insn) } feature =ARM_FEATURE_V8_RDM ;break ; +case 0x8 :/* FCMLA, #0 */ +case 0x9 :/* FCMLA, #90 */ +case 0xa :/* FCMLA, #180 */ +case 0xb :/* FCMLA, #270 */ case 0xc :/* FCADD, #90 */ case 0xe :/* FCADD, #270 */ if (size == 0@@ -10891,6 +10895,29 @@ static void disas_simd_three_reg_same_extra(DisasContext *s, uint32_t insn) }return ; +case 0x8 :/* FCMLA, #0 */ +case 0x9 :/* FCMLA, #90 */ +case 0xa :/* FCMLA, #180 */ +case 0xb :/* FCMLA, #270 */ + rot =extract32 (opcode,0 ,2 ); +switch (size) { +case 1 : +gen_gvec_op3_fpst (s, is_q, rd, rn, rm, true, rot, + gen_helper_gvec_fcmlah); +break ; +case 2 : +gen_gvec_op3_fpst (s, is_q, rd, rn, rm, false, rot, + gen_helper_gvec_fcmlas); +break ; +case 3 : + gen_gvec_op3_fpst(s, is_q, rd, rn, rm, false, rot,
target/arm/translate-a64.c static void disas_simd_three_reg_same_extra(DisasContext *s, uint32_t insn) · line 10923
Quoted 10 lines
target/arm/translate-a64.c +7
-0+ gen_helper_gvec_fcmlad); +break ; +default : +g_assert_not_reached (); + } +return ; +case 0xc :/* FCADD, #90 */ case 0xe :/* FCADD, #270 */ rot =extract32 (opcode,1 ,1 );
Shouldn't there be a feature check on ARM_FEATURE_V8_FCMA somewhere in the three_reg_same_extra code path?
Quoted 21 lines
target/arm/vec_helper.c +13
-0@@ -278,3 +278,152 @@ void HELPER(gvec_fcaddd)(void *vd, void *vn, void *vm, }clear_tail (d, opr_sz,simd_maxsz (desc)); } + +void HELPER (gvec_fcmlah )(void *vd,void *vn,void *vm, +void *vfpst,uint32_t desc) +{ +uintptr_t opr_sz =simd_oprsz (desc); +float16 *d = vd; +float16 *n = vn; +float16 *m = vm; +float_status *fpst = vfpst; +intptr_t flip =extract32 (desc,SIMD_DATA_SHIFT ,1 ); +uint32_t neg_imag =extract32 (desc,SIMD_DATA_SHIFT +1 ,1 ); +uint32_t neg_real = flip ^ neg_imag; +uintptr_t i;
target/arm/vec_helper.c void HELPER(gvec_fcaddd)(void *vd, void *vn, void *vm, · line 303
Quoted 10 lines
target/arm/vec_helper.c +10
-0+ +/* Shift boolean to the sign bit so we can xor to negate. */ + neg_real <<=15 ; + neg_imag <<=15 ; + +for (i =0 ; i < opr_sz /2 ; i +=2 ) { +float16 e1 = n[H2 (i + flip)]; +float16 e2 = m[H2 (i + flip)] ^ neg_real; +float16 e3 = e1; +float16 e4 = m[H2 (i +1 - flip)] ^ neg_imag;
These don't match up with the element1 ... element4 in the Arm ARM pseudocode. It's e2 and e4 that are always the same, not e1 and e3. Ditto in the other functions.
thanks
-- PMM
Re: [Qemu-arm] [Qemu-devel] [PATCH v3 12/16] target/arm: Decode aa64 armv8.3 fcmla
Quoted 2 lines · Peter Maydell
Shouldn't there be a feature check on
ARM_FEATURE_V8_FCMAsomewhere in thethree_reg_same_extracode path?
Oh, there is, because FCADD &c are also (feature bit name notwithstanding) under that feature bit.
thanks
-- PMM
Peter Maydell
Reviewed-byRe: [Qemu-arm] [Qemu-devel] [PATCH v3 12/16] target/arm: Decode aa64 armv8.3 fcmla
In reply to Peter MaydellQuoted 108 lines · Peter Maydell
Quoted 64 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/helper.h | 11 ++++ target/arm/translate-a64.c | 94 +++++++++++++++++++++++++--- target/arm/vec_helper.c | 149 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 246 insertions(+), 8 deletions(-)target/arm/helper.h +11
-0@@ -585,6 +585,17 @@ DEF_HELPER_FLAGS_5(gvec_fcadds, TCG_CALL_NO_RWG,DEF_HELPER_FLAGS_5 (gvec_fcaddd,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcmlah,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcmlah_idx,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcmlas,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcmlas_idx,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5 (gvec_fcmlad,TCG_CALL_NO_RWG , + void, ptr, ptr, ptr, ptr, i32) +#ifdef TARGET_AARCH64 #include "helper-a64.h" #endif target/arm/translate-a64.c +20
-0@@ -10842,6 +10842,10 @@ static void disas_simd_three_reg_same_extra(DisasContext *s, uint32_t insn) } feature =ARM_FEATURE_V8_RDM ;break ; +case 0x8 :/* FCMLA, #0 */ +case 0x9 :/* FCMLA, #90 */ +case 0xa :/* FCMLA, #180 */ +case 0xb :/* FCMLA, #270 */ case 0xc :/* FCADD, #90 */ case 0xe :/* FCADD, #270 */ if (size == 0@@ -10891,6 +10895,29 @@ static void disas_simd_three_reg_same_extra(DisasContext *s, uint32_t insn) }return ; +case 0x8 :/* FCMLA, #0 */ +case 0x9 :/* FCMLA, #90 */ +case 0xa :/* FCMLA, #180 */ +case 0xb :/* FCMLA, #270 */ + rot =extract32 (opcode,0 ,2 ); +switch (size) { +case 1 : +gen_gvec_op3_fpst (s, is_q, rd, rn, rm, true, rot, + gen_helper_gvec_fcmlah); +break ; +case 2 : +gen_gvec_op3_fpst (s, is_q, rd, rn, rm, false, rot, + gen_helper_gvec_fcmlas); +break ; +case 3 : + gen_gvec_op3_fpst(s, is_q, rd, rn, rm, false, rot,target/arm/translate-a64.c static void disas_simd_three_reg_same_extra(DisasContext *s, uint32_t insn) · line 10923
Quoted 10 lines
target/arm/translate-a64.c +7
-0+ gen_helper_gvec_fcmlad); +break ; +default : +g_assert_not_reached (); + } +return ; +case 0xc :/* FCADD, #90 */ case 0xe :/* FCADD, #270 */ rot =extract32 (opcode,1 ,1 );Shouldn't there be a feature check on
ARM_FEATURE_V8_FCMAsomewhere in thethree_reg_same_extracode path?Quoted 27 lines
target/arm/vec_helper.c +19
-0@@ -278,3 +278,152 @@ void HELPER(gvec_fcaddd)(void *vd, void *vn, void *vm, }clear_tail (d, opr_sz,simd_maxsz (desc)); } + +void HELPER (gvec_fcmlah )(void *vd,void *vn,void *vm, +void *vfpst,uint32_t desc) +{ +uintptr_t opr_sz =simd_oprsz (desc); +float16 *d = vd; +float16 *n = vn; +float16 *m = vm; +float_status *fpst = vfpst; +intptr_t flip =extract32 (desc,SIMD_DATA_SHIFT ,1 ); +uint32_t neg_imag =extract32 (desc,SIMD_DATA_SHIFT +1 ,1 ); +uint32_t neg_real = flip ^ neg_imag; +uintptr_t i; + +/* Shift boolean to the sign bit so we can xor to negate. */ + neg_real <<=15 ; + neg_imag <<=15 ; + +for (i =0 ; i < opr_sz /2 ; i +=2 ) {
Quoted 8 lines
target/arm/vec_helper.c void HELPER(gvec_fcaddd)(void *vd, void *vn, void *vm, · line 303
Quoted 4 lines
target/arm/vec_helper.c +4
-0+float16 e1 = n[H2 (i + flip)]; +float16 e2 = m[H2 (i + flip)] ^ neg_real; +float16 e3 = e1; +float16 e4 = m[H2 (i +1 - flip)] ^ neg_imag;These don't match up with the element1 ... element4 in the Arm ARM pseudocode. It's e2 and e4 that are always the same, not e1 and e3. Ditto in the other functions.
Specifically I think:
this code pseudocode
e1 element2 e2 element1 e3 element4 e4 element2
So if we renumber these to match the pseudocode
thanks
-- PMM
Re: [Qemu-arm] [Qemu-devel] [PATCH v3 12/16] target/arm: Decode aa64 armv8.3 fcmla
Quoted 11 lines · Peter Maydell
Quoted 7 lines · Peter Maydell
Quoted 1 line · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>These don't match up with the element1 ... element4 in the Arm ARM pseudocode. It's e2 and e4 that are always the same, not e1 and e3. Ditto in the other functions.
Specifically I think:
this code pseudocode
Quoted 8 lines
e1 element2 e2 element1 e3 element4 e4 element2So if we renumber these to match the pseudocode
Reviewed-by Peter Maydell <[email protected]>
Since this is the only issue in this patchset I propose to squash in this:
target/arm/vec_helper.c +34 -34
@@ -297,13 +297,13 @@ void HELPER(gvec_fcmlah)(void *vd, void *vn, void *vm, neg_imag <<=15 ;for (i =0 ; i < opr_sz /2 ; i +=2 ) { -float16 e1 = n[H2 (i + flip)]; -float16 e2 = m[H2 (i + flip)] ^ neg_real; -float16 e3 = e1; -float16 e4 = m[H2 (i +1 - flip)] ^ neg_imag; +float16 e2 = n[H2 (i + flip)]; +float16 e1 = m[H2 (i + flip)] ^ neg_real; +float16 e4 = e2; +float16 e3 = m[H2 (i +1 - flip)] ^ neg_imag; - d[H2 (i)] =float16_muladd (e1, e2, d[H2 (i)],0 , fpst); - d[H2 (i +1 )] =float16_muladd (e3, e4, d[H2 (i +1 )],0 , fpst); + d[H2 (i)] =float16_muladd (e2, e1, d[H2 (i)],0 , fpst); + d[H2 (i +1 )] =float16_muladd (e4, e3, d[H2 (i +1 )],0 , fpst); }clear_tail (d, opr_sz,simd_maxsz (desc)); }
@@ -320,21 +320,21 @@ void HELPER(gvec_fcmlah_idx)(void *vd, void *vn, void *vm,uint32_t neg_imag =extract32 (desc,SIMD_DATA_SHIFT +1 ,1 );uint32_t neg_real = flip ^ neg_imag;uintptr_t i; -float16 e2 = m[H2 (flip)]; -float16 e4 = m[H2 (1 - flip)]; +float16 e1 = m[H2 (flip)]; +float16 e3 = m[H2 (1 - flip)];/* Shift boolean to the sign bit so we can xor to negate. */ neg_real <<=15 ; neg_imag <<=15 ; - e2 ^= neg_real; - e4 ^= neg_imag; + e1 ^= neg_real; + e3 ^= neg_imag;for (i =0 ; i < opr_sz /2 ; i +=2 ) { -float16 e1 = n[H2 (i + flip)]; -float16 e3 = e1; +float16 e2 = n[H2 (i + flip)]; +float16 e4 = e2; - d[H2 (i)] =float16_muladd (e1, e2, d[H2 (i)],0 , fpst); - d[H2 (i +1 )] =float16_muladd (e3, e4, d[H2 (i +1 )],0 , fpst); + d[H2 (i)] =float16_muladd (e2, e1, d[H2 (i)],0 , fpst); + d[H2 (i +1 )] =float16_muladd (e4, e3, d[H2 (i +1 )],0 , fpst); }clear_tail (d, opr_sz,simd_maxsz (desc)); }
@@ -357,13 +357,13 @@ void HELPER(gvec_fcmlas)(void *vd, void *vn, void *vm, neg_imag <<=31 ;for (i =0 ; i < opr_sz /4 ; i +=2 ) { -float32 e1 = n[H4 (i + flip)]; -float32 e2 = m[H4 (i + flip)] ^ neg_real; -float32 e3 = e1; -float32 e4 = m[H4 (i +1 - flip)] ^ neg_imag; +float32 e2 = n[H4 (i + flip)]; +float32 e1 = m[H4 (i + flip)] ^ neg_real; +float32 e4 = e2; +float32 e3 = m[H4 (i +1 - flip)] ^ neg_imag; - d[H4 (i)] =float32_muladd (e1, e2, d[H4 (i)],0 , fpst); - d[H4 (i +1 )] =float32_muladd (e3, e4, d[H4 (i +1 )],0 , fpst); + d[H4 (i)] =float32_muladd (e2, e1, d[H4 (i)],0 , fpst); + d[H4 (i +1 )] =float32_muladd (e4, e3, d[H4 (i +1 )],0 , fpst); }clear_tail (d, opr_sz,simd_maxsz (desc)); }
@@ -380,21 +380,21 @@ void HELPER(gvec_fcmlas_idx)(void *vd, void *vn, void *vm,uint32_t neg_imag =extract32 (desc,SIMD_DATA_SHIFT +1 ,1 );uint32_t neg_real = flip ^ neg_imag;uintptr_t i; -float32 e2 = m[H4 (flip)]; -float32 e4 = m[H4 (1 - flip)]; +float32 e1 = m[H4 (flip)]; +float32 e3 = m[H4 (1 - flip)];/* Shift boolean to the sign bit so we can xor to negate. */ neg_real <<=31 ; neg_imag <<=31 ; - e2 ^= neg_real; - e4 ^= neg_imag; + e1 ^= neg_real; + e3 ^= neg_imag;for (i =0 ; i < opr_sz /4 ; i +=2 ) { -float32 e1 = n[H4 (i + flip)]; -float32 e3 = e1; +float32 e2 = n[H4 (i + flip)]; +float32 e4 = e2; - d[H4 (i)] =float32_muladd (e1, e2, d[H4 (i)],0 , fpst); - d[H4 (i +1 )] =float32_muladd (e3, e4, d[H4 (i +1 )],0 , fpst); + d[H4 (i)] =float32_muladd (e2, e1, d[H4 (i)],0 , fpst); + d[H4 (i +1 )] =float32_muladd (e4, e3, d[H4 (i +1 )],0 , fpst); }clear_tail (d, opr_sz,simd_maxsz (desc)); }
@@ -417,13 +417,13 @@ void HELPER(gvec_fcmlad)(void *vd, void *vn, void *vm, neg_imag <<=63 ;for (i =0 ; i < opr_sz /8 ; i +=2 ) { -float64 e1 = n[i + flip]; -float64 e2 = m[i + flip] ^ neg_real; -float64 e3 = e1; -float64 e4 = m[i +1 - flip] ^ neg_imag; +float64 e2 = n[i + flip]; +float64 e1 = m[i + flip] ^ neg_real; +float64 e4 = e2; +float64 e3 = m[i +1 - flip] ^ neg_imag; - d[i] =float64_muladd (e1, e2, d[i],0 , fpst); - d[i +1 ] =float64_muladd (e3, e4, d[i +1 ],0 , fpst); + d[i] =float64_muladd (e2, e1, d[i],0 , fpst); + d[i +1 ] =float64_muladd (e4, e3, d[i +1 ],0 , fpst); }clear_tail (d, opr_sz,simd_maxsz (desc)); }
which is a basically mechanical rename, and put it into target-arm.next.
thanks
-- PMM
PATCH v3 13/16 target/arm: Decode aa32 armv8.3 3-same
In reply to Richard Henderson--- target/arm/translate.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)
target/arm/translate.c +68 -0
@@ -7680,6 +7680,68 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)return 0 ; } +/* Advanced SIMD three registers of the same length extension. +* 31 25 23 22 20 16 12 11 10 9 8 3 0 +* +---------------+-----+---+-----+----+----+---+----+---+----+---------+----+ +* | 1 1 1 1 1 1 0 | op1 | D | op2 | Vn | Vd | 1 | o3 | 0 | o4 | N Q M U | Vm | +* +---------------+-----+---+-----+----+----+---+----+---+----+---------+----+ +*/ +static int disas_neon_insn_3same_ext (DisasContext *s,uint32_t insn) +{ +gen_helper_gvec_3_ptr *fn_gvec_ptr; +int rd, rn, rm, rot, size, opr_sz; +TCGv_ptr fpst; +bool q; + + q =extract32 (insn,6 ,1 ); +VFP_DREG_D (rd, insn); +VFP_DREG_N (rn, insn); +VFP_DREG_M (rm, insn); +if ((rd | rn | rm) & q) { +return 1 ; + } + +if ((insn &0xfe200f10 ) ==0xfc200800 ) { +/* VCMLA -- 1111 110R R.1S .... .... 1000 ...0 .... */ + size =extract32 (insn,20 ,1 ); + rot =extract32 (insn,23 ,2 ); +if (!arm_dc_feature (s,ARM_FEATURE_V8_FCMA ) + || (!size && !arm_dc_feature (s,ARM_FEATURE_V8_FP16 ))) { +return 1 ; + } + fn_gvec_ptr = size ? gen_helper_gvec_fcmlas : gen_helper_gvec_fcmlah; + }else if ((insn &0xfea00f10 ) ==0xfc800800 ) { +/* VCADD -- 1111 110R 1.0S .... .... 1000 ...0 .... */ + size =extract32 (insn,20 ,1 ); + rot =extract32 (insn,24 ,1 ); +if (!arm_dc_feature (s,ARM_FEATURE_V8_FCMA ) + || (!size && !arm_dc_feature (s,ARM_FEATURE_V8_FP16 ))) { +return 1 ; + } + fn_gvec_ptr = size ? gen_helper_gvec_fcadds : gen_helper_gvec_fcaddh; + }else { +return 1 ; + } + +if (s->fp_excp_el) { +gen_exception_insn (s,4 ,EXCP_UDEF , +syn_fp_access_trap (1 ,0xe , false), s->fp_excp_el); +return 0 ; + } +if (!s->vfp_enabled) { +return 1 ; + } + + opr_sz = (1 + q) *8 ; + fpst =get_fpstatus_ptr (1 ); +tcg_gen_gvec_3_ptr (vfp_reg_offset (1 , rd), +vfp_reg_offset (1 , rn), +vfp_reg_offset (1 , rm), fpst, + opr_sz, opr_sz, rot, fn_gvec_ptr); +tcg_temp_free_ptr (fpst); +return 0 ; +} +static int disas_coproc_insn (DisasContext *s,uint32_t insn) {int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2;
@@ -8424,6 +8486,12 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) } } } + }else if ((insn &0x0e000a00 ) ==0x0c000800 + &&arm_dc_feature (s,ARM_FEATURE_V8 )) { +if (disas_neon_insn_3same_ext (s, insn)) { + goto illegal_op; + } +return ; }else if ((insn &0x0fe00000 ) ==0x0c400000 ) {/* Coprocessor double register transfer. */ ARCH(5TE);
Signature · 1 line
2.14.3
Re: [Qemu-devel] [PATCH v3 13/16] target/arm: Decode aa32 armv8.3 3-same
Quoted 25 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/translate.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)target/arm/translate.c +12
-0@@ -7680,6 +7680,68 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)return 0 ; } +/* Advanced SIMD three registers of the same length extension. +* 31 25 23 22 20 16 12 11 10 9 8 3 0 +* +---------------+-----+---+-----+----+----+---+----+---+----+---------+----+ +* | 1 1 1 1 1 1 0 | op1 | D | op2 | Vn | Vd | 1 | o3 | 0 | o4 | N Q M U | Vm | +* +---------------+-----+---+-----+----+----+---+----+---+----+---------+----+ +*/ +static int disas_neon_insn_3same_ext (DisasContext *s,uint32_t insn) +{ +gen_helper_gvec_3_ptr *fn_gvec_ptr; +int rd, rn, rm, rot, size, opr_sz; +TCGv_ptr fpst; +bool q;
target/arm/translate.c static int disas_neon_data_insn(DisasContext *s, uint32_t insn) · line 7704
Quoted 10 lines
target/arm/translate.c +10
-0+ + q =extract32 (insn,6 ,1 ); +VFP_DREG_D (rd, insn); +VFP_DREG_N (rn, insn); +VFP_DREG_M (rm, insn); +if ((rd | rn | rm) & q) { +return 1 ; + } + +if ((insn &0xfe200f10 ) ==0xfc200800 ) {
Slightly confusing to be re-checking bits we've already decoded, rather than just looking at op1/op2/op3/op4/Q/U.
Anyway
thanks
-- PMM
Re: [Qemu-devel] [PATCH v3 13/16] target/arm: Decode aa32 armv8.3 3-same
In reply to Richard HendersonQuoted 8 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/translate.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)target/arm/translate.c +0
-0@@ -8424,6 +8486,12 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) } }
target/arm/translate.c static void disas_arm_insn(DisasContext *s, unsigned int insn) · line 8497
Quoted 10 lines
target/arm/translate.c +6
-0} + }else if ((insn &0x0e000a00 ) ==0x0c000800 + &&arm_dc_feature (s,ARM_FEATURE_V8 )) { +if (disas_neon_insn_3same_ext (s, insn)) { + goto illegal_op; + } +return ; }else if ((insn &0x0fe00000 ) ==0x0c400000 ) {/* Coprocessor double register transfer. */ ARCH(5TE);
Oh yes, shouldn't there be a similar fragment in disas_thumb2_insn() to take care of the Thumb encodings of these insns ?
thanks
-- PMM
PATCH v3 14/16 target/arm: Decode aa32 armv8.3 2-reg-index
In reply to Richard Henderson--- target/arm/translate.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+)
target/arm/translate.c +61 -0
@@ -7742,6 +7742,61 @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn)return 0 ; } +/* Advanced SIMD two registers and a scalar extension. +* 31 24 23 22 20 16 12 11 10 9 8 3 0 +* +-----------------+----+---+----+----+----+---+----+---+----+---------+----+ +* | 1 1 1 1 1 1 1 0 | o1 | D | o2 | Vn | Vd | 1 | o3 | 0 | o4 | N Q M U | Vm | +* +-----------------+----+---+----+----+----+---+----+---+----+---------+----+ +* +*/ + +static int disas_neon_insn_2reg_scalar_ext (DisasContext *s,uint32_t insn) +{ +int rd, rn, rm, rot, size, opr_sz; +TCGv_ptr fpst; +bool q; + + q =extract32 (insn,6 ,1 ); +VFP_DREG_D (rd, insn); +VFP_DREG_N (rn, insn); +VFP_DREG_M (rm, insn); +if ((rd | rn) & q) { +return 1 ; + } + +if ((insn &0xff000f10 ) ==0xfe000800 ) { +/* VCMLA (indexed) -- 1111 1110 S.RR .... .... 1000 ...0 .... */ + rot =extract32 (insn,20 ,2 ); + size =extract32 (insn,23 ,1 ); +if (!arm_dc_feature (s,ARM_FEATURE_V8_FCMA ) + || (!size && !arm_dc_feature (s,ARM_FEATURE_V8_FP16 ))) { +return 1 ; + } + }else { +return 1 ; + } + +if (s->fp_excp_el) { +gen_exception_insn (s,4 ,EXCP_UDEF , +syn_fp_access_trap (1 ,0xe , false), s->fp_excp_el); +return 0 ; + } +if (!s->vfp_enabled) { +return 1 ; + } + + opr_sz = (1 + q) *8 ; + fpst =get_fpstatus_ptr (1 ); +tcg_gen_gvec_3_ptr (vfp_reg_offset (1 , rd), +vfp_reg_offset (1 , rn), +vfp_reg_offset (1 , rm), fpst, + opr_sz, opr_sz, rot, + size ? gen_helper_gvec_fcmlas_idx + : gen_helper_gvec_fcmlah_idx); +tcg_temp_free_ptr (fpst); +return 0 ; +} +static int disas_coproc_insn (DisasContext *s,uint32_t insn) {int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2;
@@ -8492,6 +8547,12 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) goto illegal_op; }return ; + }else if ((insn &0x0f000a00 ) ==0x0e000800 + &&arm_dc_feature (s,ARM_FEATURE_V8 )) { +if (disas_neon_insn_2reg_scalar_ext (s, insn)) { + goto illegal_op; + } +return ; }else if ((insn &0x0fe00000 ) ==0x0c400000 ) {/* Coprocessor double register transfer. */ ARCH(5TE);
Signature · 1 line
2.14.3
Re: [Qemu-arm] [PATCH v3 14/16] target/arm: Decode aa32 armv8.3 2-reg-index
Quoted 9 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/translate.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+)target/arm/translate.c +0
-0@@ -8492,6 +8547,12 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) goto illegal_op; }
target/arm/translate.c static void disas_arm_insn(DisasContext *s, unsigned int insn) · line 8558
Quoted 10 lines
target/arm/translate.c +6
-0return ; + }else if ((insn &0x0f000a00 ) ==0x0e000800 + &&arm_dc_feature (s,ARM_FEATURE_V8 )) { +if (disas_neon_insn_2reg_scalar_ext (s, insn)) { + goto illegal_op; + } +return ; }else if ((insn &0x0fe00000 ) ==0x0c400000 ) {/* Coprocessor double register transfer. */ ARCH(5TE);
Missing the similar code for disas_thumb2_insn() again.
Otherwise
thanks
-- PMM
PATCH v3 15/16 target/arm: Decode t32 simd 3reg and 2reg_scalar extension
In reply to Richard HendersonHappily, the bits are in the same places compared to a32.
--- target/arm/translate.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
target/arm/translate.c +13 -1
@@ -10774,7 +10774,19 @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) default_exception_el(s));break ; } -if (((insn >>24 ) &3 ) ==3 ) { +if ((insn &0xfe000a00 ) ==0xfc000800 + &&arm_dc_feature (s,ARM_FEATURE_V8 )) { +/* The Thumb2 and ARM encodings are identical. */ +if (disas_neon_insn_3same_ext (s, insn)) { + goto illegal_op; + } + }else if ((insn &0xff000a00 ) ==0xfe000800 + &&arm_dc_feature (s,ARM_FEATURE_V8 )) { +/* The Thumb2 and ARM encodings are identical. */ +if (disas_neon_insn_2reg_scalar_ext (s, insn)) { + goto illegal_op; + } + }else if (((insn >>24 ) &3 ) ==3 ) {/* Translate into the equivalent ARM encoding. */ insn = (insn &0xe2ffffff ) | ((insn & (1 <<28 )) >>4 ) | (1 <<28 );if (disas_neon_data_insn (s, insn)) {
Signature · 1 line
2.14.3
Re: [Qemu-arm] [Qemu-devel] [PATCH v3 15/16] target/arm: Decode t32 simd 3reg and 2reg_scalar extension
Quoted 33 lines · Richard Henderson
Happily, the bits are in the same places compared to a32.
Signed-off-by Richard Henderson <[email protected]>--- target/arm/translate.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)target/arm/translate.c +13
-2@@ -10774,7 +10774,19 @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) default_exception_el(s));break ; } -if (((insn >>24 ) &3 ) ==3 ) { +if ((insn &0xfe000a00 ) ==0xfc000800 + &&arm_dc_feature (s,ARM_FEATURE_V8 )) { +/* The Thumb2 and ARM encodings are identical. */ +if (disas_neon_insn_3same_ext (s, insn)) { + goto illegal_op; + } + }else if ((insn &0xff000a00 ) ==0xfe000800 + &&arm_dc_feature (s,ARM_FEATURE_V8 )) { +/* The Thumb2 and ARM encodings are identical. */ +if (disas_neon_insn_2reg_scalar_ext (s, insn)) { + goto illegal_op; + } + }else if (((insn >>24 ) &3 ) ==3 ) {/* Translate into the equivalent ARM encoding. */ insn = (insn &0xe2ffffff ) | ((insn & (1 <<28 )) >>4 ) | (1 <<28 );if (disas_neon_data_insn (s, insn)) { --
Quoted 1 line
2.14.3
Oh, here they are. If you mention "Thumb decode will be added in a subsequent commit" in a commit message it helps to avoid confusing reviewers...
thanks
-- PMM
PATCH v3 16/16 target/arm: Enable ARM_FEATURE_V8_FCMA
In reply to Richard HendersonEnable it for the "any" CPU used by *-linux-user.
--- target/arm/cpu.c | 1 + target/arm/cpu64.c | 1 + 2 files changed, 2 insertions(+)
target/arm/cpu.c +1 -0
@@ -1651,6 +1651,7 @@ static void arm_any_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V8_PMULL );set_feature (&cpu->env,ARM_FEATURE_CRC );set_feature (&cpu->env,ARM_FEATURE_V8_RDM ); +set_feature (&cpu->env,ARM_FEATURE_V8_FCMA ); cpu->midr = 0xffffffff; }#endif
target/arm/cpu64.c +1 -0
@@ -232,6 +232,7 @@ static void aarch64_any_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_CRC );set_feature (&cpu->env,ARM_FEATURE_V8_RDM );set_feature (&cpu->env,ARM_FEATURE_V8_FP16 ); +set_feature (&cpu->env,ARM_FEATURE_V8_FCMA ); cpu->ctr =0x80038003 ;/* 32 byte I and D cacheline size, VIPT icache */ cpu->dcz_blocksize =7 ;/* 512 bytes */ }
Signature · 1 line
2.14.3
Re: [Qemu-arm] [PATCH v3 16/16] target/arm: Enable ARM_FEATURE_V8_FCMA
Quoted 25 lines · Richard Henderson
Enable it for the "any" CPU used by *-linux-user.
Signed-off-by Richard Henderson <[email protected]>--- target/arm/cpu.c | 1 + target/arm/cpu64.c | 1 + 2 files changed, 2 insertions(+)target/arm/cpu.c +1
-0@@ -1651,6 +1651,7 @@ static void arm_any_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V8_PMULL );set_feature (&cpu->env,ARM_FEATURE_CRC );set_feature (&cpu->env,ARM_FEATURE_V8_RDM ); +set_feature (&cpu->env,ARM_FEATURE_V8_FCMA ); cpu->midr = 0xffffffff; }#endif target/arm/cpu64.c +0
-0
target/arm/cpu64.c static void aarch64_any_initfn(Object *obj)
Quoted 8 lines
target/arm/cpu64.c +1
-1@@ -232,6 +232,7 @@ static void aarch64_any_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_CRC );set_feature (&cpu->env,ARM_FEATURE_V8_RDM );set_feature (&cpu->env,ARM_FEATURE_V8_FP16 ); +set_feature (&cpu->env,ARM_FEATURE_V8_FCMA ); cpu->ctr =0x80038003 ;/* 32 byte I and D cacheline size, VIPT icache */ cpu->dcz_blocksize =7 ;/* 512 bytes */ } --
We should be setting some hwcap bits in linux-user for these new feature bits (and RDM), right?
thanks
-- PMM
Re: [Qemu-arm] [PATCH v3 16/16] target/arm: Enable ARM_FEATURE_V8_FCMA
Quoted 6 lines · Peter Maydell
Quoted 1 line · Richard Henderson
Enable it for the "any" CPU used by *-linux-user.
We should be setting some hwcap bits in linux-user for these new feature bits (and RDM), right?
Oh, you did that back in the patch where you added the feature bit. Sorry, I'm clearly skimming these patches a little too quickly.
-- PMM