Revisión | 461aa6783eec27f209b026c6647fc7a83b2997cd (tree) |
---|---|
Tiempo | 2015-09-15 23:45:34 |
Autor | Richard Henderson <rth@twid...> |
Commiter | Richard Henderson |
target-tilegx: Handle v1shl, v1shru, v1shrs
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
@@ -1 +1 @@ | ||
1 | -obj-y += cpu.o translate.o helper.o | |
1 | +obj-y += cpu.o translate.o helper.o simd_helper.o |
@@ -4,3 +4,7 @@ DEF_HELPER_FLAGS_1(cnttz, TCG_CALL_NO_RWG_SE, i64, i64) | ||
4 | 4 | DEF_HELPER_FLAGS_1(pcnt, TCG_CALL_NO_RWG_SE, i64, i64) |
5 | 5 | DEF_HELPER_FLAGS_1(revbits, TCG_CALL_NO_RWG_SE, i64, i64) |
6 | 6 | DEF_HELPER_FLAGS_3(shufflebytes, TCG_CALL_NO_RWG_SE, i64, i64, i64, i64) |
7 | + | |
8 | +DEF_HELPER_FLAGS_2(v1shl, TCG_CALL_NO_RWG_SE, i64, i64, i64) | |
9 | +DEF_HELPER_FLAGS_2(v1shru, TCG_CALL_NO_RWG_SE, i64, i64, i64) | |
10 | +DEF_HELPER_FLAGS_2(v1shrs, TCG_CALL_NO_RWG_SE, i64, i64, i64) |
@@ -0,0 +1,55 @@ | ||
1 | +/* | |
2 | + * QEMU TILE-Gx helpers | |
3 | + * | |
4 | + * Copyright (c) 2015 Chen Gang | |
5 | + * | |
6 | + * This library is free software; you can redistribute it and/or | |
7 | + * modify it under the terms of the GNU Lesser General Public | |
8 | + * License as published by the Free Software Foundation; either | |
9 | + * version 2.1 of the License, or (at your option) any later version. | |
10 | + * | |
11 | + * This library is distributed in the hope that it will be useful, | |
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | + * Lesser General Public License for more details. | |
15 | + * | |
16 | + * You should have received a copy of the GNU Lesser General Public | |
17 | + * License along with this library; if not, see | |
18 | + * <http://www.gnu.org/licenses/lgpl-2.1.html> | |
19 | + */ | |
20 | + | |
21 | +#include "cpu.h" | |
22 | +#include "qemu-common.h" | |
23 | +#include "exec/helper-proto.h" | |
24 | + | |
25 | + | |
26 | +uint64_t helper_v1shl(uint64_t a, uint64_t b) | |
27 | +{ | |
28 | + uint64_t m; | |
29 | + | |
30 | + b &= 7; | |
31 | + m = 0x0101010101010101ULL * (0xff >> b); | |
32 | + return (a & m) << b; | |
33 | +} | |
34 | + | |
35 | +uint64_t helper_v1shru(uint64_t a, uint64_t b) | |
36 | +{ | |
37 | + uint64_t m; | |
38 | + | |
39 | + b &= 7; | |
40 | + m = 0x0101010101010101ULL * ((0xff << b) & 0xff); | |
41 | + return (a & m) >> b; | |
42 | +} | |
43 | + | |
44 | +uint64_t helper_v1shrs(uint64_t a, uint64_t b) | |
45 | +{ | |
46 | + uint64_t r = 0; | |
47 | + int i; | |
48 | + | |
49 | + b &= 7; | |
50 | + for (i = 0; i < 64; i += 8) { | |
51 | + int64_t ae = (int8_t)(a >> i); | |
52 | + r |= ((ae >> b) & 0xff) << i; | |
53 | + } | |
54 | + return r; | |
55 | +} |
@@ -1077,12 +1077,22 @@ static TileExcp gen_rrr_opcode(DisasContext *dc, unsigned opext, | ||
1077 | 1077 | case OE_RRR(V1MZ, 0, X1): |
1078 | 1078 | case OE_RRR(V1SADAU, 0, X0): |
1079 | 1079 | case OE_RRR(V1SADU, 0, X0): |
1080 | + return TILEGX_EXCP_OPCODE_UNIMPLEMENTED; | |
1080 | 1081 | case OE_RRR(V1SHL, 0, X0): |
1081 | 1082 | case OE_RRR(V1SHL, 0, X1): |
1083 | + gen_helper_v1shl(tdest, tsrca, tsrcb); | |
1084 | + mnemonic = "v1shl"; | |
1085 | + break; | |
1082 | 1086 | case OE_RRR(V1SHRS, 0, X0): |
1083 | 1087 | case OE_RRR(V1SHRS, 0, X1): |
1088 | + gen_helper_v1shrs(tdest, tsrca, tsrcb); | |
1089 | + mnemonic = "v1shrs"; | |
1090 | + break; | |
1084 | 1091 | case OE_RRR(V1SHRU, 0, X0): |
1085 | 1092 | case OE_RRR(V1SHRU, 0, X1): |
1093 | + gen_helper_v1shru(tdest, tsrca, tsrcb); | |
1094 | + mnemonic = "v1shru"; | |
1095 | + break; | |
1086 | 1096 | case OE_RRR(V1SUBUC, 0, X0): |
1087 | 1097 | case OE_RRR(V1SUBUC, 0, X1): |
1088 | 1098 | case OE_RRR(V1SUB, 0, X0): |
@@ -1199,6 +1209,7 @@ static TileExcp gen_rri_opcode(DisasContext *dc, unsigned opext, | ||
1199 | 1209 | const char *mnemonic; |
1200 | 1210 | TCGMemOp memop; |
1201 | 1211 | int i2, i3; |
1212 | + TCGv t0; | |
1202 | 1213 | |
1203 | 1214 | switch (opext) { |
1204 | 1215 | case OE(ADDI_OPCODE_Y0, 0, Y0): |
@@ -1401,7 +1412,11 @@ static TileExcp gen_rri_opcode(DisasContext *dc, unsigned opext, | ||
1401 | 1412 | break; |
1402 | 1413 | case OE_SH(V1SHRSI, X0): |
1403 | 1414 | case OE_SH(V1SHRSI, X1): |
1404 | - return TILEGX_EXCP_OPCODE_UNIMPLEMENTED; | |
1415 | + t0 = tcg_const_tl(imm & 7); | |
1416 | + gen_helper_v1shrs(tdest, tsrca, t0); | |
1417 | + tcg_temp_free(t0); | |
1418 | + mnemonic = "v1shrsi"; | |
1419 | + break; | |
1405 | 1420 | case OE_SH(V1SHRUI, X0): |
1406 | 1421 | case OE_SH(V1SHRUI, X1): |
1407 | 1422 | i2 = imm & 7; |