target/s390x: Implement TRTR
Drop TRT from the set of insns handled internally by EXECUTE. It's more important to adjust the existing helper to handle both TRT and TRTR. Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
		
							parent
							
								
									be7acb5839
								
							
						
					
					
						commit
						b213c9f58e
					
				| 
						 | 
				
			
			@ -97,6 +97,7 @@ DEF_HELPER_FLAGS_3(tp, TCG_CALL_NO_WG, i32, env, i64, i32)
 | 
			
		|||
DEF_HELPER_FLAGS_4(tr, TCG_CALL_NO_WG, void, env, i32, i64, i64)
 | 
			
		||||
DEF_HELPER_4(tre, i64, env, i64, i64, i64)
 | 
			
		||||
DEF_HELPER_4(trt, i32, env, i32, i64, i64)
 | 
			
		||||
DEF_HELPER_4(trtr, i32, env, i32, i64, i64)
 | 
			
		||||
DEF_HELPER_5(trXX, i32, env, i32, i32, i32, i32)
 | 
			
		||||
DEF_HELPER_4(cksm, i64, env, i64, i64, i64)
 | 
			
		||||
DEF_HELPER_FLAGS_5(calc_cc, TCG_CALL_NO_RWG_SE, i32, env, i32, i64, i64, i64)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -916,6 +916,8 @@
 | 
			
		|||
    C(0xdc00, TR,      SS_a,  Z,   la1, a2, 0, 0, tr, 0)
 | 
			
		||||
/* TRANSLATE AND TEST */
 | 
			
		||||
    C(0xdd00, TRT,     SS_a,  Z,   la1, a2, 0, 0, trt, 0)
 | 
			
		||||
/* TRANSLATE AND TEST REVERSE */
 | 
			
		||||
    C(0xd000, TRTR,    SS_a,  ETF3, la1, a2, 0, 0, trtr, 0)
 | 
			
		||||
/* TRANSLATE EXTENDED */
 | 
			
		||||
    C(0xb2a5, TRE,     RRE,   Z,   0, r2, r1_P, 0, tre, 0)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1277,17 +1277,18 @@ uint64_t HELPER(tre)(CPUS390XState *env, uint64_t array,
 | 
			
		|||
    return array + i;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static uint32_t do_helper_trt(CPUS390XState *env, uint32_t len, uint64_t array,
 | 
			
		||||
                              uint64_t trans, uintptr_t ra)
 | 
			
		||||
static inline uint32_t do_helper_trt(CPUS390XState *env, int len,
 | 
			
		||||
                                     uint64_t array, uint64_t trans,
 | 
			
		||||
                                     int inc, uintptr_t ra)
 | 
			
		||||
{
 | 
			
		||||
    uint32_t i;
 | 
			
		||||
    int i;
 | 
			
		||||
 | 
			
		||||
    for (i = 0; i <= len; i++) {
 | 
			
		||||
        uint8_t byte = cpu_ldub_data_ra(env, array + i, ra);
 | 
			
		||||
        uint8_t byte = cpu_ldub_data_ra(env, array + i * inc, ra);
 | 
			
		||||
        uint8_t sbyte = cpu_ldub_data_ra(env, trans + byte, ra);
 | 
			
		||||
 | 
			
		||||
        if (sbyte != 0) {
 | 
			
		||||
            set_address(env, 1, array + i);
 | 
			
		||||
            set_address(env, 1, array + i * inc);
 | 
			
		||||
            env->regs[2] = deposit64(env->regs[2], 0, 8, sbyte);
 | 
			
		||||
            return (i == len) ? 2 : 1;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -1299,7 +1300,13 @@ static uint32_t do_helper_trt(CPUS390XState *env, uint32_t len, uint64_t array,
 | 
			
		|||
uint32_t HELPER(trt)(CPUS390XState *env, uint32_t len, uint64_t array,
 | 
			
		||||
                     uint64_t trans)
 | 
			
		||||
{
 | 
			
		||||
    return do_helper_trt(env, len, array, trans, GETPC());
 | 
			
		||||
    return do_helper_trt(env, len, array, trans, 1, GETPC());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t HELPER(trtr)(CPUS390XState *env, uint32_t len, uint64_t array,
 | 
			
		||||
                      uint64_t trans)
 | 
			
		||||
{
 | 
			
		||||
    return do_helper_trt(env, len, array, trans, -1, GETPC());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Translate one/two to one/two */
 | 
			
		||||
| 
						 | 
				
			
			@ -2119,7 +2126,6 @@ void HELPER(ex)(CPUS390XState *env, uint32_t ilen, uint64_t r1, uint64_t addr)
 | 
			
		|||
            [0x6] = do_helper_oc,
 | 
			
		||||
            [0x7] = do_helper_xc,
 | 
			
		||||
            [0xc] = do_helper_tr,
 | 
			
		||||
            [0xd] = do_helper_trt,
 | 
			
		||||
        };
 | 
			
		||||
        dx_helper helper = dx[opc & 0xf];
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4447,6 +4447,15 @@ static ExitStatus op_trt(DisasContext *s, DisasOps *o)
 | 
			
		|||
    return NO_EXIT;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static ExitStatus op_trtr(DisasContext *s, DisasOps *o)
 | 
			
		||||
{
 | 
			
		||||
    TCGv_i32 l = tcg_const_i32(get_field(s->fields, l1));
 | 
			
		||||
    gen_helper_trtr(cc_op, cpu_env, l, o->addr1, o->in2);
 | 
			
		||||
    tcg_temp_free_i32(l);
 | 
			
		||||
    set_cc_static(s);
 | 
			
		||||
    return NO_EXIT;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static ExitStatus op_trXX(DisasContext *s, DisasOps *o)
 | 
			
		||||
{
 | 
			
		||||
    TCGv_i32 r1 = tcg_const_i32(get_field(s->fields, r1));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue