Commit 000a2d866a65d7aca6ee2b0214306c14507eb207

Authored by malc
1 parent e924bbec

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
tcg/ppc/tcg-target.c
@@ -1113,22 +1113,14 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args, @@ -1113,22 +1113,14 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
1113 1113
1114 case INDEX_op_and_i32: 1114 case INDEX_op_and_i32:
1115 if (const_args[2]) { 1115 if (const_args[2]) {
1116 - if (!args[2])  
1117 - tcg_out_movi (s, TCG_TYPE_I32, args[0], 0); 1116 + if ((args[2] & 0xffff) == args[2])
  1117 + tcg_out32 (s, ANDI | RS (args[1]) | RA (args[0]) | args[2]);
  1118 + else if ((args[2] & 0xffff0000) == args[2])
  1119 + tcg_out32 (s, ANDIS | RS (args[1]) | RA (args[0])
  1120 + | ((args[2] >> 16) & 0xffff));
1118 else { 1121 else {
1119 - if ((args[2] & 0xffff) == args[2])  
1120 - tcg_out32 (s, ANDI | RS (args[1]) | RA (args[0]) | args[2]);  
1121 - else if ((args[2] & 0xffff0000) == args[2])  
1122 - tcg_out32 (s, ANDIS | RS (args[1]) | RA (args[0])  
1123 - | ((args[2] >> 16) & 0xffff));  
1124 - else if (args[2] == 0xffffffff) {  
1125 - if (args[0] != args[1])  
1126 - tcg_out_mov (s, args[0], args[1]);  
1127 - }  
1128 - else {  
1129 - tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);  
1130 - tcg_out32 (s, AND | SAB (args[1], args[0], 0));  
1131 - } 1122 + tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);
  1123 + tcg_out32 (s, AND | SAB (args[1], args[0], 0));
1132 } 1124 }
1133 } 1125 }
1134 else 1126 else
@@ -1136,22 +1128,16 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args, @@ -1136,22 +1128,16 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
1136 break; 1128 break;
1137 case INDEX_op_or_i32: 1129 case INDEX_op_or_i32:
1138 if (const_args[2]) { 1130 if (const_args[2]) {
1139 - if (args[2]) {  
1140 - if (args[2] & 0xffff) {  
1141 - tcg_out32 (s, ORI | RS (args[1]) | RA (args[0])  
1142 - | (args[2] & 0xffff));  
1143 - if (args[2] >> 16)  
1144 - tcg_out32 (s, ORIS | RS (args[0]) | RA (args[0])  
1145 - | ((args[2] >> 16) & 0xffff));  
1146 - }  
1147 - else {  
1148 - tcg_out32 (s, ORIS | RS (args[1]) | RA (args[0]) 1131 + if (args[2] & 0xffff) {
  1132 + tcg_out32 (s, ORI | RS (args[1]) | RA (args[0])
  1133 + | (args[2] & 0xffff));
  1134 + if (args[2] >> 16)
  1135 + tcg_out32 (s, ORIS | RS (args[0]) | RA (args[0])
1149 | ((args[2] >> 16) & 0xffff)); 1136 | ((args[2] >> 16) & 0xffff));
1150 - }  
1151 } 1137 }
1152 else { 1138 else {
1153 - if (args[0] != args[1])  
1154 - tcg_out_mov (s, args[0], args[1]); 1139 + tcg_out32 (s, ORIS | RS (args[1]) | RA (args[0])
  1140 + | ((args[2] >> 16) & 0xffff));
1155 } 1141 }
1156 } 1142 }
1157 else 1143 else
@@ -1159,21 +1145,15 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args, @@ -1159,21 +1145,15 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
1159 break; 1145 break;
1160 case INDEX_op_xor_i32: 1146 case INDEX_op_xor_i32:
1161 if (const_args[2]) { 1147 if (const_args[2]) {
1162 - if (args[2]) {  
1163 - if ((args[2] & 0xffff) == args[2])  
1164 - tcg_out32 (s, XORI | RS (args[1]) | RA (args[0])  
1165 - | (args[2] & 0xffff));  
1166 - else if ((args[2] & 0xffff0000) == args[2])  
1167 - tcg_out32 (s, XORIS | RS (args[1]) | RA (args[0])  
1168 - | ((args[2] >> 16) & 0xffff));  
1169 - else {  
1170 - tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);  
1171 - tcg_out32 (s, XOR | SAB (args[1], args[0], 0));  
1172 - }  
1173 - } 1148 + if ((args[2] & 0xffff) == args[2])
  1149 + tcg_out32 (s, XORI | RS (args[1]) | RA (args[0])
  1150 + | (args[2] & 0xffff));
  1151 + else if ((args[2] & 0xffff0000) == args[2])
  1152 + tcg_out32 (s, XORIS | RS (args[1]) | RA (args[0])
  1153 + | ((args[2] >> 16) & 0xffff));
1174 else { 1154 else {
1175 - if (args[0] != args[1])  
1176 - tcg_out_mov (s, args[0], args[1]); 1155 + tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);
  1156 + tcg_out32 (s, XOR | SAB (args[1], args[0], 0));
1177 } 1157 }
1178 } 1158 }
1179 else 1159 else
@@ -1228,34 +1208,28 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args, @@ -1228,34 +1208,28 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
1228 1208
1229 case INDEX_op_shl_i32: 1209 case INDEX_op_shl_i32:
1230 if (const_args[2]) { 1210 if (const_args[2]) {
1231 - if (args[2])  
1232 - tcg_out32 (s, (RLWINM  
1233 - | RA (args[0])  
1234 - | RS (args[1])  
1235 - | SH (args[2])  
1236 - | MB (0)  
1237 - | ME (31 - args[2])  
1238 - )  
1239 - );  
1240 - else  
1241 - tcg_out_mov (s, args[0], args[1]); 1211 + tcg_out32 (s, (RLWINM
  1212 + | RA (args[0])
  1213 + | RS (args[1])
  1214 + | SH (args[2])
  1215 + | MB (0)
  1216 + | ME (31 - args[2])
  1217 + )
  1218 + );
1242 } 1219 }
1243 else 1220 else
1244 tcg_out32 (s, SLW | SAB (args[1], args[0], args[2])); 1221 tcg_out32 (s, SLW | SAB (args[1], args[0], args[2]));
1245 break; 1222 break;
1246 case INDEX_op_shr_i32: 1223 case INDEX_op_shr_i32:
1247 if (const_args[2]) { 1224 if (const_args[2]) {
1248 - if (args[2])  
1249 - tcg_out32 (s, (RLWINM  
1250 - | RA (args[0])  
1251 - | RS (args[1])  
1252 - | SH (32 - args[2])  
1253 - | MB (args[2])  
1254 - | ME (31)  
1255 - )  
1256 - );  
1257 - else  
1258 - tcg_out_mov (s, args[0], args[1]); 1225 + tcg_out32 (s, (RLWINM
  1226 + | RA (args[0])
  1227 + | RS (args[1])
  1228 + | SH (32 - args[2])
  1229 + | MB (args[2])
  1230 + | ME (31)
  1231 + )
  1232 + );
1259 } 1233 }
1260 else 1234 else
1261 tcg_out32 (s, SRW | SAB (args[1], args[0], args[2])); 1235 tcg_out32 (s, SRW | SAB (args[1], args[0], args[2]));
tcg/ppc64/tcg-target.c
@@ -1104,22 +1104,14 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args, @@ -1104,22 +1104,14 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args,
1104 1104
1105 case INDEX_op_and_i32: 1105 case INDEX_op_and_i32:
1106 if (const_args[2]) { 1106 if (const_args[2]) {
1107 - if (!args[2])  
1108 - tcg_out_movi (s, TCG_TYPE_I32, args[0], 0); 1107 + if ((args[2] & 0xffff) == args[2])
  1108 + tcg_out32 (s, ANDI | RS (args[1]) | RA (args[0]) | args[2]);
  1109 + else if ((args[2] & 0xffff0000) == args[2])
  1110 + tcg_out32 (s, ANDIS | RS (args[1]) | RA (args[0])
  1111 + | ((args[2] >> 16) & 0xffff));
1109 else { 1112 else {
1110 - if ((args[2] & 0xffff) == args[2])  
1111 - tcg_out32 (s, ANDI | RS (args[1]) | RA (args[0]) | args[2]);  
1112 - else if ((args[2] & 0xffff0000) == args[2])  
1113 - tcg_out32 (s, ANDIS | RS (args[1]) | RA (args[0])  
1114 - | ((args[2] >> 16) & 0xffff));  
1115 - else if (args[2] == 0xffffffff) {  
1116 - if (args[0] != args[1])  
1117 - tcg_out_mov (s, args[0], args[1]);  
1118 - }  
1119 - else {  
1120 - tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);  
1121 - tcg_out32 (s, AND | SAB (args[1], args[0], 0));  
1122 - } 1113 + tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);
  1114 + tcg_out32 (s, AND | SAB (args[1], args[0], 0));
1123 } 1115 }
1124 } 1116 }
1125 else 1117 else
@@ -1127,22 +1119,16 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args, @@ -1127,22 +1119,16 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args,
1127 break; 1119 break;
1128 case INDEX_op_or_i32: 1120 case INDEX_op_or_i32:
1129 if (const_args[2]) { 1121 if (const_args[2]) {
1130 - if (args[2]) {  
1131 - if (args[2] & 0xffff) {  
1132 - tcg_out32 (s, ORI | RS (args[1]) | RA (args[0])  
1133 - | (args[2] & 0xffff));  
1134 - if (args[2] >> 16)  
1135 - tcg_out32 (s, ORIS | RS (args[0]) | RA (args[0])  
1136 - | ((args[2] >> 16) & 0xffff));  
1137 - }  
1138 - else {  
1139 - tcg_out32 (s, ORIS | RS (args[1]) | RA (args[0]) 1122 + if (args[2] & 0xffff) {
  1123 + tcg_out32 (s, ORI | RS (args[1]) | RA (args[0])
  1124 + | (args[2] & 0xffff));
  1125 + if (args[2] >> 16)
  1126 + tcg_out32 (s, ORIS | RS (args[0]) | RA (args[0])
1140 | ((args[2] >> 16) & 0xffff)); 1127 | ((args[2] >> 16) & 0xffff));
1141 - }  
1142 } 1128 }
1143 else { 1129 else {
1144 - if (args[0] != args[1])  
1145 - tcg_out_mov (s, args[0], args[1]); 1130 + tcg_out32 (s, ORIS | RS (args[1]) | RA (args[0])
  1131 + | ((args[2] >> 16) & 0xffff));
1146 } 1132 }
1147 } 1133 }
1148 else 1134 else
@@ -1150,21 +1136,15 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args, @@ -1150,21 +1136,15 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args,
1150 break; 1136 break;
1151 case INDEX_op_xor_i32: 1137 case INDEX_op_xor_i32:
1152 if (const_args[2]) { 1138 if (const_args[2]) {
1153 - if (args[2]) {  
1154 - if ((args[2] & 0xffff) == args[2])  
1155 - tcg_out32 (s, XORI | RS (args[1]) | RA (args[0])  
1156 - | (args[2] & 0xffff));  
1157 - else if ((args[2] & 0xffff0000) == args[2])  
1158 - tcg_out32 (s, XORIS | RS (args[1]) | RA (args[0])  
1159 - | ((args[2] >> 16) & 0xffff));  
1160 - else {  
1161 - tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);  
1162 - tcg_out32 (s, XOR | SAB (args[1], args[0], 0));  
1163 - }  
1164 - } 1139 + if ((args[2] & 0xffff) == args[2])
  1140 + tcg_out32 (s, XORI | RS (args[1]) | RA (args[0])
  1141 + | (args[2] & 0xffff));
  1142 + else if ((args[2] & 0xffff0000) == args[2])
  1143 + tcg_out32 (s, XORIS | RS (args[1]) | RA (args[0])
  1144 + | ((args[2] >> 16) & 0xffff));
1165 else { 1145 else {
1166 - if (args[0] != args[1])  
1167 - tcg_out_mov (s, args[0], args[1]); 1146 + tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);
  1147 + tcg_out32 (s, XOR | SAB (args[1], args[0], 0));
1168 } 1148 }
1169 } 1149 }
1170 else 1150 else
@@ -1207,34 +1187,28 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args, @@ -1207,34 +1187,28 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args,
1207 1187
1208 case INDEX_op_shl_i32: 1188 case INDEX_op_shl_i32:
1209 if (const_args[2]) { 1189 if (const_args[2]) {
1210 - if (args[2])  
1211 - tcg_out32 (s, (RLWINM  
1212 - | RA (args[0])  
1213 - | RS (args[1])  
1214 - | SH (args[2])  
1215 - | MB (0)  
1216 - | ME (31 - args[2])  
1217 - )  
1218 - );  
1219 - else  
1220 - tcg_out_mov (s, args[0], args[1]); 1190 + tcg_out32 (s, (RLWINM
  1191 + | RA (args[0])
  1192 + | RS (args[1])
  1193 + | SH (args[2])
  1194 + | MB (0)
  1195 + | ME (31 - args[2])
  1196 + )
  1197 + );
1221 } 1198 }
1222 else 1199 else
1223 tcg_out32 (s, SLW | SAB (args[1], args[0], args[2])); 1200 tcg_out32 (s, SLW | SAB (args[1], args[0], args[2]));
1224 break; 1201 break;
1225 case INDEX_op_shr_i32: 1202 case INDEX_op_shr_i32:
1226 if (const_args[2]) { 1203 if (const_args[2]) {
1227 - if (args[2])  
1228 - tcg_out32 (s, (RLWINM  
1229 - | RA (args[0])  
1230 - | RS (args[1])  
1231 - | SH (32 - args[2])  
1232 - | MB (args[2])  
1233 - | ME (31)  
1234 - )  
1235 - );  
1236 - else  
1237 - tcg_out_mov (s, args[0], args[1]); 1204 + tcg_out32 (s, (RLWINM
  1205 + | RA (args[0])
  1206 + | RS (args[1])
  1207 + | SH (32 - args[2])
  1208 + | MB (args[2])
  1209 + | ME (31)
  1210 + )
  1211 + );
1238 } 1212 }
1239 else 1213 else
1240 tcg_out32 (s, SRW | SAB (args[1], args[0], args[2])); 1214 tcg_out32 (s, SRW | SAB (args[1], args[0], args[2]));