From patchwork Sun Feb 4 21:40:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 769852 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp1842092wrc; Sun, 4 Feb 2024 13:42:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IEqneqbC0YdUziOnnVflUhD61pmmCmQhmrQp7QxRiH1o8seyl3OZgX4neWRPsv/IsQAEcAH X-Received: by 2002:a05:6808:17a2:b0:3be:abd3:cbaa with SMTP id bg34-20020a05680817a200b003beabd3cbaamr18715525oib.53.1707082931608; Sun, 04 Feb 2024 13:42:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707082931; cv=none; d=google.com; s=arc-20160816; b=eYHP2iUCzFNyaOnTlYPthuDeU0v+s+qvlqEqEqTJdrAjtkp5hwyaeEzNvUjhVolZ4B KVC9V7e77rGLKC+2Y0T4NPj3CPs/CEkdi9U+JHY4rOuCTvMfXMtetCgTspEvKJpcIDsF +2gLo89+FsTqy2o5kwOtux2FgbfIQG3OThSDDXg0f4tlTf1m2uskzmjW6Ku9rQf3NU/N KbagYwCBqtGqiT81YqTR911dZvXeg8zo45PBTDfJhCvNw9bLGZl+4Za18Da7JqDPdZof h5bhVfzc8vynQ+nZzufiLugWNyfDTvQEA+TursBflf8z1LW1i/NnAeKc+AzFH4JJ2E7x pvhA== 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=Ljp12UTJ8shSwK1Q4724Q6XhwFJKp2WnNNgAtGZJS18=; fh=+ClWV7DhA61JwOQAhfzOZN49B0dfi/ei/cDyhxagcxI=; b=HHO+XemSwLnzE2QCgm84HSj0hUg7/B4x4lZ/1U6IE2us5rYzyWqVNE3VjMBvnCSsiW YefSs2QNqF7oj/DK1jqvHWuAHpevcc1wxD0hZ6t51oXbaL0Tme3YCObgRGNbcjobtb4X 1lic/YMbBC80thSHlpNqr+CtaVhYsvxDceuCVs5l+d8wxCXsdtHeW2XNCYRUlp5x7uni MjY83V+4fLLZ7T3tuM+yqo8k4bEWGMN6ho3LW6/v+rIO/Bowc3K/7xQ1Okh62r22eqM2 MLMVaOz/avhNeuSnFfiE+mDPAW4HCmMVNHWaHnpXTDgkUsYd8AkP/924x8J/ZyszuCym 1fyA==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jqkNLjCL; 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 X-Forwarded-Encrypted: i=0; AJvYcCXl1m3X1U1Mszm6f5wicMiq70B0myL7Yguk3GOLpX2SY/i45kRnuYVLhAoEWOAIpJl6fzASZwLAdXcP2ZOoLVQ2 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p18-20020ac84612000000b0042c0509f5e9si5686543qtn.324.2024.02.04.13.42.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 04 Feb 2024 13:42:11 -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=jqkNLjCL; 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 1rWkFF-0002Uw-TY; Sun, 04 Feb 2024 16:41:45 -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 1rWkFD-0002IF-JF for qemu-devel@nongnu.org; Sun, 04 Feb 2024 16:41:43 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rWkFB-0003YJ-V8 for qemu-devel@nongnu.org; Sun, 04 Feb 2024 16:41:43 -0500 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1d73066880eso33260785ad.3 for ; Sun, 04 Feb 2024 13:41:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707082900; x=1707687700; 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=Ljp12UTJ8shSwK1Q4724Q6XhwFJKp2WnNNgAtGZJS18=; b=jqkNLjCLJ661EsfgrwuCu1PrfyqJjSx/W0b22Snc6Hqj2PNTyw6bBQ4T5u+f2KoWv6 O1qfqz9l9nZX/j1KBwHvSudipLzqEf08Ejx8KMT7CFwEwO5K6LpXWnjb50Keosz2gMjn LBHQ+yQIX1gJRoQcL4nFHqYQo1jCZGPdbgRQFIQ9yhMFfGGVGUat5ni4dBuJNGHKkHj4 GPMr27ffe87VYcmsdAkkVeVnxjPjvvp07pvqlLoVQxoJvndzJMhL3nwtgJostY01akiB /CMb/BKVrumLOC78v3nimRosyZ/m7GO/M0UQEUGMr4pIfqnBsQTR26bdOe9JfzKsnhYi /gSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707082900; x=1707687700; 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=Ljp12UTJ8shSwK1Q4724Q6XhwFJKp2WnNNgAtGZJS18=; b=dA8WnpptDwnn6HipEoI1l1yy7h0/jt6Azxs1Rm6Zyb2prsdKhvuagXAvVtqoGSu+9P mAqcYuUAIvu/2awWI3l0jo29Gu9+20ijHvcnwj+0/GgJEFIpyu2AxZwhDROPaA+LVvOK KIJdwjO+ujRz8Ax5usQLC6Dh1o2c703rnHX7obqRqJuRWazI5X9/i0NApDsdiCWMnlie GZNaXR/r7PSafXxAqYvOHeEF8b9iJSkKhz7J15emoFGr+EVD2NBmjZNJ1G/h22P5jGu8 yVlnsX81O1y1Fv2mZA2olXDtga8TzIB0sAlOrUXSOl7dfH4Ixugz61GfeSNqHQiUsbdG Pylg== X-Gm-Message-State: AOJu0YxdoPd/WFN+nya4KF/twMaNbBDKt2xTJwdll//UpAWdw0YluWqE INC9MgjKaxGWJJaPLQDH0gw2vI+bGxu6KvUUMlPbaqLrxkHsO01vljY+vMnaig1fSUs08vuccMl sG5c= X-Received: by 2002:a17:902:eb82:b0:1d9:8082:4573 with SMTP id q2-20020a170902eb8200b001d980824573mr9358736plg.2.1707082900696; Sun, 04 Feb 2024 13:41:40 -0800 (PST) Received: from stoup.. ([43.252.112.156]) by smtp.gmail.com with ESMTPSA id mf11-20020a170902fc8b00b001d8f5560503sm4953670plb.222.2024.02.04.13.41.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 13:41:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 21/39] tcg/arm: Split out tcg_out_cmp() Date: Mon, 5 Feb 2024 07:40:34 +1000 Message-Id: <20240204214052.5639-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240204214052.5639-1-richard.henderson@linaro.org> References: <20240204214052.5639-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20231028194522.245170-12-richard.henderson@linaro.org> [PMD: Split from bigger patch, part 1/2] Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20231108145244.72421-1-philmd@linaro.org> --- tcg/arm/tcg-target.c.inc | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 113094a5b2..4ea17845bb 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -1191,6 +1191,13 @@ static void tcg_out_mb(TCGContext *s, TCGArg a0) } } +static TCGCond tcg_out_cmp(TCGContext *s, TCGCond cond, TCGReg a, + TCGArg b, int b_const) +{ + tcg_out_dat_rIN(s, COND_AL, ARITH_CMP, ARITH_CMN, 0, a, b, b_const); + return cond; +} + static TCGCond tcg_out_cmp2(TCGContext *s, const TCGArg *args, const int *const_args) { @@ -1809,9 +1816,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, /* Constraints mean that v2 is always in the same register as dest, * so we only need to do "if condition passed, move v1 to dest". */ - tcg_out_dat_rIN(s, COND_AL, ARITH_CMP, ARITH_CMN, 0, - args[1], args[2], const_args[2]); - tcg_out_dat_rIK(s, tcg_cond_to_arm_cond[args[5]], ARITH_MOV, + c = tcg_out_cmp(s, args[5], args[1], args[2], const_args[2]); + tcg_out_dat_rIK(s, tcg_cond_to_arm_cond[c], ARITH_MOV, ARITH_MVN, args[0], 0, args[3], const_args[3]); break; case INDEX_op_add_i32: @@ -1961,25 +1967,21 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, break; case INDEX_op_brcond_i32: - tcg_out_dat_rIN(s, COND_AL, ARITH_CMP, ARITH_CMN, 0, - args[0], args[1], const_args[1]); - tcg_out_goto_label(s, tcg_cond_to_arm_cond[args[2]], - arg_label(args[3])); + c = tcg_out_cmp(s, args[2], args[0], args[1], const_args[1]); + tcg_out_goto_label(s, tcg_cond_to_arm_cond[c], arg_label(args[3])); break; case INDEX_op_setcond_i32: - tcg_out_dat_rIN(s, COND_AL, ARITH_CMP, ARITH_CMN, 0, - args[1], args[2], const_args[2]); - tcg_out_dat_imm(s, tcg_cond_to_arm_cond[args[3]], + c = tcg_out_cmp(s, args[3], args[1], args[2], const_args[2]); + tcg_out_dat_imm(s, tcg_cond_to_arm_cond[c], ARITH_MOV, args[0], 0, 1); - tcg_out_dat_imm(s, tcg_cond_to_arm_cond[tcg_invert_cond(args[3])], + tcg_out_dat_imm(s, tcg_cond_to_arm_cond[tcg_invert_cond(c)], ARITH_MOV, args[0], 0, 0); break; case INDEX_op_negsetcond_i32: - tcg_out_dat_rIN(s, COND_AL, ARITH_CMP, ARITH_CMN, 0, - args[1], args[2], const_args[2]); - tcg_out_dat_imm(s, tcg_cond_to_arm_cond[args[3]], + c = tcg_out_cmp(s, args[3], args[1], args[2], const_args[2]); + tcg_out_dat_imm(s, tcg_cond_to_arm_cond[c], ARITH_MVN, args[0], 0, 0); - tcg_out_dat_imm(s, tcg_cond_to_arm_cond[tcg_invert_cond(args[3])], + tcg_out_dat_imm(s, tcg_cond_to_arm_cond[tcg_invert_cond(c)], ARITH_MOV, args[0], 0, 0); break;