A64 Neon patches: sixth set
cover A64 Neon patches: sixth set
This is the sixth set of patches implementing more of the Neon instructions for A64 (assuming I haven't lost count...) PMULL is a fixed version of the patch from last time round which doesn't pointlessly pass cpu_env to the helper; the rest are new.
Remaining unimplemented usermode instructions:
* crypto, CRC32 [these are optional extensions anyway]
* FCVTZS, FCVTZU, SQSHLU, SQSHL, UQSHL from the shift-imm and scalar-shift-imm groups
* FRECPE, FRSQRTE, URECPE, URSQRTE (2-misc, scalar 2-misc)
* SUQADD, USQADD, SQABS, SQNEG (2-misc, scalar-2misc)
* SQXTN, SQXTUN, UQXTN (scalar-2misc; 2-misc versions already done)
Available for testing and review purposes at
git://git.linaro.org/people/peter.maydell/qemu-arm.git a64-neon-sixth-set
I'm aiming to get these into the 2.0 release so I'd appreciate code review for these :-)
thanks
-- PMM
Alex Bennée (6):
target-arm: A64: Fix bug in add_sub_ext handling of rn
target-arm: A64: Add last AdvSIMD Integer to FP ops
target-arm: A64: Add FSQRT to C3.6.17 (two misc)
target-arm: A64: Add remaining CLS/Z vector ops
target-arm: A64: Saturating and narrowing shift ops
target-arm: A64: Add FRECPX (reciprocal exponent)
Peter Maydell (10):
target-arm: A64: Implement PMULL instruction
target-arm: A64: Implement SADDLP, UADDLP, SADALP, UADALP
target-arm: A64: Implement SHLL, SHLL2
target-arm: A64: Implement FCVT[NMAPZ][SU] SIMD instructions
target-arm: A64: Implement FCVTN
target-arm: A64: Implement FCVTL
target-arm: A64: List unsupported shift-imm opcodes
target-arm: A64: Implement SRI
target-arm: A64: Implement FRINT*
exec-all.h: Increase MAX_OP_PER_INSTR for ARM A64 decoder
include/exec/exec-all.h | 2 +- target-arm/helper-a64.c | 155 ++++++++ target-arm/helper-a64.h | 9 + target-arm/translate-a64.c | 942 ++++++++++++++++++++++++++++++++++++++++++--- target-arm/translate.c | 1 + target-arm/translate.h | 6 + 6 files changed, 1066 insertions(+), 49 deletions(-)
Signature · 1 line
1.9.0
PATCH 1/16 target-arm: A64: Implement PMULL instruction
Implement the PMULL instruction; this is the last unimplemented insn in the three-reg-diff group.
Note that PMULL with size 3 is considered part of the AES part of the crypto extensions (see the ID_AA64ISAR0_EL1 register definition in the v8 ARM ARM), so it isn't necessary to burn an extra feature bit on it, even though we're using more feature bits than a single "crypto extension present/not present" toggle.
--- target-arm/helper-a64.c | 30 ++++++++++++++++++++++++++++++ target-arm/helper-a64.h | 2 ++ target-arm/translate-a64.c | 41 +++++++++++++++++++++++++++++++++++++++-- target-arm/translate.c | 1 + target-arm/translate.h | 6 ++++++ 5 files changed, 78 insertions(+), 2 deletions(-)
target-arm/helper-a64.c +30 -0
@@ -180,6 +180,36 @@ uint64_t HELPER(simd_tbl)(CPUARMState *env, uint64_t result, uint64_t indices,return result; } +/* Helper function for 64 bit polynomial multiply case: +* perform PolynomialMult(op1, op2) and return either the top or +* bottom half of the 128 bit result. +*/ +uint64_t HELPER (neon_pmull_64_lo )(uint64_t op1,uint64_t op2) +{ +int bitnum; +uint64_t res =0 ; + +for (bitnum =0 ; bitnum <64 ; bitnum++) { +if (op1 & (1ULL << bitnum)) { + res ^= op2 << bitnum; + } + } +return res; +} +uint64_t HELPER (neon_pmull_64_hi )(uint64_t op1,uint64_t op2) +{ +int bitnum; +uint64_t res =0 ; + +/* bit 0 of op1 can't influence the high 64 bits at all */ +for (bitnum =1 ; bitnum <64 ; bitnum++) { +if (op1 & (1ULL << bitnum)) { + res ^= op2 >> (64 - bitnum); + } + } +return res; +} +/* 64bit/double versions of the neon float compare functions */ uint64_t HELPER (neon_ceq_f64 )(float64 a,float64 b,void *fpstp) {
target-arm/helper-a64.h +2 -0
@@ -27,6 +27,8 @@ DEF_HELPER_3(vfp_cmpes_a64, i64, f32, f32, ptr) DEF_HELPER_3(vfp_cmpd_a64, i64, f64, f64, ptr) DEF_HELPER_3(vfp_cmped_a64, i64, f64, f64, ptr) DEF_HELPER_FLAGS_5(simd_tbl, TCG_CALL_NO_RWG_SE, i64, env, i64, i64, i32, i32) +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_3(vfp_mulxs, TCG_CALL_NO_RWG, f32, f32, f32, ptr) DEF_HELPER_FLAGS_3(vfp_mulxd, TCG_CALL_NO_RWG, f64, f64, f64, ptr)DEF_HELPER_FLAGS_3 (neon_ceq_f64,TCG_CALL_NO_RWG , i64, i64, i64, ptr)
target-arm/translate-a64.c +39 -2
71 lines not on this page · raw message
target-arm/translate.c +1 -0
@@ -10651,6 +10651,7 @@ static inline void gen_intermediate_code_internal(ARMCPU *cpu, dc->vec_stride =ARM_TBFLAG_VECSTRIDE (tb->flags); dc->cp_regs = cpu->cp_regs; dc->current_pl =arm_current_pl (env); + dc->features = env->features; cpu_F0s =tcg_temp_new_i32 (); cpu_F1s =tcg_temp_new_i32 ();
target-arm/translate.h +6 -0
@@ -26,6 +26,7 @@ typedef struct DisasContext {int aarch64;int current_pl;GHashTable *cp_regs; +uint64_t features;/* CPU features bits */ #define TMP_A64_MAX 16int tmp_a64_count;TCGv_i64 tmp_a64[TMP_A64_MAX ];
@@ -33,6 +34,11 @@ typedef struct DisasContext {extern TCGv_ptr cpu_env; +static inline int arm_dc_feature (DisasContext *dc,int feature) +{ +return (dc->features & (1ULL << feature)) !=0 ; +} +/* target-specific extra values for is_jmp */ /* These instructions trap after executing, so the A32/T32 decoder must * defer them until after the conditional execution state has been updated.
Signature · 1 line
1.9.0
PATCH 2/16 target-arm: A64: Fix bug in add_sub_ext handling of rn
In reply to Peter MaydellFrom: Alex Bennée <[email protected]>
rn == 31 always means SP (not XZR) whether an add_sub_ext instruction is setting the flags or not; only rd has behaviour dependent on whether we are setting flags.
--- target-arm/translate-a64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
target-arm/translate-a64.c +1 -2
@@ -3096,12 +3096,11 @@ static void disas_add_sub_ext_reg(DisasContext *s, uint32_t insn)/* non-flag setting ops may use SP */ if (!setflags) { - tcg_rn =read_cpu_reg_sp (s, rn, sf); tcg_rd =cpu_reg_sp (s, rd); }else { - tcg_rn =read_cpu_reg (s, rn, sf); tcg_rd =cpu_reg (s, rd); } + tcg_rn =read_cpu_reg_sp (s, rn, sf); tcg_rm =read_cpu_reg (s, rm, sf);ext_and_shift_reg (tcg_rm, tcg_rm, option, imm3);
Signature · 1 line
1.9.0
Re: [Qemu-devel] [PATCH 02/16] target-arm: A64: Fix bug in add_sub_ext handling of rn
Quoted 9 lines · Peter Maydell
From: Alex Bennée <[email protected]>
rn == 31 always means SP (not XZR) whether an
add_sub_extinstruction is setting the flags or not; only rd has behaviour dependent on whether we are setting flags.Reported-by Laurent Desnogues <[email protected]>Signed-off-by Alex Bennée <[email protected]>Signed-off-by Peter Maydell <[email protected]>
Thanks,
Laurent
Quoted 25 lines
--- target-arm/translate-a64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)target-arm/translate-a64.c +1
-3@@ -3096,12 +3096,11 @@ static void disas_add_sub_ext_reg(DisasContext *s, uint32_t insn)/* non-flag setting ops may use SP */ if (!setflags) { - tcg_rn =read_cpu_reg_sp (s, rn, sf); tcg_rd =cpu_reg_sp (s, rd); }else { - tcg_rn =read_cpu_reg (s, rn, sf); tcg_rd =cpu_reg (s, rd); } + tcg_rn =read_cpu_reg_sp (s, rn, sf); tcg_rm =read_cpu_reg (s, rm, sf);ext_and_shift_reg (tcg_rm, tcg_rm, option, imm3); --1.9.0
PATCH 3/16 target-arm: A64: Add last AdvSIMD Integer to FP ops
In reply to Peter MaydellFrom: Alex Bennée <[email protected]>
This adds the remaining [US]CVTF operations to the SIMD shift-immediate, scalar-shift-immediate, two-reg-misc and scalar-two-reg-misc groups of opcodes.
--- target-arm/translate-a64.c | 132 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 123 insertions(+), 9 deletions(-)
target-arm/translate-a64.c +123 -9
@@ -5907,6 +5907,95 @@ static void handle_scalar_simd_shli(DisasContext *s, bool insert,tcg_temp_free_i64 (tcg_rd); } +/* Common vector code for handling integer to FP conversion */ +static void handle_simd_intfp_conv (DisasContext *s,int rd,int rn, +int elements,int is_signed, +int fracbits,int size) +{ +bool is_double = size ==3 ? true : false; +TCGv_ptr tcg_fpst =get_fpstatus_ptr (); +TCGv_i32 tcg_shift =tcg_const_i32 (fracbits); +TCGv_i64 tcg_int =tcg_temp_new_i64 (); +TCGMemOp mop = size | (is_signed ?MO_SIGN :0 ); +int pass; + +for (pass =0 ; pass < elements; pass++) { +read_vec_element (s, tcg_int, rn, pass, mop); + +if (is_double) { +TCGv_i64 tcg_double =tcg_temp_new_i64 (); +if (is_signed) { +gen_helper_vfp_sqtod (tcg_double, tcg_int, + tcg_shift, tcg_fpst); + }else { +gen_helper_vfp_uqtod (tcg_double, tcg_int, + tcg_shift, tcg_fpst); + } +if (elements ==1 ) { +write_fp_dreg (s, rd, tcg_double); + }else { +write_vec_element (s, tcg_double, rd, pass,MO_64 ); + } +tcg_temp_free_i64 (tcg_double); + }else { +TCGv_i32 tcg_single =tcg_temp_new_i32 (); +if (is_signed) { +gen_helper_vfp_sqtos (tcg_single, tcg_int, + tcg_shift, tcg_fpst); + }else { +gen_helper_vfp_uqtos (tcg_single, tcg_int, + tcg_shift, tcg_fpst); + } +if (elements ==1 ) { +write_fp_sreg (s, rd, tcg_single); + }else { +write_vec_element_i32 (s, tcg_single, rd, pass,MO_32 ); + } +tcg_temp_free_i32 (tcg_single); + } + } + +if (!is_double && elements ==2 ) { +clear_vec_high (s, rd); + } + +tcg_temp_free_i64 (tcg_int); +tcg_temp_free_ptr (tcg_fpst); +tcg_temp_free_i32 (tcg_shift); +} + +/* UCVTF/SCVTF - Integer to FP conversion */ +static void handle_simd_shift_intfp_conv (DisasContext *s,bool is_scalar, +bool is_q,bool is_u, +int immh,int immb,int opcode, +int rn,int rd) +{ +bool is_double =extract32 (immh,3 ,1 ); +int size = is_double ?MO_64 :MO_32 ; +int elements; +int immhb = immh <<3 | immb; +int fracbits = (is_double ?128 :64 ) - immhb; + +if (!extract32 (immh,2 ,2 )) { +unallocated_encoding (s); +return ; + } + +if (is_scalar) { + elements =1 ; + }else { + elements = is_double ?2 : is_q ?4 :2 ; +if (is_double && !is_q) { +unallocated_encoding (s); +return ; + } + } +/* immh == 0 would be a failure of the decode logic */ +g_assert (immh); + +handle_simd_intfp_conv (s, rd, rn, elements, !is_u, fracbits, size); +} +/* C3.6.9 AdvSIMD scalar shift by immediate * 31 30 29 28 23 22 19 18 16 15 11 10 9 5 4 0 * +-----+---+-------------+------+------+--------+---+------+------+
@@ -5934,6 +6023,10 @@ static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn)case 0x0a :/* SHL / SLI */ handle_scalar_simd_shli (s, is_u, immh, immb, opcode, rn, rd);break ; +case 0x1c :/* SCVTF, UCVTF */ +handle_simd_shift_intfp_conv (s, true, false, is_u, immh, immb, + opcode, rn, rd); +break ;default :unsupported_encoding (s, insn);break ;
@@ -6689,10 +6782,16 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn)case 0x6d :/* FCMLE (zero) */ handle_2misc_fcmp_zero (s, opcode, true, u, true, size, rn, rd);return ; +case 0x1d :/* SCVTF */ +case 0x5d :/* UCVTF */ + { +bool is_signed = (opcode ==0x1d ); +handle_simd_intfp_conv (s, rd, rn,1 , is_signed,0 , size); +return ; + }case 0x1a :/* FCVTNS */ case 0x1b :/* FCVTMS */ case 0x1c :/* FCVTAS */ -case 0x1d :/* SCVTF */ case 0x3a :/* FCVTPS */ case 0x3b :/* FCVTZS */ case 0x3d :/* FRECPE */
@@ -6701,7 +6800,6 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn)case 0x5a :/* FCVTNU */ case 0x5b :/* FCVTMU */ case 0x5c :/* FCVTAU */ -case 0x5d :/* UCVTF */ case 0x7a :/* FCVTPU */ case 0x7b :/* FCVTZU */ case 0x7d :/* FRSQRTE */
@@ -6877,7 +6975,6 @@ static void handle_vec_simd_wshli(DisasContext *s, bool is_q, bool is_u, } } -/* C3.6.14 AdvSIMD shift by immediate * 31 30 29 28 23 22 19 18 16 15 11 10 9 5 4 0 * +---+---+---+-------------+------+------+--------+---+------+------+
@@ -6907,10 +7004,16 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn)case 0x14 :/* SSHLL / USHLL */ handle_vec_simd_wshli (s, is_q, is_u, immh, immb, opcode, rn, rd);break ; +case 0x1c :/* SCVTF / UCVTF */ +handle_simd_shift_intfp_conv (s, false, is_q, is_u, immh, immb, + opcode, rn, rd); +break ; +case 0x1f :/* FCVTZS/ FCVTZU */ +unsupported_encoding (s, insn); +return ;default : -/* We don't currently implement any of the Narrow or saturating shifts; -* nor do we implement the fixed-point conversions in this -* encoding group (SCVTF, FCVTZS, UCVTF, FCVTZU). +/* We don't currently implement any of the Narrow or +* saturating shifts. */ unsupported_encoding (s, insn);return ;
@@ -8255,8 +8358,9 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)/* Floating point: U, size[1] and opcode indicate operation; * size[0] indicates single or double precision. */ +int is_double =extract32 (size,0 ,1 ); opcode |= (extract32 (size,1 ,1 ) <<5 ) | (u <<6 ); - size =extract32 (size,0 ,1 ) ?3 :2 ; + size = is_double ?3 :2 ;switch (opcode) {case 0x2f :/* FABS */ case 0x6f :/* FNEG */
@@ -8265,6 +8369,18 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)return ; }break ; +case 0x1d :/* SCVTF */ +case 0x5d :/* UCVTF */ + { +bool is_signed = (opcode ==0x1d ) ? true : false; +int elements = is_double ?2 : is_q ?4 :2 ; +if (is_double && !is_q) { +unallocated_encoding (s); +return ; + } +handle_simd_intfp_conv (s, rd, rn, elements, is_signed,0 , size); +return ; + }case 0x2c :/* FCMGT (zero) */ case 0x2d :/* FCMEQ (zero) */ case 0x2e :/* FCMLT (zero) */
@@ -8283,7 +8399,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)case 0x1a :/* FCVTNS */ case 0x1b :/* FCVTMS */ case 0x1c :/* FCVTAS */ -case 0x1d :/* SCVTF */ case 0x38 :/* FRINTP */ case 0x39 :/* FRINTZ */ case 0x3a :/* FCVTPS */
@@ -8296,7 +8411,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)case 0x5a :/* FCVTNU */ case 0x5b :/* FCVTMU */ case 0x5c :/* FCVTAU */ -case 0x5d :/* UCVTF */ case 0x79 :/* FRINTI */ case 0x7a :/* FCVTPU */ case 0x7b :/* FCVTZU */
Signature · 1 line
1.9.0
PATCH 4/16 target-arm: A64: Add FSQRT to C3.6.17 (two misc)
In reply to Peter MaydellFrom: Alex Bennée <[email protected]>
Implement FSQRT in the two-reg-misc category.
GCC uses this instruction form.
--- target-arm/translate-a64.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
target-arm/translate-a64.c +12 -1
@@ -6623,6 +6623,9 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u,case 0x6f :/* FNEG */ gen_helper_vfp_negd (tcg_rd, tcg_rn);break ; +case 0x7f :/* FSQRT */ +gen_helper_vfp_sqrtd (tcg_rd, tcg_rn, cpu_env); +break ;default :g_assert_not_reached (); }
@@ -8392,6 +8395,12 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) }handle_2misc_fcmp_zero (s, opcode, false, u, is_q, size, rn, rd);return ; +case 0x7f :/* FSQRT */ +if (size ==3 && !is_q) { +unallocated_encoding (s); +return ; + } +break ;case 0x16 :/* FCVTN, FCVTN2 */ case 0x17 :/* FCVTL, FCVTL2 */ case 0x18 :/* FRINTN */
@@ -8416,7 +8425,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)case 0x7b :/* FCVTZU */ case 0x7c :/* URSQRTE */ case 0x7d :/* FRSQRTE */ -case 0x7f :/* FSQRT */ unsupported_encoding (s, insn);return ;default :
@@ -8493,6 +8501,9 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)case 0x6f :/* FNEG */ gen_helper_vfp_negs (tcg_res, tcg_op);break ; +case 0x7f :/* FSQRT */ +gen_helper_vfp_sqrts (tcg_res, tcg_op, cpu_env); +break ;default :g_assert_not_reached (); }
Signature · 1 line
1.9.0
PATCH 5/16 target-arm: A64: Add remaining CLS/Z vector ops
In reply to Peter MaydellFrom: Alex Bennée <[email protected]>
Implement the CLS, CLZ operations in the 2-reg-misc category.
--- target-arm/helper-a64.c | 5 +++++ target-arm/helper-a64.h | 1 + target-arm/translate-a64.c | 36 +++++++++++++++++++++++++++++++++++- 3 files changed, 41 insertions(+), 1 deletion(-)
target-arm/helper-a64.c +5 -0
@@ -60,6 +60,11 @@ uint32_t HELPER(cls32)(uint32_t x)return clrsb32 (x); } +uint32_t HELPER (clz32 )(uint32_t x) +{ +return clz32 (x); +} +uint64_t HELPER (rbit64 )(uint64_t x) {/* assign the correct byte position */
target-arm/helper-a64.h +1 -0
@@ -21,6 +21,7 @@ DEF_HELPER_FLAGS_2(sdiv64, TCG_CALL_NO_RWG_SE, s64, s64, s64) DEF_HELPER_FLAGS_1(clz64, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_1(cls64, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_1(cls32, TCG_CALL_NO_RWG_SE, i32, i32) +DEF_HELPER_FLAGS_1(clz32, TCG_CALL_NO_RWG_SE, i32, i32) DEF_HELPER_FLAGS_1(rbit64, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_3(vfp_cmps_a64, i64, f32, f32, ptr)DEF_HELPER_3 (vfp_cmpes_a64, i64, f32, f32, ptr)
target-arm/translate-a64.c +35 -1
@@ -6584,6 +6584,13 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u,TCGCond cond;switch (opcode) { +case 0x4 :/* CLS, CLZ */ +if (u) { +gen_helper_clz64 (tcg_rd, tcg_rn); + }else { +gen_helper_cls64 (tcg_rd, tcg_rn); + } +break ;case 0x5 :/* NOT */ /* This opcode is shared with CNT and RBIT but we have earlier * enforced that size == 3 if and only if this is the NOT insn.
@@ -8316,8 +8323,13 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) }handle_2misc_narrow (s, opcode, u, is_q, size, rn, rd);return ; -case 0x2 :/* SADDLP, UADDLP */ case 0x4 :/* CLS, CLZ */ +if (size ==3 ) { +unallocated_encoding (s); +return ; + } +break ; +case 0x2 :/* SADDLP, UADDLP */ case 0x6 :/* SADALP, UADALP */ if (size ==3 ) {unallocated_encoding (s);
@@ -8484,6 +8496,13 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)case 0x9 :/* CMEQ, CMLE */ cond = u ?TCG_COND_LE :TCG_COND_EQ ; goto do_cmop; +case 0x4 :/* CLS */ +if (u) { +gen_helper_clz32 (tcg_res, tcg_op); + }else { +gen_helper_cls32 (tcg_res, tcg_op); + } +break ;case 0xb :/* ABS, NEG */ if (u) {tcg_gen_neg_i32 (tcg_res, tcg_op);
@@ -8567,6 +8586,21 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } }break ; +case 0x4 :/* CLS, CLZ */ +if (u) { +if (size ==0 ) { +gen_helper_neon_clz_u8 (tcg_res, tcg_op); + }else { +gen_helper_neon_clz_u16 (tcg_res, tcg_op); + } + }else { +if (size ==0 ) { +gen_helper_neon_cls_s8 (tcg_res, tcg_op); + }else { +gen_helper_neon_cls_s16 (tcg_res, tcg_op); + } + } +break ;default :g_assert_not_reached (); }
Signature · 1 line
1.9.0
PATCH 6/16 target-arm: A64: Saturating and narrowing shift ops
In reply to Peter MaydellFrom: Alex Bennée <[email protected]>
This implements a the remaining [US][R]SHR[R][2] opcodes which are saturating and narrowing shift right operations. These are used in things like libav. Note signed shifts can have an "unsigned" saturating narrow operation which will floor negative values.
--- target-arm/translate-a64.c | 181 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 178 insertions(+), 3 deletions(-)
target-arm/translate-a64.c +178 -3
@@ -5907,6 +5907,94 @@ static void handle_scalar_simd_shli(DisasContext *s, bool insert,tcg_temp_free_i64 (tcg_rd); } +/* SQSHRN/SQSHRUN - Saturating (signed/unsigned) shift right with +* (signed/unsigned) narrowing */ +static void handle_vec_simd_sqshrn (DisasContext *s,bool is_scalar,bool is_q, +bool is_u_shift,bool is_u_narrow, +int immh,int immb,int opcode, +int rn,int rd) +{ +int immhb = immh <<3 | immb; +int size =32 -clz32 (immh) -1 ; +int esize =8 << size; +int shift = (2 * esize) - immhb; +int elements = is_scalar ?1 : (64 / esize); +bool round =extract32 (opcode,0 ,1 ); +TCGMemOp ldop = (size +1 ) | (is_u_shift ?0 :MO_SIGN ); +TCGv_i64 tcg_rn, tcg_rd, tcg_round; +TCGv_i32 tcg_rd_narrowed; +TCGv_i64 tcg_final; + +static NeonGenNarrowEnvFn *const signed_narrow_fns[4 ][2 ] = { + { gen_helper_neon_narrow_sat_s8, + gen_helper_neon_unarrow_sat8 }, + { gen_helper_neon_narrow_sat_s16, + gen_helper_neon_unarrow_sat16 }, + { gen_helper_neon_narrow_sat_s32, + gen_helper_neon_unarrow_sat32 }, + {NULL ,NULL }, + }; +static NeonGenNarrowEnvFn *const unsigned_narrow_fns[4 ] = { + gen_helper_neon_narrow_sat_u8, + gen_helper_neon_narrow_sat_u16, + gen_helper_neon_narrow_sat_u32, +NULL + }; +NeonGenNarrowEnvFn *narrowfn; + +int i; + +assert (size <4 ); + +if (extract32 (immh,3 ,1 )) { +unallocated_encoding (s); +return ; + } + +if (is_u_shift) { + narrowfn = unsigned_narrow_fns[size]; + }else { + narrowfn = signed_narrow_fns[size][is_u_narrow ?1 :0 ]; + } + + tcg_rn =tcg_temp_new_i64 (); + tcg_rd =tcg_temp_new_i64 (); + tcg_rd_narrowed =tcg_temp_new_i32 (); + tcg_final =tcg_const_i64 (0 ); + +if (round) { +uint64_t round_const =1ULL << (shift -1 ); + tcg_round =tcg_const_i64 (round_const); + }else { +TCGV_UNUSED_I64 (tcg_round); + } + +for (i =0 ; i < elements; i++) { +read_vec_element (s, tcg_rn, rn, i, ldop); +handle_shri_with_rndacc (tcg_rd, tcg_rn, tcg_round, + false, is_u_shift, size+1 , shift); +narrowfn (tcg_rd_narrowed, cpu_env, tcg_rd); +tcg_gen_extu_i32_i64 (tcg_rd, tcg_rd_narrowed); +tcg_gen_deposit_i64 (tcg_final, tcg_final, tcg_rd, esize * i, esize); + } + +if (!is_q) { +clear_vec_high (s, rd); +write_vec_element (s, tcg_final, rd,0 ,MO_64 ); + }else { +write_vec_element (s, tcg_final, rd,1 ,MO_64 ); + } + +if (round) { +tcg_temp_free_i64 (tcg_round); + } +tcg_temp_free_i64 (tcg_rn); +tcg_temp_free_i64 (tcg_rd); +tcg_temp_free_i32 (tcg_rd_narrowed); +tcg_temp_free_i64 (tcg_final); +return ; +} +/* Common vector code for handling integer to FP conversion */ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, int elements, int is_signed,
@@ -6013,6 +6101,11 @@ static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn)int immh =extract32 (insn,19 ,4 );bool is_u =extract32 (insn,29 ,1 ); +if (immh ==0 ) { +unallocated_encoding (s); +return ; + } +switch (opcode) {case 0x00 :/* SSHR / USHR */ case 0x02 :/* SSRA / USRA */
@@ -6027,6 +6120,20 @@ static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn)handle_simd_shift_intfp_conv (s, true, false, is_u, immh, immb, opcode, rn, rd);break ; +case 0x10 :/* SQSHRUN, SQSHRUN2 */ +case 0x11 :/* SQRSHRUN, SQRSHRUN2 */ +if (!is_u) { +unallocated_encoding (s); +return ; + } +handle_vec_simd_sqshrn (s, true, false, false, true, + immh, immb, opcode, rn, rd); +break ; +case 0x12 :/* SQSHRN, SQSHRN2, UQSHRN */ +case 0x13 :/* SQRSHRN, SQRSHRN2, UQRSHRN, UQRSHRN2 */ +handle_vec_simd_sqshrn (s, true, false, is_u, is_u, + immh, immb, opcode, rn, rd); +break ;default :unsupported_encoding (s, insn);break ;
@@ -6985,6 +7092,63 @@ static void handle_vec_simd_wshli(DisasContext *s, bool is_q, bool is_u, } } +/* SHRN/RSHRN - Shift right with narrowing (and potential rounding) */ +static void handle_vec_simd_shrn (DisasContext *s,bool is_q, +int immh,int immb,int opcode,int rn,int rd) +{ +int immhb = immh <<3 | immb; +int size =32 -clz32 (immh) -1 ; +int dsize =64 ; +int esize =8 << size; +int elements = dsize/esize; +int shift = (2 * esize) - immhb; +bool round =extract32 (opcode,0 ,1 ); +TCGv_i64 tcg_rn, tcg_rd, tcg_final; +TCGv_i64 tcg_round; +int i; + +if (extract32 (immh,3 ,1 )) { +unallocated_encoding (s); +return ; + } + + tcg_rn =tcg_temp_new_i64 (); + tcg_rd =tcg_temp_new_i64 (); + tcg_final =tcg_temp_new_i64 (); +read_vec_element (s, tcg_final, rd, is_q ?1 :0 ,MO_64 ); + +if (round) { +uint64_t round_const =1ULL << (shift -1 ); + tcg_round =tcg_const_i64 (round_const); + }else { +TCGV_UNUSED_I64 (tcg_round); + } + +for (i =0 ; i < elements; i++) { +read_vec_element (s, tcg_rn, rn, i, size+1 ); +handle_shri_with_rndacc (tcg_rd, tcg_rn, tcg_round, + false, true, size+1 , shift); + +tcg_gen_deposit_i64 (tcg_final, tcg_final, tcg_rd, esize * i, esize); + } + +if (!is_q) { +clear_vec_high (s, rd); +write_vec_element (s, tcg_final, rd,0 ,MO_64 ); + }else { +write_vec_element (s, tcg_final, rd,1 ,MO_64 ); + } + +if (round) { +tcg_temp_free_i64 (tcg_round); + } +tcg_temp_free_i64 (tcg_rn); +tcg_temp_free_i64 (tcg_rd); +tcg_temp_free_i64 (tcg_final); +return ; +} + +/* C3.6.14 AdvSIMD shift by immediate * 31 30 29 28 23 22 19 18 16 15 11 10 9 5 4 0 * +---+---+---+-------------+------+------+--------+---+------+------+
@@ -7011,6 +7175,20 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn)case 0x0a :/* SHL / SLI */ handle_vec_simd_shli (s, is_q, is_u, immh, immb, opcode, rn, rd);break ; +case 0x10 :/* SHRN */ +case 0x11 :/* RSHRN / SQRSHRUN */ +if (is_u) { +handle_vec_simd_sqshrn (s, false, is_q, false, true, immh, immb, + opcode, rn, rd); + }else { +handle_vec_simd_shrn (s, is_q, immh, immb, opcode, rn, rd); + } +break ; +case 0x12 :/* SQSHRN / UQSHRN */ +case 0x13 :/* SQRSHRN / UQRSHRN */ +handle_vec_simd_sqshrn (s, false, is_q, is_u, is_u, immh, immb, + opcode, rn, rd); +break ;case 0x14 :/* SSHLL / USHLL */ handle_vec_simd_wshli (s, is_q, is_u, immh, immb, opcode, rn, rd);break ;
@@ -7022,9 +7200,6 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn)unsupported_encoding (s, insn);return ;default : -/* We don't currently implement any of the Narrow or -* saturating shifts. -*/ unsupported_encoding (s, insn);return ; }
Signature · 1 line
1.9.0
Re: [Qemu-devel] [PATCH 06/16] target-arm: A64: Saturating and narrowing shift ops
Quoted 3 lines · Peter Maydell
From: Alex Bennée <[email protected]>
This implements a the remaining [US][R]SHR[R][2] opcodes which are
there is an extra 'a' and the instructions are [US][Q][R]SHR[U][N][2]. The last '[R]' is at least clearly wrong.
The commit itself looks correct and is tested with libav's test suite.
Janne
PATCH 7/16 target-arm: A64: Implement SADDLP, UADDLP, SADALP, UADALP
In reply to Peter MaydellImplement the SADDLP, UADDLP, SADALP and UADALP instructions in the SIMD 2-reg misc category.
--- target-arm/helper-a64.c | 61 +++++++++++++++++++++++++++++++++++++ target-arm/helper-a64.h | 4 +++ target-arm/translate-a64.c | 75 +++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 139 insertions(+), 1 deletion(-)
target-arm/helper-a64.c +61 -0
@@ -293,3 +293,64 @@ float64 HELPER(rsqrtsf_f64)(float64 a, float64 b, void *fpstp) }return float64_muladd (a, b, float64_three, float_muladd_halve_result, fpst); } + +/* Pairwise long add: add pairs of adjacent elements into +* double-width elements in the result (eg _s8 is an 8x8->16 op) +*/ +uint64_t HELPER (neon_addlp_s8 )(uint64_t a) +{ +uint64_t nsignmask =0x0080008000800080ULL ; +uint64_t wsignmask =0x8000800080008000ULL ; +uint64_t elementmask =0x00ff00ff00ff00ffULL ; +uint64_t tmp1, tmp2; +uint64_t res, signres; + +/* Extract odd elements, sign extend each to a 16 bit field */ + tmp1 = a & elementmask; + tmp1 ^= nsignmask; + tmp1 |= wsignmask; + tmp1 = (tmp1 - nsignmask) ^ wsignmask; +/* Ditto for the even elements */ + tmp2 = (a >>8 ) & elementmask; + tmp2 ^= nsignmask; + tmp2 |= wsignmask; + tmp2 = (tmp2 - nsignmask) ^ wsignmask; + +/* calculate the result by summing bits 0..14, 16..22, etc, +* and then adjusting the sign bits 15, 23, etc manually. +* This ensures the addition can't overflow the 16 bit field. +*/ + signres = (tmp1 ^ tmp2) & wsignmask; + res = (tmp1 & ~wsignmask) + (tmp2 & ~wsignmask); + res ^= signres; + +return res; +} + +uint64_t HELPER (neon_addlp_u8 )(uint64_t a) +{ +uint64_t tmp; + + tmp = a &0x00ff00ff00ff00ffULL ; + tmp += (a >>8 ) &0x00ff00ff00ff00ffULL ; +return tmp; +} + +uint64_t HELPER (neon_addlp_s16 )(uint64_t a) +{ +int32_t reslo, reshi; + + reslo = (int32_t )(int16_t )a + (int32_t )(int16_t )(a >>16 ); + reshi = (int32_t )(int16_t )(a >>32 ) + (int32_t )(int16_t )(a >>48 ); + +return (uint32_t )reslo | (((uint64_t )reshi) <<32 ); +} + +uint64_t HELPER (neon_addlp_u16 )(uint64_t a) +{ +uint64_t tmp; + + tmp = a &0x0000ffff0000ffffULL ; + tmp += (a >>16 ) &0x0000ffff0000ffffULL ; +return tmp; +}
target-arm/helper-a64.h +4 -0
@@ -39,3 +39,7 @@ DEF_HELPER_FLAGS_3(recpsf_f32, TCG_CALL_NO_RWG, f32, f32, f32, ptr) DEF_HELPER_FLAGS_3(recpsf_f64, TCG_CALL_NO_RWG, f64, f64, f64, ptr) DEF_HELPER_FLAGS_3(rsqrtsf_f32, TCG_CALL_NO_RWG, f32, f32, f32, ptr) DEF_HELPER_FLAGS_3(rsqrtsf_f64, TCG_CALL_NO_RWG, f64, f64, f64, ptr) +DEF_HELPER_FLAGS_1(neon_addlp_s8, TCG_CALL_NO_RWG_SE, i64, i64) +DEF_HELPER_FLAGS_1(neon_addlp_u8, TCG_CALL_NO_RWG_SE, i64, i64) +DEF_HELPER_FLAGS_1(neon_addlp_s16, TCG_CALL_NO_RWG_SE, i64, i64) +DEF_HELPER_FLAGS_1 (neon_addlp_u16,TCG_CALL_NO_RWG_SE , i64, i64)
target-arm/translate-a64.c +74 -1
93 lines not on this page · raw message
Signature · 1 line
1.9.0
PATCH 8/16 target-arm: A64: Implement SHLL, SHLL2
In reply to Peter MaydellImplement the SHLL and SHLL2 instructions from the 2-reg-misc category.
--- target-arm/translate-a64.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)
target-arm/translate-a64.c +31 -1
@@ -8529,6 +8529,36 @@ static void handle_2misc_pairwise(DisasContext *s, int opcode, bool u, } } +static void handle_shll (DisasContext *s,bool is_q,int size,int rn,int rd) +{ +/* Implement SHLL and SHLL2 */ +int pass; +int part = is_q ?2 :0 ; +TCGv_i64 tcg_res[2 ]; + +for (pass =0 ; pass <2 ; pass++) { +static NeonGenWidenFn *const widenfns[3 ] = { + gen_helper_neon_widen_u8, + gen_helper_neon_widen_u16, + tcg_gen_extu_i32_i64, + }; +NeonGenWidenFn *widenfn = widenfns[size]; +TCGv_i32 tcg_op =tcg_temp_new_i32 (); + +read_vec_element_i32 (s, tcg_op, rn, part + pass,MO_32 ); + tcg_res[pass] =tcg_temp_new_i64 (); +widenfn (tcg_res[pass], tcg_op); +tcg_gen_shli_i64 (tcg_res[pass], tcg_res[pass],8 << size); + +tcg_temp_free_i32 (tcg_op); + } + +for (pass =0 ; pass <2 ; pass++) { +write_vec_element (s, tcg_res[pass], rd, pass,MO_64 ); +tcg_temp_free_i64 (tcg_res[pass]); + } +} +/* C3.6.17 AdvSIMD two reg misc * 31 30 29 28 24 23 22 21 17 16 12 11 10 9 5 4 0 * +---+---+---+-----------+------+-----------+--------+-----+------+------+
@@ -8590,7 +8620,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)unallocated_encoding (s);return ; } -unsupported_encoding (s, insn); +handle_shll (s, is_q, size, rn, rd);return ;case 0xa :/* CMLT */ if (u ==1 ) {
Signature · 1 line
1.9.0
PATCH 9/16 target-arm: A64: Implement FCVT[NMAPZ][SU] SIMD instructions
In reply to Peter MaydellImplement the floating-point-to-integer conversion instructions FCVT[NMAPZ][SU] in the 2-reg-misc and scalar-2-reg-misc categories.
--- target-arm/translate-a64.c | 188 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 169 insertions(+), 19 deletions(-)
target-arm/translate-a64.c +169 -19
@@ -6683,11 +6683,14 @@ static void disas_simd_scalar_three_reg_same(DisasContext *s, uint32_t insn) }static void handle_2misc_64 (DisasContext *s,int opcode,bool u, -TCGv_i64 tcg_rd,TCGv_i64 tcg_rn) +TCGv_i64 tcg_rd,TCGv_i64 tcg_rn, +TCGv_i32 tcg_rmode,TCGv_ptr tcg_fpstatus) {/* Handle 64->64 opcodes which are shared between the scalar and * vector 2-reg-misc groups. We cover every integer opcode where size == 3 * is valid in either group and also the double-precision fp ops. +* The caller only need provide tcg_rmode and tcg_fpstatus if the op +* requires them. */ TCGCond cond;
@@ -6741,6 +6744,28 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u,case 0x7f :/* FSQRT */ gen_helper_vfp_sqrtd (tcg_rd, tcg_rn, cpu_env);break ; +case 0x1a :/* FCVTNS */ +case 0x1b :/* FCVTMS */ +case 0x1c :/* FCVTAS */ +case 0x3a :/* FCVTPS */ +case 0x3b :/* FCVTZS */ + { +TCGv_i32 tcg_shift =tcg_const_i32 (0 ); +gen_helper_vfp_tosqd (tcg_rd, tcg_rn, tcg_shift, tcg_fpstatus); +tcg_temp_free_i32 (tcg_shift); +break ; + } +case 0x5a :/* FCVTNU */ +case 0x5b :/* FCVTMU */ +case 0x5c :/* FCVTAU */ +case 0x7a :/* FCVTPU */ +case 0x7b :/* FCVTZU */ + { +TCGv_i32 tcg_shift =tcg_const_i32 (0 ); +gen_helper_vfp_touqd (tcg_rd, tcg_rn, tcg_shift, tcg_fpstatus); +tcg_temp_free_i32 (tcg_shift); +break ; + }default :g_assert_not_reached (); }
@@ -6868,6 +6893,10 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn)int opcode =extract32 (insn,12 ,5 );int size =extract32 (insn,22 ,2 );bool u =extract32 (insn,29 ,1 ); +bool is_fcvt = false; +int rmode; +TCGv_i32 tcg_rmode; +TCGv_ptr tcg_fpstatus;switch (opcode) {case 0xa :/* CMLT */
@@ -6909,17 +6938,24 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) }case 0x1a :/* FCVTNS */ case 0x1b :/* FCVTMS */ -case 0x1c :/* FCVTAS */ case 0x3a :/* FCVTPS */ case 0x3b :/* FCVTZS */ -case 0x3d :/* FRECPE */ -case 0x3f :/* FRECPX */ -case 0x56 :/* FCVTXN, FCVTXN2 */ case 0x5a :/* FCVTNU */ case 0x5b :/* FCVTMU */ -case 0x5c :/* FCVTAU */ case 0x7a :/* FCVTPU */ case 0x7b :/* FCVTZU */ + is_fcvt = true; + rmode =extract32 (opcode,5 ,1 ) | (extract32 (opcode,0 ,1 ) <<1 ); +break ; +case 0x1c :/* FCVTAS */ +case 0x5c :/* FCVTAU */ +/* TIEAWAY doesn't fit in the usual rounding mode encoding */ + is_fcvt = true; + rmode =FPROUNDING_TIEAWAY ; +break ; +case 0x3d :/* FRECPE */ +case 0x3f :/* FRECPX */ +case 0x56 :/* FCVTXN, FCVTXN2 */ case 0x7d :/* FRSQRTE */ unsupported_encoding (s, insn);return ;
@@ -6938,18 +6974,66 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn)return ; } +if (is_fcvt) { + tcg_rmode =tcg_const_i32 (arm_rmode_to_sf (rmode)); +gen_helper_set_rmode (tcg_rmode, tcg_rmode, cpu_env); + tcg_fpstatus =get_fpstatus_ptr (); + }else { +TCGV_UNUSED_I32 (tcg_rmode); +TCGV_UNUSED_PTR (tcg_fpstatus); + } +if (size ==3 ) {TCGv_i64 tcg_rn =read_fp_dreg (s, rn);TCGv_i64 tcg_rd =tcg_temp_new_i64 (); -handle_2misc_64 (s, opcode, u, tcg_rd, tcg_rn); +handle_2misc_64 (s, opcode, u, tcg_rd, tcg_rn, tcg_rmode, tcg_fpstatus);write_fp_dreg (s, rd, tcg_rd);tcg_temp_free_i64 (tcg_rd);tcg_temp_free_i64 (tcg_rn); + }else if (size ==2 ) { +TCGv_i32 tcg_rn =read_fp_sreg (s, rn); +TCGv_i32 tcg_rd =tcg_temp_new_i32 (); + +switch (opcode) { +case 0x1a :/* FCVTNS */ +case 0x1b :/* FCVTMS */ +case 0x1c :/* FCVTAS */ +case 0x3a :/* FCVTPS */ +case 0x3b :/* FCVTZS */ + { +TCGv_i32 tcg_shift =tcg_const_i32 (0 ); +gen_helper_vfp_tosls (tcg_rd, tcg_rn, tcg_shift, tcg_fpstatus); +tcg_temp_free_i32 (tcg_shift); +break ; + } +case 0x5a :/* FCVTNU */ +case 0x5b :/* FCVTMU */ +case 0x5c :/* FCVTAU */ +case 0x7a :/* FCVTPU */ +case 0x7b :/* FCVTZU */ + { +TCGv_i32 tcg_shift =tcg_const_i32 (0 ); +gen_helper_vfp_touls (tcg_rd, tcg_rn, tcg_shift, tcg_fpstatus); +tcg_temp_free_i32 (tcg_shift); +break ; + } +default : +g_assert_not_reached (); + } + +write_fp_sreg (s, rd, tcg_rd); +tcg_temp_free_i32 (tcg_rd); +tcg_temp_free_i32 (tcg_rn); }else { -/* the 'size might not be 64' ops aren't implemented yet */ g_assert_not_reached (); } + +if (is_fcvt) { +gen_helper_set_rmode (tcg_rmode, tcg_rmode, cpu_env); +tcg_temp_free_i32 (tcg_rmode); +tcg_temp_free_ptr (tcg_fpstatus); + } }/* SSHR[RA]/USHR[RA] - Vector shift right (optional rounding/accumulate) */
@@ -8573,6 +8657,11 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)bool is_q =extract32 (insn,30 ,1 );int rn =extract32 (insn,5 ,5 );int rd =extract32 (insn,0 ,5 ); +bool need_fpstatus = false; +bool need_rmode = false; +int rmode; +TCGv_i32 tcg_rmode; +TCGv_ptr tcg_fpstatus;switch (opcode) {case 0x0 :/* REV64, REV32 */
@@ -8691,28 +8780,44 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)return ; }break ; +case 0x1a :/* FCVTNS */ +case 0x1b :/* FCVTMS */ +case 0x3a :/* FCVTPS */ +case 0x3b :/* FCVTZS */ +case 0x5a :/* FCVTNU */ +case 0x5b :/* FCVTMU */ +case 0x7a :/* FCVTPU */ +case 0x7b :/* FCVTZU */ + need_fpstatus = true; + need_rmode = true; + rmode =extract32 (opcode,5 ,1 ) | (extract32 (opcode,0 ,1 ) <<1 ); +if (size ==3 && !is_q) { +unallocated_encoding (s); +return ; + } +break ; +case 0x5c :/* FCVTAU */ +case 0x1c :/* FCVTAS */ + need_fpstatus = true; + need_rmode = true; + rmode =FPROUNDING_TIEAWAY ; +if (size ==3 && !is_q) { +unallocated_encoding (s); +return ; + } +break ;case 0x16 :/* FCVTN, FCVTN2 */ case 0x17 :/* FCVTL, FCVTL2 */ case 0x18 :/* FRINTN */ case 0x19 :/* FRINTM */ -case 0x1a :/* FCVTNS */ -case 0x1b :/* FCVTMS */ -case 0x1c :/* FCVTAS */ case 0x38 :/* FRINTP */ case 0x39 :/* FRINTZ */ -case 0x3a :/* FCVTPS */ -case 0x3b :/* FCVTZS */ case 0x3c :/* URECPE */ case 0x3d :/* FRECPE */ case 0x56 :/* FCVTXN, FCVTXN2 */ case 0x58 :/* FRINTA */ case 0x59 :/* FRINTX */ -case 0x5a :/* FCVTNU */ -case 0x5b :/* FCVTMU */ -case 0x5c :/* FCVTAU */ case 0x79 :/* FRINTI */ -case 0x7a :/* FCVTPU */ -case 0x7b :/* FCVTZU */ case 0x7c :/* URSQRTE */ case 0x7d :/* FRSQRTE */ unsupported_encoding (s, insn);
@@ -8728,6 +8833,18 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)return ; } +if (need_fpstatus) { + tcg_fpstatus =get_fpstatus_ptr (); + }else { +TCGV_UNUSED_PTR (tcg_fpstatus); + } +if (need_rmode) { + tcg_rmode =tcg_const_i32 (arm_rmode_to_sf (rmode)); +gen_helper_set_rmode (tcg_rmode, tcg_rmode, cpu_env); + }else { +TCGV_UNUSED_I32 (tcg_rmode); + } +if (size ==3 ) {/* All 64-bit element operations can be shared with scalar 2misc */ int pass;
@@ -8738,7 +8855,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)read_vec_element (s, tcg_op, rn, pass,MO_64 ); -handle_2misc_64 (s, opcode, u, tcg_res, tcg_op); +handle_2misc_64 (s, opcode, u, tcg_res, tcg_op, + tcg_rmode, tcg_fpstatus);write_vec_element (s, tcg_res, rd, pass,MO_64 );
@@ -8801,6 +8919,30 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)case 0x7f :/* FSQRT */ gen_helper_vfp_sqrts (tcg_res, tcg_op, cpu_env);break ; +case 0x1a :/* FCVTNS */ +case 0x1b :/* FCVTMS */ +case 0x1c :/* FCVTAS */ +case 0x3a :/* FCVTPS */ +case 0x3b :/* FCVTZS */ + { +TCGv_i32 tcg_shift =tcg_const_i32 (0 ); +gen_helper_vfp_tosls (tcg_res, tcg_op, + tcg_shift, tcg_fpstatus); +tcg_temp_free_i32 (tcg_shift); +break ; + } +case 0x5a :/* FCVTNU */ +case 0x5b :/* FCVTMU */ +case 0x5c :/* FCVTAU */ +case 0x7a :/* FCVTPU */ +case 0x7b :/* FCVTZU */ + { +TCGv_i32 tcg_shift =tcg_const_i32 (0 ); +gen_helper_vfp_touls (tcg_res, tcg_op, + tcg_shift, tcg_fpstatus); +tcg_temp_free_i32 (tcg_shift); +break ; + }default :g_assert_not_reached (); }
@@ -8893,6 +9035,14 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)if (!is_q) {clear_vec_high (s, rd); } + +if (need_rmode) { +gen_helper_set_rmode (tcg_rmode, tcg_rmode, cpu_env); +tcg_temp_free_i32 (tcg_rmode); + } +if (need_fpstatus) { +tcg_temp_free_ptr (tcg_fpstatus); + } }/* C3.6.13 AdvSIMD scalar x indexed element
Signature · 1 line
1.9.0
Re: [Qemu-devel] [PATCH 09/16] target-arm: A64: Implement FCVT[NMAPZ][SU] SIMD instructions
target-arm/translate-a64.c static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) · line 8662
Quoted 13 lines · Peter Maydell
Implement the floating-point-to-integer conversion instructions FCVT[NMAPZ][SU] in the 2-reg-misc and scalar-2-reg-misc categories.
Signed-off-by Peter Maydell <[email protected]>---
target-arm/translate-a64.c +3
-0@@ -8573,6 +8657,11 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)bool is_q =extract32 (insn,30 ,1 );int rn =extract32 (insn,5 ,5 );int rd =extract32 (insn,0 ,5 ); +bool need_fpstatus = false; +bool need_rmode = false; +int rmode;
This needs to be "int rmode = -1;" since some versions of gcc otherwise complain about maybe-used-uninitialized (not actually true since on all code paths we set rmode if setting need_rmode to true, and only use rmode if need_rmode is set).
No idea why only this function and not the scalar_two_reg_misc similar construct provokes the warning....
thanks
-- PMM
PATCH 10/16 target-arm: A64: Implement FCVTN
In reply to Peter MaydellImplement FCVTN (narrowing fp-to-fp conversions) from the SIMD 2-reg-misc category.
--- target-arm/translate-a64.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
target-arm/translate-a64.c +20 -1
@@ -8450,13 +8450,30 @@ static void handle_2misc_narrow(DisasContext *s, int opcode, bool u, bool is_q, genenvfn = fns[size][u];break ; } +case 0x16 :/* FCVTN, FCVTN2 */ +/* 32 bit to 16 bit or 64 bit to 32 bit float conversion */ +if (size ==3 ) { +gen_helper_vfp_fcvtsd (tcg_res[pass], tcg_op, cpu_env); + }else { +TCGv_i32 tcg_lo =tcg_temp_new_i32 (); +TCGv_i32 tcg_hi =tcg_temp_new_i32 (); +tcg_gen_trunc_i64_i32 (tcg_lo, tcg_op); +gen_helper_vfp_fcvt_f32_to_f16 (tcg_lo, tcg_lo, cpu_env); +tcg_gen_shri_i64 (tcg_op, tcg_op,32 ); +tcg_gen_trunc_i64_i32 (tcg_hi, tcg_op); +gen_helper_vfp_fcvt_f32_to_f16 (tcg_hi, tcg_hi, cpu_env); +tcg_gen_deposit_i32 (tcg_res[pass], tcg_lo, tcg_hi,16 ,16 ); +tcg_temp_free_i32 (tcg_lo); +tcg_temp_free_i32 (tcg_hi); + } +break ;default :g_assert_not_reached (); }if (genfn) {genfn (tcg_res[pass], tcg_op); - }else { + }else if (genenvfn) {genenvfn (tcg_res[pass], cpu_env, tcg_op); }
@@ -8807,6 +8824,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) }break ;case 0x16 :/* FCVTN, FCVTN2 */ +handle_2misc_narrow (s, opcode,0 , is_q, size, rn, rd); +return ;case 0x17 :/* FCVTL, FCVTL2 */ case 0x18 :/* FRINTN */ case 0x19 :/* FRINTM */
Signature · 1 line
1.9.0
PATCH 11/16 target-arm: A64: Implement FCVTL
In reply to Peter MaydellImplement FCVTL, the only instruction in the 2-reg-misc group which widens from size to 2*size elements.
--- target-arm/translate-a64.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
target-arm/translate-a64.c +47 -0
@@ -8489,6 +8489,51 @@ static void handle_2misc_narrow(DisasContext *s, int opcode, bool u, bool is_q, } } +static void handle_2misc_widening (DisasContext *s,int opcode,bool is_q, +int size,int rn,int rd) +{ +/* Handle 2-reg-misc ops which are widening (so each size element +* in the source becomes a 2*size element in the destination. +* The only instruction like this is FCVTL. +*/ +int pass; + +if (size ==3 ) { +/* 32 -> 64 bit fp conversion */ +TCGv_i64 tcg_res[2 ]; +int srcelt = is_q ?2 :0 ; + +for (pass =0 ; pass <2 ; pass++) { +TCGv_i32 tcg_op =tcg_temp_new_i32 (); + tcg_res[pass] =tcg_temp_new_i64 (); + +read_vec_element_i32 (s, tcg_op, rn, srcelt + pass,MO_32 ); +gen_helper_vfp_fcvtds (tcg_res[pass], tcg_op, cpu_env); +tcg_temp_free_i32 (tcg_op); + } +for (pass =0 ; pass <2 ; pass++) { +write_vec_element (s, tcg_res[pass], rd, pass,MO_64 ); +tcg_temp_free_i64 (tcg_res[pass]); + } + }else { +/* 16 -> 32 bit fp conversion */ +int srcelt = is_q ?4 :0 ; +TCGv_i32 tcg_res[4 ]; + +for (pass =0 ; pass <4 ; pass++) { + tcg_res[pass] =tcg_temp_new_i32 (); + +read_vec_element_i32 (s, tcg_res[pass], rn, srcelt + pass,MO_16 ); +gen_helper_vfp_fcvt_f16_to_f32 (tcg_res[pass], tcg_res[pass], + cpu_env); + } +for (pass =0 ; pass <4 ; pass++) { +write_vec_element_i32 (s, tcg_res[pass], rd, pass,MO_32 ); +tcg_temp_free_i32 (tcg_res[pass]); + } + } +} +static void handle_rev (DisasContext *s,int opcode,bool u,bool is_q,int size,int rn,int rd) {
@@ -8827,6 +8872,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)handle_2misc_narrow (s, opcode,0 , is_q, size, rn, rd);return ;case 0x17 :/* FCVTL, FCVTL2 */ +handle_2misc_widening (s, opcode, is_q, size, rn, rd); +return ;case 0x18 :/* FRINTN */ case 0x19 :/* FRINTM */ case 0x38 :/* FRINTP */
Signature · 1 line
1.9.0
PATCH 12/16 target-arm: A64: List unsupported shift-imm opcodes
In reply to Peter MaydellAdd the remaining unsupported opcodes to the decode switches for the shift-imm and scalar shift-imm categories so we can see what is still to be implemented.
--- target-arm/translate-a64.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
target-arm/translate-a64.c +11 -2
@@ -6135,9 +6135,15 @@ static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn)handle_vec_simd_sqshrn (s, true, false, is_u, is_u, immh, immb, opcode, rn, rd);break ; -default : +case 0x8 :/* SRI */ +case 0xc :/* SQSHLU */ +case 0xe :/* SQSHL, UQSHL */ +case 0x1f :/* FCVTZS, FCVTZU */ unsupported_encoding (s, insn);break ; +default : +unallocated_encoding (s); +break ; } }
@@ -7281,11 +7287,14 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn)handle_simd_shift_intfp_conv (s, false, is_q, is_u, immh, immb, opcode, rn, rd);break ; +case 0x8 :/* SRI */ +case 0xc :/* SQSHLU */ +case 0xe :/* SQSHL, UQSHL */ case 0x1f :/* FCVTZS/ FCVTZU */ unsupported_encoding (s, insn);return ;default : -unsupported_encoding (s, insn); +unallocated_encoding (s);return ; } }
Signature · 1 line
1.9.0
PATCH 13/16 target-arm: A64: Add FRECPX (reciprocal exponent)
In reply to Peter MaydellFrom: Alex Bennée <[email protected]>
These are fairly simple exponent only estimation functions using helpers.
--- target-arm/helper-a64.c | 59 ++++++++++++++++++++++++++++++++++++++ target-arm/helper-a64.h | 2 ++ target-arm/translate-a64.c | 70 +++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 130 insertions(+), 1 deletion(-)
target-arm/helper-a64.c +59 -0
@@ -354,3 +354,62 @@ uint64_t HELPER(neon_addlp_u16)(uint64_t a) tmp += (a >>16 ) &0x0000ffff0000ffffULL ;return tmp; } + +/* Floating-point reciprocal exponent - see FPRecpX in ARM ARM */ +float32 HELPER (frecpx_f32 )(float32 a,void *fpstp) +{ +float_status *fpst = fpstp; +uint32_t val32, sbit; +int32_t exp; + +if (float32_is_any_nan (a)) { +float32 nan = a; +if (float32_is_signaling_nan (a)) { +float_raise (float_flag_invalid, fpst); + nan =float32_maybe_silence_nan (a); + } +if (fpst->default_nan_mode) { + nan = float32_default_nan; + } +return nan; + } + + val32 =float32_val (a); + sbit =0x80000000ULL & val32; + exp =extract32 (val32,23 ,8 ); + +if (exp ==0 ) { +return make_float32 (sbit | (0xfe <<23 )); + }else { +return make_float32 (sbit | (~exp &0xff ) <<23 ); + } +} + +float64 HELPER (frecpx_f64 )(float64 a,void *fpstp) +{ +float_status *fpst = fpstp; +uint64_t val64, sbit; +int64_t exp; + +if (float64_is_any_nan (a)) { +float64 nan = a; +if (float64_is_signaling_nan (a)) { +float_raise (float_flag_invalid, fpst); + nan =float64_maybe_silence_nan (a); + } +if (fpst->default_nan_mode) { + nan = float64_default_nan; + } +return nan; + } + + val64 =float64_val (a); + sbit =0x8000000000000000ULL & val64; + exp =extract64 (float64_val (a),52 ,11 ); + +if (exp ==0 ) { +return make_float64 (sbit | (0x7feULL <<52 )); + }else { +return make_float64 (sbit | (~exp &0x7ffULL ) <<52 ); + } +}
target-arm/helper-a64.h +2 -0
@@ -43,3 +43,5 @@ DEF_HELPER_FLAGS_1(neon_addlp_s8, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_1(neon_addlp_u8, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_1(neon_addlp_s16, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_1(neon_addlp_u16, TCG_CALL_NO_RWG_SE, i64, i64) +DEF_HELPER_FLAGS_2(frecpx_f64, TCG_CALL_NO_RWG, f64, f64, ptr) +DEF_HELPER_FLAGS_2 (frecpx_f32,TCG_CALL_NO_RWG , f32, f32, ptr)
target-arm/translate-a64.c +69 -1
88 lines not on this page · raw message
Signature · 1 line
1.9.0
PATCH 14/16 target-arm: A64: Implement SRI
In reply to Peter MaydellImplement SRI (shift right and insert).
--- target-arm/translate-a64.c | 57 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 8 deletions(-)
target-arm/translate-a64.c +49 -8
@@ -5828,6 +5828,21 @@ static void handle_shli_with_ins(TCGv_i64 tcg_res, TCGv_i64 tcg_src, } } +/* SRI: shift right with insert */ +static void handle_shri_with_ins (TCGv_i64 tcg_res,TCGv_i64 tcg_src, +int size,int shift) +{ +int esize =8 << size; + +/* shift count same as element size is valid but does nothing; +* special case to avoid potential shift by 64. +*/ +if (shift != esize) { +tcg_gen_shri_i64 (tcg_src, tcg_src, shift); +tcg_gen_deposit_i64 (tcg_res, tcg_res, tcg_src,0 , esize - shift); + } +} +/* SSHR[RA]/USHR[RA] - Scalar shift right (optional rounding/accumulate) */ static void handle_scalar_simd_shri(DisasContext *s, bool is_u, int immh, int immb,
@@ -5838,6 +5853,7 @@ static void handle_scalar_simd_shri(DisasContext *s,int shift =2 * (8 << size) - immhb;bool accumulate = false;bool round = false; +bool insert = false;TCGv_i64 tcg_rn;TCGv_i64 tcg_rd;TCGv_i64 tcg_round;
@@ -5857,6 +5873,9 @@ static void handle_scalar_simd_shri(DisasContext *s,case 0x06 :/* SRSRA / URSRA (accum + rounding) */ accumulate = round = true;break ; +case 0x08 :/* SRI */ + insert = true; +break ; }if (round) {
@@ -5867,10 +5886,14 @@ static void handle_scalar_simd_shri(DisasContext *s, } tcg_rn =read_fp_dreg (s, rn); - tcg_rd = accumulate ?read_fp_dreg (s, rd) :tcg_temp_new_i64 (); + tcg_rd = (accumulate || insert) ?read_fp_dreg (s, rd) :tcg_temp_new_i64 (); -handle_shri_with_rndacc (tcg_rd, tcg_rn, tcg_round, - accumulate, is_u, size, shift); +if (insert) { +handle_shri_with_ins (tcg_rd, tcg_rn, size, shift); + }else { +handle_shri_with_rndacc (tcg_rd, tcg_rn, tcg_round, + accumulate, is_u, size, shift); + }write_fp_dreg (s, rd, tcg_rd);
@@ -6108,6 +6131,12 @@ static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn) }switch (opcode) { +case 0x08 :/* SRI */ +if (!is_u) { +unallocated_encoding (s); +return ; + } +/* fall through */ case 0x00 :/* SSHR / USHR */ case 0x02 :/* SSRA / USRA */ case 0x04 :/* SRSHR / URSHR */
@@ -6135,7 +6164,6 @@ static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn)handle_vec_simd_sqshrn (s, true, false, is_u, is_u, immh, immb, opcode, rn, rd);break ; -case 0x8 :/* SRI */ case 0xc :/* SQSHLU */ case 0xe :/* SQSHL, UQSHL */ case 0x1f :/* FCVTZS, FCVTZU */
@@ -7119,6 +7147,7 @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u,int shift =2 * (8 << size) - immhb;bool accumulate = false;bool round = false; +bool insert = false;int dsize = is_q ?128 :64 ;int esize =8 << size;int elements = dsize/esize;
@@ -7148,6 +7177,9 @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u,case 0x06 :/* SRSRA / URSRA (accum + rounding) */ accumulate = round = true;break ; +case 0x08 :/* SRI */ + insert = true; +break ; }if (round) {
@@ -7159,12 +7191,16 @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u,for (i =0 ; i < elements; i++) {read_vec_element (s, tcg_rn, rn, i, memop); -if (accumulate) { +if (accumulate || insert) {read_vec_element (s, tcg_rd, rd, i, memop); } -handle_shri_with_rndacc (tcg_rd, tcg_rn, tcg_round, - accumulate, is_u, size, shift); +if (insert) { +handle_shri_with_ins (tcg_rd, tcg_rn, size, shift); + }else { +handle_shri_with_rndacc (tcg_rd, tcg_rn, tcg_round, + accumulate, is_u, size, shift); + }write_vec_element (s, tcg_rd, rd, i, size); }
@@ -7325,6 +7361,12 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn)bool is_q =extract32 (insn,30 ,1 );switch (opcode) { +case 0x08 :/* SRI */ +if (!is_u) { +unallocated_encoding (s); +return ; + } +/* fall through */ case 0x00 :/* SSHR / USHR */ case 0x02 :/* SSRA / USRA (accumulate) */ case 0x04 :/* SRSHR / URSHR (rounding) */
@@ -7355,7 +7397,6 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn)handle_simd_shift_intfp_conv (s, false, is_q, is_u, immh, immb, opcode, rn, rd);break ; -case 0x8 :/* SRI */ case 0xc :/* SQSHLU */ case 0xe :/* SQSHL, UQSHL */ case 0x1f :/* FCVTZS/ FCVTZU */
Signature · 1 line
1.9.0
PATCH 15/16 target-arm: A64: Implement FRINT*
In reply to Peter MaydellImplement the FRINT* round-to-integral operations from the 2-reg-misc category.
--- target-arm/translate-a64.c | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-)
target-arm/translate-a64.c +34 -3
@@ -6800,6 +6800,17 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u,tcg_temp_free_i32 (tcg_shift);break ; } +case 0x18 :/* FRINTN */ +case 0x19 :/* FRINTM */ +case 0x38 :/* FRINTP */ +case 0x39 :/* FRINTZ */ +case 0x58 :/* FRINTA */ +case 0x79 :/* FRINTI */ +gen_helper_rintd (tcg_rd, tcg_rn, tcg_fpstatus); +break ; +case 0x59 :/* FRINTX */ +gen_helper_rintd_exact (tcg_rd, tcg_rn, tcg_fpstatus); +break ;default :g_assert_not_reached (); }
@@ -8996,12 +9007,21 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)case 0x19 :/* FRINTM */ case 0x38 :/* FRINTP */ case 0x39 :/* FRINTZ */ -case 0x3c :/* URECPE */ -case 0x3d :/* FRECPE */ -case 0x56 :/* FCVTXN, FCVTXN2 */ case 0x58 :/* FRINTA */ + need_rmode = true; + rmode =extract32 (opcode,5 ,2 ) | (extract32 (opcode,0 ,1 ) <<1 ); +/* fall through */ case 0x59 :/* FRINTX */ case 0x79 :/* FRINTI */ + need_fpstatus = true; +if (size ==3 && !is_q) { +unallocated_encoding (s); +return ; + } +break ; +case 0x3c :/* URECPE */ +case 0x3d :/* FRECPE */ +case 0x56 :/* FCVTXN, FCVTXN2 */ case 0x7c :/* URSQRTE */ case 0x7d :/* FRSQRTE */ unsupported_encoding (s, insn);
@@ -9127,6 +9147,17 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)tcg_temp_free_i32 (tcg_shift);break ; } +case 0x18 :/* FRINTN */ +case 0x19 :/* FRINTM */ +case 0x38 :/* FRINTP */ +case 0x39 :/* FRINTZ */ +case 0x58 :/* FRINTA */ +case 0x79 :/* FRINTI */ +gen_helper_rints (tcg_res, tcg_op, tcg_fpstatus); +break ; +case 0x59 :/* FRINTX */ +gen_helper_rints_exact (tcg_res, tcg_op, tcg_fpstatus); +break ;default :g_assert_not_reached (); }
Signature · 1 line
1.9.0
PATCH 16/16 exec-all.h: Increase MAX_OP_PER_INSTR for ARM A64 decoder
In reply to Peter MaydellThe ARM A64 decoder's worst case number of TCG ops per instruction is 266 (for insn 0x4c800000, a post-indexed ST4 multiple-structures store). Raise the MAX_OP_PER_INSTR define accordingly.
--- include/exec/exec-all.h | 2 +- target-arm/translate-a64.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-)
include/exec/exec-all.h +1 -1
@@ -44,7 +44,7 @@ struct TranslationBlock;typedef struct TranslationBlock TranslationBlock ;/* XXX: make safe guess about sizes */ -#define MAX_OP_PER_INSTR 208 +#define MAX_OP_PER_INSTR 266#if HOST_LONG_BITS ==32 #define MAX_OPC_PARAM_PER_ARG 2
target-arm/translate-a64.c +10 -2
@@ -9007,9 +9007,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)case 0x19 :/* FRINTM */ case 0x38 :/* FRINTP */ case 0x39 :/* FRINTZ */ -case 0x58 :/* FRINTA */ need_rmode = true; - rmode =extract32 (opcode,5 ,2 ) | (extract32 (opcode,0 ,1 ) <<1 ); + rmode =extract32 (opcode,5 ,1 ) | (extract32 (opcode,0 ,1 ) <<1 );/* fall through */ case 0x59 :/* FRINTX */ case 0x79 :/* FRINTI */
@@ -9019,6 +9018,15 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)return ; }break ; +case 0x58 :/* FRINTA */ + need_rmode = true; + rmode =FPROUNDING_TIEAWAY ; + need_fpstatus = true; +if (size ==3 && !is_q) { +unallocated_encoding (s); +return ; + } +break ;case 0x3c :/* URECPE */ case 0x3d :/* FRECPE */ case 0x56 :/* FCVTXN, FCVTXN2 */
Signature · 1 line
1.9.0
Re: [Qemu-devel] [PATCH 16/16] exec-all.h: Increase MAX_OP_PER_INSTR for ARM A64 decoder
Hi,
Quoted 18 lines · Peter Maydell
target-arm/translate-a64.c +1
-2@@ -9007,9 +9007,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)case 0x19 :/* FRINTM */ case 0x38 :/* FRINTP */ case 0x39 :/* FRINTZ */ -case 0x58 :/* FRINTA */ need_rmode = true; - rmode =extract32 (opcode,5 ,2 ) | (extract32 (opcode,0 ,1 ) <<1 ); + rmode =extract32 (opcode,5 ,1 ) | (extract32 (opcode,0 ,1 ) <<1 );/* fall through */ case 0x59 :/* FRINTX */ case 0x79 :/* FRINTI */ @@ -9019,6 +9018,15 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)return ; }
target-arm/translate-a64.c static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) · line 9029
Quoted 10 lines
target-arm/translate-a64.c +9
-0break ; +case 0x58 :/* FRINTA */ + need_rmode = true; + rmode =FPROUNDING_TIEAWAY ; + need_fpstatus = true; +if (size ==3 && !is_q) { +unallocated_encoding (s); +return ; + } +break ;
Merge the above into [15/16] ?
Ciao,
Michael.
Re: [Qemu-devel] [PATCH 16/16] exec-all.h: Increase MAX_OP_PER_INSTR for ARM A64 decoder
Quoted 26 lines · Michael Matz
Hi,
Quoted 22 lines · Peter Maydell
target-arm/translate-a64.c +4
-2@@ -9007,9 +9007,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)case 0x19 :/* FRINTM */ case 0x38 :/* FRINTP */ case 0x39 :/* FRINTZ */ -case 0x58 :/* FRINTA */ need_rmode = true; - rmode =extract32 (opcode,5 ,2 ) | (extract32 (opcode,0 ,1 ) <<1 ); + rmode =extract32 (opcode,5 ,1 ) | (extract32 (opcode,0 ,1 ) <<1 );/* fall through */ case 0x59 :/* FRINTX */ case 0x79 :/* FRINTI */ @@ -9019,6 +9018,15 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)return ; }break ; +case 0x58 :/* FRINTA */ + need_rmode = true; + rmode =FPROUNDING_TIEAWAY ;
Quoted 8 lines
target-arm/translate-a64.c static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) · line 9029
Quoted 6 lines
target-arm/translate-a64.c +6
-0+ need_fpstatus = true; +if (size ==3 && !is_q) { +unallocated_encoding (s); +return ; + } +break ;Merge the above into [15/16] ?
Yes, indeed. I obviously refreshed these FRINT
changes into the wrong patch.
thanks
-- PMM