From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926323; cv=none; d=zohomail.com; s=zohoarc; b=XUCdQqqZ034KT4JYuzwaqi0TIpU0P27fcO9//1kRU5Bew/edWb78u29tbjwLP70MhmpQ8/t3eYSqcRTaaM4xqZhzvFEzPP0bR6oWDLTbykSEV22rjON2ZanyF3M1rWrUJ+JbSMJe85duQcBOAUCcHM4zLohQ005t/NX/8YPQ344= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926323; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=66qqJnLKSHXJyhZyhU1uJ6YcOFA+1qEwuEvMIZnPNic=; b=NZ6rMqXJJSgxX8qzhimFki6H4qEs8D4FwuI7mwZVW8Bhtkwk5I0cRRv76unujfdFfXGW6pfB9x/zv4IMTiCQ+Q3VjI3IyjHAGt5hKoJS3UBULlFxN7KTM6lVl+bCtL4VijigDSW4ODnv0FPG4UneZWz8EfVqSqlSwMRIIFOvUDs= 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 1671926323775816.797350687269; Sat, 24 Dec 2022 15:58:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOW-0002Jn-T6; Sat, 24 Dec 2022 18:57: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 1p9EOU-0002I5-Bi for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:34 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOO-0006GR-AG for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:34 -0500 Received: by mail-pl1-x62d.google.com with SMTP id 4so8051328plj.3 for ; Sat, 24 Dec 2022 15:57:24 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=66qqJnLKSHXJyhZyhU1uJ6YcOFA+1qEwuEvMIZnPNic=; b=YiTN+L3WTy2iYlYJgkIBsvYju4stgOznV+lovrB5CGvmKUKUQk2kr/au1ND4Lh//Bt 3Q7k6/+Z3e6hEQcs0Y10vgJ+YU3FIwLHDbEaAMQvh8bL1o+ZuCEvywQvthl+Jtm9/d5w gBh9ib9of8micKl+/ey3Wcw3BVV236iK7fRzUBUciPuaRsIRPoz9tLnWw2RLaTdNUl9e RznrVQ5G4+EupAu5+BO5DyZDa+1b18fdMdQnETSE/93tpL5stxPzixZEHs9BCJanC9ij k0TBIdizcHILQ6ju5JZ0c46oHu2cu19NXzzVemVVf3B7jCTiLpA1F/5jxpgqPGJnPbnY PdIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=66qqJnLKSHXJyhZyhU1uJ6YcOFA+1qEwuEvMIZnPNic=; b=A/Cib1rQTgXMjQrorIL9gJg6oOKCZVOCBB3FQKvRM47T5HP4vOUczTCF/mcUEK6fP8 8yBUuJBfpu6AhO857Pu8L63ZDAy8MKciJqcYUUSDQZaztn+/v5TAV7gWfbPUBpnitTKA vyU3jSjq6yO+rFZhF7T4yqYZPs22NbBf3UpTViABHlLi99SE5vB4PuV8r4Ew1EZziTB7 hYjne4BnbhpsJbaLrc5PJnYy4/kPju/rozt9jjwVvgDABd6fGsUKMq/l+7YGf2cfbhKX C2t0vStMjs7wU8v3yzd6rkbI9IhdBAdJQUkSnPWNhVtgtr7e+FzFcwIullMsJEAXFwyF GJSg== X-Gm-Message-State: AFqh2kpNkmokxAsDYfvfiFnD2egHLXaCHh8vvPr+J9Ptm3vhYMb27C02 HkzGQhYbo4UNtjeE6BDhLw02YH4ottyoyhWe X-Google-Smtp-Source: AMrXdXsTX4rTJQmGfO+HrsdHjCWwCAIMK2ExOaqUOfUj1U24dMJupf7miAJvDwKJ4X2x5ePIlfq1ew== X-Received: by 2002:a17:902:8f87:b0:189:2688:c97f with SMTP id z7-20020a1709028f8700b001892688c97fmr16313424plo.50.1671926243031; Sat, 24 Dec 2022 15:57:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org, Mark Cave-Ayland , Fabiano Rosas Subject: [PATCH v5 01/43] tcg: convert tcg/README to rst Date: Sat, 24 Dec 2022 15:56:38 -0800 Message-Id: <20221224235720.842093-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> MIME-Version: 1.0 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::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926325354100003 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland Convert tcg/README to rst and move it to docs/devel as a new "TCG Intermedi= ate Representation" page. There are a few minor changes to improve the aesthetic of the final output which are as follows: - Rename the title from "Tiny Code Generator - Fabrice Bellard" to "TCG Intermediate Representation" - Remove the section numbering - Add the missing parameters to the ssadd_vec operations in the "Host vector operations" section - Change the path to the Atomic Operations document to use a proper reference - Replace tcg/README in tcg.rst with a proper reference to the new docume= nt Signed-off-by: Mark Cave-Ayland Reviewed-by: Fabiano Rosas Message-Id: <20221130100434.64207-2-mark.cave-ayland@ilande.co.uk> Signed-off-by: Richard Henderson --- docs/devel/atomics.rst | 2 + docs/devel/index-tcg.rst | 1 + docs/devel/tcg-ops.rst | 941 +++++++++++++++++++++++++++++++++++++++ docs/devel/tcg.rst | 2 +- tcg/README | 784 -------------------------------- 5 files changed, 945 insertions(+), 785 deletions(-) create mode 100644 docs/devel/tcg-ops.rst delete mode 100644 tcg/README diff --git a/docs/devel/atomics.rst b/docs/devel/atomics.rst index 52baa0736d..7957310071 100644 --- a/docs/devel/atomics.rst +++ b/docs/devel/atomics.rst @@ -1,3 +1,5 @@ +.. _atomics-ref: + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D Atomic operations in QEMU =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D diff --git a/docs/devel/index-tcg.rst b/docs/devel/index-tcg.rst index 7b9760b26f..b44ff8b5a4 100644 --- a/docs/devel/index-tcg.rst +++ b/docs/devel/index-tcg.rst @@ -9,6 +9,7 @@ are only implementing things for HW accelerated hypervisors. :maxdepth: 2 =20 tcg + tcg-ops decodetree multi-thread-tcg tcg-icount diff --git a/docs/devel/tcg-ops.rst b/docs/devel/tcg-ops.rst new file mode 100644 index 0000000000..9adc0c9b6c --- /dev/null +++ b/docs/devel/tcg-ops.rst @@ -0,0 +1,941 @@ +.. _tcg-ops-ref: + +******************************* +TCG Intermediate Representation +******************************* + +Introduction +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +TCG (Tiny Code Generator) began as a generic backend for a C +compiler. It was simplified to be used in QEMU. It also has its roots +in the QOP code generator written by Paul Brook. + +Definitions +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +TCG receives RISC-like *TCG ops* and performs some optimizations on them, +including liveness analysis and trivial constant expression +evaluation. TCG ops are then implemented in the host CPU back end, +also known as the TCG target. + +The TCG *target* is the architecture for which we generate the +code. It is of course not the same as the "target" of QEMU which is +the emulated architecture. As TCG started as a generic C backend used +for cross compiling, it is assumed that the TCG target is different +from the host, although it is never the case for QEMU. + +In this document, we use *guest* to specify what architecture we are +emulating; *target* always means the TCG target, the machine on which +we are running QEMU. + +A TCG *function* corresponds to a QEMU Translated Block (TB). + +A TCG *temporary* is a variable only live in a basic block. Temporaries ar= e allocated explicitly in each function. + +A TCG *local temporary* is a variable only live in a function. Local tempo= raries are allocated explicitly in each function. + +A TCG *global* is a variable which is live in all the functions +(equivalent of a C global variable). They are defined before the +functions defined. A TCG global can be a memory location (e.g. a QEMU +CPU register), a fixed host register (e.g. the QEMU CPU state pointer) +or a memory location which is stored in a register outside QEMU TBs +(not implemented yet). + +A TCG *basic block* corresponds to a list of instructions terminated +by a branch instruction. + +An operation with *undefined behavior* may result in a crash. + +An operation with *unspecified behavior* shall not crash. However, +the result may be one of several possibilities so may be considered +an *undefined result*. + +Intermediate representation +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D + +Introduction +------------ + +TCG instructions operate on variables which are temporaries, local +temporaries or globals. TCG instructions and variables are strongly +typed. Two types are supported: 32 bit integers and 64 bit +integers. Pointers are defined as an alias to 32 bit or 64 bit +integers depending on the TCG target word size. + +Each instruction has a fixed number of output variable operands, input +variable operands and always constant operands. + +The notable exception is the call instruction which has a variable +number of outputs and inputs. + +In the textual form, output operands usually come first, followed by +input operands, followed by constant operands. The output type is +included in the instruction name. Constants are prefixed with a '$'. + +.. code-block:: none + + add_i32 t0, t1, t2 /* (t0 <- t1 + t2) */ + + +Assumptions +----------- + +Basic blocks +^^^^^^^^^^^^ + +* Basic blocks end after branches (e.g. brcond_i32 instruction), + goto_tb and exit_tb instructions. + +* Basic blocks start after the end of a previous basic block, or at a + set_label instruction. + +After the end of a basic block, the content of temporaries is +destroyed, but local temporaries and globals are preserved. + +Floating point types +^^^^^^^^^^^^^^^^^^^^ + +* Floating point types are not supported yet + +Pointers +^^^^^^^^ + +* Depending on the TCG target, pointer size is 32 bit or 64 + bit. The type ``TCG_TYPE_PTR`` is an alias to ``TCG_TYPE_I32`` or + ``TCG_TYPE_I64``. + +Helpers +^^^^^^^ + +* Using the tcg_gen_helper_x_y it is possible to call any function + taking i32, i64 or pointer types. By default, before calling a helper, + all globals are stored at their canonical location and it is assumed + that the function can modify them. By default, the helper is allowed to + modify the CPU state or raise an exception. + + This can be overridden using the following function modifiers: + + - ``TCG_CALL_NO_READ_GLOBALS`` means that the helper does not read globa= ls, + either directly or via an exception. They will not be saved to their + canonical locations before calling the helper. + + - ``TCG_CALL_NO_WRITE_GLOBALS`` means that the helper does not modify an= y globals. + They will only be saved to their canonical location before calling hel= pers, + but they won't be reloaded afterwards. + + - ``TCG_CALL_NO_SIDE_EFFECTS`` means that the call to the function is re= moved if + the return value is not used. + + Note that ``TCG_CALL_NO_READ_GLOBALS`` implies ``TCG_CALL_NO_WRITE_GLOBA= LS``. + + On some TCG targets (e.g. x86), several calling conventions are + supported. + +Branches +^^^^^^^^ + +* Use the instruction 'br' to jump to a label. + +Code Optimizations +------------------ + +When generating instructions, you can count on at least the following +optimizations: + +- Single instructions are simplified, e.g. + + .. code-block:: none + + and_i32 t0, t0, $0xffffffff + + is suppressed. + +- A liveness analysis is done at the basic block level. The + information is used to suppress moves from a dead variable to + another one. It is also used to remove instructions which compute + dead results. The later is especially useful for condition code + optimization in QEMU. + + In the following example: + + .. code-block:: none + + add_i32 t0, t1, t2 + add_i32 t0, t0, $1 + mov_i32 t0, $1 + + only the last instruction is kept. + + +Instruction Reference +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Function call +------------- + +.. list-table:: + + * - call ** ** ptr + + - | call function 'ptr' (pointer type) + | + | ** optional 32 bit or 64 bit return value + | ** optional 32 bit or 64 bit parameters + +Jumps/Labels +------------ + +.. list-table:: + + * - set_label $label + + - | Define label 'label' at the current program point. + + * - br $label + + - | Jump to label. + + * - brcond_i32/i64 *t0*, *t1*, *cond*, *label* + + - | Conditional jump if *t0* *cond* *t1* is true. *cond* can be: + | + | ``TCG_COND_EQ`` + | ``TCG_COND_NE`` + | ``TCG_COND_LT /* signed */`` + | ``TCG_COND_GE /* signed */`` + | ``TCG_COND_LE /* signed */`` + | ``TCG_COND_GT /* signed */`` + | ``TCG_COND_LTU /* unsigned */`` + | ``TCG_COND_GEU /* unsigned */`` + | ``TCG_COND_LEU /* unsigned */`` + | ``TCG_COND_GTU /* unsigned */`` + +Arithmetic +---------- + +.. list-table:: + + * - add_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* + *t2* + + * - sub_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* - *t2* + + * - neg_i32/i64 *t0*, *t1* + + - | *t0* =3D -*t1* (two's complement) + + * - mul_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* * *t2* + + * - div_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* / *t2* (signed) + | Undefined behavior if division by zero or overflow. + + * - divu_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* / *t2* (unsigned) + | Undefined behavior if division by zero. + + * - rem_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* % *t2* (signed) + | Undefined behavior if division by zero or overflow. + + * - remu_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* % *t2* (unsigned) + | Undefined behavior if division by zero. + + +Logical +------- + +.. list-table:: + + * - and_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* & *t2* + + * - or_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* | *t2* + + * - xor_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* ^ *t2* + + * - not_i32/i64 *t0*, *t1* + + - | *t0* =3D ~\ *t1* + + * - andc_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* & ~\ *t2* + + * - eqv_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D ~(*t1* ^ *t2*), or equivalently, *t0* =3D *t1* ^ ~\ *t2* + + * - nand_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D ~(*t1* & *t2*) + + * - nor_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D ~(*t1* | *t2*) + + * - orc_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* | ~\ *t2* + + * - clz_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* ? clz(*t1*) : *t2* + + * - ctz_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* ? ctz(*t1*) : *t2* + + * - ctpop_i32/i64 *t0*, *t1* + + - | *t0* =3D number of bits set in *t1* + | + | With *ctpop* short for "count population", matching + | the function name used in ``include/qemu/host-utils.h``. + + +Shifts/Rotates +-------------- + +.. list-table:: + + * - shl_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* << *t2* + | Unspecified behavior if *t2* < 0 or *t2* >=3D 32 (resp 64) + + * - shr_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* >> *t2* (unsigned) + | Unspecified behavior if *t2* < 0 or *t2* >=3D 32 (resp 64) + + * - sar_i32/i64 *t0*, *t1*, *t2* + + - | *t0* =3D *t1* >> *t2* (signed) + | Unspecified behavior if *t2* < 0 or *t2* >=3D 32 (resp 64) + + * - rotl_i32/i64 *t0*, *t1*, *t2* + + - | Rotation of *t2* bits to the left + | Unspecified behavior if *t2* < 0 or *t2* >=3D 32 (resp 64) + + * - rotr_i32/i64 *t0*, *t1*, *t2* + + - | Rotation of *t2* bits to the right. + | Unspecified behavior if *t2* < 0 or *t2* >=3D 32 (resp 64) + + +Misc +---- + +.. list-table:: + + * - mov_i32/i64 *t0*, *t1* + + - | *t0* =3D *t1* + | Move *t1* to *t0* (both operands must have the same type). + + * - ext8s_i32/i64 *t0*, *t1* + + ext8u_i32/i64 *t0*, *t1* + + ext16s_i32/i64 *t0*, *t1* + + ext16u_i32/i64 *t0*, *t1* + + ext32s_i64 *t0*, *t1* + + ext32u_i64 *t0*, *t1* + + - | 8, 16 or 32 bit sign/zero extension (both operands must have the = same type) + + * - bswap16_i32/i64 *t0*, *t1*, *flags* + + - | 16 bit byte swap on the low bits of a 32/64 bit input. + | + | If *flags* & ``TCG_BSWAP_IZ``, then *t1* is known to be zero-exte= nded from bit 15. + | If *flags* & ``TCG_BSWAP_OZ``, then *t0* will be zero-extended fr= om bit 15. + | If *flags* & ``TCG_BSWAP_OS``, then *t0* will be sign-extended fr= om bit 15. + | + | If neither ``TCG_BSWAP_OZ`` nor ``TCG_BSWAP_OS`` are set, then th= e bits of *t0* above bit 15 may contain any value. + + * - bswap32_i64 *t0*, *t1*, *flags* + + - | 32 bit byte swap on a 64-bit value. The flags are the same as fo= r bswap16, + except they apply from bit 31 instead of bit 15. + + * - bswap32_i32 *t0*, *t1*, *flags* + + bswap64_i64 *t0*, *t1*, *flags* + + - | 32/64 bit byte swap. The flags are ignored, but still present + for consistency with the other bswap opcodes. + + * - discard_i32/i64 *t0* + + - | Indicate that the value of *t0* won't be used later. It is useful= to + force dead code elimination. + + * - deposit_i32/i64 *dest*, *t1*, *t2*, *pos*, *len* + + - | Deposit *t2* as a bitfield into *t1*, placing the result in *dest= *. + | + | The bitfield is described by *pos*/*len*, which are immediate val= ues: + | + | *len* - the length of the bitfield + | *pos* - the position of the first bit, counting from the LSB + | + | For example, "deposit_i32 dest, t1, t2, 8, 4" indicates a 4-bit f= ield + at bit 8. This operation would be equivalent to + | + | *dest* =3D (*t1* & ~0x0f00) | ((*t2* << 8) & 0x0f00) + + * - extract_i32/i64 *dest*, *t1*, *pos*, *len* + + sextract_i32/i64 *dest*, *t1*, *pos*, *len* + + - | Extract a bitfield from *t1*, placing the result in *dest*. + | + | The bitfield is described by *pos*/*len*, which are immediate val= ues, + as above for deposit. For extract_*, the result will be extended + to the left with zeros; for sextract_*, the result will be extend= ed + to the left with copies of the bitfield sign bit at *pos* + *len*= - 1. + | + | For example, "sextract_i32 dest, t1, 8, 4" indicates a 4-bit field + at bit 8. This operation would be equivalent to + | + | *dest* =3D (*t1* << 20) >> 28 + | + | (using an arithmetic right shift). + + * - extract2_i32/i64 *dest*, *t1*, *t2*, *pos* + + - | For N =3D {32,64}, extract an N-bit quantity from the concatenati= on + of *t2*:*t1*, beginning at *pos*. The tcg_gen_extract2_{i32,i64} = expander + accepts 0 <=3D *pos* <=3D N as inputs. The backend code generator= will + not see either 0 or N as inputs for these opcodes. + + * - extrl_i64_i32 *t0*, *t1* + + - | For 64-bit hosts only, extract the low 32-bits of input *t1* and = place it + into 32-bit output *t0*. Depending on the host, this may be a si= mple move, + or may require additional canonicalization. + + * - extrh_i64_i32 *t0*, *t1* + + - | For 64-bit hosts only, extract the high 32-bits of input *t1* and= place it + into 32-bit output *t0*. Depending on the host, this may be a si= mple shift, + or may require additional canonicalization. + + +Conditional moves +----------------- + +.. list-table:: + + * - setcond_i32/i64 *dest*, *t1*, *t2*, *cond* + + - | *dest* =3D (*t1* *cond* *t2*) + | + | Set *dest* to 1 if (*t1* *cond* *t2*) is true, otherwise set to 0. + + * - movcond_i32/i64 *dest*, *c1*, *c2*, *v1*, *v2*, *cond* + + - | *dest* =3D (*c1* *cond* *c2* ? *v1* : *v2*) + | + | Set *dest* to *v1* if (*c1* *cond* *c2*) is true, otherwise set t= o *v2*. + + +Type conversions +---------------- + +.. list-table:: + + * - ext_i32_i64 *t0*, *t1* + + - | Convert *t1* (32 bit) to *t0* (64 bit) and does sign extension + + * - extu_i32_i64 *t0*, *t1* + + - | Convert *t1* (32 bit) to *t0* (64 bit) and does zero extension + + * - trunc_i64_i32 *t0*, *t1* + + - | Truncate *t1* (64 bit) to *t0* (32 bit) + + * - concat_i32_i64 *t0*, *t1*, *t2* + + - | Construct *t0* (64-bit) taking the low half from *t1* (32 bit) an= d the high half + from *t2* (32 bit). + + * - concat32_i64 *t0*, *t1*, *t2* + + - | Construct *t0* (64-bit) taking the low half from *t1* (64 bit) an= d the high half + from *t2* (64 bit). + + +Load/Store +---------- + +.. list-table:: + + * - ld_i32/i64 *t0*, *t1*, *offset* + + ld8s_i32/i64 *t0*, *t1*, *offset* + + ld8u_i32/i64 *t0*, *t1*, *offset* + + ld16s_i32/i64 *t0*, *t1*, *offset* + + ld16u_i32/i64 *t0*, *t1*, *offset* + + ld32s_i64 t0, *t1*, *offset* + + ld32u_i64 t0, *t1*, *offset* + + - | *t0* =3D read(*t1* + *offset*) + | + | Load 8, 16, 32 or 64 bits with or without sign extension from hos= t memory. + *offset* must be a constant. + + * - st_i32/i64 *t0*, *t1*, *offset* + + st8_i32/i64 *t0*, *t1*, *offset* + + st16_i32/i64 *t0*, *t1*, *offset* + + st32_i64 *t0*, *t1*, *offset* + + - | write(*t0*, *t1* + *offset*) + | + | Write 8, 16, 32 or 64 bits to host memory. + +All this opcodes assume that the pointed host memory doesn't correspond +to a global. In the latter case the behaviour is unpredictable. + + +Multiword arithmetic support +---------------------------- + +.. list-table:: + + * - add2_i32/i64 *t0_low*, *t0_high*, *t1_low*, *t1_high*, *t2_low*, *t= 2_high* + + sub2_i32/i64 *t0_low*, *t0_high*, *t1_low*, *t1_high*, *t2_low*, *t= 2_high* + + - | Similar to add/sub, except that the double-word inputs *t1* and *= t2* are + formed from two single-word arguments, and the double-word output= *t0* + is returned in two single-word outputs. + + * - mulu2_i32/i64 *t0_low*, *t0_high*, *t1*, *t2* + + - | Similar to mul, except two unsigned inputs *t1* and *t2* yielding= the full + double-word product *t0*. The latter is returned in two single-wo= rd outputs. + + * - muls2_i32/i64 *t0_low*, *t0_high*, *t1*, *t2* + + - | Similar to mulu2, except the two inputs *t1* and *t2* are signed. + + * - mulsh_i32/i64 *t0*, *t1*, *t2* + + muluh_i32/i64 *t0*, *t1*, *t2* + + - | Provide the high part of a signed or unsigned multiply, respectiv= ely. + | + | If mulu2/muls2 are not provided by the backend, the tcg-op genera= tor + can obtain the same results by emitting a pair of opcodes, mul + = muluh/mulsh. + + +Memory Barrier support +---------------------- + +.. list-table:: + + * - mb *<$arg>* + + - | Generate a target memory barrier instruction to ensure memory ord= ering + as being enforced by a corresponding guest memory barrier instru= ction. + | + | The ordering enforced by the backend may be stricter than the ord= ering + required by the guest. It cannot be weaker. This opcode takes a c= onstant + argument which is required to generate the appropriate barrier + instruction. The backend should take care to emit the target barr= ier + instruction only when necessary i.e., for SMP guests and when MTT= CG is + enabled. + | + | The guest translators should generate this opcode for all guest i= nstructions + which have ordering side effects. + | + | Please see :ref:`atomics-ref` for more information on memory barr= iers. + + +64-bit guest on 32-bit host support +----------------------------------- + +The following opcodes are internal to TCG. Thus they are to be implemente= d by +32-bit host code generators, but are not to be emitted by guest translator= s. +They are emitted as needed by inline functions within ``tcg-op.h``. + +.. list-table:: + + * - brcond2_i32 *t0_low*, *t0_high*, *t1_low*, *t1_high*, *cond*, *labe= l* + + - | Similar to brcond, except that the 64-bit values *t0* and *t1* + are formed from two 32-bit arguments. + + * - setcond2_i32 *dest*, *t1_low*, *t1_high*, *t2_low*, *t2_high*, *con= d* + + - | Similar to setcond, except that the 64-bit values *t1* and *t2* a= re + formed from two 32-bit arguments. The result is a 32-bit value. + + +QEMU specific operations +------------------------ + +.. list-table:: + + * - exit_tb *t0* + + - | Exit the current TB and return the value *t0* (word type). + + * - goto_tb *index* + + - | Exit the current TB and jump to the TB index *index* (constant) i= f the + current TB was linked to this TB. Otherwise execute the next + instructions. Only indices 0 and 1 are valid and tcg_gen_goto_tb = may be issued + at most once with each slot index per TB. + + * - lookup_and_goto_ptr *tb_addr* + + - | Look up a TB address *tb_addr* and jump to it if valid. If not va= lid, + jump to the TCG epilogue to go back to the exec loop. + | + | This operation is optional. If the TCG backend does not implement= the + goto_ptr opcode, emitting this op is equivalent to emitting exit_= tb(0). + + * - qemu_ld_i32/i64 *t0*, *t1*, *flags*, *memidx* + + qemu_st_i32/i64 *t0*, *t1*, *flags*, *memidx* + + qemu_st8_i32 *t0*, *t1*, *flags*, *memidx* + + - | Load data at the guest address *t1* into *t0*, or store data in *= t0* at guest + address *t1*. The _i32/_i64 size applies to the size of the inpu= t/output + register *t0* only. The address *t1* is always sized according t= o the guest, + and the width of the memory operation is controlled by *flags*. + | + | Both *t0* and *t1* may be split into little-endian ordered pairs = of registers + if dealing with 64-bit quantities on a 32-bit host. + | + | The *memidx* selects the qemu tlb index to use (e.g. user or kern= el access). + The flags are the MemOp bits, selecting the sign, width, and endi= anness + of the memory access. + | + | For a 32-bit host, qemu_ld/st_i64 is guaranteed to only be used w= ith a + 64-bit memory access specified in *flags*. + | + | For i386, qemu_st8_i32 is exactly like qemu_st_i32, except the si= ze of + the memory operation is known to be 8-bit. This allows the backe= nd to + provide a different set of register constraints. + + +Host vector operations +---------------------- + +All of the vector ops have two parameters, ``TCGOP_VECL`` & ``TCGOP_VECE``. +The former specifies the length of the vector in log2 64-bit units; the +latter specifies the length of the element (if applicable) in log2 8-bit u= nits. +E.g. VECL =3D 1 -> 64 << 1 -> v128, and VECE =3D 2 -> 1 << 2 -> i32. + +.. list-table:: + + * - mov_vec *v0*, *v1* + ld_vec *v0*, *t1* + st_vec *v0*, *t1* + + - | Move, load and store. + + * - dup_vec *v0*, *r1* + + - | Duplicate the low N bits of *r1* into VECL/VECE copies across *v0= *. + + * - dupi_vec *v0*, *c* + + - | Similarly, for a constant. + | Smaller values will be replicated to host register size by the ex= panders. + + * - dup2_vec *v0*, *r1*, *r2* + + - | Duplicate *r2*:*r1* into VECL/64 copies across *v0*. This opcode = is + only present for 32-bit hosts. + + * - add_vec *v0*, *v1*, *v2* + + - | *v0* =3D *v1* + *v2*, in elements across the vector. + + * - sub_vec *v0*, *v1*, *v2* + + - | Similarly, *v0* =3D *v1* - *v2*. + + * - mul_vec *v0*, *v1*, *v2* + + - | Similarly, *v0* =3D *v1* * *v2*. + + * - neg_vec *v0*, *v1* + + - | Similarly, *v0* =3D -*v1*. + + * - abs_vec *v0*, *v1* + + - | Similarly, *v0* =3D *v1* < 0 ? -*v1* : *v1*, in elements across t= he vector. + + * - smin_vec *v0*, *v1*, *v2* + + umin_vec *v0*, *v1*, *v2* + + - | Similarly, *v0* =3D MIN(*v1*, *v2*), for signed and unsigned elem= ent types. + + * - smax_vec *v0*, *v1*, *v2* + + umax_vec *v0*, *v1*, *v2* + + - | Similarly, *v0* =3D MAX(*v1*, *v2*), for signed and unsigned elem= ent types. + + * - ssadd_vec *v0*, *v1*, *v2* + + sssub_vec *v0*, *v1*, *v2* + + usadd_vec *v0*, *v1*, *v2* + + ussub_vec *v0*, *v1*, *v2* + + - | Signed and unsigned saturating addition and subtraction. + | + | If the true result is not representable within the element type, = the + element is set to the minimum or maximum value for the type. + + * - and_vec *v0*, *v1*, *v2* + + or_vec *v0*, *v1*, *v2* + + xor_vec *v0*, *v1*, *v2* + + andc_vec *v0*, *v1*, *v2* + + orc_vec *v0*, *v1*, *v2* + + not_vec *v0*, *v1* + + - | Similarly, logical operations with and without complement. + | + | Note that VECE is unused. + + * - shli_vec *v0*, *v1*, *i2* + + shls_vec *v0*, *v1*, *s2* + + - | Shift all elements from v1 by a scalar *i2*/*s2*. I.e. + + .. code-block:: c + + for (i =3D 0; i < VECL/VECE; ++i) { + v0[i] =3D v1[i] << s2; + } + + * - shri_vec *v0*, *v1*, *i2* + + sari_vec *v0*, *v1*, *i2* + + rotli_vec *v0*, *v1*, *i2* + + shrs_vec *v0*, *v1*, *s2* + + sars_vec *v0*, *v1*, *s2* + + - | Similarly for logical and arithmetic right shift, and left rotate. + + * - shlv_vec *v0*, *v1*, *v2* + + - | Shift elements from *v1* by elements from *v2*. I.e. + + .. code-block:: c + + for (i =3D 0; i < VECL/VECE; ++i) { + v0[i] =3D v1[i] << v2[i]; + } + + * - shrv_vec *v0*, *v1*, *v2* + + sarv_vec *v0*, *v1*, *v2* + + rotlv_vec *v0*, *v1*, *v2* + + rotrv_vec *v0*, *v1*, *v2* + + - | Similarly for logical and arithmetic right shift, and rotates. + + * - cmp_vec *v0*, *v1*, *v2*, *cond* + + - | Compare vectors by element, storing -1 for true and 0 for false. + + * - bitsel_vec *v0*, *v1*, *v2*, *v3* + + - | Bitwise select, *v0* =3D (*v2* & *v1*) | (*v3* & ~\ *v1*), across= the entire vector. + + * - cmpsel_vec *v0*, *c1*, *c2*, *v3*, *v4*, *cond* + + - | Select elements based on comparison results: + + .. code-block:: c + + for (i =3D 0; i < n; ++i) { + v0[i] =3D (c1[i] cond c2[i]) ? v3[i] : v4[i]. + } + +**Note 1**: Some shortcuts are defined when the last operand is known to be +a constant (e.g. addi for add, movi for mov). + +**Note 2**: When using TCG, the opcodes must never be generated directly +as some of them may not be available as "real" opcodes. Always use the +function tcg_gen_xxx(args). + + +Backend +=3D=3D=3D=3D=3D=3D=3D + +``tcg-target.h`` contains the target specific definitions. ``tcg-target.c.= inc`` +contains the target specific code; it is #included by ``tcg/tcg.c``, rather +than being a standalone C file. + +Assumptions +----------- + +The target word size (``TCG_TARGET_REG_BITS``) is expected to be 32 bit or +64 bit. It is expected that the pointer has the same size as the word. + +On a 32 bit target, all 64 bit operations are converted to 32 bits. A +few specific operations must be implemented to allow it (see add2_i32, +sub2_i32, brcond2_i32). + +On a 64 bit target, the values are transferred between 32 and 64-bit +registers using the following ops: + +- trunc_shr_i64_i32 +- ext_i32_i64 +- extu_i32_i64 + +They ensure that the values are correctly truncated or extended when +moved from a 32-bit to a 64-bit register or vice-versa. Note that the +trunc_shr_i64_i32 is an optional op. It is not necessary to implement +it if all the following conditions are met: + +- 64-bit registers can hold 32-bit values +- 32-bit values in a 64-bit register do not need to stay zero or + sign extended +- all 32-bit TCG ops ignore the high part of 64-bit registers + +Floating point operations are not supported in this version. A +previous incarnation of the code generator had full support of them, +but it is better to concentrate on integer operations first. + +Constraints +---------------- + +GCC like constraints are used to define the constraints of every +instruction. Memory constraints are not supported in this +version. Aliases are specified in the input operands as for GCC. + +The same register may be used for both an input and an output, even when +they are not explicitly aliased. If an op expands to multiple target +instructions then care must be taken to avoid clobbering input values. +GCC style "early clobber" outputs are supported, with '``&``'. + +A target can define specific register or constant constraints. If an +operation uses a constant input constraint which does not allow all +constants, it must also accept registers in order to have a fallback. +The constraint '``i``' is defined generically to accept any constant. +The constraint '``r``' is not defined generically, but is consistently +used by each backend to indicate all registers. + +The movi_i32 and movi_i64 operations must accept any constants. + +The mov_i32 and mov_i64 operations must accept any registers of the +same type. + +The ld/st/sti instructions must accept signed 32 bit constant offsets. +This can be implemented by reserving a specific register in which to +compute the address if the offset is too big. + +The ld/st instructions must accept any destination (ld) or source (st) +register. + +The sti instruction may fail if it cannot store the given constant. + +Function call assumptions +------------------------- + +- The only supported types for parameters and return value are: 32 and + 64 bit integers and pointer. +- The stack grows downwards. +- The first N parameters are passed in registers. +- The next parameters are passed on the stack by storing them as words. +- Some registers are clobbered during the call. +- The function can return 0 or 1 value in registers. On a 32 bit + target, functions must be able to return 2 values in registers for + 64 bit return type. + + +Recommended coding rules for best performance +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +- Use globals to represent the parts of the QEMU CPU state which are + often modified, e.g. the integer registers and the condition + codes. TCG will be able to use host registers to store them. + +- Avoid globals stored in fixed registers. They must be used only to + store the pointer to the CPU state and possibly to store a pointer + to a register window. + +- Use temporaries. Use local temporaries only when really needed, + e.g. when you need to use a value after a jump. Local temporaries + introduce a performance hit in the current TCG implementation: their + content is saved to memory at end of each basic block. + +- Free temporaries and local temporaries when they are no longer used + (tcg_temp_free). Since tcg_const_x() also creates a temporary, you + should free it after it is used. Freeing temporaries does not yield + a better generated code, but it reduces the memory usage of TCG and + the speed of the translation. + +- Don't hesitate to use helpers for complicated or seldom used guest + instructions. There is little performance advantage in using TCG to + implement guest instructions taking more than about twenty TCG + instructions. Note that this rule of thumb is more applicable to + helpers doing complex logic or arithmetic, where the C compiler has + scope to do a good job of optimisation; it is less relevant where + the instruction is mostly doing loads and stores, and in those cases + inline TCG may still be faster for longer sequences. + +- The hard limit on the number of TCG instructions you can generate + per guest instruction is set by ``MAX_OP_PER_INSTR`` in ``exec-all.h`` -- + you cannot exceed this without risking a buffer overrun. + +- Use the 'discard' instruction if you know that TCG won't be able to + prove that a given global is "dead" at a given program point. The + x86 guest uses it to improve the condition codes optimisation. diff --git a/docs/devel/tcg.rst b/docs/devel/tcg.rst index a65fb7b1c4..136a7a0d96 100644 --- a/docs/devel/tcg.rst +++ b/docs/devel/tcg.rst @@ -9,7 +9,7 @@ which make it relatively easily portable and simple while a= chieving good performances. =20 QEMU's dynamic translation backend is called TCG, for "Tiny Code -Generator". For more information, please take a look at ``tcg/README``. +Generator". For more information, please take a look at :ref:`tcg-ops-ref`. =20 The following sections outline some notable features and implementation details of QEMU's dynamic translator. diff --git a/tcg/README b/tcg/README deleted file mode 100644 index bc15cc3b32..0000000000 --- a/tcg/README +++ /dev/null @@ -1,784 +0,0 @@ -Tiny Code Generator - Fabrice Bellard. - -1) Introduction - -TCG (Tiny Code Generator) began as a generic backend for a C -compiler. It was simplified to be used in QEMU. It also has its roots -in the QOP code generator written by Paul Brook.=20 - -2) Definitions - -TCG receives RISC-like "TCG ops" and performs some optimizations on them, -including liveness analysis and trivial constant expression -evaluation. TCG ops are then implemented in the host CPU back end, -also known as the TCG "target". - -The TCG "target" is the architecture for which we generate the -code. It is of course not the same as the "target" of QEMU which is -the emulated architecture. As TCG started as a generic C backend used -for cross compiling, it is assumed that the TCG target is different -from the host, although it is never the case for QEMU. - -In this document, we use "guest" to specify what architecture we are -emulating; "target" always means the TCG target, the machine on which -we are running QEMU. - -A TCG "function" corresponds to a QEMU Translated Block (TB). - -A TCG "temporary" is a variable only live in a basic -block. Temporaries are allocated explicitly in each function. - -A TCG "local temporary" is a variable only live in a function. Local -temporaries are allocated explicitly in each function. - -A TCG "global" is a variable which is live in all the functions -(equivalent of a C global variable). They are defined before the -functions defined. A TCG global can be a memory location (e.g. a QEMU -CPU register), a fixed host register (e.g. the QEMU CPU state pointer) -or a memory location which is stored in a register outside QEMU TBs -(not implemented yet). - -A TCG "basic block" corresponds to a list of instructions terminated -by a branch instruction.=20 - -An operation with "undefined behavior" may result in a crash. - -An operation with "unspecified behavior" shall not crash. However, -the result may be one of several possibilities so may be considered -an "undefined result". - -3) Intermediate representation - -3.1) Introduction - -TCG instructions operate on variables which are temporaries, local -temporaries or globals. TCG instructions and variables are strongly -typed. Two types are supported: 32 bit integers and 64 bit -integers. Pointers are defined as an alias to 32 bit or 64 bit -integers depending on the TCG target word size. - -Each instruction has a fixed number of output variable operands, input -variable operands and always constant operands. - -The notable exception is the call instruction which has a variable -number of outputs and inputs. - -In the textual form, output operands usually come first, followed by -input operands, followed by constant operands. The output type is -included in the instruction name. Constants are prefixed with a '$'. - -add_i32 t0, t1, t2 (t0 <- t1 + t2) - -3.2) Assumptions - -* Basic blocks - -- Basic blocks end after branches (e.g. brcond_i32 instruction), - goto_tb and exit_tb instructions. -- Basic blocks start after the end of a previous basic block, or at a - set_label instruction. - -After the end of a basic block, the content of temporaries is -destroyed, but local temporaries and globals are preserved. - -* Floating point types are not supported yet - -* Pointers: depending on the TCG target, pointer size is 32 bit or 64 - bit. The type TCG_TYPE_PTR is an alias to TCG_TYPE_I32 or - TCG_TYPE_I64. - -* Helpers: - -Using the tcg_gen_helper_x_y it is possible to call any function -taking i32, i64 or pointer types. By default, before calling a helper, -all globals are stored at their canonical location and it is assumed -that the function can modify them. By default, the helper is allowed to -modify the CPU state or raise an exception. - -This can be overridden using the following function modifiers: -- TCG_CALL_NO_READ_GLOBALS means that the helper does not read globals, - either directly or via an exception. They will not be saved to their - canonical locations before calling the helper. -- TCG_CALL_NO_WRITE_GLOBALS means that the helper does not modify any glob= als. - They will only be saved to their canonical location before calling helpe= rs, - but they won't be reloaded afterwards. -- TCG_CALL_NO_SIDE_EFFECTS means that the call to the function is removed = if - the return value is not used. - -Note that TCG_CALL_NO_READ_GLOBALS implies TCG_CALL_NO_WRITE_GLOBALS. - -On some TCG targets (e.g. x86), several calling conventions are -supported. - -* Branches: - -Use the instruction 'br' to jump to a label. - -3.3) Code Optimizations - -When generating instructions, you can count on at least the following -optimizations: - -- Single instructions are simplified, e.g. - - and_i32 t0, t0, $0xffffffff - =20 - is suppressed. - -- A liveness analysis is done at the basic block level. The - information is used to suppress moves from a dead variable to - another one. It is also used to remove instructions which compute - dead results. The later is especially useful for condition code - optimization in QEMU. - - In the following example: - - add_i32 t0, t1, t2 - add_i32 t0, t0, $1 - mov_i32 t0, $1 - - only the last instruction is kept. - -3.4) Instruction Reference - -********* Function call - -* call ptr - -call function 'ptr' (pointer type) - - optional 32 bit or 64 bit return value - optional 32 bit or 64 bit parameters - -********* Jumps/Labels - -* set_label $label - -Define label 'label' at the current program point. - -* br $label - -Jump to label. - -* brcond_i32/i64 t0, t1, cond, label - -Conditional jump if t0 cond t1 is true. cond can be: - TCG_COND_EQ - TCG_COND_NE - TCG_COND_LT /* signed */ - TCG_COND_GE /* signed */ - TCG_COND_LE /* signed */ - TCG_COND_GT /* signed */ - TCG_COND_LTU /* unsigned */ - TCG_COND_GEU /* unsigned */ - TCG_COND_LEU /* unsigned */ - TCG_COND_GTU /* unsigned */ - -********* Arithmetic - -* add_i32/i64 t0, t1, t2 - -t0=3Dt1+t2 - -* sub_i32/i64 t0, t1, t2 - -t0=3Dt1-t2 - -* neg_i32/i64 t0, t1 - -t0=3D-t1 (two's complement) - -* mul_i32/i64 t0, t1, t2 - -t0=3Dt1*t2 - -* div_i32/i64 t0, t1, t2 - -t0=3Dt1/t2 (signed). Undefined behavior if division by zero or overflow. - -* divu_i32/i64 t0, t1, t2 - -t0=3Dt1/t2 (unsigned). Undefined behavior if division by zero. - -* rem_i32/i64 t0, t1, t2 - -t0=3Dt1%t2 (signed). Undefined behavior if division by zero or overflow. - -* remu_i32/i64 t0, t1, t2 - -t0=3Dt1%t2 (unsigned). Undefined behavior if division by zero. - -********* Logical - -* and_i32/i64 t0, t1, t2 - -t0=3Dt1&t2 - -* or_i32/i64 t0, t1, t2 - -t0=3Dt1|t2 - -* xor_i32/i64 t0, t1, t2 - -t0=3Dt1^t2 - -* not_i32/i64 t0, t1 - -t0=3D~t1 - -* andc_i32/i64 t0, t1, t2 - -t0=3Dt1&~t2 - -* eqv_i32/i64 t0, t1, t2 - -t0=3D~(t1^t2), or equivalently, t0=3Dt1^~t2 - -* nand_i32/i64 t0, t1, t2 - -t0=3D~(t1&t2) - -* nor_i32/i64 t0, t1, t2 - -t0=3D~(t1|t2) - -* orc_i32/i64 t0, t1, t2 - -t0=3Dt1|~t2 - -* clz_i32/i64 t0, t1, t2 - -t0 =3D t1 ? clz(t1) : t2 - -* ctz_i32/i64 t0, t1, t2 - -t0 =3D t1 ? ctz(t1) : t2 - -* ctpop_i32/i64 t0, t1 - -t0 =3D number of bits set in t1 -With "ctpop" short for "count population", matching -the function name used in include/qemu/host-utils.h. - -********* Shifts/Rotates - -* shl_i32/i64 t0, t1, t2 - -t0=3Dt1 << t2. Unspecified behavior if t2 < 0 or t2 >=3D 32 (resp 64) - -* shr_i32/i64 t0, t1, t2 - -t0=3Dt1 >> t2 (unsigned). Unspecified behavior if t2 < 0 or t2 >=3D 32 (re= sp 64) - -* sar_i32/i64 t0, t1, t2 - -t0=3Dt1 >> t2 (signed). Unspecified behavior if t2 < 0 or t2 >=3D 32 (resp= 64) - -* rotl_i32/i64 t0, t1, t2 - -Rotation of t2 bits to the left. -Unspecified behavior if t2 < 0 or t2 >=3D 32 (resp 64) - -* rotr_i32/i64 t0, t1, t2 - -Rotation of t2 bits to the right. -Unspecified behavior if t2 < 0 or t2 >=3D 32 (resp 64) - -********* Misc - -* mov_i32/i64 t0, t1 - -t0 =3D t1 - -Move t1 to t0 (both operands must have the same type). - -* ext8s_i32/i64 t0, t1 -ext8u_i32/i64 t0, t1 -ext16s_i32/i64 t0, t1 -ext16u_i32/i64 t0, t1 -ext32s_i64 t0, t1 -ext32u_i64 t0, t1 - -8, 16 or 32 bit sign/zero extension (both operands must have the same type) - -* bswap16_i32/i64 t0, t1, flags - -16 bit byte swap on the low bits of a 32/64 bit input. -If flags & TCG_BSWAP_IZ, then t1 is known to be zero-extended from bit 15. -If flags & TCG_BSWAP_OZ, then t0 will be zero-extended from bit 15. -If flags & TCG_BSWAP_OS, then t0 will be sign-extended from bit 15. -If neither TCG_BSWAP_OZ nor TCG_BSWAP_OS are set, then the bits of -t0 above bit 15 may contain any value. - -* bswap32_i64 t0, t1, flags - -32 bit byte swap on a 64-bit value. The flags are the same as for bswap16, -except they apply from bit 31 instead of bit 15. - -* bswap32_i32 t0, t1, flags -* bswap64_i64 t0, t1, flags - -32/64 bit byte swap. The flags are ignored, but still present -for consistency with the other bswap opcodes. - -* discard_i32/i64 t0 - -Indicate that the value of t0 won't be used later. It is useful to -force dead code elimination. - -* deposit_i32/i64 dest, t1, t2, pos, len - -Deposit T2 as a bitfield into T1, placing the result in DEST. -The bitfield is described by POS/LEN, which are immediate values: - - LEN - the length of the bitfield - POS - the position of the first bit, counting from the LSB - -For example, "deposit_i32 dest, t1, t2, 8, 4" indicates a 4-bit field -at bit 8. This operation would be equivalent to - - dest =3D (t1 & ~0x0f00) | ((t2 << 8) & 0x0f00) - -* extract_i32/i64 dest, t1, pos, len -* sextract_i32/i64 dest, t1, pos, len - -Extract a bitfield from T1, placing the result in DEST. -The bitfield is described by POS/LEN, which are immediate values, -as above for deposit. For extract_*, the result will be extended -to the left with zeros; for sextract_*, the result will be extended -to the left with copies of the bitfield sign bit at pos + len - 1. - -For example, "sextract_i32 dest, t1, 8, 4" indicates a 4-bit field -at bit 8. This operation would be equivalent to - - dest =3D (t1 << 20) >> 28 - -(using an arithmetic right shift). - -* extract2_i32/i64 dest, t1, t2, pos - -For N =3D {32,64}, extract an N-bit quantity from the concatenation -of t2:t1, beginning at pos. The tcg_gen_extract2_{i32,i64} expander -accepts 0 <=3D pos <=3D N as inputs. The backend code generator will -not see either 0 or N as inputs for these opcodes. - -* extrl_i64_i32 t0, t1 - -For 64-bit hosts only, extract the low 32-bits of input T1 and place it -into 32-bit output T0. Depending on the host, this may be a simple move, -or may require additional canonicalization. - -* extrh_i64_i32 t0, t1 - -For 64-bit hosts only, extract the high 32-bits of input T1 and place it -into 32-bit output T0. Depending on the host, this may be a simple shift, -or may require additional canonicalization. - -********* Conditional moves - -* setcond_i32/i64 dest, t1, t2, cond - -dest =3D (t1 cond t2) - -Set DEST to 1 if (T1 cond T2) is true, otherwise set to 0. - -* movcond_i32/i64 dest, c1, c2, v1, v2, cond - -dest =3D (c1 cond c2 ? v1 : v2) - -Set DEST to V1 if (C1 cond C2) is true, otherwise set to V2. - -********* Type conversions - -* ext_i32_i64 t0, t1 -Convert t1 (32 bit) to t0 (64 bit) and does sign extension - -* extu_i32_i64 t0, t1 -Convert t1 (32 bit) to t0 (64 bit) and does zero extension - -* trunc_i64_i32 t0, t1 -Truncate t1 (64 bit) to t0 (32 bit) - -* concat_i32_i64 t0, t1, t2 -Construct t0 (64-bit) taking the low half from t1 (32 bit) and the high ha= lf -from t2 (32 bit). - -* concat32_i64 t0, t1, t2 -Construct t0 (64-bit) taking the low half from t1 (64 bit) and the high ha= lf -from t2 (64 bit). - -********* Load/Store - -* ld_i32/i64 t0, t1, offset -ld8s_i32/i64 t0, t1, offset -ld8u_i32/i64 t0, t1, offset -ld16s_i32/i64 t0, t1, offset -ld16u_i32/i64 t0, t1, offset -ld32s_i64 t0, t1, offset -ld32u_i64 t0, t1, offset - -t0 =3D read(t1 + offset) -Load 8, 16, 32 or 64 bits with or without sign extension from host memory.=20 -offset must be a constant. - -* st_i32/i64 t0, t1, offset -st8_i32/i64 t0, t1, offset -st16_i32/i64 t0, t1, offset -st32_i64 t0, t1, offset - -write(t0, t1 + offset) -Write 8, 16, 32 or 64 bits to host memory. - -All this opcodes assume that the pointed host memory doesn't correspond -to a global. In the latter case the behaviour is unpredictable. - -********* Multiword arithmetic support - -* add2_i32/i64 t0_low, t0_high, t1_low, t1_high, t2_low, t2_high -* sub2_i32/i64 t0_low, t0_high, t1_low, t1_high, t2_low, t2_high - -Similar to add/sub, except that the double-word inputs T1 and T2 are -formed from two single-word arguments, and the double-word output T0 -is returned in two single-word outputs. - -* mulu2_i32/i64 t0_low, t0_high, t1, t2 - -Similar to mul, except two unsigned inputs T1 and T2 yielding the full -double-word product T0. The later is returned in two single-word outputs. - -* muls2_i32/i64 t0_low, t0_high, t1, t2 - -Similar to mulu2, except the two inputs T1 and T2 are signed. - -* mulsh_i32/i64 t0, t1, t2 -* muluh_i32/i64 t0, t1, t2 - -Provide the high part of a signed or unsigned multiply, respectively. -If mulu2/muls2 are not provided by the backend, the tcg-op generator -can obtain the same results can be obtained by emitting a pair of -opcodes, mul+muluh/mulsh. - -********* Memory Barrier support - -* mb <$arg> - -Generate a target memory barrier instruction to ensure memory ordering as = being -enforced by a corresponding guest memory barrier instruction. The ordering -enforced by the backend may be stricter than the ordering required by the = guest. -It cannot be weaker. This opcode takes a constant argument which is requir= ed to -generate the appropriate barrier instruction. The backend should take care= to -emit the target barrier instruction only when necessary i.e., for SMP gues= ts and -when MTTCG is enabled. - -The guest translators should generate this opcode for all guest instructio= ns -which have ordering side effects. - -Please see docs/devel/atomics.rst for more information on memory barriers. - -********* 64-bit guest on 32-bit host support - -The following opcodes are internal to TCG. Thus they are to be implemente= d by -32-bit host code generators, but are not to be emitted by guest translator= s. -They are emitted as needed by inline functions within "tcg-op.h". - -* brcond2_i32 t0_low, t0_high, t1_low, t1_high, cond, label - -Similar to brcond, except that the 64-bit values T0 and T1 -are formed from two 32-bit arguments. - -* setcond2_i32 dest, t1_low, t1_high, t2_low, t2_high, cond - -Similar to setcond, except that the 64-bit values T1 and T2 are -formed from two 32-bit arguments. The result is a 32-bit value. - -********* QEMU specific operations - -* exit_tb t0 - -Exit the current TB and return the value t0 (word type). - -* goto_tb index - -Exit the current TB and jump to the TB index 'index' (constant) if the -current TB was linked to this TB. Otherwise execute the next -instructions. Only indices 0 and 1 are valid and tcg_gen_goto_tb may be is= sued -at most once with each slot index per TB. - -* lookup_and_goto_ptr tb_addr - -Look up a TB address ('tb_addr') and jump to it if valid. If not valid, -jump to the TCG epilogue to go back to the exec loop. - -This operation is optional. If the TCG backend does not implement the -goto_ptr opcode, emitting this op is equivalent to emitting exit_tb(0). - -* qemu_ld_i32/i64 t0, t1, flags, memidx -* qemu_st_i32/i64 t0, t1, flags, memidx -* qemu_st8_i32 t0, t1, flags, memidx - -Load data at the guest address t1 into t0, or store data in t0 at guest -address t1. The _i32/_i64 size applies to the size of the input/output -register t0 only. The address t1 is always sized according to the guest, -and the width of the memory operation is controlled by flags. - -Both t0 and t1 may be split into little-endian ordered pairs of registers -if dealing with 64-bit quantities on a 32-bit host. - -The memidx selects the qemu tlb index to use (e.g. user or kernel access). -The flags are the MemOp bits, selecting the sign, width, and endianness -of the memory access. - -For a 32-bit host, qemu_ld/st_i64 is guaranteed to only be used with a -64-bit memory access specified in flags. - -For i386, qemu_st8_i32 is exactly like qemu_st_i32, except the size of -the memory operation is known to be 8-bit. This allows the backend to -provide a different set of register constraints. - -********* Host vector operations - -All of the vector ops have two parameters, TCGOP_VECL & TCGOP_VECE. -The former specifies the length of the vector in log2 64-bit units; the -later specifies the length of the element (if applicable) in log2 8-bit un= its. -E.g. VECL=3D1 -> 64 << 1 -> v128, and VECE=3D2 -> 1 << 2 -> i32. - -* mov_vec v0, v1 -* ld_vec v0, t1 -* st_vec v0, t1 - - Move, load and store. - -* dup_vec v0, r1 - - Duplicate the low N bits of R1 into VECL/VECE copies across V0. - -* dupi_vec v0, c - - Similarly, for a constant. - Smaller values will be replicated to host register size by the expanders. - -* dup2_vec v0, r1, r2 - - Duplicate r2:r1 into VECL/64 copies across V0. This opcode is - only present for 32-bit hosts. - -* add_vec v0, v1, v2 - - v0 =3D v1 + v2, in elements across the vector. - -* sub_vec v0, v1, v2 - - Similarly, v0 =3D v1 - v2. - -* mul_vec v0, v1, v2 - - Similarly, v0 =3D v1 * v2. - -* neg_vec v0, v1 - - Similarly, v0 =3D -v1. - -* abs_vec v0, v1 - - Similarly, v0 =3D v1 < 0 ? -v1 : v1, in elements across the vector. - -* smin_vec: -* umin_vec: - - Similarly, v0 =3D MIN(v1, v2), for signed and unsigned element types. - -* smax_vec: -* umax_vec: - - Similarly, v0 =3D MAX(v1, v2), for signed and unsigned element types. - -* ssadd_vec: -* sssub_vec: -* usadd_vec: -* ussub_vec: - - Signed and unsigned saturating addition and subtraction. If the true - result is not representable within the element type, the element is - set to the minimum or maximum value for the type. - -* and_vec v0, v1, v2 -* or_vec v0, v1, v2 -* xor_vec v0, v1, v2 -* andc_vec v0, v1, v2 -* orc_vec v0, v1, v2 -* not_vec v0, v1 - - Similarly, logical operations with and without complement. - Note that VECE is unused. - -* shli_vec v0, v1, i2 -* shls_vec v0, v1, s2 - - Shift all elements from v1 by a scalar i2/s2. I.e. - - for (i =3D 0; i < VECL/VECE; ++i) { - v0[i] =3D v1[i] << s2; - } - -* shri_vec v0, v1, i2 -* sari_vec v0, v1, i2 -* rotli_vec v0, v1, i2 -* shrs_vec v0, v1, s2 -* sars_vec v0, v1, s2 - - Similarly for logical and arithmetic right shift, and left rotate. - -* shlv_vec v0, v1, v2 - - Shift elements from v1 by elements from v2. I.e. - - for (i =3D 0; i < VECL/VECE; ++i) { - v0[i] =3D v1[i] << v2[i]; - } - -* shrv_vec v0, v1, v2 -* sarv_vec v0, v1, v2 -* rotlv_vec v0, v1, v2 -* rotrv_vec v0, v1, v2 - - Similarly for logical and arithmetic right shift, and rotates. - -* cmp_vec v0, v1, v2, cond - - Compare vectors by element, storing -1 for true and 0 for false. - -* bitsel_vec v0, v1, v2, v3 - - Bitwise select, v0 =3D (v2 & v1) | (v3 & ~v1), across the entire vector. - -* cmpsel_vec v0, c1, c2, v3, v4, cond - - Select elements based on comparison results: - for (i =3D 0; i < n; ++i) { - v0[i] =3D (c1[i] cond c2[i]) ? v3[i] : v4[i]. - } - -********* - -Note 1: Some shortcuts are defined when the last operand is known to be -a constant (e.g. addi for add, movi for mov). - -Note 2: When using TCG, the opcodes must never be generated directly -as some of them may not be available as "real" opcodes. Always use the -function tcg_gen_xxx(args). - -4) Backend - -tcg-target.h contains the target specific definitions. tcg-target.c.inc -contains the target specific code; it is #included by tcg/tcg.c, rather -than being a standalone C file. - -4.1) Assumptions - -The target word size (TCG_TARGET_REG_BITS) is expected to be 32 bit or -64 bit. It is expected that the pointer has the same size as the word. - -On a 32 bit target, all 64 bit operations are converted to 32 bits. A -few specific operations must be implemented to allow it (see add2_i32, -sub2_i32, brcond2_i32). - -On a 64 bit target, the values are transferred between 32 and 64-bit -registers using the following ops: -- trunc_shr_i64_i32 -- ext_i32_i64 -- extu_i32_i64 - -They ensure that the values are correctly truncated or extended when -moved from a 32-bit to a 64-bit register or vice-versa. Note that the -trunc_shr_i64_i32 is an optional op. It is not necessary to implement -it if all the following conditions are met: -- 64-bit registers can hold 32-bit values -- 32-bit values in a 64-bit register do not need to stay zero or - sign extended -- all 32-bit TCG ops ignore the high part of 64-bit registers - -Floating point operations are not supported in this version. A -previous incarnation of the code generator had full support of them, -but it is better to concentrate on integer operations first. - -4.2) Constraints - -GCC like constraints are used to define the constraints of every -instruction. Memory constraints are not supported in this -version. Aliases are specified in the input operands as for GCC. - -The same register may be used for both an input and an output, even when -they are not explicitly aliased. If an op expands to multiple target -instructions then care must be taken to avoid clobbering input values. -GCC style "early clobber" outputs are supported, with '&'. - -A target can define specific register or constant constraints. If an -operation uses a constant input constraint which does not allow all -constants, it must also accept registers in order to have a fallback. -The constraint 'i' is defined generically to accept any constant. -The constraint 'r' is not defined generically, but is consistently -used by each backend to indicate all registers. - -The movi_i32 and movi_i64 operations must accept any constants. - -The mov_i32 and mov_i64 operations must accept any registers of the -same type. - -The ld/st/sti instructions must accept signed 32 bit constant offsets. -This can be implemented by reserving a specific register in which to -compute the address if the offset is too big. - -The ld/st instructions must accept any destination (ld) or source (st) -register. - -The sti instruction may fail if it cannot store the given constant. - -4.3) Function call assumptions - -- The only supported types for parameters and return value are: 32 and - 64 bit integers and pointer. -- The stack grows downwards. -- The first N parameters are passed in registers. -- The next parameters are passed on the stack by storing them as words. -- Some registers are clobbered during the call.=20 -- The function can return 0 or 1 value in registers. On a 32 bit - target, functions must be able to return 2 values in registers for - 64 bit return type. - -5) Recommended coding rules for best performance - -- Use globals to represent the parts of the QEMU CPU state which are - often modified, e.g. the integer registers and the condition - codes. TCG will be able to use host registers to store them. - -- Avoid globals stored in fixed registers. They must be used only to - store the pointer to the CPU state and possibly to store a pointer - to a register window. - -- Use temporaries. Use local temporaries only when really needed, - e.g. when you need to use a value after a jump. Local temporaries - introduce a performance hit in the current TCG implementation: their - content is saved to memory at end of each basic block. - -- Free temporaries and local temporaries when they are no longer used - (tcg_temp_free). Since tcg_const_x() also creates a temporary, you - should free it after it is used. Freeing temporaries does not yield - a better generated code, but it reduces the memory usage of TCG and - the speed of the translation. - -- Don't hesitate to use helpers for complicated or seldom used guest - instructions. There is little performance advantage in using TCG to - implement guest instructions taking more than about twenty TCG - instructions. Note that this rule of thumb is more applicable to - helpers doing complex logic or arithmetic, where the C compiler has - scope to do a good job of optimisation; it is less relevant where - the instruction is mostly doing loads and stores, and in those cases - inline TCG may still be faster for longer sequences. - -- The hard limit on the number of TCG instructions you can generate - per guest instruction is set by MAX_OP_PER_INSTR in exec-all.h -- - you cannot exceed this without risking a buffer overrun. - -- Use the 'discard' instruction if you know that TCG won't be able to - prove that a given global is "dead" at a given program point. The - x86 guest uses it to improve the condition codes optimisation. --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926298; cv=none; d=zohomail.com; s=zohoarc; b=I5lQtLK/pvfX03jUqp6Zq9OdAxtoBBTGq7tXndnT/F2O+pmkwLbCOzRTpoC/nxgG8lK4eq8b5LC1T/R7XU8CfOHmT/etVA1Dq38Vxb2YAhIpqU8JdhXrKrIDKZx3SX61ohYCDGMVvxhlamcqA/YXW/ywxmmoGFtHc7krPJLZIP8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926298; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZuFGBK7oJk/EujTjAqZpKzYL125RUa7EsoUz7ySoMMg=; b=Vo3Gmyzo3Rqfrg8/eYGRRM4+td2Yix4sNgmh0R0VX7ZdvGE8RnNNLBgibQ4jz8RfNsX4dapYImoMhAq+1yqUEglIK5MYN8F38TI7w9/FX5SlA+cIZ+xKwgOqprKIiII6wMlxyOdfWkWXjTI0B5EhKlSyath3K3GQC+wLi/Kiw6U= 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 1671926298080241.57148201935036; Sat, 24 Dec 2022 15:58:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOQ-0002Gs-OX; Sat, 24 Dec 2022 18:57:30 -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 1p9EOQ-0002GU-6F for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:30 -0500 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOO-0006GT-AF for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:29 -0500 Received: by mail-pj1-x1029.google.com with SMTP id u15-20020a17090a3fcf00b002191825cf02so8000814pjm.2 for ; Sat, 24 Dec 2022 15:57:25 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=ZuFGBK7oJk/EujTjAqZpKzYL125RUa7EsoUz7ySoMMg=; b=BXOqRF6aEBsZL00HSqHRmp9l/KdsSsH+utTsPW0wZUI1V2emSXBaAAwHvgmOKdIytN HGMQrfMpBdeL3LfIVepzotfCeBKGlRItLZHo9U0+97DUn5SlqzhRT0ac2k14nNa5kxlI /S2jUTKM+btTgR+Ob81pXakvpm1kQrbLAJmGvAtNI8CfLD2YhDByGvBnPCpaZGrQ5+F4 JKRVArZoboaF3dQOSY16n+eRRaNEzY9RXqw4vtX6gwiZPlCHdihpDQoW31SHQcaPLol4 ENy0RRjt99gN64tRZKh1Te6lmv68/u+T57gBHXEPPuf+5zUEjC8vziJH79xBCnqW+USm a9eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=ZuFGBK7oJk/EujTjAqZpKzYL125RUa7EsoUz7ySoMMg=; b=7ChAQFubudseWdPMeDqnKRtVTBbE5hO7oPNjo6Q8iI2RPjIs7Jtxo6ZXWUNHQSaFgl HWBOxq5hAm5Rw28uUbUSylo5h5ud06eMSxv31qoPoyL3sb5wWrYLn9kAK/LEDzP4aZbS w+6u2VlD7yqZNFPjrlIc4xjihYDScG228yTRkAYhstjrKvmFY4lQ03w54/2IFweT2Tmc PDPIwH4l8egEK7SD3D30ZXJp3kH4PUkowkwag/wPlRJMzo6cd81y7V/EDNSY4Rr9MT+T NtcYmh2nVCpP6JzoGg5lHs2fr8KiTCmwXk2uonxcAjE/qrP+YZiAoZ45WNapaEYbVqSL Jv4Q== X-Gm-Message-State: AFqh2kpN2OvycqD9bM6XZK7r9B2ZiYztj9DmK0wK82uYyXTAwdYM3k5D IZiDRphlSZK2Lw6q8ebkfl+9ckKPv4aBu65a X-Google-Smtp-Source: AMrXdXu1+Okl8UlWlFuo6lC/XjjyQ4IzLbkLqlLSKJIZiDDKzoe/vzkgIERPB2t5FKyGWxXzA3CwSA== X-Received: by 2002:a17:902:e74c:b0:189:dd98:b96b with SMTP id p12-20020a170902e74c00b00189dd98b96bmr21435918plf.22.1671926244076; Sat, 24 Dec 2022 15:57:24 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org, Paolo Bonzini Subject: [PATCH v5 02/43] meson: Move CONFIG_TCG_INTERPRETER to config_host Date: Sat, 24 Dec 2022 15:56:39 -0800 Message-Id: <20221224235720.842093-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926299239100001 Like CONFIG_TCG, the enabled method of execution is a host property not a guest property. This exposes the define to compile-once files. Acked-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- meson.build | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 4c6f8a674a..14e3eba227 100644 --- a/meson.build +++ b/meson.build @@ -469,6 +469,7 @@ if get_option('tcg').allowed() endif if get_option('tcg_interpreter') tcg_arch =3D 'tci' + config_host +=3D { 'CONFIG_TCG_INTERPRETER': 'y' } elif host_arch =3D=3D 'x86_64' tcg_arch =3D 'i386' elif host_arch =3D=3D 'ppc64' @@ -2545,9 +2546,6 @@ foreach target : target_dirs if sym =3D=3D 'CONFIG_TCG' or target in accelerator_targets.get(sym, [= ]) config_target +=3D { sym: 'y' } config_all +=3D { sym: 'y' } - if sym =3D=3D 'CONFIG_TCG' and tcg_arch =3D=3D 'tci' - config_target +=3D { 'CONFIG_TCG_INTERPRETER': 'y' } - endif if target in modular_tcg config_target +=3D { 'CONFIG_TCG_MODULAR': 'y' } else --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926867; cv=none; d=zohomail.com; s=zohoarc; b=Eg49a8TnsZDCXZ4SoAW4fr3U6/vxfvwHJBguB3rKm17TUc350j9Dzlt0SoYr1hNi+VtzKfR+aAer9BuxKSZs5ZvVNGtB1ia2XVVHaWtL3EGwgLA5qIegRg8M2R3hGIa9IsBdDlanRBr7zO7iXOC09QGT7XiyBYnEWZBeHfWe3ew= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926867; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=l2AYVfOigGNcWueyGcFEAyNre3J/WgPqkB4M4xEOEGc=; b=l2BvXFVNMIL9cJh3r/lQ6cNeeiE67LrD10lbAPLpzyLCPowzIWVomvnIKJsbrnvqnnfQL1bP4NOd61bLQHS9wkf48qD3KwEuo3K//ed1aFdLAaY7pA3APgaoNdbHYbc0MaVS6hXy/pjrH15Y47xI1nB3DeRwdTF96RvT4VMql4A= 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 1671926866992683.8849516946565; Sat, 24 Dec 2022 16:07:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOT-0002Hv-KC; Sat, 24 Dec 2022 18:57:33 -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 1p9EOQ-0002GT-5k for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:30 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOO-0006Ge-AH for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:29 -0500 Received: by mail-pl1-x62d.google.com with SMTP id 19so1057872plo.12 for ; Sat, 24 Dec 2022 15:57:25 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=l2AYVfOigGNcWueyGcFEAyNre3J/WgPqkB4M4xEOEGc=; b=FesStA7qsfUIwMgIUKOlVap98sJ6r/hwLcAOLoVSJzICVmTRZSVbSgYDMSZdjZAiv4 AJWemDZQqtn4D5k0AJyx+u8GEOHtbYrb7gRvLhx+Mr2BGWTWZSy25IF6agbhYM8r1CQk KOBneRzn+a7WNGRtKBAay7v5402o4z1e5x9bkerPgVcVpY6MpsCsAHoBuEp1NoA/gbYr MtKrfbY+7zcNvplTMOQsAjSR4iIT+qd/nJAz9E3335h/MM000LNS0nIDvXFtfz58dmbJ Up7rtUhZ2244s+g0sSHSNfTVbaju0S8MIuVl8yPmIhEqCTae2/ZogqT+xkDn5Hp6Q9f/ X8jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=l2AYVfOigGNcWueyGcFEAyNre3J/WgPqkB4M4xEOEGc=; b=XSGKewi3/a4VxN2SG5lhphvJ5DvTWrYY2+lFFUc7GDdiZICYWpNvu2AAgu+n1jU4TG WnhMg9X4iSCT0nj5IJwy4/JSdwJBhrbOzDykDKzJtYVb2dTfyYDadS8sM9dW9OViRKAo Mk0hpabjr4c7rfC1JJBpAF8cRpwVJQWDH5FOmSvhVNBcdJZIMQVD0sYval7ayeQ8pCUq bBJuepY5SKe/Tg2DAgD60xGTif91GH/2xQ69tFdee/kjWjYycs1Qfh3UuGJ80pdplv8i hMHCdEl/19M+FID52ZFUyUak5tzPc+oSI/q9+pJE8JbHzRcYjVmBQhSkKGlaqC08O7OI gR3w== X-Gm-Message-State: AFqh2koo+wyQcx1i/j7GZOslhN/0TQj2ZeXBvh2sgWUJBgux3W4Jfy8Z lbdX8tkReZu+UvUThFspb4GpWCwY8fgDxao/ X-Google-Smtp-Source: AMrXdXtbr0YUwWl18dmDZfWNfJPtZ/HZNg2kQiaPJTaTWuGsBJXOqJpyAQE5oWgsQyoZlf71ZeEyew== X-Received: by 2002:a17:902:d891:b0:189:d979:22a with SMTP id b17-20020a170902d89100b00189d979022amr15355705plz.29.1671926245074; Sat, 24 Dec 2022 15:57:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org, Wilfred Mallawa Subject: [PATCH v5 03/43] tcg/s390x: Fix coding style Date: Sat, 24 Dec 2022 15:56:40 -0800 Message-Id: <20221224235720.842093-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926869292100001 From: Philippe Mathieu-Daud=C3=A9 We are going to modify this code, so fix its style first to avoid: ERROR: spaces required around that '*' (ctx:VxV) #281: FILE: tcg/s390x/tcg-target.c.inc:1224: + uintptr_t mask =3D ~(0xffffull << i*16); ^ Reviewed-by: Wilfred Mallawa Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20221130132654.76369-2-philmd@linaro.org> Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 33becd7694..f1d3907cd8 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -802,9 +802,9 @@ static bool maybe_out_small_movi(TCGContext *s, TCGType= type, } =20 for (i =3D 0; i < 4; i++) { - tcg_target_long mask =3D 0xffffull << i*16; + tcg_target_long mask =3D 0xffffull << i * 16; if ((uval & mask) =3D=3D uval) { - tcg_out_insn_RI(s, lli_insns[i], ret, uval >> i*16); + tcg_out_insn_RI(s, lli_insns[i], ret, uval >> i * 16); return true; } } @@ -1221,9 +1221,9 @@ static void tgen_andi(TCGContext *s, TCGType type, TC= GReg dest, uint64_t val) =20 /* Try all 32-bit insns that can perform it in one go. */ for (i =3D 0; i < 4; i++) { - tcg_target_ulong mask =3D ~(0xffffull << i*16); + tcg_target_ulong mask =3D ~(0xffffull << i * 16); if (((val | ~valid) & mask) =3D=3D mask) { - tcg_out_insn_RI(s, ni_insns[i], dest, val >> i*16); + tcg_out_insn_RI(s, ni_insns[i], dest, val >> i * 16); return; } } @@ -1231,9 +1231,9 @@ static void tgen_andi(TCGContext *s, TCGType type, TC= GReg dest, uint64_t val) /* Try all 48-bit insns that can perform it in one go. */ if (HAVE_FACILITY(EXT_IMM)) { for (i =3D 0; i < 2; i++) { - tcg_target_ulong mask =3D ~(0xffffffffull << i*32); + tcg_target_ulong mask =3D ~(0xffffffffull << i * 32); if (((val | ~valid) & mask) =3D=3D mask) { - tcg_out_insn_RIL(s, nif_insns[i], dest, val >> i*32); + tcg_out_insn_RIL(s, nif_insns[i], dest, val >> i * 32); return; } } @@ -1279,9 +1279,9 @@ static void tgen_ori(TCGContext *s, TCGType type, TCG= Reg dest, uint64_t val) =20 /* Try all 32-bit insns that can perform it in one go. */ for (i =3D 0; i < 4; i++) { - tcg_target_ulong mask =3D (0xffffull << i*16); + tcg_target_ulong mask =3D (0xffffull << i * 16); if ((val & mask) !=3D 0 && (val & ~mask) =3D=3D 0) { - tcg_out_insn_RI(s, oi_insns[i], dest, val >> i*16); + tcg_out_insn_RI(s, oi_insns[i], dest, val >> i * 16); return; } } @@ -1289,9 +1289,9 @@ static void tgen_ori(TCGContext *s, TCGType type, TCG= Reg dest, uint64_t val) /* Try all 48-bit insns that can perform it in one go. */ if (HAVE_FACILITY(EXT_IMM)) { for (i =3D 0; i < 2; i++) { - tcg_target_ulong mask =3D (0xffffffffull << i*32); + tcg_target_ulong mask =3D (0xffffffffull << i * 32); if ((val & mask) !=3D 0 && (val & ~mask) =3D=3D 0) { - tcg_out_insn_RIL(s, oif_insns[i], dest, val >> i*32); + tcg_out_insn_RIL(s, oif_insns[i], dest, val >> i * 32); return; } } --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926318; cv=none; d=zohomail.com; s=zohoarc; b=lAOSWxeLIyjknsxjDMBcrP8cQI39eld7WgZMiySA9n4QvlRTCnaH/zzbfuT6FgT7R8EYV4l8YKfpr3mNMSmmkQHNsEBeveduRAeOavrYnt47/63zZNAOba+kmaQxcx+P7bz6yPLDu7BD9/scvPyx+WpuPIKHyghQhcga4lC13is= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926318; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=J6tqpC+7m8/ICgyOyiYZ2RwX4BgqdHMMEgREVC9PV0w=; b=TUboUXklK5C2GZ/dk9pfubW1+dOzOMHBfp+eLYJiyrCxBnoYF9Ol7wKhQqDrOoji6BGU8HQCFUObp+gfgfb//qyPrlvYYVbthfYEZQnLS5Lilt8tqNk6Q43dCdIwjzZazVbrPMrhDDW2waO3JLu+z8DzonHr2A/b1qTua1YKxaw= 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 167192631833210.981659054602687; Sat, 24 Dec 2022 15:58:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOS-0002HP-Kg; Sat, 24 Dec 2022 18:57:32 -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 1p9EOR-0002HC-Hs for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:31 -0500 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOO-0006Gi-A3 for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:31 -0500 Received: by mail-pj1-x1036.google.com with SMTP id m7-20020a17090a730700b00225ebb9cd01so30451pjk.3 for ; Sat, 24 Dec 2022 15:57:27 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=J6tqpC+7m8/ICgyOyiYZ2RwX4BgqdHMMEgREVC9PV0w=; b=I36TYGYxTvgSZdrSUFurkxQasG5VTpIjH2PB5LPR/ER6R8TPZxBGvcvMffH3PCojLV HcRmoo9rIPaefzh1XuaoxGlCYsfwWnA6nORMaELt6m/Jj7hGp4qc0eXU+7+dy48Be1R/ HSOUu52EUlS671mT2fESzIEQzfBOVFurohdOH/7Yr2bWqmIgMPb46svqeE6PXeE8V3dU nHZeDHouZlprjxbe9gvnk9Yo4Xl97gzunM3T99E4aWl+QBkM1AOQSzZ+UzE2toTnELjA E2NlHp988bTKddAkFILZxsfNuEcizAOCJrhxuNeTDQOx60Fc2wN3tnrtGxzizCWvyxks kYoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=J6tqpC+7m8/ICgyOyiYZ2RwX4BgqdHMMEgREVC9PV0w=; b=r4oMsTjhQ2o0zW76xbgT+5HVEyn8LyOTrHcQTT0BwmoO+scQQOg1POph5IV+d2rfPv 6P6TwTMgQ0FklfDVoJV1XlXnkk5H8gDO7RePA8jwMgK0p6NbDmSbwBqlO28aA+rEs22+ ML/eWVCgUVLd3U3pAYeQk8qes6ZQ/haOHa/eSs+SPHRVGy1nmHaoTQmXAMrx8wQ1O4k2 sLFNH5vYGo8U/IJuCP8P3puWNQsBG4qq4LifzKv5zpz4ONtmCuKfFtWrJkBpBBna5Sba Q5A/lavcYc94BNdoAoXFQrXl46+jQ/0aF8Pb7Jt5a0rjNIL5lCx/5ljC0M/by7B3E7sY TVgQ== X-Gm-Message-State: AFqh2kpQNxrVT9rB9aW85pPlwBFpjdOWHxS8Pf6z/V3Xo4Lpy+YshOop EqwHe0isPJOavNGhvv3ZrXax0Q1WDPjYQrSO X-Google-Smtp-Source: AMrXdXvEQQAs8AGLsn7DM4muKRgC1LpPAVE5C2raTThWks08B3EULLbG6rX50fz4bEF3ouQ/9BpwpQ== X-Received: by 2002:a17:903:442:b0:191:2c85:1371 with SMTP id iw2-20020a170903044200b001912c851371mr12269136plb.18.1671926246120; Sat, 24 Dec 2022 15:57:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 04/43] tcg: Cleanup trailing whitespace Date: Sat, 24 Dec 2022 15:56:41 -0800 Message-Id: <20221224235720.842093-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926319201100001 Remove whitespace at end of line, plus one place this also highlights some missing braces. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/tcg.c | 33 +++++++++++++++++---------------- tcg/ppc/tcg-target.c.inc | 2 +- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 436fcf6ebd..db64799e03 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -496,7 +496,7 @@ void *tcg_malloc_internal(TCGContext *s, int size) { TCGPool *p; int pool_size; - =20 + if (size > TCG_POOL_CHUNK_SIZE) { /* big malloc: insert a new pool (XXX: could optimize) */ p =3D g_malloc(sizeof(TCGPool) + size); @@ -517,10 +517,11 @@ void *tcg_malloc_internal(TCGContext *s, int size) p =3D g_malloc(sizeof(TCGPool) + pool_size); p->size =3D pool_size; p->next =3D NULL; - if (s->pool_current)=20 + if (s->pool_current) { s->pool_current->next =3D p; - else + } else { s->pool_first =3D p; + } } else { p =3D p->next; } @@ -2949,8 +2950,8 @@ static void dump_regs(TCGContext *s) =20 for(i =3D 0; i < TCG_TARGET_NB_REGS; i++) { if (s->reg_to_temp[i] !=3D NULL) { - printf("%s: %s\n",=20 - tcg_target_reg_names[i],=20 + printf("%s: %s\n", + tcg_target_reg_names[i], tcg_get_arg_str_ptr(s, buf, sizeof(buf), s->reg_to_temp= [i])); } } @@ -2967,7 +2968,7 @@ static void check_regs(TCGContext *s) ts =3D s->reg_to_temp[reg]; if (ts !=3D NULL) { if (ts->val_type !=3D TEMP_VAL_REG || ts->reg !=3D reg) { - printf("Inconsistency for register %s:\n",=20 + printf("Inconsistency for register %s:\n", tcg_target_reg_names[reg]); goto fail; } @@ -3597,14 +3598,14 @@ static void tcg_reg_alloc_op(TCGContext *s, const T= CGOp *op) nb_iargs =3D def->nb_iargs; =20 /* copy constants */ - memcpy(new_args + nb_oargs + nb_iargs,=20 + memcpy(new_args + nb_oargs + nb_iargs, op->args + nb_oargs + nb_iargs, sizeof(TCGArg) * def->nb_cargs); =20 i_allocated_regs =3D s->reserved_regs; o_allocated_regs =3D s->reserved_regs; =20 - /* satisfy input constraints */=20 + /* satisfy input constraints */ for (k =3D 0; k < nb_iargs; k++) { TCGRegSet i_preferred_regs, o_preferred_regs; =20 @@ -3678,7 +3679,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) const_args[i] =3D 0; tcg_regset_set_reg(i_allocated_regs, reg); } - =20 + /* mark dead temporaries and free the associated registers */ for (i =3D nb_oargs; i < nb_oargs + nb_iargs; i++) { if (IS_DEAD_ARG(i)) { @@ -3692,7 +3693,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) tcg_reg_alloc_bb_end(s, i_allocated_regs); } else { if (def->flags & TCG_OPF_CALL_CLOBBER) { - /* XXX: permit generic clobber register list ? */=20 + /* XXX: permit generic clobber register list ? */ for (i =3D 0; i < TCG_TARGET_NB_REGS; i++) { if (tcg_regset_test_reg(tcg_target_call_clobber_regs, i)) { tcg_reg_free(s, i, i_allocated_regs); @@ -3704,7 +3705,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) an exception. */ sync_globals(s, i_allocated_regs); } - =20 + /* satisfy the output constraints */ for(k =3D 0; k < nb_oargs; k++) { i =3D def->args_ct[k].sort_index; @@ -3889,7 +3890,7 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp *= op) =20 /* assign stack slots first */ call_stack_size =3D (nb_iargs - nb_regs) * sizeof(tcg_target_long); - call_stack_size =3D (call_stack_size + TCG_TARGET_STACK_ALIGN - 1) &=20 + call_stack_size =3D (call_stack_size + TCG_TARGET_STACK_ALIGN - 1) & ~(TCG_TARGET_STACK_ALIGN - 1); allocate_args =3D (call_stack_size > TCG_STATIC_CALL_ARGS_SIZE); if (allocate_args) { @@ -3914,7 +3915,7 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp *= op) stack_offset +=3D sizeof(tcg_target_long); #endif } - =20 + /* assign input registers */ allocated_regs =3D s->reserved_regs; for (i =3D 0; i < nb_regs; i++) { @@ -3947,14 +3948,14 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp= *op) tcg_regset_set_reg(allocated_regs, reg); } } - =20 + /* mark dead temporaries and free the associated registers */ for (i =3D nb_oargs; i < nb_iargs + nb_oargs; i++) { if (IS_DEAD_ARG(i)) { temp_dead(s, arg_temp(op->args[i])); } } - =20 + /* clobber call registers */ for (i =3D 0; i < TCG_TARGET_NB_REGS; i++) { if (tcg_regset_test_reg(tcg_target_call_clobber_regs, i)) { @@ -4395,7 +4396,7 @@ void tcg_dump_info(GString *buf) (double)s->code_out_len / tb_div_count); g_string_append_printf(buf, "avg search data/TB %0.1f\n", (double)s->search_out_len / tb_div_count); - =20 + g_string_append_printf(buf, "cycles/op %0.1f\n", s->op_count ? (double)tot / s->op_count : 0); g_string_append_printf(buf, "cycles/in byte %0.1f\n", diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index e3dba47697..9e34df94ba 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -42,7 +42,7 @@ # else # error "Unknown ABI" # endif -#endif=20 +#endif =20 #ifdef _CALL_SYSV # define TCG_TARGET_CALL_ALIGN_ARGS 1 --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926643; cv=none; d=zohomail.com; s=zohoarc; b=kaPLmUqDGTcZfMzaICRzikHKFSHSKJXEwwGcs40v84YMqZN9h3NV1OSEI3hoBBYO06Gpl+zq23ZSwZ1hX11y6p96uNKdt/OXLmq2hSm+s/5sjyPmfFeVeT0pZ1ZTdnsZTKdh+VxZsIUZxipTVnHcZz9xY+Uo52u+Icmn3VdAx0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926643; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xe4xTZh/olelEWsm0lJjRBAP0V+vxyo3x0yWKfVII3Q=; b=BOh3vk56JKlIr8KpNGf/OsMSI72QLTx0cay8V4F4d4yHzh6wZ6Kl3wWTW7E+CkYlCQhiXyO2+AdFXEZgiTfG1F5sgfQbqtjigU4KjWzjDkRXqrsqlpNZWdZAOjWtgAyaMbg1nRwuSE2VMOsvQtVQ06py4lK9aPC/f5Ar3KEjEx0= 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 1671926643213736.2225000370069; Sat, 24 Dec 2022 16:04:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOU-0002I3-7Z; Sat, 24 Dec 2022 18:57: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 1p9EOR-0002H7-CJ for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:31 -0500 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOO-0006Gm-Cd for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:31 -0500 Received: by mail-pj1-x1034.google.com with SMTP id o2so2441876pjh.4 for ; Sat, 24 Dec 2022 15:57:27 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=xe4xTZh/olelEWsm0lJjRBAP0V+vxyo3x0yWKfVII3Q=; b=h1kVdroJSwJIV1AkSI6veOISP63t/B3O6U+UC34DFd91+tzVC//v3p2V8TaqP3Z/4c r0N2qoPZ3IDmO2LtlvQlLoBVb7UYj4fj5s6lXHiFWaIOShO47cdA5tUVv21vzbThPIKQ GgCtDhGBUDh8Fz/0aoCBaAkEFSZ1LhGVZWxlz3cQj4xTe5iTEiUxBL0d1nNEM/AdemF5 yzI0BQ0fexEUaJs0EqpBR3VuSIPQk+cb+h82ZzYYRsQy3gPKt3UzHU+SLyY5nqkxG9XG TLLRKuUNwJPlGk5JB2Cdv/QFwTbpdomI4X815DKe4b5sDsWyuqBMXxaZzuyyD+gfZWbi /EAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=xe4xTZh/olelEWsm0lJjRBAP0V+vxyo3x0yWKfVII3Q=; b=Ye9hnPCpjVn/ezpr+2TBBPc/tyKFOsnyadcNKSDBPa577oqoHkDJRYEhBnuM2IdEUm Kq9oZL/IBs6AwqnoTwx/ZVtFAVfdvI6lxoYZ2zXj5UWvHg9AZV7NnoxKIyxyBYLnxU1D 0UDcKQAaycw2Ii78ZP8ISP6aFyJuuZM9BcOlqO2q0wdF2NFB9sFBjHALDtuaDU6Nldm3 dCm0GYeptwmt22cAvYtBIM95xPuWH+fNGwQkQ6dtPVhEPMF1kgWGP9q5l0jhfJqHcrFh gnewrYVTWr4k7EfY2hFtFs3DNwzFQjn7lCmzt9YZhaHhPyLekr8U1F22QhCrMNOMPhsf M0PQ== X-Gm-Message-State: AFqh2krb+Fx1x6ElCUKtncxHde7QUmgp/sHqNhzaqss1CtxnM196ERib ryr04ZdcASGoeLoK3SpEqlkWjqze0HgOTtyD X-Google-Smtp-Source: AMrXdXulksGFpUslGV/+uQSB3c/U7uz2kWX02TfRH9wTjtuPa3qnMK9uWD00oBWiugp5zwndgQ7xGA== X-Received: by 2002:a17:902:aa86:b0:188:f5de:891f with SMTP id d6-20020a170902aa8600b00188f5de891fmr31864662plr.11.1671926246973; Sat, 24 Dec 2022 15:57:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 05/43] qemu/main-loop: Introduce QEMU_IOTHREAD_LOCK_GUARD Date: Sat, 24 Dec 2022 15:56:42 -0800 Message-Id: <20221224235720.842093-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926644347100003 Create a wrapper for locking/unlocking the iothread lock. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/qemu/main-loop.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h index 3c9a9a982d..c25f390696 100644 --- a/include/qemu/main-loop.h +++ b/include/qemu/main-loop.h @@ -343,6 +343,35 @@ void qemu_mutex_lock_iothread_impl(const char *file, i= nt line); */ void qemu_mutex_unlock_iothread(void); =20 +/** + * QEMU_IOTHREAD_LOCK_GUARD + * + * Wrap a block of code in a conditional qemu_mutex_{lock,unlock}_iothread. + */ +typedef struct IOThreadLockAuto IOThreadLockAuto; + +static inline IOThreadLockAuto *qemu_iothread_auto_lock(const char *file, + int line) +{ + if (qemu_mutex_iothread_locked()) { + return NULL; + } + qemu_mutex_lock_iothread_impl(file, line); + /* Anything non-NULL causes the cleanup function to be called */ + return (IOThreadLockAuto *)(uintptr_t)1; +} + +static inline void qemu_iothread_auto_unlock(IOThreadLockAuto *l) +{ + qemu_mutex_unlock_iothread(); +} + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(IOThreadLockAuto, qemu_iothread_auto_unlock) + +#define QEMU_IOTHREAD_LOCK_GUARD() \ + g_autoptr(IOThreadLockAuto) _iothread_lock_auto __attribute__((unused)= ) \ + =3D qemu_iothread_auto_lock(__FILE__, __LINE__) + /* * qemu_cond_wait_iothread: Wait on condition for the main loop mutex * --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926483; cv=none; d=zohomail.com; s=zohoarc; b=oBuBboiU0bHUZjiwPq7kpgYqXj49jc7sP98AaavNQ74WPhuzp9+Gz9wq8G3NoYbplJJplYdKT9MhBMTZbZEkPzRt9C9dPCGyOMdagygjDLLBICff1eX+hGYj+Gaq2djJZfLsmHXk+2l77tbNyPf/R8vBOBiBKyPmeZfK4mv7h9Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926483; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=J5fURURdpD95K+AiPWNLzyWdmAHAOzWJ7x2HA9bfmtE=; b=AH3QgwX8VjNIJ45ZXWCwNgV66zgQ/iGGRnFJsEsjMkWecaH2rOeIzPUkcn5ca0DtHqn44z6hMoDdNGvc/buFO6Ov2AcKXKu14QWcPU2uen0msJuPVZ/DpMp/aqcRux1JzsbXNup+NhLcwuEh1aP7rRetJKhgF4jO6Q7PM3QsLeU= 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 1671926483418249.03950874868656; Sat, 24 Dec 2022 16:01:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOU-0002IM-TW; Sat, 24 Dec 2022 18:57: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 1p9EOS-0002HR-Nl for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:32 -0500 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOP-0006Gr-Ix for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:32 -0500 Received: by mail-pl1-x62f.google.com with SMTP id 19so1057917plo.12 for ; Sat, 24 Dec 2022 15:57:29 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=J5fURURdpD95K+AiPWNLzyWdmAHAOzWJ7x2HA9bfmtE=; b=gSOKXzHUlob4/XFdvy6zVrRqgy6Kn+0xjuruKXOb+Kh9hceluI8yE7R5KBMYNSP/E1 1G46aQLSJmbwUzdGIs5sSYvDq9ErjdUe9A9FTV2fqINzcUXojHeswUHPAYU+h8rYgkif AheLTANcinF/vIf8CM0X2v4M4mwp3W81AzQDm7Q12v9Up783qvH9IOPZn3mCjZnbCbO2 75GOTCZU2O+HK9dZBv2X6vENR1BYPfGKw5cc0txf1ufpmwjjmCA5mbzFNfx3gtKs4wuu YS72044HjlY4nnltPYc9NEDZjOg8GtjXF7dStOpgidot7+qfXVBPgzog/FI7KTs9jzml 4elA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=J5fURURdpD95K+AiPWNLzyWdmAHAOzWJ7x2HA9bfmtE=; b=w5N6YKhXN3frybR27F5HEwMh39f908L/BUeXp6177856Y+hsbkfGmVcKYSpuCXrb92 1TmeRDJlkt4YmzbFExWnSIh6aVy5MMMiX0MCFKOMPe1ir5oUJ5hsRI3pk+J64Cp/d8rG tT7NrVFH1Bxa0zctjIJynZSHTMjvCzgCJExQ4377sbX/owjz8+R/AxtKmdLgbVMCyTqA wbeFHI87Ufcx5VdQdTvkCykQjsCLRV0s2p3jF/gETPr4ALpDaoHe/Zg0TwAco47htrlI egJX1jTnhWfNWZCo9RL1D3qDT7J9FcJV/ANxt6eT8Ku0zYWn4os6T9NWsYig08wiQLhN D52w== X-Gm-Message-State: AFqh2krvPHiGtrvdExkcL52ekGYCdLP/pqKdWHtXVMx954f+jRcfPvqY qkZvIZ64Jr+Qv2H1lkz4wLz0nY86bllmprAs X-Google-Smtp-Source: AMrXdXuICCWcCygDes0PcaFwcxgRSBqXzGGBP8nxTDYEYEw5ZKMwNIpLCv4Glwi6BThGPucwu9Be3w== X-Received: by 2002:a05:6a20:1455:b0:ad:e06f:9540 with SMTP id a21-20020a056a20145500b000ade06f9540mr22269325pzi.4.1671926248344; Sat, 24 Dec 2022 15:57:28 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 06/43] hw/mips: Use QEMU_IOTHREAD_LOCK_GUARD in cpu_mips_irq_request Date: Sat, 24 Dec 2022 15:56:43 -0800 Message-Id: <20221224235720.842093-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926485761100003 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- hw/mips/mips_int.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/hw/mips/mips_int.c b/hw/mips/mips_int.c index 2db5e10fe0..73437cd90f 100644 --- a/hw/mips/mips_int.c +++ b/hw/mips/mips_int.c @@ -32,17 +32,12 @@ static void cpu_mips_irq_request(void *opaque, int irq,= int level) MIPSCPU *cpu =3D opaque; CPUMIPSState *env =3D &cpu->env; CPUState *cs =3D CPU(cpu); - bool locked =3D false; =20 if (irq < 0 || irq > 7) { return; } =20 - /* Make sure locking works even if BQL is already held by the caller */ - if (!qemu_mutex_iothread_locked()) { - locked =3D true; - qemu_mutex_lock_iothread(); - } + QEMU_IOTHREAD_LOCK_GUARD(); =20 if (level) { env->CP0_Cause |=3D 1 << (irq + CP0Ca_IP); @@ -59,10 +54,6 @@ static void cpu_mips_irq_request(void *opaque, int irq, = int level) } else { cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } - - if (locked) { - qemu_mutex_unlock_iothread(); - } } =20 void cpu_mips_irq_init_cpu(MIPSCPU *cpu) --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671927371; cv=none; d=zohomail.com; s=zohoarc; b=TyNCNMqfqMfyp17yvwH6UukjYXCa1SOME7t1JBq/3ipbGTFZLrZih0JMJ+EkF6wsLFtK8ljKRzdaLc8H/TkziKy57VNtwQqOWo0tteXK0l4Rgzbn6a7zJcihPvwy2FwP7962nJv3nghHu0/t+hm/cXuF8PtO5GQm2PbuTz50sSA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671927371; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pj3A1RydZ5k++XJlvrH6d1P1H8txrpAYpf5yEofm078=; b=CV1fQRi5cpo5cTfGfvpV+C8HEZkOCQQ/XHiNRRLCaFDSXR/dY47gpsmG73tnMydOXl+h5G2uwUPwbArikxX2+ncW5urPcdx5wKb8FFu4KbeD0xkvyH32QtfgZevsQwbHW+Remv1qwh3z/UcQOeUWI1P8SlVPx6P7vR6mPem2cC4= 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 1671927371746475.1954135954652; Sat, 24 Dec 2022 16:16:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOV-0002Ia-9J; Sat, 24 Dec 2022 18:57: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 1p9EOS-0002HQ-NJ for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:32 -0500 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOQ-0006Gx-Of for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:32 -0500 Received: by mail-pj1-x1030.google.com with SMTP id hd14-20020a17090b458e00b0021909875bccso10213681pjb.1 for ; Sat, 24 Dec 2022 15:57:30 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=pj3A1RydZ5k++XJlvrH6d1P1H8txrpAYpf5yEofm078=; b=ZPvPDBrD3LjzYd+bOA2jDhlPFyel6/LPi78k5RWOeLH1Pdi+39AS63232BDTb8S0GE +BbjqjRchmxJofsjqrQWbO2wKWOv2wT4/izZ7drTfqXjZ0I7hDZEy0YoLNW0+syAduC2 eZydlM9uY3JzhXmqlvdHrh4BfTJ035UjTw016LS0b5Rx0mV33vzYtij/32sBWLzx/Tw/ g+im1DYDNLSsZxBhZ5TUrxFVK4LiLXhQ/4HJjjg7yPS5gi1Y0mRr+rODejdVtTOF9CTC jxrQtKY9mknJJTxqY7zMRiaTRwnntdeveJDnhcLu9zCJeE4Ny+jwgixm1vT2oQMvyCo9 0SBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=pj3A1RydZ5k++XJlvrH6d1P1H8txrpAYpf5yEofm078=; b=YUlDgyRBccp9K/i2gjuaIEHJS3oiHEBY53UjP1CPvnDV4/KHzhgUDLm3ALiGSgbzRm 4Ht3YNILI2pB09poXYu8WW0lgi3pz8Js5n61nCqtjPRjreeLA1oAt5NY87x1W7cbtgF9 azwYda04w0gnh5n5JNH6IOgEU00HAhO9Gxv5tILYURwn/Kg7rlxQ8yG3p3AA0pbLcOIB UeU9hJangIoIETGpUzbl3iFqgyjlySO42HIsISGzAa4t0wQlE17JgNll6SsonYQrbzwb 1oAh8SpBXsPrI6etl2UzJW4aRH/xB0HAmas9pbwfMn5fWLmu82VZo3RZhZ95W3wpB6a5 1OlA== X-Gm-Message-State: AFqh2koIp+zl5ATtwQM/xMv/eA/6RnX7MVrFKsz6sonu7NT/w4Hnp8yh GWIHQSUJVZwkNakh2nZPDvNXch2QUtQq/Mox X-Google-Smtp-Source: AMrXdXuc0UAoxwuj1A43m+i4axWf6ZxbaBAm10HC8ygb5KlVi1Tq5TSAYFzGgznrMmZuigDNik/10Q== X-Received: by 2002:a17:902:e944:b0:189:d8fb:1523 with SMTP id b4-20020a170902e94400b00189d8fb1523mr17004857pll.36.1671926249349; Sat, 24 Dec 2022 15:57:29 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org, Daniel Henrique Barboza Subject: [PATCH v5 07/43] target/ppc: Use QEMU_IOTHREAD_LOCK_GUARD in ppc_maybe_interrupt Date: Sat, 24 Dec 2022 15:56:44 -0800 Message-Id: <20221224235720.842093-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671927373462100001 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel Henrique Barboza Signed-off-by: Richard Henderson --- target/ppc/excp_helper.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index add4d54ae7..287659c74d 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -2163,22 +2163,13 @@ static int ppc_next_unmasked_interrupt(CPUPPCState = *env) void ppc_maybe_interrupt(CPUPPCState *env) { CPUState *cs =3D env_cpu(env); - bool locked =3D false; - - if (!qemu_mutex_iothread_locked()) { - locked =3D true; - qemu_mutex_lock_iothread(); - } + QEMU_IOTHREAD_LOCK_GUARD(); =20 if (ppc_next_unmasked_interrupt(env)) { cpu_interrupt(cs, CPU_INTERRUPT_HARD); } else { cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } - - if (locked) { - qemu_mutex_unlock_iothread(); - } } =20 #if defined(TARGET_PPC64) --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671927220; cv=none; d=zohomail.com; s=zohoarc; b=dP+cfa/I4/jMVhMH0GW5JRDnj5j3Yrg1yiOepG2eFLp5uDAd5ySnPyjMYAaGaJIV8009vHxz+x5DtmJD2hEw4F2b4KUGMMrDe9f6We8RXNnpDuWCNvouSiDDTLeTRLySyb4LCvSOgSbZqretscggwP85nR6Ue4DqCrrGVr5ZdzU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671927220; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=plDIoOrc/jMHxHch1a/joN0jkJOzT26vJ1hDyyzmh0Q=; b=KvfILghNEDIwxwClXKsyUXxJIRkJNELmBAEozURZnmY97lLrXcXdG42QRl13L/GhsWe2X3Au3EnABOwNQOj/LSbZymV8Pqzg3l94RpYcBFTjuTVMwt6lL56frSNBlUfrWqr05b/Ldqqp4LfheXUigiWEeQxYZXzU9GMOrveSqys= 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 1671927220394320.2997094112743; Sat, 24 Dec 2022 16:13:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOV-0002Id-AK; Sat, 24 Dec 2022 18:57: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 1p9EOT-0002Hw-Tw for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:33 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOR-0006Ge-L5 for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:33 -0500 Received: by mail-pl1-x62d.google.com with SMTP id 19so1057972plo.12 for ; Sat, 24 Dec 2022 15:57:31 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=plDIoOrc/jMHxHch1a/joN0jkJOzT26vJ1hDyyzmh0Q=; b=SVJR9OLWTPY0kvUpYdGN8umjNIccKQiPrX9sSCj8WfQ+pkdML+NAgj2fvTzqjqXw6e NyM8/quHvzzf1YgGFmdlMtVsFtxrbD+2cUnq4t0KgSR0iZ6x76Yf8IsIveG1W9hCwgv+ VZVuaBGgl/ROXlEKXgxKxSdugHb8EViOuUZ4lpaEgKAs5sdbVrqizJibvEPVPHgXt80w wydAfL7GpZdx8GfWMjMRjEpEa8d2jNPYD2raTuPzJH4Kze2XWpyWgB/FwkaQQL1l7oRR VmgjIeCnUy9+FjNw7ba2iHKQjHiujPb8x/O+dFVijanoa4vAiASNwxEScFz3SzINEQiq GkfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=plDIoOrc/jMHxHch1a/joN0jkJOzT26vJ1hDyyzmh0Q=; b=leVu2j3ZDf0Me8Q+oqwWN1UELOouLonvJDmu5yLfu1KqZHmSmvGuGskbJe6F/fwqyY Ko6besTHXfJh+kfngKNrDWyDfLLo/3omePe9ivw4h75SHPE3D3Ly2ayeoq0+AggL/N2b AU0donsiALk46x8TQkR8lIRittwpE8AseaZxn+i8H+GhmQ1ZXuGcD05AY7X8GQWACHpq 3iF1lmBi+gu8s0jEN8LtIqI8mA17yCssl3OPqNRBl0T/H6rhWR/UMg8LlJXxhZHiY/hC XKjDN5m6XmJ9bwFdEdfxxe6Glw5Lpj5PyEgQ9HV2udkC6l9kRWaNoL7JEajzcvME6tin S/ug== X-Gm-Message-State: AFqh2koCZx0bye6Pek/rzDcr0I9S2ryc7KdpVajYHr03qeAD0rIx6Hah zcjv+z5ojBBKGRBMFVfL3ucuNt1yB3o44HJ5 X-Google-Smtp-Source: AMrXdXv1DqNBOBA6RBi5Yh57AcnO1bqtAG6nDhIPzL0jte13V3ibj4qEPN6nxzY2+ZgQm9nLCIqpZQ== X-Received: by 2002:a17:902:e3d5:b0:192:6a20:3cb1 with SMTP id r21-20020a170902e3d500b001926a203cb1mr2945222ple.51.1671926250677; Sat, 24 Dec 2022 15:57:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org, Daniel Henrique Barboza Subject: [PATCH v5 08/43] target/ppc: Use QEMU_IOTHREAD_LOCK_GUARD in cpu_interrupt_exittb Date: Sat, 24 Dec 2022 15:56:45 -0800 Message-Id: <20221224235720.842093-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671927222792100007 In addition, use tcg_enabled instead of !kvm_enabled. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel Henrique Barboza Signed-off-by: Richard Henderson --- target/ppc/helper_regs.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/target/ppc/helper_regs.c b/target/ppc/helper_regs.c index c0aee5855b..779e7db513 100644 --- a/target/ppc/helper_regs.c +++ b/target/ppc/helper_regs.c @@ -22,6 +22,7 @@ #include "qemu/main-loop.h" #include "exec/exec-all.h" #include "sysemu/kvm.h" +#include "sysemu/tcg.h" #include "helper_regs.h" #include "power8-pmu.h" #include "cpu-models.h" @@ -203,17 +204,10 @@ void cpu_interrupt_exittb(CPUState *cs) { /* * We don't need to worry about translation blocks - * when running with KVM. + * unless running with TCG. */ - if (kvm_enabled()) { - return; - } - - if (!qemu_mutex_iothread_locked()) { - qemu_mutex_lock_iothread(); - cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); - qemu_mutex_unlock_iothread(); - } else { + if (tcg_enabled()) { + QEMU_IOTHREAD_LOCK_GUARD(); cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); } } --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926344; cv=none; d=zohomail.com; s=zohoarc; b=Kg5xEOXXSmyswFq8qIvSQxkcNzaAYNtqmlfW8tIkDY+TeVDRL7Hd7NsZlRSS6Wl/Mhghh7bt4CsqA0+Xg43Bz/CmBh+PuQo5a3z6d2DKDXMMCjhyfiifLgyifCbPGrlJ4PQNN/gNsYGMurESSpJEC/XmiwiJuUcguNzo3NE1KJA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926344; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1y/tXWdTWI0vCwq66Bd7dAixKbHX6fB2Vsdpuh+SVC4=; b=idlS1IMvR+cXQVfpf0EMREfyKpL7K+IIGwGn82QaGqzr0sDQ56cBCsmTffAjknkD0MgmPgeSFnC7gQE6KLoV8vqePct/8QVflSAMHMKdMsf3yItGOtLh+TZELOluxyRRzm9AUNTd/2nGN+KQz/sg84We6LYcMEQg8t5CG3De7uY= 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 1671926344760441.7319619569719; Sat, 24 Dec 2022 15:59:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOW-0002Jp-Ti; Sat, 24 Dec 2022 18:57: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 1p9EOU-0002ID-JP for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:34 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOT-0006Hd-1V for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:34 -0500 Received: by mail-pl1-x62c.google.com with SMTP id b2so8032122pld.7 for ; Sat, 24 Dec 2022 15:57:32 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=1y/tXWdTWI0vCwq66Bd7dAixKbHX6fB2Vsdpuh+SVC4=; b=G5vuMOqaKsTCUUUP7M0ZCTmn6uv/KwYRnto8TC7IBhrfeZxvqxpsYl6JRz4LN60sgp 7UMTJ7r0cvjyK5mqgUMiVCTcIQ6nF7FVjLuAeK8TH/fd0UYIWrKgE+iWZD+eCCKiAKJi P+/wYifLb0JgfImcGQd+pem5gOkrIDPhwzUkWxmP9z8ygXxCNJ+iEiN1k2ZzkqA05+pj vhOg27H5oFl2AhM6WErh5j6++O4XNMZtA9Z705sRga3PowESrGQd5cPXD9WxfriKnEke Op/cyMJ8ZRQz1EP5qK0pxRgLZDVJKO20oC+30qD+SmEMDjAUusPhfcIDqq0X2Xp7apEI qjpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=1y/tXWdTWI0vCwq66Bd7dAixKbHX6fB2Vsdpuh+SVC4=; b=r1csSV+I42170JWhy7WGGVUOUgPLYzVhMjWhsoa6Ao2PqLINo+J8zptLUbhQvuyP8M GupbWBicSsov3Zok8ivCPQZUmcNXTWK1DWRV1w2RA5/EgXr3jOFRh6jitV2ZrL1ryFLt BagvmzvXW5nEjnpSAW5Ldy3gvftAqyghyT29bxKghvdUFPaNTxFWs95cg6Q+WS1uo7If YTsuXBSUznZL6xg6af4NesY/j+aILiyjxXSXnVubvXMY3fJdzZbd+xrXuC07vYpKxB98 31wNBpxq+IN19026ZybZhhLLcP/iOvTCpZD1T7L5O+jxsByHpZTBN0LilZkwFBWaf2XB s7ug== X-Gm-Message-State: AFqh2krVGFC6yMzMY/Wcalzsi1g5e7qgT6jAtvfK5HtaB4Gvm3IjthUe DbU7UeMqDrAvJ3gx6PR7QHKCKgDouY79O04i X-Google-Smtp-Source: AMrXdXv/pW7zoJQLszcAwAhrJPJP4SFTjX0/TZf8fI/KNUIeDnxFCJnogU2+ER7zGSd5nC8A3QwPxg== X-Received: by 2002:a17:902:74ca:b0:18d:dd85:303f with SMTP id f10-20020a17090274ca00b0018ddd85303fmr15681166plt.22.1671926251618; Sat, 24 Dec 2022 15:57:31 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org, Alistair Francis Subject: [PATCH v5 09/43] target/riscv: Use QEMU_IOTHREAD_LOCK_GUARD in riscv_cpu_update_mip Date: Sat, 24 Dec 2022 15:56:46 -0800 Message-Id: <20221224235720.842093-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926345254100001 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- target/riscv/cpu_helper.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 278d163803..241d06bab8 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -610,7 +610,6 @@ uint64_t riscv_cpu_update_mip(RISCVCPU *cpu, uint64_t m= ask, uint64_t value) CPURISCVState *env =3D &cpu->env; CPUState *cs =3D CPU(cpu); uint64_t gein, vsgein =3D 0, vstip =3D 0, old =3D env->mip; - bool locked =3D false; =20 if (riscv_cpu_virt_enabled(env)) { gein =3D get_field(env->hstatus, HSTATUS_VGEIN); @@ -621,10 +620,7 @@ uint64_t riscv_cpu_update_mip(RISCVCPU *cpu, uint64_t = mask, uint64_t value) mask =3D ((mask =3D=3D MIP_VSTIP) && env->vstime_irq) ? 0 : mask; vstip =3D env->vstime_irq ? MIP_VSTIP : 0; =20 - if (!qemu_mutex_iothread_locked()) { - locked =3D true; - qemu_mutex_lock_iothread(); - } + QEMU_IOTHREAD_LOCK_GUARD(); =20 env->mip =3D (env->mip & ~mask) | (value & mask); =20 @@ -634,10 +630,6 @@ uint64_t riscv_cpu_update_mip(RISCVCPU *cpu, uint64_t = mask, uint64_t value) cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } =20 - if (locked) { - qemu_mutex_unlock_iothread(); - } - return old; } =20 --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926298; cv=none; d=zohomail.com; s=zohoarc; b=RAS5neEEWuoBtiMyWJCTWZZtpgmiBG4PO0I+1aoo+aqRfwhnLEsaoPYjqmB5IGFwLIJELkaeUPh+FA9jPlgQm2SAAc30LQd716UY4ptnXx9zZvVtN5xY3LDL5vfnKDq4+oZtxUfmkHavkLl8xkxj3AS6p2pCC6kn3Fmo3k5AAC8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926298; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rFR0O1YijUsq1uYIRbDYqS29WFSZX2n/uoAxYINV+hk=; b=IFLED7mwxk71mJ6WOBGvte9YNpML3zWuNRN6eFnplDpHwc56q4Pk+00CoYKZL9ree+mph9iiKJTeFpko6p4JgY/xVVxekBl8dR+SXeA6rEXp02uDp8z8dHnn6CCLvcMeJn3we1zpKKYFO0eZg1XgyXjvv2jO+T+BQ0ypS3xDhN8= 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 167192629808319.203391852904133; Sat, 24 Dec 2022 15:58:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOZ-0002L8-S8; Sat, 24 Dec 2022 18:57: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 1p9EOU-0002II-Pf for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:34 -0500 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOT-0006Gi-7S for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:34 -0500 Received: by mail-pj1-x1036.google.com with SMTP id m7-20020a17090a730700b00225ebb9cd01so30551pjk.3 for ; Sat, 24 Dec 2022 15:57:32 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=rFR0O1YijUsq1uYIRbDYqS29WFSZX2n/uoAxYINV+hk=; b=f1pSupuz8JnCPqeWS3Y+RLVCiI0ncCl4sYCj6dGf/Mq/XHznK7PQQLMgp+VRg+dL/N bI6fwnwfvdbqjSG0FtjjE9RQeKN5IupVyFtqY2thAuumw5Nj5mSZUJX0mAAF2uVVJhbI 1uaZgukb9ojokk6kyXvTfNzlYKlUMdPwwfYZRSsAH6vNCujZtt2pM5tnmfG9kwpLagC/ 9BwlPxNyt1L4W0YfP/ivsp4OTPsmKXdJO0W9Ti08q3vpz0SfYLONsl/7woYU6XYwWaQT Lz+xf/0WBF/BD/4eheUbsjwEu9Lug+lgz6hL6DXo88CoJ8lwK//S8SEj/mI1v6u+Csay LZzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=rFR0O1YijUsq1uYIRbDYqS29WFSZX2n/uoAxYINV+hk=; b=nL8WY9F9mrboDUlYjIOyiOkAtsWwU2xJLhT7mrP0tUnYlmLNae0T3GHnXvUGZvqCl0 foHYQZOlGJu/BPG86DVbGjHrSgMp0Q8z0XfXtuCiv0LSc9jT9U3jo24mFoVkMb8D53C+ YnzswXBIi+BuLJNHVBH07E9Fv05er+fULQkaBXhojVx2JtFVFGGYjuHNr0xg/vSUng/2 DsxhBr5srACufk1o8icAQnpxgsQ499KL9MfrSXNORLvfJBe7aPvm9Z8lCJUKAuuTbNMh Y/g0oT/zLJ7YYTnZrFJYRk9BGV1wcbO2/NY8qcM/TXbbvxVC5W+XcTiQ3to/sXtYTgsN z/mw== X-Gm-Message-State: AFqh2kqnpvFDgZLhmdbpHA50juptVEGuPzuWCDxlsiF6ojqFqdMMYSC0 FcHlMYJOkSrVup6E14NDBRkLRraTmuaL3zI8 X-Google-Smtp-Source: AMrXdXvF253YVRqYeIwQzC0+4vUvXP/vnwTbbq0F1U5h6Dmecek/LbdujrmZ1752TTJd2/CnMcdOvA== X-Received: by 2002:a17:902:e74c:b0:189:9cfd:be79 with SMTP id p12-20020a170902e74c00b001899cfdbe79mr21666649plf.15.1671926252521; Sat, 24 Dec 2022 15:57:32 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org, Daniel Henrique Barboza Subject: [PATCH v5 10/43] hw/ppc: Use QEMU_IOTHREAD_LOCK_GUARD in ppc_set_irq Date: Sat, 24 Dec 2022 15:56:47 -0800 Message-Id: <20221224235720.842093-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926299263100002 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel Henrique Barboza Signed-off-by: Richard Henderson --- hw/ppc/ppc.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index dc86c1c7db..4e816c68c7 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -44,13 +44,9 @@ void ppc_set_irq(PowerPCCPU *cpu, int irq, int level) { CPUPPCState *env =3D &cpu->env; unsigned int old_pending; - bool locked =3D false; =20 /* We may already have the BQL if coming from the reset path */ - if (!qemu_mutex_iothread_locked()) { - locked =3D true; - qemu_mutex_lock_iothread(); - } + QEMU_IOTHREAD_LOCK_GUARD(); =20 old_pending =3D env->pending_interrupts; =20 @@ -67,10 +63,6 @@ void ppc_set_irq(PowerPCCPU *cpu, int irq, int level) =20 trace_ppc_irq_set_exit(env, irq, level, env->pending_interrupts, CPU(cpu)->interrupt_request); - - if (locked) { - qemu_mutex_unlock_iothread(); - } } =20 /* PowerPC 6xx / 7xx internal IRQ controller */ --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671927220; cv=none; d=zohomail.com; s=zohoarc; b=W3j70q/B7NA6Hvm9W+fVQTkjg7BhU1s2AutrEzgpLFZ132lcsnRY3n31bbZ+Sp4psUA7Q5jJ9gK66YEVVGuDs9f6rrbij0derEXNUDtvYu2ogLBuvistt2ZBXGpzOVmcG2Lnq+G2k+HH117te4txBGSArIiAlb6EspHHXZpvA/o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671927220; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yTAFA5u9VpP4tWGyC/Uni1rtwcEMMx/BI1MBDPeSpjQ=; b=jt+8R0dGPIkJcxKOATV3Q1nA9OqVr2JsZjmMwo66YMnKp4dothX7OD+AX8w0GXgwE+mNVZ/CFNzP9viysv3jubEOjudSNP6TS0SQjfEv4ObQFCeuwNqAR4I1YfB1e6CrC/k+idPj0hS2lOS2OpDbxyqwsCd/8U/0w33z+xi+avQ= 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 167192722055312.320261242645529; Sat, 24 Dec 2022 16:13:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOa-0002Lu-Kp; Sat, 24 Dec 2022 18:57: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 1p9EOW-0002Je-Fc for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:36 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOU-0006IC-RN for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:36 -0500 Received: by mail-pj1-x1033.google.com with SMTP id gv5-20020a17090b11c500b00223f01c73c3so10043197pjb.0 for ; Sat, 24 Dec 2022 15:57:34 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=yTAFA5u9VpP4tWGyC/Uni1rtwcEMMx/BI1MBDPeSpjQ=; b=h4R+IEWDg7AsbdYpogSE9GwcRT+dLfleqZ1++jgZL+FD6N9tSvOHBbLcJHBE9hBHZW ccTQbuRyUzwzm31xHHEarZzsH3m3RYj6rlMxuPUGOTdLNWEVbfaWY/+bmwCvc+J1/T1N 2u6r9EvZs+pcj/gQl7/7o89VWS5Z3u5djuNK16/M3maRlazP19qdEhwDOLbLe8q6RLo5 VWMCiszi4KtxdqTX2DMBkkqqlS0j8m2yjnqBeHp/qcskmJYSE2lsYmMdZdIvxoTMMEj3 vBHaN5POaHC8xu9xHDMCDHBEgV4L2FsC6wvvKsM/YfazD/HsE09lz1JtNF0j7WcGJ2rn teTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=yTAFA5u9VpP4tWGyC/Uni1rtwcEMMx/BI1MBDPeSpjQ=; b=2waXFh5+iyFiKJ9PYFijbkwHDWp9Jjdopkvud9B9uBMYujhLoQH6iEvQqPvKLCEADx vMZ2HRk7NZjm9tUGI9V15N+wJOJbyJSRAEGI0frf5UmommgGXrlLv6pQA2BakFSCPcvv GH96t3XeF3ZQ3YljsjMiJZAfBsPz6nZPj20exrCqeS1o0mxAU1ZF6HrIrK0hVohrJ64M Ac3RruM7pHH7VVLBDiYGSpX8gbJ7mGo7w4fsk6mTxoGHf/t3i4vYX7JW6XRGfjkDWuxD 8kNfHW1uJf70JpDCvy6kh98T0AFoqX+/dnAL1tBhCEfM9zUGruyvCj0opbrjovYHXzQi DCtw== X-Gm-Message-State: AFqh2krNjfwsYbJi2UKJmLVHEF2gnNMolKFlDPdABlz7BrYXzg+lvbUg Aj8axblT4uSIhcpYJmBUxkXq7FLtlFbBg73J X-Google-Smtp-Source: AMrXdXv67op9fYhF2b+1VjH62sxX0qWIfqizhPtuk0Xa7G3T76QsiadfToiKRFEwv1Db0VyJC0nAaA== X-Received: by 2002:a17:902:bf43:b0:185:441e:2d77 with SMTP id u3-20020a170902bf4300b00185441e2d77mr16505843pls.14.1671926253390; Sat, 24 Dec 2022 15:57:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 11/43] accel/tcg: Use QEMU_IOTHREAD_LOCK_GUARD in io_readx/io_writex Date: Sat, 24 Dec 2022 15:56:48 -0800 Message-Id: <20221224235720.842093-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671927222910100009 Narrow the scope of the lock to the actual read/write, moving the cpu_transation_failed call outside the lock. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 03674d598f..4948729917 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1356,7 +1356,6 @@ static uint64_t io_readx(CPUArchState *env, CPUTLBEnt= ryFull *full, MemoryRegionSection *section; MemoryRegion *mr; uint64_t val; - bool locked =3D false; MemTxResult r; =20 section =3D iotlb_to_section(cpu, full->xlat_section, full->attrs); @@ -1367,11 +1366,11 @@ static uint64_t io_readx(CPUArchState *env, CPUTLBE= ntryFull *full, cpu_io_recompile(cpu, retaddr); } =20 - if (!qemu_mutex_iothread_locked()) { - qemu_mutex_lock_iothread(); - locked =3D true; + { + QEMU_IOTHREAD_LOCK_GUARD(); + r =3D memory_region_dispatch_read(mr, mr_offset, &val, op, full->a= ttrs); } - r =3D memory_region_dispatch_read(mr, mr_offset, &val, op, full->attrs= ); + if (r !=3D MEMTX_OK) { hwaddr physaddr =3D mr_offset + section->offset_within_address_space - @@ -1380,10 +1379,6 @@ static uint64_t io_readx(CPUArchState *env, CPUTLBEn= tryFull *full, cpu_transaction_failed(cpu, physaddr, addr, memop_size(op), access= _type, mmu_idx, full->attrs, r, retaddr); } - if (locked) { - qemu_mutex_unlock_iothread(); - } - return val; } =20 @@ -1410,7 +1405,6 @@ static void io_writex(CPUArchState *env, CPUTLBEntryF= ull *full, hwaddr mr_offset; MemoryRegionSection *section; MemoryRegion *mr; - bool locked =3D false; MemTxResult r; =20 section =3D iotlb_to_section(cpu, full->xlat_section, full->attrs); @@ -1427,11 +1421,11 @@ static void io_writex(CPUArchState *env, CPUTLBEntr= yFull *full, */ save_iotlb_data(cpu, section, mr_offset); =20 - if (!qemu_mutex_iothread_locked()) { - qemu_mutex_lock_iothread(); - locked =3D true; + { + QEMU_IOTHREAD_LOCK_GUARD(); + r =3D memory_region_dispatch_write(mr, mr_offset, val, op, full->a= ttrs); } - r =3D memory_region_dispatch_write(mr, mr_offset, val, op, full->attrs= ); + if (r !=3D MEMTX_OK) { hwaddr physaddr =3D mr_offset + section->offset_within_address_space - @@ -1441,9 +1435,6 @@ static void io_writex(CPUArchState *env, CPUTLBEntryF= ull *full, MMU_DATA_STORE, mmu_idx, full->attrs, r, retaddr); } - if (locked) { - qemu_mutex_unlock_iothread(); - } } =20 static inline target_ulong tlb_read_ofs(CPUTLBEntry *entry, size_t ofs) --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926929; cv=none; d=zohomail.com; s=zohoarc; b=POYmXY1NqFbbKedATljVDX7uYZghwPDe7nWYai/3WZ882LYC0CrqMZfl72ImD/8f4TLRQntuRoq5oQ2mMZ6G1VT8jgte2oRazIrv1Pb2n66gFwKWhXlgU0NaCER3KWbrMiIfhdoSDp9M6Llu+TK4ApvJAq9XYJbz0nDlZ4dJe0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926929; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vtHTxOsR6ht0+9SPiWHuqeFVG+XUj4+DdhfsvFYW/Qc=; b=V0YA/syE32g9iAK02yJXAunLIXJ8ba3wnJJizVN5o6kj9CbGJWmZGkqGhdHkQX9/LYoRqdx6n+pVpqDNmfJmq+xUjj5rJ4qRAGKIuh4frPOfvbOwReW0rmv6bVQn7fWbNWexfvZo5+ylBL0ElsadmjM0ZttTTYTd4Bfyc85XcUU= 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 1671926929905782.7386649205364; Sat, 24 Dec 2022 16:08:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOY-0002Ko-Hq; Sat, 24 Dec 2022 18:57:38 -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 1p9EOW-0002Jl-Pr for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:36 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOV-0006GI-48 for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:36 -0500 Received: by mail-pj1-x102b.google.com with SMTP id p4so7977125pjk.2 for ; Sat, 24 Dec 2022 15:57:34 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=vtHTxOsR6ht0+9SPiWHuqeFVG+XUj4+DdhfsvFYW/Qc=; b=qT5zVeDNWmXJlpLGFcl6eBYmLzZT5M5rf1RsTaAvmzwWUGKEfOl02tIZjrOdoKJ2K9 3uH6+NF84wnrGzso60m5pDu+PJGWPCtrN6zDmbkogCl2guzIF1rf7qrxQuDscVyu1dX4 3ocTiFPrGd6h+OR63qtETHgfS3Byx8NQPAy6e79FkqmJhVx72dWRmbl9dPZyTfCytAd5 vqFy4GaYsqqfkYaFZnOB/clF/GN7AgG7LE16IkyYP7joPjK0+RwSd6iAjyUTrYCWHsy5 gm67Hznk/xeJ48/vK9Az04VpA/dWmkoerzqShv70I/bwXAHe1pPBC7eVEqLG+Y0N+dXx GEgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=vtHTxOsR6ht0+9SPiWHuqeFVG+XUj4+DdhfsvFYW/Qc=; b=wh+pG1pdjVThTohEJua0UJyEWT2Lrmqo1/kbqf/Qj2+aabzyjWaufZEt5f+dHTbzRS jfuPb0tKkvI4YciDbRBc9KH+yA3LdfND1BHOlkPYoJONPKggNEYFFH+s71IP2VbyWqWX u1qSfLmdkse2P8qVQOdNfXxyoZOBIIT5WUgp1dzjEQ8m6YD2/MGzndmHwz4kcKWm0V0M WrFkCmWUu1HqsL8fGcG7iSqvKuVVkL4iFRAlL8Ff+Eo/IPeoPPLhIztqyhy6+wffD/s4 GgUNbAgSwHpLiStkEcPTv1V0lScSLEI7rRP7H+RKVPgoMWJXQIJLJn9p9qXjmub6wGcF 8uwA== X-Gm-Message-State: AFqh2kpYWGluSdParm0tYR1Eq/QqdmOxCldsNq0hgTqgnOmIzYD8BjaW CFbYpPUh+3RBM4D6B86M/ywzE1X4bMqK+5ha X-Google-Smtp-Source: AMrXdXsXxkN9SRYtz+dDym7SNA3ojxfdE9POs+cy6FtcnPBoD0F/GPeSQ470/t4mJxvUVeL1Py8dNw== X-Received: by 2002:a05:6a20:7d8b:b0:aa:23cb:a1a6 with SMTP id v11-20020a056a207d8b00b000aa23cba1a6mr46409724pzj.0.1671926254310; Sat, 24 Dec 2022 15:57:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 12/43] tcg: Tidy tcg_reg_alloc_op Date: Sat, 24 Dec 2022 15:56:49 -0800 Message-Id: <20221224235720.842093-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926931460100001 Replace goto allocate_in_reg with a boolean. Remove o_preferred_regs which isn't used, except to copy. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/tcg.c | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index db64799e03..215ddf2db5 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3607,7 +3607,8 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) =20 /* satisfy input constraints */ for (k =3D 0; k < nb_iargs; k++) { - TCGRegSet i_preferred_regs, o_preferred_regs; + TCGRegSet i_preferred_regs; + bool allocate_new_reg; =20 i =3D def->args_ct[nb_oargs + k].sort_index; arg =3D op->args[i]; @@ -3622,9 +3623,12 @@ static void tcg_reg_alloc_op(TCGContext *s, const TC= GOp *op) continue; } =20 - i_preferred_regs =3D o_preferred_regs =3D 0; + reg =3D ts->reg; + i_preferred_regs =3D 0; + allocate_new_reg =3D false; + if (arg_ct->ialias) { - o_preferred_regs =3D op->output_pref[arg_ct->alias_index]; + i_preferred_regs =3D op->output_pref[arg_ct->alias_index]; =20 /* * If the input is readonly, then it cannot also be an @@ -3633,30 +3637,23 @@ static void tcg_reg_alloc_op(TCGContext *s, const T= CGOp *op) * register and move it. */ if (temp_readonly(ts) || !IS_DEAD_ARG(i)) { - goto allocate_in_reg; + allocate_new_reg =3D true; + } else if (ts->val_type =3D=3D TEMP_VAL_REG) { + /* + * Check if the current register has already been + * allocated for another input. + */ + allocate_new_reg =3D tcg_regset_test_reg(i_allocated_regs,= reg); } - - /* - * Check if the current register has already been allocated - * for another input aliased to an output. - */ - if (ts->val_type =3D=3D TEMP_VAL_REG) { - reg =3D ts->reg; - for (int k2 =3D 0; k2 < k; k2++) { - int i2 =3D def->args_ct[nb_oargs + k2].sort_index; - if (def->args_ct[i2].ialias && reg =3D=3D new_args[i2]= ) { - goto allocate_in_reg; - } - } - } - i_preferred_regs =3D o_preferred_regs; } =20 - temp_load(s, ts, arg_ct->regs, i_allocated_regs, i_preferred_regs); - reg =3D ts->reg; + if (!allocate_new_reg) { + temp_load(s, ts, arg_ct->regs, i_allocated_regs, i_preferred_r= egs); + reg =3D ts->reg; + allocate_new_reg =3D !tcg_regset_test_reg(arg_ct->regs, reg); + } =20 - if (!tcg_regset_test_reg(arg_ct->regs, reg)) { - allocate_in_reg: + if (allocate_new_reg) { /* * Allocate a new register matching the constraint * and move the temporary register into it. @@ -3664,7 +3661,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) temp_load(s, ts, tcg_target_available_regs[ts->type], i_allocated_regs, 0); reg =3D tcg_reg_alloc(s, arg_ct->regs, i_allocated_regs, - o_preferred_regs, ts->indirect_base); + i_preferred_regs, ts->indirect_base); if (!tcg_out_mov(s, ts->type, reg, ts->reg)) { /* * Cross register class move not supported. Sync the --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926680; cv=none; d=zohomail.com; s=zohoarc; b=OTdE996Ycl6b2LHr2uVn0L3rUI1T2MKrUKQ5bf9sdP3kLNMZsBah4VgRVXpmZN9iUy+GKhsmaeCKBrGsjNNGZ1hyjmgTSkUeRoArApnBRtmOFfiwmcxJ7uHlM5O4wW3GWxbzT5O4JLfu5AilJEjc8F2YOp+SBWQ99UqEQoI5Ckk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926680; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ICnDE5CkA2lmO28avcdDx7Ov//rZAy7zNfU1ruYzqlU=; b=gxPBEnJ6Z/aOWeO4cg3sItbzHrYnEkou0P2wJfwgq/yBZrk0jrQOi0V8GSMQ6cJh+RgdlAOJ+qTtmkKLBXlX7Ks/JTWmouWcQfC2Ijf0jbaV+RO1UVDR6icaHZSF7zsVA5WQ0aNi/yK9FsvmhtQCjSmmm64tTLVQpTJZ0nXMdX4= 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 167192668090935.64734373388603; Sat, 24 Dec 2022 16:04:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOc-0002MZ-8P; Sat, 24 Dec 2022 18:57:42 -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 1p9EOY-0002KZ-AO for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:38 -0500 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOW-0006Ix-J1 for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:38 -0500 Received: by mail-pj1-x1032.google.com with SMTP id p4so7977136pjk.2 for ; Sat, 24 Dec 2022 15:57:36 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=ICnDE5CkA2lmO28avcdDx7Ov//rZAy7zNfU1ruYzqlU=; b=cwggcCW4rnW3gXkxWMiPlWRWSUaEyNPWZorPNGibfV1/SDBkJCMWHe/WbMk7ee+HY7 6m8oIoV5DdEmRwtOjFsS7qvhCXdrCSAYYp90qsrZn8e2aReOeny1RPTH0ItgKXK3S5X1 jmtHLNYkNMT9CmU9ZfkD5h9iiYgRSUmPH4qRZDIUxix0bbNgPrSQWoU5WyMDfd9Fgu4o cx2dvzmzgSiFo7LjG/bT1+KhQw3WfRd9kTybjtkYOvcd4wvyFRPVuE/JL6iOQ5CJ2RVf Z9Q7G0zOlATtHT9ofTHVkgGyfc7qSNP4wy0w5amCXSPEJehVzDmtPDAx9q8iOZ6BtLDH F1TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=ICnDE5CkA2lmO28avcdDx7Ov//rZAy7zNfU1ruYzqlU=; b=ZIsQa68FQGOzYeeqp1Qp+dn8VqU71GdFj6Y+/j6Ypt+tzwFPs94Fj/Ed7/TtWLe10O B1ZkOHl2ms+qCr8Zqx5TU+geZ4V7pR124BDrqHZE6ph3q31XV1CGxvGHWY/siZiflc05 PmuWRJfEqKKJFHsrsIJvaW6NWXq4ZSkXDXwbzNsoz/aSosm2DxjVAWx7OOsfRtfYBQpH AG2C7l4bMHpNCkcEd6yn/Rx4I9Q6fz8Z/iEFQUkYWsf/ra8jHn5gSv5Ggo23YhoYkcM+ UaPNmkrdk6RyeZ2d4J1uMP3ugIg8T7sc7VQeWNso6nrx5jXZaARhjXFFJDgS42yyl1X8 bs8A== X-Gm-Message-State: AFqh2kp8cHaY0C/Y8p/rypCrMKVEfC7r824GXHkk2FSUY+hgh0G1uP5F L+tLm/OdOnv0rSsSSC6gMwyeEGKw3j3/Pnxr X-Google-Smtp-Source: AMrXdXsry7QMWkTU9UGJHY+D4MycGyd7C0rhB2UePijdTBu9dDqTO1fxwAV5nXcuWoP7s6jexA4VGA== X-Received: by 2002:a17:902:6b89:b0:189:cf92:6f5c with SMTP id p9-20020a1709026b8900b00189cf926f5cmr16456920plk.52.1671926255189; Sat, 24 Dec 2022 15:57:35 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 13/43] tcg: Remove TCG_TARGET_STACK_GROWSUP Date: Sat, 24 Dec 2022 15:56:50 -0800 Message-Id: <20221224235720.842093-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926682480100003 The hppa host code has been removed since 2013; this should have been deleted at the same time. Fixes: 802b5081233a ("tcg-hppa: Remove tcg backend") Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.h | 1 - tcg/arm/tcg-target.h | 1 - tcg/tcg.c | 32 ++------------------------------ 3 files changed, 2 insertions(+), 32 deletions(-) diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index 485f685bd2..e145d50fef 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -16,7 +16,6 @@ #define TCG_TARGET_INSN_UNIT_SIZE 4 #define TCG_TARGET_TLB_DISPLACEMENT_BITS 24 #define MAX_CODE_GEN_BUFFER_SIZE (2 * GiB) -#undef TCG_TARGET_STACK_GROWSUP =20 typedef enum { TCG_REG_X0, TCG_REG_X1, TCG_REG_X2, TCG_REG_X3, diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index 7e96495392..56c1ac4586 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -30,7 +30,6 @@ extern int arm_arch; =20 #define use_armv7_instructions (__ARM_ARCH >=3D 7 || arm_arch >=3D 7) =20 -#undef TCG_TARGET_STACK_GROWSUP #define TCG_TARGET_INSN_UNIT_SIZE 4 #define TCG_TARGET_TLB_DISPLACEMENT_BITS 16 #define MAX_CODE_GEN_BUFFER_SIZE UINT32_MAX diff --git a/tcg/tcg.c b/tcg/tcg.c index 215ddf2db5..05d2b70ab7 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1552,25 +1552,8 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int nar= gs, TCGTemp **args) } =20 if (TCG_TARGET_REG_BITS < 64 && is_64bit) { - /* - * If stack grows up, then we will be placing successive - * arguments at lower addresses, which means we need to - * reverse the order compared to how we would normally - * treat either big or little-endian. For those arguments - * that will wind up in registers, this still works for - * HPPA (the only current STACK_GROWSUP target) since the - * argument registers are *also* allocated in decreasing - * order. If another such target is added, this logic may - * have to get more complicated to differentiate between - * stack arguments and register arguments. - */ -#if HOST_BIG_ENDIAN !=3D defined(TCG_TARGET_STACK_GROWSUP) - op->args[pi++] =3D temp_arg(args[i] + 1); - op->args[pi++] =3D temp_arg(args[i]); -#else - op->args[pi++] =3D temp_arg(args[i]); - op->args[pi++] =3D temp_arg(args[i] + 1); -#endif + op->args[pi++] =3D temp_arg(args[i] + HOST_BIG_ENDIAN); + op->args[pi++] =3D temp_arg(args[i] + !HOST_BIG_ENDIAN); real_args +=3D 2; continue; } @@ -3854,12 +3837,6 @@ static bool tcg_reg_alloc_dup2(TCGContext *s, const = TCGOp *op) return true; } =20 -#ifdef TCG_TARGET_STACK_GROWSUP -#define STACK_DIR(x) (-(x)) -#else -#define STACK_DIR(x) (x) -#endif - static void tcg_reg_alloc_call(TCGContext *s, TCGOp *op) { const int nb_oargs =3D TCGOP_CALLO(op); @@ -3899,18 +3876,13 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp= *op) stack_offset =3D TCG_TARGET_CALL_STACK_OFFSET; for (i =3D nb_regs; i < nb_iargs; i++) { arg =3D op->args[nb_oargs + i]; -#ifdef TCG_TARGET_STACK_GROWSUP - stack_offset -=3D sizeof(tcg_target_long); -#endif if (arg !=3D TCG_CALL_DUMMY_ARG) { ts =3D arg_temp(arg); temp_load(s, ts, tcg_target_available_regs[ts->type], s->reserved_regs, 0); tcg_out_st(s, ts->type, ts->reg, TCG_REG_CALL_STACK, stack_off= set); } -#ifndef TCG_TARGET_STACK_GROWSUP stack_offset +=3D sizeof(tcg_target_long); -#endif } =20 /* assign input registers */ --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671927162; cv=none; d=zohomail.com; s=zohoarc; b=ghOLq245BeV+eC84SMteEJj4Dp7wO85nq9kCnWihnyhppb3yOgcaIs8uNYIzRFb8XeYU/J45Wp5kwgMfHqKk1mR5oUcKVy8aCgj067UfjGxZkR1k59VYSs05/8p8FwqvhA2U/n2lgRBkqtJ7pruBe663kzgCjokch1Do3Zq7gOU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671927162; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=D8QfQ1uDgH78xLrd7SQL4h0WAoUU3UOZ3RoOlmiv5EM=; b=lbxKrv5L/XNnKRatOCmQrCa32uiIpd4STNE4lQcMIvSlebcTOkq4UIYTNWX7qiKyqBmfDkY/hsyDPPoXWdvoVgvQbTHC01LoAxVV//lpNXdu7lM8WAzo+EuestRn5oCTPcdeIWdOySxWcOm0M2YO3/1XDf1PdaFHXM7U2NNf6Mw= 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 1671927162958732.4021645849928; Sat, 24 Dec 2022 16:12:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOa-0002LI-3O; Sat, 24 Dec 2022 18:57: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 1p9EOZ-0002Ku-09 for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:39 -0500 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOX-0006J7-Bm for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:38 -0500 Received: by mail-pj1-x1032.google.com with SMTP id k88-20020a17090a4ce100b00219d0b857bcso8008486pjh.1 for ; Sat, 24 Dec 2022 15:57:36 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=D8QfQ1uDgH78xLrd7SQL4h0WAoUU3UOZ3RoOlmiv5EM=; b=UQl46vBRu7SW9dLT+pEBRKGKvJ+exQa94UllJVm1d/I/vlXVuYJ8Jcasfy0TIW1PtL 6DzKGsm04r8h3cPqlYml7xbNvEtKiHQm8xYIEUg2mXVm711bBnPZexUI52kgBKQTFaJJ QpmguaezTfHvDTPJnIksa/gly9ym1SYj/I2Rp/um/W0SDmMIRudMQ+SXA9P0YWBVM3C8 aPSogDxa7/zdvKuGYdahLv07mj7fbjk+Fqw1Rnt6i7UQsoBwpa2uKyiyyHuYe0tqDseQ gILC4jIW16EpIqDb1gKBCtA0tuZqq5rTOS77Ywg02fNNqC2QzVaH47csUaJlhmHOgGOi ddzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=D8QfQ1uDgH78xLrd7SQL4h0WAoUU3UOZ3RoOlmiv5EM=; b=RgeKcLlxOf1QcH36QMoxyX8pqfqI3hR0Sr8fF2qR0x5/J1+Ac/jD9udqYFt19VjG/v aid2gVaYoqE7ZwpJafrU37OWF2ZvrjbhNSd8X3cOPBYPJPu3wryd9eT9dXM2ld+pG/Dp Qze25c4OHEBgGhJ47AlhdultqaGh47n/u8/nvHS6LP4nhIZkvcZrXDyomOTlpOXljUh5 V4gy6dKfSZ9ZJFcUzy0CSD63VuKrw7ZvGOM/jrBv/njx0S8xR3lgqsYRqjvyHfCKK9q8 2zP2/eaiNyvuECRnJOcF80sKJOmJcgNqCGOJsBXb9fiBFRYzR7YCasq3lbmHQMK0rWtL E2Xg== X-Gm-Message-State: AFqh2kqRT+Si6+N+MzzqxQEcMWsHS98FnEI4ZjlMin/6+BKgvjGxpoeM m2NiTyOZ1tOgLNpjhB08HTo2ymQCfRWBOvGL X-Google-Smtp-Source: AMrXdXuKoNpHTbjmN9XGBwbTeLuqbD6z/J4ronZ2q7KiO1zHtvdDFeQFaGDAoZMeB/o8EVWNUW3+ZA== X-Received: by 2002:a17:902:7594:b0:188:5e99:d84f with SMTP id j20-20020a170902759400b001885e99d84fmr16351707pll.42.1671926256127; Sat, 24 Dec 2022 15:57:36 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 14/43] tci: MAX_OPC_PARAM_IARGS is no longer used Date: Sat, 24 Dec 2022 15:56:51 -0800 Message-Id: <20221224235720.842093-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671927166383100003 Unused since commit 7b7d8b2d9a ("tcg/tci: Use ffi for calls"). Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/tci.c | 1 - tcg/tci/tcg-target.c.inc | 4 ---- 2 files changed, 5 deletions(-) diff --git a/tcg/tci.c b/tcg/tci.c index bdfac83492..05a24163d3 100644 --- a/tcg/tci.c +++ b/tcg/tci.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "tcg/tcg.h" /* MAX_OPC_PARAM_IARGS */ #include "exec/cpu_ldst.h" #include "tcg/tcg-op.h" #include "tcg/tcg-ldst.h" diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc index f3d7441e06..c1acaa943e 100644 --- a/tcg/tci/tcg-target.c.inc +++ b/tcg/tci/tcg-target.c.inc @@ -197,10 +197,6 @@ static const int tcg_target_reg_alloc_order[] =3D { TCG_REG_R0, }; =20 -#if MAX_OPC_PARAM_IARGS !=3D 7 -# error Fix needed, number of supported input arguments changed! -#endif - /* No call arguments via registers. All will be stored on the "stack". */ static const int tcg_target_call_iarg_regs[] =3D { }; =20 --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671927206; cv=none; d=zohomail.com; s=zohoarc; b=IIxmse9IhvZ/zbjAy2bz3hrci3FJtoUMHE+YETYvl5hH98PbLstzuZ7re8VVIPsnB+WdY+Rif4tC2Oi4muZ1ks+ouGY9xfA2TBqSmfsLc7AkZz6YtGmD0oZmLholVnXeraWPzF8XzjYwN4s6HLzysHIdn4DozkcEUWTDZtyuS7I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671927206; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=14I+QLaNg6Y9e4H/8QMxuuyCzHk2ngznUAbtAPjHaRo=; b=QsgFAMm/dKZ9lyaHlxaqlGhzmy3ibXb+KPt7wkvdSA2bF+eQFFpeNr7gcdfh6dfbTOYsUCvpRV21farOX1B/oW34pLBzrfPMYeemmnA/Hnad8G1wf6W5TqJru7Tzo1Q+pPIqeVqkycMDSw9JOa1aLf5to+4DhqAP7Yzn54BQPjo= 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 1671927206355791.2664316283839; Sat, 24 Dec 2022 16:13:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOb-0002ML-Cx; Sat, 24 Dec 2022 18:57:41 -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 1p9EOZ-0002L4-L4 for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:39 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOX-0006GI-Pu for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:39 -0500 Received: by mail-pj1-x102b.google.com with SMTP id p4so7977174pjk.2 for ; Sat, 24 Dec 2022 15:57:37 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=14I+QLaNg6Y9e4H/8QMxuuyCzHk2ngznUAbtAPjHaRo=; b=WyfO2Znfa/bjfoJsLV/2GL7/2JoxXIk+Y2PVtcNuyZ7+UJWGHAHua3gZzWHk4VDnP3 dsvEwebxAbmk24x2951Y7UxdlEbSOIDkBXTijoM8iRIttbSsJ0QCu4LRWJjEtPLlNfeU rJB4xDGRxfNLO67Zj9HwRckmdY+IvnMoNReMPAbgHRudJ2EA5qPG5GLHxSS/qaxFeaH7 OwU6UaLt6hUjYocxf/hKNfcyXZgmQDvQPdmnEiCprPm6yIB9d4XATURAxZiEYNO6MTWU EblOsKvGDUWSpJtJIQ7YUJduiQvZYG9omChItitxxPhw6Xp5Ex4M3Ko2lMYvwmHe8uRI TXgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=14I+QLaNg6Y9e4H/8QMxuuyCzHk2ngznUAbtAPjHaRo=; b=5LzKx0Hl6z6dqTYbjBLqkC/iUtCnSHIw4Q2kf9uhmKx20pW+gGzUodkaQ/tex2tI6m d9ZeN+9TL8vc5+5kP78OrTyJQxsT7genJyz98767mEHnqpMO5LdFBZqjCebz6Fc86oPo otrx54nUh5PYnHEH38r48CQ2DfwtEjqNPFRzvGO2FiC1OA1fawvCoMCIqbx5hTuMBj0n HcrGLxVZWWKBBBREeWtfdKnlvV2Ud4AxnllhX2+Lu+iWBLZ3+jUO1AP7SHHUmoy8CPSk IRkViHwstPfxmVnxXHt0jhZ8GExiIVrbz0blgIuhLmPFQSD7p2rqkvCCcjDt86Iu7ieu Om6A== X-Gm-Message-State: AFqh2krj905ajK/Aev7dhMfvV/9zjANaeA1jXI/CVj2bCDV3HDDcI6cF /hY+bd0ZJtzo0nZsXMf+yN76SrP+pSme/aZf X-Google-Smtp-Source: AMrXdXt2C4QLqq6+/8yobvA1x1Lk95Z9/jIb7EH6Lj4KNqsR6ZuL8oEoI+OT+0Kd8CqZj0CwFK5npQ== X-Received: by 2002:a17:903:3311:b0:189:6522:7cc0 with SMTP id jk17-20020a170903331100b0018965227cc0mr15626046plb.50.1671926257015; Sat, 24 Dec 2022 15:57:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 15/43] tcg: Fix tcg_reg_alloc_dup* Date: Sat, 24 Dec 2022 15:56:52 -0800 Message-Id: <20221224235720.842093-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> MIME-Version: 1.0 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::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671927208553100003 Content-Type: text/plain; charset="utf-8" The assignment to mem_coherent should be done with any modification, not simply with a newly allocated register. Signed-off-by: Richard Henderson --- tcg/tcg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 05d2b70ab7..371908b34b 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3498,7 +3498,6 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TC= GOp *op) ots->reg =3D tcg_reg_alloc(s, dup_out_regs, allocated_regs, op->output_pref[0], ots->indirect_base); ots->val_type =3D TEMP_VAL_REG; - ots->mem_coherent =3D 0; s->reg_to_temp[ots->reg] =3D ots; } =20 @@ -3552,6 +3551,7 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TC= GOp *op) tcg_debug_assert(ok); =20 done: + ots->mem_coherent =3D 0; if (IS_DEAD_ARG(1)) { temp_dead(s, its); } @@ -3779,7 +3779,6 @@ static bool tcg_reg_alloc_dup2(TCGContext *s, const T= CGOp *op) ots->reg =3D tcg_reg_alloc(s, dup_out_regs, allocated_regs, op->output_pref[0], ots->indirect_base); ots->val_type =3D TEMP_VAL_REG; - ots->mem_coherent =3D 0; s->reg_to_temp[ots->reg] =3D ots; } =20 @@ -3823,6 +3822,7 @@ static bool tcg_reg_alloc_dup2(TCGContext *s, const T= CGOp *op) return false; =20 done: + ots->mem_coherent =3D 0; if (IS_DEAD_ARG(1)) { temp_dead(s, itsl); } --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926298; cv=none; d=zohomail.com; s=zohoarc; b=QTBOO3Z7mw34x+9tbadecihf4n181ImJa+pwyu9O99PfbCvNlvnd04+qrNIgMZ8/gMvn7KWse+emvyYhpbdoOgEJXLbjNDaGZxJP+SxZRcwqmJZGNBDxwqrgsi/DgMiX/dD1kfVkUyK8ssbc0/EDVYP5aIILW0ZZvlMp7O/swGI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926298; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TaUbg1x+8VKhL26yQHWY99Zf9utpt/oiF3l4PqR5eGE=; b=bSN44w/8E1TouT9X30lEvjY1a46H+bmIEE4Nk8n6bNbEnazbgs4GQAQjEGe06pW6XPufSnY9gfzAeUdeDdccJOfI/ppaWoUA7/XPs288oF1XRG0xa+Fhzj/5E1zhLfnfyg/ruqKpV+d+BdHvsu1+jihsNdablRRUUvLuD5b07Kc= 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 1671926298124431.5943228901899; Sat, 24 Dec 2022 15:58:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOg-0002NF-83; Sat, 24 Dec 2022 18:57:48 -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 1p9EOa-0002MM-Vs for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:41 -0500 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOY-0006Gx-RR for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:40 -0500 Received: by mail-pj1-x1030.google.com with SMTP id hd14-20020a17090b458e00b0021909875bccso10213784pjb.1 for ; Sat, 24 Dec 2022 15:57:38 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=TaUbg1x+8VKhL26yQHWY99Zf9utpt/oiF3l4PqR5eGE=; b=FPANMimDaWa7CQBmygAwVWhey8PiwBkJRE4F91kNlzaCA19+X5s55CSSIcGfBrNlwq 4cAtWWfirCJlqyA9mBHClOXeJtcfQCZYR/ZOMbc0zW1jvFT4hAmkZJAv6KRj+BXuZ70B MsJrF1rU3lvQQ80bvpUYtfRIlkwxrDl8UH0URusMyG4AoWCXLBANLpFDUx/VIZaOWNUr 8jICWlbGNU89iYLUxIQYvaj2KmxX3u/teQP3cCyZDiUZW5bgZB4KHZOMxa5of7Ggy4tI Yp1BE6H/Aw6oub11TeefBYCqL1A1SvAfMDgGDh7hDwvMbTr3KjiOowcxtehbt7RZeXe1 dRNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=TaUbg1x+8VKhL26yQHWY99Zf9utpt/oiF3l4PqR5eGE=; b=xFMawgj5JkQW2P2bzTk+RImWOuX2QLuX3yu0bIKx4R/Vg4ZS0Hn007x+oPF8T7RgFp 6HHfeLGs/7SOh6XwJhR7DHMLI/P6U3pigCdYlXVWPzxpZmdk1ay9s73w3HVPLQXd7qP4 GrvBl1E82ymj7qVUXwzdX5eaeqhNNh5cCL9g+0hvnqEni7mBoU403v+zjqYrgASPJIFw mUUeTTjqmjXMeuQa2d7njosyVMFnOILauIk6bTk+XSqCuXCvPf0pZ/oAazMXKA9PKBqM Ol5dGiAhvMaUx9Fqvujl3qQURRHtpS4M6IMsEr2b8Szh5c7023ox+nz4Hhnb9Pr/iUDw WbBA== X-Gm-Message-State: AFqh2koiBhp8CE8nOOFpOxXScxUvgr7F8w9yQMZEu5vd0I7DJvNWmDoT dDXVz+iM92Kd4qeXh8kKAqL2X6cb+aWkhzYR X-Google-Smtp-Source: AMrXdXuSbSW1ov2t67r2uFnkcrOSvWvcYCZM3J+LWt73gKCtH6CxZQ6xXgfa8tYOouIB2dpdfHi5nw== X-Received: by 2002:a05:6a21:2d07:b0:b2:48e8:e3a9 with SMTP id tw7-20020a056a212d0700b000b248e8e3a9mr21443432pzb.12.1671926257974; Sat, 24 Dec 2022 15:57:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 16/43] tcg: Centralize updates to reg_to_temp Date: Sat, 24 Dec 2022 15:56:53 -0800 Message-Id: <20221224235720.842093-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926299388100007 Create two new functions, set_temp_val_{reg,nonreg}. Assert that the reg_to_temp mapping is correct before any changes are made. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- tcg/tcg.c | 159 +++++++++++++++++++++++++++++------------------------- 1 file changed, 85 insertions(+), 74 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 371908b34b..a1ae761a58 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3019,6 +3019,35 @@ static void temp_allocate_frame(TCGContext *s, TCGTe= mp *ts) ts->mem_allocated =3D 1; } =20 +/* Assign @reg to @ts, and update reg_to_temp[]. */ +static void set_temp_val_reg(TCGContext *s, TCGTemp *ts, TCGReg reg) +{ + if (ts->val_type =3D=3D TEMP_VAL_REG) { + TCGReg old =3D ts->reg; + tcg_debug_assert(s->reg_to_temp[old] =3D=3D ts); + if (old =3D=3D reg) { + return; + } + s->reg_to_temp[old] =3D NULL; + } + tcg_debug_assert(s->reg_to_temp[reg] =3D=3D NULL); + s->reg_to_temp[reg] =3D ts; + ts->val_type =3D TEMP_VAL_REG; + ts->reg =3D reg; +} + +/* Assign a non-register value type to @ts, and update reg_to_temp[]. */ +static void set_temp_val_nonreg(TCGContext *s, TCGTemp *ts, TCGTempVal typ= e) +{ + tcg_debug_assert(type !=3D TEMP_VAL_REG); + if (ts->val_type =3D=3D TEMP_VAL_REG) { + TCGReg reg =3D ts->reg; + tcg_debug_assert(s->reg_to_temp[reg] =3D=3D ts); + s->reg_to_temp[reg] =3D NULL; + } + ts->val_type =3D type; +} + static void temp_load(TCGContext *, TCGTemp *, TCGRegSet, TCGRegSet, TCGRe= gSet); =20 /* Mark a temporary as free or dead. If 'free_or_dead' is negative, @@ -3044,10 +3073,7 @@ static void temp_free_or_dead(TCGContext *s, TCGTemp= *ts, int free_or_dead) default: g_assert_not_reached(); } - if (ts->val_type =3D=3D TEMP_VAL_REG) { - s->reg_to_temp[ts->reg] =3D NULL; - } - ts->val_type =3D new_type; + set_temp_val_nonreg(s, ts, new_type); } =20 /* Mark a temporary as dead. */ @@ -3227,9 +3253,7 @@ static void temp_load(TCGContext *s, TCGTemp *ts, TCG= RegSet desired_regs, default: tcg_abort(); } - ts->reg =3D reg; - ts->val_type =3D TEMP_VAL_REG; - s->reg_to_temp[reg] =3D ts; + set_temp_val_reg(s, ts, reg); } =20 /* Save a temporary to memory. 'allocated_regs' is used in case a @@ -3341,10 +3365,7 @@ static void tcg_reg_alloc_do_movi(TCGContext *s, TCG= Temp *ots, tcg_debug_assert(!temp_readonly(ots)); =20 /* The movi is not explicitly generated here. */ - if (ots->val_type =3D=3D TEMP_VAL_REG) { - s->reg_to_temp[ots->reg] =3D NULL; - } - ots->val_type =3D TEMP_VAL_CONST; + set_temp_val_nonreg(s, ots, TEMP_VAL_CONST); ots->val =3D val; ots->mem_coherent =3D 0; if (NEED_SYNC_ARG(0)) { @@ -3363,6 +3384,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TC= GOp *op) TCGRegSet allocated_regs, preferred_regs; TCGTemp *ts, *ots; TCGType otype, itype; + TCGReg oreg, ireg; =20 allocated_regs =3D s->reserved_regs; preferred_regs =3D op->output_pref[0]; @@ -3394,8 +3416,9 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TC= GOp *op) temp_load(s, ts, tcg_target_available_regs[itype], allocated_regs, preferred_regs); } - tcg_debug_assert(ts->val_type =3D=3D TEMP_VAL_REG); + ireg =3D ts->reg; + if (IS_DEAD_ARG(0)) { /* mov to a non-saved dead register makes no sense (even with liveness analysis disabled). */ @@ -3403,52 +3426,53 @@ static void tcg_reg_alloc_mov(TCGContext *s, const = TCGOp *op) if (!ots->mem_allocated) { temp_allocate_frame(s, ots); } - tcg_out_st(s, otype, ts->reg, ots->mem_base->reg, ots->mem_offset); + tcg_out_st(s, otype, ireg, ots->mem_base->reg, ots->mem_offset); if (IS_DEAD_ARG(1)) { temp_dead(s, ts); } temp_dead(s, ots); + return; + } + + if (IS_DEAD_ARG(1) && ts->kind !=3D TEMP_FIXED) { + /* + * The mov can be suppressed. Kill input first, so that it + * is unlinked from reg_to_temp, then set the output to the + * reg that we saved from the input. + */ + temp_dead(s, ts); + oreg =3D ireg; } else { - if (IS_DEAD_ARG(1) && ts->kind !=3D TEMP_FIXED) { - /* the mov can be suppressed */ - if (ots->val_type =3D=3D TEMP_VAL_REG) { - s->reg_to_temp[ots->reg] =3D NULL; - } - ots->reg =3D ts->reg; - temp_dead(s, ts); + if (ots->val_type =3D=3D TEMP_VAL_REG) { + oreg =3D ots->reg; } else { - if (ots->val_type !=3D TEMP_VAL_REG) { - /* When allocating a new register, make sure to not spill = the - input one. */ - tcg_regset_set_reg(allocated_regs, ts->reg); - ots->reg =3D tcg_reg_alloc(s, tcg_target_available_regs[ot= ype], - allocated_regs, preferred_regs, - ots->indirect_base); - } - if (!tcg_out_mov(s, otype, ots->reg, ts->reg)) { - /* - * Cross register class move not supported. - * Store the source register into the destination slot - * and leave the destination temp as TEMP_VAL_MEM. - */ - assert(!temp_readonly(ots)); - if (!ts->mem_allocated) { - temp_allocate_frame(s, ots); - } - tcg_out_st(s, ts->type, ts->reg, - ots->mem_base->reg, ots->mem_offset); - ots->mem_coherent =3D 1; - temp_free_or_dead(s, ots, -1); - return; - } + /* Make sure to not spill the input register during allocation= . */ + oreg =3D tcg_reg_alloc(s, tcg_target_available_regs[otype], + allocated_regs | ((TCGRegSet)1 << ireg), + preferred_regs, ots->indirect_base); } - ots->val_type =3D TEMP_VAL_REG; - ots->mem_coherent =3D 0; - s->reg_to_temp[ots->reg] =3D ots; - if (NEED_SYNC_ARG(0)) { - temp_sync(s, ots, allocated_regs, 0, 0); + if (!tcg_out_mov(s, otype, oreg, ireg)) { + /* + * Cross register class move not supported. + * Store the source register into the destination slot + * and leave the destination temp as TEMP_VAL_MEM. + */ + assert(!temp_readonly(ots)); + if (!ts->mem_allocated) { + temp_allocate_frame(s, ots); + } + tcg_out_st(s, ts->type, ireg, ots->mem_base->reg, ots->mem_off= set); + set_temp_val_nonreg(s, ts, TEMP_VAL_MEM); + ots->mem_coherent =3D 1; + return; } } + set_temp_val_reg(s, ots, oreg); + ots->mem_coherent =3D 0; + + if (NEED_SYNC_ARG(0)) { + temp_sync(s, ots, allocated_regs, 0, 0); + } } =20 /* @@ -3490,15 +3514,15 @@ static void tcg_reg_alloc_dup(TCGContext *s, const = TCGOp *op) /* Allocate the output register now. */ if (ots->val_type !=3D TEMP_VAL_REG) { TCGRegSet allocated_regs =3D s->reserved_regs; + TCGReg oreg; =20 if (!IS_DEAD_ARG(1) && its->val_type =3D=3D TEMP_VAL_REG) { /* Make sure to not spill the input register. */ tcg_regset_set_reg(allocated_regs, its->reg); } - ots->reg =3D tcg_reg_alloc(s, dup_out_regs, allocated_regs, - op->output_pref[0], ots->indirect_base); - ots->val_type =3D TEMP_VAL_REG; - s->reg_to_temp[ots->reg] =3D ots; + oreg =3D tcg_reg_alloc(s, dup_out_regs, allocated_regs, + op->output_pref[0], ots->indirect_base); + set_temp_val_reg(s, ots, oreg); } =20 switch (its->val_type) { @@ -3535,10 +3559,12 @@ static void tcg_reg_alloc_dup(TCGContext *s, const = TCGOp *op) #else endian_fixup =3D 0; #endif + /* Attempt to dup directly from the input memory slot. */ if (tcg_out_dupm_vec(s, vtype, vece, ots->reg, its->mem_base->reg, its->mem_offset + endian_fixup)) { goto done; } + /* Load the input into the destination vector register. */ tcg_out_ld(s, itype, ots->reg, its->mem_base->reg, its->mem_offset= ); break; =20 @@ -3707,17 +3733,8 @@ static void tcg_reg_alloc_op(TCGContext *s, const TC= GOp *op) op->output_pref[k], ts->indirect_base); } tcg_regset_set_reg(o_allocated_regs, reg); - if (ts->val_type =3D=3D TEMP_VAL_REG) { - s->reg_to_temp[ts->reg] =3D NULL; - } - ts->val_type =3D TEMP_VAL_REG; - ts->reg =3D reg; - /* - * Temp value is modified, so the value kept in memory is - * potentially not the same. - */ + set_temp_val_reg(s, ts, reg); ts->mem_coherent =3D 0; - s->reg_to_temp[reg] =3D ts; new_args[i] =3D reg; } } @@ -3767,6 +3784,7 @@ static bool tcg_reg_alloc_dup2(TCGContext *s, const T= CGOp *op) TCGRegSet allocated_regs =3D s->reserved_regs; TCGRegSet dup_out_regs =3D tcg_op_defs[INDEX_op_dup_vec].args_ct[0].regs; + TCGReg oreg; =20 /* Make sure to not spill the input registers. */ if (!IS_DEAD_ARG(1) && itsl->val_type =3D=3D TEMP_VAL_REG) { @@ -3776,10 +3794,9 @@ static bool tcg_reg_alloc_dup2(TCGContext *s, const = TCGOp *op) tcg_regset_set_reg(allocated_regs, itsh->reg); } =20 - ots->reg =3D tcg_reg_alloc(s, dup_out_regs, allocated_regs, - op->output_pref[0], ots->indirect_base); - ots->val_type =3D TEMP_VAL_REG; - s->reg_to_temp[ots->reg] =3D ots; + oreg =3D tcg_reg_alloc(s, dup_out_regs, allocated_regs, + op->output_pref[0], ots->indirect_base); + set_temp_val_reg(s, ots, oreg); } =20 /* Promote dup2 of immediates to dupi_vec. */ @@ -3962,14 +3979,8 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp = *op) tcg_debug_assert(!temp_readonly(ts)); =20 reg =3D tcg_target_call_oarg_regs[i]; - tcg_debug_assert(s->reg_to_temp[reg] =3D=3D NULL); - if (ts->val_type =3D=3D TEMP_VAL_REG) { - s->reg_to_temp[ts->reg] =3D NULL; - } - ts->val_type =3D TEMP_VAL_REG; - ts->reg =3D reg; + set_temp_val_reg(s, ts, reg); ts->mem_coherent =3D 0; - s->reg_to_temp[reg] =3D ts; if (NEED_SYNC_ARG(i)) { temp_sync(s, ts, allocated_regs, 0, IS_DEAD_ARG(i)); } else if (IS_DEAD_ARG(i)) { --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926828; cv=none; d=zohomail.com; s=zohoarc; b=MkcJIgmfxSTB+xN9yTSigvIJOm/E9Ieip4einWabz1PJ2rBM6kZuL8Ot6Nu3y91uWBKOUXadiOE8jg0m7zVXNA6QVOmTQ3HuliBK2KEXQ6PcUyGgflC91S8wDpMmf8/dF2erQyOlOVbvg5jpNoMaMldie3ZCkUBUcNG9WlzBSsA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926828; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YysLimCJ4D81VkYcj5AOVk4+aaIq43s9xyiLUf2Ez/I=; b=gMLme3QwqT4msjfEOwx6rHRMNhlu9MRtgKl8MhJWRkrV0e+PGB8tJcPg9etHWY86Tjve8oV9FhccR92+ZF2zj1ol/gL/xtwTexTd3+BJpHtd4KvRwz0Vmj7RIqeRIyubFSQfAkC17wXW8xnMEjTeVxIy/3vJQwZNS6Ninvzk7Ao= 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 1671926828268713.0742223165903; Sat, 24 Dec 2022 16:07:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOq-0002Pz-62; Sat, 24 Dec 2022 18:57:56 -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 1p9EOb-0002MV-PV for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:41 -0500 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOa-0006Jk-3K for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:41 -0500 Received: by mail-pj1-x1036.google.com with SMTP id v13-20020a17090a6b0d00b00219c3be9830so7980936pjj.4 for ; Sat, 24 Dec 2022 15:57:39 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=YysLimCJ4D81VkYcj5AOVk4+aaIq43s9xyiLUf2Ez/I=; b=oklMrQiKiZtqTDMHBbEkbkjCZyzFNQluP2d/XAULyKELdebxNL4RoCaFxAz2gJ6y7M I5EnSD0FBN6zXZjYrLzScKTm1mDIj3bu66ar1Hquu+TaYziXtel4ULuGI5dlPNuqhlw9 6bPoXFhEN3WJHUJG0iAUUHUZPcLfSPrxCNDVLhF+X32e94cbnV8zxNnRoUD/OsLVmFF5 n0VTDzAG1oITnR1kPBiYXw0uSMm6P9dwYvK8GANggtx7tYsxrwywh9Pap3Gg/itRuxr3 Y0sGI94oPXCXGAWeuXNOFWHKlsfLiUbvsVbOGiuFDKSGMvxOin2/PVhRrDcqHVkNxRdc Oe+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=YysLimCJ4D81VkYcj5AOVk4+aaIq43s9xyiLUf2Ez/I=; b=Xe9/hvZSQVjn+8tRb3HUR6PB5ZaP1kf9bDige/r69uv5ifvzrWRswnkJt3zlia/fl4 S1rP2CxK2uWSHHfxn2JeY4F+av+3yu5GLHeAomhFr36p28l9VC5Tl7KD+nS1U/1OxLQA Q8Qpj+fysYowsY0LtPFunNHYeUib5gHlUSiCUUg8KRZxtgk90Bw29dP0RzuAShPi3G6e q5NLpn3pevdbyb/bbIv68+4h+Xu77MUpR5otGJCuv+5SJePGYmlRuIVzyJlCF0k9J1zU IukpceftWSwkWNXKH43SYyNIuCQdC45h2KtMF8qJrjYQJBAei8ucYs7AAJVgnx85Cbwa YZLg== X-Gm-Message-State: AFqh2krgw3NhGhWCcw5Wn2URzWrVl2OgaQG+zbL0ELFL9ffsIxBzDQAS W2bwtaJYmm+GG7L9LZK3DQFCmqD76EMk2YzG X-Google-Smtp-Source: AMrXdXtMUoloCSrm0SaNrWeCOdq3/LSGp4qrCWcrklLBsCKkEEu0d6IMr4up83rQVNa5Ga06WvNIKA== X-Received: by 2002:a17:902:ba93:b0:191:2c85:189f with SMTP id k19-20020a170902ba9300b001912c85189fmr14399202pls.69.1671926258805; Sat, 24 Dec 2022 15:57:38 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 17/43] tcg: Remove check_regs Date: Sat, 24 Dec 2022 15:56:54 -0800 Message-Id: <20221224235720.842093-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926829099100001 We now check the consistency of reg_to_temp[] with each update, so the utility of checking consistency at the end of each opcode is minimal. In addition, the form of this check is quite expensive, consuming 10% of a checking-enabled build. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- tcg/tcg.c | 76 ------------------------------------------------------- 1 file changed, 76 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index a1ae761a58..c330d114bc 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2900,79 +2900,6 @@ static bool liveness_pass_2(TCGContext *s) return changes; } =20 -#ifdef CONFIG_DEBUG_TCG -static void dump_regs(TCGContext *s) -{ - TCGTemp *ts; - int i; - char buf[64]; - - for(i =3D 0; i < s->nb_temps; i++) { - ts =3D &s->temps[i]; - printf(" %10s: ", tcg_get_arg_str_ptr(s, buf, sizeof(buf), ts)); - switch(ts->val_type) { - case TEMP_VAL_REG: - printf("%s", tcg_target_reg_names[ts->reg]); - break; - case TEMP_VAL_MEM: - printf("%d(%s)", (int)ts->mem_offset, - tcg_target_reg_names[ts->mem_base->reg]); - break; - case TEMP_VAL_CONST: - printf("$0x%" PRIx64, ts->val); - break; - case TEMP_VAL_DEAD: - printf("D"); - break; - default: - printf("???"); - break; - } - printf("\n"); - } - - for(i =3D 0; i < TCG_TARGET_NB_REGS; i++) { - if (s->reg_to_temp[i] !=3D NULL) { - printf("%s: %s\n", - tcg_target_reg_names[i], - tcg_get_arg_str_ptr(s, buf, sizeof(buf), s->reg_to_temp= [i])); - } - } -} - -static void check_regs(TCGContext *s) -{ - int reg; - int k; - TCGTemp *ts; - char buf[64]; - - for (reg =3D 0; reg < TCG_TARGET_NB_REGS; reg++) { - ts =3D s->reg_to_temp[reg]; - if (ts !=3D NULL) { - if (ts->val_type !=3D TEMP_VAL_REG || ts->reg !=3D reg) { - printf("Inconsistency for register %s:\n", - tcg_target_reg_names[reg]); - goto fail; - } - } - } - for (k =3D 0; k < s->nb_temps; k++) { - ts =3D &s->temps[k]; - if (ts->val_type =3D=3D TEMP_VAL_REG - && ts->kind !=3D TEMP_FIXED - && s->reg_to_temp[ts->reg] !=3D ts) { - printf("Inconsistency for temp %s:\n", - tcg_get_arg_str_ptr(s, buf, sizeof(buf), ts)); - fail: - printf("reg state:\n"); - dump_regs(s); - tcg_abort(); - } - } -} -#endif - static void temp_allocate_frame(TCGContext *s, TCGTemp *ts) { intptr_t off, size, align; @@ -4297,9 +4224,6 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb,= target_ulong pc_start) tcg_reg_alloc_op(s, op); break; } -#ifdef CONFIG_DEBUG_TCG - check_regs(s); -#endif /* Test for (pending) buffer overflow. The assumption is that any one operation beginning below the high water mark cannot overrun the buffer completely. Thus we can test for overflow after --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926489; cv=none; d=zohomail.com; s=zohoarc; b=dI2ptBaty/usg3WzZTyzHXWXRub/SaF8ax7RmYpZscBY2ZXxDqhzVU77GZydggkB/61NYjTvch22O9On/YgWwsORrN/ZwLJ+b7pkAXBJWcr8YSlfWarMxTzJPu5ByO5dXXjh42UmGZWLl4qChuBhui1ALoc6LmxJMbAQVKP/fAI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926489; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=82jdObgJZFzER9GFo6NlXKKdjvOyLg4xyhd1mr3KndA=; b=B8kvRfkz9zNvPl2GLtugj9vL8DB2m9iAEiB353Lk+uCXd151/0tPEJ0oQSQCs0lgbLMXXZCNpVZWxWSJg4DB/LpCA6/3Ak75o5xZdeFW3lU+fAYiJXbhD0dGalj3IHil8/mAsVSh8ptvKgwrrh3RGzOt4qVeTMRF7EcV5LVEXhk= 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 1671926489476728.1486214998262; Sat, 24 Dec 2022 16:01:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOk-0002O6-4a; Sat, 24 Dec 2022 18:57:50 -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 1p9EOc-0002Mx-GC for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:43 -0500 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOa-0006Jy-Qj for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:42 -0500 Received: by mail-pj1-x1032.google.com with SMTP id ge16so4312034pjb.5 for ; Sat, 24 Dec 2022 15:57:40 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=82jdObgJZFzER9GFo6NlXKKdjvOyLg4xyhd1mr3KndA=; b=ogTXLb5khCo7teRA/QW+ZSmHaFeBl9Di+gp+ylz7qgeOPWq+OXODwRbDUcCbuS7qsV A36RK+eFEDYA4bHmMHWULyeXV2m4Rj2dcxBM/F1dsg+83ykdOfKi3w7gg8kXzpaLl59V 7mZx82ERHhXYfv5ORT3pPIxfNX3jrJy8KUeAjAGUBeKA28Wmblncj9nzYXZVQl/D1rqG gohbCylrLcYrrfwAlBO17JsMvFlhqxyRj3+gCpwoKMXH4Ksq275xJRU/tXmti71m7QzO KGozd0BXCDFPZRZrzLufXJBX9OPfvMBxtIjhpSHWUs10q2/jAPRvOU8xfk4HIneHK+uE gP1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=82jdObgJZFzER9GFo6NlXKKdjvOyLg4xyhd1mr3KndA=; b=pDPP21emZA2380XZKsDupo2jSoHz0/psNSkuaT8yDYLoXYJm/O2lfyju/Z2KQZeaiF 02RKcz7hMSGqD/sO2NgOofQ0S4UEfNd//Z76kKbYTLQ467br+raxgJ6m+bgd9WVmhrV8 OptFQtTRuJVpmyu+OTlhXwob1UmcHDfzhXqOimd8KYXWb4vI7YsQB0KjwgSaJKGJObma fR6oeCofqJrDrexYbo19scda39dUyOWxpJETF2BVp5c2z5Pqje+Ud4c4RnlmQVVQIeTr DuM03Dmc/9MnaxhwY2TIbtpG+FYOF3gKAkbXs4VTbjUCWbYya7CVKK98lbOJp0bgULqn XXFQ== X-Gm-Message-State: AFqh2kpaEaL1YniIxakdzt2foeJkYQ2R1Mil4a9wtrjmYGIXtNSx2Ib0 eSJPrdWpp/81j+e6FSBZj0/n2FNyDtM0/Fr2 X-Google-Smtp-Source: AMrXdXvSB6MtmZ0KyX34nXUn3vVIil+rPZkIdKbO3uGBfihDaxcw26yj6GyRb9WB1UfpDMKWgGZoTQ== X-Received: by 2002:a17:902:ab4e:b0:186:fb8d:f4d3 with SMTP id ij14-20020a170902ab4e00b00186fb8df4d3mr15552560plb.5.1671926259614; Sat, 24 Dec 2022 15:57:39 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 18/43] tcg: Massage process_op_defs() Date: Sat, 24 Dec 2022 15:56:55 -0800 Message-Id: <20221224235720.842093-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926491810100003 From: Philippe Mathieu-Daud=C3=A9 In preparation of introducing paired registers, massage a bit process_op_defs()'s switch case. Signed-off-by: Richard Henderson [PMD: Split from bigger patch, 1/3] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20221219220925.79218-2-philmd@linaro.org> --- tcg/tcg.c | 61 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index c330d114bc..92141bd79a 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2012,7 +2012,7 @@ static void process_op_defs(TCGContext *s) for (op =3D 0; op < NB_OPS; op++) { TCGOpDef *def =3D &tcg_op_defs[op]; const TCGTargetOpDef *tdefs; - int i, nb_args; + int i, o, nb_args; =20 if (def->flags & TCG_OPF_NOT_PRESENT) { continue; @@ -2034,53 +2034,60 @@ static void process_op_defs(TCGContext *s) =20 for (i =3D 0; i < nb_args; i++) { const char *ct_str =3D tdefs->args_ct_str[i]; + bool input_p =3D i >=3D def->nb_oargs; + /* Incomplete TCGTargetOpDef entry. */ tcg_debug_assert(ct_str !=3D NULL); =20 - while (*ct_str !=3D '\0') { - switch(*ct_str) { - case '0' ... '9': - { - int oarg =3D *ct_str - '0'; - tcg_debug_assert(ct_str =3D=3D tdefs->args_ct_str[= i]); - tcg_debug_assert(oarg < def->nb_oargs); - tcg_debug_assert(def->args_ct[oarg].regs !=3D 0); - def->args_ct[i] =3D def->args_ct[oarg]; - /* The output sets oalias. */ - def->args_ct[oarg].oalias =3D true; - def->args_ct[oarg].alias_index =3D i; - /* The input sets ialias. */ - def->args_ct[i].ialias =3D true; - def->args_ct[i].alias_index =3D oarg; - } - ct_str++; - break; - case '&': - def->args_ct[i].newreg =3D true; - ct_str++; - break; + switch (*ct_str) { + case '0' ... '9': + o =3D *ct_str - '0'; + tcg_debug_assert(input_p); + tcg_debug_assert(o < def->nb_oargs); + tcg_debug_assert(def->args_ct[o].regs !=3D 0); + tcg_debug_assert(!def->args_ct[o].oalias); + def->args_ct[i] =3D def->args_ct[o]; + /* The output sets oalias. */ + def->args_ct[o].oalias =3D 1; + def->args_ct[o].alias_index =3D i; + /* The input sets ialias. */ + def->args_ct[i].ialias =3D 1; + def->args_ct[i].alias_index =3D o; + tcg_debug_assert(ct_str[1] =3D=3D '\0'); + continue; + + case '&': + tcg_debug_assert(!input_p); + def->args_ct[i].newreg =3D true; + ct_str++; + break; + } + + do { + switch (*ct_str) { case 'i': def->args_ct[i].ct |=3D TCG_CT_CONST; - ct_str++; break; =20 /* Include all of the target-specific constraints. */ =20 #undef CONST #define CONST(CASE, MASK) \ - case CASE: def->args_ct[i].ct |=3D MASK; ct_str++; break; + case CASE: def->args_ct[i].ct |=3D MASK; break; #define REGS(CASE, MASK) \ - case CASE: def->args_ct[i].regs |=3D MASK; ct_str++; break; + case CASE: def->args_ct[i].regs |=3D MASK; break; =20 #include "tcg-target-con-str.h" =20 #undef REGS #undef CONST default: + case '0' ... '9': + case '&': /* Typo in TCGTargetOpDef constraint. */ g_assert_not_reached(); } - } + } while (*++ct_str !=3D '\0'); } =20 /* TCGTargetOpDef entry with too much information? */ --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671927252; cv=none; d=zohomail.com; s=zohoarc; b=O0u/Zt71Qav49ieu/WmKOjKF8JM599SVdv2og7pQh0Q34B/OuP7ovEzfZG4x7ELn51ZfX6dUmA4RYTZ1oXoq7CxmFQbTUF9los2kdM5kC4hHI3I4MbR+SQISuIDewY35atRzMgXKy+UihK3XWcF4o4Io5pEqbRyE+tJdhw/CbXU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671927252; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IblgsuTkBYo62wnQem3s+YTquxd8zyPsw8gkaMKFZiQ=; b=UMS3upFc2P8zk1EtnJ3lLqV1kB+BUAxeJfySyKg6sHZw34/vA3Su1+79hVZeDAbl5zwjVyove8TrulWouUuhWcByX/Vz90unLxtGbTokK7fVmweyqtUGrY4UMzZGBVsbqneN/pGC/bAu2YsMLQ4SkvUZ33s8Hb9H166GX3AZcvY= 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 1671927252224375.65907454200965; Sat, 24 Dec 2022 16:14:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EP3-0002rO-FG; Sat, 24 Dec 2022 18:58:09 -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 1p9EOf-0002NO-Mb for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:46 -0500 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOc-0006KE-GI for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:44 -0500 Received: by mail-pl1-x633.google.com with SMTP id m4so8047198pls.4 for ; Sat, 24 Dec 2022 15:57:42 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=IblgsuTkBYo62wnQem3s+YTquxd8zyPsw8gkaMKFZiQ=; b=edDcdU4NeQW4P4ezQvS8MwgA8rNUNATqW6mAUIkPnQNX4Rr6QM2VOZtqhp+kI2tt8s jw+cH4wcnlh0zztQR41JgOQ7BhX56vjYRlk5HaL2XALICcyqqcKrNy2X5YyHJsoP4qDg ipkApgxkepa5NcPQqFyiqORZaQw+2NHrDAaUmPwMG3GOOmTaF9pDqMBksxGDf4vl7D3d CTYDChMBOxP42h1FZaeDJTCUkR3bpngbpTSIFrsHBx6ZhC5pKPEeSuYgVG+W3FKQg8gI oUNOgk2dFz98qSoKnlVkiDfqbc5IrEabYcJQ3FuvSMufmPpo6HKDwzW52LPs7++JenPs mbzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=IblgsuTkBYo62wnQem3s+YTquxd8zyPsw8gkaMKFZiQ=; b=Ww18fKYBMl2VyYs3kWhAr3pBEKHRWgOVEho/KrezbK4aya8r0A+ZKU6Dzc9XR/jUC4 jl955vkWnDP2ImAkE8v42nz0cUV/EYFp92xbtQ7PIZI9z0zFLBr/iaaQ5dvqx9pfYT8S ms5VxDgzUAqhyEAg7MPI9eEcit6ldKYyrWKSvVGfLefusXk5kGBNfymcbBgAYd+Ds37Y 05N0b9yqyo3Qa6466OKkQBno9ciQignt4KMwdKbTsDH1og3xtixCooXNyDYudDx9+dEm wJJmmuUihRjaSjuIj9025TVyZF+2JTQjdBRldeC7Bnmgsn42gjcY5kVv9l3Ugdg+B2LQ Npyg== X-Gm-Message-State: AFqh2kri7NGgQQuN1wytWIE0PMOL1cR4t9mkO9S6eS7YKZSwt2D/QGcl eoIAAg4bYXT9up9zOp7EEZgTI1K5UAyATXok X-Google-Smtp-Source: AMrXdXtH/e/UCzqfijoGth1X44FA6+zA2CB6d6aOiU9dJekXKVJ9oDZ56jq0JPPTTs1Xdj0WIvJMFw== X-Received: by 2002:a17:902:8a8f:b0:192:6ec9:5cf6 with SMTP id p15-20020a1709028a8f00b001926ec95cf6mr2063207plo.8.1671926260735; Sat, 24 Dec 2022 15:57:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 19/43] tcg: Introduce paired register allocation Date: Sat, 24 Dec 2022 15:56:56 -0800 Message-Id: <20221224235720.842093-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> MIME-Version: 1.0 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::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671927253067100001 Content-Type: text/plain; charset="utf-8" There are several instances where we need to be able to allocate a pair of registers to related inputs/outputs. Add 'p' and 'm' register constraints for this, in order to be able to allocate the even/odd register first or second. Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 2 + tcg/tcg.c | 416 ++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 370 insertions(+), 48 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index d84bae6e3f..5c2254ce9f 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -951,6 +951,8 @@ typedef struct TCGArgConstraint { unsigned ct : 16; unsigned alias_index : 4; unsigned sort_index : 4; + unsigned pair_index : 4; + unsigned pair : 2; /* 0: none, 1: first, 2: second, 3: second alias */ bool oalias : 1; bool ialias : 1; bool newreg : 1; diff --git a/tcg/tcg.c b/tcg/tcg.c index 92141bd79a..98d51e538c 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1969,15 +1969,32 @@ static void tcg_dump_ops(TCGContext *s, FILE *f, bo= ol have_prefs) static int get_constraint_priority(const TCGOpDef *def, int k) { const TCGArgConstraint *arg_ct =3D &def->args_ct[k]; - int n; + int n =3D ctpop64(arg_ct->regs); =20 - if (arg_ct->oalias) { - /* an alias is equivalent to a single register */ - n =3D 1; - } else { - n =3D ctpop64(arg_ct->regs); + /* + * Sort constraints of a single register first, which includes output + * aliases (which must exactly match the input already allocated). + */ + if (n =3D=3D 1 || arg_ct->oalias) { + return INT_MAX; } - return TCG_TARGET_NB_REGS - n + 1; + + /* + * Sort register pairs next, first then second immediately after. + * Arbitrarily sort multiple pairs by the index of the first reg; + * there shouldn't be many pairs. + */ + switch (arg_ct->pair) { + case 1: + case 3: + return (k + 1) * 2; + case 2: + return (arg_ct->pair_index + 1) * 2 - 1; + } + + /* Finally, sort by decreasing register count. */ + assert(n > 1); + return -n; } =20 /* sort from highest priority to lowest */ @@ -2012,7 +2029,8 @@ static void process_op_defs(TCGContext *s) for (op =3D 0; op < NB_OPS; op++) { TCGOpDef *def =3D &tcg_op_defs[op]; const TCGTargetOpDef *tdefs; - int i, o, nb_args; + bool saw_alias_pair =3D false; + int i, o, i2, o2, nb_args; =20 if (def->flags & TCG_OPF_NOT_PRESENT) { continue; @@ -2053,6 +2071,9 @@ static void process_op_defs(TCGContext *s) /* The input sets ialias. */ def->args_ct[i].ialias =3D 1; def->args_ct[i].alias_index =3D o; + if (def->args_ct[i].pair) { + saw_alias_pair =3D true; + } tcg_debug_assert(ct_str[1] =3D=3D '\0'); continue; =20 @@ -2061,6 +2082,38 @@ static void process_op_defs(TCGContext *s) def->args_ct[i].newreg =3D true; ct_str++; break; + + case 'p': /* plus */ + /* Allocate to the register after the previous. */ + tcg_debug_assert(i > (input_p ? def->nb_oargs : 0)); + o =3D i - 1; + tcg_debug_assert(!def->args_ct[o].pair); + tcg_debug_assert(!def->args_ct[o].ct); + def->args_ct[i] =3D (TCGArgConstraint){ + .pair =3D 2, + .pair_index =3D o, + .regs =3D def->args_ct[o].regs << 1, + }; + def->args_ct[o].pair =3D 1; + def->args_ct[o].pair_index =3D i; + tcg_debug_assert(ct_str[1] =3D=3D '\0'); + continue; + + case 'm': /* minus */ + /* Allocate to the register before the previous. */ + tcg_debug_assert(i > (input_p ? def->nb_oargs : 0)); + o =3D i - 1; + tcg_debug_assert(!def->args_ct[o].pair); + tcg_debug_assert(!def->args_ct[o].ct); + def->args_ct[i] =3D (TCGArgConstraint){ + .pair =3D 1, + .pair_index =3D o, + .regs =3D def->args_ct[o].regs >> 1, + }; + def->args_ct[o].pair =3D 2; + def->args_ct[o].pair_index =3D i; + tcg_debug_assert(ct_str[1] =3D=3D '\0'); + continue; } =20 do { @@ -2084,6 +2137,8 @@ static void process_op_defs(TCGContext *s) default: case '0' ... '9': case '&': + case 'p': + case 'm': /* Typo in TCGTargetOpDef constraint. */ g_assert_not_reached(); } @@ -2093,6 +2148,79 @@ static void process_op_defs(TCGContext *s) /* TCGTargetOpDef entry with too much information? */ tcg_debug_assert(i =3D=3D TCG_MAX_OP_ARGS || tdefs->args_ct_str[i]= =3D=3D NULL); =20 + /* + * Fix up output pairs that are aliased with inputs. + * When we created the alias, we copied pair from the output. + * There are three cases: + * (1a) Pairs of inputs alias pairs of outputs. + * (1b) One input aliases the first of a pair of outputs. + * (2) One input aliases the second of a pair of outputs. + * + * Case 1a is handled by making sure that the pair_index'es are + * properly updated so that they appear the same as a pair of inpu= ts. + * + * Case 1b is handled by setting the pair_index of the input to + * itself, simply so it doesn't point to an unrelated argument. + * Since we don't encounter the "second" during the input allocati= on + * phase, nothing happens with the second half of the input pair. + * + * Case 2 is handled by setting the second input to pair=3D3, the + * first output to pair=3D3, and the pair_index'es to match. + */ + if (saw_alias_pair) { + for (i =3D def->nb_oargs; i < nb_args; i++) { + /* + * Since [0-9pm] must be alone in the constraint string, + * the only way they can both be set is if the pair comes + * from the output alias. + */ + if (!def->args_ct[i].ialias) { + continue; + } + switch (def->args_ct[i].pair) { + case 0: + break; + case 1: + o =3D def->args_ct[i].alias_index; + o2 =3D def->args_ct[o].pair_index; + tcg_debug_assert(def->args_ct[o].pair =3D=3D 1); + tcg_debug_assert(def->args_ct[o2].pair =3D=3D 2); + if (def->args_ct[o2].oalias) { + /* Case 1a */ + i2 =3D def->args_ct[o2].alias_index; + tcg_debug_assert(def->args_ct[i2].pair =3D=3D 2); + def->args_ct[i2].pair_index =3D i; + def->args_ct[i].pair_index =3D i2; + } else { + /* Case 1b */ + def->args_ct[i].pair_index =3D i; + } + break; + case 2: + o =3D def->args_ct[i].alias_index; + o2 =3D def->args_ct[o].pair_index; + tcg_debug_assert(def->args_ct[o].pair =3D=3D 2); + tcg_debug_assert(def->args_ct[o2].pair =3D=3D 1); + if (def->args_ct[o2].oalias) { + /* Case 1a */ + i2 =3D def->args_ct[o2].alias_index; + tcg_debug_assert(def->args_ct[i2].pair =3D=3D 1); + def->args_ct[i2].pair_index =3D i; + def->args_ct[i].pair_index =3D i2; + } else { + /* Case 2 */ + def->args_ct[i].pair =3D 3; + def->args_ct[o2].pair =3D 3; + def->args_ct[i].pair_index =3D o2; + def->args_ct[o2].pair_index =3D i; + } + break; + default: + g_assert_not_reached(); + } + } + } + /* sort the constraints (XXX: this is just an heuristic) */ sort_constraints(def, 0, def->nb_oargs); sort_constraints(def, def->nb_oargs, def->nb_iargs); @@ -3141,6 +3269,52 @@ static TCGReg tcg_reg_alloc(TCGContext *s, TCGRegSet= required_regs, tcg_abort(); } =20 +static TCGReg tcg_reg_alloc_pair(TCGContext *s, TCGRegSet required_regs, + TCGRegSet allocated_regs, + TCGRegSet preferred_regs, bool rev) +{ + int i, j, k, fmin, n =3D ARRAY_SIZE(tcg_target_reg_alloc_order); + TCGRegSet reg_ct[2]; + const int *order; + + /* Ensure that if I is not in allocated_regs, I+1 is not either. */ + reg_ct[1] =3D required_regs & ~(allocated_regs | (allocated_regs >> 1)= ); + tcg_debug_assert(reg_ct[1] !=3D 0); + reg_ct[0] =3D reg_ct[1] & preferred_regs; + + order =3D rev ? indirect_reg_alloc_order : tcg_target_reg_alloc_order; + + /* + * Skip the preferred_regs option if it cannot be satisfied, + * or if the preference made no difference. + */ + k =3D reg_ct[0] =3D=3D 0 || reg_ct[0] =3D=3D reg_ct[1]; + + /* + * Minimize the number of flushes by looking for 2 free registers firs= t, + * then a single flush, then two flushes. + */ + for (fmin =3D 2; fmin >=3D 0; fmin--) { + for (j =3D k; j < 2; j++) { + TCGRegSet set =3D reg_ct[j]; + + for (i =3D 0; i < n; i++) { + TCGReg reg =3D order[i]; + + if (tcg_regset_test_reg(set, reg)) { + int f =3D !s->reg_to_temp[reg] + !s->reg_to_temp[reg += 1]; + if (f >=3D fmin) { + tcg_reg_free(s, reg, allocated_regs); + tcg_reg_free(s, reg + 1, allocated_regs); + return reg; + } + } + } + } + } + tcg_abort(); +} + /* Make sure the temporary is in a register. If needed, allocate the regi= ster from DESIRED while avoiding ALLOCATED. */ static void temp_load(TCGContext *s, TCGTemp *ts, TCGRegSet desired_regs, @@ -3550,8 +3724,10 @@ static void tcg_reg_alloc_op(TCGContext *s, const TC= GOp *op) =20 /* satisfy input constraints */ for (k =3D 0; k < nb_iargs; k++) { - TCGRegSet i_preferred_regs; - bool allocate_new_reg; + TCGRegSet i_preferred_regs, i_required_regs; + bool allocate_new_reg, copyto_new_reg; + TCGTemp *ts2; + int i1, i2; =20 i =3D def->args_ct[nb_oargs + k].sort_index; arg =3D op->args[i]; @@ -3568,43 +3744,156 @@ static void tcg_reg_alloc_op(TCGContext *s, const = TCGOp *op) =20 reg =3D ts->reg; i_preferred_regs =3D 0; + i_required_regs =3D arg_ct->regs; allocate_new_reg =3D false; + copyto_new_reg =3D false; =20 - if (arg_ct->ialias) { + switch (arg_ct->pair) { + case 0: /* not paired */ + if (arg_ct->ialias) { + i_preferred_regs =3D op->output_pref[arg_ct->alias_index]; + + /* + * If the input is not dead after the instruction, + * we must allocate a new register and move it. + */ + if (!IS_DEAD_ARG(i)) { + allocate_new_reg =3D true; + } else if (ts->val_type =3D=3D TEMP_VAL_REG) { + /* + * Check if the current register has already been + * allocated for another input. + */ + allocate_new_reg =3D + tcg_regset_test_reg(i_allocated_regs, reg); + } + } + if (!allocate_new_reg) { + temp_load(s, ts, i_required_regs, i_allocated_regs, + i_preferred_regs); + reg =3D ts->reg; + allocate_new_reg =3D !tcg_regset_test_reg(i_required_regs,= reg); + } + if (allocate_new_reg) { + /* + * Allocate a new register matching the constraint + * and move the temporary register into it. + */ + temp_load(s, ts, tcg_target_available_regs[ts->type], + i_allocated_regs, 0); + reg =3D tcg_reg_alloc(s, i_required_regs, i_allocated_regs, + i_preferred_regs, ts->indirect_base); + copyto_new_reg =3D true; + } + break; + + case 1: + /* First of an input pair; if i1 =3D=3D i2, the second is an o= utput. */ + i1 =3D i; + i2 =3D arg_ct->pair_index; + ts2 =3D i1 !=3D i2 ? arg_temp(op->args[i2]) : NULL; + + /* + * It is easier to default to allocating a new pair + * and to identify a few cases where it's not required. + */ + if (arg_ct->ialias) { + i_preferred_regs =3D op->output_pref[arg_ct->alias_index]; + if (IS_DEAD_ARG(i1) && + IS_DEAD_ARG(i2) && + ts->val_type =3D=3D TEMP_VAL_REG && + ts->reg < TCG_TARGET_NB_REGS - 1 && + tcg_regset_test_reg(i_required_regs, reg) && + !tcg_regset_test_reg(i_allocated_regs, reg) && + !tcg_regset_test_reg(i_allocated_regs, reg + 1) && + (ts2 + ? ts2->val_type =3D=3D TEMP_VAL_REG && + ts2->reg =3D=3D reg + 1 + : s->reg_to_temp[reg + 1] =3D=3D NULL)) { + break; + } + } else { + /* Without aliasing, the pair must also be an input. */ + tcg_debug_assert(ts2); + if (ts->val_type =3D=3D TEMP_VAL_REG && + ts2->val_type =3D=3D TEMP_VAL_REG && + ts2->reg =3D=3D reg + 1 && + tcg_regset_test_reg(i_required_regs, reg)) { + break; + } + } + reg =3D tcg_reg_alloc_pair(s, i_required_regs, i_allocated_reg= s, + 0, ts->indirect_base); + goto do_pair; + + case 2: /* pair second */ + reg =3D new_args[arg_ct->pair_index] + 1; + goto do_pair; + + case 3: /* ialias with second output, no first input */ + tcg_debug_assert(arg_ct->ialias); i_preferred_regs =3D op->output_pref[arg_ct->alias_index]; =20 - /* - * If the input is readonly, then it cannot also be an - * output and aliased to itself. If the input is not - * dead after the instruction, we must allocate a new - * register and move it. - */ - if (temp_readonly(ts) || !IS_DEAD_ARG(i)) { - allocate_new_reg =3D true; - } else if (ts->val_type =3D=3D TEMP_VAL_REG) { - /* - * Check if the current register has already been - * allocated for another input. - */ - allocate_new_reg =3D tcg_regset_test_reg(i_allocated_regs,= reg); + if (IS_DEAD_ARG(i) && + ts->val_type =3D=3D TEMP_VAL_REG && + reg > 0 && + s->reg_to_temp[reg - 1] =3D=3D NULL && + tcg_regset_test_reg(i_required_regs, reg) && + !tcg_regset_test_reg(i_allocated_regs, reg) && + !tcg_regset_test_reg(i_allocated_regs, reg - 1)) { + tcg_regset_set_reg(i_allocated_regs, reg - 1); + break; } - } + reg =3D tcg_reg_alloc_pair(s, i_required_regs >> 1, + i_allocated_regs, 0, + ts->indirect_base); + tcg_regset_set_reg(i_allocated_regs, reg); + reg +=3D 1; + goto do_pair; =20 - if (!allocate_new_reg) { - temp_load(s, ts, arg_ct->regs, i_allocated_regs, i_preferred_r= egs); - reg =3D ts->reg; - allocate_new_reg =3D !tcg_regset_test_reg(arg_ct->regs, reg); - } - - if (allocate_new_reg) { + do_pair: /* - * Allocate a new register matching the constraint - * and move the temporary register into it. + * If an aliased input is not dead after the instruction, + * we must allocate a new register and move it. */ - temp_load(s, ts, tcg_target_available_regs[ts->type], - i_allocated_regs, 0); - reg =3D tcg_reg_alloc(s, arg_ct->regs, i_allocated_regs, - i_preferred_regs, ts->indirect_base); + if (arg_ct->ialias && !IS_DEAD_ARG(i)) { + /* + * Because of the alias, and the continued life, make sure + * that the temp is somewhere *other* than reg, and we get + * a copy in reg. + */ + tcg_regset_set_reg(i_allocated_regs, reg); + if (ts->val_type =3D=3D TEMP_VAL_REG && ts->reg =3D=3D reg= ) { + /* If ts was already in reg, copy it somewhere else. */ + TCGReg nr; + bool ok; + + tcg_debug_assert(ts->kind !=3D TEMP_FIXED); + nr =3D tcg_reg_alloc(s, tcg_target_available_regs[ts->= type], + i_allocated_regs, 0, ts->indirect_b= ase); + ok =3D tcg_out_mov(s, ts->type, nr, reg); + tcg_debug_assert(ok); + + set_temp_val_reg(s, ts, nr); + } else { + temp_load(s, ts, tcg_target_available_regs[ts->type], + i_allocated_regs, 0); + copyto_new_reg =3D true; + } + } else { + /* Preferably allocate to reg, otherwise copy. */ + i_required_regs =3D (TCGRegSet)1 << reg; + temp_load(s, ts, i_required_regs, i_allocated_regs, + i_preferred_regs); + copyto_new_reg =3D ts->reg !=3D reg; + } + break; + + default: + g_assert_not_reached(); + } + + if (copyto_new_reg) { if (!tcg_out_mov(s, ts->type, reg, ts->reg)) { /* * Cross register class move not supported. Sync the @@ -3656,15 +3945,46 @@ static void tcg_reg_alloc_op(TCGContext *s, const T= CGOp *op) /* ENV should not be modified. */ tcg_debug_assert(!temp_readonly(ts)); =20 - if (arg_ct->oalias && !const_args[arg_ct->alias_index]) { - reg =3D new_args[arg_ct->alias_index]; - } else if (arg_ct->newreg) { - reg =3D tcg_reg_alloc(s, arg_ct->regs, - i_allocated_regs | o_allocated_regs, - op->output_pref[k], ts->indirect_base); - } else { - reg =3D tcg_reg_alloc(s, arg_ct->regs, o_allocated_regs, - op->output_pref[k], ts->indirect_base); + switch (arg_ct->pair) { + case 0: /* not paired */ + if (arg_ct->oalias && !const_args[arg_ct->alias_index]) { + reg =3D new_args[arg_ct->alias_index]; + } else if (arg_ct->newreg) { + reg =3D tcg_reg_alloc(s, arg_ct->regs, + i_allocated_regs | o_allocated_reg= s, + op->output_pref[k], ts->indirect_b= ase); + } else { + reg =3D tcg_reg_alloc(s, arg_ct->regs, o_allocated_reg= s, + op->output_pref[k], ts->indirect_b= ase); + } + break; + + case 1: /* first of pair */ + tcg_debug_assert(!arg_ct->newreg); + if (arg_ct->oalias) { + reg =3D new_args[arg_ct->alias_index]; + break; + } + reg =3D tcg_reg_alloc_pair(s, arg_ct->regs, o_allocated_re= gs, + op->output_pref[k], ts->indirect_= base); + break; + + case 2: /* second of pair */ + tcg_debug_assert(!arg_ct->newreg); + if (arg_ct->oalias) { + reg =3D new_args[arg_ct->alias_index]; + } else { + reg =3D new_args[arg_ct->pair_index] + 1; + } + break; + + case 3: /* first of pair, aliasing with a second input */ + tcg_debug_assert(!arg_ct->newreg); + reg =3D new_args[arg_ct->pair_index] - 1; + break; + + default: + g_assert_not_reached(); } tcg_regset_set_reg(o_allocated_regs, reg); set_temp_val_reg(s, ts, reg); --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671927302; cv=none; d=zohomail.com; s=zohoarc; b=GUrBsWzMVIBZQXciOs2xR2LnfS51LRTtR7vsRqV3qvhsEa9vHZc4ePIfDTj1KZkkP8sDeLZURt91IpQGExeHOUs6zvgrdl/Zi2IPZxqeR4BzmxjyOYNPpQvbruB7U/6Vd22Ewse+mQiU1rgx3/2kC4Dtbnt6axsPyZ8UfVBeSbE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671927302; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0A7BGyHqAN6alhYKfJ9E1yLwyik0pT3tSjb2m0LkGsk=; b=bMmGXJLxXNg6lxF1DO+nVDG8Oq9otJtkeixiiWrwYm30DZhzAXGOILlC6Ca2M22zvWeOrv0aa8SPOLpDq/HjfCPDZvVcfZHmG0nH6H9GYD6z6+EmBs48e3a0bcAZSnHBtO1OUTHiSd8G1e59TtUS+s+6VPbLj/DRLHfSbLOyK5g= 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 1671927302253546.6280070342888; Sat, 24 Dec 2022 16:15:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOm-0002Og-6z; Sat, 24 Dec 2022 18:57:52 -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 1p9EOe-0002NH-KZ for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:46 -0500 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOd-0006KL-24 for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:44 -0500 Received: by mail-pj1-x1035.google.com with SMTP id v23so7961343pju.3 for ; Sat, 24 Dec 2022 15:57:42 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=0A7BGyHqAN6alhYKfJ9E1yLwyik0pT3tSjb2m0LkGsk=; b=DAU9YZa/cEeLYK2mQvOl6NTOgvaHDxTjM2F5b8YSdt9krfSOLSOUTXIH2pJ5fPqb/d VOz3XoZuTARIZZ21MSxoUko7b8DUu26jaPaOwW238CJPPpFXjgUX1Vh/tL+Whs2aRjni 8cVwHpBA7CJ1z9s7BGsxVJNy9ih/I55eAXhxpgpvwsoJnSqasgHFJ3bozxjMyUkZB1fc dtGmpu77UtdJc0LOy3rddtk2hNuknc27furVB+/qboSa1piwXic449O37pqORuCWHFq6 ippErLrRpr0V/+HMxOxO0NeOJMxzON3I3qajB4SoD3LWpgCeUg1IcHYGCaicHKP5lOTE Q4BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=0A7BGyHqAN6alhYKfJ9E1yLwyik0pT3tSjb2m0LkGsk=; b=EiZ3Px6QgY7UK1Vu7carAPQVP3x+sT223Ge4bUEqjqCvlr7/jKXqV0ebVuVUQMBlcl H9AL5hV7woYDoxYhDdF6RnY4bXBoNUbk/dsxhSs3my3kAGrIdMOamS6CEdYPFqooRAtB 4y24O0L5fCBA+4CZ1KolqN01CZfxMDJYUWRgwgwsOgRVUIarI9z/ZTw+nyWzQcEzV55O NBrl2atq+UEReYZyxTSOLyhKhFQ8O3XthMYTFUTftr/knRl6Y5/Hn0lRFeHaKYs1fIIu Agt+bBGAh5aY0nxjg8sAz5kk77jy9nXAQrESIAwJ939Zw2dsjoy6ZCYqmL/GA7BSWAzg dzRA== X-Gm-Message-State: AFqh2kpN8kh967FhI2/n0OdWfMpc69rdrY99SXfuJidg7btQRmnTDfbE 6xsJ7Nz+CvZEBjIs1kyrd1lIV1XHMGO6hphu X-Google-Smtp-Source: AMrXdXsZzkzlvGAa/OeQrp7U5Lpvttl7w2exA0t0SGrHcCu+jvv8HCGkZ7z7NS7+hICR/GYSbXr0Cg== X-Received: by 2002:a17:902:e54f:b0:187:49e0:4ab with SMTP id n15-20020a170902e54f00b0018749e004abmr21813308plf.4.1671926261631; Sat, 24 Dec 2022 15:57:41 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 20/43] accel/tcg: Set cflags_next_tb in cpu_common_initfn Date: Sat, 24 Dec 2022 15:56:57 -0800 Message-Id: <20221224235720.842093-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671927303134100009 While we initialize this value in cpu_common_reset, that isn't called during startup, so set it as well in init. This fixes -singlestep versus the very first TB. Fixes: 04f5b647ed07 ("accel/tcg: Handle -singlestep in curr_cflags") Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- hw/core/cpu-common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 78b5f350a0..b177e761f0 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -235,6 +235,7 @@ static void cpu_common_initfn(Object *obj) /* the default value is changed by qemu_init_vcpu() for softmmu */ cpu->nr_cores =3D 1; cpu->nr_threads =3D 1; + cpu->cflags_next_tb =3D -1; =20 qemu_mutex_init(&cpu->work_mutex); QSIMPLEQ_INIT(&cpu->work_list); --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926839; cv=none; d=zohomail.com; s=zohoarc; b=V+Th1ZI5y+LavsMjKBZII6VC1FCdQEwyft6G4v1wvSiezJVoBCKKAnQn6O8ccdQLrnOnXmsJz7LvTP3KYPloSrC4T/9ITeCF5yH4qk5tj8dAlwT/yIEn6ETfKfYcnuUSXwmQ72Ri7fsiYOOKXO/zaC9ocpfWvZZigb74dWI7S0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926839; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kWUlisroi1Ap5EswxjI+i9O+kMNxYO+3kWUIW10W2to=; b=Iw1cNJ0Wb88tuaAFW5Icad2mfsuXSqz0dVh+82K4C6PNPk8Keq0o3JQeTFaC6NqIz1Vz0iGPICCN/IEaROxEHY8eIZb/N235Y1CyTbpkyR0yRgJgrabdtoZHXi/nRvLH94He07Q37Gt6ClR01Ig5RObSPg0PIPxwsbSVdFVchz0= 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 1671926839293430.3446655569038; Sat, 24 Dec 2022 16:07:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOq-0002Qw-DL; Sat, 24 Dec 2022 18:57:58 -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 1p9EOf-0002NP-Qz for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:46 -0500 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOe-0006Gr-26 for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:45 -0500 Received: by mail-pl1-x62f.google.com with SMTP id 19so1058145plo.12 for ; Sat, 24 Dec 2022 15:57:42 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=kWUlisroi1Ap5EswxjI+i9O+kMNxYO+3kWUIW10W2to=; b=ZFn9REsLeDmdOxsY+pgtCmb2TdoWk7ZrYIakl5r9adzBKtnegedZK/Ibd5VAo+ZMYL Zz6mixJxw/zpqJPvA4nnIM5S9a9sxvSUIfxsRd0W8MHKzd8QK2NoM6IKszFLB3yx+ddR dErxACwGeaorC0RD4Qharlw1qbPrxHTlpETTXjGH5OFMbzG/l6pg3EpyGc79zYIVjdjN tkqXuIhzAw2iA1xzpo2pUow9rC/YoXyvbyk09U5TCXYRYwtxcmMwIK8Yqip6zr5srzPI sckg5gYdH03wLovHfwm1fBvQyosnOoITB4HnD+codAFKHDlgApw5yb+vDK/MNZI26gKT D8xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=kWUlisroi1Ap5EswxjI+i9O+kMNxYO+3kWUIW10W2to=; b=i7FwH5qrb/nfzinELp/3U9key64CCZMzPMsLhP+dKtTQDS5Q1SsMPKyEHHZfk121JZ oGXK6dsiupQ+OKWI2mIDXrzeSSURJBJDYKT/17qE+ogyOgW8C065o3yWnLeToVvyNZiq 8Q7fqVAqDooXXU4V6dQWyIew2BfQn5do/C30idQlj4BZdS4ikXpWdu7QR4k+WhXR6Bo0 HiElFjdzi5HxgpIuFYHVgzOW2sY+rcP9VtrJ54W3UvQOVMpPG1muWQBF3n59ul9fkvIs R84c1odRRay+711ENJ5pznDcYFV+V5pyP/DENEDbBdSHUEZdKlPOTk2C/THXaVi/2z7S qzGQ== X-Gm-Message-State: AFqh2krVd9RlnskgOMMQAMr3JqpNqs2/yxPKUHcaIswVUS1X16q0e5d3 ztZamCsAnuHttOmIg2Z3rrn1fM7mi0vIC54Z X-Google-Smtp-Source: AMrXdXsrN/OBAJ4LaEZXiEuEK3WKNcheH4s+STt6pJ1xwDNjICXCKttBy6gfrY0EsWwsdz0h6Lng9w== X-Received: by 2002:a17:902:ee41:b0:191:2181:d6e0 with SMTP id 1-20020a170902ee4100b001912181d6e0mr14917396plo.8.1671926262589; Sat, 24 Dec 2022 15:57:42 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org, Mark Cave-Ayland Subject: [PATCH v5 21/43] target/sparc: Avoid TCGV_{LOW,HIGH} Date: Sat, 24 Dec 2022 15:56:58 -0800 Message-Id: <20221224235720.842093-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926841149100001 Use the official extend/extract functions instead of routines that will shortly be internal to tcg. Cc: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/sparc/translate.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 34858eb95f..150aeecd14 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -163,13 +163,6 @@ static inline void gen_update_fprs_dirty(DisasContext = *dc, int rd) /* floating point registers moves */ static TCGv_i32 gen_load_fpr_F(DisasContext *dc, unsigned int src) { -#if TCG_TARGET_REG_BITS =3D=3D 32 - if (src & 1) { - return TCGV_LOW(cpu_fpr[src / 2]); - } else { - return TCGV_HIGH(cpu_fpr[src / 2]); - } -#else TCGv_i32 ret =3D get_temp_i32(dc); if (src & 1) { tcg_gen_extrl_i64_i32(ret, cpu_fpr[src / 2]); @@ -177,22 +170,16 @@ static TCGv_i32 gen_load_fpr_F(DisasContext *dc, unsi= gned int src) tcg_gen_extrh_i64_i32(ret, cpu_fpr[src / 2]); } return ret; -#endif } =20 static void gen_store_fpr_F(DisasContext *dc, unsigned int dst, TCGv_i32 v) { -#if TCG_TARGET_REG_BITS =3D=3D 32 - if (dst & 1) { - tcg_gen_mov_i32(TCGV_LOW(cpu_fpr[dst / 2]), v); - } else { - tcg_gen_mov_i32(TCGV_HIGH(cpu_fpr[dst / 2]), v); - } -#else - TCGv_i64 t =3D (TCGv_i64)v; + TCGv_i64 t =3D tcg_temp_new_i64(); + + tcg_gen_extu_i32_i64(t, v); tcg_gen_deposit_i64(cpu_fpr[dst / 2], cpu_fpr[dst / 2], t, (dst & 1 ? 0 : 32), 32); -#endif + tcg_temp_free_i64(t); gen_update_fprs_dirty(dc, dst); } =20 --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926924; cv=none; d=zohomail.com; s=zohoarc; b=FjDveNjDBLauCtaenRfZAH48gk8AhssGVQVNEuzcOxo/YFd3eywZaqv0oUAJwk+VQyg088YhTlHBt6EsIpqXQhxwXbbtEN29zPlkcgAk3BtrY12AyFQHGWcv+GVPfTY1w1Topmw0f3/oSrIF/4vix1iUFBKE+TjXtUiGDSKJcjg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926924; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vcQlxYY7mFIcT5pvKb1eZPHlZnAn92mI9Ka1689AM7M=; b=jRJTfTWLgQxNkUaDWvZIsPG3EcBlRhuVyq/rYLZNr4OKPHP4hK8eEKu4vVQ+hHDGIQPoLJiynWge0ve4C2dBzFDZQRdsj72+rmBYq0iEjYBXhsS1X8+V+zhfSAC0oazlegnX+CoAeQ+UTSN0WNhsNZuQ84K36zyY8C80OJaqeF0= 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 1671926924163522.3562938402831; Sat, 24 Dec 2022 16:08:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOx-0002ca-Ga; Sat, 24 Dec 2022 18:58:03 -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 1p9EOi-0002O0-8z for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:49 -0500 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOf-0006KZ-GY for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:47 -0500 Received: by mail-pl1-x629.google.com with SMTP id t2so8056841ply.2 for ; Sat, 24 Dec 2022 15:57:44 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=vcQlxYY7mFIcT5pvKb1eZPHlZnAn92mI9Ka1689AM7M=; b=G0flpYyWJURbQqklpOSuY7kHL8ZmrKKg/0P4i91PxDBjDR4gdT0zlI9gr2gXu2oxoh HWyhViiR3f1jhYinbLysiocpuy7bn9K4kJgk4wLNi64+ebBIGgiWN/cPbUuGtsamH6Tu sRyvYHHkLrL9MbVIQLE6sMo5jwqWIKr2x4U7Y+KiqSUlsy8pLHHGkLpABqVqkjrhay+P Qv6cWp26YTDhyxh+PmH0sZ4ZNyOaqp/0vAESzXyBNsaoYDmVV/sVe9Ylc0dbXKMItUr/ 972EJrlq8K9qIb2TC3Di2TGNtvGEhiRI8KvUXk4Xmm5pGsQsat+ufs/8zpAdO66WD+XU uMLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=vcQlxYY7mFIcT5pvKb1eZPHlZnAn92mI9Ka1689AM7M=; b=MIIM9Uck3a6ln2VVXBaD9fuq5Y/RuAQfHMUDMiCIypzlr60NEZ/9aQKVN5JRRVGjiU u92jf/f5s2khujXY38LlI7iLkk5G/XftmTlliQaNY9xDPoE7DsZLTwibR9Iymnw6ACHG jqfZw8S4ZDU62O5s6DVeaiVg+LoU1Fw6aDTRzGU/7QO4+ZFefEWNp5tTZUnwr8DuNhlH Dm2YrKrIn0RzFF4505Byqw5Pj6BWLyLG+4ExXeuktvnd8wy49/CBw8ZxRyo6M4gQdl5a FqW0kf5wEK6kWmYUAk/qvqBHrr1AOYzNpEG0zwOgYYHJRQtpiciRBdMyvMJflUNFn7tA VuMA== X-Gm-Message-State: AFqh2kqpV8db3VRFG+q17IIXW+cw2/xG7rZt0n/VAK8Bt0fRsuj2uWk5 oMcS+jwd+gGrKBw9A8PW5SMfwSRyNmjAr2Pg X-Google-Smtp-Source: AMrXdXs4xP5tVqjD9Zm3ea+3QtGj4jlPp47NKATMu2VEv5cfO28vqMfLrYY6Cug+Rt3GoLocZ1RRQQ== X-Received: by 2002:a17:902:74cc:b0:189:dd9b:66c3 with SMTP id f12-20020a17090274cc00b00189dd9b66c3mr2667147plt.11.1671926263485; Sat, 24 Dec 2022 15:57:43 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 22/43] tcg: Move TCG_{LOW,HIGH} to tcg-internal.h Date: Sat, 24 Dec 2022 15:56:59 -0800 Message-Id: <20221224235720.842093-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926925515100001 Move the error-generating fallback from tcg-op.c, and replace "_link_error" with modern QEMU_ERROR markup. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/tcg/tcg-op.h | 33 +++++---------------------------- include/tcg/tcg.h | 12 ------------ tcg/tcg-internal.h | 14 ++++++++++++++ tcg/tcg-op-vec.c | 2 ++ tcg/tcg-op.c | 37 ++++++++++++++++++++++++++++--------- 5 files changed, 49 insertions(+), 49 deletions(-) diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 209e168305..8176f194cb 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -667,35 +667,12 @@ static inline void tcg_gen_mul_i64(TCGv_i64 ret, TCGv= _i64 arg1, TCGv_i64 arg2) tcg_gen_op3_i64(INDEX_op_mul_i64, ret, arg1, arg2); } #else /* TCG_TARGET_REG_BITS =3D=3D 32 */ -static inline void tcg_gen_st8_i64(TCGv_i64 arg1, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_st8_i32(TCGV_LOW(arg1), arg2, offset); -} +void tcg_gen_st8_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset); +void tcg_gen_st16_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset= ); +void tcg_gen_st32_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset= ); =20 -static inline void tcg_gen_st16_i64(TCGv_i64 arg1, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_st16_i32(TCGV_LOW(arg1), arg2, offset); -} - -static inline void tcg_gen_st32_i64(TCGv_i64 arg1, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_st_i32(TCGV_LOW(arg1), arg2, offset); -} - -static inline void tcg_gen_add_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 a= rg2) -{ - tcg_gen_add2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), TCGV_LOW(arg1), - TCGV_HIGH(arg1), TCGV_LOW(arg2), TCGV_HIGH(arg2)); -} - -static inline void tcg_gen_sub_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 a= rg2) -{ - tcg_gen_sub2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), TCGV_LOW(arg1), - TCGV_HIGH(arg1), TCGV_LOW(arg2), TCGV_HIGH(arg2)); -} +void tcg_gen_add_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); +void tcg_gen_sub_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); =20 void tcg_gen_discard_i64(TCGv_i64 arg); void tcg_gen_mov_i64(TCGv_i64 ret, TCGv_i64 arg); diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 5c2254ce9f..d207bc47be 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -737,18 +737,6 @@ static inline TCGv_vec temp_tcgv_vec(TCGTemp *t) return (TCGv_vec)temp_tcgv_i32(t); } =20 -#if TCG_TARGET_REG_BITS =3D=3D 32 -static inline TCGv_i32 TCGV_LOW(TCGv_i64 t) -{ - return temp_tcgv_i32(tcgv_i64_temp(t)); -} - -static inline TCGv_i32 TCGV_HIGH(TCGv_i64 t) -{ - return temp_tcgv_i32(tcgv_i64_temp(t) + 1); -} -#endif - static inline TCGArg tcg_get_insn_param(TCGOp *op, int arg) { return op->args[arg]; diff --git a/tcg/tcg-internal.h b/tcg/tcg-internal.h index cc82088d52..a9ea27f67a 100644 --- a/tcg/tcg-internal.h +++ b/tcg/tcg-internal.h @@ -59,4 +59,18 @@ static inline unsigned tcg_call_flags(TCGOp *op) return tcg_call_info(op)->flags; } =20 +#if TCG_TARGET_REG_BITS =3D=3D 32 +static inline TCGv_i32 TCGV_LOW(TCGv_i64 t) +{ + return temp_tcgv_i32(tcgv_i64_temp(t)); +} +static inline TCGv_i32 TCGV_HIGH(TCGv_i64 t) +{ + return temp_tcgv_i32(tcgv_i64_temp(t) + 1); +} +#else +extern TCGv_i32 TCGV_LOW(TCGv_i64) QEMU_ERROR("32-bit code path is reachab= le"); +extern TCGv_i32 TCGV_HIGH(TCGv_i64) QEMU_ERROR("32-bit code path is reacha= ble"); +#endif + #endif /* TCG_INTERNAL_H */ diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index 463dabf515..5bf100ea7d 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -21,6 +21,8 @@ #include "tcg/tcg.h" #include "tcg/tcg-op.h" #include "tcg/tcg-mo.h" +#include "tcg-internal.h" + =20 /* Reduce the number of ifdefs below. This assumes that all uses of TCGV_HIGH and TCGV_LOW are properly protected by a conditional that diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 019fab00cc..6168327030 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -28,16 +28,8 @@ #include "tcg/tcg-op.h" #include "tcg/tcg-mo.h" #include "exec/plugin-gen.h" +#include "tcg-internal.h" =20 -/* Reduce the number of ifdefs below. This assumes that all uses of - TCGV_HIGH and TCGV_LOW are properly protected by a conditional that - the compiler can eliminate. */ -#if TCG_TARGET_REG_BITS =3D=3D 64 -extern TCGv_i32 TCGV_LOW_link_error(TCGv_i64); -extern TCGv_i32 TCGV_HIGH_link_error(TCGv_i64); -#define TCGV_LOW TCGV_LOW_link_error -#define TCGV_HIGH TCGV_HIGH_link_error -#endif =20 void tcg_gen_op1(TCGOpcode opc, TCGArg a1) { @@ -1171,6 +1163,21 @@ void tcg_gen_ld_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg= _target_long offset) #endif } =20 +void tcg_gen_st8_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset) +{ + tcg_gen_st8_i32(TCGV_LOW(arg1), arg2, offset); +} + +void tcg_gen_st16_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset) +{ + tcg_gen_st16_i32(TCGV_LOW(arg1), arg2, offset); +} + +void tcg_gen_st32_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset) +{ + tcg_gen_st_i32(TCGV_LOW(arg1), arg2, offset); +} + void tcg_gen_st_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset) { #if HOST_BIG_ENDIAN @@ -1182,6 +1189,18 @@ void tcg_gen_st_i64(TCGv_i64 arg1, TCGv_ptr arg2, tc= g_target_long offset) #endif } =20 +void tcg_gen_add_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) +{ + tcg_gen_add2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), TCGV_LOW(arg1), + TCGV_HIGH(arg1), TCGV_LOW(arg2), TCGV_HIGH(arg2)); +} + +void tcg_gen_sub_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) +{ + tcg_gen_sub2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), TCGV_LOW(arg1), + TCGV_HIGH(arg1), TCGV_LOW(arg2), TCGV_HIGH(arg2)); +} + void tcg_gen_and_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) { tcg_gen_and_i32(TCGV_LOW(ret), TCGV_LOW(arg1), TCGV_LOW(arg2)); --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926918; cv=none; d=zohomail.com; s=zohoarc; b=bk8FRZJU0LdRnhWdtLGRmsXMpuI6edCHRK7OMVbgYGMkJ9ku6ebzBTSDcuozQDVvaZwUICLxxFGHujuI/G5tLJjSoqmvpCvg7KEk1GlxfUhSA2cV6nq4xuaC6O8FznCQchhkxwPfUa9vTALk1uk1HWA7dI4lGxekD8LsUrWs+oI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926918; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8dgmD8yUJnIF7Ep3YQaKEZ2wvp15A3Cnw31rhHlanTU=; b=SHGkX9OsVCJwc3t+YRLEy0nuDzn8bPBGn/KyoFhTL3Z5vWh9I4uVtlUvb5fq0nML6uBUITxuLLb9P401/YCoi7AxkyGfsohYBaZUDgfEd4mZgECZkwO+YGTMJP+NCtE+BlXIr9CLtmUYxgIUoxxHGRwsbvncgQb5qMT9A+cZHkg= 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 1671926918591579.0284262827266; Sat, 24 Dec 2022 16:08:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOy-0002es-J0; Sat, 24 Dec 2022 18:58:04 -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 1p9EOi-0002Nz-96 for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:49 -0500 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOf-0006Kj-Rq for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:47 -0500 Received: by mail-pl1-x636.google.com with SMTP id m4so8047257pls.4 for ; Sat, 24 Dec 2022 15:57:45 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=8dgmD8yUJnIF7Ep3YQaKEZ2wvp15A3Cnw31rhHlanTU=; b=m3H7dc98BF7DX867RrmDfoYxf914v6tlrVq4fdc3HJkWHgpzn5x/VuxOLO2+YgPiat 6F3+fA1vyB+qqLEtNAcItoLjj2zLIv3kt3Ys/OdHXBtBtiMmQa8m/ddvQtRaYUnh1EGT yVhFop7QOCwIWd8qDgOCVWHaHLrggmMC6mbdx8OXdYLJdVa7pe26BjIWaBdb7qA8E2N6 rf4lgrIvSw6ZGdruLCZZ58hluetLqxdVoz4Vdz6mpx1hshhtNicDA4P5pAG49a5JoA0R TrD8a4FDChWSbcTyOYww/3K+PtCssUO6eXXI7GmNH+PeTBmUQTUlzg4ZEyD20ILnyZub 2arQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=8dgmD8yUJnIF7Ep3YQaKEZ2wvp15A3Cnw31rhHlanTU=; b=RMxUzXw7OZKJOu97+nLRP2Fw3vVr5A3aP0SoZy34yGgeQ28HprfiZujD05OLR6HOfK 1sqdY1u+bsx2jb2+rypcYYmu7WCp8/28tKHRYcoMW6jfQojAxeU5jexM43AZwMpR8+T7 FQK4IIKg9AqIuSVojhBzQg11j67YsTLUsUs1HE+rCYPgOlJMmqlNwSSPThrKIAW5IOnD EaoTbLL15fPnuvTMMKjYPHLyRY494MR7SAALmQQIWaqq24QcVS3cAQcDK1bTV619vvji vWfVfMgOBdXdXmqw40rZqq/67q+iCWaaV5OfZwT3ZTwQL7NTr8fQB+V5e5U0gjxhcMyU 9uMg== X-Gm-Message-State: AFqh2kqdv2CyJJj4OovULlIBSRec6LW+56tkCexEPOUF7vRu2QFaiYYM f2NRxRq+S3AeCZLsydlicEoBrfaort1LLl2I X-Google-Smtp-Source: AMrXdXuO0ZeW8v5XxxHnunxcY3Njt0wp6uxlKhv0k/CtuFAaKjb4P1KYLP21pWlnvw7UJIp2/oARRQ== X-Received: by 2002:a17:902:f392:b0:189:eaae:a19c with SMTP id f18-20020a170902f39200b00189eaaea19cmr13656512ple.30.1671926264366; Sat, 24 Dec 2022 15:57:44 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 23/43] tcg: Add temp_subindex to TCGTemp Date: Sat, 24 Dec 2022 15:57:00 -0800 Message-Id: <20221224235720.842093-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926921609100001 Record the location of a TCGTemp within a larger object. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 1 + tcg/tcg.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index d207bc47be..afa18986b1 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -456,6 +456,7 @@ typedef struct TCGTemp { unsigned int mem_coherent:1; unsigned int mem_allocated:1; unsigned int temp_allocated:1; + unsigned int temp_subindex:1; =20 int64_t val; struct TCGTemp *mem_base; diff --git a/tcg/tcg.c b/tcg/tcg.c index 98d51e538c..0f58013a5a 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -928,6 +928,7 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TCGv= _ptr base, ts2->mem_allocated =3D 1; ts2->mem_base =3D base_ts; ts2->mem_offset =3D offset + (1 - bigendian) * 4; + ts2->temp_subindex =3D 1; pstrcpy(buf, sizeof(buf), name); pstrcat(buf, sizeof(buf), "_1"); ts2->name =3D strdup(buf); @@ -974,6 +975,7 @@ TCGTemp *tcg_temp_new_internal(TCGType type, bool temp_= local) ts2->base_type =3D TCG_TYPE_I64; ts2->type =3D TCG_TYPE_I32; ts2->temp_allocated =3D 1; + ts2->temp_subindex =3D 1; ts2->kind =3D kind; } else { ts->base_type =3D type; @@ -1092,6 +1094,7 @@ TCGTemp *tcg_constant_internal(TCGType type, int64_t = val) ts2->type =3D TCG_TYPE_I32; ts2->kind =3D TEMP_CONST; ts2->temp_allocated =3D 1; + ts2->temp_subindex =3D 1; ts2->val =3D val >> 32; } else { ts->base_type =3D type; --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926848; cv=none; d=zohomail.com; s=zohoarc; b=QU8246yuc8QMcRHcGEkIZfEUAqCmW9kljPwkwVK3kbzh3Nws5S/zvSj1KZwTIN5v37mz5qDC0B1hyswOvTaDV6AI+0Wl866X6AGpbt7/+iT5GCo0Oq9IH3DMHYmsx3xEzp0I8RfF9DPHS0lqpjv0LCGjP+w4sPbXO5RNoQhR8k4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926848; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zkDNvTm+PB28QbxJv1RcKBwbBiJBv33q35rFa86H5jg=; b=XpBw30CFFLjgL0Sab/d0Nq7Pxkfmh/BiAyGywLhNLOjUKBOCUxE3fEJuHiNHhtEb/XlhSD+4xDBlEN13ibQT2RdWoByIH6yN/BcxWZYMWYByAExq8WyKRJwtZuiZRuY5IoPBJZXx/7BtLcIAfrgZEHDfEzO+mA5imAYX0K6xJXY= 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 1671926848645784.1775116361292; Sat, 24 Dec 2022 16:07:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOx-0002dI-Sk; Sat, 24 Dec 2022 18:58:03 -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 1p9EOi-0002O1-Ak for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:49 -0500 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOg-0006KE-3p for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:47 -0500 Received: by mail-pl1-x633.google.com with SMTP id m4so8047270pls.4 for ; Sat, 24 Dec 2022 15:57:45 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=zkDNvTm+PB28QbxJv1RcKBwbBiJBv33q35rFa86H5jg=; b=wbN19EKkoE8P0aWrpzGEEkbs4px8oH3fQU/ykqZibDZmeey8uG/KdT553Y2L9cklrV vNx9FZwetldnRZyabkb/M7BzvMQVzIiui0q7PZtNtzXFNcxaGE9TySnPhTj02ao5+mAd 0yhfgZ3ghNXc/7x6bB742cxp8SRvxmuyTydNnZtZK8keYTNvKwZa1Gy7Lk5+i4MUJpgV qAR5LT0ZfSuTPhn+nPguZ7Yhx5GW1/901oYVgloTvurSXGqMNZmcB6PiH5RmsQXYLxdq r9wjZCLGAlgI0/Zc6kTmgzgMjHxZhnAIpFQtyntkM0FgUigS8NeofIUleoRRSZwVaJiN +H6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=zkDNvTm+PB28QbxJv1RcKBwbBiJBv33q35rFa86H5jg=; b=Md3FbeqkjoRz8+WqRWNWyKbtNQH1NWRTnAEbQqVBLb6HVId3PAcAM8DwDtfUgoJFmL JBhzzaz8E9Go1BBxwapMa7ExJb0s7jDwOpweDbQaVcoBoMmdPtt+TLNhzQPVMrCzdYCl eopMU+/Xq8xLrbYLZWUmJ5jnQq7P4gAkGPEftcG9TCZJMjc/w4zLEn20UPk4YVJFASna KMKVC2tfs8OV9blkhBjkVstTHXzn6EYpkEVmwMOo7LAuEVpRvOL5zs18Ufxw6fn8tQxR VjDGzxX94fDdGTPHgoRpibfKrEFs26QxpxEg8bXbWVltq36idrnVJsQjQy0n6GH2Xy/I ++Dw== X-Gm-Message-State: AFqh2kqLbPqG2VpCksf/mGZobHxVqAtFvYrYVNQgTCHAhysX78Og+g68 5wqLI0D3R6iUhRqTHnx9DaPx+9Hlw81HBP4F X-Google-Smtp-Source: AMrXdXveIHAlkEQUXZGJROCRKG8IdhGO+zLwRHZtkxVJ8QZtl32+eKzNr3Q/5IIFFJb1GKxX9rDwww== X-Received: by 2002:a17:903:3255:b0:191:f83:636b with SMTP id ji21-20020a170903325500b001910f83636bmr16626975plb.25.1671926265352; Sat, 24 Dec 2022 15:57:45 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 24/43] tcg: Simplify calls to temp_sync vs mem_coherent Date: Sat, 24 Dec 2022 15:57:01 -0800 Message-Id: <20221224235720.842093-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926851197100001 The first thing that temp_sync does is check mem_coherent, so there's no need for the caller to do so. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/tcg.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 0f58013a5a..36a33a122c 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -4075,12 +4075,8 @@ static bool tcg_reg_alloc_dup2(TCGContext *s, const = TCGOp *op) =20 /* If the two inputs form one 64-bit value, try dupm_vec. */ if (itsl + 1 =3D=3D itsh && itsl->base_type =3D=3D TCG_TYPE_I64) { - if (!itsl->mem_coherent) { - temp_sync(s, itsl, s->reserved_regs, 0, 0); - } - if (!itsh->mem_coherent) { - temp_sync(s, itsh, s->reserved_regs, 0, 0); - } + temp_sync(s, itsl, s->reserved_regs, 0, 0); + temp_sync(s, itsh, s->reserved_regs, 0, 0); #if HOST_BIG_ENDIAN TCGTemp *its =3D itsh; #else --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926331; cv=none; d=zohomail.com; s=zohoarc; b=dMTYoLkzlrVFIDF/SdVJ77yIWMbRvRpfUWVsfhYB5rhjDB94bula48X8qQx/4cPFGq6GrSe/E+swf8yygAdEFPIwYnhYIpLME9ubu9QS6gAWTJQ0KrOi3kYCC93xOVbPReHuA+ojhP5hWYS9i+s72isOWCLnVyvvdfceWB3HKSc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926331; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7stba5MTNOn1+WsG6fk76btOm9hVHehrjjbFHXB3kBc=; b=FB1yVfS0MQ0Uf3qzhySW26MiOllbWmmB1NADUdM2x20VryQXYvX6la/1Jq3HXocyoyU4QvM26IFYAlL7fA083qEVtkAohMUsl5v8UvV3wGvED54MGZZQkNcPkmjzP4LssDD5Ewk7lCECflv8OZzztvj1KBbMxOB9FJPYGdaxNLU= 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 1671926331644668.7823786587752; Sat, 24 Dec 2022 15:58:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EP0-0002mQ-T6; Sat, 24 Dec 2022 18:58:06 -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 1p9EOk-0002O8-9D for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:51 -0500 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOi-0006L5-2e for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:49 -0500 Received: by mail-pj1-x1034.google.com with SMTP id u4-20020a17090a518400b00223f7eba2c4so7980518pjh.5 for ; Sat, 24 Dec 2022 15:57:47 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=7stba5MTNOn1+WsG6fk76btOm9hVHehrjjbFHXB3kBc=; b=ysibz+0g/fOp5XTJCMciuWFXemxX2UceDlm3dL7N26FaCVK+WeETlarc6Gztx6H9+j MuGAxvhaGe85a4qo28mkh81i3s6bnQ9ybQOFxylavoLMUiVmP72LnZ2Nr3lHGPmem9qV 1X5zBOYftBXMVOlD7zAlk11amcQhKel1bGOb3JHgup6UimAvkKS0RQkWm2XdzJY0J+IS vzAt4hlobqqa7DbiE0Ka60bhx0xWiqE65kBBEbe8lUNEVIu1uK+DKUsPRIB3PQKLBCRm pETgeto6kY6Z8/DYGn55v4szbmJusDtzC0OHZkGpsHH77PcNnKvCXqgkzsAt/IE5b/OD RR1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=7stba5MTNOn1+WsG6fk76btOm9hVHehrjjbFHXB3kBc=; b=ngNdnPw0tWHra1wNI3ErWQixxg2GPhIB9Hkl80czF35sZ//dIqLXLFS7h3zkfloC96 YmsMMOr09ft5r+9bopqbGyAbgcsyaHm+FPbFUTyMOu5+a4L6IJ6xGcHlZIdO4GhNNz62 FC8S/Q7OUIJHfaKsefPyBf5ehPSkTo36ahgLiBhlLuO44HY4K/aOJXkYuqaWG+5oDJxb xpyMmOtfDWuO78sC367OuxU23FdPxgNv9dJotjdTKTA9OsTuoNkoVc02RQrGjvlaJ6Dn NcqetVy+dnzPOp6Yw47OXFkTFise3MD3v5fJxRi7Hy5y+byhSnEBW1Z/JuAApgmbVgTR Sufw== X-Gm-Message-State: AFqh2ko4jrS8x3y+hd4cz45sGJ8M8PcMiTDMvERo/gkG18yB/Y79OzU8 eGVzXVsRnldf/N3vHI+0IupK9nrgKNhzfoez X-Google-Smtp-Source: AMrXdXv4oYPJ+PVCDrAgl6S6Tg/Hsf+qUB/muhGCRanEXLMLF/bVvihKQ6Wmz1awX8XEZcKcgzBuLQ== X-Received: by 2002:a17:902:e543:b0:189:a6b4:91ed with SMTP id n3-20020a170902e54300b00189a6b491edmr21479545plf.17.1671926266243; Sat, 24 Dec 2022 15:57:46 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 25/43] tcg: Allocate TCGTemp pairs in host memory order Date: Sat, 24 Dec 2022 15:57:02 -0800 Message-Id: <20221224235720.842093-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926333301100003 Allocate the first of a pair at the lower address, and the second of a pair at the higher address. This will make it easier to find the beginning of the larger memory block. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/tcg-internal.h | 4 ++-- tcg/tcg.c | 58 ++++++++++++++++++++++------------------------ 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/tcg/tcg-internal.h b/tcg/tcg-internal.h index a9ea27f67a..2c06b5116a 100644 --- a/tcg/tcg-internal.h +++ b/tcg/tcg-internal.h @@ -62,11 +62,11 @@ static inline unsigned tcg_call_flags(TCGOp *op) #if TCG_TARGET_REG_BITS =3D=3D 32 static inline TCGv_i32 TCGV_LOW(TCGv_i64 t) { - return temp_tcgv_i32(tcgv_i64_temp(t)); + return temp_tcgv_i32(tcgv_i64_temp(t) + HOST_BIG_ENDIAN); } static inline TCGv_i32 TCGV_HIGH(TCGv_i64 t) { - return temp_tcgv_i32(tcgv_i64_temp(t) + 1); + return temp_tcgv_i32(tcgv_i64_temp(t) + !HOST_BIG_ENDIAN); } #else extern TCGv_i32 TCGV_LOW(TCGv_i64) QEMU_ERROR("32-bit code path is reachab= le"); diff --git a/tcg/tcg.c b/tcg/tcg.c index 36a33a122c..dbf4e864eb 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -887,10 +887,7 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TCG= v_ptr base, TCGContext *s =3D tcg_ctx; TCGTemp *base_ts =3D tcgv_ptr_temp(base); TCGTemp *ts =3D tcg_global_alloc(s); - int indirect_reg =3D 0, bigendian =3D 0; -#if HOST_BIG_ENDIAN - bigendian =3D 1; -#endif + int indirect_reg =3D 0; =20 switch (base_ts->kind) { case TEMP_FIXED: @@ -916,7 +913,7 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TCGv= _ptr base, ts->indirect_reg =3D indirect_reg; ts->mem_allocated =3D 1; ts->mem_base =3D base_ts; - ts->mem_offset =3D offset + bigendian * 4; + ts->mem_offset =3D offset; pstrcpy(buf, sizeof(buf), name); pstrcat(buf, sizeof(buf), "_0"); ts->name =3D strdup(buf); @@ -927,7 +924,7 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TCGv= _ptr base, ts2->indirect_reg =3D indirect_reg; ts2->mem_allocated =3D 1; ts2->mem_base =3D base_ts; - ts2->mem_offset =3D offset + (1 - bigendian) * 4; + ts2->mem_offset =3D offset + 4; ts2->temp_subindex =3D 1; pstrcpy(buf, sizeof(buf), name); pstrcat(buf, sizeof(buf), "_1"); @@ -1073,37 +1070,43 @@ TCGTemp *tcg_constant_internal(TCGType type, int64_= t val) =20 ts =3D g_hash_table_lookup(h, &val); if (ts =3D=3D NULL) { + int64_t *val_ptr; + ts =3D tcg_temp_alloc(s); =20 if (TCG_TARGET_REG_BITS =3D=3D 32 && type =3D=3D TCG_TYPE_I64) { TCGTemp *ts2 =3D tcg_temp_alloc(s); =20 + tcg_debug_assert(ts2 =3D=3D ts + 1); + ts->base_type =3D TCG_TYPE_I64; ts->type =3D TCG_TYPE_I32; ts->kind =3D TEMP_CONST; ts->temp_allocated =3D 1; - /* - * Retain the full value of the 64-bit constant in the low - * part, so that the hash table works. Actual uses will - * truncate the value to the low part. - */ - ts->val =3D val; =20 - tcg_debug_assert(ts2 =3D=3D ts + 1); ts2->base_type =3D TCG_TYPE_I64; ts2->type =3D TCG_TYPE_I32; ts2->kind =3D TEMP_CONST; ts2->temp_allocated =3D 1; ts2->temp_subindex =3D 1; - ts2->val =3D val >> 32; + + /* + * Retain the full value of the 64-bit constant in the low + * part, so that the hash table works. Actual uses will + * truncate the value to the low part. + */ + ts[HOST_BIG_ENDIAN].val =3D val; + ts[!HOST_BIG_ENDIAN].val =3D val >> 32; + val_ptr =3D &ts[HOST_BIG_ENDIAN].val; } else { ts->base_type =3D type; ts->type =3D type; ts->kind =3D TEMP_CONST; ts->temp_allocated =3D 1; ts->val =3D val; + val_ptr =3D &ts->val; } - g_hash_table_insert(h, &ts->val, ts); + g_hash_table_insert(h, val_ptr, ts); } =20 return ts; @@ -1515,13 +1518,8 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int nar= gs, TCGTemp **args) pi =3D 0; if (ret !=3D NULL) { if (TCG_TARGET_REG_BITS < 64 && (typemask & 6) =3D=3D dh_typecode_= i64) { -#if HOST_BIG_ENDIAN - op->args[pi++] =3D temp_arg(ret + 1); - op->args[pi++] =3D temp_arg(ret); -#else op->args[pi++] =3D temp_arg(ret); op->args[pi++] =3D temp_arg(ret + 1); -#endif nb_rets =3D 2; } else { op->args[pi++] =3D temp_arg(ret); @@ -1555,8 +1553,8 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int narg= s, TCGTemp **args) } =20 if (TCG_TARGET_REG_BITS < 64 && is_64bit) { - op->args[pi++] =3D temp_arg(args[i] + HOST_BIG_ENDIAN); - op->args[pi++] =3D temp_arg(args[i] + !HOST_BIG_ENDIAN); + op->args[pi++] =3D temp_arg(args[i]); + op->args[pi++] =3D temp_arg(args[i] + 1); real_args +=3D 2; continue; } @@ -4074,14 +4072,14 @@ static bool tcg_reg_alloc_dup2(TCGContext *s, const= TCGOp *op) } =20 /* If the two inputs form one 64-bit value, try dupm_vec. */ - if (itsl + 1 =3D=3D itsh && itsl->base_type =3D=3D TCG_TYPE_I64) { - temp_sync(s, itsl, s->reserved_regs, 0, 0); - temp_sync(s, itsh, s->reserved_regs, 0, 0); -#if HOST_BIG_ENDIAN - TCGTemp *its =3D itsh; -#else - TCGTemp *its =3D itsl; -#endif + if (itsl->temp_subindex =3D=3D HOST_BIG_ENDIAN && + itsh->temp_subindex =3D=3D !HOST_BIG_ENDIAN && + itsl =3D=3D itsh + (HOST_BIG_ENDIAN ? 1 : -1)) { + TCGTemp *its =3D itsl - HOST_BIG_ENDIAN; + + temp_sync(s, its + 0, s->reserved_regs, 0, 0); + temp_sync(s, its + 1, s->reserved_regs, 0, 0); + if (tcg_out_dupm_vec(s, vtype, MO_64, ots->reg, its->mem_base->reg, its->mem_offset)) { goto done; --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671927324; cv=none; d=zohomail.com; s=zohoarc; b=LPfHJyJvRoRzkma5EOpk5iA7DZ7XOYyZRxdOrXRFcOoee9Pv1zviJy+R339hu/rcQ51qdGmo6/9egUcawrmNPH+Sycz9CZ3XSWDDFg5QW3Q7ry/fLBgdjfrk8XTwimySwjOQor9kB85PGqBGY+3W0jfW1L2IZogS3zwSkDpdiZc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671927324; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=g+8yoDAKtbWcn6kd6zbMcipsZN6xB1eyyko6EmQwVd4=; b=VhHs/R9XhautH+S9uYDEVVEQju3gPJ8iGyHiOS2/fXXxjZChu0gdffwmnTg0HjRjRqH0pe8uSYngQEMQs8IefyKPLlK3kAo0172wkBfe2iL1PBjsGXvEeDMw+Xp8w8/bPAFGs3hWAzKWm1fvZBkWtukpQU2Hv/jLxgczKwiXH1w= 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 167192732469123.543280820977316; Sat, 24 Dec 2022 16:15:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EP0-0002ir-3e; Sat, 24 Dec 2022 18:58:06 -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 1p9EOk-0002OA-2m for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:50 -0500 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOi-0006LB-GT for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:49 -0500 Received: by mail-pj1-x102a.google.com with SMTP id o1-20020a17090a678100b00219cf69e5f0so11943461pjj.2 for ; Sat, 24 Dec 2022 15:57:48 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=g+8yoDAKtbWcn6kd6zbMcipsZN6xB1eyyko6EmQwVd4=; b=C8zRQIqMzw5QrlC3EAHQiPRefqLPtXOX+w+24X6/H5CDFljBKm9N2RwFh/cqDKrGd6 BWoZtPp9e8i4lNSmK/6/QYcz4fbEkSVfa7faponaZYA1GPgCjLQaD3BbrTkPVYDvAjxI lW81gxHBjeSijjDjeIBz4B6wQYVK3A7YMLJLS9zzKG42b8anWN1zpUCx7ekY2LVAmbXw Z6cI14CBnZ2xXIQ4kwTtemRC+t6BU+a/VW2+DKsm6lsJ7AjgbRGFmXRdk/yS7qrCEFyk TBaT8DVHMko1q+1AhJQQqPqkmh/d9bbLOpj23OuyUS1MtrMDchBibaLO6C8rlHZNTMfI es2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=g+8yoDAKtbWcn6kd6zbMcipsZN6xB1eyyko6EmQwVd4=; b=QPF8swXI6eU6KvJigPI5hnvRu3aQqLtq3azYQZcsP2kYWP/UtjTdgpSNuRbCy2t7/6 6ncAm7B4ex1UwKisrcq9/5KiYRpl+wQx2DO4A6SLAd48KKnwq09VWZ/jVL2/4NLv3mvg CLNlHknXvGgJuv5oQeivEWqEGXspwVyOgVerZaAAAEYXWUB8G0gXrOGRenyH9wDm1zYL keB9IhohK8/Liancka7ch02NRLZAu8LrPhl/tskFA0jYfqYyvzlK1aeEFAcTGUZ3SwOj im3Fo7KJ9WHvaDVCHKbQCiMeiFFfN093WpPUpxWRqS5Bbo4y5E4yPF/klblRCw/38LAK zUSg== X-Gm-Message-State: AFqh2kq6/KA5aJaGx9s3nxsNJf5DVZTC5IBPT+4Dgw7Nro6bs8afvh72 kTL0sfGNXjmeldqYkBaYocdUhJPFveBgi6jF X-Google-Smtp-Source: AMrXdXvCaYkp+l078EoQlrPvAZio04594Pp028SRZBp/4nka5qdm1AkPKd3M2CZPnocN/au9/sHUVQ== X-Received: by 2002:a17:903:2781:b0:189:c3ef:c759 with SMTP id jw1-20020a170903278100b00189c3efc759mr16683115plb.68.1671926267147; Sat, 24 Dec 2022 15:57:47 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 26/43] tcg: Move TCG_TYPE_COUNT outside enum Date: Sat, 24 Dec 2022 15:57:03 -0800 Message-Id: <20221224235720.842093-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671927327293100003 The count is not itself an enumerator. Move it outside to prevent the compiler from considering it with -Wswitch-enum. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index afa18986b1..f2da340bb9 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -294,7 +294,8 @@ typedef enum TCGType { TCG_TYPE_V128, TCG_TYPE_V256, =20 - TCG_TYPE_COUNT, /* number of different types */ + /* Number of different types (integer not enum) */ +#define TCG_TYPE_COUNT (TCG_TYPE_V256 + 1) =20 /* An alias for the size of the host register. */ #if TCG_TARGET_REG_BITS =3D=3D 32 --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926971; cv=none; d=zohomail.com; s=zohoarc; b=GrYbaiigughzH7dQf7IiliCj4FvS+ngBMer/kF4eX4RWU8lOOB7AOaknn+BYG7pPK9B5NQoPADrxNlBSpIkF+AULLXkge9TB9KqdWxis2e/XULagkEAQWKhwA5/A2/wc/fBOqpK0UdH2dMzO1IJtuga9O85ZFRqONrdmBE9CJ/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926971; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3PNalx9xC9o37R0T2TRvL9fvT6DAngOYvV1/eVoQctk=; b=Aw3X8ZiRHwr3kEwiRP2U7c6kU6d+71K+n4lvIkbV/09K15iinK8bPVyczza9qlNk/s2cj5mirPU1YqsOj5A7UbY12z5q8TC8baPS7q7rMOW9bFv0PUarxtZsWZGwVlH41krh6IepxX0SXTLlOI6D0deBRelu0I35vK5clDymma4= 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 1671926971242169.59055097391717; Sat, 24 Dec 2022 16:09:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EP4-0002tT-8z; Sat, 24 Dec 2022 18:58:10 -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 1p9EOl-0002P5-4n for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:52 -0500 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOi-0006Jy-OL for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:50 -0500 Received: by mail-pj1-x1032.google.com with SMTP id ge16so4312198pjb.5 for ; Sat, 24 Dec 2022 15:57:48 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=3PNalx9xC9o37R0T2TRvL9fvT6DAngOYvV1/eVoQctk=; b=iiBm/1izNBrdardKXJtEhew5V5LimT7uyQsGF1o5TOfhEV43XEFPJ+5Go5F8du6g+0 WJQG5QiBMIffrB4BGDiCkZ5TxxmLKHOJK2pCPEZlc8NEeHHK8I+9Gw11n3ohtSXEWxRR v0gctMSj3jYa+Pj3d5VerwuqhQ9ta9MnkZfmj1fY9lP5sLrrRdz9PJ8Ivrpr2NsnKzM8 n/H2M0YQ+XK6BvgSn6F1X7xOVpPHBBAesekIVEVyuGqdZIMmTuF74j3gy9cn81zgZDfy U+NANuZWdABpgt2QYIvrQKe/eCwcShxuYdz18/7glmtLua/mJA375ygwDZJgH09WDfuf wIbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=3PNalx9xC9o37R0T2TRvL9fvT6DAngOYvV1/eVoQctk=; b=V3cRnGL85IXbGfXbmYcsbkC8yVDx7MkyEjhCAhwXfc+0dTY4n2AjTTU8E5ULLIEKn9 i45+P4b8OlyV3knzI/V87FrgFCZmIvpxvVF+Nv2xDWxe/yyBbx1K3PvHW9OqCALvPmpN cA1rucKkE6JT50PJVUSMx5LyzlUcF6ghm71ILT4yT+sbD4LMi8JWoQiI6N5iFhFDYNNz sj52JcraNJqSqjgWpNqPlWitaQE9U4p5C0+HEIoBC5mJXyrfyzcwvG7AsEAP23xjGoO5 AzzVkBo+Yesu5mypEqEiu/R5tsw25fBmw19vj5lKmHwQHdLQrBiaGhaJOyB9OEQzKPkA FFSQ== X-Gm-Message-State: AFqh2kovc6v1skFSzq0ZryWpfy58Mgo5Rhd8NTqGMOFTiEYjurY9r4WO tzEWO76vO5t+RZ7a+xq/+0tmaBmyig4MDJES X-Google-Smtp-Source: AMrXdXs2JVBA9++y9O8i82qi/x6E65P9W+OA2SVsXGB80/vsiDw9VKEthD0KdfgQ9memQcWbGPkRww== X-Received: by 2002:a17:902:e952:b0:192:4ce1:3687 with SMTP id b18-20020a170902e95200b001924ce13687mr17659658pll.52.1671926268021; Sat, 24 Dec 2022 15:57:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 27/43] tcg: Introduce tcg_type_size Date: Sat, 24 Dec 2022 15:57:04 -0800 Message-Id: <20221224235720.842093-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926973733100003 Add a helper function for computing the size of a type. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 16 ++++++++++++++++ tcg/tcg.c | 27 ++++++++++++--------------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index f2da340bb9..8bcd60d0ed 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -319,6 +319,22 @@ typedef enum TCGType { #endif } TCGType; =20 +/** + * tcg_type_size + * @t: type + * + * Return the size of the type in bytes. + */ +static inline int tcg_type_size(TCGType t) +{ + unsigned i =3D t; + if (i >=3D TCG_TYPE_V64) { + tcg_debug_assert(i < TCG_TYPE_COUNT); + i -=3D TCG_TYPE_V64 - 1; + } + return 4 << i; +} + /** * get_alignment_bits * @memop: MemOp value diff --git a/tcg/tcg.c b/tcg/tcg.c index dbf4e864eb..12676268a2 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3038,22 +3038,22 @@ static bool liveness_pass_2(TCGContext *s) =20 static void temp_allocate_frame(TCGContext *s, TCGTemp *ts) { - intptr_t off, size, align; + int size =3D tcg_type_size(ts->type); + int align; + intptr_t off; =20 switch (ts->type) { case TCG_TYPE_I32: - size =3D align =3D 4; + align =3D 4; break; case TCG_TYPE_I64: case TCG_TYPE_V64: - size =3D align =3D 8; + align =3D 8; break; case TCG_TYPE_V128: - size =3D align =3D 16; - break; case TCG_TYPE_V256: /* Note that we do not require aligned storage for V256. */ - size =3D 32, align =3D 16; + align =3D 16; break; default: g_assert_not_reached(); @@ -3593,8 +3593,8 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TC= GOp *op) TCGRegSet dup_out_regs, dup_in_regs; TCGTemp *its, *ots; TCGType itype, vtype; - intptr_t endian_fixup; unsigned vece; + int lowpart_ofs; bool ok; =20 ots =3D arg_temp(op->args[0]); @@ -3662,15 +3662,12 @@ static void tcg_reg_alloc_dup(TCGContext *s, const = TCGOp *op) /* fall through */ =20 case TEMP_VAL_MEM: -#if HOST_BIG_ENDIAN - endian_fixup =3D itype =3D=3D TCG_TYPE_I32 ? 4 : 8; - endian_fixup -=3D 1 << vece; -#else - endian_fixup =3D 0; -#endif - /* Attempt to dup directly from the input memory slot. */ + lowpart_ofs =3D 0; + if (HOST_BIG_ENDIAN) { + lowpart_ofs =3D tcg_type_size(itype) - (1 << vece); + } if (tcg_out_dupm_vec(s, vtype, vece, ots->reg, its->mem_base->reg, - its->mem_offset + endian_fixup)) { + its->mem_offset + lowpart_ofs)) { goto done; } /* Load the input into the destination vector register. */ --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926613; cv=none; d=zohomail.com; s=zohoarc; b=Y9afMQpdt+a09OzpzrIlgS12GrpDKIXNk2Z4myRuNxgpAqesLKm1kvedgw5Q+RgN6VwYFhJzsFULkG14rAZ2nQ2t9tO2sFjduGTrFzvE+o9A7DjeZS0iHBut0PBTwaJQT5Z7SeFv+tfiLs5kj+JS9QfUaQDR8wirc80rPrtuVGc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926613; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tz8pxyjZBQm1+qEjyv1TGYW3iZ6MjviUhbwrA5+bw+s=; b=YSi0ORxGEKLuV9eJYX043HISjfC17ibXtJPCacAN6HLwgHjnzGXcOy3vVHTXL1abMfQpSBe1/ma3ctiHhSIcArbinPjqJdXAEeMYZsh9ywPI9PUBPMs8ItxOpqlah++c8VhnduovFQe+DEGFKk0XpgM3/IVI7jYtecDsmvBN0kA= 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 1671926613377604.4685578206135; Sat, 24 Dec 2022 16:03:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOz-0002hH-Gg; Sat, 24 Dec 2022 18:58:05 -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 1p9EOl-0002P6-OH for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:52 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOk-0006Lh-7X for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:51 -0500 Received: by mail-pl1-x62c.google.com with SMTP id s7so8041233plk.5 for ; Sat, 24 Dec 2022 15:57:49 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=tz8pxyjZBQm1+qEjyv1TGYW3iZ6MjviUhbwrA5+bw+s=; b=pkUn1F/R7f6HmHMPtPaET3u5rtxThO/Llt7pnva75dhCbgHiXgfMtHih4rbLWAvuNo agmFc5HV3O6CxGGYrCCYVe7xyAF+BNnzp4eDJH+xqGlHOFLAVs/rbnlYxk89vUcy3T/a nH4MHQtn05kQ8czvYnrigs8L592/UBcbn4a8hNiNL3Jva/XwvohxPm2FmC1UWrwtWAWX ruPkO67P3D/atsA4j2pmTFtmdKNFn+74oIqM2KjD9KpKnPTExsYozMb/u7mqBL5fRjNJ aa0oYBTee9sOBp+usXK2sg+3/7pWKO9VE2OniWHRq0tWaTJBrTPAamin+oProXgG7YFF hzdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=tz8pxyjZBQm1+qEjyv1TGYW3iZ6MjviUhbwrA5+bw+s=; b=dv2BrKB+KfRWKSoWgh6bxV9u40pY6tmibQnea//bhgCzvxmOS/aZcyGDl0jn1Nc6Dt /YMFJm2gGPJCaY8veAO9UMhCYiie2y0qJHQxPGjUrd2Vrsox1xwlNI9u812XCRt3yAG8 bGAw1xvBSQBYVakUcb5rdX59uCM1kLC2uT0opRwk1KD3atuO+z62ImNXF0gmb5jkyOyt KtELLLNnjOzdkw6tMcALPXqtkT5JThlQSSHwTCN4yD8cmKNY4Zei6hhW4WvPTuyhYmiE gcydT2VRPZl6nmkVeX+1H24AofnsJ2UroVuH73QPNNpNDP1F7TV9V9QrrfVxzEE53zYf vS5Q== X-Gm-Message-State: AFqh2krZgIy5ks77enmjlSVfmrKNz6i/TdFhkxrpID2/z7dcSlHXHLeg wgCgICZTltA72kAkV0rR5t0lFLVtdbTRFOAk X-Google-Smtp-Source: AMrXdXvReEAYlYX5PyL+6EAKZ8F+6sqJTg3s+91996dcsP2U069DyA4KXPJzNx/hWVfGg+4MSVPCQA== X-Received: by 2002:a17:902:e0c9:b0:192:6853:b5b4 with SMTP id e9-20020a170902e0c900b001926853b5b4mr3724065pla.23.1671926268963; Sat, 24 Dec 2022 15:57:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 28/43] tcg: Introduce TCGCallReturnKind and TCGCallArgumentKind Date: Sat, 24 Dec 2022 15:57:05 -0800 Message-Id: <20221224235720.842093-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926616411100003 Prepare to replace a bunch of separate ifdefs with a consistent way to describe the ABI of a function call. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/tcg-internal.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tcg/tcg-internal.h b/tcg/tcg-internal.h index 2c06b5116a..f574743ff8 100644 --- a/tcg/tcg-internal.h +++ b/tcg/tcg-internal.h @@ -27,6 +27,21 @@ =20 #define TCG_HIGHWATER 1024 =20 +/* + * Describe the calling convention of a given argument type. + */ +typedef enum { + TCG_CALL_RET_NORMAL, /* by registers */ +} TCGCallReturnKind; + +typedef enum { + TCG_CALL_ARG_NORMAL, /* by registers (continuing onto stack) */ + TCG_CALL_ARG_EVEN, /* like normal, but skipping odd slots */ + TCG_CALL_ARG_EXTEND, /* for i32, as a sign/zero-extended i64 */ + TCG_CALL_ARG_EXTEND_U, /* ... as a zero-extended i64 */ + TCG_CALL_ARG_EXTEND_S, /* ... as a sign-extended i64 */ +} TCGCallArgumentKind; + typedef struct TCGHelperInfo { void *func; const char *name; --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926964; cv=none; d=zohomail.com; s=zohoarc; b=HtxNzHf0pyz75T27vIDk+DN1xzsbpNYx9Lb2GKui46gxGbEPnYLAH5C3jEDrRTtVkKBuwOVgPeuJNJa/OV6NJJ+x9l+yub9Wtdx8lBpglGKWX8d2HFHg1ovPNwJRlr40TG6pGx1GXDEmJjSLHRih1kmEQKzlsC5hKJy5Atlqv24= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926964; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8cQIWEMyleaE9VnutdzGpBw5zrz24lsmhK3egVV5Q0E=; b=DSvANKUqJ9VddFh9pu/APN3AgXafFD/aYUdJPIe+kRwYYglYn/oqvxbX9NO1/T4h0MlYK8Wm90qDYGiprOkXVnRwFVcUGzk5ysxMbSIemII72RJiC0CVQtr+UOyFX0s89F+/r7Qeb2XBcUCFWx7qCyosTsVxRINYJEMIh7X1FUE= 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 1671926964317159.33010447425556; Sat, 24 Dec 2022 16:09:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EP2-0002qP-Jz; Sat, 24 Dec 2022 18:58:08 -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 1p9EOm-0002Q1-Q7 for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:54 -0500 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOk-0006LB-KC for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:52 -0500 Received: by mail-pj1-x102a.google.com with SMTP id o1-20020a17090a678100b00219cf69e5f0so11943510pjj.2 for ; Sat, 24 Dec 2022 15:57:50 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=8cQIWEMyleaE9VnutdzGpBw5zrz24lsmhK3egVV5Q0E=; b=GYF2TPo0hylQ/NzrQ6bX/hu8dqFlG4zsWCR9dqN+Eb7Z07as0Bhv3wMS8T594g1nRS JrHdrSk9BGdVbZ4ZkTdduYZTLaHZDnzrKgPMnkPaM2acakOgOilSldd7h2RlaSh/XKRm Dar5+cyIBX23phkv4SdRm2GpAzT3HUMWycWbuK4r9UXS/nJzlkkE88+oO8w9Dz3WAx/e k3MVrM+2h9yHUUyDDekZZxH7rBan1Lqd3zoDK23wGOhjEtt7ia8oXOTjd9qDAlRwGrtz 7L6eW+No9Rs+zs5B0gA7miJXiuCH0yx6IQSZhqPeyAE7OEvRHCgbGKVCgsyTK/xCxcTH 8gXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=8cQIWEMyleaE9VnutdzGpBw5zrz24lsmhK3egVV5Q0E=; b=FsdlJ/i1HGZ7G8rxY7Y4tv0SkNFouuAmrw8pdZZblcSMTGBlwQ8/XBI5cUjvFyqU/5 iXPRsYABtO+c+DP9kJP/2WFytnr2/C5vhjxqf1iLhXGuqZUHafnxWcfWs1DGMadZ+ONZ H8qK3Kru95sYeatVZ/ERXTRU4PC581UCAERiznBae9iPk005vba3M143e2w/ck+17Dd2 i+3pOuiyT3H55PtrEP7txHwYm4pqtYY4SdkfXGglfLGV/GkhNtAm+2XsSxgeNaS0krca NwTGxuB48syiKppTq2SYh8lrhHeuN0s5EGqQXxhjrv4TeI3Mw+w53vUOvtPNypzzTK8Y lPmw== X-Gm-Message-State: AFqh2kp/L3m4lOwthPQJei1AMq1T0Qb846xkTmOONyCiLBgfEHjH6j7A iARtHulpMLvY56Jj9ZE9ml2mMCofYeAB8SoI X-Google-Smtp-Source: AMrXdXtWO7seEPFOv8u3PKYlIPU679W7siPRqDTO15j5XaKxmhQYJd0OEcUjhNiBj8wWKWILls+Fmw== X-Received: by 2002:a17:902:ea81:b0:192:6b94:7a89 with SMTP id x1-20020a170902ea8100b001926b947a89mr3264396plb.43.1671926269851; Sat, 24 Dec 2022 15:57:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 29/43] tcg: Replace TCG_TARGET_CALL_ALIGN_ARGS with TCG_TARGET_CALL_ARG_I64 Date: Sat, 24 Dec 2022 15:57:06 -0800 Message-Id: <20221224235720.842093-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926965741100001 For 32-bit hosts when TCG_TARGET_CALL_ALIGN_ARGS was set, use TCG_CALL_ARG_EVEN. For 64-bit hosts, TCG_TARGET_CALL_ALIGN_ARGS was silently ignored, so always use TCG_CALL_ARG_NORMAL. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.h | 2 +- tcg/arm/tcg-target.h | 2 +- tcg/i386/tcg-target.h | 1 + tcg/loongarch64/tcg-target.h | 2 +- tcg/mips/tcg-target.h | 3 ++- tcg/riscv/tcg-target.h | 6 +++++- tcg/s390x/tcg-target.h | 1 + tcg/sparc64/tcg-target.h | 1 + tcg/tci/tcg-target.h | 5 +++++ tcg/tcg.c | 6 ++++-- tcg/ppc/tcg-target.c.inc | 21 ++++++++------------- 11 files changed, 30 insertions(+), 20 deletions(-) diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index e145d50fef..d9dd777caa 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -51,8 +51,8 @@ typedef enum { /* used for function call generation */ #define TCG_REG_CALL_STACK TCG_REG_SP #define TCG_TARGET_STACK_ALIGN 16 -#define TCG_TARGET_CALL_ALIGN_ARGS 1 #define TCG_TARGET_CALL_STACK_OFFSET 0 +#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL =20 /* optional instructions */ #define TCG_TARGET_HAS_div_i32 1 diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index 56c1ac4586..09dd0550aa 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -88,8 +88,8 @@ extern bool use_neon_instructions; =20 /* used for function call generation */ #define TCG_TARGET_STACK_ALIGN 8 -#define TCG_TARGET_CALL_ALIGN_ARGS 1 #define TCG_TARGET_CALL_STACK_OFFSET 0 +#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_EVEN =20 /* optional instructions */ #define TCG_TARGET_HAS_ext8s_i32 1 diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 00fcbe297d..42628a2791 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -98,6 +98,7 @@ typedef enum { #else #define TCG_TARGET_CALL_STACK_OFFSET 0 #endif +#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL =20 extern bool have_bmi1; extern bool have_popcnt; diff --git a/tcg/loongarch64/tcg-target.h b/tcg/loongarch64/tcg-target.h index a659c8d6fd..19d4c07170 100644 --- a/tcg/loongarch64/tcg-target.h +++ b/tcg/loongarch64/tcg-target.h @@ -92,8 +92,8 @@ typedef enum { /* used for function call generation */ #define TCG_REG_CALL_STACK TCG_REG_SP #define TCG_TARGET_STACK_ALIGN 16 -#define TCG_TARGET_CALL_ALIGN_ARGS 1 #define TCG_TARGET_CALL_STACK_OFFSET 0 +#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL =20 /* optional instructions */ #define TCG_TARGET_HAS_movcond_i32 0 diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h index 7669213175..bb7312aed4 100644 --- a/tcg/mips/tcg-target.h +++ b/tcg/mips/tcg-target.h @@ -83,10 +83,11 @@ typedef enum { #define TCG_TARGET_STACK_ALIGN 16 #if _MIPS_SIM =3D=3D _ABIO32 # define TCG_TARGET_CALL_STACK_OFFSET 16 +# define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_EVEN #else # define TCG_TARGET_CALL_STACK_OFFSET 0 +# define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL #endif -#define TCG_TARGET_CALL_ALIGN_ARGS 1 =20 /* MOVN/MOVZ instructions detection */ #if (defined(__mips_isa_rev) && (__mips_isa_rev >=3D 1)) || \ diff --git a/tcg/riscv/tcg-target.h b/tcg/riscv/tcg-target.h index 11c9b3e4f4..2ab4b8d04a 100644 --- a/tcg/riscv/tcg-target.h +++ b/tcg/riscv/tcg-target.h @@ -81,8 +81,12 @@ typedef enum { /* used for function call generation */ #define TCG_REG_CALL_STACK TCG_REG_SP #define TCG_TARGET_STACK_ALIGN 16 -#define TCG_TARGET_CALL_ALIGN_ARGS 1 #define TCG_TARGET_CALL_STACK_OFFSET 0 +#if TCG_TARGET_REG_BITS =3D=3D 32 +#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_EVEN +#else +#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL +#endif =20 /* optional instructions */ #define TCG_TARGET_HAS_movcond_i32 0 diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index 23e2063667..3f77fcf5b3 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -166,6 +166,7 @@ extern uint64_t s390_facilities[3]; /* used for function call generation */ #define TCG_TARGET_STACK_ALIGN 8 #define TCG_TARGET_CALL_STACK_OFFSET 160 +#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL =20 #define TCG_TARGET_EXTEND_ARGS 1 #define TCG_TARGET_HAS_MEMORY_BSWAP 1 diff --git a/tcg/sparc64/tcg-target.h b/tcg/sparc64/tcg-target.h index 8655acdbe5..44ac164b31 100644 --- a/tcg/sparc64/tcg-target.h +++ b/tcg/sparc64/tcg-target.h @@ -72,6 +72,7 @@ typedef enum { #define TCG_TARGET_STACK_ALIGN 16 #define TCG_TARGET_CALL_STACK_OFFSET (128 + 6*8 + TCG_TARGET_STACK_BIAS) #define TCG_TARGET_EXTEND_ARGS 1 +#define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL =20 #if defined(__VIS__) && __VIS__ >=3D 0x300 #define use_vis3_instructions 1 diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h index ceb36c4f7a..e11c293906 100644 --- a/tcg/tci/tcg-target.h +++ b/tcg/tci/tcg-target.h @@ -158,6 +158,11 @@ typedef enum { /* Used for function call generation. */ #define TCG_TARGET_CALL_STACK_OFFSET 0 #define TCG_TARGET_STACK_ALIGN 8 +#if TCG_TARGET_REG_BITS =3D=3D 32 +# define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_EVEN +#else +# define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL +#endif =20 #define HAVE_TCG_QEMU_TB_EXEC #define TCG_TARGET_NEED_POOL_LABELS diff --git a/tcg/tcg.c b/tcg/tcg.c index 12676268a2..3ca25f7a28 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1542,9 +1542,11 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int nar= gs, TCGTemp **args) * for passing off to ffi_call. */ want_align =3D true; -#elif defined(TCG_TARGET_CALL_ALIGN_ARGS) +#else /* Some targets want aligned 64 bit args */ - want_align =3D is_64bit; + if (is_64bit) { + want_align =3D TCG_TARGET_CALL_ARG_I64 =3D=3D TCG_CALL_ARG_EVE= N; + } #endif =20 if (TCG_TARGET_REG_BITS < 64 && want_align && (real_args & 1)) { diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 9e34df94ba..c2e6bc3296 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -45,7 +45,9 @@ #endif =20 #ifdef _CALL_SYSV -# define TCG_TARGET_CALL_ALIGN_ARGS 1 +# define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_EVEN +#else +# define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL #endif =20 /* For some memory operations, we need a scratch that isn't R0. For the A= IX @@ -2202,9 +2204,7 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) lo =3D lb->addrlo_reg; hi =3D lb->addrhi_reg; if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) { -#ifdef TCG_TARGET_CALL_ALIGN_ARGS - arg |=3D 1; -#endif + arg |=3D (TCG_TARGET_CALL_ARG_I64 =3D=3D TCG_CALL_ARG_EVEN); tcg_out_mov(s, TCG_TYPE_I32, arg++, hi); tcg_out_mov(s, TCG_TYPE_I32, arg++, lo); } else { @@ -2250,9 +2250,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) lo =3D lb->addrlo_reg; hi =3D lb->addrhi_reg; if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) { -#ifdef TCG_TARGET_CALL_ALIGN_ARGS - arg |=3D 1; -#endif + arg |=3D (TCG_TARGET_CALL_ARG_I64 =3D=3D TCG_CALL_ARG_EVEN); tcg_out_mov(s, TCG_TYPE_I32, arg++, hi); tcg_out_mov(s, TCG_TYPE_I32, arg++, lo); } else { @@ -2266,9 +2264,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) if (TCG_TARGET_REG_BITS =3D=3D 32) { switch (s_bits) { case MO_64: -#ifdef TCG_TARGET_CALL_ALIGN_ARGS - arg |=3D 1; -#endif + arg |=3D (TCG_TARGET_CALL_ARG_I64 =3D=3D TCG_CALL_ARG_EVEN); tcg_out_mov(s, TCG_TYPE_I32, arg++, hi); /* FALLTHRU */ case MO_32: @@ -2324,9 +2320,8 @@ static bool tcg_out_fail_alignment(TCGContext *s, TCG= LabelQemuLdst *l) =20 if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) { TCGReg arg =3D TCG_REG_R4; -#ifdef TCG_TARGET_CALL_ALIGN_ARGS - arg |=3D 1; -#endif + + arg |=3D (TCG_TARGET_CALL_ARG_I64 =3D=3D TCG_CALL_ARG_EVEN); if (l->addrlo_reg !=3D arg) { tcg_out_mov(s, TCG_TYPE_I32, arg, l->addrhi_reg); tcg_out_mov(s, TCG_TYPE_I32, arg + 1, l->addrlo_reg); --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671927297; cv=none; d=zohomail.com; s=zohoarc; b=ipaOuaS01rDbkPAJ81G72q+LnxGc+K5R8js4vohqSj5ZseBdssOZC8ZAams5Z5cw6a9k0Tg85WbAxLHCOfPq5K1sTybuILWYWNDXvo4DgFWkkfV///Mo+X0tfTGdYvSKetqdFNwPpWA/rf/xMtFUUp7xMs7NXQFdwdo8iJj7FR8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671927297; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZOnun1gj2MJ7bcEZ/RrytneSuuImjXAZrtV+jstCUNA=; b=Ig8YUVpoy1whw/YTuzI1zvVfFd2K8yb7qyv7J1a+OXIZaJlcnJT0Rwli2EJExSoz4jpAtJElii3tOqDY6J/OCY1JNcJ1Hbuc7AIh0SymiE0sHwv7K33HFssvjIPlHVwarCk1pDbb2AO07v99K8tOn65k5/2tuUh+1dW8m3T8utA= 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 1671927297848333.55460893590384; Sat, 24 Dec 2022 16:14:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EP0-0002iz-7W; Sat, 24 Dec 2022 18:58:06 -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 1p9EOo-0002Q3-3l for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:56 -0500 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOl-0006GT-Vh for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:53 -0500 Received: by mail-pj1-x1029.google.com with SMTP id u15-20020a17090a3fcf00b002191825cf02so8001218pjm.2 for ; Sat, 24 Dec 2022 15:57:51 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=ZOnun1gj2MJ7bcEZ/RrytneSuuImjXAZrtV+jstCUNA=; b=kCXoFVORgdO7M1aK713svJr+4aj+zxFcfuOyAU2t2VIKYmm+1CsoA9FnxYyIBsu4jH qMNIpcwiXhxmut6fHn2ax4p1zRDdH0qyUkgaUZlgrthsriY9l0x0mZUlNB4sUtKPhTqL EosS0uJk3ur6IhbTch9o2ks7fmb5hgBWb/rGgb9weEO9FHTkg3ZwE82vp2QYLfrr+Beu OgJn+Z/x/o10d3rtWDquJWLyf2cGf55hbCnM2GbluSt5RK7+y7rCoU1GsMo43nj0bp3O eu2Q4U8vitSBPQwot9Y/EhYaHA28s4fgsd9u8UANGxrnf9uqz24lVZBuyUb07CgsN7h5 Ck7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=ZOnun1gj2MJ7bcEZ/RrytneSuuImjXAZrtV+jstCUNA=; b=A2ol8qbrLLOngMBuD8ayOCO0NpgvU6BR2Iq8C3El1CjDzVOxZqnQjtL8rlhcuJfIKz iHPR87qhPNv0YX7+InxZG0sqAUpNNhQwOE3nD0rCTBUCoq/noquljHN9L+HVfJsCK5Cz ZGDF6QxmQXqWPfhVhCtZVXDNhzKwkiGOLeYrPOtdFo1/vAQhJu85X/Pkl4xV1RRS9kLn MFk3PL8L9/y9+LragYwZ9aYqmcZKWcaBC0XjvcaUyy60wEeq/pkhh31pIlV9h4wx/T0s /qnALRbtVdF5QuG2jt5U7sB0FIwTahc4hXyIum/UGDvggmcBf9Xw7GUPB7ZzbBEGJDJk a6cA== X-Gm-Message-State: AFqh2krll9B8AsGXeX+4TmvHXpXXeeOxE34AAkoO8H3QBU73cYXAwRvs Tk/HYL2cr9cpd5HZOVAC1gkW8maBeSrFG3f9 X-Google-Smtp-Source: AMrXdXushKzAqITpqRazBdfiDttaXnv7g0ihtgqhbfPdWPtZ+HtBhkl1GDj5oGAs6QsoltZTRAOQLA== X-Received: by 2002:a17:902:b58e:b0:191:24a:63e3 with SMTP id a14-20020a170902b58e00b00191024a63e3mr14393665pls.50.1671926270757; Sat, 24 Dec 2022 15:57:50 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 30/43] tcg: Replace TCG_TARGET_EXTEND_ARGS with TCG_TARGET_CALL_ARG_I32 Date: Sat, 24 Dec 2022 15:57:07 -0800 Message-Id: <20221224235720.842093-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671927299087100001 For 64-bit hosts that had TCG_TARGET_EXTEND_ARGS, set TCG_TARGET_CALL_ARG_I32 to TCG_CALL_ARG_EXTEND. Otherwise, use TCG_CALL_ARG_NORMAL. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.h | 1 + tcg/arm/tcg-target.h | 1 + tcg/i386/tcg-target.h | 1 + tcg/loongarch64/tcg-target.h | 1 + tcg/mips/tcg-target.h | 1 + tcg/riscv/tcg-target.h | 1 + tcg/s390x/tcg-target.h | 2 +- tcg/sparc64/tcg-target.h | 2 +- tcg/tci/tcg-target.h | 1 + tcg/tcg.c | 42 ++++++++++++++++++------------------ tcg/ppc/tcg-target.c.inc | 6 +++++- 11 files changed, 35 insertions(+), 24 deletions(-) diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index d9dd777caa..413a5410c5 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -52,6 +52,7 @@ typedef enum { #define TCG_REG_CALL_STACK TCG_REG_SP #define TCG_TARGET_STACK_ALIGN 16 #define TCG_TARGET_CALL_STACK_OFFSET 0 +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL #define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL =20 /* optional instructions */ diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index 09dd0550aa..b7843d2d54 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -89,6 +89,7 @@ extern bool use_neon_instructions; /* used for function call generation */ #define TCG_TARGET_STACK_ALIGN 8 #define TCG_TARGET_CALL_STACK_OFFSET 0 +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL #define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_EVEN =20 /* optional instructions */ diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 42628a2791..7edb7f1d9a 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -98,6 +98,7 @@ typedef enum { #else #define TCG_TARGET_CALL_STACK_OFFSET 0 #endif +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL #define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL =20 extern bool have_bmi1; diff --git a/tcg/loongarch64/tcg-target.h b/tcg/loongarch64/tcg-target.h index 19d4c07170..e5f7a1f09d 100644 --- a/tcg/loongarch64/tcg-target.h +++ b/tcg/loongarch64/tcg-target.h @@ -93,6 +93,7 @@ typedef enum { #define TCG_REG_CALL_STACK TCG_REG_SP #define TCG_TARGET_STACK_ALIGN 16 #define TCG_TARGET_CALL_STACK_OFFSET 0 +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL #define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL =20 /* optional instructions */ diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h index bb7312aed4..15721c3e42 100644 --- a/tcg/mips/tcg-target.h +++ b/tcg/mips/tcg-target.h @@ -88,6 +88,7 @@ typedef enum { # define TCG_TARGET_CALL_STACK_OFFSET 0 # define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL #endif +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL =20 /* MOVN/MOVZ instructions detection */ #if (defined(__mips_isa_rev) && (__mips_isa_rev >=3D 1)) || \ diff --git a/tcg/riscv/tcg-target.h b/tcg/riscv/tcg-target.h index 2ab4b8d04a..232537ccea 100644 --- a/tcg/riscv/tcg-target.h +++ b/tcg/riscv/tcg-target.h @@ -82,6 +82,7 @@ typedef enum { #define TCG_REG_CALL_STACK TCG_REG_SP #define TCG_TARGET_STACK_ALIGN 16 #define TCG_TARGET_CALL_STACK_OFFSET 0 +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL #if TCG_TARGET_REG_BITS =3D=3D 32 #define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_EVEN #else diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index 3f77fcf5b3..22d70d431b 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -166,9 +166,9 @@ extern uint64_t s390_facilities[3]; /* used for function call generation */ #define TCG_TARGET_STACK_ALIGN 8 #define TCG_TARGET_CALL_STACK_OFFSET 160 +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_EXTEND #define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL =20 -#define TCG_TARGET_EXTEND_ARGS 1 #define TCG_TARGET_HAS_MEMORY_BSWAP 1 =20 #define TCG_TARGET_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) diff --git a/tcg/sparc64/tcg-target.h b/tcg/sparc64/tcg-target.h index 44ac164b31..0044ac8d78 100644 --- a/tcg/sparc64/tcg-target.h +++ b/tcg/sparc64/tcg-target.h @@ -71,7 +71,7 @@ typedef enum { #define TCG_TARGET_STACK_BIAS 2047 #define TCG_TARGET_STACK_ALIGN 16 #define TCG_TARGET_CALL_STACK_OFFSET (128 + 6*8 + TCG_TARGET_STACK_BIAS) -#define TCG_TARGET_EXTEND_ARGS 1 +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_EXTEND #define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL =20 #if defined(__VIS__) && __VIS__ >=3D 0x300 diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h index e11c293906..d6e0450ed8 100644 --- a/tcg/tci/tcg-target.h +++ b/tcg/tci/tcg-target.h @@ -158,6 +158,7 @@ typedef enum { /* Used for function call generation. */ #define TCG_TARGET_CALL_STACK_OFFSET 0 #define TCG_TARGET_STACK_ALIGN 8 +#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL #if TCG_TARGET_REG_BITS =3D=3D 32 # define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_EVEN #else diff --git a/tcg/tcg.c b/tcg/tcg.c index 3ca25f7a28..4c397cb0fa 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1494,24 +1494,24 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int na= rgs, TCGTemp **args) } #endif =20 -#if defined(TCG_TARGET_EXTEND_ARGS) && TCG_TARGET_REG_BITS =3D=3D 64 - for (i =3D 0; i < nargs; ++i) { - int argtype =3D extract32(typemask, (i + 1) * 3, 3); - bool is_32bit =3D (argtype & ~1) =3D=3D dh_typecode_i32; - bool is_signed =3D argtype & 1; + if (TCG_TARGET_CALL_ARG_I32 =3D=3D TCG_CALL_ARG_EXTEND) { + for (i =3D 0; i < nargs; ++i) { + int argtype =3D extract32(typemask, (i + 1) * 3, 3); + bool is_32bit =3D (argtype & ~1) =3D=3D dh_typecode_i32; + bool is_signed =3D argtype & 1; =20 - if (is_32bit) { - TCGv_i64 temp =3D tcg_temp_new_i64(); - TCGv_i32 orig =3D temp_tcgv_i32(args[i]); - if (is_signed) { - tcg_gen_ext_i32_i64(temp, orig); - } else { - tcg_gen_extu_i32_i64(temp, orig); + if (is_32bit) { + TCGv_i64 temp =3D tcg_temp_new_i64(); + TCGv_i32 orig =3D temp_tcgv_i32(args[i]); + if (is_signed) { + tcg_gen_ext_i32_i64(temp, orig); + } else { + tcg_gen_extu_i32_i64(temp, orig); + } + args[i] =3D tcgv_i64_temp(temp); } - args[i] =3D tcgv_i64_temp(temp); } } -#endif /* TCG_TARGET_EXTEND_ARGS */ =20 op =3D tcg_emit_op(INDEX_op_call); =20 @@ -1572,16 +1572,16 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int na= rgs, TCGTemp **args) tcg_debug_assert(TCGOP_CALLI(op) =3D=3D real_args); tcg_debug_assert(pi <=3D ARRAY_SIZE(op->args)); =20 -#if defined(TCG_TARGET_EXTEND_ARGS) && TCG_TARGET_REG_BITS =3D=3D 64 - for (i =3D 0; i < nargs; ++i) { - int argtype =3D extract32(typemask, (i + 1) * 3, 3); - bool is_32bit =3D (argtype & ~1) =3D=3D dh_typecode_i32; + if (TCG_TARGET_CALL_ARG_I32 =3D=3D TCG_CALL_ARG_EXTEND) { + for (i =3D 0; i < nargs; ++i) { + int argtype =3D extract32(typemask, (i + 1) * 3, 3); + bool is_32bit =3D (argtype & ~1) =3D=3D dh_typecode_i32; =20 - if (is_32bit) { - tcg_temp_free_internal(args[i]); + if (is_32bit) { + tcg_temp_free_internal(args[i]); + } } } -#endif /* TCG_TARGET_EXTEND_ARGS */ } =20 static void tcg_reg_alloc_start(TCGContext *s) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index c2e6bc3296..38ee9974cd 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -44,6 +44,11 @@ # endif #endif =20 +#if TCG_TARGET_REG_BITS =3D=3D 64 +# define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_EXTEND +#else +# define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL +#endif #ifdef _CALL_SYSV # define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_EVEN #else @@ -2520,7 +2525,6 @@ static void tcg_out_nop_fill(tcg_insn_unit *p, int co= unt) =20 /* Parameters for function call generation, used in tcg.c. */ #define TCG_TARGET_STACK_ALIGN 16 -#define TCG_TARGET_EXTEND_ARGS 1 =20 #ifdef _CALL_AIX # define LINK_AREA_SIZE (6 * SZR) --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926977; cv=none; d=zohomail.com; s=zohoarc; b=cO2/Yuqd765whzw8G44TL+zTM6cYCOpVdd5PN0FCZaxsVbxUPZV8AyXXAEq0dV4kAYWBp610qP3SiSVcAltlCeReBe9xjX/l6DKy3k8Ng6LOoHEXF2Qn/nvljrybqqpfuCeHBcx/SExEwTLM3bm2RCCV4SCl1KPLWOiBfm0YL7E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926977; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kcsaITVUaZwX2W3VYFeAudOGzYmg0UWJ+TXMDg4IToo=; b=UeVibufra4HLyho/LosIE340n4rJrQNIoO6yD6MuYa4Rltezw1ry1aH4wOVrBwkC4ZVZgSD0fwwdT+j68ysvy42qWT9bVk1V5eoaTQ/Lf9SaloJqmMaB0ej3mkRAH/Z6Hw5ZvSUOG29GN5rHSejft/E0iAFdaXxzxX7MIHnmFfk= 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 1671926977511240.15538269187425; Sat, 24 Dec 2022 16:09:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EP3-0002r6-Ah; Sat, 24 Dec 2022 18:58:09 -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 1p9EOq-0002RC-Ic for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:58 -0500 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOn-0006MK-Sr for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:56 -0500 Received: by mail-pl1-x62f.google.com with SMTP id n4so8059897plp.1 for ; Sat, 24 Dec 2022 15:57:52 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=kcsaITVUaZwX2W3VYFeAudOGzYmg0UWJ+TXMDg4IToo=; b=jclAvtQpEMht6X8kAgklHePWZ4Cy017+ccVOunlfQdQl+gA/l0pM7mzIUwl/jXCcIn d8Wv0gKw2DmMrTCsyq9jDFdpfPqZKAPwePd/dQqLwPWLTxzZUM+oXSrwJyFCsrwHxzqX gHy+z4mzAMNjBYfBPWQuWaPjGOd7MDEAV71PDMHI88rc2ftKdD86nRf5chuHRC5CVxih jyXITetFJo5SWXy1zqq8uWwe9t040PYzT7wn49RTk0vvWgnKD/6Utsn7z7HoGIE7H15K MwuW9DfjfUL7DpS3F+lUm2J4rvu73BvS8vIKCITFz4Rmgac3jNYGewTmTTZ63PUVabk4 FZtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=kcsaITVUaZwX2W3VYFeAudOGzYmg0UWJ+TXMDg4IToo=; b=eCR+OjTVG4m2zQpXrD+lhOMHovuOsu7Jn7VU4NLv8wtZ65fYi7p0sGXewxZlfcM3Cw Q5Xjuv3nnNuqTZajMMW2IYj3OaBQp/fvqhtuZKjS6dapDM5/hkniwJG//E6TDanAgdrx 7L05Xo44LYuVAGMHwCE4NIAF4I2K7iQZ8f5WxsW4wJXgn0QrUgw5ACC/8M0t87zEMcc4 n0N9wr+6BA/1+CCseVmb0DfBku738aOB66uKq0u9aWhO+hExvJhkxUPGqg2Rdh8Pq5eg uQz5LV1E1VNx8H4EXSjiklI078Dhpw1Fk8DDBbMf6duI9s7l/MfAEQGISNLQpV1c7Oom d7cw== X-Gm-Message-State: AFqh2kqtQDYslh7dqIaPlMPXbHctaKd0qLwcSthYDa1TJo3wli5tGvcY n4ZeSH8qwVc8EieDQm9A57h9QxJevjp5RDKe X-Google-Smtp-Source: AMrXdXvXr4WpkW/gTIdxtn17u0A6MebnEM3UijGDaLIslZeGg0ZlFeuh3oHamzFvoa+ZY22xSpErHg== X-Received: by 2002:a17:903:2341:b0:192:5e53:15f3 with SMTP id c1-20020a170903234100b001925e5315f3mr11633256plh.48.1671926271633; Sat, 24 Dec 2022 15:57:51 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 31/43] tcg: Use TCG_CALL_ARG_EVEN for TCI special case Date: Sat, 24 Dec 2022 15:57:08 -0800 Message-Id: <20221224235720.842093-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926979772100003 Change 32-bit tci TCG_TARGET_CALL_ARG_I32 to TCG_CALL_ARG_EVEN, to force 32-bit values to be aligned to 64-bit. With a small reorg to the argument processing loop, this neatly replaces an ifdef for CONFIG_TCG_INTERPRETER. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/tci/tcg-target.h | 3 +- tcg/tcg.c | 70 ++++++++++++++++++++++++++++---------------- 2 files changed, 47 insertions(+), 26 deletions(-) diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h index d6e0450ed8..94ec541b4e 100644 --- a/tcg/tci/tcg-target.h +++ b/tcg/tci/tcg-target.h @@ -158,10 +158,11 @@ typedef enum { /* Used for function call generation. */ #define TCG_TARGET_CALL_STACK_OFFSET 0 #define TCG_TARGET_STACK_ALIGN 8 -#define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL #if TCG_TARGET_REG_BITS =3D=3D 32 +# define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_EVEN # define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_EVEN #else +# define TCG_TARGET_CALL_ARG_I32 TCG_CALL_ARG_NORMAL # define TCG_TARGET_CALL_ARG_I64 TCG_CALL_ARG_NORMAL #endif =20 diff --git a/tcg/tcg.c b/tcg/tcg.c index 4c397cb0fa..aae4046e1b 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1533,36 +1533,56 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int na= rgs, TCGTemp **args) real_args =3D 0; for (i =3D 0; i < nargs; i++) { int argtype =3D extract32(typemask, (i + 1) * 3, 3); - bool is_64bit =3D (argtype & ~1) =3D=3D dh_typecode_i64; - bool want_align =3D false; + TCGCallArgumentKind kind; + TCGType type; =20 -#if defined(CONFIG_TCG_INTERPRETER) - /* - * Align all arguments, so that they land in predictable places - * for passing off to ffi_call. - */ - want_align =3D true; -#else - /* Some targets want aligned 64 bit args */ - if (is_64bit) { - want_align =3D TCG_TARGET_CALL_ARG_I64 =3D=3D TCG_CALL_ARG_EVE= N; - } -#endif - - if (TCG_TARGET_REG_BITS < 64 && want_align && (real_args & 1)) { - op->args[pi++] =3D TCG_CALL_DUMMY_ARG; - real_args++; + switch (argtype) { + case dh_typecode_i32: + case dh_typecode_s32: + type =3D TCG_TYPE_I32; + break; + case dh_typecode_i64: + case dh_typecode_s64: + type =3D TCG_TYPE_I64; + break; + case dh_typecode_ptr: + type =3D TCG_TYPE_PTR; + break; + default: + g_assert_not_reached(); } =20 - if (TCG_TARGET_REG_BITS < 64 && is_64bit) { + switch (type) { + case TCG_TYPE_I32: + kind =3D TCG_TARGET_CALL_ARG_I32; + break; + case TCG_TYPE_I64: + kind =3D TCG_TARGET_CALL_ARG_I64; + break; + default: + g_assert_not_reached(); + } + + switch (kind) { + case TCG_CALL_ARG_EVEN: + if (real_args & 1) { + op->args[pi++] =3D TCG_CALL_DUMMY_ARG; + real_args++; + } + /* fall through */ + case TCG_CALL_ARG_NORMAL: + if (TCG_TARGET_REG_BITS =3D=3D 32 && type =3D=3D TCG_TYPE_I64)= { + op->args[pi++] =3D temp_arg(args[i]); + op->args[pi++] =3D temp_arg(args[i] + 1); + real_args +=3D 2; + break; + } op->args[pi++] =3D temp_arg(args[i]); - op->args[pi++] =3D temp_arg(args[i] + 1); - real_args +=3D 2; - continue; + real_args++; + break; + default: + g_assert_not_reached(); } - - op->args[pi++] =3D temp_arg(args[i]); - real_args++; } op->args[pi++] =3D (uintptr_t)func; op->args[pi++] =3D (uintptr_t)info; --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926854; cv=none; d=zohomail.com; s=zohoarc; b=Pc1KvfmAOFTRssqg2LgeMXVkDjS4BtqZUgL5ldAQtjXvCLzmtlvMMrSBmoXOIWBdgXDOwzawNHSPIitVtCnCW0hyfTh3wrJHru3ge7WrDUD4D+QgkF//KYvK1fVrFEG83xeDskFznk+BBf6ZKoKhiIDm1loLrQ3fFu4uzm36KlY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926854; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qmknChCT1BuzZEHCmViTBYnc57/Tlc2QwxNuPPER9qk=; b=BuH4oH1exU+/k3NGJVFPPdUbHRsIaarFtCgwMS/H6I9AwlzaGtMLwnELr4/AmdvPPNY4cfqQZdDUOBZzv1hSLrL6X29F1qNJDYVWAIokbADiwwScaO7wIQGRSly4IQ+I4o9VhJE9UZbd7Qe7SPIGlYrKHftbN+GGF4ay8wN0Vps= 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 1671926854525791.5779306626339; Sat, 24 Dec 2022 16:07:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EP3-0002ra-G3; Sat, 24 Dec 2022 18:58:09 -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 1p9EOp-0002QB-FH for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:56 -0500 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOn-0006Jk-Sv for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:55 -0500 Received: by mail-pj1-x1036.google.com with SMTP id v13-20020a17090a6b0d00b00219c3be9830so7981152pjj.4 for ; Sat, 24 Dec 2022 15:57:52 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=qmknChCT1BuzZEHCmViTBYnc57/Tlc2QwxNuPPER9qk=; b=RxBjxwrcpyDwBOkTD8XlAfWGDxdZYtfY/N6aLzE+tzdd6NgflXKFQofLsJv7aDWFtr Clxg6s31KWSzlv1uD8d5QE9sy29ebIvJ2WCrAEaSZ2fb4fSWQTGIIgHjMla/LGFt836R XYmTudRItEBP9bvsF3rfcz+xhtmEkayhT4FVHf+H9eLZs+k68qnkXGDkOIuXhZFZ6jLg YHlehvT40hsIbCEf/tkLt4Vxmk2O2oyjGxQE+lxrGzimNAF1EDmpdCeH6PnPPjausUk2 bQfFVMkupu0taejvKhVXmI9BAM1NRrD0GLTFNgOMahcNidh10QPMNY7lIYM3AlQ9In5y Xy4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=qmknChCT1BuzZEHCmViTBYnc57/Tlc2QwxNuPPER9qk=; b=lphPCan38dFk3kTTeCfdggGbe/eZzyIop3b/AtG7zinYSLzjrrgOllBeSmCDyX3TRW Hduf0M2CkyCArwUxDjTuro1Tjo7Bu5BVmKe6pyT6ZpQfpnGKSw+7mI1KOaBX76KPS2fc kljos1Ddcs1ZiNwZUsFcMKOn1AKqD8zsUm3NSx/X6+YZ9iZ8t/r2Lb2W186dFwjuWDof tBRN4zUVBXHWZdR8woSmdYUU+NTz8xk4YIrMpGUakroIzmVAE2T1tc6Bm+lQCKTSynL1 ii8xk/vrvoRO7+hORLkMNXoKwqIlPC8m1mV40h4VDv5YcvAzMHKsda17T2D/TtdXY+4q Sg7A== X-Gm-Message-State: AFqh2krCWd6LkSfDEaFJMZp5uR4Dct7rITeZ5qLVJOCiax1xoscC7xSC AsHeVOfL/s2pS7eVsNAW2Lo30UaBLRWHekTp X-Google-Smtp-Source: AMrXdXtcLMCFP2sYjXGQ15Xa9r6g3L4dfdsLeL8PpuEelrFQDFGnKtREmlW07hD3t4vCXhfgi4MTwg== X-Received: by 2002:a17:902:cf02:b0:191:283d:5afb with SMTP id i2-20020a170902cf0200b00191283d5afbmr15403615plg.50.1671926272502; Sat, 24 Dec 2022 15:57:52 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 32/43] accel/tcg/plugin: Don't search for the function pointer index Date: Sat, 24 Dec 2022 15:57:09 -0800 Message-Id: <20221224235720.842093-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926855212100001 The function pointer is immediately after the output and input operands; no need to search. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 80dff68934..9e359c006a 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -381,32 +381,25 @@ static TCGOp *copy_st_ptr(TCGOp **begin_op, TCGOp *op) static TCGOp *copy_call(TCGOp **begin_op, TCGOp *op, void *empty_func, void *func, int *cb_idx) { + TCGOp *old_op; + int func_idx; + /* copy all ops until the call */ do { op =3D copy_op_nocheck(begin_op, op); } while (op->opc !=3D INDEX_op_call); =20 /* fill in the op call */ - op->param1 =3D (*begin_op)->param1; - op->param2 =3D (*begin_op)->param2; + old_op =3D *begin_op; + TCGOP_CALLI(op) =3D TCGOP_CALLI(old_op); + TCGOP_CALLO(op) =3D TCGOP_CALLO(old_op); tcg_debug_assert(op->life =3D=3D 0); - if (*cb_idx =3D=3D -1) { - int i; =20 - /* - * Instead of working out the position of the callback in args[], = just - * look for @empty_func, since it should be a unique pointer. - */ - for (i =3D 0; i < MAX_OPC_PARAM_ARGS; i++) { - if ((uintptr_t)(*begin_op)->args[i] =3D=3D (uintptr_t)empty_fu= nc) { - *cb_idx =3D i; - break; - } - } - tcg_debug_assert(i < MAX_OPC_PARAM_ARGS); - } - op->args[*cb_idx] =3D (uintptr_t)func; - op->args[*cb_idx + 1] =3D (*begin_op)->args[*cb_idx + 1]; + func_idx =3D TCGOP_CALLO(op) + TCGOP_CALLI(op); + *cb_idx =3D func_idx; + + op->args[func_idx] =3D (uintptr_t)func; + op->args[func_idx + 1] =3D old_op->args[func_idx + 1]; =20 return op; } --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671927335; cv=none; d=zohomail.com; s=zohoarc; b=nQhS1Z+h37gtWzEOLcSG0Ha4HomE2jKCL09e1ZsotLqHoE5yHhz16lQHI2kJqkpEUqPJnQ5fBqLUqqiaKCSlDaHyAfUhybVQ0P6NtzVwBPd0ynazphXx9axU3mji5tzlaPrewK0DIB7f9E/IaRVIDNbMf5mt8tmJL1ZTrVdyuwI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671927335; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WRnYCcPWX5BOQQf1a59sccPy8bi18QDF38eChoryi3g=; b=feqKFeahg5Fc+GY1/0rAT2YY2cb5ZVUEAbIEB7eU7envfwRDKzk0RhVeiiJzRvsKWtemgCkna8DYCpsntYmLGOpOuQM8OJjbhYXF3sUtlPCtHdYhYQ0h3AEDuPB2oF3uBjQxHE/+UbPbzJd6ksyenGL9OQS3UmTz+cPU8E83y4k= 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 1671927335404222.38197638284691; Sat, 24 Dec 2022 16:15:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EP2-0002qG-CS; Sat, 24 Dec 2022 18:58:08 -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 1p9EOq-0002RE-Lo for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:58 -0500 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOo-0006Mh-Qd for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:56 -0500 Received: by mail-pl1-x62a.google.com with SMTP id d7so8024230pll.9 for ; Sat, 24 Dec 2022 15:57:54 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=WRnYCcPWX5BOQQf1a59sccPy8bi18QDF38eChoryi3g=; b=iqAkJokNkpKws9Yhs9UsbE0fbi9WoVy21F1RhhehesbWsN8tVjrhVaihfSrupf6XtL SdHa/RVz5pIBaG6ulKOd2aq5MWJjN6RoUMDJnsTPPKuM23jW5NFgwkCA4VLg1fjW6B/u c7UFZaQEvLe2RapkDMxADjT54Z209IFZnN0tWr+VPp2JgsReI+Z++7I5VTCWc4AnifTj nioPXCT22smkAkDWJAGZw9uztr1Qx5DLNJ25B1qfiNb+BcR/FYtrkSAOq2uxn9aRX3fS KqkadXTxnG0P8hTk+HuNAShsSjwSk5wIgvWePXmKRypxtCoB2q9JbfH9AncnMHy3Fq5v necg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=WRnYCcPWX5BOQQf1a59sccPy8bi18QDF38eChoryi3g=; b=5dxtwDxQdSkshksicthHB+asl2lzRtXf86kXNwrVweZ0W7KWJdkSD29gPHYCqABJ8N qB7TjH54Kp3eIsBB70jA/CpuAjN5nOWSLuMqJdXgB40lFincEa1b9dhjsrSwdDluGROh NlvKkuWoC0Dp+MEZJxndZBd9GGR8/H/RBD4ow1ilqFQAJ/N684dvy4TiP10SltRs+FRY o51cNmfWqaLUO7ZSmco+wDIpmoZhQgofHUv94O/6NVFen/TinLhhQpuqDB1XhE55SBlU YmuEgsumULp/W/8qVgtWdBu0QR3aTwOZgDEB4olMD2wvsKxZctt3V6sVnIeYXcTqN/pr xQZQ== X-Gm-Message-State: AFqh2kpYuXZCfKRokRD58z8gjl0smEN5xBap6WXP/ZEWUdY80YOGTbr6 O05EomC/Mp1QjGJ1hcKP7GM7bjNrfSIM8Bfc X-Google-Smtp-Source: AMrXdXuAfWeVV11urpVpNX9pYIUvaL1bYHFQwn4PihhMfONicL9wxrp/C6NIAI3Kc+faZRA+FUhH2w== X-Received: by 2002:a17:902:b613:b0:18f:98bb:c08e with SMTP id b19-20020a170902b61300b0018f98bbc08emr14213521pls.36.1671926273443; Sat, 24 Dec 2022 15:57:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 33/43] accel/tcg/plugin: Avoid duplicate copy in copy_call Date: Sat, 24 Dec 2022 15:57:10 -0800 Message-Id: <20221224235720.842093-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671927337286100001 We copied all of the arguments in copy_op_nocheck. We only need to replace the one argument that we change. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 9e359c006a..77e6823d6b 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -397,9 +397,7 @@ static TCGOp *copy_call(TCGOp **begin_op, TCGOp *op, vo= id *empty_func, =20 func_idx =3D TCGOP_CALLO(op) + TCGOP_CALLI(op); *cb_idx =3D func_idx; - op->args[func_idx] =3D (uintptr_t)func; - op->args[func_idx + 1] =3D old_op->args[func_idx + 1]; =20 return op; } --=20 2.34.1 From nobody Sat May 18 21:45:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671926931545840.5427300072504; Sat, 24 Dec 2022 16:08:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EP1-0002oc-KG; Sat, 24 Dec 2022 18:58:07 -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 1p9EOq-0002RG-PX for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:58 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOp-0006Lh-4n for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:56 -0500 Received: by mail-pl1-x62c.google.com with SMTP id s7so8041314plk.5 for ; Sat, 24 Dec 2022 15:57:54 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=mg8MgGwO6jjwnW8nsumFgvs1cdVJMS+XlnPx9WvPnOA=; b=jVsHDW2dOsj9Uf9ClwroBVKqF4rtBnpBQ9zw9TuZdJ5Iq+O3j59xtERtroqKlLFWaJ wToULnB5bNRu7PJGAHOUWXS8BsmqCgc1vNpMM8vYsrgua2qz6VexWKmAzAS/N4z0MQgb AQg1BBgITQSU79QVyHDtTYvxY5Dj6AtEpjK9/ONbieWof3Q2ZbqwMaG961rRBXtkafXO 2ROX+k4rm2tY3FRLIh9tCggJJ/M5QLEvXfhPArhMcqjvV2kWtQRKlzevpBNcQpf+vLSH a/5FvTMUukj/5mUfJBNNeDvCmixw+0fMnktj/sJm8qc/4zb/JY8vjJwYqQvgwfVjwoTk 3/cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=mg8MgGwO6jjwnW8nsumFgvs1cdVJMS+XlnPx9WvPnOA=; b=P1AjQjx19VwZ8QK/EKbi9IJ9xUi6NN+lsIa/P1oSC0YrOySQk8POOJS4JDj8HkZs27 AVyNVLDE7dWVjFLnb5IDCxBL+rSLC/L0Gc++xnZkIltovCuvK8IVWGYF3kHZw7qZgNeL SxNvxiw4Jdtz4HKMX20PTyO+k+D2zNU3r43vmbrScK4Idc5SowKpw9ebzuSN8gjowtnt clFd3oi1b0Nrt6ZtmoRqUKiyKp6fpkFvGC0RyPb3ksq9PM704i7B/ZCRKgdMM/y2sdJe 79HLEhS8BuqQctjzAO003DjW+IWn5eU1u2v4qs9S9zOneFmaf2k2npR0piFz5dObUlfv fuqA== X-Gm-Message-State: AFqh2kokimaLJd1VPagzy76DFXepvPuXJU+WyVWBjRSaQ0b081csKmR1 x94IkGaITBIJVqe5EIF62Eozep0ztVuIG65K X-Google-Smtp-Source: AMrXdXvTTYG8+6uHiwnLAhiHTTNI5I9xI/nUhVyR1ntt2sC74YRC8TtuPzvUfYN8fXqZur0TJImVQA== X-Received: by 2002:a17:902:aa8e:b0:191:4575:48aa with SMTP id d14-20020a170902aa8e00b00191457548aamr14484923plr.11.1671926274440; Sat, 24 Dec 2022 15:57:54 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 34/43] accel/tcg/plugin: Use copy_op in append_{udata, mem}_cb Date: Sat, 24 Dec 2022 15:57:11 -0800 Message-Id: <20221224235720.842093-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1671926933485100003 Better to re-use the existing function for copying ops. Acked-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 77e6823d6b..a6aaacd053 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -415,11 +415,11 @@ static TCGOp *append_udata_cb(const struct qemu_plugi= n_dyn_cb *cb, op =3D copy_const_ptr(&begin_op, op, cb->userp); =20 /* copy the ld_i32, but note that we only have to copy it once */ - begin_op =3D QTAILQ_NEXT(begin_op, link); - tcg_debug_assert(begin_op && begin_op->opc =3D=3D INDEX_op_ld_i32); if (*cb_idx =3D=3D -1) { - op =3D tcg_op_insert_after(tcg_ctx, op, INDEX_op_ld_i32); - memcpy(op->args, begin_op->args, sizeof(op->args)); + op =3D copy_op(&begin_op, op, INDEX_op_ld_i32); + } else { + begin_op =3D QTAILQ_NEXT(begin_op, link); + tcg_debug_assert(begin_op && begin_op->opc =3D=3D INDEX_op_ld_i32); } =20 /* call */ @@ -462,11 +462,11 @@ static TCGOp *append_mem_cb(const struct qemu_plugin_= dyn_cb *cb, op =3D copy_const_ptr(&begin_op, op, cb->userp); =20 /* copy the ld_i32, but note that we only have to copy it once */ - begin_op =3D QTAILQ_NEXT(begin_op, link); - tcg_debug_assert(begin_op && begin_op->opc =3D=3D INDEX_op_ld_i32); if (*cb_idx =3D=3D -1) { - op =3D tcg_op_insert_after(tcg_ctx, op, INDEX_op_ld_i32); - memcpy(op->args, begin_op->args, sizeof(op->args)); + op =3D copy_op(&begin_op, op, INDEX_op_ld_i32); + } else { + begin_op =3D QTAILQ_NEXT(begin_op, link); + tcg_debug_assert(begin_op && begin_op->opc =3D=3D INDEX_op_ld_i32); } =20 /* extu_tl_i64 */ --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926308; cv=none; d=zohomail.com; s=zohoarc; b=Iid1mO5AZLzvE3clgwSbmUDG39R6GOfMjfbsgkRzLaH1ovOmsGzVfydaZzf4WuduPvr19lYw0os9Ms4cH/l/nK4APuZe9CxTridoiDNN5LR5R20qCt9jyr+9ui8mLH0hr/DAkU8HNiPqks0fnHbWtjo3rfqO5PXrIZXB8rgZ324= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926308; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ct74BpbnxovFEC/YFVNT80uRSuWyPTl3WEsL/cNtiK4=; b=PPjq61Kt5atQgVJmv1lGjBDMv7/8o5Uwjq2q76oEPL+F8v0sNelKwSOSLotQ+LHJMnRDvgzyUMJaBl9YOERfP2AxOFvEU0vnkJ3UeqIzKmLIqaggPUdkyMO5Nc2mRZyQHZwKSddhCE+untVgciLDEZY79e6o8afZluzKR5oimrs= 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 1671926308554115.11079187500991; Sat, 24 Dec 2022 15:58:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EP1-0002p8-Rj; Sat, 24 Dec 2022 18:58:07 -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 1p9EOs-0002SF-UW for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:58:02 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOq-0006N5-P5 for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:58 -0500 Received: by mail-pl1-x62c.google.com with SMTP id d7so8024273pll.9 for ; Sat, 24 Dec 2022 15:57:56 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=ct74BpbnxovFEC/YFVNT80uRSuWyPTl3WEsL/cNtiK4=; b=OpEgKkOEqkc8K83kWSRFS5zm39l/CsYVdHKPYMxmB+8aayxNdmZKeEXwm40dmFc1fo zyaS1fxDNKy1xTggIcytqzXiW4u672d/GvkwwVngLzPWDe9yI8RWz4ubdJy5HaSCkGtV npNA3dXcPHnd7U/JkrirRo3Do/VNP1bYqlbzKlv1HkF1Tc4Q7CXwOwmHLDjG+DYhSmgT pedrHPq3sNXnk41kw/E2w86meMIyCK60378JZ5s1LDf9LMQgGwF7bLWS4JFJYSiZkBHV RxcH7CcC5XE7nmgPKAY/Tibrmfb85bpJs7TFbeJTNXz84NwgJ7Atrm4oOe8Yy1fRCGsv 4uWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=ct74BpbnxovFEC/YFVNT80uRSuWyPTl3WEsL/cNtiK4=; b=EHsCvkub1LsGSHadrdC8mNbOr5UmkVYhrPXMczZNgWOG6uXqPPjIRd3kNGHfas9iP+ NFyW76hAQYwekG+v92dl3ZiocAWHTsJR19Q3Wvbz9tRW9tLMKkgFzbKH2u3/PcchtvEW Zl6Fw4BQINIlR1rRNzEy5OoN7RJl+Fcw0wf/7AnsfxFCK7cwLbpcWZYMWJYnUYXB2wky Q6I2RhPEDBX9ZQaCvRj6QRHT46KsvgKQ5uOPPClHjFDwbV4CbhFvuddV/R68JbgZZRDB e4b9S7yAXzmJ2rN/vDoBAWsapFDP3SVHMYGs2Ej26yC2Y5gITEcCzFu+ctG4pBokuHEF 3U6A== X-Gm-Message-State: AFqh2kqoypAkoJurZ/y4N+KseHF7HI2JvnTLYPTwKo5lsPczYLpwjU3z 2PThBU+4utW4gfgGrVPjCJWgUYWfwHrKxvF1 X-Google-Smtp-Source: AMrXdXsxOIGJRRlwjNKlSwnWUtVpBQ5rZAPjvvN7PvC8M6nkNworMaXGVV01a420Aibv6tzAcLMGMA== X-Received: by 2002:a17:902:fe0c:b0:192:5c3e:8939 with SMTP id g12-20020a170902fe0c00b001925c3e8939mr8639073plj.0.1671926275272; Sat, 24 Dec 2022 15:57:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 35/43] tcg: Pass number of arguments to tcg_emit_op() / tcg_op_insert_*() Date: Sat, 24 Dec 2022 15:57:12 -0800 Message-Id: <20221224235720.842093-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926311287100003 From: Philippe Mathieu-Daud=C3=A9 In order to have variable size allocated TCGOp, pass the number of arguments we use (and would allocate) up to tcg_op_alloc(). This alters tcg_emit_op(), tcg_op_insert_before() and tcg_op_insert_after() prototypes. In tcg_op_alloc() ensure the number of arguments is in range. Signed-off-by: Richard Henderson [PMD: Extracted from bigger patch] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20221218211832.73312-2-philmd@linaro.org> Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/tcg/tcg-op.h | 2 +- include/tcg/tcg.h | 8 +++++--- accel/tcg/plugin-gen.c | 5 ++++- tcg/optimize.c | 4 ++-- tcg/tcg-op-vec.c | 8 ++++---- tcg/tcg-op.c | 12 ++++++------ tcg/tcg.c | 30 +++++++++++++++++------------- 7 files changed, 39 insertions(+), 30 deletions(-) diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 8176f194cb..79b1cf786f 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -818,7 +818,7 @@ static inline void tcg_gen_plugin_cb_start(unsigned fro= m, unsigned type, =20 static inline void tcg_gen_plugin_cb_end(void) { - tcg_emit_op(INDEX_op_plugin_cb_end); + tcg_emit_op(INDEX_op_plugin_cb_end, 0); } =20 #if TARGET_LONG_BITS =3D=3D 32 diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 8bcd60d0ed..c55fa21a89 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -1014,10 +1014,12 @@ bool tcg_op_supported(TCGOpcode op); =20 void tcg_gen_callN(void *func, TCGTemp *ret, int nargs, TCGTemp **args); =20 -TCGOp *tcg_emit_op(TCGOpcode opc); +TCGOp *tcg_emit_op(TCGOpcode opc, unsigned nargs); void tcg_op_remove(TCGContext *s, TCGOp *op); -TCGOp *tcg_op_insert_before(TCGContext *s, TCGOp *op, TCGOpcode opc); -TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *op, TCGOpcode opc); +TCGOp *tcg_op_insert_before(TCGContext *s, TCGOp *op, + TCGOpcode opc, unsigned nargs); +TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *op, + TCGOpcode opc, unsigned nargs); =20 /** * tcg_remove_ops_after: diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index a6aaacd053..62e775d34d 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -258,10 +258,13 @@ static TCGOp *rm_ops(TCGOp *op) =20 static TCGOp *copy_op_nocheck(TCGOp **begin_op, TCGOp *op) { + unsigned nargs =3D ARRAY_SIZE(op->args); + *begin_op =3D QTAILQ_NEXT(*begin_op, link); tcg_debug_assert(*begin_op); - op =3D tcg_op_insert_after(tcg_ctx, op, (*begin_op)->opc); + op =3D tcg_op_insert_after(tcg_ctx, op, (*begin_op)->opc, nargs); memcpy(op->args, (*begin_op)->args, sizeof(op->args)); + return op; } =20 diff --git a/tcg/optimize.c b/tcg/optimize.c index ae081ab29c..1afd50175b 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -962,7 +962,7 @@ static bool fold_addsub2(OptContext *ctx, TCGOp *op, bo= ol add) rh =3D op->args[1]; =20 /* The proper opcode is supplied by tcg_opt_gen_mov. */ - op2 =3D tcg_op_insert_before(ctx->tcg, op, 0); + op2 =3D tcg_op_insert_before(ctx->tcg, op, 0, 2); =20 tcg_opt_gen_movi(ctx, op, rl, al); tcg_opt_gen_movi(ctx, op2, rh, ah); @@ -1613,7 +1613,7 @@ static bool fold_multiply2(OptContext *ctx, TCGOp *op) rh =3D op->args[1]; =20 /* The proper opcode is supplied by tcg_opt_gen_mov. */ - op2 =3D tcg_op_insert_before(ctx->tcg, op, 0); + op2 =3D tcg_op_insert_before(ctx->tcg, op, 0, 2); =20 tcg_opt_gen_movi(ctx, op, rl, l); tcg_opt_gen_movi(ctx, op2, rh, h); diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index 5bf100ea7d..966d41d65a 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -152,7 +152,7 @@ bool tcg_can_emit_vecop_list(const TCGOpcode *list, =20 void vec_gen_2(TCGOpcode opc, TCGType type, unsigned vece, TCGArg r, TCGAr= g a) { - TCGOp *op =3D tcg_emit_op(opc); + TCGOp *op =3D tcg_emit_op(opc, 2); TCGOP_VECL(op) =3D type - TCG_TYPE_V64; TCGOP_VECE(op) =3D vece; op->args[0] =3D r; @@ -162,7 +162,7 @@ void vec_gen_2(TCGOpcode opc, TCGType type, unsigned ve= ce, TCGArg r, TCGArg a) void vec_gen_3(TCGOpcode opc, TCGType type, unsigned vece, TCGArg r, TCGArg a, TCGArg b) { - TCGOp *op =3D tcg_emit_op(opc); + TCGOp *op =3D tcg_emit_op(opc, 3); TCGOP_VECL(op) =3D type - TCG_TYPE_V64; TCGOP_VECE(op) =3D vece; op->args[0] =3D r; @@ -173,7 +173,7 @@ void vec_gen_3(TCGOpcode opc, TCGType type, unsigned ve= ce, void vec_gen_4(TCGOpcode opc, TCGType type, unsigned vece, TCGArg r, TCGArg a, TCGArg b, TCGArg c) { - TCGOp *op =3D tcg_emit_op(opc); + TCGOp *op =3D tcg_emit_op(opc, 4); TCGOP_VECL(op) =3D type - TCG_TYPE_V64; TCGOP_VECE(op) =3D vece; op->args[0] =3D r; @@ -185,7 +185,7 @@ void vec_gen_4(TCGOpcode opc, TCGType type, unsigned ve= ce, static void vec_gen_6(TCGOpcode opc, TCGType type, unsigned vece, TCGArg r, TCGArg a, TCGArg b, TCGArg c, TCGArg d, TCGArg e) { - TCGOp *op =3D tcg_emit_op(opc); + TCGOp *op =3D tcg_emit_op(opc, 6); TCGOP_VECL(op) =3D type - TCG_TYPE_V64; TCGOP_VECE(op) =3D vece; op->args[0] =3D r; diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 6168327030..cd1cd4e736 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -33,20 +33,20 @@ =20 void tcg_gen_op1(TCGOpcode opc, TCGArg a1) { - TCGOp *op =3D tcg_emit_op(opc); + TCGOp *op =3D tcg_emit_op(opc, 1); op->args[0] =3D a1; } =20 void tcg_gen_op2(TCGOpcode opc, TCGArg a1, TCGArg a2) { - TCGOp *op =3D tcg_emit_op(opc); + TCGOp *op =3D tcg_emit_op(opc, 2); op->args[0] =3D a1; op->args[1] =3D a2; } =20 void tcg_gen_op3(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3) { - TCGOp *op =3D tcg_emit_op(opc); + TCGOp *op =3D tcg_emit_op(opc, 3); op->args[0] =3D a1; op->args[1] =3D a2; op->args[2] =3D a3; @@ -54,7 +54,7 @@ void tcg_gen_op3(TCGOpcode opc, TCGArg a1, TCGArg a2, TCG= Arg a3) =20 void tcg_gen_op4(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, TCGArg a4) { - TCGOp *op =3D tcg_emit_op(opc); + TCGOp *op =3D tcg_emit_op(opc, 4); op->args[0] =3D a1; op->args[1] =3D a2; op->args[2] =3D a3; @@ -64,7 +64,7 @@ void tcg_gen_op4(TCGOpcode opc, TCGArg a1, TCGArg a2, TCG= Arg a3, TCGArg a4) void tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, TCGArg a4, TCGArg a5) { - TCGOp *op =3D tcg_emit_op(opc); + TCGOp *op =3D tcg_emit_op(opc, 5); op->args[0] =3D a1; op->args[1] =3D a2; op->args[2] =3D a3; @@ -75,7 +75,7 @@ void tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2, TCG= Arg a3, void tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, TCGArg a4, TCGArg a5, TCGArg a6) { - TCGOp *op =3D tcg_emit_op(opc); + TCGOp *op =3D tcg_emit_op(opc, 6); op->args[0] =3D a1; op->args[1] =3D a2; op->args[2] =3D a3; diff --git a/tcg/tcg.c b/tcg/tcg.c index aae4046e1b..3f172cb1d6 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1479,7 +1479,7 @@ bool tcg_op_supported(TCGOpcode op) and endian swap in tcg_reg_alloc_call(). */ void tcg_gen_callN(void *func, TCGTemp *ret, int nargs, TCGTemp **args) { - int i, real_args, nb_rets, pi; + int i, real_args, nb_rets, pi, max_args; unsigned typemask; const TCGHelperInfo *info; TCGOp *op; @@ -1513,7 +1513,8 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int narg= s, TCGTemp **args) } } =20 - op =3D tcg_emit_op(INDEX_op_call); + max_args =3D ARRAY_SIZE(op->args); + op =3D tcg_emit_op(INDEX_op_call, max_args); =20 pi =3D 0; if (ret !=3D NULL) { @@ -1590,7 +1591,7 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int narg= s, TCGTemp **args) =20 /* Make sure the fields didn't overflow. */ tcg_debug_assert(TCGOP_CALLI(op) =3D=3D real_args); - tcg_debug_assert(pi <=3D ARRAY_SIZE(op->args)); + tcg_debug_assert(pi <=3D max_args); =20 if (TCG_TARGET_CALL_ARG_I32 =3D=3D TCG_CALL_ARG_EXTEND) { for (i =3D 0; i < nargs; ++i) { @@ -2294,11 +2295,12 @@ void tcg_remove_ops_after(TCGOp *op) } } =20 -static TCGOp *tcg_op_alloc(TCGOpcode opc) +static TCGOp *tcg_op_alloc(TCGOpcode opc, unsigned nargs) { TCGContext *s =3D tcg_ctx; TCGOp *op; =20 + assert(nargs < ARRAY_SIZE(op->args)); if (likely(QTAILQ_EMPTY(&s->free_ops))) { op =3D tcg_malloc(sizeof(TCGOp)); } else { @@ -2312,23 +2314,25 @@ static TCGOp *tcg_op_alloc(TCGOpcode opc) return op; } =20 -TCGOp *tcg_emit_op(TCGOpcode opc) +TCGOp *tcg_emit_op(TCGOpcode opc, unsigned nargs) { - TCGOp *op =3D tcg_op_alloc(opc); + TCGOp *op =3D tcg_op_alloc(opc, nargs); QTAILQ_INSERT_TAIL(&tcg_ctx->ops, op, link); return op; } =20 -TCGOp *tcg_op_insert_before(TCGContext *s, TCGOp *old_op, TCGOpcode opc) +TCGOp *tcg_op_insert_before(TCGContext *s, TCGOp *old_op, + TCGOpcode opc, unsigned nargs) { - TCGOp *new_op =3D tcg_op_alloc(opc); + TCGOp *new_op =3D tcg_op_alloc(opc, nargs); QTAILQ_INSERT_BEFORE(old_op, new_op, link); return new_op; } =20 -TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *old_op, TCGOpcode opc) +TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *old_op, + TCGOpcode opc, unsigned nargs) { - TCGOp *new_op =3D tcg_op_alloc(opc); + TCGOp *new_op =3D tcg_op_alloc(opc, nargs); QTAILQ_INSERT_AFTER(&s->ops, old_op, new_op, link); return new_op; } @@ -2937,7 +2941,7 @@ static bool liveness_pass_2(TCGContext *s) TCGOpcode lopc =3D (arg_ts->type =3D=3D TCG_TYPE_I32 ? INDEX_op_ld_i32 : INDEX_op_ld_i64); - TCGOp *lop =3D tcg_op_insert_before(s, op, lopc); + TCGOp *lop =3D tcg_op_insert_before(s, op, lopc, 3); =20 lop->args[0] =3D temp_arg(dir_ts); lop->args[1] =3D temp_arg(arg_ts->mem_base); @@ -3003,7 +3007,7 @@ static bool liveness_pass_2(TCGContext *s) TCGOpcode sopc =3D (arg_ts->type =3D=3D TCG_TYPE_I32 ? INDEX_op_st_i32 : INDEX_op_st_i64); - TCGOp *sop =3D tcg_op_insert_after(s, op, sopc); + TCGOp *sop =3D tcg_op_insert_after(s, op, sopc, 3); TCGTemp *out_ts =3D dir_ts; =20 if (IS_DEAD_ARG(0)) { @@ -3039,7 +3043,7 @@ static bool liveness_pass_2(TCGContext *s) TCGOpcode sopc =3D (arg_ts->type =3D=3D TCG_TYPE_I32 ? INDEX_op_st_i32 : INDEX_op_st_i64); - TCGOp *sop =3D tcg_op_insert_after(s, op, sopc); + TCGOp *sop =3D tcg_op_insert_after(s, op, sopc, 3); =20 sop->args[0] =3D temp_arg(dir_ts); sop->args[1] =3D temp_arg(arg_ts->mem_base); --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671927037; cv=none; d=zohomail.com; s=zohoarc; b=kF6Jx1LCmt0XpgN6ZVO4m7r3gWX+mALMvJZ3c2QP4pV1r3HfxL3bym9i+PqzISd74ihbNRRLfHxoOQw71zlxpRSsUnumyIHhcpO8oriksaqF+GziaVOYsVwYsJ0l9qEFDH6pieDyz3QS0VQjyIFtZmQGjqjbLjND2+5J+BRrr5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671927037; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Lfx7NQBNa74qVtVMBN1GF+GnVW2f4R1cjMJGyuHUTIU=; b=fxwFPCcc6DaNF1Byu+3ePc9lY+ZNBqVL3SN4hWA8675Jpy9K6ytkGOJ5QeId68JAZniOw4bOnMFYynDqYIay5+57hQLq9zlJo1GiUjhHCYDM9np2ra0dyV3/pYwd1dgY8j9YYLuTja5PKj7YB01j/m2Xe5ckf8sgWHBCza8YROw= 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 1671927037267205.71007718337808; Sat, 24 Dec 2022 16:10:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EP4-0002so-3b; Sat, 24 Dec 2022 18:58:10 -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 1p9EOt-0002SH-Dj for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:58:02 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOr-0006NW-Hq for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:57:59 -0500 Received: by mail-pj1-x102e.google.com with SMTP id q17-20020a17090aa01100b002194cba32e9so11950099pjp.1 for ; Sat, 24 Dec 2022 15:57:57 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=Lfx7NQBNa74qVtVMBN1GF+GnVW2f4R1cjMJGyuHUTIU=; b=SUxxmjAJ5HBk3izhUzly2SZjb+UWbMHnRBb3dQyc3Oc1/rdfJXCvJ3zyK/39sAadRO 5cC84ljzRr+eRo0Gf/PnyFpwEar1TtFUKZ1dhOFOnf36ZvP4ZJ7pXt66Rsjl4ZppfWbY 6TpoTw0UgfOc/507omioIGY58k4QvEnEFGbjwX57/l44V9J3jMsx06BjLpgQJnBMD67g ULGJt1OfKXvpThuUFNP/kYffgWHg0n80sNAbTvr38g1o+iL0VrXVJLCjCrdM1Y+QjTvY f4AslFitTjBaYWf3kvCTt5kKF2cgZ/lh9Af5oGxuo+bsEzvXCVzVHvnp32HuEgrw3Lsf aSDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Lfx7NQBNa74qVtVMBN1GF+GnVW2f4R1cjMJGyuHUTIU=; b=RXbabwSMC4GN8QCc/HzGoeMDtRu3K3XnVp7knAdm4R5IClx+xX0BwhXyDj7lTRG01x FvElTTvhpqVm3PWSW/mQ5115O+wPM/k1ssT54nzJXLJ6uOLZsw2W4NG1GKcMB1rAukUk BTts+3oNP8YAwlI5KDRz0tbecdasBMOmmZoF+uC6zjPThDLQ0Qks5wJPnquz6tuPrxCM 2CXdF5DujXeW5cDYggRV79LsaAb5OpsMrJiHAUHbYyCaFtJE9pVT+HKqrKoxYJ2Poy1C fbXHvkitC7rTgFsJm2GQRx+4oQEfbv+MUqYAp/WnI7Eufinz7GdMKLAECx8ysF0Rnvkt L3Gg== X-Gm-Message-State: AFqh2kpDKljaDV6pbAJ/AnO7kArN4iW4dn6x/VjPJ8HM0eg1jbMU6Waj nkd27ZAyhv9eyosNMahDsoZOORou3Z10qjNb X-Google-Smtp-Source: AMrXdXu3RkXYiRu6I7IGuAsadpVflscNB1yd4j/ReNZQ4H4gTHDS+bFG2tZ9BgoWfIGKq7zvaGsn8Q== X-Received: by 2002:a17:902:6845:b0:192:569c:e54c with SMTP id f5-20020a170902684500b00192569ce54cmr11466314pln.53.1671926276204; Sat, 24 Dec 2022 15:57:56 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 36/43] tcg: Vary the allocation size for TCGOp Date: Sat, 24 Dec 2022 15:57:13 -0800 Message-Id: <20221224235720.842093-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671927038029100001 We have been allocating a worst case number of arguments to support calls. Instead, allow the size to vary. By default leave space for 4 args, to maximize reuse, but allow calls to increase the number of args to 32. Signed-off-by: Richard Henderson [PMD: Split patch in two] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20221218211832.73312-3-philmd@linaro.org> --- include/exec/helper-head.h | 2 -- include/tcg/tcg.h | 46 +++++++++++++------------------------- accel/tcg/plugin-gen.c | 10 ++++----- tcg/tcg.c | 35 +++++++++++++++++++++-------- 4 files changed, 47 insertions(+), 46 deletions(-) diff --git a/include/exec/helper-head.h b/include/exec/helper-head.h index e242fed46e..8bdf0f6ea2 100644 --- a/include/exec/helper-head.h +++ b/include/exec/helper-head.h @@ -133,6 +133,4 @@ #define DEF_HELPER_7(name, ret, t1, t2, t3, t4, t5, t6, t7) \ DEF_HELPER_FLAGS_7(name, 0, ret, t1, t2, t3, t4, t5, t6, t7) =20 -/* MAX_OPC_PARAM_IARGS must be set to n if last entry is DEF_HELPER_FLAGS_= n. */ - #endif /* EXEC_HELPER_HEAD_H */ diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index c55fa21a89..d430ea10c8 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -38,20 +38,6 @@ /* XXX: make safe guess about sizes */ #define MAX_OP_PER_INSTR 266 =20 -#if HOST_LONG_BITS =3D=3D 32 -#define MAX_OPC_PARAM_PER_ARG 2 -#else -#define MAX_OPC_PARAM_PER_ARG 1 -#endif -#define MAX_OPC_PARAM_IARGS 7 -#define MAX_OPC_PARAM_OARGS 1 -#define MAX_OPC_PARAM_ARGS (MAX_OPC_PARAM_IARGS + MAX_OPC_PARAM_OARGS) - -/* A Call op needs up to 4 + 2N parameters on 32-bit archs, - * and up to 4 + N parameters on 64-bit archs - * (N =3D number of input arguments + output arguments). */ -#define MAX_OPC_PARAM (4 + (MAX_OPC_PARAM_PER_ARG * MAX_OPC_PARAM_ARGS)) - #define CPU_TEMP_BUF_NLONGS 128 #define TCG_STATIC_FRAME_SIZE (CPU_TEMP_BUF_NLONGS * sizeof(long)) =20 @@ -493,34 +479,34 @@ typedef struct TCGTempSet { unsigned long l[BITS_TO_LONGS(TCG_MAX_TEMPS)]; } TCGTempSet; =20 -/* While we limit helpers to 6 arguments, for 32-bit hosts, with padding, - this imples a max of 6*2 (64-bit in) + 2 (64-bit out) =3D 14 operands. - There are never more than 2 outputs, which means that we can store all - dead + sync data within 16 bits. */ -#define DEAD_ARG 4 -#define SYNC_ARG 1 -typedef uint16_t TCGLifeData; +/* + * With 1 128-bit output, a 32-bit host requires 4 output parameters, + * which leaves a maximum of 28 other slots. Which is enough for 7 + * 128-bit operands. + */ +#define DEAD_ARG (1 << 4) +#define SYNC_ARG (1 << 0) +typedef uint32_t TCGLifeData; =20 -/* The layout here is designed to avoid a bitfield crossing of - a 32-bit boundary, which would cause GCC to add extra padding. */ typedef struct TCGOp { - TCGOpcode opc : 8; /* 8 */ + TCGOpcode opc : 8; + unsigned nargs : 8; =20 /* Parameters for this opcode. See below. */ - unsigned param1 : 4; /* 12 */ - unsigned param2 : 4; /* 16 */ + unsigned param1 : 8; + unsigned param2 : 8; =20 /* Lifetime data of the operands. */ - unsigned life : 16; /* 32 */ + TCGLifeData life; =20 /* Next and previous opcodes. */ QTAILQ_ENTRY(TCGOp) link; =20 - /* Arguments for the opcode. */ - TCGArg args[MAX_OPC_PARAM]; - /* Register preferences for the output(s). */ TCGRegSet output_pref[2]; + + /* Arguments for the opcode. */ + TCGArg args[]; } TCGOp; =20 #define TCGOP_CALLI(X) (X)->param1 diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 62e775d34d..c7d6514840 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -258,12 +258,12 @@ static TCGOp *rm_ops(TCGOp *op) =20 static TCGOp *copy_op_nocheck(TCGOp **begin_op, TCGOp *op) { - unsigned nargs =3D ARRAY_SIZE(op->args); + TCGOp *old_op =3D QTAILQ_NEXT(*begin_op, link); + unsigned nargs =3D old_op->nargs; =20 - *begin_op =3D QTAILQ_NEXT(*begin_op, link); - tcg_debug_assert(*begin_op); - op =3D tcg_op_insert_after(tcg_ctx, op, (*begin_op)->opc, nargs); - memcpy(op->args, (*begin_op)->args, sizeof(op->args)); + *begin_op =3D old_op; + op =3D tcg_op_insert_after(tcg_ctx, op, old_op->opc, nargs); + memcpy(op->args, old_op->args, sizeof(op->args[0]) * nargs); =20 return op; } diff --git a/tcg/tcg.c b/tcg/tcg.c index 3f172cb1d6..ccbe947222 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1513,7 +1513,12 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int nar= gs, TCGTemp **args) } } =20 - max_args =3D ARRAY_SIZE(op->args); + /* + * A Call op needs up to 4 + 2N parameters on 32-bit archs, + * and up to 4 + N parameters on 64-bit archs + * (N =3D number of input arguments + output arguments). + */ + max_args =3D (64 / TCG_TARGET_REG_BITS) * nargs + 4; op =3D tcg_emit_op(INDEX_op_call, max_args); =20 pi =3D 0; @@ -2298,19 +2303,31 @@ void tcg_remove_ops_after(TCGOp *op) static TCGOp *tcg_op_alloc(TCGOpcode opc, unsigned nargs) { TCGContext *s =3D tcg_ctx; - TCGOp *op; + TCGOp *op =3D NULL; =20 - assert(nargs < ARRAY_SIZE(op->args)); - if (likely(QTAILQ_EMPTY(&s->free_ops))) { - op =3D tcg_malloc(sizeof(TCGOp)); - } else { - op =3D QTAILQ_FIRST(&s->free_ops); - QTAILQ_REMOVE(&s->free_ops, op, link); + if (unlikely(!QTAILQ_EMPTY(&s->free_ops))) { + QTAILQ_FOREACH(op, &s->free_ops, link) { + if (nargs <=3D op->nargs) { + QTAILQ_REMOVE(&s->free_ops, op, link); + nargs =3D op->nargs; + goto found; + } + } } + + /* Most opcodes have 3 or 4 operands: reduce fragmentation. */ + nargs =3D MAX(4, nargs); + op =3D tcg_malloc(sizeof(TCGOp) + sizeof(TCGArg) * nargs); + + found: memset(op, 0, offsetof(TCGOp, link)); op->opc =3D opc; - s->nb_ops++; + op->nargs =3D nargs; =20 + /* Check for bitfield overflow. */ + tcg_debug_assert(op->nargs =3D=3D nargs); + + s->nb_ops++; return op; } =20 --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671927220; cv=none; d=zohomail.com; s=zohoarc; b=TY7lgC+VIXxn8Fh1A/BcqTwctu7/10KO+4tp8NEFKhXU+xBPJKGURzTR/g86bqAV24BnNNxNYsexCl6IZrVOmwiYnr+BtwIhCDnzMiu1NjWcsO2Q/YT1xtxeLWoWzOImkQrOzl4tXnMa7XP4LiZ2qcQ/Ww73hH/Yfx0ignbTPJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671927220; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HrfsNyGJ4cFlPj1QXpR5FkACHHSum2rmLa4iU9J/XqE=; b=mhv4PUlBchp31MCtZh01Mwoy4VYdhxAUfc6DL8sQsljrSqpY2+BdzsnsJEzX9eA0euzvPGA1t8U00+HFUmygX9rpDBTtkjQ8yHXOjfpcWzx7/zHoOOF7F8q8mTENFf+NRi/lGrZNJ70p5frJUP/us8Plyf6snYRbptnMRCmSHUc= 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 1671927220249150.76068867255924; Sat, 24 Dec 2022 16:13:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EOy-0002eR-BI; Sat, 24 Dec 2022 18:58:04 -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 1p9EOu-0002ZX-L6 for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:58:02 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOs-0006Lh-9B for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:58:00 -0500 Received: by mail-pl1-x62c.google.com with SMTP id s7so8041398plk.5 for ; Sat, 24 Dec 2022 15:57:57 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=HrfsNyGJ4cFlPj1QXpR5FkACHHSum2rmLa4iU9J/XqE=; b=kSGUf/Cdc7JdoYUJztF1pzFxMTrtnxqF7GXSspv4Xy0raHcpPLriYsYYRVQCWmoBv6 24XiIGWGMPchgubmqpc/h7GA4cNHi5FiyL+Lls4yNPK53mbX9lA7zird1G1byiKyHudi 7SSTgwqoTkMtoWOHLSztQgBjQvoMwngt9he8WhoYIDro8nCOGI4SNFeUPbFSgnWyJw6u gB8m40m2ZWJyUO56XBg75iHslZ/k509X21oVbHAvEx+/C6Y6aQXAvKx0HwNZb6VZ3rQY bI4eJKedsgD+hDdC3Uiups5oi4Cg7I3NCr5bifCEC8Wu6ZVkxK3rtTcvGAIY30Ce4MPU V7yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=HrfsNyGJ4cFlPj1QXpR5FkACHHSum2rmLa4iU9J/XqE=; b=x4WXigptt1fMlHghEH98RzL3pxF10dbCqscppeqeExRZF0Fe/bd/p4QTZka0zQyWcy xDpPw96C2vHXjruy0M6qkXn3cRAUChIVhwyjmIdtVQYrRdsvCcuGAPGjxHEicMHrMcVc qlLRZdAd8xWC6HSqumUHoYFfdOiCpKfdnLb4xKDU9XDnO1KVIrKQyfXgZWs9RZ7hns1H Y5Pja0ug5lMg7KG8ReRz9omT+N6Xm5v3COrtw6LWEnNrimJVpbg7o0U8/pWMRnDXuySq QZYFh2lsDR3qGp3VFH2S4e/TYbHbSUV8QLpx0rgyfFUXt5+aUGbdbt+coKp84j2T6dFv 8cfg== X-Gm-Message-State: AFqh2kqRRtBt0VirsAcamhUpJ9C0zxY6Qv7L9QoCEvzFsPk8ORqckfJn 1KGBJb68bYZdBXdiWDkdf0tW+AT8ZaxpKQyJ X-Google-Smtp-Source: AMrXdXtvfdsAYP0v45mpIhQrWxYDxvokBRAU9aRHvKWE5YUnaRB8G1dmV5ON0MxE44IjLP0US0iC1Q== X-Received: by 2002:a17:903:18b:b0:186:e378:91cf with SMTP id z11-20020a170903018b00b00186e37891cfmr23014653plg.37.1671926277237; Sat, 24 Dec 2022 15:57:57 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 37/43] tcg: Use output_pref wrapper function Date: Sat, 24 Dec 2022 15:57:14 -0800 Message-Id: <20221224235720.842093-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671927223812100011 We will shortly have the possibility of more that two outputs, though only for calls (for which preferences are moot). Avoid direct references to op->output_pref[] when possible. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 5 +++++ tcg/tcg.c | 34 ++++++++++++++++++---------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index d430ea10c8..a6310b898f 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -518,6 +518,11 @@ typedef struct TCGOp { /* Make sure operands fit in the bitfields above. */ QEMU_BUILD_BUG_ON(NB_OPS > (1 << 8)); =20 +static inline TCGRegSet output_pref(const TCGOp *op, unsigned i) +{ + return i < ARRAY_SIZE(op->output_pref) ? op->output_pref[i] : 0; +} + typedef struct TCGProfile { int64_t cpu_exec_time; int64_t tb_count1; diff --git a/tcg/tcg.c b/tcg/tcg.c index ccbe947222..d08323db49 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1966,7 +1966,7 @@ static void tcg_dump_ops(TCGContext *s, FILE *f, bool= have_prefs) =20 if (have_prefs) { for (i =3D 0; i < nb_oargs; ++i) { - TCGRegSet set =3D op->output_pref[i]; + TCGRegSet set =3D output_pref(op, i); =20 if (i =3D=3D 0) { ne_fprintf(f, " pref=3D"); @@ -2636,11 +2636,11 @@ static void liveness_pass_1(TCGContext *s) } ts->state =3D TS_DEAD; la_reset_pref(ts); - - /* Not used -- it will be tcg_target_call_oarg_regs[i]= . */ - op->output_pref[i] =3D 0; } =20 + /* Not used -- it will be tcg_target_call_oarg_reg(). */ + memset(op->output_pref, 0, sizeof(op->output_pref)); + if (!(call_flags & (TCG_CALL_NO_WRITE_GLOBALS | TCG_CALL_NO_READ_GLOBALS))) { la_global_kill(s, nb_globals); @@ -2802,7 +2802,9 @@ static void liveness_pass_1(TCGContext *s) ts =3D arg_temp(op->args[i]); =20 /* Remember the preference of the uses that followed. */ - op->output_pref[i] =3D *la_temp_pref(ts); + if (i < ARRAY_SIZE(op->output_pref)) { + op->output_pref[i] =3D *la_temp_pref(ts); + } =20 /* Output args are dead. */ if (ts->state & TS_DEAD) { @@ -2872,7 +2874,7 @@ static void liveness_pass_1(TCGContext *s) =20 set &=3D ct->regs; if (ct->ialias) { - set &=3D op->output_pref[ct->alias_index]; + set &=3D output_pref(op, ct->alias_index); } /* If the combination is not possible, restart. */ if (set =3D=3D 0) { @@ -3539,7 +3541,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TC= GOp *op) TCGReg oreg, ireg; =20 allocated_regs =3D s->reserved_regs; - preferred_regs =3D op->output_pref[0]; + preferred_regs =3D output_pref(op, 0); ots =3D arg_temp(op->args[0]); ts =3D arg_temp(op->args[1]); =20 @@ -3656,7 +3658,7 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TC= GOp *op) if (IS_DEAD_ARG(1)) { temp_dead(s, its); } - tcg_reg_alloc_do_movi(s, ots, val, arg_life, op->output_pref[0]); + tcg_reg_alloc_do_movi(s, ots, val, arg_life, output_pref(op, 0)); return; } =20 @@ -3673,7 +3675,7 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TC= GOp *op) tcg_regset_set_reg(allocated_regs, its->reg); } oreg =3D tcg_reg_alloc(s, dup_out_regs, allocated_regs, - op->output_pref[0], ots->indirect_base); + output_pref(op, 0), ots->indirect_base); set_temp_val_reg(s, ots, oreg); } =20 @@ -3792,7 +3794,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) switch (arg_ct->pair) { case 0: /* not paired */ if (arg_ct->ialias) { - i_preferred_regs =3D op->output_pref[arg_ct->alias_index]; + i_preferred_regs =3D output_pref(op, arg_ct->alias_index); =20 /* * If the input is not dead after the instruction, @@ -3839,7 +3841,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) * and to identify a few cases where it's not required. */ if (arg_ct->ialias) { - i_preferred_regs =3D op->output_pref[arg_ct->alias_index]; + i_preferred_regs =3D output_pref(op, arg_ct->alias_index); if (IS_DEAD_ARG(i1) && IS_DEAD_ARG(i2) && ts->val_type =3D=3D TEMP_VAL_REG && @@ -3873,7 +3875,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) =20 case 3: /* ialias with second output, no first input */ tcg_debug_assert(arg_ct->ialias); - i_preferred_regs =3D op->output_pref[arg_ct->alias_index]; + i_preferred_regs =3D output_pref(op, arg_ct->alias_index); =20 if (IS_DEAD_ARG(i) && ts->val_type =3D=3D TEMP_VAL_REG && @@ -3993,10 +3995,10 @@ static void tcg_reg_alloc_op(TCGContext *s, const T= CGOp *op) } else if (arg_ct->newreg) { reg =3D tcg_reg_alloc(s, arg_ct->regs, i_allocated_regs | o_allocated_reg= s, - op->output_pref[k], ts->indirect_b= ase); + output_pref(op, k), ts->indirect_b= ase); } else { reg =3D tcg_reg_alloc(s, arg_ct->regs, o_allocated_reg= s, - op->output_pref[k], ts->indirect_b= ase); + output_pref(op, k), ts->indirect_b= ase); } break; =20 @@ -4007,7 +4009,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) break; } reg =3D tcg_reg_alloc_pair(s, arg_ct->regs, o_allocated_re= gs, - op->output_pref[k], ts->indirect_= base); + output_pref(op, k), ts->indirect_= base); break; =20 case 2: /* second of pair */ @@ -4090,7 +4092,7 @@ static bool tcg_reg_alloc_dup2(TCGContext *s, const T= CGOp *op) } =20 oreg =3D tcg_reg_alloc(s, dup_out_regs, allocated_regs, - op->output_pref[0], ots->indirect_base); + output_pref(op, 0), ots->indirect_base); set_temp_val_reg(s, ots, oreg); } =20 --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671927299; cv=none; d=zohomail.com; s=zohoarc; b=fWp58jkuNJ7nkR1UyOcbQpGjTyh/mRZQRHCHlbh8sS2Doy0zxMdsED6bG4INRb7TgTS7NAllb9qWQ6ClFSlmubXnVl8EOgsk96qFvdHjdpWQjBqy3NGdsJJPlyTduKoMg9FOjkMlUMQdzge0/PJVTl+9cQl+xVcPWzCLacfvWx0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671927299; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=P90EeKH4/pTjIHbulrXvG19OO1n2b3uUvSh0tREkpus=; b=PEJiGs3iSPV3rGuZpO9Xzaqapw6ym9v6L5NB+hBSJElcn/Yl/vEM780gf6sI6Wnsn8M8PcWNaRY5tK0t54jfOATpb4msMF742vK/spjv+HrF028jCOylySW+vmxDRZ/URndtoaJB10PFcs2Fn3v4kGmdaJwCJs7UkGixlEWWqvc= 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 1671927299956651.9497698601384; Sat, 24 Dec 2022 16:14:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EP0-0002jd-ED; Sat, 24 Dec 2022 18:58:06 -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 1p9EOw-0002bM-KW for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:58:02 -0500 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOt-0006Jy-C7 for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:58:02 -0500 Received: by mail-pj1-x1032.google.com with SMTP id ge16so4312385pjb.5 for ; Sat, 24 Dec 2022 15:57:58 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=P90EeKH4/pTjIHbulrXvG19OO1n2b3uUvSh0tREkpus=; b=WCFoBaluZvjOuR/KO8b30ubWxqt/jaQWt82XWJNAdt+kjtjcMNRJQZP+o2TpDLjSkB XPYTY2oTnq2gWnbjn5GEyZra7gcVBA7DuiYOoBbqUFbAwMF22z2zCwhqXXsMIY/ykpSM cASCwFWPqr088uOnKsxKTqV3RQUWYHSI6yE2VrFNzkoIpGX9I+Phtc4oWuQE5afI67bD FGM76V108KH9qrlvCmsiF7odR8G6gKr5r2QTSaUBX69szo8B+FHglYDQ1cwgJEDXCA+d u5rfwZpOsPtmJ7YspaBxE6lOwSPihWKJZzqAd7GjPLDXVJLZnfAuivA6qdgwY2XC6yJw PirQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=P90EeKH4/pTjIHbulrXvG19OO1n2b3uUvSh0tREkpus=; b=LGDEmZyHWLxQxZ0f3eZlNmPPJ8wHUriGoUlV5S7K147KPtDVfJmMSTA2f5z/dF6pyK 8bgfueEn9IjewmXd8SLVnMoSRXIH6SLAR6NPEEaa2L1Cw55j+ixgjAHwiSOuBH0yOY1K LbMFLQmModRwRZfC4r/DaNE4oiv9fRVxa9n7ptXAQMrah5RS3KN3UoNYGpR3ozZV+hko gLaJHFzeBx08Mj7lRUgG8t997WlyqWixMMtUHC5gisq4tkvg2f2m1YRej0dEvCRoilJB lNntoIlo8WDmRCJzJkEukefiODLlIlJiMYZMK+coAgYCtiR/rLOtnnTqc4nr6F9rEebD F/7g== X-Gm-Message-State: AFqh2koWgtq90i/Jw1nKMbCp6JYByfJ02iDz6ysZgMMTfCLOB2BepQbf uuz6XLLEALfVhrezkYkF6aj7t5gJYW/0wUAm X-Google-Smtp-Source: AMrXdXtKs/zaZBtabppp8VauK83mDe/iwOWLyF7EZuF1BN64jzCPDrH7CkP3bGMxHwfd6amyegK2BA== X-Received: by 2002:a17:902:d683:b0:192:5c3f:6051 with SMTP id v3-20020a170902d68300b001925c3f6051mr9123982ply.14.1671926278194; Sat, 24 Dec 2022 15:57:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 38/43] tcg: Reorg function calls Date: Sat, 24 Dec 2022 15:57:15 -0800 Message-Id: <20221224235720.842093-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> MIME-Version: 1.0 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::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671927301116100007 Content-Type: text/plain; charset="utf-8" Pre-compute the function call layout for each helper at startup. Drop TCG_CALL_DUMMY_ARG, as we no longer need to leave gaps in the op->args[] array. This allows several places to stop checking for NULL TCGTemp, to which TCG_CALL_DUMMY_ARG mapped. For tcg_gen_callN, loop over the arguments once. Allocate the TCGOp for the call early but delay emitting it, collecting arguments first. This allows the argument processing loop to emit code for extensions and have them sequenced before the call. For tcg_reg_alloc_call, loop over the arguments in reverse order, which allows stack slots to be filled first naturally. Signed-off-by: Richard Henderson --- include/exec/helper-head.h | 2 + include/tcg/tcg.h | 5 +- tcg/tcg-internal.h | 22 +- tcg/optimize.c | 6 +- tcg/tcg.c | 609 ++++++++++++++++++++++--------------- 5 files changed, 394 insertions(+), 250 deletions(-) diff --git a/include/exec/helper-head.h b/include/exec/helper-head.h index 8bdf0f6ea2..bc6698b19f 100644 --- a/include/exec/helper-head.h +++ b/include/exec/helper-head.h @@ -133,4 +133,6 @@ #define DEF_HELPER_7(name, ret, t1, t2, t3, t4, t5, t6, t7) \ DEF_HELPER_FLAGS_7(name, 0, ret, t1, t2, t3, t4, t5, t6, t7) =20 +/* MAX_CALL_IARGS must be set to n if last entry is DEF_HELPER_FLAGS_n. */ + #endif /* EXEC_HELPER_HEAD_H */ diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index a6310b898f..b949d75fdd 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -38,6 +38,8 @@ /* XXX: make safe guess about sizes */ #define MAX_OP_PER_INSTR 266 =20 +#define MAX_CALL_IARGS 7 + #define CPU_TEMP_BUF_NLONGS 128 #define TCG_STATIC_FRAME_SIZE (CPU_TEMP_BUF_NLONGS * sizeof(long)) =20 @@ -411,9 +413,6 @@ typedef TCGv_ptr TCGv_env; #define TCG_CALL_NO_RWG_SE (TCG_CALL_NO_RWG | TCG_CALL_NO_SE) #define TCG_CALL_NO_WG_SE (TCG_CALL_NO_WG | TCG_CALL_NO_SE) =20 -/* Used to align parameters. See the comment before tcgv_i32_temp. */ -#define TCG_CALL_DUMMY_ARG ((TCGArg)0) - /* * Flags for the bswap opcodes. * If IZ, the input is zero-extended, otherwise unknown. diff --git a/tcg/tcg-internal.h b/tcg/tcg-internal.h index f574743ff8..c7e87e193d 100644 --- a/tcg/tcg-internal.h +++ b/tcg/tcg-internal.h @@ -42,11 +42,29 @@ typedef enum { TCG_CALL_ARG_EXTEND_S, /* ... as a sign-extended i64 */ } TCGCallArgumentKind; =20 +typedef struct TCGCallArgumentLoc { + TCGCallArgumentKind kind : 8; + unsigned arg_slot : 8; + unsigned ref_slot : 8; + unsigned arg_idx : 4; + unsigned tmp_subindex : 2; +} TCGCallArgumentLoc; + +/* Avoid "unsigned < 0 is always false" Werror, when iarg_regs is empty. */ +#define REG_P(L) \ + ((int)(L)->arg_slot < (int)ARRAY_SIZE(tcg_target_call_iarg_regs)) + typedef struct TCGHelperInfo { void *func; const char *name; - unsigned flags; - unsigned typemask; + unsigned typemask : 32; + unsigned flags : 8; + unsigned nr_in : 8; + unsigned nr_out : 8; + TCGCallReturnKind out_kind : 8; + + /* Maximum physical arguments are constrained by TCG_TYPE_I128. */ + TCGCallArgumentLoc in[MAX_CALL_IARGS * (128 / TCG_TARGET_REG_BITS)]; } TCGHelperInfo; =20 extern TCGContext tcg_init_ctx; diff --git a/tcg/optimize.c b/tcg/optimize.c index 1afd50175b..763bca9ea6 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -667,9 +667,7 @@ static void init_arguments(OptContext *ctx, TCGOp *op, = int nb_args) { for (int i =3D 0; i < nb_args; i++) { TCGTemp *ts =3D arg_temp(op->args[i]); - if (ts) { - init_ts_info(ctx, ts); - } + init_ts_info(ctx, ts); } } =20 @@ -680,7 +678,7 @@ static void copy_propagate(OptContext *ctx, TCGOp *op, =20 for (int i =3D nb_oargs; i < nb_oargs + nb_iargs; i++) { TCGTemp *ts =3D arg_temp(op->args[i]); - if (ts && ts_is_copy(ts)) { + if (ts_is_copy(ts)) { op->args[i] =3D temp_arg(find_better_copy(s, ts)); } } diff --git a/tcg/tcg.c b/tcg/tcg.c index d08323db49..74f7491d73 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -547,7 +547,7 @@ void tcg_pool_reset(TCGContext *s) =20 #include "exec/helper-proto.h" =20 -static const TCGHelperInfo all_helpers[] =3D { +static TCGHelperInfo all_helpers[] =3D { #include "exec/helper-tcg.h" }; static GHashTable *helper_table; @@ -565,6 +565,154 @@ static ffi_type * const typecode_to_ffi[8] =3D { }; #endif =20 +typedef struct TCGCumulativeArgs { + int arg_idx; /* tcg_gen_callN args[] */ + int info_in_idx; /* TCGHelperInfo in[] */ + int arg_slot; /* regs+stack slot */ + int ref_slot; /* stack slots for references */ +} TCGCumulativeArgs; + +static void layout_arg_even(TCGCumulativeArgs *cum) +{ + cum->arg_slot +=3D cum->arg_slot & 1; +} + +static void layout_arg_1(TCGCumulativeArgs *cum, TCGHelperInfo *info, + TCGCallArgumentKind kind) +{ + TCGCallArgumentLoc *loc =3D &info->in[cum->info_in_idx]; + + *loc =3D (TCGCallArgumentLoc){ + .kind =3D kind, + .arg_idx =3D cum->arg_idx, + .arg_slot =3D cum->arg_slot, + }; + cum->info_in_idx++; + cum->arg_slot++; +} + +static void layout_arg_normal_n(TCGCumulativeArgs *cum, + TCGHelperInfo *info, int n) +{ + TCGCallArgumentLoc *loc =3D &info->in[cum->info_in_idx]; + + for (int i =3D 0; i < n; ++i) { + /* Layout all using the same arg_idx, adjusting the subindex. */ + loc[i] =3D (TCGCallArgumentLoc){ + .kind =3D TCG_CALL_ARG_NORMAL, + .arg_idx =3D cum->arg_idx, + .tmp_subindex =3D i, + .arg_slot =3D cum->arg_slot + i, + }; + } + cum->info_in_idx +=3D n; + cum->arg_slot +=3D n; +} + +static void init_call_layout(TCGHelperInfo *info) +{ + int max_reg_slots =3D ARRAY_SIZE(tcg_target_call_iarg_regs); + int max_stk_slots =3D TCG_STATIC_CALL_ARGS_SIZE / sizeof(tcg_target_lo= ng); + unsigned typemask =3D info->typemask; + unsigned typecode; + TCGCumulativeArgs cum =3D { }; + + /* + * Parse and place any function return value. + */ + typecode =3D typemask & 7; + switch (typecode) { + case dh_typecode_void: + info->nr_out =3D 0; + break; + case dh_typecode_i32: + case dh_typecode_s32: + case dh_typecode_ptr: + info->nr_out =3D 1; + info->out_kind =3D TCG_CALL_RET_NORMAL; + break; + case dh_typecode_i64: + case dh_typecode_s64: + info->nr_out =3D 64 / TCG_TARGET_REG_BITS; + info->out_kind =3D TCG_CALL_RET_NORMAL; + break; + default: + g_assert_not_reached(); + } + assert(info->nr_out <=3D ARRAY_SIZE(tcg_target_call_oarg_regs)); + + /* + * Parse and place function arguments. + */ + for (typemask >>=3D 3; typemask; typemask >>=3D 3, cum.arg_idx++) { + TCGCallArgumentKind kind; + TCGType type; + + typecode =3D typemask & 7; + switch (typecode) { + case dh_typecode_i32: + case dh_typecode_s32: + type =3D TCG_TYPE_I32; + break; + case dh_typecode_i64: + case dh_typecode_s64: + type =3D TCG_TYPE_I64; + break; + case dh_typecode_ptr: + type =3D TCG_TYPE_PTR; + break; + default: + g_assert_not_reached(); + } + + switch (type) { + case TCG_TYPE_I32: + switch (TCG_TARGET_CALL_ARG_I32) { + case TCG_CALL_ARG_EVEN: + layout_arg_even(&cum); + /* fall through */ + case TCG_CALL_ARG_NORMAL: + layout_arg_1(&cum, info, TCG_CALL_ARG_NORMAL); + break; + case TCG_CALL_ARG_EXTEND: + kind =3D TCG_CALL_ARG_EXTEND_U + (typecode & 1); + layout_arg_1(&cum, info, kind); + break; + default: + qemu_build_not_reached(); + } + break; + + case TCG_TYPE_I64: + switch (TCG_TARGET_CALL_ARG_I64) { + case TCG_CALL_ARG_EVEN: + layout_arg_even(&cum); + /* fall through */ + case TCG_CALL_ARG_NORMAL: + if (TCG_TARGET_REG_BITS =3D=3D 32) { + layout_arg_normal_n(&cum, info, 2); + } else { + layout_arg_1(&cum, info, TCG_CALL_ARG_NORMAL); + } + break; + default: + qemu_build_not_reached(); + } + break; + + default: + g_assert_not_reached(); + } + } + info->nr_in =3D cum.info_in_idx; + + /* Validate that we didn't overrun the input array. */ + assert(cum.info_in_idx <=3D ARRAY_SIZE(info->in)); + /* Validate the backend has enough argument space. */ + assert(cum.arg_slot <=3D max_reg_slots + max_stk_slots); + assert(cum.ref_slot <=3D max_stk_slots); +} + static int indirect_reg_alloc_order[ARRAY_SIZE(tcg_target_reg_alloc_order)= ]; static void process_op_defs(TCGContext *s); static TCGTemp *tcg_global_reg_new_internal(TCGContext *s, TCGType type, @@ -604,6 +752,7 @@ static void tcg_context_init(unsigned max_cpus) helper_table =3D g_hash_table_new(NULL, NULL); =20 for (i =3D 0; i < ARRAY_SIZE(all_helpers); ++i) { + init_call_layout(&all_helpers[i]); g_hash_table_insert(helper_table, (gpointer)all_helpers[i].func, (gpointer)&all_helpers[i]); } @@ -1474,18 +1623,19 @@ bool tcg_op_supported(TCGOpcode op) } } =20 -/* Note: we convert the 64 bit args to 32 bit and do some alignment - and endian swap. Maybe it would be better to do the alignment - and endian swap in tcg_reg_alloc_call(). */ +static TCGOp *tcg_op_alloc(TCGOpcode opc, unsigned nargs); + void tcg_gen_callN(void *func, TCGTemp *ret, int nargs, TCGTemp **args) { - int i, real_args, nb_rets, pi, max_args; - unsigned typemask; const TCGHelperInfo *info; + TCGv_i64 extend_free[MAX_CALL_IARGS]; + int n_extend =3D 0; TCGOp *op; + int i, n, pi =3D 0, total_args; =20 info =3D g_hash_table_lookup(helper_table, (gpointer)func); - typemask =3D info->typemask; + total_args =3D info->nr_out + info->nr_in + 2; + op =3D tcg_op_alloc(INDEX_op_call, total_args); =20 #ifdef CONFIG_PLUGIN /* detect non-plugin helpers */ @@ -1494,119 +1644,65 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int n= args, TCGTemp **args) } #endif =20 - if (TCG_TARGET_CALL_ARG_I32 =3D=3D TCG_CALL_ARG_EXTEND) { - for (i =3D 0; i < nargs; ++i) { - int argtype =3D extract32(typemask, (i + 1) * 3, 3); - bool is_32bit =3D (argtype & ~1) =3D=3D dh_typecode_i32; - bool is_signed =3D argtype & 1; + TCGOP_CALLO(op) =3D n =3D info->nr_out; + switch (n) { + case 0: + tcg_debug_assert(ret =3D=3D NULL); + break; + case 1: + tcg_debug_assert(ret !=3D NULL); + op->args[pi++] =3D temp_arg(ret); + break; + case 2: + tcg_debug_assert(ret !=3D NULL); + tcg_debug_assert(ret->base_type =3D=3D ret->type + 1); + tcg_debug_assert(ret->temp_subindex =3D=3D 0); + op->args[pi++] =3D temp_arg(ret); + op->args[pi++] =3D temp_arg(ret + 1); + break; + default: + g_assert_not_reached(); + } =20 - if (is_32bit) { + TCGOP_CALLI(op) =3D n =3D info->nr_in; + for (i =3D 0; i < n; i++) { + const TCGCallArgumentLoc *loc =3D &info->in[i]; + TCGTemp *ts =3D args[loc->arg_idx] + loc->tmp_subindex; + + switch (loc->kind) { + case TCG_CALL_ARG_NORMAL: + op->args[pi++] =3D temp_arg(ts); + break; + + case TCG_CALL_ARG_EXTEND_U: + case TCG_CALL_ARG_EXTEND_S: + { TCGv_i64 temp =3D tcg_temp_new_i64(); - TCGv_i32 orig =3D temp_tcgv_i32(args[i]); - if (is_signed) { + TCGv_i32 orig =3D temp_tcgv_i32(ts); + + if (loc->kind =3D=3D TCG_CALL_ARG_EXTEND_S) { tcg_gen_ext_i32_i64(temp, orig); } else { tcg_gen_extu_i32_i64(temp, orig); } - args[i] =3D tcgv_i64_temp(temp); + op->args[pi++] =3D tcgv_i64_arg(temp); + extend_free[n_extend++] =3D temp; } - } - } - - /* - * A Call op needs up to 4 + 2N parameters on 32-bit archs, - * and up to 4 + N parameters on 64-bit archs - * (N =3D number of input arguments + output arguments). - */ - max_args =3D (64 / TCG_TARGET_REG_BITS) * nargs + 4; - op =3D tcg_emit_op(INDEX_op_call, max_args); - - pi =3D 0; - if (ret !=3D NULL) { - if (TCG_TARGET_REG_BITS < 64 && (typemask & 6) =3D=3D dh_typecode_= i64) { - op->args[pi++] =3D temp_arg(ret); - op->args[pi++] =3D temp_arg(ret + 1); - nb_rets =3D 2; - } else { - op->args[pi++] =3D temp_arg(ret); - nb_rets =3D 1; - } - } else { - nb_rets =3D 0; - } - TCGOP_CALLO(op) =3D nb_rets; - - real_args =3D 0; - for (i =3D 0; i < nargs; i++) { - int argtype =3D extract32(typemask, (i + 1) * 3, 3); - TCGCallArgumentKind kind; - TCGType type; - - switch (argtype) { - case dh_typecode_i32: - case dh_typecode_s32: - type =3D TCG_TYPE_I32; break; - case dh_typecode_i64: - case dh_typecode_s64: - type =3D TCG_TYPE_I64; - break; - case dh_typecode_ptr: - type =3D TCG_TYPE_PTR; - break; - default: - g_assert_not_reached(); - } =20 - switch (type) { - case TCG_TYPE_I32: - kind =3D TCG_TARGET_CALL_ARG_I32; - break; - case TCG_TYPE_I64: - kind =3D TCG_TARGET_CALL_ARG_I64; - break; - default: - g_assert_not_reached(); - } - - switch (kind) { - case TCG_CALL_ARG_EVEN: - if (real_args & 1) { - op->args[pi++] =3D TCG_CALL_DUMMY_ARG; - real_args++; - } - /* fall through */ - case TCG_CALL_ARG_NORMAL: - if (TCG_TARGET_REG_BITS =3D=3D 32 && type =3D=3D TCG_TYPE_I64)= { - op->args[pi++] =3D temp_arg(args[i]); - op->args[pi++] =3D temp_arg(args[i] + 1); - real_args +=3D 2; - break; - } - op->args[pi++] =3D temp_arg(args[i]); - real_args++; - break; default: g_assert_not_reached(); } } op->args[pi++] =3D (uintptr_t)func; op->args[pi++] =3D (uintptr_t)info; - TCGOP_CALLI(op) =3D real_args; + tcg_debug_assert(pi =3D=3D total_args); =20 - /* Make sure the fields didn't overflow. */ - tcg_debug_assert(TCGOP_CALLI(op) =3D=3D real_args); - tcg_debug_assert(pi <=3D max_args); + QTAILQ_INSERT_TAIL(&tcg_ctx->ops, op, link); =20 - if (TCG_TARGET_CALL_ARG_I32 =3D=3D TCG_CALL_ARG_EXTEND) { - for (i =3D 0; i < nargs; ++i) { - int argtype =3D extract32(typemask, (i + 1) * 3, 3); - bool is_32bit =3D (argtype & ~1) =3D=3D dh_typecode_i32; - - if (is_32bit) { - tcg_temp_free_internal(args[i]); - } - } + tcg_debug_assert(n_extend < ARRAY_SIZE(extend_free)); + for (i =3D 0; i < n_extend; ++i) { + tcg_temp_free_i64(extend_free[i]); } } =20 @@ -1822,10 +1918,7 @@ static void tcg_dump_ops(TCGContext *s, FILE *f, boo= l have_prefs) } for (i =3D 0; i < nb_iargs; i++) { TCGArg arg =3D op->args[nb_oargs + i]; - const char *t =3D ""; - if (arg !=3D TCG_CALL_DUMMY_ARG) { - t =3D tcg_get_arg_str(s, buf, sizeof(buf), arg); - } + const char *t =3D tcg_get_arg_str(s, buf, sizeof(buf), arg= ); col +=3D ne_fprintf(f, ",%s", t); } } else { @@ -2606,12 +2699,11 @@ static void liveness_pass_1(TCGContext *s) switch (opc) { case INDEX_op_call: { - int call_flags; - int nb_call_regs; + const TCGHelperInfo *info =3D tcg_call_info(op); + int call_flags =3D tcg_call_flags(op); =20 nb_oargs =3D TCGOP_CALLO(op); nb_iargs =3D TCGOP_CALLI(op); - call_flags =3D tcg_call_flags(op); =20 /* pure functions can be removed if their result is unused= */ if (call_flags & TCG_CALL_NO_SIDE_EFFECTS) { @@ -2651,7 +2743,7 @@ static void liveness_pass_1(TCGContext *s) /* Record arguments that die in this helper. */ for (i =3D nb_oargs; i < nb_iargs + nb_oargs; i++) { ts =3D arg_temp(op->args[i]); - if (ts && ts->state & TS_DEAD) { + if (ts->state & TS_DEAD) { arg_life |=3D DEAD_ARG << i; } } @@ -2659,31 +2751,59 @@ static void liveness_pass_1(TCGContext *s) /* For all live registers, remove call-clobbered prefs. */ la_cross_call(s, nb_temps); =20 - nb_call_regs =3D ARRAY_SIZE(tcg_target_call_iarg_regs); + /* + * Input arguments are live for preceding opcodes. + * + * For those arguments that die, and will be allocated in + * registers, clear the register set for that arg, to be + * filled in below. For args that will be on the stack, + * reset to any available reg. Process arguments in rever= se + * order so that if a temp is used more than once, the sta= ck + * reset to max happens before the register reset to 0. + */ + for (i =3D nb_iargs - 1; i >=3D 0; i--) { + const TCGCallArgumentLoc *loc =3D &info->in[i]; + ts =3D arg_temp(op->args[nb_oargs + i]); =20 - /* Input arguments are live for preceding opcodes. */ - for (i =3D 0; i < nb_iargs; i++) { - ts =3D arg_temp(op->args[i + nb_oargs]); - if (ts && ts->state & TS_DEAD) { - /* For those arguments that die, and will be alloc= ated - * in registers, clear the register set for that a= rg, - * to be filled in below. For args that will be on - * the stack, reset to any available reg. - */ - *la_temp_pref(ts) - =3D (i < nb_call_regs ? 0 : - tcg_target_available_regs[ts->type]); + if (ts->state & TS_DEAD) { + switch (loc->kind) { + case TCG_CALL_ARG_NORMAL: + case TCG_CALL_ARG_EXTEND_U: + case TCG_CALL_ARG_EXTEND_S: + if (REG_P(loc)) { + *la_temp_pref(ts) =3D 0; + break; + } + /* fall through */ + default: + *la_temp_pref(ts) =3D + tcg_target_available_regs[ts->type]; + break; + } ts->state &=3D ~TS_DEAD; } } =20 - /* For each input argument, add its input register to pref= s. - If a temp is used once, this produces a single set bit.= */ - for (i =3D 0; i < MIN(nb_call_regs, nb_iargs); i++) { - ts =3D arg_temp(op->args[i + nb_oargs]); - if (ts) { - tcg_regset_set_reg(*la_temp_pref(ts), - tcg_target_call_iarg_regs[i]); + /* + * For each input argument, add its input register to pref= s. + * If a temp is used once, this produces a single set bit; + * if a temp is used multiple times, this produces a set. + */ + for (i =3D 0; i < nb_iargs; i++) { + const TCGCallArgumentLoc *loc =3D &info->in[i]; + ts =3D arg_temp(op->args[nb_oargs + i]); + + switch (loc->kind) { + case TCG_CALL_ARG_NORMAL: + case TCG_CALL_ARG_EXTEND_U: + case TCG_CALL_ARG_EXTEND_S: + if (REG_P(loc)) { + tcg_regset_set_reg(*la_temp_pref(ts), + tcg_target_call_iarg_regs[loc->arg_slot]); + } + break; + default: + break; } } } @@ -2954,21 +3074,19 @@ static bool liveness_pass_2(TCGContext *s) /* Make sure that input arguments are available. */ for (i =3D nb_oargs; i < nb_iargs + nb_oargs; i++) { arg_ts =3D arg_temp(op->args[i]); - if (arg_ts) { - dir_ts =3D arg_ts->state_ptr; - if (dir_ts && arg_ts->state =3D=3D TS_DEAD) { - TCGOpcode lopc =3D (arg_ts->type =3D=3D TCG_TYPE_I32 - ? INDEX_op_ld_i32 - : INDEX_op_ld_i64); - TCGOp *lop =3D tcg_op_insert_before(s, op, lopc, 3); + dir_ts =3D arg_ts->state_ptr; + if (dir_ts && arg_ts->state =3D=3D TS_DEAD) { + TCGOpcode lopc =3D (arg_ts->type =3D=3D TCG_TYPE_I32 + ? INDEX_op_ld_i32 + : INDEX_op_ld_i64); + TCGOp *lop =3D tcg_op_insert_before(s, op, lopc, 3); =20 - lop->args[0] =3D temp_arg(dir_ts); - lop->args[1] =3D temp_arg(arg_ts->mem_base); - lop->args[2] =3D arg_ts->mem_offset; + lop->args[0] =3D temp_arg(dir_ts); + lop->args[1] =3D temp_arg(arg_ts->mem_base); + lop->args[2] =3D arg_ts->mem_offset; =20 - /* Loaded, but synced with memory. */ - arg_ts->state =3D TS_MEM; - } + /* Loaded, but synced with memory. */ + arg_ts->state =3D TS_MEM; } } =20 @@ -2977,14 +3095,12 @@ static bool liveness_pass_2(TCGContext *s) so that we reload when needed. */ for (i =3D nb_oargs; i < nb_iargs + nb_oargs; i++) { arg_ts =3D arg_temp(op->args[i]); - if (arg_ts) { - dir_ts =3D arg_ts->state_ptr; - if (dir_ts) { - op->args[i] =3D temp_arg(dir_ts); - changes =3D true; - if (IS_DEAD_ARG(i)) { - arg_ts->state =3D TS_DEAD; - } + dir_ts =3D arg_ts->state_ptr; + if (dir_ts) { + op->args[i] =3D temp_arg(dir_ts); + changes =3D true; + if (IS_DEAD_ARG(i)) { + arg_ts->state =3D TS_DEAD; } } } @@ -4147,106 +4263,107 @@ static bool tcg_reg_alloc_dup2(TCGContext *s, con= st TCGOp *op) return true; } =20 +static void load_arg_reg(TCGContext *s, TCGReg reg, TCGTemp *ts, + TCGRegSet allocated_regs) +{ + if (ts->val_type =3D=3D TEMP_VAL_REG) { + if (ts->reg !=3D reg) { + tcg_reg_free(s, reg, allocated_regs); + if (!tcg_out_mov(s, ts->type, reg, ts->reg)) { + /* + * Cross register class move not supported. Sync the + * temp back to its slot and load from there. + */ + temp_sync(s, ts, allocated_regs, 0, 0); + tcg_out_ld(s, ts->type, reg, + ts->mem_base->reg, ts->mem_offset); + } + } + } else { + TCGRegSet arg_set =3D 0; + + tcg_reg_free(s, reg, allocated_regs); + tcg_regset_set_reg(arg_set, reg); + temp_load(s, ts, arg_set, allocated_regs, 0); + } +} + +static void load_arg_stk(TCGContext *s, int stk_slot, TCGTemp *ts, + TCGRegSet allocated_regs) +{ + /* + * When the destination is on the stack, load up the temp and store. + * If there are many call-saved registers, the temp might live to + * see another use; otherwise it'll be discarded. + */ + temp_load(s, ts, tcg_target_available_regs[ts->type], allocated_regs, = 0); + tcg_out_st(s, ts->type, ts->reg, TCG_REG_CALL_STACK, + TCG_TARGET_CALL_STACK_OFFSET + + stk_slot * sizeof(tcg_target_long)); +} + +static void load_arg_normal(TCGContext *s, const TCGCallArgumentLoc *l, + TCGTemp *ts, TCGRegSet *allocated_regs) +{ + if (REG_P(l)) { + TCGReg reg =3D tcg_target_call_iarg_regs[l->arg_slot]; + load_arg_reg(s, reg, ts, *allocated_regs); + tcg_regset_set_reg(*allocated_regs, reg); + } else { + load_arg_stk(s, l->arg_slot - ARRAY_SIZE(tcg_target_call_iarg_regs= ), + ts, *allocated_regs); + } +} + static void tcg_reg_alloc_call(TCGContext *s, TCGOp *op) { const int nb_oargs =3D TCGOP_CALLO(op); const int nb_iargs =3D TCGOP_CALLI(op); const TCGLifeData arg_life =3D op->life; - const TCGHelperInfo *info; - int flags, nb_regs, i; - TCGReg reg; - TCGArg arg; - TCGTemp *ts; - intptr_t stack_offset; - size_t call_stack_size; - tcg_insn_unit *func_addr; - int allocate_args; - TCGRegSet allocated_regs; + const TCGHelperInfo *info =3D tcg_call_info(op); + TCGRegSet allocated_regs =3D s->reserved_regs; + int i; =20 - func_addr =3D tcg_call_func(op); - info =3D tcg_call_info(op); - flags =3D info->flags; + /* + * Move inputs into place in reverse order, + * so that we place stacked arguments first. + */ + for (i =3D nb_iargs - 1; i >=3D 0; --i) { + const TCGCallArgumentLoc *loc =3D &info->in[i]; + TCGTemp *ts =3D arg_temp(op->args[nb_oargs + i]); =20 - nb_regs =3D ARRAY_SIZE(tcg_target_call_iarg_regs); - if (nb_regs > nb_iargs) { - nb_regs =3D nb_iargs; - } - - /* assign stack slots first */ - call_stack_size =3D (nb_iargs - nb_regs) * sizeof(tcg_target_long); - call_stack_size =3D (call_stack_size + TCG_TARGET_STACK_ALIGN - 1) & - ~(TCG_TARGET_STACK_ALIGN - 1); - allocate_args =3D (call_stack_size > TCG_STATIC_CALL_ARGS_SIZE); - if (allocate_args) { - /* XXX: if more than TCG_STATIC_CALL_ARGS_SIZE is needed, - preallocate call stack */ - tcg_abort(); - } - - stack_offset =3D TCG_TARGET_CALL_STACK_OFFSET; - for (i =3D nb_regs; i < nb_iargs; i++) { - arg =3D op->args[nb_oargs + i]; - if (arg !=3D TCG_CALL_DUMMY_ARG) { - ts =3D arg_temp(arg); - temp_load(s, ts, tcg_target_available_regs[ts->type], - s->reserved_regs, 0); - tcg_out_st(s, ts->type, ts->reg, TCG_REG_CALL_STACK, stack_off= set); - } - stack_offset +=3D sizeof(tcg_target_long); - } - - /* assign input registers */ - allocated_regs =3D s->reserved_regs; - for (i =3D 0; i < nb_regs; i++) { - arg =3D op->args[nb_oargs + i]; - if (arg !=3D TCG_CALL_DUMMY_ARG) { - ts =3D arg_temp(arg); - reg =3D tcg_target_call_iarg_regs[i]; - - if (ts->val_type =3D=3D TEMP_VAL_REG) { - if (ts->reg !=3D reg) { - tcg_reg_free(s, reg, allocated_regs); - if (!tcg_out_mov(s, ts->type, reg, ts->reg)) { - /* - * Cross register class move not supported. Sync = the - * temp back to its slot and load from there. - */ - temp_sync(s, ts, allocated_regs, 0, 0); - tcg_out_ld(s, ts->type, reg, - ts->mem_base->reg, ts->mem_offset); - } - } - } else { - TCGRegSet arg_set =3D 0; - - tcg_reg_free(s, reg, allocated_regs); - tcg_regset_set_reg(arg_set, reg); - temp_load(s, ts, arg_set, allocated_regs, 0); - } - - tcg_regset_set_reg(allocated_regs, reg); + switch (loc->kind) { + case TCG_CALL_ARG_NORMAL: + case TCG_CALL_ARG_EXTEND_U: + case TCG_CALL_ARG_EXTEND_S: + load_arg_normal(s, loc, ts, &allocated_regs); + break; + default: + g_assert_not_reached(); } } =20 - /* mark dead temporaries and free the associated registers */ + /* Mark dead temporaries and free the associated registers. */ for (i =3D nb_oargs; i < nb_iargs + nb_oargs; i++) { if (IS_DEAD_ARG(i)) { temp_dead(s, arg_temp(op->args[i])); } } =20 - /* clobber call registers */ + /* Clobber call registers. */ for (i =3D 0; i < TCG_TARGET_NB_REGS; i++) { if (tcg_regset_test_reg(tcg_target_call_clobber_regs, i)) { tcg_reg_free(s, i, allocated_regs); } } =20 - /* Save globals if they might be written by the helper, sync them if - they might be read. */ - if (flags & TCG_CALL_NO_READ_GLOBALS) { + /* + * Save globals if they might be written by the helper, + * sync them if they might be read. + */ + if (info->flags & TCG_CALL_NO_READ_GLOBALS) { /* Nothing to do */ - } else if (flags & TCG_CALL_NO_WRITE_GLOBALS) { + } else if (info->flags & TCG_CALL_NO_WRITE_GLOBALS) { sync_globals(s, allocated_regs); } else { save_globals(s, allocated_regs); @@ -4257,25 +4374,35 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp= *op) gpointer hash =3D (gpointer)(uintptr_t)info->typemask; ffi_cif *cif =3D g_hash_table_lookup(ffi_table, hash); assert(cif !=3D NULL); - tcg_out_call(s, func_addr, cif); + tcg_out_call(s, tcg_call_func(op), cif); } #else - tcg_out_call(s, func_addr); + tcg_out_call(s, tcg_call_func(op)); #endif =20 - /* assign output registers and emit moves if needed */ - for(i =3D 0; i < nb_oargs; i++) { - arg =3D op->args[i]; - ts =3D arg_temp(arg); + /* Assign output registers and emit moves if needed. */ + switch (info->out_kind) { + case TCG_CALL_RET_NORMAL: + for (i =3D 0; i < nb_oargs; i++) { + TCGTemp *ts =3D arg_temp(op->args[i]); + TCGReg reg =3D tcg_target_call_oarg_regs[i]; =20 - /* ENV should not be modified. */ - tcg_debug_assert(!temp_readonly(ts)); + /* ENV should not be modified. */ + tcg_debug_assert(!temp_readonly(ts)); =20 - reg =3D tcg_target_call_oarg_regs[i]; - set_temp_val_reg(s, ts, reg); - ts->mem_coherent =3D 0; + set_temp_val_reg(s, ts, reg); + ts->mem_coherent =3D 0; + } + break; + default: + g_assert_not_reached(); + } + + /* Flush or discard output registers as needed. */ + for (i =3D 0; i < nb_oargs; i++) { + TCGTemp *ts =3D arg_temp(op->args[i]); if (NEED_SYNC_ARG(i)) { - temp_sync(s, ts, allocated_regs, 0, IS_DEAD_ARG(i)); + temp_sync(s, ts, s->reserved_regs, 0, IS_DEAD_ARG(i)); } else if (IS_DEAD_ARG(i)) { temp_dead(s, ts); } --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671927255; cv=none; d=zohomail.com; s=zohoarc; b=XVPmB928YO6++ke0mQPtnK41ct4AW+0NVJ0vWA1Op3xGKBilJa5Ebeg0qVOukSKOO/2cXYwzEzeQID6mjaucuXvDgNGglMP/4XPpQApkDz4WJqI5an95UkWEBTBEl13fWkEeVILtgPQHdEFn0vF0t6fyR72CPCjqjNszzZIsQI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671927255; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6kRUHzLHjPRludB9lggQQFcCT178U0N5vVARh39rZgA=; b=n7WjNgrBbiXF0z6n7FHD3Pj1DRf10mAvAkVj9tHfnQvtVGsI5RXu41fHwUUIxrqL1qVdlouc0TtholaXIa17OTti4B/J7xTILg0pggSbl2/Lair1bySpqGBIk5z7i2t5LL3gjxxDqTuwPiA0lDUlTTlRQSDDqJeeBmp3v3cNtDs= 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 1671927255415550.6774280478742; Sat, 24 Dec 2022 16:14:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9EP1-0002nU-32; Sat, 24 Dec 2022 18:58:07 -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 1p9EOv-0002aI-Jk for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:58:02 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9EOt-0006NW-UN for qemu-devel@nongnu.org; Sat, 24 Dec 2022 18:58:01 -0500 Received: by mail-pj1-x102e.google.com with SMTP id q17-20020a17090aa01100b002194cba32e9so11950141pjp.1 for ; Sat, 24 Dec 2022 15:57:59 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id cp12-20020a170902e78c00b00187022627d7sm4599716plb.36.2022.12.24.15.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 15:57:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=6kRUHzLHjPRludB9lggQQFcCT178U0N5vVARh39rZgA=; b=DtP4qs0/jieOPAziMg7vW2olieGnLGcKLSs5f/Jxs0WmdQuM84bYy0L9EXM2odBMX6 izaeyklfE1x1Iy30+aUdYTwhScwdvsEWR0Q6oZhvHw0jXaIt4ANYUZ2I95yohwLOFAU1 QFHJuTJqeFbQM71VjDASuSZv1oMdq5F9rS4IhSo4SGN/lRF+Vwx2UsuOVTiW5bnDfjX6 XREzvwVhKNXhNSNtCVkojx2Y4XBgyNqhkvi+GnPUC4SauafJXLMuS8CTDcbghjWznfSN JbUFRoWa/mO5Kmp5M7g8FoEreGalD9BiSs/VneH8a0Q1h7pcTtrHa4rjwYtXXbbV8mCD x2YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=6kRUHzLHjPRludB9lggQQFcCT178U0N5vVARh39rZgA=; b=76bFmVBMyGsu+uy+vfnw0s77Z3O/NPvHTPFBWBy0uZl0t7CcPd/cCBFMwco2wmteLs DwalJ3Mr71KC1frju4ZU6G6nEwk67VGsUp3UDj78HDH7bpN9zQk8vCIPMpLkIAAHpKm4 J8HmlskGGTL8+tnDy4GCgNAfUtK4JoNhinyNWsjDMawgqqcWLnD61pJsmrWqG+rDBaak Q+k7NuHT7fb/SGU7npI1vZLs9beA2XQsZZsZv4EicVvGAXqi5S0c6qne+Y3+ei+shqFg /F/OInZfi/twkySd1vtL9+YyhJ/BFfTv/30FuIvz+9oDJZS5DgUFKKRD1bkPVW9JlPqi g0qA== X-Gm-Message-State: AFqh2kqaxZ/rkXajE0gdrTtsFPzjs9ZLfR2mPG7ic+ajAANF1QkOjDvj 0KK+Lkc2pze8c/4ilaVLInE8r3+5QOMsrD6N X-Google-Smtp-Source: AMrXdXtgd345lvvbKlTHcykYWrlmbdjXrUUvWRAiCWbNn58PXJ494dD7UoXpyLwWE1jQxEsLuMmNDw== X-Received: by 2002:a17:903:32c3:b0:189:7819:e5c with SMTP id i3-20020a17090332c300b0018978190e5cmr21133237plr.6.1671926279146; Sat, 24 Dec 2022 15:57:59 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 39/43] tcg: Convert typecode_to_ffi from array to function Date: Sat, 24 Dec 2022 15:57:16 -0800 Message-Id: <20221224235720.842093-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671927256900100003 From: Philippe Mathieu-Daud=C3=A9 In the unlikely case of invalid typecode mask, the function will abort instead of returning a NULL pointer. Signed-off-by: Richard Henderson Message-Id: <20221111074101.2069454-27-richard.henderson@linaro.org> [PMD: Split from bigger patch] Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20221122180804.938-2-philmd@linaro.org> --- tcg/tcg.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 74f7491d73..46cce228a0 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -555,14 +555,24 @@ static GHashTable *helper_table; #ifdef CONFIG_TCG_INTERPRETER static GHashTable *ffi_table; =20 -static ffi_type * const typecode_to_ffi[8] =3D { - [dh_typecode_void] =3D &ffi_type_void, - [dh_typecode_i32] =3D &ffi_type_uint32, - [dh_typecode_s32] =3D &ffi_type_sint32, - [dh_typecode_i64] =3D &ffi_type_uint64, - [dh_typecode_s64] =3D &ffi_type_sint64, - [dh_typecode_ptr] =3D &ffi_type_pointer, -}; +static ffi_type *typecode_to_ffi(int argmask) +{ + switch (argmask) { + case dh_typecode_void: + return &ffi_type_void; + case dh_typecode_i32: + return &ffi_type_uint32; + case dh_typecode_s32: + return &ffi_type_sint32; + case dh_typecode_i64: + return &ffi_type_uint64; + case dh_typecode_s64: + return &ffi_type_sint64; + case dh_typecode_ptr: + return &ffi_type_pointer; + } + g_assert_not_reached(); +} #endif =20 typedef struct TCGCumulativeArgs { @@ -779,14 +789,14 @@ static void tcg_context_init(unsigned max_cpus) nargs =3D DIV_ROUND_UP(nargs, 3); =20 ca =3D g_malloc0(sizeof(*ca) + nargs * sizeof(ffi_type *)); - ca->cif.rtype =3D typecode_to_ffi[typemask & 7]; + ca->cif.rtype =3D typecode_to_ffi(typemask & 7); ca->cif.nargs =3D nargs; =20 if (nargs !=3D 0) { ca->cif.arg_types =3D ca->args; for (int j =3D 0; j < nargs; ++j) { int typecode =3D extract32(typemask, (j + 1) * 3, 3); - ca->args[j] =3D typecode_to_ffi[typecode]; + ca->args[j] =3D typecode_to_ffi(typecode); } } =20 --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671927184; cv=none; d=zohomail.com; s=zohoarc; b=Wy2R8C5kbixnzaZ+71YE93cPv2WB59pjgaNfbNTtRfnYIMpx7AxqQ5BLhjssH1Q+WmaY5tETpExeN62RlYZn1p7WqI5I+Up+Xdm9RR2owLIRdMOHs071k0ipMVNa4eMHsArJWOswL7JQxqufGU+/qnMaoeUYYyhXkGRsvJ8fkcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671927184; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OBljFhYIHpDHYp33JDsunVI9K3ZsXt/tBvc3MWwAFFM=; b=ELR4sMlomboW5Fgqd+DaYUqO35MSPsaYtudaIOJ0bA0R2B9tMMkcJT7BHGmoyDO/i8qWBJTdKpnQeuJrnsGZKYnJ3ZEmvXYWzzX0UBZtKAFfoaIPqLA8MomgphKWJeooYXD6zLXzn0gtJ5Ube3yJwym/jEXf76q8SaEiDFifmqo= 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 1671927184622176.47096003847048; Sat, 24 Dec 2022 16:13:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9ES4-0007OQ-Lu; Sat, 24 Dec 2022 19:01:16 -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 1p9ERt-0007NF-Au for qemu-devel@nongnu.org; Sat, 24 Dec 2022 19:01:06 -0500 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9ERr-0000hV-2L for qemu-devel@nongnu.org; Sat, 24 Dec 2022 19:01:05 -0500 Received: by mail-pj1-x1029.google.com with SMTP id v23so7965251pju.3 for ; Sat, 24 Dec 2022 16:01:01 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id e32-20020a630f20000000b00478fd9bb6c7sm4161280pgl.75.2022.12.24.16.00.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 16:01:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=OBljFhYIHpDHYp33JDsunVI9K3ZsXt/tBvc3MWwAFFM=; b=x6hPkZedHFS9asNrOOvRyaILARQszcH/ErxYSNFWPCWyt/1OBl7hCyRn4QTfLxm37X 0NJy47FN+xlkbgsVK3uhivLU2tsYFcaJ7iQ2I1ieE2dOA1VKQAkYx3SLy+TxY192rnww qdFoVmU2O1NlHOh1CENtx+QXtafQ+we8yY1v+m+Ld0xP9nI/ql10u/ALC1SFwNdpodaQ HA/0ySRSLpDP2FVQitGq+ubYZwXNWW/zW5Vuk+obAfp4NtoI09rKiwqg0TMfHwecXjr9 N09RI9l+ErzsbyhWgJJE1QPJv2LAzh7BCziPCdx58wSDM3CAMf6h2I3UnoQh4jEz2tvD ID8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=OBljFhYIHpDHYp33JDsunVI9K3ZsXt/tBvc3MWwAFFM=; b=HV0bm6hfiAtq6rEJtLZjIirKgrzxCz6s9X8rPurqyhi6Ha4o/kuVMrLmHln6pfdIBp 6jnRDntfs89gQztex9befQV9AAdYLudTmBsinpz1Z4I0M3WmHZtAyuSQVklGOHtXgG/n G4blSadNIhMDBB3jBHTTdc6o+oUI1mJVF5VTtQUYv3fYyyzvERPCnhdUwtmT6uQ7xHsI YaTSYvPtr2oQxg7S+hHdWK4skzA80obtonTKwETJmQYP52U0fhOCZr+DVr6haw39dU+d CoJbEP1QKIz7dreFh403I3QX+Rkk3k2FxMsTsmUgy41ubg7Eb7qWoLdFVHbI9lrqZ/yf okOg== X-Gm-Message-State: AFqh2krVGoEN+TyVet/2Up3nMj5x47Y/WIfyFBG1noIN1fLToEvd2WDr nPIBKbPxpY2L6X1Amswet1ZVQZLG6xJyNMnE X-Google-Smtp-Source: AMrXdXspavDN86zA6c1xeDvKlrN7q5Ulz+mlQT8tRVCv+gmv4p/jf828qbU8TsvfmE7fM+aCcTV2xw== X-Received: by 2002:a17:90a:8b14:b0:219:752e:c071 with SMTP id y20-20020a17090a8b1400b00219752ec071mr31651582pjn.6.1671926460733; Sat, 24 Dec 2022 16:01:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 40/43] tcg: Factor init_ffi_layouts() out of tcg_context_init() Date: Sat, 24 Dec 2022 15:57:17 -0800 Message-Id: <20221224235720.842093-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671927186490100003 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson Message-Id: <20221111074101.2069454-27-richard.henderson@linaro.org> [PMD: Split from bigger patch] Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20221122180804.938-3-philmd@linaro.org> --- tcg/tcg.c | 83 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 39 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 46cce228a0..3c3bb2d422 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -573,7 +573,49 @@ static ffi_type *typecode_to_ffi(int argmask) } g_assert_not_reached(); } -#endif + +static void init_ffi_layouts(void) +{ + /* g_direct_hash/equal for direct comparisons on uint32_t. */ + ffi_table =3D g_hash_table_new(NULL, NULL); + for (int i =3D 0; i < ARRAY_SIZE(all_helpers); ++i) { + uint32_t typemask =3D all_helpers[i].typemask; + gpointer hash =3D (gpointer)(uintptr_t)typemask; + struct { + ffi_cif cif; + ffi_type *args[]; + } *ca; + ffi_status status; + int nargs; + + if (g_hash_table_lookup(ffi_table, hash)) { + continue; + } + + /* Ignoring the return type, find the last non-zero field. */ + nargs =3D 32 - clz32(typemask >> 3); + nargs =3D DIV_ROUND_UP(nargs, 3); + + ca =3D g_malloc0(sizeof(*ca) + nargs * sizeof(ffi_type *)); + ca->cif.rtype =3D typecode_to_ffi(typemask & 7); + ca->cif.nargs =3D nargs; + + if (nargs !=3D 0) { + ca->cif.arg_types =3D ca->args; + for (int j =3D 0; j < nargs; ++j) { + int typecode =3D extract32(typemask, (j + 1) * 3, 3); + ca->args[j] =3D typecode_to_ffi(typecode); + } + } + + status =3D ffi_prep_cif(&ca->cif, FFI_DEFAULT_ABI, nargs, + ca->cif.rtype, ca->cif.arg_types); + assert(status =3D=3D FFI_OK); + + g_hash_table_insert(ffi_table, hash, (gpointer)&ca->cif); + } +} +#endif /* CONFIG_TCG_INTERPRETER */ =20 typedef struct TCGCumulativeArgs { int arg_idx; /* tcg_gen_callN args[] */ @@ -768,44 +810,7 @@ static void tcg_context_init(unsigned max_cpus) } =20 #ifdef CONFIG_TCG_INTERPRETER - /* g_direct_hash/equal for direct comparisons on uint32_t. */ - ffi_table =3D g_hash_table_new(NULL, NULL); - for (i =3D 0; i < ARRAY_SIZE(all_helpers); ++i) { - struct { - ffi_cif cif; - ffi_type *args[]; - } *ca; - uint32_t typemask =3D all_helpers[i].typemask; - gpointer hash =3D (gpointer)(uintptr_t)typemask; - ffi_status status; - int nargs; - - if (g_hash_table_lookup(ffi_table, hash)) { - continue; - } - - /* Ignoring the return type, find the last non-zero field. */ - nargs =3D 32 - clz32(typemask >> 3); - nargs =3D DIV_ROUND_UP(nargs, 3); - - ca =3D g_malloc0(sizeof(*ca) + nargs * sizeof(ffi_type *)); - ca->cif.rtype =3D typecode_to_ffi(typemask & 7); - ca->cif.nargs =3D nargs; - - if (nargs !=3D 0) { - ca->cif.arg_types =3D ca->args; - for (int j =3D 0; j < nargs; ++j) { - int typecode =3D extract32(typemask, (j + 1) * 3, 3); - ca->args[j] =3D typecode_to_ffi(typecode); - } - } - - status =3D ffi_prep_cif(&ca->cif, FFI_DEFAULT_ABI, nargs, - ca->cif.rtype, ca->cif.arg_types); - assert(status =3D=3D FFI_OK); - - g_hash_table_insert(ffi_table, hash, (gpointer)&ca->cif); - } + init_ffi_layouts(); #endif =20 tcg_target_init(s); --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926485; cv=none; d=zohomail.com; s=zohoarc; b=kKYcFQ4j7CPX6Muf7OWG5Etqi0ZfmrfXTeM0ZhgmeUTModk9noSY6bUySSE8C6RIC4k54mgV16WYJ1Uh8k/lUc5zmQnx9ld3GBZdQDjo6k16NsZSyfo/NJvK7EXscgZA1LmFGE7KZq56Zzztx8n3x/giqgecFjvNWdXD7D/6Cmo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926485; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4Nqeff2807DVtWliN4Uc1oaHcrsPV+f3YmdHy8haHjQ=; b=gk7pQOETG3QKtLs+AMPjbQKxXgHvZ5UB/7cwlX81plcCJ06DaHpfdo1eHGSGHxXYyo4ZYEwoGcKzwKN7F1FnMcHphdkKBQwgGVAWvrT0fgnCfkaRhksyAcVFl3hQzsHAFkbU5mj3c/QibgeMu9xRfZNaaqjLRyfi/0tfeag7Ydg= 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 1671926485840448.4832010576713; Sat, 24 Dec 2022 16:01:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9ES9-0007Tm-8e; Sat, 24 Dec 2022 19:01:21 -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 1p9ERw-0007NU-K3 for qemu-devel@nongnu.org; Sat, 24 Dec 2022 19:01:12 -0500 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9ERr-0000hZ-It for qemu-devel@nongnu.org; Sat, 24 Dec 2022 19:01:05 -0500 Received: by mail-pj1-x1032.google.com with SMTP id u15-20020a17090a3fcf00b002191825cf02so8005198pjm.2 for ; Sat, 24 Dec 2022 16:01:02 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id e32-20020a630f20000000b00478fd9bb6c7sm4161280pgl.75.2022.12.24.16.01.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 16:01:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=4Nqeff2807DVtWliN4Uc1oaHcrsPV+f3YmdHy8haHjQ=; b=dIQnzHCRWDjan+wO5SHBrNxzp8J8c89TtyTP+UFY2QYMUsbtyAkpsCApUEkNrzL6F4 axoXvrakgpk27Xy4bu4YO63rMIocmUNwfolRzXth0zT+K7l6/JtkD3pbFbtd6dQtQe+i TB61S1ooEng97R/uLMvAbB+oMIjCFCJv7H4JHuhBh7Fp6RgVybn33YFArVOTI8BRnxtD 9CL6xss/GefAaG6u9994B2vMb1Et8OX5OvEd1kQqtpE4JbVLHimFZmemSl8+aQzN5W9s HKLgYEjHSAcn4OiHqGM1YdPFAZDxdq1vR9lBbEbwjli0IQ4jHePXpjLz3KY4YQRQEy1O oYyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=4Nqeff2807DVtWliN4Uc1oaHcrsPV+f3YmdHy8haHjQ=; b=KhrYbzbm0kb6be7U+F7YKY1rj5OXca3H0hBVlIHUtvyVOYIxEe1fOJazYWRpY8VF08 fmfbqkbfX/BPepPFP+VQlQ8LPT4Nhjd+HhOeSVeKhLuz3kFPaZOIYkqJ32m9Dgse7DlQ eVAvSlwN5JvFXWkMEohKYrDtNLbax9LKsPNEmnc5ZRtpAzHoLf2zwo9Vtsm6Byrgd1Zh GfVqxQ8sbncdMG0TQbVw0zzx8QTndKrkdx06CjI4okojYkW+7gUAeiJ6TXalxO2cu/cc 83K09mU+IdijgwNeE82UjSDyJerVutKhH9xeSBDrIew3Fu7Lr81Pi+76p/ebzqGiLHpd 1j6g== X-Gm-Message-State: AFqh2krE3xun5tgDhrO1tt6DJGuXi1ok0sPq349nmFtLJN0mD6yzT7WY sAt+ChmhPuVRF4MOVAjaZD7oo4qDjjpmaQm8 X-Google-Smtp-Source: AMrXdXt9gug2ACS6a7ImV++uJyCek5xEDFgW73vyW31q2oLEgG9P2EKGK33FL0U7L12faY/evOqzKA== X-Received: by 2002:a05:6a20:4f02:b0:ad:ccea:73b4 with SMTP id gi2-20020a056a204f0200b000adccea73b4mr15412288pzb.42.1671926461755; Sat, 24 Dec 2022 16:01:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 41/43] tcg: Move ffi_cif pointer into TCGHelperInfo Date: Sat, 24 Dec 2022 15:57:18 -0800 Message-Id: <20221224235720.842093-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926487794100007 Instead of requiring a separate hash table lookup, put a pointer to the CIF into TCGHelperInfo. Signed-off-by: Richard Henderson Message-Id: <20221111074101.2069454-27-richard.henderson@linaro.org> [PMD: Split from bigger patch] Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20221122180804.938-4-philmd@linaro.org> --- tcg/tcg-internal.h | 7 +++++++ tcg/tcg.c | 30 ++++++++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/tcg/tcg-internal.h b/tcg/tcg-internal.h index c7e87e193d..6e50aeba3a 100644 --- a/tcg/tcg-internal.h +++ b/tcg/tcg-internal.h @@ -25,6 +25,10 @@ #ifndef TCG_INTERNAL_H #define TCG_INTERNAL_H =20 +#ifdef CONFIG_TCG_INTERPRETER +#include +#endif + #define TCG_HIGHWATER 1024 =20 /* @@ -57,6 +61,9 @@ typedef struct TCGCallArgumentLoc { typedef struct TCGHelperInfo { void *func; const char *name; +#ifdef CONFIG_TCG_INTERPRETER + ffi_cif *cif; +#endif unsigned typemask : 32; unsigned flags : 8; unsigned nr_in : 8; diff --git a/tcg/tcg.c b/tcg/tcg.c index 3c3bb2d422..9092473cf0 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -62,10 +62,6 @@ #include "tcg/tcg-ldst.h" #include "tcg-internal.h" =20 -#ifdef CONFIG_TCG_INTERPRETER -#include -#endif - /* Forward declarations for functions declared in tcg-target.c.inc and used here. */ static void tcg_target_init(TCGContext *s); @@ -553,8 +549,6 @@ static TCGHelperInfo all_helpers[] =3D { static GHashTable *helper_table; =20 #ifdef CONFIG_TCG_INTERPRETER -static GHashTable *ffi_table; - static ffi_type *typecode_to_ffi(int argmask) { switch (argmask) { @@ -577,9 +571,11 @@ static ffi_type *typecode_to_ffi(int argmask) static void init_ffi_layouts(void) { /* g_direct_hash/equal for direct comparisons on uint32_t. */ - ffi_table =3D g_hash_table_new(NULL, NULL); + GHashTable *ffi_table =3D g_hash_table_new(NULL, NULL); + for (int i =3D 0; i < ARRAY_SIZE(all_helpers); ++i) { - uint32_t typemask =3D all_helpers[i].typemask; + TCGHelperInfo *info =3D &all_helpers[i]; + unsigned typemask =3D info->typemask; gpointer hash =3D (gpointer)(uintptr_t)typemask; struct { ffi_cif cif; @@ -587,8 +583,11 @@ static void init_ffi_layouts(void) } *ca; ffi_status status; int nargs; + ffi_cif *cif; =20 - if (g_hash_table_lookup(ffi_table, hash)) { + cif =3D g_hash_table_lookup(ffi_table, hash); + if (cif) { + info->cif =3D cif; continue; } =20 @@ -612,8 +611,12 @@ static void init_ffi_layouts(void) ca->cif.rtype, ca->cif.arg_types); assert(status =3D=3D FFI_OK); =20 - g_hash_table_insert(ffi_table, hash, (gpointer)&ca->cif); + cif =3D &ca->cif; + info->cif =3D cif; + g_hash_table_insert(ffi_table, hash, (gpointer)cif); } + + g_hash_table_destroy(ffi_table); } #endif /* CONFIG_TCG_INTERPRETER */ =20 @@ -4385,12 +4388,7 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp = *op) } =20 #ifdef CONFIG_TCG_INTERPRETER - { - gpointer hash =3D (gpointer)(uintptr_t)info->typemask; - ffi_cif *cif =3D g_hash_table_lookup(ffi_table, hash); - assert(cif !=3D NULL); - tcg_out_call(s, tcg_call_func(op), cif); - } + tcg_out_call(s, tcg_call_func(op), info->cif); #else tcg_out_call(s, tcg_call_func(op)); #endif --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671926823; cv=none; d=zohomail.com; s=zohoarc; b=EUYRzCzXw4KujHsTTJgJJCROo5NjIQV5L/s7cp+IR8Y9ux3QYEi55MwRP18QSkHzmRmnrP7M4qrZvbOewVLBQT+ie5gGqduXdC+6pU3vYF5QIWbGbj+KFsnllEflXGikfjBbyASPmJ7HrP4mhhWRGLpSXqAD6WiZOBU6KcuBF00= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671926823; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AOYCCYtPdnKj+yfIPyQ3b3Eju8B6onYQzX1BsWT7Kq0=; b=BWrfViB9Id8oZy88LKOQP6zAguvWkFKbcyDJgTAoI8oI5rB0WETT4QknYGD2a4nO7oSeZ13gcZqujL84RDgruUvsIDA8cN+ob8lBXrpm8gRodlPNh1LDbWJaQoYk7ry3Av0oJ2qPrNk3noAhYjPGB5m5k0rN3fF6jGOipeMp018= 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 1671926823462193.0766625229072; Sat, 24 Dec 2022 16:07:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9ES8-0007Ss-Ca; Sat, 24 Dec 2022 19:01:20 -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 1p9ERw-0007NV-Kk for qemu-devel@nongnu.org; Sat, 24 Dec 2022 19:01:12 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9ERr-0000iw-UV for qemu-devel@nongnu.org; Sat, 24 Dec 2022 19:01:06 -0500 Received: by mail-pj1-x102e.google.com with SMTP id hd14-20020a17090b458e00b0021909875bccso10217535pjb.1 for ; Sat, 24 Dec 2022 16:01:03 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id e32-20020a630f20000000b00478fd9bb6c7sm4161280pgl.75.2022.12.24.16.01.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 16:01:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=AOYCCYtPdnKj+yfIPyQ3b3Eju8B6onYQzX1BsWT7Kq0=; b=Faje3W4rWEiNKGLIZtaELEXOVtTGmUbEFupcf1xnevsg5SJBzRnKonbJxiYL/Jglbd GHeBPcV+0j0JQaV8pBiQFl4gfBZCbB7vXZj/eIIMHPWR/kXaEeN9lwW+74VNuBM6ZofG ORNMhU3D3v/6SUvP/vR95h4lehYyK3s7Sh6++ntzHsmUmgbZSMJRKtGCnFTH4Am5hCzX VyU35mD6clALHKAMHYPO7gxtWHv0t7eBbB6L4zKAiGKhWjzbjVSoJ/WTR1M5BlfSX8IN T0mkjK+Ole9gG8I7bwz7G81xqko990bB2X2lyu8Rd1h77iEtWveGLHtsDymNiDkUFtrE o7+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=AOYCCYtPdnKj+yfIPyQ3b3Eju8B6onYQzX1BsWT7Kq0=; b=kCPUZk56R40wgaBc1fVT+c0AUoizucC6dmkuhvcptSqXIOxZgHheQEQZE3YzXIH6Xx 9ZMNj2u7NPcBB7liXhWyPqE893phmPlcM4PuC3zRCHaijJwgIBvc9p5RRGqIU62E4tPm G6NvbiXexoZfH4P/bhPAcLnxbeDTQxe5ZjS4V+sW3pwHq3nzcLX5uqgzQPpx+2iIyamc EQ8Vxb1EjmiXAoW5KUREddyIGeQ0GX3r3frHP3SSJXgOXXetpAPefuRZ7jCXfYI9kBEp UVDmEdFGg94rZnWPNyw8euKNCHlFwTm/S/gV5a6sX1n5/3YNTBexuRbqLRQYfAzu1fo5 0CXw== X-Gm-Message-State: AFqh2kq9WmwUYiPorLnZKZi1v9fxzmr2phv5kgYbu54ddZkeu0atdVuF QeFwLA34UWfvZgHSqEX6lvyxXV5tqGH1xmb4 X-Google-Smtp-Source: AMrXdXvxH8MxJPqMaTlh08UU8Ya078up99KPPPMGSRa8LQQSDgsuufznw4xMnlOQdJkMqNGSugOfGg== X-Received: by 2002:a05:6a21:3942:b0:9d:efbe:2065 with SMTP id ac2-20020a056a21394200b0009defbe2065mr20523207pzc.27.1671926462646; Sat, 24 Dec 2022 16:01:02 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 42/43] tcg/aarch64: Merge tcg_out_callr into tcg_out_call Date: Sat, 24 Dec 2022 15:57:19 -0800 Message-Id: <20221224235720.842093-43-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671926825016100001 There is only one use, and BLR is perhaps even more self-documentary than CALLR. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c.inc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 344b63e20f..1af879e6f5 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -1336,11 +1336,6 @@ static void tcg_out_goto_long(TCGContext *s, const t= cg_insn_unit *target) } } =20 -static inline void tcg_out_callr(TCGContext *s, TCGReg reg) -{ - tcg_out_insn(s, 3207, BLR, reg); -} - static void tcg_out_call(TCGContext *s, const tcg_insn_unit *target) { ptrdiff_t offset =3D tcg_pcrel_diff(s, target) >> 2; @@ -1348,7 +1343,7 @@ static void tcg_out_call(TCGContext *s, const tcg_ins= n_unit *target) tcg_out_insn(s, 3206, BL, offset); } else { tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_TMP, (intptr_t)target); - tcg_out_callr(s, TCG_REG_TMP); + tcg_out_insn(s, 3207, BLR, TCG_REG_TMP); } } =20 --=20 2.34.1 From nobody Sat May 18 21:45:41 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1671927328; cv=none; d=zohomail.com; s=zohoarc; b=M6SWQhpNSHWN0JeFuar38Dlpw2zx6/qDfpyanfS1JTPPEzto0823wIs0yJ4S/+1M+92RHpK3HoBV+7OCnWtkDXr4z9bdzKaFCH0IShb3tWBQLsh5QBJ/JSSZ2sGlHJR0UUvNM6neGQWCKxOlZgvg3qUAag1EVfdzzEjCcOGNyA8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671927328; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=t90UzdI6bBWuX61bW3oSKKHPeT/DJfZGV++tUHFjEmI=; b=XC4EpFnCwMA1PU1akQzsYon2do9xcS+7leRHF2wF56dwvL0QHfTGijBBLi0WyFr678Qax7kWiDLKPxPibsMIRGawtHtB2NaOBaN2c++KoeeynZBCjf2RXnZ9g6JOjEkIJ87txG5f5YHbKJ/rp1rCUanYb5msiRevedFL1NJhegc= 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 1671927328380132.70949198734854; Sat, 24 Dec 2022 16:15:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9ES9-0007U2-ES; Sat, 24 Dec 2022 19:01:21 -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 1p9ERz-0007Nh-1m for qemu-devel@nongnu.org; Sat, 24 Dec 2022 19:01:12 -0500 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9ERu-0000j0-T3 for qemu-devel@nongnu.org; Sat, 24 Dec 2022 19:01:10 -0500 Received: by mail-pj1-x1035.google.com with SMTP id fy4so8011785pjb.0 for ; Sat, 24 Dec 2022 16:01:04 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id e32-20020a630f20000000b00478fd9bb6c7sm4161280pgl.75.2022.12.24.16.01.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Dec 2022 16:01:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=t90UzdI6bBWuX61bW3oSKKHPeT/DJfZGV++tUHFjEmI=; b=DbIVMZbRV64SXxlhBXIdPyCLl9C/H49g7ldc0AsYy/lIBXAF8zaBmccBqxuMyTQJkh IH502y3deR2vZSgqHm5l+JiAtW78a1paESYIvqnCJQEsFfJxgVvci3+11bhP9I9aDWQm 6iA3cI+7R5xOdi+ugmxGktqwFuqFS6jGPCM7FkW3t3JZjtDk1IhXR24pq12TNb1hbssS sKAg0QxHlQE5iJBeGaIcJu4oyXm0ww8t1+MQA6J+XE6jMkFKy6LQRKI1E5K+uXhSn4ef JFZeIDyGbrbfry8eOUKEEtQyCOW+BhR7zursUIvsSEpNzO1HZmJeu6frGs8kJRUUaSyr LBEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=t90UzdI6bBWuX61bW3oSKKHPeT/DJfZGV++tUHFjEmI=; b=row+plMaD5nRjVo/1IgSIrkmujyk55igUFk4ETbM131Ffj4KjJ51ZnpG9/kLFzjyl1 6WV9DhewFdNm1TvFisgROyi5EVjNPSGdbHzCEsPPWl2evanVmI+0qOF9tBI0pXY717pB QqKVYBPssJdvHsBPJKUK9mQ2AkbKMqpyygUFO2iD/YUTzIOY7kWq6dXDanfe1SIHib3w gdIwpmPggzZ2wttYNkMZ2lLV9Yvy2oJWcloSqiRXBhbXTp02DzO30d6mVg/bPV+BdYZc e16AsgCQSKgEy5Hy9tvRPdlZ1jhffdyHCNsaay7S+mOdT+vevpYmwm6PkgW6NiQNcal9 1OMw== X-Gm-Message-State: AFqh2kqLw0NjDvaE7XU2PiqCfP90t28bqn2b1leC9MI9ql3btpS0FzGt +vN5p3qM6nD9t3K7vhTRjEDIeyH8hHJALYuu X-Google-Smtp-Source: AMrXdXtR+r3c8/FgR8upfDab0G1IZ9t1uLwGxaDNQ8DIR+BPQhjhkXGuAucTDJJCNmClK72l6CZ1Zg== X-Received: by 2002:a05:6a20:94c3:b0:a3:6f97:e658 with SMTP id ht3-20020a056a2094c300b000a36f97e658mr17943434pzb.58.1671926463609; Sat, 24 Dec 2022 16:01:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v5 43/43] tcg: Add TCGHelperInfo argument to tcg_out_call Date: Sat, 24 Dec 2022 15:57:20 -0800 Message-Id: <20221224235720.842093-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224235720.842093-1-richard.henderson@linaro.org> References: <20221224235720.842093-1-richard.henderson@linaro.org> 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::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @linaro.org) X-ZM-MESSAGEID: 1671927329378100001 This eliminates an ifdef for TCI, and will be required for expanding the call for TCGv_i128. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/tcg.c | 12 ++---------- tcg/aarch64/tcg-target.c.inc | 12 +++++++++--- tcg/arm/tcg-target.c.inc | 10 ++++++++-- tcg/i386/tcg-target.c.inc | 5 +++-- tcg/loongarch64/tcg-target.c.inc | 7 ++++--- tcg/mips/tcg-target.c.inc | 3 ++- tcg/ppc/tcg-target.c.inc | 7 ++++--- tcg/riscv/tcg-target.c.inc | 7 ++++--- tcg/s390x/tcg-target.c.inc | 12 +++++++++--- tcg/sparc64/tcg-target.c.inc | 3 ++- tcg/tci/tcg-target.c.inc | 3 ++- 11 files changed, 49 insertions(+), 32 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 9092473cf0..acd73d09bf 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -145,12 +145,8 @@ static void tcg_out_st(TCGContext *s, TCGType type, TC= GReg arg, TCGReg arg1, intptr_t arg2); static bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, TCGReg base, intptr_t ofs); -#ifdef CONFIG_TCG_INTERPRETER static void tcg_out_call(TCGContext *s, const tcg_insn_unit *target, - ffi_cif *cif); -#else -static void tcg_out_call(TCGContext *s, const tcg_insn_unit *target); -#endif + const TCGHelperInfo *info); static bool tcg_target_const_match(int64_t val, TCGType type, int ct); #ifdef TCG_TARGET_NEED_LDST_LABELS static int tcg_out_ldst_finalize(TCGContext *s); @@ -4387,11 +4383,7 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp = *op) save_globals(s, allocated_regs); } =20 -#ifdef CONFIG_TCG_INTERPRETER - tcg_out_call(s, tcg_call_func(op), info->cif); -#else - tcg_out_call(s, tcg_call_func(op)); -#endif + tcg_out_call(s, tcg_call_func(op), info); =20 /* Assign output registers and emit moves if needed. */ switch (info->out_kind) { diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 1af879e6f5..ad1816e32d 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -1336,7 +1336,7 @@ static void tcg_out_goto_long(TCGContext *s, const tc= g_insn_unit *target) } } =20 -static void tcg_out_call(TCGContext *s, const tcg_insn_unit *target) +static void tcg_out_call_int(TCGContext *s, const tcg_insn_unit *target) { ptrdiff_t offset =3D tcg_pcrel_diff(s, target) >> 2; if (offset =3D=3D sextract64(offset, 0, 26)) { @@ -1347,6 +1347,12 @@ static void tcg_out_call(TCGContext *s, const tcg_in= sn_unit *target) } } =20 +static void tcg_out_call(TCGContext *s, const tcg_insn_unit *target, + const TCGHelperInfo *info) +{ + tcg_out_call_int(s, target); +} + void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_rx, uintptr_t jmp_rw, uintptr_t addr) { @@ -1594,7 +1600,7 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) tcg_out_mov(s, TARGET_LONG_BITS =3D=3D 64, TCG_REG_X1, lb->addrlo_reg); tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_X2, oi); tcg_out_adr(s, TCG_REG_X3, lb->raddr); - tcg_out_call(s, qemu_ld_helpers[opc & MO_SIZE]); + tcg_out_call_int(s, qemu_ld_helpers[opc & MO_SIZE]); if (opc & MO_SIGN) { tcg_out_sxt(s, lb->type, size, lb->datalo_reg, TCG_REG_X0); } else { @@ -1620,7 +1626,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) tcg_out_mov(s, size =3D=3D MO_64, TCG_REG_X2, lb->datalo_reg); tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_X3, oi); tcg_out_adr(s, TCG_REG_X4, lb->raddr); - tcg_out_call(s, qemu_st_helpers[opc & MO_SIZE]); + tcg_out_call_int(s, qemu_st_helpers[opc & MO_SIZE]); tcg_out_goto(s, lb->raddr); return true; } diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 2c6c353eea..9245ea86d0 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -1131,7 +1131,7 @@ static void tcg_out_goto(TCGContext *s, ARMCond cond,= const tcg_insn_unit *addr) * The call case is mostly used for helpers - so it's not unreasonable * for them to be beyond branch range. */ -static void tcg_out_call(TCGContext *s, const tcg_insn_unit *addr) +static void tcg_out_call_int(TCGContext *s, const tcg_insn_unit *addr) { intptr_t addri =3D (intptr_t)addr; ptrdiff_t disp =3D tcg_pcrel_diff(s, addr); @@ -1150,6 +1150,12 @@ static void tcg_out_call(TCGContext *s, const tcg_in= sn_unit *addr) tcg_out_blx_reg(s, COND_AL, TCG_REG_TMP); } =20 +static void tcg_out_call(TCGContext *s, const tcg_insn_unit *addr, + const TCGHelperInfo *info) +{ + tcg_out_call_int(s, addr); +} + static void tcg_out_goto_label(TCGContext *s, ARMCond cond, TCGLabel *l) { if (l->has_value) { @@ -1515,7 +1521,7 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) argreg =3D tcg_out_arg_reg32(s, argreg, TCG_REG_R14); =20 /* Use the canonical unsigned helpers and minimize icache usage. */ - tcg_out_call(s, qemu_ld_helpers[opc & MO_SIZE]); + tcg_out_call_int(s, qemu_ld_helpers[opc & MO_SIZE]); =20 datalo =3D lb->datalo_reg; datahi =3D lb->datahi_reg; diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index cb04e4b3ad..58bd5873f5 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -1661,7 +1661,8 @@ static void tcg_out_branch(TCGContext *s, int call, c= onst tcg_insn_unit *dest) } } =20 -static inline void tcg_out_call(TCGContext *s, const tcg_insn_unit *dest) +static void tcg_out_call(TCGContext *s, const tcg_insn_unit *dest, + const TCGHelperInfo *info) { tcg_out_branch(s, 1, dest); } @@ -1885,7 +1886,7 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, = TCGLabelQemuLdst *l) (uintptr_t)l->raddr); } =20 - tcg_out_call(s, qemu_ld_helpers[opc & (MO_BSWAP | MO_SIZE)]); + tcg_out_branch(s, 1, qemu_ld_helpers[opc & (MO_BSWAP | MO_SIZE)]); =20 data_reg =3D l->datalo_reg; switch (opc & MO_SSIZE) { diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.= c.inc index d326e28740..c9e99e8ec3 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -567,7 +567,8 @@ static void tcg_out_call_int(TCGContext *s, const tcg_i= nsn_unit *arg, bool tail) } } =20 -static void tcg_out_call(TCGContext *s, const tcg_insn_unit *arg) +static void tcg_out_call(TCGContext *s, const tcg_insn_unit *arg, + const TCGHelperInfo *info) { tcg_out_call_int(s, arg, false); } @@ -760,7 +761,7 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TC= GLabelQemuLdst *l) tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_A2, oi); tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_A3, (tcg_target_long)l->raddr); =20 - tcg_out_call(s, qemu_ld_helpers[size]); + tcg_out_call_int(s, qemu_ld_helpers[size], false); =20 switch (opc & MO_SSIZE) { case MO_SB: @@ -821,7 +822,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TC= GLabelQemuLdst *l) tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_A3, oi); tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_A4, (tcg_target_long)l->raddr); =20 - tcg_out_call(s, qemu_st_helpers[size]); + tcg_out_call_int(s, qemu_st_helpers[size], false); =20 return tcg_out_goto(s, l->raddr); } diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index bd76f0c97f..292e490b5c 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -1020,7 +1020,8 @@ static void tcg_out_call_int(TCGContext *s, const tcg= _insn_unit *arg, bool tail) } } =20 -static void tcg_out_call(TCGContext *s, const tcg_insn_unit *arg) +static void tcg_out_call(TCGContext *s, const tcg_insn_unit *arg, + const TCGHelperInfo *info) { tcg_out_call_int(s, arg, false); tcg_out_nop(s); diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 38ee9974cd..e0621463f6 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2002,7 +2002,8 @@ static void tcg_out_call_int(TCGContext *s, int lk, #endif } =20 -static void tcg_out_call(TCGContext *s, const tcg_insn_unit *target) +static void tcg_out_call(TCGContext *s, const tcg_insn_unit *target, + const TCGHelperInfo *info) { tcg_out_call_int(s, LK, target); } @@ -2221,7 +2222,7 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) tcg_out_movi(s, TCG_TYPE_I32, arg++, oi); tcg_out32(s, MFSPR | RT(arg) | LR); =20 - tcg_out_call(s, qemu_ld_helpers[opc & (MO_BSWAP | MO_SIZE)]); + tcg_out_call_int(s, LK, qemu_ld_helpers[opc & (MO_BSWAP | MO_SIZE)]); =20 lo =3D lb->datalo_reg; hi =3D lb->datahi_reg; @@ -2290,7 +2291,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) tcg_out_movi(s, TCG_TYPE_I32, arg++, oi); tcg_out32(s, MFSPR | RT(arg) | LR); =20 - tcg_out_call(s, qemu_st_helpers[opc & (MO_BSWAP | MO_SIZE)]); + tcg_out_call_int(s, LK, qemu_st_helpers[opc & (MO_BSWAP | MO_SIZE)]); =20 tcg_out_b(s, 0, lb->raddr); return true; diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index 81a83e45b1..aa017d665a 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -819,7 +819,8 @@ static void tcg_out_call_int(TCGContext *s, const tcg_i= nsn_unit *arg, bool tail) } } =20 -static void tcg_out_call(TCGContext *s, const tcg_insn_unit *arg) +static void tcg_out_call(TCGContext *s, const tcg_insn_unit *arg, + const TCGHelperInfo *info) { tcg_out_call_int(s, arg, false); } @@ -1002,7 +1003,7 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, = TCGLabelQemuLdst *l) tcg_out_movi(s, TCG_TYPE_PTR, a2, oi); tcg_out_movi(s, TCG_TYPE_PTR, a3, (tcg_target_long)l->raddr); =20 - tcg_out_call(s, qemu_ld_helpers[opc & MO_SSIZE]); + tcg_out_call_int(s, qemu_ld_helpers[opc & MO_SSIZE], false); tcg_out_mov(s, (opc & MO_SIZE) =3D=3D MO_64, l->datalo_reg, a0); =20 tcg_out_goto(s, l->raddr); @@ -1047,7 +1048,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, = TCGLabelQemuLdst *l) tcg_out_movi(s, TCG_TYPE_PTR, a3, oi); tcg_out_movi(s, TCG_TYPE_PTR, a4, (tcg_target_long)l->raddr); =20 - tcg_out_call(s, qemu_st_helpers[opc & MO_SIZE]); + tcg_out_call_int(s, qemu_st_helpers[opc & MO_SIZE], false); =20 tcg_out_goto(s, l->raddr); return true; diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index f1d3907cd8..b9ba7b605e 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -1691,7 +1691,7 @@ static void tgen_brcond(TCGContext *s, TCGType type, = TCGCond c, tgen_branch(s, cc, l); } =20 -static void tcg_out_call(TCGContext *s, const tcg_insn_unit *dest) +static void tcg_out_call_int(TCGContext *s, const tcg_insn_unit *dest) { ptrdiff_t off =3D tcg_pcrel_diff(s, dest) >> 1; if (off =3D=3D (int32_t)off) { @@ -1702,6 +1702,12 @@ static void tcg_out_call(TCGContext *s, const tcg_in= sn_unit *dest) } } =20 +static void tcg_out_call(TCGContext *s, const tcg_insn_unit *dest, + const TCGHelperInfo *info) +{ + tcg_out_call_int(s, dest); +} + static void tcg_out_qemu_ld_direct(TCGContext *s, MemOp opc, TCGReg data, TCGReg base, TCGReg index, int disp) { @@ -1897,7 +1903,7 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) } tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_R4, oi); tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R5, (uintptr_t)lb->raddr); - tcg_out_call(s, qemu_ld_helpers[opc & (MO_BSWAP | MO_SSIZE)]); + tcg_out_call_int(s, qemu_ld_helpers[opc & (MO_BSWAP | MO_SSIZE)]); tcg_out_mov(s, TCG_TYPE_I64, data_reg, TCG_REG_R2); =20 tgen_gotoi(s, S390_CC_ALWAYS, lb->raddr); @@ -1938,7 +1944,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) } tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_R5, oi); tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R6, (uintptr_t)lb->raddr); - tcg_out_call(s, qemu_st_helpers[opc & (MO_BSWAP | MO_SIZE)]); + tcg_out_call_int(s, qemu_st_helpers[opc & (MO_BSWAP | MO_SIZE)]); =20 tgen_gotoi(s, S390_CC_ALWAYS, lb->raddr); return true; diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc index cb9453efdd..eb913f33c8 100644 --- a/tcg/sparc64/tcg-target.c.inc +++ b/tcg/sparc64/tcg-target.c.inc @@ -859,7 +859,8 @@ static void tcg_out_call_nodelay(TCGContext *s, const t= cg_insn_unit *dest, } } =20 -static void tcg_out_call(TCGContext *s, const tcg_insn_unit *dest) +static void tcg_out_call(TCGContext *s, const tcg_insn_unit *dest, + const TCGHelperInfo *info) { tcg_out_call_nodelay(s, dest, false); tcg_out_nop(s); diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc index c1acaa943e..d36a7ebdd1 100644 --- a/tcg/tci/tcg-target.c.inc +++ b/tcg/tci/tcg-target.c.inc @@ -558,8 +558,9 @@ static void tcg_out_movi(TCGContext *s, TCGType type, } =20 static void tcg_out_call(TCGContext *s, const tcg_insn_unit *func, - ffi_cif *cif) + const TCGHelperInfo *info) { + ffi_cif *cif =3D info->cif; tcg_insn_unit insn =3D 0; uint8_t which; =20 --=20 2.34.1