From patchwork Tue Feb 14 16:30:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 653473 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp3146837wrr; Tue, 14 Feb 2023 08:32:46 -0800 (PST) X-Google-Smtp-Source: AK7set+kQm/Uo8U68Gjd8w2/F6IjYxooRJXsIiJYCrj4dvncXyO8WnzuHN660fdg9UmdfwiU7bxX X-Received: by 2002:ac8:5f8e:0:b0:3b8:3a7c:d208 with SMTP id j14-20020ac85f8e000000b003b83a7cd208mr4972671qta.34.1676392366204; Tue, 14 Feb 2023 08:32:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676392366; cv=none; d=google.com; s=arc-20160816; b=xl2rMVuQ2Fz/t0cJIjwzttn9792NsPLCZwmVWTPuWBxO3EsOKsv01HXeQV9FDj5J9S 07273raNICBOQohSAkCbEEIUE1ftX7bpo/5MeTHymjlwi9ZhZMcuVnNtNWjbLdAIF23e 6MY0gcmQWnwe2VRS8G/CtF8gtRYohg/V4ybUsZZUlLpEkoKL16u0SqclKy+zUU96e/Ji jVuou4DQEsWeTLxeFM+TfRoJsj3pbrFUw7fKi5ZJIUcADQnrj0CihUZnF1qjOW6Zicz2 2WZr6bTCNxHacxEyS/6apoSZUMVMYQUZUuQUxvaaP1jAgFlM1iqYl0SZOa59JlkmVzSo fQkw== 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=Grnio/H04PPuIGiRb3nIsuzzYqUqwsUO7rkz9vUiKr8=; b=Zsgoa9crmzAPlO2s2m1p0XnHhbabVW5YenUAKyr29GKvdxwjVidE6qJBn9l26DVKS+ 7IiKagjn3ZEXiu2uPsMBlO4fV84sywRqMgQtI7kQtVSffhr5QTSGgDMPrES5X50bYv/L /rggIkwVAmLDYNWXvvxsmfSglJ8JnBLxSTb0VGz1ceSMsXao0ZwfKQCW28wTc2DKSRJ9 /v6EfQllFvX5J76EtUb/5O3f8xZxETbkSc28LM/VGzifobc3obnWPMe/RpkQTSemQVKI 988XxC/YRWiPPBvHclEw5MFQf7qPWrfwJUrARCqt+NvtAU5wgHX/Aiu2OY/G4+D2vWwG 0e/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KR5SR2gM; 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 k18-20020ac85fd2000000b003b84c9b1f42si12941749qta.375.2023.02.14.08.32.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Feb 2023 08:32:46 -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=KR5SR2gM; 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 1pRyD1-0006ZW-Jo; Tue, 14 Feb 2023 11:31: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 1pRyCs-0006RX-TS for qemu-devel@nongnu.org; Tue, 14 Feb 2023 11:31:02 -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 1pRyCq-00027S-Mm for qemu-devel@nongnu.org; Tue, 14 Feb 2023 11:31:02 -0500 Received: by mail-pg1-x52b.google.com with SMTP id e1so5759751pgg.9 for ; Tue, 14 Feb 2023 08:30:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=Grnio/H04PPuIGiRb3nIsuzzYqUqwsUO7rkz9vUiKr8=; b=KR5SR2gMQ2Q4nPkyvqJSrcqclkF32K46fkHwU5XrT1mC/jHjg56ECTqpH4qCKp2N2h Ja11as9yTO1ir0YTUd7+IUgxkDCr97ao/trMNVYvDx/Suq77DcAubp+zoTwM+V/OD1xc /Pest5Non4iwpkWRjW57gb8U9QtqLiMcj4Q0kurid2KCRoNjF0Zy7KWHM2hc8+16srXi SPhcx/fGl9DdR+5J4wg0J4X01P2R05AanV5racMvcZOvAMzu/wZwdtsmo6VsMOfrlAnG k5+OKna+IUCcYiPay/0miHFUKa69ftRD43BS7nM5f2LfL+055pbocRd9oLjBMS18c3J/ 3S/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Grnio/H04PPuIGiRb3nIsuzzYqUqwsUO7rkz9vUiKr8=; b=hsdJQx/655ctonPzsu5g2+FNHMZA5ke07g4oD1OpNzEdbNQ1sp084D+NpYQHPZrdDM AE3Yi3zrD1yb1XnVkE+exmsPpCzLoWq8YT/l2r0R9YePOaSXOUSit1mT+a5O3q9WNl9y 6SutrylmFjJp593rnBEzrrSsX2dP1Cr7UoQiTbDrbuluH22u2H33iu0nWPM3TDA33hyp eF+1IMvVj+yDuWH/g+wxSgivzlpkt5OICrgfW8eXY1wpgKR4M9X90oiMDKShaIz9lPBU pRLYHECIF/rvfA0XkROWlQ+V4UMYNz2zRNLV9Wz0HEVnyMaw5+1oCxEmSL9lGc7oUfRM E8ww== X-Gm-Message-State: AO0yUKUVtUBeJYexEv7B3BOabHjVvuIJktGW38d72tWRkVpsAdqLdTtx Ok2bCVbu/l9hycjYkAH32DAgKPsq2TI8fIfUtrU= X-Received: by 2002:aa7:9842:0:b0:594:15fd:895e with SMTP id n2-20020aa79842000000b0059415fd895emr2277535pfq.31.1676392257746; Tue, 14 Feb 2023 08:30:57 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id d17-20020aa78691000000b0058d99337381sm10337011pfo.172.2023.02.14.08.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 08:30:57 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 04/14] target/arm: Split out output_vector_union_type Date: Tue, 14 Feb 2023 06:30:38 -1000 Message-Id: <20230214163048.903964-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230214163048.903964-1-richard.henderson@linaro.org> References: <20230214163048.903964-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 autolearn=unavailable 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 Create a subroutine for creating the union of unions of the various type sizes that a vector may contain. Signed-off-by: Richard Henderson Reviewed-by: Fabiano Rosas Reviewed-by: Peter Maydell --- target/arm/gdbstub64.c | 83 +++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 38 deletions(-) diff --git a/target/arm/gdbstub64.c b/target/arm/gdbstub64.c index 59fb5465d5..811833d8de 100644 --- a/target/arm/gdbstub64.c +++ b/target/arm/gdbstub64.c @@ -210,44 +210,39 @@ int aarch64_gdb_set_sve_reg(CPUARMState *env, uint8_t *buf, int reg) return 0; } -struct TypeSize { - const char *gdb_type; - short size; - char sz, suffix; -}; - -static const struct TypeSize vec_lanes[] = { - /* quads */ - { "uint128", 128, 'q', 'u' }, - { "int128", 128, 'q', 's' }, - /* 64 bit */ - { "ieee_double", 64, 'd', 'f' }, - { "uint64", 64, 'd', 'u' }, - { "int64", 64, 'd', 's' }, - /* 32 bit */ - { "ieee_single", 32, 's', 'f' }, - { "uint32", 32, 's', 'u' }, - { "int32", 32, 's', 's' }, - /* 16 bit */ - { "ieee_half", 16, 'h', 'f' }, - { "uint16", 16, 'h', 'u' }, - { "int16", 16, 'h', 's' }, - /* bytes */ - { "uint8", 8, 'b', 'u' }, - { "int8", 8, 'b', 's' }, -}; - -int arm_gen_dynamic_svereg_xml(CPUState *cs, int base_reg) +static void output_vector_union_type(GString *s, int reg_width) { - ARMCPU *cpu = ARM_CPU(cs); - GString *s = g_string_new(NULL); - DynamicGDBXMLInfo *info = &cpu->dyn_svereg_xml; + struct TypeSize { + const char *gdb_type; + short size; + char sz, suffix; + }; + + static const struct TypeSize vec_lanes[] = { + /* quads */ + { "uint128", 128, 'q', 'u' }, + { "int128", 128, 'q', 's' }, + /* 64 bit */ + { "ieee_double", 64, 'd', 'f' }, + { "uint64", 64, 'd', 'u' }, + { "int64", 64, 'd', 's' }, + /* 32 bit */ + { "ieee_single", 32, 's', 'f' }, + { "uint32", 32, 's', 'u' }, + { "int32", 32, 's', 's' }, + /* 16 bit */ + { "ieee_half", 16, 'h', 'f' }, + { "uint16", 16, 'h', 'u' }, + { "int16", 16, 'h', 's' }, + /* bytes */ + { "uint8", 8, 'b', 'u' }, + { "int8", 8, 'b', 's' }, + }; + + static const char suf[] = { 'q', 'd', 's', 'h', 'b' }; + g_autoptr(GString) ts = g_string_new(""); - int i, j, bits, reg_width = (cpu->sve_max_vq * 128); - info->num = 0; - g_string_printf(s, ""); - g_string_append_printf(s, ""); - g_string_append_printf(s, ""); + int i, j, bits; /* First define types and totals in a whole VL */ for (i = 0; i < ARRAY_SIZE(vec_lanes); i++) { @@ -263,7 +258,6 @@ int arm_gen_dynamic_svereg_xml(CPUState *cs, int base_reg) * 8 bits. */ for (bits = 128, i = 0; bits >= 8; bits /= 2, i++) { - const char suf[] = { 'q', 'd', 's', 'h', 'b' }; g_string_append_printf(s, "", suf[i]); for (j = 0; j < ARRAY_SIZE(vec_lanes); j++) { if (vec_lanes[j].size == bits) { @@ -277,11 +271,24 @@ int arm_gen_dynamic_svereg_xml(CPUState *cs, int base_reg) /* And now the final union of unions */ g_string_append(s, ""); for (bits = 128, i = 0; bits >= 8; bits /= 2, i++) { - const char suf[] = { 'q', 'd', 's', 'h', 'b' }; g_string_append_printf(s, "", suf[i], suf[i]); } g_string_append(s, ""); +} + +int arm_gen_dynamic_svereg_xml(CPUState *cs, int base_reg) +{ + ARMCPU *cpu = ARM_CPU(cs); + GString *s = g_string_new(NULL); + DynamicGDBXMLInfo *info = &cpu->dyn_svereg_xml; + int i, reg_width = (cpu->sve_max_vq * 128); + info->num = 0; + g_string_printf(s, ""); + g_string_append_printf(s, ""); + g_string_append_printf(s, ""); + + output_vector_union_type(s, reg_width); /* Finally the sve prefix type */ g_string_append_printf(s,