• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisión461aa6783eec27f209b026c6647fc7a83b2997cd (tree)
Tiempo2015-09-15 23:45:34
AutorRichard Henderson <rth@twid...>
CommiterRichard Henderson

Log Message

target-tilegx: Handle v1shl, v1shru, v1shrs

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>

Cambiar Resumen

Diferencia incremental

--- a/target-tilegx/Makefile.objs
+++ b/target-tilegx/Makefile.objs
@@ -1 +1 @@
1-obj-y += cpu.o translate.o helper.o
1+obj-y += cpu.o translate.o helper.o simd_helper.o
--- a/target-tilegx/helper.h
+++ b/target-tilegx/helper.h
@@ -4,3 +4,7 @@ DEF_HELPER_FLAGS_1(cnttz, TCG_CALL_NO_RWG_SE, i64, i64)
44 DEF_HELPER_FLAGS_1(pcnt, TCG_CALL_NO_RWG_SE, i64, i64)
55 DEF_HELPER_FLAGS_1(revbits, TCG_CALL_NO_RWG_SE, i64, i64)
66 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)
--- /dev/null
+++ b/target-tilegx/simd_helper.c
@@ -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+}
--- a/target-tilegx/translate.c
+++ b/target-tilegx/translate.c
@@ -1077,12 +1077,22 @@ static TileExcp gen_rrr_opcode(DisasContext *dc, unsigned opext,
10771077 case OE_RRR(V1MZ, 0, X1):
10781078 case OE_RRR(V1SADAU, 0, X0):
10791079 case OE_RRR(V1SADU, 0, X0):
1080+ return TILEGX_EXCP_OPCODE_UNIMPLEMENTED;
10801081 case OE_RRR(V1SHL, 0, X0):
10811082 case OE_RRR(V1SHL, 0, X1):
1083+ gen_helper_v1shl(tdest, tsrca, tsrcb);
1084+ mnemonic = "v1shl";
1085+ break;
10821086 case OE_RRR(V1SHRS, 0, X0):
10831087 case OE_RRR(V1SHRS, 0, X1):
1088+ gen_helper_v1shrs(tdest, tsrca, tsrcb);
1089+ mnemonic = "v1shrs";
1090+ break;
10841091 case OE_RRR(V1SHRU, 0, X0):
10851092 case OE_RRR(V1SHRU, 0, X1):
1093+ gen_helper_v1shru(tdest, tsrca, tsrcb);
1094+ mnemonic = "v1shru";
1095+ break;
10861096 case OE_RRR(V1SUBUC, 0, X0):
10871097 case OE_RRR(V1SUBUC, 0, X1):
10881098 case OE_RRR(V1SUB, 0, X0):
@@ -1199,6 +1209,7 @@ static TileExcp gen_rri_opcode(DisasContext *dc, unsigned opext,
11991209 const char *mnemonic;
12001210 TCGMemOp memop;
12011211 int i2, i3;
1212+ TCGv t0;
12021213
12031214 switch (opext) {
12041215 case OE(ADDI_OPCODE_Y0, 0, Y0):
@@ -1401,7 +1412,11 @@ static TileExcp gen_rri_opcode(DisasContext *dc, unsigned opext,
14011412 break;
14021413 case OE_SH(V1SHRSI, X0):
14031414 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;
14051420 case OE_SH(V1SHRUI, X0):
14061421 case OE_SH(V1SHRUI, X1):
14071422 i2 = imm & 7;