From patchwork Tue May 16 19:40:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 682370 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:558:b0:22d:db33:bb6d with SMTP id w24csp639639ltp; Tue, 16 May 2023 12:45:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5SBMuBeOzomKZebYS6tlpjOMang8f42WanrRWgGYGOXXkRGaXLcL7Ig/pTzyKTecmka8KJ X-Received: by 2002:a05:622a:118f:b0:3f4:c9b:24ca with SMTP id m15-20020a05622a118f00b003f40c9b24camr40314436qtk.53.1684266304663; Tue, 16 May 2023 12:45:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684266304; cv=none; d=google.com; s=arc-20160816; b=k91VG4nrkOymM7qErPtuc2dRarWh7rIdi+NrN7WI8DNd5mmVZwqKhNuOeKEyQ/C1+Y CamUdA1ZVG2IpmacXLqCq8sP9hfs0mXLiKd4+C8dpwtY0XdePnWdAeily1ZzG4inDgQc ahIPSFkLqwb71Np0uq/gMBcj4wlltUBfVFjEZ7R34n3sV4ueYpGpWv0m9wsa7s0i1npK hmMpXeBBOmfnmccCKpkcBabzfeCbuGPiKgrLuePdJUx/Bwo12P5xAtMjH2iZYdTrPY5o d4cPJ2DNRdXMJomZMJEDhXRNZydLQs5s4WPgaaIPmHGCsBfNtfOXCFehWfMTY5AD5lrn 7XEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=JU4vdDs/6qpsKlmOEFRbKkCiPMY/9YXw9xFKAMp8gMg=; b=MZwIVQQPk+FXFG7MBQvsGZapXb0+zpWhPKvU35QuwtGeQR2fI+zFBQpLUtnhyjDg2c /VYgnP0sJ44ghYjNlQ9yNehlOvWN4w5lDTxDZX4kNNNZQ9lla5spqNLWIPr31y74cYwi Tb+V5Fv8ivKEppMbgoygJdOUZOS+MF+F22gi9+BtMsxfIJpL46Xo4dlMRBHrPFmsmfcD qaWD1K8288FTUXP15ELt1a9ld5Km9Ww+CYhvHwuyl8PUPdm+C6+pI3TU9AUqW/sdM9KJ A3E9/nRqMbspF4Ca5bP4jn+/PNOoClsOvcaxuOmxlJXU4mJlOmNbPVgicxLGs28bCSt+ y+Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fhACcL9M; 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 s4-20020a05620a16a400b0075789213edesi216070qkj.384.2023.05.16.12.45.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 May 2023 12:45:04 -0700 (PDT) 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=fhACcL9M; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pz0Yj-0006hg-8M; Tue, 16 May 2023 15:42:09 -0400 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 1pz0Yg-0006gJ-Ey for qemu-devel@nongnu.org; Tue, 16 May 2023 15:42:06 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pz0Ye-0002pV-Oa for qemu-devel@nongnu.org; Tue, 16 May 2023 15:42:06 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-52867360efcso10426275a12.2 for ; Tue, 16 May 2023 12:42:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684266123; x=1686858123; 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=JU4vdDs/6qpsKlmOEFRbKkCiPMY/9YXw9xFKAMp8gMg=; b=fhACcL9MpK0F5hlkhWB9aQBYdkFEEQuq+jknL40Xx/Jbacn3+lmeSW0o89rkL73WJF zX18DIc8feyZLxdEb+aj5kgbgweFbNxjWE+A7RVYd+3gX8B6dAHPlIbOx60+08UGPVCk q8DEg65wfw7CTNNR3yxLzxV9obHdqbe2FrOgBQ425CNqDwTqZRncvwc/TuNPtDH6SpLX kHUh4w6tnUBJHbU3ttwFWLEhzfj1f2mEJ7qpXPm3ARVtLmr/BCflF/et/azvNCi3EZ9d nUtZGC7r41xnSp4AyovHUvgMmh57HK2viBarBOdmLuLJn1IQjSPICR/rtES0Q1/IDLiz tPKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684266123; x=1686858123; 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=JU4vdDs/6qpsKlmOEFRbKkCiPMY/9YXw9xFKAMp8gMg=; b=GnVmmmArx4A+1qGkOjc/HVbO7/2PyD62J+Lssk9WtVh3UUWmzT4CL/6TshORgBNKxN 0AJYJvbyAqYRD/bLFoZDvaWy7Y8JWtwieTbjhy/oxmlnjqyfyTG2/B2YC4k1qoLthZWZ Aab9+DkxGaQccA+c9slkvtPzFSBExrW7BWm4fr/3fMbz8x5qBxxsJY24e+gwxAH5VyU3 ajP5OW3sgkjdOOxdJPR6lROJbc3fEedTnbS3DcKVVBXyb8xNzID3kd6UmijRHTAZyG6Z YPDZOCll1qle3Wp3etc1SwjfvZr5OaGGiwQ4ZWe3NIADYJdYFLneJsR1ANYjHJKVFDOr adBA== X-Gm-Message-State: AC+VfDynVC3xPswtG7tiTRzI9FQvN8X8MY7aMZASxuLLF7J9tGGL12cN mBo1PjMQvL+wgy+XRhelURDb6CNiav/cH3AHgeY= X-Received: by 2002:a05:6a20:4299:b0:100:bda9:4b39 with SMTP id o25-20020a056a20429900b00100bda94b39mr38837991pzj.34.1684266123356; Tue, 16 May 2023 12:42:03 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:ec81:440e:33a4:40b9]) by smtp.gmail.com with ESMTPSA id z21-20020aa791d5000000b006260526cf0csm13771165pfa.116.2023.05.16.12.42.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 12:42:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 18/80] tcg/arm: Adjust constraints on qemu_ld/st Date: Tue, 16 May 2023 12:40:43 -0700 Message-Id: <20230516194145.1749305-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230516194145.1749305-1-richard.henderson@linaro.org> References: <20230516194145.1749305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Always reserve r3 for tlb softmmu lookup. Fix a bug in user-only ALL_QLDST_REGS, in that r14 is clobbered by the BLNE that leads to the misaligned trap. Remove r0+r1 from user-only ALL_QLDST_REGS; I believe these had been reserved for bswap, which we no longer perform during qemu_st. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/arm/tcg-target-con-set.h | 16 ++++++++-------- tcg/arm/tcg-target-con-str.h | 5 ++--- tcg/arm/tcg-target.c.inc | 23 ++++++++--------------- 3 files changed, 18 insertions(+), 26 deletions(-) diff --git a/tcg/arm/tcg-target-con-set.h b/tcg/arm/tcg-target-con-set.h index b8849b2478..229ae258ac 100644 --- a/tcg/arm/tcg-target-con-set.h +++ b/tcg/arm/tcg-target-con-set.h @@ -12,19 +12,19 @@ C_O0_I1(r) C_O0_I2(r, r) C_O0_I2(r, rIN) -C_O0_I2(s, s) +C_O0_I2(q, q) C_O0_I2(w, r) -C_O0_I3(s, s, s) -C_O0_I3(S, p, s) +C_O0_I3(q, q, q) +C_O0_I3(Q, p, q) C_O0_I4(r, r, rI, rI) -C_O0_I4(S, p, s, s) -C_O1_I1(r, l) +C_O0_I4(Q, p, q, q) +C_O1_I1(r, q) C_O1_I1(r, r) C_O1_I1(w, r) C_O1_I1(w, w) C_O1_I1(w, wr) C_O1_I2(r, 0, rZ) -C_O1_I2(r, l, l) +C_O1_I2(r, q, q) C_O1_I2(r, r, r) C_O1_I2(r, r, rI) C_O1_I2(r, r, rIK) @@ -39,8 +39,8 @@ C_O1_I2(w, w, wZ) C_O1_I3(w, w, w, w) C_O1_I4(r, r, r, rI, rI) C_O1_I4(r, r, rIN, rIK, 0) -C_O2_I1(e, p, l) -C_O2_I2(e, p, l, l) +C_O2_I1(e, p, q) +C_O2_I2(e, p, q, q) C_O2_I2(r, r, r, r) C_O2_I4(r, r, r, r, rIN, rIK) C_O2_I4(r, r, rI, rI, rIN, rIK) diff --git a/tcg/arm/tcg-target-con-str.h b/tcg/arm/tcg-target-con-str.h index 24b4b59feb..f83f1d3919 100644 --- a/tcg/arm/tcg-target-con-str.h +++ b/tcg/arm/tcg-target-con-str.h @@ -10,9 +10,8 @@ */ REGS('e', ALL_GENERAL_REGS & 0x5555) /* even regs */ REGS('r', ALL_GENERAL_REGS) -REGS('l', ALL_QLOAD_REGS) -REGS('s', ALL_QSTORE_REGS) -REGS('S', ALL_QSTORE_REGS & 0x5555) /* even qstore */ +REGS('q', ALL_QLDST_REGS) +REGS('Q', ALL_QLDST_REGS & 0x5555) /* even qldst */ REGS('w', ALL_VECTOR_REGS) /* diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 8b0d526659..a02804dd69 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -353,23 +353,16 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type, #define ALL_VECTOR_REGS 0xffff0000u /* - * r0-r2 will be overwritten when reading the tlb entry (softmmu only) - * and r0-r1 doing the byte swapping, so don't use these. - * r3 is removed for softmmu to avoid clashes with helper arguments. + * r0-r3 will be overwritten when reading the tlb entry (softmmu only); + * r14 will be overwritten by the BLNE branching to the slow path. */ #ifdef CONFIG_SOFTMMU -#define ALL_QLOAD_REGS \ +#define ALL_QLDST_REGS \ (ALL_GENERAL_REGS & ~((1 << TCG_REG_R0) | (1 << TCG_REG_R1) | \ (1 << TCG_REG_R2) | (1 << TCG_REG_R3) | \ (1 << TCG_REG_R14))) -#define ALL_QSTORE_REGS \ - (ALL_GENERAL_REGS & ~((1 << TCG_REG_R0) | (1 << TCG_REG_R1) | \ - (1 << TCG_REG_R2) | (1 << TCG_REG_R14) | \ - ((TARGET_LONG_BITS == 64) << TCG_REG_R3))) #else -#define ALL_QLOAD_REGS ALL_GENERAL_REGS -#define ALL_QSTORE_REGS \ - (ALL_GENERAL_REGS & ~((1 << TCG_REG_R0) | (1 << TCG_REG_R1))) +#define ALL_QLDST_REGS (ALL_GENERAL_REGS & ~(1 << TCG_REG_R14)) #endif /* @@ -2203,13 +2196,13 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) return C_O1_I4(r, r, r, rI, rI); case INDEX_op_qemu_ld_i32: - return TARGET_LONG_BITS == 32 ? C_O1_I1(r, l) : C_O1_I2(r, l, l); + return TARGET_LONG_BITS == 32 ? C_O1_I1(r, q) : C_O1_I2(r, q, q); case INDEX_op_qemu_ld_i64: - return TARGET_LONG_BITS == 32 ? C_O2_I1(e, p, l) : C_O2_I2(e, p, l, l); + return TARGET_LONG_BITS == 32 ? C_O2_I1(e, p, q) : C_O2_I2(e, p, q, q); case INDEX_op_qemu_st_i32: - return TARGET_LONG_BITS == 32 ? C_O0_I2(s, s) : C_O0_I3(s, s, s); + return TARGET_LONG_BITS == 32 ? C_O0_I2(q, q) : C_O0_I3(q, q, q); case INDEX_op_qemu_st_i64: - return TARGET_LONG_BITS == 32 ? C_O0_I3(S, p, s) : C_O0_I4(S, p, s, s); + return TARGET_LONG_BITS == 32 ? C_O0_I3(Q, p, q) : C_O0_I4(Q, p, q, q); case INDEX_op_st_vec: return C_O0_I2(w, r);