From patchwork Mon Feb 27 21:33: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: 657129 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp2584869wrb; Mon, 27 Feb 2023 13:37:06 -0800 (PST) X-Google-Smtp-Source: AK7set8ChLc+lSJhiZBgiCZJxjQA7jM6Rr4Mt6byGD+56Gjkp30UpI1IsxnRZNIWvBxM23usLuPF X-Received: by 2002:a05:6214:508c:b0:56f:1b7e:d87f with SMTP id kk12-20020a056214508c00b0056f1b7ed87fmr1629442qvb.34.1677533826195; Mon, 27 Feb 2023 13:37:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677533826; cv=none; d=google.com; s=arc-20160816; b=SjpEdtACE61LIrHgSyntqTxr5b3ol9Mb/tX8eKn5th5IFVB8ZSi8KlrlbvxStksTZ2 96MHsuX0oMYfwq65Gkm3Pr7MUUYIud+V7KGzxuJrtLxfKHKLkPPEozxkWO6PukH9t6y0 BAHH3Z+mZXQ+EyW706RXp9QhV3/cTrwdccQHdHHhm2zDRhS8a+L4otOUcDGoDVS85KoA tyowikEJIIZuTYUOibK5xLPJOaC+uK4OYFtTl0PeG8NLVaspLsyKZRgPLtj2DdsNtY26 e7DLnbI+wVVNxfFYw7m5q9xwcILYfcdaoiz8kZjdNJhOMaxmE0jCvzs3mJ+jT8HJKXkj Cxgg== 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=aNUfNAOOW2217GtDxgnHNun0baCDqHkCJ74duv+EzTmtvDccRJx7dmo6Q48J4em5UW l0/QMrzF0+qD2Rbj51IjURjOw7m8ORDAG4Uc14QJpqH0ZLQrULAV2JbpLgmLYlfcMVDM c0SDFV33aH3sIMIHytLe91Pxswin4sp944PFDtdiWaLSHXSXrV2glasT9z4AT0Bk3x8d 2+S7i5+V5sW4iH/wKTDFgjecN1SkZgbjYfgyR6ZwsGld+1b2I39nY4Iee9xLR6AWzqqO MR2nGWsm+FYntnAf/lBYF8yyS1zzVYK5LN/l/SX7FYrFgS3Eo3ogha2ugyVE4NpOsz2c QC+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M6n2lUHM; 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 q9-20020a0ce209000000b005376d8a8e5asi6876100qvl.433.2023.02.27.13.37.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Feb 2023 13:37: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=M6n2lUHM; 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 1pWl7v-00079e-BA; Mon, 27 Feb 2023 16:33:43 -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 1pWl7t-00078T-Te for qemu-devel@nongnu.org; Mon, 27 Feb 2023 16:33:41 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWl7r-0004Ha-Td for qemu-devel@nongnu.org; Mon, 27 Feb 2023 16:33:41 -0500 Received: by mail-pl1-x62b.google.com with SMTP id n6so6878041plf.5 for ; Mon, 27 Feb 2023 13:33:39 -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=M6n2lUHMnDdngn13MzAJK5qyfzqgLLqKEaMVam+co6RIemOBZLJ7L2woZLer+Rz+b3 Z2W1DS42hYDYsk4kdWfb9fIQ3uQzZuvn1Rk6E4ziK/Gf9tgToR9SgK5NcQ8ozicxJeMA iBWjijIz6k2PkRNyongc5xIR3Xv6R5g6rBpqKu9qzL/qV/fQQB0Ov0PgLsQAwU6g2ME+ i+YfqrYVn9KrDnfJvGcuaKzHk8xtkD2czfLGRKzkeOm6Kqprd2HtO7M7uzEWOWpzoxeC FHLpnPtY+L/ruOAlODY1w7Fpq7Q/iTmzmoK1P2zw1cBQ2B633R3j5ozivB7qSIFne4AX hvaw== 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=jGsZFkhMV+yZXpblZ51L4HECjzZPbzRevor6ibc5zWiLc8fbBWu2e/aCMjIPhFKbwj L972nLTRn4eB0IgKlKMqowJ+NNaWPWoC+dGzRfYOiZTubKHB4kxYq0fj6s7hvMP6RKa8 CY08pzqEoPsaKZTgrLQ/R7NhP4SLT/MV4PuWr/nN1LmOiODiqeEF/IsPAjME7lDIopPu igTxAUtQVGajgOtf0tBf+lUc+Wwsg546FYWM0bFPhU7UaPz9rGTwdtzOtMyGycsjRxg1 oHHZmTu7jpwjuA0vmw8jVg7Jgd5TwtwCJ0/WoYeDn5WlLh3WsJMwFpi7EdEiZZS0kzmC dAsw== X-Gm-Message-State: AO0yUKWg/EHBZyRRHBOw+ZhVzLj9GAg6SEz/z3fmRpDxRiRJH/hEK+oC z12jNVYgaHtAr/s3My2yRfmPq+x512Dz8rImKV4= X-Received: by 2002:a05:6a20:4420:b0:b9:2df:7ef6 with SMTP id ce32-20020a056a20442000b000b902df7ef6mr947580pzb.31.1677533618545; Mon, 27 Feb 2023 13:33:38 -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 d137-20020a63368f000000b00478c48cf73csm4375262pga.82.2023.02.27.13.33.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 13:33:38 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Fabiano Rosas , Peter Maydell Subject: [PATCH v3 04/14] target/arm: Split out output_vector_union_type Date: Mon, 27 Feb 2023 11:33:19 -1000 Message-Id: <20230227213329.793795-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230227213329.793795-1-richard.henderson@linaro.org> References: <20230227213329.793795-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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,