From patchwork Wed Jan 10 21:52:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 761460 Delivered-To: patch@linaro.org Received: by 2002:a5d:6e02:0:b0:337:62d3:c6d5 with SMTP id h2csp2094220wrz; Wed, 10 Jan 2024 13:52:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGOYPww+sCObeLC25azFPMCsV31ZCPzjJz9VBaraxqnoHT/4olJsb0Lj/qRXVHICMSBsD8 X-Received: by 2002:a0c:9b11:0:b0:681:7e9:8a71 with SMTP id b17-20020a0c9b11000000b0068107e98a71mr124270qve.59.1704923569748; Wed, 10 Jan 2024 13:52:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704923569; cv=none; d=google.com; s=arc-20160816; b=DzS/v/UHFmrtpBKjXD8CX8S2zz5mN6s6ToBRsZ00WbJLCwps1Xp8GBuz3JTUT4Lupb otIK9zcC8n/4o4nisnSxaqX8Sf5oeiQgx2wHDb+66QmNK5ysQsKZo8FmJiodCj8PrErR z7bWhtrpMHa/o/UvscX4TQofbODspUpz2KQyzJssAIA+c/7CQwmKZhr/U6YOJ3leBFru 1h9HBOQg2y1hOywuf57sUs1YS+zqpj/lQ8r/2ppDreUzrMTYqKuHqQTHtnI1IWlKzve6 Sm6S9fuIXDIrOpfZMs/o3YIRDWPUt4IqNGwAMOyTQ/pkeGcrAudns8+RTKMu5Z54bfjV c59Q== 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=cc2RPo52FmEiV7m0RK0jR9X26iVBZu5+1nh1fPIm+Uk=; fh=OTkfrEnbNDInppsfj4HB8z6V33zCj7LOct256XBfW6M=; b=htOpjeceCwHcUXNj2E/u95mtDgJCo/efXvf81Dtmqdrd6NbffdNSEQUgGF+PdYGZli ykBYg8rpmIh4Y62Wp6bFpxb0gUEL+Fo+DukOr5OW0YMrycMupn/eQKXBC6efz505a4G/ zaBR9a9YqQCwjGQ3+Tv5TPYRw3CDj83QDXg6UvqFgx8RUrwJy+WApnNZdV6QgirMqjFq FZCkk9Ti13d1qOVcjUKnF6iIob5QoOMPjl3FO/w+OfxRgN7F4dReTEbDOV+q1LdFZ95I nWzMJHDpV2joY/gQkMiVKlLHtAbZZY8k6iF8F2YeYCKp/rkNVM5Geju/figipTKOBZMD 5rSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fokUvWvk; 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 v4-20020a0ce1c4000000b0067f6f831c13si5189620qvl.219.2024.01.10.13.52.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jan 2024 13:52:49 -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=fokUvWvk; 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 1rNgUm-0003Zs-SZ; Wed, 10 Jan 2024 16:52:20 -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 1rNgUk-0003Z8-U7 for qemu-devel@nongnu.org; Wed, 10 Jan 2024 16:52:18 -0500 Received: from mail-qk1-x733.google.com ([2607:f8b0:4864:20::733]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNgUj-0005do-3E for qemu-devel@nongnu.org; Wed, 10 Jan 2024 16:52:18 -0500 Received: by mail-qk1-x733.google.com with SMTP id af79cd13be357-7831ed13d39so347692385a.0 for ; Wed, 10 Jan 2024 13:52:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704923536; x=1705528336; 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=cc2RPo52FmEiV7m0RK0jR9X26iVBZu5+1nh1fPIm+Uk=; b=fokUvWvk2xld39RpsmFlisSwNN4F+LmUGPj2vhC/+WlJD6PVOXuC7vfrZT7oX0MoE8 xiDrLN8BzDUNYAGRDuewB2R3r4vDVquJyHlIGpoQNF+yhN6UpDo5QoLfRXt6zgBdpJLj E/mHloBvePojQeEIMs3M5NYaasObM75c/CQ7tZDZSnqqEX0vd+UcuocmuOH8bHZiFo7s ESPfDVQIwP1XLVUKzhdfilaLbAHLbtm8zTUT2YTbTwyqqhPIpaeOkmN1LNKWHc+KzV5L P97iByWa5SqWlQC/H3Sp2JVt8qC0GNeZck1C5nDIdqKQf1UL8xDxCx4pgRyd/jpB8mVl 2q3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704923536; x=1705528336; 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=cc2RPo52FmEiV7m0RK0jR9X26iVBZu5+1nh1fPIm+Uk=; b=BTe5iS2TWsRUIs2t5i53xC5z3fWhkRErLMd6kcvVl5Su2et1CS+yaFhmp7Yha/l2Q9 pBaTcM8G55L3UtLb42zllqDkVmxg0kC4HCvy0aZi1kEgboNLaeBf0ejA/5X3eX+xSZQg CYIDRo4kaos3jIDFKaBjdDZSP9VTcVLZmP6mDjXaqSTNe0dQNIXwUjewCzKj45uvpR95 84SBTUIKvNUXqifvvNioR4fJ20skWLGB0XEs86TOX/9h+6oGQi9IBJYx/YtVXj52fHmb sy2Xg+fTMlzYbIgP+8Nmx5aCGz+X3ff+B+uLgcZozWVhvnE/pK5LEbdV8NnKTZB1KJ3A oOQA== X-Gm-Message-State: AOJu0YyefAj9ZqeVZ/qNypVZAzMcOmrJvescEWoHeoQmr7xowp9VwuM5 7InOC9MuodfOVxL8B/mY0MaEmUVWgkd/z1g4frjiDCYBUOE0zhd1 X-Received: by 2002:a05:620a:288d:b0:781:5e3a:a85f with SMTP id j13-20020a05620a288d00b007815e3aa85fmr374385qkp.17.1704923535987; Wed, 10 Jan 2024 13:52:15 -0800 (PST) Received: from stoup.. ([172.58.27.160]) by smtp.gmail.com with ESMTPSA id z8-20020ae9c108000000b0078313c87609sm1888387qki.100.2024.01.10.13.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 13:52:15 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PULL 1/4] tcg/i386: convert add/sub of 128 to sub/add of -128 Date: Thu, 11 Jan 2024 08:52:01 +1100 Message-Id: <20240110215204.9353-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110215204.9353-1-richard.henderson@linaro.org> References: <20240110215204.9353-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::733; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x733.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 From: Paolo Bonzini Extend the existing conditional that generates INC/DEC, to also swap an ADD for a SUB and vice versa when the immediate is 128. This facilitates using OPC_ARITH_EvIb instead of OPC_ARITH_EvIz. Signed-off-by: Paolo Bonzini Message-Id: <20231228120514.70205-1-pbonzini@redhat.com> [rth: Use a switch on C] Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 49 +++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index a83f8aab30..29e80af78b 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -1316,23 +1316,41 @@ static void tgen_arithi(TCGContext *s, int c, int r0, c &= 7; } - /* ??? While INC is 2 bytes shorter than ADDL $1, they also induce - partial flags update stalls on Pentium4 and are not recommended - by current Intel optimization manuals. */ - if (!cf && (c == ARITH_ADD || c == ARITH_SUB) && (val == 1 || val == -1)) { - int is_inc = (c == ARITH_ADD) ^ (val < 0); - if (TCG_TARGET_REG_BITS == 64) { - /* The single-byte increment encodings are re-tasked as the - REX prefixes. Use the MODRM encoding. */ - tcg_out_modrm(s, OPC_GRP5 + rexw, - (is_inc ? EXT5_INC_Ev : EXT5_DEC_Ev), r0); - } else { - tcg_out8(s, (is_inc ? OPC_INC_r32 : OPC_DEC_r32) + r0); + switch (c) { + case ARITH_ADD: + case ARITH_SUB: + if (!cf) { + /* + * ??? While INC is 2 bytes shorter than ADDL $1, they also induce + * partial flags update stalls on Pentium4 and are not recommended + * by current Intel optimization manuals. + */ + if (val == 1 || val == -1) { + int is_inc = (c == ARITH_ADD) ^ (val < 0); + if (TCG_TARGET_REG_BITS == 64) { + /* + * The single-byte increment encodings are re-tasked + * as the REX prefixes. Use the MODRM encoding. + */ + tcg_out_modrm(s, OPC_GRP5 + rexw, + (is_inc ? EXT5_INC_Ev : EXT5_DEC_Ev), r0); + } else { + tcg_out8(s, (is_inc ? OPC_INC_r32 : OPC_DEC_r32) + r0); + } + return; + } + if (val == 128) { + /* + * Facilitate using an 8-bit immediate. Carry is inverted + * by this transformation, so do it only if cf == 0. + */ + c ^= ARITH_ADD ^ ARITH_SUB; + val = -128; + } } - return; - } + break; - if (c == ARITH_AND) { + case ARITH_AND: if (TCG_TARGET_REG_BITS == 64) { if (val == 0xffffffffu) { tcg_out_ext32u(s, r0, r0); @@ -1351,6 +1369,7 @@ static void tgen_arithi(TCGContext *s, int c, int r0, tcg_out_ext16u(s, r0, r0); return; } + break; } if (val == (int8_t)val) { From patchwork Wed Jan 10 21:52:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 761459 Delivered-To: patch@linaro.org Received: by 2002:a5d:6e02:0:b0:337:62d3:c6d5 with SMTP id h2csp2094219wrz; Wed, 10 Jan 2024 13:52:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHiFUFhUojPd0sDwFXpTdVGiCbFqEezWGGIi/X4tI7fzj7JFHGitvMgSiJwMD8uPbhdUnei X-Received: by 2002:a05:6214:21ce:b0:681:1201:a523 with SMTP id d14-20020a05621421ce00b006811201a523mr214227qvh.25.1704923569764; Wed, 10 Jan 2024 13:52:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704923569; cv=none; d=google.com; s=arc-20160816; b=ga62hkbS5oVqdbyyksdz87nwBK/rsGanDg7c4YGibDsn/BX+iOzq9qdfdqUoruGlO/ oieTP2guHRo4eoJLVY2+Y7ziuAqjiO5v3CyTmQZlvtp5Hz20F0pS9GSwvxyxBxPC4BWT BlzO3pOrnzxqywFjktmtnVkVZLDt0m8OvgUZqwIjpfVtByIumBt5zAf1l6ANcAKkWyWl lQDK14j0eP6YX8TasjQboBuEYnEt/oE8/4co1s+37ef7bvU73jvTqqe8YEVt5Lrs7UNd hbUNt5MdAmpJklMoY+ddDAG9EREZ9soNbIjEAJ7EF/Goe/zMO/9uGp3PM7UoazIePlrF gPHQ== 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=OBBeoirsyv5/OFQlIRCs3B1+YR9/kciezwI6H7ohodM=; fh=OTkfrEnbNDInppsfj4HB8z6V33zCj7LOct256XBfW6M=; b=XV1JRk3gF/kEyLgDDZyVgF9cLbW4vRiStC8y8F2v9utPkzJIPhwbFvIx0geubzBRwV gRRZozqHXYr0fnDvc7RaYTyLXwErj893k8OT4s5wM3tfgXNGhhw8ZdUdbtrx8do6o6YX 03O92cRy+O5zaluB/+IaxzQIB9LjjtOn9cN4ukwrNmPpv1d8jxXmQdiSD3sDVjlCuIrj YNujE3mrWdwvc53ASoesCbemQHOsH34OupS3A1qOe/4FMTVruKlNSUCYBJd/55kSwgGq HflSZb8NAUhsiSDu9Qh5cbw+sj1tbTHxJs8ZL90yBN+V/dl8RPUuZX3TFUl4yygs3Qsn QtVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jcBFQ2hw; 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 u2-20020a0cb402000000b00680b1758fdbsi5186374qve.383.2024.01.10.13.52.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jan 2024 13:52:49 -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=jcBFQ2hw; 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 1rNgUp-0003ab-Dd; Wed, 10 Jan 2024 16:52:23 -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 1rNgUn-0003aA-Mk for qemu-devel@nongnu.org; Wed, 10 Jan 2024 16:52:21 -0500 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNgUm-0005fn-3f for qemu-devel@nongnu.org; Wed, 10 Jan 2024 16:52:21 -0500 Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-783182d4a09so482344485a.2 for ; Wed, 10 Jan 2024 13:52:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704923539; x=1705528339; 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=OBBeoirsyv5/OFQlIRCs3B1+YR9/kciezwI6H7ohodM=; b=jcBFQ2hwa1ZICpmBR0Ac7N8axgc1pbmlbmzb1xdlzIyw4wc2rYQRc2NbREnNJBTeBC Rr/rypm4r+qTwC56tF24s60nhNRXQNWqHrbz4CL56g69MQk21ECfMz8mYIhw6mW2M2qe PrhC4iBgLrcrcPLszVKRVvFT1dBx+Q/kMHfvuEuWnuAXAD3CY4cG625/Y4eawlVBXgPb 77aaurMpKIVZAVaot44BvyZHvaoFY3/S4+P9T2TITghjX2q7PlQNnQ9rduDguZWwsDZt +O9DW0Aw8HDIPVcOHS2X5xs+cQjhNJukmETKYUlKEnQNzTyG3eBJeIuDlgRXXGPTWsL2 xYEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704923539; x=1705528339; 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=OBBeoirsyv5/OFQlIRCs3B1+YR9/kciezwI6H7ohodM=; b=NLwgo4ulKgjbQFmzSzVlPUZ9PFt2ONlDpj+gzQ55aS1yRwsjl9BkU0WalUXD2KVa3f cxY5NA86/ALUJN9x11Z6IcPgI8k6BSb5biQXQMqXbidxnG4JqwRmTS7kJ2/oIuOucMfW wKVFdSuEnriPiHTqGSfblPU51EY1gw7wjLikpwZU71KXaq01U4MhJPOt0TyznvB6x7na C5WC3VEEDtsTugvLRU664OwwcnZPxs8Wql+pvrq51VtSNAYPAAtRZLrRfO6fG2oh4jVz 5MrUylnHOngUeebH8ClSuhsH1E7lTcJZLh3qRL/FMGDaIMorsyoNxNUldl7TATJAyVgg HnuQ== X-Gm-Message-State: AOJu0YyL3pm0fQ89jn+5hibQLEk6jZXL079uEmDQ5oM6SfjB8wZ7+Ua0 exc58IkKMyWkzT2JQvKkYJrlpJz+jAhMWM/ZyDSvWXLeuP/S8BFS X-Received: by 2002:a05:620a:13ed:b0:783:23a1:8b45 with SMTP id h13-20020a05620a13ed00b0078323a18b45mr328613qkl.108.1704923539157; Wed, 10 Jan 2024 13:52:19 -0800 (PST) Received: from stoup.. ([172.58.27.160]) by smtp.gmail.com with ESMTPSA id z8-20020ae9c108000000b0078313c87609sm1888387qki.100.2024.01.10.13.52.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 13:52:18 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PULL 2/4] tcg/i386: use 8-bit OR or XOR for unsigned 8-bit immediates Date: Thu, 11 Jan 2024 08:52:02 +1100 Message-Id: <20240110215204.9353-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110215204.9353-1-richard.henderson@linaro.org> References: <20240110215204.9353-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72c; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x72c.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 From: Paolo Bonzini In the case where OR or XOR has an 8-bit immediate between 128 and 255, we can operate on a low-byte register and shorten the output by two or three bytes (two if a prefix byte is needed for REX.B). Signed-off-by: Paolo Bonzini Message-Id: <20231228120524.70239-1-pbonzini@redhat.com> [rth: Incorporate into switch.] Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 29e80af78b..d268199fc1 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -244,6 +244,7 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct, int vece) #define P_VEXL 0x80000 /* Set VEX.L = 1 */ #define P_EVEX 0x100000 /* Requires EVEX encoding */ +#define OPC_ARITH_EbIb (0x80) #define OPC_ARITH_EvIz (0x81) #define OPC_ARITH_EvIb (0x83) #define OPC_ARITH_GvEv (0x03) /* ... plus (ARITH_FOO << 3) */ @@ -1370,6 +1371,16 @@ static void tgen_arithi(TCGContext *s, int c, int r0, return; } break; + + case ARITH_OR: + case ARITH_XOR: + if (val >= 0x80 && val <= 0xff + && (r0 < 4 || TCG_TARGET_REG_BITS == 64)) { + tcg_out_modrm(s, OPC_ARITH_EbIb + P_REXB_RM, c, r0); + tcg_out8(s, val); + return; + } + break; } if (val == (int8_t)val) { From patchwork Wed Jan 10 21:52:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 761463 Delivered-To: patch@linaro.org Received: by 2002:a5d:6e02:0:b0:337:62d3:c6d5 with SMTP id h2csp2094464wrz; Wed, 10 Jan 2024 13:53:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEx8eimEytkNWaZ/NIJ+C8vxplVe+nU/goo57KYwhY2cgTEwVeEBtMve6MrpU3PRNplKEN5 X-Received: by 2002:a05:620a:45a4:b0:783:561:b939 with SMTP id bp36-20020a05620a45a400b007830561b939mr365248qkb.27.1704923616235; Wed, 10 Jan 2024 13:53:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704923616; cv=none; d=google.com; s=arc-20160816; b=lhWab/qeps9pVQ+1VWY5xdf0uuz7gIoTX6cZ/eiszZeBvCL0zQSAJ5Rkw+C9JM4qwB nn8bFdojOVvWLZw7pZZLTn9UfoybeeIUt8OsNhO22gQbmLasVcZ5zOdP33gO7u0dNRAW FPRq6xYGSQYgnwW+YZSlt5dQM6PG8tf1cttaUIzLEKP/eawxIEHYJbNRYB+Ep4KYbfPn OCd5zXVZX4O8DVjtkvTFWJNEAqy/36YGw15KTow2D0j5F71SVb77IBbadmHSdvD01gvB BlXpO41NIBwftVw26I7Y3l4r09tUjgzYNBhTv8Vh37Wkc9569fhQ0e4tHXCD2YAcSMxi 1UnA== 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=HwFKj5Pn5DjJGhI9eC5OFFV9tA3PvMraO52aS5I9wUY=; fh=aYwv1qvAWDHKcZLZyhvLuIoAkBRd6ysYy/Itgr1WhFg=; b=N5YHtm9TeeT1Op9J6BETmMNRNQd/ac/X4N8atVl3Jkwlw8qNTqZckKCWv+NYzJQ/13 /QezFMk3VLucRubX9ox0DysHr34qd0MaEB8aq4zHFTGv3oA6y90yPJJ4BD87eurhVCcm GydhSZL29DST3W9z5GD5cIzx5eRpv+6gPtpcZULGBnmZ0IkA5da2ixSufFgrL0xwuqSa 1WmYy3JhtJxPyoxNwHMpBMsMERd1pBSxRYyXfmjs3YYGpj7tpMQnicL1gXluD2jtCJiC ehXjn4BTStimhRfdpA9OIfKZ8MWbL07UCTW0UHEa4+pZS1DoegxpZS9tT7F1/XdlarWx csgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rridXl3+; 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 t5-20020a05620a450500b0078160dc34cfsi5214506qkp.20.2024.01.10.13.53.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jan 2024 13:53:36 -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=rridXl3+; 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 1rNgV5-0003fV-N5; Wed, 10 Jan 2024 16:52:40 -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 1rNgUt-0003bA-Jd for qemu-devel@nongnu.org; Wed, 10 Jan 2024 16:52:27 -0500 Received: from mail-qk1-x734.google.com ([2607:f8b0:4864:20::734]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNgUp-0005iT-KH for qemu-devel@nongnu.org; Wed, 10 Jan 2024 16:52:25 -0500 Received: by mail-qk1-x734.google.com with SMTP id af79cd13be357-7833c5d5c77so28888785a.3 for ; Wed, 10 Jan 2024 13:52:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704923543; x=1705528343; 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=HwFKj5Pn5DjJGhI9eC5OFFV9tA3PvMraO52aS5I9wUY=; b=rridXl3+jdqbF7VGMLtTvQ0Yonrw6h4zHrKsfStlGzXFX6sEwUTCAfQgE9tzC1L3zR O6KqHRBVmJhBUJu8Stu5ijr+ZNz8iX3+SpnCFWq4Wa4eeY+SD0GAPIuqsGQMda0ZtoSA HzJGmi65fSLsid8JG60XuFZlBBug4qrGjXkicsWcEbTlxVY9W7rfkjzD6uzHaibOVBUe Iat3Cv/G+Ns1dP997/ieLu8h11puMVU0qrFLT0QJd9cVbUg1rUWxyKlcSjnIHQoZE3cg mgGYlhWqsxhIh37L+vJDq6e5UikkHrWvP8rgCFfjstDTuKuC77FhiSRCRonHmW8VMi40 HxUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704923543; x=1705528343; 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=HwFKj5Pn5DjJGhI9eC5OFFV9tA3PvMraO52aS5I9wUY=; b=RgFo+qekcviHHeyhGD0GHO0e6rmxC5I+SJHzSqybKbH7Z2EhGzZuAP835lZdCoSRkY ultOkPQJO0qlmWLZ81HtgZf1Y0DTwvI2SSnUo1QsCsz6Zj0mD+K3ImJ0ExPSlpVn0pBR mA6VPBqBWyzbeWvR0p8BPRGzBRSxAGCUi2IHiPVN82E79wfp5lDwcOGz7J2UpXMFUCV8 Yu/Dei+zx4YoJjZbIFsvbdSgq38dn6s406A2fL8oH8h3qc/P4nutNmMWlJ8c3B2fLVWI WcaIjbp6wC7MUpRKxIliXk/v97mQ4nsmTTcNRt1ghKGy2UR/dyZmMsqplHf3PkQWICSn pk1A== X-Gm-Message-State: AOJu0YwPFDksURV+Oxiqm3IlYZ90wxM1CeCPyRPiXpJ0XE3aIfauf+aZ 33+05fVPv2lQfPg108ZcFWgbqEKFiZzxPHi2K03VDY9DrW5RhPYJ X-Received: by 2002:a05:620a:3914:b0:783:2a6a:7b82 with SMTP id qr20-20020a05620a391400b007832a6a7b82mr388836qkn.98.1704923542755; Wed, 10 Jan 2024 13:52:22 -0800 (PST) Received: from stoup.. ([172.58.27.160]) by smtp.gmail.com with ESMTPSA id z8-20020ae9c108000000b0078313c87609sm1888387qki.100.2024.01.10.13.52.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 13:52:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 3/4] tcg/ppc: Use new registers for LQ destination Date: Thu, 11 Jan 2024 08:52:03 +1100 Message-Id: <20240110215204.9353-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110215204.9353-1-richard.henderson@linaro.org> References: <20240110215204.9353-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::734; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x734.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 LQ has a constraint that RTp != RA, else SIGILL. Therefore, force the destination of INDEX_op_qemu_*_ld128 to be a new register pair, so that it cannot overlap the input address. This requires new support in process_op_defs and tcg_reg_alloc_op. Cc: qemu-stable@nongnu.org Fixes: 526cd4ec01f ("tcg/ppc: Support 128-bit load/store") Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20240102013456.131846-1-richard.henderson@linaro.org> Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target-con-set.h | 2 +- tcg/tcg.c | 21 ++++++++++++++++----- tcg/ppc/tcg-target.c.inc | 3 ++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tcg/ppc/tcg-target-con-set.h b/tcg/ppc/tcg-target-con-set.h index bbd7b21247..cb47b29452 100644 --- a/tcg/ppc/tcg-target-con-set.h +++ b/tcg/ppc/tcg-target-con-set.h @@ -35,7 +35,7 @@ C_O1_I3(v, v, v, v) C_O1_I4(r, r, ri, rZ, rZ) C_O1_I4(r, r, r, ri, ri) C_O2_I1(r, r, r) -C_O2_I1(o, m, r) +C_N1O1_I1(o, m, r) C_O2_I2(r, r, r, r) C_O2_I4(r, r, rI, rZM, r, r) C_O2_I4(r, r, r, r, rI, rZM) diff --git a/tcg/tcg.c b/tcg/tcg.c index 896a36caeb..e2c38f6d11 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_N1O1_I1(O1, O2, I1) C_PFX3(c_n1o1_i1_, O1, O2, I1), #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), @@ -676,6 +677,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode); #undef C_O1_I3 #undef C_O1_I4 #undef C_N1_I2 +#undef C_N1O1_I1 #undef C_N2_I1 #undef C_O2_I1 #undef C_O2_I2 @@ -696,6 +698,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_N1O1_I1(O1, O2, I1) { .args_ct_str = { "&" #O1, #O2, #I1 } }, #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 } }, @@ -718,6 +721,7 @@ static const TCGTargetOpDef constraint_sets[] = { #undef C_O1_I3 #undef C_O1_I4 #undef C_N1_I2 +#undef C_N1O1_I1 #undef C_N2_I1 #undef C_O2_I1 #undef C_O2_I2 @@ -738,6 +742,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_N1O1_I1(O1, O2, I1) C_PFX3(c_n1o1_i1_, O1, O2, I1) #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) @@ -2988,6 +2993,7 @@ static void process_op_defs(TCGContext *s) .pair = 2, .pair_index = o, .regs = def->args_ct[o].regs << 1, + .newreg = def->args_ct[o].newreg, }; def->args_ct[o].pair = 1; def->args_ct[o].pair_index = i; @@ -3004,6 +3010,7 @@ static void process_op_defs(TCGContext *s) .pair = 1, .pair_index = o, .regs = def->args_ct[o].regs >> 1, + .newreg = def->args_ct[o].newreg, }; def->args_ct[o].pair = 2; def->args_ct[o].pair_index = i; @@ -5036,17 +5043,21 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) break; case 1: /* first of pair */ - tcg_debug_assert(!arg_ct->newreg); if (arg_ct->oalias) { reg = new_args[arg_ct->alias_index]; - break; + } else if (arg_ct->newreg) { + reg = tcg_reg_alloc_pair(s, arg_ct->regs, + i_allocated_regs | o_allocated_regs, + output_pref(op, k), + ts->indirect_base); + } else { + reg = tcg_reg_alloc_pair(s, arg_ct->regs, o_allocated_regs, + output_pref(op, k), + ts->indirect_base); } - reg = tcg_reg_alloc_pair(s, arg_ct->regs, o_allocated_regs, - output_pref(op, k), ts->indirect_base); break; case 2: /* second of pair */ - tcg_debug_assert(!arg_ct->newreg); if (arg_ct->oalias) { reg = new_args[arg_ct->alias_index]; } else { diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 856c3b18f5..54816967bc 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2595,6 +2595,7 @@ static void tcg_out_qemu_ldst_i128(TCGContext *s, TCGReg datalo, TCGReg datahi, tcg_debug_assert(!need_bswap); tcg_debug_assert(datalo & 1); tcg_debug_assert(datahi == datalo - 1); + tcg_debug_assert(!is_ld || datahi != index); insn = is_ld ? LQ : STQ; tcg_out32(s, insn | TAI(datahi, index, 0)); } else { @@ -4071,7 +4072,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(o, m, r); + return C_N1O1_I1(o, m, r); case INDEX_op_qemu_st_a32_i128: case INDEX_op_qemu_st_a64_i128: return C_O0_I3(o, m, r); From patchwork Wed Jan 10 21:52:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 761462 Delivered-To: patch@linaro.org Received: by 2002:a5d:6e02:0:b0:337:62d3:c6d5 with SMTP id h2csp2094407wrz; Wed, 10 Jan 2024 13:53:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFxXS0iP2NZIvOcFYR4vooTLRf1/zcgnBmOIx45RG/MYsGhsrC1Xd4D6/oYiiGKQ4CRW6kU X-Received: by 2002:ac8:7c49:0:b0:429:bf1b:2b49 with SMTP id o9-20020ac87c49000000b00429bf1b2b49mr160149qtv.111.1704923605656; Wed, 10 Jan 2024 13:53:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704923605; cv=none; d=google.com; s=arc-20160816; b=Fsfd8hosxeu7w4o5nlTgaJ2rbjCj/cMtjM0I32ly2OTrrocgAll/drqihDFonMmq6N 7HCtF+bfDq8xRIQxCQ8EVp1k2MQMxJ/mxB32FS6mcCl9m6BL8uQacM3/EgWL+kjqc2zl x35ko71x1MSEaEGZds4ZLBRk23pCmitV8+2FQXHNv21XN/rxaOnOZqWC40iU5QeYBavO vCP+cp1iKXMjeBnb3d10/2jpfiWmLTHX2kJBV+KP9hciEAHGfF51z5FVKaOdMjpZFza7 haM+DhtIkjcxbLz4rDMM49ts/8EWeGUzNSxhjLHtXxbnQdlUrj4VB/fwipy6Y2NpYgbe 1oew== 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=VNe84Wm/eO/XQH/99RqV1VT7/D2nQwtaPsBh5uvsHFY=; fh=v0tj5pRql4YXVB7DGuYBhfB3Z81N8oL83BHvAm6usCM=; b=vQyZbOK1T341I+XoL9EfOORDaQVgjLT/MsDgYj6FykGnpikdJQjfUcy5PyMQOJKRsY tWSF5n5cPOSKUjU+oCTd16D/PFs1pE96B+SlQJ4wypwCBdV51Wprkx93cYlV8dJCqUdE W2onW77YqfOX4FKye6t5pPPgEaxLQ5Fkd5KODxCj+ZdONujZ7a7tr45q891bF5c8L6i4 fb/yTlcVPxmuFZU6uDuHXTeZYHfNg2dqeGh37YYcMfZCzVrlybDm8T/qMCirEBsjGPKb QK+AGp8RgOzypJPEzhFt/boNkiU9nWquu/AunwwKpE5TcDihcQ2qVu8X0mnpvxM+BA0z mCvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S4YJkeK1; 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 jd21-20020a05622a719500b00429ab4014f4si3749850qtb.178.2024.01.10.13.53.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jan 2024 13:53:25 -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=S4YJkeK1; 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 1rNgV9-0003iF-3u; Wed, 10 Jan 2024 16:52: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 1rNgUx-0003fO-Cw for qemu-devel@nongnu.org; Wed, 10 Jan 2024 16:52:31 -0500 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNgUt-0005k7-C1 for qemu-devel@nongnu.org; Wed, 10 Jan 2024 16:52:28 -0500 Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-7831362c9bcso356011985a.1 for ; Wed, 10 Jan 2024 13:52:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704923546; x=1705528346; 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=VNe84Wm/eO/XQH/99RqV1VT7/D2nQwtaPsBh5uvsHFY=; b=S4YJkeK12jwLuaSCbYc56I/O5CQa+IiWGgvr3WCpBP1ctclCWCykRYTbWxGwyop81d Hgbo1XecebJ83kSPkKiWyfFMgFMp0PjdB3XIMa6bz+geml7PFEbqpIIf0wQEjbw0ovQG TZugNPSo9F1q7symZnEJUs94Uo0/iU5sJ/ZCpxylUG8nixOp7ucPcUTHQ2ac1YhIyHc+ vLZ2hHpYBIUNynMdy42wZcHNdF86bx6tChTfCg1VJSSQN3vNAVvGwYToHMHbQBX7l2Y/ oZxqqIa127mHFVBMsgmQHASDfbb1Lfc19GicpMcrWSh2q45HhX2abB/eF5cv3khEb0lu JeXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704923546; x=1705528346; 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=VNe84Wm/eO/XQH/99RqV1VT7/D2nQwtaPsBh5uvsHFY=; b=a891wmEh0fDjUyBmME4J+xoQwKNFiy9v9Y6/mc0LtZhcMvsOXil70lCCGedapYpERr mehvFQvezxRSf+mlPCcsxEM5j+zLt3WyGtME0UJTf6C1X3p+9ojBrEdFP/IxqZQiBkdZ ORJ+ulC05GrCUNv5jP+uoyuaKLlQb6PlCD1mZwPnTtBLDZdkeQPZmFmzLl5atmNkd+bX XbWgcCY9eIrTXdnvOGOQwWdbV+vk3/ux6IHCp20tUobwZLP7L65O0BkiFlwzPdo2md/9 MxSey4kRt7vTKaHv0m4iKsBNyOK+dXDeflOwnBhfonIp5S7viAakjDutrxRlslpXyiCt iRJw== X-Gm-Message-State: AOJu0YxgT9DknlDt/+A928LYwje4XQX6ZyKQYbGtMgBL6NCB+vONIPGB b8dAE4RdRE0mgrBAoqbnUgtU3Kcr54XJN/On/fpxIf+xxa3CwpAU X-Received: by 2002:a05:620a:2589:b0:783:1a6e:99bd with SMTP id x9-20020a05620a258900b007831a6e99bdmr256898qko.53.1704923546267; Wed, 10 Jan 2024 13:52:26 -0800 (PST) Received: from stoup.. ([172.58.27.160]) by smtp.gmail.com with ESMTPSA id z8-20020ae9c108000000b0078313c87609sm1888387qki.100.2024.01.10.13.52.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 13:52:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Natanael Copa , qemu-stable@nongnu.org Subject: [PULL 4/4] util: fix build with musl libc on ppc64le Date: Thu, 11 Jan 2024 08:52:04 +1100 Message-Id: <20240110215204.9353-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110215204.9353-1-richard.henderson@linaro.org> References: <20240110215204.9353-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72c; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x72c.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 From: Natanael Copa Use PPC_FEATURE2_ISEL and PPC_FEATURE2_VEC_CRYPTO from linux headers instead of the GNU specific PPC_FEATURE2_HAS_ISEL and PPC_FEATURE2_HAS_VEC_CRYPTO. This fixes build with musl libc. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1861 Signed-off-by: Natanael Copa Fixes: 63922f467a ("tcg/ppc: Replace HAVE_ISEL macro with a variable") Fixes: 68f340d4cd ("tcg/ppc: Enable Altivec detection") Message-Id: <20231219105236.7059-1-ncopa@alpinelinux.org> Signed-off-by: Richard Henderson --- util/cpuinfo-ppc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/cpuinfo-ppc.c b/util/cpuinfo-ppc.c index 1ea3db0ac8..b2d8893a06 100644 --- a/util/cpuinfo-ppc.c +++ b/util/cpuinfo-ppc.c @@ -6,10 +6,10 @@ #include "qemu/osdep.h" #include "host/cpuinfo.h" +#include #ifdef CONFIG_GETAUXVAL # include #else -# include # include "elf.h" #endif @@ -40,7 +40,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void) info |= CPUINFO_V2_06; } - if (hwcap2 & PPC_FEATURE2_HAS_ISEL) { + if (hwcap2 & PPC_FEATURE2_ISEL) { info |= CPUINFO_ISEL; } if (hwcap & PPC_FEATURE_HAS_ALTIVEC) { @@ -53,7 +53,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void) * always have both anyway, since VSX came with Power7 * and crypto came with Power8. */ - if (hwcap2 & PPC_FEATURE2_HAS_VEC_CRYPTO) { + if (hwcap2 & PPC_FEATURE2_VEC_CRYPTO) { info |= CPUINFO_CRYPTO; } }