]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target-tricore: add RR_CRC32 instruction of the v1.6.1 ISA
authorBastian Koppelmann <kbastian@mail.uni-paderborn.de>
Thu, 7 May 2015 17:55:37 +0000 (19:55 +0200)
committerBastian Koppelmann <kbastian@mail.uni-paderborn.de>
Fri, 22 May 2015 15:02:33 +0000 (17:02 +0200)
This instruction was introduced by the new Aurix platform.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
target-tricore/helper.h
target-tricore/op_helper.c
target-tricore/translate.c
target-tricore/tricore-opcodes.h

index 1a49b00ccb708a1f4fd49f182ea1f3d4de723bdb..842506c5f961a63dbee48c41ec1130f489ec1faa 100644 (file)
@@ -117,6 +117,8 @@ DEF_HELPER_FLAGS_2(dvstep_u, TCG_CALL_NO_RWG_SE, i64, i64, i32)
 DEF_HELPER_FLAGS_5(mul_h, TCG_CALL_NO_RWG_SE, i64, i32, i32, i32, i32, i32)
 DEF_HELPER_FLAGS_5(mulm_h, TCG_CALL_NO_RWG_SE, i64, i32, i32, i32, i32, i32)
 DEF_HELPER_FLAGS_5(mulr_h, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32, i32, i32)
+/* crc32 */
+DEF_HELPER_FLAGS_2(crc32, TCG_CALL_NO_RWG_SE, i32, i32, i32)
 /* CSA */
 DEF_HELPER_2(call, void, env, i32)
 DEF_HELPER_1(ret, void, env)
index 9919b5b17bed2b031ca42e7b87a1ebe8d5ad1bce..7aa1f8e40ec70f24a40c6b2cee6c0e195d62a127 100644 (file)
@@ -19,6 +19,7 @@
 #include "qemu/host-utils.h"
 #include "exec/helper-proto.h"
 #include "exec/cpu_ldst.h"
+#include <zlib.h> /* for crc32 */
 
 /* Addressing mode helper */
 
@@ -2165,6 +2166,16 @@ uint32_t helper_mulr_h(uint32_t arg00, uint32_t arg01,
     return (result1 & 0xffff0000) | (result0 >> 16);
 }
 
+uint32_t helper_crc32(uint32_t arg0, uint32_t arg1)
+{
+    uint8_t buf[4];
+    uint32_t ret;
+    stl_be_p(buf, arg0);
+
+    ret = crc32(arg1, buf, 4);
+    return ret;
+}
+
 /* context save area (CSA) related helpers */
 
 static int cdc_increment(target_ulong *psw)
index b2e25e7c7fc0e711572668369074f8e8285756a6..52f474ba9f268e5ff173cc53a70aab0eee52275d 100644 (file)
@@ -6449,6 +6449,11 @@ static void decode_rr_divide(CPUTriCoreState *env, DisasContext *ctx)
     case OPC2_32_RR_UNPACK:
         gen_unpack(cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1]);
         break;
+    case OPC2_32_RR_CRC32:
+        if (tricore_feature(env, TRICORE_FEATURE_161)) {
+            gen_helper_crc32(cpu_gpr_d[r3], cpu_gpr_d[r1], cpu_gpr_d[r2]);
+        } /* TODO: else raise illegal opcode trap */
+        break;
     }
 }
 
index 7ad6df9bd6eff2a7270e44772d5b07a501c6659c..440c7fefed6c059ab6844f669db4f308807f25e4 100644 (file)
@@ -1120,6 +1120,7 @@ enum {
     OPC2_32_RR_DVINIT_U                          = 0x0a,
     OPC2_32_RR_PARITY                            = 0x02,
     OPC2_32_RR_UNPACK                            = 0x08,
+    OPC2_32_RR_CRC32                             = 0x03,
 };
 /* OPCM_32_RR_IDIRECT                               */
 enum {