From patchwork Mon Feb 26 20:17:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 13572793 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA75AC48BF6 for ; Mon, 26 Feb 2024 20:18:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rehPr-0001cX-P4; Mon, 26 Feb 2024 15:17:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rehPp-0001bT-Mg for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:33 -0500 Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rehPm-0007zH-IF for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:33 -0500 Received: by mail-oi1-x22a.google.com with SMTP id 5614622812f47-3c1a172e158so250906b6e.0 for ; Mon, 26 Feb 2024 12:17:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708978647; x=1709583447; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CRjb46WdqEPMqkZSAvVdtRTJCtj+kvcnkZkQaWAfooI=; b=D2OvewPWCe+Rb9nKXFr2V75ffzC0apR0vheuwh0WQhdTktfMMQOiYt5F4A9gR9aTMF dm5a58uwg/Jz6V3G49/AoVfDNHTK9MDYzOh5dDngLmm0LwZq2ctuMIhyrIgs5aPA+jGd bDZRQp/EN5LlzRLhIQIgDAxPqhZYh405lVThRtM5Tfoywm2LN+ftoerPGoJusXHw6YaG wuwlLjgI6p9rP5nDOYpi+yBkaZz4sWeysmnwoIzBXjPsuO9xCEmXOJJfK1YJxYYEC6zl ZnsZ1ilDcONNx6CFcJpDht2RdDG6V2JuDtjWlUD2TuTfDomtxLGaVgtwrXiRh1VMRE+P CBbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708978647; x=1709583447; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CRjb46WdqEPMqkZSAvVdtRTJCtj+kvcnkZkQaWAfooI=; b=TtiPDvWvHiISQ+VxfO1Kh37/hv3PISzjJwkMyHL9w8niGBGhFlhzyp+ULvF28nndw9 KlbxJSAiXUn/Un/gqHCIMONclmVpgTS++LJsUOWbwz2OQ9nsab13zj/OcM93ZiKS3Kh8 C4bW/9PWbiu3EbHrWG5/1/9KXacSAJoAB4JNtz/ivnHumiulAISY8KN3YxIN2UIIRs3c 5cNSgrsZ3++Me8pw0PNCDZWvU0ajd64WBMHwrIwnPC46lo88fHOFmXmOyRdQePYPCZgD 9CjymPTuX12IJ+l7R3FqfvWVljlh5ShUERI3ZG5Yy3b2ZWR3jkn/+AE0+gX7kDUW9FWZ /Hww== X-Gm-Message-State: AOJu0YyIUVw6JQ4Rd3OjTUMjq2FEyAuPsG4bv1jHDWIz2RXTE2a9IgaV cz4+ACkWbyKEr0hS+e/5w8/uNym1OoW6tTiczUgKA6bctu/uniJKPV7CZXL/70Q= X-Google-Smtp-Source: AGHT+IEiY2QoZhU/f1IY5AVw5xH2J8iMPXwY4ylnxBnPExap4nLqI8CQnThVm2npQTws8Sb9L+rlfA== X-Received: by 2002:a05:6808:14c7:b0:3c1:7ebb:e24f with SMTP id f7-20020a05680814c700b003c17ebbe24fmr98056oiw.16.1708978646972; Mon, 26 Feb 2024 12:17:26 -0800 (PST) Received: from taylor-ubuntu.austin.rr.com (068-203-008-061.res.spectrum.com. [68.203.8.61]) by smtp.gmail.com with ESMTPSA id by11-20020a056808340b00b003c1a4a9ad17sm330594oib.46.2024.02.26.12.17.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 12:17:26 -0800 (PST) From: Taylor Simpson To: qemu-devel@nongnu.org Cc: bcain@quicinc.com, quic_mathbern@quicinc.com, sidneym@quicinc.com, quic_mliebel@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, ale@rev.ng, anjo@rev.ng, ltaylorsimpson@gmail.com Subject: [PATCH 1/9] Hexagon (target/hexagon) Add is_old/is_new to Register class Date: Mon, 26 Feb 2024 13:17:14 -0700 Message-Id: <20240226201722.391879-2-ltaylorsimpson@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226201722.391879-1-ltaylorsimpson@gmail.com> References: <20240226201722.391879-1-ltaylorsimpson@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22a; envelope-from=ltaylorsimpson@gmail.com; helo=mail-oi1-x22a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Taylor Simpson Reviewed-by: Philippe Mathieu-Daudé --- target/hexagon/hex_common.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py index 195620c7ec..4bacef223f 100755 --- a/target/hexagon/hex_common.py +++ b/target/hexagon/hex_common.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 ## -## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. +## Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Reserved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -397,10 +397,18 @@ def is_readwrite(self): class OldSource(Source): def reg_tcg(self): return f"{self.regtype}{self.regid}V" + def is_old(self): + return True + def is_new(self): + return False class NewSource(Source): def reg_tcg(self): return f"{self.regtype}{self.regid}N" + def is_old(self): + return False + def is_new(self): + return True class ReadWrite: def reg_tcg(self): @@ -413,6 +421,10 @@ def is_read(self): return True def is_readwrite(self): return True + def is_old(self): + return True + def is_new(self): + return False class GprDest(Register, Single, Dest): def decl_tcg(self, f, tag, regno): From patchwork Mon Feb 26 20:17:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 13572788 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9542AC5478C for ; Mon, 26 Feb 2024 20:18:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rehPq-0001bt-Jd; Mon, 26 Feb 2024 15:17:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rehPo-0001bE-Vw for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:33 -0500 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rehPn-0007zS-2X for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:32 -0500 Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3bbbc6bcc78so2686305b6e.1 for ; Mon, 26 Feb 2024 12:17:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708978648; x=1709583448; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=34hyOq9fT2wY/9uJL975rSySKZ4ZdVHzRHf6WhirkXw=; b=CYbgfOBa374bDvWsey0snO37YHu/6zF5sC2oeVjXU+G/McgbCueSFd7g73DxBQqR94 UI9Wkk+3tfE2g9vdR96nW6a4nXSMdcZwswTpzQ8JylO6i8Oa0Erdf+gzuG1s4rKwo4ab TBpqXrrNeKFKGBamVR15oZkV6bQryQomnl0xWPCZd3jUpEKG5wVVDjfCp42P8JPGbvMc nGpD4N2JKPqSgeoopwbU8Z4/gmRdGjeTb9GFD5UKLOiZwgLiFYCKXSW+ClcryL8kjADI 8j88n3JGJndH/inHk1+cdzwHxlRO9yb10RgsYZqBvHdNnXHnjrqxWQbBXraXxQNo1D6i 6d2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708978648; x=1709583448; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=34hyOq9fT2wY/9uJL975rSySKZ4ZdVHzRHf6WhirkXw=; b=OKlfnp4yOGxivsWHz7/D67ppJQUWXWCDRJhE5WIpL+QnZltqJHLaFAV+ZwCmyXwEIj 3drtPSMbCvgV6ILZ41+wOkYhWpm2BfR7ocdWpcuMvJnJC2gUQi4hnUtSEbB4IDnXDVQv qa8QDjMFvjYTXQlHGeTVHeqqZw+tZa6u9wspCsY8+laj2R4SEPNY29U7+0l+1wJ7dYAQ qZ52cZf8q3oXw4CnOBN8PiTNZysZw1iDFa7TmXITs7NFQ0fraNioWrOkpk2O4XBD/6Pc //bLYhIc3t6+BcaE4/bZqdbh8WcQ5Y1MwiGkcWW5ZyxvuVyi7wQK/Qzf4muq5BsgeZnB SGFw== X-Gm-Message-State: AOJu0Yw/kF/+8H9a/emgipfI8EADYg06cC7n/yhXKt9aB8AllM5dDEZt czEURhbq0Pljt8ri5SZ6EvJOWdG3a+5a5/ZSzvvlBQyoMXSdRX5X3bfnI41Rq5c= X-Google-Smtp-Source: AGHT+IFMnfcuz/BXJtpbev/b7IA7y65QBd6hv40SImK1PfsehBx87OTUNsQ85p/oxW3H9HrvbTYHhQ== X-Received: by 2002:a05:6808:11c1:b0:3c1:78b0:9ce1 with SMTP id p1-20020a05680811c100b003c178b09ce1mr264941oiv.13.1708978648442; Mon, 26 Feb 2024 12:17:28 -0800 (PST) Received: from taylor-ubuntu.austin.rr.com (068-203-008-061.res.spectrum.com. [68.203.8.61]) by smtp.gmail.com with ESMTPSA id by11-20020a056808340b00b003c1a4a9ad17sm330594oib.46.2024.02.26.12.17.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 12:17:27 -0800 (PST) From: Taylor Simpson To: qemu-devel@nongnu.org Cc: bcain@quicinc.com, quic_mathbern@quicinc.com, sidneym@quicinc.com, quic_mliebel@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, ale@rev.ng, anjo@rev.ng, ltaylorsimpson@gmail.com Subject: [PATCH 2/9] Hexagon (target/hexagon) Mark new_read_idx in trans functions Date: Mon, 26 Feb 2024 13:17:15 -0700 Message-Id: <20240226201722.391879-3-ltaylorsimpson@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226201722.391879-1-ltaylorsimpson@gmail.com> References: <20240226201722.391879-1-ltaylorsimpson@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::230; envelope-from=ltaylorsimpson@gmail.com; helo=mail-oi1-x230.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Check that the value matches opcode_reginfo Signed-off-by: Taylor Simpson --- target/hexagon/insn.h | 3 ++- target/hexagon/decode.c | 2 ++ target/hexagon/mmvec/decode_ext_mmvec.c | 2 ++ target/hexagon/gen_trans_funcs.py | 15 ++++++++++----- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/target/hexagon/insn.h b/target/hexagon/insn.h index 3e7a22c91e..36502bf056 100644 --- a/target/hexagon/insn.h +++ b/target/hexagon/insn.h @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Reserved. + * Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,6 +39,7 @@ struct Instruction { uint32_t slot:3; uint32_t which_extended:1; /* If has an extender, which immediate */ uint32_t new_value_producer_slot:4; + int32_t new_read_idx; bool part1; /* * cmp-jumps are split into two insns. diff --git a/target/hexagon/decode.c b/target/hexagon/decode.c index a40210ca1e..4595e30384 100644 --- a/target/hexagon/decode.c +++ b/target/hexagon/decode.c @@ -131,6 +131,8 @@ decode_fill_newvalue_regno(Packet *packet) use_regidx = strchr(opcode_reginfo[use_opcode], 's') - opcode_reginfo[use_opcode]; } + g_assert(packet->insn[i].new_read_idx != -1 && + packet->insn[i].new_read_idx == use_regidx); /* * What's encoded at the N-field is the offset to who's producing diff --git a/target/hexagon/mmvec/decode_ext_mmvec.c b/target/hexagon/mmvec/decode_ext_mmvec.c index 202d84c7c0..e9007f5d71 100644 --- a/target/hexagon/mmvec/decode_ext_mmvec.c +++ b/target/hexagon/mmvec/decode_ext_mmvec.c @@ -41,6 +41,8 @@ check_new_value(Packet *pkt) GET_ATTRIB(use_opcode, A_STORE)) { int use_regidx = strchr(opcode_reginfo[use_opcode], 's') - opcode_reginfo[use_opcode]; + g_assert(pkt->insn[i].new_read_idx != -1 && + pkt->insn[i].new_read_idx == use_regidx); /* * What's encoded at the N-field is the offset to who's producing * the value. diff --git a/target/hexagon/gen_trans_funcs.py b/target/hexagon/gen_trans_funcs.py index 53e844a44b..79475b2946 100755 --- a/target/hexagon/gen_trans_funcs.py +++ b/target/hexagon/gen_trans_funcs.py @@ -84,14 +84,15 @@ def gen_trans_funcs(f): insn->opcode = {tag}; """)) - regno = 0 - for reg in regs: - reg_type = reg[0] - reg_id = reg[1] + new_read_idx = -1 + for regno, regstruct in enumerate(regs): + reg_type, reg_id, _, _ = regstruct + reg = hex_common.get_register(tag, reg_type, reg_id) f.write(code_fmt(f"""\ insn->regno[{regno}] = args->{reg_type}{reg_id}; """)) - regno += 1 + if reg.is_read() and reg.is_new(): + new_read_idx = regno if len(imms) != 0: mark_which_imm_extended(f, tag) @@ -112,6 +113,9 @@ def gen_trans_funcs(f): insn->immed[{immno}] = args->{imm_type}{imm_letter}; """)) + f.write(code_fmt(f"""\ + insn->new_read_idx = {new_read_idx}; + """)) f.write(textwrap.dedent(f"""\ return true; {close_curly} @@ -120,5 +124,6 @@ def gen_trans_funcs(f): if __name__ == "__main__": hex_common.read_semantics_file(sys.argv[1]) + hex_common.init_registers() with open(sys.argv[2], "w") as f: gen_trans_funcs(f) From patchwork Mon Feb 26 20:17:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 13572794 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4761C5478C for ; Mon, 26 Feb 2024 20:18:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rehPr-0001cL-7X; Mon, 26 Feb 2024 15:17:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rehPp-0001bb-T0 for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:33 -0500 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rehPo-0007zh-6T for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:33 -0500 Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3bb9b28acb4so2482055b6e.2 for ; Mon, 26 Feb 2024 12:17:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708978650; x=1709583450; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IKDpTWyScsaSBI11X+2N+qTatk0v8tuwGtm68rKYDSc=; b=fDJfjxdsXXog2SQOST/zChPImlnccMqkCvbsgoADahMjLbI5IK8IUEouIAKSu2gZkU 8A/M4J2vc2b5Z0IVbDl9Na4R3UnD57a1Dya85lfspHsu8bgcRtumyBPzJ041FveCvY/l GSYH1RFYR01CREK9H+QMiqE07KhLdSgLItLV6ZfbQWhNuIp3SMxXrfFakWlmBYz1VwVY Q14rxF2nOsiv81c+1vbx3qJ/51DoPocMCtc56YPFi31rQlxHwz88vvznPAVzzmBFragZ CTQ9RJYYMh1JtQj4aY039qQdIn1m3x/xbtEKQkj/bwQdaWIpRjyX6K0iuA1HDyGTWZVr XELQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708978650; x=1709583450; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IKDpTWyScsaSBI11X+2N+qTatk0v8tuwGtm68rKYDSc=; b=qqPazthVnoePMORDXQpIBXs2jbnaCUuG7xQMxrizihqD1ONAd7sB7JCEAO5fq8Asao NxWpK9mN8yBRMjWlD9c4tGg4yRAaAvKR8cECqV9ACf52n0vdpAtXPGs0wRn0+z7N/Yco OKdzJX3a4zptyQJzCtBB1pU6W17eLwlF3CvwCvzCQq7RD4zcQ6rTYGqzMgnv5mblUqMm q+GrhR293pQSMHJb9uZ/i5PJwus6L+sijN1/x14s/DEFn4xW5bN5CK60/5txJB/o/2Jp zilZcpzhzma6n3wvDUO4hLRxF2oYJA4EKAgj0Zmxjuc8aK6dzZX6EgvFhXY64xC7uJ5U MpxA== X-Gm-Message-State: AOJu0YwtDZ3O9PliGnFKyswPNrpTdjaLzThePxRM2AsK4CHFS/FQKblL rYQheLtdVCtnceeg1+8ZMKWoiPHQEsaHTsEJruSGZ/cSrLHi8lJQGZ3WxxyezSM= X-Google-Smtp-Source: AGHT+IEVH0ezXJDe2WjAD+U30CNhVeDx+5TgV1dWJQd9Q0jS57IeWHDd107TwZPYXhyCQ6kAoTrjsw== X-Received: by 2002:a05:6808:1286:b0:3c0:3e27:b122 with SMTP id a6-20020a056808128600b003c03e27b122mr184923oiw.39.1708978650061; Mon, 26 Feb 2024 12:17:30 -0800 (PST) Received: from taylor-ubuntu.austin.rr.com (068-203-008-061.res.spectrum.com. [68.203.8.61]) by smtp.gmail.com with ESMTPSA id by11-20020a056808340b00b003c1a4a9ad17sm330594oib.46.2024.02.26.12.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 12:17:29 -0800 (PST) From: Taylor Simpson To: qemu-devel@nongnu.org Cc: bcain@quicinc.com, quic_mathbern@quicinc.com, sidneym@quicinc.com, quic_mliebel@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, ale@rev.ng, anjo@rev.ng, ltaylorsimpson@gmail.com Subject: [PATCH 3/9] Hexagon (target/hexagon) Mark dest_idx in trans functions Date: Mon, 26 Feb 2024 13:17:16 -0700 Message-Id: <20240226201722.391879-4-ltaylorsimpson@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226201722.391879-1-ltaylorsimpson@gmail.com> References: <20240226201722.391879-1-ltaylorsimpson@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::236; envelope-from=ltaylorsimpson@gmail.com; helo=mail-oi1-x236.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Check that the value matches opcode_reginfo/opcode_wregs Signed-off-by: Taylor Simpson --- target/hexagon/insn.h | 1 + target/hexagon/decode.c | 2 ++ target/hexagon/mmvec/decode_ext_mmvec.c | 2 ++ target/hexagon/gen_trans_funcs.py | 4 ++++ 4 files changed, 9 insertions(+) diff --git a/target/hexagon/insn.h b/target/hexagon/insn.h index 36502bf056..a770379958 100644 --- a/target/hexagon/insn.h +++ b/target/hexagon/insn.h @@ -40,6 +40,7 @@ struct Instruction { uint32_t which_extended:1; /* If has an extender, which immediate */ uint32_t new_value_producer_slot:4; int32_t new_read_idx; + int32_t dest_idx; bool part1; /* * cmp-jumps are split into two insns. diff --git a/target/hexagon/decode.c b/target/hexagon/decode.c index 4595e30384..a4d8500fea 100644 --- a/target/hexagon/decode.c +++ b/target/hexagon/decode.c @@ -184,6 +184,8 @@ decode_fill_newvalue_regno(Packet *packet) /* Now patch up the consumer with the register number */ dst_idx = dststr - opcode_reginfo[def_opcode]; + g_assert(packet->insn[def_idx].dest_idx != -1 && + packet->insn[def_idx].dest_idx == dst_idx); packet->insn[i].regno[use_regidx] = packet->insn[def_idx].regno[dst_idx]; /* diff --git a/target/hexagon/mmvec/decode_ext_mmvec.c b/target/hexagon/mmvec/decode_ext_mmvec.c index e9007f5d71..c1320406df 100644 --- a/target/hexagon/mmvec/decode_ext_mmvec.c +++ b/target/hexagon/mmvec/decode_ext_mmvec.c @@ -86,6 +86,8 @@ check_new_value(Packet *pkt) /* still not there, we have a bad packet */ g_assert_not_reached(); } + g_assert(pkt->insn[def_idx].dest_idx != -1 && + pkt->insn[def_idx].dest_idx == dststr - reginfo); int def_regnum = pkt->insn[def_idx].regno[dststr - reginfo]; /* Now patch up the consumer with the register number */ pkt->insn[i].regno[use_regidx] = def_regnum ^ def_oreg; diff --git a/target/hexagon/gen_trans_funcs.py b/target/hexagon/gen_trans_funcs.py index 79475b2946..07292e0170 100755 --- a/target/hexagon/gen_trans_funcs.py +++ b/target/hexagon/gen_trans_funcs.py @@ -85,6 +85,7 @@ def gen_trans_funcs(f): """)) new_read_idx = -1 + dest_idx = -1 for regno, regstruct in enumerate(regs): reg_type, reg_id, _, _ = regstruct reg = hex_common.get_register(tag, reg_type, reg_id) @@ -93,6 +94,8 @@ def gen_trans_funcs(f): """)) if reg.is_read() and reg.is_new(): new_read_idx = regno + if reg.is_written() and dest_idx == -1: + dest_idx = regno if len(imms) != 0: mark_which_imm_extended(f, tag) @@ -115,6 +118,7 @@ def gen_trans_funcs(f): f.write(code_fmt(f"""\ insn->new_read_idx = {new_read_idx}; + insn->dest_idx = {dest_idx}; """)) f.write(textwrap.dedent(f"""\ return true; From patchwork Mon Feb 26 20:17:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 13572795 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 59C7FC5478C for ; Mon, 26 Feb 2024 20:18:57 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rehPr-0001cd-Pj; Mon, 26 Feb 2024 15:17:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rehPq-0001c7-OI for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:34 -0500 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rehPp-000803-6F for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:34 -0500 Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-3bb9b28acb4so2482073b6e.2 for ; Mon, 26 Feb 2024 12:17:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708978651; x=1709583451; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yMW6AxjBVDIdk1/2CbavQRJvPc+W233QtqwWnqwEGOg=; b=Q+GPhQXabJHbTeYOOvQ6og0ZmVRWMYJiKpmzEoRMEoyYHNPzXaN9UjaQ0dtGb6ZdPE dNtn78X+t7SlpdKyvZCA8Lms/s5/9pZ7c3UzlUAqWjkWEbOndOgMoIWoMcuRWHQ1kMuH LZSQ5ORm0K9WK/r75rc2Q+JHNZbsJhZNlV9exhSydZR9swKmJwX/EjXKx3xaPdIrstju J4xchHopFKfwlwWvSW/rCKA/TeuIEuhq2LIZh7Qsm3jrVSsAGwkIOXd0rEXp+wCSLwzs +xs9A3NNdmuoZUA2AssG8h5rTAW+C1p1Q1Bh9/in/535L8nwUtEPQsVacRb/mWTOt2h9 VV6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708978651; x=1709583451; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yMW6AxjBVDIdk1/2CbavQRJvPc+W233QtqwWnqwEGOg=; b=I8za7lbo7B/Nf2spn1iTRB8U0pTgIzZTrPlldE0fZ/+lEpkh6irprh1rRtVRy+lw+S rq56qVar/5SqBeZ/P6PBkisYstr1BLZBgX1PhT8EciYtZdOtLC5sOrrkyEvJewuEzgAt Us75m94YGCFLYPiJjgrik9xs+KNtbMioRx5qlaB1Dp4K0kwSrk3ThIZMDXofwdZtdcu5 2+N0pzf99O69Y3gnJXZtQxqEU5MBrToA4dsHuyoGnkptoSLTl2dQ7Oahbxt/NIwC2fCB fYdqTIeQrOng3ThjRPBiNBi8+TvOgGjvWucLTywMALzFSvW8pTDa7uBjINt/xRsarWDD QDSw== X-Gm-Message-State: AOJu0YzbejoLXl4pdOs5d51pV7BwyolnQf40HQ6IPW+WI7E2Bk7WFqWX WtOBD04v9ui/kmxhuWI0rGT5lu/ZxzOH4PFINLkbCjfH4BkbQtskWHG6Iz7DsR4= X-Google-Smtp-Source: AGHT+IFVNxavW8N79nMnwL4jbkbBBZwkCjd/ENpRKu/qPCb6zKA1BLcU061IcUoOJMMb6FSXD0QmdQ== X-Received: by 2002:a05:6808:2189:b0:3bf:fdb2:ca5b with SMTP id be9-20020a056808218900b003bffdb2ca5bmr222894oib.3.1708978651490; Mon, 26 Feb 2024 12:17:31 -0800 (PST) Received: from taylor-ubuntu.austin.rr.com (068-203-008-061.res.spectrum.com. [68.203.8.61]) by smtp.gmail.com with ESMTPSA id by11-20020a056808340b00b003c1a4a9ad17sm330594oib.46.2024.02.26.12.17.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 12:17:30 -0800 (PST) From: Taylor Simpson To: qemu-devel@nongnu.org Cc: bcain@quicinc.com, quic_mathbern@quicinc.com, sidneym@quicinc.com, quic_mliebel@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, ale@rev.ng, anjo@rev.ng, ltaylorsimpson@gmail.com Subject: [PATCH 4/9] Hexagon (target/hexagon) Mark has_pred_dest in trans functions Date: Mon, 26 Feb 2024 13:17:17 -0700 Message-Id: <20240226201722.391879-5-ltaylorsimpson@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226201722.391879-1-ltaylorsimpson@gmail.com> References: <20240226201722.391879-1-ltaylorsimpson@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::229; envelope-from=ltaylorsimpson@gmail.com; helo=mail-oi1-x229.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Check that the value matches opcode_wregs Signed-off-by: Taylor Simpson --- target/hexagon/insn.h | 1 + target/hexagon/decode.c | 3 +++ target/hexagon/gen_trans_funcs.py | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/target/hexagon/insn.h b/target/hexagon/insn.h index a770379958..24dcf7fe9f 100644 --- a/target/hexagon/insn.h +++ b/target/hexagon/insn.h @@ -41,6 +41,7 @@ struct Instruction { uint32_t new_value_producer_slot:4; int32_t new_read_idx; int32_t dest_idx; + bool has_pred_dest; bool part1; /* * cmp-jumps are split into two insns. diff --git a/target/hexagon/decode.c b/target/hexagon/decode.c index a4d8500fea..84a3899556 100644 --- a/target/hexagon/decode.c +++ b/target/hexagon/decode.c @@ -366,6 +366,9 @@ static void decode_shuffle_for_execution(Packet *packet) for (flag = false, i = 0; i < last_insn + 1; i++) { int opcode = packet->insn[i].opcode; + g_assert(packet->insn[i].has_pred_dest == + (strstr(opcode_wregs[opcode], "Pd4") || + strstr(opcode_wregs[opcode], "Pe4"))); if ((strstr(opcode_wregs[opcode], "Pd4") || strstr(opcode_wregs[opcode], "Pe4")) && GET_ATTRIB(opcode, A_STORE) == 0) { diff --git a/target/hexagon/gen_trans_funcs.py b/target/hexagon/gen_trans_funcs.py index 07292e0170..f1972fd2dd 100755 --- a/target/hexagon/gen_trans_funcs.py +++ b/target/hexagon/gen_trans_funcs.py @@ -86,6 +86,7 @@ def gen_trans_funcs(f): new_read_idx = -1 dest_idx = -1 + has_pred_dest = "false" for regno, regstruct in enumerate(regs): reg_type, reg_id, _, _ = regstruct reg = hex_common.get_register(tag, reg_type, reg_id) @@ -96,6 +97,8 @@ def gen_trans_funcs(f): new_read_idx = regno if reg.is_written() and dest_idx == -1: dest_idx = regno + if reg_type == "P" and not reg.is_read(): + has_pred_dest = "true" if len(imms) != 0: mark_which_imm_extended(f, tag) @@ -119,6 +122,7 @@ def gen_trans_funcs(f): f.write(code_fmt(f"""\ insn->new_read_idx = {new_read_idx}; insn->dest_idx = {dest_idx}; + insn->has_pred_dest = {has_pred_dest}; """)) f.write(textwrap.dedent(f"""\ return true; From patchwork Mon Feb 26 20:17:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 13572789 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A563C48BF6 for ; Mon, 26 Feb 2024 20:18:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rehPu-0001dm-W0; Mon, 26 Feb 2024 15:17:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rehPs-0001dK-KY for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:36 -0500 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rehPr-00080T-34 for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:36 -0500 Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3bb9d54575cso2843902b6e.2 for ; Mon, 26 Feb 2024 12:17:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708978653; x=1709583453; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=G8J7F2iE5kae+EJMR1Fj9GxIukzXTHmw7zGOIwbFMQA=; b=BE8twdb330PofWpkkN7hEK/zvyaZBgFRcswu9WsSXDR3J9zzF+DaHKruUAiQtTq/bY YkVVaWp5RpQU0OPdmdTMUzNqScyHEb0eLNnSdxe/xm7eOicrSfx9oSwP6IuTuyKD1GGW 5QXgPtdBe0xd9bYQKfkKEXX9m1MAxHnw/h2WGMehyEHARYKlxqVbOBEDc3E4CPpkX+hy z31RPtQ8ZGxENIP8qfwbkTBx71214ydmHg8N95OBUHiKuEXkwgawsSLl3TnCVhNlAY74 AB4eo9FJ5Gi586QC7jBWdq3vxn7Uw0ila+0FmTTVwgX8JO4E2f1gQ2+7aRNKtMMV7H6R kmKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708978653; x=1709583453; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G8J7F2iE5kae+EJMR1Fj9GxIukzXTHmw7zGOIwbFMQA=; b=AO3TZKz5MXwRpXA12wngs1I6JOd7dS/rhp+wXTpjeoPBxAMc3MN/wC8IKi7Wt6yuej O4aIrLSy2wofpvqwWsEx+ZoBecCg8wfelvdiwAZ3Gk3hFDN4+tz9DwE18ZzKju3+F39H IP/SkjcR5BZsWHXrGq6ZVOksVTqN09/BBcS88WyisfRvQ3mMfl3ngmrpbyLBWvYoji5R kPQJMOXKUjxw86mIUEJoeuK9URlECBVgGy21e05K/7ZjSue7echt3731fkSNEtzxTqfW 5GB5IM5dQ3XLvMA7YUuSWgMbs+mBpyVZsw/1JZuiRxYjkIUBl4PEeiVLRhgjrEecmS76 ZHQA== X-Gm-Message-State: AOJu0YxLpvwqRFbUEiiakfjN/P5yRQFS0bRAsNVgMUO37+8z/Z75YyWf fsCwb9qQwY0qdvZQUcNfOiwgnG7g1k4Vx6YUxHGqf1WsvrYvL1BjZ2NKoVHRO+E= X-Google-Smtp-Source: AGHT+IEF+Gf5eHD4D9fvOwUflsXd+8nXtTRdx8mW78HPwg4g0NWFhwKusFrCTpriaLNL/8rqcJIscg== X-Received: by 2002:a05:6808:17a6:b0:3c1:9b7b:5836 with SMTP id bg38-20020a05680817a600b003c19b7b5836mr256826oib.12.1708978652743; Mon, 26 Feb 2024 12:17:32 -0800 (PST) Received: from taylor-ubuntu.austin.rr.com (068-203-008-061.res.spectrum.com. [68.203.8.61]) by smtp.gmail.com with ESMTPSA id by11-20020a056808340b00b003c1a4a9ad17sm330594oib.46.2024.02.26.12.17.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 12:17:32 -0800 (PST) From: Taylor Simpson To: qemu-devel@nongnu.org Cc: bcain@quicinc.com, quic_mathbern@quicinc.com, sidneym@quicinc.com, quic_mliebel@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, ale@rev.ng, anjo@rev.ng, ltaylorsimpson@gmail.com Subject: [PATCH 5/9] Hexagon (tests/tcg/hexagon) Test HVX .new read from high half of pair Date: Mon, 26 Feb 2024 13:17:18 -0700 Message-Id: <20240226201722.391879-6-ltaylorsimpson@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226201722.391879-1-ltaylorsimpson@gmail.com> References: <20240226201722.391879-1-ltaylorsimpson@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22b; envelope-from=ltaylorsimpson@gmail.com; helo=mail-oi1-x22b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Make sure the decoding of HVX .new is correctly handling this case Signed-off-by: Taylor Simpson --- tests/tcg/hexagon/hvx_misc.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/tcg/hexagon/hvx_misc.c b/tests/tcg/hexagon/hvx_misc.c index b45170acd1..1fe14b5158 100644 --- a/tests/tcg/hexagon/hvx_misc.c +++ b/tests/tcg/hexagon/hvx_misc.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2021-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. + * Copyright(c) 2021-2024 Qualcomm Innovation Center, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -231,6 +231,7 @@ static void test_masked_store(bool invert) static void test_new_value_store(void) { void *p0 = buffer0; + void *p1 = buffer1; void *pout = output; asm("{\n\t" @@ -242,6 +243,19 @@ static void test_new_value_store(void) expect[0] = buffer0[0]; check_output_w(__LINE__, 1); + + /* Test the .new read from the high half of a pair */ + asm("v7 = vmem(%0 + #0)\n\t" + "v12 = vmem(%1 + #0)\n\t" + "{\n\t" + " v5:4 = vcombine(v12, v7)\n\t" + " vmem(%2 + #0) = v5.new\n\t" + "}\n\t" + : : "r"(p0), "r"(p1), "r"(pout) : "v4", "v5", "v7", "v12", "memory"); + + expect[0] = buffer1[0]; + + check_output_w(__LINE__, 1); } static void test_max_temps() From patchwork Mon Feb 26 20:17:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 13572790 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9EFCC54E4A for ; Mon, 26 Feb 2024 20:18:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rehPw-0001el-S7; Mon, 26 Feb 2024 15:17:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rehPv-0001e0-7U for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:39 -0500 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rehPs-00080f-9Y for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:37 -0500 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3c132695f1bso2211438b6e.2 for ; Mon, 26 Feb 2024 12:17:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708978654; x=1709583454; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U46l8139A+4KRjWcCLYKQaeKeiOnLqLqKh4dYSCOgv0=; b=QJkde2e+YrDypsguCqjVwZqwamLyyFadwtPNNssHLgfMtB11ZBaTYzAsR0T8cEISZ7 9K8+nZFFzAMGWlymz9oxAWnzsszo0NEsuzj/uK+blTZCTiMcCpfYminyz6YQ2OT4ZWb2 rSygvpsSgYKsQlzPPN4T0N8oXMXiVMqQjnXGO7OCrp/Ty5S5ZKGiAtbuZq003xwnISKF LhXlGnGKQV1pA69MfxkIbB6ecR7lr82sMQIegM7Q7z9jBenNA0nn+793mRX5nZL4PrjN gODYQJVA9wEjpbOWNTCJpLdroZo0cyYqaVddEKaXJSNCFjQdiESJfXj/oD8a9QGyz1SB wjog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708978654; x=1709583454; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U46l8139A+4KRjWcCLYKQaeKeiOnLqLqKh4dYSCOgv0=; b=deJS/SkrWJSyu/6yMgMGn+VrCfIXI2XOlg8Spkedem3f8KyhrGCafEWdPMm95imKjD Z+Ok+1YSbgUrANxkA2/L4nifVYQahxzC5MC5nkQLdU0tAGxg3/27LU54H61yrLPoQ+JO yqaFGFxBIexKnNbJ+pCU5LVT2IojxlOaSewOhIXnoJ5RGkL3E9LqWq0eNn6QMkUhN2ko kpw+Bn4OC81yigov/Zcqw0Nl7U91DXrnTlLQhxYU5otBQ73NwKu23JOZZX1z/nX0dQXl FYseaUOyvNLcxuJHkjb2eT8VjVxzr5+e5ro+179XZYetC3uAl0yviu8vL8YEIt8SuIut JD+w== X-Gm-Message-State: AOJu0YyAbNb5U2J6EWORNKeilEbNg8ofXcLyp4bDrJB9tFtgJ5yRUp5I fI2Ue5XT/ufE6CXUc2g17e0qtLq9g3qz/qkb1bKiR6VfrE7h/4bX9dvesof+A8k= X-Google-Smtp-Source: AGHT+IHt+qhzIoEYfFd+/u+8C5uGLpYDaMJGcX8nXgMeK+xSBcUJqm3UIGI8apQzt3BmtClFw1zQMw== X-Received: by 2002:a05:6808:130f:b0:3c1:81ad:f45f with SMTP id y15-20020a056808130f00b003c181adf45fmr210492oiv.28.1708978654268; Mon, 26 Feb 2024 12:17:34 -0800 (PST) Received: from taylor-ubuntu.austin.rr.com (068-203-008-061.res.spectrum.com. [68.203.8.61]) by smtp.gmail.com with ESMTPSA id by11-20020a056808340b00b003c1a4a9ad17sm330594oib.46.2024.02.26.12.17.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 12:17:33 -0800 (PST) From: Taylor Simpson To: qemu-devel@nongnu.org Cc: bcain@quicinc.com, quic_mathbern@quicinc.com, sidneym@quicinc.com, quic_mliebel@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, ale@rev.ng, anjo@rev.ng, ltaylorsimpson@gmail.com Subject: [PATCH 6/9] Hexagon (target/hexagon) Remove uses of op_regs_generated.h.inc Date: Mon, 26 Feb 2024 13:17:19 -0700 Message-Id: <20240226201722.391879-7-ltaylorsimpson@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226201722.391879-1-ltaylorsimpson@gmail.com> References: <20240226201722.391879-1-ltaylorsimpson@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::231; envelope-from=ltaylorsimpson@gmail.com; helo=mail-oi1-x231.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Taylor Simpson --- target/hexagon/opcodes.h | 4 -- target/hexagon/decode.c | 57 +++---------------------- target/hexagon/mmvec/decode_ext_mmvec.c | 34 +++------------ target/hexagon/opcodes.c | 28 ------------ 4 files changed, 13 insertions(+), 110 deletions(-) diff --git a/target/hexagon/opcodes.h b/target/hexagon/opcodes.h index fa7e321950..0ee11bd445 100644 --- a/target/hexagon/opcodes.h +++ b/target/hexagon/opcodes.h @@ -40,10 +40,6 @@ typedef enum { extern const char * const opcode_names[]; -extern const char * const opcode_reginfo[]; -extern const char * const opcode_rregs[]; -extern const char * const opcode_wregs[]; - typedef struct { const char * const encoding; const EncClass enc_class; diff --git a/target/hexagon/decode.c b/target/hexagon/decode.c index 84a3899556..23deba2426 100644 --- a/target/hexagon/decode.c +++ b/target/hexagon/decode.c @@ -115,24 +115,13 @@ static void decode_fill_newvalue_regno(Packet *packet) { int i, use_regidx, offset, def_idx, dst_idx; - uint16_t def_opcode, use_opcode; - char *dststr; for (i = 1; i < packet->num_insns; i++) { if (GET_ATTRIB(packet->insn[i].opcode, A_DOTNEWVALUE) && !GET_ATTRIB(packet->insn[i].opcode, A_EXTENSION)) { - use_opcode = packet->insn[i].opcode; - - /* It's a store, so we're adjusting the Nt field */ - if (GET_ATTRIB(use_opcode, A_STORE)) { - use_regidx = strchr(opcode_reginfo[use_opcode], 't') - - opcode_reginfo[use_opcode]; - } else { /* It's a Jump, so we're adjusting the Ns field */ - use_regidx = strchr(opcode_reginfo[use_opcode], 's') - - opcode_reginfo[use_opcode]; - } - g_assert(packet->insn[i].new_read_idx != -1 && - packet->insn[i].new_read_idx == use_regidx); + + g_assert(packet->insn[i].new_read_idx != -1); + use_regidx = packet->insn[i].new_read_idx; /* * What's encoded at the N-field is the offset to who's producing @@ -153,39 +142,9 @@ decode_fill_newvalue_regno(Packet *packet) */ g_assert(!((def_idx < 0) || (def_idx > (packet->num_insns - 1)))); - /* - * packet->insn[def_idx] is the producer - * Figure out which type of destination it produces - * and the corresponding index in the reginfo - */ - def_opcode = packet->insn[def_idx].opcode; - dststr = strstr(opcode_wregs[def_opcode], "Rd"); - if (dststr) { - dststr = strchr(opcode_reginfo[def_opcode], 'd'); - } else { - dststr = strstr(opcode_wregs[def_opcode], "Rx"); - if (dststr) { - dststr = strchr(opcode_reginfo[def_opcode], 'x'); - } else { - dststr = strstr(opcode_wregs[def_opcode], "Re"); - if (dststr) { - dststr = strchr(opcode_reginfo[def_opcode], 'e'); - } else { - dststr = strstr(opcode_wregs[def_opcode], "Ry"); - if (dststr) { - dststr = strchr(opcode_reginfo[def_opcode], 'y'); - } else { - g_assert_not_reached(); - } - } - } - } - g_assert(dststr != NULL); - /* Now patch up the consumer with the register number */ - dst_idx = dststr - opcode_reginfo[def_opcode]; - g_assert(packet->insn[def_idx].dest_idx != -1 && - packet->insn[def_idx].dest_idx == dst_idx); + g_assert(packet->insn[def_idx].dest_idx != -1); + dst_idx = packet->insn[def_idx].dest_idx; packet->insn[i].regno[use_regidx] = packet->insn[def_idx].regno[dst_idx]; /* @@ -366,11 +325,7 @@ static void decode_shuffle_for_execution(Packet *packet) for (flag = false, i = 0; i < last_insn + 1; i++) { int opcode = packet->insn[i].opcode; - g_assert(packet->insn[i].has_pred_dest == - (strstr(opcode_wregs[opcode], "Pd4") || - strstr(opcode_wregs[opcode], "Pe4"))); - if ((strstr(opcode_wregs[opcode], "Pd4") || - strstr(opcode_wregs[opcode], "Pe4")) && + if (packet->insn[i].has_pred_dest && GET_ATTRIB(opcode, A_STORE) == 0) { /* This should be a compare (not a store conditional) */ if (flag) { diff --git a/target/hexagon/mmvec/decode_ext_mmvec.c b/target/hexagon/mmvec/decode_ext_mmvec.c index c1320406df..f850d0154d 100644 --- a/target/hexagon/mmvec/decode_ext_mmvec.c +++ b/target/hexagon/mmvec/decode_ext_mmvec.c @@ -28,21 +28,15 @@ check_new_value(Packet *pkt) { /* .new value for a MMVector store */ int i, j; - const char *reginfo; - const char *destletters; - const char *dststr = NULL; uint16_t def_opcode; - char letter; for (i = 1; i < pkt->num_insns; i++) { uint16_t use_opcode = pkt->insn[i].opcode; if (GET_ATTRIB(use_opcode, A_DOTNEWVALUE) && GET_ATTRIB(use_opcode, A_CVI) && GET_ATTRIB(use_opcode, A_STORE)) { - int use_regidx = strchr(opcode_reginfo[use_opcode], 's') - - opcode_reginfo[use_opcode]; - g_assert(pkt->insn[i].new_read_idx != -1 && - pkt->insn[i].new_read_idx == use_regidx); + int use_regidx = pkt->insn[i].new_read_idx; + g_assert(pkt->insn[i].new_read_idx != -1); /* * What's encoded at the N-field is the offset to who's producing * the value. @@ -70,33 +64,19 @@ check_new_value(Packet *pkt) /* def_idx is the index of the producer */ def_opcode = pkt->insn[def_idx].opcode; - reginfo = opcode_reginfo[def_opcode]; - destletters = "dexy"; - for (j = 0; (letter = destletters[j]) != 0; j++) { - dststr = strchr(reginfo, letter); - if (dststr != NULL) { - break; - } - } - if ((dststr == NULL) && GET_ATTRIB(def_opcode, A_CVI_GATHER)) { + if ((pkt->insn[def_idx].dest_idx == -1) && + GET_ATTRIB(def_opcode, A_CVI_GATHER)) { pkt->insn[i].regno[use_regidx] = def_oreg; pkt->insn[i].new_value_producer_slot = pkt->insn[def_idx].slot; } else { - if (dststr == NULL) { + if (pkt->insn[def_idx].dest_idx == -1) { /* still not there, we have a bad packet */ g_assert_not_reached(); } - g_assert(pkt->insn[def_idx].dest_idx != -1 && - pkt->insn[def_idx].dest_idx == dststr - reginfo); - int def_regnum = pkt->insn[def_idx].regno[dststr - reginfo]; + int def_regnum = + pkt->insn[def_idx].regno[pkt->insn[def_idx].dest_idx]; /* Now patch up the consumer with the register number */ pkt->insn[i].regno[use_regidx] = def_regnum ^ def_oreg; - /* special case for (Vx,Vy) */ - dststr = strchr(reginfo, 'y'); - if (def_oreg && strchr(reginfo, 'x') && dststr) { - def_regnum = pkt->insn[def_idx].regno[dststr - reginfo]; - pkt->insn[i].regno[use_regidx] = def_regnum; - } /* * We need to remember who produces this value to later * check if it was dynamically cancelled diff --git a/target/hexagon/opcodes.c b/target/hexagon/opcodes.c index 1f7f3def38..02ae9cf787 100644 --- a/target/hexagon/opcodes.c +++ b/target/hexagon/opcodes.c @@ -36,34 +36,6 @@ const char * const opcode_names[] = { #undef OPCODE }; -const char * const opcode_reginfo[] = { -#define IMMINFO(TAG, SIGN, SIZE, SHAMT, SIGN2, SIZE2, SHAMT2) /* nothing */ -#define REGINFO(TAG, REGINFO, RREGS, WREGS) REGINFO, -#include "op_regs_generated.h.inc" - NULL -#undef REGINFO -#undef IMMINFO -}; - - -const char * const opcode_rregs[] = { -#define IMMINFO(TAG, SIGN, SIZE, SHAMT, SIGN2, SIZE2, SHAMT2) /* nothing */ -#define REGINFO(TAG, REGINFO, RREGS, WREGS) RREGS, -#include "op_regs_generated.h.inc" - NULL -#undef REGINFO -#undef IMMINFO -}; - - -const char * const opcode_wregs[] = { -#define IMMINFO(TAG, SIGN, SIZE, SHAMT, SIGN2, SIZE2, SHAMT2) /* nothing */ -#define REGINFO(TAG, REGINFO, RREGS, WREGS) WREGS, -#include "op_regs_generated.h.inc" - NULL -#undef REGINFO -#undef IMMINFO -}; const char * const opcode_short_semantics[] = { #define DEF_SHORTCODE(TAG, SHORTCODE) [TAG] = #SHORTCODE, From patchwork Mon Feb 26 20:17:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 13572791 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B1C92C54E55 for ; Mon, 26 Feb 2024 20:18:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rehQ1-0001gW-KE; Mon, 26 Feb 2024 15:17:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rehQ0-0001g9-0L for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:44 -0500 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rehPt-00080p-SI for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:42 -0500 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3c199237eaeso1896267b6e.0 for ; Mon, 26 Feb 2024 12:17:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708978656; x=1709583456; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5r8V+dWA3RVhS5vfjxAmsItqAa6Frdq+W5yFoj18eJ8=; b=KuyxHXqSF0tKC0XvdygtDxYYZ9+wqyODIBRQe00/rwNQc8ZAyANSq7iyHLwIVqbRXB fbFIxHbb5nPnLwEslVhhOPX0UrwXnzE0ZtWFLiammDOVgtTHNcnIpmOVDQkcniKlDY3x /sjEKMXK/tP8AGxqv7d7ZJA5wdrFtR+9EJRhlBW2q9RPYdq5heBErCaYWjoUSNiesrLI FWvRCGtcLA3xCVsTRKgYNbPlCEPyGNSs9NHq3kRyVKgRIZd0QHUFtl52DJRAwgFkZNR1 klB6JQdTkfbAiZ6lvn+MVZMdUvGaRkZCzSCqdVsPp4qnO2k5h3qQYkRLyXGd3Qc2nlNi id1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708978656; x=1709583456; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5r8V+dWA3RVhS5vfjxAmsItqAa6Frdq+W5yFoj18eJ8=; b=mram3a9Ba0meDBh7HoAzNgM2GDMLdheiG0kXawyHhf3QprHmbR59E13VTsz0a2rrl/ 6sVzKanpqUm2a8xftGZPUJZjEH8kg+vZ31iyQoChp7Aal7b5pExt4a0vwBdsTsDKL0BF Ak0zsGt6H3ihQbRDorCpX1fDUq2oTtaucsYhi35/oUCvqxK2mjqJ37EDPmI5CI2UWXDH OCiKY3POP62Rp24EDHFCkw7ScmFhiAQYTNjdHMyrDdZxoyy8PNRs2Lz6GpkeXsMcI7vh JloMVfaubkKGyhciTU8pcWZGxFls0MxHaIOJ00yuhsXKr5fH4hEHYNJzPmZOOiBHjUzU 8AvA== X-Gm-Message-State: AOJu0YxtUyxaANuxnRAjPiE5frczxoKQo7jIyQ+9k682Ct6bDSFQvjPX PtHclMVuIXJiaq4/pzl8zzZv8yGcSOtVpa/GYr0zhLffLo2sEQhrZ+R6tDVDMpA= X-Google-Smtp-Source: AGHT+IF3a893SMloMtD5gR4asIlbjvL5GwLKGfmH0MIPtNOfhCb1MnHkhP0sMvFBFA+wuNojQ0AqLQ== X-Received: by 2002:a05:6808:15a9:b0:3c0:34ff:891f with SMTP id t41-20020a05680815a900b003c034ff891fmr217745oiw.57.1708978655785; Mon, 26 Feb 2024 12:17:35 -0800 (PST) Received: from taylor-ubuntu.austin.rr.com (068-203-008-061.res.spectrum.com. [68.203.8.61]) by smtp.gmail.com with ESMTPSA id by11-20020a056808340b00b003c1a4a9ad17sm330594oib.46.2024.02.26.12.17.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 12:17:35 -0800 (PST) From: Taylor Simpson To: qemu-devel@nongnu.org Cc: bcain@quicinc.com, quic_mathbern@quicinc.com, sidneym@quicinc.com, quic_mliebel@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, ale@rev.ng, anjo@rev.ng, ltaylorsimpson@gmail.com Subject: [PATCH 7/9] Hexagon (target/hexagon) Remove gen_op_regs.py Date: Mon, 26 Feb 2024 13:17:20 -0700 Message-Id: <20240226201722.391879-8-ltaylorsimpson@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226201722.391879-1-ltaylorsimpson@gmail.com> References: <20240226201722.391879-1-ltaylorsimpson@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::231; envelope-from=ltaylorsimpson@gmail.com; helo=mail-oi1-x231.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01, WEIRD_QUOTING=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Taylor Simpson --- target/hexagon/README | 1 - target/hexagon/gen_op_regs.py | 125 ---------------------------------- target/hexagon/meson.build | 14 +--- 3 files changed, 2 insertions(+), 138 deletions(-) delete mode 100755 target/hexagon/gen_op_regs.py diff --git a/target/hexagon/README b/target/hexagon/README index 746ebec378..065c05154d 100644 --- a/target/hexagon/README +++ b/target/hexagon/README @@ -43,7 +43,6 @@ target/hexagon/gen_semantics.c. This step produces That file is consumed by the following python scripts to produce the indicated header files in /target/hexagon gen_opcodes_def.py -> opcodes_def_generated.h.inc - gen_op_regs.py -> op_regs_generated.h.inc gen_printinsn.py -> printinsn_generated.h.inc gen_op_attribs.py -> op_attribs_generated.h.inc gen_helper_protos.py -> helper_protos_generated.h.inc diff --git a/target/hexagon/gen_op_regs.py b/target/hexagon/gen_op_regs.py deleted file mode 100755 index 7b7b33895a..0000000000 --- a/target/hexagon/gen_op_regs.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python3 - -## -## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, see . -## - -import sys -import re -import string -import hex_common - - -## -## Generate the register and immediate operands for each instruction -## -def calculate_regid_reg(tag): - def letter_inc(x): - return chr(ord(x) + 1) - - ordered_implregs = ["SP", "FP", "LR"] - srcdst_lett = "X" - src_lett = "S" - dst_lett = "D" - retstr = "" - mapdict = {} - for reg in ordered_implregs: - reg_rd = 0 - reg_wr = 0 - if ("A_IMPLICIT_WRITES_" + reg) in hex_common.attribdict[tag]: - reg_wr = 1 - if reg_rd and reg_wr: - retstr += srcdst_lett - mapdict[srcdst_lett] = reg - srcdst_lett = letter_inc(srcdst_lett) - elif reg_rd: - retstr += src_lett - mapdict[src_lett] = reg - src_lett = letter_inc(src_lett) - elif reg_wr: - retstr += dst_lett - mapdict[dst_lett] = reg - dst_lett = letter_inc(dst_lett) - return retstr, mapdict - - -def calculate_regid_letters(tag): - retstr, mapdict = calculate_regid_reg(tag) - return retstr - - -def strip_reg_prefix(x): - y = x.replace("UREG.", "") - y = y.replace("MREG.", "") - return y.replace("GREG.", "") - - -def main(): - hex_common.read_semantics_file(sys.argv[1]) - hex_common.read_attribs_file(sys.argv[2]) - hex_common.init_registers() - tagregs = hex_common.get_tagregs(full=True) - tagimms = hex_common.get_tagimms() - - with open(sys.argv[3], "w") as f: - for tag in hex_common.tags: - regs = tagregs[tag] - rregs = [] - wregs = [] - regids = "" - for regtype, regid, _, numregs in regs: - reg = hex_common.get_register(tag, regtype, regid) - if reg.is_read(): - if regid[0] not in regids: - regids += regid[0] - rregs.append(regtype + regid + numregs) - if reg.is_written(): - wregs.append(regtype + regid + numregs) - if regid[0] not in regids: - regids += regid[0] - for attrib in hex_common.attribdict[tag]: - if hex_common.attribinfo[attrib]["rreg"]: - rregs.append(strip_reg_prefix(attribinfo[attrib]["rreg"])) - if hex_common.attribinfo[attrib]["wreg"]: - wregs.append(strip_reg_prefix(attribinfo[attrib]["wreg"])) - regids += calculate_regid_letters(tag) - f.write( - f'REGINFO({tag},"{regids}",\t/*RD:*/\t"{",".join(rregs)}",' - f'\t/*WR:*/\t"{",".join(wregs)}")\n' - ) - - for tag in hex_common.tags: - imms = tagimms[tag] - f.write(f"IMMINFO({tag}") - if not imms: - f.write(""",'u',0,0,'U',0,0""") - for sign, size, shamt in imms: - if sign == "r": - sign = "s" - if not shamt: - shamt = "0" - f.write(f""",'{sign}',{size},{shamt}""") - if len(imms) == 1: - if sign.isupper(): - myu = "u" - else: - myu = "U" - f.write(f""",'{myu}',0,0""") - f.write(")\n") - - -if __name__ == "__main__": - main() diff --git a/target/hexagon/meson.build b/target/hexagon/meson.build index fb480afc03..b3a0944d3b 100644 --- a/target/hexagon/meson.build +++ b/target/hexagon/meson.build @@ -1,5 +1,5 @@ ## -## Copyright(c) 2020-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. +## Copyright(c) 2020-2024 Qualcomm Innovation Center, Inc. All Rights Reserved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -45,7 +45,6 @@ hexagon_ss.add(semantics_generated) # shortcode_generated.h.inc # tcg_func_table_generated.c.inc # printinsn_generated.h.inc -# op_regs_generated.h.inc # op_attribs_generated.h.inc # opcodes_def_generated.h.inc # @@ -76,15 +75,6 @@ printinsn_generated = custom_target( ) hexagon_ss.add(printinsn_generated) -op_regs_generated = custom_target( - 'op_regs_generated.h.inc', - output: 'op_regs_generated.h.inc', - depends: [semantics_generated], - depend_files: [hex_common_py, attribs_def], - command: [python, files('gen_op_regs.py'), semantics_generated, attribs_def, '@OUTPUT@'], -) -hexagon_ss.add(op_regs_generated) - op_attribs_generated = custom_target( 'op_attribs_generated.h.inc', output: 'op_attribs_generated.h.inc', @@ -110,7 +100,7 @@ hexagon_ss.add(opcodes_def_generated) # gen_dectree_import = executable( 'gen_dectree_import', - 'gen_dectree_import.c', opcodes_def_generated, op_regs_generated, + 'gen_dectree_import.c', opcodes_def_generated, native: true, build_by_default: false) iset_py = custom_target( From patchwork Mon Feb 26 20:17:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 13572802 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A0DF9C48BF6 for ; Mon, 26 Feb 2024 20:19:07 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rehQ0-0001gB-5L; Mon, 26 Feb 2024 15:17:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rehPx-0001ew-CN for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:41 -0500 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rehPv-000811-BM for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:41 -0500 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3bb9b28acb4so2482133b6e.2 for ; Mon, 26 Feb 2024 12:17:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708978657; x=1709583457; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2kAEgIdBp6Ue1btIM+Uj1VoaSgxC8giYiH5Kmbwpsfk=; b=X0jRWafIfmHCQy4wudzjJon6cdZ6nMaQbT1QBUZZgd/HS7aQVqMxAnaZ9zfX2Xg6H7 MfZcBIDvdzJ5EftWNnjSnZztVddg4pV7IP173ZSITblHUgBatjIQKvgjIUukSfvmI/Bk fTleKwOBfn0SfxwKD54nUp+8dld/e5BT7VCOjzx1Sj8lHyk/EOM9CS2AgpRoc0JAAmAV gwteBUL9qc03wezJZJIg/o4q93bePKk5kr4FedaMkelDKEfbMO4rpoTUQwN+NONdNT+L xImQwap2zxirupCI+RV0SbBDS5QW3vb3T9e5YYK+3oETyDe3NeAmmUdxlcJD+J7B1nj7 WEzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708978657; x=1709583457; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2kAEgIdBp6Ue1btIM+Uj1VoaSgxC8giYiH5Kmbwpsfk=; b=DxZ1sFYZ8u65K/PE/6mz4SrIeZbSR57LQgN19xto6qV3/ivkiJjGFc9azhJgpWgUnd tuS4tEBV2MN5nFJUt6owfEQkqTbKIccpWTWaq1BNJHh6TaL2dwagdofYV82+fCMGJV93 9KLiF4PXiv/9lOBKujqbWDqhrMhA/VmO3fPyeiz3zY3cKnAhTziRRHwaQx2TjjfP+oq4 W+xJLyuScc3v6mc/w+jgo+OngQfRTYTUcV0TvN5wzb5PGi+hbQyO+OVl/rTaiTh7qWOn YyHT0N92YVMqokjrEQM/Y04vvttpdyaxhpR6iXdfDAGIZa4gmsHf3WCW+Ct26uHK0EwP 6gig== X-Gm-Message-State: AOJu0YwoPP/m6H741kyuwJNDf2v6E453rYlokMT4MGadG6p1krYgdsrA jhrJ87ju+PaoPBHMgVK+rk1L2/fCUhwPrWIrHhYTWcebWGpCTzU/SqXq6vZBNxI= X-Google-Smtp-Source: AGHT+IGIC2MNmJJaHD7E3Ew6yvs00WWSjxluTznzDrPZxeqVIlr8drzbSNVdgyUEFxxpJFCgShyqBw== X-Received: by 2002:a05:6808:2189:b0:3bf:fdb2:ca5b with SMTP id be9-20020a056808218900b003bffdb2ca5bmr223210oib.3.1708978657341; Mon, 26 Feb 2024 12:17:37 -0800 (PST) Received: from taylor-ubuntu.austin.rr.com (068-203-008-061.res.spectrum.com. [68.203.8.61]) by smtp.gmail.com with ESMTPSA id by11-20020a056808340b00b003c1a4a9ad17sm330594oib.46.2024.02.26.12.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 12:17:36 -0800 (PST) From: Taylor Simpson To: qemu-devel@nongnu.org Cc: bcain@quicinc.com, quic_mathbern@quicinc.com, sidneym@quicinc.com, quic_mliebel@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, ale@rev.ng, anjo@rev.ng, ltaylorsimpson@gmail.com Subject: [PATCH 8/9] Hexagon (target/hexagon) Remove gen_shortcode.py Date: Mon, 26 Feb 2024 13:17:21 -0700 Message-Id: <20240226201722.391879-9-ltaylorsimpson@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226201722.391879-1-ltaylorsimpson@gmail.com> References: <20240226201722.391879-1-ltaylorsimpson@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::232; envelope-from=ltaylorsimpson@gmail.com; helo=mail-oi1-x232.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This data structure is not used Signed-off-by: Taylor Simpson --- target/hexagon/opcodes.c | 7 ---- target/hexagon/README | 1 - target/hexagon/gen_shortcode.py | 63 --------------------------------- target/hexagon/meson.build | 10 ------ 4 files changed, 81 deletions(-) delete mode 100755 target/hexagon/gen_shortcode.py diff --git a/target/hexagon/opcodes.c b/target/hexagon/opcodes.c index 02ae9cf787..c8bde2f9e9 100644 --- a/target/hexagon/opcodes.c +++ b/target/hexagon/opcodes.c @@ -37,13 +37,6 @@ const char * const opcode_names[] = { }; -const char * const opcode_short_semantics[] = { -#define DEF_SHORTCODE(TAG, SHORTCODE) [TAG] = #SHORTCODE, -#include "shortcode_generated.h.inc" -#undef DEF_SHORTCODE - NULL -}; - DECLARE_BITMAP(opcode_attribs[XX_LAST_OPCODE], A_ZZ_LASTATTRIB); static void init_attribs(int tag, ...) diff --git a/target/hexagon/README b/target/hexagon/README index 065c05154d..65b4fcc0fa 100644 --- a/target/hexagon/README +++ b/target/hexagon/README @@ -46,7 +46,6 @@ header files in /target/hexagon gen_printinsn.py -> printinsn_generated.h.inc gen_op_attribs.py -> op_attribs_generated.h.inc gen_helper_protos.py -> helper_protos_generated.h.inc - gen_shortcode.py -> shortcode_generated.h.inc gen_tcg_funcs.py -> tcg_funcs_generated.c.inc gen_tcg_func_table.py -> tcg_func_table_generated.c.inc gen_helper_funcs.py -> helper_funcs_generated.c.inc diff --git a/target/hexagon/gen_shortcode.py b/target/hexagon/gen_shortcode.py deleted file mode 100755 index deb94446c4..0000000000 --- a/target/hexagon/gen_shortcode.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python3 - -## -## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, see . -## - -import sys -import re -import string -import hex_common - - -def gen_shortcode(f, tag): - f.write(f"DEF_SHORTCODE({tag}, {hex_common.semdict[tag]})\n") - - -def main(): - hex_common.read_semantics_file(sys.argv[1]) - hex_common.read_attribs_file(sys.argv[2]) - hex_common.calculate_attribs() - tagregs = hex_common.get_tagregs() - tagimms = hex_common.get_tagimms() - - with open(sys.argv[3], "w") as f: - f.write("#ifndef DEF_SHORTCODE\n") - f.write("#define DEF_SHORTCODE(TAG,SHORTCODE) /* Nothing */\n") - f.write("#endif\n") - - for tag in hex_common.tags: - ## Skip the priv instructions - if "A_PRIV" in hex_common.attribdict[tag]: - continue - ## Skip the guest instructions - if "A_GUEST" in hex_common.attribdict[tag]: - continue - ## Skip the diag instructions - if tag == "Y6_diag": - continue - if tag == "Y6_diag0": - continue - if tag == "Y6_diag1": - continue - - gen_shortcode(f, tag) - - f.write("#undef DEF_SHORTCODE\n") - - -if __name__ == "__main__": - main() diff --git a/target/hexagon/meson.build b/target/hexagon/meson.build index b3a0944d3b..988e7489ba 100644 --- a/target/hexagon/meson.build +++ b/target/hexagon/meson.build @@ -42,21 +42,11 @@ hexagon_ss.add(semantics_generated) # # Step 2 # We use Python scripts to generate the following files -# shortcode_generated.h.inc # tcg_func_table_generated.c.inc # printinsn_generated.h.inc # op_attribs_generated.h.inc # opcodes_def_generated.h.inc # -shortcode_generated = custom_target( - 'shortcode_generated.h.inc', - output: 'shortcode_generated.h.inc', - depends: [semantics_generated], - depend_files: [hex_common_py, attribs_def], - command: [python, files('gen_shortcode.py'), semantics_generated, attribs_def, '@OUTPUT@'], -) -hexagon_ss.add(shortcode_generated) - tcg_func_table_generated = custom_target( 'tcg_func_table_generated.c.inc', output: 'tcg_func_table_generated.c.inc', From patchwork Mon Feb 26 20:17:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 13572792 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DF41AC54E51 for ; Mon, 26 Feb 2024 20:18:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rehQD-0001ij-4m; Mon, 26 Feb 2024 15:17:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rehQB-0001i7-TU for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:55 -0500 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rehPw-00081B-GW for qemu-devel@nongnu.org; Mon, 26 Feb 2024 15:17:55 -0500 Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3c19937913fso1739947b6e.3 for ; Mon, 26 Feb 2024 12:17:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708978659; x=1709583459; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2mZF31pVOsPdanhM75ZSyb+FCM6gHs0R2hRgmZ/lF6E=; b=NTccxSmM0MwGh/SsrZhozDglv5BVButVPLmecOAsiP+Argu9I56IZMzHog6dM750rr eyMSjQiQXI2M3L7Q4qTiVMALXC/sQklCTrwXXcRNU9VGeabRJwqBVufDVukmvjH5Ks2H aEOa2uwLOP+yTY3vqbzHYiT6co+Q86IiUw2QTUSV6BWm4O9mKQ6/P0772xHn/07sXir/ dZ8TDWjAy4owI/ha8cE2YfgrfaRh9FxA/B+8LUwtctRspu0ry1cMy7ytOw1OALweIGNl J9eMf9+jLepK8RgSJlU6lo3ZoVIDffe1+sR8ue/16D0d3d2b5iJnoJnB1U1Rj9BIZnJX jPvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708978659; x=1709583459; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2mZF31pVOsPdanhM75ZSyb+FCM6gHs0R2hRgmZ/lF6E=; b=nZUOAbHJXDKd8EGoYwbcgie5VLo9Cjexd19bKmLYpge8TMX9iEg8x4M+GMRaCEgzCU nv3X+KNagUnNk4zxQXkpumk0CUNZXH/oLLjOiVzxpbDQjE4ttyYbDSOiMCqIlO6g79PF ThfqLgyg/zAU864keroXfFqeMXz6SXCuEj89Vj3CoGzSk+BUVnMqnxMj3rLJtHG/vvsP yqDnNorbj44GFCcCSLx51ye7SZWVhNOVKaiVVNdnpDE+hheGqjpUsS7EdXOGRxU3ff14 fEyNdSXHCPeKt4qBnkYPxMTj+KVmoKlixIHkgz/uqJNHmzxTuKACipctRrPfofUGpEh7 wA1w== X-Gm-Message-State: AOJu0YxKWN1WPlJengF7rxoVV0WoUEAoox3XiluDn8CtC+uJhTAXa4FH DeLytYmuOXta5h24o60j+yKfdWpIukD61i7ocwCH6ZCBYSZ3ZnS4EqpPttlHRU4= X-Google-Smtp-Source: AGHT+IE38zPgztZiA0dPGoyZs1Bd/krX4Dk/Lsw6CR3SCC/tATASTybDXDt1zGBOkr/nBx0rR/BRtQ== X-Received: by 2002:a05:6808:640c:b0:3c1:abb6:b4b3 with SMTP id fg12-20020a056808640c00b003c1abb6b4b3mr222146oib.2.1708978658915; Mon, 26 Feb 2024 12:17:38 -0800 (PST) Received: from taylor-ubuntu.austin.rr.com (068-203-008-061.res.spectrum.com. [68.203.8.61]) by smtp.gmail.com with ESMTPSA id by11-20020a056808340b00b003c1a4a9ad17sm330594oib.46.2024.02.26.12.17.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 12:17:38 -0800 (PST) From: Taylor Simpson To: qemu-devel@nongnu.org Cc: bcain@quicinc.com, quic_mathbern@quicinc.com, sidneym@quicinc.com, quic_mliebel@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, ale@rev.ng, anjo@rev.ng, ltaylorsimpson@gmail.com Subject: [PATCH 9/9] Hexagon (target/hexagon) Remove hex_common.read_attribs_file Date: Mon, 26 Feb 2024 13:17:22 -0700 Message-Id: <20240226201722.391879-10-ltaylorsimpson@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226201722.391879-1-ltaylorsimpson@gmail.com> References: <20240226201722.391879-1-ltaylorsimpson@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::236; envelope-from=ltaylorsimpson@gmail.com; helo=mail-oi1-x236.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The attribinfo data structure is not used Adjust the command-line arguments to the python scripts Add hex_common.read_common_files for TCG/helper generation scripts Signed-off-by: Taylor Simpson --- target/hexagon/gen_analyze_funcs.py | 21 ++------------- target/hexagon/gen_helper_funcs.py | 21 ++------------- target/hexagon/gen_helper_protos.py | 21 ++------------- target/hexagon/gen_idef_parser_funcs.py | 5 ++-- target/hexagon/gen_op_attribs.py | 5 ++-- target/hexagon/gen_opcodes_def.py | 4 +-- target/hexagon/gen_printinsn.py | 5 ++-- target/hexagon/gen_tcg_func_table.py | 5 ++-- target/hexagon/gen_tcg_funcs.py | 21 ++------------- target/hexagon/hex_common.py | 35 +++++++++++++++---------- target/hexagon/meson.build | 31 +++++++++++----------- 11 files changed, 54 insertions(+), 120 deletions(-) diff --git a/target/hexagon/gen_analyze_funcs.py b/target/hexagon/gen_analyze_funcs.py index a9af666cef..b73b4e2349 100755 --- a/target/hexagon/gen_analyze_funcs.py +++ b/target/hexagon/gen_analyze_funcs.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 ## -## Copyright(c) 2022-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. +## Copyright(c) 2022-2024 Qualcomm Innovation Center, Inc. All Rights Reserved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -67,24 +67,7 @@ def gen_analyze_func(f, tag, regs, imms): def main(): - hex_common.read_semantics_file(sys.argv[1]) - hex_common.read_attribs_file(sys.argv[2]) - hex_common.read_overrides_file(sys.argv[3]) - hex_common.read_overrides_file(sys.argv[4]) - ## Whether or not idef-parser is enabled is - ## determined by the number of arguments to - ## this script: - ## - ## 5 args. -> not enabled, - ## 6 args. -> idef-parser enabled. - ## - ## The 6:th arg. then holds a list of the successfully - ## parsed instructions. - is_idef_parser_enabled = len(sys.argv) > 6 - if is_idef_parser_enabled: - hex_common.read_idef_parser_enabled_file(sys.argv[5]) - hex_common.calculate_attribs() - hex_common.init_registers() + hex_common.read_common_files() tagregs = hex_common.get_tagregs() tagimms = hex_common.get_tagimms() diff --git a/target/hexagon/gen_helper_funcs.py b/target/hexagon/gen_helper_funcs.py index 9cc3d69c49..e9685bff2f 100755 --- a/target/hexagon/gen_helper_funcs.py +++ b/target/hexagon/gen_helper_funcs.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 ## -## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. +## Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Reserved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -102,24 +102,7 @@ def gen_helper_function(f, tag, tagregs, tagimms): def main(): - hex_common.read_semantics_file(sys.argv[1]) - hex_common.read_attribs_file(sys.argv[2]) - hex_common.read_overrides_file(sys.argv[3]) - hex_common.read_overrides_file(sys.argv[4]) - ## Whether or not idef-parser is enabled is - ## determined by the number of arguments to - ## this script: - ## - ## 5 args. -> not enabled, - ## 6 args. -> idef-parser enabled. - ## - ## The 6:th arg. then holds a list of the successfully - ## parsed instructions. - is_idef_parser_enabled = len(sys.argv) > 6 - if is_idef_parser_enabled: - hex_common.read_idef_parser_enabled_file(sys.argv[5]) - hex_common.calculate_attribs() - hex_common.init_registers() + hex_common.read_common_files() tagregs = hex_common.get_tagregs() tagimms = hex_common.get_tagimms() diff --git a/target/hexagon/gen_helper_protos.py b/target/hexagon/gen_helper_protos.py index c82b0f54e4..4cc72a1581 100755 --- a/target/hexagon/gen_helper_protos.py +++ b/target/hexagon/gen_helper_protos.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 ## -## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. +## Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Reserved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -44,24 +44,7 @@ def gen_helper_prototype(f, tag, tagregs, tagimms): def main(): - hex_common.read_semantics_file(sys.argv[1]) - hex_common.read_attribs_file(sys.argv[2]) - hex_common.read_overrides_file(sys.argv[3]) - hex_common.read_overrides_file(sys.argv[4]) - ## Whether or not idef-parser is enabled is - ## determined by the number of arguments to - ## this script: - ## - ## 5 args. -> not enabled, - ## 6 args. -> idef-parser enabled. - ## - ## The 6:th arg. then holds a list of the successfully - ## parsed instructions. - is_idef_parser_enabled = len(sys.argv) > 6 - if is_idef_parser_enabled: - hex_common.read_idef_parser_enabled_file(sys.argv[5]) - hex_common.calculate_attribs() - hex_common.init_registers() + hex_common.read_common_files() tagregs = hex_common.get_tagregs() tagimms = hex_common.get_tagimms() diff --git a/target/hexagon/gen_idef_parser_funcs.py b/target/hexagon/gen_idef_parser_funcs.py index 550a48cb7b..eb494abba8 100644 --- a/target/hexagon/gen_idef_parser_funcs.py +++ b/target/hexagon/gen_idef_parser_funcs.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 ## -## Copyright(c) 2019-2023 rev.ng Labs Srl. All Rights Reserved. +## Copyright(c) 2019-2024 rev.ng Labs Srl. All Rights Reserved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -44,13 +44,12 @@ ## def main(): hex_common.read_semantics_file(sys.argv[1]) - hex_common.read_attribs_file(sys.argv[2]) hex_common.calculate_attribs() hex_common.init_registers() tagregs = hex_common.get_tagregs() tagimms = hex_common.get_tagimms() - with open(sys.argv[3], "w") as f: + with open(sys.argv[-1], "w") as f: f.write('#include "macros.inc"\n\n') for tag in hex_common.tags: diff --git a/target/hexagon/gen_op_attribs.py b/target/hexagon/gen_op_attribs.py index 41074b8573..99448220da 100755 --- a/target/hexagon/gen_op_attribs.py +++ b/target/hexagon/gen_op_attribs.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 ## -## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. +## Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Reserved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -25,13 +25,12 @@ def main(): hex_common.read_semantics_file(sys.argv[1]) - hex_common.read_attribs_file(sys.argv[2]) hex_common.calculate_attribs() ## ## Generate all the attributes associated with each instruction ## - with open(sys.argv[3], "w") as f: + with open(sys.argv[-1], "w") as f: for tag in hex_common.tags: f.write( f"OP_ATTRIB({tag},ATTRIBS(" diff --git a/target/hexagon/gen_opcodes_def.py b/target/hexagon/gen_opcodes_def.py index cddd868fe3..536f0eb68a 100755 --- a/target/hexagon/gen_opcodes_def.py +++ b/target/hexagon/gen_opcodes_def.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 ## -## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. +## Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Reserved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ def main(): ## ## Generate a list of all the opcodes ## - with open(sys.argv[3], "w") as f: + with open(sys.argv[-1], "w") as f: for tag in hex_common.tags: f.write(f"OPCODE({tag}),\n") diff --git a/target/hexagon/gen_printinsn.py b/target/hexagon/gen_printinsn.py index e570bd7c6a..8bf4d0985c 100755 --- a/target/hexagon/gen_printinsn.py +++ b/target/hexagon/gen_printinsn.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 ## -## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. +## Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Reserved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -97,11 +97,10 @@ def spacify(s): def main(): hex_common.read_semantics_file(sys.argv[1]) - hex_common.read_attribs_file(sys.argv[2]) immext_casere = re.compile(r"IMMEXT\(([A-Za-z])") - with open(sys.argv[3], "w") as f: + with open(sys.argv[-1], "w") as f: for tag in hex_common.tags: if not hex_common.behdict[tag]: continue diff --git a/target/hexagon/gen_tcg_func_table.py b/target/hexagon/gen_tcg_func_table.py index f998ef0992..978ac1819b 100755 --- a/target/hexagon/gen_tcg_func_table.py +++ b/target/hexagon/gen_tcg_func_table.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 ## -## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. +## Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Reserved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -25,12 +25,11 @@ def main(): hex_common.read_semantics_file(sys.argv[1]) - hex_common.read_attribs_file(sys.argv[2]) hex_common.calculate_attribs() tagregs = hex_common.get_tagregs() tagimms = hex_common.get_tagimms() - with open(sys.argv[3], "w") as f: + with open(sys.argv[-1], "w") as f: f.write("#ifndef HEXAGON_FUNC_TABLE_H\n") f.write("#define HEXAGON_FUNC_TABLE_H\n\n") diff --git a/target/hexagon/gen_tcg_funcs.py b/target/hexagon/gen_tcg_funcs.py index 3d8e3cb6a2..05aa0a7855 100755 --- a/target/hexagon/gen_tcg_funcs.py +++ b/target/hexagon/gen_tcg_funcs.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 ## -## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. +## Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Reserved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -108,24 +108,7 @@ def gen_def_tcg_func(f, tag, tagregs, tagimms): def main(): - hex_common.read_semantics_file(sys.argv[1]) - hex_common.read_attribs_file(sys.argv[2]) - hex_common.read_overrides_file(sys.argv[3]) - hex_common.read_overrides_file(sys.argv[4]) - hex_common.calculate_attribs() - hex_common.init_registers() - ## Whether or not idef-parser is enabled is - ## determined by the number of arguments to - ## this script: - ## - ## 5 args. -> not enabled, - ## 6 args. -> idef-parser enabled. - ## - ## The 6:th arg. then holds a list of the successfully - ## parsed instructions. - is_idef_parser_enabled = len(sys.argv) > 6 - if is_idef_parser_enabled: - hex_common.read_idef_parser_enabled_file(sys.argv[5]) + is_idef_parser_enabled = hex_common.read_common_files() tagregs = hex_common.get_tagregs() tagimms = hex_common.get_tagimms() diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py index 4bacef223f..43ca78b489 100755 --- a/target/hexagon/hex_common.py +++ b/target/hexagon/hex_common.py @@ -26,7 +26,6 @@ semdict = {} # tag -> semantics attribdict = {} # tag -> attributes macros = {} # macro -> macro information... -attribinfo = {} # Register information and misc registers = {} # register -> register functions new_registers = {} tags = [] # list of all tags @@ -257,19 +256,6 @@ def read_semantics_file(name): eval_line = "" -def read_attribs_file(name): - attribre = re.compile( - r"DEF_ATTRIB\(([A-Za-z0-9_]+), ([^,]*), " - + r'"([A-Za-z0-9_\.]*)", "([A-Za-z0-9_\.]*)"\)' - ) - for line in open(name, "rt").readlines(): - if not attribre.match(line): - continue - (attrib_base, descr, rreg, wreg) = attribre.findall(line)[0] - attrib_base = "A_" + attrib_base - attribinfo[attrib_base] = {"rreg": rreg, "wreg": wreg, "descr": descr} - - def read_overrides_file(name): overridere = re.compile(r"#define fGEN_TCG_([A-Za-z0-9_]+)\(.*") for line in open(name, "rt").readlines(): @@ -1143,3 +1129,24 @@ def helper_args(tag, regs, imms): "uint32_t part1" )) return args + + +def read_common_files(): + read_semantics_file(sys.argv[1]) + read_overrides_file(sys.argv[2]) + read_overrides_file(sys.argv[3]) + ## Whether or not idef-parser is enabled is + ## determined by the number of arguments to + ## this script: + ## + ## 4 args. -> not enabled, + ## 5 args. -> idef-parser enabled. + ## + ## The 5:th arg. then holds a list of the successfully + ## parsed instructions. + is_idef_parser_enabled = len(sys.argv) > 5 + if is_idef_parser_enabled: + read_idef_parser_enabled_file(sys.argv[4]) + calculate_attribs() + init_registers() + return is_idef_parser_enabled diff --git a/target/hexagon/meson.build b/target/hexagon/meson.build index 988e7489ba..b0b253aa6b 100644 --- a/target/hexagon/meson.build +++ b/target/hexagon/meson.build @@ -18,7 +18,6 @@ hexagon_ss = ss.source_set() hex_common_py = 'hex_common.py' -attribs_def = meson.current_source_dir() / 'attribs_def.h.inc' gen_tcg_h = meson.current_source_dir() / 'gen_tcg.h' gen_tcg_hvx_h = meson.current_source_dir() / 'gen_tcg_hvx.h' idef_parser_dir = meson.current_source_dir() / 'idef-parser' @@ -51,8 +50,8 @@ tcg_func_table_generated = custom_target( 'tcg_func_table_generated.c.inc', output: 'tcg_func_table_generated.c.inc', depends: [semantics_generated], - depend_files: [hex_common_py, attribs_def], - command: [python, files('gen_tcg_func_table.py'), semantics_generated, attribs_def, '@OUTPUT@'], + depend_files: [hex_common_py], + command: [python, files('gen_tcg_func_table.py'), semantics_generated, '@OUTPUT@'], ) hexagon_ss.add(tcg_func_table_generated) @@ -60,8 +59,8 @@ printinsn_generated = custom_target( 'printinsn_generated.h.inc', output: 'printinsn_generated.h.inc', depends: [semantics_generated], - depend_files: [hex_common_py, attribs_def], - command: [python, files('gen_printinsn.py'), semantics_generated, attribs_def, '@OUTPUT@'], + depend_files: [hex_common_py], + command: [python, files('gen_printinsn.py'), semantics_generated, '@OUTPUT@'], ) hexagon_ss.add(printinsn_generated) @@ -69,8 +68,8 @@ op_attribs_generated = custom_target( 'op_attribs_generated.h.inc', output: 'op_attribs_generated.h.inc', depends: [semantics_generated], - depend_files: [hex_common_py, attribs_def], - command: [python, files('gen_op_attribs.py'), semantics_generated, attribs_def, '@OUTPUT@'], + depend_files: [hex_common_py], + command: [python, files('gen_op_attribs.py'), semantics_generated, '@OUTPUT@'], ) hexagon_ss.add(op_attribs_generated) @@ -78,8 +77,8 @@ opcodes_def_generated = custom_target( 'opcodes_def_generated.h.inc', output: 'opcodes_def_generated.h.inc', depends: [semantics_generated], - depend_files: [hex_common_py, attribs_def], - command: [python, files('gen_opcodes_def.py'), semantics_generated, attribs_def, '@OUTPUT@'], + depend_files: [hex_common_py], + command: [python, files('gen_opcodes_def.py'), semantics_generated, '@OUTPUT@'], ) hexagon_ss.add(opcodes_def_generated) @@ -278,7 +277,7 @@ if idef_parser_enabled and 'hexagon-linux-user' in target_dirs output: 'idef_parser_input.h.inc', depends: [semantics_generated], depend_files: [hex_common_py], - command: [python, files('gen_idef_parser_funcs.py'), semantics_generated, attribs_def, '@OUTPUT@'], + command: [python, files('gen_idef_parser_funcs.py'), semantics_generated, '@OUTPUT@'], ) preprocessed_idef_parser_input_generated = custom_target( @@ -347,12 +346,12 @@ if idef_parser_enabled and 'hexagon-linux-user' in target_dirs # Setup input and dependencies for the next step, this depends on whether or # not idef-parser is enabled helper_dep = [semantics_generated, idef_generated_tcg_c, idef_generated_tcg] - helper_in = [semantics_generated, attribs_def, gen_tcg_h, gen_tcg_hvx_h, idef_generated_list] + helper_in = [semantics_generated, gen_tcg_h, gen_tcg_hvx_h, idef_generated_list] else # Setup input and dependencies for the next step, this depends on whether or # not idef-parser is enabled helper_dep = [semantics_generated] - helper_in = [semantics_generated, attribs_def, gen_tcg_h, gen_tcg_hvx_h] + helper_in = [semantics_generated, gen_tcg_h, gen_tcg_hvx_h] endif # @@ -366,7 +365,7 @@ helper_protos_generated = custom_target( 'helper_protos_generated.h.inc', output: 'helper_protos_generated.h.inc', depends: helper_dep, - depend_files: [hex_common_py, attribs_def, gen_tcg_h, gen_tcg_hvx_h], + depend_files: [hex_common_py, gen_tcg_h, gen_tcg_hvx_h], command: [python, files('gen_helper_protos.py'), helper_in, '@OUTPUT@'], ) hexagon_ss.add(helper_protos_generated) @@ -375,7 +374,7 @@ helper_funcs_generated = custom_target( 'helper_funcs_generated.c.inc', output: 'helper_funcs_generated.c.inc', depends: helper_dep, - depend_files: [hex_common_py, attribs_def, gen_tcg_h, gen_tcg_hvx_h], + depend_files: [hex_common_py, gen_tcg_h, gen_tcg_hvx_h], command: [python, files('gen_helper_funcs.py'), helper_in, '@OUTPUT@'], ) hexagon_ss.add(helper_funcs_generated) @@ -384,7 +383,7 @@ tcg_funcs_generated = custom_target( 'tcg_funcs_generated.c.inc', output: 'tcg_funcs_generated.c.inc', depends: helper_dep, - depend_files: [hex_common_py, attribs_def, gen_tcg_h, gen_tcg_hvx_h], + depend_files: [hex_common_py, gen_tcg_h, gen_tcg_hvx_h], command: [python, files('gen_tcg_funcs.py'), helper_in, '@OUTPUT@'], ) hexagon_ss.add(tcg_funcs_generated) @@ -393,7 +392,7 @@ analyze_funcs_generated = custom_target( 'analyze_funcs_generated.c.inc', output: 'analyze_funcs_generated.c.inc', depends: helper_dep, - depend_files: [hex_common_py, attribs_def, gen_tcg_h, gen_tcg_hvx_h], + depend_files: [hex_common_py, gen_tcg_h, gen_tcg_hvx_h], command: [python, files('gen_analyze_funcs.py'), helper_in, '@OUTPUT@'], ) hexagon_ss.add(analyze_funcs_generated)