From nobody Fri Dec 19 20:33:54 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail header.i=@quicinc.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1617249364; cv=none; d=zohomail.com; s=zohoarc; b=GYvV2B+Fc6u9nd6LT5BsUvD2WMvB8pUgwUj8oJFqQWdsPozRuPtf3FDMCXIb8ZQExcy6h1gBSDazufFs0oz64PqqGcDYTF6idt/Fun5x/sxCMa/FK+DGbjQkim5NolxUl2RRjx6IB+5vEjwxFm3ONM1ToFzeQI+YGAQlKGYva2Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617249364; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/UoLALKbHH/YexaVVr75+0EwWQ4974UhxmqGVZ4FAv0=; b=S7g3ALL2bpQ1Yrpp/J7U9OjFXscjo+3EfRl0otGcMDoEvTKMmc+oVZ8wSlIhvKMmcn+0Ok7DcoIZ4TiXJ2LuN0Q5SdptJYLZqvbICEyhgJMKZ9dRanUYkvr/ZoPGkCjvkuIWGVBfyOTx2VI+Pa1Kcv3FdGBDmOjHPHzgBlS1Xso= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail header.i=@quicinc.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1617249364271502.42991057223423; Wed, 31 Mar 2021 20:56:04 -0700 (PDT) Received: from localhost ([::1]:36818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRoR9-0003Db-5V for importer@patchew.org; Wed, 31 Mar 2021 23:56:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRoP1-0001QL-7A for qemu-devel@nongnu.org; Wed, 31 Mar 2021 23:53:51 -0400 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:33769) by eggs.gnu.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lRoOx-0004r5-S5 for qemu-devel@nongnu.org; Wed, 31 Mar 2021 23:53:50 -0400 Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-01.qualcomm.com with ESMTP; 31 Mar 2021 20:53:42 -0700 Received: from vu-tsimpson-aus.qualcomm.com (HELO vu-tsimpson1-aus.qualcomm.com) ([10.222.150.1]) by ironmsg01-sd.qualcomm.com with ESMTP; 31 Mar 2021 20:53:41 -0700 Received: by vu-tsimpson1-aus.qualcomm.com (Postfix, from userid 47164) id BBC81110F; Wed, 31 Mar 2021 22:53:40 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1617249227; x=1648785227; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=n6j68wYMhV7h4ri3a9upiqg16kMnWYDyLD0qbnPA3HU=; b=mqpqUi5G8wRfOLtkPq5xf78pB6GvRtpmYRrDoxPqH8YqX3/DrhIYLjE3 TmizHgKfZ5JgtxBDbxWZIouTHwDuTBa2EdSpwMYVajmW79nI872uYGS+I Wk5blH+y1TY6lBPyRWQomv545tBdb+EWVNKmlZyvnIXDPV8R5pv3bKHCM o=; X-QCInternal: smtphost From: Taylor Simpson To: qemu-devel@nongnu.org Subject: [PATCH v2 06/21] Hexagon (target/hexagon) change variables from int to bool when appropriate Date: Wed, 31 Mar 2021 22:53:18 -0500 Message-Id: <1617249213-22667-7-git-send-email-tsimpson@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1617249213-22667-1-git-send-email-tsimpson@quicinc.com> References: <1617249213-22667-1-git-send-email-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=199.106.114.38; envelope-from=tsimpson@qualcomm.com; helo=alexa-out-sd-01.qualcomm.com X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ale@rev.ng, philmd@redhat.com, tsimpson@quicinc.com, richard.henderson@linaro.org, bcain@quicinc.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Suggested-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Signed-off-by: Taylor Simpson --- target/hexagon/cpu_bits.h | 2 +- target/hexagon/decode.c | 80 +++++++++++++++++++++++-------------------= ---- target/hexagon/insn.h | 21 ++++++------ target/hexagon/op_helper.c | 8 ++--- target/hexagon/translate.c | 6 ++-- target/hexagon/translate.h | 2 +- 6 files changed, 60 insertions(+), 59 deletions(-) diff --git a/target/hexagon/cpu_bits.h b/target/hexagon/cpu_bits.h index 96af834..96fef71 100644 --- a/target/hexagon/cpu_bits.h +++ b/target/hexagon/cpu_bits.h @@ -47,7 +47,7 @@ static inline uint32_t iclass_bits(uint32_t encoding) return iclass; } =20 -static inline int is_packet_end(uint32_t endocing) +static inline bool is_packet_end(uint32_t endocing) { uint32_t bits =3D parse_bits(endocing); return ((bits =3D=3D 0x3) || (bits =3D=3D 0x0)); diff --git a/target/hexagon/decode.c b/target/hexagon/decode.c index 65d97ce..dffe1d1 100644 --- a/target/hexagon/decode.c +++ b/target/hexagon/decode.c @@ -340,8 +340,8 @@ static void decode_split_cmpjump(Packet *pkt) if (GET_ATTRIB(pkt->insn[i].opcode, A_NEWCMPJUMP)) { last =3D pkt->num_insns; pkt->insn[last] =3D pkt->insn[i]; /* copy the instruction */ - pkt->insn[last].part1 =3D 1; /* last instruction does the C= MP */ - pkt->insn[i].part1 =3D 0; /* existing instruction does the = JUMP */ + pkt->insn[last].part1 =3D true; /* last insn does the CMP= */ + pkt->insn[i].part1 =3D false; /* existing insn does the= JUMP */ pkt->num_insns++; } } @@ -354,7 +354,7 @@ static void decode_split_cmpjump(Packet *pkt) } } =20 -static int decode_opcode_can_jump(int opcode) +static bool decode_opcode_can_jump(int opcode) { if ((GET_ATTRIB(opcode, A_JUMP)) || (GET_ATTRIB(opcode, A_CALL)) || @@ -362,15 +362,15 @@ static int decode_opcode_can_jump(int opcode) (opcode =3D=3D J2_pause)) { /* Exception to A_JUMP attribute */ if (opcode =3D=3D J4_hintjumpr) { - return 0; + return false; } - return 1; + return true; } =20 - return 0; + return false; } =20 -static int decode_opcode_ends_loop(int opcode) +static bool decode_opcode_ends_loop(int opcode) { return GET_ATTRIB(opcode, A_HWLOOP0_END) || GET_ATTRIB(opcode, A_HWLOOP1_END); @@ -383,9 +383,9 @@ static void decode_set_insn_attr_fields(Packet *pkt) int numinsns =3D pkt->num_insns; uint16_t opcode; =20 - pkt->pkt_has_cof =3D 0; - pkt->pkt_has_endloop =3D 0; - pkt->pkt_has_dczeroa =3D 0; + pkt->pkt_has_cof =3D false; + pkt->pkt_has_endloop =3D false; + pkt->pkt_has_dczeroa =3D false; =20 for (i =3D 0; i < numinsns; i++) { opcode =3D pkt->insn[i].opcode; @@ -394,14 +394,14 @@ static void decode_set_insn_attr_fields(Packet *pkt) } =20 if (GET_ATTRIB(opcode, A_DCZEROA)) { - pkt->pkt_has_dczeroa =3D 1; + pkt->pkt_has_dczeroa =3D true; } =20 if (GET_ATTRIB(opcode, A_STORE)) { if (pkt->insn[i].slot =3D=3D 0) { - pkt->pkt_has_store_s0 =3D 1; + pkt->pkt_has_store_s0 =3D true; } else { - pkt->pkt_has_store_s1 =3D 1; + pkt->pkt_has_store_s1 =3D true; } } =20 @@ -422,9 +422,9 @@ static void decode_set_insn_attr_fields(Packet *pkt) */ static void decode_shuffle_for_execution(Packet *packet) { - int changed =3D 0; + bool changed =3D false; int i; - int flag; /* flag means we've seen a non-memory instruction */ + bool flag; /* flag means we've seen a non-memory instruction */ int n_mems; int last_insn =3D packet->num_insns - 1; =20 @@ -437,7 +437,7 @@ static void decode_shuffle_for_execution(Packet *packet) } =20 do { - changed =3D 0; + changed =3D false; /* * Stores go last, must not reorder. * Cannot shuffle stores past loads, either. @@ -445,13 +445,13 @@ static void decode_shuffle_for_execution(Packet *pack= et) * then a store, shuffle the store to the front. Don't shuffle * stores wrt each other or a load. */ - for (flag =3D n_mems =3D 0, i =3D last_insn; i >=3D 0; i--) { + for (flag =3D false, n_mems =3D 0, i =3D last_insn; i >=3D 0; i--)= { int opcode =3D packet->insn[i].opcode; =20 if (flag && GET_ATTRIB(opcode, A_STORE)) { decode_send_insn_to(packet, i, last_insn - n_mems); n_mems++; - changed =3D 1; + changed =3D true; } else if (GET_ATTRIB(opcode, A_STORE)) { n_mems++; } else if (GET_ATTRIB(opcode, A_LOAD)) { @@ -466,7 +466,7 @@ static void decode_shuffle_for_execution(Packet *packet) * a .new value */ } else { - flag =3D 1; + flag =3D true; } } =20 @@ -474,7 +474,7 @@ static void decode_shuffle_for_execution(Packet *packet) continue; } /* Compares go first, may be reordered wrt each other */ - for (flag =3D 0, i =3D 0; i < last_insn + 1; i++) { + for (flag =3D false, i =3D 0; i < last_insn + 1; i++) { int opcode =3D packet->insn[i].opcode; =20 if ((strstr(opcode_wregs[opcode], "Pd4") || @@ -483,7 +483,7 @@ static void decode_shuffle_for_execution(Packet *packet) /* This should be a compare (not a store conditional) */ if (flag) { decode_send_insn_to(packet, i, 0); - changed =3D 1; + changed =3D true; continue; } } else if (GET_ATTRIB(opcode, A_IMPLICIT_WRITES_P3) && @@ -495,18 +495,18 @@ static void decode_shuffle_for_execution(Packet *pack= et) */ if (flag) { decode_send_insn_to(packet, i, 0); - changed =3D 1; + changed =3D true; continue; } } else if (GET_ATTRIB(opcode, A_IMPLICIT_WRITES_P0) && !GET_ATTRIB(opcode, A_NEWCMPJUMP)) { if (flag) { decode_send_insn_to(packet, i, 0); - changed =3D 1; + changed =3D true; continue; } } else { - flag =3D 1; + flag =3D true; } } if (changed) { @@ -543,7 +543,7 @@ static void decode_apply_extenders(Packet *packet) int i; for (i =3D 0; i < packet->num_insns; i++) { if (GET_ATTRIB(packet->insn[i].opcode, A_IT_EXTENDER)) { - packet->insn[i + 1].extension_valid =3D 1; + packet->insn[i + 1].extension_valid =3D true; apply_extender(packet, i + 1, packet->insn[i].immed[0]); } } @@ -764,7 +764,7 @@ static void decode_add_endloop_insn(Insn *insn, int loo= pnum) } } =20 -static int decode_parsebits_is_loopend(uint32_t encoding32) +static bool decode_parsebits_is_loopend(uint32_t encoding32) { uint32_t bits =3D parse_bits(encoding32); return bits =3D=3D 0x2; @@ -775,8 +775,11 @@ decode_set_slot_number(Packet *pkt) { int slot; int i; - int hit_mem_insn =3D 0; - int hit_duplex =3D 0; + bool hit_mem_insn =3D false; + bool hit_duplex =3D false; + bool slot0_found =3D false; + bool slot1_found =3D false; + int slot1_iidx =3D 0; =20 /* * The slots are encoded in reverse order @@ -801,7 +804,7 @@ decode_set_slot_number(Packet *pkt) if ((GET_ATTRIB(pkt->insn[i].opcode, A_MEMLIKE) || GET_ATTRIB(pkt->insn[i].opcode, A_MEMLIKE_PACKET_RULES)) && !hit_mem_insn) { - hit_mem_insn =3D 1; + hit_mem_insn =3D true; pkt->insn[i].slot =3D 0; continue; } @@ -818,7 +821,7 @@ decode_set_slot_number(Packet *pkt) for (i =3D pkt->num_insns - 1; i >=3D 0; i--) { /* First subinsn always goes to slot 0 */ if (GET_ATTRIB(pkt->insn[i].opcode, A_SUBINSN) && !hit_duplex) { - hit_duplex =3D 1; + hit_duplex =3D true; pkt->insn[i].slot =3D 0; continue; } @@ -830,13 +833,10 @@ decode_set_slot_number(Packet *pkt) } =20 /* Fix the exceptions - slot 1 is never empty, always aligns to slot 0= */ - int slot0_found =3D 0; - int slot1_found =3D 0; - int slot1_iidx =3D 0; for (i =3D pkt->num_insns - 1; i >=3D 0; i--) { /* Is slot0 used? */ if (pkt->insn[i].slot =3D=3D 0) { - int is_endloop =3D (pkt->insn[i].opcode =3D=3D J2_endloop01); + bool is_endloop =3D (pkt->insn[i].opcode =3D=3D J2_endloop01); is_endloop |=3D (pkt->insn[i].opcode =3D=3D J2_endloop0); is_endloop |=3D (pkt->insn[i].opcode =3D=3D J2_endloop1); =20 @@ -845,17 +845,17 @@ decode_set_slot_number(Packet *pkt) * slot0 for endloop */ if (!is_endloop) { - slot0_found =3D 1; + slot0_found =3D true; } } /* Is slot1 used? */ if (pkt->insn[i].slot =3D=3D 1) { - slot1_found =3D 1; + slot1_found =3D true; slot1_iidx =3D i; } } /* Is slot0 empty and slot1 used? */ - if ((slot0_found =3D=3D 0) && (slot1_found =3D=3D 1)) { + if ((!slot0_found) && slot1_found) { /* Then push it to slot0 */ pkt->insn[slot1_iidx].slot =3D 0; } @@ -873,7 +873,7 @@ int decode_packet(int max_words, const uint32_t *words,= Packet *pkt, { int num_insns =3D 0; int words_read =3D 0; - int end_of_packet =3D 0; + bool end_of_packet =3D false; int new_insns =3D 0; uint32_t encoding32; =20 @@ -890,7 +890,7 @@ int decode_packet(int max_words, const uint32_t *words,= Packet *pkt, * decode works */ if (pkt->insn[num_insns].opcode =3D=3D A4_ext) { - pkt->insn[num_insns + 1].extension_valid =3D 1; + pkt->insn[num_insns + 1].extension_valid =3D true; } num_insns +=3D new_insns; words_read++; @@ -913,7 +913,7 @@ int decode_packet(int max_words, const uint32_t *words,= Packet *pkt, decode_add_endloop_insn(&pkt->insn[pkt->num_insns++], 0); } if (words_read >=3D 3) { - uint32_t has_loop0, has_loop1; + bool has_loop0, has_loop1; has_loop0 =3D decode_parsebits_is_loopend(words[0]); has_loop1 =3D decode_parsebits_is_loopend(words[1]); if (has_loop0 && has_loop1) { diff --git a/target/hexagon/insn.h b/target/hexagon/insn.h index 5756a1d..2e34591 100644 --- a/target/hexagon/insn.h +++ b/target/hexagon/insn.h @@ -40,14 +40,15 @@ struct Instruction { =20 uint32_t iclass:6; uint32_t slot:3; - uint32_t part1:1; /* + uint32_t which_extended:1; /* If has an extender, which immediate */ + uint32_t new_value_producer_slot:4; + + bool part1; /* * cmp-jumps are split into two insns. * set for the compare and clear for the jump */ - uint32_t extension_valid:1; /* Has a constant extender attached */ - uint32_t which_extended:1; /* If has an extender, which immediate */ - uint32_t is_endloop:1; /* This is an end of loop */ - uint32_t new_value_producer_slot:4; + bool extension_valid; /* Has a constant extender attached */ + bool is_endloop; /* This is an end of loop */ int32_t immed[IMMEDS_MAX]; /* immediate field */ }; =20 @@ -58,13 +59,13 @@ struct Packet { uint16_t encod_pkt_size_in_bytes; =20 /* Pre-decodes about COF */ - uint32_t pkt_has_cof:1; /* Has any change-of-flow */ - uint32_t pkt_has_endloop:1; + bool pkt_has_cof; /* Has any change-of-flow */ + bool pkt_has_endloop; =20 - uint32_t pkt_has_dczeroa:1; + bool pkt_has_dczeroa; =20 - uint32_t pkt_has_store_s0:1; - uint32_t pkt_has_store_s1:1; + bool pkt_has_store_s0; + bool pkt_has_store_s1; =20 Insn insn[INSTRUCTIONS_MAX]; }; diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 7ac8554..1d91fa2 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -948,8 +948,8 @@ static bool is_inf_prod(int32_t a, int32_t b) float32 HELPER(sffma_lib)(CPUHexagonState *env, float32 RxV, float32 RsV, float32 RtV) { - int infinp; - int infminusinf; + bool infinp; + bool infminusinf; float32 tmp; =20 arch_fpop_start(env); @@ -982,8 +982,8 @@ float32 HELPER(sffma_lib)(CPUHexagonState *env, float32= RxV, float32 HELPER(sffms_lib)(CPUHexagonState *env, float32 RxV, float32 RsV, float32 RtV) { - int infinp; - int infminusinf; + bool infinp; + bool infminusinf; float32 tmp; =20 arch_fpop_start(env); diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 49ec8b7..0468422 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -177,7 +177,7 @@ static void gen_start_packet(DisasContext *ctx, Packet = *pkt) ctx->store_width[i] =3D 0; } tcg_gen_movi_tl(hex_pkt_has_store_s1, pkt->pkt_has_store_s1); - ctx->s1_store_processed =3D 0; + ctx->s1_store_processed =3D false; =20 #if HEX_DEBUG /* Handy place to set a breakpoint before the packet executes */ @@ -210,7 +210,7 @@ static void mark_implicit_reg_write(DisasContext *ctx, = Insn *insn, int attrib, int rnum) { if (GET_ATTRIB(insn->opcode, attrib)) { - int is_predicated =3D GET_ATTRIB(insn->opcode, A_CONDEXEC); + bool is_predicated =3D GET_ATTRIB(insn->opcode, A_CONDEXEC); if (is_predicated && !is_preloaded(ctx, rnum)) { tcg_gen_mov_tl(hex_new_value[rnum], hex_gpr[rnum]); } @@ -354,7 +354,7 @@ void process_store(DisasContext *ctx, Packet *pkt, int = slot_num) if (slot_num =3D=3D 1 && ctx->s1_store_processed) { return; } - ctx->s1_store_processed =3D 1; + ctx->s1_store_processed =3D true; =20 if (is_predicated) { TCGv cancelled =3D tcg_temp_new(); diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h index 0ecfbd7..97b12a7 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -36,7 +36,7 @@ typedef struct DisasContext { int preg_log_idx; DECLARE_BITMAP(pregs_written, NUM_PREGS); uint8_t store_width[STORES_MAX]; - uint8_t s1_store_processed; + bool s1_store_processed; } DisasContext; =20 static inline void ctx_log_reg_write(DisasContext *ctx, int rnum) --=20 2.7.4