From patchwork Tue Feb 14 16:30:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 653472 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp3146712wrr; Tue, 14 Feb 2023 08:32:35 -0800 (PST) X-Google-Smtp-Source: AK7set9yqQFjboOirZAdCro2yQFYzOnazjHs5bnLji5azWTJRPxpWF3ZVpYH/xGzyZ5LCs4mIwpU X-Received: by 2002:ad4:5b84:0:b0:56e:9f05:6267 with SMTP id 4-20020ad45b84000000b0056e9f056267mr5825596qvp.48.1676392355305; Tue, 14 Feb 2023 08:32:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676392355; cv=none; d=google.com; s=arc-20160816; b=D26peswFbjmqPqQq1hbxlou9HEKFw8m/Je2Aum3pRlAitRpWtig4MAlvwjrW+5XDN8 nYEFkZ3TafpJU/MJQzlXj6Ss0hkl60+NNfS3Quh+ifFW6c/Qs3bxoJOeIVNfRL/wUef1 h+BxDqv33CFBNk2WLVggjkGAP9FUksbnj9rRRQsf59BB8yItB5BOd7jukTBnYej81rK9 rXBeO4yCGg7NGORbSUOFPrQ02iPusBIgHsqI4jurGeLq1u2a5UYv6NEW5UaDXbGm5PVN 0BROlKOJdFSdFsWYWbBAfSt0VJkul/AnS6w4EciWQ8g35gNWZ5Yp0HLTP957IfoqyVLj I+rQ== 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=YRBnSRYi8o+DLHiV3s59zUytH0Yp49LyljZa3CvYZ4E=; b=vEVWLIS4eOorYn1FmWqUGvxZBvE3CvbGzRSxxng2ZAN7R1BmgqeFmCqZhJepq+O+97 Vn4+p7R+WSXYWQF8PNWSTRhmgM2xJLaXsfs+t7D4amgfB/cA3cTq66POSTUGo3P49kT8 I1ds+94zNhNkOUn2lIn/pUXcKIelzfgXSqeR4CUYmdktIZ+899GFtF7g50CUymG2/FSE Od+LxgCFabAfv8AcaL5caqxy/PqlJN0f+TCZn7LP2PVdILx8bc17ojB59Tqa6IJokoId mUjlwjdLy4opcHuXGF/AXyj+ugKXV0mcVndeDEDsbLAI6z8zdO6Uu9eHxSc1s5EzgqQS G0rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fWI7kDHi; 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 w8-20020a05620a424800b006fa5f940d69si12308915qko.531.2023.02.14.08.32.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Feb 2023 08:32: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=fWI7kDHi; 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 1pRyDC-0006wS-10; Tue, 14 Feb 2023 11:31:22 -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 1pRyCy-0006Ur-8M for qemu-devel@nongnu.org; Tue, 14 Feb 2023 11:31:08 -0500 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRyCw-0002AM-NO for qemu-devel@nongnu.org; Tue, 14 Feb 2023 11:31:07 -0500 Received: by mail-pg1-x532.google.com with SMTP id v3so10583660pgh.4 for ; Tue, 14 Feb 2023 08:31:06 -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=YRBnSRYi8o+DLHiV3s59zUytH0Yp49LyljZa3CvYZ4E=; b=fWI7kDHiT7X3OmtkOyNQejdpwA6XhJG97IZ4mlR8XOHBF9sbzjzBso/ASVPcE5VkyA +dh1/9QZOdvIdOty38ZgMaMlxIDNVknzr7yXmI7q8hLexL5+YaKNHol4UR5A4eYZd0Vs LtLhynCf1Y4tacrWoZN3n380YV65rgPD6Dv+QWRgHfpcqZbuw3kw0Ui6b8B51z57IS9t QM6TS4KO2PjDWtQhq4ZCR+cPxG4xvg2Sqr5y57WuTiGVUvZObcshcsLQB4YccoCvxEMb CogtbZaSc7tAYc2OzSk+q7uQVsqtLtLRx/edfnRrxV7IdigeEF9VV+RDEKOqafgpa5J3 29ng== 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=YRBnSRYi8o+DLHiV3s59zUytH0Yp49LyljZa3CvYZ4E=; b=lX0nvv+xp66LKCH7Aui1+zVv3QVVgR5j056uQYMXuEXJbRwURD/9fR6E9lt2BOtWlI aZiqw6SbVFBSbO+AlmuGTollirINa9xG45Jxy6oNi0K2mIy3qZTJ2qBsi0nMc5oI7U7b jc+BvliVWjJ88kgbmYDUABT9/Wk7yXy23FkwZrg/n8Hrd1GeS05SgbzRLkAOfVu/NzOP eVFz6n4jRoxlE0TBw4kpdoLiw59UklUaIhrpAhgCW+OmUl1I/yIhLcU56lV4gcb8awEL DtSLefYZbjimStVu8pWUXPVR1iTcsEVY1p+7teXq50IGlrvLQVMU+1ZRua/qnIoCVsZi Lqug== X-Gm-Message-State: AO0yUKWpBmkax5XfJMQyzLoGdtJqY/Oa4mfv7EsoKVclXjG/386ZGzzB ixys3dL0DaEyDx7B/dtd8ODgdi5eT2Ji+PWwl8w= X-Received: by 2002:a62:17c3:0:b0:5a8:aa1d:30e9 with SMTP id 186-20020a6217c3000000b005a8aa1d30e9mr2275115pfx.18.1676392265265; Tue, 14 Feb 2023 08:31:05 -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.31.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 08:31:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 09/14] target/arm: Simplify iteration over bit widths Date: Tue, 14 Feb 2023 06:30:43 -1000 Message-Id: <20230214163048.903964-10-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::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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 Order suf[] by the log8 of the width. Use ARRAY_SIZE instead of hard-coding 128. This changes the order of the union definitions, but retains the order of the union-of-union members. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/gdbstub64.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/target/arm/gdbstub64.c b/target/arm/gdbstub64.c index 166cb288cd..a6a8e7eb40 100644 --- a/target/arm/gdbstub64.c +++ b/target/arm/gdbstub64.c @@ -240,8 +240,8 @@ static void output_vector_union_type(GString *s, int reg_width, { "int8", 8, 'b', 's' }, }; - static const char suf[] = { 'q', 'd', 's', 'h', 'b' }; - int i, j, bits; + static const char suf[] = { 'b', 'h', 's', 'd', 'q' }; + int i, j; /* First define types and totals in a whole VL */ for (i = 0; i < ARRAY_SIZE(vec_lanes); i++) { @@ -256,7 +256,9 @@ static void output_vector_union_type(GString *s, int reg_width, * signed and potentially float versions of each size from 128 to * 8 bits. */ - for (bits = 128, i = 0; bits >= 8; bits /= 2, i++) { + for (i = 0; i < ARRAY_SIZE(suf); i++) { + int bits = 8 << i; + g_string_append_printf(s, "", name, suf[i]); for (j = 0; j < ARRAY_SIZE(vec_lanes); j++) { if (vec_lanes[j].size == bits) { @@ -270,7 +272,7 @@ static void output_vector_union_type(GString *s, int reg_width, /* And now the final union of unions */ g_string_append_printf(s, "", name); - for (bits = 128, i = 0; bits >= 8; bits /= 2, i++) { + for (i = ARRAY_SIZE(suf) - 1; i >= 0; i--) { g_string_append_printf(s, "", suf[i], name, suf[i]); }