From patchwork Tue Dec 10 16:16:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848813 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416301wrn; Tue, 10 Dec 2024 08:20:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX3NAPyI3v1m6thKqN59tNf82WOnuVA/rVdw11m8eWNb9iyiIlDfvISSw6l0SIFr10EdIlGbQ==@linaro.org X-Google-Smtp-Source: AGHT+IHd3iao5Ch5Ig4ZJnKVG5AlEv49c+S5DU1NWqmieLwkA2uN6wfMOgNcZdw8xlwGBVq+/2gy X-Received: by 2002:ad4:5c49:0:b0:6d8:8f14:2f5c with SMTP id 6a1803df08f44-6d91e36fb15mr106419226d6.23.1733847605302; Tue, 10 Dec 2024 08:20:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847605; cv=none; d=google.com; s=arc-20240605; b=kn+xmyx1SjCU9ukUcC16EFXbihBDtOJ9lqhf5tgkxCcD/IS1DA+GwLrFtPa2JvzHfx tLQ2GZ5hrHfRHj/nzeUkGbGk3YjEjy6U5WLLgFgi9/qQJPXadsvJl37WHcAJu2ff8gPs RRlO88YxXx2eCn/eiU0Z7m7xTMKR3F6uV/gpLNcGpdQs4p6zha5YTx8LcS7CHVA1/0c8 cHMEQzJTw0nM6U5JyRT8uj1p6hIU6mOcgBwYGdwIy4nEH91h0px1dZZx5GUUTejsB+Zm xSB3tvudDb54kSx7wRSF61sLj5I9e91H50f5BGjFnuHKvqc0vuUS2oFjb4lFQsWXYYDo vI0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=4Io19/CScrA5Q2D7CSJ00bcM9NMayI0ImV9POYZmxx0=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=leFzeXtSeU4e8JNBKM+R+kBkeRzFqLQD98zowsfEdfLIvzCExeWDWNzj7xiOA9L0s9 XAdNKXwfZa/kmeJrUM3nCwp0Fry+aBBq1G2A8E4ADUbF8nll+F7GoxW269u8qSyF0HWz GGSu6Kk/QFZQNT5C+Smle80AfSbqQ7BIbws2fpaL2Zga30Wz3Nx5pV4ZGP1TeH1Gr7Ks TkeX9cF9NYv9pe/M61Xz8j/gIhLdjpsJL/6UwZkBMDWFkHE0cgO9ZCcOr/VoJctd9sjh 7WlvBpR13ZRqNbnVdkJutObErkpZaQvDTPAYttdR00F8Q1ysuq3XQQVzi1vYAEdgal6h mRYA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qcJ655o7; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6d4ab0f13si603073385a.7.2024.12.10.08.20.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20:05 -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=qcJ655o7; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2x7-0002vG-D5; Tue, 10 Dec 2024 11:19:19 -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 1tL2wg-0002ip-Oc for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:47 -0500 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2we-0006Pd-Up for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:46 -0500 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-54026562221so728493e87.1 for ; Tue, 10 Dec 2024 08:18:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847523; x=1734452323; 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=4Io19/CScrA5Q2D7CSJ00bcM9NMayI0ImV9POYZmxx0=; b=qcJ655o7q3Zb8YtLuzbz/FEhPFQ2nIFqs9jJVkZGOmGcewsXipnrVxliwZebKt+Cm8 5i1UNq9NckFDqxi5CfrNBHKp2lHy5bB/ScNdpxcOGwQNCyjQvecJVFFdN4TQilruEffV vM8YCVPUydpqODQf60H12lcdl++HelpULOBl3AmHuf+lsfZZOJqvl0wImxqP6OO3B5r5 0oMpKfXWJ/O1m0NrCRCVs8GKhGEMu0x/t/OnZiq2J331sYoG+S09Sebs+8kj3yVBeTvM +8eFvUKaYDarDm20PTyo8mCHYnAhzbEggfDSwrRGUzVARk9dSZtcbRAtZezIwGOXHAm6 zOBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847523; x=1734452323; 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=4Io19/CScrA5Q2D7CSJ00bcM9NMayI0ImV9POYZmxx0=; b=r+BNMTIwxFcWWoZsyWzYZrKrecJomJ6lT1TMA22zYJ45CMDaJ1J//jtEbM5RPSO0gu kU8aCPyPykjBdJ7+u10JY09qkoiNGag42VIm+R3Lyd3aKBJLMIitnnstUMShdu7d84fM yPK1/VxqqLVGVBFNKCRc1JNfHbIizYe/GfxUapgNaxNwSfctbyRXQJGV8bl+hBI8pCmB NoV+qoEdXe8LKT+RnDcI6gMvMSuH4g2QWkyCaz5N7er0GBlvyJu5CcCveSUwbM51ahXB 9tue0bQwtPbCCmzV7qYgdwnPLDuatL1wZUoxJq8wjMNJOu09eEM+R5q/lrDa0TmBcHNZ pCEw== X-Gm-Message-State: AOJu0YySPA4m+i46XQJ7sk1DnhLVqnvioMEscj2P5OF/U4Gjr2XNZiNa Tywys3EVKsQ6YKmp8DcEfehbg4k7bfcXoM3ZHKv49rfrVaPzAGz4gGxTd1dYn1PpiJjTj7LVSHV L8DSvEwEP X-Gm-Gg: ASbGncu6qNZCYbmJS58vWAgN73wXaCwrHd2ZKnC/kP2lrqSpf993LKCGG18AP6EOqZh 6RXzUe3UGxI3gWqXwOBqu+wxdLh2H+sNAtIZ/2FKHviRJhIVVhoZ+2LsesJcWklWtQuqoGO/WWX qwAobQADx9BL1r5OmVAUzFZPlW1wcZQUkKZyaKEmVnO+yKtS3pAUwXNu7pXYGiOyKFZ0TXV0Nuv fvjYAgwqXQtfkrLldPsIrikTqex4RurBQv/2RxGTgSDYSnVhkRwnqMdEDQ= X-Received: by 2002:a05:6512:ba6:b0:540:1c6e:f046 with SMTP id 2adb3069b0e04-54024107755mr1825392e87.36.1733847523210; Tue, 10 Dec 2024 08:18:43 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.18.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:18:42 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 15/69] target/arm: Convert disas_adc_sbc to decodetree Date: Tue, 10 Dec 2024 10:16:39 -0600 Message-ID: <20241210161733.1830573-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12f.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This includes ADC, SBC, ADCS, SBCS. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 43 +++++++++++++--------------------- target/arm/tcg/a64.decode | 6 +++++ 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 99ff787c61..d7747fcf57 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8017,42 +8017,34 @@ TRANS(SMSUBL, do_muladd, a, true, true, MO_SL) TRANS(UMADDL, do_muladd, a, true, false, MO_UL) TRANS(UMSUBL, do_muladd, a, true, true, MO_UL) -/* Add/subtract (with carry) - * 31 30 29 28 27 26 25 24 23 22 21 20 16 15 10 9 5 4 0 - * +--+--+--+------------------------+------+-------------+------+-----+ - * |sf|op| S| 1 1 0 1 0 0 0 0 | rm | 0 0 0 0 0 0 | Rn | Rd | - * +--+--+--+------------------------+------+-------------+------+-----+ - */ - -static void disas_adc_sbc(DisasContext *s, uint32_t insn) +static bool do_adc_sbc(DisasContext *s, arg_rrr_sf *a, + bool is_sub, bool setflags) { - unsigned int sf, op, setflags, rm, rn, rd; TCGv_i64 tcg_y, tcg_rn, tcg_rd; - sf = extract32(insn, 31, 1); - op = extract32(insn, 30, 1); - setflags = extract32(insn, 29, 1); - rm = extract32(insn, 16, 5); - rn = extract32(insn, 5, 5); - rd = extract32(insn, 0, 5); + tcg_rd = cpu_reg(s, a->rd); + tcg_rn = cpu_reg(s, a->rn); - tcg_rd = cpu_reg(s, rd); - tcg_rn = cpu_reg(s, rn); - - if (op) { + if (is_sub) { tcg_y = tcg_temp_new_i64(); - tcg_gen_not_i64(tcg_y, cpu_reg(s, rm)); + tcg_gen_not_i64(tcg_y, cpu_reg(s, a->rm)); } else { - tcg_y = cpu_reg(s, rm); + tcg_y = cpu_reg(s, a->rm); } if (setflags) { - gen_adc_CC(sf, tcg_rd, tcg_rn, tcg_y); + gen_adc_CC(a->sf, tcg_rd, tcg_rn, tcg_y); } else { - gen_adc(sf, tcg_rd, tcg_rn, tcg_y); + gen_adc(a->sf, tcg_rd, tcg_rn, tcg_y); } + return true; } +TRANS(ADC, do_adc_sbc, a, false, false) +TRANS(SBC, do_adc_sbc, a, true, false) +TRANS(ADCS, do_adc_sbc, a, false, true) +TRANS(SBCS, do_adc_sbc, a, true, true) + /* * Rotate right into flags * 31 30 29 21 15 10 5 4 0 @@ -8305,10 +8297,6 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) switch (op2) { case 0x0: switch (op3) { - case 0x00: /* Add/subtract (with carry) */ - disas_adc_sbc(s, insn); - break; - case 0x01: /* Rotate right into flags */ case 0x21: disas_rotate_right_into_flags(s, insn); @@ -8322,6 +8310,7 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) break; default: + case 0x00: /* Add/subtract (with carry) */ goto do_unallocated; } break; diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index b0cc8bd476..7a40ca455e 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -746,6 +746,12 @@ ADDS_ext . 01 01011001 ..... ... ... ..... ..... @addsub_ext SUBS_ext . 11 01011001 ..... ... ... ..... ..... @addsub_ext # Add/subtract (carry) + +ADC . 00 11010000 ..... 000000 ..... ..... @rrr_sf +ADCS . 01 11010000 ..... 000000 ..... ..... @rrr_sf +SBC . 10 11010000 ..... 000000 ..... ..... @rrr_sf +SBCS . 11 11010000 ..... 000000 ..... ..... @rrr_sf + # Rotate right into flags # Evaluate into flags # Conditional compare (regster)