Do not try handle "special" arguments of and/or/xor/shl/shr, upper level does it

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4961 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
malc 2008-07-28 23:46:03 +00:00
parent e924bbec7a
commit 000a2d866a
2 changed files with 76 additions and 128 deletions

View file

@ -1113,30 +1113,21 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
case INDEX_op_and_i32:
if (const_args[2]) {
if (!args[2])
tcg_out_movi (s, TCG_TYPE_I32, args[0], 0);
else {
if ((args[2] & 0xffff) == args[2])
tcg_out32 (s, ANDI | RS (args[1]) | RA (args[0]) | args[2]);
else if ((args[2] & 0xffff0000) == args[2])
tcg_out32 (s, ANDIS | RS (args[1]) | RA (args[0])
| ((args[2] >> 16) & 0xffff));
else if (args[2] == 0xffffffff) {
if (args[0] != args[1])
tcg_out_mov (s, args[0], args[1]);
}
else {
tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);
tcg_out32 (s, AND | SAB (args[1], args[0], 0));
}
}
}
else
tcg_out32 (s, AND | SAB (args[1], args[0], args[2]));
break;
case INDEX_op_or_i32:
if (const_args[2]) {
if (args[2]) {
if (args[2] & 0xffff) {
tcg_out32 (s, ORI | RS (args[1]) | RA (args[0])
| (args[2] & 0xffff));
@ -1149,17 +1140,11 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
| ((args[2] >> 16) & 0xffff));
}
}
else {
if (args[0] != args[1])
tcg_out_mov (s, args[0], args[1]);
}
}
else
tcg_out32 (s, OR | SAB (args[1], args[0], args[2]));
break;
case INDEX_op_xor_i32:
if (const_args[2]) {
if (args[2]) {
if ((args[2] & 0xffff) == args[2])
tcg_out32 (s, XORI | RS (args[1]) | RA (args[0])
| (args[2] & 0xffff));
@ -1171,11 +1156,6 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
tcg_out32 (s, XOR | SAB (args[1], args[0], 0));
}
}
else {
if (args[0] != args[1])
tcg_out_mov (s, args[0], args[1]);
}
}
else
tcg_out32 (s, XOR | SAB (args[1], args[0], args[2]));
break;
@ -1228,7 +1208,6 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
case INDEX_op_shl_i32:
if (const_args[2]) {
if (args[2])
tcg_out32 (s, (RLWINM
| RA (args[0])
| RS (args[1])
@ -1237,15 +1216,12 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
| ME (31 - args[2])
)
);
else
tcg_out_mov (s, args[0], args[1]);
}
else
tcg_out32 (s, SLW | SAB (args[1], args[0], args[2]));
break;
case INDEX_op_shr_i32:
if (const_args[2]) {
if (args[2])
tcg_out32 (s, (RLWINM
| RA (args[0])
| RS (args[1])
@ -1254,8 +1230,6 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
| ME (31)
)
);
else
tcg_out_mov (s, args[0], args[1]);
}
else
tcg_out32 (s, SRW | SAB (args[1], args[0], args[2]));

View file

@ -1104,30 +1104,21 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args,
case INDEX_op_and_i32:
if (const_args[2]) {
if (!args[2])
tcg_out_movi (s, TCG_TYPE_I32, args[0], 0);
else {
if ((args[2] & 0xffff) == args[2])
tcg_out32 (s, ANDI | RS (args[1]) | RA (args[0]) | args[2]);
else if ((args[2] & 0xffff0000) == args[2])
tcg_out32 (s, ANDIS | RS (args[1]) | RA (args[0])
| ((args[2] >> 16) & 0xffff));
else if (args[2] == 0xffffffff) {
if (args[0] != args[1])
tcg_out_mov (s, args[0], args[1]);
}
else {
tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);
tcg_out32 (s, AND | SAB (args[1], args[0], 0));
}
}
}
else
tcg_out32 (s, AND | SAB (args[1], args[0], args[2]));
break;
case INDEX_op_or_i32:
if (const_args[2]) {
if (args[2]) {
if (args[2] & 0xffff) {
tcg_out32 (s, ORI | RS (args[1]) | RA (args[0])
| (args[2] & 0xffff));
@ -1140,17 +1131,11 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args,
| ((args[2] >> 16) & 0xffff));
}
}
else {
if (args[0] != args[1])
tcg_out_mov (s, args[0], args[1]);
}
}
else
tcg_out32 (s, OR | SAB (args[1], args[0], args[2]));
break;
case INDEX_op_xor_i32:
if (const_args[2]) {
if (args[2]) {
if ((args[2] & 0xffff) == args[2])
tcg_out32 (s, XORI | RS (args[1]) | RA (args[0])
| (args[2] & 0xffff));
@ -1162,11 +1147,6 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args,
tcg_out32 (s, XOR | SAB (args[1], args[0], 0));
}
}
else {
if (args[0] != args[1])
tcg_out_mov (s, args[0], args[1]);
}
}
else
tcg_out32 (s, XOR | SAB (args[1], args[0], args[2]));
break;
@ -1207,7 +1187,6 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args,
case INDEX_op_shl_i32:
if (const_args[2]) {
if (args[2])
tcg_out32 (s, (RLWINM
| RA (args[0])
| RS (args[1])
@ -1216,15 +1195,12 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args,
| ME (31 - args[2])
)
);
else
tcg_out_mov (s, args[0], args[1]);
}
else
tcg_out32 (s, SLW | SAB (args[1], args[0], args[2]));
break;
case INDEX_op_shr_i32:
if (const_args[2]) {
if (args[2])
tcg_out32 (s, (RLWINM
| RA (args[0])
| RS (args[1])
@ -1233,8 +1209,6 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args,
| ME (31)
)
);
else
tcg_out_mov (s, args[0], args[1]);
}
else
tcg_out32 (s, SRW | SAB (args[1], args[0], args[2]));