target/tricore: Add popcnt.w insn
authorBastian Koppelmann <kbastian@mail.uni-paderborn.de>
Wed, 14 Jun 2023 10:00:33 +0000 (12:00 +0200)
committerBastian Koppelmann <kbastian@mail.uni-paderborn.de>
Wed, 21 Jun 2023 15:56:45 +0000 (17:56 +0200)
reported in https://gitlab.com/qemu-project/qemu/-/issues/1667

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Message-Id: <20230614100039.1337971-3-kbastian@mail.uni-paderborn.de>

target/tricore/translate.c
target/tricore/tricore-opcodes.h

index cd33a1dcddfe8fa7ac4483707fcc9cc7d698ebd8..26b284bcecf6511b74eb34e57ff1275d5a06bef3 100644 (file)
@@ -6197,6 +6197,13 @@ static void decode_rr_divide(DisasContext *ctx)
             generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC);
         }
         break;
+    case OPC2_32_RR_POPCNT_W:
+        if (has_feature(ctx, TRICORE_FEATURE_162)) {
+            tcg_gen_ctpop_tl(cpu_gpr_d[r3], cpu_gpr_d[r1]);
+        } else {
+            generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC);
+        }
+        break;
     case OPC2_32_RR_DIV:
         if (has_feature(ctx, TRICORE_FEATURE_16)) {
             GEN_HELPER_RR(divide, cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1],
index f7135f183d66e3de0519b320535a1a121fff5596..59aa39a7a5fbd2166d566ade06b90760fc45281f 100644 (file)
@@ -1133,6 +1133,7 @@ enum {
     OPC2_32_RR_PARITY                            = 0x02,
     OPC2_32_RR_UNPACK                            = 0x08,
     OPC2_32_RR_CRC32                             = 0x03,
+    OPC2_32_RR_POPCNT_W                          = 0x22, /* 1.6.2 only */
     OPC2_32_RR_DIV                               = 0x20,
     OPC2_32_RR_DIV_U                             = 0x21,
     OPC2_32_RR_MUL_F                             = 0x04,