target-alpha: convert byte manipulation instructions to TCG
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5246 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
		
							parent
							
								
									9c29504eb7
								
							
						
					
					
						commit
						b3249f630e
					
				@ -9,3 +9,21 @@ DEF_HELPER(uint64_t, helper_amask, (uint64_t))
 | 
				
			|||||||
DEF_HELPER(uint64_t, helper_ctpop, (uint64_t))
 | 
					DEF_HELPER(uint64_t, helper_ctpop, (uint64_t))
 | 
				
			||||||
DEF_HELPER(uint64_t, helper_ctlz, (uint64_t))
 | 
					DEF_HELPER(uint64_t, helper_ctlz, (uint64_t))
 | 
				
			||||||
DEF_HELPER(uint64_t, helper_cttz, (uint64_t))
 | 
					DEF_HELPER(uint64_t, helper_cttz, (uint64_t))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DEF_HELPER(uint64_t, helper_mskbl, (int64_t, uint64_t))
 | 
				
			||||||
 | 
					DEF_HELPER(uint64_t, helper_insbl, (int64_t, uint64_t))
 | 
				
			||||||
 | 
					DEF_HELPER(uint64_t, helper_mskwl, (int64_t, uint64_t))
 | 
				
			||||||
 | 
					DEF_HELPER(uint64_t, helper_inswl, (int64_t, uint64_t))
 | 
				
			||||||
 | 
					DEF_HELPER(uint64_t, helper_mskll, (int64_t, uint64_t))
 | 
				
			||||||
 | 
					DEF_HELPER(uint64_t, helper_insll, (int64_t, uint64_t))
 | 
				
			||||||
 | 
					DEF_HELPER(uint64_t, helper_zap, (int64_t, uint64_t))
 | 
				
			||||||
 | 
					DEF_HELPER(uint64_t, helper_zapnot, (int64_t, uint64_t))
 | 
				
			||||||
 | 
					DEF_HELPER(uint64_t, helper_mskql, (int64_t, uint64_t))
 | 
				
			||||||
 | 
					DEF_HELPER(uint64_t, helper_insql, (int64_t, uint64_t))
 | 
				
			||||||
 | 
					DEF_HELPER(uint64_t, helper_mskwh, (int64_t, uint64_t))
 | 
				
			||||||
 | 
					DEF_HELPER(uint64_t, helper_inswh, (int64_t, uint64_t))
 | 
				
			||||||
 | 
					DEF_HELPER(uint64_t, helper_msklh, (int64_t, uint64_t))
 | 
				
			||||||
 | 
					DEF_HELPER(uint64_t, helper_inslh, (int64_t, uint64_t))
 | 
				
			||||||
 | 
					DEF_HELPER(uint64_t, helper_mskqh, (int64_t, uint64_t))
 | 
				
			||||||
 | 
					DEF_HELPER(uint64_t, helper_insqh, (int64_t, uint64_t))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -243,145 +243,6 @@ void OPPROTO op_umulh (void)
 | 
				
			|||||||
    RETURN();
 | 
					    RETURN();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Logical */
 | 
					 | 
				
			||||||
void OPPROTO op_mskbl (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_mskbl();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_extbl (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_extbl();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_insbl (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_insbl();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_mskwl (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_mskwl();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_extwl (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_extwl();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_inswl (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_inswl();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_mskll (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_mskll();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_extll (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_extll();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_insll (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_insll();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_zap (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_zap();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_zapnot (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_zapnot();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_mskql (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_mskql();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_extql (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_extql();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_insql (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_insql();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_mskwh (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_mskwh();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_inswh (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_inswh();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_extwh (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_extwh();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_msklh (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_msklh();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_inslh (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_inslh();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_extlh (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_extlh();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_mskqh (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_mskqh();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_insqh (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_insqh();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void OPPROTO op_extqh (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    helper_extqh();
 | 
					 | 
				
			||||||
    RETURN();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Tests */
 | 
					/* Tests */
 | 
				
			||||||
void OPPROTO op_cmpult (void)
 | 
					void OPPROTO op_cmpult (void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -243,133 +243,91 @@ static always_inline uint64_t byte_zap (uint64_t op, uint8_t mskb)
 | 
				
			|||||||
    return op & ~mask;
 | 
					    return op & ~mask;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_mskbl (void)
 | 
					uint64_t helper_mskbl(uint64_t val, uint64_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    T0 = byte_zap(T0, 0x01 << (T1 & 7));
 | 
					    return byte_zap(val, 0x01 << (mask & 7));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_extbl (void)
 | 
					uint64_t helper_insbl(uint64_t val, uint64_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    T0 >>= (T1 & 7) * 8;
 | 
					    val <<= (mask & 7) * 8;
 | 
				
			||||||
    T0 = byte_zap(T0, 0xFE);
 | 
					    return byte_zap(val, ~(0x01 << (mask & 7)));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_insbl (void)
 | 
					uint64_t helper_mskwl(uint64_t val, uint64_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    T0 <<= (T1 & 7) * 8;
 | 
					    return byte_zap(val, 0x03 << (mask & 7));
 | 
				
			||||||
    T0 = byte_zap(T0, ~(0x01 << (T1 & 7)));
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_mskwl (void)
 | 
					uint64_t helper_inswl(uint64_t val, uint64_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    T0 = byte_zap(T0, 0x03 << (T1 & 7));
 | 
					    val <<= (mask & 7) * 8;
 | 
				
			||||||
 | 
					    return byte_zap(val, ~(0x03 << (mask & 7)));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_extwl (void)
 | 
					uint64_t helper_mskll(uint64_t val, uint64_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    T0 >>= (T1 & 7) * 8;
 | 
					    return byte_zap(val, 0x0F << (mask & 7));
 | 
				
			||||||
    T0 = byte_zap(T0, 0xFC);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_inswl (void)
 | 
					uint64_t helper_insll(uint64_t val, uint64_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    T0 <<= (T1 & 7) * 8;
 | 
					    val <<= (mask & 7) * 8;
 | 
				
			||||||
    T0 = byte_zap(T0, ~(0x03 << (T1 & 7)));
 | 
					    return byte_zap(val, ~(0x0F << (mask & 7)));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_mskll (void)
 | 
					uint64_t helper_zap(uint64_t val, uint64_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    T0 = byte_zap(T0, 0x0F << (T1 & 7));
 | 
					    return byte_zap(val, mask);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_extll (void)
 | 
					uint64_t helper_zapnot(uint64_t val, uint64_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    T0 >>= (T1 & 7) * 8;
 | 
					    return byte_zap(val, ~mask);
 | 
				
			||||||
    T0 = byte_zap(T0, 0xF0);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_insll (void)
 | 
					uint64_t helper_mskql(uint64_t val, uint64_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    T0 <<= (T1 & 7) * 8;
 | 
					    return byte_zap(val, 0xFF << (mask & 7));
 | 
				
			||||||
    T0 = byte_zap(T0, ~(0x0F << (T1 & 7)));
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_zap (void)
 | 
					uint64_t helper_insql(uint64_t val, uint64_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    T0 = byte_zap(T0, T1);
 | 
					    val <<= (mask & 7) * 8;
 | 
				
			||||||
 | 
					    return byte_zap(val, ~(0xFF << (mask & 7)));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_zapnot (void)
 | 
					uint64_t helper_mskwh(uint64_t val, uint64_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    T0 = byte_zap(T0, ~T1);
 | 
					    return byte_zap(val, (0x03 << (mask & 7)) >> 8);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_mskql (void)
 | 
					uint64_t helper_inswh(uint64_t val, uint64_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    T0 = byte_zap(T0, 0xFF << (T1 & 7));
 | 
					    val >>= 64 - ((mask & 7) * 8);
 | 
				
			||||||
 | 
					    return byte_zap(val, ~((0x03 << (mask & 7)) >> 8));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_extql (void)
 | 
					uint64_t helper_msklh(uint64_t val, uint64_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    T0 >>= (T1 & 7) * 8;
 | 
					    return byte_zap(val, (0x0F << (mask & 7)) >> 8);
 | 
				
			||||||
    T0 = byte_zap(T0, 0x00);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_insql (void)
 | 
					uint64_t helper_inslh(uint64_t val, uint64_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    T0 <<= (T1 & 7) * 8;
 | 
					    val >>= 64 - ((mask & 7) * 8);
 | 
				
			||||||
    T0 = byte_zap(T0, ~(0xFF << (T1 & 7)));
 | 
					    return byte_zap(val, ~((0x0F << (mask & 7)) >> 8));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_mskwh (void)
 | 
					uint64_t helper_mskqh(uint64_t val, uint64_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    T0 = byte_zap(T0, (0x03 << (T1 & 7)) >> 8);
 | 
					    return byte_zap(val, (0xFF << (mask & 7)) >> 8);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_inswh (void)
 | 
					uint64_t helper_insqh(uint64_t val, uint64_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    T0 >>= 64 - ((T1 & 7) * 8);
 | 
					    val >>= 64 - ((mask & 7) * 8);
 | 
				
			||||||
    T0 = byte_zap(T0, ~((0x03 << (T1 & 7)) >> 8));
 | 
					    return byte_zap(val, ~((0xFF << (mask & 7)) >> 8));
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void helper_extwh (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    T0 <<= 64 - ((T1 & 7) * 8);
 | 
					 | 
				
			||||||
    T0 = byte_zap(T0, ~0x07);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void helper_msklh (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    T0 = byte_zap(T0, (0x0F << (T1 & 7)) >> 8);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void helper_inslh (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    T0 >>= 64 - ((T1 & 7) * 8);
 | 
					 | 
				
			||||||
    T0 = byte_zap(T0, ~((0x0F << (T1 & 7)) >> 8));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void helper_extlh (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    T0 <<= 64 - ((T1 & 7) * 8);
 | 
					 | 
				
			||||||
    T0 = byte_zap(T0, ~0x0F);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void helper_mskqh (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    T0 = byte_zap(T0, (0xFF << (T1 & 7)) >> 8);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void helper_insqh (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    T0 >>= 64 - ((T1 & 7) * 8);
 | 
					 | 
				
			||||||
    T0 = byte_zap(T0, ~((0xFF << (T1 & 7)) >> 8));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void helper_extqh (void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    T0 <<= 64 - ((T1 & 7) * 8);
 | 
					 | 
				
			||||||
    T0 = byte_zap(T0, 0x00);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void helper_cmpbge (void)
 | 
					void helper_cmpbge (void)
 | 
				
			||||||
 | 
				
			|||||||
@ -33,29 +33,6 @@ void helper_subqv (void);
 | 
				
			|||||||
void helper_sublv (void);
 | 
					void helper_sublv (void);
 | 
				
			||||||
void helper_mullv (void);
 | 
					void helper_mullv (void);
 | 
				
			||||||
void helper_mulqv (void);
 | 
					void helper_mulqv (void);
 | 
				
			||||||
void helper_mskbl (void);
 | 
					 | 
				
			||||||
void helper_extbl (void);
 | 
					 | 
				
			||||||
void helper_insbl (void);
 | 
					 | 
				
			||||||
void helper_mskwl (void);
 | 
					 | 
				
			||||||
void helper_extwl (void);
 | 
					 | 
				
			||||||
void helper_inswl (void);
 | 
					 | 
				
			||||||
void helper_mskll (void);
 | 
					 | 
				
			||||||
void helper_extll (void);
 | 
					 | 
				
			||||||
void helper_insll (void);
 | 
					 | 
				
			||||||
void helper_zap (void);
 | 
					 | 
				
			||||||
void helper_zapnot (void);
 | 
					 | 
				
			||||||
void helper_mskql (void);
 | 
					 | 
				
			||||||
void helper_extql (void);
 | 
					 | 
				
			||||||
void helper_insql (void);
 | 
					 | 
				
			||||||
void helper_mskwh (void);
 | 
					 | 
				
			||||||
void helper_inswh (void);
 | 
					 | 
				
			||||||
void helper_extwh (void);
 | 
					 | 
				
			||||||
void helper_msklh (void);
 | 
					 | 
				
			||||||
void helper_inslh (void);
 | 
					 | 
				
			||||||
void helper_extlh (void);
 | 
					 | 
				
			||||||
void helper_mskqh (void);
 | 
					 | 
				
			||||||
void helper_insqh (void);
 | 
					 | 
				
			||||||
void helper_extqh (void);
 | 
					 | 
				
			||||||
void helper_cmpbge (void);
 | 
					void helper_cmpbge (void);
 | 
				
			||||||
void helper_cmov_fir (int freg);
 | 
					void helper_cmov_fir (int freg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -468,6 +468,93 @@ static always_inline void gen_itf (DisasContext *ctx,
 | 
				
			|||||||
    gen_store_fir(ctx, rc, 0);
 | 
					    gen_store_fir(ctx, rc, 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* EXTWH, EXTWH, EXTLH, EXTQH */
 | 
				
			||||||
 | 
					static always_inline void gen_ext_h(void (*tcg_gen_ext_i64)(TCGv t0, TCGv t1),
 | 
				
			||||||
 | 
					                                    int ra, int rb, int rc,
 | 
				
			||||||
 | 
					                                    int islit, int8_t lit)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (unlikely(rc == 31))
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (ra != 31) {
 | 
				
			||||||
 | 
					        if (islit)
 | 
				
			||||||
 | 
					            tcg_gen_shli_i64(cpu_ir[rc], cpu_ir[ra], 64 - ((lit & 7) * 8));
 | 
				
			||||||
 | 
					        else if (rb != 31) {
 | 
				
			||||||
 | 
					            TCGv tmp1, tmp2;
 | 
				
			||||||
 | 
					            tmp1 = tcg_temp_new(TCG_TYPE_I64);
 | 
				
			||||||
 | 
					            tcg_gen_andi_i64(tmp1, cpu_ir[rb], 7);
 | 
				
			||||||
 | 
					            tcg_gen_shli_i64(tmp1, tmp1, 3);
 | 
				
			||||||
 | 
					            tmp2 = tcg_const_i64(64);
 | 
				
			||||||
 | 
					            tcg_gen_sub_i64(tmp1, tmp2, tmp1);
 | 
				
			||||||
 | 
					            tcg_temp_free(tmp2);
 | 
				
			||||||
 | 
					            if (tcg_gen_ext_i64) {
 | 
				
			||||||
 | 
					                tcg_gen_shl_i64(tmp1, cpu_ir[ra], tmp1);
 | 
				
			||||||
 | 
					                tcg_gen_ext_i64(cpu_ir[rc], tmp1);
 | 
				
			||||||
 | 
					            } else
 | 
				
			||||||
 | 
					                tcg_gen_shl_i64(cpu_ir[rc], cpu_ir[ra], tmp1);
 | 
				
			||||||
 | 
					            tcg_temp_free(tmp1);
 | 
				
			||||||
 | 
					        } else
 | 
				
			||||||
 | 
					            tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[ra]);
 | 
				
			||||||
 | 
					    } else
 | 
				
			||||||
 | 
					        tcg_gen_movi_i64(cpu_ir[rc], 0);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* EXTBL, EXTWL, EXTWL, EXTLL, EXTQL */
 | 
				
			||||||
 | 
					static always_inline void gen_ext_l(void (*tcg_gen_ext_i64)(TCGv t0, TCGv t1),
 | 
				
			||||||
 | 
					                                    int ra, int rb, int rc,
 | 
				
			||||||
 | 
					                                    int islit, int8_t lit)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (unlikely(rc == 31))
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (ra != 31) {
 | 
				
			||||||
 | 
					        if (islit)
 | 
				
			||||||
 | 
					            tcg_gen_shri_i64(cpu_ir[rc], cpu_ir[ra], (lit & 7) * 8);
 | 
				
			||||||
 | 
					        else if (rb != 31) {
 | 
				
			||||||
 | 
					            TCGv tmp = tcg_temp_new(TCG_TYPE_I64);
 | 
				
			||||||
 | 
					            tcg_gen_andi_i64(tmp, cpu_ir[rb], 7);
 | 
				
			||||||
 | 
					            tcg_gen_shli_i64(tmp, tmp, 3);
 | 
				
			||||||
 | 
					            if (tcg_gen_ext_i64) {
 | 
				
			||||||
 | 
					                tcg_gen_shr_i64(tmp, cpu_ir[ra], tmp);
 | 
				
			||||||
 | 
					                tcg_gen_ext_i64(cpu_ir[rc], tmp);
 | 
				
			||||||
 | 
					            } else
 | 
				
			||||||
 | 
					                tcg_gen_shr_i64(cpu_ir[rc], cpu_ir[ra], tmp);
 | 
				
			||||||
 | 
					            tcg_temp_free(tmp);
 | 
				
			||||||
 | 
					        } else
 | 
				
			||||||
 | 
					            tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[ra]);
 | 
				
			||||||
 | 
					    } else
 | 
				
			||||||
 | 
					        tcg_gen_movi_i64(cpu_ir[rc], 0);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Code to call byte manipulation helpers, used by:
 | 
				
			||||||
 | 
					   INSWH, INSLH, INSQH, INSBL, INSWL, INSLL, INSQL,
 | 
				
			||||||
 | 
					   MSKWH, MSKLH, MSKQH, MSKBL, MSKWL, MSKLL, MSKQL,
 | 
				
			||||||
 | 
					   ZAP, ZAPNOT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   WARNING: it assumes that when ra31 is used, the result is 0.
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					static always_inline void gen_byte_manipulation(void *helper,
 | 
				
			||||||
 | 
					                                                int ra, int rb, int rc,
 | 
				
			||||||
 | 
					                                                int islit, uint8_t lit)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (unlikely(rc == 31))
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (ra != 31) {
 | 
				
			||||||
 | 
					        if (islit || rb == 31) {
 | 
				
			||||||
 | 
					            TCGv tmp = tcg_temp_new(TCG_TYPE_I64);
 | 
				
			||||||
 | 
					            if (islit)
 | 
				
			||||||
 | 
					                tcg_gen_movi_i64(tmp, lit);
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					                tcg_gen_movi_i64(tmp, 0);
 | 
				
			||||||
 | 
					            tcg_gen_helper_1_2(helper, cpu_ir[rc], cpu_ir[ra], tmp);
 | 
				
			||||||
 | 
					            tcg_temp_free(tmp);
 | 
				
			||||||
 | 
					        } else
 | 
				
			||||||
 | 
					            tcg_gen_helper_1_2(helper, cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]);
 | 
				
			||||||
 | 
					    } else
 | 
				
			||||||
 | 
					        tcg_gen_movi_i64(cpu_ir[rc], 0);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static always_inline int translate_one (DisasContext *ctx, uint32_t insn)
 | 
					static always_inline int translate_one (DisasContext *ctx, uint32_t insn)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    uint32_t palcode;
 | 
					    uint32_t palcode;
 | 
				
			||||||
@ -1101,51 +1188,51 @@ static always_inline int translate_one (DisasContext *ctx, uint32_t insn)
 | 
				
			|||||||
        switch (fn7) {
 | 
					        switch (fn7) {
 | 
				
			||||||
        case 0x02:
 | 
					        case 0x02:
 | 
				
			||||||
            /* MSKBL */
 | 
					            /* MSKBL */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_mskbl, ra, rb, rc, islit, lit);
 | 
					            gen_byte_manipulation(helper_mskbl, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x06:
 | 
					        case 0x06:
 | 
				
			||||||
            /* EXTBL */
 | 
					            /* EXTBL */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_extbl, ra, rb, rc, islit, lit);
 | 
					            gen_ext_l(&tcg_gen_ext8u_i64, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x0B:
 | 
					        case 0x0B:
 | 
				
			||||||
            /* INSBL */
 | 
					            /* INSBL */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_insbl, ra, rb, rc, islit, lit);
 | 
					            gen_byte_manipulation(helper_insbl, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x12:
 | 
					        case 0x12:
 | 
				
			||||||
            /* MSKWL */
 | 
					            /* MSKWL */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_mskwl, ra, rb, rc, islit, lit);
 | 
					            gen_byte_manipulation(helper_mskwl, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x16:
 | 
					        case 0x16:
 | 
				
			||||||
            /* EXTWL */
 | 
					            /* EXTWL */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_extwl, ra, rb, rc, islit, lit);
 | 
					            gen_ext_l(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x1B:
 | 
					        case 0x1B:
 | 
				
			||||||
            /* INSWL */
 | 
					            /* INSWL */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_inswl, ra, rb, rc, islit, lit);
 | 
					            gen_byte_manipulation(helper_inswl, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x22:
 | 
					        case 0x22:
 | 
				
			||||||
            /* MSKLL */
 | 
					            /* MSKLL */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_mskll, ra, rb, rc, islit, lit);
 | 
					            gen_byte_manipulation(helper_mskll, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x26:
 | 
					        case 0x26:
 | 
				
			||||||
            /* EXTLL */
 | 
					            /* EXTLL */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_extll, ra, rb, rc, islit, lit);
 | 
					            gen_ext_l(&tcg_gen_ext32u_i64, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x2B:
 | 
					        case 0x2B:
 | 
				
			||||||
            /* INSLL */
 | 
					            /* INSLL */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_insll, ra, rb, rc, islit, lit);
 | 
					            gen_byte_manipulation(helper_insll, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x30:
 | 
					        case 0x30:
 | 
				
			||||||
            /* ZAP */
 | 
					            /* ZAP */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_zap, ra, rb, rc, islit, lit);
 | 
					            gen_byte_manipulation(helper_zap, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x31:
 | 
					        case 0x31:
 | 
				
			||||||
            /* ZAPNOT */
 | 
					            /* ZAPNOT */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_zapnot, ra, rb, rc, islit, lit);
 | 
					            gen_byte_manipulation(helper_zapnot, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x32:
 | 
					        case 0x32:
 | 
				
			||||||
            /* MSKQL */
 | 
					            /* MSKQL */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_mskql, ra, rb, rc, islit, lit);
 | 
					            gen_byte_manipulation(helper_mskql, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x34:
 | 
					        case 0x34:
 | 
				
			||||||
            /* SRL */
 | 
					            /* SRL */
 | 
				
			||||||
@ -1166,7 +1253,7 @@ static always_inline int translate_one (DisasContext *ctx, uint32_t insn)
 | 
				
			|||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x36:
 | 
					        case 0x36:
 | 
				
			||||||
            /* EXTQL */
 | 
					            /* EXTQL */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_extql, ra, rb, rc, islit, lit);
 | 
					            gen_ext_l(NULL, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x39:
 | 
					        case 0x39:
 | 
				
			||||||
            /* SLL */
 | 
					            /* SLL */
 | 
				
			||||||
@ -1187,7 +1274,7 @@ static always_inline int translate_one (DisasContext *ctx, uint32_t insn)
 | 
				
			|||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x3B:
 | 
					        case 0x3B:
 | 
				
			||||||
            /* INSQL */
 | 
					            /* INSQL */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_insql, ra, rb, rc, islit, lit);
 | 
					            gen_byte_manipulation(helper_insql, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x3C:
 | 
					        case 0x3C:
 | 
				
			||||||
            /* SRA */
 | 
					            /* SRA */
 | 
				
			||||||
@ -1208,39 +1295,39 @@ static always_inline int translate_one (DisasContext *ctx, uint32_t insn)
 | 
				
			|||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x52:
 | 
					        case 0x52:
 | 
				
			||||||
            /* MSKWH */
 | 
					            /* MSKWH */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_mskwh, ra, rb, rc, islit, lit);
 | 
					            gen_byte_manipulation(helper_mskwh, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x57:
 | 
					        case 0x57:
 | 
				
			||||||
            /* INSWH */
 | 
					            /* INSWH */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_inswh, ra, rb, rc, islit, lit);
 | 
					            gen_byte_manipulation(helper_inswh, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x5A:
 | 
					        case 0x5A:
 | 
				
			||||||
            /* EXTWH */
 | 
					            /* EXTWH */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_extwh, ra, rb, rc, islit, lit);
 | 
					            gen_ext_h(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x62:
 | 
					        case 0x62:
 | 
				
			||||||
            /* MSKLH */
 | 
					            /* MSKLH */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_msklh, ra, rb, rc, islit, lit);
 | 
					            gen_byte_manipulation(helper_msklh, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x67:
 | 
					        case 0x67:
 | 
				
			||||||
            /* INSLH */
 | 
					            /* INSLH */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_inslh, ra, rb, rc, islit, lit);
 | 
					            gen_byte_manipulation(helper_inslh, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x6A:
 | 
					        case 0x6A:
 | 
				
			||||||
            /* EXTLH */
 | 
					            /* EXTLH */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_extlh, ra, rb, rc, islit, lit);
 | 
					            gen_ext_h(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x72:
 | 
					        case 0x72:
 | 
				
			||||||
            /* MSKQH */
 | 
					            /* MSKQH */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_mskqh, ra, rb, rc, islit, lit);
 | 
					            gen_byte_manipulation(helper_mskqh, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x77:
 | 
					        case 0x77:
 | 
				
			||||||
            /* INSQH */
 | 
					            /* INSQH */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_insqh, ra, rb, rc, islit, lit);
 | 
					            gen_byte_manipulation(helper_insqh, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 0x7A:
 | 
					        case 0x7A:
 | 
				
			||||||
            /* EXTQH */
 | 
					            /* EXTQH */
 | 
				
			||||||
            gen_arith3(ctx, &gen_op_extqh, ra, rb, rc, islit, lit);
 | 
					            gen_ext_h(NULL, ra, rb, rc, islit, lit);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        default:
 | 
					        default:
 | 
				
			||||||
            goto invalid_opc;
 | 
					            goto invalid_opc;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user