From nobody Tue Nov 26 10:45:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1707884912; cv=none; d=zohomail.com; s=zohoarc; b=S0+erYs+G8RqmWz8kIsoqxzmz+AntAZfWHjmjnDagTqibtx0Ww3PNXMrGhWCU3skOTWTruObCIN2wXOC/Ki+yy0sUlrPWgv8EXUHY7w1xQvg/mSXsW4Ct2Wh4f6PH0BWeUGORm/vGgzIucz/HC/NmxPCT91KXIKCivSJ2Nowr8I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707884912; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UYU53kj6Z9SDsJEykjfEK2SUz1aqv0gAFOVHSmMyOb4=; b=D2z+hpHg0hz43MFl/o+Aft720Z0TAO4+tsTPKcIXNQFFXkMH4nz2loXlIgVUHdaLW+pzFmlHGHASQ80QRLAIathv+zAJ/p1J7ccil6NLw3P+f1ITky6L7PmCJO1Utu17XVMkGQdDLEx+4dzlS/3Dib8ZbEyOHNWOCkrabHHdczg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1707884912335840.4785954187195; Tue, 13 Feb 2024 20:28:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ra6rv-0007mq-2Z; Tue, 13 Feb 2024 23:27: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 1ra6rt-0007mF-FS for qemu-devel@nongnu.org; Tue, 13 Feb 2024 23:27:33 -0500 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ra6rr-0004PC-VF for qemu-devel@nongnu.org; Tue, 13 Feb 2024 23:27:33 -0500 Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-363c2edac5aso18176235ab.2 for ; Tue, 13 Feb 2024 20:27:31 -0800 (PST) Received: from taylor-ubuntu.hsd1.co.comcast.net (c-73-169-12-54.hsd1.co.comcast.net. [73.169.12.54]) by smtp.gmail.com with ESMTPSA id c2-20020a02c9c2000000b004713170def2sm2312305jap.93.2024.02.13.20.27.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 20:27:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707884850; x=1708489650; 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=UYU53kj6Z9SDsJEykjfEK2SUz1aqv0gAFOVHSmMyOb4=; b=Dir7074Fyrzmb02Qx/6iGtNjaLrcfpcy5+xKkayYAWR1Y2Ss6O0xhyK4sLC9a1hedx Sx88+Qf4xig1M25f4LJykqfXykFvyteNZR/+y0LMfBzXTeqespNUWyxnnOFUJKOvHkuL dxrzj95ovrDhG7oY62TDfO6mrNlSLHLTLIcJtZ0rxDbnRrxAb1VFfUxuSRjO/y9sRoU0 LorMcklBaJGCdyNIw7zpg1qthotS36R2pLv0CP0pRUWsHhxHVcXqBR25vFD0zSnOQcdG swdxBOYmqDhdhxW4oIETAIvS/YRBpFN4smeLxQi3gDeB/TDrmbvlcdWlnxQquKP8cOoQ vxaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707884850; x=1708489650; 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=UYU53kj6Z9SDsJEykjfEK2SUz1aqv0gAFOVHSmMyOb4=; b=lYfK15KmG9xKy3p/rl8KXCZdokLQ9GlM85/8LXQjLsO3PEGXRtxjpcdwAX3mQS9rY7 6iyR6MqWNPXSSh0PIPhXQw6Ob2foU4lflziAY3nn9gtb6W1OcsnCRH6zGu4LH+h13GXQ di4VS6LXofCmjhon9qzfZFOhNmSeEr2ekCti8r5H07QJgn/zQPkY9roQocKrv4glWXI6 nOnhvyTzeRijGn1+RUaHhyxJyJoeLg5Qx+GfKNYHyOUndthovHJRFmrAL2diHXACYvds qdRPODWm7aUnaGNWB4bofhr8wr9/BVwxmZl9k11YO+4/lP0mRwDROVqoqNSz6FnX3daO MBlA== X-Gm-Message-State: AOJu0YxaYItmxLXhILjSJLwE4Mqhr/GCZI3gwL6Bn6OJTjfCq3aJibu7 7MjWoUCjoLyZb8If+lRjSNjuhZgxkJZXUclnvHSuRQfYYQ7Gb23jE5P5r2Istu8= X-Google-Smtp-Source: AGHT+IE6LxDbW2Peq5MGk7c2T77uFIg+giRgNt7VqVbvr/35TXMRXvlfD8Wiyo86/ppTZ146ioZC2Q== X-Received: by 2002:a92:d20b:0:b0:363:d953:a129 with SMTP id y11-20020a92d20b000000b00363d953a129mr1990690ily.25.1707884849979; Tue, 13 Feb 2024 20:27:29 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUokmLNy6+nOMMwX5OBxfY5T6Su0Xi8QdmgcY8t86MGTNtbTt/hZAOYZKiBqFqWdDldjFRXQFjJiiNm2vePA+RR9zzGNX0RRZrvNs/lvsZTKV9XOlhrxKZBOMiajdNS4gXCYDHw6dwB+QIaEIGAgGm26Go2B0oY2jP3RxJjAXj8CUEOaNC/yV8KUNlBDACqmnN0+AYGdatTbs4tO1hYLLuaIswaqPtksYBR0zCfmmvh7/o+xHdlASpfqi9hVEEaA9UWuCyMPQVfTkUxT92cvBcizRuK3nYSKjjNiKl+ 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 v3 1/3] Hexagon (target/hexagon) Pass P0 explicitly to helpers that need it Date: Tue, 13 Feb 2024 21:27:24 -0700 Message-Id: <20240214042726.19290-2-ltaylorsimpson@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214042726.19290-1-ltaylorsimpson@gmail.com> References: <20240214042726.19290-1-ltaylorsimpson@gmail.com> MIME-Version: 1.0 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=2607:f8b0:4864:20::132; envelope-from=ltaylorsimpson@gmail.com; helo=mail-il1-x132.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1707884913027100003 Rather than reading P0 from the env, pass it explicitly Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Tested-by: Anton Johansson Reviewed-by: Brian Cain --- target/hexagon/macros.h | 4 ++-- target/hexagon/hex_common.py | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/target/hexagon/macros.h b/target/hexagon/macros.h index 1376d6ccc1..aedc863fab 100644 --- a/target/hexagon/macros.h +++ b/target/hexagon/macros.h @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. + * Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Res= erved. * * 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 @@ -358,7 +358,7 @@ static inline TCGv gen_read_ireg(TCGv result, TCGv val,= int shift) #endif #define fREAD_PC() (PC) =20 -#define fREAD_P0() (env->pred[0]) +#define fREAD_P0() (P0) =20 #define fCHECK_PCALIGN(A) =20 diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py index 195620c7ec..14dcf261b4 100755 --- a/target/hexagon/hex_common.py +++ b/target/hexagon/hex_common.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 =20 ## -## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. +## Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Res= erved. ## ## 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 @@ -197,6 +197,10 @@ def get_tagimms(): return dict(zip(tags, list(map(compute_tag_immediates, tags)))) =20 =20 +def need_p0(tag): + return "A_IMPLICIT_READS_P0" in attribdict[tag] + + def need_slot(tag): if ( "A_CVI_SCATTER" not in attribdict[tag] @@ -1118,6 +1122,12 @@ def helper_args(tag, regs, imms): "tcg_constant_tl(ctx->next_PC)", "target_ulong next_PC" )) + if need_p0(tag): + args.append(HelperArg( + "i32", + "hex_pred[0]", + "uint32_t P0" + )) if need_slot(tag): args.append(HelperArg( "i32", --=20 2.34.1 From nobody Tue Nov 26 10:45:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1707884902; cv=none; d=zohomail.com; s=zohoarc; b=CS3EVf6GgmMsXCHihKldYxk3aPeMYhz2UnwqI9BQbBnz6mMT/f2k4XRcSvQZrDL4iI0Mdu1+OtrYgGaWnYZJmKEificCcsxjzAk5vCjkCepGv8AjputXNZayU7c/CR0b4qtp0Ynhn2PjiAN4NSHW9GNzSfxeqf5mIc63oe7K56E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707884902; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OPvX2LKtyesviXI/k03yDzEPeDwJWxB5cSBazGc5msw=; b=BzuQpcIGf/MHzdxZDFeBeH1S/HXx8kck+dYsvtfjocfgami5OrYxwKS2T3xZ0+0GC3ZPRqsXbzsm5kZBnqqHwhecqIoPHWIB92nobTpUU0qs3R1SKgXp70kYuH0Sn7knlADLz3kYhw+H3zVim8cSuhbJUGt8CqFYARQ+PxDJjGA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1707884902467531.9210875638223; Tue, 13 Feb 2024 20:28:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ra6rw-0007nT-Mx; Tue, 13 Feb 2024 23:27:36 -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 1ra6ru-0007mj-Pn for qemu-devel@nongnu.org; Tue, 13 Feb 2024 23:27:34 -0500 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ra6rt-0004PZ-AL for qemu-devel@nongnu.org; Tue, 13 Feb 2024 23:27:34 -0500 Received: by mail-io1-xd2d.google.com with SMTP id ca18e2360f4ac-7bb5fda069bso244916839f.0 for ; Tue, 13 Feb 2024 20:27:32 -0800 (PST) Received: from taylor-ubuntu.hsd1.co.comcast.net (c-73-169-12-54.hsd1.co.comcast.net. [73.169.12.54]) by smtp.gmail.com with ESMTPSA id c2-20020a02c9c2000000b004713170def2sm2312305jap.93.2024.02.13.20.27.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 20:27:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707884851; x=1708489651; 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=OPvX2LKtyesviXI/k03yDzEPeDwJWxB5cSBazGc5msw=; b=fAPVNepZWbyeJOkQzqWXNCVTHAvrTUelk7tnq7xGqtte9TDZwLou+koawj5GHFV0k4 kSxT3+Jc9W4RMEWJ/dH4a5UZHx1+7x0OlHUsFGa68CaHBOOWM/9zMlASqeGx6+3FSQBv 2YsQCrtmNJmdeWPbAywrcllkBL8c9EvqVgHzberD/cxFxcOeLdG3cDNPZNGzS9Xap9Lb D+aKlhKmWT+MMX3Sjid7txepb6wxbV/bO9DLS1YAy7g5v6WgYirY+PV/4qPa90QaKvX1 e0pWYiheptbz0bSCbbNHrYFh5KCkKvWVShpxlbL9UCaPxK4fpXQKluWJ6aW40m5pXKIo AwAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707884851; x=1708489651; 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=OPvX2LKtyesviXI/k03yDzEPeDwJWxB5cSBazGc5msw=; b=ObipmmCZXM8pmkJX5haFmGDtCG2A8JmuR7LmLvhmldo5SMMvcLE0DejesFOmC8JzLC 5AbLU+gqruU1PgXxWkfXYifAnLZkOyPCOHgbBpDuxc9RD5GqyV9bY5jxOWh3+A2nmePi hf1hbQNmq32R6N6xUotYNo52cDFdOHrZ1FIZ4TFVJpnWLHkRZvPA8I05JS9Dz9Jlvphu Bm8yH7wcitpdrq0WLPRcSPYtkDWUzUeDbeQVNTcMF6j0VhF1mK+GN4PN2EgNsW/B2Pjl hsMr/2xrJFDiv1Ev2xbnhf2OTeCSIRqRrjVWp889xrbUCVXH7Kxm8RneKO7AN5IYVG2W P/jg== X-Gm-Message-State: AOJu0YxUalEUF4+Cjc63P+qT+qwOavZfsR5FkzZpYfBIUMjqzXqGypFT blmYsT0XRyBq2n6RLdci/UQhUDi97ZS9X+u765TC9nLeIB8r1XtN6SbYu34NYZ8= X-Google-Smtp-Source: AGHT+IEMOpqHoa1lQzsx1/PXzjjQzEhsMsO2AtwcbcsF7dQcP+dey90atb+OyWoM6D0cgvDpZrOD1A== X-Received: by 2002:a6b:db06:0:b0:7c4:602a:10a0 with SMTP id t6-20020a6bdb06000000b007c4602a10a0mr1870777ioc.18.1707884851406; Tue, 13 Feb 2024 20:27:31 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVBUDMD++07WUlvIj14tnf+AlGfmsp8dZhGJwja1/QZMXc0Fbc+rZKOToK05hdivDJH9Gd7+NNRNUvb/hBmP+FVsq8LWkjyzEqQympXik3ekXSZ9yIr54dpsCtvCT+UorqFekQTyU7sUbLxsBWtOWacbG1i4QurQnVZJMC3SE2NQ2uFuJ4n3W//AqcV/eX9eqcwL8Gu+/oWKu8KpgPFuNrItwepc5hY8Jm3f8Hye3whWVRw014aT+zAiO4duTp7qW3UCPJTPbzZodKzkYmyuUnEorKVtIXvVTmG8X7l 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 v3 2/3] Hexagon (target/hexagon) Pass SP explicitly to helpers that need it Date: Tue, 13 Feb 2024 21:27:25 -0700 Message-Id: <20240214042726.19290-3-ltaylorsimpson@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214042726.19290-1-ltaylorsimpson@gmail.com> References: <20240214042726.19290-1-ltaylorsimpson@gmail.com> MIME-Version: 1.0 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=2607:f8b0:4864:20::d2d; envelope-from=ltaylorsimpson@gmail.com; helo=mail-io1-xd2d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1707884903209100001 Rather than reading SP from the env, pass it explicitly Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Tested-by: Anton Johansson Reviewed-by: Brian Cain --- target/hexagon/macros.h | 2 +- target/hexagon/attribs_def.h.inc | 3 ++- target/hexagon/hex_common.py | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/target/hexagon/macros.h b/target/hexagon/macros.h index aedc863fab..feb798c6c0 100644 --- a/target/hexagon/macros.h +++ b/target/hexagon/macros.h @@ -343,7 +343,7 @@ static inline TCGv gen_read_ireg(TCGv result, TCGv val,= int shift) =20 #define fREAD_LR() (env->gpr[HEX_REG_LR]) =20 -#define fREAD_SP() (env->gpr[HEX_REG_SP]) +#define fREAD_SP() (SP) #define fREAD_LC0 (env->gpr[HEX_REG_LC0]) #define fREAD_LC1 (env->gpr[HEX_REG_LC1]) #define fREAD_SA0 (env->gpr[HEX_REG_SA0]) diff --git a/target/hexagon/attribs_def.h.inc b/target/hexagon/attribs_def.= h.inc index 87942d46f4..9e3a05f882 100644 --- a/target/hexagon/attribs_def.h.inc +++ b/target/hexagon/attribs_def.h.inc @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. + * Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Res= erved. * * 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 @@ -117,6 +117,7 @@ DEF_ATTRIB(IMPLICIT_READS_P1, "Reads the P1 register", = "", "") DEF_ATTRIB(IMPLICIT_READS_P2, "Reads the P2 register", "", "") DEF_ATTRIB(IMPLICIT_READS_P3, "Reads the P3 register", "", "") DEF_ATTRIB(IMPLICIT_WRITES_USR, "May write USR", "", "") +DEF_ATTRIB(IMPLICIT_READS_SP, "Reads the SP register", "", "") DEF_ATTRIB(COMMUTES, "The operation is communitive", "", "") DEF_ATTRIB(DEALLOCRET, "dealloc_return", "", "") DEF_ATTRIB(DEALLOCFRAME, "deallocframe", "", "") diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py index 14dcf261b4..b96f67972d 100755 --- a/target/hexagon/hex_common.py +++ b/target/hexagon/hex_common.py @@ -101,6 +101,7 @@ def calculate_attribs(): add_qemu_macro_attrib('fLSBNEW1', 'A_IMPLICIT_READS_P1') add_qemu_macro_attrib('fLSBNEW1NOT', 'A_IMPLICIT_READS_P1') add_qemu_macro_attrib('fREAD_P3', 'A_IMPLICIT_READS_P3') + add_qemu_macro_attrib('fREAD_SP', 'A_IMPLICIT_READS_SP') =20 # Recurse down macros, find attributes from sub-macros macroValues =3D list(macros.values()) @@ -201,6 +202,10 @@ def need_p0(tag): return "A_IMPLICIT_READS_P0" in attribdict[tag] =20 =20 +def need_sp(tag): + return "A_IMPLICIT_READS_SP" in attribdict[tag] + + def need_slot(tag): if ( "A_CVI_SCATTER" not in attribdict[tag] @@ -1128,6 +1133,12 @@ def helper_args(tag, regs, imms): "hex_pred[0]", "uint32_t P0" )) + if need_sp(tag): + args.append(HelperArg( + "i32", + "hex_gpr[HEX_REG_SP]", + "uint32_t SP" + )) if need_slot(tag): args.append(HelperArg( "i32", --=20 2.34.1 From nobody Tue Nov 26 10:45:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1707884901; cv=none; d=zohomail.com; s=zohoarc; b=hXssjUVCoZYHErVQWy3Z3Hh3rI2v89KTUdP+0U+Y6Vq5J3eSyVFZyoxVslnPm2kGerl/1Eb5s1IthacHn8NYIh436MwDF+z72RwhVEsVwBtdF2H1WSXTH3dYIg+vebGbfmE3kLnaXq3h2Ib0AJ9IPXb5erKXrGO8dUTJ/J2iWHE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707884901; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xZZzFWXgHBt0MgJ93ILIs6n/MLVvULr7mA7GxBXHlM0=; b=eOsXfx/CPdiHw5+nvdR9l9UEZBuzH28UPKcZu0M23SMZCwg037Z1+KHFoQEbPBZ1T7LPKieCDRnLPeedzBV+ZUK2Abs6dOSbtR32+77Ybwrv6N8Ldvbo9Ye/k9TQpKDDEVnoYISaFjWj4ydbomwcoV4GN4U21Sr+xkBevLiuLYk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1707884901856915.3607166970089; Tue, 13 Feb 2024 20:28:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ra6rx-0007nc-KB; Tue, 13 Feb 2024 23:27:37 -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 1ra6rw-0007n7-AZ for qemu-devel@nongnu.org; Tue, 13 Feb 2024 23:27:36 -0500 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ra6ru-0004Pz-OR for qemu-devel@nongnu.org; Tue, 13 Feb 2024 23:27:36 -0500 Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-7ba9f1cfe94so12651039f.1 for ; Tue, 13 Feb 2024 20:27:34 -0800 (PST) Received: from taylor-ubuntu.hsd1.co.comcast.net (c-73-169-12-54.hsd1.co.comcast.net. [73.169.12.54]) by smtp.gmail.com with ESMTPSA id c2-20020a02c9c2000000b004713170def2sm2312305jap.93.2024.02.13.20.27.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 20:27:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707884853; x=1708489653; 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=xZZzFWXgHBt0MgJ93ILIs6n/MLVvULr7mA7GxBXHlM0=; b=B9km8a76j8oAXv0NVA6h5fKL2SM3m09gzGSMLHoiNJ1sdc4h5ub6BKHsi5hRhtbB7H F/vKY+GIkZIb+mwkj9bE0EN6K6Uq5MjVIDD0CRcum2IhIf3Aij2eXExHPAlHvTgJvEao 5A/twB8jAxDtsk5wgbAVKIIzmUV3VcWZ0dCUfufGGHVFFbKxOHFTIa7Q3BtQOcfu+/+k xfcq/3zlec8E0xm1ITYftLLcNp0p8Lu18Hf0Xw5lROLw8xW+KBs5x2rQx1lB55jFdxFm x7qBfV1f3o7uvctfJsVu72hcPND9p6RMUVG8fqTXGRpkyUb8GjFTl01A6hAWM2OiLpPb rbFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707884853; x=1708489653; 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=xZZzFWXgHBt0MgJ93ILIs6n/MLVvULr7mA7GxBXHlM0=; b=SATcKitzUdTQkE7pL4oaAepdZqi3FWUIugY6Y/CYFpGagAwkpvi2joNDOCn+YvwUM8 ucv9YM18lUslKcCtFZluL1ju66TPROPwAm989qVxqBLmEQbPMsobos4dGWoR5xZms5Sn GwHvwwhJPSJ1cGS6NAt6H0q9SeVJq9M1oHiwMHqe1HEO6m28q1zWFfVfPdglOwSu5Q9j NXSVGCe3PmgAmNVHi/Zm0wdm4NWdY1dWbczBfPb4XJ6NbKOgyLbGvO95u06Yzw9DCDjq nNqIS4sWjW9wMIoi9jYssO1ESC3ujRiRVhAPVaEkkAiKsKvgLbUWjoBkyDw5FSqCThVa 69DA== X-Gm-Message-State: AOJu0YymkMe+E5rFPFcT8sOZ3c7U0xzrI320Bx5GMknwLDSrhhMdFPM0 3e+ipd0IeowWcq3vE1yZBwcvp5RCimf0zyqt+MOAZvdD/iglE8AUWfoF0SD2GQI= X-Google-Smtp-Source: AGHT+IGFeqOHIHkTheIcnBwHKsulX3hfMJ2EWX15SCQFDhCFjCpTNihSmSHwQKBFP1y+fRgUX4zixg== X-Received: by 2002:a6b:cd0c:0:b0:7c4:89b2:8084 with SMTP id d12-20020a6bcd0c000000b007c489b28084mr32174iog.1.1707884852789; Tue, 13 Feb 2024 20:27:32 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXgDh9vod6XI6oGBQJMOJEucDm/aoByCnH++SXD23ifVsmUEu5IDkTLI2k1EXiyjTatrZsSrszHgdDrGVMtH+2+Ru75ix7uEvdJMPrqPJ4cvq3w45A8yxb1OqBvB5d7pAh/5p5qT04ui5xnt8fmZsNahUltisaqxU+fKIxzi2ZpG2N2hMmw9gmfXHvMajoFvgi6BQQ0W1wAHdUNlbcuUIbDfFCqFuFjuARzf24Pnb9CSXjDYnc+xaGXP1J130LZ1ibbFIFmUDEnRa0DIhRARBSI9cJogMSoCRCg/HWd 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 v3 3/3] Hexagon (target/hexagon) Only pass env to generated helper when needed Date: Tue, 13 Feb 2024 21:27:26 -0700 Message-Id: <20240214042726.19290-4-ltaylorsimpson@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214042726.19290-1-ltaylorsimpson@gmail.com> References: <20240214042726.19290-1-ltaylorsimpson@gmail.com> MIME-Version: 1.0 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=2607:f8b0:4864:20::d34; envelope-from=ltaylorsimpson@gmail.com; helo=mail-io1-xd34.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1707884903213100002 Currently, we pass env to every generated helper. When the semantics of the instruction only depend on the arguments, this is unnecessary and adds extra overhead to the helper call. We add the TCG_CALL_NO_RWG_SE flag to any non-HVX helpers that don't get the ptr to env. The A2_nop and SA1_setin1 instructions end up with no arguments. This results in a "old-style function definition" error from the compiler, so we write overrides for them. With this change, the number of helpers with env argument is idef-parser enabled: 329 total, 23 with env idef-parser disabled: 1543 total, 550 with env Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Tested-by: Anton Johansson --- target/hexagon/gen_tcg.h | 5 ++++- target/hexagon/gen_helper_protos.py | 12 ++++++++++-- target/hexagon/hex_common.py | 23 ++++++++++++++++++----- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h index 1c4391b415..3fc1f4e281 100644 --- a/target/hexagon/gen_tcg.h +++ b/target/hexagon/gen_tcg.h @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. + * Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Res= erved. * * 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 @@ -1369,3 +1369,6 @@ gen_helper_raise_exception(tcg_env, excp); \ } while (0) #endif + +#define fGEN_TCG_A2_nop(SHORTCODE) do { } while (0) +#define fGEN_TCG_SA1_setin1(SHORTCODE) tcg_gen_movi_tl(RdV, -1) diff --git a/target/hexagon/gen_helper_protos.py b/target/hexagon/gen_helpe= r_protos.py index c82b0f54e4..f8578d5033 100755 --- a/target/hexagon/gen_helper_protos.py +++ b/target/hexagon/gen_helper_protos.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 =20 ## -## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. +## Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Res= erved. ## ## 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 @@ -40,7 +40,15 @@ def gen_helper_prototype(f, tag, tagregs, tagimms): declared.append(arg.proto_arg) =20 arguments =3D ", ".join(declared) - f.write(f"DEF_HELPER_{len(declared) - 1}({tag}, {arguments})\n") + + ## Add the TCG_CALL_NO_RWG_SE flag to helpers that don't take the env + ## argument and aren't HVX instructions. Since HVX instructions take + ## pointers to their arguments, they will have side effects. + if hex_common.need_env(tag) or hex_common.is_hvx_insn(tag): + f.write(f"DEF_HELPER_{len(declared) - 1}({tag}, {arguments})\n") + else: + f.write(f"DEF_HELPER_FLAGS_{len(declared) - 1}({tag}, " + f"TCG_CALL_NO_RWG_SE, {arguments})\n") =20 =20 def main(): diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py index b96f67972d..d3d8560fcf 100755 --- a/target/hexagon/hex_common.py +++ b/target/hexagon/hex_common.py @@ -206,6 +206,18 @@ def need_sp(tag): return "A_IMPLICIT_READS_SP" in attribdict[tag] =20 =20 +def is_hvx_insn(tag): + return "A_CVI" in attribdict[tag] + + +def need_env(tag): + return ("A_STORE" in attribdict[tag] or + "A_LOAD" in attribdict[tag] or + "A_CVI_GATHER" in attribdict[tag] or + "A_CVI_SCATTER" in attribdict[tag] or + "A_IMPLICIT_WRITES_USR" in attribdict[tag]) + + def need_slot(tag): if ( "A_CVI_SCATTER" not in attribdict[tag] @@ -1069,11 +1081,12 @@ def helper_args(tag, regs, imms): args =3D [] =20 ## First argument is the CPU state - args.append(HelperArg( - "env", - "tcg_env", - "CPUHexagonState *env" - )) + if need_env(tag): + args.append(HelperArg( + "env", + "tcg_env", + "CPUHexagonState *env" + )) =20 ## For predicated instructions, we pass in the destination register if is_predicated(tag): --=20 2.34.1