Fix ppc64 tcg issues
Patches from Anton, with the revised patch 1 as posted to the list. Reviewed by me and IMO ready for merge.
r~
The following changes since commit 38aea177d93556aada7c4c7aa530f0050715e293:
Merge remote-tracking branch 'pmaydell/configury.next' into staging (2013-06-17 08:57:57 -0500)
are available in the git repository at:
git://github.com/rth7680/qemu.git fix-ppc64
for you to fetch changes up to d1bdd3af49f227dd4a4b03b90cb020c55cbed440:
tcg-ppc64: rotr_i32 rotates wrong amount (2013-06-17 10:42:16 -0700)
----------------------------------------------------------------
Anton Blanchard (4):
tcg-ppc64: Fix RLDCL opcode
tcg-ppc64: bswap64 rotates output 32 bits
tcg-ppc64: Fix add2_i64
tcg-ppc64: rotr_i32 rotates wrong amount
tcg/ppc64/tcg-target.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-)
[Qemu-devel] [PULL 1/4] tcg-ppc64: Fix RLDCL opcode
From: Anton Blanchard <[email protected]>
The rldcl instruction doesn't have an sh field, so the minor opcode is shifted 1 bit. We were using the XO30 macro which shifted the minor opcode 2 bits.
Remove XO30 and add MD30 and MDS30 macros which match the Power ISA categories.
--- tcg/ppc64/tcg-target.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
tcg/ppc64/tcg-target.c +6 -5
@@ -308,7 +308,8 @@ static int tcg_target_const_match (tcg_target_long val,#define OPCD (opc) ((opc)<<26)#define XO19 (opc) (OPCD(19)|((opc)<<1)) -#define XO30 (opc) (OPCD(30)|((opc)<<2)) +#define MD30 (opc) (OPCD(30)|((opc)<<2)) +#define MDS30 (opc) (OPCD(30)|((opc)<<1))#define XO31 (opc) (OPCD(31)|((opc)<<1))#define XO58 (opc) (OPCD(58)|(opc))#define XO62 (opc) (OPCD(62)|(opc))
@@ -354,10 +355,10 @@ static int tcg_target_const_match (tcg_target_long val,#define RLWINM OPCD( 21)#define RLWNM OPCD( 23) -#define RLDICL XO30( 0) -#define RLDICR XO30( 1) -#define RLDIMI XO30( 3) -#define RLDCL XO30( 8) +#define RLDICL MD30( 0) +#define RLDICR MD30( 1) +#define RLDIMI MD30( 3) +#define RLDCL MDS30( 8)#define BCLR XO19( 16)#define BCCTR XO19(528)
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 2/4] tcg-ppc64: bswap64 rotates output 32 bits
In reply to Richard HendersonFrom: Anton Blanchard <[email protected]>
If our input and output is in the same register, bswap64 tries to undo a rotate of the input. This just ends up rotating the output.
--- tcg/ppc64/tcg-target.c | 2 -- 1 file changed, 2 deletions(-)
tcg/ppc64/tcg-target.c +0 -2
@@ -1923,8 +1923,6 @@ static void tcg_out_op (TCGContext *s, TCGOpcode opc, const TCGArg *args,if (a0 ==0 ) {tcg_out_mov (s,TCG_TYPE_I64 , args[0 ], a0); -/* Revert the source rotate that we performed above. */ -tcg_out_rld (s,RLDICL , a1, a1,32 ,0 ); }break ;
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 3/4] tcg-ppc64: Fix add2_i64
In reply to Richard HendersonFrom: Anton Blanchard <[email protected]>
add2_i64 was adding the lower double word to the upper double word of each input. Fix this so we add the lower double words, then the upper double words with carry propagation.
--- tcg/ppc64/tcg-target.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
tcg/ppc64/tcg-target.c +7 -7
@@ -1959,18 +1959,18 @@ static void tcg_out_op (TCGContext *s, TCGOpcode opc, const TCGArg *args,environment. So in 64-bit mode it's always carry-out of bit 63. The fallback code using deposit works just as well for 32-bit. */ a0 = args[0 ], a1 = args[1 ]; -if (a0 == args[4 ] || (!const_args[5 ] && a0 == args[5 ])) { +if (a0 == args[3 ] || (!const_args[5 ] && a0 == args[5 ])) { a0 =TCG_REG_R0 ; } -if (const_args[3 ]) { -tcg_out32 (s,ADDIC |TAI (a0, args[2 ], args[3 ])); +if (const_args[4 ]) { +tcg_out32 (s,ADDIC |TAI (a0, args[2 ], args[4 ])); }else { -tcg_out32 (s,ADDC |TAB (a0, args[2 ], args[3 ])); +tcg_out32 (s,ADDC |TAB (a0, args[2 ], args[4 ])); }if (const_args[5 ]) { -tcg_out32 (s, (args[5 ] ?ADDME :ADDZE ) |RT (a1) |RA (args[4 ])); +tcg_out32 (s, (args[5 ] ?ADDME :ADDZE ) |RT (a1) |RA (args[3 ])); }else { -tcg_out32 (s,ADDE |TAB (a1, args[4 ], args[5 ])); +tcg_out32 (s,ADDE |TAB (a1, args[3 ], args[5 ])); }if (a0 != args[0 ]) {tcg_out_mov (s,TCG_TYPE_I64 , args[0 ], a0);
@@ -2148,7 +2148,7 @@ static const TCGTargetOpDef ppc_op_defs[] = { { INDEX_op_deposit_i32, { "r", "0", "rZ" } }, { INDEX_op_deposit_i64, { "r", "0", "rZ" } }, - { INDEX_op_add2_i64, { "r", "r", "r", "rI", "r", "rZM" } }, + { INDEX_op_add2_i64, { "r", "r", "r", "r", "rI", "rZM" } }, { INDEX_op_sub2_i64, { "r", "r", "rI", "r", "rZM", "r" } }, { INDEX_op_muls2_i64, { "r", "r", "r", "r" } }, { INDEX_op_mulu2_i64, { "r", "r", "r", "r" } },
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 4/4] tcg-ppc64: rotr_i32 rotates wrong amount
In reply to Richard HendersonFrom: Anton Blanchard <[email protected]>
rotr_i32 calculates the amount to left shift and puts it into a temporary, but then doesn't use it when doing the shift.
--- tcg/ppc64/tcg-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tcg/ppc64/tcg-target.c +1 -1
@@ -1662,7 +1662,7 @@ static void tcg_out_op (TCGContext *s, TCGOpcode opc, const TCGArg *args,tcg_out_rlw (s,RLWINM , args[0 ], args[1 ],32 - args[2 ],0 ,31 ); }else {tcg_out32 (s,SUBFIC |TAI (0 , args[2 ],32 )); -tcg_out32 (s,RLWNM |SAB (args[1 ], args[0 ], args[2 ]) +tcg_out32 (s,RLWNM |SAB (args[1 ], args[0 ],0 ) |MB (0 ) |ME (31 )); }break ;
Signature · 1 line
1.8.1.4
Pulled. Thanks.
Regards,
Anthony Liguori