From patchwork Wed Feb 3 02:15:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 375351 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp732912jah; Tue, 2 Feb 2021 18:21:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUCAVjpzHe+OTUAFirdffD8VoESrZ0VlIA0uVr6ZSMXc4gECOpf7M/q9LZ2xwzMM6RlezW X-Received: by 2002:a25:5583:: with SMTP id j125mr1097430ybb.307.1612318919636; Tue, 02 Feb 2021 18:21:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612318919; cv=none; d=google.com; s=arc-20160816; b=tAAnHKzpFSwyGgi1xYNraGH4vGHphh2SUhzsKY885DEKE7Vdfheq05fCy1GIUmtUDO l4hkX2tYTSKeudIZGxCUnzn+nVjPENt83elk3CCjIqhV0599nDta4adCAExM1i8On2tN Gi/sI7b2ZDUgi8wVxdfWBLrxkHAmhfLZgDlxt5DG+ZP0AReq960V5BBTpJbQRMnINlxL KOB+O+XbA2vEVSxXnBPVPqxoGxoCaciN+ntU0eD794VHUGfgSJX/uc+wYnVfdMlvYols SG+VnsQTJbTWqzez962HDUCaOJ7nCAHuuVzHhTU2uRhBaqgLoHoKTXYtUgvvkqsinfT1 oBbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=/xX/J9vMnowuMWo8/HanLANiLouFut86e12omyKqeRo=; b=PaHJFfMZIKdX71Mt31tMMeU3hPJnhGFHlgRDpTkTINiy4Axm9OGJTEBHLaA5wRUWMB sGNrP5FgxnQDh7uORm8qMMoxaXHixGIS6BIDGfRxbLCTJvkBqIz52OFvRp3npokEpyeZ +oyGIRQMOeAVxZQCEWJXCO/TvjjdUJ0iiEIURv4BLa9dz6TBf6uKqQHt9vTqAcRCpSRA FPoS/HMNQy5EaNmtjDPyWqROuVX609ZJBgwe6vug9D9NqiL3cfVNJ5UimkL6Jr8x8abu D1OL5VHLPyBQww/ibNS+Y7itQFvMIFJe+H85BkhT3wpWm0SHN12OLZC8JRizxnUoxqoC XTHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BcgfTNQH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q8si881163ybc.378.2021.02.02.18.21.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Feb 2021 18:21:59 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BcgfTNQH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l77nr-00063G-5J for patch@linaro.org; Tue, 02 Feb 2021 21:21:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l77iL-0007lm-Ap for qemu-devel@nongnu.org; Tue, 02 Feb 2021 21:16:19 -0500 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:33844) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l77iH-00012W-0K for qemu-devel@nongnu.org; Tue, 02 Feb 2021 21:16:17 -0500 Received: by mail-pf1-x42f.google.com with SMTP id m6so15672152pfk.1 for ; Tue, 02 Feb 2021 18:16:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/xX/J9vMnowuMWo8/HanLANiLouFut86e12omyKqeRo=; b=BcgfTNQHj7CZ1LdkK6VoNTPfVcy8YIe6yzlhZjfbud48x2T1KjWuSkRtnrD/Urrd0d 7z3VujM4/fuyCZb1ZWJu0Le8d5E4heU2IoIRBZe5rJovteHWheWPAQxcGVz/R/sMsWLf dtOB65U3HewKfCJ1xbDJoWDRC12cWcc7ZYJJ8A1HArtZKKV5/tfEfNHi12cGaTTPamCt gEwVr8y5rUhebypm11uIRNBxPt+tccgO1QHTM7+f3CO/k5K3rT801cP57TzDqOxtH4qM AEK/akddPvCQ3VGM4SRoFj6DLePsJfo45ebhwyel+Ha58AmNKvNhHNgJGhhPbYZwzIhy WVcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/xX/J9vMnowuMWo8/HanLANiLouFut86e12omyKqeRo=; b=IRyx4cWuwFeWwLh5SOB5pqeeHj2vhysInCpC6829YYIrPbPpdxxxSLH+05ssZVJVUC Oj4aE0mqs4lAvSDi7BKqLcFOQX5rl/rBMwgcUuggpARX65/1UZKUiEdOeoInwrn9PzI8 lpIwjcI5ht5mTSUzjuA20BvyeYuBXP0fsSFlPl9nl+RMbFm4qBKz8sgqVnSaafI2T2Cx ABP6/gGx/Z1fy9H07NGLhs4zGD0dlFcmj3DVwp/9Nko9DY/E9G80HMh3zgtUP+MRbzpg n0ngDV6I0vgDLDvglo5H26YsaTvhhPBCz2N2EBOqfh6Yi3o8MjrxI1//vS21Km6e3aCR 7TKQ== X-Gm-Message-State: AOAM531ktCyaQBFThDjPdgiS5dUQOuk4eSb6s7sZ1IjcIU5R7gtZ8E83 5yakfx0hHX5KogkpjexK2D4/SHTh1Ky9JYmD X-Received: by 2002:a63:c43:: with SMTP id 3mr1125265pgm.250.1612318571775; Tue, 02 Feb 2021 18:16:11 -0800 (PST) Received: from localhost.localdomain (cpe-66-27-222-29.hawaii.res.rr.com. [66.27.222.29]) by smtp.gmail.com with ESMTPSA id x1sm270301pgj.37.2021.02.02.18.16.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Feb 2021 18:16:11 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 12/24] tcg/s390: Split out target constraints to tcg-target-con-str.h Date: Tue, 2 Feb 2021 16:15:38 -1000 Message-Id: <20210203021550.375058-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210203021550.375058-1-richard.henderson@linaro.org> References: <20210203021550.375058-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/s390/tcg-target-con-str.h | 28 ++++++++++++++++++ tcg/s390/tcg-target.h | 1 + tcg/s390/tcg-target.c.inc | 53 +++++++++-------------------------- 3 files changed, 42 insertions(+), 40 deletions(-) create mode 100644 tcg/s390/tcg-target-con-str.h -- 2.25.1 diff --git a/tcg/s390/tcg-target-con-str.h b/tcg/s390/tcg-target-con-str.h new file mode 100644 index 0000000000..892d8f8c06 --- /dev/null +++ b/tcg/s390/tcg-target-con-str.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Define S390 target-specific operand constraints. + * Copyright (c) 2021 Linaro + */ + +/* + * Define constraint letters for register sets: + * REGS(letter, register_mask) + */ +REGS('r', ALL_GENERAL_REGS) +REGS('L', ALL_GENERAL_REGS & ~SOFTMMU_RESERVE_REGS) +/* + * A (single) even/odd pair for division. + * TODO: Add something to the register allocator to allow + * this kind of regno+1 pairing to be done more generally. + */ +REGS('a', 1u << TCG_REG_R2) +REGS('b', 1u << TCG_REG_R3) + +/* + * Define constraint letters for constants: + * CONST(letter, TCG_CT_CONST_* bit set) + */ +CONST('A', TCG_CT_CONST_S33) +CONST('I', TCG_CT_CONST_S16) +CONST('J', TCG_CT_CONST_S32) +CONST('Z', TCG_CT_CONST_ZERO) diff --git a/tcg/s390/tcg-target.h b/tcg/s390/tcg-target.h index 641464eea4..c43d6aba84 100644 --- a/tcg/s390/tcg-target.h +++ b/tcg/s390/tcg-target.h @@ -159,5 +159,6 @@ static inline void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_rx, #define TCG_TARGET_NEED_LDST_LABELS #endif #define TCG_TARGET_NEED_POOL_LABELS +#define TCG_TARGET_CON_STR_H #endif diff --git a/tcg/s390/tcg-target.c.inc b/tcg/s390/tcg-target.c.inc index 8517e55232..3fec7fec5f 100644 --- a/tcg/s390/tcg-target.c.inc +++ b/tcg/s390/tcg-target.c.inc @@ -42,6 +42,19 @@ #define TCG_CT_CONST_S33 0x400 #define TCG_CT_CONST_ZERO 0x800 +#define ALL_GENERAL_REGS MAKE_64BIT_MASK(0, 16) +/* + * For softmmu, we need to avoid conflicts with the first 3 + * argument registers to perform the tlb lookup, and to call + * the helper function. + */ +#ifdef CONFIG_SOFTMMU +#define SOFTMMU_RESERVE_REGS MAKE_64BIT_MASK(TCG_REG_R2, 3) +#else +#define SOFTMMU_RESERVE_REGS 0 +#endif + + /* Several places within the instruction set 0 means "no register" rather than TCG_REG_R0. */ #define TCG_REG_NONE 0 @@ -403,46 +416,6 @@ static bool patch_reloc(tcg_insn_unit *src_rw, int type, return false; } -/* parse target specific constraints */ -static const char *target_parse_constraint(TCGArgConstraint *ct, - const char *ct_str, TCGType type) -{ - switch (*ct_str++) { - case 'r': /* all registers */ - ct->regs = 0xffff; - break; - case 'L': /* qemu_ld/st constraint */ - ct->regs = 0xffff; - tcg_regset_reset_reg(ct->regs, TCG_REG_R2); - tcg_regset_reset_reg(ct->regs, TCG_REG_R3); - tcg_regset_reset_reg(ct->regs, TCG_REG_R4); - break; - case 'a': /* force R2 for division */ - ct->regs = 0; - tcg_regset_set_reg(ct->regs, TCG_REG_R2); - break; - case 'b': /* force R3 for division */ - ct->regs = 0; - tcg_regset_set_reg(ct->regs, TCG_REG_R3); - break; - case 'A': - ct->ct |= TCG_CT_CONST_S33; - break; - case 'I': - ct->ct |= TCG_CT_CONST_S16; - break; - case 'J': - ct->ct |= TCG_CT_CONST_S32; - break; - case 'Z': - ct->ct |= TCG_CT_CONST_ZERO; - break; - default: - return NULL; - } - return ct_str; -} - /* Test if a constant matches the constraint. */ static int tcg_target_const_match(tcg_target_long val, TCGType type, const TCGArgConstraint *arg_ct)