Skip to contentSkip to conversation

target-tilegx: Implement v1multu instruction

PATCH In review [email protected] 2 participants 2 messages Sep 21, 2015 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 target-tilegx: Implement v1multu instruction

From: Chen Gang <[email protected]>

Only according to v1shrs implementation.

---
 target-tilegx/helper.h      |  2 ++
 target-tilegx/simd_helper.c | 13 +++++++++++++
 target-tilegx/translate.c   |  4 ++++
 3 files changed, 19 insertions(+)
target-tilegx/helper.h +2 -0
index 6d98f3a..90e558d 100644
@@ -16,3 +16,5 @@ DEF_HELPER_FLAGS_2(v1add, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 DEF_HELPER_FLAGS_2(v1sub, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 DEF_HELPER_FLAGS_2(v2add, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 DEF_HELPER_FLAGS_2(v2sub, TCG_CALL_NO_RWG_SE, i64, i64, i64)
+
+DEF_HELPER_FLAGS_2(v1multu, TCG_CALL_NO_RWG_SE, i64, i64, i64)
target-tilegx/simd_helper.c +13 -0
index 00265fe..b98573e 100644
@@ -107,3 +107,16 @@ uint64_t helper_v2shrs(uint64_t a, uint64_t b)
     }
     return r;
 }
+
+uint64_t helper_v1multu(uint64_t a, uint64_t b)
+{
+    uint64_t r = 0;
+    int i;
+
+    for (i = 0; i < 64; i += 8) {
+        uint64_t ae = (uint8_t)(a >> i);
+        uint64_t be = (uint8_t)(b >> i);
+        r |= ((ae * be) & 0xff) << i;
+    }
+    return r;
+}
target-tilegx/translate.c +4 -0
index 297de5c..a9fc4ce 100644
@@ -1113,7 +1113,11 @@ static TileExcp gen_rrr_opcode(DisasContext *dc, unsigned opext,
     case OE_RRR(V1MINU, 0, X1):
     case OE_RRR(V1MNZ, 0, X0):
     case OE_RRR(V1MNZ, 0, X1):
+        return TILEGX_EXCP_OPCODE_UNIMPLEMENTED;
     case OE_RRR(V1MULTU, 0, X0):
+        gen_helper_v1multu(tdest, tsrca, tsrcb);
+        mnemonic = "v1multu";
+        break;
     case OE_RRR(V1MULUS, 0, X0):
     case OE_RRR(V1MULU, 0, X0):
     case OE_RRR(V1MZ, 0, X0):
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

The related code are changed, so this patch has to be reconstructed.

Thanks

Quoted 51 lines · On 9/22/15 06:26, [email protected] wrote:

From: Chen Gang <[email protected]>

Only according to v1shrs implementation.

---
target-tilegx/helper.h | 2 ++
target-tilegx/simd_helper.c | 13 +++++++++++++
target-tilegx/translate.c | 4 ++++

3 files changed, 19 insertions(+)
target-tilegx/helper.h +2 -0
index 6d98f3a..90e558d 100644
@@ -16,3 +16,5 @@ DEF_HELPER_FLAGS_2(v1add, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 DEF_HELPER_FLAGS_2(v1sub, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 DEF_HELPER_FLAGS_2(v2add, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 DEF_HELPER_FLAGS_2(v2sub, TCG_CALL_NO_RWG_SE, i64, i64, i64)
+
+DEF_HELPER_FLAGS_2(v1multu, TCG_CALL_NO_RWG_SE, i64, i64, i64)
target-tilegx/simd_helper.c +13 -0
index 00265fe..b98573e 100644
@@ -107,3 +107,16 @@ uint64_t helper_v2shrs(uint64_t a, uint64_t b)
 }
 return r;
 }
+
+uint64_t helper_v1multu(uint64_t a, uint64_t b)
+{
+ uint64_t r = 0;
+ int i;
+
+ for (i = 0; i < 64; i += 8) {
+ uint64_t ae = (uint8_t)(a>> i);
+ uint64_t be = (uint8_t)(b>> i);
+ r |= ((ae * be) & 0xff) << i;
+ }
+ return r;
+}
target-tilegx/translate.c +0 -0
index 297de5c..a9fc4ce 100644
@@ -1113,7 +1113,11 @@ static TileExcp gen_rrr_opcode(DisasContext *dc, unsigned opext,

case OE_RRR(V1MINU, 0, X1):
case OE_RRR(V1MNZ, 0, X0):
case OE_RRR(V1MNZ, 0, X1):

Quoted 9 lines

+ return TILEGX_EXCP_OPCODE_UNIMPLEMENTED;
case OE_RRR(V1MULTU, 0, X0):
+ gen_helper_v1multu(tdest, tsrca, tsrcb);
+ mnemonic = "v1multu";
+ break;
case OE_RRR(V1MULUS, 0, X0):
case OE_RRR(V1MULU, 0, X0):
case OE_RRR(V1MZ, 0, X0):

--
Chen Gang (陈刚)

Open, share, and attitude like air, water, and life which God blessed