From patchwork Tue Nov 7 02:48:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741745 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1414639wrr; Mon, 6 Nov 2023 18:50:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHokQJ8sGyvHqvHcslBTVIOAuzrCrnajEZdBtouL3LxmXmp7zJmniXfYuWA6+qqEEEh69ox X-Received: by 2002:a05:620a:4551:b0:777:5e79:d280 with SMTP id u17-20020a05620a455100b007775e79d280mr37098075qkp.53.1699325412783; Mon, 06 Nov 2023 18:50:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325412; cv=none; d=google.com; s=arc-20160816; b=GKbaUiUoLQlNY6lOMYkZcNVMwzyjxKScyevMgcRwxTC8QCOd7NsIgrRoaZQPCDMEhc ls4+3w4S9BUQ8iiIqjyYGhjW3+GCgdeYxoWZScnMTf86BtqL3jclzGo5Dc8Lv6KQv1oQ YcLx+p0UicUUyZadP2Mn8IV4oUt4Oc9VzTho8yLeSJbyI9ysSvjgSqGrJgaGtP/XnHzX bcFzLjYdgYVvmBqsmFihEMA03t/9vwVlRLazBakCAroWtn8G0iHqkp1FVXZbJwW+JSZG Z1VkWLDi8Nynnaf5nBbPfBQ2/XCpWgSLbncjt9KMhh9V3EVr1+RfAoGiunXgN+9xdZ6h kFgQ== 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=VvBDHrmhZ2gWPxiw2CPfGdlSoZnVJ/U4klH681+zZMk=; fh=KEPLpLQVO77v+WBSDPeXmXKEnOIOhNHYNw7geHkyLGA=; b=a/wmGdPL4pN0dSooXo2qlq12ZZRf5FwRCT9rP2Jsi5MBGNnfiPYOuWwo4d9Mz5gJmO zZP2MTzMFde8JrQeMHBRTB+uX2BHj9rFo9mrgCWvrporAV6funENRSi5lI0Uhn9Binos 1Tf8GV0UHCqi2kuVac0iwSYRh7CEKJPdnu6CC4I6yb2s6h+hoy9I1t1Sst/+2obor1oD W2tdWgR73ZllwH4MM42yMiK5f9pH55DmP85gfVgGuQz12LlYna6dgZzLOJPWAYknGjaW q8ckbWPsQl2hZc6SdN/Nf7xO7ptkILf7g7hZk+aMqPi257fNSWXfQRlov1fS6TSpVG8y rQ7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lduvxcec; 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 i5-20020a05620a248500b00779da0028c8si6583919qkn.611.2023.11.06.18.50.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:50:12 -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=Lduvxcec; 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 1r0C94-0008A3-4g; Mon, 06 Nov 2023 21:48:50 -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 1r0C92-00089D-Ju for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:48 -0500 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C90-0005pO-7r for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:48 -0500 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6b20a48522fso4421552b3a.1 for ; Mon, 06 Nov 2023 18:48:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325325; x=1699930125; 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=VvBDHrmhZ2gWPxiw2CPfGdlSoZnVJ/U4klH681+zZMk=; b=Lduvxceca8tsLU4a167AXsxo0unlKjM3FPByvIH6osigxEtC8Z0LPWQsRej3AbYFCv nkBe2osLE7pBq6QhjXl1sEWoR0Pp5vtUrxWz4vtuC3SkqOpUwcqauNtrf4sS1BoKk4Q1 QHRfqIrfz7Xt8oClOGQuqkPcCSlpRc/bBT34vPOwL/Yls1wTk8ZgrY2QqP28lThTW/X6 tqkVIgnEWmnlmuuuJ9hWlarjygobMU/t9k9Bfu0VA6o3U0mzVOPGk51nnUooOcLIVCsJ NjDffrZVz2NsvPjz3OE07XM6hSeN1fGTEyslLV6MYeEnwwTDf9vS9VSZggonFDtL1Wyo dNAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325325; x=1699930125; 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=VvBDHrmhZ2gWPxiw2CPfGdlSoZnVJ/U4klH681+zZMk=; b=rLkJYHgHWReq8Mxdad/c5aslB4HlTNuy7JRcm5EdHW7Y5aEtUceKjZuaLrhZ5xD/+p 4Wbezb9EjKeOA5z3OtxwVARZtgY026nb3ZEPKGFDIQuFTkCVOWDh7kg2d96UngrDxaLs 35da/BMBUQOOjY6/p2K7HYrkfKqhlgAEPtrgW/wP0RTPX+WritSOMguCae44Jlus/wKU TT3zRulb3XgFz2Caa9FeUchr3r7hPcf0ZYEF8TQLUzRzfblVSd3w98VByUl6Gpsi58Tc DfnwZK5eanJuIxxb4wRciIxi8mxlcLuhAK9X3Zlv97/GtvFNRMxRW4AKsXB1vTl1FqnG kaMg== X-Gm-Message-State: AOJu0YwSSSh5wEEZ04xgVICeSjm5Pyo3LJE7QfApcWKWE3Ik2MZRGv7z YC10X2s/gij8CxVXYnBKA0Lejw5h+8b7homIhCU= X-Received: by 2002:a05:6a00:98b:b0:68f:c865:5ba8 with SMTP id u11-20020a056a00098b00b0068fc8655ba8mr31650989pfg.18.1699325324840; Mon, 06 Nov 2023 18:48:44 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:44 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?A?= =?utf-8?q?lex_Benn=C3=A9e?= Subject: [PATCH 01/35] accel/tcg: Move HMP info jit and info opcount code Date: Mon, 6 Nov 2023 18:48:08 -0800 Message-Id: <20231107024842.7650-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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 Move all of it into accel/tcg/monitor.c. This puts everything about tcg that is only used by the monitor in the same place. Tested-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- accel/tcg/internal-common.h | 2 - include/exec/cputlb.h | 1 - include/tcg/tcg.h | 3 - accel/tcg/cputlb.c | 15 ---- accel/tcg/monitor.c | 154 ++++++++++++++++++++++++++++++++++++ accel/tcg/translate-all.c | 127 ----------------------------- tcg/tcg.c | 10 --- 7 files changed, 154 insertions(+), 158 deletions(-) diff --git a/accel/tcg/internal-common.h b/accel/tcg/internal-common.h index 3b2277e6e9..edefd0dcb7 100644 --- a/accel/tcg/internal-common.h +++ b/accel/tcg/internal-common.h @@ -14,8 +14,6 @@ extern int64_t max_delay; extern int64_t max_advance; -void dump_exec_info(GString *buf); - /* * Return true if CS is not running in parallel with other cpus, either * because there are no other cpus or we are within an exclusive context. diff --git a/include/exec/cputlb.h b/include/exec/cputlb.h index 19b16e58f8..6da1462c4f 100644 --- a/include/exec/cputlb.h +++ b/include/exec/cputlb.h @@ -26,6 +26,5 @@ /* cputlb.c */ void tlb_protect_code(ram_addr_t ram_addr); void tlb_unprotect_code(ram_addr_t ram_addr); -void tlb_flush_counts(size_t *full, size_t *part, size_t *elide); #endif #endif diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index a9282cdcc6..3a4c0f124f 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -846,9 +846,6 @@ static inline TCGv_ptr tcg_temp_new_ptr(void) return temp_tcgv_ptr(t); } -void tcg_dump_info(GString *buf); -void tcg_dump_op_count(GString *buf); - #define TCG_CT_CONST 1 /* any constant of register size */ typedef struct TCGArgConstraint { diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index b8c5e345b8..13986820fe 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -321,21 +321,6 @@ static void flush_all_helper(CPUState *src, run_on_cpu_func fn, } } -void tlb_flush_counts(size_t *pfull, size_t *ppart, size_t *pelide) -{ - CPUState *cpu; - size_t full = 0, part = 0, elide = 0; - - CPU_FOREACH(cpu) { - full += qatomic_read(&cpu->neg.tlb.c.full_flush_count); - part += qatomic_read(&cpu->neg.tlb.c.part_flush_count); - elide += qatomic_read(&cpu->neg.tlb.c.elide_flush_count); - } - *pfull = full; - *ppart = part; - *pelide = elide; -} - static void tlb_flush_by_mmuidx_async_work(CPUState *cpu, run_on_cpu_data data) { uint16_t asked = data.host_int; diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c index caf1189e0b..093efe9714 100644 --- a/accel/tcg/monitor.c +++ b/accel/tcg/monitor.c @@ -8,6 +8,7 @@ #include "qemu/osdep.h" #include "qemu/accel.h" +#include "qemu/qht.h" #include "qapi/error.h" #include "qapi/type-helpers.h" #include "qapi/qapi-commands-machine.h" @@ -17,6 +18,7 @@ #include "sysemu/tcg.h" #include "tcg/tcg.h" #include "internal-common.h" +#include "tb-context.h" static void dump_drift_info(GString *buf) @@ -50,6 +52,153 @@ static void dump_accel_info(GString *buf) one_insn_per_tb ? "on" : "off"); } +static void print_qht_statistics(struct qht_stats hst, GString *buf) +{ + uint32_t hgram_opts; + size_t hgram_bins; + char *hgram; + + if (!hst.head_buckets) { + return; + } + g_string_append_printf(buf, "TB hash buckets %zu/%zu " + "(%0.2f%% head buckets used)\n", + hst.used_head_buckets, hst.head_buckets, + (double)hst.used_head_buckets / + hst.head_buckets * 100); + + hgram_opts = QDIST_PR_BORDER | QDIST_PR_LABELS; + hgram_opts |= QDIST_PR_100X | QDIST_PR_PERCENT; + if (qdist_xmax(&hst.occupancy) - qdist_xmin(&hst.occupancy) == 1) { + hgram_opts |= QDIST_PR_NODECIMAL; + } + hgram = qdist_pr(&hst.occupancy, 10, hgram_opts); + g_string_append_printf(buf, "TB hash occupancy %0.2f%% avg chain occ. " + "Histogram: %s\n", + qdist_avg(&hst.occupancy) * 100, hgram); + g_free(hgram); + + hgram_opts = QDIST_PR_BORDER | QDIST_PR_LABELS; + hgram_bins = qdist_xmax(&hst.chain) - qdist_xmin(&hst.chain); + if (hgram_bins > 10) { + hgram_bins = 10; + } else { + hgram_bins = 0; + hgram_opts |= QDIST_PR_NODECIMAL | QDIST_PR_NOBINRANGE; + } + hgram = qdist_pr(&hst.chain, hgram_bins, hgram_opts); + g_string_append_printf(buf, "TB hash avg chain %0.3f buckets. " + "Histogram: %s\n", + qdist_avg(&hst.chain), hgram); + g_free(hgram); +} + +struct tb_tree_stats { + size_t nb_tbs; + size_t host_size; + size_t target_size; + size_t max_target_size; + size_t direct_jmp_count; + size_t direct_jmp2_count; + size_t cross_page; +}; + +static gboolean tb_tree_stats_iter(gpointer key, gpointer value, gpointer data) +{ + const TranslationBlock *tb = value; + struct tb_tree_stats *tst = data; + + tst->nb_tbs++; + tst->host_size += tb->tc.size; + tst->target_size += tb->size; + if (tb->size > tst->max_target_size) { + tst->max_target_size = tb->size; + } + if (tb->page_addr[1] != -1) { + tst->cross_page++; + } + if (tb->jmp_reset_offset[0] != TB_JMP_OFFSET_INVALID) { + tst->direct_jmp_count++; + if (tb->jmp_reset_offset[1] != TB_JMP_OFFSET_INVALID) { + tst->direct_jmp2_count++; + } + } + return false; +} + +static void tlb_flush_counts(size_t *pfull, size_t *ppart, size_t *pelide) +{ + CPUState *cpu; + size_t full = 0, part = 0, elide = 0; + + CPU_FOREACH(cpu) { + full += qatomic_read(&cpu->neg.tlb.c.full_flush_count); + part += qatomic_read(&cpu->neg.tlb.c.part_flush_count); + elide += qatomic_read(&cpu->neg.tlb.c.elide_flush_count); + } + *pfull = full; + *ppart = part; + *pelide = elide; +} + +static void tcg_dump_info(GString *buf) +{ + g_string_append_printf(buf, "[TCG profiler not compiled]\n"); +} + +static void dump_exec_info(GString *buf) +{ + struct tb_tree_stats tst = {}; + struct qht_stats hst; + size_t nb_tbs, flush_full, flush_part, flush_elide; + + tcg_tb_foreach(tb_tree_stats_iter, &tst); + nb_tbs = tst.nb_tbs; + /* XXX: avoid using doubles ? */ + g_string_append_printf(buf, "Translation buffer state:\n"); + /* + * Report total code size including the padding and TB structs; + * otherwise users might think "-accel tcg,tb-size" is not honoured. + * For avg host size we use the precise numbers from tb_tree_stats though. + */ + g_string_append_printf(buf, "gen code size %zu/%zu\n", + tcg_code_size(), tcg_code_capacity()); + g_string_append_printf(buf, "TB count %zu\n", nb_tbs); + g_string_append_printf(buf, "TB avg target size %zu max=%zu bytes\n", + nb_tbs ? tst.target_size / nb_tbs : 0, + tst.max_target_size); + g_string_append_printf(buf, "TB avg host size %zu bytes " + "(expansion ratio: %0.1f)\n", + nb_tbs ? tst.host_size / nb_tbs : 0, + tst.target_size ? + (double)tst.host_size / tst.target_size : 0); + g_string_append_printf(buf, "cross page TB count %zu (%zu%%)\n", + tst.cross_page, + nb_tbs ? (tst.cross_page * 100) / nb_tbs : 0); + g_string_append_printf(buf, "direct jump count %zu (%zu%%) " + "(2 jumps=%zu %zu%%)\n", + tst.direct_jmp_count, + nb_tbs ? (tst.direct_jmp_count * 100) / nb_tbs : 0, + tst.direct_jmp2_count, + nb_tbs ? (tst.direct_jmp2_count * 100) / nb_tbs : 0); + + qht_statistics_init(&tb_ctx.htable, &hst); + print_qht_statistics(hst, buf); + qht_statistics_destroy(&hst); + + g_string_append_printf(buf, "\nStatistics:\n"); + g_string_append_printf(buf, "TB flush count %u\n", + qatomic_read(&tb_ctx.tb_flush_count)); + g_string_append_printf(buf, "TB invalidate count %u\n", + qatomic_read(&tb_ctx.tb_phys_invalidate_count)); + + tlb_flush_counts(&flush_full, &flush_part, &flush_elide); + g_string_append_printf(buf, "TLB full flushes %zu\n", flush_full); + g_string_append_printf(buf, "TLB partial flushes %zu\n", flush_part); + g_string_append_printf(buf, "TLB elided flushes %zu\n", flush_elide); + tcg_dump_info(buf); +} + HumanReadableText *qmp_x_query_jit(Error **errp) { g_autoptr(GString) buf = g_string_new(""); @@ -66,6 +215,11 @@ HumanReadableText *qmp_x_query_jit(Error **errp) return human_readable_text_from_str(buf); } +static void tcg_dump_op_count(GString *buf) +{ + g_string_append_printf(buf, "[TCG profiler not compiled]\n"); +} + HumanReadableText *qmp_x_query_opcount(Error **errp) { g_autoptr(GString) buf = g_string_new(""); diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 8cb6ad3511..e579b0891d 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -645,133 +645,6 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) cpu_loop_exit_noexc(cpu); } -static void print_qht_statistics(struct qht_stats hst, GString *buf) -{ - uint32_t hgram_opts; - size_t hgram_bins; - char *hgram; - - if (!hst.head_buckets) { - return; - } - g_string_append_printf(buf, "TB hash buckets %zu/%zu " - "(%0.2f%% head buckets used)\n", - hst.used_head_buckets, hst.head_buckets, - (double)hst.used_head_buckets / - hst.head_buckets * 100); - - hgram_opts = QDIST_PR_BORDER | QDIST_PR_LABELS; - hgram_opts |= QDIST_PR_100X | QDIST_PR_PERCENT; - if (qdist_xmax(&hst.occupancy) - qdist_xmin(&hst.occupancy) == 1) { - hgram_opts |= QDIST_PR_NODECIMAL; - } - hgram = qdist_pr(&hst.occupancy, 10, hgram_opts); - g_string_append_printf(buf, "TB hash occupancy %0.2f%% avg chain occ. " - "Histogram: %s\n", - qdist_avg(&hst.occupancy) * 100, hgram); - g_free(hgram); - - hgram_opts = QDIST_PR_BORDER | QDIST_PR_LABELS; - hgram_bins = qdist_xmax(&hst.chain) - qdist_xmin(&hst.chain); - if (hgram_bins > 10) { - hgram_bins = 10; - } else { - hgram_bins = 0; - hgram_opts |= QDIST_PR_NODECIMAL | QDIST_PR_NOBINRANGE; - } - hgram = qdist_pr(&hst.chain, hgram_bins, hgram_opts); - g_string_append_printf(buf, "TB hash avg chain %0.3f buckets. " - "Histogram: %s\n", - qdist_avg(&hst.chain), hgram); - g_free(hgram); -} - -struct tb_tree_stats { - size_t nb_tbs; - size_t host_size; - size_t target_size; - size_t max_target_size; - size_t direct_jmp_count; - size_t direct_jmp2_count; - size_t cross_page; -}; - -static gboolean tb_tree_stats_iter(gpointer key, gpointer value, gpointer data) -{ - const TranslationBlock *tb = value; - struct tb_tree_stats *tst = data; - - tst->nb_tbs++; - tst->host_size += tb->tc.size; - tst->target_size += tb->size; - if (tb->size > tst->max_target_size) { - tst->max_target_size = tb->size; - } - if (tb_page_addr1(tb) != -1) { - tst->cross_page++; - } - if (tb->jmp_reset_offset[0] != TB_JMP_OFFSET_INVALID) { - tst->direct_jmp_count++; - if (tb->jmp_reset_offset[1] != TB_JMP_OFFSET_INVALID) { - tst->direct_jmp2_count++; - } - } - return false; -} - -void dump_exec_info(GString *buf) -{ - struct tb_tree_stats tst = {}; - struct qht_stats hst; - size_t nb_tbs, flush_full, flush_part, flush_elide; - - tcg_tb_foreach(tb_tree_stats_iter, &tst); - nb_tbs = tst.nb_tbs; - /* XXX: avoid using doubles ? */ - g_string_append_printf(buf, "Translation buffer state:\n"); - /* - * Report total code size including the padding and TB structs; - * otherwise users might think "-accel tcg,tb-size" is not honoured. - * For avg host size we use the precise numbers from tb_tree_stats though. - */ - g_string_append_printf(buf, "gen code size %zu/%zu\n", - tcg_code_size(), tcg_code_capacity()); - g_string_append_printf(buf, "TB count %zu\n", nb_tbs); - g_string_append_printf(buf, "TB avg target size %zu max=%zu bytes\n", - nb_tbs ? tst.target_size / nb_tbs : 0, - tst.max_target_size); - g_string_append_printf(buf, "TB avg host size %zu bytes " - "(expansion ratio: %0.1f)\n", - nb_tbs ? tst.host_size / nb_tbs : 0, - tst.target_size ? - (double)tst.host_size / tst.target_size : 0); - g_string_append_printf(buf, "cross page TB count %zu (%zu%%)\n", - tst.cross_page, - nb_tbs ? (tst.cross_page * 100) / nb_tbs : 0); - g_string_append_printf(buf, "direct jump count %zu (%zu%%) " - "(2 jumps=%zu %zu%%)\n", - tst.direct_jmp_count, - nb_tbs ? (tst.direct_jmp_count * 100) / nb_tbs : 0, - tst.direct_jmp2_count, - nb_tbs ? (tst.direct_jmp2_count * 100) / nb_tbs : 0); - - qht_statistics_init(&tb_ctx.htable, &hst); - print_qht_statistics(hst, buf); - qht_statistics_destroy(&hst); - - g_string_append_printf(buf, "\nStatistics:\n"); - g_string_append_printf(buf, "TB flush count %u\n", - qatomic_read(&tb_ctx.tb_flush_count)); - g_string_append_printf(buf, "TB invalidate count %u\n", - qatomic_read(&tb_ctx.tb_phys_invalidate_count)); - - tlb_flush_counts(&flush_full, &flush_part, &flush_elide); - g_string_append_printf(buf, "TLB full flushes %zu\n", flush_full); - g_string_append_printf(buf, "TLB partial flushes %zu\n", flush_part); - g_string_append_printf(buf, "TLB elided flushes %zu\n", flush_elide); - tcg_dump_info(buf); -} - #else /* CONFIG_USER_ONLY */ void cpu_interrupt(CPUState *cpu, int mask) diff --git a/tcg/tcg.c b/tcg/tcg.c index 35158a0846..847d749a7e 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -5927,11 +5927,6 @@ static void tcg_out_st_helper_args(TCGContext *s, const TCGLabelQemuLdst *ldst, tcg_out_helper_load_common_args(s, ldst, parm, info, next_arg); } -void tcg_dump_op_count(GString *buf) -{ - g_string_append_printf(buf, "[TCG profiler not compiled]\n"); -} - int tcg_gen_code(TCGContext *s, TranslationBlock *tb, uint64_t pc_start) { int i, start_words, num_insns; @@ -6128,11 +6123,6 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb, uint64_t pc_start) return tcg_current_code_size(s); } -void tcg_dump_info(GString *buf) -{ - g_string_append_printf(buf, "[TCG profiler not compiled]\n"); -} - #ifdef ELF_HOST_MACHINE /* In order to use this feature, the backend needs to do three things: From patchwork Tue Nov 7 02:48:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741755 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415426wrr; Mon, 6 Nov 2023 18:52:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEt6AtR41YlVXM1uh6tVwxqD1RG4ltCUy0hEH+bTYuLANdKF0H7TD55IdJIZyJflE8kzhko X-Received: by 2002:a05:620a:1669:b0:76d:bb77:b295 with SMTP id d9-20020a05620a166900b0076dbb77b295mr27678931qko.78.1699325572983; Mon, 06 Nov 2023 18:52:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325572; cv=none; d=google.com; s=arc-20160816; b=JhwJSJDpKac+rBHEkk+I9N4XPOFOu2Bsx0J2mL8t8uInhQk7SS45GZDE9VmyxerPJ2 8+41vsdQdyVIdYfbMR3r5pSy6FZDRQfv3fjkm5c/ICYG9JAsLpuRMwmMh037PuZKA4H2 bUDqLqhRQJTYgmdt78hRSU7Ez6lhTx4NTKntOekrgurmtHf6NnZIicnMJDZJJpAi0/h3 a/Gy1NUh/48FwvQMEQvdYC89HZ4fwAlKQfFTNnpF3Srrr8A/ih09yEcu536wrwvo+Hiy s06TBMlGzebvsWzOJ4wJrTujTmUYanZnijHRpdAL7l0nFjNH0Nhdu9XGl9h0h22pX5Kt cYaA== 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=1z4N/qwKWQYmS9hD74R6ggk/haC3cfKAEj4YRfVn9dM=; fh=XdZcuDF0lIDVBff2CYkB4/gQzRNs362lYRoE1KF8IAU=; b=Ghl1d37kH1sEwC7tMnZchpdvhKlgM2Ekxr3K7xaou2ZIWVBKxI6gqGhflGZGrpTzp+ KI3xA2io7wJiQuY25aSI44J3nV5q68DoVl3EtwcfezWMowqyTw9EhnlczU6Ahej4nLOb vYQl/VGRmkQFOvL49fDiZK07ayv1HUPYvBZJ54bAT5qBoffr4vAaeXdFVPdxw8rVzash XPaPkVThZiC3vtxEZ3y/eCxK/FvlA/nt01FdEodEr8gyQ9AGSeuABhLw8+MY7QEkay4f JGOIUXRyvmwxNTYFeuG0D8iRXV+pDBKxrbHy6rke5ZiFOGiTDueTArsXNcol1ZF1vG8V i+Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="dbUYSA/Y"; 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 14-20020ac8574e000000b0041773edb414si6580115qtx.655.2023.11.06.18.52.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:52:52 -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="dbUYSA/Y"; 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 1r0C97-0008Bj-8p; Mon, 06 Nov 2023 21:48:53 -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 1r0C93-00089r-Rf for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:49 -0500 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C91-0005pW-7R for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:49 -0500 Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-3b40d5ea323so3086458b6e.0 for ; Mon, 06 Nov 2023 18:48:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325325; x=1699930125; 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=1z4N/qwKWQYmS9hD74R6ggk/haC3cfKAEj4YRfVn9dM=; b=dbUYSA/YZqDXnJfxk0NDTPVSmK5CidARLsYBEyABUQsQLR/240hYWGNKsilWczVtSK zbdQWi8ppnS5+xTsRXJGVYmkOin+pQRo9idk/mIEUFOWN50tSmrFXQqUi1Z93TwwBe/p 4i+cvQEoOOKC7RSs9ztPLl1k2P7VOIwUSnJvoQc5Hq3M0x+ZQxadJG4uAIp5gEcq5XAR QYkmetFcCr9hn6rSH3N/dAaQG3Q4fL10YmJaCnRjg9gnbr1Jpobpi8h3Ejp5Ctxb12hq h7u92dgt12A9pzQOSISZEQR2ESDApUq38k/68OTPXVt/ZZwzdKlOPhZom4Z1GYz5D7q/ RMeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325325; x=1699930125; 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=1z4N/qwKWQYmS9hD74R6ggk/haC3cfKAEj4YRfVn9dM=; b=WQaXshF6DcEDM8SisWcPo+H1wHwLL5nj61F16hl4zWTFgjYzylXfzSaT5HuYyl/fNJ zDLesSEkf9ECWlwr53l7fNhNKF7iwiL9uHTFShv1eYSvA8D2DN6NMnbt7oQahFmXTztQ Du+aCzrSZlru8PLMDHgZxcpLaDAEI+qfobAH7QYSJr/cK4iKO1FNtgd5mXh3UNcDzM29 FNhMpHH36xLx6jbePbqiH/p4NxHGx7Yiow5x4LqOpJh8psKpT0CqHSzWrOcEvFrx0g+o TZnVtYibHHjxYIVEGL4/u1ojX1r23VTMBNIP+whOI8b7SsDEVHhnUf3hZurWdcSTTHCS scPw== X-Gm-Message-State: AOJu0Yyb9Mf9wjzFZHwm/KVJL7pXSIdpg1FwTTeZgLKQGRdD6pwNyd2k GTavxk4rSQUMsbXxLJku4ZQztccYdTQ/WjNXxaU= X-Received: by 2002:a05:6808:20a8:b0:3a9:cfb5:4637 with SMTP id s40-20020a05680820a800b003a9cfb54637mr33699569oiw.38.1699325325737; Mon, 06 Nov 2023 18:48:45 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:45 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Jiajie Chen Subject: [PATCH 02/35] tcg: Add C_N2_I1 Date: Mon, 6 Nov 2023 18:48:09 -0800 Message-Id: <20231107024842.7650-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::229; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x229.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 Constraint with two outputs, both in new registers. Signed-off-by: Richard Henderson Reviewed-by: Jiajie Chen Message-Id: <20230916220151.526140-2-richard.henderson@linaro.org> --- tcg/tcg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tcg/tcg.c b/tcg/tcg.c index 847d749a7e..6766b60b8a 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_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), #define C_O2_I2(O1, O2, I1, I2) C_PFX4(c_o2_i2_, O1, O2, I1, I2), @@ -675,6 +676,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode); #undef C_O1_I3 #undef C_O1_I4 #undef C_N1_I2 +#undef C_N2_I1 #undef C_O2_I1 #undef C_O2_I2 #undef C_O2_I3 @@ -694,6 +696,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_N2_I1(O1, O2, I1) { .args_ct_str = { "&" #O1, "&" #O2, #I1 } }, #define C_O2_I1(O1, O2, I1) { .args_ct_str = { #O1, #O2, #I1 } }, #define C_O2_I2(O1, O2, I1, I2) { .args_ct_str = { #O1, #O2, #I1, #I2 } }, @@ -715,6 +718,7 @@ static const TCGTargetOpDef constraint_sets[] = { #undef C_O1_I3 #undef C_O1_I4 #undef C_N1_I2 +#undef C_N2_I1 #undef C_O2_I1 #undef C_O2_I2 #undef C_O2_I3 @@ -734,6 +738,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_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) #define C_O2_I2(O1, O2, I1, I2) C_PFX4(c_o2_i2_, O1, O2, I1, I2) From patchwork Tue Nov 7 02:48:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741749 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1414932wrr; Mon, 6 Nov 2023 18:51:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHCSVHlc62djX3wKrurz8mTHSlxj/CJK8OXxC1JTth4pGXzh2IXEwI65WKvXeZ4xQofPsbW X-Received: by 2002:a05:620a:55a5:b0:76e:ec77:10a4 with SMTP id vr5-20020a05620a55a500b0076eec7710a4mr26697056qkn.77.1699325469351; Mon, 06 Nov 2023 18:51:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325469; cv=none; d=google.com; s=arc-20160816; b=OGIXSH4QvDnE97r+QPC2PPcmHoJBD6GIhdavWsrvCYnT/u1lPNze22ibSPB5g/aR9y VJEAkf7dkE402FjB/vAhwS0E+ZPRnF2qoNs+FqeBu1QisMpa4LxI5N4VxXQOGiu8w92s 5ig0TStFcHzrgTVdWSTxp2X2Hfxo86Ppiw/4w/Vt63KrCgC/nX2GFrO5G56M0jmIZwBe xmBm3PvE5rHTXpMLwdSb/pceiozRPyfBDqzDEPSKAD3hs+KisilVjjdF3O2Sr9U2dNW9 i9cC2Ju2b0WVDMjCVOskRqSDnrOQXN7Ue0H8snK5di/AAcbeSLaFac6u+XF1RmgmO/EE xErg== 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=dtF56/6br6ds70EvBJRTzpGkNHFFQW2fY4AZd7lgvlY=; fh=XdZcuDF0lIDVBff2CYkB4/gQzRNs362lYRoE1KF8IAU=; b=fbk7WqytY7MH83eVsGHYh/FRa/E+JfVz84rdkyO3zCm4gO/F3iudmtojr4r6wFjt7f SN1Fc2AkJ79YgzbBMuRlbnBsOfd8lskj9KZWWt4NsGUcJx1tO/KP+b/UA6idyn/zNqEO HlDIYd+f5YBnSjkWKSrfPANRmiF0SSD5pveTfiwGrPZnrEuxNy8cIxJSBPjEUlO1rJhf 9shZxnoxGS7YCv1PtjvkP+e2NJnmOMQTHm/rlVonGxyuN7R6YFYx/g0+UCPfYz0m7tDc kmguv5FHHbmfGnnNCByDAyinDdPO1squouLGDKRb6m0jEmWfGwzIrjcXQcUS6/By+Vp2 v7OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qRvYeS7g; 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 e17-20020a05620a015100b0077893a5a7fdsi6599452qkn.740.2023.11.06.18.51.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:51:09 -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=qRvYeS7g; 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 1r0C95-0008Am-M3; Mon, 06 Nov 2023 21:48:51 -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 1r0C93-00089t-US for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:49 -0500 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C91-0005pd-Mk for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:49 -0500 Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3b56b618217so3120931b6e.0 for ; Mon, 06 Nov 2023 18:48:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325326; x=1699930126; 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=dtF56/6br6ds70EvBJRTzpGkNHFFQW2fY4AZd7lgvlY=; b=qRvYeS7gpXNraJJbJp8/8J8ivQMUIH0Yn+wiwnaD4zBXT7fR+fo4EfQO6J4hcSi5MA 9xuEcViZ3oghHkMtm9hTUA4uSdyfzzWb5luWPBgWEK6R3jhmaAM1bE29sMjxGmthaTOr z7PKUnAAtWuCDgH/FsdQLllMnW6QU9D2IuMUTeWW9TPoeETt5ijQadanupXuLw85eq7D GlkCEGjtha6eykUfWsMQmgzExt9Ra7tQ+8ZKPShReqa0BuEzKFde97pp3IrrW4IMQ97T zFAGlCcsOBCZUXqYw/OJ/BT+oanInMEox2wjrynel6d+Guu5glcWsc+gMo3NXuQzaVox UnTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325326; x=1699930126; 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=dtF56/6br6ds70EvBJRTzpGkNHFFQW2fY4AZd7lgvlY=; b=H8LIFkgDth6Sn1yFVmilm06NtAyHZ3hLVPaI7OV4QSVgDn4TemP9CYL8sNq+9832AM 5PCFgev2fzxIXhPQopD/nJRUWuM25wqSMYU7Eilb7b9DI0ZfPnoXiBcpo+PB10vnvvX3 q+HK3ENCtMjNdg/pCB6N8SZeaayiAp7rF2NhW+uDhdj0LaErfLLqtpaD3xKGPM2pc8gF Qn1vbWz509rnzz1UODzqdoVHdNmYnAEK5EszeI/f76D3rK3SmcUMh6Kp05R7NdQryoWD mjWwE+xnaOIXT8thSZtw/tiDygkTKfxLb6AUirt4eQxcYQXeViGXl51GxVkbRP9U6SUC ytQg== X-Gm-Message-State: AOJu0YzGXsqgv1e01a13hulgFMlddowhmzyERK18miJ15vw5ePq1ljIA EUnOM1N1ao754Vw9YlI55wlVyjHwk+90VsEjAY4= X-Received: by 2002:a05:6808:f8e:b0:3af:8050:369f with SMTP id o14-20020a0568080f8e00b003af8050369fmr36764637oiw.6.1699325326453; Mon, 06 Nov 2023 18:48:46 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:46 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Jiajie Chen Subject: [PATCH 03/35] tcg/loongarch64: Use C_N2_I1 for INDEX_op_qemu_ld_a*_i128 Date: Mon, 6 Nov 2023 18:48:10 -0800 Message-Id: <20231107024842.7650-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::236; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x236.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 Use new registers for the output, so that we never overlap the input address, which could happen for user-only. This avoids a "tmp = addr + 0" in that case. Signed-off-by: Richard Henderson Reviewed-by: Jiajie Chen Message-Id: <20230916220151.526140-3-richard.henderson@linaro.org> --- tcg/loongarch64/tcg-target-con-set.h | 2 +- tcg/loongarch64/tcg-target.c.inc | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tcg/loongarch64/tcg-target-con-set.h b/tcg/loongarch64/tcg-target-con-set.h index 77d62e38e7..cae6c2aad6 100644 --- a/tcg/loongarch64/tcg-target-con-set.h +++ b/tcg/loongarch64/tcg-target-con-set.h @@ -38,4 +38,4 @@ C_O1_I2(w, w, wM) C_O1_I2(w, w, wA) C_O1_I3(w, w, w, w) C_O1_I4(r, rZ, rJ, rZ, rZ) -C_O2_I1(r, r, r) +C_N2_I1(r, r, r) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index ccf133db4b..a1a387df31 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -1103,13 +1103,18 @@ static void tcg_out_qemu_ldst_i128(TCGContext *s, TCGReg data_lo, TCGReg data_hi } } else { /* Otherwise use a pair of LD/ST. */ - tcg_out_opc_add_d(s, TCG_REG_TMP0, h.base, h.index); + TCGReg base = h.base; + if (h.index != TCG_REG_ZERO) { + base = TCG_REG_TMP0; + tcg_out_opc_add_d(s, base, h.base, h.index); + } if (is_ld) { - tcg_out_opc_ld_d(s, data_lo, TCG_REG_TMP0, 0); - tcg_out_opc_ld_d(s, data_hi, TCG_REG_TMP0, 8); + tcg_debug_assert(base != data_lo); + tcg_out_opc_ld_d(s, data_lo, base, 0); + tcg_out_opc_ld_d(s, data_hi, base, 8); } else { - tcg_out_opc_st_d(s, data_lo, TCG_REG_TMP0, 0); - tcg_out_opc_st_d(s, data_hi, TCG_REG_TMP0, 8); + tcg_out_opc_st_d(s, data_lo, base, 0); + tcg_out_opc_st_d(s, data_hi, base, 8); } } @@ -2049,7 +2054,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(r, r, r); + return C_N2_I1(r, r, r); case INDEX_op_qemu_st_a32_i128: case INDEX_op_qemu_st_a64_i128: From patchwork Tue Nov 7 02:48:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741739 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1414488wrr; Mon, 6 Nov 2023 18:49:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFxoi2u/uEV0aU85GF0KACJaumZTpVJKbTAId9Jzr28XT1sEiiWy9wYjeK4jd6xSSiIO7uS X-Received: by 2002:a05:6214:b6f:b0:671:3f49:c8b4 with SMTP id ey15-20020a0562140b6f00b006713f49c8b4mr36612936qvb.3.1699325375421; Mon, 06 Nov 2023 18:49:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325375; cv=none; d=google.com; s=arc-20160816; b=Ts5x4PPpjhlR3zs3XBdtfI6s1Rf3ed4WYUUAH8MUzYZuYS44KawuS4qAvMpNifTVMK jyiSQ9payBTE8ke2g6FSbZ5SdfuFrH2CJutI/gBGblhgsd5kOctadxHLoahjx8TrrsV9 8uGbarsnXBIJh5JVJdEMlMj7GceMg8USX1crylZ3lqWBLp4ZokkqJcZ4j6whvnfEwMNt vQm5J5xCNTWFxU9H1cFVwmO7Rd2XeQ8/zxzxh0slvNLI0GKQpQm6Uyrr9S5YI6ss2OEB CHXVea/jOrr7eih9waPJ1/7htj5OrN2wSc0UE9biuHxqu5XoEVeEQFRGILD4naVBkW0c MzrA== 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=dwItf/Y8t1sjJEnssrxfJSiyzynmgIaR+NwTubGqvjs=; fh=XdZcuDF0lIDVBff2CYkB4/gQzRNs362lYRoE1KF8IAU=; b=JoxrxvaIvihbMYKN1p8TQyjYJt7JXv9MOd37OogQUVByMwg/s7PwRryAd4K3IitlKC iGN7UPa8jRmQhko/hlFVYGnX88drVSBm4fyZP2lE92sTpZ5cpn8E/TCe/NK5VWEmTtyo 346oWCtn8tY4aiQuQXkAoYaUruonx/xysbpYvvKRbDmmmKPpPBO8gKW3tcWO+smrhZ/h nvoPSF6uhPq3XY/8mroqNH+XNqhvJFv3W4sVPmGp1Uc2oz0Y9Qj60WiTGtoCrc3T4r4F tAnUheJKWW5raNaJVVn2x0vrWSFHdOzbk1Rd2uMa8x/cPL0uSOKGO2Iv73qwQToD/U6j cqnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NXUn0tS4; 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 b8-20020a056214114800b0065aea855463si6229091qvt.81.2023.11.06.18.49.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:49:35 -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=NXUn0tS4; 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 1r0C99-0008El-7H; Mon, 06 Nov 2023 21:48:55 -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 1r0C94-0008A6-4G for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:50 -0500 Received: from mail-vs1-xe35.google.com ([2607:f8b0:4864:20::e35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C92-0005pp-4o for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:49 -0500 Received: by mail-vs1-xe35.google.com with SMTP id ada2fe7eead31-45db0df090eso1104896137.3 for ; Mon, 06 Nov 2023 18:48:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325327; x=1699930127; 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=dwItf/Y8t1sjJEnssrxfJSiyzynmgIaR+NwTubGqvjs=; b=NXUn0tS4cpAhzpI1GoMHoF6fkhe9K+pE3UkBJbm9YeIJnj8x9S/MPLFTWxdNjApV+y 0BkKinstXabpUkBKW79dmEtq8AkZ3x5uvIr6vnpChZx9TB6hUcgyF7R/KMSYTWSIRai7 t3U+Vgo5DNFZr6t1f76Stk3am8iVdIpW89euqUmALM2uk3EzMsDc7fIFhZV6K7Dziq+c /EL8y7cdFRa3M41iiMqokjrnTyUX+LQDsMPclddx4HN/QvtVgN7RG4H88uDIcw0nS5sb gL5UTaRP8VRtT7AAYoaPq2f42tH/XTEqxNRrnOQelwv8BgpUy5JRxWUXYWBdFMgePiDl amfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325327; x=1699930127; 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=dwItf/Y8t1sjJEnssrxfJSiyzynmgIaR+NwTubGqvjs=; b=RKAPTaD430fqWNvE1hgRP02yAVt5LHV13ArmvT7B6/aYBLp1i5VMW7tnSvSDsOxIGt 2LG+LBCTTPnHDDjZxixRHpViVO1Em0nMStdtgCFGEqigs3xLZ7KY0wlMawE96F13wXzZ 4SrCn5U4v1G9yuKIoB4CMwagfVBWVlooWWFuGFueae3eagP4auluztSO/5ZTFjDocy+W q+z6JyJeqnD10c/pqfxyfAFbWY2VeyxQV14m56ADro7OQgX6eCsICrrdKekpXKJ6Tg25 iyFLXLIGlyVtmDk+mHoEZT4CChnLD+pmDBN6KOo1q+Zb+D9TbJufjyLo7DaYcOYDGHrd 48WA== X-Gm-Message-State: AOJu0YycEGAo+L8CnviVwg8lvgJ5Sqvp7j+6S0ZQQU3RTZTXdsxpcW23 MO0Tgj1PVxsLuL7mNUJR2lT4Jh+LwTkLdhK1Mf8= X-Received: by 2002:a67:e0d7:0:b0:45d:aebd:7f49 with SMTP id m23-20020a67e0d7000000b0045daebd7f49mr6754232vsl.16.1699325327183; Mon, 06 Nov 2023 18:48:47 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:46 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Jiajie Chen Subject: [PATCH 04/35] util: Add cpuinfo for loongarch64 Date: Mon, 6 Nov 2023 18:48:11 -0800 Message-Id: <20231107024842.7650-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::e35; envelope-from=richard.henderson@linaro.org; helo=mail-vs1-xe35.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 Signed-off-by: Richard Henderson Reviewed-by: Jiajie Chen Message-Id: <20230916220151.526140-4-richard.henderson@linaro.org> --- host/include/loongarch64/host/cpuinfo.h | 21 +++++++++++++++ util/cpuinfo-loongarch.c | 35 +++++++++++++++++++++++++ util/meson.build | 2 ++ 3 files changed, 58 insertions(+) create mode 100644 host/include/loongarch64/host/cpuinfo.h create mode 100644 util/cpuinfo-loongarch.c diff --git a/host/include/loongarch64/host/cpuinfo.h b/host/include/loongarch64/host/cpuinfo.h new file mode 100644 index 0000000000..fab664a10b --- /dev/null +++ b/host/include/loongarch64/host/cpuinfo.h @@ -0,0 +1,21 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * Host specific cpu identification for LoongArch + */ + +#ifndef HOST_CPUINFO_H +#define HOST_CPUINFO_H + +#define CPUINFO_ALWAYS (1u << 0) /* so cpuinfo is nonzero */ +#define CPUINFO_LSX (1u << 1) + +/* Initialized with a constructor. */ +extern unsigned cpuinfo; + +/* + * We cannot rely on constructor ordering, so other constructors must + * use the function interface rather than the variable above. + */ +unsigned cpuinfo_init(void); + +#endif /* HOST_CPUINFO_H */ diff --git a/util/cpuinfo-loongarch.c b/util/cpuinfo-loongarch.c new file mode 100644 index 0000000000..08b6d7460c --- /dev/null +++ b/util/cpuinfo-loongarch.c @@ -0,0 +1,35 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * Host specific cpu identification for LoongArch. + */ + +#include "qemu/osdep.h" +#include "host/cpuinfo.h" + +#ifdef CONFIG_GETAUXVAL +# include +#else +# include "elf.h" +#endif +#include + +unsigned cpuinfo; + +/* Called both as constructor and (possibly) via other constructors. */ +unsigned __attribute__((constructor)) cpuinfo_init(void) +{ + unsigned info = cpuinfo; + unsigned long hwcap; + + if (info) { + return info; + } + + hwcap = qemu_getauxval(AT_HWCAP); + + info = CPUINFO_ALWAYS; + info |= (hwcap & HWCAP_LOONGARCH_LSX ? CPUINFO_LSX : 0); + + cpuinfo = info; + return info; +} diff --git a/util/meson.build b/util/meson.build index 769b24f2e0..1bfff81087 100644 --- a/util/meson.build +++ b/util/meson.build @@ -113,6 +113,8 @@ if cpu == 'aarch64' util_ss.add(files('cpuinfo-aarch64.c')) elif cpu in ['x86', 'x86_64'] util_ss.add(files('cpuinfo-i386.c')) +elif cpu == 'loongarch64' + util_ss.add(files('cpuinfo-loongarch.c')) elif cpu in ['ppc', 'ppc64'] util_ss.add(files('cpuinfo-ppc.c')) endif From patchwork Tue Nov 7 02:48:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741767 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415840wrr; Mon, 6 Nov 2023 18:54:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFEMv4EikpZaVTSH/Zxeo9h6It5+1RHz5U5B6y0gqU7WvGiTU/9MMNha0h+tPNjI4v4NWzQ X-Received: by 2002:a05:620a:44ca:b0:775:ce76:474a with SMTP id y10-20020a05620a44ca00b00775ce76474amr41068839qkp.52.1699325672425; Mon, 06 Nov 2023 18:54:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325672; cv=none; d=google.com; s=arc-20160816; b=a20tEZGIVNOmJ4Ea5ghWl8+d+3rWi5PRCBtB7ubEAp7SxtZlcwtoI0zvhE9QZQT9Vq ROAXAcYaK1/Cu6pgzQxIj10JWid/5IMMEopyVdTeDA63xuU5DNSNtdVIqIi1fQBNNnjG FFUT1LQUW72IeVS3O9wPzBXwNfxPP91o/RwcQHRTSM3CEarqmWg8VzaJmMhoYlYvqqh1 jN2fzwJDUV0hY+/qsG3AYR0limBC2Rhc2nrJH/I7RmESR/eU4/Fa9akdw+k4ai3T6NPV h+CXRPsB+uHd1J9r7gNGnpjt5R8/PPO4dVFvOeXyQpiWWqyxzLuO3xThin/sFmEFQE3h vkMA== 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=Q3O8/mcQ+FXQ1L4q0gH6GTHD/Q1jUKjZFDP8Gx7yZ+4=; fh=XdZcuDF0lIDVBff2CYkB4/gQzRNs362lYRoE1KF8IAU=; b=vZrHpkxeeKxqR/4c5rZv5ud/WXY1OGdmBn169QcEerMIR4HvX4HcfR51m2LMrj6U54 qlKayN1BQxrltv5rrnuvtu7hu5GaLDfJOVJgrqkCyFoVTMLYfms4dW/PJR6MitcRdSze qSx4GJhSmOQ9ar8fz1dVWzA4e7X46nfnbmEIQN/k9nugsIai2wb+yn9HfSh2UHnYZRC9 uHRzeiQ9qC4jarcA1IDkz7WaADf+qY8CRKcf6VAUU1+nTFyWiqARAXAWAwa/E3sgwxvg Ot6ggoR1Rl43hC+E10bfwSRCHIkmc7SZVjXSevdOy+Wl/lnTrc7JoQjnDnjPRtlFzsmT GUTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oG5Pu8Sh; 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 v5-20020a05622a014500b00418175f3a84si6473957qtw.138.2023.11.06.18.54.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:54:32 -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=oG5Pu8Sh; 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 1r0C96-0008BD-Oz; Mon, 06 Nov 2023 21:48:52 -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 1r0C94-0008AY-Vo for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:50 -0500 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C93-0005q0-86 for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:50 -0500 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6c320a821c4so4636758b3a.2 for ; Mon, 06 Nov 2023 18:48:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325328; x=1699930128; 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=Q3O8/mcQ+FXQ1L4q0gH6GTHD/Q1jUKjZFDP8Gx7yZ+4=; b=oG5Pu8ShiJLPO2OPdMIGdvf6x69sf+2oWmJzF6zDzMxApvDu1ZTYyPQSftGfmFwX4D U3VdZGBg98igwo2Ekf0tUf6DgDy9LriFHnHAcNFMX0NdJZREFDfbgnkuxDF5o0U+H/oj lf94vSpL019qnVnwlbYIIbWp0JFw6x76eJqWwR1ymlBkKxUDlcVMKIJXGaIpNlaMOV0D 2D+m9dUCQoiU8pZHpGlXbEGgen4/qaHIr/3rJdiv3kRJm15GINnuEJFUBBgpRexbrklV PaXQoEtcVrPOBkAbpiGSn7UnF9jjMXZVbYStZOjwcCIkjJm+GPjnVhttB5lcB7/dZcOZ IjrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325328; x=1699930128; 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=Q3O8/mcQ+FXQ1L4q0gH6GTHD/Q1jUKjZFDP8Gx7yZ+4=; b=uRkebovY+a+Dzv//rmmYKk582bJjzDRzKW7gwwJN0v7V8+sUrnvhevNS20f4hcpomn Ad8Ba+oa5jcSq4giJw8cFi7sbl5R4ioU3oDVRhIA1/kp6fTdDDZCrMhy4jeE8vxdikJC CYIM/PaljHtT26afcxadJp3oF0ZCgjK8Ph3w0D3cjp1CKuE/Ff0PLWpv9/6qPfDP8UkM jqHbwGLr8pf/txCei5awBiKxn90vyj5rrK6tUNyOloJkkCwV4Trr1JaWfV6mARvTm73m L1jdIGU67duC+2ARsCcyz7uFwGwjTRAiEaRCMPS7Q29FEI+P4S5lFncuixDAVxxklrwh 7H0g== X-Gm-Message-State: AOJu0Yz+1h/57bNShdnG/5rSa9h5qHTUGYw293L2sW/SNVB0r5zFvR7c RCzmgI+ClsWLRA8xSQYyrPeivl7eboLPSJRm/DM= X-Received: by 2002:a05:6a00:1345:b0:6bd:f760:6ab1 with SMTP id k5-20020a056a00134500b006bdf7606ab1mr29533980pfu.14.1699325327870; Mon, 06 Nov 2023 18:48:47 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:47 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Jiajie Chen Subject: [PATCH 05/35] tcg/loongarch64: Use cpuinfo.h Date: Mon, 6 Nov 2023 18:48:12 -0800 Message-Id: <20231107024842.7650-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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 Signed-off-by: Richard Henderson Reviewed-by: Jiajie Chen Message-Id: <20230916220151.526140-5-richard.henderson@linaro.org> --- tcg/loongarch64/tcg-target.h | 8 ++++---- tcg/loongarch64/tcg-target.c.inc | 8 +------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/tcg/loongarch64/tcg-target.h b/tcg/loongarch64/tcg-target.h index 03017672f6..1bea15b02e 100644 --- a/tcg/loongarch64/tcg-target.h +++ b/tcg/loongarch64/tcg-target.h @@ -29,6 +29,8 @@ #ifndef LOONGARCH_TCG_TARGET_H #define LOONGARCH_TCG_TARGET_H +#include "host/cpuinfo.h" + #define TCG_TARGET_INSN_UNIT_SIZE 4 #define TCG_TARGET_NB_REGS 64 @@ -85,8 +87,6 @@ typedef enum { TCG_VEC_TMP0 = TCG_REG_V23, } TCGReg; -extern bool use_lsx_instructions; - /* used for function call generation */ #define TCG_REG_CALL_STACK TCG_REG_SP #define TCG_TARGET_STACK_ALIGN 16 @@ -171,10 +171,10 @@ extern bool use_lsx_instructions; #define TCG_TARGET_HAS_muluh_i64 1 #define TCG_TARGET_HAS_mulsh_i64 1 -#define TCG_TARGET_HAS_qemu_ldst_i128 use_lsx_instructions +#define TCG_TARGET_HAS_qemu_ldst_i128 (cpuinfo & CPUINFO_LSX) #define TCG_TARGET_HAS_v64 0 -#define TCG_TARGET_HAS_v128 use_lsx_instructions +#define TCG_TARGET_HAS_v128 (cpuinfo & CPUINFO_LSX) #define TCG_TARGET_HAS_v256 0 #define TCG_TARGET_HAS_not_vec 1 diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index a1a387df31..ae13c1f666 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -32,8 +32,6 @@ #include "../tcg-ldst.c.inc" #include -bool use_lsx_instructions; - #ifdef CONFIG_DEBUG_TCG static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { "zero", @@ -2314,10 +2312,6 @@ static void tcg_target_init(TCGContext *s) exit(EXIT_FAILURE); } - if (hwcap & HWCAP_LOONGARCH_LSX) { - use_lsx_instructions = 1; - } - tcg_target_available_regs[TCG_TYPE_I32] = ALL_GENERAL_REGS; tcg_target_available_regs[TCG_TYPE_I64] = ALL_GENERAL_REGS; @@ -2333,7 +2327,7 @@ static void tcg_target_init(TCGContext *s) tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S8); tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S9); - if (use_lsx_instructions) { + if (cpuinfo & CPUINFO_LSX) { tcg_target_available_regs[TCG_TYPE_V128] = ALL_VECTOR_REGS; tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_V24); tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_V25); From patchwork Tue Nov 7 02:48:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741738 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1414485wrr; Mon, 6 Nov 2023 18:49:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZ5Yc1z1QUDiz6DyxjZk1pS/8yPUjdIyWKNsDHOVxpweBhKG2O07JUvPALS8c4Rlo5Uv3e X-Received: by 2002:ac8:5fc3:0:b0:41e:31bb:1e55 with SMTP id k3-20020ac85fc3000000b0041e31bb1e55mr37424455qta.61.1699325375357; Mon, 06 Nov 2023 18:49:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325375; cv=none; d=google.com; s=arc-20160816; b=km6MXyZ85Cvkxzlsf8xvtCd4Lp/WPbOtryD17BQAfkDJIhWkQRP9hLngrKVsBmzPRx qlmKpsI3Vt6oK+kfLgNVHjNUZFAyb93nZFpoGartxbgck+T1u3RnFBN04EJkwv1fIfTy UE9QF0+5QYf6JvtEaMKfN4KbEdyT6vOSBZg4TO0lxzVHccy3ubPmEkb+tAsMW9cKHXIU K+1y3JYwvfmTOgu+VWD+V5ET5Xtdgr7Yj/7BvwgCVh8BEyrc7oHBG5+pUHoUQsoDyoJf DJV7EsQVpsrQABjZtjgokz1jtgVq63KQliFyXG2CfuMmiExbPZZprPsoD49Kcvcilrz7 gCcg== 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:to:from :dkim-signature; bh=vHLAwIo9k4CChF5auIiY+68A+lSlhRobpJGeh7zUX4I=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=SCOD7Xf7tvvy8gimZpeJ3zJbRctWCBxOy1sREYFIUUvKg77byG1fEF/j9Z0iaVFqR3 3l29c+hUkuEmLkmYAGxB443diXfQQdVuzMfhrA4LyLebxyaGbObIDSeJBYn1n+Ff/3is FMLDOb2f1wk3m4eOkLaRSgy1ow0ByJC/4mBVEFKuUfV1h6LwWLmH/WDHDh6pJsXsPr52 5fhexPsujKemyDA5Ybn+vc72+XOTHDSIZQm28rTX94O7JtUwzysULZv4HXpyeBzVvRGI fkeyVmjGUIPkaIZfB2+w0R1ViNj0gHRUXO+xF2/YJW7uRd7uVzwsH1pkfEyHhRjYNajs wfZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u36fQvJk; 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 h7-20020ac85e07000000b00419930eb09dsi6622876qtx.740.2023.11.06.18.49.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:49:35 -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=u36fQvJk; 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 1r0C9J-0008N6-U9; Mon, 06 Nov 2023 21:49:05 -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 1r0C9H-0008KM-Tw for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:03 -0500 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C94-0005qC-AP for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:03 -0500 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6b5af4662b7so4252607b3a.3 for ; Mon, 06 Nov 2023 18:48:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325329; x=1699930129; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=vHLAwIo9k4CChF5auIiY+68A+lSlhRobpJGeh7zUX4I=; b=u36fQvJkQezZC7ZrPhxhIBHAUJDGOwsXHt8C/fOJcqTHAOf6+GR9zCrzkhvqyJuJVC tmECJ1SbHQMCBE4Qr+dKEl2SRZDy/OcaaWscyKOOykqxdrX9rCQmfIlMTq4QxKx2zwFL IQ6wxYR5UaUQ27gmh9BVqBjmHqVR7ZwDXREwG7Y044eEjX1TFEAhpYoy5IZGQUUalovN 2NNc8Tu6dgoHYs33nz/R+DvKClareMpnEmOQ7g64SZZWWSusHLn9LeBbWvy7CkYpU6gS zoj7lYKqwBZrXsylxrBWC++mI18P5/q5pYXENMU8zcEgP4it2BdMJHyf7Bql7DUnldtA arVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325329; x=1699930129; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vHLAwIo9k4CChF5auIiY+68A+lSlhRobpJGeh7zUX4I=; b=wdigAKmSf+RjXss40ojg9z63YFuFMem2EbueafaaQ6DybADoV1YTEEo5D5tuBNCyhh PplHOtV57Yrj5sg/9aUSnpQRNy/+Mdgl6EGOCfSWN23Uaprvcljezvi8kdoP8+TPgra7 YEQrqZQFhDKLhz7BpuiI6A+EjVxg5/CuR1yviNh27+XgLgg9mFqbDOHWI3bUuB2g5AVq G9x2qAaAAmCFCd44zlL/P8GmpWxrojIhvjOZ5Z8DyQ6JVZATz2ImsjNnKbKOtH66Vov1 /8o9JoENu2Qry5utcePd2dI0dbhuN2JL/WcpxBgKxrcvfzgrsmK/lZ7LI7Ic/faiVk9k narQ== X-Gm-Message-State: AOJu0YwWvJ9ng0ACJxIon76vtrdWw2TBsmjzCI31zCDKo4+Luy/ABJtC EN6s+V7tRIWz+7VnuUF5x9nlzO/ATCFLYXnQX/Y= X-Received: by 2002:a05:6a00:21c9:b0:68a:4103:9938 with SMTP id t9-20020a056a0021c900b0068a41039938mr28060198pfj.0.1699325328651; Mon, 06 Nov 2023 18:48:48 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 06/35] host/include/loongarch64: Add atomic16 load and store Date: Mon, 6 Nov 2023 18:48:13 -0800 Message-Id: <20231107024842.7650-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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 While loongarch64 does not have a 128-bit cmpxchg, it does have 128-bit atomic load and store via the vector unit. Signed-off-by: Richard Henderson Message-Id: <20230916220151.526140-6-richard.henderson@linaro.org> --- .../include/loongarch64/host/atomic128-ldst.h | 52 +++++++++++++++++++ .../loongarch64/host/load-extract-al16-al8.h | 39 ++++++++++++++ .../loongarch64/host/store-insert-al16.h | 12 +++++ 3 files changed, 103 insertions(+) create mode 100644 host/include/loongarch64/host/atomic128-ldst.h create mode 100644 host/include/loongarch64/host/load-extract-al16-al8.h create mode 100644 host/include/loongarch64/host/store-insert-al16.h diff --git a/host/include/loongarch64/host/atomic128-ldst.h b/host/include/loongarch64/host/atomic128-ldst.h new file mode 100644 index 0000000000..9a4a8f8b9e --- /dev/null +++ b/host/include/loongarch64/host/atomic128-ldst.h @@ -0,0 +1,52 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * Load/store for 128-bit atomic operations, LoongArch version. + * + * See docs/devel/atomics.rst for discussion about the guarantees each + * atomic primitive is meant to provide. + */ + +#ifndef LOONGARCH_ATOMIC128_LDST_H +#define LOONGARCH_ATOMIC128_LDST_H + +#include "host/cpuinfo.h" +#include "tcg/debug-assert.h" + +#define HAVE_ATOMIC128_RO likely(cpuinfo & CPUINFO_LSX) +#define HAVE_ATOMIC128_RW HAVE_ATOMIC128_RO + +/* + * As of gcc 13 and clang 16, there is no compiler support for LSX at all. + * Use inline assembly throughout. + */ + +static inline Int128 atomic16_read_ro(const Int128 *ptr) +{ + uint64_t l, h; + + tcg_debug_assert(HAVE_ATOMIC128_RO); + asm("vld $vr0, %2, 0\n\t" + "vpickve2gr.d %0, $vr0, 0\n\t" + "vpickve2gr.d %1, $vr0, 1" + : "=r"(l), "=r"(h) : "r"(ptr), "m"(*ptr) : "f0"); + + return int128_make128(l, h); +} + +static inline Int128 atomic16_read_rw(Int128 *ptr) +{ + return atomic16_read_ro(ptr); +} + +static inline void atomic16_set(Int128 *ptr, Int128 val) +{ + uint64_t l = int128_getlo(val), h = int128_gethi(val); + + tcg_debug_assert(HAVE_ATOMIC128_RW); + asm("vinsgr2vr.d $vr0, %1, 0\n\t" + "vinsgr2vr.d $vr0, %2, 1\n\t" + "vst $vr0, %3, 0" + : "=m"(*ptr) : "r"(l), "r"(h), "r"(ptr) : "f0"); +} + +#endif /* LOONGARCH_ATOMIC128_LDST_H */ diff --git a/host/include/loongarch64/host/load-extract-al16-al8.h b/host/include/loongarch64/host/load-extract-al16-al8.h new file mode 100644 index 0000000000..d1fb59d8af --- /dev/null +++ b/host/include/loongarch64/host/load-extract-al16-al8.h @@ -0,0 +1,39 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * Atomic extract 64 from 128-bit, LoongArch version. + * + * Copyright (C) 2023 Linaro, Ltd. + */ + +#ifndef LOONGARCH_LOAD_EXTRACT_AL16_AL8_H +#define LOONGARCH_LOAD_EXTRACT_AL16_AL8_H + +#include "host/cpuinfo.h" +#include "tcg/debug-assert.h" + +/** + * load_atom_extract_al16_or_al8: + * @pv: host address + * @s: object size in bytes, @s <= 8. + * + * Load @s bytes from @pv, when pv % s != 0. If [p, p+s-1] does not + * cross an 16-byte boundary then the access must be 16-byte atomic, + * otherwise the access must be 8-byte atomic. + */ +static inline uint64_t load_atom_extract_al16_or_al8(void *pv, int s) +{ + uintptr_t pi = (uintptr_t)pv; + Int128 *ptr_align = (Int128 *)(pi & ~7); + int shr = (pi & 7) * 8; + uint64_t l, h; + + tcg_debug_assert(HAVE_ATOMIC128_RO); + asm("vld $vr0, %2, 0\n\t" + "vpickve2gr.d %0, $vr0, 0\n\t" + "vpickve2gr.d %1, $vr0, 1" + : "=r"(l), "=r"(h) : "r"(ptr_align), "m"(*ptr_align) : "f0"); + + return (l >> shr) | (h << (-shr & 63)); +} + +#endif /* LOONGARCH_LOAD_EXTRACT_AL16_AL8_H */ diff --git a/host/include/loongarch64/host/store-insert-al16.h b/host/include/loongarch64/host/store-insert-al16.h new file mode 100644 index 0000000000..919fd8d744 --- /dev/null +++ b/host/include/loongarch64/host/store-insert-al16.h @@ -0,0 +1,12 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * Atomic store insert into 128-bit, LoongArch version. + */ + +#ifndef LOONGARCH_STORE_INSERT_AL16_H +#define LOONGARCH_STORE_INSERT_AL16_H + +void store_atom_insert_al16(Int128 *ps, Int128 val, Int128 msk) + QEMU_ERROR("unsupported atomic"); + +#endif /* LOONGARCH_STORE_INSERT_AL16_H */ From patchwork Tue Nov 7 02:48:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741766 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415814wrr; Mon, 6 Nov 2023 18:54:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IGVXYyfpRg15JL+wtFv7IsUC0vQFTzSzvR+eBOVxUF8CSpCs8aJOXzLSBFH6tkOie1zBbpG X-Received: by 2002:a05:6214:2267:b0:672:549c:15df with SMTP id gs7-20020a056214226700b00672549c15dfmr30092235qvb.26.1699325666900; Mon, 06 Nov 2023 18:54:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325666; cv=none; d=google.com; s=arc-20160816; b=JnlIpPsYjcxWicLQGw+vGVuGFnKHFxnSijyg4bu7fZl51F8QKXCzgKuC4KmFICKZw/ vWm7PlI9LvPqIepnORlXT8JwioqXWZa7x1uycXAygkftsVcouXeji7K8YZp5QK8DHkN+ dxiEKOFMUu9x0JPJ3lQWlQpwp/fvAdgK2QBiUS6iel4jZhVEnJdB7GV3Z0bJqnAJPrwm vPO+9BkPlc3ZwBg2NO3gZmbE/HgX1Obq1QZriOXmadQEPu52/Vc5pOyR97oMC1JICEE3 vKdRZ453Skq+dkbizVTP/A8dhny2Hsk9ZG6Wgf+IOdQsZZ+7m03/jraK8GTisyvF/tok 2k6Q== 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:to:from :dkim-signature; bh=Rcy6tJPZhV/oL1h74tlFxUFs2PlGqEM/vFlNrg2lUyY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=rqS3lXeahwaGqSz3ZOJUkRJfNfFhNeAx2az21+iPsrHRE/+4wgs2M8E6/Pphik2xQv ktwyO/0vSveLhaLTepOLmckApf0xfIQ7/bhRmqQpJOgEr8SoMhk27lBHEAG8D/7KPN9R ei0hoTB39D80kzOorUneRd+i2XuMXzZ1o7KTb9xesuphMCi4wlWfmJm6xKvCarHReK5p tkuGj10zt1Ayn1qjFoV/WXhnDF488Ecnj4QMPaGl8ndjhmocVXcq2tB+7moSs2H5CGou Jh9L7RR7256b9MC65L6n24CKMtQjrExtP/soZN3xkhlG64mWKhCc9zJt2kcQ3vI0ZLPK 9qUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fZfQSfZu; 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 ot13-20020a05620a818d00b007740be11648si6204306qkn.38.2023.11.06.18.54.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:54:26 -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=fZfQSfZu; 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 1r0C9A-0008FL-0H; Mon, 06 Nov 2023 21:48:56 -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 1r0C96-0008B2-Dv for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:52 -0500 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C94-0005qR-VR for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:52 -0500 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6c33ab26dddso3701205b3a.0 for ; Mon, 06 Nov 2023 18:48:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325329; x=1699930129; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Rcy6tJPZhV/oL1h74tlFxUFs2PlGqEM/vFlNrg2lUyY=; b=fZfQSfZu0EWRt9boml5U2qnQAlOQunb0aclszvCLDlihFsFuq2TUY3xbxAqlvQn+Gb 4IzbudUGiLHL8LnvCyWQfzVV8SgrtOReKsFuDRVvVlXWEpmutjisTLBe/SPWxBcz4Uk0 Cz/OXhjn/t2SIZebYJBOteOgufnEdKKXpoOFlO7Oq0LYiJJbmbrMO62q0+fTX0usXTOy OMInYQhyn37X1yMr3UKMqcbj+YHXBVPq8P63xKlij/by8FLl9ZZMHG8t0Zzsq14n+d6B 6IqUWvwslE6UC+MA9PAPg5SNIb/6EzNqowfuwYKs4TOUaN8scs0/ot9xXpPY3bwHRzg2 qyiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325329; x=1699930129; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Rcy6tJPZhV/oL1h74tlFxUFs2PlGqEM/vFlNrg2lUyY=; b=WU2HWaz+B/ZsusucCWt9aRKAqj03+kgyYX3tXLe4F+jKVUbEgUp0KqWR5GKapGe5Ki t4rUlEyVEd15/LestqbMnsQyXrYC0Z6MkK/aCTBUaMWWXU9ApjtvUMA6HzPUiC0I6cqQ vzjTBQ2Dx6H4qFiQowd4BvW04g1DR9yI64eOgF5bbpmUqson8SkaRAJW9dVnu1qVwBUs tT+65pjM6GaVv+I9BBukei6YG1giNDi9FUSTMYcqM+5xQ42/zIhXx6V/4x0h8f20ruJ+ m62c/g65N9vaGMYHQh16wwfd31x5J7+XMLJRPOFUD1hmGggnuTArkKgGsx228w4s3fXc W3dg== X-Gm-Message-State: AOJu0YzIjH2wUvBVRKz2ZBsFLFdC8sSHM/O2OGdZ3pjHenvOv5QKxWxc +2Wmz+9kIYR22MRHK+cJEBukAmPudGUTvGbUdOw= X-Received: by 2002:a05:6a00:280a:b0:6c2:cf23:3e2a with SMTP id bl10-20020a056a00280a00b006c2cf233e2amr12993220pfb.9.1699325329392; Mon, 06 Nov 2023 18:48:49 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 07/35] accel/tcg: Remove redundant case in store_atom_16 Date: Mon, 6 Nov 2023 18:48:14 -0800 Message-Id: <20231107024842.7650-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-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, 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 We handled the HAVE_ATOMIC128_RW case with atomic16_set at the top of the function; the only thing left for a host without that support is to fall through to cpu_loop_exit_atomic. Signed-off-by: Richard Henderson Message-Id: <20230916220151.526140-7-richard.henderson@linaro.org> --- accel/tcg/ldst_atomicity.c.inc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/accel/tcg/ldst_atomicity.c.inc b/accel/tcg/ldst_atomicity.c.inc index 1cf5b92166..e8f97506fa 100644 --- a/accel/tcg/ldst_atomicity.c.inc +++ b/accel/tcg/ldst_atomicity.c.inc @@ -1103,10 +1103,6 @@ static void store_atom_16(CPUState *cpu, uintptr_t ra, } break; case MO_128: - if (HAVE_ATOMIC128_RW) { - atomic16_set(pv, val); - return; - } break; default: g_assert_not_reached(); From patchwork Tue Nov 7 02:48:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741759 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415662wrr; Mon, 6 Nov 2023 18:53:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IE36rsr2/lZ4FjqtPuTwYEoPoYECzBM2KSF7t7loeWWQ8P4K3WB4Igyif5EUZhX3wnXffZb X-Received: by 2002:a05:6214:21ce:b0:65d:56c:5177 with SMTP id d14-20020a05621421ce00b0065d056c5177mr33005302qvh.57.1699325630407; Mon, 06 Nov 2023 18:53:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325630; cv=none; d=google.com; s=arc-20160816; b=vEEr54bMb6gTBpU4tb2ftMbro0QBBLf4TN47c3yaP4hOT11Ua/LEwfsvQuuhI6lAd2 pfNGyUGtMu3a6I/MdpZX+0sF9gm6wzchT03v+aysozJ+AcYc02zVU7eX+dSNW9HI6bU3 MiSjdD5JmGeLNWZhVZp4qFW0blm14mI1tbhcubXAXACr2sgAl9HzEQmAsC0Am4JPmtVh PcwBNlzXumVQPE5SAPkVNLmYsG9s8lZrTUvcZDjwLXkXPK++rvI9iRTSodpTni2JzLij AN4dR/PWzi0KhCex3iWZaNdAe7FPLjlJb2Ntcm6ocBP3lOWMud9RcYkNVTjr8rkkPnf6 /I1A== 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:to:from :dkim-signature; bh=IUHz5LdFJfuVGFZ9kE+P0nwAIXfhY4T9R1W1nItwZn8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=NGI4kKuY5B2NDgaF+66x57kxxVIxQlf8f6++32WmqCfmciPqO5VNkxsG6VyFc7L9Ez sJ2ecLMrd29ULzjjcxAGGZlFL42j1XWJEV3MKwVHirl7H9C2MDB71pc7GvWt5dg7WH/p fsxs5cGwgykmU0yXRIoGWGiEllOvQbCbh1N9xAoC4Z/zu7ZvUQX6gO4gYmLOhb1b38TS g4T0UBBjf+T0XMfKGMl09K+E8uVu+4+Ja03suj8N7wasYFXXNSDNeIY8MbEBAPYX3Ms/ FbLu1SBpKQNe5Q18pnyuH/69AFgBxv9TE5qA1UyGmnC9AAsDmZtprZzLfkhNGKtrKdHz 99GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lrFaU5LR; 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 l16-20020a056214029000b0065b10dbcd58si6292588qvv.9.2023.11.06.18.53.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:53:50 -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=lrFaU5LR; 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 1r0C98-0008EM-HB; Mon, 06 Nov 2023 21:48:54 -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 1r0C96-0008BH-RP for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:52 -0500 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C95-0005qf-8d for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:52 -0500 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3b58d96a3bbso2020582b6e.1 for ; Mon, 06 Nov 2023 18:48:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325330; x=1699930130; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=IUHz5LdFJfuVGFZ9kE+P0nwAIXfhY4T9R1W1nItwZn8=; b=lrFaU5LR3SIRW81Cy1YTTeGcZf8hi+ixnat+zh2czf4Iq5EWjwA6ey3L3Y35t6XLwP DEDs4qwFYvhbSUL43YMpKNamk1t7iNDx+CAkwm7z1k/tAi3B07La5kisP0ekX6hXZM9X NdpWCKkuSDPmCS+n0MzW+iQ1EAZ2dn0loDIQqLbus+9FCbKMxmbjVGEL7JL99LApCdQJ 8gyxnvnLqlx94z4MRyWhVDG/ZG65/wU+VNQMzJbxeaaDtJircCQCM8gX0atLhGtYQZIS zwZZXPS+I2n9NPX77ucJmQi3YWkgwzMqOKcwiz20ptwU5VFIPV3cfBTyMR4wro0rhYKS IbkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325330; x=1699930130; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IUHz5LdFJfuVGFZ9kE+P0nwAIXfhY4T9R1W1nItwZn8=; b=YZfmKa1zaXbqmeo2Zd9UPOiOjpaIMM1sHT/crEcf4cXjEzqtgp18/od/hw9n39L88w Rg/0/59LRqDFDKlHByf0k1F4JIVCp4WDUldG0xkWFwAWFTp1vdT6sF9OqI0mgqF8H8tl XSrp+5bKVf27hCJOgfyx3puMsJhtCctxVz7BrXh2I0lE3ez8Bc4XnWd1fMVyhQYI5O/f Vip6n/x1fovbjFDohaDtS+TQ2k0JfxZ424/YHOpYHLTiU4g60JbjB0+mFV0Z761xrTRo uTPdK/W/3H19lqqB2SMAOBkY1idd3aRm9ms1umbdPLPQ0MOBuxK/Yq3SNFhoJgUdQY6Y puCg== X-Gm-Message-State: AOJu0YwtEURs/aHKvbJ/qvxkYWVN6Y+6NYmUji/25d8nq1jldueNIkGn DfBlE3lCbZa+u8PfubjG0weOT6ovtrqftZkx51g= X-Received: by 2002:aca:1917:0:b0:3b2:ddc0:ac9c with SMTP id l23-20020aca1917000000b003b2ddc0ac9cmr29388440oii.39.1699325330137; Mon, 06 Nov 2023 18:48:50 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 08/35] accel/tcg: Fix condition for store_atom_insert_al16 Date: Mon, 6 Nov 2023 18:48:15 -0800 Message-Id: <20231107024842.7650-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::232; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x232.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 Store bytes under a mask is fundamentally a cmpxchg, not a straight store. Use HAVE_CMPXCHG128 instead of HAVE_ATOMIC128_RW. Signed-off-by: Richard Henderson Message-Id: <20230916220151.526140-8-richard.henderson@linaro.org> --- accel/tcg/cputlb.c | 2 +- accel/tcg/ldst_atomicity.c.inc | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 13986820fe..f35c5f359b 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -2691,7 +2691,7 @@ static uint64_t do_st16_leN(CPUState *cpu, MMULookupPageData *p, case MO_ATOM_WITHIN16_PAIR: /* Since size > 8, this is the half that must be atomic. */ - if (!HAVE_ATOMIC128_RW) { + if (!HAVE_CMPXCHG128) { cpu_loop_exit_atomic(cpu, ra); } return store_whole_le16(p->haddr, p->size, val_le); diff --git a/accel/tcg/ldst_atomicity.c.inc b/accel/tcg/ldst_atomicity.c.inc index e8f97506fa..33a04dec52 100644 --- a/accel/tcg/ldst_atomicity.c.inc +++ b/accel/tcg/ldst_atomicity.c.inc @@ -825,7 +825,7 @@ static uint64_t store_whole_le16(void *pv, int size, Int128 val_le) int sh = o * 8; Int128 m, v; - qemu_build_assert(HAVE_ATOMIC128_RW); + qemu_build_assert(HAVE_CMPXCHG128); /* Like MAKE_64BIT_MASK(0, sz), but larger. */ if (sz <= 64) { @@ -887,7 +887,7 @@ static void store_atom_2(CPUState *cpu, uintptr_t ra, return; } } else if ((pi & 15) == 7) { - if (HAVE_ATOMIC128_RW) { + if (HAVE_CMPXCHG128) { Int128 v = int128_lshift(int128_make64(val), 56); Int128 m = int128_lshift(int128_make64(0xffff), 56); store_atom_insert_al16(pv - 7, v, m); @@ -956,7 +956,7 @@ static void store_atom_4(CPUState *cpu, uintptr_t ra, return; } } else { - if (HAVE_ATOMIC128_RW) { + if (HAVE_CMPXCHG128) { store_whole_le16(pv, 4, int128_make64(cpu_to_le32(val))); return; } @@ -1021,7 +1021,7 @@ static void store_atom_8(CPUState *cpu, uintptr_t ra, } break; case MO_64: - if (HAVE_ATOMIC128_RW) { + if (HAVE_CMPXCHG128) { store_whole_le16(pv, 8, int128_make64(cpu_to_le64(val))); return; } @@ -1076,7 +1076,7 @@ static void store_atom_16(CPUState *cpu, uintptr_t ra, } break; case -MO_64: - if (HAVE_ATOMIC128_RW) { + if (HAVE_CMPXCHG128) { uint64_t val_le; int s2 = pi & 15; int s1 = 16 - s2; From patchwork Tue Nov 7 02:48:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741768 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415921wrr; Mon, 6 Nov 2023 18:55:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IHoQSavVgoZuaEu+DwtUa201zfINF3EU3MrmbKLn7ZUEi1wEs7gOV3u5F5FUj6w69R9IHwF X-Received: by 2002:a05:620a:1662:b0:777:7314:ee19 with SMTP id d2-20020a05620a166200b007777314ee19mr28279957qko.21.1699325700426; Mon, 06 Nov 2023 18:55:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325700; cv=none; d=google.com; s=arc-20160816; b=iODVeCy4vJ5XBw1EnqCRMt2/FzT4cBEJtFrFACCr9p95vamhWIiK3pUTsWC3/lGmXO VeUaOCuejpQ7zOa9KWg+4NHyAPxEgAP1xeebnQLGkgI9M5DqbNIeTwmwf/07pC5kmQte xbAuRQUWqXyI8daCzBnyjHv08bVS1U0FVuMNXPKF0EtLJuzFMaKgSqhpTfKlNJvogv1S e27Grtvc2JyPrdXtS5ZrEvxTh/eOczV5Iwt6b6qTrVJbNvcMR6zJKGhP+m8ruPlXpAhc GHav5Rlo52IkICmof5XrwVTiU1PGFytajxvSios5Nobe5bBtkebk78k1HA3sAlLylHRI eSTA== 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:to:from :dkim-signature; bh=rIcivD5Ogd1WlEn9ayO0cPwZ7+K+X3MtPYioN7oPrmc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=RoU7XLrzwPkJNAFDEBDagP8iyo8TNoEZ4wTisjEqYkIzD5IRdDuwm3qObZD786rhwu BrEPoHolTb5nyW5k1rsYRI2XCPWiCZN7J0zIqKYbJxHsDGmBj/CMaSU5fy0sTLAzGq5b /p7IO+8NpUJKOzxhQznNoWP6yhFIWdsydI9+A1id0KEdl3GozHV4ztuBDf6zSHLub3u7 qQwKkQufqJfwYVvfACvTCACMD0wn83Jhsimu8RU++TEXtGvIEe9oC3oxOm+g9OB2WO3z 4tCPsw2iP6UBpct0UtpqtX3u9jO+fTQovlVsiP+lCl9suKmZYpVEve9I8aQ5uU4ncHRg MTzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oc99CKZS; 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 r9-20020a05620a298900b007788d7c09f8si6835299qkp.573.2023.11.06.18.55.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:55:00 -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=oc99CKZS; 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 1r0C9A-0008Fy-Ux; Mon, 06 Nov 2023 21:48:56 -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 1r0C98-0008EQ-Pr for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:54 -0500 Received: from mail-vs1-xe2f.google.com ([2607:f8b0:4864:20::e2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C96-0005qq-4i for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:54 -0500 Received: by mail-vs1-xe2f.google.com with SMTP id ada2fe7eead31-45ef8c21e8aso832098137.1 for ; Mon, 06 Nov 2023 18:48:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325331; x=1699930131; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=rIcivD5Ogd1WlEn9ayO0cPwZ7+K+X3MtPYioN7oPrmc=; b=oc99CKZSj4RZOhk1jaouIrMVMEDENov+FjfCDVb95lcrqZXWtYAVhqIsYbU5TCsZCC ZTnlpVkSJYnljuS34myqWCkXUy79pkWibLSpF21xqATephnsTuNT6JveaDd65LoDX8Q6 EKU1VXXDot7tluv0Sb0G35Ir3fZwXikTMz/M8YUgA0fWWPYprHLLc1FrMvHa6PtdZqQ9 /HdDuVQ2uHJ/BlraR3t4UIFds/TQwSq3NAzRIQlmZnL9YLlwhenImJhbH0VgvAytYbqX IFwo6S+LOspWLrYNuiVg/yPxjTgTsAR5zH5ibQo0TBp2R6OCxR7cvL05pWdz6OGruGTl 4cWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325331; x=1699930131; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rIcivD5Ogd1WlEn9ayO0cPwZ7+K+X3MtPYioN7oPrmc=; b=Y1YYypb8cVPesFQluukQ4S6T74tEOUJGksKcnneLeyOBbhrvVZP1xmUPI59Y+A6aL/ TWRllJsjeqfiIbBmFtCP+nRQr+739JBOCGDA6oXeirAaIL8eoXKG9JjdabGI+r+Y44c4 do5wpCBVjLUM6IBS0+jxRjwJk+G4fWYUZgRW/n7Qz03SX8kyEKPZUmvQG2CaMSNFXoss 2CpIO6znCXqOLsvxLb+rh+0JeTZIxzGAWaECY2PUqbiF0jnSwJ4UtbvpcuqEuySYQwAs bZXKslqICkiKyx7rDZTMrBDbmvndGxkc0VVxzRuwjPoAJ28PQQGyIZu53ei4Y6xTOIBq FANA== X-Gm-Message-State: AOJu0YxhmrIuxJgqIwkUQzurHoiducDOk7JYeMRzx/cL/briv2YzzeB5 SQQv5XSZnIln1jshJQ4SxrDKel8rbwmadWNEqXM= X-Received: by 2002:a05:6102:4717:b0:45f:5d1:9c62 with SMTP id ei23-20020a056102471700b0045f05d19c62mr5820390vsb.19.1699325330856; Mon, 06 Nov 2023 18:48:50 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:50 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 09/35] tcg: Mark tcg_gen_op* as noinline Date: Mon, 6 Nov 2023 18:48:16 -0800 Message-Id: <20231107024842.7650-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::e2f; envelope-from=richard.henderson@linaro.org; helo=mail-vs1-xe2f.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 Encourage the compiler to tail-call rather than inline across the dozens of opcode expanders. Signed-off-by: Richard Henderson Message-Id: <20231029210848.78234-2-richard.henderson@linaro.org> --- tcg/tcg-op.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 828eb9ee46..9aed19e957 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -31,20 +31,26 @@ #include "tcg-internal.h" -void tcg_gen_op1(TCGOpcode opc, TCGArg a1) +/* + * Encourage the compiler to tail-call to a function, rather than inlining. + * Minimizes code size across 99 bottles of beer on the wall. + */ +#define NI __attribute__((noinline)) + +void NI tcg_gen_op1(TCGOpcode opc, TCGArg a1) { TCGOp *op = tcg_emit_op(opc, 1); op->args[0] = a1; } -void tcg_gen_op2(TCGOpcode opc, TCGArg a1, TCGArg a2) +void NI tcg_gen_op2(TCGOpcode opc, TCGArg a1, TCGArg a2) { TCGOp *op = tcg_emit_op(opc, 2); op->args[0] = a1; op->args[1] = a2; } -void tcg_gen_op3(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3) +void NI tcg_gen_op3(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3) { TCGOp *op = tcg_emit_op(opc, 3); op->args[0] = a1; @@ -52,7 +58,7 @@ void tcg_gen_op3(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3) op->args[2] = a3; } -void tcg_gen_op4(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, TCGArg a4) +void NI tcg_gen_op4(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, TCGArg a4) { TCGOp *op = tcg_emit_op(opc, 4); op->args[0] = a1; @@ -61,8 +67,8 @@ void tcg_gen_op4(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, TCGArg a4) op->args[3] = a4; } -void tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, - TCGArg a4, TCGArg a5) +void NI tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, + TCGArg a4, TCGArg a5) { TCGOp *op = tcg_emit_op(opc, 5); op->args[0] = a1; @@ -72,8 +78,8 @@ void tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, op->args[4] = a5; } -void tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, - TCGArg a4, TCGArg a5, TCGArg a6) +void NI tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, + TCGArg a4, TCGArg a5, TCGArg a6) { TCGOp *op = tcg_emit_op(opc, 6); op->args[0] = a1; From patchwork Tue Nov 7 02:48:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741758 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415648wrr; Mon, 6 Nov 2023 18:53:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHaPfPuxWfhwnDsw1lvE2U4DbrVh9GvhWLtEe7xFK0+8EiQdYlDgQOvkhy8tNddFBCHw96f X-Received: by 2002:ad4:5f4e:0:b0:66d:6705:5c50 with SMTP id p14-20020ad45f4e000000b0066d67055c50mr37078656qvg.44.1699325625650; Mon, 06 Nov 2023 18:53:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325625; cv=none; d=google.com; s=arc-20160816; b=hNASRUPUwCz2y50iiThJt4oARSveKewTgh0BlYxkKEE3KTLEu8M9w/9u5wSnqk5AYT sCAUyMeuUMJImm8I6NATiUuj3pKK8bW7jqe1TJRTP1r5bHDV64IuA+gm3QP103xmtD2B kE3DXTMWsZAZVXpKKuUDw+/MrxyR6D2NTT/xOuE8NqnSdm8MtQkMtmqR1Q7F1XkZX3ei yQOfOtEKEHIP1y1X9nPbJBMDykRSfKzALmQQm3BPMQclz5ZNGLzhYLA+VFN9UfyFDV3n XTtrOm/ZcA7gMdguy8Y65tlTR7Uc6Wv7OWfdPz2NXDfh/hTxuQwu++4NccTpfz3GIgMI O0Sg== 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:to:from :dkim-signature; bh=WTj5n1MSXEgec5CmWkyLjNpfK+jR2v5ZweQGOMmio/I=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=m8sotiqgQ9cgDuiqpgEVJWVzGejWKiivgZEfgiTVo6y35Sw3ETSJXhdsyu1e5FUxvI v6i2lxZM+IqFR8x6qwZ3GL04kBRPI/xyUP/AiyNUigd5f/81IJKfN1Ds7/w5Mpp8WIp0 03bf9G+H5qqHGmpVUJm3vIEAeqCaPiXJH+QLZfe1FU6u8HF5pYsSRU2uzxM5M63rNrNv NbhX+r/+x5kk3yDI0hRuSjzuEshmEqiIX58WGPQBkPSCq1t9hrxw0fTTJoQ+xL1T6iOM eXVgoAgkcU7xzX+ncp3Imo6eQlShIgG/HE+Ox5iWGE6i4HP5npSbQNjBB+DSX/1O59y5 ImuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HAl7xLsH; 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 e7-20020ad450c7000000b0066d0edaf8fasi6467881qvq.235.2023.11.06.18.53.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:53:45 -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=HAl7xLsH; 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 1r0C9C-0008GS-30; Mon, 06 Nov 2023 21:48:58 -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 1r0C99-0008Ev-A5 for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:55 -0500 Received: from mail-oi1-x22f.google.com ([2607:f8b0:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C96-0005qw-TJ for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:55 -0500 Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3b2e72fe47fso3317636b6e.1 for ; Mon, 06 Nov 2023 18:48:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325332; x=1699930132; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=WTj5n1MSXEgec5CmWkyLjNpfK+jR2v5ZweQGOMmio/I=; b=HAl7xLsH8BSMcdukg+XqzxOHW7z9nSlaj4kargUq1/HCMf5XFnd3yM1sG6wr08qLhQ DP5HvF6GUPUKOgESu0iA62OzZPsPodY+VAyQmJOUb9H3n+PPyA2LXpwIki1vZi3Fe7q1 7eGwKGIm2yt2ylI3cdSXsOFirMN1VoYWJmucXv/JqzuSlCvXUxiu9sjd4Jsz0Fe9aKz0 s7rqXBtSo2JQe8wDroKgYGmEIlZcaKqIpsqtYtRVKJdJwjK+Ags6ZnKkLs+Ys9pF2Qy7 iC+RfCO1BWeEpqCSCAgx/P8zJsnp/CF8VV4/Cs9PgD6u5HDoGfZa8KVWN2qudz6aBAOq EBhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325332; x=1699930132; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WTj5n1MSXEgec5CmWkyLjNpfK+jR2v5ZweQGOMmio/I=; b=gC6/8k3/TtNJ25m3r80+DqyOhFiQ4tBisAXzO91pOaAijnqkIWUXBixu4W2RrkZ7KM 5HUHzxM5HLlM/uFGSggAXf9il2r/fjrqdR9OJc6JfzxGTdG9FbF+2d17knDQF3bLN8FR FPBSiuM6qmjm2lGuEvm/10+1cXYV2IJronpbKIkXVtxVHN6r0ZuVpe0de5rkKCgCv1JH s80tQDfPvezPXZWN3iKR8ohB/scx9BLNE2z/QApEXS5nl7DKsWeaGQUAD5Xl5rZ7bmdR gD+9/mS6b1qCi8KMOtkdyFdr2HcD+k7/wjqnaxXT5NsW+z83D0TWKrzZpB1uXeiDjtmT YGpg== X-Gm-Message-State: AOJu0YwIHRqOeSBbj+uawGK7sw/mwJIjbanzXxoWDcrh2ZQZzmluNwI3 sclxcWH+SaBADRBC3iwQ4zuneU7C6kDKnRpPp+s= X-Received: by 2002:a05:6808:655:b0:3b2:db86:209 with SMTP id z21-20020a056808065500b003b2db860209mr27052160oih.38.1699325331737; Mon, 06 Nov 2023 18:48:51 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:51 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 10/35] tcg: Move tcg_gen_op* out of line Date: Mon, 6 Nov 2023 18:48:17 -0800 Message-Id: <20231107024842.7650-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22f; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22f.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 In addition to moving out of line, with CONFIG_DEBUG_TCG mark them all noinline. Signed-off-by: Richard Henderson Message-Id: <20231029210848.78234-3-richard.henderson@linaro.org> --- include/tcg/tcg-op-common.h | 252 +++++++----------------------------- tcg/tcg-op.c | 208 +++++++++++++++++++++++++++++ 2 files changed, 252 insertions(+), 208 deletions(-) diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h index 677aea6dd1..e093f541a7 100644 --- a/include/tcg/tcg-op-common.h +++ b/include/tcg/tcg-op-common.h @@ -25,214 +25,50 @@ void vec_gen_2(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg); void vec_gen_3(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg, TCGArg); void vec_gen_4(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg, TCGArg, TCGArg); -static inline void tcg_gen_op1_i32(TCGOpcode opc, TCGv_i32 a1) -{ - tcg_gen_op1(opc, tcgv_i32_arg(a1)); -} - -static inline void tcg_gen_op1_i64(TCGOpcode opc, TCGv_i64 a1) -{ - tcg_gen_op1(opc, tcgv_i64_arg(a1)); -} - -static inline void tcg_gen_op1i(TCGOpcode opc, TCGArg a1) -{ - tcg_gen_op1(opc, a1); -} - -static inline void tcg_gen_op2_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2) -{ - tcg_gen_op2(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2)); -} - -static inline void tcg_gen_op2_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2) -{ - tcg_gen_op2(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2)); -} - -static inline void tcg_gen_op2i_i32(TCGOpcode opc, TCGv_i32 a1, TCGArg a2) -{ - tcg_gen_op2(opc, tcgv_i32_arg(a1), a2); -} - -static inline void tcg_gen_op2i_i64(TCGOpcode opc, TCGv_i64 a1, TCGArg a2) -{ - tcg_gen_op2(opc, tcgv_i64_arg(a1), a2); -} - -static inline void tcg_gen_op2ii(TCGOpcode opc, TCGArg a1, TCGArg a2) -{ - tcg_gen_op2(opc, a1, a2); -} - -static inline void tcg_gen_op3_i32(TCGOpcode opc, TCGv_i32 a1, - TCGv_i32 a2, TCGv_i32 a3) -{ - tcg_gen_op3(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), tcgv_i32_arg(a3)); -} - -static inline void tcg_gen_op3_i64(TCGOpcode opc, TCGv_i64 a1, - TCGv_i64 a2, TCGv_i64 a3) -{ - tcg_gen_op3(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), tcgv_i64_arg(a3)); -} - -static inline void tcg_gen_op3i_i32(TCGOpcode opc, TCGv_i32 a1, - TCGv_i32 a2, TCGArg a3) -{ - tcg_gen_op3(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), a3); -} - -static inline void tcg_gen_op3i_i64(TCGOpcode opc, TCGv_i64 a1, - TCGv_i64 a2, TCGArg a3) -{ - tcg_gen_op3(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), a3); -} - -static inline void tcg_gen_ldst_op_i32(TCGOpcode opc, TCGv_i32 val, - TCGv_ptr base, TCGArg offset) -{ - tcg_gen_op3(opc, tcgv_i32_arg(val), tcgv_ptr_arg(base), offset); -} - -static inline void tcg_gen_ldst_op_i64(TCGOpcode opc, TCGv_i64 val, - TCGv_ptr base, TCGArg offset) -{ - tcg_gen_op3(opc, tcgv_i64_arg(val), tcgv_ptr_arg(base), offset); -} - -static inline void tcg_gen_op4_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGv_i32 a3, TCGv_i32 a4) -{ - tcg_gen_op4(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), - tcgv_i32_arg(a3), tcgv_i32_arg(a4)); -} - -static inline void tcg_gen_op4_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGv_i64 a3, TCGv_i64 a4) -{ - tcg_gen_op4(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), - tcgv_i64_arg(a3), tcgv_i64_arg(a4)); -} - -static inline void tcg_gen_op4i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGv_i32 a3, TCGArg a4) -{ - tcg_gen_op4(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), - tcgv_i32_arg(a3), a4); -} - -static inline void tcg_gen_op4i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGv_i64 a3, TCGArg a4) -{ - tcg_gen_op4(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), - tcgv_i64_arg(a3), a4); -} - -static inline void tcg_gen_op4ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGArg a3, TCGArg a4) -{ - tcg_gen_op4(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), a3, a4); -} - -static inline void tcg_gen_op4ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGArg a3, TCGArg a4) -{ - tcg_gen_op4(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), a3, a4); -} - -static inline void tcg_gen_op5_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGv_i32 a3, TCGv_i32 a4, TCGv_i32 a5) -{ - tcg_gen_op5(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), - tcgv_i32_arg(a3), tcgv_i32_arg(a4), tcgv_i32_arg(a5)); -} - -static inline void tcg_gen_op5_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGv_i64 a3, TCGv_i64 a4, TCGv_i64 a5) -{ - tcg_gen_op5(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), - tcgv_i64_arg(a3), tcgv_i64_arg(a4), tcgv_i64_arg(a5)); -} - -static inline void tcg_gen_op5i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGv_i32 a3, TCGv_i32 a4, TCGArg a5) -{ - tcg_gen_op5(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), - tcgv_i32_arg(a3), tcgv_i32_arg(a4), a5); -} - -static inline void tcg_gen_op5i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGv_i64 a3, TCGv_i64 a4, TCGArg a5) -{ - tcg_gen_op5(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), - tcgv_i64_arg(a3), tcgv_i64_arg(a4), a5); -} - -static inline void tcg_gen_op5ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGv_i32 a3, TCGArg a4, TCGArg a5) -{ - tcg_gen_op5(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), - tcgv_i32_arg(a3), a4, a5); -} - -static inline void tcg_gen_op5ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGv_i64 a3, TCGArg a4, TCGArg a5) -{ - tcg_gen_op5(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), - tcgv_i64_arg(a3), a4, a5); -} - -static inline void tcg_gen_op6_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGv_i32 a3, TCGv_i32 a4, - TCGv_i32 a5, TCGv_i32 a6) -{ - tcg_gen_op6(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), - tcgv_i32_arg(a3), tcgv_i32_arg(a4), tcgv_i32_arg(a5), - tcgv_i32_arg(a6)); -} - -static inline void tcg_gen_op6_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGv_i64 a3, TCGv_i64 a4, - TCGv_i64 a5, TCGv_i64 a6) -{ - tcg_gen_op6(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), - tcgv_i64_arg(a3), tcgv_i64_arg(a4), tcgv_i64_arg(a5), - tcgv_i64_arg(a6)); -} - -static inline void tcg_gen_op6i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGv_i32 a3, TCGv_i32 a4, - TCGv_i32 a5, TCGArg a6) -{ - tcg_gen_op6(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), - tcgv_i32_arg(a3), tcgv_i32_arg(a4), tcgv_i32_arg(a5), a6); -} - -static inline void tcg_gen_op6i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGv_i64 a3, TCGv_i64 a4, - TCGv_i64 a5, TCGArg a6) -{ - tcg_gen_op6(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), - tcgv_i64_arg(a3), tcgv_i64_arg(a4), tcgv_i64_arg(a5), a6); -} - -static inline void tcg_gen_op6ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGv_i32 a3, TCGv_i32 a4, - TCGArg a5, TCGArg a6) -{ - tcg_gen_op6(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), - tcgv_i32_arg(a3), tcgv_i32_arg(a4), a5, a6); -} - -static inline void tcg_gen_op6ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGv_i64 a3, TCGv_i64 a4, - TCGArg a5, TCGArg a6) -{ - tcg_gen_op6(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), - tcgv_i64_arg(a3), tcgv_i64_arg(a4), a5, a6); -} - +void tcg_gen_op1_i32(TCGOpcode, TCGv_i32); +void tcg_gen_op1_i64(TCGOpcode, TCGv_i64); +void tcg_gen_op1i(TCGOpcode, TCGArg); +void tcg_gen_op2_i32(TCGOpcode, TCGv_i32, TCGv_i32); +void tcg_gen_op2_i64(TCGOpcode, TCGv_i64, TCGv_i64); +void tcg_gen_op2i_i32(TCGOpcode, TCGv_i32, TCGArg); +void tcg_gen_op2i_i64(TCGOpcode, TCGv_i64, TCGArg); +void tcg_gen_op2ii(TCGOpcode, TCGArg, TCGArg); +void tcg_gen_op3_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32); +void tcg_gen_op3_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64); +void tcg_gen_op3i_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGArg); +void tcg_gen_op3i_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGArg); +void tcg_gen_ldst_op_i32(TCGOpcode, TCGv_i32, TCGv_ptr, TCGArg); +void tcg_gen_ldst_op_i64(TCGOpcode, TCGv_i64, TCGv_ptr, TCGArg); +void tcg_gen_op4_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, TCGv_i32); +void tcg_gen_op4_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64); +void tcg_gen_op4i_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, TCGArg); +void tcg_gen_op4i_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, TCGArg); +void tcg_gen_op4ii_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGArg, TCGArg); +void tcg_gen_op4ii_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGArg, TCGArg); +void tcg_gen_op5_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, + TCGv_i32, TCGv_i32); +void tcg_gen_op5_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, + TCGv_i64, TCGv_i64); +void tcg_gen_op5i_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, + TCGv_i32, TCGArg); +void tcg_gen_op5i_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, + TCGv_i64, TCGArg); +void tcg_gen_op5ii_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, + TCGArg, TCGArg); +void tcg_gen_op5ii_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, + TCGArg, TCGArg); +void tcg_gen_op6_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, + TCGv_i32, TCGv_i32, TCGv_i32); +void tcg_gen_op6_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, + TCGv_i64, TCGv_i64, TCGv_i64); +void tcg_gen_op6i_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, + TCGv_i32, TCGv_i32, TCGArg); +void tcg_gen_op6i_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, + TCGv_i64, TCGv_i64, TCGArg); +void tcg_gen_op6ii_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, + TCGv_i32, TCGArg, TCGArg); +void tcg_gen_op6ii_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, + TCGv_i64, TCGArg, TCGArg); /* Generic ops. */ diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 9aed19e957..6c826b46b0 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -90,6 +90,214 @@ void NI tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, op->args[5] = a6; } +/* + * With CONFIG_DEBUG_TCG, tcgv_*_tmp via tcgv_*_arg, is an out-of-line + * assertion check. Force tail calls to avoid too much code expansion. + */ +#ifdef CONFIG_DEBUG_TCG +# define DNI NI +#else +# define DNI +#endif + +void DNI tcg_gen_op1_i32(TCGOpcode opc, TCGv_i32 a1) +{ + tcg_gen_op1(opc, tcgv_i32_arg(a1)); +} + +void DNI tcg_gen_op1_i64(TCGOpcode opc, TCGv_i64 a1) +{ + tcg_gen_op1(opc, tcgv_i64_arg(a1)); +} + +void DNI tcg_gen_op1i(TCGOpcode opc, TCGArg a1) +{ + tcg_gen_op1(opc, a1); +} + +void DNI tcg_gen_op2_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2) +{ + tcg_gen_op2(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2)); +} + +void DNI tcg_gen_op2_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2) +{ + tcg_gen_op2(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2)); +} + +void DNI tcg_gen_op2i_i32(TCGOpcode opc, TCGv_i32 a1, TCGArg a2) +{ + tcg_gen_op2(opc, tcgv_i32_arg(a1), a2); +} + +void DNI tcg_gen_op2i_i64(TCGOpcode opc, TCGv_i64 a1, TCGArg a2) +{ + tcg_gen_op2(opc, tcgv_i64_arg(a1), a2); +} + +void DNI tcg_gen_op2ii(TCGOpcode opc, TCGArg a1, TCGArg a2) +{ + tcg_gen_op2(opc, a1, a2); +} + +void DNI tcg_gen_op3_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, TCGv_i32 a3) +{ + tcg_gen_op3(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), tcgv_i32_arg(a3)); +} + +void DNI tcg_gen_op3_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, TCGv_i64 a3) +{ + tcg_gen_op3(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), tcgv_i64_arg(a3)); +} + +void DNI tcg_gen_op3i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, TCGArg a3) +{ + tcg_gen_op3(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), a3); +} + +void DNI tcg_gen_op3i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, TCGArg a3) +{ + tcg_gen_op3(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), a3); +} + +void DNI tcg_gen_ldst_op_i32(TCGOpcode opc, TCGv_i32 val, + TCGv_ptr base, TCGArg offset) +{ + tcg_gen_op3(opc, tcgv_i32_arg(val), tcgv_ptr_arg(base), offset); +} + +void DNI tcg_gen_ldst_op_i64(TCGOpcode opc, TCGv_i64 val, + TCGv_ptr base, TCGArg offset) +{ + tcg_gen_op3(opc, tcgv_i64_arg(val), tcgv_ptr_arg(base), offset); +} + +void DNI tcg_gen_op4_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGv_i32 a3, TCGv_i32 a4) +{ + tcg_gen_op4(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), + tcgv_i32_arg(a3), tcgv_i32_arg(a4)); +} + +void DNI tcg_gen_op4_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, + TCGv_i64 a3, TCGv_i64 a4) +{ + tcg_gen_op4(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), + tcgv_i64_arg(a3), tcgv_i64_arg(a4)); +} + +void DNI tcg_gen_op4i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGv_i32 a3, TCGArg a4) +{ + tcg_gen_op4(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), + tcgv_i32_arg(a3), a4); +} + +void DNI tcg_gen_op4i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, + TCGv_i64 a3, TCGArg a4) +{ + tcg_gen_op4(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), + tcgv_i64_arg(a3), a4); +} + +void DNI tcg_gen_op4ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGArg a3, TCGArg a4) +{ + tcg_gen_op4(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), a3, a4); +} + +void DNI tcg_gen_op4ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, + TCGArg a3, TCGArg a4) +{ + tcg_gen_op4(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), a3, a4); +} + +void DNI tcg_gen_op5_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGv_i32 a3, TCGv_i32 a4, TCGv_i32 a5) +{ + tcg_gen_op5(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), + tcgv_i32_arg(a3), tcgv_i32_arg(a4), tcgv_i32_arg(a5)); +} + +void DNI tcg_gen_op5_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, + TCGv_i64 a3, TCGv_i64 a4, TCGv_i64 a5) +{ + tcg_gen_op5(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), + tcgv_i64_arg(a3), tcgv_i64_arg(a4), tcgv_i64_arg(a5)); +} + +void DNI tcg_gen_op5i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGv_i32 a3, TCGv_i32 a4, TCGArg a5) +{ + tcg_gen_op5(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), + tcgv_i32_arg(a3), tcgv_i32_arg(a4), a5); +} + +void DNI tcg_gen_op5i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, + TCGv_i64 a3, TCGv_i64 a4, TCGArg a5) +{ + tcg_gen_op5(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), + tcgv_i64_arg(a3), tcgv_i64_arg(a4), a5); +} + +void DNI tcg_gen_op5ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGv_i32 a3, TCGArg a4, TCGArg a5) +{ + tcg_gen_op5(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), + tcgv_i32_arg(a3), a4, a5); +} + +void DNI tcg_gen_op5ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, + TCGv_i64 a3, TCGArg a4, TCGArg a5) +{ + tcg_gen_op5(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), + tcgv_i64_arg(a3), a4, a5); +} + +void DNI tcg_gen_op6_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, TCGv_i32 a3, + TCGv_i32 a4, TCGv_i32 a5, TCGv_i32 a6) +{ + tcg_gen_op6(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), + tcgv_i32_arg(a3), tcgv_i32_arg(a4), tcgv_i32_arg(a5), + tcgv_i32_arg(a6)); +} + +void DNI tcg_gen_op6_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, TCGv_i64 a3, + TCGv_i64 a4, TCGv_i64 a5, TCGv_i64 a6) +{ + tcg_gen_op6(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), + tcgv_i64_arg(a3), tcgv_i64_arg(a4), tcgv_i64_arg(a5), + tcgv_i64_arg(a6)); +} + +void DNI tcg_gen_op6i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, TCGv_i32 a3, + TCGv_i32 a4, TCGv_i32 a5, TCGArg a6) +{ + tcg_gen_op6(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), + tcgv_i32_arg(a3), tcgv_i32_arg(a4), tcgv_i32_arg(a5), a6); +} + +void DNI tcg_gen_op6i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, TCGv_i64 a3, + TCGv_i64 a4, TCGv_i64 a5, TCGArg a6) +{ + tcg_gen_op6(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), + tcgv_i64_arg(a3), tcgv_i64_arg(a4), tcgv_i64_arg(a5), a6); +} + +void DNI tcg_gen_op6ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGv_i32 a3, TCGv_i32 a4, TCGArg a5, TCGArg a6) +{ + tcg_gen_op6(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), + tcgv_i32_arg(a3), tcgv_i32_arg(a4), a5, a6); +} + +void DNI tcg_gen_op6ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, + TCGv_i64 a3, TCGv_i64 a4, TCGArg a5, TCGArg a6) +{ + tcg_gen_op6(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), + tcgv_i64_arg(a3), tcgv_i64_arg(a4), a5, a6); +} + /* Generic ops. */ static void add_last_as_label_use(TCGLabel *l) From patchwork Tue Nov 7 02:48:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741748 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1414786wrr; Mon, 6 Nov 2023 18:50:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IHtS3y3qvSpxv4JI/bE+uhXJLKTgBKaVbb6r+psQ3oADGZUY1MVtnGZLdScimSD96sZAn3x X-Received: by 2002:ad4:5f86:0:b0:671:84f9:53c8 with SMTP id jp6-20020ad45f86000000b0067184f953c8mr32112899qvb.35.1699325442188; Mon, 06 Nov 2023 18:50:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325442; cv=none; d=google.com; s=arc-20160816; b=KQM8izsOzZwZi+fKN1sMAO4YHv4Y6Ul1pwcxMLlYk7HzhuGiaZHYKGkLEH6xWM/Le9 c5uXh0lUApDUKZZoeCBYihpo9AlWxyJiY7dX21xh+e1GdNz2RTLYIw7of9870bQ+Uggi GPPbbqCsjnw2n/2caepNxuwAPUAv2U94leME8HXIaeAzpPkOJDHiM333eoE5zgJeU9OH j2CgV+N03oXdsfVbkJjgckiutBNPPzaroi+stl5nP/jBJAsX8EqtG0+acQFdS7Q7WT1I GVqh5GRmhuoM9yEubyvt4kgwoSTmYYgGzF85aLlP1jjnpPZTqEJPg5pCTGTZOsYQ9Jv3 4oBQ== 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:to:from :dkim-signature; bh=an482H69nlIo6guTD+Xr+Nwjug6G8AV8lg5cypnyOJs=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=dQBKpR+Rcw1/vzKwUSpi6HK5hNTG4Q7K4xyUdUtxgHUF/d3+JSEeC+DYANaz2oE50k 77W7iA0hn9RbWP5Cm6oTjw89w5/e6yEiwN3+wevqn0dLX/FXTCu6zzL1ZtsjozIUaE4/ mLF32IFKni9NbvyjPDsSvb5uLJCQ2sD3vxWfmkjunrJK3jrtM5cdeEGhd8GtrjVv8jZF UaiSXt+V5RBxUOzxVhKLIMjojzsrzWcKuScNl56DvmX1NeUsE0at9u5Qpqcp8RBA+dxo qpaxIAafCQ1Ot5zP3n5f+IkzYy1Gt5Q9Rwp1ezC9K0cyQaN2N7SrUSSvcIs26nlspODZ DvRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tXN2XRCP; 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 t10-20020a056214118a00b0066d09b83e67si6252603qvv.484.2023.11.06.18.50.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:50:42 -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=tXN2XRCP; 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 1r0C9B-0008G9-IL; Mon, 06 Nov 2023 21:48:57 -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 1r0C99-0008Es-9L for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:55 -0500 Received: from mail-yb1-xb30.google.com ([2607:f8b0:4864:20::b30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C97-0005rB-LZ for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:55 -0500 Received: by mail-yb1-xb30.google.com with SMTP id 3f1490d57ef6-dae7cc31151so87130276.3 for ; Mon, 06 Nov 2023 18:48:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325332; x=1699930132; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=an482H69nlIo6guTD+Xr+Nwjug6G8AV8lg5cypnyOJs=; b=tXN2XRCP5v06+fadrdhfnnqKbAlAnsbSugXNAXhMzuUx67m2HXFUXMzzc7wVPX6zGY ihKS662+xdZF21L2khxXpLW7xpSyYkrHiPiT8CAvBp/zIL/+zq90qLtKR10fm9gL4O8e nENRbCyXJW1wPqJxxc6h6RE9SDPJ2VyCflws3b+IxRGwkWcskB24kszgO2e8ZGXvZD9m kvfXIOSeHBuRJrXgwahKFmYgi5adcGYBfvAKfnA7ueWqzibkxBC4cmYA/Zlw4mSGWHj0 lsHgwkPvt9qxotiE3lHF2hYh2eJb97wUDEjGAjh4JMTOBjCRcr5LO7UepepDk2IqA4+m dH+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325332; x=1699930132; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=an482H69nlIo6guTD+Xr+Nwjug6G8AV8lg5cypnyOJs=; b=cJ4SR6mdWE9/nBzwmQHO1IMQwWr7sooVvhULsmDAauaLfdrixfoI4KCP/uvKdrUudQ /kho4A8M2Pf4wsNnbh1P023BAMWDvylrhBUAxjlKcRLfDWMJi6WwEUedAUaNIXvSFkSt DPUTDvVCY5A5OHcGkydY3D6gkdIz9DZltonfmkkp93emG6qP3/tR5jgUXERYjRtmosKM 9MHDNT9RB/xmG1DgfYcY4sOyDxfEiMsj01eyBRnJfBtvhFlGfJuY+Td1iiZYSVYKYbaJ DgMKHdhfbhBJcqRk9SaFbMPMzLc1ciUXw2/ptIWco3MoWwf5TzUu149CdKGnjqda4nRc X3NQ== X-Gm-Message-State: AOJu0YwbgqabyGcgbtElYvVNwcZ8vsuZxGUMUcB0UGEDVyMj/XFwlXy3 F0Qzhp75NkkJ6Hpucop4RIdeqMinm0bGMxaT2Hs= X-Received: by 2002:a25:f828:0:b0:d9a:3d72:bfab with SMTP id u40-20020a25f828000000b00d9a3d72bfabmr26939894ybd.40.1699325332497; Mon, 06 Nov 2023 18:48:52 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:52 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 11/35] tcg: Move generic expanders out of line Date: Mon, 6 Nov 2023 18:48:18 -0800 Message-Id: <20231107024842.7650-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::b30; envelope-from=richard.henderson@linaro.org; helo=mail-yb1-xb30.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 Signed-off-by: Richard Henderson Message-Id: <20231029210848.78234-4-richard.henderson@linaro.org> --- include/tcg/tcg-op-common.h | 19 +++---------------- tcg/tcg-op.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h index e093f541a7..2134961a98 100644 --- a/include/tcg/tcg-op-common.h +++ b/include/tcg/tcg-op-common.h @@ -72,12 +72,7 @@ void tcg_gen_op6ii_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, /* Generic ops. */ -static inline void gen_set_label(TCGLabel *l) -{ - l->present = 1; - tcg_gen_op1(INDEX_op_set_label, label_arg(l)); -} - +void gen_set_label(TCGLabel *l); void tcg_gen_br(TCGLabel *l); void tcg_gen_mb(TCGBar); @@ -121,16 +116,8 @@ void tcg_gen_goto_tb(unsigned idx); */ void tcg_gen_lookup_and_goto_ptr(void); -static inline void tcg_gen_plugin_cb_start(unsigned from, unsigned type, - unsigned wr) -{ - tcg_gen_op3(INDEX_op_plugin_cb_start, from, type, wr); -} - -static inline void tcg_gen_plugin_cb_end(void) -{ - tcg_emit_op(INDEX_op_plugin_cb_end, 0); -} +void tcg_gen_plugin_cb_start(unsigned from, unsigned type, unsigned wr); +void tcg_gen_plugin_cb_end(void); /* 32 bit ops */ diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 6c826b46b0..a8cbad212d 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -300,6 +300,12 @@ void DNI tcg_gen_op6ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, /* Generic ops. */ +void gen_set_label(TCGLabel *l) +{ + l->present = 1; + tcg_gen_op1(INDEX_op_set_label, label_arg(l)); +} + static void add_last_as_label_use(TCGLabel *l) { TCGLabelUse *u = tcg_malloc(sizeof(TCGLabelUse)); @@ -333,6 +339,16 @@ void tcg_gen_mb(TCGBar mb_type) } } +void tcg_gen_plugin_cb_start(unsigned from, unsigned type, unsigned wr) +{ + tcg_gen_op3(INDEX_op_plugin_cb_start, from, type, wr); +} + +void tcg_gen_plugin_cb_end(void) +{ + tcg_emit_op(INDEX_op_plugin_cb_end, 0); +} + /* 32 bit ops */ void tcg_gen_movi_i32(TCGv_i32 ret, int32_t arg) From patchwork Tue Nov 7 02:48:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741762 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415679wrr; Mon, 6 Nov 2023 18:53:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHuQmE1VMtAkgdAkIjb5+p2OZXA4iq4VORr/T6EAESf07GlTwB6K19syPBcrVreArsftB6q X-Received: by 2002:a05:620a:8706:b0:778:9836:3ddb with SMTP id px6-20020a05620a870600b0077898363ddbmr34505775qkn.34.1699325633465; Mon, 06 Nov 2023 18:53:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325633; cv=none; d=google.com; s=arc-20160816; b=cJMjyDC+tOcbdQsn128ilyLBVqQpFLbuj4YCVW95V214WgiMXa71SY3ZoXSwisHx7I mJRkL4AHDDNReyaYHhErl68u2ROGAOwJ6K2mOGwxaaQshh3lRv9uXo2wqYoPj6BiI1S2 B5pLitWU175VedeIQAgzR1BBYHLiy7kyg71bQHqDRhqkEzVxQTSfyV2q0z5XEbtFLn8j X9MCUnkPRgfHtqVoRznG8EGOpsvFDmmSHNPtkwib42RfTHyi92o2edwlFdtdFSYtTxXZ /SmC7JSEM2BaHVN21jYEAEjusp/fTQUok1l1KY7tmVsRaJES6cLi7UjpmdtuCkr3ZkjI s5pw== 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:to:from :dkim-signature; bh=xs2jjk1dVnS2GBNBQmj7I4gd/ApA9rILGvfR7LyyN4k=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=EtAzFQ/9TDKm7Jy4QEfpvk2CSYwHvEroVTzIWFd9e2aX6Ih5qsufakiOrRfoiOb0Hg gobdJjwsKbcV+WMWBiRJe2PAgvvQrY/y6tLP2Rb4f/25kE2TsfwvSTmC4U6vAqHADiD+ hVTudykBDTwEyxRS7E+JdG6NFakYFfVcOGKQpRhsrqRl+Rhp/EblpQy0nNinjMqVagJA 9cCsEa4n0tvmI0Ka095XRPAyXZY1Bgwxdfs08O4pRJqnmD7ZOPmJcZjtbuE5m6eOEnYw kbK+iUmaMwVtRzeEBbOQAXgvy7X0Zxtqr+QVAVbZ3u7tej008Y99BL2ANFFHaOWO5Le7 q3tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nsPUFm9G; 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 y18-20020a05620a09d200b0076db12d14c2si5955664qky.719.2023.11.06.18.53.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:53:53 -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=nsPUFm9G; 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 1r0C9C-0008GV-Bt; Mon, 06 Nov 2023 21:48:58 -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 1r0C9B-0008G0-7s for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:57 -0500 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C99-0005rK-0M for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:56 -0500 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6b7f0170d7bso5220195b3a.2 for ; Mon, 06 Nov 2023 18:48:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325333; x=1699930133; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=xs2jjk1dVnS2GBNBQmj7I4gd/ApA9rILGvfR7LyyN4k=; b=nsPUFm9GTCdaeKCA4eaxY3jP79FQynDOjnmxSHjqUW97i6gTy9pUKAgStWg8FWc0R6 nXh6UT78y+Dyw1dfzsdJqXlHad9l5CZcMN5HUNs1wPlcb1Nwp98BI1RW+gIo8wlxllAH D7YbagJzgrg0ktS3/DTJczjovVp9Qqx6mqkfbKSnyhCbBruC5rdjsmlYVls4DySmWord EjLhgVHHYK/N+7WQegaJ/rFvUBga0Y7ex5EtJ+65+x9TyiGJDo6ZA3AA1ieecoR+VTck TNneXJesT46Fbfxov2VafqXtiOuMVq3yp2BlY5OyLhsOisxdqPmpuGamLMq4099erX/9 m6wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325333; x=1699930133; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xs2jjk1dVnS2GBNBQmj7I4gd/ApA9rILGvfR7LyyN4k=; b=VrWfRg15h7CsJK4GoL5mrSQQvWJfwOZy5cyMHmSeqsM2FLS5MXXiRxiAxNz2rG2233 IHA9tmY4ugN2iW9nPV5gcUMWXBvqrjgKakHWn5/iQpQX5o/XEcK4XXD2KxXZoUrLol5g WdaoA7sv1R8ouareFAOUdIp6oyf1bRm3tZPKZO4+pqGMrFxFTP245oB4NbT7nQj5IkVI S17NOJozP5ksisi1C5+bwAYKGn6KgedoNNGBgOs7Blk8i+l6j2B+JjTpKb/4ZUXuhz49 UIhVLw3BvKTQgA18LXXERBUAwSORtjRBPBuoAYEhJY5xWzfHphTozo/9dLOFOe8yncUl Q1uQ== X-Gm-Message-State: AOJu0YyiNLPTEyQyNelDXsHVLOEfyYMbXkVC3UN5HZUCxppn2ArZ/JN2 80fAzW8Wt6r+dxpjje6seaQIh7ibddR0chEtGEE= X-Received: by 2002:a05:6a00:2494:b0:6bd:f760:6a9d with SMTP id c20-20020a056a00249400b006bdf7606a9dmr38868158pfv.14.1699325333356; Mon, 06 Nov 2023 18:48:53 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 12/35] tcg: Move 32-bit expanders out of line Date: Mon, 6 Nov 2023 18:48:19 -0800 Message-Id: <20231107024842.7650-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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 Signed-off-by: Richard Henderson Message-Id: <20231029210848.78234-5-richard.henderson@linaro.org> --- include/tcg/tcg-op-common.h | 140 ++++++------------------------------ tcg/tcg-op.c | 116 ++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+), 119 deletions(-) diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h index 2134961a98..cdaa1415d1 100644 --- a/include/tcg/tcg-op-common.h +++ b/include/tcg/tcg-op-common.h @@ -197,128 +197,30 @@ void tcg_gen_abs_i32(TCGv_i32, TCGv_i32); /* Replicate a value of size @vece from @in to all the lanes in @out */ void tcg_gen_dup_i32(unsigned vece, TCGv_i32 out, TCGv_i32 in); -static inline void tcg_gen_discard_i32(TCGv_i32 arg) -{ - tcg_gen_op1_i32(INDEX_op_discard, arg); -} +void tcg_gen_discard_i32(TCGv_i32 arg); +void tcg_gen_mov_i32(TCGv_i32 ret, TCGv_i32 arg); -static inline void tcg_gen_mov_i32(TCGv_i32 ret, TCGv_i32 arg) -{ - if (ret != arg) { - tcg_gen_op2_i32(INDEX_op_mov_i32, ret, arg); - } -} +void tcg_gen_ld8u_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset); +void tcg_gen_ld8s_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset); +void tcg_gen_ld16u_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset); +void tcg_gen_ld16s_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset); +void tcg_gen_ld_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset); -static inline void tcg_gen_ld8u_i32(TCGv_i32 ret, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i32(INDEX_op_ld8u_i32, ret, arg2, offset); -} +void tcg_gen_st8_i32(TCGv_i32 arg1, TCGv_ptr arg2, tcg_target_long offset); +void tcg_gen_st16_i32(TCGv_i32 arg1, TCGv_ptr arg2, tcg_target_long offset); +void tcg_gen_st_i32(TCGv_i32 arg1, TCGv_ptr arg2, tcg_target_long offset); -static inline void tcg_gen_ld8s_i32(TCGv_i32 ret, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i32(INDEX_op_ld8s_i32, ret, arg2, offset); -} - -static inline void tcg_gen_ld16u_i32(TCGv_i32 ret, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i32(INDEX_op_ld16u_i32, ret, arg2, offset); -} - -static inline void tcg_gen_ld16s_i32(TCGv_i32 ret, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i32(INDEX_op_ld16s_i32, ret, arg2, offset); -} - -static inline void tcg_gen_ld_i32(TCGv_i32 ret, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i32(INDEX_op_ld_i32, ret, arg2, offset); -} - -static inline void tcg_gen_st8_i32(TCGv_i32 arg1, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i32(INDEX_op_st8_i32, arg1, arg2, offset); -} - -static inline void tcg_gen_st16_i32(TCGv_i32 arg1, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i32(INDEX_op_st16_i32, arg1, arg2, offset); -} - -static inline void tcg_gen_st_i32(TCGv_i32 arg1, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i32(INDEX_op_st_i32, arg1, arg2, offset); -} - -static inline void tcg_gen_add_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) -{ - tcg_gen_op3_i32(INDEX_op_add_i32, ret, arg1, arg2); -} - -static inline void tcg_gen_sub_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) -{ - tcg_gen_op3_i32(INDEX_op_sub_i32, ret, arg1, arg2); -} - -static inline void tcg_gen_and_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) -{ - tcg_gen_op3_i32(INDEX_op_and_i32, ret, arg1, arg2); -} - -static inline void tcg_gen_or_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) -{ - tcg_gen_op3_i32(INDEX_op_or_i32, ret, arg1, arg2); -} - -static inline void tcg_gen_xor_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) -{ - tcg_gen_op3_i32(INDEX_op_xor_i32, ret, arg1, arg2); -} - -static inline void tcg_gen_shl_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) -{ - tcg_gen_op3_i32(INDEX_op_shl_i32, ret, arg1, arg2); -} - -static inline void tcg_gen_shr_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) -{ - tcg_gen_op3_i32(INDEX_op_shr_i32, ret, arg1, arg2); -} - -static inline void tcg_gen_sar_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) -{ - tcg_gen_op3_i32(INDEX_op_sar_i32, ret, arg1, arg2); -} - -static inline void tcg_gen_mul_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) -{ - tcg_gen_op3_i32(INDEX_op_mul_i32, ret, arg1, arg2); -} - -static inline void tcg_gen_neg_i32(TCGv_i32 ret, TCGv_i32 arg) -{ - if (TCG_TARGET_HAS_neg_i32) { - tcg_gen_op2_i32(INDEX_op_neg_i32, ret, arg); - } else { - tcg_gen_subfi_i32(ret, 0, arg); - } -} - -static inline void tcg_gen_not_i32(TCGv_i32 ret, TCGv_i32 arg) -{ - if (TCG_TARGET_HAS_not_i32) { - tcg_gen_op2_i32(INDEX_op_not_i32, ret, arg); - } else { - tcg_gen_xori_i32(ret, arg, -1); - } -} +void tcg_gen_add_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); +void tcg_gen_sub_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); +void tcg_gen_and_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); +void tcg_gen_or_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); +void tcg_gen_xor_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); +void tcg_gen_shl_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); +void tcg_gen_shr_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); +void tcg_gen_sar_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); +void tcg_gen_mul_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); +void tcg_gen_neg_i32(TCGv_i32 ret, TCGv_i32 arg); +void tcg_gen_not_i32(TCGv_i32 ret, TCGv_i32 arg); /* 64 bit ops */ diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index a8cbad212d..ab6281ebec 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -351,11 +351,28 @@ void tcg_gen_plugin_cb_end(void) /* 32 bit ops */ +void tcg_gen_discard_i32(TCGv_i32 arg) +{ + tcg_gen_op1_i32(INDEX_op_discard, arg); +} + +void tcg_gen_mov_i32(TCGv_i32 ret, TCGv_i32 arg) +{ + if (ret != arg) { + tcg_gen_op2_i32(INDEX_op_mov_i32, ret, arg); + } +} + void tcg_gen_movi_i32(TCGv_i32 ret, int32_t arg) { tcg_gen_mov_i32(ret, tcg_constant_i32(arg)); } +void tcg_gen_add_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) +{ + tcg_gen_op3_i32(INDEX_op_add_i32, ret, arg1, arg2); +} + void tcg_gen_addi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { /* some cases can be optimized here */ @@ -366,6 +383,11 @@ void tcg_gen_addi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) } } +void tcg_gen_sub_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) +{ + tcg_gen_op3_i32(INDEX_op_sub_i32, ret, arg1, arg2); +} + void tcg_gen_subfi_i32(TCGv_i32 ret, int32_t arg1, TCGv_i32 arg2) { if (arg1 == 0 && TCG_TARGET_HAS_neg_i32) { @@ -386,6 +408,20 @@ void tcg_gen_subi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) } } +void tcg_gen_neg_i32(TCGv_i32 ret, TCGv_i32 arg) +{ + if (TCG_TARGET_HAS_neg_i32) { + tcg_gen_op2_i32(INDEX_op_neg_i32, ret, arg); + } else { + tcg_gen_subfi_i32(ret, 0, arg); + } +} + +void tcg_gen_and_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) +{ + tcg_gen_op3_i32(INDEX_op_and_i32, ret, arg1, arg2); +} + void tcg_gen_andi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { /* Some cases can be optimized here. */ @@ -414,6 +450,11 @@ void tcg_gen_andi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) tcg_gen_and_i32(ret, arg1, tcg_constant_i32(arg2)); } +void tcg_gen_or_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) +{ + tcg_gen_op3_i32(INDEX_op_or_i32, ret, arg1, arg2); +} + void tcg_gen_ori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { /* Some cases can be optimized here. */ @@ -426,6 +467,11 @@ void tcg_gen_ori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) } } +void tcg_gen_xor_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) +{ + tcg_gen_op3_i32(INDEX_op_xor_i32, ret, arg1, arg2); +} + void tcg_gen_xori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { /* Some cases can be optimized here. */ @@ -439,6 +485,20 @@ void tcg_gen_xori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) } } +void tcg_gen_not_i32(TCGv_i32 ret, TCGv_i32 arg) +{ + if (TCG_TARGET_HAS_not_i32) { + tcg_gen_op2_i32(INDEX_op_not_i32, ret, arg); + } else { + tcg_gen_xori_i32(ret, arg, -1); + } +} + +void tcg_gen_shl_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) +{ + tcg_gen_op3_i32(INDEX_op_shl_i32, ret, arg1, arg2); +} + void tcg_gen_shli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { tcg_debug_assert(arg2 >= 0 && arg2 < 32); @@ -449,6 +509,11 @@ void tcg_gen_shli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) } } +void tcg_gen_shr_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) +{ + tcg_gen_op3_i32(INDEX_op_shr_i32, ret, arg1, arg2); +} + void tcg_gen_shri_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { tcg_debug_assert(arg2 >= 0 && arg2 < 32); @@ -459,6 +524,11 @@ void tcg_gen_shri_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) } } +void tcg_gen_sar_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) +{ + tcg_gen_op3_i32(INDEX_op_sar_i32, ret, arg1, arg2); +} + void tcg_gen_sari_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { tcg_debug_assert(arg2 >= 0 && arg2 < 32); @@ -527,6 +597,11 @@ void tcg_gen_negsetcondi_i32(TCGCond cond, TCGv_i32 ret, tcg_gen_negsetcond_i32(cond, ret, arg1, tcg_constant_i32(arg2)); } +void tcg_gen_mul_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) +{ + tcg_gen_op3_i32(INDEX_op_mul_i32, ret, arg1, arg2); +} + void tcg_gen_muli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { if (arg2 == 0) { @@ -1385,6 +1460,47 @@ void tcg_gen_abs_i32(TCGv_i32 ret, TCGv_i32 a) tcg_temp_free_i32(t); } +void tcg_gen_ld8u_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset) +{ + tcg_gen_ldst_op_i32(INDEX_op_ld8u_i32, ret, arg2, offset); +} + +void tcg_gen_ld8s_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset) +{ + tcg_gen_ldst_op_i32(INDEX_op_ld8s_i32, ret, arg2, offset); +} + +void tcg_gen_ld16u_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset) +{ + tcg_gen_ldst_op_i32(INDEX_op_ld16u_i32, ret, arg2, offset); +} + +void tcg_gen_ld16s_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset) +{ + tcg_gen_ldst_op_i32(INDEX_op_ld16s_i32, ret, arg2, offset); +} + +void tcg_gen_ld_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset) +{ + tcg_gen_ldst_op_i32(INDEX_op_ld_i32, ret, arg2, offset); +} + +void tcg_gen_st8_i32(TCGv_i32 arg1, TCGv_ptr arg2, tcg_target_long offset) +{ + tcg_gen_ldst_op_i32(INDEX_op_st8_i32, arg1, arg2, offset); +} + +void tcg_gen_st16_i32(TCGv_i32 arg1, TCGv_ptr arg2, tcg_target_long offset) +{ + tcg_gen_ldst_op_i32(INDEX_op_st16_i32, arg1, arg2, offset); +} + +void tcg_gen_st_i32(TCGv_i32 arg1, TCGv_ptr arg2, tcg_target_long offset) +{ + tcg_gen_ldst_op_i32(INDEX_op_st_i32, arg1, arg2, offset); +} + + /* 64-bit ops */ #if TCG_TARGET_REG_BITS == 32 From patchwork Tue Nov 7 02:48:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741752 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415009wrr; Mon, 6 Nov 2023 18:51:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHeFaJi6aKzDXZ5Sl8ul4+C5/RjsDaSUVi9sNEg9OmlCwQWuTNAQlJa4cgRThwUJQqdya0U X-Received: by 2002:ac8:570a:0:b0:41c:cf9d:aa0 with SMTP id 10-20020ac8570a000000b0041ccf9d0aa0mr31704697qtw.32.1699325483087; Mon, 06 Nov 2023 18:51:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325483; cv=none; d=google.com; s=arc-20160816; b=VDl52JZUqByCkA1R7k9BnN0V0RMnIaN48TEJzh5wxd/I/+kDea5y+FQrED1f1s8NoL TpKQKqJfvIRu7B6rIvkfeJHqnyYOJOkSKoJeEQ7fqtDhRJWgYue7jhQNwHX1Kgp+VuwE qU45c2FGenJbqOGWSOzMXfb30Ba0Ha+6GGVoynWudsNXDnkiapo6Q9ud9La2cT6OFyid M476BMS4MyWD3H0LsQ2taKielA3848DCEWAbRh1Ab05Nn98LTNG9tyzlvXjC3mj6T6br ++ryl7jeqDntQtGDhIqt/er6o0qVPTkFB/e9sjdy9Uz/c6cjrKXb8RCgzY6mIxK3/FOG luUQ== 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:to:from :dkim-signature; bh=2sloVrILa/y8th+MYnXLRzVd29BChrb1tBcv1TtA6mo=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=eJ4EkCTO3/+qCVyjm7KsDidwj/yx/31oUhrAZHiNWUmEhoidBH17LRNxu7vl8wXgkZ hxV9OYXQamHsY3xH6+acPttILgET4YmDyL5wLRZtHFexqbvsiVfNdgEJ3naCbuGvB7OH 2k5QkW3+s6uzn/TKyyCi+vVcFZifZThwQyUpMWNoMQeBFguwfcoKY3nXPDJVGzNXytwr dP8dKnRYQLL/To5Y+aw+UiCLzVjL1a6RdIhJa1D4fq+pOj5GfoO97eMebeh0hC0gTOSE BE1FwoTdnieU2ObEaxLW9apph3GSw1V0Lsh4bahxKZmbVnTMnF6igf2EoJCg56BBhite 4iUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MoK4ol1+; 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 t28-20020a05622a181c00b0041978cbdcc3si6886640qtc.498.2023.11.06.18.51.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:51:23 -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=MoK4ol1+; 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 1r0C9E-0008Hl-5f; Mon, 06 Nov 2023 21:49:00 -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 1r0C9C-0008GU-9s for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:58 -0500 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C99-0005rN-LZ for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:58 -0500 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6b2018a11efso5352520b3a.0 for ; Mon, 06 Nov 2023 18:48:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325334; x=1699930134; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=2sloVrILa/y8th+MYnXLRzVd29BChrb1tBcv1TtA6mo=; b=MoK4ol1+4C7wNIDtdsQCuWnvDhR9Jaoq4S7Rb0RoQc/DR0p65xag8mwXNqokKBnx1k OmrYJbianrvzwfBEa3ohco6z3iBNg4PVzqsphD+LdZqtyIsvwkfOqRM1ccR4zx+cfWrQ 1esh7Jdb1V6a4QO4QKW1R126AUn4RZOIUMXOuhB5X4jCmKgZXLam+hqaHRNYw0GWs08D Jd2CC7xq1xYm6aU3uERohdUbLGjNHUarDKWKDmMQjcFZMalXxfEvE2e3/AcS1IWrDN4u IgtvSrClGxdEJFm9zkO7oU5yDkTgctjBKE+UpbGVAMMCtURSz+XV/5TeLIWERi5XWaKh X+LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325334; x=1699930134; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2sloVrILa/y8th+MYnXLRzVd29BChrb1tBcv1TtA6mo=; b=Ht+KVis4t+biIMnoq10glvpiiTec6NjOON8xjthinIV7IdaNWnnDUOK64wsMNsK7RV lg5J+C1cTYvu8qatYZJ+PFilUSWhlunAkMQERAr2010/F0Qz73bOGFwgr2G77X1CWmLq 4A2x4Yw5nSugtIIvbQnMoH+AqYoZk9L6sxepmPnpXYTHOAcSLKUlgLYgCrNGGbi7Hk5x g5GOHoDnBfYjblzH6lT+CRkNxl5WtaSvBr0x9D0UP9BLqu847NybglyzE6p0R3gEaL1u 2z4oOmg3sj2O7pHbPaXWjGGGd8E16exhV6K93v2EG2yiIdrt0YO4m+MaWRlrwrRM+4u9 rM5g== X-Gm-Message-State: AOJu0YycjmtI+f3j22i8qAT5sI6nWrdkRZMrlP+hvI9AVek92iW5qAjA 3GM9aHeWu5m3G3pwPZ6qfwwd3JP9y3fXzWgJ92A= X-Received: by 2002:a05:6a21:3290:b0:17b:129b:196f with SMTP id yt16-20020a056a21329000b0017b129b196fmr37566397pzb.11.1699325334139; Mon, 06 Nov 2023 18:48:54 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 13/35] tcg: Move 64-bit expanders out of line Date: Mon, 6 Nov 2023 18:48:20 -0800 Message-Id: <20231107024842.7650-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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 This one is more complicated, combining 32-bit and 64-bit expansion with C if instead of preprocessor #if. Signed-off-by: Richard Henderson Message-Id: <20231029210848.78234-6-richard.henderson@linaro.org> --- include/tcg/tcg-op-common.h | 144 +--------------------- tcg/tcg-op.c | 231 +++++++++++++++++++++++++----------- 2 files changed, 169 insertions(+), 206 deletions(-) diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h index cdaa1415d1..f5ec54f874 100644 --- a/include/tcg/tcg-op-common.h +++ b/include/tcg/tcg-op-common.h @@ -305,130 +305,6 @@ void tcg_gen_abs_i64(TCGv_i64, TCGv_i64); /* Replicate a value of size @vece from @in to all the lanes in @out */ void tcg_gen_dup_i64(unsigned vece, TCGv_i64 out, TCGv_i64 in); -#if TCG_TARGET_REG_BITS == 64 -static inline void tcg_gen_discard_i64(TCGv_i64 arg) -{ - tcg_gen_op1_i64(INDEX_op_discard, arg); -} - -static inline void tcg_gen_mov_i64(TCGv_i64 ret, TCGv_i64 arg) -{ - if (ret != arg) { - tcg_gen_op2_i64(INDEX_op_mov_i64, ret, arg); - } -} - -static inline void tcg_gen_ld8u_i64(TCGv_i64 ret, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i64(INDEX_op_ld8u_i64, ret, arg2, offset); -} - -static inline void tcg_gen_ld8s_i64(TCGv_i64 ret, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i64(INDEX_op_ld8s_i64, ret, arg2, offset); -} - -static inline void tcg_gen_ld16u_i64(TCGv_i64 ret, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i64(INDEX_op_ld16u_i64, ret, arg2, offset); -} - -static inline void tcg_gen_ld16s_i64(TCGv_i64 ret, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i64(INDEX_op_ld16s_i64, ret, arg2, offset); -} - -static inline void tcg_gen_ld32u_i64(TCGv_i64 ret, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i64(INDEX_op_ld32u_i64, ret, arg2, offset); -} - -static inline void tcg_gen_ld32s_i64(TCGv_i64 ret, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i64(INDEX_op_ld32s_i64, ret, arg2, offset); -} - -static inline void tcg_gen_ld_i64(TCGv_i64 ret, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i64(INDEX_op_ld_i64, ret, arg2, offset); -} - -static inline void tcg_gen_st8_i64(TCGv_i64 arg1, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i64(INDEX_op_st8_i64, arg1, arg2, offset); -} - -static inline void tcg_gen_st16_i64(TCGv_i64 arg1, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i64(INDEX_op_st16_i64, arg1, arg2, offset); -} - -static inline void tcg_gen_st32_i64(TCGv_i64 arg1, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i64(INDEX_op_st32_i64, arg1, arg2, offset); -} - -static inline void tcg_gen_st_i64(TCGv_i64 arg1, TCGv_ptr arg2, - tcg_target_long offset) -{ - tcg_gen_ldst_op_i64(INDEX_op_st_i64, arg1, arg2, offset); -} - -static inline void tcg_gen_add_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) -{ - tcg_gen_op3_i64(INDEX_op_add_i64, ret, arg1, arg2); -} - -static inline void tcg_gen_sub_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) -{ - tcg_gen_op3_i64(INDEX_op_sub_i64, ret, arg1, arg2); -} - -static inline void tcg_gen_and_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) -{ - tcg_gen_op3_i64(INDEX_op_and_i64, ret, arg1, arg2); -} - -static inline void tcg_gen_or_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) -{ - tcg_gen_op3_i64(INDEX_op_or_i64, ret, arg1, arg2); -} - -static inline void tcg_gen_xor_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) -{ - tcg_gen_op3_i64(INDEX_op_xor_i64, ret, arg1, arg2); -} - -static inline void tcg_gen_shl_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) -{ - tcg_gen_op3_i64(INDEX_op_shl_i64, ret, arg1, arg2); -} - -static inline void tcg_gen_shr_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) -{ - tcg_gen_op3_i64(INDEX_op_shr_i64, ret, arg1, arg2); -} - -static inline void tcg_gen_sar_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) -{ - tcg_gen_op3_i64(INDEX_op_sar_i64, ret, arg1, arg2); -} - -static inline void tcg_gen_mul_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) -{ - tcg_gen_op3_i64(INDEX_op_mul_i64, ret, arg1, arg2); -} -#else /* TCG_TARGET_REG_BITS == 32 */ void tcg_gen_st8_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset); void tcg_gen_st16_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset); void tcg_gen_st32_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset); @@ -453,16 +329,8 @@ void tcg_gen_shl_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); void tcg_gen_shr_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); void tcg_gen_sar_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); void tcg_gen_mul_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); -#endif /* TCG_TARGET_REG_BITS */ +void tcg_gen_neg_i64(TCGv_i64 ret, TCGv_i64 arg); -static inline void tcg_gen_neg_i64(TCGv_i64 ret, TCGv_i64 arg) -{ - if (TCG_TARGET_HAS_neg_i64) { - tcg_gen_op2_i64(INDEX_op_neg_i64, ret, arg); - } else { - tcg_gen_subfi_i64(ret, 0, arg); - } -} /* Size changing operations. */ @@ -473,19 +341,17 @@ void tcg_gen_extrl_i64_i32(TCGv_i32 ret, TCGv_i64 arg); void tcg_gen_extrh_i64_i32(TCGv_i32 ret, TCGv_i64 arg); void tcg_gen_extr_i64_i32(TCGv_i32 lo, TCGv_i32 hi, TCGv_i64 arg); void tcg_gen_extr32_i64(TCGv_i64 lo, TCGv_i64 hi, TCGv_i64 arg); +void tcg_gen_concat32_i64(TCGv_i64 ret, TCGv_i64 lo, TCGv_i64 hi); -void tcg_gen_mov_i128(TCGv_i128 dst, TCGv_i128 src); void tcg_gen_extr_i128_i64(TCGv_i64 lo, TCGv_i64 hi, TCGv_i128 arg); void tcg_gen_concat_i64_i128(TCGv_i128 ret, TCGv_i64 lo, TCGv_i64 hi); +/* 128 bit ops */ + +void tcg_gen_mov_i128(TCGv_i128 dst, TCGv_i128 src); void tcg_gen_ld_i128(TCGv_i128 ret, TCGv_ptr base, tcg_target_long offset); void tcg_gen_st_i128(TCGv_i128 val, TCGv_ptr base, tcg_target_long offset); -static inline void tcg_gen_concat32_i64(TCGv_i64 ret, TCGv_i64 lo, TCGv_i64 hi) -{ - tcg_gen_deposit_i64(ret, lo, hi, 32, 32); -} - /* Local load/store bit ops */ void tcg_gen_qemu_ld_i32_chk(TCGv_i32, TCGTemp *, TCGArg, MemOp, TCGType); diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index ab6281ebec..579a2aab15 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -1503,152 +1503,238 @@ void tcg_gen_st_i32(TCGv_i32 arg1, TCGv_ptr arg2, tcg_target_long offset) /* 64-bit ops */ -#if TCG_TARGET_REG_BITS == 32 -/* These are all inline for TCG_TARGET_REG_BITS == 64. */ - void tcg_gen_discard_i64(TCGv_i64 arg) { - tcg_gen_discard_i32(TCGV_LOW(arg)); - tcg_gen_discard_i32(TCGV_HIGH(arg)); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_op1_i64(INDEX_op_discard, arg); + } else { + tcg_gen_discard_i32(TCGV_LOW(arg)); + tcg_gen_discard_i32(TCGV_HIGH(arg)); + } } void tcg_gen_mov_i64(TCGv_i64 ret, TCGv_i64 arg) { - TCGTemp *ts = tcgv_i64_temp(arg); - - /* Canonicalize TCGv_i64 TEMP_CONST into TCGv_i32 TEMP_CONST. */ - if (ts->kind == TEMP_CONST) { - tcg_gen_movi_i64(ret, ts->val); + if (ret == arg) { + return; + } + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_op2_i64(INDEX_op_mov_i64, ret, arg); } else { - tcg_gen_mov_i32(TCGV_LOW(ret), TCGV_LOW(arg)); - tcg_gen_mov_i32(TCGV_HIGH(ret), TCGV_HIGH(arg)); + TCGTemp *ts = tcgv_i64_temp(arg); + + /* Canonicalize TCGv_i64 TEMP_CONST into TCGv_i32 TEMP_CONST. */ + if (ts->kind == TEMP_CONST) { + tcg_gen_movi_i64(ret, ts->val); + } else { + tcg_gen_mov_i32(TCGV_LOW(ret), TCGV_LOW(arg)); + tcg_gen_mov_i32(TCGV_HIGH(ret), TCGV_HIGH(arg)); + } } } void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg) { - tcg_gen_movi_i32(TCGV_LOW(ret), arg); - tcg_gen_movi_i32(TCGV_HIGH(ret), arg >> 32); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_mov_i64(ret, tcg_constant_i64(arg)); + } else { + tcg_gen_movi_i32(TCGV_LOW(ret), arg); + tcg_gen_movi_i32(TCGV_HIGH(ret), arg >> 32); + } } void tcg_gen_ld8u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset) { - tcg_gen_ld8u_i32(TCGV_LOW(ret), arg2, offset); - tcg_gen_movi_i32(TCGV_HIGH(ret), 0); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_ldst_op_i64(INDEX_op_ld8u_i64, ret, arg2, offset); + } else { + tcg_gen_ld8u_i32(TCGV_LOW(ret), arg2, offset); + tcg_gen_movi_i32(TCGV_HIGH(ret), 0); + } } void tcg_gen_ld8s_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset) { - tcg_gen_ld8s_i32(TCGV_LOW(ret), arg2, offset); - tcg_gen_sari_i32(TCGV_HIGH(ret), TCGV_LOW(ret), 31); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_ldst_op_i64(INDEX_op_ld8s_i64, ret, arg2, offset); + } else { + tcg_gen_ld8s_i32(TCGV_LOW(ret), arg2, offset); + tcg_gen_sari_i32(TCGV_HIGH(ret), TCGV_LOW(ret), 31); + } } void tcg_gen_ld16u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset) { - tcg_gen_ld16u_i32(TCGV_LOW(ret), arg2, offset); - tcg_gen_movi_i32(TCGV_HIGH(ret), 0); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_ldst_op_i64(INDEX_op_ld16u_i64, ret, arg2, offset); + } else { + tcg_gen_ld16u_i32(TCGV_LOW(ret), arg2, offset); + tcg_gen_movi_i32(TCGV_HIGH(ret), 0); + } } void tcg_gen_ld16s_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset) { - tcg_gen_ld16s_i32(TCGV_LOW(ret), arg2, offset); - tcg_gen_sari_i32(TCGV_HIGH(ret), TCGV_LOW(ret), 31); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_ldst_op_i64(INDEX_op_ld16s_i64, ret, arg2, offset); + } else { + tcg_gen_ld16s_i32(TCGV_LOW(ret), arg2, offset); + tcg_gen_sari_i32(TCGV_HIGH(ret), TCGV_LOW(ret), 31); + } } void tcg_gen_ld32u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset) { - tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset); - tcg_gen_movi_i32(TCGV_HIGH(ret), 0); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_ldst_op_i64(INDEX_op_ld32u_i64, ret, arg2, offset); + } else { + tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset); + tcg_gen_movi_i32(TCGV_HIGH(ret), 0); + } } void tcg_gen_ld32s_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset) { - tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset); - tcg_gen_sari_i32(TCGV_HIGH(ret), TCGV_LOW(ret), 31); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_ldst_op_i64(INDEX_op_ld32s_i64, ret, arg2, offset); + } else { + tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset); + tcg_gen_sari_i32(TCGV_HIGH(ret), TCGV_LOW(ret), 31); + } } void tcg_gen_ld_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset) { - /* Since arg2 and ret have different types, - they cannot be the same temporary */ -#if HOST_BIG_ENDIAN - tcg_gen_ld_i32(TCGV_HIGH(ret), arg2, offset); - tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset + 4); -#else - tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset); - tcg_gen_ld_i32(TCGV_HIGH(ret), arg2, offset + 4); -#endif + /* + * For 32-bit host, since arg2 and ret have different types, + * they cannot be the same temporary -- no chance of overlap. + */ + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_ldst_op_i64(INDEX_op_ld_i64, ret, arg2, offset); + } else if (HOST_BIG_ENDIAN) { + tcg_gen_ld_i32(TCGV_HIGH(ret), arg2, offset); + tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset + 4); + } else { + tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset); + tcg_gen_ld_i32(TCGV_HIGH(ret), arg2, offset + 4); + } } void tcg_gen_st8_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset) { - tcg_gen_st8_i32(TCGV_LOW(arg1), arg2, offset); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_ldst_op_i64(INDEX_op_st8_i64, arg1, arg2, offset); + } else { + tcg_gen_st8_i32(TCGV_LOW(arg1), arg2, offset); + } } void tcg_gen_st16_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset) { - tcg_gen_st16_i32(TCGV_LOW(arg1), arg2, offset); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_ldst_op_i64(INDEX_op_st16_i64, arg1, arg2, offset); + } else { + tcg_gen_st16_i32(TCGV_LOW(arg1), arg2, offset); + } } void tcg_gen_st32_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset) { - tcg_gen_st_i32(TCGV_LOW(arg1), arg2, offset); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_ldst_op_i64(INDEX_op_st32_i64, arg1, arg2, offset); + } else { + tcg_gen_st_i32(TCGV_LOW(arg1), arg2, offset); + } } void tcg_gen_st_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset) { -#if HOST_BIG_ENDIAN - tcg_gen_st_i32(TCGV_HIGH(arg1), arg2, offset); - tcg_gen_st_i32(TCGV_LOW(arg1), arg2, offset + 4); -#else - tcg_gen_st_i32(TCGV_LOW(arg1), arg2, offset); - tcg_gen_st_i32(TCGV_HIGH(arg1), arg2, offset + 4); -#endif + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_ldst_op_i64(INDEX_op_st_i64, arg1, arg2, offset); + } else if (HOST_BIG_ENDIAN) { + tcg_gen_st_i32(TCGV_HIGH(arg1), arg2, offset); + tcg_gen_st_i32(TCGV_LOW(arg1), arg2, offset + 4); + } else { + tcg_gen_st_i32(TCGV_LOW(arg1), arg2, offset); + tcg_gen_st_i32(TCGV_HIGH(arg1), arg2, offset + 4); + } } void tcg_gen_add_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) { - tcg_gen_add2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), TCGV_LOW(arg1), - TCGV_HIGH(arg1), TCGV_LOW(arg2), TCGV_HIGH(arg2)); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_op3_i64(INDEX_op_add_i64, ret, arg1, arg2); + } else { + tcg_gen_add2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), TCGV_LOW(arg1), + TCGV_HIGH(arg1), TCGV_LOW(arg2), TCGV_HIGH(arg2)); + } } void tcg_gen_sub_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) { - tcg_gen_sub2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), TCGV_LOW(arg1), - TCGV_HIGH(arg1), TCGV_LOW(arg2), TCGV_HIGH(arg2)); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_op3_i64(INDEX_op_sub_i64, ret, arg1, arg2); + } else { + tcg_gen_sub2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), TCGV_LOW(arg1), + TCGV_HIGH(arg1), TCGV_LOW(arg2), TCGV_HIGH(arg2)); + } } void tcg_gen_and_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) { - tcg_gen_and_i32(TCGV_LOW(ret), TCGV_LOW(arg1), TCGV_LOW(arg2)); - tcg_gen_and_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), TCGV_HIGH(arg2)); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_op3_i64(INDEX_op_and_i64, ret, arg1, arg2); + } else { + tcg_gen_and_i32(TCGV_LOW(ret), TCGV_LOW(arg1), TCGV_LOW(arg2)); + tcg_gen_and_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), TCGV_HIGH(arg2)); + } } void tcg_gen_or_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) { - tcg_gen_or_i32(TCGV_LOW(ret), TCGV_LOW(arg1), TCGV_LOW(arg2)); - tcg_gen_or_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), TCGV_HIGH(arg2)); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_op3_i64(INDEX_op_or_i64, ret, arg1, arg2); + } else { + tcg_gen_or_i32(TCGV_LOW(ret), TCGV_LOW(arg1), TCGV_LOW(arg2)); + tcg_gen_or_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), TCGV_HIGH(arg2)); + } } void tcg_gen_xor_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) { - tcg_gen_xor_i32(TCGV_LOW(ret), TCGV_LOW(arg1), TCGV_LOW(arg2)); - tcg_gen_xor_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), TCGV_HIGH(arg2)); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_op3_i64(INDEX_op_xor_i64, ret, arg1, arg2); + } else { + tcg_gen_xor_i32(TCGV_LOW(ret), TCGV_LOW(arg1), TCGV_LOW(arg2)); + tcg_gen_xor_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), TCGV_HIGH(arg2)); + } } void tcg_gen_shl_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) { - gen_helper_shl_i64(ret, arg1, arg2); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_op3_i64(INDEX_op_shl_i64, ret, arg1, arg2); + } else { + gen_helper_shl_i64(ret, arg1, arg2); + } } void tcg_gen_shr_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) { - gen_helper_shr_i64(ret, arg1, arg2); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_op3_i64(INDEX_op_shr_i64, ret, arg1, arg2); + } else { + gen_helper_shr_i64(ret, arg1, arg2); + } } void tcg_gen_sar_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) { - gen_helper_sar_i64(ret, arg1, arg2); + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_op3_i64(INDEX_op_sar_i64, ret, arg1, arg2); + } else { + gen_helper_sar_i64(ret, arg1, arg2); + } } void tcg_gen_mul_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) @@ -1656,6 +1742,12 @@ void tcg_gen_mul_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) TCGv_i64 t0; TCGv_i32 t1; + if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_op3_i64(INDEX_op_mul_i64, ret, arg1, arg2); + return; + } + + t0 = tcg_temp_ebb_new_i64(); t1 = tcg_temp_ebb_new_i32(); @@ -1672,15 +1764,6 @@ void tcg_gen_mul_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) tcg_temp_free_i32(t1); } -#else - -void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg) -{ - tcg_gen_mov_i64(ret, tcg_constant_i64(arg)); -} - -#endif /* TCG_TARGET_REG_SIZE == 32 */ - void tcg_gen_addi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) { /* some cases can be optimized here */ @@ -1723,6 +1806,15 @@ void tcg_gen_subi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) } } +void tcg_gen_neg_i64(TCGv_i64 ret, TCGv_i64 arg) +{ + if (TCG_TARGET_HAS_neg_i64) { + tcg_gen_op2_i64(INDEX_op_neg_i64, ret, arg); + } else { + tcg_gen_subfi_i64(ret, 0, arg); + } +} + void tcg_gen_andi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) { if (TCG_TARGET_REG_BITS == 32) { @@ -3218,6 +3310,11 @@ void tcg_gen_extr32_i64(TCGv_i64 lo, TCGv_i64 hi, TCGv_i64 arg) tcg_gen_shri_i64(hi, arg, 32); } +void tcg_gen_concat32_i64(TCGv_i64 ret, TCGv_i64 lo, TCGv_i64 hi) +{ + tcg_gen_deposit_i64(ret, lo, hi, 32, 32); +} + void tcg_gen_extr_i128_i64(TCGv_i64 lo, TCGv_i64 hi, TCGv_i128 arg) { tcg_gen_mov_i64(lo, TCGV128_LOW(arg)); From patchwork Tue Nov 7 02:48:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741757 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415645wrr; Mon, 6 Nov 2023 18:53:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IF2jsYp+w47opISqJvOztrW3Cfk0JlzfEm/994waXOB3UiDM9EjPihJ7h5KG9jKENV/2/f0 X-Received: by 2002:a05:620a:450b:b0:777:6c68:c5f0 with SMTP id t11-20020a05620a450b00b007776c68c5f0mr35539404qkp.0.1699325625163; Mon, 06 Nov 2023 18:53:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325625; cv=none; d=google.com; s=arc-20160816; b=qNfO+3f9Z4TXkyXvcdFMaQxzxON/YHNGSFMfHecyRmFmtFwO3y/Hn3yyCurqAnqZlK fnzaA+qyKdA4nMfLGhW0rG+MB45MUOdBz6gNs+DrBwzu4ypmaubn55wPwTiQSm63/qya cWqvh5xq/soodK4nDR97d5U5xxNKJbKZL6/AS8cs7e9kpGzvtU16IQLLIcJNWG0wRVOF 8fu5vnaVQusvFBZXJ5al6pRyHfM6hxOUqBPHcvImasWnCu0SXCilOd//omH1dn8TfYOc 2iRQMZWQYyE1qfL6uQQb2obOtkdjaSw1dOLUI338vYg0WY9y9Q9ZFXthbbvJtr/7kgJy mLCQ== 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:to:from :dkim-signature; bh=sTeX8Z9KYrgukeCf1kRNaUbTN7Yqs8Pw5WY/NJNaehw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=YpWZQWNQLssMguxnyRmf82bz4SddDfpJrWTApU9v6/h8GxM9JeQfNiV3iETeg/sb1E syTowOV2E3fRl7N0FEcvgiUBnPtJL8bQcvyDCpODi3LK22KRefkPYAve4epz/0qboI82 1I2pXeIMXb25MsVx0SyM6cPaOZ1ixKBTlR5mkg/Y8WlmkOI3O2fjOysj5mNG1Zsgj5uT BIR05tZA1Up4pdPCkNltn4Da2uBfA4t7hCbsNeqAiuNn4JDTC56lXlOduQvjPI3IP7Wr bTjZCVXNTipKoigSZVp+tpaZllvSADMHNxGXMFgHkcVv8GkqcuIMYIderzHpEUNtV8zc 6w1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ilCleaGy; 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 ef4-20020a05620a808400b00767cf648a19si6662269qkb.443.2023.11.06.18.53.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:53:45 -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=ilCleaGy; 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 1r0C9E-0008IJ-QT; Mon, 06 Nov 2023 21:49:00 -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 1r0C9C-0008Gc-Gu for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:58 -0500 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9A-0005rf-3C for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:58 -0500 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-6ce344fa7e4so3171835a34.0 for ; Mon, 06 Nov 2023 18:48:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325335; x=1699930135; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=sTeX8Z9KYrgukeCf1kRNaUbTN7Yqs8Pw5WY/NJNaehw=; b=ilCleaGyfl9klo7Sw6ZiOQ5+y95MogCeoZbwJkPPgcfKI25opOfUgwZVyfrZNXvKwa PLy6BKa6f1Pr262ocPrSw0fLD1r8Vi9P9BhhT9TPfhJZWQHPGv0nBcpvAAjt5aj3HReU ll4zXJbiQEIujIMVUsx0NuKsNVymEGp11oaArpeocmVS6IxRoRHvCx46db4NNXy61f9F jRulqFwR/0E3O0KOGeYiLno4v16Rhnn9Heiwr30AEc6G0JSeqsVelrZ8wYTQZyo8ZI0X 0w+nXrcTJB8vkq5zb9b+NVfD5rFcYUMu/idAKxv2j6qsmpyb9BrGuyJG7omWAeb45BHp duzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325335; x=1699930135; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sTeX8Z9KYrgukeCf1kRNaUbTN7Yqs8Pw5WY/NJNaehw=; b=M/RvwFNE9X4KLLkWUijNR6DYwv6UbfsFxwtjxLEoduYVF11TloJ7mSkhPB5YXKS3yO ee9B8FRn0bVDQ+zEZ4tfInVWFtU5THbvsp2SBOdE9uxH9Wr8kDMYo1OgzDn8bTJVdHr1 j3H1m5wrGgk/fIICxRbQ1Ipqh0pPhuw+Gs1AtDMpGR4rL302fiibxeUw7Snms1E5poZ3 0xxC/dXrw/of606kfdJTFwzQAgeT4fbZI4/JeTNz/++OoIJDWfQ9xxoVdIEqPqNPBwnd +72rZTCckhUuQQf0d80vt4eYtvzSBGDHpunbKCjPk5ThPJxCvtccw/Vac3e3elu5KvEg 5wWQ== X-Gm-Message-State: AOJu0YyB+HNpjq1uFbtUC4p5TXkbOaPjfb8YAqRKUco5IpE5eCfMRqvy JFvmFkGu5NBN8leI9Vj8gJzUNP1n/pTZXvmLZ8g= X-Received: by 2002:a9d:734b:0:b0:6bd:603:797f with SMTP id l11-20020a9d734b000000b006bd0603797fmr28788334otk.37.1699325334845; Mon, 06 Nov 2023 18:48:54 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:54 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 14/35] tcg: Move vec_gen_* declarations to tcg-internal.h Date: Mon, 6 Nov 2023 18:48:21 -0800 Message-Id: <20231107024842.7650-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x334.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 These are used within tcg-op-vec.c and tcg/host/tcg-target.c.inc. There are no uses outside tcg/. Signed-off-by: Richard Henderson Message-Id: <20231029210848.78234-7-richard.henderson@linaro.org> --- include/tcg/tcg-op-common.h | 4 ---- tcg/tcg-internal.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h index f5ec54f874..3f8b214376 100644 --- a/include/tcg/tcg-op-common.h +++ b/include/tcg/tcg-op-common.h @@ -21,10 +21,6 @@ void tcg_gen_op4(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg); void tcg_gen_op5(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg); void tcg_gen_op6(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg); -void vec_gen_2(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg); -void vec_gen_3(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg, TCGArg); -void vec_gen_4(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg, TCGArg, TCGArg); - void tcg_gen_op1_i32(TCGOpcode, TCGv_i32); void tcg_gen_op1_i64(TCGOpcode, TCGv_i64); void tcg_gen_op1i(TCGOpcode, TCGArg); diff --git a/tcg/tcg-internal.h b/tcg/tcg-internal.h index 40a69e6e6e..f18d282abb 100644 --- a/tcg/tcg-internal.h +++ b/tcg/tcg-internal.h @@ -83,4 +83,8 @@ static inline TCGv_i64 TCGV128_HIGH(TCGv_i128 t) bool tcg_target_has_memory_bswap(MemOp memop); +void vec_gen_2(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg); +void vec_gen_3(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg, TCGArg); +void vec_gen_4(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg, TCGArg, TCGArg); + #endif /* TCG_INTERNAL_H */ From patchwork Tue Nov 7 02:48:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741742 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1414575wrr; Mon, 6 Nov 2023 18:49:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFOMT53bUaKu65dCHfUgaehwOyxIjSN/aZB3MT82W0Z3IE9FW2NjuuVRs0o4xABTr5n0ND0 X-Received: by 2002:a05:622a:15ce:b0:417:a514:72cd with SMTP id d14-20020a05622a15ce00b00417a51472cdmr40227373qty.19.1699325396236; Mon, 06 Nov 2023 18:49:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325396; cv=none; d=google.com; s=arc-20160816; b=SoAFMB+g2zZbrAfQfSK0xnrRBBZM+it0V9GezZhK3Pz5q5y9V8aXRCmhzg7p1dAepR Uev6KhyKYRQtBmFE3eTzJp9A0EZH+IkRebDbJUsR1s24rjvuBGlFAOr5ciAgV62veT5G wHAyysdv4Xw/z6Zhy/7adtIY8DRRDJEQaFOnr7kLPBuaqvfMMsdaraBhff5Q+x8PMVYz Jy31eDe3xFhXpApOhXF5GNTXzl41n6RyZ5F19M07vHiNfwk5RVWaWJqGi6eQLRZMNjhg YCbA0cyp+Hbx/0J8gs6RQlPj4+nBeJ3SJbEemr56irIR3mrFuXgRkEE4t809b/LuRUkw u6yg== 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:to:from :dkim-signature; bh=d3NCy7c1Qz0hjx/9ReaBNA0nt0Qdhs4UCEPvgjjqajY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=kpZ+00fZSNOzgINYzTCzo6vXRt6PqWl+bZddMUYy8GLA32bvmStTxKiRh8Fd1x5TFy +DBQMZ5qPWiJkIQIs+kyv1E9zdeTNmaB6gAF5PaWQfC3YDgMhTqPKc5sMwjLVCv3M1d/ hg/EPpexZq3OTG4xA2xSO/wXBLDq+ldRLQNGXiG4PLMEtwHxXIpD+10CiNtuexlstEN6 8uF/s6IejLRVO0tASjmWCKCGMT22qzBpmPFuUrIDXG1DZfQD6RkMEzXic/aTpzqE7xYe clc3IroPCO33S8+m2GmJFuJMPjmic+EUUaqFrm5tltr++ektygvRH0OW4ARnLdWDP+GO EJKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p8iOw4+R; 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 e6-20020ac85986000000b0041cc4706f49si6599387qte.26.2023.11.06.18.49.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:49:56 -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=p8iOw4+R; 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 1r0C9D-0008Hc-Vh; Mon, 06 Nov 2023 21:49:00 -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 1r0C9C-0008Gh-N4 for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:58 -0500 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9A-0005rp-Sr for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:58 -0500 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6bee11456baso4797384b3a.1 for ; Mon, 06 Nov 2023 18:48:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325335; x=1699930135; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=d3NCy7c1Qz0hjx/9ReaBNA0nt0Qdhs4UCEPvgjjqajY=; b=p8iOw4+R57PNk0K3A3XgtUIPowwJMgbAQ8QcDih+sJ/uflCOqAihZfJpMtmWCLzSBi zwSMDz96jJx1EKcvT2HYNbpxVBrh8YupyYXnx9LtmNTdxNXYT1wnTaCNRe+nOY9xt13E t1jZ7wNJfnBZ1DJU8XacEqdjyqwC4oOFtDIQJD5/X+qylKebaSiezFNwAs1/R6Fjya9k IifOWiKgm7QqMG80gufxmCwqGFBqzgvLd2pECKSeT00CNwt8Ec+DnH50Eqvu5iAMLP0k 8IFkBs8HT1JgeE/RY79uTh24o6766KTTxfglzcWXW2fom32PD49Rstl2MBjNhJ7zn0m8 b1sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325335; x=1699930135; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d3NCy7c1Qz0hjx/9ReaBNA0nt0Qdhs4UCEPvgjjqajY=; b=piLpfOsNTEQ9TEQ2lnO2v4tTkAJYfDoltQjp6Z2cXdu3kdLm2kCpnSA8vgIfSsnMGz /miiIzpgEOJjKpxO1wq6qIe948l0QzUUUgBsP/CGB5Jyi8qswK8v4WS9cpWn1dEvQnJ3 DLU8PzB3Nl393+N2KgFW4kBMWVHtOdkGldtses/2PLyVo3pTTElkGAjim1LZeSPQSD+2 AegWlFzFQ1vRNapyA0XdbmUKUUpQTMg7Rr4+F6Pwpjmw16eM94mJqCbF8P0+7b3D80ep Pore3hQT8iJMhIGYkr5zH0xsRg0jSUrxh//MirP+K2V3WTCZDAmVijHmn8803l0Z7XAy hBuQ== X-Gm-Message-State: AOJu0Yw0g5JRwgkeTuK+P2QYLPOQ39cBWhwtajE26ApVtxdY3qvqM+7o 3z3INbpGO6uFa6CbxYBPTyxQI4LAbJq1D71+9cA= X-Received: by 2002:a05:6a00:1389:b0:6be:5a1a:3b93 with SMTP id t9-20020a056a00138900b006be5a1a3b93mr31307511pfg.4.1699325335529; Mon, 06 Nov 2023 18:48:55 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 15/35] tcg: Move tcg_gen_opN declarations to tcg-internal.h Date: Mon, 6 Nov 2023 18:48:22 -0800 Message-Id: <20231107024842.7650-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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 These are used within tcg-op.c and tcg-op-ldst.c. There are no uses outside tcg/. Signed-off-by: Richard Henderson Message-Id: <20231029210848.78234-8-richard.henderson@linaro.org> --- include/tcg/tcg-op-common.h | 7 ------- tcg/tcg-internal.h | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h index 3f8b214376..b922545118 100644 --- a/include/tcg/tcg-op-common.h +++ b/include/tcg/tcg-op-common.h @@ -14,13 +14,6 @@ /* Basic output routines. Not for general consumption. */ -void tcg_gen_op1(TCGOpcode, TCGArg); -void tcg_gen_op2(TCGOpcode, TCGArg, TCGArg); -void tcg_gen_op3(TCGOpcode, TCGArg, TCGArg, TCGArg); -void tcg_gen_op4(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg); -void tcg_gen_op5(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg); -void tcg_gen_op6(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg); - void tcg_gen_op1_i32(TCGOpcode, TCGv_i32); void tcg_gen_op1_i64(TCGOpcode, TCGv_i64); void tcg_gen_op1i(TCGOpcode, TCGArg); diff --git a/tcg/tcg-internal.h b/tcg/tcg-internal.h index f18d282abb..c9ac34fc3d 100644 --- a/tcg/tcg-internal.h +++ b/tcg/tcg-internal.h @@ -83,6 +83,13 @@ static inline TCGv_i64 TCGV128_HIGH(TCGv_i128 t) bool tcg_target_has_memory_bswap(MemOp memop); +void tcg_gen_op1(TCGOpcode, TCGArg); +void tcg_gen_op2(TCGOpcode, TCGArg, TCGArg); +void tcg_gen_op3(TCGOpcode, TCGArg, TCGArg, TCGArg); +void tcg_gen_op4(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg); +void tcg_gen_op5(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg); +void tcg_gen_op6(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg); + void vec_gen_2(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg); void vec_gen_3(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg, TCGArg); void vec_gen_4(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg, TCGArg, TCGArg); From patchwork Tue Nov 7 02:48:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741764 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415725wrr; Mon, 6 Nov 2023 18:54:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHcuyqNaQ/E5ruMh1ITPVD9Y293PDYyUEQqn2C2dk80VZoZ7ZuhLQ5t1OJmUJv+7ZaiEE9r X-Received: by 2002:a05:6214:2488:b0:658:22f8:4e51 with SMTP id gi8-20020a056214248800b0065822f84e51mr48013596qvb.1.1699325642234; Mon, 06 Nov 2023 18:54:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325642; cv=none; d=google.com; s=arc-20160816; b=nyWelueurCwl96UVkFPwhA6h0C1zEW5a8gUWY2drcMM/kztWK/UJxaXM9yq2IOV2y5 UkesosCN8N7BYWHVxciQru4jcVXuNw1mBOmR/FZZjffUi9T2BwKJqSYjJVdsW8C+W91m 7wnDJYaLWVaWP19OWwGuAW/SRL34+XWneQwJG9uv7AmUvfzOz31h2iDNg/aZqlDvdj2E DhR3dGvptqJJin4MDWuIooTYU90bchKbzEWO6uPcio+Ts4Mugzc889c5+/V+Vh7oXzlA uCDq09nFDVBLE0iJ0/5+4f0od1+8nGVUomV2xpfo0JRRZQuJz0gQ9r0NkbCO0LeLYdTI nc+A== 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:to:from :dkim-signature; bh=WDqry/XgScdXwJwBq8aBX0uqrceQjTsF7uSyvzshoLw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=1A8vIjXpp5Rmxamh3nFKqxit6VEmwgc/1oUU8U+nkUSYdCjIy84Sxuvc/WxJ0OcXDV eJ/yi12CRiF5NbmEqVxUqS7oRfU0LNrBdJgF7pFMCa8vYtlCiu0CWiQk496CYjqN46zC 7WRqx4VjpCqG7ZRBdWQ5ARjbR6HaQHB5V6Tw1rVIk6meuaVQq3LuXo3Gtn87a/6XJNkg 4qv1ApfYUuBTgdF4cQjDJK6e0sxXMGX5mH9DTsGjJLjRDQ1pPJoHml1J1STduSDq0l3I HzGUey65G+mMxJIyeN/nKUnQCAznMyqxSsW1JHZ1QQ/i8d6Lab2bToUOZEJC8MLrQTat Z/DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="KcZZX/IJ"; 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 k12-20020a05621414ec00b006563f18c948si6362138qvw.367.2023.11.06.18.54.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:54:02 -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="KcZZX/IJ"; 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 1r0C9G-0008K0-Gi; Mon, 06 Nov 2023 21:49:02 -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 1r0C9E-0008Ht-7R for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:00 -0500 Received: from mail-yw1-x112e.google.com ([2607:f8b0:4864:20::112e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9B-0005rw-AP for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:59 -0500 Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-5a7d9d357faso60358557b3.0 for ; Mon, 06 Nov 2023 18:48:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325336; x=1699930136; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=WDqry/XgScdXwJwBq8aBX0uqrceQjTsF7uSyvzshoLw=; b=KcZZX/IJuUcq2sq62d0W3RXuc0IfnqsT/L22K9pkFuhS6698d6IH/dhvd6WLLcmcar jVwKOJEXz6kja0CuGVL4ZqpWDd0YeZzuQ9ci8aXywV8MoSBHYOsYD2vmHtvrnjLnSmAL WijpavlYvnwdpztPNkRlBd94I8vrCjGidxsgMzL6IDv3WHpenrPtH/M948OKTg6hqdUC djMiq1oba1OGx/rGpQlotRcptkTQpUHXex/Sj0kGxivHVxTcPgpMmgpOhILBdi6WI1qP c1Bj1G6at8U2Iv5ag9q6xemxryDCVOyK7siiJM+VHQjoyYRseIm2CENICfZDQEOzleGL J0qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325336; x=1699930136; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WDqry/XgScdXwJwBq8aBX0uqrceQjTsF7uSyvzshoLw=; b=ufAkDHw8zLBgO17YZPGJHQ4nrym3VlVM+781h3SdwOEbmUdegintOVWw5oAvgcfOqZ Z6SmMvAnH8n3GVlqY62SC+Pllud5pnE41wcB1tj3bAaoQLBeNgkUMoQxxnMfv3h9DjdL SS6pokYbJj92uKvof+f1J+Ort9mZAfAJ9c6Y+ckBUdxMc/TYGei0EUjnapjekXo5ZIyB QiOYTuDf8u832vC0yf9PUaaxmXjIGSi+goRewTCG3CvhfJ6fiSgC7UygHthRvZzLUWZ/ CLpte3iLW/S/RrRkMBZqAsJgGjfi8t2vQz3apu7LklufiQJcJwJl012xkRO/LFuAsE3/ ZUeA== X-Gm-Message-State: AOJu0YwSrqYw4Kdhu1FEeU834tgg5HzXVSA0Dq9mndfnZjwrBYdkGLOC dr9UtKuk+tq3+n9hsbq6WHMATaYNrlKu7BQVkrs= X-Received: by 2002:a25:d80f:0:b0:da0:c581:6663 with SMTP id p15-20020a25d80f000000b00da0c5816663mr32065136ybg.28.1699325336293; Mon, 06 Nov 2023 18:48:56 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 16/35] tcg: Unexport tcg_gen_op*_{i32,i64} Date: Mon, 6 Nov 2023 18:48:23 -0800 Message-Id: <20231107024842.7650-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::112e; envelope-from=richard.henderson@linaro.org; helo=mail-yw1-x112e.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 These functions are no longer used outside tcg-op.c. There are several that are completely unused, so remove them. Signed-off-by: Richard Henderson Message-Id: <20231029210848.78234-9-richard.henderson@linaro.org> --- include/tcg/tcg-op-common.h | 47 ------------- tcg/tcg-op.c | 131 ++++++++++++++---------------------- 2 files changed, 52 insertions(+), 126 deletions(-) diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h index b922545118..760c67683b 100644 --- a/include/tcg/tcg-op-common.h +++ b/include/tcg/tcg-op-common.h @@ -12,53 +12,6 @@ #include "exec/helper-proto-common.h" #include "exec/helper-gen-common.h" -/* Basic output routines. Not for general consumption. */ - -void tcg_gen_op1_i32(TCGOpcode, TCGv_i32); -void tcg_gen_op1_i64(TCGOpcode, TCGv_i64); -void tcg_gen_op1i(TCGOpcode, TCGArg); -void tcg_gen_op2_i32(TCGOpcode, TCGv_i32, TCGv_i32); -void tcg_gen_op2_i64(TCGOpcode, TCGv_i64, TCGv_i64); -void tcg_gen_op2i_i32(TCGOpcode, TCGv_i32, TCGArg); -void tcg_gen_op2i_i64(TCGOpcode, TCGv_i64, TCGArg); -void tcg_gen_op2ii(TCGOpcode, TCGArg, TCGArg); -void tcg_gen_op3_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32); -void tcg_gen_op3_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64); -void tcg_gen_op3i_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGArg); -void tcg_gen_op3i_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGArg); -void tcg_gen_ldst_op_i32(TCGOpcode, TCGv_i32, TCGv_ptr, TCGArg); -void tcg_gen_ldst_op_i64(TCGOpcode, TCGv_i64, TCGv_ptr, TCGArg); -void tcg_gen_op4_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, TCGv_i32); -void tcg_gen_op4_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64); -void tcg_gen_op4i_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, TCGArg); -void tcg_gen_op4i_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, TCGArg); -void tcg_gen_op4ii_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGArg, TCGArg); -void tcg_gen_op4ii_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGArg, TCGArg); -void tcg_gen_op5_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, - TCGv_i32, TCGv_i32); -void tcg_gen_op5_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, - TCGv_i64, TCGv_i64); -void tcg_gen_op5i_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, - TCGv_i32, TCGArg); -void tcg_gen_op5i_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, - TCGv_i64, TCGArg); -void tcg_gen_op5ii_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, - TCGArg, TCGArg); -void tcg_gen_op5ii_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, - TCGArg, TCGArg); -void tcg_gen_op6_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, - TCGv_i32, TCGv_i32, TCGv_i32); -void tcg_gen_op6_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, - TCGv_i64, TCGv_i64, TCGv_i64); -void tcg_gen_op6i_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, - TCGv_i32, TCGv_i32, TCGArg); -void tcg_gen_op6i_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, - TCGv_i64, TCGv_i64, TCGArg); -void tcg_gen_op6ii_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, - TCGv_i32, TCGArg, TCGArg); -void tcg_gen_op6ii_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, - TCGv_i64, TCGArg, TCGArg); - /* Generic ops. */ void gen_set_label(TCGLabel *l); diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 579a2aab15..9aba103590 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -100,204 +100,177 @@ void NI tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, # define DNI #endif -void DNI tcg_gen_op1_i32(TCGOpcode opc, TCGv_i32 a1) +static void DNI tcg_gen_op1_i32(TCGOpcode opc, TCGv_i32 a1) { tcg_gen_op1(opc, tcgv_i32_arg(a1)); } -void DNI tcg_gen_op1_i64(TCGOpcode opc, TCGv_i64 a1) +static void DNI tcg_gen_op1_i64(TCGOpcode opc, TCGv_i64 a1) { tcg_gen_op1(opc, tcgv_i64_arg(a1)); } -void DNI tcg_gen_op1i(TCGOpcode opc, TCGArg a1) +static void DNI tcg_gen_op1i(TCGOpcode opc, TCGArg a1) { tcg_gen_op1(opc, a1); } -void DNI tcg_gen_op2_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2) +static void DNI tcg_gen_op2_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2) { tcg_gen_op2(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2)); } -void DNI tcg_gen_op2_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2) +static void DNI tcg_gen_op2_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2) { tcg_gen_op2(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2)); } -void DNI tcg_gen_op2i_i32(TCGOpcode opc, TCGv_i32 a1, TCGArg a2) -{ - tcg_gen_op2(opc, tcgv_i32_arg(a1), a2); -} - -void DNI tcg_gen_op2i_i64(TCGOpcode opc, TCGv_i64 a1, TCGArg a2) -{ - tcg_gen_op2(opc, tcgv_i64_arg(a1), a2); -} - -void DNI tcg_gen_op2ii(TCGOpcode opc, TCGArg a1, TCGArg a2) -{ - tcg_gen_op2(opc, a1, a2); -} - -void DNI tcg_gen_op3_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, TCGv_i32 a3) +static void DNI tcg_gen_op3_i32(TCGOpcode opc, TCGv_i32 a1, + TCGv_i32 a2, TCGv_i32 a3) { tcg_gen_op3(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), tcgv_i32_arg(a3)); } -void DNI tcg_gen_op3_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, TCGv_i64 a3) +static void DNI tcg_gen_op3_i64(TCGOpcode opc, TCGv_i64 a1, + TCGv_i64 a2, TCGv_i64 a3) { tcg_gen_op3(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), tcgv_i64_arg(a3)); } -void DNI tcg_gen_op3i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, TCGArg a3) +static void DNI tcg_gen_op3i_i32(TCGOpcode opc, TCGv_i32 a1, + TCGv_i32 a2, TCGArg a3) { tcg_gen_op3(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), a3); } -void DNI tcg_gen_op3i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, TCGArg a3) +static void DNI tcg_gen_op3i_i64(TCGOpcode opc, TCGv_i64 a1, + TCGv_i64 a2, TCGArg a3) { tcg_gen_op3(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), a3); } -void DNI tcg_gen_ldst_op_i32(TCGOpcode opc, TCGv_i32 val, - TCGv_ptr base, TCGArg offset) +static void DNI tcg_gen_ldst_op_i32(TCGOpcode opc, TCGv_i32 val, + TCGv_ptr base, TCGArg offset) { tcg_gen_op3(opc, tcgv_i32_arg(val), tcgv_ptr_arg(base), offset); } -void DNI tcg_gen_ldst_op_i64(TCGOpcode opc, TCGv_i64 val, - TCGv_ptr base, TCGArg offset) +static void DNI tcg_gen_ldst_op_i64(TCGOpcode opc, TCGv_i64 val, + TCGv_ptr base, TCGArg offset) { tcg_gen_op3(opc, tcgv_i64_arg(val), tcgv_ptr_arg(base), offset); } -void DNI tcg_gen_op4_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGv_i32 a3, TCGv_i32 a4) +static void DNI tcg_gen_op4_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGv_i32 a3, TCGv_i32 a4) { tcg_gen_op4(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), tcgv_i32_arg(a3), tcgv_i32_arg(a4)); } -void DNI tcg_gen_op4_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGv_i64 a3, TCGv_i64 a4) +static void DNI tcg_gen_op4_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, + TCGv_i64 a3, TCGv_i64 a4) { tcg_gen_op4(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), tcgv_i64_arg(a3), tcgv_i64_arg(a4)); } -void DNI tcg_gen_op4i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGv_i32 a3, TCGArg a4) +static void DNI tcg_gen_op4i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGv_i32 a3, TCGArg a4) { tcg_gen_op4(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), tcgv_i32_arg(a3), a4); } -void DNI tcg_gen_op4i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGv_i64 a3, TCGArg a4) +static void DNI tcg_gen_op4i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, + TCGv_i64 a3, TCGArg a4) { tcg_gen_op4(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), tcgv_i64_arg(a3), a4); } -void DNI tcg_gen_op4ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGArg a3, TCGArg a4) +static void DNI tcg_gen_op4ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGArg a3, TCGArg a4) { tcg_gen_op4(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), a3, a4); } -void DNI tcg_gen_op4ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGArg a3, TCGArg a4) +static void DNI tcg_gen_op4ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, + TCGArg a3, TCGArg a4) { tcg_gen_op4(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), a3, a4); } -void DNI tcg_gen_op5_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGv_i32 a3, TCGv_i32 a4, TCGv_i32 a5) +static void DNI tcg_gen_op5_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGv_i32 a3, TCGv_i32 a4, TCGv_i32 a5) { tcg_gen_op5(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), tcgv_i32_arg(a3), tcgv_i32_arg(a4), tcgv_i32_arg(a5)); } -void DNI tcg_gen_op5_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGv_i64 a3, TCGv_i64 a4, TCGv_i64 a5) +static void DNI tcg_gen_op5_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, + TCGv_i64 a3, TCGv_i64 a4, TCGv_i64 a5) { tcg_gen_op5(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), tcgv_i64_arg(a3), tcgv_i64_arg(a4), tcgv_i64_arg(a5)); } -void DNI tcg_gen_op5i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGv_i32 a3, TCGv_i32 a4, TCGArg a5) -{ - tcg_gen_op5(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), - tcgv_i32_arg(a3), tcgv_i32_arg(a4), a5); -} - -void DNI tcg_gen_op5i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGv_i64 a3, TCGv_i64 a4, TCGArg a5) -{ - tcg_gen_op5(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), - tcgv_i64_arg(a3), tcgv_i64_arg(a4), a5); -} - -void DNI tcg_gen_op5ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGv_i32 a3, TCGArg a4, TCGArg a5) +static void DNI tcg_gen_op5ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGv_i32 a3, TCGArg a4, TCGArg a5) { tcg_gen_op5(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), tcgv_i32_arg(a3), a4, a5); } -void DNI tcg_gen_op5ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGv_i64 a3, TCGArg a4, TCGArg a5) +static void DNI tcg_gen_op5ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, + TCGv_i64 a3, TCGArg a4, TCGArg a5) { tcg_gen_op5(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), tcgv_i64_arg(a3), a4, a5); } -void DNI tcg_gen_op6_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, TCGv_i32 a3, - TCGv_i32 a4, TCGv_i32 a5, TCGv_i32 a6) +static void DNI tcg_gen_op6_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGv_i32 a3, TCGv_i32 a4, + TCGv_i32 a5, TCGv_i32 a6) { tcg_gen_op6(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), tcgv_i32_arg(a3), tcgv_i32_arg(a4), tcgv_i32_arg(a5), tcgv_i32_arg(a6)); } -void DNI tcg_gen_op6_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, TCGv_i64 a3, - TCGv_i64 a4, TCGv_i64 a5, TCGv_i64 a6) +static void DNI tcg_gen_op6_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, + TCGv_i64 a3, TCGv_i64 a4, + TCGv_i64 a5, TCGv_i64 a6) { tcg_gen_op6(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), tcgv_i64_arg(a3), tcgv_i64_arg(a4), tcgv_i64_arg(a5), tcgv_i64_arg(a6)); } -void DNI tcg_gen_op6i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, TCGv_i32 a3, - TCGv_i32 a4, TCGv_i32 a5, TCGArg a6) +static void DNI tcg_gen_op6i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGv_i32 a3, TCGv_i32 a4, + TCGv_i32 a5, TCGArg a6) { tcg_gen_op6(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), tcgv_i32_arg(a3), tcgv_i32_arg(a4), tcgv_i32_arg(a5), a6); } -void DNI tcg_gen_op6i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, TCGv_i64 a3, - TCGv_i64 a4, TCGv_i64 a5, TCGArg a6) +static void DNI tcg_gen_op6i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, + TCGv_i64 a3, TCGv_i64 a4, + TCGv_i64 a5, TCGArg a6) { tcg_gen_op6(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), tcgv_i64_arg(a3), tcgv_i64_arg(a4), tcgv_i64_arg(a5), a6); } -void DNI tcg_gen_op6ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, - TCGv_i32 a3, TCGv_i32 a4, TCGArg a5, TCGArg a6) +static void DNI tcg_gen_op6ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, + TCGv_i32 a3, TCGv_i32 a4, + TCGArg a5, TCGArg a6) { tcg_gen_op6(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), tcgv_i32_arg(a3), tcgv_i32_arg(a4), a5, a6); } -void DNI tcg_gen_op6ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, - TCGv_i64 a3, TCGv_i64 a4, TCGArg a5, TCGArg a6) -{ - tcg_gen_op6(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), - tcgv_i64_arg(a3), tcgv_i64_arg(a4), a5, a6); -} - /* Generic ops. */ void gen_set_label(TCGLabel *l) From patchwork Tue Nov 7 02:48:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741743 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1414587wrr; Mon, 6 Nov 2023 18:50:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IGOp+35aF/xzGbXVBILdcWbv7q3k7sRWz4SO1XBF7bOpqmRNXygUEFcjhNB2Z1gDWgn6P46 X-Received: by 2002:a05:6214:1316:b0:656:2d03:a4be with SMTP id pn22-20020a056214131600b006562d03a4bemr40185056qvb.40.1699325399947; Mon, 06 Nov 2023 18:49:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325399; cv=none; d=google.com; s=arc-20160816; b=YWW2EdqvFepj6N5wq7umSF1S7hB7FGkrgMtiRHWLaRYoXrbx5CFbjqo7axn4R0aARc LFdaQZWIEZwahbMrgMs3GLpYA0HOo9RXPY++94HneY1WQl0xS4wHF1Qk0VgcKKD+il3T Si4PXQf7CCnrh9ZCd7ihqxKe4D0FxqtHtkl9UOxQa6qVjMmSpOS2O7U2ldGACjJRMSCC ldD9H0slpEVng2DGsahwSlJtJV/RI0lJioincbhk92W6xE8LSR29l3jpG0TVLuZDQCPJ pz44m4Hs3VAVtbM1sZTsavLJOzDd2jOjypinUEIAVK9b37ZdUbIwY81HbbQPaJ5Vxhlq OOBg== 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:to:from :dkim-signature; bh=cAcMZdXb3don662dWVOxxMEXAdoPbTxWOBUJh8uey/k=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=bKVphbnZwGqXflTmwsLb0JGeiVAOtdddtyR0yake6suVepJj0+d1j/+a3cRivn2WpV gI3jv3Nsx2r89lMGc17xGEYghkS/W8y3KQf7ooMb97uD1AUWFJI5njBtpfojiuBsjZPE lsvNVFCMhrMR4NZVpiGMEbM5BRgXGiOrjiv1btwYhBwR/5a1cD8A5jY/9wQXNBK2BE3n Ld+88pmoUKOYKSS/gB52iGBDiVBImcfcXB/hCLkhI8WqNoOuylNE2fds3J+1TNB9ybR0 wjqtHFxrp/JVyZE8oK7yr16PImryjB+SgQH03hbaNuwDRfk3wyUDEZ4YwHTch6ZPZfs9 bBXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c2Ah3n0Y; 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 q18-20020ad44352000000b0065b17bc10b7si6338833qvs.239.2023.11.06.18.49.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:49: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=c2Ah3n0Y; 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 1r0C9F-0008JM-NL; Mon, 06 Nov 2023 21:49:01 -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 1r0C9E-0008Hg-0A for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:00 -0500 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9C-0005s8-8j for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:48:59 -0500 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6c320a821c4so4636817b3a.2 for ; Mon, 06 Nov 2023 18:48:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325337; x=1699930137; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=cAcMZdXb3don662dWVOxxMEXAdoPbTxWOBUJh8uey/k=; b=c2Ah3n0YVl1nC8UZ7fSLcwcUQpMA+mQHVnac133DwnsqKe5lmcBHMfEknvRlsrZ+OG yKErZV1T82ASgunCrFtfVpL6m9gjgiTX6OyggZ6ZRQiyfNiR81mWoJvQygMAvxtGivzv wi+EevH4+oTYE5hRUJhf4x9+aDCZ7PLTtIIBt4fwr48yF4ihmiiHZzZoiPgLpPRNl1Bh 2ZojzjngsH75LDqBFg91cJV+CJ7XjptyZnzngohf54vwvF3CZxeAKo1yc5C2b3+VP7F2 Mc/GZPzXuBUTClZE0Pe6578LnzwDy0gJWd1HMki+evFJ+LK90pFaJyQBU65hviUtqCHJ mR7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325337; x=1699930137; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cAcMZdXb3don662dWVOxxMEXAdoPbTxWOBUJh8uey/k=; b=kxYznhBeQq1jwxobWzhD0n2HFfEH0AS8Jb4gTssaN9/pLMDXg3JFP+hosQHTRTCz1N I0q3QVcpVq+jkOU3IOYvIDHa1womq2Da4ssYZ8gVXatLUC7H35osRk4TD4luOfOae2jU 0G/GO0tI6q38trAcDE642n92iSroybAK+fWmm8/+776GhxKSkUD3HR3ke0afZbn2HhNw KCQydAomPo9dlq0gvBOP6CscuNyBkGcBcGyykXnAE4ghMb5JR4FjRHKT3od3mrgZ6eya S/Rz4YXKq8c49UJ2t7l6PwygxijJG8UgSqG5COSPRQtOngdME5I0jjyV9CGgGu2VVnQG WW3w== X-Gm-Message-State: AOJu0YwFTjmgE4ExXm2LYPRny+w2zcYthK8sOCSe3xCGG95rPvb0xGY+ QfRJQt/KW085QKFf4pwLFxKQ5SBf1FGnjyWUyIQ= X-Received: by 2002:a05:6a00:1345:b0:6bd:f760:6ab1 with SMTP id k5-20020a056a00134500b006bdf7606ab1mr29534190pfu.14.1699325336974; Mon, 06 Nov 2023 18:48:56 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:56 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 17/35] tcg: Move tcg_constant_* out of line Date: Mon, 6 Nov 2023 18:48:24 -0800 Message-Id: <20231107024842.7650-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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 Signed-off-by: Richard Henderson Message-Id: <20231029210848.78234-10-richard.henderson@linaro.org> --- include/tcg/tcg-op-common.h | 8 ++++++++ include/tcg/tcg.h | 26 -------------------------- tcg/tcg-internal.h | 7 +++++++ tcg/tcg.c | 15 +++++++++++++++ 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h index 760c67683b..dddf93067e 100644 --- a/include/tcg/tcg-op-common.h +++ b/include/tcg/tcg-op-common.h @@ -12,6 +12,11 @@ #include "exec/helper-proto-common.h" #include "exec/helper-gen-common.h" +TCGv_i32 tcg_constant_i32(int32_t val); +TCGv_i64 tcg_constant_i64(int64_t val); +TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val); +TCGv_vec tcg_constant_vec_matching(TCGv_vec match, unsigned vece, int64_t val); + /* Generic ops. */ void gen_set_label(TCGLabel *l); @@ -459,6 +464,9 @@ void tcg_gen_stl_vec(TCGv_vec r, TCGv_ptr base, TCGArg offset, TCGType t); # define NAT TCGv_i64 #endif +TCGv_ptr tcg_constant_ptr_int(intptr_t x); +#define tcg_constant_ptr(X) tcg_constant_ptr_int((intptr_t)(X)) + static inline void tcg_gen_ld_ptr(TCGv_ptr r, TCGv_ptr a, intptr_t o) { glue(tcg_gen_ld_,PTR)((NAT)r, a, o); diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 3a4c0f124f..1ae131c242 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -934,32 +934,6 @@ void tcg_remove_ops_after(TCGOp *op); void tcg_optimize(TCGContext *s); -/* - * Locate or create a read-only temporary that is a constant. - * This kind of temporary need not be freed, but for convenience - * will be silently ignored by tcg_temp_free_*. - */ -TCGTemp *tcg_constant_internal(TCGType type, int64_t val); - -static inline TCGv_i32 tcg_constant_i32(int32_t val) -{ - return temp_tcgv_i32(tcg_constant_internal(TCG_TYPE_I32, val)); -} - -static inline TCGv_i64 tcg_constant_i64(int64_t val) -{ - return temp_tcgv_i64(tcg_constant_internal(TCG_TYPE_I64, val)); -} - -TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val); -TCGv_vec tcg_constant_vec_matching(TCGv_vec match, unsigned vece, int64_t val); - -#if UINTPTR_MAX == UINT32_MAX -# define tcg_constant_ptr(x) ((TCGv_ptr)tcg_constant_i32((intptr_t)(x))) -#else -# define tcg_constant_ptr(x) ((TCGv_ptr)tcg_constant_i64((intptr_t)(x))) -#endif - TCGLabel *gen_new_label(void); /** diff --git a/tcg/tcg-internal.h b/tcg/tcg-internal.h index c9ac34fc3d..6c9d9e48db 100644 --- a/tcg/tcg-internal.h +++ b/tcg/tcg-internal.h @@ -83,6 +83,13 @@ static inline TCGv_i64 TCGV128_HIGH(TCGv_i128 t) bool tcg_target_has_memory_bswap(MemOp memop); +/* + * Locate or create a read-only temporary that is a constant. + * This kind of temporary need not be freed, but for convenience + * will be silently ignored by tcg_temp_free_*. + */ +TCGTemp *tcg_constant_internal(TCGType type, int64_t val); + void tcg_gen_op1(TCGOpcode, TCGArg); void tcg_gen_op2(TCGOpcode, TCGArg, TCGArg); void tcg_gen_op3(TCGOpcode, TCGArg, TCGArg, TCGArg); diff --git a/tcg/tcg.c b/tcg/tcg.c index 6766b60b8a..ab0d227c00 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1806,6 +1806,21 @@ TCGTemp *tcg_constant_internal(TCGType type, int64_t val) return ts; } +TCGv_i32 tcg_constant_i32(int32_t val) +{ + return temp_tcgv_i32(tcg_constant_internal(TCG_TYPE_I32, val)); +} + +TCGv_i64 tcg_constant_i64(int64_t val) +{ + return temp_tcgv_i64(tcg_constant_internal(TCG_TYPE_I64, val)); +} + +TCGv_ptr tcg_constant_ptr_int(intptr_t val) +{ + return temp_tcgv_ptr(tcg_constant_internal(TCG_TYPE_PTR, val)); +} + TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val) { val = dup_const(vece, val); From patchwork Tue Nov 7 02:48:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741754 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415362wrr; Mon, 6 Nov 2023 18:52:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IEU8EdQHCDdjYnzqoSkzP95EuT6lmXIrta4ucf3LutMtyGXO+xyORKXbEvU7Bu7OKsmt6Xq X-Received: by 2002:a05:620a:1c:b0:779:efb4:73bb with SMTP id j28-20020a05620a001c00b00779efb473bbmr27810878qki.41.1699325552334; Mon, 06 Nov 2023 18:52:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325552; cv=none; d=google.com; s=arc-20160816; b=lFMgwqohDMRNE2dprde1YqN+4orT5L+oDVRH01F5N5wkXuD2D9h3vo/C0xy3duv4KM hdODuZSYUZ8652dqbb8DMMvektTnDFhvcPtH0GwgjG9XpJP563vI2ytrjQC4Xvko/X2M LON8pRIQKexCkCVxY3ZkKzJeQ4HTSc/oHkQoaLy/wCQ0xvtkARElt6hHruOP1FNXqiWP ota6jFT4mjfZAO7JK1l4DFZGJyn68jM4Ig6obEUafDWgknVsGJF5+Stc9QpINRfCcfJ6 DGD2DKVkYGNFiNVw6VazApY+BCRC0AtYIBu1rN/RmJ9w3JhHfaS4Z5aYXdR007A9Xqs7 jzZg== 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:to:from :dkim-signature; bh=fJ/xY0iUs9P73AiIEfKXEfuW9trQF9ga4siF3shzUGM=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ThnjEeH+WnyFBnq2lRNGAuXgwb0lqA/gWYgc8v8JooTAdjOch+qEdYrYNJrR6KoTVN HJFVKK/xnmiHa5MhJGG6O0SeD098W49rxyZZ/HhKeyT93nGHbf0GrPSplDms0LzFRh+p LzuuHTaGKBNLM1ddVf7v/DgrkchMzAp06d88nkuwaWOfOeYBsvHE+AXQsNOoSM4XXVjj gbI1P0i2dongUtTJ5rlxWHMgJA3dIgg+xjz1ILbvbvxPcdIcAS2lCeeluTnUsXA0OQNO 0o8uDWVWupr84b5wQIRCOUe9W2/vY/foWb+XqvA2TY7PyhxLpDePiPkY64lpEMmT2Aw5 TcMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NcyzqWf3; 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 i1-20020a05620a404100b0077a02969c78si6211351qko.487.2023.11.06.18.52.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:52:32 -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=NcyzqWf3; 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 1r0C9I-0008KO-0x; Mon, 06 Nov 2023 21:49:04 -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 1r0C9F-0008Id-2S for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:01 -0500 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9D-0005sK-2K for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:00 -0500 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6c39ad730aaso1899700b3a.0 for ; Mon, 06 Nov 2023 18:48:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325338; x=1699930138; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=fJ/xY0iUs9P73AiIEfKXEfuW9trQF9ga4siF3shzUGM=; b=NcyzqWf3a/dXpp1jIZOGbb0MWBzbt47S6Doza1OWkePjsOFtpnMy/sglCdYXTLpNCm 5oAzEauqIvYG9VcpXt1nMo8ZohbtZA5guGk90PoJRN34BRSUngR0RKkeGDyU1wAlvFpy FD1S6JzYBEyFZhEq4adz9Sw9dSZ5yP5Oc3rRBotYzZ8qhWDMxP6xIqci4VhHxmMxrWXq b+iVJTOP0kthdQwPx2l6ZwgmoiVkvqWLdFPGjMZyiLEz+Kygp+pjgFWHa0bZPHDX/i0J JJ/8RiEcLs9Un0CrmtVTa2bjE1li5O61OPjSpCrhP8UANIvhzY078howBbw3Fcn0YJCx IJ5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325338; x=1699930138; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fJ/xY0iUs9P73AiIEfKXEfuW9trQF9ga4siF3shzUGM=; b=cf/XgX1ke9GOTo7SR+FhgWMuZq0TEuKvidIj7tFcS5dUp+z+QGyOjTcTNJbOTKP9gR XzFEkXHpTHT99kuAiE3nPdL8beMh0HGeyrvuDgsXLCy6xaUJGjqVYJJcX6iwDHGktt+k jl0aORpE56THYmALM8ECAzXgkyLV3V2mE+LwMfq/MBnnbbQz2jImBaOPHcvRbSzvzG3p 2axCDJr792DIszxL+/KjAS02mmnfpjd9drXc8P4fUzrNOCgPFC15MKZbWEhhrZmBju/s pUI07ggViasS5ExbS1iRt0dGHWKhe87lFvaP693VfmLjAz/oDouMNpPW7h90XiYBWDH6 5Hgw== X-Gm-Message-State: AOJu0Yzv+Pf+pHMUckPt/wb3CBCnvr2fHy00itVUfg+BcFvNVHh0cK8O qvHOspTwiEPst1J0brUXEyZv1PSC/FEInNHZWL4= X-Received: by 2002:aa7:8881:0:b0:691:2d4:23b2 with SMTP id z1-20020aa78881000000b0069102d423b2mr28134427pfe.15.1699325337796; Mon, 06 Nov 2023 18:48:57 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:57 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 18/35] tcg: Move tcg_temp_new_*, tcg_global_mem_new_* out of line Date: Mon, 6 Nov 2023 18:48:25 -0800 Message-Id: <20231107024842.7650-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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 Signed-off-by: Richard Henderson Message-Id: <20231029210848.78234-11-richard.henderson@linaro.org> --- include/tcg/tcg-op-common.h | 11 ++++++ include/tcg/tcg-temp-internal.h | 27 +++----------- include/tcg/tcg.h | 51 -------------------------- tcg/tcg.c | 64 +++++++++++++++++++++++++++++++-- 4 files changed, 76 insertions(+), 77 deletions(-) diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h index dddf93067e..2d932a515e 100644 --- a/include/tcg/tcg-op-common.h +++ b/include/tcg/tcg-op-common.h @@ -17,6 +17,17 @@ TCGv_i64 tcg_constant_i64(int64_t val); TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val); TCGv_vec tcg_constant_vec_matching(TCGv_vec match, unsigned vece, int64_t val); +TCGv_i32 tcg_temp_new_i32(void); +TCGv_i64 tcg_temp_new_i64(void); +TCGv_ptr tcg_temp_new_ptr(void); +TCGv_i128 tcg_temp_new_i128(void); +TCGv_vec tcg_temp_new_vec(TCGType type); +TCGv_vec tcg_temp_new_vec_matching(TCGv_vec match); + +TCGv_i32 tcg_global_mem_new_i32(TCGv_ptr reg, intptr_t off, const char *name); +TCGv_i64 tcg_global_mem_new_i64(TCGv_ptr reg, intptr_t off, const char *name); +TCGv_ptr tcg_global_mem_new_ptr(TCGv_ptr reg, intptr_t off, const char *name); + /* Generic ops. */ void gen_set_label(TCGLabel *l); diff --git a/include/tcg/tcg-temp-internal.h b/include/tcg/tcg-temp-internal.h index dded2917e5..2d45cc45d2 100644 --- a/include/tcg/tcg-temp-internal.h +++ b/include/tcg/tcg-temp-internal.h @@ -56,28 +56,9 @@ static inline void tcg_temp_free_vec(TCGv_vec arg) tcg_temp_free_internal(tcgv_vec_temp(arg)); } -static inline TCGv_i32 tcg_temp_ebb_new_i32(void) -{ - TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_I32, TEMP_EBB); - return temp_tcgv_i32(t); -} - -static inline TCGv_i64 tcg_temp_ebb_new_i64(void) -{ - TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_I64, TEMP_EBB); - return temp_tcgv_i64(t); -} - -static inline TCGv_i128 tcg_temp_ebb_new_i128(void) -{ - TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_I128, TEMP_EBB); - return temp_tcgv_i128(t); -} - -static inline TCGv_ptr tcg_temp_ebb_new_ptr(void) -{ - TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_PTR, TEMP_EBB); - return temp_tcgv_ptr(t); -} +TCGv_i32 tcg_temp_ebb_new_i32(void); +TCGv_i64 tcg_temp_ebb_new_i64(void); +TCGv_ptr tcg_temp_ebb_new_ptr(void); +TCGv_i128 tcg_temp_ebb_new_i128(void); #endif /* TCG_TEMP_FREE_H */ diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 1ae131c242..fc218fd381 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -795,57 +795,6 @@ void tb_target_set_jmp_target(const TranslationBlock *, int, void tcg_set_frame(TCGContext *s, TCGReg reg, intptr_t start, intptr_t size); -TCGTemp *tcg_global_mem_new_internal(TCGType, TCGv_ptr, - intptr_t, const char *); -TCGTemp *tcg_temp_new_internal(TCGType, TCGTempKind); -TCGv_vec tcg_temp_new_vec(TCGType type); -TCGv_vec tcg_temp_new_vec_matching(TCGv_vec match); - -static inline TCGv_i32 tcg_global_mem_new_i32(TCGv_ptr reg, intptr_t offset, - const char *name) -{ - TCGTemp *t = tcg_global_mem_new_internal(TCG_TYPE_I32, reg, offset, name); - return temp_tcgv_i32(t); -} - -static inline TCGv_i32 tcg_temp_new_i32(void) -{ - TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_I32, TEMP_TB); - return temp_tcgv_i32(t); -} - -static inline TCGv_i64 tcg_global_mem_new_i64(TCGv_ptr reg, intptr_t offset, - const char *name) -{ - TCGTemp *t = tcg_global_mem_new_internal(TCG_TYPE_I64, reg, offset, name); - return temp_tcgv_i64(t); -} - -static inline TCGv_i64 tcg_temp_new_i64(void) -{ - TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_I64, TEMP_TB); - return temp_tcgv_i64(t); -} - -static inline TCGv_i128 tcg_temp_new_i128(void) -{ - TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_I128, TEMP_TB); - return temp_tcgv_i128(t); -} - -static inline TCGv_ptr tcg_global_mem_new_ptr(TCGv_ptr reg, intptr_t offset, - const char *name) -{ - TCGTemp *t = tcg_global_mem_new_internal(TCG_TYPE_PTR, reg, offset, name); - return temp_tcgv_ptr(t); -} - -static inline TCGv_ptr tcg_temp_new_ptr(void) -{ - TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_PTR, TEMP_TB); - return temp_tcgv_ptr(t); -} - #define TCG_CT_CONST 1 /* any constant of register size */ typedef struct TCGArgConstraint { diff --git a/tcg/tcg.c b/tcg/tcg.c index ab0d227c00..ec358ce5c0 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1572,8 +1572,8 @@ void tcg_set_frame(TCGContext *s, TCGReg reg, intptr_t start, intptr_t size) = tcg_global_reg_new_internal(s, TCG_TYPE_PTR, reg, "_frame"); } -TCGTemp *tcg_global_mem_new_internal(TCGType type, TCGv_ptr base, - intptr_t offset, const char *name) +static TCGTemp *tcg_global_mem_new_internal(TCGv_ptr base, intptr_t offset, + const char *name, TCGType type) { TCGContext *s = tcg_ctx; TCGTemp *base_ts = tcgv_ptr_temp(base); @@ -1632,7 +1632,25 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TCGv_ptr base, return ts; } -TCGTemp *tcg_temp_new_internal(TCGType type, TCGTempKind kind) +TCGv_i32 tcg_global_mem_new_i32(TCGv_ptr reg, intptr_t off, const char *name) +{ + TCGTemp *ts = tcg_global_mem_new_internal(reg, off, name, TCG_TYPE_I32); + return temp_tcgv_i32(ts); +} + +TCGv_i64 tcg_global_mem_new_i64(TCGv_ptr reg, intptr_t off, const char *name) +{ + TCGTemp *ts = tcg_global_mem_new_internal(reg, off, name, TCG_TYPE_I64); + return temp_tcgv_i64(ts); +} + +TCGv_ptr tcg_global_mem_new_ptr(TCGv_ptr reg, intptr_t off, const char *name) +{ + TCGTemp *ts = tcg_global_mem_new_internal(reg, off, name, TCG_TYPE_PTR); + return temp_tcgv_ptr(ts); +} + +static TCGTemp *tcg_temp_new_internal(TCGType type, TCGTempKind kind) { TCGContext *s = tcg_ctx; TCGTemp *ts; @@ -1696,6 +1714,46 @@ TCGTemp *tcg_temp_new_internal(TCGType type, TCGTempKind kind) return ts; } +TCGv_i32 tcg_temp_new_i32(void) +{ + return temp_tcgv_i32(tcg_temp_new_internal(TCG_TYPE_I32, TEMP_TB)); +} + +TCGv_i32 tcg_temp_ebb_new_i32(void) +{ + return temp_tcgv_i32(tcg_temp_new_internal(TCG_TYPE_I32, TEMP_EBB)); +} + +TCGv_i64 tcg_temp_new_i64(void) +{ + return temp_tcgv_i64(tcg_temp_new_internal(TCG_TYPE_I64, TEMP_TB)); +} + +TCGv_i64 tcg_temp_ebb_new_i64(void) +{ + return temp_tcgv_i64(tcg_temp_new_internal(TCG_TYPE_I64, TEMP_EBB)); +} + +TCGv_ptr tcg_temp_new_ptr(void) +{ + return temp_tcgv_ptr(tcg_temp_new_internal(TCG_TYPE_PTR, TEMP_TB)); +} + +TCGv_ptr tcg_temp_ebb_new_ptr(void) +{ + return temp_tcgv_ptr(tcg_temp_new_internal(TCG_TYPE_PTR, TEMP_EBB)); +} + +TCGv_i128 tcg_temp_new_i128(void) +{ + return temp_tcgv_i128(tcg_temp_new_internal(TCG_TYPE_I128, TEMP_TB)); +} + +TCGv_i128 tcg_temp_ebb_new_i128(void) +{ + return temp_tcgv_i128(tcg_temp_new_internal(TCG_TYPE_I128, TEMP_EBB)); +} + TCGv_vec tcg_temp_new_vec(TCGType type) { TCGTemp *t; From patchwork Tue Nov 7 02:48:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741753 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415126wrr; Mon, 6 Nov 2023 18:51:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IFX3hos37TWkaHXwxrc/PIcmQC3HrF3ZN9VN6MPtgdkjdXoPGmx8BaubjmsuOjn0FwM92+l X-Received: by 2002:a05:6214:d0c:b0:65d:dcc:9754 with SMTP id 12-20020a0562140d0c00b0065d0dcc9754mr41828504qvh.30.1699325507598; Mon, 06 Nov 2023 18:51:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325507; cv=none; d=google.com; s=arc-20160816; b=ApUqj/kUY3iEddLre51FtToRBbdlOX6KQqXOyGxAv7dH5eFnYMmC2HFSbudxJhyhXq 7jTv3WaGN520oDpWXveB8i11liVZKVkPOrfku3WK06i+/dxYRLzZyyDsqSB1B9P2Ze7f BsGAuMaBHLwi65djFHvERQurk2snFQOpCm7ILSdeDmkr2lBv2eroSX6ubD8zdfvicgom f6lJ2i3ohkFhn5d0hXPEZPewLQ18ImtL2xNYa4pcajJElSPQ9APVkFT1jH+b8OhZWzLy FA3EgR3XeEFfA5qJ0Jl7THUNArcgorHuXG3gw55jL6/Crdgt70atYfEXJVfWaatKBjB+ 86ew== 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:to:from :dkim-signature; bh=DlhphZRnGb1iIQOEtk7AVLi5uVwg8AB9d1n3Ic46tJk=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=kT5u4vYzE3xnhi84zIq7yPA1NkP8GptZcfNJdzxjEOrHStXalrFa3/7j4xhuLZN0wg 5EDzozqkFuqTFXoyfkmr9kmVseLJBciWvfS6I38zLK8ZyU0OYDyEllD+wPRxeMJQMFug V0XAdd0gImdoh9kP+CN4e4i4Ko7HGM3hXjvV/566pR5YjNkqgeDVM6QuFjSFvJzUfpq3 cPEF0USMmD+YLE6wH6yNnCAl1+lhBecwLv4wy+C45Bi3sQ9jVKfzUibfi72r+5Mk/pyi M00PncpmZNkvJo7RmFwMN/2AqYxC399dgm2CnFygBwasPQTGdh5d3mJ8I7/CdUxJAi0s Dw+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jO3ba2Qn; 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 pe26-20020a056214495a00b0066fbb476ee6si6464328qvb.507.2023.11.06.18.51.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:51:47 -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=jO3ba2Qn; 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 1r0C9I-0008KX-7u; Mon, 06 Nov 2023 21:49:04 -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 1r0C9F-0008JU-P7 for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:01 -0500 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9D-0005sc-SH for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:01 -0500 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-5b980391d70so3931710a12.0 for ; Mon, 06 Nov 2023 18:48:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325338; x=1699930138; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=DlhphZRnGb1iIQOEtk7AVLi5uVwg8AB9d1n3Ic46tJk=; b=jO3ba2Qnxy0dll63+Bohr2n7klyTSDz6d6skvLf0Uql2hwezj/R0xAS1pZe5zu1IOA YjiF3gDZbuuyvfiR3IKU9MmjJTwIYZf5hTvnUPvdvi9h5P6sRo2L+laMt/HEZK3quWKt PTQPO3NG00puZCMUICAKtxayTlV+FNQ5zrECFzVr8yuSyvMKZMGJUmwvFoEPV3hfMUsc iofHKjJq9ZVcXHii8C8C4U1mDGZDgEtK/YztAoIvSBRmRcrZupfleVsPOZ6Q+tiFKiuU iFU/vEUtmYkLzJOFfF6NZO8caSJo0naKiRhmEebHVf3l27uNnph3+7/ebpWWjrI5aRnj wGnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325338; x=1699930138; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DlhphZRnGb1iIQOEtk7AVLi5uVwg8AB9d1n3Ic46tJk=; b=V6G5BEzIL0/L7UUIYTJfU8iwei6nRb/OQkwAATbtFHJYnIz4FfmZ/Q18CIX7g71yVW PhzGg1fpdStHFmeCEDOqAKMC202bC9i1s7wYtrLIB4k4ycEfGhB7g2tM2tfrqsGTQpUn CpPw1I7MYiEV3zPbcbvxcDTLvFzSFJU5oxfNseo7kIiyl1QNTW238/oXAWCczJwjS80q q0RqjTAI9xk6Dn77jAz/X5zuLgycIJ6TBvfFf7OsxYxukrdH55LCA53Jucm8u2uqBGpz AlQdZOwIqNOnUpyG17g3beUYbG2aknTDMMLn7tlZ3yfNn6vBFQygqYTdHM0/7fcBPQM7 Zwyw== X-Gm-Message-State: AOJu0Yz3fv19lzB3Nn2rJ6Wtc93DJChz6iOjp5AfKLJZWRxaoVaJvLJL X54KcVFEqSLBdahB27eF5B3TEfG188PQb7Fv6AY= X-Received: by 2002:a05:6a20:8e2a:b0:132:ff57:7fab with SMTP id y42-20020a056a208e2a00b00132ff577fabmr38361195pzj.2.1699325338512; Mon, 06 Nov 2023 18:48:58 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 19/35] tcg: Move tcg_temp_free_* out of line Date: Mon, 6 Nov 2023 18:48:26 -0800 Message-Id: <20231107024842.7650-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.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 Signed-off-by: Richard Henderson Message-Id: <20231029210848.78234-12-richard.henderson@linaro.org> --- include/tcg/tcg-temp-internal.h | 29 +++++------------------------ tcg/tcg.c | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/include/tcg/tcg-temp-internal.h b/include/tcg/tcg-temp-internal.h index 2d45cc45d2..44192c55a9 100644 --- a/include/tcg/tcg-temp-internal.h +++ b/include/tcg/tcg-temp-internal.h @@ -31,30 +31,11 @@ void tcg_temp_free_internal(TCGTemp *); -static inline void tcg_temp_free_i32(TCGv_i32 arg) -{ - tcg_temp_free_internal(tcgv_i32_temp(arg)); -} - -static inline void tcg_temp_free_i64(TCGv_i64 arg) -{ - tcg_temp_free_internal(tcgv_i64_temp(arg)); -} - -static inline void tcg_temp_free_i128(TCGv_i128 arg) -{ - tcg_temp_free_internal(tcgv_i128_temp(arg)); -} - -static inline void tcg_temp_free_ptr(TCGv_ptr arg) -{ - tcg_temp_free_internal(tcgv_ptr_temp(arg)); -} - -static inline void tcg_temp_free_vec(TCGv_vec arg) -{ - tcg_temp_free_internal(tcgv_vec_temp(arg)); -} +void tcg_temp_free_i32(TCGv_i32 arg); +void tcg_temp_free_i64(TCGv_i64 arg); +void tcg_temp_free_i128(TCGv_i128 arg); +void tcg_temp_free_ptr(TCGv_ptr arg); +void tcg_temp_free_vec(TCGv_vec arg); TCGv_i32 tcg_temp_ebb_new_i32(void); TCGv_i64 tcg_temp_ebb_new_i64(void); diff --git a/tcg/tcg.c b/tcg/tcg.c index ec358ce5c0..258bd1c10b 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1809,6 +1809,31 @@ void tcg_temp_free_internal(TCGTemp *ts) } } +void tcg_temp_free_i32(TCGv_i32 arg) +{ + tcg_temp_free_internal(tcgv_i32_temp(arg)); +} + +void tcg_temp_free_i64(TCGv_i64 arg) +{ + tcg_temp_free_internal(tcgv_i64_temp(arg)); +} + +void tcg_temp_free_i128(TCGv_i128 arg) +{ + tcg_temp_free_internal(tcgv_i128_temp(arg)); +} + +void tcg_temp_free_ptr(TCGv_ptr arg) +{ + tcg_temp_free_internal(tcgv_ptr_temp(arg)); +} + +void tcg_temp_free_vec(TCGv_vec arg) +{ + tcg_temp_free_internal(tcgv_vec_temp(arg)); +} + TCGTemp *tcg_constant_internal(TCGType type, int64_t val) { TCGContext *s = tcg_ctx; From patchwork Tue Nov 7 02:48:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741744 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1414605wrr; Mon, 6 Nov 2023 18:50:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLyhydqgjGT5kbYLmVyJYZc7YKGfeSiKFi7OcNqQLtD/eDRKKLpnDLWHhT7MfEgZ5qxdPh X-Received: by 2002:a05:620a:4609:b0:775:903e:388c with SMTP id br9-20020a05620a460900b00775903e388cmr38603890qkb.2.1699325403764; Mon, 06 Nov 2023 18:50:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325403; cv=none; d=google.com; s=arc-20160816; b=KZpSBGVvPEsxB9YTvhrbQkuOhhwcgzKQB3Bxb8OQuk8n19phCsNjzZwFXlpN78dUw/ cGAWdYAzyf6CcS5g/d7CJ9g5g/PxESoeQGw9XQpva+nPaeInLEaUbjoabiisG2Y+QLS1 WZc9V2XEK8s18d8yHcnouGrFtv60o20UuDwKS2//s2puSiFwGDbX+RuVKuuh7DDvVTC8 CXPxjJFfz9JA74lKWO8iVd13Ik890OEACJuRgjATUdA5NKluCDj60lkcSsn9399SaTGz Mbda1T71fCdioBn7HegTr2j9S+JE3hFQG4AKAEcSPMJeR47n/hQeM+rq9RA8GyyZU4o9 PVuQ== 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:to:from :dkim-signature; bh=zz7hg2/atmOJ2zc1IN2ls7Jl6BOw07GScu60nlbqXVU=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=c7kbBG0tmwmnD9Pj09iK70BkDyglcMhHlGe9kIOKs4eKFEg4+IKfmk/Vltf3SOVc4H TjtmYxa8O+9HQf8aNz/E+sSp2S3IL2ifrMBQnPJ5Dj2jRiUqLBJr07Owks1GIKdZN+Si stEhlY6881oTZ8I3Ue72kX8juPo0t5RJShC9mnamcptmryh+rQSFTBACYGD+Mxbh76xi 11HtmyzES7p+7aeBmwMjF1Ty2Qrc5sFvBtBKJRRm3f97T8XsstOKsZPO1xwov/hijDT7 Apjohsu2QIM8HiB8/kZwyo1Z8/6oEoEuxA64gdSHe7LDDEpeEPqgvchlNg0kpnSPo6sO k72g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pmj72iNH; 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 i6-20020a05620a27c600b0076ce5b9f0f6si6615104qkp.472.2023.11.06.18.50.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:50:03 -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=Pmj72iNH; 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 1r0C9J-0008Mv-Jk; Mon, 06 Nov 2023 21:49:05 -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 1r0C9G-0008K2-Lo for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:02 -0500 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9E-0005so-Fg for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:02 -0500 Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3b565e35fedso3105295b6e.2 for ; Mon, 06 Nov 2023 18:49:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325339; x=1699930139; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=zz7hg2/atmOJ2zc1IN2ls7Jl6BOw07GScu60nlbqXVU=; b=Pmj72iNHsUMqQu7zxgNh60hoXOwKK5oCFtuj88ifW/tfTlmmNzPpbMlxL1ipbW3Ook MJbhTCJ4tVvA3qYc/m+1+7DvZQdZq1cxfkdv2BFFZRS+gqnI89BPVCmdciTZ/h/mDJFI RjVNho149kWiCmEOfEfnLrk1bmP+5BiMiLEyFriunILOZZO3TJvyAYITdDlwlPqXPxFw MS2frY+KMQQZsOB/csgvvHPMKzu0mx5ptkkwhRz1FzwePd9hsB1FP1gTJoM44VNZSm+L 5qAJQ2geLm0sU0xiZTVFr5D4ExPAToAHlH621wetL+8a+6WPFPFe/f7/BHEmb53SjWTZ Wu6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325339; x=1699930139; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zz7hg2/atmOJ2zc1IN2ls7Jl6BOw07GScu60nlbqXVU=; b=OFGAs4NNVa0o3Z4uPq3oPKyix9RrPzMXupmImvm50KPXmjwr0MlIc06YdlZ6U52DlH YFzvS/lnjVR4oOpzZ9gNmyLr9gXFjWal0XXBmtCenjq0zoHKAGJiJTbR61ZJmCFvdCl9 8qzF4u6pPwkq430kdwYsxCx99PgeunSPCOCeOsxakKpmkW6JKhPRgprgoowdIFsRp6Zn fTg++yH6ifBZWFnfFUEK8rJe25XQCmFCgslRcXIMTLSu7tmfvjnx0As5wcclkjWxNEwd /rbBGHxvh+ZeADBp6nLRlziiBAH3woeE5Vzf8Vh5HOiQaGusmS6fCG+tSv/AheJYrXY2 yZGg== X-Gm-Message-State: AOJu0YzmQ3dvfrutmQTf5NQOjiG5G3k3kuZjWlg5er17yGB6PuVu+MyQ m3BD6E44x0I3EFIAxmLbnvCafq6e451rkrKrpnc= X-Received: by 2002:a05:6808:1810:b0:3b2:eab1:918 with SMTP id bh16-20020a056808181000b003b2eab10918mr37694519oib.29.1699325339337; Mon, 06 Nov 2023 18:48:59 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 20/35] tcg/mips: Split out tcg_out_setcond_int Date: Mon, 6 Nov 2023 18:48:27 -0800 Message-Id: <20231107024842.7650-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::230; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x230.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 Return the temp and a set of flags, to be used as a primitive for setcond, brcond, movcond. Signed-off-by: Richard Henderson Message-Id: <20231026041404.1229328-2-richard.henderson@linaro.org> --- tcg/mips/tcg-target.c.inc | 302 +++++++++++++++----------------------- 1 file changed, 118 insertions(+), 184 deletions(-) diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index 328984ccff..89681f00fe 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -871,71 +871,83 @@ static void tcg_out_addsub2(TCGContext *s, TCGReg rl, TCGReg rh, TCGReg al, } } -/* Bit 0 set if inversion required; bit 1 set if swapping required. */ -#define MIPS_CMP_INV 1 -#define MIPS_CMP_SWAP 2 +#define SETCOND_INV TCG_TARGET_NB_REGS +#define SETCOND_NEZ (SETCOND_INV << 1) +#define SETCOND_FLAGS (SETCOND_INV | SETCOND_NEZ) -static const uint8_t mips_cmp_map[16] = { - [TCG_COND_LT] = 0, - [TCG_COND_LTU] = 0, - [TCG_COND_GE] = MIPS_CMP_INV, - [TCG_COND_GEU] = MIPS_CMP_INV, - [TCG_COND_LE] = MIPS_CMP_INV | MIPS_CMP_SWAP, - [TCG_COND_LEU] = MIPS_CMP_INV | MIPS_CMP_SWAP, - [TCG_COND_GT] = MIPS_CMP_SWAP, - [TCG_COND_GTU] = MIPS_CMP_SWAP, -}; +static int tcg_out_setcond_int(TCGContext *s, TCGCond cond, TCGReg ret, + TCGReg arg1, TCGReg arg2) +{ + int flags = 0; + + switch (cond) { + case TCG_COND_EQ: /* -> NE */ + case TCG_COND_GE: /* -> LT */ + case TCG_COND_GEU: /* -> LTU */ + case TCG_COND_LE: /* -> GT */ + case TCG_COND_LEU: /* -> GTU */ + cond = tcg_invert_cond(cond); + flags ^= SETCOND_INV; + break; + default: + break; + } + + switch (cond) { + case TCG_COND_NE: + flags |= SETCOND_NEZ; + if (arg2 == 0) { + return arg1 | flags; + } + tcg_out_opc_reg(s, OPC_XOR, ret, arg1, arg2); + break; + case TCG_COND_LT: + tcg_out_opc_reg(s, OPC_SLT, ret, arg1, arg2); + break; + case TCG_COND_LTU: + tcg_out_opc_reg(s, OPC_SLTU, ret, arg1, arg2); + break; + case TCG_COND_GT: + tcg_out_opc_reg(s, OPC_SLT, ret, arg2, arg1); + break; + case TCG_COND_GTU: + tcg_out_opc_reg(s, OPC_SLTU, ret, arg2, arg1); + break; + default: + g_assert_not_reached(); + } + return ret | flags; +} + +static void tcg_out_setcond_end(TCGContext *s, TCGReg ret, int tmpflags) +{ + if (tmpflags != ret) { + TCGReg tmp = tmpflags & ~SETCOND_FLAGS; + + switch (tmpflags & SETCOND_FLAGS) { + case SETCOND_INV: + /* Intermediate result is boolean: simply invert. */ + tcg_out_opc_imm(s, OPC_XORI, ret, tmp, 1); + break; + case SETCOND_NEZ: + /* Intermediate result is zero/non-zero: test != 0. */ + tcg_out_opc_reg(s, OPC_SLTU, ret, TCG_REG_ZERO, tmp); + break; + case SETCOND_NEZ | SETCOND_INV: + /* Intermediate result is zero/non-zero: test == 0. */ + tcg_out_opc_imm(s, OPC_SLTIU, ret, tmp, 1); + break; + default: + g_assert_not_reached(); + } + } +} static void tcg_out_setcond(TCGContext *s, TCGCond cond, TCGReg ret, TCGReg arg1, TCGReg arg2) { - MIPSInsn s_opc = OPC_SLTU; - int cmp_map; - - switch (cond) { - case TCG_COND_EQ: - if (arg2 != 0) { - tcg_out_opc_reg(s, OPC_XOR, ret, arg1, arg2); - arg1 = ret; - } - tcg_out_opc_imm(s, OPC_SLTIU, ret, arg1, 1); - break; - - case TCG_COND_NE: - if (arg2 != 0) { - tcg_out_opc_reg(s, OPC_XOR, ret, arg1, arg2); - arg1 = ret; - } - tcg_out_opc_reg(s, OPC_SLTU, ret, TCG_REG_ZERO, arg1); - break; - - case TCG_COND_LT: - case TCG_COND_GE: - case TCG_COND_LE: - case TCG_COND_GT: - s_opc = OPC_SLT; - /* FALLTHRU */ - - case TCG_COND_LTU: - case TCG_COND_GEU: - case TCG_COND_LEU: - case TCG_COND_GTU: - cmp_map = mips_cmp_map[cond]; - if (cmp_map & MIPS_CMP_SWAP) { - TCGReg t = arg1; - arg1 = arg2; - arg2 = t; - } - tcg_out_opc_reg(s, s_opc, ret, arg1, arg2); - if (cmp_map & MIPS_CMP_INV) { - tcg_out_opc_imm(s, OPC_XORI, ret, ret, 1); - } - break; - - default: - g_assert_not_reached(); - break; - } + int tmpflags = tcg_out_setcond_int(s, cond, ret, arg1, arg2); + tcg_out_setcond_end(s, ret, tmpflags); } static void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGReg arg1, @@ -948,9 +960,7 @@ static void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGReg arg1, [TCG_COND_GE] = OPC_BGEZ, }; - MIPSInsn s_opc = OPC_SLTU; - MIPSInsn b_opc; - int cmp_map; + MIPSInsn b_opc = 0; switch (cond) { case TCG_COND_EQ: @@ -959,7 +969,6 @@ static void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGReg arg1, case TCG_COND_NE: b_opc = OPC_BNE; break; - case TCG_COND_LT: case TCG_COND_GT: case TCG_COND_LE: @@ -968,133 +977,76 @@ static void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGReg arg1, b_opc = b_zero[cond]; arg2 = arg1; arg1 = 0; - break; } - s_opc = OPC_SLT; - /* FALLTHRU */ - - case TCG_COND_LTU: - case TCG_COND_GTU: - case TCG_COND_LEU: - case TCG_COND_GEU: - cmp_map = mips_cmp_map[cond]; - if (cmp_map & MIPS_CMP_SWAP) { - TCGReg t = arg1; - arg1 = arg2; - arg2 = t; - } - tcg_out_opc_reg(s, s_opc, TCG_TMP0, arg1, arg2); - b_opc = (cmp_map & MIPS_CMP_INV ? OPC_BEQ : OPC_BNE); - arg1 = TCG_TMP0; - arg2 = TCG_REG_ZERO; break; - default: - g_assert_not_reached(); break; } + if (b_opc == 0) { + int tmpflags = tcg_out_setcond_int(s, cond, TCG_TMP0, arg1, arg2); + + arg2 = TCG_REG_ZERO; + arg1 = tmpflags & ~SETCOND_FLAGS; + b_opc = tmpflags & SETCOND_INV ? OPC_BEQ : OPC_BNE; + } + + tcg_out_reloc(s, s->code_ptr, R_MIPS_PC16, l, 0); tcg_out_opc_br(s, b_opc, arg1, arg2); - tcg_out_reloc(s, s->code_ptr - 1, R_MIPS_PC16, l, 0); tcg_out_nop(s); } -static TCGReg tcg_out_reduce_eq2(TCGContext *s, TCGReg tmp0, TCGReg tmp1, - TCGReg al, TCGReg ah, - TCGReg bl, TCGReg bh) +static int tcg_out_setcond2_int(TCGContext *s, TCGCond cond, TCGReg ret, + TCGReg al, TCGReg ah, TCGReg bl, TCGReg bh) { - /* Merge highpart comparison into AH. */ - if (bh != 0) { - if (ah != 0) { - tcg_out_opc_reg(s, OPC_XOR, tmp0, ah, bh); - ah = tmp0; - } else { - ah = bh; - } + int flags = 0; + + switch (cond) { + case TCG_COND_EQ: + flags |= SETCOND_INV; + /* fall through */ + case TCG_COND_NE: + flags |= SETCOND_NEZ; + tcg_out_opc_reg(s, OPC_XOR, TCG_TMP0, al, bl); + tcg_out_opc_reg(s, OPC_XOR, TCG_TMP1, ah, bh); + tcg_out_opc_reg(s, OPC_OR, ret, TCG_TMP0, TCG_TMP1); + break; + + default: + tcg_out_setcond(s, TCG_COND_EQ, TCG_TMP0, ah, bh); + tcg_out_setcond(s, tcg_unsigned_cond(cond), TCG_TMP1, al, bl); + tcg_out_opc_reg(s, OPC_AND, TCG_TMP1, TCG_TMP1, TCG_TMP0); + tcg_out_setcond(s, tcg_high_cond(cond), TCG_TMP0, ah, bh); + tcg_out_opc_reg(s, OPC_OR, ret, TCG_TMP0, TCG_TMP1); + break; } - /* Merge lowpart comparison into AL. */ - if (bl != 0) { - if (al != 0) { - tcg_out_opc_reg(s, OPC_XOR, tmp1, al, bl); - al = tmp1; - } else { - al = bl; - } - } - /* Merge high and low part comparisons into AL. */ - if (ah != 0) { - if (al != 0) { - tcg_out_opc_reg(s, OPC_OR, tmp0, ah, al); - al = tmp0; - } else { - al = ah; - } - } - return al; + return ret | flags; } static void tcg_out_setcond2(TCGContext *s, TCGCond cond, TCGReg ret, TCGReg al, TCGReg ah, TCGReg bl, TCGReg bh) { - TCGReg tmp0 = TCG_TMP0; - TCGReg tmp1 = ret; - - tcg_debug_assert(ret != TCG_TMP0); - if (ret == ah || ret == bh) { - tcg_debug_assert(ret != TCG_TMP1); - tmp1 = TCG_TMP1; - } - - switch (cond) { - case TCG_COND_EQ: - case TCG_COND_NE: - tmp1 = tcg_out_reduce_eq2(s, tmp0, tmp1, al, ah, bl, bh); - tcg_out_setcond(s, cond, ret, tmp1, TCG_REG_ZERO); - break; - - default: - tcg_out_setcond(s, TCG_COND_EQ, tmp0, ah, bh); - tcg_out_setcond(s, tcg_unsigned_cond(cond), tmp1, al, bl); - tcg_out_opc_reg(s, OPC_AND, tmp1, tmp1, tmp0); - tcg_out_setcond(s, tcg_high_cond(cond), tmp0, ah, bh); - tcg_out_opc_reg(s, OPC_OR, ret, tmp1, tmp0); - break; - } + int tmpflags = tcg_out_setcond2_int(s, cond, ret, al, ah, bl, bh); + tcg_out_setcond_end(s, ret, tmpflags); } static void tcg_out_brcond2(TCGContext *s, TCGCond cond, TCGReg al, TCGReg ah, TCGReg bl, TCGReg bh, TCGLabel *l) { - TCGCond b_cond = TCG_COND_NE; - TCGReg tmp = TCG_TMP1; + int tmpflags = tcg_out_setcond2_int(s, cond, TCG_TMP0, al, ah, bl, bh); + TCGReg tmp = tmpflags & ~SETCOND_FLAGS; + MIPSInsn b_opc = tmpflags & SETCOND_INV ? OPC_BEQ : OPC_BNE; - /* With branches, we emit between 4 and 9 insns with 2 or 3 branches. - With setcond, we emit between 3 and 10 insns and only 1 branch, - which ought to get better branch prediction. */ - switch (cond) { - case TCG_COND_EQ: - case TCG_COND_NE: - b_cond = cond; - tmp = tcg_out_reduce_eq2(s, TCG_TMP0, TCG_TMP1, al, ah, bl, bh); - break; - - default: - /* Minimize code size by preferring a compare not requiring INV. */ - if (mips_cmp_map[cond] & MIPS_CMP_INV) { - cond = tcg_invert_cond(cond); - b_cond = TCG_COND_EQ; - } - tcg_out_setcond2(s, cond, tmp, al, ah, bl, bh); - break; - } - - tcg_out_brcond(s, b_cond, tmp, TCG_REG_ZERO, l); + tcg_out_reloc(s, s->code_ptr, R_MIPS_PC16, l, 0); + tcg_out_opc_br(s, b_opc, tmp, TCG_REG_ZERO); + tcg_out_nop(s); } static void tcg_out_movcond(TCGContext *s, TCGCond cond, TCGReg ret, TCGReg c1, TCGReg c2, TCGReg v1, TCGReg v2) { - bool eqz = false; + int tmpflags; + bool eqz; /* If one of the values is zero, put it last to match SEL*Z instructions */ if (use_mips32r6_instructions && v1 == 0) { @@ -1103,27 +1055,9 @@ static void tcg_out_movcond(TCGContext *s, TCGCond cond, TCGReg ret, cond = tcg_invert_cond(cond); } - switch (cond) { - case TCG_COND_EQ: - eqz = true; - /* FALLTHRU */ - case TCG_COND_NE: - if (c2 != 0) { - tcg_out_opc_reg(s, OPC_XOR, TCG_TMP0, c1, c2); - c1 = TCG_TMP0; - } - break; - - default: - /* Minimize code size by preferring a compare not requiring INV. */ - if (mips_cmp_map[cond] & MIPS_CMP_INV) { - cond = tcg_invert_cond(cond); - eqz = true; - } - tcg_out_setcond(s, cond, TCG_TMP0, c1, c2); - c1 = TCG_TMP0; - break; - } + tmpflags = tcg_out_setcond_int(s, cond, TCG_TMP0, c1, c2); + c1 = tmpflags & ~SETCOND_FLAGS; + eqz = tmpflags & SETCOND_INV; if (use_mips32r6_instructions) { MIPSInsn m_opc_t = eqz ? OPC_SELEQZ : OPC_SELNEZ; From patchwork Tue Nov 7 02:48:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741747 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1414739wrr; Mon, 6 Nov 2023 18:50:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+5DT/qDd8PKGfMWAKEGsrk5gJTQXjb3WWJE0o/WRTALs8c/lGJs5yeMgyAsCloLOyPtZm X-Received: by 2002:a05:620a:29c5:b0:776:fba6:da64 with SMTP id s5-20020a05620a29c500b00776fba6da64mr33351125qkp.22.1699325435129; Mon, 06 Nov 2023 18:50:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325435; cv=none; d=google.com; s=arc-20160816; b=EdaX4H5k3ST2fbngFjrggNE7qilqkR3ZiGMmtcKN3bYzlP1g4J9MljSiIMTH6xaUgy E2E+EIjP9o/S4hLW/9Zf6D52XZJy8BdCaITFmUzhrDD9bSF/XiPhkyFCAzBCXlHU8h4z bxpL61IBhcRfHTXHS875rArYSRoAhRQiMcU/J6q/i9shaohjazFpDDbPMcmXqi40iaV6 lPj7co1uu6v/qGs47PwIyKXe3olu59hFGjRLmU27q/rGQ5OULOIZnDnRT1cYaDE2XQUg InQtXZVFz7Wf3y4KloFiZZ9t0NSteUFg6sD9CbMq9TXDpxUyjejnuOYvgrsIN5uHTxjC h8sw== 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:to:from :dkim-signature; bh=UKokEn2/f5uDToV4b3MTyHM++CDKvKNGzEYJ6Ux0XXw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=bm+29gCONH9gGSPsPGD321QrDqlvuZsl7RGYFo/HE5YzzsNwYYkf1flqEmPIPpchbp bPBWYa5PaMWaOeeX7U+T8+qWX2Q0LfIbHn45m681rZoVepXyYI9YL5R8EaZsZr/bFN71 jDuGNR9fa9EnTJV+8lViMrPrSizhPY216MonAIbReKqBTiBa1Hr0k7+TQx74w+3dna0f eh1NUp0aulH30Q6Bf2zrHi7qjg8gccghdkYj3DAIob/ivaHkV7RDmL5sFRqXZ7CaR5tx WAG+oKt2ygzhKKBznWpEC0A/mW46SeIytOAlqqM492P6IyyEPlzfy4qtmkyWdHb0f7JZ lbkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jLFFeBOJ; 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 u10-20020a05622a14ca00b00419845c7a91si6632113qtx.377.2023.11.06.18.50.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:50:35 -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=jLFFeBOJ; 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 1r0C9J-0008Mw-KZ; Mon, 06 Nov 2023 21:49:05 -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 1r0C9H-0008KC-5g for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:03 -0500 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9F-0005t8-HR for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:02 -0500 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6c396ef9a3dso2410393b3a.1 for ; Mon, 06 Nov 2023 18:49:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325340; x=1699930140; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=UKokEn2/f5uDToV4b3MTyHM++CDKvKNGzEYJ6Ux0XXw=; b=jLFFeBOJ07FEmCGUbbMR0VoreCV3vw+w+2X+G2pvAuz7ix9/T9Oi5XijfGwdyMIW4h 5vsiSbfx83b7GzjkqpPIgFT0bCPiFLHkykwqwb34b4mUz07o1XvXnG52t4khPHUc6+PI //rnXDcnydJBRetEutxrz5Kv0ysAX4jJ5ivFZSdVm36aWoP4nowoTKhsRwsOzl7tZaEt yEOxijkFVi4TpPIoYV2mNuUrgXbXYp235ZTXXM4CN6fXtsID3ZU9X04HQiAedja1nUtR BsHmEw5ufCzLXbf/Z0lxdggz4S23i8PzgM6NINTeRLtEgeJIyAJm8EJFxEOVOWAalos3 gxXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325340; x=1699930140; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UKokEn2/f5uDToV4b3MTyHM++CDKvKNGzEYJ6Ux0XXw=; b=fywXfP9RvD86HxR8NYvD5mExRDf7k6UfsPlZXr9salpXM/JgS65357+gwes/3E6dz1 4HBj5EFbjQMHAhFcPcFQ+rVPS75f3FfmSkoPfDG+cokZHvQt1RCrirhJIEqboiyMMCDV OiseQB2nbuh+zA3dyHAFFGPz2SYI9+a7LrrfV6K6A7y/a16chaA79/buIRL7xcmpr3Ey a69N6ec1gRSjqTtI+4PqditwJxcQtZ0vVcA1Y06EZsDDnko7TaI1j9my1XR26k1lKM7r 8C799Ux7AJnXW6gLPHrEFKTSopKDm790gZnt4nfkKgesN+4Yn6dxOfF7SN5k2xi1Sqyn eZtg== X-Gm-Message-State: AOJu0YwnAvmneAYyDNKo6i1HaDzaFnWgqWg9abEI1BVlrK8A+Ixpc+WR bJDKtdszU5QC84EzJndyHdmyL+rFtqNgQJd77x8= X-Received: by 2002:a05:6a00:1593:b0:6be:2901:2cd with SMTP id u19-20020a056a00159300b006be290102cdmr29779496pfk.10.1699325340078; Mon, 06 Nov 2023 18:49:00 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.48.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:48:59 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 21/35] tcg/mips: Always implement movcond Date: Mon, 6 Nov 2023 18:48:28 -0800 Message-Id: <20231107024842.7650-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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 Expand as branch over move if not supported in the ISA. Signed-off-by: Richard Henderson Message-Id: <20231026041404.1229328-3-richard.henderson@linaro.org> --- tcg/mips/tcg-target.h | 4 ++-- tcg/mips/tcg-target.c.inc | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h index c0576f66d7..0a4083f0d9 100644 --- a/tcg/mips/tcg-target.h +++ b/tcg/mips/tcg-target.h @@ -154,7 +154,7 @@ extern bool use_mips32r2_instructions; #endif /* optional instructions detected at runtime */ -#define TCG_TARGET_HAS_movcond_i32 use_movnz_instructions +#define TCG_TARGET_HAS_movcond_i32 1 #define TCG_TARGET_HAS_bswap16_i32 use_mips32r2_instructions #define TCG_TARGET_HAS_deposit_i32 use_mips32r2_instructions #define TCG_TARGET_HAS_extract_i32 use_mips32r2_instructions @@ -169,7 +169,7 @@ extern bool use_mips32r2_instructions; #define TCG_TARGET_HAS_qemu_st8_i32 0 #if TCG_TARGET_REG_BITS == 64 -#define TCG_TARGET_HAS_movcond_i64 use_movnz_instructions +#define TCG_TARGET_HAS_movcond_i64 1 #define TCG_TARGET_HAS_bswap16_i64 use_mips32r2_instructions #define TCG_TARGET_HAS_bswap32_i64 use_mips32r2_instructions #define TCG_TARGET_HAS_bswap64_i64 use_mips32r2_instructions diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index 89681f00fe..82b078b9c5 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -1070,13 +1070,22 @@ static void tcg_out_movcond(TCGContext *s, TCGCond cond, TCGReg ret, if (v2 != 0) { tcg_out_opc_reg(s, OPC_OR, ret, ret, TCG_TMP1); } - } else { + return; + } + + /* This should be guaranteed via constraints */ + tcg_debug_assert(v2 == ret); + + if (use_movnz_instructions) { MIPSInsn m_opc = eqz ? OPC_MOVZ : OPC_MOVN; - tcg_out_opc_reg(s, m_opc, ret, v1, c1); - - /* This should be guaranteed via constraints */ - tcg_debug_assert(v2 == ret); + } else { + /* Invert the condition in order to branch over the move. */ + MIPSInsn b_opc = eqz ? OPC_BNE : OPC_BEQ; + tcg_out_opc_imm(s, b_opc, c1, TCG_REG_ZERO, 2); + tcg_out_nop(s); + /* Open-code tcg_out_mov, without the nop-move check. */ + tcg_out_opc_reg(s, OPC_OR, ret, v1, TCG_REG_ZERO); } } From patchwork Tue Nov 7 02:48:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741773 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415990wrr; Mon, 6 Nov 2023 18:55:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IGN4LXfqQnRf6TAiHrPL5vn2gLHVj/xMIx2esiQbXd/Y625wZ5adHjxSlHXRZFlQbpEe3mb X-Received: by 2002:a37:e115:0:b0:76f:f0b:a1b8 with SMTP id c21-20020a37e115000000b0076f0f0ba1b8mr30241705qkm.25.1699325718167; Mon, 06 Nov 2023 18:55:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325718; cv=none; d=google.com; s=arc-20160816; b=ZrAfLHAthDipzIjnzUkN5VLup9ndNQr/zzgwonCq/gGgBVEG6i0PcWm9rAJLkmFbqG ha9YQrcLaZjejdl0meS7WdjU/8QW6lFC4dk80H91R+S8a1veS6TmNHYGAdiASECYBn7i 0BXwv32yo69ECAXV+43l1ZVREaVQ2E+Fko3Z4cGSwYnwz2K22GIsjzy9D9siaJVI8q/e 5GV6KJs0CLoE+MTJDG4xNhiOZR/ia8K8sHb/aVwMeJ+Bunsgz/XG3s+DaKF+/15yrtdX vzZLjY+ADzbJduiV3xg2Z1so6TuRuIw6ObFM96pPNW502UhqF5xDb2Hg9zeHqMyuj7CY 5hoQ== 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:to:from :dkim-signature; bh=Lv9IiJaQxDaOysiAsIS8TPqkuxW48QQMSCUJAG5Tjgs=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=dRHxvsHxky7YH7+BivH2qTmBIYOSamczKN/nbltShMX6OSji7SizdVFFe7TKci8RMM m5jC6AC9rMmBiDXkdq93RcYE91yIDpVHAKwybM8Y2d8s7AsxjZn554MW+HTsNI4S5Amr x9W381lHwBc+2yvhCp4bk7Zu3FfaG4x1BiJgnsXHTfvOLgOUbMnJJ16rrg5S+8NbWDwO VfMZ8sML+gEJJGUsFTFnZR0s4GpCp8Osh+aFxttJJR+UilbU/zjh0lE9Dg9SwoaAZUe5 rtcfTalTZ96YmdNCYhlqGSKpmNH/KCAiAH9/3wZrMsF95QTEj0+6LnI5RXIhDRAvGq/W gHkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pd+xecuH; 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 de26-20020a05620a371a00b0077579bb29easi6956532qkb.707.2023.11.06.18.55.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:55:18 -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=pd+xecuH; 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 1r0C9K-0008Nh-8G; Mon, 06 Nov 2023 21:49:06 -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 1r0C9I-0008KY-B2 for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:04 -0500 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9G-0005tI-2O for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:04 -0500 Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3b2ea7cca04so3341305b6e.2 for ; Mon, 06 Nov 2023 18:49:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325341; x=1699930141; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Lv9IiJaQxDaOysiAsIS8TPqkuxW48QQMSCUJAG5Tjgs=; b=pd+xecuHxf94d0DWAzKfGGgT7+df1qm2QkFlnz6cAPFzz/TJ53Wgsn/Cp4lNwYOf3R oVAzOlfqYuDZXt8Ho8JINGykDPBeR7JKPwBP4DhhSaWJjAWrj8AE101SCL911l7i1iZP Abfahzf2o9nyCDwmIbCFMlhiG290aZMPL3VEzE5MSq6SJ6dVLHNpuw4IalbwEemoAobl H/6FzEy7iCjEzGuC1kqEuwk4dC3jVqwYaqFhR0UuyJ/+h76y8pV3xvvCd9s6EhY0xniZ ZHdcrLoubApFWKiHRzakAy/2YpsuzodhtlfDxqgHiQ7vaehBvm/VmmEexAKDB4QT44h7 c8Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325341; x=1699930141; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Lv9IiJaQxDaOysiAsIS8TPqkuxW48QQMSCUJAG5Tjgs=; b=STwNt5AMOeJ8dw5efkMwjwnu6JbkoZ2raY5JrjQBiwX3u4SPqbzTaAVX9k17ASIOJI fcsP6SIJ3/gOPTLWu5YDffXAyHJHXEOqX9FkbN2/MrM0wEQEYkZPXQJq+JHLxQw7TGUt OcSGnYXsR7hhFRvOjd59pR9efE/cdrU8wITuZH/2mW3bqG6bJq8aOKVcHinQIvy3EfZA oXuGKIXdz0GP9ICYt5PrDe/5vnoFHL5n2tRtMhPrDcCWz09FeyOpomTIci5qSRqe7O+3 ZZwZ6qnJbv9RHAfHJ9WM1YRIGXI84Ns/eKmx6ZHJ6h2yh7wes/K8L2qO+UBqlCRoGNd1 wojw== X-Gm-Message-State: AOJu0YzVCzVJqbuiXk/twriMnYTkOwGAjEHfi7oh/irOv0N9VdtafPFf LHmn3l/AHydXgH1C+JOzhImKJfKSOK/MJ6/CAT8= X-Received: by 2002:a05:6808:8c8:b0:3b5:9724:9687 with SMTP id k8-20020a05680808c800b003b597249687mr8942014oij.1.1699325340909; Mon, 06 Nov 2023 18:49:00 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 22/35] tcg: Remove TCG_TARGET_HAS_movcond_{i32,i64} Date: Mon, 6 Nov 2023 18:48:29 -0800 Message-Id: <20231107024842.7650-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22e; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22e.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 The movcond opcode is now mandatory for backends to implement. Signed-off-by: Richard Henderson Message-Id: <20231026041404.1229328-4-richard.henderson@linaro.org> --- include/tcg/tcg-opc.h | 4 +-- include/tcg/tcg.h | 1 - tcg/aarch64/tcg-target.h | 2 -- tcg/arm/tcg-target.h | 1 - tcg/i386/tcg-target.h | 2 -- tcg/loongarch64/tcg-target.h | 2 -- tcg/mips/tcg-target.h | 2 -- tcg/ppc/tcg-target.h | 2 -- tcg/riscv/tcg-target.h | 2 -- tcg/s390x/tcg-target.h | 2 -- tcg/sparc64/tcg-target.h | 2 -- tcg/tci/tcg-target.h | 2 -- tcg/tcg-op.c | 50 ++++++++---------------------------- tcg/tcg.c | 6 ++--- 14 files changed, 14 insertions(+), 66 deletions(-) diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h index 6eff3d9106..ecd08db0de 100644 --- a/include/tcg/tcg-opc.h +++ b/include/tcg/tcg-opc.h @@ -47,7 +47,7 @@ DEF(mb, 0, 0, 1, 0) DEF(mov_i32, 1, 1, 0, TCG_OPF_NOT_PRESENT) DEF(setcond_i32, 1, 2, 1, 0) DEF(negsetcond_i32, 1, 2, 1, IMPL(TCG_TARGET_HAS_negsetcond_i32)) -DEF(movcond_i32, 1, 4, 1, IMPL(TCG_TARGET_HAS_movcond_i32)) +DEF(movcond_i32, 1, 4, 1, 0) /* load/store */ DEF(ld8u_i32, 1, 1, 1, 0) DEF(ld8s_i32, 1, 1, 1, 0) @@ -113,7 +113,7 @@ DEF(ctpop_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_ctpop_i32)) DEF(mov_i64, 1, 1, 0, TCG_OPF_64BIT | TCG_OPF_NOT_PRESENT) DEF(setcond_i64, 1, 2, 1, IMPL64) DEF(negsetcond_i64, 1, 2, 1, IMPL64 | IMPL(TCG_TARGET_HAS_negsetcond_i64)) -DEF(movcond_i64, 1, 4, 1, IMPL64 | IMPL(TCG_TARGET_HAS_movcond_i64)) +DEF(movcond_i64, 1, 4, 1, IMPL64) /* load/store */ DEF(ld8u_i64, 1, 1, 1, IMPL64) DEF(ld8s_i64, 1, 1, 1, IMPL64) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index fc218fd381..32a208a02e 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -96,7 +96,6 @@ typedef uint64_t TCGRegSet; #define TCG_TARGET_HAS_extract_i64 0 #define TCG_TARGET_HAS_sextract_i64 0 #define TCG_TARGET_HAS_extract2_i64 0 -#define TCG_TARGET_HAS_movcond_i64 0 #define TCG_TARGET_HAS_negsetcond_i64 0 #define TCG_TARGET_HAS_add2_i64 0 #define TCG_TARGET_HAS_sub2_i64 0 diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index 98727ea53b..352e19aba8 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -85,7 +85,6 @@ typedef enum { #define TCG_TARGET_HAS_extract_i32 1 #define TCG_TARGET_HAS_sextract_i32 1 #define TCG_TARGET_HAS_extract2_i32 1 -#define TCG_TARGET_HAS_movcond_i32 1 #define TCG_TARGET_HAS_negsetcond_i32 1 #define TCG_TARGET_HAS_add2_i32 1 #define TCG_TARGET_HAS_sub2_i32 1 @@ -122,7 +121,6 @@ typedef enum { #define TCG_TARGET_HAS_extract_i64 1 #define TCG_TARGET_HAS_sextract_i64 1 #define TCG_TARGET_HAS_extract2_i64 1 -#define TCG_TARGET_HAS_movcond_i64 1 #define TCG_TARGET_HAS_negsetcond_i64 1 #define TCG_TARGET_HAS_add2_i64 1 #define TCG_TARGET_HAS_sub2_i64 1 diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index 311a985209..439898efb3 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -115,7 +115,6 @@ extern bool use_neon_instructions; #define TCG_TARGET_HAS_extract_i32 use_armv7_instructions #define TCG_TARGET_HAS_sextract_i32 use_armv7_instructions #define TCG_TARGET_HAS_extract2_i32 1 -#define TCG_TARGET_HAS_movcond_i32 1 #define TCG_TARGET_HAS_negsetcond_i32 1 #define TCG_TARGET_HAS_mulu2_i32 1 #define TCG_TARGET_HAS_muls2_i32 1 diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 8417ea4899..7522ce7575 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -149,7 +149,6 @@ typedef enum { #define TCG_TARGET_HAS_extract_i32 1 #define TCG_TARGET_HAS_sextract_i32 1 #define TCG_TARGET_HAS_extract2_i32 1 -#define TCG_TARGET_HAS_movcond_i32 1 #define TCG_TARGET_HAS_negsetcond_i32 1 #define TCG_TARGET_HAS_add2_i32 1 #define TCG_TARGET_HAS_sub2_i32 1 @@ -186,7 +185,6 @@ typedef enum { #define TCG_TARGET_HAS_extract_i64 1 #define TCG_TARGET_HAS_sextract_i64 0 #define TCG_TARGET_HAS_extract2_i64 1 -#define TCG_TARGET_HAS_movcond_i64 1 #define TCG_TARGET_HAS_negsetcond_i64 1 #define TCG_TARGET_HAS_add2_i64 1 #define TCG_TARGET_HAS_sub2_i64 1 diff --git a/tcg/loongarch64/tcg-target.h b/tcg/loongarch64/tcg-target.h index 1bea15b02e..486898c2d3 100644 --- a/tcg/loongarch64/tcg-target.h +++ b/tcg/loongarch64/tcg-target.h @@ -97,7 +97,6 @@ typedef enum { #define TCG_TARGET_CALL_RET_I128 TCG_CALL_RET_NORMAL /* optional instructions */ -#define TCG_TARGET_HAS_movcond_i32 1 #define TCG_TARGET_HAS_negsetcond_i32 0 #define TCG_TARGET_HAS_div_i32 1 #define TCG_TARGET_HAS_rem_i32 1 @@ -134,7 +133,6 @@ typedef enum { #define TCG_TARGET_HAS_qemu_st8_i32 0 /* 64-bit operations */ -#define TCG_TARGET_HAS_movcond_i64 1 #define TCG_TARGET_HAS_negsetcond_i64 0 #define TCG_TARGET_HAS_div_i64 1 #define TCG_TARGET_HAS_rem_i64 1 diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h index 0a4083f0d9..5b3fdcc726 100644 --- a/tcg/mips/tcg-target.h +++ b/tcg/mips/tcg-target.h @@ -154,7 +154,6 @@ extern bool use_mips32r2_instructions; #endif /* optional instructions detected at runtime */ -#define TCG_TARGET_HAS_movcond_i32 1 #define TCG_TARGET_HAS_bswap16_i32 use_mips32r2_instructions #define TCG_TARGET_HAS_deposit_i32 use_mips32r2_instructions #define TCG_TARGET_HAS_extract_i32 use_mips32r2_instructions @@ -169,7 +168,6 @@ extern bool use_mips32r2_instructions; #define TCG_TARGET_HAS_qemu_st8_i32 0 #if TCG_TARGET_REG_BITS == 64 -#define TCG_TARGET_HAS_movcond_i64 1 #define TCG_TARGET_HAS_bswap16_i64 use_mips32r2_instructions #define TCG_TARGET_HAS_bswap32_i64 use_mips32r2_instructions #define TCG_TARGET_HAS_bswap64_i64 use_mips32r2_instructions diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h index 8bfb14998e..a2856afd4d 100644 --- a/tcg/ppc/tcg-target.h +++ b/tcg/ppc/tcg-target.h @@ -96,7 +96,6 @@ typedef enum { #define TCG_TARGET_HAS_extract_i32 1 #define TCG_TARGET_HAS_sextract_i32 0 #define TCG_TARGET_HAS_extract2_i32 0 -#define TCG_TARGET_HAS_movcond_i32 1 #define TCG_TARGET_HAS_negsetcond_i32 1 #define TCG_TARGET_HAS_mulu2_i32 0 #define TCG_TARGET_HAS_muls2_i32 0 @@ -134,7 +133,6 @@ typedef enum { #define TCG_TARGET_HAS_extract_i64 1 #define TCG_TARGET_HAS_sextract_i64 0 #define TCG_TARGET_HAS_extract2_i64 0 -#define TCG_TARGET_HAS_movcond_i64 1 #define TCG_TARGET_HAS_negsetcond_i64 1 #define TCG_TARGET_HAS_add2_i64 1 #define TCG_TARGET_HAS_sub2_i64 1 diff --git a/tcg/riscv/tcg-target.h b/tcg/riscv/tcg-target.h index c1132d178f..f3644a8bc1 100644 --- a/tcg/riscv/tcg-target.h +++ b/tcg/riscv/tcg-target.h @@ -87,7 +87,6 @@ extern bool have_zbb; #endif /* optional instructions */ -#define TCG_TARGET_HAS_movcond_i32 1 #define TCG_TARGET_HAS_negsetcond_i32 1 #define TCG_TARGET_HAS_div_i32 1 #define TCG_TARGET_HAS_rem_i32 1 @@ -123,7 +122,6 @@ extern bool have_zbb; #define TCG_TARGET_HAS_setcond2 1 #define TCG_TARGET_HAS_qemu_st8_i32 0 -#define TCG_TARGET_HAS_movcond_i64 1 #define TCG_TARGET_HAS_negsetcond_i64 1 #define TCG_TARGET_HAS_div_i64 1 #define TCG_TARGET_HAS_rem_i64 1 diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index 50e12ef9d6..2c936c1bcb 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -95,7 +95,6 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_extract_i32 1 #define TCG_TARGET_HAS_sextract_i32 0 #define TCG_TARGET_HAS_extract2_i32 0 -#define TCG_TARGET_HAS_movcond_i32 1 #define TCG_TARGET_HAS_negsetcond_i32 1 #define TCG_TARGET_HAS_add2_i32 1 #define TCG_TARGET_HAS_sub2_i32 1 @@ -131,7 +130,6 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_extract_i64 1 #define TCG_TARGET_HAS_sextract_i64 0 #define TCG_TARGET_HAS_extract2_i64 0 -#define TCG_TARGET_HAS_movcond_i64 1 #define TCG_TARGET_HAS_negsetcond_i64 1 #define TCG_TARGET_HAS_add2_i64 1 #define TCG_TARGET_HAS_sub2_i64 1 diff --git a/tcg/sparc64/tcg-target.h b/tcg/sparc64/tcg-target.h index 5cfc4b4679..4c286c6006 100644 --- a/tcg/sparc64/tcg-target.h +++ b/tcg/sparc64/tcg-target.h @@ -105,7 +105,6 @@ extern bool use_vis3_instructions; #define TCG_TARGET_HAS_extract_i32 0 #define TCG_TARGET_HAS_sextract_i32 0 #define TCG_TARGET_HAS_extract2_i32 0 -#define TCG_TARGET_HAS_movcond_i32 1 #define TCG_TARGET_HAS_negsetcond_i32 1 #define TCG_TARGET_HAS_add2_i32 1 #define TCG_TARGET_HAS_sub2_i32 1 @@ -142,7 +141,6 @@ extern bool use_vis3_instructions; #define TCG_TARGET_HAS_extract_i64 0 #define TCG_TARGET_HAS_sextract_i64 0 #define TCG_TARGET_HAS_extract2_i64 0 -#define TCG_TARGET_HAS_movcond_i64 1 #define TCG_TARGET_HAS_negsetcond_i64 1 #define TCG_TARGET_HAS_add2_i64 1 #define TCG_TARGET_HAS_sub2_i64 1 diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h index 91ca33b616..3503fc4a4c 100644 --- a/tcg/tci/tcg-target.h +++ b/tcg/tci/tcg-target.h @@ -69,7 +69,6 @@ #define TCG_TARGET_HAS_not_i32 1 #define TCG_TARGET_HAS_orc_i32 1 #define TCG_TARGET_HAS_rot_i32 1 -#define TCG_TARGET_HAS_movcond_i32 1 #define TCG_TARGET_HAS_negsetcond_i32 0 #define TCG_TARGET_HAS_muls2_i32 1 #define TCG_TARGET_HAS_muluh_i32 0 @@ -104,7 +103,6 @@ #define TCG_TARGET_HAS_not_i64 1 #define TCG_TARGET_HAS_orc_i64 1 #define TCG_TARGET_HAS_rot_i64 1 -#define TCG_TARGET_HAS_movcond_i64 1 #define TCG_TARGET_HAS_negsetcond_i64 0 #define TCG_TARGET_HAS_muls2_i64 1 #define TCG_TARGET_HAS_add2_i32 1 diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 9aba103590..26bcd090c1 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -1142,17 +1142,8 @@ void tcg_gen_movcond_i32(TCGCond cond, TCGv_i32 ret, TCGv_i32 c1, tcg_gen_mov_i32(ret, v1); } else if (cond == TCG_COND_NEVER) { tcg_gen_mov_i32(ret, v2); - } else if (TCG_TARGET_HAS_movcond_i32) { - tcg_gen_op6i_i32(INDEX_op_movcond_i32, ret, c1, c2, v1, v2, cond); } else { - TCGv_i32 t0 = tcg_temp_ebb_new_i32(); - TCGv_i32 t1 = tcg_temp_ebb_new_i32(); - tcg_gen_negsetcond_i32(cond, t0, c1, c2); - tcg_gen_and_i32(t1, v1, t0); - tcg_gen_andc_i32(ret, v2, t0); - tcg_gen_or_i32(ret, ret, t1); - tcg_temp_free_i32(t0); - tcg_temp_free_i32(t1); + tcg_gen_op6i_i32(INDEX_op_movcond_i32, ret, c1, c2, v1, v2, cond); } } @@ -3011,43 +3002,22 @@ void tcg_gen_movcond_i64(TCGCond cond, TCGv_i64 ret, TCGv_i64 c1, tcg_gen_mov_i64(ret, v1); } else if (cond == TCG_COND_NEVER) { tcg_gen_mov_i64(ret, v2); - } else if (TCG_TARGET_REG_BITS == 32) { + } else if (TCG_TARGET_REG_BITS == 64) { + tcg_gen_op6i_i64(INDEX_op_movcond_i64, ret, c1, c2, v1, v2, cond); + } else { TCGv_i32 t0 = tcg_temp_ebb_new_i32(); - TCGv_i32 t1 = tcg_temp_ebb_new_i32(); + TCGv_i32 zero = tcg_constant_i32(0); + tcg_gen_op6i_i32(INDEX_op_setcond2_i32, t0, TCGV_LOW(c1), TCGV_HIGH(c1), TCGV_LOW(c2), TCGV_HIGH(c2), cond); - if (TCG_TARGET_HAS_movcond_i32) { - tcg_gen_movi_i32(t1, 0); - tcg_gen_movcond_i32(TCG_COND_NE, TCGV_LOW(ret), t0, t1, - TCGV_LOW(v1), TCGV_LOW(v2)); - tcg_gen_movcond_i32(TCG_COND_NE, TCGV_HIGH(ret), t0, t1, - TCGV_HIGH(v1), TCGV_HIGH(v2)); - } else { - tcg_gen_neg_i32(t0, t0); + tcg_gen_movcond_i32(TCG_COND_NE, TCGV_LOW(ret), t0, zero, + TCGV_LOW(v1), TCGV_LOW(v2)); + tcg_gen_movcond_i32(TCG_COND_NE, TCGV_HIGH(ret), t0, zero, + TCGV_HIGH(v1), TCGV_HIGH(v2)); - tcg_gen_and_i32(t1, TCGV_LOW(v1), t0); - tcg_gen_andc_i32(TCGV_LOW(ret), TCGV_LOW(v2), t0); - tcg_gen_or_i32(TCGV_LOW(ret), TCGV_LOW(ret), t1); - - tcg_gen_and_i32(t1, TCGV_HIGH(v1), t0); - tcg_gen_andc_i32(TCGV_HIGH(ret), TCGV_HIGH(v2), t0); - tcg_gen_or_i32(TCGV_HIGH(ret), TCGV_HIGH(ret), t1); - } tcg_temp_free_i32(t0); - tcg_temp_free_i32(t1); - } else if (TCG_TARGET_HAS_movcond_i64) { - tcg_gen_op6i_i64(INDEX_op_movcond_i64, ret, c1, c2, v1, v2, cond); - } else { - TCGv_i64 t0 = tcg_temp_ebb_new_i64(); - TCGv_i64 t1 = tcg_temp_ebb_new_i64(); - tcg_gen_negsetcond_i64(cond, t0, c1, c2); - tcg_gen_and_i64(t1, v1, t0); - tcg_gen_andc_i64(ret, v2, t0); - tcg_gen_or_i64(ret, ret, t1); - tcg_temp_free_i64(t0); - tcg_temp_free_i64(t1); } } diff --git a/tcg/tcg.c b/tcg/tcg.c index 258bd1c10b..d59ff14f0f 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1977,6 +1977,7 @@ bool tcg_op_supported(TCGOpcode op) case INDEX_op_mov_i32: case INDEX_op_setcond_i32: case INDEX_op_brcond_i32: + case INDEX_op_movcond_i32: case INDEX_op_ld8u_i32: case INDEX_op_ld8s_i32: case INDEX_op_ld16u_i32: @@ -1998,8 +1999,6 @@ bool tcg_op_supported(TCGOpcode op) case INDEX_op_negsetcond_i32: return TCG_TARGET_HAS_negsetcond_i32; - case INDEX_op_movcond_i32: - return TCG_TARGET_HAS_movcond_i32; case INDEX_op_div_i32: case INDEX_op_divu_i32: return TCG_TARGET_HAS_div_i32; @@ -2072,6 +2071,7 @@ bool tcg_op_supported(TCGOpcode op) case INDEX_op_mov_i64: case INDEX_op_setcond_i64: case INDEX_op_brcond_i64: + case INDEX_op_movcond_i64: case INDEX_op_ld8u_i64: case INDEX_op_ld8s_i64: case INDEX_op_ld16u_i64: @@ -2098,8 +2098,6 @@ bool tcg_op_supported(TCGOpcode op) case INDEX_op_negsetcond_i64: return TCG_TARGET_HAS_negsetcond_i64; - case INDEX_op_movcond_i64: - return TCG_TARGET_HAS_movcond_i64; case INDEX_op_div_i64: case INDEX_op_divu_i64: return TCG_TARGET_HAS_div_i64; From patchwork Tue Nov 7 02:48:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741770 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415948wrr; Mon, 6 Nov 2023 18:55:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzPmdiZ29SZqHfWA+nP2/IUVaQ4sQcr68kLp3IpJLYrhvHpkbYxgkfKf4Jq7SZpL2rABCa X-Received: by 2002:ad4:5ae5:0:b0:670:f530:47ee with SMTP id c5-20020ad45ae5000000b00670f53047eemr41774110qvh.34.1699325707156; Mon, 06 Nov 2023 18:55:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325707; cv=none; d=google.com; s=arc-20160816; b=kzWab9kW7M6KZGNaxuHz6B2VhFq/CIhEQ5Vt2PyJzCMGKWcTkBSl7Zismq5UTofH52 R2vVWpvTU55buClW9gxGauiYUztXZJNwGSG+Vne7LjCh0KBQMiksnjUkyHVtanHyd8En YMpalTW7JFUpGJyhkpn3t9urpydswmynHjUp6Fg+dKR7OQrFnDRWYU1dpIXaDvGMX/0H WFYMD3vYxx6MhlpTO59r+qJKURRET+MT+MK0TGq524J8NTGQSOdDTL6ByvMyYfWrwBVe vljQqAsiyFbmPNxNt7jE6N5Od+cC/vVNRGHC3Rul71tYPhNiIwT2PK2P5u+vbAYvGARP aQag== 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:to:from :dkim-signature; bh=QmgLQHRjVVBRPaZdvh0i8/8wa1sGosyB6yu2fFTSqQc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Fk0t8/N/SSKKLHykA0H1warW3RKnUmt89JJSOTXI9tXQgPQEbPyVJTC1HM+bMUZ1vJ Ekz2D0JraE183m8baNGVWcI1dgq1Qpk4nsR3Uml3tU9HN/NuSmEIccyfjr75Ng4cPvUi EAGzwR/Hrdi7yIXSL6o5hlPrhBKCfQBF5/7/zyshY8BjrDpv4hQxSHTwulm9JDNL+hX9 n3MHY3z265E4imjEYoXrerD0Ewfa8083ukoCp7x0IMdZ3ExE4LJzxiVVYUKpn8nFX7Km dIEo80v3FvOl2tqeD7ndC1gljGfUn7mYshkFyEkJqdLrMzKJzPgeMYR5GrS2+Esu1KnU KOPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JhvcgDVX; 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 m4-20020ad44a04000000b0066d10e104cdsi6153892qvz.363.2023.11.06.18.55.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:55:07 -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=JhvcgDVX; 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 1r0C9K-0008O1-I5; Mon, 06 Nov 2023 21:49:06 -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 1r0C9I-0008Lh-RI for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:04 -0500 Received: from mail-vk1-xa2a.google.com ([2607:f8b0:4864:20::a2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9H-0005tT-7h for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:04 -0500 Received: by mail-vk1-xa2a.google.com with SMTP id 71dfb90a1353d-49e15724283so2006049e0c.1 for ; Mon, 06 Nov 2023 18:49:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325342; x=1699930142; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=QmgLQHRjVVBRPaZdvh0i8/8wa1sGosyB6yu2fFTSqQc=; b=JhvcgDVXldMNChA/jvrkCBd8HCjaVvrqwd8yectWOa+337m9Q/3hhu+lCHgHM2h4xq Ukhqf4R43knYgKGSpcv3DVZ8Dg9j6bwUZkrW3LNYJcmvcj7WIRPkEGikrCKWgMTEPQET gJfvjXldxw8bMSFJcnSsLMSZjfWTdu5wZRoVu0Z2CL1gOwqL8t6j+wG6hBEUq10Ols2X /b0YtfF16faClD2ixNrngURz1Wa6EGUciM2tlymNiLARF6+LYEoW0HvxsbvsQShQ0CqW vUs8hwmuKEOkpI4yMrHZD8k1EKtwkXUMDTzbq/R5mXa1sAiXbYEL8vcATlMSI+A9UPkD cFZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325342; x=1699930142; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QmgLQHRjVVBRPaZdvh0i8/8wa1sGosyB6yu2fFTSqQc=; b=FUNhwi2dEG1q50gqpkcDhL5u1ND9fYrhaZRh4u9dPQ59PHxIpo3NUSJUhGRosyAXSt IKQ7/v6s63wwecH7MX4eeA8pr4TpdRZrSztzU8IItzWJX6NmaOZJIkagrvL9dv+imxy1 chmOdIb89PBDhBQUyV3TKHZvvUmErJCNWpnvwNWqkB+l7USiVi5K619028z7yaN40vkf Rr7o75qOP3xzPWgvFIDph5aBQLOQqVJZhpSE43ReWR3OQYqMPIP1FuxoeS+pJ3CDa01z 2WLNtIXpuqMTEKWVElXE5Hd3Lm8n6IeVdphy5ClTaIt5yOeCaQ7w3dJGcgRqnDMYKrgQ irPA== X-Gm-Message-State: AOJu0Yx/6HbGKMCU7ghiWFaxvolEHFJz1u5LpHEl2KKBoJb7CDSIgK0t +g5JRUoiHPJSWCtaWtxywZChCfFk4IvCeqHuWko= X-Received: by 2002:a1f:aa0a:0:b0:4ac:6a9f:2bb4 with SMTP id t10-20020a1faa0a000000b004ac6a9f2bb4mr2499959vke.15.1699325341973; Mon, 06 Nov 2023 18:49:01 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 23/35] tcg/mips: Implement neg opcodes Date: Mon, 6 Nov 2023 18:48:30 -0800 Message-Id: <20231107024842.7650-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::a2a; envelope-from=richard.henderson@linaro.org; helo=mail-vk1-xa2a.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 Signed-off-by: Richard Henderson Message-Id: <20231026041404.1229328-5-richard.henderson@linaro.org> --- tcg/mips/tcg-target.h | 4 ++-- tcg/mips/tcg-target.c.inc | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h index 5b3fdcc726..20c14224fb 100644 --- a/tcg/mips/tcg-target.h +++ b/tcg/mips/tcg-target.h @@ -184,12 +184,12 @@ extern bool use_mips32r2_instructions; #endif /* optional instructions automatically implemented */ -#define TCG_TARGET_HAS_neg_i32 0 /* sub rd, zero, rt */ +#define TCG_TARGET_HAS_neg_i32 1 #define TCG_TARGET_HAS_ext8u_i32 0 /* andi rt, rs, 0xff */ #define TCG_TARGET_HAS_ext16u_i32 0 /* andi rt, rs, 0xffff */ #if TCG_TARGET_REG_BITS == 64 -#define TCG_TARGET_HAS_neg_i64 0 /* sub rd, zero, rt */ +#define TCG_TARGET_HAS_neg_i64 1 #define TCG_TARGET_HAS_ext8u_i64 0 /* andi rt, rs, 0xff */ #define TCG_TARGET_HAS_ext16u_i64 0 /* andi rt, rs, 0xffff */ #endif diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index 82b078b9c5..8328dbdecc 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -1920,6 +1920,12 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_out_opc_reg(s, OPC_MFHI, a1, 0, 0); break; + case INDEX_op_neg_i32: + i1 = OPC_SUBU; + goto do_unary; + case INDEX_op_neg_i64: + i1 = OPC_DSUBU; + goto do_unary; case INDEX_op_not_i32: case INDEX_op_not_i64: i1 = OPC_NOR; @@ -2144,6 +2150,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_ld16u_i32: case INDEX_op_ld16s_i32: case INDEX_op_ld_i32: + case INDEX_op_neg_i32: case INDEX_op_not_i32: case INDEX_op_bswap16_i32: case INDEX_op_bswap32_i32: @@ -2157,6 +2164,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_ld32s_i64: case INDEX_op_ld32u_i64: case INDEX_op_ld_i64: + case INDEX_op_neg_i64: case INDEX_op_not_i64: case INDEX_op_bswap16_i64: case INDEX_op_bswap32_i64: From patchwork Tue Nov 7 02:48:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741771 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415959wrr; Mon, 6 Nov 2023 18:55:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IGOcu+k1fbZqbkOBn+uZEBI66fQZeWxNTyJ0afUaaSq5pyNoXHnS6sHhVJIMHerW3DVte5D X-Received: by 2002:a0c:cc03:0:b0:66f:b899:d31c with SMTP id r3-20020a0ccc03000000b0066fb899d31cmr25663253qvk.7.1699325708909; Mon, 06 Nov 2023 18:55:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325708; cv=none; d=google.com; s=arc-20160816; b=rxsAbfYLzIis7msa8LILe9ZqO+8mcEbe2uGxAVJmb6mXD0pwkoPq1I6aE2hvB3kzDz eNDr15NLw2L0QsZPInASQdD72wQE5dJNh0WgtWqHHkV0sny/ZqDp28OAGGMMcIY46MQD WBGHN5mztKksmP8M12M2qx2ml5Z05EwQ+7amY7n0KhUwkItIuycoKBh5LlN+Ei10/cbC jZdQEsozRZUMyS5RlFTTFsE/qge+TjCiDMJY71QM1XV3QmCWizY2g/cfCtGKvYwLGWel jsAJ09PjyY53VkiLXKNCo2oRCWaV2WZ/sXeL1d1Do6poWp+JLZi2BdYQ2PkGbYzS/Xgw gumA== 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:to:from :dkim-signature; bh=8GSD+l+fgsavoFgGdG3xylhNYKfi9yVBkELAIfWGGOI=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=YQ3LP3FdysckmY1ze4TqN46WSFSsbqv5L6zXRSK4Kr+RYVbV6XVmbntc+9F2kjcu0f 5EkY8zbEXglLD/yUWuQzyoyEgN+zOSWxOs/Dkg8U4XvCCHvw3giJtwcFF7V/moxRefFe ANH3B7hg3n0Q9SIIQHmj9ahGJql44IS20tRuVuL/aoNR+Cf74QQ2/r0KOoK7JKUwq0kT wC4nwLhO+hkR8Z+rlrIWwfZlWEtPE+oVfoiiUuK1yGuYRsTydSxL/sTBdgiJR+9hFkfX TDiaUPBHOALBwDZMSpDDNPz5Yc55NI4GlD3WR7CilztyPMp6mOLLanwyWEdE5SSyFWwE uZWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WH6EHvtw; 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 g2-20020ae9e102000000b0077438f60e5esi6430673qkm.211.2023.11.06.18.55.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:55:08 -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=WH6EHvtw; 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 1r0C9N-0008PX-Lw; Mon, 06 Nov 2023 21:49:09 -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 1r0C9J-0008Mu-He for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:05 -0500 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9H-0005tf-TK for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:05 -0500 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6ce37683cf6so3226253a34.3 for ; Mon, 06 Nov 2023 18:49:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325342; x=1699930142; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=8GSD+l+fgsavoFgGdG3xylhNYKfi9yVBkELAIfWGGOI=; b=WH6EHvtw4nprZlRHXJBdO9mqZAoH4cUg6657bNWUDhYaHDRBQlxRW83MN3gkZ/G3WY xH7TVIKIjFe6pEqwEPHFXC0P6RpG571aOmaOWYfRoxkqqFuYBgukl1bmAhUmsd/TLh7B KFpTTSJvqkpslAZP9UddZSW1v2uDdGQkQaQKIOoPXtC66fODJX0e+EMdF3EABOGrGqQn N0NBiQebkix//6tTVSu+rDzjFbGUuwnqqondR9KtESg5k3vbI9CgSC47MMH9CCmwUlmh 0sXSQvG8nPyNQwmK5RuBzX9aWd6BKwxSTQR+d5HUhsOoJt/8LA2U/No+mkrOmWO3G1a1 5vsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325342; x=1699930142; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8GSD+l+fgsavoFgGdG3xylhNYKfi9yVBkELAIfWGGOI=; b=U58aLZqNPRH04Or7ZsT1DYNx0l2Cj3FktVViGzZ7OgQWDHkxslRo4K5LBC3Jt3RBKw HIpuCBrDf2gZ3CIMmx2h9/VkL+mKxT/JC5MU4XefhBR0nVBnWiD8VVVzMRtMmA8scUBU eB6YPhs3Qpw8b/ZeoxZn4e2KW7qhCvfWcJwzzV+0tAxE8dNOEZ2pLak7rdPk3akRaTSK AZ3ZkoeSlA/HSc8Oj9h/ZjbcW5aNuf4KEpHEpWOe/P1UbpPfkc3sC0zGQXSpASU38JpL lTgH/k5+XY77pD88yUllU0ndq/S+HnMGddFVdY5KrpgR2CIaGhOSu4SLxgVOSnBK/5Da TVWw== X-Gm-Message-State: AOJu0YwY2SfZonE7nvNylq3Ko2RjHBMWFWsJQJEy6fYviqRlj3WqMstX fbX1++lqcgY9JXJzWFT/r210gEc+MKAStzHE6fQ= X-Received: by 2002:a9d:6293:0:b0:6b9:bf1e:c141 with SMTP id x19-20020a9d6293000000b006b9bf1ec141mr32466655otk.23.1699325342724; Mon, 06 Nov 2023 18:49:02 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:02 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 24/35] tcg/loongarch64: Implement neg opcodes Date: Mon, 6 Nov 2023 18:48:31 -0800 Message-Id: <20231107024842.7650-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32e; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32e.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 Signed-off-by: Richard Henderson Message-Id: <20231026041404.1229328-6-richard.henderson@linaro.org> --- tcg/loongarch64/tcg-target.h | 4 ++-- tcg/loongarch64/tcg-target.c.inc | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tcg/loongarch64/tcg-target.h b/tcg/loongarch64/tcg-target.h index 486898c2d3..189997644a 100644 --- a/tcg/loongarch64/tcg-target.h +++ b/tcg/loongarch64/tcg-target.h @@ -119,7 +119,7 @@ typedef enum { #define TCG_TARGET_HAS_bswap16_i32 1 #define TCG_TARGET_HAS_bswap32_i32 1 #define TCG_TARGET_HAS_not_i32 1 -#define TCG_TARGET_HAS_neg_i32 0 +#define TCG_TARGET_HAS_neg_i32 1 #define TCG_TARGET_HAS_andc_i32 1 #define TCG_TARGET_HAS_orc_i32 1 #define TCG_TARGET_HAS_eqv_i32 0 @@ -153,7 +153,7 @@ typedef enum { #define TCG_TARGET_HAS_bswap32_i64 1 #define TCG_TARGET_HAS_bswap64_i64 1 #define TCG_TARGET_HAS_not_i64 1 -#define TCG_TARGET_HAS_neg_i64 0 +#define TCG_TARGET_HAS_neg_i64 1 #define TCG_TARGET_HAS_andc_i64 1 #define TCG_TARGET_HAS_orc_i64 1 #define TCG_TARGET_HAS_eqv_i64 0 diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index ae13c1f666..a588fb3085 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -1441,6 +1441,13 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, } break; + case INDEX_op_neg_i32: + tcg_out_opc_sub_w(s, a0, TCG_REG_ZERO, a1); + break; + case INDEX_op_neg_i64: + tcg_out_opc_sub_d(s, a0, TCG_REG_ZERO, a1); + break; + case INDEX_op_mul_i32: tcg_out_opc_mul_w(s, a0, a1, a2); break; @@ -2076,6 +2083,8 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_extrl_i64_i32: case INDEX_op_extrh_i64_i32: case INDEX_op_ext_i32_i64: + case INDEX_op_neg_i32: + case INDEX_op_neg_i64: case INDEX_op_not_i32: case INDEX_op_not_i64: case INDEX_op_extract_i32: From patchwork Tue Nov 7 02:48:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741750 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1414956wrr; Mon, 6 Nov 2023 18:51:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHSCZHJ3l5C92CYEy9jGlhYdwSrfWvgPzJUrDlml1X9vthWF3vP9JUQQ1yq/7IAqPF9hDXG X-Received: by 2002:a05:620a:c45:b0:77a:8e1:840c with SMTP id u5-20020a05620a0c4500b0077a08e1840cmr36481833qki.33.1699325472981; Mon, 06 Nov 2023 18:51:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325472; cv=none; d=google.com; s=arc-20160816; b=svGqQC7jOCC1oWW1UZJ4EnNdEEZ9OUan4KHsQ3N/a9lTIiFULmpMN4VOetJCVBCWJS LU5FTHCfrkkdZv3UnrWPb2NtdLGqZbv8Rtna1AWGMEomJcp5dmu3McYebxYFqvhw6txa D35qn+veKVL2emtGgvcZOyPBagmRtJNzVSQsiWoWSXPUS5CtsWC8Ro/X3zKoaUzS27yX br7u0kJzTe07V/tekPDV6N3dbsJGlL5D9mtpbsFCiYkVgQT1R3K/X5/XW/I/KN4tHcw4 vdhXJbWFxKesANOWmWtuc6sZr7O56stXD/SQDDbU8Wz/Dbxkrcgw+eoLvJPEfX3EO92r LdqA== 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:to:from :dkim-signature; bh=BmxVri7VT4MUjzfnFpMDtKzBcAkAGuxFEEom/sZd+hA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=iOkT843LrLGSysv4idWgrYPAWcTyvKn8ySJheEbCfvJt7bT5FXidEYTJIkXQBBRfzC Cjh9EwN+6OkZQQ0Jea0oKAaI+Y1PNIjUNhO0godVUcj4GYvBrSk2tcT9W+5O37+KPO4l ywS775I0KfhZkYDfP43QXWc7UGkLpA86CxPHcsKtljdYcT9x0VGpclzPabze5XcqqVfi 4ZejLzKtqEJyMpfjW3F9Q4inH7aKF0Fx/rLIQFRXqZzHVVyXisVa8Ws0WAo33pc84Emk 1zewQQOLwbYP+RCdj7KPcFeJ7wQy5t0IuHc24GjtqcwHpv0in6F1fphvUqAFaG1bGf6a jXyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=z0kxV8ER; 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 h6-20020a05620a284600b007756ff02c5bsi6879203qkp.130.2023.11.06.18.51.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:51:12 -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=z0kxV8ER; 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 1r0C9N-0008PM-3o; Mon, 06 Nov 2023 21:49:09 -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 1r0C9L-0008OJ-D1 for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:07 -0500 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9J-0005tr-1j for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:07 -0500 Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3b5714439b3so2435875b6e.3 for ; Mon, 06 Nov 2023 18:49:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325343; x=1699930143; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=BmxVri7VT4MUjzfnFpMDtKzBcAkAGuxFEEom/sZd+hA=; b=z0kxV8ERrJTipHip/Bt6HcQUM4DEQ7/QxKy3gQSCLEji1OSebG4hQYqUmYf7I49t++ z0D/LfmyLvq+ehRzk+ItVXVsP7KfrYZMDTJkPA+7TBZGZWsE8k7DUCiW1bGgIy6o2mgA kh+VlQ1QkV9atCNRVyxucEF7QNFn9iG62KkHohDRB13OaEtHeEOiohHR7hCe/bBiPNdb n6ii2/i2YKNmgzO1JFeTka22U6L6RyYOQEEQFgiC/SZbe8ArUtbW6c8Zqmp5ckWIBi88 BvEhsm3ig/JVi2+48lvllhv419RYCuTIhUY3s0ZsyYQMtQ82GzAzeDFeqFC7CohRzNj4 uB8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325343; x=1699930143; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BmxVri7VT4MUjzfnFpMDtKzBcAkAGuxFEEom/sZd+hA=; b=rDzHrncOC7qCKassIfwVAHl7YOoXgYsvGY1PQcdYtQLyMjWDqyjlI5Mdp+Frf4nhml C60XnAGf0r0oPJSSxx1sm66DCM8ErRfNx8YthGsNHHRChhzw3PwsME/Q4PEoL/mXcn0W pibbe0gO9WBxP7KMP1nuv2zqov8Bp7gJ7XmXtWb3FbGhnsb4CFoaM3YEKdaCJ241EzyN 1dlP1b+0TKouMl10CLvLLA2zMFlpIYm5gSx8/0CFZyf9FlN7R7A99uQGe/IyXxxuinXx QnYzAQkiUTeXNOKrRPdNc7XCjIt1KaBYTJlU2V/N+yBBVqxQvZPoHR1lCXUfDBCaNz9+ W3Pg== X-Gm-Message-State: AOJu0YxyXDyw0avKqi5O5K2arZm8X6h6tLq4dDZmnfQPMwZO1IA8VwXO KY+9g1Y2K4mCWgEzrF5NW0QFqLn1yqDY3wd6KIg= X-Received: by 2002:a05:6808:9a3:b0:3b2:e9ad:c01f with SMTP id e3-20020a05680809a300b003b2e9adc01fmr25947185oig.44.1699325343678; Mon, 06 Nov 2023 18:49:03 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 25/35] tcg: Remove TCG_TARGET_HAS_neg_{i32,i64} Date: Mon, 6 Nov 2023 18:48:32 -0800 Message-Id: <20231107024842.7650-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::234; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x234.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 The movcond opcode is now mandatory for backends to implement. Signed-off-by: Richard Henderson Message-Id: <20231026041404.1229328-7-richard.henderson@linaro.org> --- include/tcg/tcg-opc.h | 4 ++-- include/tcg/tcg.h | 1 - tcg/aarch64/tcg-target.h | 2 -- tcg/arm/tcg-target.h | 1 - tcg/i386/tcg-target.h | 2 -- tcg/loongarch64/tcg-target.h | 2 -- tcg/mips/tcg-target.h | 2 -- tcg/ppc/tcg-target.h | 2 -- tcg/riscv/tcg-target.h | 2 -- tcg/s390x/tcg-target.h | 2 -- tcg/sparc64/tcg-target.h | 2 -- tcg/tci/tcg-target.h | 2 -- tcg/optimize.c | 4 ++-- tcg/tcg-op.c | 22 +++++++++------------- tcg/tcg.c | 6 ++---- tcg/tci.c | 2 -- 16 files changed, 15 insertions(+), 43 deletions(-) diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h index ecd08db0de..b80227fa1c 100644 --- a/include/tcg/tcg-opc.h +++ b/include/tcg/tcg-opc.h @@ -100,7 +100,7 @@ DEF(ext16u_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_ext16u_i32)) DEF(bswap16_i32, 1, 1, 1, IMPL(TCG_TARGET_HAS_bswap16_i32)) DEF(bswap32_i32, 1, 1, 1, IMPL(TCG_TARGET_HAS_bswap32_i32)) DEF(not_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_not_i32)) -DEF(neg_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_neg_i32)) +DEF(neg_i32, 1, 1, 0, 0) DEF(andc_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_andc_i32)) DEF(orc_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_orc_i32)) DEF(eqv_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_eqv_i32)) @@ -171,7 +171,7 @@ DEF(bswap16_i64, 1, 1, 1, IMPL64 | IMPL(TCG_TARGET_HAS_bswap16_i64)) DEF(bswap32_i64, 1, 1, 1, IMPL64 | IMPL(TCG_TARGET_HAS_bswap32_i64)) DEF(bswap64_i64, 1, 1, 1, IMPL64 | IMPL(TCG_TARGET_HAS_bswap64_i64)) DEF(not_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_not_i64)) -DEF(neg_i64, 1, 1, 0, IMPL64 | IMPL(TCG_TARGET_HAS_neg_i64)) +DEF(neg_i64, 1, 1, 0, IMPL64) DEF(andc_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_andc_i64)) DEF(orc_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_orc_i64)) DEF(eqv_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_eqv_i64)) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 32a208a02e..daf2a5bf9e 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -82,7 +82,6 @@ typedef uint64_t TCGRegSet; #define TCG_TARGET_HAS_bswap16_i64 0 #define TCG_TARGET_HAS_bswap32_i64 0 #define TCG_TARGET_HAS_bswap64_i64 0 -#define TCG_TARGET_HAS_neg_i64 0 #define TCG_TARGET_HAS_not_i64 0 #define TCG_TARGET_HAS_andc_i64 0 #define TCG_TARGET_HAS_orc_i64 0 diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index 352e19aba8..33f15a564a 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -71,7 +71,6 @@ typedef enum { #define TCG_TARGET_HAS_bswap16_i32 1 #define TCG_TARGET_HAS_bswap32_i32 1 #define TCG_TARGET_HAS_not_i32 1 -#define TCG_TARGET_HAS_neg_i32 1 #define TCG_TARGET_HAS_rot_i32 1 #define TCG_TARGET_HAS_andc_i32 1 #define TCG_TARGET_HAS_orc_i32 1 @@ -107,7 +106,6 @@ typedef enum { #define TCG_TARGET_HAS_bswap32_i64 1 #define TCG_TARGET_HAS_bswap64_i64 1 #define TCG_TARGET_HAS_not_i64 1 -#define TCG_TARGET_HAS_neg_i64 1 #define TCG_TARGET_HAS_rot_i64 1 #define TCG_TARGET_HAS_andc_i64 1 #define TCG_TARGET_HAS_orc_i64 1 diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index 439898efb3..a712cc80ad 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -101,7 +101,6 @@ extern bool use_neon_instructions; #define TCG_TARGET_HAS_bswap16_i32 1 #define TCG_TARGET_HAS_bswap32_i32 1 #define TCG_TARGET_HAS_not_i32 1 -#define TCG_TARGET_HAS_neg_i32 1 #define TCG_TARGET_HAS_rot_i32 1 #define TCG_TARGET_HAS_andc_i32 1 #define TCG_TARGET_HAS_orc_i32 0 diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 7522ce7575..fa34deec47 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -135,7 +135,6 @@ typedef enum { #define TCG_TARGET_HAS_ext16u_i32 1 #define TCG_TARGET_HAS_bswap16_i32 1 #define TCG_TARGET_HAS_bswap32_i32 1 -#define TCG_TARGET_HAS_neg_i32 1 #define TCG_TARGET_HAS_not_i32 1 #define TCG_TARGET_HAS_andc_i32 have_bmi1 #define TCG_TARGET_HAS_orc_i32 0 @@ -171,7 +170,6 @@ typedef enum { #define TCG_TARGET_HAS_bswap16_i64 1 #define TCG_TARGET_HAS_bswap32_i64 1 #define TCG_TARGET_HAS_bswap64_i64 1 -#define TCG_TARGET_HAS_neg_i64 1 #define TCG_TARGET_HAS_not_i64 1 #define TCG_TARGET_HAS_andc_i64 have_bmi1 #define TCG_TARGET_HAS_orc_i64 0 diff --git a/tcg/loongarch64/tcg-target.h b/tcg/loongarch64/tcg-target.h index 189997644a..9c70ebfefc 100644 --- a/tcg/loongarch64/tcg-target.h +++ b/tcg/loongarch64/tcg-target.h @@ -119,7 +119,6 @@ typedef enum { #define TCG_TARGET_HAS_bswap16_i32 1 #define TCG_TARGET_HAS_bswap32_i32 1 #define TCG_TARGET_HAS_not_i32 1 -#define TCG_TARGET_HAS_neg_i32 1 #define TCG_TARGET_HAS_andc_i32 1 #define TCG_TARGET_HAS_orc_i32 1 #define TCG_TARGET_HAS_eqv_i32 0 @@ -153,7 +152,6 @@ typedef enum { #define TCG_TARGET_HAS_bswap32_i64 1 #define TCG_TARGET_HAS_bswap64_i64 1 #define TCG_TARGET_HAS_not_i64 1 -#define TCG_TARGET_HAS_neg_i64 1 #define TCG_TARGET_HAS_andc_i64 1 #define TCG_TARGET_HAS_orc_i64 1 #define TCG_TARGET_HAS_eqv_i64 0 diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h index 20c14224fb..b98ffae1d0 100644 --- a/tcg/mips/tcg-target.h +++ b/tcg/mips/tcg-target.h @@ -184,12 +184,10 @@ extern bool use_mips32r2_instructions; #endif /* optional instructions automatically implemented */ -#define TCG_TARGET_HAS_neg_i32 1 #define TCG_TARGET_HAS_ext8u_i32 0 /* andi rt, rs, 0xff */ #define TCG_TARGET_HAS_ext16u_i32 0 /* andi rt, rs, 0xffff */ #if TCG_TARGET_REG_BITS == 64 -#define TCG_TARGET_HAS_neg_i64 1 #define TCG_TARGET_HAS_ext8u_i64 0 /* andi rt, rs, 0xff */ #define TCG_TARGET_HAS_ext16u_i64 0 /* andi rt, rs, 0xffff */ #endif diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h index a2856afd4d..5295e4f9ab 100644 --- a/tcg/ppc/tcg-target.h +++ b/tcg/ppc/tcg-target.h @@ -83,7 +83,6 @@ typedef enum { #define TCG_TARGET_HAS_bswap16_i32 1 #define TCG_TARGET_HAS_bswap32_i32 1 #define TCG_TARGET_HAS_not_i32 1 -#define TCG_TARGET_HAS_neg_i32 1 #define TCG_TARGET_HAS_andc_i32 1 #define TCG_TARGET_HAS_orc_i32 1 #define TCG_TARGET_HAS_eqv_i32 1 @@ -120,7 +119,6 @@ typedef enum { #define TCG_TARGET_HAS_bswap32_i64 1 #define TCG_TARGET_HAS_bswap64_i64 1 #define TCG_TARGET_HAS_not_i64 1 -#define TCG_TARGET_HAS_neg_i64 1 #define TCG_TARGET_HAS_andc_i64 1 #define TCG_TARGET_HAS_orc_i64 1 #define TCG_TARGET_HAS_eqv_i64 1 diff --git a/tcg/riscv/tcg-target.h b/tcg/riscv/tcg-target.h index f3644a8bc1..a4edc3dc74 100644 --- a/tcg/riscv/tcg-target.h +++ b/tcg/riscv/tcg-target.h @@ -109,7 +109,6 @@ extern bool have_zbb; #define TCG_TARGET_HAS_bswap16_i32 have_zbb #define TCG_TARGET_HAS_bswap32_i32 have_zbb #define TCG_TARGET_HAS_not_i32 1 -#define TCG_TARGET_HAS_neg_i32 1 #define TCG_TARGET_HAS_andc_i32 have_zbb #define TCG_TARGET_HAS_orc_i32 have_zbb #define TCG_TARGET_HAS_eqv_i32 have_zbb @@ -142,7 +141,6 @@ extern bool have_zbb; #define TCG_TARGET_HAS_bswap32_i64 have_zbb #define TCG_TARGET_HAS_bswap64_i64 have_zbb #define TCG_TARGET_HAS_not_i64 1 -#define TCG_TARGET_HAS_neg_i64 1 #define TCG_TARGET_HAS_andc_i64 have_zbb #define TCG_TARGET_HAS_orc_i64 have_zbb #define TCG_TARGET_HAS_eqv_i64 have_zbb diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index 2c936c1bcb..e69b0d2ddd 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -82,7 +82,6 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_bswap16_i32 1 #define TCG_TARGET_HAS_bswap32_i32 1 #define TCG_TARGET_HAS_not_i32 HAVE_FACILITY(MISC_INSN_EXT3) -#define TCG_TARGET_HAS_neg_i32 1 #define TCG_TARGET_HAS_andc_i32 HAVE_FACILITY(MISC_INSN_EXT3) #define TCG_TARGET_HAS_orc_i32 HAVE_FACILITY(MISC_INSN_EXT3) #define TCG_TARGET_HAS_eqv_i32 HAVE_FACILITY(MISC_INSN_EXT3) @@ -117,7 +116,6 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_bswap32_i64 1 #define TCG_TARGET_HAS_bswap64_i64 1 #define TCG_TARGET_HAS_not_i64 HAVE_FACILITY(MISC_INSN_EXT3) -#define TCG_TARGET_HAS_neg_i64 1 #define TCG_TARGET_HAS_andc_i64 HAVE_FACILITY(MISC_INSN_EXT3) #define TCG_TARGET_HAS_orc_i64 HAVE_FACILITY(MISC_INSN_EXT3) #define TCG_TARGET_HAS_eqv_i64 HAVE_FACILITY(MISC_INSN_EXT3) diff --git a/tcg/sparc64/tcg-target.h b/tcg/sparc64/tcg-target.h index 4c286c6006..f8cf145266 100644 --- a/tcg/sparc64/tcg-target.h +++ b/tcg/sparc64/tcg-target.h @@ -91,7 +91,6 @@ extern bool use_vis3_instructions; #define TCG_TARGET_HAS_ext16u_i32 0 #define TCG_TARGET_HAS_bswap16_i32 0 #define TCG_TARGET_HAS_bswap32_i32 0 -#define TCG_TARGET_HAS_neg_i32 1 #define TCG_TARGET_HAS_not_i32 1 #define TCG_TARGET_HAS_andc_i32 1 #define TCG_TARGET_HAS_orc_i32 1 @@ -127,7 +126,6 @@ extern bool use_vis3_instructions; #define TCG_TARGET_HAS_bswap16_i64 0 #define TCG_TARGET_HAS_bswap32_i64 0 #define TCG_TARGET_HAS_bswap64_i64 0 -#define TCG_TARGET_HAS_neg_i64 1 #define TCG_TARGET_HAS_not_i64 1 #define TCG_TARGET_HAS_andc_i64 1 #define TCG_TARGET_HAS_orc_i64 1 diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h index 3503fc4a4c..2a13816c8e 100644 --- a/tcg/tci/tcg-target.h +++ b/tcg/tci/tcg-target.h @@ -65,7 +65,6 @@ #define TCG_TARGET_HAS_clz_i32 1 #define TCG_TARGET_HAS_ctz_i32 1 #define TCG_TARGET_HAS_ctpop_i32 1 -#define TCG_TARGET_HAS_neg_i32 1 #define TCG_TARGET_HAS_not_i32 1 #define TCG_TARGET_HAS_orc_i32 1 #define TCG_TARGET_HAS_rot_i32 1 @@ -99,7 +98,6 @@ #define TCG_TARGET_HAS_clz_i64 1 #define TCG_TARGET_HAS_ctz_i64 1 #define TCG_TARGET_HAS_ctpop_i64 1 -#define TCG_TARGET_HAS_neg_i64 1 #define TCG_TARGET_HAS_not_i64 1 #define TCG_TARGET_HAS_orc_i64 1 #define TCG_TARGET_HAS_rot_i64 1 diff --git a/tcg/optimize.c b/tcg/optimize.c index 2db5177c32..6b072d4cdb 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2001,11 +2001,11 @@ static bool fold_sub_to_neg(OptContext *ctx, TCGOp *op) switch (ctx->type) { case TCG_TYPE_I32: neg_op = INDEX_op_neg_i32; - have_neg = TCG_TARGET_HAS_neg_i32; + have_neg = true; break; case TCG_TYPE_I64: neg_op = INDEX_op_neg_i64; - have_neg = TCG_TARGET_HAS_neg_i64; + have_neg = true; break; case TCG_TYPE_V64: case TCG_TYPE_V128: diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 26bcd090c1..de096a6f93 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -363,9 +363,8 @@ void tcg_gen_sub_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) void tcg_gen_subfi_i32(TCGv_i32 ret, int32_t arg1, TCGv_i32 arg2) { - if (arg1 == 0 && TCG_TARGET_HAS_neg_i32) { - /* Don't recurse with tcg_gen_neg_i32. */ - tcg_gen_op2_i32(INDEX_op_neg_i32, ret, arg2); + if (arg1 == 0) { + tcg_gen_neg_i32(ret, arg2); } else { tcg_gen_sub_i32(ret, tcg_constant_i32(arg1), arg2); } @@ -383,11 +382,7 @@ void tcg_gen_subi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) void tcg_gen_neg_i32(TCGv_i32 ret, TCGv_i32 arg) { - if (TCG_TARGET_HAS_neg_i32) { - tcg_gen_op2_i32(INDEX_op_neg_i32, ret, arg); - } else { - tcg_gen_subfi_i32(ret, 0, arg); - } + tcg_gen_op2_i32(INDEX_op_neg_i32, ret, arg); } void tcg_gen_and_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) @@ -1744,9 +1739,8 @@ void tcg_gen_addi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) void tcg_gen_subfi_i64(TCGv_i64 ret, int64_t arg1, TCGv_i64 arg2) { - if (arg1 == 0 && TCG_TARGET_HAS_neg_i64) { - /* Don't recurse with tcg_gen_neg_i64. */ - tcg_gen_op2_i64(INDEX_op_neg_i64, ret, arg2); + if (arg1 == 0) { + tcg_gen_neg_i64(ret, arg2); } else if (TCG_TARGET_REG_BITS == 64) { tcg_gen_sub_i64(ret, tcg_constant_i64(arg1), arg2); } else { @@ -1772,10 +1766,12 @@ void tcg_gen_subi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) void tcg_gen_neg_i64(TCGv_i64 ret, TCGv_i64 arg) { - if (TCG_TARGET_HAS_neg_i64) { + if (TCG_TARGET_REG_BITS == 64) { tcg_gen_op2_i64(INDEX_op_neg_i64, ret, arg); } else { - tcg_gen_subfi_i64(ret, 0, arg); + TCGv_i32 zero = tcg_constant_i32(0); + tcg_gen_sub2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), + zero, zero, TCGV_LOW(arg), TCGV_HIGH(arg)); } } diff --git a/tcg/tcg.c b/tcg/tcg.c index d59ff14f0f..d2ea22b397 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1988,6 +1988,7 @@ bool tcg_op_supported(TCGOpcode op) case INDEX_op_st_i32: case INDEX_op_add_i32: case INDEX_op_sub_i32: + case INDEX_op_neg_i32: case INDEX_op_mul_i32: case INDEX_op_and_i32: case INDEX_op_or_i32: @@ -2045,8 +2046,6 @@ bool tcg_op_supported(TCGOpcode op) return TCG_TARGET_HAS_bswap32_i32; case INDEX_op_not_i32: return TCG_TARGET_HAS_not_i32; - case INDEX_op_neg_i32: - return TCG_TARGET_HAS_neg_i32; case INDEX_op_andc_i32: return TCG_TARGET_HAS_andc_i32; case INDEX_op_orc_i32: @@ -2085,6 +2084,7 @@ bool tcg_op_supported(TCGOpcode op) case INDEX_op_st_i64: case INDEX_op_add_i64: case INDEX_op_sub_i64: + case INDEX_op_neg_i64: case INDEX_op_mul_i64: case INDEX_op_and_i64: case INDEX_op_or_i64: @@ -2141,8 +2141,6 @@ bool tcg_op_supported(TCGOpcode op) return TCG_TARGET_HAS_bswap64_i64; case INDEX_op_not_i64: return TCG_TARGET_HAS_not_i64; - case INDEX_op_neg_i64: - return TCG_TARGET_HAS_neg_i64; case INDEX_op_andc_i64: return TCG_TARGET_HAS_andc_i64; case INDEX_op_orc_i64: diff --git a/tcg/tci.c b/tcg/tci.c index 4640902c88..3cc851b7bd 100644 --- a/tcg/tci.c +++ b/tcg/tci.c @@ -733,12 +733,10 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, regs[r0] = ~regs[r1]; break; #endif -#if TCG_TARGET_HAS_neg_i32 || TCG_TARGET_HAS_neg_i64 CASE_32_64(neg) tci_args_rr(insn, &r0, &r1); regs[r0] = -regs[r1]; break; -#endif #if TCG_TARGET_REG_BITS == 64 /* Load/store operations (64 bit). */ From patchwork Tue Nov 7 02:48:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741765 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415747wrr; Mon, 6 Nov 2023 18:54:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZbZojBK7YkeE4xsaVh4qANFrYlyQVwTvYgQ16gg80ObE8Vw8h9vj/smTG3MOR2jDoj+e0 X-Received: by 2002:a05:6214:2aa8:b0:66d:1100:7b81 with SMTP id js8-20020a0562142aa800b0066d11007b81mr33197350qvb.18.1699325645870; Mon, 06 Nov 2023 18:54:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325645; cv=none; d=google.com; s=arc-20160816; b=FfQSYP+bzFgSlhkE4DAADPJB+pX/4SkTAcGZzhEKOT5VKDonOKRvi4KNyzg6I9qoEk rmc4wXuI8GCfvZ63+y2ZF8IvRhszDHCQnbufDovAZSRvFscpaqjlqEUciPWUK8IkaseE 2vtZwkr0MsfRcKotlJkvWWvHsksOV+ONmslnkcEZZM4p92XBNQEiXF1JIUzYZ8KuWtOL EerDUT0hAyeRdGC76//uuItkMFMbkRqPSrAxf/Yj5BEwOP4rJZ9zgtblGZ0aRlNQOV1/ pJJ1OmRih2Mjmi/CW1eUhjQdxWmr6jW7LrFjssRLC3vfkOoW+zPQMq8nq+i36bMP/WTd FRPw== 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=Z7hu7I1v6RDDh0TrF9ctysWl55drcBpviXkmgRNznnU=; fh=KXT8skN7RFTc7N6YjUNlSMSjM9WXZW43UAg6bOEDSoc=; b=VLq5Iq8Ff8u1Q2nUdGyS9QCMQ/2MrLXTVPHkWfhUYUnMttkiRD6RZtakeV4ygUiz4h PZmlsL/0plP6zQFsNB0IN216itsfMHHWk8XH8s0sLQBFq5avXHwqkOdwk15+YFl/Gblk 3AEq9i7+11kSiLuLPWM2Eqh5gtXeTpFhGqfeaNpjTWwOj2PH83llbdd6f6eAJmetHwoT nYU15EA+qvC1T4jPKMZH0cdCT/SOlA2sUn3YP3e7GVzTRUIGPAEOgbZjh/fOPFZP/5yU lR0itQXu9aOqr76obu2/d8VDXqshRhvWTsrMGexlLH7A1RzqNvfzVI09Xs5GE4/DbjG9 7Gcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aAoRsgtU; 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 k2-20020a0cebc2000000b0065d0358ebc5si6456151qvq.394.2023.11.06.18.54.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:54: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=aAoRsgtU; 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 1r0C9O-0008Pm-A5; Mon, 06 Nov 2023 21:49:10 -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 1r0C9L-0008OZ-Oq for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:07 -0500 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9J-0005up-MS for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:07 -0500 Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3b6ad461599so36758b6e.1 for ; Mon, 06 Nov 2023 18:49:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325344; x=1699930144; 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=Z7hu7I1v6RDDh0TrF9ctysWl55drcBpviXkmgRNznnU=; b=aAoRsgtUVZix/q//BgWe56yIUb3NOBSuCL19ef7EwWI+ZpocK4SZlAUlmUumq7qnK7 MRPNYY4uNnoM1U5BR+gdzru/VK8CkgPUJdtVj3y8eseUDFEdqHJqlelvEF1U6uB8STLl btrBACKqgbDt2dmEwgjqcG/ROfFQt+bk30l1KjMza7mQq3jLX67nBrLZcGA0DloaE+Zt pZDAoBA7jqsjwNH7zzMJGYIwcF+4LJiN1Eff8KiBriC4bA04CETmZuKI7q3SFhd3o2Pz 1iHdngsX7HJ6Xbkc1G5g/n9Z3u6q2CWVEsy/EC0GBBTT3sCx0c7EKZa3hahE8Rd363Ce yuRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325344; x=1699930144; 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=Z7hu7I1v6RDDh0TrF9ctysWl55drcBpviXkmgRNznnU=; b=S3JHDgi5rGClmMpUFzLOb+pZuhe22xO/N+ozQPXBglQTH9lmwZ7XEb/vQSFnIHr4qS /imKrUd8AE/yyCggHqSYt9ShJ0nAxCUHEbNihxAgLivANhBh90+0xCgsFvQ5tTYr2T6Z d0q9wFv+sMzy2vUBr5QFS++pSksEJ1bOTZLBj4k1stutMRLhf6xi0Ba2qOeUdD4HcIl2 UFETbfpnHZ4NwJN9zTPJE5B5B4aeyFi9KhUVryUens3Y3laoVCITW9Ykuil/ChuxluIN VW2wMOVedjtEEiQ3+9+9HVRfaYcdZK7MKflqskGziNjyqSLLSGX/BdeyR/vzz++UD66t iTcg== X-Gm-Message-State: AOJu0YzP7DORaQteLLCiUKlDZOq9D0a4MGdl+28Uwbxy6QK03bTe2Fbj XTV8mrvxCBhlyacbxMN5mJYMFBjzMYbvJj2FTfw= X-Received: by 2002:a05:6808:9b5:b0:3b2:f15e:459f with SMTP id e21-20020a05680809b500b003b2f15e459fmr31203177oig.58.1699325344494; Mon, 06 Nov 2023 18:49:04 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao Subject: [PATCH 26/35] tcg: Don't free vector results Date: Mon, 6 Nov 2023 18:48:33 -0800 Message-Id: <20231107024842.7650-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22b; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22b.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 Avoid reusing vector temporaries so that we may re-use them when propagating stores to loads. Reviewed-by: Song Gao Signed-off-by: Richard Henderson --- tcg/tcg-op-gvec.c | 112 ++++++++++++++++------------------------------ 1 file changed, 38 insertions(+), 74 deletions(-) diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index feb2d3686b..bb88943f79 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -561,7 +561,6 @@ static void do_dup(unsigned vece, uint32_t dofs, uint32_t oprsz, tcg_gen_dupi_vec(vece, t_vec, in_c); } do_dup_store(type, dofs, oprsz, maxsz, t_vec); - tcg_temp_free_vec(t_vec); return; } @@ -1024,11 +1023,10 @@ static void expand_2_vec(unsigned vece, uint32_t dofs, uint32_t aofs, bool load_dest, void (*fni)(unsigned, TCGv_vec, TCGv_vec)) { - TCGv_vec t0 = tcg_temp_new_vec(type); - TCGv_vec t1 = tcg_temp_new_vec(type); - uint32_t i; + for (uint32_t i = 0; i < oprsz; i += tysz) { + TCGv_vec t0 = tcg_temp_new_vec(type); + TCGv_vec t1 = tcg_temp_new_vec(type); - for (i = 0; i < oprsz; i += tysz) { tcg_gen_ld_vec(t0, tcg_env, aofs + i); if (load_dest) { tcg_gen_ld_vec(t1, tcg_env, dofs + i); @@ -1036,8 +1034,6 @@ static void expand_2_vec(unsigned vece, uint32_t dofs, uint32_t aofs, fni(vece, t1, t0); tcg_gen_st_vec(t1, tcg_env, dofs + i); } - tcg_temp_free_vec(t0); - tcg_temp_free_vec(t1); } /* Expand OPSZ bytes worth of two-vector operands and an immediate operand @@ -1047,11 +1043,10 @@ static void expand_2i_vec(unsigned vece, uint32_t dofs, uint32_t aofs, int64_t c, bool load_dest, void (*fni)(unsigned, TCGv_vec, TCGv_vec, int64_t)) { - TCGv_vec t0 = tcg_temp_new_vec(type); - TCGv_vec t1 = tcg_temp_new_vec(type); - uint32_t i; + for (uint32_t i = 0; i < oprsz; i += tysz) { + TCGv_vec t0 = tcg_temp_new_vec(type); + TCGv_vec t1 = tcg_temp_new_vec(type); - for (i = 0; i < oprsz; i += tysz) { tcg_gen_ld_vec(t0, tcg_env, aofs + i); if (load_dest) { tcg_gen_ld_vec(t1, tcg_env, dofs + i); @@ -1059,8 +1054,6 @@ static void expand_2i_vec(unsigned vece, uint32_t dofs, uint32_t aofs, fni(vece, t1, t0, c); tcg_gen_st_vec(t1, tcg_env, dofs + i); } - tcg_temp_free_vec(t0); - tcg_temp_free_vec(t1); } static void expand_2s_vec(unsigned vece, uint32_t dofs, uint32_t aofs, @@ -1068,11 +1061,10 @@ static void expand_2s_vec(unsigned vece, uint32_t dofs, uint32_t aofs, TCGv_vec c, bool scalar_first, void (*fni)(unsigned, TCGv_vec, TCGv_vec, TCGv_vec)) { - TCGv_vec t0 = tcg_temp_new_vec(type); - TCGv_vec t1 = tcg_temp_new_vec(type); - uint32_t i; + for (uint32_t i = 0; i < oprsz; i += tysz) { + TCGv_vec t0 = tcg_temp_new_vec(type); + TCGv_vec t1 = tcg_temp_new_vec(type); - for (i = 0; i < oprsz; i += tysz) { tcg_gen_ld_vec(t0, tcg_env, aofs + i); if (scalar_first) { fni(vece, t1, c, t0); @@ -1081,8 +1073,6 @@ static void expand_2s_vec(unsigned vece, uint32_t dofs, uint32_t aofs, } tcg_gen_st_vec(t1, tcg_env, dofs + i); } - tcg_temp_free_vec(t0); - tcg_temp_free_vec(t1); } /* Expand OPSZ bytes worth of three-operand operations using host vectors. */ @@ -1091,12 +1081,11 @@ static void expand_3_vec(unsigned vece, uint32_t dofs, uint32_t aofs, uint32_t tysz, TCGType type, bool load_dest, void (*fni)(unsigned, TCGv_vec, TCGv_vec, TCGv_vec)) { - TCGv_vec t0 = tcg_temp_new_vec(type); - TCGv_vec t1 = tcg_temp_new_vec(type); - TCGv_vec t2 = tcg_temp_new_vec(type); - uint32_t i; + for (uint32_t i = 0; i < oprsz; i += tysz) { + TCGv_vec t0 = tcg_temp_new_vec(type); + TCGv_vec t1 = tcg_temp_new_vec(type); + TCGv_vec t2 = tcg_temp_new_vec(type); - for (i = 0; i < oprsz; i += tysz) { tcg_gen_ld_vec(t0, tcg_env, aofs + i); tcg_gen_ld_vec(t1, tcg_env, bofs + i); if (load_dest) { @@ -1105,9 +1094,6 @@ static void expand_3_vec(unsigned vece, uint32_t dofs, uint32_t aofs, fni(vece, t2, t0, t1); tcg_gen_st_vec(t2, tcg_env, dofs + i); } - tcg_temp_free_vec(t2); - tcg_temp_free_vec(t1); - tcg_temp_free_vec(t0); } /* @@ -1120,12 +1106,11 @@ static void expand_3i_vec(unsigned vece, uint32_t dofs, uint32_t aofs, void (*fni)(unsigned, TCGv_vec, TCGv_vec, TCGv_vec, int64_t)) { - TCGv_vec t0 = tcg_temp_new_vec(type); - TCGv_vec t1 = tcg_temp_new_vec(type); - TCGv_vec t2 = tcg_temp_new_vec(type); - uint32_t i; + for (uint32_t i = 0; i < oprsz; i += tysz) { + TCGv_vec t0 = tcg_temp_new_vec(type); + TCGv_vec t1 = tcg_temp_new_vec(type); + TCGv_vec t2 = tcg_temp_new_vec(type); - for (i = 0; i < oprsz; i += tysz) { tcg_gen_ld_vec(t0, tcg_env, aofs + i); tcg_gen_ld_vec(t1, tcg_env, bofs + i); if (load_dest) { @@ -1134,9 +1119,6 @@ static void expand_3i_vec(unsigned vece, uint32_t dofs, uint32_t aofs, fni(vece, t2, t0, t1, c); tcg_gen_st_vec(t2, tcg_env, dofs + i); } - tcg_temp_free_vec(t0); - tcg_temp_free_vec(t1); - tcg_temp_free_vec(t2); } /* Expand OPSZ bytes worth of four-operand operations using host vectors. */ @@ -1146,13 +1128,12 @@ static void expand_4_vec(unsigned vece, uint32_t dofs, uint32_t aofs, void (*fni)(unsigned, TCGv_vec, TCGv_vec, TCGv_vec, TCGv_vec)) { - TCGv_vec t0 = tcg_temp_new_vec(type); - TCGv_vec t1 = tcg_temp_new_vec(type); - TCGv_vec t2 = tcg_temp_new_vec(type); - TCGv_vec t3 = tcg_temp_new_vec(type); - uint32_t i; + for (uint32_t i = 0; i < oprsz; i += tysz) { + TCGv_vec t0 = tcg_temp_new_vec(type); + TCGv_vec t1 = tcg_temp_new_vec(type); + TCGv_vec t2 = tcg_temp_new_vec(type); + TCGv_vec t3 = tcg_temp_new_vec(type); - for (i = 0; i < oprsz; i += tysz) { tcg_gen_ld_vec(t1, tcg_env, aofs + i); tcg_gen_ld_vec(t2, tcg_env, bofs + i); tcg_gen_ld_vec(t3, tcg_env, cofs + i); @@ -1162,10 +1143,6 @@ static void expand_4_vec(unsigned vece, uint32_t dofs, uint32_t aofs, tcg_gen_st_vec(t1, tcg_env, aofs + i); } } - tcg_temp_free_vec(t3); - tcg_temp_free_vec(t2); - tcg_temp_free_vec(t1); - tcg_temp_free_vec(t0); } /* @@ -1178,23 +1155,18 @@ static void expand_4i_vec(unsigned vece, uint32_t dofs, uint32_t aofs, void (*fni)(unsigned, TCGv_vec, TCGv_vec, TCGv_vec, TCGv_vec, int64_t)) { - TCGv_vec t0 = tcg_temp_new_vec(type); - TCGv_vec t1 = tcg_temp_new_vec(type); - TCGv_vec t2 = tcg_temp_new_vec(type); - TCGv_vec t3 = tcg_temp_new_vec(type); - uint32_t i; + for (uint32_t i = 0; i < oprsz; i += tysz) { + TCGv_vec t0 = tcg_temp_new_vec(type); + TCGv_vec t1 = tcg_temp_new_vec(type); + TCGv_vec t2 = tcg_temp_new_vec(type); + TCGv_vec t3 = tcg_temp_new_vec(type); - for (i = 0; i < oprsz; i += tysz) { tcg_gen_ld_vec(t1, tcg_env, aofs + i); tcg_gen_ld_vec(t2, tcg_env, bofs + i); tcg_gen_ld_vec(t3, tcg_env, cofs + i); fni(vece, t0, t1, t2, t3, c); tcg_gen_st_vec(t0, tcg_env, dofs + i); } - tcg_temp_free_vec(t3); - tcg_temp_free_vec(t2); - tcg_temp_free_vec(t1); - tcg_temp_free_vec(t0); } /* Expand a vector two-operand operation. */ @@ -1732,7 +1704,6 @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dofs, uint32_t aofs, TCGv_vec t_vec = tcg_temp_new_vec(type); tcg_gen_dup_mem_vec(vece, t_vec, tcg_env, aofs); do_dup_store(type, dofs, oprsz, maxsz, t_vec); - tcg_temp_free_vec(t_vec); } else if (vece <= MO_32) { TCGv_i32 in = tcg_temp_ebb_new_i32(); switch (vece) { @@ -1766,7 +1737,6 @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dofs, uint32_t aofs, for (i = (aofs == dofs) * 16; i < oprsz; i += 16) { tcg_gen_st_vec(in, tcg_env, dofs + i); } - tcg_temp_free_vec(in); } else { TCGv_i64 in0 = tcg_temp_ebb_new_i64(); TCGv_i64 in1 = tcg_temp_ebb_new_i64(); @@ -1796,7 +1766,6 @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dofs, uint32_t aofs, for (i = (aofs == dofs) * 32; i < oprsz; i += 32) { tcg_gen_st_vec(in, tcg_env, dofs + i); } - tcg_temp_free_vec(in); } else if (TCG_TARGET_HAS_v128) { TCGv_vec in0 = tcg_temp_new_vec(TCG_TYPE_V128); TCGv_vec in1 = tcg_temp_new_vec(TCG_TYPE_V128); @@ -1807,8 +1776,6 @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dofs, uint32_t aofs, tcg_gen_st_vec(in0, tcg_env, dofs + i); tcg_gen_st_vec(in1, tcg_env, dofs + i + 16); } - tcg_temp_free_vec(in0); - tcg_temp_free_vec(in1); } else { TCGv_i64 in[4]; int j; @@ -3136,15 +3103,14 @@ static void expand_2sh_vec(unsigned vece, uint32_t dofs, uint32_t aofs, TCGv_i32 shift, void (*fni)(unsigned, TCGv_vec, TCGv_vec, TCGv_i32)) { - TCGv_vec t0 = tcg_temp_new_vec(type); - uint32_t i; + for (uint32_t i = 0; i < oprsz; i += tysz) { + TCGv_vec t0 = tcg_temp_new_vec(type); + TCGv_vec t1 = tcg_temp_new_vec(type); - for (i = 0; i < oprsz; i += tysz) { tcg_gen_ld_vec(t0, tcg_env, aofs + i); - fni(vece, t0, t0, shift); - tcg_gen_st_vec(t0, tcg_env, dofs + i); + fni(vece, t1, t0, shift); + tcg_gen_st_vec(t1, tcg_env, dofs + i); } - tcg_temp_free_vec(t0); } static void @@ -3720,18 +3686,16 @@ static void expand_cmp_vec(unsigned vece, uint32_t dofs, uint32_t aofs, uint32_t bofs, uint32_t oprsz, uint32_t tysz, TCGType type, TCGCond cond) { - TCGv_vec t0 = tcg_temp_new_vec(type); - TCGv_vec t1 = tcg_temp_new_vec(type); - uint32_t i; + for (uint32_t i = 0; i < oprsz; i += tysz) { + TCGv_vec t0 = tcg_temp_new_vec(type); + TCGv_vec t1 = tcg_temp_new_vec(type); + TCGv_vec t2 = tcg_temp_new_vec(type); - for (i = 0; i < oprsz; i += tysz) { tcg_gen_ld_vec(t0, tcg_env, aofs + i); tcg_gen_ld_vec(t1, tcg_env, bofs + i); - tcg_gen_cmp_vec(cond, vece, t0, t0, t1); - tcg_gen_st_vec(t0, tcg_env, dofs + i); + tcg_gen_cmp_vec(cond, vece, t2, t0, t1); + tcg_gen_st_vec(t2, tcg_env, dofs + i); } - tcg_temp_free_vec(t1); - tcg_temp_free_vec(t0); } void tcg_gen_gvec_cmp(TCGCond cond, unsigned vece, uint32_t dofs, From patchwork Tue Nov 7 02:48:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741761 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415667wrr; Mon, 6 Nov 2023 18:53:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGe9HgYFKFZff8mVjyCqMVxyfEvuHbbC4JBx6K7loS+7ymi9oiZR2vx9G2N5f6LYjcgH2ix X-Received: by 2002:a05:622a:5d4:b0:418:12c6:467f with SMTP id d20-20020a05622a05d400b0041812c6467fmr35085494qtb.3.1699325630768; Mon, 06 Nov 2023 18:53:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325630; cv=none; d=google.com; s=arc-20160816; b=TxJfJ3b5Ht3zZ+yHHrMbRg24grdGoFu23pPaHGkSU9JSOlOpNq5HdmiTllY+HAipyM ha3fpOFxO190EFafSysoBf0Tc2z2yd4oS695NBZeK5/aEfXZXsJL1R6YOatB1MeRZ8VT AnKn+bWz+mdmm2HvIlZ+60RICCITKI9eKPGTafG8QAsmSIspXcV2RR4YrLTbczigYMB6 jx8Fhe7lnB2U17STgaT+xNZg6kXCQP1mAhlkhln+wRIYBMaMTxJieMfZHtpOLpcirKlZ aEQVvYNUWzpAm/DSskUF46yr/d4z9pEZcb5UyZpp6hiDBZRQkVm+/vac2VDLHjjXODb2 Ttpg== 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=F9d35huw1p7Cu08U8Degtbo7sfMGmI1/7YRi8G8catM=; fh=WHbKwsB9jlgssve14/eRnAYNW4p1c+a/TobPlehjgd8=; b=BUZepBWHH71Py7ETP7zNY3JZ6n0ilLSjrYQcKwb9ElJfycHHZixqORCYjwCNI9nMp4 zsnUeBZ+lgIq3pjVGvZGIIgwFQfl055VNKQf3Tcth92TU9nkqZ2WdasX7e7L2ZMdva6+ 1a3NH2XPCY6b4dMqbEaBL+71+8RAHecnDdyvYY1z2Y2ij41bUhDHoN1pUva3Jo0gQFOV cD+d84nL3G6vZ4Cm9EqQKDWcKY8YhdPvmkMpiUKR8oj8axJL5nCF0ZAldvoByFaz6Sk5 MTOr8CER2oplmJVJRZP2OvDHTDsxEhnI3Y7W81VTJVAr1pefdwkmAe5BXxVNSZ5r7z5J tGKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ikxXuZB3; 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 b22-20020ac87fd6000000b0041986ea11a9si5956182qtk.318.2023.11.06.18.53.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:53:50 -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=ikxXuZB3; 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 1r0C9O-0008Q4-Tb; Mon, 06 Nov 2023 21:49:10 -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 1r0C9M-0008Oi-6h for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:08 -0500 Received: from mail-yb1-xb2b.google.com ([2607:f8b0:4864:20::b2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9K-0005vh-Iw for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:07 -0500 Received: by mail-yb1-xb2b.google.com with SMTP id 3f1490d57ef6-d9beb863816so5338570276.1 for ; Mon, 06 Nov 2023 18:49:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325345; x=1699930145; 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=F9d35huw1p7Cu08U8Degtbo7sfMGmI1/7YRi8G8catM=; b=ikxXuZB3Aw53PIkjED8CrYNcfD5YG71A30a9w4Kr6RgTZjtA6NoSO8x13lYADataqF 4Tl/dTCPptpgd+RJdB+dPLmmn54+xr1IAdd5uNSZ7a4eWNrcoeElfZR3Bh5rch4zkg1c byAjT+n/Fnm22z0uf5HRMpJ6B0DM9TgtUGNk6zumk7dQRrITqvbaH4M2dJ+hxdSh3Eoi F1AOqKwyjW/P2f4PPivF5J89109atHM0dxEcNtEV1KEpX7keLVxQy4lZTU8AVmuViYL4 Ln5pR7WYLZwCJ38SjHrr7UxHs8Vjy744ZbiSDuT7Y0iimQrEVCxaQ6+gO6uMO/l82MdW rWsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325345; x=1699930145; 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=F9d35huw1p7Cu08U8Degtbo7sfMGmI1/7YRi8G8catM=; b=SKGEaukiZaMxJZr0C/fpWywgZ61PH9s6LaFpslFPLlaNX0ziNRwh64sW9s7ZO02QMb SJL7zAmiiNLu2P82gYw+Vqw5z3rBqZSnWNQDVYYWNNwnvCHO/0LEfhXguuRfhRNbDuex vj4XDAHyhJ7lLgmb2AMVXYz0GzXJTku7mlJSDG1FH7dgzAkb77kb1OhOUmP6vwHggqiP AcH4HeQxBzAr/GrqeJKEmVIfHdmOi0Etq0h8jwMBGJfE9+7hFYYUvXoA8zStMC5BscaX EzDvSyjWSaQrHH5Wik2D9I0mpnJxFWzU6HKhT6opFSoOZv17BXT4L2dnUkqZ0pEdTKq6 cMGg== X-Gm-Message-State: AOJu0YyZbLLce6na1sEkosUvIkU9Na10MSTo6jHD7x4ujZQoNFA1R3Rc f27nLDGC2926XQ9ndQJPAOWzNBgd8AtbO1g+p4c= X-Received: by 2002:a5b:706:0:b0:da0:c49a:5103 with SMTP id g6-20020a5b0706000000b00da0c49a5103mr30263644ybq.47.1699325345301; Mon, 06 Nov 2023 18:49:05 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 27/35] tcg/optimize: Pipe OptContext into reset_ts Date: Mon, 6 Nov 2023 18:48:34 -0800 Message-Id: <20231107024842.7650-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::b2b; envelope-from=richard.henderson@linaro.org; helo=mail-yb1-xb2b.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 Will be needed in the next patch. Reviewed-by: Song Gao Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/optimize.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 6b072d4cdb..cbb095b241 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -123,7 +123,7 @@ static inline bool ts_is_copy(TCGTemp *ts) } /* Reset TEMP's state, possibly removing the temp for the list of copies. */ -static void reset_ts(TCGTemp *ts) +static void reset_ts(OptContext *ctx, TCGTemp *ts) { TempOptInfo *ti = ts_info(ts); TempOptInfo *pi = ts_info(ti->prev_copy); @@ -138,9 +138,9 @@ static void reset_ts(TCGTemp *ts) ti->s_mask = 0; } -static void reset_temp(TCGArg arg) +static void reset_temp(OptContext *ctx, TCGArg arg) { - reset_ts(arg_temp(arg)); + reset_ts(ctx, arg_temp(arg)); } /* Initialize and activate a temporary. */ @@ -239,7 +239,7 @@ static bool tcg_opt_gen_mov(OptContext *ctx, TCGOp *op, TCGArg dst, TCGArg src) return true; } - reset_ts(dst_ts); + reset_ts(ctx, dst_ts); di = ts_info(dst_ts); si = ts_info(src_ts); @@ -702,7 +702,7 @@ static void finish_folding(OptContext *ctx, TCGOp *op) nb_oargs = def->nb_oargs; for (i = 0; i < nb_oargs; i++) { TCGTemp *ts = arg_temp(op->args[i]); - reset_ts(ts); + reset_ts(ctx, ts); /* * Save the corresponding known-zero/sign bits mask for the * first output argument (only one supported so far). @@ -1215,14 +1215,14 @@ static bool fold_call(OptContext *ctx, TCGOp *op) for (i = 0; i < nb_globals; i++) { if (test_bit(i, ctx->temps_used.l)) { - reset_ts(&ctx->tcg->temps[i]); + reset_ts(ctx, &ctx->tcg->temps[i]); } } } /* Reset temp data for outputs. */ for (i = 0; i < nb_oargs; i++) { - reset_temp(op->args[i]); + reset_temp(ctx, op->args[i]); } /* Stop optimizing MB across calls. */ From patchwork Tue Nov 7 02:48:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741760 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415668wrr; Mon, 6 Nov 2023 18:53:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGL9BVNl+AOZE6Zrnl0WyhyMnCzSOb0pJq3c2geRHz6HPF0yZ3SxvEYKrZIfmQnpwANr3wg X-Received: by 2002:ac8:5a47:0:b0:418:bd5:f674 with SMTP id o7-20020ac85a47000000b004180bd5f674mr39514321qta.23.1699325630840; Mon, 06 Nov 2023 18:53:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325630; cv=none; d=google.com; s=arc-20160816; b=Lg9h1Ga8ydTmGfQP/JhP9g4bCem3ty2ADsDzIDK0G+rec1SkEnbGywEhHRe01z454Z YcPd00fWAb9r60deJpxdTjqDS+XDkKdA//0BYcQAmf7dvibcxcjl5PbpqrWXmLbb5ZiA AWumcYN3RcCSjAaJS2ciyrgD0Zujtqht2nmRJL5ojd9T8M/ldxK9T1UJo30gmbEp2TXE ZPKe/QHInqQxN0cl7LZXrr6lt7mFJevbzihLndM6OjemTGosV38/K54wg1+2U6PcHUP8 JBua3K4QvktZU44/jbN16tfM3rFbUclO5DnPguXPHsayvp+w8f79hl6sUCtggP6NX7Ht J93A== 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:to:from :dkim-signature; bh=Or+n2LZo5yTrnMIWpnTgdydrrS4oDZYVZsFrQSQQ5h4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=j+2DHNZx4BOq0odN/im0VKsbkmIN4vazzAVRrzSZeePSz+p9yE/hEpoilwrSULbllR 7i1WsTOpwNPhML4cNFDJzXwSeEK/Mhz6rxPsrskZYl/kBGeoudC7tXSVw0U8NUqxLeK1 ZkzmM6TlGN2PAc/IpsXlL6Tlo/qZP89jt7F9rBR9wLrIdxn6/j5KDcpNR7Pg0E0zSD7N A7TTlPJaTrnR3/iq4S4p1RKep1Axyjr2/Q2k2AljXoeCN7QRYomReqvHbaNV9aNs9oEm pO/luRKScFmPzRaUGvwrsWiGKT/THuaXYF1G1RUp4SYBXjqD1X4eZX+2ykslmiamDhHM sHtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rzxa3wvf; 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 g12-20020ac8580c000000b004199836e6e7si6641417qtg.133.2023.11.06.18.53.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:53:50 -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=Rzxa3wvf; 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 1r0C9P-0008QA-9e; Mon, 06 Nov 2023 21:49:11 -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 1r0C9N-0008PP-7S for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:09 -0500 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9L-0005vl-IF for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:08 -0500 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3b52360cdf0so2441082b6e.2 for ; Mon, 06 Nov 2023 18:49:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325346; x=1699930146; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Or+n2LZo5yTrnMIWpnTgdydrrS4oDZYVZsFrQSQQ5h4=; b=Rzxa3wvf8rQURImtgIq8HGJF9NFe/AgKl7u3kVaXGYL+XPzTyeL5hjokAfCk7qtbAc oHBn0FSf+MVw9UVIxOf7ldhQZqp9jEsl9DwAKqKB4cvg5wNX/BcoCvEkvS6KpvnJNtkD IvbprEHy0chleiJJEogUouH9MhJXcG6jefnRf1ZkzRgwex996VhoAv14lg2IrSkX8HZ1 eMLpiWkiXsWTf62DVOTE4mv8zwys7yvvhdL7IeSqOavTSg6ujfzXm0kaBOxHCt4RHOTA gs5/j80H3mUO9Oc4bOfN1Pw2asqr9ICJOyFk2rBFAZCqmB1M6fauntTxdywuxJQndz03 dsEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325346; x=1699930146; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Or+n2LZo5yTrnMIWpnTgdydrrS4oDZYVZsFrQSQQ5h4=; b=SFEz8A/3g6m08oW1dZ10zp03xVAsUjsCzeqcUi4LZk8C8Zug0l1doSbysBUCyuvX+S fsLnwO/nSZYFsmorqGokFpAF7X3b8ffp+stkFdZJofRFcl4jP9W9hKfpFfEpNReFdirE nCszjGiMA2RMj0wl59D77P9iSMutK+BLtlcd3Ro3AKILJRFJcdbVdEE3fUVdAFkCspeg ovnYOmQH1cVV9m1RpndzsM2u5T2WZ3HkRnQejjUbins0mT5yG2eusnlH5Q+j0gZ16Reg FFNPueQTIfl8fu/y0wDIk0Iu0ay3gkYpAw6yWWGxM0zAykHXYfZOb1ht/OnmCrPjtDvn lf+w== X-Gm-Message-State: AOJu0YwORggoWA6iyM9JTG4zcOieSvnAKu7JXxsVAHMhEWdGtPJBDQW2 6x5rVYIFo4BEORKzwB3rc2WhzqBU5bAr4p1261E= X-Received: by 2002:a05:6808:4d9:b0:3ad:f3e6:66f8 with SMTP id a25-20020a05680804d900b003adf3e666f8mr27461530oie.41.1699325346114; Mon, 06 Nov 2023 18:49:06 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 28/35] tcg/optimize: Split out cmp_better_copy Date: Mon, 6 Nov 2023 18:48:35 -0800 Message-Id: <20231107024842.7650-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::231; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x231.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 Compare two temps for "better", split out from finding the best from a whole list. Use TCGKind, which already gives the proper priority. Signed-off-by: Richard Henderson --- tcg/optimize.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index cbb095b241..118561f56d 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -122,6 +122,11 @@ static inline bool ts_is_copy(TCGTemp *ts) return ts_info(ts)->next_copy != ts; } +static TCGTemp *cmp_better_copy(TCGTemp *a, TCGTemp *b) +{ + return a->kind < b->kind ? b : a; +} + /* Reset TEMP's state, possibly removing the temp for the list of copies. */ static void reset_ts(OptContext *ctx, TCGTemp *ts) { @@ -174,30 +179,20 @@ static void init_ts_info(OptContext *ctx, TCGTemp *ts) } } -static TCGTemp *find_better_copy(TCGContext *s, TCGTemp *ts) +static TCGTemp *find_better_copy(TCGTemp *ts) { - TCGTemp *i, *g, *l; + TCGTemp *i, *ret; /* If this is already readonly, we can't do better. */ if (temp_readonly(ts)) { return ts; } - g = l = NULL; + ret = ts; for (i = ts_info(ts)->next_copy; i != ts; i = ts_info(i)->next_copy) { - if (temp_readonly(i)) { - return i; - } else if (i->kind > ts->kind) { - if (i->kind == TEMP_GLOBAL) { - g = i; - } else if (i->kind == TEMP_TB) { - l = i; - } - } + ret = cmp_better_copy(ret, i); } - - /* If we didn't find a better representation, return the same temp. */ - return g ? g : l ? l : ts; + return ret; } static bool ts_are_copies(TCGTemp *ts1, TCGTemp *ts2) @@ -672,12 +667,10 @@ static void init_arguments(OptContext *ctx, TCGOp *op, int nb_args) static void copy_propagate(OptContext *ctx, TCGOp *op, int nb_oargs, int nb_iargs) { - TCGContext *s = ctx->tcg; - for (int i = nb_oargs; i < nb_oargs + nb_iargs; i++) { TCGTemp *ts = arg_temp(op->args[i]); if (ts_is_copy(ts)) { - op->args[i] = temp_arg(find_better_copy(s, ts)); + op->args[i] = temp_arg(find_better_copy(ts)); } } } From patchwork Tue Nov 7 02:48:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741756 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415619wrr; Mon, 6 Nov 2023 18:53:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IF8sBlrPnqv1G2I0GIpT7UDuftaRwu+0kjBFOQJOMujluLWpGb4f24mO1+UW5OwRr1cyCwF X-Received: by 2002:a05:622a:3:b0:41c:cd2a:f066 with SMTP id x3-20020a05622a000300b0041ccd2af066mr39818866qtw.34.1699325619826; Mon, 06 Nov 2023 18:53:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325619; cv=none; d=google.com; s=arc-20160816; b=l8NZhOzwDBhxl9CR6XEc7byggQYIXVUp7Kn1j8R/qIQY14d8boheB4Ez0HP+uu9hmV xX/z+B510t7AfjkWRWb5PtzCT9SIuuqxVzTTo3hfS4oUQ0ktGLfz6VsSXwcjaF0En/xN V4N56zDor53MkfbazAiGRaHW3aHFBCmfy1Y6lPJIEi6sHHII72gHuiNqSVONoBT2yxwq vx1hA9EWezA81CyB4ppP+LKTiM9+SXnQ23idaVI1Ju5z2J/Z20Gg/yUvgfwfkv/NV2Kt cZkCIEKNOj/HvuB5rSAhjJrM/qa4mon+XJ1PAlaJzoeVBIaLlVhXWEurp3nZNcDUeUwL Aicg== 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=8jIe+ljgU19ERgfvxJVRf4ZOPpcLIdY66wFze/QZuDU=; fh=KXT8skN7RFTc7N6YjUNlSMSjM9WXZW43UAg6bOEDSoc=; b=qED2ApxU3k0XRmyn/y/Z0BFYFBar8yzeMC0aMAxhueygkOeo40xrIT776do7ZZDWWr wyfC0Q0FvMGepVXJQAcUqUsItv/DhvoIHVqDpaYkBUXqRSpkgN7ybc8w5cuanZqLYYeL KkXn1bwmJithpZZUGwCHA8xRKcUZIQR8c+OqFJg9eMCUiuzzaqieNwyjZ1KOYVBEaQdp w5NaSzfY2rL48hv3LkUT1EFTHiUfbM1XaSv19nsV2dd0bffoRo+L+zPhplN3jf1n23ek 8PDbYEEyMKBeg3M6VL37O9Wj1YddpN9muUrdEqfYBnDxlNYM0u+c3sBcVpB0qmnuoScn lHWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bIZ+gDpo; 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 a19-20020a05622a02d300b0041230bc1d65si6686526qtx.371.2023.11.06.18.53.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:53:39 -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=bIZ+gDpo; 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 1r0C9Q-0008Qv-Nq; Mon, 06 Nov 2023 21:49:12 -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 1r0C9O-0008Pn-9W for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:10 -0500 Received: from mail-oi1-x22f.google.com ([2607:f8b0:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9M-0005vz-5q for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:09 -0500 Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3b2ea7cca04so3341372b6e.2 for ; Mon, 06 Nov 2023 18:49:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325347; x=1699930147; 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=8jIe+ljgU19ERgfvxJVRf4ZOPpcLIdY66wFze/QZuDU=; b=bIZ+gDpo8eLnZHal3RRvk96PQ5twnxFWSFqD+RsXAy4YT1un+fzBZPQKAH5q4kFm6N 09Vw7ONRtNf9bu7G4yEgmVc0zeYDw9FwSN4wwSdWsKaQeFrnHZZfTGRdTxsDQeZmmR6C WG4UYbG9UvGQZTfw8STFA+N65w4yC0sMegmLGj5kq5A5gLWr1+QxxeUPAABPNrmd5MhM IPvL3LHkN7riXzT0+9xfaJ/rZPbcdyKAzoLs6chmR28HKqcj0f4fUmD//BKfkhM54YYD orY5zXsLIAYBXP4FwPbPbmWULyt3hBMYG73ji8SdSA+GEVXmnhmGSHRwjr4ykemuFd8d 7kAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325347; x=1699930147; 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=8jIe+ljgU19ERgfvxJVRf4ZOPpcLIdY66wFze/QZuDU=; b=RFe2NHpmHJe3AYx6bOOH8Cjmhjq2Gu/oQqpySyNtiLRQI4L0mAYplH1jzaziChbIMh KnhEhilKeNbnjfsWYSoKqLA4McP3tGmJQ/gEfTZ5EsBXw/f55avUoQ9fWSJ4j8b4f4dV 3oGIL5s2UK2mu10drnFR6zef723kmerEZJx03pE2k0gQuQEYcKvWlnDE9gt5rqQhL8nN KJMsJZvd6S/jAPgkxJt9xco2un/AqDee75riYv9+2Z+v82hAfUKJwPdlAGj0/vQfjiGX VODNXCXcpyy5i0O3saxKg9B9Vz9vye5kPS/2osEuDAmJLe7kHnq8JieqdZHgM0Tn3fSr 5vQw== X-Gm-Message-State: AOJu0YwC1hcx73LANVRdfPcjeD21klz70OdUXiDyxkO4x8g65jWT5DsZ XerHipNkvXYakc7HW1SdD1OIOmvzs5vqV9bXyiM= X-Received: by 2002:a05:6808:23c3:b0:3b2:f2a8:1a4c with SMTP id bq3-20020a05680823c300b003b2f2a81a4cmr39844049oib.44.1699325347161; Mon, 06 Nov 2023 18:49:07 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:06 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao Subject: [PATCH 29/35] tcg/optimize: Optimize env memory operations Date: Mon, 6 Nov 2023 18:48:36 -0800 Message-Id: <20231107024842.7650-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22f; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22f.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 Propagate stores to loads, loads to loads. Reviewed-by: Song Gao Signed-off-by: Richard Henderson --- tcg/optimize.c | 264 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 243 insertions(+), 21 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 118561f56d..b32ef0be0f 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "qemu/int128.h" +#include "qemu/interval-tree.h" #include "tcg/tcg-op-common.h" #include "tcg-internal.h" @@ -37,10 +38,18 @@ glue(glue(case INDEX_op_, x), _i64): \ glue(glue(case INDEX_op_, x), _vec) +typedef struct MemCopyInfo { + IntervalTreeNode itree; + QSIMPLEQ_ENTRY (MemCopyInfo) next; + TCGTemp *ts; + TCGType type; +} MemCopyInfo; + typedef struct TempOptInfo { bool is_const; TCGTemp *prev_copy; TCGTemp *next_copy; + QSIMPLEQ_HEAD(, MemCopyInfo) mem_copy; uint64_t val; uint64_t z_mask; /* mask bit is 0 if and only if value bit is 0 */ uint64_t s_mask; /* a left-aligned mask of clrsb(value) bits. */ @@ -51,6 +60,9 @@ typedef struct OptContext { TCGOp *prev_mb; TCGTempSet temps_used; + IntervalTreeRoot mem_copy; + QSIMPLEQ_HEAD(, MemCopyInfo) mem_free; + /* In flight values from optimization. */ uint64_t a_mask; /* mask bit is 0 iff value identical to first input */ uint64_t z_mask; /* mask bit is 0 iff value bit is 0 */ @@ -127,27 +139,6 @@ static TCGTemp *cmp_better_copy(TCGTemp *a, TCGTemp *b) return a->kind < b->kind ? b : a; } -/* Reset TEMP's state, possibly removing the temp for the list of copies. */ -static void reset_ts(OptContext *ctx, TCGTemp *ts) -{ - TempOptInfo *ti = ts_info(ts); - TempOptInfo *pi = ts_info(ti->prev_copy); - TempOptInfo *ni = ts_info(ti->next_copy); - - ni->prev_copy = ti->prev_copy; - pi->next_copy = ti->next_copy; - ti->next_copy = ts; - ti->prev_copy = ts; - ti->is_const = false; - ti->z_mask = -1; - ti->s_mask = 0; -} - -static void reset_temp(OptContext *ctx, TCGArg arg) -{ - reset_ts(ctx, arg_temp(arg)); -} - /* Initialize and activate a temporary. */ static void init_ts_info(OptContext *ctx, TCGTemp *ts) { @@ -167,6 +158,7 @@ static void init_ts_info(OptContext *ctx, TCGTemp *ts) ti->next_copy = ts; ti->prev_copy = ts; + QSIMPLEQ_INIT(&ti->mem_copy); if (ts->kind == TEMP_CONST) { ti->is_const = true; ti->val = ts->val; @@ -179,6 +171,45 @@ static void init_ts_info(OptContext *ctx, TCGTemp *ts) } } +static MemCopyInfo *mem_copy_first(OptContext *ctx, intptr_t s, intptr_t l) +{ + IntervalTreeNode *r = interval_tree_iter_first(&ctx->mem_copy, s, l); + return r ? container_of(r, MemCopyInfo, itree) : NULL; +} + +static MemCopyInfo *mem_copy_next(MemCopyInfo *mem, intptr_t s, intptr_t l) +{ + IntervalTreeNode *r = interval_tree_iter_next(&mem->itree, s, l); + return r ? container_of(r, MemCopyInfo, itree) : NULL; +} + +static void remove_mem_copy(OptContext *ctx, MemCopyInfo *mc) +{ + TCGTemp *ts = mc->ts; + TempOptInfo *ti = ts_info(ts); + + interval_tree_remove(&mc->itree, &ctx->mem_copy); + QSIMPLEQ_REMOVE(&ti->mem_copy, mc, MemCopyInfo, next); + QSIMPLEQ_INSERT_TAIL(&ctx->mem_free, mc, next); +} + +static void remove_mem_copy_in(OptContext *ctx, intptr_t s, intptr_t l) +{ + while (true) { + MemCopyInfo *mc = mem_copy_first(ctx, s, l); + if (!mc) { + break; + } + remove_mem_copy(ctx, mc); + } +} + +static void remove_mem_copy_all(OptContext *ctx) +{ + remove_mem_copy_in(ctx, 0, -1); + tcg_debug_assert(interval_tree_is_empty(&ctx->mem_copy)); +} + static TCGTemp *find_better_copy(TCGTemp *ts) { TCGTemp *i, *ret; @@ -195,6 +226,80 @@ static TCGTemp *find_better_copy(TCGTemp *ts) return ret; } +static void move_mem_copies(TCGTemp *dst_ts, TCGTemp *src_ts) +{ + TempOptInfo *si = ts_info(src_ts); + TempOptInfo *di = ts_info(dst_ts); + MemCopyInfo *mc; + + QSIMPLEQ_FOREACH(mc, &si->mem_copy, next) { + tcg_debug_assert(mc->ts == src_ts); + mc->ts = dst_ts; + } + QSIMPLEQ_CONCAT(&di->mem_copy, &si->mem_copy); +} + +/* Reset TEMP's state, possibly removing the temp for the list of copies. */ +static void reset_ts(OptContext *ctx, TCGTemp *ts) +{ + TempOptInfo *ti = ts_info(ts); + TCGTemp *pts = ti->prev_copy; + TCGTemp *nts = ti->next_copy; + TempOptInfo *pi = ts_info(pts); + TempOptInfo *ni = ts_info(nts); + + ni->prev_copy = ti->prev_copy; + pi->next_copy = ti->next_copy; + ti->next_copy = ts; + ti->prev_copy = ts; + ti->is_const = false; + ti->z_mask = -1; + ti->s_mask = 0; + + if (!QSIMPLEQ_EMPTY(&ti->mem_copy)) { + if (ts == nts) { + /* Last temp copy being removed, the mem copies die. */ + MemCopyInfo *mc; + QSIMPLEQ_FOREACH(mc, &ti->mem_copy, next) { + interval_tree_remove(&mc->itree, &ctx->mem_copy); + } + QSIMPLEQ_CONCAT(&ctx->mem_free, &ti->mem_copy); + } else { + move_mem_copies(find_better_copy(nts), ts); + } + } +} + +static void reset_temp(OptContext *ctx, TCGArg arg) +{ + reset_ts(ctx, arg_temp(arg)); +} + +static void record_mem_copy(OptContext *ctx, TCGType type, + TCGTemp *ts, intptr_t start, intptr_t last) +{ + MemCopyInfo *mc; + TempOptInfo *ti; + + mc = QSIMPLEQ_FIRST(&ctx->mem_free); + if (mc) { + QSIMPLEQ_REMOVE_HEAD(&ctx->mem_free, next); + } else { + mc = tcg_malloc(sizeof(*mc)); + } + + memset(mc, 0, sizeof(*mc)); + mc->itree.start = start; + mc->itree.last = last; + mc->type = type; + interval_tree_insert(&mc->itree, &ctx->mem_copy); + + ts = find_better_copy(ts); + ti = ts_info(ts); + mc->ts = ts; + QSIMPLEQ_INSERT_TAIL(&ti->mem_copy, mc, next); +} + static bool ts_are_copies(TCGTemp *ts1, TCGTemp *ts2) { TCGTemp *i; @@ -221,6 +326,18 @@ static bool args_are_copies(TCGArg arg1, TCGArg arg2) return ts_are_copies(arg_temp(arg1), arg_temp(arg2)); } +static TCGTemp *find_mem_copy_for(OptContext *ctx, TCGType type, intptr_t s) +{ + MemCopyInfo *mc; + + for (mc = mem_copy_first(ctx, s, s); mc; mc = mem_copy_next(mc, s, s)) { + if (mc->itree.start == s && mc->type == type) { + return find_better_copy(mc->ts); + } + } + return NULL; +} + static bool tcg_opt_gen_mov(OptContext *ctx, TCGOp *op, TCGArg dst, TCGArg src) { TCGTemp *dst_ts = arg_temp(dst); @@ -270,6 +387,11 @@ static bool tcg_opt_gen_mov(OptContext *ctx, TCGOp *op, TCGArg dst, TCGArg src) si->next_copy = dst_ts; di->is_const = si->is_const; di->val = si->val; + + if (!QSIMPLEQ_EMPTY(&si->mem_copy) + && cmp_better_copy(src_ts, dst_ts) == dst_ts) { + move_mem_copies(dst_ts, src_ts); + } } return true; } @@ -688,6 +810,7 @@ static void finish_folding(OptContext *ctx, TCGOp *op) ctx->prev_mb = NULL; if (!(def->flags & TCG_OPF_COND_BRANCH)) { memset(&ctx->temps_used, 0, sizeof(ctx->temps_used)); + remove_mem_copy_all(ctx); } return; } @@ -1213,6 +1336,11 @@ static bool fold_call(OptContext *ctx, TCGOp *op) } } + /* If the function has side effects, reset mem data. */ + if (!(flags & TCG_CALL_NO_SIDE_EFFECTS)) { + remove_mem_copy_all(ctx); + } + /* Reset temp data for outputs. */ for (i = 0; i < nb_oargs; i++) { reset_temp(ctx, op->args[i]); @@ -2070,6 +2198,83 @@ static bool fold_tcg_ld(OptContext *ctx, TCGOp *op) return false; } +static bool fold_tcg_ld_memcopy(OptContext *ctx, TCGOp *op) +{ + TCGTemp *dst, *src; + intptr_t ofs; + TCGType type; + + if (op->args[1] != tcgv_ptr_arg(tcg_env)) { + return false; + } + + type = ctx->type; + ofs = op->args[2]; + dst = arg_temp(op->args[0]); + src = find_mem_copy_for(ctx, type, ofs); + if (src && src->base_type == type) { + return tcg_opt_gen_mov(ctx, op, temp_arg(dst), temp_arg(src)); + } + + reset_ts(ctx, dst); + record_mem_copy(ctx, type, dst, ofs, ofs + tcg_type_size(type) - 1); + return true; +} + +static bool fold_tcg_st(OptContext *ctx, TCGOp *op) +{ + intptr_t ofs = op->args[2]; + intptr_t lm1; + + if (op->args[1] != tcgv_ptr_arg(tcg_env)) { + remove_mem_copy_all(ctx); + return false; + } + + switch (op->opc) { + CASE_OP_32_64(st8): + lm1 = 0; + break; + CASE_OP_32_64(st16): + lm1 = 1; + break; + case INDEX_op_st32_i64: + case INDEX_op_st_i32: + lm1 = 3; + break; + case INDEX_op_st_i64: + lm1 = 7; + break; + case INDEX_op_st_vec: + lm1 = tcg_type_size(ctx->type) - 1; + break; + default: + g_assert_not_reached(); + } + remove_mem_copy_in(ctx, ofs, ofs + lm1); + return false; +} + +static bool fold_tcg_st_memcopy(OptContext *ctx, TCGOp *op) +{ + TCGTemp *src; + intptr_t ofs, last; + TCGType type; + + if (op->args[1] != tcgv_ptr_arg(tcg_env)) { + fold_tcg_st(ctx, op); + return false; + } + + src = arg_temp(op->args[0]); + ofs = op->args[2]; + type = ctx->type; + last = ofs + tcg_type_size(type) - 1; + remove_mem_copy_in(ctx, ofs, last); + record_mem_copy(ctx, type, src, ofs, last); + return false; +} + static bool fold_xor(OptContext *ctx, TCGOp *op) { if (fold_const2_commutative(ctx, op) || @@ -2093,6 +2298,8 @@ void tcg_optimize(TCGContext *s) TCGOp *op, *op_next; OptContext ctx = { .tcg = s }; + QSIMPLEQ_INIT(&ctx.mem_free); + /* Array VALS has an element for each temp. If this temp holds a constant then its value is kept in VALS' element. If this temp is a copy of other ones then the other copies are @@ -2214,6 +2421,21 @@ void tcg_optimize(TCGContext *s) case INDEX_op_ld32u_i64: done = fold_tcg_ld(&ctx, op); break; + case INDEX_op_ld_i32: + case INDEX_op_ld_i64: + case INDEX_op_ld_vec: + done = fold_tcg_ld_memcopy(&ctx, op); + break; + CASE_OP_32_64(st8): + CASE_OP_32_64(st16): + case INDEX_op_st32_i64: + done = fold_tcg_st(&ctx, op); + break; + case INDEX_op_st_i32: + case INDEX_op_st_i64: + case INDEX_op_st_vec: + done = fold_tcg_st_memcopy(&ctx, op); + break; case INDEX_op_mb: done = fold_mb(&ctx, op); break; From patchwork Tue Nov 7 02:48:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741769 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415946wrr; Mon, 6 Nov 2023 18:55:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUNYOfPuZ00v9zclgp+TgNL0Wfmmu0/7L1WT+kBQ60hLEXAJu8SIm7Dz64oNtWgK86HT5w X-Received: by 2002:ac8:5a91:0:b0:403:b645:86fa with SMTP id c17-20020ac85a91000000b00403b64586famr38612318qtc.24.1699325706662; Mon, 06 Nov 2023 18:55:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325706; cv=none; d=google.com; s=arc-20160816; b=maO9UcjEQ8qibKmRyeuQfiNAVlxuHt4vka2K2F8ARUxzGwUJ7uIMzetzNNsjFEr1yG w4Aip9iMnALFP77Qa1zeHd43rZCgr0zIdjDNjufTkQE/fq93btgxnHxVj8AfZYiTH8Wn bbDl6aX7whnL0fJfNTe0aiVps87XPvTKg/Qbnzb5vNiLlNyXxuvmMuxNidcKRYNl/G6K cS0DB3/oJLFJuEAHFI+JWDJEMtuHnlNPZeXDOuCJrQMh330M45qKcuHvHpNMUaLvVo8B pwKzXbbF+7gz61u7mRH5wJqRSqBApiMf5HlPWtVbj/AWf52uV0dsg/w0xkrRaqxEXU0O AjuQ== 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=s0FKOVu2Ee6DzcvywhcOLuTknlnZxj3uQnWlPfBTRpM=; fh=KXT8skN7RFTc7N6YjUNlSMSjM9WXZW43UAg6bOEDSoc=; b=xKsIkHENnP7T8umPLtCp4quWgYaDkj7MeDnUfGuThDP8dlxQlHKCH0+C3471kPmhB4 sOjg7rNfCRCnYpCgG8yROQt9NEmQRb3/LeiMOGcqGgTwBexy882l8BfIsb91HF9Fzg3e TsfLI6SswahvVA9xYhJmxb7PnBPHNQu3jYcHsEVbBrl2NXWsDvHFIPWhX2FZD0rRIPGm zt+kIl/arfLfDkU8LKWE8oTY68ftjeruiBbJUZtcafcWWfnoErtKn9LPQNnKMsGQwxVS EtzGPeJobzUpKioj+BHqnGumzEEZOqH7l4M6zBBuktA2WcjJdFoujoypXsphLpZiJfzd 8mOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F3qk9MDB; 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 j17-20020ac85f91000000b0041cb9401ca9si6621442qta.216.2023.11.06.18.55.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:55:06 -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=F3qk9MDB; 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 1r0C9R-0008R4-8m; Mon, 06 Nov 2023 21:49:13 -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 1r0C9O-0008Px-M4 for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:10 -0500 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9N-0005wD-6S for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:10 -0500 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-5aa481d53e5so3493134a12.1 for ; Mon, 06 Nov 2023 18:49:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325348; x=1699930148; 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=s0FKOVu2Ee6DzcvywhcOLuTknlnZxj3uQnWlPfBTRpM=; b=F3qk9MDBWiSLhGogYwZbW8/9VAAYs6ZyNRzuqXuOxsqN+IKGfUST2rqiyp+jjNb5Hc MHzkXtPzHIhSD+LKsYFVDCRdHhDpTZxqNef3yDBtbpIbyOUVPinPhTOh1jTvfye3a41O gMU5QPjwoUC6BTwLvi5fe+b8uEuHdbTv9qNUgB0FkRaEuXgp+X7N1LXMBLYX8byCRfEH Jwp5lFhez+cy0FWaMLhIShrmXy7bh98a032zIRGH7TuW/wJFZVRkttjyorc6vRkX2mVJ cGdDLvTF3MyEjs3rqaV/X9xV/w7GaZ8+gdju3YPP/fVkPyjitae0I2TMLU7m6Yhxz89I RYUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325348; x=1699930148; 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=s0FKOVu2Ee6DzcvywhcOLuTknlnZxj3uQnWlPfBTRpM=; b=WLymSZPwV5bPx/SguGFwCIddHsP/YAVzXoFYLxxJazpDmHsiHzKeKYz843+7sa0t39 rvMgcfvWKmU3K+RRq7A5jPWwlydFDeYfhYjQcQB5dvTAEUcWqlR7EOBjglv6nxPSr2PF LytdbtSdAFgoMKMosu/Cx1mNZjXmFXE8w14prqdDYs73yTS+0RlGu670yUWAGr5ROs/A OaHXIUxkJ1yipyrEkjbsE1wEG6JhVSaG0+C85k+LJNpQdPMXxzpMUFkYvQHQ9b1iQdfv 7ap5SBSht6hvlmR93JlA2Jh0NkQnjeq32un2goHc2UDVDe2o8ushoIQEjh9C5lzN74mf jKKg== X-Gm-Message-State: AOJu0YyXiU9isym6YFX5cSFJTCpXe/mzqJ4veHKEDfWm/wMSAhxTUK3e gLGU89nnQVUyBlYTtCWAThxObQjp7mzjM6dGCtE= X-Received: by 2002:a05:6a20:431c:b0:181:9b65:b4b5 with SMTP id h28-20020a056a20431c00b001819b65b4b5mr12031555pzk.3.1699325347936; Mon, 06 Nov 2023 18:49:07 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:07 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao Subject: [PATCH 30/35] tcg: Eliminate duplicate env store operations Date: Mon, 6 Nov 2023 18:48:37 -0800 Message-Id: <20231107024842.7650-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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 Notice when a constant is stored to the same location twice. Reviewed-by: Song Gao Signed-off-by: Richard Henderson --- tcg/optimize.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tcg/optimize.c b/tcg/optimize.c index b32ef0be0f..a4fe9ee9bb 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2269,6 +2269,19 @@ static bool fold_tcg_st_memcopy(OptContext *ctx, TCGOp *op) src = arg_temp(op->args[0]); ofs = op->args[2]; type = ctx->type; + + /* + * Eliminate duplicate stores of a constant. + * This happens frequently when the target ISA zero-extends. + */ + if (ts_is_const(src)) { + TCGTemp *prev = find_mem_copy_for(ctx, type, ofs); + if (src == prev) { + tcg_op_remove(ctx->tcg, op); + return true; + } + } + last = ofs + tcg_type_size(type) - 1; remove_mem_copy_in(ctx, ofs, last); record_mem_copy(ctx, type, src, ofs, last); From patchwork Tue Nov 7 02:48:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741751 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1414978wrr; Mon, 6 Nov 2023 18:51:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHiF2JeAOiXS9DTNakEmkI3p/+epfTMLipvt3pe0CFnixIbZCEENF4rmsxKZ1qbk9GYK2dl X-Received: by 2002:ac8:5cc7:0:b0:403:a9aa:571f with SMTP id s7-20020ac85cc7000000b00403a9aa571fmr36605154qta.16.1699325477430; Mon, 06 Nov 2023 18:51:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325477; cv=none; d=google.com; s=arc-20160816; b=DB3Wt6GIpqTtGX5khQDm1UHskqwlO9ibesagOw5AHoiYngSOh277lFqyTzj3LFfGpQ leJ/8QCxar3z5W7FisHw3PA41l5r9upQRxxOFCkdsDcTtd4L+zD7JIHNE5dxG3TE9iEa osoAegjt0iJcbrwADulQuDu6+LVAU0iW4mvS8CuJp5NlhqKcMdhvrFp/bgPerD5EtTex PsVRhTN7z64mHOwCc2P0XwEE5vc7WGtMexmoEG5tP4RI5N1Q98yvT+r/YHhMF/Xuu8TA FBpSg8KB3uBPlUri29ygFyaeABWp8LBe3CAcPW0XDagcjXdzPwmXUsChfcCLzDgffE4Z VDgQ== 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=N9z9UDH6HsfK3PAJgBAA8lIx6YK0Bl0hMEwM1O6FOrY=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=vC+vAWS62yTIPPODBR/ZGTfOSd+ZJ6MD0DSzhsSjOejzjcu+4mAiDavCw/XcdEFbWY ByLdtqMry16AwtpLXJCbSBHNAmvJBPWKAJvJYfQXpHHkyjyC6se0LDfE/0q83YNUG0EA 3YNSls3N6j1Ix18UUujDLe/5vvRSvAR34e2XPXPrQGUl8H+LQCFMjuoPSzruPncWR4dl EQUdp0KrLiZMMOLLlCKzMDZ5CaKbEuHmp6RcvzC1IEW+o1m58ICs1jtaJhnAvFt3xJa+ F5DiDcf0c7vVjVioUqDWewOwhcQLP3DyUuugJ+uouRf0bzEvqhypG6f8H1rE7n5F3E8d VspQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GQKCy4Yu; 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 t17-20020a05622a01d100b0041822c32e38si6578075qtw.511.2023.11.06.18.51.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:51:17 -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=GQKCy4Yu; 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 1r0C9R-0008R9-Rd; Mon, 06 Nov 2023 21:49:13 -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 1r0C9P-0008QC-Hj for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:11 -0500 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9N-0005wL-R3 for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:11 -0500 Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-6cd0963c61cso2754785a34.0 for ; Mon, 06 Nov 2023 18:49:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325349; x=1699930149; 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=N9z9UDH6HsfK3PAJgBAA8lIx6YK0Bl0hMEwM1O6FOrY=; b=GQKCy4YuJoNAAjQcHm0ecWe1WoFU+TBJVOUM3IFo8WGphCMo3kIxd07WaaYb0k0T5l ETF5NrXR27gxbAjHNcjylBKlbxMvKeSATmFJSRAlmsWYKvwLyXMEJTOA2DVVfHr45KUd IhFlEzd3L3rFTI3DCEuyHPwn+vFSXNCmi2cIAGCIbXnDOQDBj92TXIzGpciMqDVLsblk TG9cSOVINX2IiImZDCX3nTSq6v5sIvMQQgcejBGYuSVSWLmkuXI2Nxc/SiUuxFK6pBTR j8jHMwncLPdOIbYbb5rt3FIPEjC1i42noZiGyMsUUd53qxW6lGKlt+AtSLWlBgK4SE7D pyIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325349; x=1699930149; 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=N9z9UDH6HsfK3PAJgBAA8lIx6YK0Bl0hMEwM1O6FOrY=; b=Dv3O8LGq0aPpbDOXLc9mj50YpE7jKU3108aDhsi6QA7Db8JBZFjt8D5nwaiJ9B23LP yB/vJHFZDvg7VcjNXY3zfr/dQm0dJSrVZMzYgAjbv4tnjhpxyDDTTUkxwBCSyV+S4Cb0 zfXflCzXNGVU/G4ggu2nbJ1LHmnptQ0G/P6NXk4Z9We1mSsWJabFbysvn+GMvCMRcrC3 atNzwSq1gEOHeZS9b2IpZ5wBhZeiuhXsKk3E6gGhY+BzS4e8RnowEyFGtAQ+6MDSsEJ2 hJkmUYMOqmGq7yG4syh9Z3bYVmjlol3dZHpMe+q80oomTDBBweKWTNEzBvU0Ov1v4iQV 4StQ== X-Gm-Message-State: AOJu0YxT94pSktKFTNp/19rxb1m46G0a5Qd36X1mGwBWlYUmdJCBvZ70 NhaijHk//Uj7h8jLzjh+pmKWc8+OKjn0l+eb4Mc= X-Received: by 2002:a05:6830:3149:b0:6b8:dc53:9efd with SMTP id c9-20020a056830314900b006b8dc539efdmr32406598ots.3.1699325348783; Mon, 06 Nov 2023 18:49:08 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:08 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 31/35] tcg/optimize: Split out arg_new_constant Date: Mon, 6 Nov 2023 18:48:38 -0800 Message-Id: <20231107024842.7650-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::335; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x335.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 Fixes a bug wherein raw uses of tcg_constant_internal do not have their TempOptInfo initialized. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/optimize.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index a4fe9ee9bb..d8e437c826 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -338,6 +338,21 @@ static TCGTemp *find_mem_copy_for(OptContext *ctx, TCGType type, intptr_t s) return NULL; } +static TCGArg arg_new_constant(OptContext *ctx, uint64_t val) +{ + TCGType type = ctx->type; + TCGTemp *ts; + + if (type == TCG_TYPE_I32) { + val = (int32_t)val; + } + + ts = tcg_constant_internal(type, val); + init_ts_info(ctx, ts); + + return temp_arg(ts); +} + static bool tcg_opt_gen_mov(OptContext *ctx, TCGOp *op, TCGArg dst, TCGArg src) { TCGTemp *dst_ts = arg_temp(dst); @@ -399,16 +414,8 @@ static bool tcg_opt_gen_mov(OptContext *ctx, TCGOp *op, TCGArg dst, TCGArg src) static bool tcg_opt_gen_movi(OptContext *ctx, TCGOp *op, TCGArg dst, uint64_t val) { - TCGTemp *tv; - - if (ctx->type == TCG_TYPE_I32) { - val = (int32_t)val; - } - /* Convert movi to mov with constant temp. */ - tv = tcg_constant_internal(ctx->type, val); - init_ts_info(ctx, tv); - return tcg_opt_gen_mov(ctx, op, dst, temp_arg(tv)); + return tcg_opt_gen_mov(ctx, op, dst, arg_new_constant(ctx, val)); } static uint64_t do_constant_folding_2(TCGOpcode op, uint64_t x, uint64_t y) @@ -1431,7 +1438,7 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op) op->opc = and_opc; op->args[1] = op->args[2]; - op->args[2] = temp_arg(tcg_constant_internal(ctx->type, mask)); + op->args[2] = arg_new_constant(ctx, mask); ctx->z_mask = mask & arg_info(op->args[1])->z_mask; return false; } @@ -1442,7 +1449,7 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op) uint64_t mask = deposit64(-1, op->args[3], op->args[4], 0); op->opc = and_opc; - op->args[2] = temp_arg(tcg_constant_internal(ctx->type, mask)); + op->args[2] = arg_new_constant(ctx, mask); ctx->z_mask = mask & arg_info(op->args[1])->z_mask; return false; } From patchwork Tue Nov 7 02:48:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741763 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415682wrr; Mon, 6 Nov 2023 18:53:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGwAHrNXcQXQQACF+CUWAgZeIOayczMxpFEgqJpMQbZgmhKuWagOeaO1yO6BhnxXopUuvG X-Received: by 2002:a05:620a:248b:b0:76d:a00b:84f8 with SMTP id i11-20020a05620a248b00b0076da00b84f8mr37631586qkn.57.1699325633986; Mon, 06 Nov 2023 18:53:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325633; cv=none; d=google.com; s=arc-20160816; b=teSwnZnAU89ONuSXY3UuqA/fzDpoSvCzMAIMGdMdEgd95VWO680DLCOB7aioYpmsOp vgXy+PvnQioZ6zOYOqe5o3S8bWO/ltnx6XoxYe7QOdqsisysutLs7Ir/bFpiF6c4bYu1 Be0WqzCMjx/LMiV0rwHoQHVI2prU31gpSNwJxMSDychFdpAmUEk1o3iY6k/jL52RmoqV x1TBQbpPdjB3oEyQxYfuCPJSGxXqLXnuK8Bmj39wY7dPaqAt9zR4obJkfhTRhi1nmz58 6Hr0iRH+gEBgYuEMz5yQXqdmt9fYioJhjR6a3tXMAJDNFp7wSe2x/FOn3m5aIlJEyPIc 4YtQ== 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=yATrqhFa0XdJNCrDgxI0k8cWQsLoXGcnoV4EfIA9rFw=; fh=Qh1fDyeKF6RN1RJuySFfPJyY198jyWlhb0GvHOCyqAQ=; b=l8Jx+E+5DeimMdfcSUdjVvxsDfXehgc/ozkgaYabyEEQR9HTMbEbVcPf/93JUhnM4X /KD/r216T7+saW4mwTTHXzP8WfMsG4xJtAv4DpPLdhl66Mi7DXR4gy6ruTk0Y51r5CgC 5hku96Xaa4++IDAf5qojLXeCMEmftnc8JxMv80CzBwBPeAk9nMp11ZWt70d0K+gCbOMh sw4P2+jRGon5e5P5s+gBHYjq50CizIke0Fg1a7ig80V9rZy2jQLJ16kmnQRDghv0YvBz VF558z9FUlHJE3+s8Wx6QNbt+WobiSiPjNlRm7n18gbEfomcww/RJRXbZClhjpP1rZJX l9aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sybNyylZ; 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 dv14-20020a05620a1b8e00b00778a5708429si6197922qkb.724.2023.11.06.18.53.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:53:53 -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=sybNyylZ; 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 1r0C9R-0008R6-NQ; Mon, 06 Nov 2023 21:49:13 -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 1r0C9Q-0008QR-9K for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:12 -0500 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9O-0005wW-QF for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:12 -0500 Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-6ce353df504so3030087a34.3 for ; Mon, 06 Nov 2023 18:49:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325350; x=1699930150; 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=yATrqhFa0XdJNCrDgxI0k8cWQsLoXGcnoV4EfIA9rFw=; b=sybNyylZxTBDZsDb0WKHNor/sx+o/xaFAY/4VSp+D3K2cDePXifK7XlNG9gpd7Fcaf SKMd7iYpPYAoVjTk6OeffZtkMVU3+qIwLa6hoDJKoUBm9qvkx57XnBagNHbGO+yyMPTB 9eXjsiKZqgDd96vjvdEy6fCMopYwJV0EXD0OnDciDfzdFcVnWt8MuONlcmepW9QCuTOg Drpq5CZypst2ybaWFsFTfxNcvkIqwQ2Pjl/JLFwJs7JllyJm1WEE3AWlNXZTWb7+ddI1 6b4uLYOo70bpcMmsRudLI7RNA1Ty0Q3y8v5RDgozzTJ7CkGv3azZ2hUvztKHymr32NI0 0v7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325350; x=1699930150; 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=yATrqhFa0XdJNCrDgxI0k8cWQsLoXGcnoV4EfIA9rFw=; b=UYlsDtmZ2LF6TSyWUi8oR0C5nMjYkf1KhHwpIwNuMaiXlpvCzUArUE7FOIQ5YiHukl aHOM0Uch3WTrNn/732fiI6+nNEEAAzgapNd+86DJEi8S1SX275jnWSSpjs1S+XKAdAkG zukzI5gTpvClBs5I2LLjzVpIWSVWs02r4cn/jpAcHOy2svMyHlyZcVd/m9jHbcNysWgY hDWiibvR2M9AR7r7iISpX01aAe9gkE18SWP45oG/3sIywAUluJg0wPMGBS1lIYEu241p E5x88Y+NsOJSlPiy+Serqj4A0axvBVUBBRR+CjGrA/vVgDgOMTYBTxkLqeuKCf2dg5GK pcJA== X-Gm-Message-State: AOJu0Yzv1ojyhhMlKrNF90FqDwFRjahOI3qtWcAa+C9rpbHkTfiCQUj8 EM6QQBCQuvekyqdOBvXaJQ2H8H1Z9d7FiS9o1tA= X-Received: by 2002:a9d:7d90:0:b0:6bb:1036:46de with SMTP id j16-20020a9d7d90000000b006bb103646demr30751758otn.30.1699325349806; Mon, 06 Nov 2023 18:49:09 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH 32/35] tcg: Canonicalize subi to addi during opcode generation Date: Mon, 6 Nov 2023 18:48:39 -0800 Message-Id: <20231107024842.7650-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::335; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x335.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 Suggested-by: Paolo Bonzini Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20231026013945.1152174-2-richard.henderson@linaro.org> --- tcg/tcg-op.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index de096a6f93..aa6bc6f57d 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -372,12 +372,7 @@ void tcg_gen_subfi_i32(TCGv_i32 ret, int32_t arg1, TCGv_i32 arg2) void tcg_gen_subi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { - /* some cases can be optimized here */ - if (arg2 == 0) { - tcg_gen_mov_i32(ret, arg1); - } else { - tcg_gen_sub_i32(ret, arg1, tcg_constant_i32(arg2)); - } + tcg_gen_addi_i32(ret, arg1, -arg2); } void tcg_gen_neg_i32(TCGv_i32 ret, TCGv_i32 arg) @@ -1752,16 +1747,7 @@ void tcg_gen_subfi_i64(TCGv_i64 ret, int64_t arg1, TCGv_i64 arg2) void tcg_gen_subi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) { - /* some cases can be optimized here */ - if (arg2 == 0) { - tcg_gen_mov_i64(ret, arg1); - } else if (TCG_TARGET_REG_BITS == 64) { - tcg_gen_sub_i64(ret, arg1, tcg_constant_i64(arg2)); - } else { - tcg_gen_sub2_i32(TCGV_LOW(ret), TCGV_HIGH(ret), - TCGV_LOW(arg1), TCGV_HIGH(arg1), - tcg_constant_i32(arg2), tcg_constant_i32(arg2 >> 32)); - } + tcg_gen_addi_i64(ret, arg1, -arg2); } void tcg_gen_neg_i64(TCGv_i64 ret, TCGv_i64 arg) From patchwork Tue Nov 7 02:48:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741746 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1414661wrr; Mon, 6 Nov 2023 18:50:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGugyOeRgWooCOL9xHu+AclI1LsQBFHDdJgEPP7uwVOREmd77QuzxucsGc8PriI6HH8C9hB X-Received: by 2002:a05:6214:21ca:b0:65b:765:254 with SMTP id d10-20020a05621421ca00b0065b07650254mr33645154qvh.4.1699325417308; Mon, 06 Nov 2023 18:50:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325417; cv=none; d=google.com; s=arc-20160816; b=CtdohCG41Gg4/QzBqyh7nM229lOyY9SLn2L+spzihI1lw5Um/tMUsqgLG8mwV5O3b7 HgXR6gQrcCNIEGURWf1rYgeG4UwiuqDBOIWbxqYybTQWKSK1+Rs+lnqlk2tOk691cXj6 Ledzf0RM3Js1pO1ynMtv9Mltm8qvhmqN1Ovecs0bOuAey6N5L3Xb2+y8LM4rcgP6PwJ/ pVzpDwdklgjW9CWhlawo8wbM6yrCO4hH7JEjpFkLf0LoSgO5bAGbHa9jDC0KtCzAGD8H GYpi/4eYbAgbtzkNyou7mVAwMskGgqhACAHg2VgO+7w7lWhzsijqYyO1ILAVi2JPhChR w96g== 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=YHmBTBkZIpyIbEJIll5966friKsejaD+iHlMP+LfScE=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=jM9KHkEA0ZZxugx8syoEkJTun7zwXzi72s1MQLMv5HU17eMH0cHhg6VgGVbE8kYLUy uRinS/YB0i/Pwrf3Q9KLKu1ZK7u4s8R20iqEF91zGuCDVkCcZYp4BE8PWtvsYdb/2GEB 0/LLDZBKP0XASiAE9K1MFi00jbA0cB0Jo6s+E1Ya9kMftP9Lc5dH/Y2OY5jpspkqq88C PvAS6gHDwqR8dDkTehUmxjXPsg5caQGt6wJ8APyxS9iRPwQptKASHZmgBsisY/vbxhvJ uLukBylkOIWi8FhN/mjU5+ttWRekHTN2P1ZJVu6vshv1me3e0lBhAjzYTwcSrykR777X YB4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ieVjWNme; 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 p7-20020a0cfd87000000b0066d0755101fsi6396964qvr.287.2023.11.06.18.50.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:50:17 -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=ieVjWNme; 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 1r0C9T-0008SW-HH; Mon, 06 Nov 2023 21:49:15 -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 1r0C9Q-0008Qx-Vw for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:13 -0500 Received: from mail-vk1-xa2c.google.com ([2607:f8b0:4864:20::a2c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9P-0005wh-IG for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:12 -0500 Received: by mail-vk1-xa2c.google.com with SMTP id 71dfb90a1353d-4ac023c8f82so1566268e0c.1 for ; Mon, 06 Nov 2023 18:49:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325350; x=1699930150; 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=YHmBTBkZIpyIbEJIll5966friKsejaD+iHlMP+LfScE=; b=ieVjWNmem8Ga4QJGRrNvnMPgxwmaktNVS53aDo0vuUmfd2O8D1XJie9BEmWGVQTdGh AA+TFxXAgZOJZMfs1pj80cXFvXQU/OZITGQWozmctyr+BVYZtha/rjdorcYK5UmQZ+r3 gsXby9CoQ8rWGQnnouINm4+q8eiPpRf0S3847y9LfZJmfJEYeaZ/+JUKpa//TlrM0yxI vD3xrv6fTUiXZ7TzsK8bnkcQvKQS/4KgYn1CkfEOAgWWUFTdqcRyWh8TBmfl1PDf2EWT zTyXUd3gRu9NG5e+JwKKj+p6OgD1QpXy9AEM+r+/Wf4td2v87kS2RNC/dEIVn5F637Ln Medg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325350; x=1699930150; 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=YHmBTBkZIpyIbEJIll5966friKsejaD+iHlMP+LfScE=; b=tS0VvFtA7nI7pAlnerAtw1t9GNAExHvkV+jgt6eS80WD2BiS3YgwkQwLfMhlmG+IQF /hcOAtRYBqU994xqiz0BtR6ZEJXKNkqUwoRXIStAMFMeSss1uS2SkEpk1KnXQc/ytWsU wmgb4sUrv6u/OEof/jePegeVTO/VTremz12QRsmIGEDcGrSahbBXatNSVKlWWVkcoqs6 KhAc3i+4ZCZfVlJcc+EcTTdsJyPS7e2UZ/QHE5YoYIzyrXA3nCzwea6I13lCGX/muY6/ BiDcxiDCOh1b4+a2ga69RZnZhfaot1xVWUdksud6dOj01AarMXHB75lDOXE0VNnPVzFQ 3Uzw== X-Gm-Message-State: AOJu0YyNtWEcEnUjPieTFrQliMke6cJaU/rjsDxnOnPInrah7AgwbjOj Rqac7bnLZ7Q3ECHlwT6zVvacyuOcnSEq+6JDqPo= X-Received: by 2002:a1f:2992:0:b0:4ab:fbff:a811 with SMTP id p140-20020a1f2992000000b004abfbffa811mr6793222vkp.14.1699325350551; Mon, 06 Nov 2023 18:49:10 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:10 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 33/35] tcg/optimize: Canonicalize subi to addi during optimization Date: Mon, 6 Nov 2023 18:48:40 -0800 Message-Id: <20231107024842.7650-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::a2c; envelope-from=richard.henderson@linaro.org; helo=mail-vk1-xa2c.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 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20231026013945.1152174-3-richard.henderson@linaro.org> --- tcg/optimize.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index d8e437c826..468f827399 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2166,7 +2166,19 @@ static bool fold_sub_vec(OptContext *ctx, TCGOp *op) static bool fold_sub(OptContext *ctx, TCGOp *op) { - return fold_const2(ctx, op) || fold_sub_vec(ctx, op); + if (fold_const2(ctx, op) || fold_sub_vec(ctx, op)) { + return true; + } + + /* Fold sub r,x,i to add r,x,-i */ + if (arg_is_const(op->args[2])) { + uint64_t val = arg_info(op->args[2])->val; + + op->opc = (ctx->type == TCG_TYPE_I32 + ? INDEX_op_add_i32 : INDEX_op_add_i64); + op->args[2] = arg_new_constant(ctx, -val); + } + return false; } static bool fold_sub2(OptContext *ctx, TCGOp *op) From patchwork Tue Nov 7 02:48:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741741 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1414551wrr; Mon, 6 Nov 2023 18:49:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFlpsDAa+GYK0RHnd7egw4RrB/wxYve2ut9/A6mYO3fhK9IoBcxGgQY22mQQzNxz4woriZ X-Received: by 2002:a05:622a:1113:b0:41c:cda8:9981 with SMTP id e19-20020a05622a111300b0041ccda89981mr37652179qty.64.1699325392379; Mon, 06 Nov 2023 18:49:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325392; cv=none; d=google.com; s=arc-20160816; b=MkqRRY+/pIONHEDh8+KznFdX/9qPb2poR2SkksI2PSeG3JVyZrPWOkK3HivWFP1EsG +Z9NtLUWd10A3dAY2m/cr7EL8meRT2O86/jfAAtUab21BgSMrSVAxzuX5bYQKG3DYsna NCsKarjgcJprSGtV752zJqMYUkOrqDJMx2A5kL/0sxjels2SH8avEvfe8fhiQ5zY1Tmj 5rXSueu5VnBrsUMXmmvvstMErx0l6uua/Ptj6/Y7tR/iyw7OrhcIoUxvd0kKOkhd/3PN viCL5XWlX4xGbDZjHy0xTlrJw8T6/2cWTmTtf4PQcvUDcq8gX5VhTDHfh86bPPVyyr5a Zfew== 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=/1m1R0D87bh0NujvmTIskCL5xHsf6reFL+x/VSt/CM8=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=LwSfU+NmqPL0pyHlS5hTfgYOYp3b7B96yec6pgH34eseQ0YTBBdUDCmSIZFzpERDEF vaxQCXctcEYBESgvwELSvijOCHnEI3DgWPqHFyLaQWgPgm+13oCIlnhcxNKVF0YXzF0E IWgEwcjKviQAq91kgSWnrrgt7M4+nHE5VynUXxae0NT58cssLenW8wlEsGe6lHfWhoqv m7iACWL/7vWpfz3iaz/z95ogj55ROmF5bWEGMqvrYh9l1gRmu7dc0LfBTA8kvFEzkfDD 3CzYNHrxtkwbUdBe9drRWBRMU7zxQR5ipTSLvGTOqUp0KB6ZCC83d0Ohx3fndPtcU8wC /VJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zeqx1qG2; 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 t2-20020ac85882000000b003fe296f07casi6502362qta.302.2023.11.06.18.49.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:49:52 -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=Zeqx1qG2; 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 1r0C9T-0008Sp-RL; Mon, 06 Nov 2023 21:49:15 -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 1r0C9R-0008R8-Pr for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:13 -0500 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9Q-0005wr-8q for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:13 -0500 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3b2f5aed39cso3072441b6e.1 for ; Mon, 06 Nov 2023 18:49:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325351; x=1699930151; 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=/1m1R0D87bh0NujvmTIskCL5xHsf6reFL+x/VSt/CM8=; b=Zeqx1qG2ZZFXVJ9RGwlPkEvXSRclkIPDym4me/maU1ME5ajAzaxeiGm3c742LYAZox Cbo8xGV6yTmhXoxSHZwcDeCF6nlIWGDP+eSK5tTniz/y17ZnN0T46gZbph73bVWWiCjk ks7oV1tnCDluV3xCcFWOVRlIuR1ny/y06ueFFhwKhiK1XcJGtDQVsinUo/M61TK38Yso k38+H8loA5Hrp07GE9JnYQVIIWRcnLw6pVsF3vXa/gYmOXMyzHz/dkqgjVrxqqBCY1rg d6tCKkiHxtus+z7hCIHAwCvyddvQ8H06eSLP3lnr99C7R28ltHycgV3ffAx2u8C8Jfai +viQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325351; x=1699930151; 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=/1m1R0D87bh0NujvmTIskCL5xHsf6reFL+x/VSt/CM8=; b=Lt7DRrOxFf0AAiAjhd2tQAUeS4vK1WP875/1FUma7bIDR6/wfKpr7UtMziR5kIv42o VsdK+mJN4lCkBoLknZXZoMUpf6aTG0lRa3N67N0AX9VPO1QcSBzG67kBPXJsmtZgiRF9 2MtG2jbRF4gww0GVquuj0/5CD9nG+xaoDJ/yJve+rbg4me2ylDJSmlYMnqYgHwCbZUI4 H7DPL9f0KdJoUJfRYtKIIhmdvOwDL4BrloHLZxaZH1UBfwlEHfSGrhcqL+IAJ9GUiLr2 8g6tqWVrC7gv4F/6hZx4TcHYm01mHCuLIEzKRPjzjACQxokr9Dipg41UJP8YNVY2DTlJ bSNA== X-Gm-Message-State: AOJu0YyY2UkmpDtuep2mLFbXZgMdVJoT1Oth4J2H8Xw37EuWCLfM5Twn AckIvmj4Z13VFXHdWL8joFepVvx9M9uzz9sNTsg= X-Received: by 2002:a05:6808:1385:b0:3b2:f54b:8b3a with SMTP id c5-20020a056808138500b003b2f54b8b3amr40354171oiw.27.1699325351348; Mon, 06 Nov 2023 18:49:11 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:10 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 34/35] tcg/optimize: Canonicalize sub2 with constants to add2 Date: Mon, 6 Nov 2023 18:48:41 -0800 Message-Id: <20231107024842.7650-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::231; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x231.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 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20231026013945.1152174-4-richard.henderson@linaro.org> --- tcg/optimize.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 468f827399..f2d01654c5 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1044,8 +1044,10 @@ static bool fold_add_vec(OptContext *ctx, TCGOp *op) static bool fold_addsub2(OptContext *ctx, TCGOp *op, bool add) { - if (arg_is_const(op->args[2]) && arg_is_const(op->args[3]) && - arg_is_const(op->args[4]) && arg_is_const(op->args[5])) { + bool a_const = arg_is_const(op->args[2]) && arg_is_const(op->args[3]); + bool b_const = arg_is_const(op->args[4]) && arg_is_const(op->args[5]); + + if (a_const && b_const) { uint64_t al = arg_info(op->args[2])->val; uint64_t ah = arg_info(op->args[3])->val; uint64_t bl = arg_info(op->args[4])->val; @@ -1089,6 +1091,21 @@ static bool fold_addsub2(OptContext *ctx, TCGOp *op, bool add) tcg_opt_gen_movi(ctx, op2, rh, ah); return true; } + + /* Fold sub2 r,x,i to add2 r,x,-i */ + if (!add && b_const) { + uint64_t bl = arg_info(op->args[4])->val; + uint64_t bh = arg_info(op->args[5])->val; + + /* Negate the two parts without assembling and disassembling. */ + bl = -bl; + bh = ~bh + !bl; + + op->opc = (ctx->type == TCG_TYPE_I32 + ? INDEX_op_add2_i32 : INDEX_op_add2_i64); + op->args[4] = arg_new_constant(ctx, bl); + op->args[5] = arg_new_constant(ctx, bh); + } return false; } From patchwork Tue Nov 7 02:48:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741772 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1415968wrr; Mon, 6 Nov 2023 18:55:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFh+uKzOnIrGmcs77CQkdytDtm3Lrib36dl3/EMoalSwMbZqC+X6Z6AHnMgIxZCXpsho9pX X-Received: by 2002:a05:622a:1889:b0:418:1f6b:7ca3 with SMTP id v9-20020a05622a188900b004181f6b7ca3mr38532261qtc.23.1699325713061; Mon, 06 Nov 2023 18:55:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325713; cv=none; d=google.com; s=arc-20160816; b=Jz8RrXk9jhn9WTuP6oIpTGlXviggF1vUoA1QoKIGunKDPlT+aAxbeFkCpEewtc86gL 5qcOkiaQfwoAKr/o1b5kZKfSrQ0ZnkR78erEW7Xdc8bWzWjgLp9CO0svOM/bm4UCJCOy rq+ETgfBOMhHHnS+4qQmY9oc/9sB0wuxeL4NTCmYF/8XLuyFHfgiFuXE19d+eJj+TWvl KJRZKxCVWMgJrX2nPI4Ss7H6vhPGSMcaUNYRYvWsuQE1WhGmt28OLOwJEkDfxaXqtGk9 85P6rp6iRaxD67eUrnCvRI5CCiDl9Fx6v7KP5BjzxnB9I9pWqPFaHlfHke1mxq+beJaZ W+kQ== 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=qGxp+u7pgV6arVD2QDQulhnMp/bdkqauCxtRBcuTVJQ=; fh=aYwv1qvAWDHKcZLZyhvLuIoAkBRd6ysYy/Itgr1WhFg=; b=pdc8rW5IYLnj6bt3JX+eR/ewBnsB1QcypRPq4sGrMXi2rGKIZC4TwevqppkCpnRISl QGE42gE9aTyilbA9LnEMdWESKHm1Fcv0fNhVlvWyqG5+VaZU74URXicxf1uExcTIhIh7 14VovCtS/SY9rTERiIFasBsK91HXztzBpmn146Xrj1bSR/Loz4WJKK4FW1SeU5wKAggp AIMeg+HYFycq3EUMol3UH9gjiXZg6+MkKUusagAptIf46oIbtj9LhwTHxMqZ6hBytRSI 2mevU/RgOJK0vaVggMSkh0NxoZfebFUHqh2lxessxDlRKduOwF3G/MItbUcFoQkgXCMC vl/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VdYuHvb0; 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 e15-20020ac84e4f000000b00403a110a67fsi6437865qtw.114.2023.11.06.18.55.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:55:13 -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=VdYuHvb0; 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 1r0C9V-0008Ti-NH; Mon, 06 Nov 2023 21:49:17 -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 1r0C9T-0008SJ-6C for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:15 -0500 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9R-0005x2-Jp for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:14 -0500 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-5b99bfca064so3408610a12.3 for ; Mon, 06 Nov 2023 18:49:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325352; x=1699930152; 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=qGxp+u7pgV6arVD2QDQulhnMp/bdkqauCxtRBcuTVJQ=; b=VdYuHvb0t5IxTEtPwKCoBQuiDsg/dwReBl7Y1QigLcU6jfMPrFnEvEZplOdmR42LkR 7YVaj81yO9iyiYnCinHunqqI4iC7B3Jc6Qy90WKUwjDnqKky5sj7jnRrK+Xs/6q0XF/+ NDoHD2BE4JFwM8TeX6d7Pzbnss47va/Kjy4OxLlmdClJMm2YabfNk9BvHGx8cJEIslMV jO1jgIDSkeapn+rZ/XLgibmwC0PuOBDk1SWGOB1W3du/RbzOTPzKzetjuCNL/OsJbkrZ Ng1cYa4nnEoWlZ9XQ6wGulDfVPPQzl3W9+enrF1EinRUHh9x5Du7bhCs2N6azgq2zxK2 vUyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325352; x=1699930152; 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=qGxp+u7pgV6arVD2QDQulhnMp/bdkqauCxtRBcuTVJQ=; b=kwC9bzEXXKar8xNz5DujasgU5ipaTxwbVS9O22ENMX62OGlbYxR3v9dmfK4lGGA840 WQbUl65nCWWxckahCvJ+NI11YY9CiW6vm95aBIUyZmU3jbM1hKahmac9bM18U8EZI2+P 2b2u2dMyq0ln2yNGhxWz17NeyOxgjukuU8KP+uXs1MU6FPd61V+xYi1YWsB1q5GQ2juo oxRXWiQCVnFweFvaq2vvHXMqBvMSOywuRJdS4AY/boB0AJ1zJ6IQisNxYtVgsYXdA5uA eoMoFeIFDDWSB95Sonyatdp5pxHfMYYl0HslP0ehPwobSLSQRQ8bl2NxsPCwikbiu5Pc JJnA== X-Gm-Message-State: AOJu0YxllCs/CvH4G/v0VigmkPKRjn3zr9jMkNBTSfUSs7Z/uL0ZMs20 wGMj6wGKZ9F2AFnQdKG8+drpYRZjHyO+k4CA+W0= X-Received: by 2002:a05:6a20:8e02:b0:17b:4b61:a8f7 with SMTP id y2-20020a056a208e0200b0017b4b61a8f7mr34187315pzj.9.1699325352242; Mon, 06 Nov 2023 18:49:12 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:11 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 35/35] tcg/sparc64: Implement tcg_out_extrl_i64_i32 Date: Mon, 6 Nov 2023 18:48:42 -0800 Message-Id: <20231107024842.7650-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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 Build fix for missing symbol. Cc: qemu-stable@nongnu.org Fixes: dad2f2f5af ("tcg/sparc64: Disable TCG_TARGET_HAS_extr_i64_i32") Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/sparc64/tcg-target.c.inc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc index 19d9df4a09..a91defd0ac 100644 --- a/tcg/sparc64/tcg-target.c.inc +++ b/tcg/sparc64/tcg-target.c.inc @@ -529,6 +529,11 @@ static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg rd, TCGReg rs) tcg_out_ext32u(s, rd, rs); } +static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg rd, TCGReg rs) +{ + tcg_out_ext32u(s, rd, rs); +} + static bool tcg_out_xchg(TCGContext *s, TCGType type, TCGReg r1, TCGReg r2) { return false;