tcg cleanups
cover tcg cleanups
Three of the patches improve the debugging of TCG by using enumerations where it makes sense. This avoids having to grovel through header files to figure out what a given constant refers to.
Four of the patches have previously been posted by Nathan Froyd. Since my ANDC and ORC patches were accepted on 2010-02-20, it seems silly to not complete the job with the existing compound logical operaions already defined in tcg-op.h.
One patch is required to make the uncommitted Alpha TCG port function.
r~
Richard Henderson (9):
tcg: Remove jmp opcode.
tcg: Name the opcode enumeration.
tcg: Use TCGCond where appropriate.
tcg: Change TCGType to an enumeration.
tcg: Disambiguate qemu_ld32u with 32-bit and 64-bit outputs.
tcg: Use not_i32 to implement not_i64.
tcg: Allow target-specific implementation of EQV.
tcg: Allow target-specific implementation of NAND.
tcg: Allow target-specific implementation of NOR.
tcg/README | 19 +++--- tcg/arm/tcg-target.c | 13 +--- tcg/arm/tcg-target.h | 3 + tcg/hppa/tcg-target.c | 13 +--- tcg/i386/tcg-target.c | 21 ++---- tcg/i386/tcg-target.h | 3 + tcg/mips/tcg-target.c | 21 ++---- tcg/mips/tcg-target.h | 3 + tcg/ppc/tcg-target.c | 25 ++----- tcg/ppc/tcg-target.h | 3 + tcg/ppc64/tcg-target.c | 21 ++---- tcg/ppc64/tcg-target.h | 6 ++ tcg/s390/tcg-target.c | 2 +- tcg/s390/tcg-target.h | 6 ++ tcg/sparc/tcg-target.c | 22 ++++--- tcg/sparc/tcg-target.h | 6 ++ tcg/tcg-op.h | 164 ++++++++++++++++++++++++++++------------------- tcg/tcg-opc.h | 24 ++++++- tcg/tcg.c | 33 +++++++--- tcg/tcg.h | 25 ++++--- tcg/x86_64/tcg-target.c | 16 ++--- tcg/x86_64/tcg-target.h | 6 ++ 22 files changed, 258 insertions(+), 197 deletions(-)
PATCH 1/9 tcg: Remove jmp opcode.
This opcode is unused. It was incorrectly implemented on at least one host. Just remove it.
--- tcg/README | 7 +------ tcg/arm/tcg-target.c | 7 ------- tcg/hppa/tcg-target.c | 5 ----- tcg/i386/tcg-target.c | 9 --------- tcg/mips/tcg-target.c | 5 ----- tcg/ppc/tcg-target.c | 10 ---------- tcg/ppc64/tcg-target.c | 10 ---------- tcg/sparc/tcg-target.c | 2 -- tcg/tcg-opc.h | 1 - tcg/x86_64/tcg-target.c | 8 -------- 10 files changed, 1 insertions(+), 63 deletions(-)
tcg/README +1 -6
@@ -88,8 +88,7 @@ supported. * Branches: -Use the instruction 'br' to jump to a label. Use 'jmp' to jump to an -explicit address. Conditional branches can only jump to labels. +Use the instruction 'br' to jump to a label. 3.3) Code Optimizations
@@ -129,10 +128,6 @@ call function 'ptr' (pointer type) ********* Jumps/Labels -* jmp t0 - -Absolute jump to address t0 (pointer type). - * set_label $label Define label 'label' at the current program point.
tcg/arm/tcg-target.c +0 -7
@@ -1312,12 +1312,6 @@ static inline void tcg_out_op(TCGContext *s, int opc,else tcg_out_callr (s,COND_AL , args[0 ]);break ; -case INDEX_op_jmp: -if (const_args[0 ]) -tcg_out_goto (s,COND_AL , args[0 ]); -else -tcg_out_bx (s,COND_AL , args[0 ]); -break ;case INDEX_op_br:tcg_out_goto_label (s,COND_AL , args[0 ]);break ;
@@ -1540,7 +1534,6 @@ static const TCGTargetOpDef arm_op_defs[] = { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_call, { "ri" } }, - { INDEX_op_jmp, { "ri" } }, { INDEX_op_br, { } }, { INDEX_op_mov_i32, { "r", "r" } },
tcg/hppa/tcg-target.c +0 -5
@@ -753,10 +753,6 @@ static inline void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,tcg_out32 (s,BLE_SR4 |INSN_R2 (args[0 ]));tcg_out_mov (s,TCG_REG_RP ,TCG_REG_R31 );break ; -case INDEX_op_jmp: -fprintf (stderr,"unimplemented jmp\n" ); -tcg_abort (); -break ;case INDEX_op_br:fprintf (stderr,"unimplemented br\n" );tcg_abort ();
@@ -892,7 +888,6 @@ static const TCGTargetOpDef hppa_op_defs[] = { { INDEX_op_goto_tb, { } }, { INDEX_op_call, { "r" } }, - { INDEX_op_jmp, { "r" } }, { INDEX_op_br, { } }, { INDEX_op_mov_i32, { "r", "r" } },
tcg/i386/tcg-target.c +0 -9
@@ -1001,14 +1001,6 @@ static inline void tcg_out_op(TCGContext *s, int opc,tcg_out_modrm (s,0xff ,2 , args[0 ]); }break ; -case INDEX_op_jmp: -if (const_args[0 ]) { -tcg_out8 (s,0xe9 ); -tcg_out32 (s, args[0 ] - (tcg_target_long )s->code_ptr -4 ); - }else { -tcg_out_modrm (s,0xff ,4 , args[0 ]); - } -break ;case INDEX_op_br:tcg_out_jxx (s,JCC_JMP , args[0 ],0 );break ;
@@ -1226,7 +1218,6 @@ static const TCGTargetOpDef x86_op_defs[] = { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_call, { "ri" } }, - { INDEX_op_jmp, { "ri" } }, { INDEX_op_br, { } }, { INDEX_op_mov_i32, { "r", "r" } }, { INDEX_op_movi_i32, { "r" } },
tcg/mips/tcg-target.c +0 -5
@@ -1115,10 +1115,6 @@ static inline void tcg_out_op(TCGContext *s, int opc,tcg_out_opc_reg (s,OPC_JALR ,TCG_REG_RA , args[0 ],0 );tcg_out_nop (s);break ; -case INDEX_op_jmp: -tcg_out_opc_reg (s,OPC_JR ,0 , args[0 ],0 ); -tcg_out_nop (s); -break ;case INDEX_op_br:tcg_out_brcond (s,TCG_COND_EQ ,TCG_REG_ZERO ,TCG_REG_ZERO , args[0 ]);break ;
@@ -1326,7 +1322,6 @@ static const TCGTargetOpDef mips_op_defs[] = { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_call, { "C" } }, - { INDEX_op_jmp, { "r" } }, { INDEX_op_br, { } }, { INDEX_op_mov_i32, { "r", "r" } },
tcg/ppc/tcg-target.c +0 -10
@@ -1331,15 +1331,6 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,case INDEX_op_call:tcg_out_call (s, args[0 ], const_args[0 ]);break ; -case INDEX_op_jmp: -if (const_args[0 ]) { -tcg_out_b (s,0 , args[0 ]); - } -else { -tcg_out32 (s,MTSPR |RS (args[0 ]) |CTR ); -tcg_out32 (s,BCCTR |BO_ALWAYS ); - } -break ;case INDEX_op_movi_i32:tcg_out_movi (s,TCG_TYPE_I32 , args[0 ], args[1 ]);break ;
@@ -1721,7 +1712,6 @@ static const TCGTargetOpDef ppc_op_defs[] = { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_call, { "ri" } }, - { INDEX_op_jmp, { "ri" } }, { INDEX_op_br, { } }, { INDEX_op_mov_i32, { "r", "r" } },
tcg/ppc64/tcg-target.c +0 -10
@@ -1242,15 +1242,6 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args,case INDEX_op_call:tcg_out_call (s, args[0 ], const_args[0 ]);break ; -case INDEX_op_jmp: -if (const_args[0 ]) { -tcg_out_b (s,0 , args[0 ]); - } -else { -tcg_out32 (s,MTSPR |RS (args[0 ]) |CTR ); -tcg_out32 (s,BCCTR |BO_ALWAYS ); - } -break ;case INDEX_op_movi_i32:tcg_out_movi (s,TCG_TYPE_I32 , args[0 ], args[1 ]);break ;
@@ -1575,7 +1566,6 @@ static const TCGTargetOpDef ppc_op_defs[] = { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_call, { "ri" } }, - { INDEX_op_jmp, { "ri" } }, { INDEX_op_br, { } }, { INDEX_op_mov_i32, { "r", "r" } },
tcg/sparc/tcg-target.c +0 -2
@@ -1169,7 +1169,6 @@ static inline void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,TCG_TARGET_CALL_STACK_OFFSET -TCG_STATIC_CALL_ARGS_SIZE - sizeof(long), HOST_LD_OP);break ; -case INDEX_op_jmp:case INDEX_op_br:tcg_out_branch_i32 (s,COND_A , args[0 ]);tcg_out_nop (s);
@@ -1431,7 +1430,6 @@ static const TCGTargetOpDef sparc_op_defs[] = { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_call, { "ri" } }, - { INDEX_op_jmp, { "ri" } }, { INDEX_op_br, { } }, { INDEX_op_mov_i32, { "r", "r" } },
tcg/tcg-opc.h +0 -1
@@ -37,7 +37,6 @@ DEF2(discard, 1, 0, 0, 0) DEF2(set_label, 0, 0, 1, 0) DEF2(call, 0, 1, 2, TCG_OPF_SIDE_EFFECTS) /* variable number of parameters */ -DEF2(jmp, 0, 1, 0, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS) DEF2(br, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)DEF2 (mov_i32,1 ,1 ,0 ,0 )
tcg/x86_64/tcg-target.c +0 -8
@@ -935,13 +935,6 @@ static inline void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,tcg_out_modrm (s,0xff ,2 , args[0 ]); }break ; -case INDEX_op_jmp: -if (const_args[0 ]) { -tcg_out_goto (s,0 , (void *) args[0 ]); - }else { -tcg_out_modrm (s,0xff ,4 , args[0 ]); - } -break ;case INDEX_op_br:tcg_out_jxx (s,JCC_JMP , args[0 ]);break ;
@@ -1320,7 +1313,6 @@ static const TCGTargetOpDef x86_64_op_defs[] = { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_call, { "ri" } }, /* XXX: might need a specific constant constraint */ - { INDEX_op_jmp, { "ri" } }, /* XXX: might need a specific constant constraint */ { INDEX_op_br, { } }, { INDEX_op_mov_i32, { "r", "r" } },
Signature · 1 line
1.6.6.1
Re: [Qemu-devel] [PATCH 1/9] tcg: Remove jmp opcode.
Quoted 4 lines · Richard Henderson
This opcode is unused. It was incorrectly implemented on at least one host. Just remove it.
Signed-off-by Richard Henderson <[email protected]>
Quoted 12 lines
--- tcg/README | 7 +------ tcg/arm/tcg-target.c | 7 ------- tcg/hppa/tcg-target.c | 5 ----- tcg/i386/tcg-target.c | 9 --------- tcg/mips/tcg-target.c | 5 ----- tcg/ppc/tcg-target.c | 10 ---------- tcg/ppc64/tcg-target.c | 10 ---------- tcg/sparc/tcg-target.c | 2 -- tcg/tcg-opc.h | 1 - tcg/x86_64/tcg-target.c | 8 -------- 10 files changed, 1 insertions(+), 63 deletions(-)
Quoted 243 lines
tcg/README +1
-6@@ -88,8 +88,7 @@ supported. * Branches: -Use the instruction 'br' to jump to a label. Use 'jmp' to jump to an -explicit address. Conditional branches can only jump to labels. +Use the instruction 'br' to jump to a label. 3.3) Code Optimizations@@ -129,10 +128,6 @@ call function 'ptr' (pointer type) ********* Jumps/Labels -* jmp t0 - -Absolute jump to address t0 (pointer type). - * set_label $label Define label 'label' at the current program point.tcg/arm/tcg-target.c +0
-7@@ -1312,12 +1312,6 @@ static inline void tcg_out_op(TCGContext *s, int opc,else tcg_out_callr (s,COND_AL , args[0 ]);break ; -case INDEX_op_jmp: -if (const_args[0 ]) -tcg_out_goto (s,COND_AL , args[0 ]); -else -tcg_out_bx (s,COND_AL , args[0 ]); -break ;case INDEX_op_br:tcg_out_goto_label (s,COND_AL , args[0 ]);break ;@@ -1540,7 +1534,6 @@ static const TCGTargetOpDef arm_op_defs[] = { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_call, { "ri" } }, - { INDEX_op_jmp, { "ri" } }, { INDEX_op_br, { } }, { INDEX_op_mov_i32, { "r", "r" } },tcg/hppa/tcg-target.c +0
-5@@ -753,10 +753,6 @@ static inline void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,tcg_out32 (s,BLE_SR4 |INSN_R2 (args[0 ]));tcg_out_mov (s,TCG_REG_RP ,TCG_REG_R31 );break ; -case INDEX_op_jmp: -fprintf (stderr,"unimplemented jmp\n" ); -tcg_abort (); -break ;case INDEX_op_br:fprintf (stderr,"unimplemented br\n" );tcg_abort ();@@ -892,7 +888,6 @@ static const TCGTargetOpDef hppa_op_defs[] = { { INDEX_op_goto_tb, { } }, { INDEX_op_call, { "r" } }, - { INDEX_op_jmp, { "r" } }, { INDEX_op_br, { } }, { INDEX_op_mov_i32, { "r", "r" } },tcg/i386/tcg-target.c +0
-9@@ -1001,14 +1001,6 @@ static inline void tcg_out_op(TCGContext *s, int opc,tcg_out_modrm (s,0xff ,2 , args[0 ]); }break ; -case INDEX_op_jmp: -if (const_args[0 ]) { -tcg_out8 (s,0xe9 ); -tcg_out32 (s, args[0 ] - (tcg_target_long )s->code_ptr -4 ); - }else { -tcg_out_modrm (s,0xff ,4 , args[0 ]); - } -break ;case INDEX_op_br:tcg_out_jxx (s,JCC_JMP , args[0 ],0 );break ;@@ -1226,7 +1218,6 @@ static const TCGTargetOpDef x86_op_defs[] = { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_call, { "ri" } }, - { INDEX_op_jmp, { "ri" } }, { INDEX_op_br, { } }, { INDEX_op_mov_i32, { "r", "r" } }, { INDEX_op_movi_i32, { "r" } },tcg/mips/tcg-target.c +0
-5@@ -1115,10 +1115,6 @@ static inline void tcg_out_op(TCGContext *s, int opc,tcg_out_opc_reg (s,OPC_JALR ,TCG_REG_RA , args[0 ],0 );tcg_out_nop (s);break ; -case INDEX_op_jmp: -tcg_out_opc_reg (s,OPC_JR ,0 , args[0 ],0 ); -tcg_out_nop (s); -break ;case INDEX_op_br:tcg_out_brcond (s,TCG_COND_EQ ,TCG_REG_ZERO ,TCG_REG_ZERO , args[0 ]);break ;@@ -1326,7 +1322,6 @@ static const TCGTargetOpDef mips_op_defs[] = { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_call, { "C" } }, - { INDEX_op_jmp, { "r" } }, { INDEX_op_br, { } }, { INDEX_op_mov_i32, { "r", "r" } },tcg/ppc/tcg-target.c +0
-10@@ -1331,15 +1331,6 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,case INDEX_op_call:tcg_out_call (s, args[0 ], const_args[0 ]);break ; -case INDEX_op_jmp: -if (const_args[0 ]) { -tcg_out_b (s,0 , args[0 ]); - } -else { -tcg_out32 (s,MTSPR |RS (args[0 ]) |CTR ); -tcg_out32 (s,BCCTR |BO_ALWAYS ); - } -break ;case INDEX_op_movi_i32:tcg_out_movi (s,TCG_TYPE_I32 , args[0 ], args[1 ]);break ;@@ -1721,7 +1712,6 @@ static const TCGTargetOpDef ppc_op_defs[] = { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_call, { "ri" } }, - { INDEX_op_jmp, { "ri" } }, { INDEX_op_br, { } }, { INDEX_op_mov_i32, { "r", "r" } },tcg/ppc64/tcg-target.c +0
-10@@ -1242,15 +1242,6 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args,case INDEX_op_call:tcg_out_call (s, args[0 ], const_args[0 ]);break ; -case INDEX_op_jmp: -if (const_args[0 ]) { -tcg_out_b (s,0 , args[0 ]); - } -else { -tcg_out32 (s,MTSPR |RS (args[0 ]) |CTR ); -tcg_out32 (s,BCCTR |BO_ALWAYS ); - } -break ;case INDEX_op_movi_i32:tcg_out_movi (s,TCG_TYPE_I32 , args[0 ], args[1 ]);break ;@@ -1575,7 +1566,6 @@ static const TCGTargetOpDef ppc_op_defs[] = { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_call, { "ri" } }, - { INDEX_op_jmp, { "ri" } }, { INDEX_op_br, { } }, { INDEX_op_mov_i32, { "r", "r" } },tcg/sparc/tcg-target.c +0
-2@@ -1169,7 +1169,6 @@ static inline void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,TCG_TARGET_CALL_STACK_OFFSET -TCG_STATIC_CALL_ARGS_SIZE - sizeof(long), HOST_LD_OP);break ; -case INDEX_op_jmp:case INDEX_op_br:tcg_out_branch_i32 (s,COND_A , args[0 ]);tcg_out_nop (s);@@ -1431,7 +1430,6 @@ static const TCGTargetOpDef sparc_op_defs[] = { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_call, { "ri" } }, - { INDEX_op_jmp, { "ri" } }, { INDEX_op_br, { } }, { INDEX_op_mov_i32, { "r", "r" } },tcg/tcg-opc.h +0
-1@@ -37,7 +37,6 @@ DEF2(discard, 1, 0, 0, 0) DEF2(set_label, 0, 0, 1, 0) DEF2(call, 0, 1, 2, TCG_OPF_SIDE_EFFECTS) /* variable number of parameters */ -DEF2(jmp, 0, 1, 0, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS) DEF2(br, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)DEF2 (mov_i32,1 ,1 ,0 ,0 )tcg/x86_64/tcg-target.c +0
-8@@ -935,13 +935,6 @@ static inline void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,tcg_out_modrm (s,0xff ,2 , args[0 ]); }break ; -case INDEX_op_jmp: -if (const_args[0 ]) { -tcg_out_goto (s,0 , (void *) args[0 ]); - }else { -tcg_out_modrm (s,0xff ,4 , args[0 ]); - } -break ;case INDEX_op_br:tcg_out_jxx (s,JCC_JMP , args[0 ]);break ;@@ -1320,7 +1313,6 @@ static const TCGTargetOpDef x86_64_op_defs[] = { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_call, { "ri" } }, /* XXX: might need a specific constant constraint */ - { INDEX_op_jmp, { "ri" } }, /* XXX: might need a specific constant constraint */ { INDEX_op_br, { } }, { INDEX_op_mov_i32, { "r", "r" } },Signature · 1 line
1.6.6.1
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
PATCH 2/9 tcg: Name the opcode enumeration.
In reply to Richard HendersonGive the enumeration formed from tcg-opc.h a name: TCGOpcode. Use that enumeration type instead of "int" whereever appropriate.
--- tcg/arm/tcg-target.c | 2 +- tcg/hppa/tcg-target.c | 2 +- tcg/i386/tcg-target.c | 2 +- tcg/mips/tcg-target.c | 2 +- tcg/ppc/tcg-target.c | 2 +- tcg/ppc64/tcg-target.c | 2 +- tcg/s390/tcg-target.c | 2 +- tcg/sparc/tcg-target.c | 2 +- tcg/tcg-op.h | 84 +++++++++++++++++++++++----------------------- tcg/tcg.c | 33 +++++++++++++----- tcg/tcg.h | 6 ++-- tcg/x86_64/tcg-target.c | 2 +- 12 files changed, 78 insertions(+), 63 deletions(-)
tcg/arm/tcg-target.c +1 -1
@@ -1247,7 +1247,7 @@ static inline void tcg_out_qemu_st(TCGContext *s, int cond,static uint8_t *tb_ret_addr; -static inline void tcg_out_op (TCGContext *s,int opc, +static inline void tcg_out_op (TCGContext *s,TCGOpcode opc,const TCGArg *args,const int *const_args) {int c;
tcg/hppa/tcg-target.c +1 -1
@@ -723,7 +723,7 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, int opc)#endif } -static inline void tcg_out_op (TCGContext *s,int opc,const TCGArg *args, +static inline void tcg_out_op (TCGContext *s,TCGOpcode opc,const TCGArg *args,const int *const_args) {int c;
tcg/i386/tcg-target.c +1 -1
@@ -968,7 +968,7 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args,#endif } -static inline void tcg_out_op (TCGContext *s,int opc, +static inline void tcg_out_op (TCGContext *s,TCGOpcode opc,const TCGArg *args,const int *const_args) {int c;
tcg/mips/tcg-target.c +1 -1
@@ -1088,7 +1088,7 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args,#endif } -static inline void tcg_out_op (TCGContext *s,int opc, +static inline void tcg_out_op (TCGContext *s,TCGOpcode opc,const TCGArg *args,const int *const_args) {switch (opc) {
tcg/ppc/tcg-target.c +1 -1
@@ -1292,7 +1292,7 @@ void ppc_tb_set_jmp_target (unsigned long jmp_addr, unsigned long addr)flush_icache_range (jmp_addr, jmp_addr + patch_size); } -static void tcg_out_op (TCGContext *s,int opc,const TCGArg *args, +static void tcg_out_op (TCGContext *s,TCGOpcode opc,const TCGArg *args,const int *const_args) {switch (opc) {
tcg/ppc64/tcg-target.c +1 -1
@@ -1201,7 +1201,7 @@ void ppc_tb_set_jmp_target (unsigned long jmp_addr, unsigned long addr)flush_icache_range (jmp_addr, jmp_addr + patch_size); } -static void tcg_out_op (TCGContext *s,int opc,const TCGArg *args, +static void tcg_out_op (TCGContext *s,TCGOpcode opc,const TCGArg *args,const int *const_args) {int c;
tcg/s390/tcg-target.c +1 -1
@@ -78,7 +78,7 @@ static inline void tcg_out_st(TCGContext *s, TCGType type, int arg,tcg_abort (); } -static inline void tcg_out_op (TCGContext *s,int opc, +static inline void tcg_out_op (TCGContext *s,TCGOpcode opc,const TCGArg *args,const int *const_args) {tcg_abort ();
tcg/sparc/tcg-target.c +1 -1
@@ -1119,7 +1119,7 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args,#endif } -static inline void tcg_out_op (TCGContext *s,int opc,const TCGArg *args, +static inline void tcg_out_op (TCGContext *s,TCGOpcode opc,const TCGArg *args,const int *const_args) {int c;
tcg/tcg-op.h +42 -42
273 lines not on this page · raw message
tcg/tcg.c +24 -9
@@ -783,7 +783,8 @@ void tcg_dump_ops(TCGContext *s, FILE *outfile)const uint16_t *opc_ptr;const TCGArg *args;TCGArg arg; -int c, i, k, nb_oargs, nb_iargs, nb_cargs, first_insn; +TCGOpcode c; +int i, k, nb_oargs, nb_iargs, nb_cargs, first_insn;const TCGOpDef *def;char buf[128 ];
@@ -970,13 +971,13 @@ static void sort_constraints(TCGOpDef *def, int start, int n)void tcg_add_target_add_op_defs (const TCGTargetOpDef *tdefs) { -int op; +TCGOpcode op;TCGOpDef *def;const char *ct_str;int i, nb_args;for (;;) { -if (tdefs->op <0 ) +if (tdefs->op == (TCGOpcode)-1 )break ; op = tdefs->op;assert (op >=0 && op <NB_OPS );
@@ -1046,15 +1047,27 @@ void tcg_add_target_add_op_defs(const TCGTargetOpDef *tdefs) }#if defined(CONFIG_DEBUG_TCG ) + i =0 ;for (op =0 ; op <ARRAY_SIZE (tcg_op_defs); op++) {if (op < INDEX_op_call || op == INDEX_op_debug_insn_start) {/* Wrong entry in op definitions? */ -assert (!tcg_op_defs[op].used); +if (tcg_op_defs[op].used) { +fprintf (stderr,"Invalid op definition for %s\n" , + tcg_op_defs[op].name); + i =1 ; + } }else {/* Missing entry in op definitions? */ -assert (tcg_op_defs[op].used); +if (!tcg_op_defs[op].used) { +fprintf (stderr,"Missing op definition for %s\n" , + tcg_op_defs[op].name); + i =1 ; + } } } +if (i ==1 ) { +tcg_abort (); + }#endif }
@@ -1106,7 +1119,8 @@ static inline void tcg_la_bb_end(TCGContext *s, uint8_t *dead_temps)temporaries are removed. */ static void tcg_liveness_analysis (TCGContext *s) { -int i, op_index, op, nb_args, nb_iargs, nb_oargs, arg, nb_ops; +int i, op_index, nb_args, nb_iargs, nb_oargs, arg, nb_ops; +TCGOpcode op;TCGArg *args;const TCGOpDef *def;uint8_t *dead_temps;
@@ -1547,7 +1561,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOpDef *def, }static void tcg_reg_alloc_op (TCGContext *s, -const TCGOpDef *def,int opc, +const TCGOpDef *def,TCGOpcode opc,const TCGArg *args,unsigned int dead_iargs) {
@@ -1714,7 +1728,7 @@ static void tcg_reg_alloc_op(TCGContext *s,#endif static int tcg_reg_alloc_call (TCGContext *s,const TCGOpDef *def, -int opc,const TCGArg *args, +TCGOpcode opc,const TCGArg *args,unsigned int dead_iargs) {int nb_iargs, nb_oargs, flags, nb_regs, i, reg, nb_params;
@@ -1911,7 +1925,8 @@ static void dump_op_count(void)static inline int tcg_gen_code_common (TCGContext *s,uint8_t *gen_code_buf,long search_pc) { -int opc, op_index; +TCGOpcode opc; +int op_index;const TCGOpDef *def;unsigned int dead_iargs;const TCGArg *args;
tcg/tcg.h +3 -3
@@ -47,12 +47,12 @@ typedef uint64_t TCGRegSet;#error unsupported#endif -enum { +typedef enum TCGOpcode { #define DEF(s, n, copy_size) INDEX_op_ ## s,#include "tcg-opc.h" #undef DEFNB_OPS , -}; +} TCGOpcode;#define tcg_regset_clear (d) (d) = 0#define tcg_regset_set (d, s) (d) = (s)
@@ -418,7 +418,7 @@ typedef struct TCGOpDef { } TCGOpDef;typedef struct TCGTargetOpDef { -int op; +TCGOpcode op;const char *args_ct_str[TCG_MAX_OP_ARGS ]; }TCGTargetOpDef ;
tcg/x86_64/tcg-target.c +1 -1
@@ -903,7 +903,7 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args,#endif } -static inline void tcg_out_op (TCGContext *s,int opc,const TCGArg *args, +static inline void tcg_out_op (TCGContext *s,TCGOpcode opc,const TCGArg *args,const int *const_args) {int c;
Signature · 1 line
1.6.6.1
PATCH 3/9 tcg: Use TCGCond where appropriate.
In reply to Richard HendersonUse the TCGCond enumeration type in the brcond and setcond related prototypes in tcg-op.h and each code generator.
--- tcg/i386/tcg-target.c | 4 ++-- tcg/mips/tcg-target.c | 8 ++++---- tcg/ppc/tcg-target.c | 7 ++++--- tcg/ppc64/tcg-target.c | 7 ++++--- tcg/sparc/tcg-target.c | 12 ++++++------ tcg/tcg-op.h | 34 +++++++++++++++++----------------- tcg/x86_64/tcg-target.c | 4 ++-- 7 files changed, 39 insertions(+), 37 deletions(-)
tcg/i386/tcg-target.c +2 -2
@@ -376,7 +376,7 @@ static void tcg_out_cmp(TCGContext *s, TCGArg arg1, TCGArg arg2, } } -static void tcg_out_brcond (TCGContext *s,int cond, +static void tcg_out_brcond (TCGContext *s,TCGCond cond,TCGArg arg1,TCGArg arg2,int const_arg2,int label_index,int small) {
@@ -466,7 +466,7 @@ static void tcg_out_brcond2(TCGContext *s, const TCGArg *args,tcg_out_label (s, label_next, (tcg_target_long )s->code_ptr); } -static void tcg_out_setcond (TCGContext *s,int cond,TCGArg dest, +static void tcg_out_setcond (TCGContext *s,TCGCond cond,TCGArg dest,TCGArg arg1,TCGArg arg2,int const_arg2) {tcg_out_cmp (s, arg1, arg2, const_arg2);
tcg/mips/tcg-target.c +4 -4
@@ -464,7 +464,7 @@ static inline void tcg_out_addi(TCGContext *s, int reg, tcg_target_long val) } } -static void tcg_out_brcond (TCGContext *s,int cond,int arg1, +static void tcg_out_brcond (TCGContext *s,TCGCond cond,int arg1,int arg2,int label_index) {TCGLabel *l = &s->labels[label_index];
@@ -522,7 +522,7 @@ static void tcg_out_brcond(TCGContext *s, int cond, int arg1,/* XXX: we implement it at the target level to avoid having to handle cross basic blocks temporaries */ -static void tcg_out_brcond2 (TCGContext *s,int cond,int arg1, +static void tcg_out_brcond2 (TCGContext *s,TCGCond cond,int arg1,int arg2,int arg3,int arg4,int label_index) {void *label_ptr;
@@ -585,7 +585,7 @@ static void tcg_out_brcond2(TCGContext *s, int cond, int arg1,reloc_pc16 (label_ptr, (tcg_target_long ) s->code_ptr); } -static void tcg_out_setcond (TCGContext *s,int cond,int ret, +static void tcg_out_setcond (TCGContext *s,TCGCond cond,int ret,int arg1,int arg2) {switch (cond) {
@@ -645,7 +645,7 @@ static void tcg_out_setcond(TCGContext *s, int cond, int ret,/* XXX: we implement it at the target level to avoid having to handle cross basic blocks temporaries */ -static void tcg_out_setcond2 (TCGContext *s,int cond,int ret, +static void tcg_out_setcond2 (TCGContext *s,TCGCond cond,int ret,int arg1,int arg2,int arg3,int arg4) {switch (cond) {
tcg/ppc/tcg-target.c +4 -3
@@ -1080,7 +1080,8 @@ static void tcg_out_bc (TCGContext *s, int bc, int label_index)static void tcg_out_cr7eq_from_cond (TCGContext *s,const TCGArg *args,const int *const_args) { -int cond = args[4 ], op; +TCGCond cond = args[4 ]; +int op;struct {int bit1;int bit2;int cond2; } bits[] = { [TCG_COND_LT ] = {CR_LT ,CR_LT ,TCG_COND_LT }, [TCG_COND_LE ] = {CR_LT ,CR_GT ,TCG_COND_LT },
@@ -1120,7 +1121,7 @@ static void tcg_out_cr7eq_from_cond (TCGContext *s, const TCGArg *args, } } -static void tcg_out_setcond (TCGContext *s,int cond,TCGArg arg0, +static void tcg_out_setcond (TCGContext *s,TCGCond cond,TCGArg arg0,TCGArg arg1,TCGArg arg2,int const_arg2) {int crop, sh, arg;
@@ -1244,7 +1245,7 @@ static void tcg_out_setcond2 (TCGContext *s, const TCGArg *args, ); } -static void tcg_out_brcond (TCGContext *s,int cond, +static void tcg_out_brcond (TCGContext *s,TCGCond cond,TCGArg arg1,TCGArg arg2,int const_arg2,int label_index) {
tcg/ppc64/tcg-target.c +4 -3
@@ -1051,8 +1051,9 @@ static void tcg_out_cmp (TCGContext *s, int cond, TCGArg arg1, TCGArg arg2, } -static void tcg_out_setcond (TCGContext *s,TCGType type,int cond,TCGArg arg0, -TCGArg arg1,TCGArg arg2,int const_arg2) +static void tcg_out_setcond (TCGContext *s,TCGType type,TCGCond cond, +TCGArg arg0,TCGArg arg1,TCGArg arg2, +int const_arg2) {int crop, sh, arg;
@@ -1182,7 +1183,7 @@ static void tcg_out_bc (TCGContext *s, int bc, int label_index) } } -static void tcg_out_brcond (TCGContext *s,int cond, +static void tcg_out_brcond (TCGContext *s,TCGCond cond,TCGArg arg1,TCGArg arg2,int const_arg2,int label_index,int arch64) {
tcg/sparc/tcg-target.c +6 -6
@@ -520,7 +520,7 @@ static void tcg_out_cmp(TCGContext *s, TCGArg c1, TCGArg c2, int c2const)tcg_out_arithc (s,TCG_REG_G0 , c1, c2, c2const,ARITH_SUBCC ); } -static void tcg_out_brcond_i32 (TCGContext *s,int cond, +static void tcg_out_brcond_i32 (TCGContext *s,TCGCond cond,TCGArg arg1,TCGArg arg2,int const_arg2,int label_index) {
@@ -530,7 +530,7 @@ static void tcg_out_brcond_i32(TCGContext *s, int cond, }#if TCG_TARGET_REG_BITS ==64 -static void tcg_out_brcond_i64 (TCGContext *s,int cond, +static void tcg_out_brcond_i64 (TCGContext *s,TCGCond cond,TCGArg arg1,TCGArg arg2,int const_arg2,int label_index) {
@@ -539,7 +539,7 @@ static void tcg_out_brcond_i64(TCGContext *s, int cond, tcg_out_nop(s); }#else -static void tcg_out_brcond2_i32 (TCGContext *s,int cond, +static void tcg_out_brcond2_i32 (TCGContext *s,TCGCond cond,TCGArg al,TCGArg ah,TCGArg bl,int blconst,TCGArg bh,int bhconst,int label_dest)
@@ -587,7 +587,7 @@ static void tcg_out_brcond2_i32(TCGContext *s, int cond, }#endif -static void tcg_out_setcond_i32 (TCGContext *s,int cond,TCGArg ret, +static void tcg_out_setcond_i32 (TCGContext *s,TCGCond cond,TCGArg ret,TCGArg c1,TCGArg c2,int c2const) {TCGArg t;
@@ -643,7 +643,7 @@ static void tcg_out_setcond_i32(TCGContext *s, int cond, TCGArg ret, }#if TCG_TARGET_REG_BITS ==64 -static void tcg_out_setcond_i64 (TCGContext *s,int cond,TCGArg ret, +static void tcg_out_setcond_i64 (TCGContext *s,TCGCond cond,TCGArg ret,TCGArg c1,TCGArg c2,int c2const) {tcg_out_cmp (s, c1, c2, c2const);
@@ -653,7 +653,7 @@ static void tcg_out_setcond_i64(TCGContext *s, int cond, TCGArg ret, | MOVCC_XCC | INSN_IMM11(1)); }#else -static void tcg_out_setcond2_i32 (TCGContext *s,int cond,TCGArg ret, +static void tcg_out_setcond2_i32 (TCGContext *s,TCGCond cond,TCGArg ret,TCGArg al,TCGArg ah,TCGArg bl,int blconst,TCGArg bh,int bhconst)
tcg/tcg-op.h +17 -17
@@ -593,28 +593,28 @@ static inline void tcg_gen_sari_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) } } -static inline void tcg_gen_brcond_i32 (int cond,TCGv_i32 arg1,TCGv_i32 arg2, -int label_index) +static inline void tcg_gen_brcond_i32 (TCGCond cond,TCGv_i32 arg1, +TCGv_i32 arg2,int label_index) {tcg_gen_op4ii_i32 (INDEX_op_brcond_i32, arg1, arg2, cond, label_index); } -static inline void tcg_gen_brcondi_i32 (int cond,TCGv_i32 arg1,int32_t arg2, -int label_index) +static inline void tcg_gen_brcondi_i32 (TCGCond cond,TCGv_i32 arg1, +int32_t arg2,int label_index) {TCGv_i32 t0 =tcg_const_i32 (arg2);tcg_gen_brcond_i32 (cond, arg1, t0, label_index);tcg_temp_free_i32 (t0); } -static inline void tcg_gen_setcond_i32 (int cond,TCGv_i32 ret, +static inline void tcg_gen_setcond_i32 (TCGCond cond,TCGv_i32 ret,TCGv_i32 arg1,TCGv_i32 arg2) {tcg_gen_op4i_i32 (INDEX_op_setcond_i32, ret, arg1, arg2, cond); } -static inline void tcg_gen_setcondi_i32 (int cond,TCGv_i32 ret,TCGv_i32 arg1, -int32_t arg2) +static inline void tcg_gen_setcondi_i32 (TCGCond cond,TCGv_i32 ret, +TCGv_i32 arg1,int32_t arg2) {TCGv_i32 t0 =tcg_const_i32 (arg2);tcg_gen_setcond_i32 (cond, ret, arg1, t0);
@@ -895,15 +895,15 @@ static inline void tcg_gen_sari_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)tcg_gen_shifti_i64 (ret, arg1, arg2,1 ,1 ); } -static inline void tcg_gen_brcond_i64 (int cond,TCGv_i64 arg1,TCGv_i64 arg2, -int label_index) +static inline void tcg_gen_brcond_i64 (TCGCond cond,TCGv_i64 arg1, +TCGv_i64 arg2,int label_index) {tcg_gen_op6ii_i32 (INDEX_op_brcond2_i32,TCGV_LOW (arg1),TCGV_HIGH (arg1),TCGV_LOW (arg2),TCGV_HIGH (arg2), cond, label_index); } -static inline void tcg_gen_setcond_i64 (int cond,TCGv_i64 ret, +static inline void tcg_gen_setcond_i64 (TCGCond cond,TCGv_i64 ret,TCGv_i64 arg1,TCGv_i64 arg2) { tcg_gen_op6i_i32(INDEX_op_setcond2_i32, TCGV_LOW(ret),
@@ -1136,13 +1136,13 @@ static inline void tcg_gen_sari_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) } } -static inline void tcg_gen_brcond_i64 (int cond,TCGv_i64 arg1,TCGv_i64 arg2, -int label_index) +static inline void tcg_gen_brcond_i64 (TCGCond cond,TCGv_i64 arg1, +TCGv_i64 arg2,int label_index) {tcg_gen_op4ii_i64 (INDEX_op_brcond_i64, arg1, arg2, cond, label_index); } -static inline void tcg_gen_setcond_i64 (int cond,TCGv_i64 ret, +static inline void tcg_gen_setcond_i64 (TCGCond cond,TCGv_i64 ret,TCGv_i64 arg1,TCGv_i64 arg2) {tcg_gen_op4i_i64 (INDEX_op_setcond_i64, ret, arg1, arg2, cond);
@@ -1263,16 +1263,16 @@ static inline void tcg_gen_subi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)tcg_temp_free_i64 (t0); } } -static inline void tcg_gen_brcondi_i64 (int cond,TCGv_i64 arg1,int64_t arg2, -int label_index) +static inline void tcg_gen_brcondi_i64 (TCGCond cond,TCGv_i64 arg1, +int64_t arg2,int label_index) {TCGv_i64 t0 =tcg_const_i64 (arg2);tcg_gen_brcond_i64 (cond, arg1, t0, label_index);tcg_temp_free_i64 (t0); } -static inline void tcg_gen_setcondi_i64 (int cond,TCGv_i64 ret,TCGv_i64 arg1, -int64_t arg2) +static inline void tcg_gen_setcondi_i64 (TCGCond cond,TCGv_i64 ret, +TCGv_i64 arg1,int64_t arg2) {TCGv_i64 t0 =tcg_const_i64 (arg2);tcg_gen_setcond_i64 (cond, ret, arg1, t0);
tcg/x86_64/tcg-target.c +2 -2
@@ -518,7 +518,7 @@ static void tcg_out_cmp(TCGContext *s, TCGArg arg1, TCGArg arg2, } } -static void tcg_out_brcond (TCGContext *s,int cond, +static void tcg_out_brcond (TCGContext *s,TCGCond cond,TCGArg arg1,TCGArg arg2,int const_arg2,int label_index,int rexw) {
@@ -526,7 +526,7 @@ static void tcg_out_brcond(TCGContext *s, int cond,tcg_out_jxx (s, tcg_cond_to_jcc[cond], label_index); } -static void tcg_out_setcond (TCGContext *s,int cond,TCGArg dest, +static void tcg_out_setcond (TCGContext *s,TCGCond cond,TCGArg dest,TCGArg arg1,TCGArg arg2,int const_arg2,int rexw) {tcg_out_cmp (s, arg1, arg2, const_arg2, rexw);
Signature · 1 line
1.6.6.1
PATCH 4/9 tcg: Change TCGType to an enumeration.
In reply to Richard HendersonThe TCGType name was already used consistently. Changing it to an enumeration instead of a set of defines aids debugging.
--- tcg/tcg-op.h | 2 -- tcg/tcg.h | 19 ++++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-)
tcg/tcg-op.h +0 -2
@@ -2175,7 +2175,6 @@ static inline void tcg_gen_qemu_st64(TCGv_i64 arg, TCGv addr, int mem_index)#endif /* TCG_TARGET_REG_BITS != 32 */ #if TARGET_LONG_BITS ==64 -#define TCG_TYPE_TL TCG_TYPE_I64#define tcg_gen_movi_tl tcg_gen_movi_i64#define tcg_gen_mov_tl tcg_gen_mov_i64#define tcg_gen_ld8u_tl tcg_gen_ld8u_i64
@@ -2247,7 +2246,6 @@ static inline void tcg_gen_qemu_st64(TCGv_i64 arg, TCGv addr, int mem_index)#define tcg_const_tl tcg_const_i64#define tcg_const_local_tl tcg_const_local_i64#else -#define TCG_TYPE_TL TCG_TYPE_I32#define tcg_gen_movi_tl tcg_gen_movi_i32#define tcg_gen_mov_tl tcg_gen_mov_i32#define tcg_gen_ld8u_tl tcg_gen_ld8u_i32
tcg/tcg.h +12 -7
@@ -96,17 +96,22 @@ typedef struct TCGPool {this value, they are statically allocated in the TB stack frame */ #define TCG_STATIC_CALL_ARGS_SIZE 128 -typedef int TCGType ; - -#define TCG_TYPE_I32 0 -#define TCG_TYPE_I64 1 -#define TCG_TYPE_COUNT 2/* number of different types */ +typedef enum TCGType { +TCG_TYPE_I32 , +TCG_TYPE_I64 , +TCG_TYPE_COUNT ,/* number of different types */ #if TCG_TARGET_REG_BITS ==32 -#define TCG_TYPE_PTR TCG_TYPE_I32 +TCG_TYPE_PTR =TCG_TYPE_I32 , +#else +TCG_TYPE_PTR =TCG_TYPE_I64 , +#endif +#if TARGET_LONG_BITS ==64 +TCG_TYPE_TL =TCG_TYPE_I64 ,#else -#define TCG_TYPE_PTR TCG_TYPE_I64 +TCG_TYPE_TL =TCG_TYPE_I32 ,#endif +}TCGType ;typedef tcg_target_ulong TCGArg ;
Signature · 1 line
1.6.6.1
PATCH 5/9 tcg: Disambiguate qemu_ld32u with 32-bit and 64-bit outputs.
In reply to Richard HendersonSome targets (e.g. Alpha and MIPS64) need to keep 32-bit operands sign-extended in 64-bit registers (regardless of the "real" sign of the operand). For that, we need to be able to distinguish between a 32-bit load with a 32-bit result and a 32-bit load with a given extension to a 64-bit result. This distinction already exists for the ld* loads, but not the qemu_ld* loads.
Reserve qemu_ld32u for 64-bit outputs and introduce qemu_ld32 for 32-bit outputs. Adjust all code generators to match.
--- tcg/README | 10 +++++++--- tcg/arm/tcg-target.c | 4 ++-- tcg/hppa/tcg-target.c | 6 +++--- tcg/i386/tcg-target.c | 6 +++--- tcg/mips/tcg-target.c | 6 +++--- tcg/ppc/tcg-target.c | 6 +++--- tcg/ppc64/tcg-target.c | 2 ++ tcg/sparc/tcg-target.c | 6 +++++- tcg/tcg-op.h | 8 ++++---- tcg/tcg-opc.h | 5 +++-- tcg/x86_64/tcg-target.c | 2 ++ 11 files changed, 37 insertions(+), 24 deletions(-)
tcg/README +7 -3
@@ -373,13 +373,17 @@ instructions. qemu_ld8s t0, t1, flags qemu_ld16u t0, t1, flags qemu_ld16s t0, t1, flags +qemu_ld32 t0, t1, flags qemu_ld32u t0, t1, flags qemu_ld32s t0, t1, flags qemu_ld64 t0, t1, flags -Load data at the QEMU CPU address t1 into t0. t1 has the QEMU CPU -address type. 'flags' contains the QEMU memory index (selects user or -kernel access) for example. +Load data at the QEMU CPU address t1 into t0. t1 has the QEMU CPU address +type. 'flags' contains the QEMU memory index (selects user or kernel access) +for example. + +Note that "qemu_ld32" implies a 32-bit result, while "qemu_ld32u" and +"qemu_ld32s" imply a 64-bit result appropriately extended from 32 bits. * qemu_st8 t0, t1, flags qemu_st16 t0, t1, flags
tcg/arm/tcg-target.c +2 -2
@@ -1482,7 +1482,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,case INDEX_op_qemu_ld16s:tcg_out_qemu_ld (s,COND_AL , args,1 |4 );break ; -case INDEX_op_qemu_ld32u: +case INDEX_op_qemu_ld32:tcg_out_qemu_ld (s,COND_AL , args,2 );break ;case INDEX_op_qemu_ld64:
@@ -1577,7 +1577,7 @@ static const TCGTargetOpDef arm_op_defs[] = { { INDEX_op_qemu_ld8s, { "r", "x", "X" } }, { INDEX_op_qemu_ld16u, { "r", "x", "X" } }, { INDEX_op_qemu_ld16s, { "r", "x", "X" } }, - { INDEX_op_qemu_ld32u, { "r", "x", "X" } }, + { INDEX_op_qemu_ld32, { "r", "x", "X" } }, { INDEX_op_qemu_ld64, { "d", "r", "x", "X" } }, { INDEX_op_qemu_st8, { "x", "x", "X" } },
tcg/hppa/tcg-target.c +3 -3
@@ -859,7 +859,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,case INDEX_op_qemu_ld16s:tcg_out_qemu_ld (s, args,1 |4 );break ; -case INDEX_op_qemu_ld32u: +case INDEX_op_qemu_ld32:tcg_out_qemu_ld (s, args,2 );break ;
@@ -918,7 +918,7 @@ static const TCGTargetOpDef hppa_op_defs[] = { { INDEX_op_qemu_ld8s, { "r", "L" } }, { INDEX_op_qemu_ld16u, { "r", "L" } }, { INDEX_op_qemu_ld16s, { "r", "L" } }, - { INDEX_op_qemu_ld32u, { "r", "L" } }, + { INDEX_op_qemu_ld32, { "r", "L" } }, { INDEX_op_qemu_ld64, { "r", "r", "L" } }, { INDEX_op_qemu_st8, { "L", "L" } },
@@ -930,7 +930,7 @@ static const TCGTargetOpDef hppa_op_defs[] = { { INDEX_op_qemu_ld8s, { "r", "L", "L" } }, { INDEX_op_qemu_ld16u, { "r", "L", "L" } }, { INDEX_op_qemu_ld16s, { "r", "L", "L" } }, - { INDEX_op_qemu_ld32u, { "r", "L", "L" } }, + { INDEX_op_qemu_ld32, { "r", "L", "L" } }, { INDEX_op_qemu_ld64, { "r", "r", "L", "L" } }, { INDEX_op_qemu_st8, { "L", "L", "L" } },
tcg/i386/tcg-target.c +3 -3
@@ -1189,7 +1189,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,case INDEX_op_qemu_ld16s:tcg_out_qemu_ld (s, args,1 |4 );break ; -case INDEX_op_qemu_ld32u: +case INDEX_op_qemu_ld32:tcg_out_qemu_ld (s, args,2 );break ;case INDEX_op_qemu_ld64:
@@ -1272,7 +1272,7 @@ static const TCGTargetOpDef x86_op_defs[] = { { INDEX_op_qemu_ld8s, { "r", "L" } }, { INDEX_op_qemu_ld16u, { "r", "L" } }, { INDEX_op_qemu_ld16s, { "r", "L" } }, - { INDEX_op_qemu_ld32u, { "r", "L" } }, + { INDEX_op_qemu_ld32, { "r", "L" } }, { INDEX_op_qemu_ld64, { "r", "r", "L" } }, { INDEX_op_qemu_st8, { "cb", "L" } },
@@ -1284,7 +1284,7 @@ static const TCGTargetOpDef x86_op_defs[] = { { INDEX_op_qemu_ld8s, { "r", "L", "L" } }, { INDEX_op_qemu_ld16u, { "r", "L", "L" } }, { INDEX_op_qemu_ld16s, { "r", "L", "L" } }, - { INDEX_op_qemu_ld32u, { "r", "L", "L" } }, + { INDEX_op_qemu_ld32, { "r", "L", "L" } }, { INDEX_op_qemu_ld64, { "r", "r", "L", "L" } }, { INDEX_op_qemu_st8, { "cb", "L", "L" } },
tcg/mips/tcg-target.c +3 -3
@@ -1294,7 +1294,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,case INDEX_op_qemu_ld16s:tcg_out_qemu_ld (s, args,1 |4 );break ; -case INDEX_op_qemu_ld32u: +case INDEX_op_qemu_ld32:tcg_out_qemu_ld (s, args,2 );break ;case INDEX_op_qemu_ld64:
@@ -1366,7 +1366,7 @@ static const TCGTargetOpDef mips_op_defs[] = { { INDEX_op_qemu_ld8s, { "L", "lZ" } }, { INDEX_op_qemu_ld16u, { "L", "lZ" } }, { INDEX_op_qemu_ld16s, { "L", "lZ" } }, - { INDEX_op_qemu_ld32u, { "L", "lZ" } }, + { INDEX_op_qemu_ld32, { "L", "lZ" } }, { INDEX_op_qemu_ld64, { "L", "L", "lZ" } }, { INDEX_op_qemu_st8, { "SZ", "SZ" } },
@@ -1378,7 +1378,7 @@ static const TCGTargetOpDef mips_op_defs[] = { { INDEX_op_qemu_ld8s, { "L", "lZ", "lZ" } }, { INDEX_op_qemu_ld16u, { "L", "lZ", "lZ" } }, { INDEX_op_qemu_ld16s, { "L", "lZ", "lZ" } }, - { INDEX_op_qemu_ld32u, { "L", "lZ", "lZ" } }, + { INDEX_op_qemu_ld32, { "L", "lZ", "lZ" } }, { INDEX_op_qemu_ld64, { "L", "L", "lZ", "lZ" } }, { INDEX_op_qemu_st8, { "SZ", "SZ", "SZ" } },
tcg/ppc/tcg-target.c +3 -3
@@ -1652,7 +1652,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,case INDEX_op_qemu_ld16s:tcg_out_qemu_ld (s, args,1 |4 );break ; -case INDEX_op_qemu_ld32u: +case INDEX_op_qemu_ld32:tcg_out_qemu_ld (s, args,2 );break ;case INDEX_op_qemu_ld64:
@@ -1765,7 +1765,7 @@ static const TCGTargetOpDef ppc_op_defs[] = { { INDEX_op_qemu_ld8s, { "r", "L" } }, { INDEX_op_qemu_ld16u, { "r", "L" } }, { INDEX_op_qemu_ld16s, { "r", "L" } }, - { INDEX_op_qemu_ld32u, { "r", "L" } }, + { INDEX_op_qemu_ld32, { "r", "L" } }, { INDEX_op_qemu_ld64, { "r", "r", "L" } }, { INDEX_op_qemu_st8, { "K", "K" } },
@@ -1777,7 +1777,7 @@ static const TCGTargetOpDef ppc_op_defs[] = { { INDEX_op_qemu_ld8s, { "r", "L", "L" } }, { INDEX_op_qemu_ld16u, { "r", "L", "L" } }, { INDEX_op_qemu_ld16s, { "r", "L", "L" } }, - { INDEX_op_qemu_ld32u, { "r", "L", "L" } }, + { INDEX_op_qemu_ld32, { "r", "L", "L" } }, { INDEX_op_qemu_ld64, { "r", "L", "L", "L" } }, { INDEX_op_qemu_st8, { "K", "K", "K" } },
tcg/ppc64/tcg-target.c +2 -0
@@ -1511,6 +1511,7 @@ static void tcg_out_op (TCGContext *s, TCGOpcode opc, const TCGArg *args,case INDEX_op_qemu_ld16s:tcg_out_qemu_ld (s, args,1 |4 );break ; +case INDEX_op_qemu_ld32:case INDEX_op_qemu_ld32u:tcg_out_qemu_ld (s, args,2 );break ;
@@ -1638,6 +1639,7 @@ static const TCGTargetOpDef ppc_op_defs[] = { { INDEX_op_qemu_ld8s, { "r", "L" } }, { INDEX_op_qemu_ld16u, { "r", "L" } }, { INDEX_op_qemu_ld16s, { "r", "L" } }, + { INDEX_op_qemu_ld32, { "r", "L" } }, { INDEX_op_qemu_ld32u, { "r", "L" } }, { INDEX_op_qemu_ld32s, { "r", "L" } }, { INDEX_op_qemu_ld64, { "r", "L" } },
tcg/sparc/tcg-target.c +5 -1
@@ -1323,7 +1323,10 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,case INDEX_op_qemu_ld16s:tcg_out_qemu_ld (s, args,1 |4 );break ; +case INDEX_op_qemu_ld32: +#if TCG_TARGET_REG_BITS ==64 case INDEX_op_qemu_ld32u: +#endif tcg_out_qemu_ld (s, args,2 );break ;#if TCG_TARGET_REG_BITS ==64
@@ -1478,8 +1481,9 @@ static const TCGTargetOpDef sparc_op_defs[] = { { INDEX_op_qemu_ld8s, { "r", "L" } }, { INDEX_op_qemu_ld16u, { "r", "L" } }, { INDEX_op_qemu_ld16s, { "r", "L" } }, - { INDEX_op_qemu_ld32u, { "r", "L" } }, + { INDEX_op_qemu_ld32, { "r", "L" } }, #if TCG_TARGET_REG_BITS == 64 + { INDEX_op_qemu_ld32u, { "r", "L" } }, { INDEX_op_qemu_ld32s, { "r", "L" } }, #endif
tcg/tcg-op.h +4 -4
@@ -2039,9 +2039,9 @@ static inline void tcg_gen_qemu_ld16s(TCGv ret, TCGv addr, int mem_index)static inline void tcg_gen_qemu_ld32u (TCGv ret,TCGv addr,int mem_index) {#if TARGET_LONG_BITS ==32 -tcg_gen_op3i_i32 (INDEX_op_qemu_ld32u, ret, addr, mem_index); +tcg_gen_op3i_i32 (INDEX_op_qemu_ld32, ret, addr, mem_index);#else -tcg_gen_op4i_i32 (INDEX_op_qemu_ld32u,TCGV_LOW (ret),TCGV_LOW (addr), +tcg_gen_op4i_i32 (INDEX_op_qemu_ld32,TCGV_LOW (ret),TCGV_LOW (addr),TCGV_HIGH (addr), mem_index);tcg_gen_movi_i32 (TCGV_HIGH (ret),0 );#endif
@@ -2050,9 +2050,9 @@ static inline void tcg_gen_qemu_ld32u(TCGv ret, TCGv addr, int mem_index)static inline void tcg_gen_qemu_ld32s (TCGv ret,TCGv addr,int mem_index) {#if TARGET_LONG_BITS ==32 -tcg_gen_op3i_i32 (INDEX_op_qemu_ld32u, ret, addr, mem_index); +tcg_gen_op3i_i32 (INDEX_op_qemu_ld32, ret, addr, mem_index);#else -tcg_gen_op4i_i32 (INDEX_op_qemu_ld32u,TCGV_LOW (ret),TCGV_LOW (addr), +tcg_gen_op4i_i32 (INDEX_op_qemu_ld32,TCGV_LOW (ret),TCGV_LOW (addr),TCGV_HIGH (addr), mem_index);tcg_gen_sari_i32 (TCGV_HIGH (ret),TCGV_LOW (ret),31 );#endif
tcg/tcg-opc.h +3 -2
@@ -230,9 +230,9 @@ DEF2(qemu_ld16s, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS) DEF2(qemu_ld16s, 1, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)#endif #if TARGET_LONG_BITS ==32 -DEF2(qemu_ld32u, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS) +DEF2(qemu_ld32, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)#else -DEF2(qemu_ld32u, 1, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS) +DEF2(qemu_ld32, 1, 2, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)#endif #if TARGET_LONG_BITS ==32 DEF2 (qemu_ld64,2 ,1 ,1 ,TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS )
@@ -267,6 +267,7 @@ DEF2(qemu_ld8u, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS) DEF2(qemu_ld8s, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS) DEF2(qemu_ld16u, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS) DEF2(qemu_ld16s, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS) +DEF2(qemu_ld32, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS) DEF2(qemu_ld32u, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS) DEF2(qemu_ld32s, 1, 1, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS)DEF2 (qemu_ld64,1 ,1 ,1 ,TCG_OPF_CALL_CLOBBER |TCG_OPF_SIDE_EFFECTS )
tcg/x86_64/tcg-target.c +2 -0
@@ -1231,6 +1231,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,case INDEX_op_qemu_ld16s:tcg_out_qemu_ld (s, args,1 |4 );break ; +case INDEX_op_qemu_ld32:case INDEX_op_qemu_ld32u:tcg_out_qemu_ld (s, args,2 );break ;
@@ -1404,6 +1405,7 @@ static const TCGTargetOpDef x86_64_op_defs[] = { { INDEX_op_qemu_ld8s, { "r", "L" } }, { INDEX_op_qemu_ld16u, { "r", "L" } }, { INDEX_op_qemu_ld16s, { "r", "L" } }, + { INDEX_op_qemu_ld32, { "r", "L" } }, { INDEX_op_qemu_ld32u, { "r", "L" } }, { INDEX_op_qemu_ld32s, { "r", "L" } }, { INDEX_op_qemu_ld64, { "r", "L" } },
Signature · 1 line
1.6.6.1
PATCH 6/9 tcg: Use not_i32 to implement not_i64.
In reply to Richard Henderson--- tcg/tcg-op.h | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
tcg/tcg-op.h +3 -0
@@ -1653,6 +1653,9 @@ static inline void tcg_gen_not_i64(TCGv_i64 ret, TCGv_i64 arg) {#ifdef TCG_TARGET_HAS_not_i64tcg_gen_op2_i64 (INDEX_op_not_i64, ret, arg); +#elif defined(TCG_TARGET_HAS_not_i32) &&TCG_TARGET_REG_BITS ==32 +tcg_gen_not_i32 (TCGV_LOW (ret),TCGV_LOW (arg)); +tcg_gen_not_i32 (TCGV_HIGH (ret),TCGV_HIGH (arg));#else tcg_gen_xori_i64 (ret, arg,-1 );#endif
Signature · 1 line
1.6.6.1
PATCH 7/9 tcg: Allow target-specific implementation of EQV.
In reply to Richard Henderson--- tcg/README | 2 +- tcg/arm/tcg-target.h | 1 + tcg/i386/tcg-target.h | 1 + tcg/mips/tcg-target.h | 1 + tcg/ppc/tcg-target.h | 1 + tcg/ppc64/tcg-target.h | 2 ++ tcg/s390/tcg-target.h | 2 ++ tcg/sparc/tcg-target.h | 2 ++ tcg/tcg-op.h | 11 +++++++++++ tcg/tcg-opc.h | 6 ++++++ tcg/x86_64/tcg-target.h | 2 ++ 11 files changed, 30 insertions(+), 1 deletions(-)
tcg/README +1 -1
@@ -208,7 +208,7 @@ t0=t1&~t2 * eqv_i32/i64 t0, t1, t2 -t0=~(t1^t2) +t0=~(t1^t2), or equivalently, t0=t1^~t2 * nand_i32/i64 t0, t1, t2
tcg/arm/tcg-target.h +1 -0
@@ -67,6 +67,7 @@ enum {// #define TCG_TARGET_HAS_rot_i32 #define TCG_TARGET_HAS_andc_i32// #define TCG_TARGET_HAS_orc_i32 +// #define TCG_TARGET_HAS_eqv_i32 #define TCG_TARGET_HAS_GUEST_BASE
tcg/i386/tcg-target.h +1 -0
@@ -57,6 +57,7 @@ enum {#define TCG_TARGET_HAS_not_i32// #define TCG_TARGET_HAS_andc_i32 // #define TCG_TARGET_HAS_orc_i32 +// #define TCG_TARGET_HAS_eqv_i32 #define TCG_TARGET_HAS_GUEST_BASE
tcg/mips/tcg-target.h +1 -0
@@ -87,6 +87,7 @@ enum {#undef TCG_TARGET_HAS_bswap16_i32#undef TCG_TARGET_HAS_andc_i32#undef TCG_TARGET_HAS_orc_i32 +#undef TCG_TARGET_HAS_eqv_i32/* optional instructions automatically implemented */ #undef TCG_TARGET_HAS_neg_i32/* sub rd, zero, rt */
tcg/ppc/tcg-target.h +1 -0
@@ -89,6 +89,7 @@ enum {#define TCG_TARGET_HAS_neg_i32#define TCG_TARGET_HAS_andc_i32#define TCG_TARGET_HAS_orc_i32 +/* #define TCG_TARGET_HAS_eqv_i32 */ #define TCG_AREG0 TCG_REG_R27#define TCG_AREG1 TCG_REG_R24
tcg/ppc64/tcg-target.h +2 -0
@@ -80,6 +80,7 @@ enum {#define TCG_TARGET_HAS_neg_i32/* #define TCG_TARGET_HAS_andc_i32 */ /* #define TCG_TARGET_HAS_orc_i32 */ +/* #define TCG_TARGET_HAS_eqv_i32 */ #define TCG_TARGET_HAS_div_i64/* #define TCG_TARGET_HAS_rot_i64 */
@@ -96,6 +97,7 @@ enum {#define TCG_TARGET_HAS_neg_i64/* #define TCG_TARGET_HAS_andc_i64 */ /* #define TCG_TARGET_HAS_orc_i64 */ +/* #define TCG_TARGET_HAS_eqv_i64 */ #define TCG_AREG0 TCG_REG_R27#define TCG_AREG1 TCG_REG_R24
tcg/s390/tcg-target.h +2 -0
@@ -59,6 +59,7 @@ enum {// #define TCG_TARGET_HAS_neg_i32 // #define TCG_TARGET_HAS_andc_i32 // #define TCG_TARGET_HAS_orc_i32 +// #define TCG_TARGET_HAS_eqv_i32 // #define TCG_TARGET_HAS_div_i64 // #define TCG_TARGET_HAS_rot_i64
@@ -75,6 +76,7 @@ enum {// #define TCG_TARGET_HAS_neg_i64 // #define TCG_TARGET_HAS_andc_i64 // #define TCG_TARGET_HAS_orc_i64 +// #define TCG_TARGET_HAS_eqv_i64 /* used for function call generation */ #define TCG_REG_CALL_STACK TCG_REG_R15
tcg/sparc/tcg-target.h +2 -0
@@ -100,6 +100,7 @@ enum {#define TCG_TARGET_HAS_not_i32#define TCG_TARGET_HAS_andc_i32#define TCG_TARGET_HAS_orc_i32 +// #define TCG_TARGET_HAS_eqv_i32 #if TCG_TARGET_REG_BITS ==64 #define TCG_TARGET_HAS_div_i64
@@ -117,6 +118,7 @@ enum {#define TCG_TARGET_HAS_not_i64#define TCG_TARGET_HAS_andc_i64#define TCG_TARGET_HAS_orc_i64 +// #define TCG_TARGET_HAS_eqv_i64 #endif /* Note: must be synced with dyngen-exec.h and Makefile.target */
tcg/tcg-op.h +11 -0
@@ -1740,14 +1740,25 @@ static inline void tcg_gen_andc_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)static inline void tcg_gen_eqv_i32 (TCGv_i32 ret,TCGv_i32 arg1,TCGv_i32 arg2) { +#ifdef TCG_TARGET_HAS_eqv_i32 +tcg_gen_op3_i32 (INDEX_op_eqv_i32, ret, arg1, arg2); +#else tcg_gen_xor_i32 (ret, arg1, arg2);tcg_gen_not_i32 (ret, ret); +#endif }static inline void tcg_gen_eqv_i64 (TCGv_i64 ret,TCGv_i64 arg1,TCGv_i64 arg2) { +#ifdef TCG_TARGET_HAS_eqv_i64 +tcg_gen_op3_i64 (INDEX_op_eqv_i64, ret, arg1, arg2); +#elif defined(TCG_TARGET_HAS_eqv_i32) &&TCG_TARGET_REG_BITS ==32 +tcg_gen_eqv_i32 (TCGV_LOW (ret),TCGV_LOW (arg1),TCGV_LOW (arg2)); +tcg_gen_eqv_i32 (TCGV_HIGH (ret),TCGV_HIGH (arg1),TCGV_HIGH (arg2)); +#else tcg_gen_xor_i64 (ret, arg1, arg2);tcg_gen_not_i64 (ret, ret); +#endif }static inline void tcg_gen_nand_i32 (TCGv_i32 ret,TCGv_i32 arg1,TCGv_i32 arg2)
tcg/tcg-opc.h +6 -0
@@ -114,6 +114,9 @@ DEF2(andc_i32, 1, 2, 0, 0)#ifdef TCG_TARGET_HAS_orc_i32 DEF2(orc_i32, 1, 2, 0, 0)#endif +#ifdef TCG_TARGET_HAS_eqv_i32 +DEF2(eqv_i32, 1, 2, 0, 0) +#endif #if TCG_TARGET_REG_BITS ==64 DEF2 (mov_i64,1 ,1 ,0 ,0 )
@@ -196,6 +199,9 @@ DEF2(andc_i64, 1, 2, 0, 0)#ifdef TCG_TARGET_HAS_orc_i64 DEF2(orc_i64, 1, 2, 0, 0)#endif +#ifdef TCG_TARGET_HAS_eqv_i64 +DEF2(eqv_i64, 1, 2, 0, 0) +#endif #endif /* QEMU specific */
tcg/x86_64/tcg-target.h +2 -0
@@ -84,6 +84,8 @@ enum {// #define TCG_TARGET_HAS_andc_i64 // #define TCG_TARGET_HAS_orc_i32 // #define TCG_TARGET_HAS_orc_i64 +// #define TCG_TARGET_HAS_eqv_i32 +// #define TCG_TARGET_HAS_eqv_i64 #define TCG_TARGET_HAS_GUEST_BASE
Signature · 1 line
1.6.6.1
PATCH 8/9 tcg: Allow target-specific implementation of NAND.
In reply to Richard Henderson--- tcg/arm/tcg-target.h | 1 + tcg/i386/tcg-target.h | 1 + tcg/mips/tcg-target.h | 1 + tcg/ppc/tcg-target.h | 1 + tcg/ppc64/tcg-target.h | 2 ++ tcg/s390/tcg-target.h | 2 ++ tcg/sparc/tcg-target.h | 2 ++ tcg/tcg-op.h | 11 +++++++++++ tcg/tcg-opc.h | 6 ++++++ tcg/x86_64/tcg-target.h | 2 ++ 10 files changed, 29 insertions(+), 0 deletions(-)
tcg/arm/tcg-target.h +1 -0
@@ -68,6 +68,7 @@ enum {#define TCG_TARGET_HAS_andc_i32// #define TCG_TARGET_HAS_orc_i32 // #define TCG_TARGET_HAS_eqv_i32 +// #define TCG_TARGET_HAS_nand_i32 #define TCG_TARGET_HAS_GUEST_BASE
tcg/i386/tcg-target.h +1 -0
@@ -58,6 +58,7 @@ enum {// #define TCG_TARGET_HAS_andc_i32 // #define TCG_TARGET_HAS_orc_i32 // #define TCG_TARGET_HAS_eqv_i32 +// #define TCG_TARGET_HAS_nand_i32 #define TCG_TARGET_HAS_GUEST_BASE
tcg/mips/tcg-target.h +1 -0
@@ -88,6 +88,7 @@ enum {#undef TCG_TARGET_HAS_andc_i32#undef TCG_TARGET_HAS_orc_i32#undef TCG_TARGET_HAS_eqv_i32 +#undef TCG_TARGET_HAS_nand_i32/* optional instructions automatically implemented */ #undef TCG_TARGET_HAS_neg_i32/* sub rd, zero, rt */
tcg/ppc/tcg-target.h +1 -0
@@ -90,6 +90,7 @@ enum {#define TCG_TARGET_HAS_andc_i32#define TCG_TARGET_HAS_orc_i32/* #define TCG_TARGET_HAS_eqv_i32 */ +/* #define TCG_TARGET_HAS_nand_i32 */ #define TCG_AREG0 TCG_REG_R27#define TCG_AREG1 TCG_REG_R24
tcg/ppc64/tcg-target.h +2 -0
@@ -81,6 +81,7 @@ enum {/* #define TCG_TARGET_HAS_andc_i32 */ /* #define TCG_TARGET_HAS_orc_i32 */ /* #define TCG_TARGET_HAS_eqv_i32 */ +/* #define TCG_TARGET_HAS_nand_i32 */ #define TCG_TARGET_HAS_div_i64/* #define TCG_TARGET_HAS_rot_i64 */
@@ -98,6 +99,7 @@ enum {/* #define TCG_TARGET_HAS_andc_i64 */ /* #define TCG_TARGET_HAS_orc_i64 */ /* #define TCG_TARGET_HAS_eqv_i64 */ +/* #define TCG_TARGET_HAS_nand_i64 */ #define TCG_AREG0 TCG_REG_R27#define TCG_AREG1 TCG_REG_R24
tcg/s390/tcg-target.h +2 -0
@@ -60,6 +60,7 @@ enum {// #define TCG_TARGET_HAS_andc_i32 // #define TCG_TARGET_HAS_orc_i32 // #define TCG_TARGET_HAS_eqv_i32 +// #define TCG_TARGET_HAS_nand_i32 // #define TCG_TARGET_HAS_div_i64 // #define TCG_TARGET_HAS_rot_i64
@@ -77,6 +78,7 @@ enum {// #define TCG_TARGET_HAS_andc_i64 // #define TCG_TARGET_HAS_orc_i64 // #define TCG_TARGET_HAS_eqv_i64 +// #define TCG_TARGET_HAS_nand_i64 /* used for function call generation */ #define TCG_REG_CALL_STACK TCG_REG_R15
tcg/sparc/tcg-target.h +2 -0
@@ -101,6 +101,7 @@ enum {#define TCG_TARGET_HAS_andc_i32#define TCG_TARGET_HAS_orc_i32// #define TCG_TARGET_HAS_eqv_i32 +// #define TCG_TARGET_HAS_nand_i32 #if TCG_TARGET_REG_BITS ==64 #define TCG_TARGET_HAS_div_i64
@@ -119,6 +120,7 @@ enum {#define TCG_TARGET_HAS_andc_i64#define TCG_TARGET_HAS_orc_i64// #define TCG_TARGET_HAS_eqv_i64 +// #define TCG_TARGET_HAS_nand_i64 #endif /* Note: must be synced with dyngen-exec.h and Makefile.target */
tcg/tcg-op.h +11 -0
@@ -1763,14 +1763,25 @@ static inline void tcg_gen_eqv_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)static inline void tcg_gen_nand_i32 (TCGv_i32 ret,TCGv_i32 arg1,TCGv_i32 arg2) { +#ifdef TCG_TARGET_HAS_nand_i32 +tcg_gen_op3_i32 (INDEX_op_nand_i32, ret, arg1, arg2); +#else tcg_gen_and_i32 (ret, arg1, arg2);tcg_gen_not_i32 (ret, ret); +#endif }static inline void tcg_gen_nand_i64 (TCGv_i64 ret,TCGv_i64 arg1,TCGv_i64 arg2) { +#ifdef TCG_TARGET_HAS_nand_i64 +tcg_gen_op3_i64 (INDEX_op_nand_i64, ret, arg1, arg2); +#elif defined(TCG_TARGET_HAS_nand_i32) &&TCG_TARGET_REG_BITS ==32 +tcg_gen_nand_i32 (TCGV_LOW (ret),TCGV_LOW (arg1),TCGV_LOW (arg2)); +tcg_gen_nand_i32 (TCGV_HIGH (ret),TCGV_HIGH (arg1),TCGV_HIGH (arg2)); +#else tcg_gen_and_i64 (ret, arg1, arg2);tcg_gen_not_i64 (ret, ret); +#endif }static inline void tcg_gen_nor_i32 (TCGv_i32 ret,TCGv_i32 arg1,TCGv_i32 arg2)
tcg/tcg-opc.h +6 -0
@@ -117,6 +117,9 @@ DEF2(orc_i32, 1, 2, 0, 0)#ifdef TCG_TARGET_HAS_eqv_i32 DEF2(eqv_i32, 1, 2, 0, 0)#endif +#ifdef TCG_TARGET_HAS_nand_i32 +DEF2(nand_i32, 1, 2, 0, 0) +#endif #if TCG_TARGET_REG_BITS ==64 DEF2 (mov_i64,1 ,1 ,0 ,0 )
@@ -202,6 +205,9 @@ DEF2(orc_i64, 1, 2, 0, 0)#ifdef TCG_TARGET_HAS_eqv_i64 DEF2(eqv_i64, 1, 2, 0, 0)#endif +#ifdef TCG_TARGET_HAS_nand_i64 +DEF2(nand_i64, 1, 2, 0, 0) +#endif #endif /* QEMU specific */
tcg/x86_64/tcg-target.h +2 -0
@@ -86,6 +86,8 @@ enum {// #define TCG_TARGET_HAS_orc_i64 // #define TCG_TARGET_HAS_eqv_i32 // #define TCG_TARGET_HAS_eqv_i64 +// #define TCG_TARGET_HAS_nand_i32 +// #define TCG_TARGET_HAS_nand_i64 #define TCG_TARGET_HAS_GUEST_BASE
Signature · 1 line
1.6.6.1
PATCH 9/9 tcg: Allow target-specific implementation of NOR.
In reply to Richard Henderson--- tcg/arm/tcg-target.h | 1 + tcg/i386/tcg-target.h | 1 + tcg/mips/tcg-target.h | 1 + tcg/ppc/tcg-target.h | 1 + tcg/ppc64/tcg-target.h | 2 ++ tcg/s390/tcg-target.h | 2 ++ tcg/sparc/tcg-target.h | 2 ++ tcg/tcg-op.h | 11 +++++++++++ tcg/tcg-opc.h | 6 ++++++ tcg/x86_64/tcg-target.h | 2 ++ 10 files changed, 29 insertions(+), 0 deletions(-)
tcg/arm/tcg-target.h +1 -0
@@ -69,6 +69,7 @@ enum {// #define TCG_TARGET_HAS_orc_i32 // #define TCG_TARGET_HAS_eqv_i32 // #define TCG_TARGET_HAS_nand_i32 +// #define TCG_TARGET_HAS_nor_i32 #define TCG_TARGET_HAS_GUEST_BASE
tcg/i386/tcg-target.h +1 -0
@@ -59,6 +59,7 @@ enum {// #define TCG_TARGET_HAS_orc_i32 // #define TCG_TARGET_HAS_eqv_i32 // #define TCG_TARGET_HAS_nand_i32 +// #define TCG_TARGET_HAS_nor_i32 #define TCG_TARGET_HAS_GUEST_BASE
tcg/mips/tcg-target.h +1 -0
@@ -89,6 +89,7 @@ enum {#undef TCG_TARGET_HAS_orc_i32#undef TCG_TARGET_HAS_eqv_i32#undef TCG_TARGET_HAS_nand_i32 +#undef TCG_TARGET_HAS_nor_i32/* optional instructions automatically implemented */ #undef TCG_TARGET_HAS_neg_i32/* sub rd, zero, rt */
tcg/ppc/tcg-target.h +1 -0
@@ -91,6 +91,7 @@ enum {#define TCG_TARGET_HAS_orc_i32/* #define TCG_TARGET_HAS_eqv_i32 */ /* #define TCG_TARGET_HAS_nand_i32 */ +/* #define TCG_TARGET_HAS_nor_i32 */ #define TCG_AREG0 TCG_REG_R27#define TCG_AREG1 TCG_REG_R24
tcg/ppc64/tcg-target.h +2 -0
@@ -82,6 +82,7 @@ enum {/* #define TCG_TARGET_HAS_orc_i32 */ /* #define TCG_TARGET_HAS_eqv_i32 */ /* #define TCG_TARGET_HAS_nand_i32 */ +/* #define TCG_TARGET_HAS_nor_i32 */ #define TCG_TARGET_HAS_div_i64/* #define TCG_TARGET_HAS_rot_i64 */
@@ -100,6 +101,7 @@ enum {/* #define TCG_TARGET_HAS_orc_i64 */ /* #define TCG_TARGET_HAS_eqv_i64 */ /* #define TCG_TARGET_HAS_nand_i64 */ +/* #define TCG_TARGET_HAS_nor_i64 */ #define TCG_AREG0 TCG_REG_R27#define TCG_AREG1 TCG_REG_R24
tcg/s390/tcg-target.h +2 -0
@@ -61,6 +61,7 @@ enum {// #define TCG_TARGET_HAS_orc_i32 // #define TCG_TARGET_HAS_eqv_i32 // #define TCG_TARGET_HAS_nand_i32 +// #define TCG_TARGET_HAS_nor_i32 // #define TCG_TARGET_HAS_div_i64 // #define TCG_TARGET_HAS_rot_i64
@@ -79,6 +80,7 @@ enum {// #define TCG_TARGET_HAS_orc_i64 // #define TCG_TARGET_HAS_eqv_i64 // #define TCG_TARGET_HAS_nand_i64 +// #define TCG_TARGET_HAS_nor_i64 /* used for function call generation */ #define TCG_REG_CALL_STACK TCG_REG_R15
tcg/sparc/tcg-target.h +2 -0
@@ -102,6 +102,7 @@ enum {#define TCG_TARGET_HAS_orc_i32// #define TCG_TARGET_HAS_eqv_i32 // #define TCG_TARGET_HAS_nand_i32 +// #define TCG_TARGET_HAS_nor_i32 #if TCG_TARGET_REG_BITS ==64 #define TCG_TARGET_HAS_div_i64
@@ -121,6 +122,7 @@ enum {#define TCG_TARGET_HAS_orc_i64// #define TCG_TARGET_HAS_eqv_i64 // #define TCG_TARGET_HAS_nand_i64 +// #define TCG_TARGET_HAS_nor_i64 #endif /* Note: must be synced with dyngen-exec.h and Makefile.target */
tcg/tcg-op.h +11 -0
@@ -1786,14 +1786,25 @@ static inline void tcg_gen_nand_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)static inline void tcg_gen_nor_i32 (TCGv_i32 ret,TCGv_i32 arg1,TCGv_i32 arg2) { +#ifdef TCG_TARGET_HAS_nor_i32 +tcg_gen_op3_i32 (INDEX_op_nor_i32, ret, arg1, arg2); +#else tcg_gen_or_i32 (ret, arg1, arg2);tcg_gen_not_i32 (ret, ret); +#endif }static inline void tcg_gen_nor_i64 (TCGv_i64 ret,TCGv_i64 arg1,TCGv_i64 arg2) { +#ifdef TCG_TARGET_HAS_nor_i64 +tcg_gen_op3_i64 (INDEX_op_nor_i64, ret, arg1, arg2); +#elif defined(TCG_TARGET_HAS_nor_i32) &&TCG_TARGET_REG_BITS ==32 +tcg_gen_nor_i32 (TCGV_LOW (ret),TCGV_LOW (arg1),TCGV_LOW (arg2)); +tcg_gen_nor_i32 (TCGV_HIGH (ret),TCGV_HIGH (arg1),TCGV_HIGH (arg2)); +#else tcg_gen_or_i64 (ret, arg1, arg2);tcg_gen_not_i64 (ret, ret); +#endif }static inline void tcg_gen_orc_i32 (TCGv_i32 ret,TCGv_i32 arg1,TCGv_i32 arg2)
tcg/tcg-opc.h +6 -0
@@ -120,6 +120,9 @@ DEF2(eqv_i32, 1, 2, 0, 0)#ifdef TCG_TARGET_HAS_nand_i32 DEF2(nand_i32, 1, 2, 0, 0)#endif +#ifdef TCG_TARGET_HAS_nor_i32 +DEF2(nor_i32, 1, 2, 0, 0) +#endif #if TCG_TARGET_REG_BITS ==64 DEF2 (mov_i64,1 ,1 ,0 ,0 )
@@ -208,6 +211,9 @@ DEF2(eqv_i64, 1, 2, 0, 0)#ifdef TCG_TARGET_HAS_nand_i64 DEF2(nand_i64, 1, 2, 0, 0)#endif +#ifdef TCG_TARGET_HAS_nor_i64 +DEF2(nor_i64, 1, 2, 0, 0) +#endif #endif /* QEMU specific */
tcg/x86_64/tcg-target.h +2 -0
@@ -88,6 +88,8 @@ enum {// #define TCG_TARGET_HAS_eqv_i64 // #define TCG_TARGET_HAS_nand_i32 // #define TCG_TARGET_HAS_nand_i64 +// #define TCG_TARGET_HAS_nor_i32 +// #define TCG_TARGET_HAS_nor_i64 #define TCG_TARGET_HAS_GUEST_BASE
Signature · 1 line
1.6.6.1
Quoted 10 lines · Richard Henderson
Three of the patches improve the debugging of TCG by using enumerations where it makes sense. This avoids having to grovel through header files to figure out what a given constant refers to.
Four of the patches have previously been posted by Nathan Froyd. Since my ANDC and ORC patches were accepted on 2010-02-20, it seems silly to not complete the job with the existing compound logical operaions already defined in
tcg-op.h.One patch is required to make the uncommitted Alpha TCG port function.
I have applied patches 2-9. The patch 1 probably needs more ack first, at it removes a "feature".
Quoted 41 lines
r~
Richard Henderson (9):
tcg: Remove jmp opcode.
tcg: Name the opcode enumeration.
tcg: Use TCGCond where appropriate.
tcg: Change TCGType to an enumeration.
tcg: Disambiguateqemu_ld32uwith 32-bit and 64-bit outputs.
tcg: Usenot_i32to implementnot_i64.
tcg: Allow target-specific implementation of EQV.
tcg: Allow target-specific implementation of NAND.
tcg: Allow target-specific implementation of NOR.tcg/README | 19 +++--- tcg/arm/tcg-target.c | 13 +--- tcg/arm/tcg-target.h | 3 + tcg/hppa/tcg-target.c | 13 +--- tcg/i386/tcg-target.c | 21 ++---- tcg/i386/tcg-target.h | 3 + tcg/mips/tcg-target.c | 21 ++---- tcg/mips/tcg-target.h | 3 + tcg/ppc/tcg-target.c | 25 ++----- tcg/ppc/tcg-target.h | 3 + tcg/ppc64/tcg-target.c | 21 ++---- tcg/ppc64/tcg-target.h | 6 ++ tcg/s390/tcg-target.c | 2 +- tcg/s390/tcg-target.h | 6 ++ tcg/sparc/tcg-target.c | 22 ++++--- tcg/sparc/tcg-target.h | 6 ++ tcg/tcg-op.h | 164 ++++++++++++++++++++++++++++------------------- tcg/tcg-opc.h | 24 ++++++- tcg/tcg.c | 33 +++++++--- tcg/tcg.h | 25 ++++--- tcg/x86_64/tcg-target.c | 16 ++--- tcg/x86_64/tcg-target.h | 6 ++ 22 files changed, 258 insertions(+), 197 deletions(-)
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net