From patchwork Tue Feb 21 02:19:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 655342 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp1724944wrc; Mon, 20 Feb 2023 18:21:39 -0800 (PST) X-Google-Smtp-Source: AK7set8n6EZ1JA7/CETg8bo5t4F5sCbheOfKBFHrrtNybvHIxDwx0FTQrd2Rb3qDO5yk0xiVExCZ X-Received: by 2002:a05:622a:190f:b0:3b9:b9b4:cb8d with SMTP id w15-20020a05622a190f00b003b9b9b4cb8dmr21631533qtc.11.1676946099257; Mon, 20 Feb 2023 18:21:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676946099; cv=none; d=google.com; s=arc-20160816; b=AsRKgyXrcKU57ri9XFNU0+51Ocbu95+ygy88t+i7uAabehNyb9Aoy9Mw57PRxsV7A6 lQXkD0gdy4jNVSOdYo1lZCbqVwDCadkfSPpxRli+pT0Wsj9/nPWnrx5Wtps4mf1qvzsI TY3kT6byFIGuHufznbCFgfnpIqLXoX+P3IsawYiioLUwpP4AaSMf78YurBc1TCKoj6Qp Emmv3w+nz2vPLoKQ6/mQqU9ZD4+nucSf+f1WU7B1IZN56VwKjJeNP+pZYuXGq/WNcq4I Yl5hJ7WXoihQ9y3M1nU6eKQEEg0X6kejGa4Ypckbggj0c+OO8uIzlbwQQJWhSNF5Tj0o B2QQ== 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=ZxO2vFEBAewUG3Eemq5/VG4yc4LrHxRhdtS1HA4qP7I=; b=lxZs1w2eWtO3t8opbFVSgVPISyQWa4uybLgWoM8RqfsV9vWY4Mguj5JQq9lLqIRrA+ 4cwTnyGesexpiwdUU7I1NS06FfJvmlGdnppxkHspVAK2vw7XEYKtZAPYETYudL3K3kOd fklWQ7wNFpZPFCn17KAcpT9NMDjPlY+lCVjotabehD2Ic9i8yb2J499py+O3+kAn30A6 ArU7aIHOzh8hkApDFE6MPLPqkS/7WSwqlj3Y3XcKtbnysG2n/mUHiTVSFeis9ySA0FMK nolQ0P02p325mu5wNP7YjV12BqfsXle4BuQbXhnbs8NKcE0Z4hpe4uBw8v47kKRKjgQp xZGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L2f7ennI; 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 f128-20020a37d286000000b00721bf7bec5fsi10269031qkj.441.2023.02.20.18.21.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Feb 2023 18:21: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=L2f7ennI; 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 1pUIGE-0001cR-T1; Mon, 20 Feb 2023 21:20: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 1pUIGC-0001an-QK for qemu-devel@nongnu.org; Mon, 20 Feb 2023 21:20:04 -0500 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pUIGA-00080i-56 for qemu-devel@nongnu.org; Mon, 20 Feb 2023 21:20:04 -0500 Received: by mail-pj1-x1029.google.com with SMTP id b14-20020a17090a8c8e00b002349579949aso3206371pjo.5 for ; Mon, 20 Feb 2023 18:20:01 -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=ZxO2vFEBAewUG3Eemq5/VG4yc4LrHxRhdtS1HA4qP7I=; b=L2f7ennIpruboA+aTi7OGo8rD2/WhhE4hi9vMPyRB+ZutQOZYkvJX9g0d56Gmo6LEq JuF3EEmyrrOREwRuLExo+hFn91lS4nOqLAdCBlNkinXDIACmlbmxG97uy3cHCYIYYy2Z f2nk2ygJpo2un3Vha4VIeY/vs1LI5iVqOs7HzZ6qbAZ1i9RXLB1Qm53nxCxQqoHjWd14 jv4nTfecPy0jkw4iev7Ktg1tdhXkKg/Q6ikTwtQhQoe3Lpfe0aIwOqX7Ae7p3rsFtnT5 evch9Ze7hY0V1P9AqKFN90bQoHCLqV4xWW2NlnvEaq7gHGGbyG1VSXJrBMyQXSjlff3G 59Ew== 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=ZxO2vFEBAewUG3Eemq5/VG4yc4LrHxRhdtS1HA4qP7I=; b=cc9ihIr896a8Fk4JOV8IR7PJ8hbLsXhwm8uXi4HNEycqPjNgznmT+2gTMD3jJiU8eh u12+ZfBvcXXZMJmb21JKCl19CGw6rSnLO7gEPlWVOo2n1Mbx933A01pNkng0xzd2yE26 FoqK0raHOmbc3mUfd/6U4dxZ9Rg9yksnUt+Hvqq7RXh9ZU/JoEJ8hJjh7Bec1NxLFNe+ lOgrUd3kupqEPy2GtBsiTvstOdnjvnS8+VA/l0LP116k4dULIkkgN0pSmapAxsY5YcMD NSFRY8aAlciheCWWQnu6ESgNXLr0SRSPFxL+L8cSpOoYTD77KvuyTKX58G1OANDTUKwk Zzqw== X-Gm-Message-State: AO0yUKWJenIdg/tXK5y4uZQc8tRKRhmXgulNXdE2uyJdt8V5qasYlAMG 4TMDx2utF7GcbsVwFES94+mgOxdPLxpeS4BcVDM= X-Received: by 2002:a17:902:f54a:b0:19a:a647:1891 with SMTP id h10-20020a170902f54a00b0019aa6471891mr6625157plf.67.1676946001373; Mon, 20 Feb 2023 18:20:01 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id f3-20020a170902e98300b0019141c79b1dsm8559328plb.254.2023.02.20.18.19.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 18:20:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Fabiano Rosas , Peter Maydell Subject: [PATCH v2 04/14] target/arm: Split out output_vector_union_type Date: Mon, 20 Feb 2023 16:19:41 -1000 Message-Id: <20230221021951.453601-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230221021951.453601-1-richard.henderson@linaro.org> References: <20230221021951.453601-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Create a subroutine for creating the union of unions of the various type sizes that a vector may contain. Reviewed-by: Fabiano Rosas Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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,