target-tilegx: Implement v2sh* instructions
PATCH v2 1/1 target-tilegx: Implement v2sh* instructions
From: Chen Gang <[email protected]>
It is just according to v1sh* instructions implementation.
--- target-tilegx/translate.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
target-tilegx/translate.c +17 -1
@@ -1686,11 +1686,27 @@ static TileExcp gen_rri_opcode(DisasContext *dc, unsigned opext,break ;case OE_SH (V2SHLI ,X0 ):case OE_SH (V2SHLI ,X1 ): + i2 = imm &15 ; + i3 =0xffff >> i2; +tcg_gen_andi_tl (tdest, tsrca,V2_IMM (i3)); +tcg_gen_shli_tl (tdest, tdest, i2); + mnemonic ="v2shli" ; +break ;case OE_SH (V2SHRSI ,X0 ):case OE_SH (V2SHRSI ,X1 ): + t0 =tcg_const_tl (imm &15 ); +gen_helper_v2shrs (tdest, tsrca, t0); +tcg_temp_free (t0); + mnemonic ="v2shrsi" ; +break ;case OE_SH (V2SHRUI ,X0 ):case OE_SH (V2SHRUI ,X1 ): -return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ; + i2 = imm &15 ; + i3 = (0xffff << i2) &0xffff ; +tcg_gen_andi_tl (tdest, tsrca,V2_IMM (i3)); +tcg_gen_shri_tl (tdest, tdest, i2); + mnemonic ="v2shrui" ; +break ;case OE (ADDLI_OPCODE_X0 ,0 ,X0 ):case OE (ADDLI_OPCODE_X1 ,0 ,X1 ):
Signature · 1 line
1.9.3
PATCH v2 1/1 target-tilegx: Implement v?int_* instructions.
From: Chen Gang <[email protected]>
--- target-tilegx/helper.h | 5 ++++ target-tilegx/simd_helper.c | 56 +++++++++++++++++++++++++++++++++++++++++++++ target-tilegx/translate.c | 14 ++++++++++++ 3 files changed, 75 insertions(+)
target-tilegx/helper.h +5 -0
@@ -10,6 +10,11 @@ DEF_HELPER_FLAGS_3(cmula, TCG_CALL_NO_RWG_SE, i64, i64, i64, i64) DEF_HELPER_FLAGS_3(cmulaf, TCG_CALL_NO_RWG_SE, i64, i64, i64, i64) DEF_HELPER_FLAGS_4(cmul2, TCG_CALL_NO_RWG_SE, i64, i64, i64, int, int) +DEF_HELPER_FLAGS_2(v1int_h, TCG_CALL_NO_RWG_SE, i64, i64, i64) +DEF_HELPER_FLAGS_2(v1int_l, TCG_CALL_NO_RWG_SE, i64, i64, i64) +DEF_HELPER_FLAGS_2(v2int_h, TCG_CALL_NO_RWG_SE, i64, i64, i64) +DEF_HELPER_FLAGS_2(v2int_l, TCG_CALL_NO_RWG_SE, i64, i64, i64) + DEF_HELPER_FLAGS_2(v1multu, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(v1shl, TCG_CALL_NO_RWG_SE, i64, i64, i64)DEF_HELPER_FLAGS_2 (v1shru,TCG_CALL_NO_RWG_SE , i64, i64, i64)
target-tilegx/simd_helper.c +56 -0
59 lines not on this page · raw message
target-tilegx/translate.c +14 -0
@@ -1260,10 +1260,17 @@ static TileExcp gen_rrr_opcode(DisasContext *dc, unsigned opext,case OE_RRR (V1DOTPUS ,0 ,X0 ):case OE_RRR (V1DOTPU ,0 ,X0 ):case OE_RRR (V1DOTP ,0 ,X0 ): +return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ;case OE_RRR (V1INT_H ,0 ,X0 ):case OE_RRR (V1INT_H ,0 ,X1 ): +gen_helper_v1int_h (tdest, tsrca, tsrcb); + mnemonic ="v1int_h" ; +break ;case OE_RRR (V1INT_L ,0 ,X0 ):case OE_RRR (V1INT_L ,0 ,X1 ): +gen_helper_v1int_l (tdest, tsrca, tsrcb); + mnemonic ="v1int_l" ; +break ;case OE_RRR (V1MAXU ,0 ,X0 ):case OE_RRR (V1MAXU ,0 ,X1 ):case OE_RRR (V1MINU ,0 ,X0 ):
@@ -1329,10 +1336,17 @@ static TileExcp gen_rrr_opcode(DisasContext *dc, unsigned opext,case OE_RRR (V2CMPNE ,0 ,X1 ):case OE_RRR (V2DOTPA ,0 ,X0 ):case OE_RRR (V2DOTP ,0 ,X0 ): +return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ;case OE_RRR (V2INT_H ,0 ,X0 ):case OE_RRR (V2INT_H ,0 ,X1 ): +gen_helper_v2int_h (tdest, tsrca, tsrcb); + mnemonic ="v2int_h" ; +break ;case OE_RRR (V2INT_L ,0 ,X0 ):case OE_RRR (V2INT_L ,0 ,X1 ): +gen_helper_v2int_l (tdest, tsrca, tsrcb); + mnemonic ="v2int_l" ; +break ;case OE_RRR (V2MAXS ,0 ,X0 ):case OE_RRR (V2MAXS ,0 ,X1 ):case OE_RRR (V2MINS ,0 ,X0 ):
Signature · 1 line
1.9.3
PATCH v2 1/1 target-tilegx: Use TILEGX_EXCP_OPCODE_UNKNOWN and TILEGX_EXCP_OPCODE_UNIMPLEMENTED correctly
In reply to [email protected]From: Chen Gang <[email protected]>
For some cases, they are for TILEGX_EXCP_OPCODE_UNKNOWN, not for TILEGX_EXCP_OPCODE_UNIMPLEMENTED.
Also for some cases, they are for TILEGX_EXCP_OPCODE_UNIMPLEMENTED, not for TILEGX_EXCP_OPCODE_UNKNOWN.
When analyzing issues, the correct printing information is necessary, e.g. grep UIMP in gcc testsuite output log for finding qemu tilegx umimplementation issues, grep UNKNOWN for finding unknown instructions.
--- target-tilegx/translate.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-)
target-tilegx/translate.c +24 -17
@@ -291,7 +291,7 @@ static TileExcp gen_st_opcode(DisasContext *dc, unsigned dest, unsigned srca, unsigned srcb, TCGMemOp memop, const char *name) { if (dest) { - return TILEGX_EXCP_OPCODE_UNIMPLEMENTED; + return TILEGX_EXCP_OPCODE_UNKNOWN; } tcg_gen_qemu_st_tl(load_gr(dc, srcb), load_gr(dc, srca),
@@ -538,7 +538,7 @@ static TileExcp gen_rr_opcode(DisasContext *dc, unsigned opext, mnemonic ="swint1" ; done0:if (srca || dest) { -return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ; +return TILEGX_EXCP_OPCODE_UNKNOWN ; }qemu_log_mask (CPU_LOG_TB_IN_ASM ,"%s" , mnemonic);return ret;
@@ -584,7 +584,7 @@ static TileExcp gen_rr_opcode(DisasContext *dc, unsigned opext,tcg_gen_andi_tl (dc->jmp.dest,load_gr (dc, srca), ~7 ); done1:if (dest) { -return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ; +return TILEGX_EXCP_OPCODE_UNKNOWN ; }qemu_log_mask (CPU_LOG_TB_IN_ASM ,"%s %s" , mnemonic, reg_names[srca]);return ret;
@@ -679,7 +679,7 @@ static TileExcp gen_rr_opcode(DisasContext *dc, unsigned opext,case OE_RR_X1 (LNK ):case OE_RR_Y1 (LNK ):if (srca) { -return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ; +return TILEGX_EXCP_OPCODE_UNKNOWN ; }tcg_gen_movi_tl (tdest, dc->pc +TILEGX_BUNDLE_SIZE_IN_BYTES ); mnemonic ="lnk" ;
@@ -723,7 +723,7 @@ static TileExcp gen_rr_opcode(DisasContext *dc, unsigned opext, mnemonic ="tblidxb3" ;break ;default : -return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ; +return TILEGX_EXCP_OPCODE_UNKNOWN ; } qemu_log_mask(CPU_LOG_TB_IN_ASM, "%s %s, %s", mnemonic,
@@ -1453,7 +1453,7 @@ static TileExcp gen_rrr_opcode(DisasContext *dc, unsigned opext, mnemonic ="xor" ;break ;default : -return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ; +return TILEGX_EXCP_OPCODE_UNKNOWN ; } qemu_log_mask(CPU_LOG_TB_IN_ASM, "%s %s, %s, %s", mnemonic,
@@ -1745,7 +1745,7 @@ static TileExcp gen_rri_opcode(DisasContext *dc, unsigned opext,break ;default : -return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ; +return TILEGX_EXCP_OPCODE_UNKNOWN ; } qemu_log_mask(CPU_LOG_TB_IN_ASM, "%s %s, %s, %d", mnemonic,
@@ -1839,7 +1839,7 @@ static TileExcp gen_bf_opcode_x0(DisasContext *dc, unsigned ext,break ;default : -return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ; +return TILEGX_EXCP_OPCODE_UNKNOWN ; } qemu_log_mask(CPU_LOG_TB_IN_ASM, "%s %s, %s, %u, %u", mnemonic,
@@ -1895,7 +1895,7 @@ static TileExcp gen_branch_opcode_x1(DisasContext *dc, unsigned ext, mnemonic ="blbs" ;break ;default : -return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ; +return TILEGX_EXCP_OPCODE_UNKNOWN ; }if (qemu_loglevel_mask (CPU_LOG_TB_IN_ASM )) {
@@ -1962,7 +1962,7 @@ static TileExcp gen_mtspr_x1(DisasContext *dc, unsigned spr, unsigned srca)if (def ==NULL ) {qemu_log_mask (CPU_LOG_TB_IN_ASM ,"mtspr spr[%u], %s" , spr, reg_names[srca]); -return TILEGX_EXCP_OPCODE_UNKNOWN ; +return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ; } tsrca =load_gr (dc, srca);
@@ -1982,7 +1982,7 @@ static TileExcp gen_mfspr_x1(DisasContext *dc, unsigned dest, unsigned spr)if (def ==NULL ) {qemu_log_mask (CPU_LOG_TB_IN_ASM ,"mtspr %s, spr[%u]" , reg_names[dest], spr); -return TILEGX_EXCP_OPCODE_UNKNOWN ; +return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ; } tdest =dest_gr (dc, dest);
@@ -2037,7 +2037,7 @@ static TileExcp decode_y0(DisasContext *dc, tilegx_bundle_bits bundle)return gen_rri_opcode (dc,OE (opc,0 ,Y0 ), dest, srca, imm);default : -return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ; +return TILEGX_EXCP_OPCODE_UNKNOWN ; } }
@@ -2081,7 +2081,7 @@ static TileExcp decode_y1(DisasContext *dc, tilegx_bundle_bits bundle)return gen_rri_opcode (dc,OE (opc,0 ,Y1 ), dest, srca, imm);default : -return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ; +return TILEGX_EXCP_OPCODE_UNKNOWN ; } }
@@ -2139,7 +2139,7 @@ static TileExcp decode_y2(DisasContext *dc, tilegx_bundle_bits bundle)return gen_st_opcode (dc,0 , srca, srcbdest,MO_TEQ ,"st" );default : -return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ; +return TILEGX_EXCP_OPCODE_UNKNOWN ; } }
@@ -2184,7 +2184,7 @@ static TileExcp decode_x0(DisasContext *dc, tilegx_bundle_bits bundle)return gen_rri_opcode (dc,OE (opc,0 ,X0 ), dest, srca, imm);default : -return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ; +return TILEGX_EXCP_OPCODE_UNKNOWN ; } }
@@ -2274,7 +2274,7 @@ static TileExcp decode_x1(DisasContext *dc, tilegx_bundle_bits bundle)return gen_rri_opcode (dc,OE (opc,0 ,X1 ), dest, srca, imm);default : -return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ; +return TILEGX_EXCP_OPCODE_UNKNOWN ; } }
@@ -2285,8 +2285,15 @@ static void notice_excp(DisasContext *dc, uint64_t bundle,return ; }gen_exception (dc, excp); -if (excp ==TILEGX_EXCP_OPCODE_UNIMPLEMENTED ) { +switch (excp) { +case TILEGX_EXCP_OPCODE_UNIMPLEMENTED :qemu_log_mask (LOG_UNIMP ,"UNIMP %s, [" FMT64X "]\n" , type, bundle); +break ; +case TILEGX_EXCP_OPCODE_UNKNOWN : +qemu_log_mask (LOG_UNIMP ,"UNKNOWN %s, [" FMT64X "]\n" , type, bundle); +break ; +default : +break ; } }
Signature · 1 line
1.9.3
PATCH v2 1/1 target-tilegx: Implement v2mults instruction
In reply to [email protected]From: Chen Gang <[email protected]>
Just according to v1multu instruction implementation.
--- target-tilegx/helper.h | 1 + target-tilegx/simd_helper.c | 13 +++++++++++++ target-tilegx/translate.c | 4 ++++ 3 files changed, 18 insertions(+)
target-tilegx/helper.h +1 -0
@@ -16,6 +16,7 @@ DEF_HELPER_FLAGS_2(v2int_h, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(v2int_l, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(v1multu, TCG_CALL_NO_RWG_SE, i64, i64, i64) +DEF_HELPER_FLAGS_2(v2mults, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(v1shl, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(v1shru, TCG_CALL_NO_RWG_SE, i64, i64, i64)DEF_HELPER_FLAGS_2 (v1shrs,TCG_CALL_NO_RWG_SE , i64, i64, i64)
target-tilegx/simd_helper.c +13 -0
@@ -41,6 +41,19 @@ uint64_t helper_v1multu(uint64_t a, uint64_t b)return r; } +uint64_t helper_v2mults (uint64_t a,uint64_t b) +{ +uint64_t r =0 ; +int i; + +for (i =0 ; i <64 ; i +=16 ) { +int64_t ae = (int16_t )(a >> i); +int64_t be = (int16_t )(b >> i); + r |= ((ae * be) &0xffff ) << i; + } +return r; +} +uint64_t helper_v1shl (uint64_t a,uint64_t b) {uint64_t m;
target-tilegx/translate.c +4 -0
@@ -1355,7 +1355,11 @@ static TileExcp gen_rrr_opcode(DisasContext *dc, unsigned opext,case OE_RRR (V2MNZ ,0 ,X1 ):case OE_RRR (V2MULFSC ,0 ,X0 ):case OE_RRR (V2MULS ,0 ,X0 ): +return TILEGX_EXCP_OPCODE_UNIMPLEMENTED ;case OE_RRR (V2MULTS ,0 ,X0 ): +gen_helper_v2mults (tdest, tsrca, tsrcb); + mnemonic ="v2mults" ; +break ;case OE_RRR (V2MZ ,0 ,X0 ):case OE_RRR (V2MZ ,0 ,X1 ):case OE_RRR (V2PACKH ,0 ,X0 ):
Signature · 1 line
1.9.3
Quoted 5 lines · On 10/04/2015 10:01 PM, [email protected] wrote:
From: Chen Gang <[email protected]>
It is just according to v1sh* instructions implementation.
Signed-off-by Chen Gang <[email protected]>
Applied all, with tweeks.
r~