mirror of
				https://github.com/yuzu-emu/unicorn.git
				synced 2025-11-04 11:24:54 +00:00 
			
		
		
		
	target/arm: Convert VFP VNMLA to decodetree
Convert the VFP VNMLA instruction to decodetree. Backports commit 8a483533adc1bdc2decb8f456dbe930a2d245a8b from qemu
This commit is contained in:
		
							parent
							
								
									638b90de31
								
							
						
					
					
						commit
						b26b6a12a2
					
				| 
						 | 
				
			
			@ -1402,3 +1402,37 @@ static bool trans_VNMLS_dp(DisasContext *s, arg_VNMLS_sp *a)
 | 
			
		|||
{
 | 
			
		||||
    return do_vfp_3op_dp(s, gen_VNMLS_dp, a->vd, a->vn, a->vm, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void gen_VNMLA_sp(TCGContext *tcg_ctx, TCGv_i32 vd, TCGv_i32 vn, TCGv_i32 vm, TCGv_ptr fpst)
 | 
			
		||||
{
 | 
			
		||||
    /* VNMLA: -fd + -(fn * fm) */
 | 
			
		||||
    TCGv_i32 tmp = tcg_temp_new_i32(tcg_ctx);
 | 
			
		||||
 | 
			
		||||
    gen_helper_vfp_muls(tcg_ctx, tmp, vn, vm, fpst);
 | 
			
		||||
    gen_helper_vfp_negs(tcg_ctx, tmp, tmp);
 | 
			
		||||
    gen_helper_vfp_negs(tcg_ctx, vd, vd);
 | 
			
		||||
    gen_helper_vfp_adds(tcg_ctx, vd, vd, tmp, fpst);
 | 
			
		||||
    tcg_temp_free_i32(tcg_ctx, tmp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool trans_VNMLA_sp(DisasContext *s, arg_VNMLA_sp *a)
 | 
			
		||||
{
 | 
			
		||||
    return do_vfp_3op_sp(s, gen_VNMLA_sp, a->vd, a->vn, a->vm, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void gen_VNMLA_dp(TCGContext *tcg_ctx, TCGv_i64 vd, TCGv_i64 vn, TCGv_i64 vm, TCGv_ptr fpst)
 | 
			
		||||
{
 | 
			
		||||
    /* VNMLA: -fd + (fn * fm) */
 | 
			
		||||
    TCGv_i64 tmp = tcg_temp_new_i64(tcg_ctx);
 | 
			
		||||
 | 
			
		||||
    gen_helper_vfp_muld(tcg_ctx, tmp, vn, vm, fpst);
 | 
			
		||||
    gen_helper_vfp_negd(tcg_ctx, tmp, tmp);
 | 
			
		||||
    gen_helper_vfp_negd(tcg_ctx, vd, vd);
 | 
			
		||||
    gen_helper_vfp_addd(tcg_ctx, vd, vd, tmp, fpst);
 | 
			
		||||
    tcg_temp_free_i64(tcg_ctx, tmp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool trans_VNMLA_dp(DisasContext *s, arg_VNMLA_sp *a)
 | 
			
		||||
{
 | 
			
		||||
    return do_vfp_3op_dp(s, gen_VNMLA_dp, a->vd, a->vn, a->vm, true);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1449,17 +1449,6 @@ VFP_OP2(div)
 | 
			
		|||
 | 
			
		||||
#undef VFP_OP2
 | 
			
		||||
 | 
			
		||||
static inline void gen_vfp_F1_neg(DisasContext *s, int dp)
 | 
			
		||||
{
 | 
			
		||||
    TCGContext *tcg_ctx = s->uc->tcg_ctx;
 | 
			
		||||
    /* Like gen_vfp_neg() but put result in F1 */
 | 
			
		||||
    if (dp) {
 | 
			
		||||
        gen_helper_vfp_negd(tcg_ctx, s->F1d, s->F0d);
 | 
			
		||||
    } else {
 | 
			
		||||
        gen_helper_vfp_negs(tcg_ctx, s->F1s, s->F0s);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void gen_vfp_abs(DisasContext *s, int dp)
 | 
			
		||||
{
 | 
			
		||||
    TCGContext *tcg_ctx = s->uc->tcg_ctx;
 | 
			
		||||
| 
						 | 
				
			
			@ -3228,6 +3217,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn)
 | 
			
		|||
            case 0:
 | 
			
		||||
            case 1:
 | 
			
		||||
            case 2:
 | 
			
		||||
            case 3:
 | 
			
		||||
                /* Already handled by decodetree */
 | 
			
		||||
                return 1;
 | 
			
		||||
            default:
 | 
			
		||||
| 
						 | 
				
			
			@ -3413,13 +3403,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn)
 | 
			
		|||
            for (;;) {
 | 
			
		||||
                /* Perform the calculation.  */
 | 
			
		||||
                switch (op) {
 | 
			
		||||
                case 3: /* VNMLA: -fd + -(fn * fm) */
 | 
			
		||||
                    gen_vfp_mul(s, dp);
 | 
			
		||||
                    gen_vfp_F1_neg(s, dp);
 | 
			
		||||
                    gen_mov_F0_vreg(s, dp, rd);
 | 
			
		||||
                    gen_vfp_neg(s, dp);
 | 
			
		||||
                    gen_vfp_add(s, dp);
 | 
			
		||||
                    break;
 | 
			
		||||
                case 4: /* mul: fn * fm */
 | 
			
		||||
                    gen_vfp_mul(s, dp);
 | 
			
		||||
                    break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -112,3 +112,8 @@ VNMLS_sp     ---- 1110 0.01 .... .... 1010 .0.0 .... \
 | 
			
		|||
             vm=%vm_sp vn=%vn_sp vd=%vd_sp
 | 
			
		||||
VNMLS_dp     ---- 1110 0.01 .... .... 1011 .0.0 .... \
 | 
			
		||||
             vm=%vm_dp vn=%vn_dp vd=%vd_dp
 | 
			
		||||
 | 
			
		||||
VNMLA_sp     ---- 1110 0.01 .... .... 1010 .1.0 .... \
 | 
			
		||||
             vm=%vm_sp vn=%vn_sp vd=%vd_sp
 | 
			
		||||
VNMLA_dp     ---- 1110 0.01 .... .... 1011 .1.0 .... \
 | 
			
		||||
             vm=%vm_dp vn=%vn_dp vd=%vd_dp
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue