Revision 000a2d86

b/tcg/ppc/tcg-target.c
1113 1113

  
1114 1114
    case INDEX_op_and_i32:
1115 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 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 1126
        else
......
1136 1128
        break;
1137 1129
    case INDEX_op_or_i32:
1138 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 1136
                               | ((args[2] >> 16) & 0xffff));
1150
                }
1151 1137
            }
1152 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 1143
        else
......
1159 1145
        break;
1160 1146
    case INDEX_op_xor_i32:
1161 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 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 1159
        else
......
1228 1208

  
1229 1209
    case INDEX_op_shl_i32:
1230 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 1220
        else
1244 1221
            tcg_out32 (s, SLW | SAB (args[1], args[0], args[2]));
1245 1222
        break;
1246 1223
    case INDEX_op_shr_i32:
1247 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 1234
        else
1261 1235
            tcg_out32 (s, SRW | SAB (args[1], args[0], args[2]));
b/tcg/ppc64/tcg-target.c
1104 1104

  
1105 1105
    case INDEX_op_and_i32:
1106 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 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 1117
        else
......
1127 1119
        break;
1128 1120
    case INDEX_op_or_i32:
1129 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 1127
                               | ((args[2] >> 16) & 0xffff));
1141
                }
1142 1128
            }
1143 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 1134
        else
......
1150 1136
        break;
1151 1137
    case INDEX_op_xor_i32:
1152 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 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 1150
        else
......
1207 1187

  
1208 1188
    case INDEX_op_shl_i32:
1209 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 1199
        else
1223 1200
            tcg_out32 (s, SLW | SAB (args[1], args[0], args[2]));
1224 1201
        break;
1225 1202
    case INDEX_op_shr_i32:
1226 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 1213
        else
1240 1214
            tcg_out32 (s, SRW | SAB (args[1], args[0], args[2]));

Also available in: Unified diff