From patchwork Wed Jan 10 21:52:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 761463 Delivered-To: patch@linaro.org Received: by 2002:a5d:6e02:0:b0:337:62d3:c6d5 with SMTP id h2csp2094464wrz; Wed, 10 Jan 2024 13:53:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEx8eimEytkNWaZ/NIJ+C8vxplVe+nU/goo57KYwhY2cgTEwVeEBtMve6MrpU3PRNplKEN5 X-Received: by 2002:a05:620a:45a4:b0:783:561:b939 with SMTP id bp36-20020a05620a45a400b007830561b939mr365248qkb.27.1704923616235; Wed, 10 Jan 2024 13:53:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704923616; cv=none; d=google.com; s=arc-20160816; b=lhWab/qeps9pVQ+1VWY5xdf0uuz7gIoTX6cZ/eiszZeBvCL0zQSAJ5Rkw+C9JM4qwB nn8bFdojOVvWLZw7pZZLTn9UfoybeeIUt8OsNhO22gQbmLasVcZ5zOdP33gO7u0dNRAW FPRq6xYGSQYgnwW+YZSlt5dQM6PG8tf1cttaUIzLEKP/eawxIEHYJbNRYB+Ep4KYbfPn OCd5zXVZX4O8DVjtkvTFWJNEAqy/36YGw15KTow2D0j5F71SVb77IBbadmHSdvD01gvB BlXpO41NIBwftVw26I7Y3l4r09tUjgzYNBhTv8Vh37Wkc9569fhQ0e4tHXCD2YAcSMxi 1UnA== 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=HwFKj5Pn5DjJGhI9eC5OFFV9tA3PvMraO52aS5I9wUY=; fh=aYwv1qvAWDHKcZLZyhvLuIoAkBRd6ysYy/Itgr1WhFg=; b=N5YHtm9TeeT1Op9J6BETmMNRNQd/ac/X4N8atVl3Jkwlw8qNTqZckKCWv+NYzJQ/13 /QezFMk3VLucRubX9ox0DysHr34qd0MaEB8aq4zHFTGv3oA6y90yPJJ4BD87eurhVCcm GydhSZL29DST3W9z5GD5cIzx5eRpv+6gPtpcZULGBnmZ0IkA5da2ixSufFgrL0xwuqSa 1WmYy3JhtJxPyoxNwHMpBMsMERd1pBSxRYyXfmjs3YYGpj7tpMQnicL1gXluD2jtCJiC ehXjn4BTStimhRfdpA9OIfKZ8MWbL07UCTW0UHEa4+pZS1DoegxpZS9tT7F1/XdlarWx csgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rridXl3+; 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 t5-20020a05620a450500b0078160dc34cfsi5214506qkp.20.2024.01.10.13.53.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jan 2024 13:53:36 -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=rridXl3+; 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 1rNgV5-0003fV-N5; Wed, 10 Jan 2024 16:52: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 1rNgUt-0003bA-Jd for qemu-devel@nongnu.org; Wed, 10 Jan 2024 16:52:27 -0500 Received: from mail-qk1-x734.google.com ([2607:f8b0:4864:20::734]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNgUp-0005iT-KH for qemu-devel@nongnu.org; Wed, 10 Jan 2024 16:52:25 -0500 Received: by mail-qk1-x734.google.com with SMTP id af79cd13be357-7833c5d5c77so28888785a.3 for ; Wed, 10 Jan 2024 13:52:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704923543; x=1705528343; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HwFKj5Pn5DjJGhI9eC5OFFV9tA3PvMraO52aS5I9wUY=; b=rridXl3+jdqbF7VGMLtTvQ0Yonrw6h4zHrKsfStlGzXFX6sEwUTCAfQgE9tzC1L3zR O6KqHRBVmJhBUJu8Stu5ijr+ZNz8iX3+SpnCFWq4Wa4eeY+SD0GAPIuqsGQMda0ZtoSA HzJGmi65fSLsid8JG60XuFZlBBug4qrGjXkicsWcEbTlxVY9W7rfkjzD6uzHaibOVBUe Iat3Cv/G+Ns1dP997/ieLu8h11puMVU0qrFLT0QJd9cVbUg1rUWxyKlcSjnIHQoZE3cg mgGYlhWqsxhIh37L+vJDq6e5UikkHrWvP8rgCFfjstDTuKuC77FhiSRCRonHmW8VMi40 HxUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704923543; x=1705528343; 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=HwFKj5Pn5DjJGhI9eC5OFFV9tA3PvMraO52aS5I9wUY=; b=RgFo+qekcviHHeyhGD0GHO0e6rmxC5I+SJHzSqybKbH7Z2EhGzZuAP835lZdCoSRkY ultOkPQJO0qlmWLZ81HtgZf1Y0DTwvI2SSnUo1QsCsz6Zj0mD+K3ImJ0ExPSlpVn0pBR mA6VPBqBWyzbeWvR0p8BPRGzBRSxAGCUi2IHiPVN82E79wfp5lDwcOGz7J2UpXMFUCV8 Yu/Dei+zx4YoJjZbIFsvbdSgq38dn6s406A2fL8oH8h3qc/P4nutNmMWlJ8c3B2fLVWI WcaIjbp6wC7MUpRKxIliXk/v97mQ4nsmTTcNRt1ghKGy2UR/dyZmMsqplHf3PkQWICSn pk1A== X-Gm-Message-State: AOJu0YwPFDksURV+Oxiqm3IlYZ90wxM1CeCPyRPiXpJ0XE3aIfauf+aZ 33+05fVPv2lQfPg108ZcFWgbqEKFiZzxPHi2K03VDY9DrW5RhPYJ X-Received: by 2002:a05:620a:3914:b0:783:2a6a:7b82 with SMTP id qr20-20020a05620a391400b007832a6a7b82mr388836qkn.98.1704923542755; Wed, 10 Jan 2024 13:52:22 -0800 (PST) Received: from stoup.. ([172.58.27.160]) by smtp.gmail.com with ESMTPSA id z8-20020ae9c108000000b0078313c87609sm1888387qki.100.2024.01.10.13.52.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 13:52:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 3/4] tcg/ppc: Use new registers for LQ destination Date: Thu, 11 Jan 2024 08:52:03 +1100 Message-Id: <20240110215204.9353-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110215204.9353-1-richard.henderson@linaro.org> References: <20240110215204.9353-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::734; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x734.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 LQ has a constraint that RTp != RA, else SIGILL. Therefore, force the destination of INDEX_op_qemu_*_ld128 to be a new register pair, so that it cannot overlap the input address. This requires new support in process_op_defs and tcg_reg_alloc_op. Cc: qemu-stable@nongnu.org Fixes: 526cd4ec01f ("tcg/ppc: Support 128-bit load/store") Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20240102013456.131846-1-richard.henderson@linaro.org> Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target-con-set.h | 2 +- tcg/tcg.c | 21 ++++++++++++++++----- tcg/ppc/tcg-target.c.inc | 3 ++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tcg/ppc/tcg-target-con-set.h b/tcg/ppc/tcg-target-con-set.h index bbd7b21247..cb47b29452 100644 --- a/tcg/ppc/tcg-target-con-set.h +++ b/tcg/ppc/tcg-target-con-set.h @@ -35,7 +35,7 @@ C_O1_I3(v, v, v, v) C_O1_I4(r, r, ri, rZ, rZ) C_O1_I4(r, r, r, ri, ri) C_O2_I1(r, r, r) -C_O2_I1(o, m, r) +C_N1O1_I1(o, m, r) C_O2_I2(r, r, r, r) C_O2_I4(r, r, rI, rZM, r, r) C_O2_I4(r, r, r, r, rI, rZM) diff --git a/tcg/tcg.c b/tcg/tcg.c index 896a36caeb..e2c38f6d11 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -653,6 +653,7 @@ static void tcg_out_movext3(TCGContext *s, const TCGMovExtend *i1, #define C_O1_I4(O1, I1, I2, I3, I4) C_PFX5(c_o1_i4_, O1, I1, I2, I3, I4), #define C_N1_I2(O1, I1, I2) C_PFX3(c_n1_i2_, O1, I1, I2), +#define C_N1O1_I1(O1, O2, I1) C_PFX3(c_n1o1_i1_, O1, O2, I1), #define C_N2_I1(O1, O2, I1) C_PFX3(c_n2_i1_, O1, O2, I1), #define C_O2_I1(O1, O2, I1) C_PFX3(c_o2_i1_, O1, O2, I1), @@ -676,6 +677,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode); #undef C_O1_I3 #undef C_O1_I4 #undef C_N1_I2 +#undef C_N1O1_I1 #undef C_N2_I1 #undef C_O2_I1 #undef C_O2_I2 @@ -696,6 +698,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode); #define C_O1_I4(O1, I1, I2, I3, I4) { .args_ct_str = { #O1, #I1, #I2, #I3, #I4 } }, #define C_N1_I2(O1, I1, I2) { .args_ct_str = { "&" #O1, #I1, #I2 } }, +#define C_N1O1_I1(O1, O2, I1) { .args_ct_str = { "&" #O1, #O2, #I1 } }, #define C_N2_I1(O1, O2, I1) { .args_ct_str = { "&" #O1, "&" #O2, #I1 } }, #define C_O2_I1(O1, O2, I1) { .args_ct_str = { #O1, #O2, #I1 } }, @@ -718,6 +721,7 @@ static const TCGTargetOpDef constraint_sets[] = { #undef C_O1_I3 #undef C_O1_I4 #undef C_N1_I2 +#undef C_N1O1_I1 #undef C_N2_I1 #undef C_O2_I1 #undef C_O2_I2 @@ -738,6 +742,7 @@ static const TCGTargetOpDef constraint_sets[] = { #define C_O1_I4(O1, I1, I2, I3, I4) C_PFX5(c_o1_i4_, O1, I1, I2, I3, I4) #define C_N1_I2(O1, I1, I2) C_PFX3(c_n1_i2_, O1, I1, I2) +#define C_N1O1_I1(O1, O2, I1) C_PFX3(c_n1o1_i1_, O1, O2, I1) #define C_N2_I1(O1, O2, I1) C_PFX3(c_n2_i1_, O1, O2, I1) #define C_O2_I1(O1, O2, I1) C_PFX3(c_o2_i1_, O1, O2, I1) @@ -2988,6 +2993,7 @@ static void process_op_defs(TCGContext *s) .pair = 2, .pair_index = o, .regs = def->args_ct[o].regs << 1, + .newreg = def->args_ct[o].newreg, }; def->args_ct[o].pair = 1; def->args_ct[o].pair_index = i; @@ -3004,6 +3010,7 @@ static void process_op_defs(TCGContext *s) .pair = 1, .pair_index = o, .regs = def->args_ct[o].regs >> 1, + .newreg = def->args_ct[o].newreg, }; def->args_ct[o].pair = 2; def->args_ct[o].pair_index = i; @@ -5036,17 +5043,21 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) break; case 1: /* first of pair */ - tcg_debug_assert(!arg_ct->newreg); if (arg_ct->oalias) { reg = new_args[arg_ct->alias_index]; - break; + } else if (arg_ct->newreg) { + reg = tcg_reg_alloc_pair(s, arg_ct->regs, + i_allocated_regs | o_allocated_regs, + output_pref(op, k), + ts->indirect_base); + } else { + reg = tcg_reg_alloc_pair(s, arg_ct->regs, o_allocated_regs, + output_pref(op, k), + ts->indirect_base); } - reg = tcg_reg_alloc_pair(s, arg_ct->regs, o_allocated_regs, - output_pref(op, k), ts->indirect_base); break; case 2: /* second of pair */ - tcg_debug_assert(!arg_ct->newreg); if (arg_ct->oalias) { reg = new_args[arg_ct->alias_index]; } else { diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 856c3b18f5..54816967bc 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2595,6 +2595,7 @@ static void tcg_out_qemu_ldst_i128(TCGContext *s, TCGReg datalo, TCGReg datahi, tcg_debug_assert(!need_bswap); tcg_debug_assert(datalo & 1); tcg_debug_assert(datahi == datalo - 1); + tcg_debug_assert(!is_ld || datahi != index); insn = is_ld ? LQ : STQ; tcg_out32(s, insn | TAI(datahi, index, 0)); } else { @@ -4071,7 +4072,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_qemu_ld_a32_i128: case INDEX_op_qemu_ld_a64_i128: - return C_O2_I1(o, m, r); + return C_N1O1_I1(o, m, r); case INDEX_op_qemu_st_a32_i128: case INDEX_op_qemu_st_a64_i128: return C_O0_I3(o, m, r);