From patchwork Tue Dec 10 16:16:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848821 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416632wrn; Tue, 10 Dec 2024 08:20:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUfzQUavHk1Th3JQxc/Eu+oiW3a/zgtWRptDSWZG4PlrpVRGhTIn0ppsEx7GsjVILklcRVi4Q==@linaro.org X-Google-Smtp-Source: AGHT+IGIfOvF9UdXW9uZiRPEUrLqatPa8HHm4l99ttPOBudj0MeTixCob+IDQDBrGIWm3msTW1dc X-Received: by 2002:a05:620a:46a2:b0:7b6:dd82:ac9c with SMTP id af79cd13be357-7b6dd82afc6mr755875485a.12.1733847636269; Tue, 10 Dec 2024 08:20:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847636; cv=none; d=google.com; s=arc-20240605; b=SbB+9n/64u3ZnBHaN+nhGyrAyF8viW2KVMQSKu35IxNkkRMuVklAEPp0N7hhBf2JIk a62CGiGmRytvfsIvcseyJ/+bhTCrN5MsBcRqIbc0TSGSfAR4ypW01FchVkWSRIdIYLLL i/DVB5UUb3nI4S0y07/L3qxXF+OsfsU72by0kPchcxlPqd+KghVsmjREno8oo17ugNoT Hcq0wyuB6ua53TJnX4AtEYjVtkh+aUj5BbeJ3Pbx9iLDzZ+YZqCRiHR+RnlAKnRAiu1m MVVNikSFGGdEnyaSk/OCInxK89aQaheUEYreU//HVKkeLs1HyiiqEGdOpYbUHywQ9QFm SuCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=fQWBBpBVBB2pYpCBMt9NLIFTJDB68D9O686ayP1ZAos=; fh=OZQBfL75rC14cCDy3q+1fYHCs9KjWAQ7ZJ3hTfS+5lQ=; b=Zu/eDJFx8fJk8jUVmXKxGONCDAsBc8rr7kFF/1kH5TdGkh9Y3MGnNo83lMdwGmlrub 0GpFUekoqpRKaBxScFEMOsc0kalIrSQXBjio5DZ8+RIvMR6HtAUn8N6p4Nk1zFuWzuFT ci0B7oV6nOXjOCb+jNJ21rGfQKd6rVtkiZC3wsyQx0r4smckZbHAA15IL7hEhFVlyHfM VFryuYy3/ObEuj5ihO0Pb2OfyPvn7lwF9GgEHw2VSSiciO0gMou/BpOx/GazUeHfQmpf Zv2e/kgEIURFUF3wwEjbj1Qv5/NjCNnvnBev0zZhyTgBooSG5v+uBf89IforjWBOnDmY HITw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YWnXYVc0; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6b5ad2f2bsi1429713485a.673.2024.12.10.08.20.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20: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=YWnXYVc0; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2vv-0002Pi-P7; Tue, 10 Dec 2024 11:17:59 -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 1tL2vl-0002Nl-MM for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:17:49 -0500 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2vj-0006FO-N0 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:17:49 -0500 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2ffd6af012eso61404831fa.2 for ; Tue, 10 Dec 2024 08:17:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847466; x=1734452266; 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=fQWBBpBVBB2pYpCBMt9NLIFTJDB68D9O686ayP1ZAos=; b=YWnXYVc0tmd1bzs1oOkY34Rh6wvbWSkNERxRKVK6YGFH3VxG7BGASPbyqrThoyaaEk L4dcKaTcF5849CXBd8ZJAIlDiL+mm+AF6XtcNCem6tzZ5qKcsanIo/pYhsRR8+mbRLCl V3s/ar5DHNwfdYv9j+dFwpp24n9LkaWuCMN/t2GcuBojhdYBll33uAyfIXZpbb1pGKeN R8DmEnG5il4/dx5Vg21nYdy49xG9Eept02aYAxfQsucPNuZwCakc7AN8h8OaaL/iC3w1 HYYQOZ1737y72mEjfncdApbmIAxBdfY6nPUKjkvkP1LR53rjQlW/f+tqVWWE5BaHdakK L2RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847466; x=1734452266; 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=fQWBBpBVBB2pYpCBMt9NLIFTJDB68D9O686ayP1ZAos=; b=PEc+ugNiZKj5psRiqBNzgkQPKIBXCmhppJL8faVd1q6iW/mcPeAk8y+uuWI+kacXp8 9ljXMqvxvJ63NzCR0C3NbqiZm1vhBLk8XyySYmHA61HoDqS29FnL7uc4lmT2oRCSkW7i Q3h9wC7y0gA/seyBwVvMlZc+zRV/lnTulcSAbmJlejlbv7HIm8kbRHImQVWTt8y4gnpq rb3ztB9thVCNG8nWmbm0LWe0m9mdHKMXv7dwX5Lve5MnIa9TIYwe4coFZPJjbeP0DKcm gNynPoBsNs9MUnuseFYVAyxn02DsPjW/0R7KVGkbELudpZdk5Y0d3Qijl2coru+fGkMy BrKA== X-Gm-Message-State: AOJu0YwYnObDrKghGtBnSmC0O5TUv/k6NxGVTbahfhRvpoE+CAw+Zz9X GeYWNUpZ7sNZIYEVMxJPMpwKjQSrHY2U1WN0FNqbXj9LGOBZzxso4uJ6G1/JFaNyIjqkUdoZlXv atGFkZPam X-Gm-Gg: ASbGnctg5opS78cUg/aCrGkYabgb2QnRnY5uP8zXkLMLyyjCFcWy1TKX8mn5DyMhH7F 92NAtAY8HSFswtsF/c+Vfz4WFKPTbi6NN5DP+fVCewe+2ADDpEK8TfdLlpFnvDt0XB38hRxvaIT qYvOs/tvPnr59NWQ549ipUQmMF5fUQ0sipcGvqS6PLqKyihmLavz6WFAyEt1PJ5vLVrAb4lFFl9 HLhCoee3iHIA8EsEffubkIeyi//04dXlITOyKDppXq6GCBTa39qxSKx28Q= X-Received: by 2002:a05:6512:230b:b0:540:2022:e3c8 with SMTP id 2adb3069b0e04-5402410762dmr1996437e87.41.1733847465740; Tue, 10 Dec 2024 08:17:45 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.17.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:17:45 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 01/69] target/arm: Add section labels for "Data Processing (register)" Date: Tue, 10 Dec 2024 10:16:25 -0600 Message-ID: <20241210161733.1830573-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::233; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x233.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 At the same time, use ### to separate 3rd-level sections. We already use ### for 4.1.92 Data Processing (immediate), but not the two following two third-level sections: 4.1.93 Branches, and 4.1.94 Loads and stores. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/tcg/a64.decode | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 331a8e180c..d28efb884d 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -161,7 +161,7 @@ UBFM . 10 100110 . ...... ...... ..... ..... @bitfield_32 EXTR 1 00 100111 1 0 rm:5 imm:6 rn:5 rd:5 &extract sf=1 EXTR 0 00 100111 0 0 rm:5 0 imm:5 rn:5 rd:5 &extract sf=0 -# Branches +### Branches %imm26 0:s26 !function=times_4 @branch . ..... .......................... &i imm=%imm26 @@ -291,7 +291,7 @@ HLT 1101 0100 010 ................ 000 00 @i16 # DCPS2 1101 0100 101 ................ 000 10 @i16 # DCPS3 1101 0100 101 ................ 000 11 @i16 -# Loads and stores +### Loads and stores &stxr rn rt rt2 rs sz lasr &stlr rn rt sz lasr @@ -649,6 +649,21 @@ CPYP 00 011 1 01000 ..... .... 01 ..... ..... @cpy CPYM 00 011 1 01010 ..... .... 01 ..... ..... @cpy CPYE 00 011 1 01100 ..... .... 01 ..... ..... @cpy +### Data Processing (register) + +# Data Processing (2-source) +# Data Processing (1-source) +# Logical (shifted reg) +# Add/subtract (shifted reg) +# Add/subtract (extended reg) +# Add/subtract (carry) +# Rotate right into flags +# Evaluate into flags +# Conditional compare (regster) +# Conditional compare (immediate) +# Conditional select +# Data Processing (3-source) + ### Cryptographic AES AESE 01001110 00 10100 00100 10 ..... ..... @r2r_q1e0 From patchwork Tue Dec 10 16:16:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848805 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp415603wrn; Tue, 10 Dec 2024 08:18:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVQdZWhRDydv+jQEUt4MwwkQq7nX6FLys2Hy9UL0/d4BvQe6ru+MTEuxt/ckYbelBB3YL6F7g==@linaro.org X-Google-Smtp-Source: AGHT+IH4jehD4HkPZHQfBHaUSx8aQSAA4EE+bp4N1AG1jK5vcmniZgkq6Q0ryTYUAfgskKDkPHjY X-Received: by 2002:a05:6214:2aa7:b0:6ce:2357:8a2e with SMTP id 6a1803df08f44-6d91e411d20mr82553256d6.37.1733847525959; Tue, 10 Dec 2024 08:18:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847525; cv=none; d=google.com; s=arc-20240605; b=FhGFrflfpEEZvzRc5r4QxqfRC4NjCf4/PV42GCxl67ltz1V1XMFeDCt1W0vppY3H/Y aA3F1PI3V1RUug+7dMbfPrUAwTNq28hWY+IdM1+SP2T8kGfAamAhEicuwB66ammS21WF GT22BuL2Z/NiCs8adcf8qZsvVkMr/YmbHhVfHP1W0QWrJ/RnGpOsR+yoGWa1HKA6SAe5 yt7sFbf2OeSjUr0zohOHPbqesWyNYuR12yj3C+lx8LJ/M1n1PFRwFMoxjZcCGcPfUL1K oQpAfww2A/CTO5A/OeJNi/Uin7FzFe53ZFfcFyO0LRcbQRBcQIec1r7aRMf+8CWaisJ/ GwcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=ifcSfCHSTTtxXndi5QQbGHpzoZtEugLsXBXrGvDqkmU=; fh=OZQBfL75rC14cCDy3q+1fYHCs9KjWAQ7ZJ3hTfS+5lQ=; b=i9wEjUqzU/y08vteENsz0PlOSuUYbPqqcKqo1lzB1WqyPff7womnU/cf8mjRllIVki B8p7buTPWcemlApv386TeMc59zsEe9jU5iI8LhZHj1DoOnHZbdTAmXhMj9SkHuxDFtIs AUYTVuDSNISXq5Ge7ccyb7jDiXU2/BxAzziUQcX4mpuV4PNSY2NpIcQT6UzUQzE6ruRZ +OhYg87SaKsuGqCXF2k5xhidNi0kAYnJNEknQhwunfSQcfPgqSuKSzpNpGYFXpKbqZ/N wptqxiTwIgvhEu6sOXcOsh5aKPnHGMK2XpglSj1Axlrodqma0QYZn7UbwjfbR76Megsw 8KQg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w3yHLz2Q; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8dac0b2b1si7748426d6.386.2024.12.10.08.18.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:18:45 -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=w3yHLz2Q; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2vx-0002RA-En; Tue, 10 Dec 2024 11:18:01 -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 1tL2vr-0002OP-HE for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:17:57 -0500 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2vo-0006GZ-HH for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:17:54 -0500 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-5401c52000fso2375107e87.2 for ; Tue, 10 Dec 2024 08:17:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847470; x=1734452270; 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=ifcSfCHSTTtxXndi5QQbGHpzoZtEugLsXBXrGvDqkmU=; b=w3yHLz2QxsG2UDyAXUuIeXMR0a6SduLCrpnImiKEUe5xCQj4hP3K27vdBaV5W+0gIy Eyj1NFgrGB1BsKXPUw8dA0ElzhwxbkSIcAaJJjaCHLWcXInkqyLC5d3lqrJYtsg8b9lK lNYWFKD5GmF4azcN1R86wn8dF9JV5olpN70WeF8DYfc640Ujk3J19OvbtTBSSqW/h+/q 2CaGhb7KzIMO+1T83Y6v2w0iSDJCMRdouYuSfRgXXgtJRAgjV7oUAT3jmh98VQnT2z+f eleYmY3YKeAUcJuTMLj+TF725db+X6JBDFWJXIWPYF6PjjYTOUIQ386XiQPa+t4mlgZg rVOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847470; x=1734452270; 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=ifcSfCHSTTtxXndi5QQbGHpzoZtEugLsXBXrGvDqkmU=; b=naqbG5khHce/age+syuowm6sN0ITajdqqQUUry+GBgqcYFr/Q7fXu3YARFKGmaQqzX DDD9gq/l0b3Qm8VseCOr6+xxuvaL1Ft/F3sqCrDGZC7Y60fAaWVsMol0EcZnggSdSrD7 1TOv/T/RdjR4ffVXr0wpRXENGDP+hHEjvShFYn/VJ6xUWAb8pbalvlxEzqxJxlqprJiI D+zD7veK3zmyGXMzjYAApGn39vVxn3cXCTXJerioCcCfuevruDZ7CNgcVvVOC9gE45l5 EmjjoHXJjQBXIULvlkxXc1A18Vjq8GDha1QH2tw/uaKQ+ltO6cJrGE5VjiyemT7qyQfN 3fHg== X-Gm-Message-State: AOJu0Ywi1GFuayP0J0hXTAsOEqJAyEAEo8LPXO7MeBraQppqo6RDYy3+ rKJ/fSQ+XUTA+Wx79LoPmIMpKJxcxFOBqbt/+fkvqxWWon/UihRJ/fK2usC1oaWUK3vt1II9LhD dzRmw7RqA X-Gm-Gg: ASbGncuwbIf8N1CAkDYU0/+OfB5KOiw0TNme5uhhfYauoqyic1TTD5gd+BRfXud9NQP rBRjZzKi8+mmjviZ42QExTSFUUV68tOVePjfVgweHbFPkNPc6AYSmXMBMDKAAA5Rr1vVN//NiAi gYHkanCNTHxicLrnrv9+H95v76ycxzRQeOf9cfJXxB3J70W9sx9Iev+EzKSCoiHHrTYZBrM0qU8 4q5nRekacZ8hBTEtRud5HUzvxzHv68SEwszOYovL+/tO3u0sbOQvzXQ/1M= X-Received: by 2002:a05:6512:118e:b0:53e:2789:ffd0 with SMTP id 2adb3069b0e04-540241048famr2202298e87.43.1733847470303; Tue, 10 Dec 2024 08:17:50 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.17.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:17:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 02/69] target/arm: Convert UDIV, SDIV to decodetree Date: Tue, 10 Dec 2024 10:16:26 -0600 Message-ID: <20241210161733.1830573-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x135.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 64 +++++++++++++++++----------------- target/arm/tcg/a64.decode | 7 ++++ 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index b2851ea503..9f687ba840 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7485,6 +7485,36 @@ TRANS(UQRSHRN_si, do_scalar_shift_imm_narrow, a, uqrshrn_fns, 0, false) TRANS(SQSHRUN_si, do_scalar_shift_imm_narrow, a, sqshrun_fns, MO_SIGN, false) TRANS(SQRSHRUN_si, do_scalar_shift_imm_narrow, a, sqrshrun_fns, MO_SIGN, false) +static bool do_div(DisasContext *s, arg_rrr_sf *a, bool is_signed) +{ + TCGv_i64 tcg_n, tcg_m, tcg_rd; + tcg_rd = cpu_reg(s, a->rd); + + if (!a->sf && is_signed) { + tcg_n = tcg_temp_new_i64(); + tcg_m = tcg_temp_new_i64(); + tcg_gen_ext32s_i64(tcg_n, cpu_reg(s, a->rn)); + tcg_gen_ext32s_i64(tcg_m, cpu_reg(s, a->rm)); + } else { + tcg_n = read_cpu_reg(s, a->rn, a->sf); + tcg_m = read_cpu_reg(s, a->rm, a->sf); + } + + if (is_signed) { + gen_helper_sdiv64(tcg_rd, tcg_n, tcg_m); + } else { + gen_helper_udiv64(tcg_rd, tcg_n, tcg_m); + } + + if (!a->sf) { /* zero extend final result */ + tcg_gen_ext32u_i64(tcg_rd, tcg_rd); + } + return true; +} + +TRANS(SDIV, do_div, a, true) +TRANS(UDIV, do_div, a, false) + /* Shift a TCGv src by TCGv shift_amount, put result in dst. * Note that it is the caller's responsibility to ensure that the * shift amount is in range (ie 0..31 or 0..63) and provide the ARM @@ -8425,32 +8455,6 @@ static void disas_data_proc_1src(DisasContext *s, uint32_t insn) #undef MAP } -static void handle_div(DisasContext *s, bool is_signed, unsigned int sf, - unsigned int rm, unsigned int rn, unsigned int rd) -{ - TCGv_i64 tcg_n, tcg_m, tcg_rd; - tcg_rd = cpu_reg(s, rd); - - if (!sf && is_signed) { - tcg_n = tcg_temp_new_i64(); - tcg_m = tcg_temp_new_i64(); - tcg_gen_ext32s_i64(tcg_n, cpu_reg(s, rn)); - tcg_gen_ext32s_i64(tcg_m, cpu_reg(s, rm)); - } else { - tcg_n = read_cpu_reg(s, rn, sf); - tcg_m = read_cpu_reg(s, rm, sf); - } - - if (is_signed) { - gen_helper_sdiv64(tcg_rd, tcg_n, tcg_m); - } else { - gen_helper_udiv64(tcg_rd, tcg_n, tcg_m); - } - - if (!sf) { /* zero extend final result */ - tcg_gen_ext32u_i64(tcg_rd, tcg_rd); - } -} /* LSLV, LSRV, ASRV, RORV */ static void handle_shift_reg(DisasContext *s, @@ -8552,12 +8556,6 @@ static void disas_data_proc_2src(DisasContext *s, uint32_t insn) } } break; - case 2: /* UDIV */ - handle_div(s, false, sf, rm, rn, rd); - break; - case 3: /* SDIV */ - handle_div(s, true, sf, rm, rn, rd); - break; case 4: /* IRG */ if (sf == 0 || !dc_isar_feature(aa64_mte_insn_reg, s)) { goto do_unallocated; @@ -8616,6 +8614,8 @@ static void disas_data_proc_2src(DisasContext *s, uint32_t insn) } default: do_unallocated: + case 2: /* UDIV */ + case 3: /* SDIV */ unallocated_encoding(s); break; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index d28efb884d..c218f6afbc 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -28,6 +28,7 @@ &r rn &ri rd imm &rri_sf rd rn imm sf +&rrr_sf rd rn rm sf &i imm &rr_e rd rn esz &rri_e rd rn imm esz @@ -652,6 +653,12 @@ CPYE 00 011 1 01100 ..... .... 01 ..... ..... @cpy ### Data Processing (register) # Data Processing (2-source) + +@rrr_sf sf:1 .......... rm:5 ...... rn:5 rd:5 &rrr_sf + +UDIV . 00 11010110 ..... 00001 0 ..... ..... @rrr_sf +SDIV . 00 11010110 ..... 00001 1 ..... ..... @rrr_sf + # Data Processing (1-source) # Logical (shifted reg) # Add/subtract (shifted reg) From patchwork Tue Dec 10 16:16:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848808 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416145wrn; Tue, 10 Dec 2024 08:19:44 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU9GOzjWtVria1SWTvVz9N8KwxAB2sEqYzN2FMg8hYzT8X3ghdmmrb64Uw1BECJYtxhm1bY5Q==@linaro.org X-Google-Smtp-Source: AGHT+IFD9MFSwM+OZ2usWWZ04kNrOdJgJL+XGXHBErzLMvygOs2hKlXiUZCX39WnP1vNPdfQjInr X-Received: by 2002:a05:6102:3750:b0:4b1:130f:9fd3 with SMTP id ada2fe7eead31-4b1130fa18bmr6607708137.15.1733847583918; Tue, 10 Dec 2024 08:19:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847583; cv=none; d=google.com; s=arc-20240605; b=R0F+z3uBVB/I0Cflv72SZlpjcfe0Ms0YKs3QLN8RdPYROJ2Wnk5GLCHpvDTf2+Ayq5 zwm66GRBTMv8ZURNbGFPs31UoXvDoOztL+bFAY4m/0OBkLDAItAqI0oTNQ8x5SRnb48I s27EcvGGCPtDQcOP+ZTK61FJ3FLXFWbLKC5vHVILnBMJw2/3swBfmgX9/Yy4nfHMq8wd VRfBvO0Gi8LyrDEy4ZVRoP7hlUZh63Ll/+LtyeFFUqx8GIGdKkfHUPtmZKvET9fFcOjd 87B+Ykq1d74ihU37x9mP4CzymhuRQGYMWz9/pTGPMncuyBVoBLy2iXf7xD2iORMVG3fz uSBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=s63N5H1NJdR8gVUhJ6lBSzQfPRwDYdjmVxlruA0DAg4=; fh=OZQBfL75rC14cCDy3q+1fYHCs9KjWAQ7ZJ3hTfS+5lQ=; b=MEPj1N0lTx1694BSYne1fQ+nCnEfizoUgu7eIyj/dUp9uiE/w09I6dcd01LUkKogEI y3VafZh6cmvePzaJa5nCJAvuWAilaum3lul76XO+s51MvQqB6sPKqzMduaEpGguvc2le VrN/wFtTkMLtv8MgxJhamiQxofalQ2wxfKT+yBm35u3GrhGKV4bAa6AUbYXHdrMxkHOW G6ugQHVHff/ZkLVEOYJ9VlLzaWpkUXDomK++BVDMvkAvYZG2E9G1Iy7lj/JmkFM/Nxi6 5DyA2Vfx9YjCMuIjx/GJ34xMQv5MX179F2otaRmDJyFaI0Z0kcin7daqGZktomBwEz5x 5BbQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ox+l6cQQ; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4afdf1b9cb4si1749650137.478.2024.12.10.08.19.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:19:43 -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=Ox+l6cQQ; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2vw-0002QS-Vo; Tue, 10 Dec 2024 11:18:01 -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 1tL2vv-0002Pj-2T for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:17:59 -0500 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2vt-0006HC-Bl for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:17:58 -0500 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-53e3a37ae07so3463462e87.3 for ; Tue, 10 Dec 2024 08:17:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847475; x=1734452275; 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=s63N5H1NJdR8gVUhJ6lBSzQfPRwDYdjmVxlruA0DAg4=; b=Ox+l6cQQYRcdlnVW4dTu3jv3OdfLjyWTDXRVEankWwhxnO89hnmcxySDkakYFlr7qA TGNF+d5x0OASGOBRnArPuOnXSOFHeWghYJJZ1jGqSmPx1wiKJrxlii7fsxfNG4xyz2oG 17IVJTZ/xcRRLdDUs/mVB5Bv7izEYTtPRjbmHXHZlsnSSIDiGgBbqlL12KTGoXKoCFVu M/2I61mnC33pIGebPhNeblah1EyBF15JwLmgvHTh9Hmr/ry/9OK97MQ8pqXMp33SVD2S 3v1kO/PFtNQcptGhqT46cuVuILHgXD38teQgKCriXdzYTpC73W1iYVqv09UeZC5V/ohT TLxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847475; x=1734452275; 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=s63N5H1NJdR8gVUhJ6lBSzQfPRwDYdjmVxlruA0DAg4=; b=lrxgreKHBdgJZufDt5Pma/mJQTB8AvpuZoHybPscFe2Hu+QYe3n+2ikqkTKYNxD8a2 tGRYp+0rdnkvNm7RpBUg5h8KYhXfmvnaedrDlsp6hGYpSjNDmOEICYU7qqLgdZX2LcfR NTgE66oiKnhMSRm8BfRbbqXBQDzSoEzgf2FRZDQdq5sPbGxLRPtjymNc67zqPsUMo2AK Ys+GcsdLRfaID1LyWOBER+Z7HsVFt6pqhusNoT++Dkhn4hXP/FhwpW8ld1o3T4nksjYO UR68AF0dIxEmGCyl6Ghh/bCLqFUDncAf+EmXh8VSbeNDEvv3QXxNzQOVXKtgJiDJ8ElM yCVg== X-Gm-Message-State: AOJu0Yw0O3sz1TgOwtcO27BeC36k+nBillepYTAfBuEr+Prqu0o3iLOC fADGSMnTm3nJcG5ktVIO56SU2gKNmty+dFCVY78+AnZcw5eTgyVSx5qQmAdKmaSSYw4/D18hPKY BZFVpOTIm X-Gm-Gg: ASbGncuN0Vk6T76RxPT7fAVRSLboDkuGf8BwulaMYQLArfvTF2SrRStcBprrAfaFA0q CF2lAuTv+o3AVuu1alPIRNU0dYaE38jZMPgDmERFUZ+qx0nvy0fpBuesw7Sm8uIk+Z9hsuTThao oLZ4GL+D51nNK0QE0OiXVCh95QR94alH3haytar9/7Hx/Kw4qrpKloLff2ZpM+WH3rr56sGAGeM ydXtHiITHNMo1meIif1lV9cCbj2YQAUfQXIyuNigPTPBKu1cKW7kudmF7A= X-Received: by 2002:a05:6512:3e19:b0:53e:3a53:f884 with SMTP id 2adb3069b0e04-53e3a53f931mr5111988e87.35.1733847474913; Tue, 10 Dec 2024 08:17:54 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.17.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:17:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 03/69] target/arm: Convert LSLV, LSRV, ASRV, RORV to decodetree Date: Tue, 10 Dec 2024 10:16:27 -0600 Message-ID: <20241210161733.1830573-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x131.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 46 ++++++++++++++++------------------ target/arm/tcg/a64.decode | 4 +++ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 9f687ba840..8b7ca2c68a 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7575,6 +7575,23 @@ static void shift_reg_imm(TCGv_i64 dst, TCGv_i64 src, int sf, } } +static bool do_shift_reg(DisasContext *s, arg_rrr_sf *a, + enum a64_shift_type shift_type) +{ + TCGv_i64 tcg_shift = tcg_temp_new_i64(); + TCGv_i64 tcg_rd = cpu_reg(s, a->rd); + TCGv_i64 tcg_rn = read_cpu_reg(s, a->rn, a->sf); + + tcg_gen_andi_i64(tcg_shift, cpu_reg(s, a->rm), a->sf ? 63 : 31); + shift_reg(tcg_rd, tcg_rn, a->sf, shift_type, tcg_shift); + return true; +} + +TRANS(LSLV, do_shift_reg, a, A64_SHIFT_TYPE_LSL) +TRANS(LSRV, do_shift_reg, a, A64_SHIFT_TYPE_LSR) +TRANS(ASRV, do_shift_reg, a, A64_SHIFT_TYPE_ASR) +TRANS(RORV, do_shift_reg, a, A64_SHIFT_TYPE_ROR) + /* Logical (shifted register) * 31 30 29 28 24 23 22 21 20 16 15 10 9 5 4 0 * +----+-----+-----------+-------+---+------+--------+------+------+ @@ -8456,19 +8473,6 @@ static void disas_data_proc_1src(DisasContext *s, uint32_t insn) } -/* LSLV, LSRV, ASRV, RORV */ -static void handle_shift_reg(DisasContext *s, - enum a64_shift_type shift_type, unsigned int sf, - unsigned int rm, unsigned int rn, unsigned int rd) -{ - TCGv_i64 tcg_shift = tcg_temp_new_i64(); - TCGv_i64 tcg_rd = cpu_reg(s, rd); - TCGv_i64 tcg_rn = read_cpu_reg(s, rn, sf); - - tcg_gen_andi_i64(tcg_shift, cpu_reg(s, rm), sf ? 63 : 31); - shift_reg(tcg_rd, tcg_rn, sf, shift_type, tcg_shift); -} - /* CRC32[BHWX], CRC32C[BHWX] */ static void handle_crc32(DisasContext *s, unsigned int sf, unsigned int sz, bool crc32c, @@ -8579,18 +8583,6 @@ static void disas_data_proc_2src(DisasContext *s, uint32_t insn) tcg_gen_or_i64(cpu_reg(s, rd), cpu_reg(s, rm), t); } break; - case 8: /* LSLV */ - handle_shift_reg(s, A64_SHIFT_TYPE_LSL, sf, rm, rn, rd); - break; - case 9: /* LSRV */ - handle_shift_reg(s, A64_SHIFT_TYPE_LSR, sf, rm, rn, rd); - break; - case 10: /* ASRV */ - handle_shift_reg(s, A64_SHIFT_TYPE_ASR, sf, rm, rn, rd); - break; - case 11: /* RORV */ - handle_shift_reg(s, A64_SHIFT_TYPE_ROR, sf, rm, rn, rd); - break; case 12: /* PACGA */ if (sf == 0 || !dc_isar_feature(aa64_pauth, s)) { goto do_unallocated; @@ -8616,6 +8608,10 @@ static void disas_data_proc_2src(DisasContext *s, uint32_t insn) do_unallocated: case 2: /* UDIV */ case 3: /* SDIV */ + case 8: /* LSLV */ + case 9: /* LSRV */ + case 10: /* ASRV */ + case 11: /* RORV */ unallocated_encoding(s); break; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index c218f6afbc..3db55b78a6 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -658,6 +658,10 @@ CPYE 00 011 1 01100 ..... .... 01 ..... ..... @cpy UDIV . 00 11010110 ..... 00001 0 ..... ..... @rrr_sf SDIV . 00 11010110 ..... 00001 1 ..... ..... @rrr_sf +LSLV . 00 11010110 ..... 00100 0 ..... ..... @rrr_sf +LSRV . 00 11010110 ..... 00100 1 ..... ..... @rrr_sf +ASRV . 00 11010110 ..... 00101 0 ..... ..... @rrr_sf +RORV . 00 11010110 ..... 00101 1 ..... ..... @rrr_sf # Data Processing (1-source) # Logical (shifted reg) From patchwork Tue Dec 10 16:16:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848852 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp419894wrn; Tue, 10 Dec 2024 08:26:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXo3FHUStj8hFpbHdu5gkJoY/tacGsIgB731kvxqVlWSWIXrgx8XmfnMKvEbXwCFh59jU8Y/A==@linaro.org X-Google-Smtp-Source: AGHT+IFCLCNvLhG8C9rSBEWZs/BjHVqk8xpT9ow6Bjpytge58+o3BV38x03qWt788geVB2Rdvi6I X-Received: by 2002:ad4:5be5:0:b0:6d8:9c92:6544 with SMTP id 6a1803df08f44-6d91e34178emr87103196d6.7.1733847992785; Tue, 10 Dec 2024 08:26:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847992; cv=none; d=google.com; s=arc-20240605; b=T/ZPXIV/36aAGq4LfZ3M6gpth2wM4xyHMWpbYHgLgPX6nHOPp416yctq+9+3aL7fIQ Wc60iqEVqug8DqY7aoKqn7ay+KTMMZhmdxbglWBklCDIicD7nqKGBPUojZGMt92rlPKv jrMGEaZ+nQ7TRPAizQ8J+7pfIni9ecCHsOqkNleTBMQ2R4VSBg7GjS3yhxrqHdUl+w/o 2B5ZRbJo44KpJAEenVZnCwUPBuBiNX9Uq4ShU8ZVSheq7uNstXySao/OYPiC/LB+njcN gxIRGcwvrtcijn1ZfhDIHYHAzNxjjG0l1/Y/OTJNmdZJZtejx9LMXbZYobc8uZ0b8a9e YpYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=4AznEk9/hIp6KCRRVqDdnFfH0hvsbNa1L/nyYxE6eHM=; fh=OZQBfL75rC14cCDy3q+1fYHCs9KjWAQ7ZJ3hTfS+5lQ=; b=SR2PF3anqp3syv0B90ojt9jsJ58SgGsLUjd0mE1UqzNjpeddTw8VG20P/BUS3D6Juz GfvJJ3f7aWj6xM9MYdbYy1gnUKakn5zEabNVFVSVluYL5E0npAE4JPsAci+pjVNOqjb6 sDDs10d4rjS0klsyu7ysbcFqT0Z1FtxEs1LxjLOx3ez4cSXMeoLZmhfrONWWeOeuwF32 MsaphllTBvMDP19mQ3vpyNgr7Pc3ZhZR28R4Jgd8/aokrCRcG4ILNr+HnbXfmiju7B/E LCNTS8JxRHF6OgkCpVDg8HqDWvX+Vj7L0lZKiRWRJ8aFAdmdAmJ9JIB9wZg5ojArFMLA 40xw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jrBH9JM/"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8da67b62dsi144049266d6.105.2024.12.10.08.26.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:26:32 -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="jrBH9JM/"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2w0-0002Rc-Ev; Tue, 10 Dec 2024 11:18:04 -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 1tL2vz-0002RP-Gd for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:03 -0500 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2vw-0006Hp-Pc for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:03 -0500 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-540254357c8so1117922e87.1 for ; Tue, 10 Dec 2024 08:18:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847479; x=1734452279; 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=4AznEk9/hIp6KCRRVqDdnFfH0hvsbNa1L/nyYxE6eHM=; b=jrBH9JM/AjGV4doli5/PTEefgJFQNIE7/Cu/PBTxyRWrh7VaYfnKy8P4U3DQoGc+d5 I3NsuTpslroFIGctcvS7hpSRcYQEsD0T1zik+kkc0yPjLlX+HFKDrvrU41lNu5L9MoKc ZviJG3XlRaL0a1M1JTs5v/Ek3JhWFt97I64DRuHe46rQjiWAWRFadpianKEfj3iS4sJW TLM2rlakQr/Qz/ZM+2KMEAyLazn8dmsLbgKRfAc3eDKZFXKzWvc7vjJiA36CaWJbB7SV IGp81awW/JQA21zIIEAoxWZuMInPXuTZdrfDx5YoBbB5eNUPb+H8DLIHiLUjHf0Jk0/O 8kCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847479; x=1734452279; 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=4AznEk9/hIp6KCRRVqDdnFfH0hvsbNa1L/nyYxE6eHM=; b=FBGecKCjJL59QENsUOJyB1NOg3JxNuuaZKu1SIvpPiwNHERpylk1B1Ut42k87y8zzl P3JjyEM+UhjWLR9kCZwYwp6GKxESZn2BQxangaOEQDbcAHd+eIyVoNMN1KaCRNNJeyVt YPqjQ8M2qM8ZtB6JdbQ54YQvEH+Hzn8aJuv3l52zYwJ1vp8kHFsxlObaIUy+YCIxMB20 9Lk7kwyq4hHuJ2UF0YA+JUNG4nfK6TSkia1/fG0IncXt8fWP45oBq390mAHgZ0NtYDAo vIKcTLluUaIRTNC/5KwLDEM8r2Y++LgMJbTNjQLe8LcOLiEdUIOAMqdyVUoZc8dsrztK Il0Q== X-Gm-Message-State: AOJu0YxOQIAUvsBwMXvKtrnMsHy5uOv2R/tJuQCX9hspmI5E0QMBJwmt WEfiEolGa+bCkb6qiBVZjZpBHO9Cym0m4UHI0MXHGUbmuEH466qRAMOtRROBnGgU1lmL5IJ2JEc eg8fIjgh3 X-Gm-Gg: ASbGncsbPLLitnlAhIj51ZtGsJdMYPcGm3TMr5Azb/SwfM45/OoXbmYdeDttrY0RMr7 Keta8HNrHO52ciR/OXyFZyRFCu2kHQ+5NdFwcGuMmEMFlhDLL8BSDvAvAah659lbO5V+3LVSXCs 2NIXIECOs3kKFiu+xdspJmYBatpc0z8EDufSbpjZEtAfXcvjO3Q5E3AF3bZKuVnaDihTSi9Pcl7 8o3tBAiOvA04OEuK72tLZqizajr5YqM3yJ/aOe2lfOdDDzlxw5H7xE/M7U= X-Received: by 2002:ac2:4f0f:0:b0:53d:ed69:a593 with SMTP id 2adb3069b0e04-540240c24c8mr2002627e87.22.1733847478915; Tue, 10 Dec 2024 08:17:58 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:17:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 04/69] target/arm: Convert CRC32, CRC32C to decodetree Date: Tue, 10 Dec 2024 10:16:28 -0600 Message-ID: <20241210161733.1830573-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12d; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12d.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 101 +++++++++++++-------------------- target/arm/tcg/a64.decode | 12 ++++ 2 files changed, 53 insertions(+), 60 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 8b7ca2c68a..22594a1149 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7592,6 +7592,39 @@ TRANS(LSRV, do_shift_reg, a, A64_SHIFT_TYPE_LSR) TRANS(ASRV, do_shift_reg, a, A64_SHIFT_TYPE_ASR) TRANS(RORV, do_shift_reg, a, A64_SHIFT_TYPE_ROR) +static bool do_crc32(DisasContext *s, arg_rrr_e *a, bool crc32c) +{ + TCGv_i64 tcg_acc, tcg_val, tcg_rd; + TCGv_i32 tcg_bytes; + + switch (a->esz) { + case MO_8: + case MO_16: + case MO_32: + tcg_val = tcg_temp_new_i64(); + tcg_gen_extract_i64(tcg_val, cpu_reg(s, a->rm), 0, 8 << a->esz); + break; + case MO_64: + tcg_val = cpu_reg(s, a->rm); + break; + default: + g_assert_not_reached(); + } + tcg_acc = cpu_reg(s, a->rn); + tcg_bytes = tcg_constant_i32(1 << a->esz); + tcg_rd = cpu_reg(s, a->rd); + + if (crc32c) { + gen_helper_crc32c_64(tcg_rd, tcg_acc, tcg_val, tcg_bytes); + } else { + gen_helper_crc32_64(tcg_rd, tcg_acc, tcg_val, tcg_bytes); + } + return true; +} + +TRANS_FEAT(CRC32, aa64_crc32, do_crc32, a, false) +TRANS_FEAT(CRC32C, aa64_crc32, do_crc32, a, true) + /* Logical (shifted register) * 31 30 29 28 24 23 22 21 20 16 15 10 9 5 4 0 * +----+-----+-----------+-------+---+------+--------+------+------+ @@ -8473,52 +8506,6 @@ static void disas_data_proc_1src(DisasContext *s, uint32_t insn) } -/* CRC32[BHWX], CRC32C[BHWX] */ -static void handle_crc32(DisasContext *s, - unsigned int sf, unsigned int sz, bool crc32c, - unsigned int rm, unsigned int rn, unsigned int rd) -{ - TCGv_i64 tcg_acc, tcg_val; - TCGv_i32 tcg_bytes; - - if (!dc_isar_feature(aa64_crc32, s) - || (sf == 1 && sz != 3) - || (sf == 0 && sz == 3)) { - unallocated_encoding(s); - return; - } - - if (sz == 3) { - tcg_val = cpu_reg(s, rm); - } else { - uint64_t mask; - switch (sz) { - case 0: - mask = 0xFF; - break; - case 1: - mask = 0xFFFF; - break; - case 2: - mask = 0xFFFFFFFF; - break; - default: - g_assert_not_reached(); - } - tcg_val = tcg_temp_new_i64(); - tcg_gen_andi_i64(tcg_val, cpu_reg(s, rm), mask); - } - - tcg_acc = cpu_reg(s, rn); - tcg_bytes = tcg_constant_i32(1 << sz); - - if (crc32c) { - gen_helper_crc32c_64(cpu_reg(s, rd), tcg_acc, tcg_val, tcg_bytes); - } else { - gen_helper_crc32_64(cpu_reg(s, rd), tcg_acc, tcg_val, tcg_bytes); - } -} - /* Data-processing (2 source) * 31 30 29 28 21 20 16 15 10 9 5 4 0 * +----+---+---+-----------------+------+--------+------+------+ @@ -8590,20 +8577,6 @@ static void disas_data_proc_2src(DisasContext *s, uint32_t insn) gen_helper_pacga(cpu_reg(s, rd), tcg_env, cpu_reg(s, rn), cpu_reg_sp(s, rm)); break; - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: /* CRC32 */ - { - int sz = extract32(opcode, 0, 2); - bool crc32c = extract32(opcode, 2, 1); - handle_crc32(s, sf, sz, crc32c, rm, rn, rd); - break; - } default: do_unallocated: case 2: /* UDIV */ @@ -8612,6 +8585,14 @@ static void disas_data_proc_2src(DisasContext *s, uint32_t insn) case 9: /* LSRV */ case 10: /* ASRV */ case 11: /* RORV */ + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: /* CRC32 */ unallocated_encoding(s); break; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 3db55b78a6..1664f4793c 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -45,7 +45,9 @@ @rr_d ........ ... ..... ...... rn:5 rd:5 &rr_e esz=3 @rr_sd ........ ... ..... ...... rn:5 rd:5 &rr_e esz=%esz_sd +@rrr_b ........ ... rm:5 ...... rn:5 rd:5 &rrr_e esz=0 @rrr_h ........ ... rm:5 ...... rn:5 rd:5 &rrr_e esz=1 +@rrr_s ........ ... rm:5 ...... rn:5 rd:5 &rrr_e esz=2 @rrr_d ........ ... rm:5 ...... rn:5 rd:5 &rrr_e esz=3 @rrr_sd ........ ... rm:5 ...... rn:5 rd:5 &rrr_e esz=%esz_sd @rrr_hsd ........ ... rm:5 ...... rn:5 rd:5 &rrr_e esz=%esz_hsd @@ -663,6 +665,16 @@ LSRV . 00 11010110 ..... 00100 1 ..... ..... @rrr_sf ASRV . 00 11010110 ..... 00101 0 ..... ..... @rrr_sf RORV . 00 11010110 ..... 00101 1 ..... ..... @rrr_sf +CRC32 0 00 11010110 ..... 0100 00 ..... ..... @rrr_b +CRC32 0 00 11010110 ..... 0100 01 ..... ..... @rrr_h +CRC32 0 00 11010110 ..... 0100 10 ..... ..... @rrr_s +CRC32 1 00 11010110 ..... 0100 11 ..... ..... @rrr_d + +CRC32C 0 00 11010110 ..... 0101 00 ..... ..... @rrr_b +CRC32C 0 00 11010110 ..... 0101 01 ..... ..... @rrr_h +CRC32C 0 00 11010110 ..... 0101 10 ..... ..... @rrr_s +CRC32C 1 00 11010110 ..... 0101 11 ..... ..... @rrr_d + # Data Processing (1-source) # Logical (shifted reg) # Add/subtract (shifted reg) From patchwork Tue Dec 10 16:16:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848815 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416441wrn; Tue, 10 Dec 2024 08:20:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWaJUp2m0Ed0M1iSx3B+RXmV+8MNdh6OQetLPJM6uQLfFdkYF76IhdTY1sVA3az7bx9V8jhJw==@linaro.org X-Google-Smtp-Source: AGHT+IEe7ET+G7fVpMQzGg+6Ik4n1ZBxp8ThJYjVbJzUTB14QKW3leV+Qkcv7BxlwsQdizQmh/5S X-Received: by 2002:a05:620a:2b90:b0:7b6:c474:d87e with SMTP id af79cd13be357-7b6de6dad9cmr619269285a.10.1733847619451; Tue, 10 Dec 2024 08:20:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847619; cv=none; d=google.com; s=arc-20240605; b=VxSricoUSTt+JD1dFwLt+tWGt3uscvUXvkrFLy5k75hOueASxZEszOGBzBBoux+8Od C+SDCGmcEU1fc5pk579ttUT2+EmKJcs4jJodCDhcUzSq4hjuj9PfSAVlIIj5Y+VhWSEH tnL/PU53yu9uEb2/xeIz+SUKvxD39hvplvr2orm6C0fENDl/l7b4S2ICZMfgTwgd6Zdr dnaABiReLa0wC2ac7C8ci6qD5m7doGn3MQGH214kHeP34qaiMTnfLDsKzkVj6W8782Px VhZOCTjPV+zHGee80zxwmP05gEsJpzbNTj8bycZ2HKUJBJQMkhDoWkaErn8neCgv+1sv BHbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=XlraVMJV+QICbAoWHNIxUyq3rj5apVKNQP4YDSIMpEQ=; fh=OZQBfL75rC14cCDy3q+1fYHCs9KjWAQ7ZJ3hTfS+5lQ=; b=iHh/mJT4jEbA312NciyOkXv7dvLyhLwKWHT/eocFt1dNSnoDsCYWvh9tOsM0htu9t6 +O3SRcKZCVKkeytoKwgk994gZCZgRX26wk1yuMXXma3lHV523eNN6/FwRV3nRQsAUyg9 NVICcynXpjKFFWbD4D38tSLO6GkC5qAB906Z7oLdxss0N3HY6RMfye3sgasZ+IUwu0af nYyKAsU0G4+vvwI+FJvAxLdxPz3lHKU1AAoUIG2PkIPp9YDNxRjsW1/oV2+Dt1mj/7hx ygtgynyVLkr73LBg+KwkuBaSfnuinL4262nANQ+18OXhZ94ZSURvoLx4kOp9oBaUgJxK OJWQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ly4XxJ2o; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6d32f014bsi602250485a.595.2024.12.10.08.20.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20:19 -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=Ly4XxJ2o; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2w3-0002Sv-Hz; Tue, 10 Dec 2024 11:18:07 -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 1tL2w2-0002SJ-9B for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:06 -0500 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2vz-0006IM-KZ for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:05 -0500 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-54025432becso1161363e87.1 for ; Tue, 10 Dec 2024 08:18:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847482; x=1734452282; 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=XlraVMJV+QICbAoWHNIxUyq3rj5apVKNQP4YDSIMpEQ=; b=Ly4XxJ2o2xAtVFZy9C+XJCJus8pIzV35uaIUaALfvrQNFQwD+GqDMkdjcgYvSEjFgd +9HMfNVyCuwjp6NpUh7Rx3xFVzLfP/TWrRLE3J3Vj7RetxJUcJeS+xjOGMKbnzVkERKI 8cL2F7fSWxtPhUaqltbcHQaB8uZ92OJxdUdOgxzIBKKWENyBu8teGvn+asUz8+6aSWmJ 1Z1DBiJv0BWbKkkJYKFijZXycqA73ONbz8JYUM62lXiXC7NnkncwYZPl+8NCkEmAuRkv E7gxkuHFqL+3qSqT/6Xw0YuZ5j0e8AXDhBNWg0nD7P1d4sk2SpP97jIdx3rMF1fhC9Bc joYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847482; x=1734452282; 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=XlraVMJV+QICbAoWHNIxUyq3rj5apVKNQP4YDSIMpEQ=; b=mvqL5zeeMdlBFhz2xNa09xHdhaOiM5G6MUH+6Svz3sb/CIzixS8af/Ne+Yr1QJH70z DkQXcgTa7vkVW3KrXL2PCrnlOrwJKBSfQNL1QODc7LMoh3Ll8d7gME34QkL8lC4nUIia uFmhuYJBi67sldihSY++K8oUscMjvqGDQa02tqRrTiXOPFylWQkSkjTrZx6vr11SKuf2 Rq8r9rYrnNZZCIgFpc5J6Fjdr7msDxOmfdFAwfWqsUMPg2HXq/M2UE36J8GuVMhGkcxR L7JY2KTLzMAWRkPJccFftPZ7utDRFD/Zoopi+2XYYBxL2Y2gp97jZL665vmtrZ2mMtq/ TQ5Q== X-Gm-Message-State: AOJu0YwDn/+Z7uThmMr2Ue0vxzoMGUjdbDPMH/9n3xPQGPgZ5lgYQQQS 7FETb0Q3Q+r91YHFnyA+WtEWStVnhyGQKPnLIBnJ277SM009Jh5S+y3QK7wD1OivGNCvqXsKm7r ltML9b6mG X-Gm-Gg: ASbGncurweCPxLqh7fQZ4W+WhSCdpKgBfEfD+ootTuPgqAwV69gsWQW06V8lQgt6eBy qT8yXvxL8PACa6gD9NZcL0LC1DQDI8GGNxzOsgfo96J8KOUXB3rV+Puv9IIf2on+viza3CQIjZB WnmX/ZSLABVV+ihE0fFwcKYUU4SuCf3IQLcZ71ardxAe3S4zOYg5jI4RFrxZEYZ2qIneCe6yShU sgjVPLworFfcmwzdK2jXAK27TlIt43i4WDTsdxuteyecxhys1eRug8FFyw= X-Received: by 2002:a05:6512:ba6:b0:53e:21db:a933 with SMTP id 2adb3069b0e04-54024112f9amr1940584e87.46.1733847481947; Tue, 10 Dec 2024 08:18:01 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.17.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:18:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 05/69] target/arm: Convert SUBP, IRG, GMI to decodetree Date: Tue, 10 Dec 2024 10:16:29 -0600 Message-ID: <20241210161733.1830573-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12b.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 94 +++++++++++++++++++--------------- target/arm/tcg/a64.decode | 7 +++ 2 files changed, 59 insertions(+), 42 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 22594a1149..00e55d42ff 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7625,6 +7625,55 @@ static bool do_crc32(DisasContext *s, arg_rrr_e *a, bool crc32c) TRANS_FEAT(CRC32, aa64_crc32, do_crc32, a, false) TRANS_FEAT(CRC32C, aa64_crc32, do_crc32, a, true) +static bool do_subp(DisasContext *s, arg_rrr *a, bool setflag) +{ + TCGv_i64 tcg_n = read_cpu_reg_sp(s, a->rn, true); + TCGv_i64 tcg_m = read_cpu_reg_sp(s, a->rm, true); + TCGv_i64 tcg_d = cpu_reg(s, a->rd); + + tcg_gen_sextract_i64(tcg_n, tcg_n, 0, 56); + tcg_gen_sextract_i64(tcg_m, tcg_m, 0, 56); + + if (setflag) { + gen_sub_CC(true, tcg_d, tcg_n, tcg_m); + } else { + tcg_gen_sub_i64(tcg_d, tcg_n, tcg_m); + } + return true; +} + +TRANS_FEAT(SUBP, aa64_mte_insn_reg, do_subp, a, false) +TRANS_FEAT(SUBPS, aa64_mte_insn_reg, do_subp, a, true) + +static bool trans_IRG(DisasContext *s, arg_rrr *a) +{ + if (dc_isar_feature(aa64_mte_insn_reg, s)) { + TCGv_i64 tcg_rd = cpu_reg_sp(s, a->rd); + TCGv_i64 tcg_rn = cpu_reg_sp(s, a->rn); + + if (s->ata[0]) { + gen_helper_irg(tcg_rd, tcg_env, tcg_rn, cpu_reg(s, a->rm)); + } else { + gen_address_with_allocation_tag0(tcg_rd, tcg_rn); + } + return true; + } + return false; +} + +static bool trans_GMI(DisasContext *s, arg_rrr *a) +{ + if (dc_isar_feature(aa64_mte_insn_reg, s)) { + TCGv_i64 t = tcg_temp_new_i64(); + + tcg_gen_extract_i64(t, cpu_reg_sp(s, a->rn), 56, 4); + tcg_gen_shl_i64(t, tcg_constant_i64(1), t); + tcg_gen_or_i64(cpu_reg(s, a->rd), cpu_reg(s, a->rm), t); + return true; + } + return false; +} + /* Logical (shifted register) * 31 30 29 28 24 23 22 21 20 16 15 10 9 5 4 0 * +----+-----+-----------+-------+---+------+--------+------+------+ @@ -8528,48 +8577,6 @@ static void disas_data_proc_2src(DisasContext *s, uint32_t insn) } switch (opcode) { - case 0: /* SUBP(S) */ - if (sf == 0 || !dc_isar_feature(aa64_mte_insn_reg, s)) { - goto do_unallocated; - } else { - TCGv_i64 tcg_n, tcg_m, tcg_d; - - tcg_n = read_cpu_reg_sp(s, rn, true); - tcg_m = read_cpu_reg_sp(s, rm, true); - tcg_gen_sextract_i64(tcg_n, tcg_n, 0, 56); - tcg_gen_sextract_i64(tcg_m, tcg_m, 0, 56); - tcg_d = cpu_reg(s, rd); - - if (setflag) { - gen_sub_CC(true, tcg_d, tcg_n, tcg_m); - } else { - tcg_gen_sub_i64(tcg_d, tcg_n, tcg_m); - } - } - break; - case 4: /* IRG */ - if (sf == 0 || !dc_isar_feature(aa64_mte_insn_reg, s)) { - goto do_unallocated; - } - if (s->ata[0]) { - gen_helper_irg(cpu_reg_sp(s, rd), tcg_env, - cpu_reg_sp(s, rn), cpu_reg(s, rm)); - } else { - gen_address_with_allocation_tag0(cpu_reg_sp(s, rd), - cpu_reg_sp(s, rn)); - } - break; - case 5: /* GMI */ - if (sf == 0 || !dc_isar_feature(aa64_mte_insn_reg, s)) { - goto do_unallocated; - } else { - TCGv_i64 t = tcg_temp_new_i64(); - - tcg_gen_extract_i64(t, cpu_reg_sp(s, rn), 56, 4); - tcg_gen_shl_i64(t, tcg_constant_i64(1), t); - tcg_gen_or_i64(cpu_reg(s, rd), cpu_reg(s, rm), t); - } - break; case 12: /* PACGA */ if (sf == 0 || !dc_isar_feature(aa64_pauth, s)) { goto do_unallocated; @@ -8579,8 +8586,11 @@ static void disas_data_proc_2src(DisasContext *s, uint32_t insn) break; default: do_unallocated: + case 0: /* SUBP(S) */ case 2: /* UDIV */ case 3: /* SDIV */ + case 4: /* IRG */ + case 5: /* GMI */ case 8: /* LSLV */ case 9: /* LSRV */ case 10: /* ASRV */ diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 1664f4793c..f0a5ffb1cd 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -26,6 +26,7 @@ %hlm 11:1 20:2 &r rn +&rrr rd rn rm &ri rd imm &rri_sf rd rn imm sf &rrr_sf rd rn rm sf @@ -656,6 +657,7 @@ CPYE 00 011 1 01100 ..... .... 01 ..... ..... @cpy # Data Processing (2-source) +@rrr . .......... rm:5 ...... rn:5 rd:5 &rrr @rrr_sf sf:1 .......... rm:5 ...... rn:5 rd:5 &rrr_sf UDIV . 00 11010110 ..... 00001 0 ..... ..... @rrr_sf @@ -675,6 +677,11 @@ CRC32C 0 00 11010110 ..... 0101 01 ..... ..... @rrr_h CRC32C 0 00 11010110 ..... 0101 10 ..... ..... @rrr_s CRC32C 1 00 11010110 ..... 0101 11 ..... ..... @rrr_d +SUBP 1 00 11010110 ..... 000000 ..... ..... @rrr +SUBPS 1 01 11010110 ..... 000000 ..... ..... @rrr +IRG 1 00 11010110 ..... 000100 ..... ..... @rrr +GMI 1 00 11010110 ..... 000101 ..... ..... @rrr + # Data Processing (1-source) # Logical (shifted reg) # Add/subtract (shifted reg) From patchwork Tue Dec 10 16:16:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848820 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416620wrn; Tue, 10 Dec 2024 08:20:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXPmPPu/7ecU+h7TAEIfVogBCD0kObUky5iZ8e7W5sYsT/dqCQiRvn7qw43CdXz12Kqe1gRHA==@linaro.org X-Google-Smtp-Source: AGHT+IFvxtN7Yk/x3Iybc/HJhF9FWJjntraBA3sye1lEmGjAcGcVXSgOJsNHFNLqNb5O9DPtBT0U X-Received: by 2002:a05:622a:1cc8:b0:467:63fb:68d7 with SMTP id d75a77b69052e-46763fb6c2fmr207861391cf.50.1733847635271; Tue, 10 Dec 2024 08:20:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847635; cv=none; d=google.com; s=arc-20240605; b=f5szzBfbZHTEmxojHqs14aAzGT18gQ2SWFzZbJ13rwMcKVFvTFIGMrMwzgTcRVb0QL GtuhtHgwqVNod7WCHoRrC+y7zUTDnFNB69FYF6qPfoM+FHp3biG8hQOA9+Xym1G30Ays 2qesK0zgu7O/yHijXZl4oDaLE96SylcLbLesomBLcNWEi3+6H1LnwjaEqgGo2qId/pKy YQLABMluDt9uopyRHsApm/vevgYqRcwBVkclqNoVu0ycqzJzQQRnQZnsXbyhUXhoQgP2 /4HE3Rt29yxxjQvYzC3MByiQpotprOH3Mgz+wiWd10DIgNA7cZNuKtUZrVvZTf5meybm HcWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=OheJzngdS+HhJoEVosRxkCExJJDmRaec59L8+hjrWV0=; fh=OZQBfL75rC14cCDy3q+1fYHCs9KjWAQ7ZJ3hTfS+5lQ=; b=cNekltPJM1aglEIlyflCbQGlC7iOMYPoEwUWUk9Svu5t2xzUE3VVTGlaIU4DfqC4cT orAEZ5sOw/TskrZkIpcfR8/FgARjWNEF6/T0rzyS3S5UP1iqJ1WiYfRhluudzqiUtGfU zemXl03RQrTnB4RWdbQN++WVN9zzkjwRnwYhXIxpGP8C1yjaMFl8Lr2a3lZNsmGrCken LRftSeB1YaZWQeYL173AE+VLe0mEUuyyWcf4r/AvgFyxvk58oOKjiAvRLQbiX4sxbMwr 0HLZMnVEDf40Q0VZ8gTg6Qn01AhUG4cWI4wo7ezwsvX3dBPcnKZ2fxQsY/sLoynySlUg dPXQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UUtj3BR8; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-467296baa24si18498451cf.18.2024.12.10.08.20.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20: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=UUtj3BR8; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2w8-0002UZ-Il; Tue, 10 Dec 2024 11:18:12 -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 1tL2w5-0002Tn-Dm for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:09 -0500 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2w3-0006Iu-5X for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:09 -0500 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-5401e6efffcso2534509e87.3 for ; Tue, 10 Dec 2024 08:18:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847485; x=1734452285; 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=OheJzngdS+HhJoEVosRxkCExJJDmRaec59L8+hjrWV0=; b=UUtj3BR8ZVebn1zMm/dxDMHkSNLuk4w21fZHE4SvxGscyzfM5z7swfUDQvX5WPlipU zkCVF5acsShyiqUfJm9L5mPo2LC6euS8i2Erj60LQLBAoUSuvGdxcfTZE1VmGwlEbh7z g1bkUXr33eYVpTbMgG6Nr3j2HMXyQSquijdzNzkMy0eqOxzPbLDMSswwxGw0SrVfqZfS MaUt2r0ZbrYhPL4A8SmWeYT6+OPJN0N9wHa8371+PHFArjcyLo9KG9FWj8KCXjjMEpLf kNmTrqomKUSRB0nuNVvoPP1+KsjXGTblWwfYJwW9R9h4dp+JC7KhHUlNge0/qIAE3XtT owQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847485; x=1734452285; 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=OheJzngdS+HhJoEVosRxkCExJJDmRaec59L8+hjrWV0=; b=gzNiJJvl6BcWts76SYbQLa7/tORj0QlzF5fkXD1hFuKgZNz1r+YyKAA209jNYutkvr 72yvNi8kv8WLWivqsVk59EAERhtdsEtzov18OeWpg8WkegMVWpUMSB9aXsD/faZi+phg E+8w7tYci6cdeqrg3G3nMH7BZWSgoCTKYI3dTU6Q5/q07AneEvUSMq3mpCJpkCgBOJLi CyLPqte9xZ9QckYQ+YnMzqMTcgOOtp8e5b0TMPyncBSCiYmu/zMYkXe7fbXKWr7VnbyX MfQWAl3zWCcEHuJAkddABpEGKSEjk2zr4JZI6hVV1C3Za5crRXcQ6ABAyuuMeRUjXCa5 /nxA== X-Gm-Message-State: AOJu0YwCAqgdiATNwF9F/9jlomvyub7EQe2RI1nBLbvcTKSpn372Z3Bq x7N1vbq6An84VuMchopcOo4hu12HY9wmAC4cv2+s2xzhE4Ovga5AS8bXWkJ336TuF1lbfPPSisX DvZGSHXej X-Gm-Gg: ASbGnct8c3FNLuurSvzlVEV90n89/EcGW/wECMc7eUVocskbi65+ntup7YOy1U/hveA YZAjQBod1D1pi/tqDVD1z7CIEdTdIbQM78b5W8geMyui945vvnGcFdgXUQ/PhVc95mxQioFGsMG qrnrquvSnYCg3uPObAL9h2c9ylVNtzjOeAaCFCMVVE/C+3zgPPndp/f/3Vz5qcR+fvjGAZ1+ka2 zmG9e1V0SQnqpZmRQBkGLNN+3Vz7f77HsycyFwsCHop7W1qlV0b42d2dHI= X-Received: by 2002:a05:6512:23a9:b0:53e:6503:4b45 with SMTP id 2adb3069b0e04-540240bc9abmr2437525e87.17.1733847485005; Tue, 10 Dec 2024 08:18:05 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.18.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:18:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 06/69] target/arm: Convert PACGA to decodetree Date: Tue, 10 Dec 2024 10:16:30 -0600 Message-ID: <20241210161733.1830573-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x133.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 Remove disas_data_proc_2src, as this was the last insn decoded by that function. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 65 ++++++---------------------------- target/arm/tcg/a64.decode | 2 ++ 2 files changed, 13 insertions(+), 54 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 00e55d42ff..ca8b644dc7 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7674,6 +7674,16 @@ static bool trans_GMI(DisasContext *s, arg_rrr *a) return false; } +static bool trans_PACGA(DisasContext *s, arg_rrr *a) +{ + if (dc_isar_feature(aa64_pauth, s)) { + gen_helper_pacga(cpu_reg(s, a->rd), tcg_env, + cpu_reg(s, a->rn), cpu_reg_sp(s, a->rm)); + return true; + } + return false; +} + /* Logical (shifted register) * 31 30 29 28 24 23 22 21 20 16 15 10 9 5 4 0 * +----+-----+-----------+-------+---+------+--------+------+------+ @@ -8555,59 +8565,6 @@ static void disas_data_proc_1src(DisasContext *s, uint32_t insn) } -/* Data-processing (2 source) - * 31 30 29 28 21 20 16 15 10 9 5 4 0 - * +----+---+---+-----------------+------+--------+------+------+ - * | sf | 0 | S | 1 1 0 1 0 1 1 0 | Rm | opcode | Rn | Rd | - * +----+---+---+-----------------+------+--------+------+------+ - */ -static void disas_data_proc_2src(DisasContext *s, uint32_t insn) -{ - unsigned int sf, rm, opcode, rn, rd, setflag; - sf = extract32(insn, 31, 1); - setflag = extract32(insn, 29, 1); - rm = extract32(insn, 16, 5); - opcode = extract32(insn, 10, 6); - rn = extract32(insn, 5, 5); - rd = extract32(insn, 0, 5); - - if (setflag && opcode != 0) { - unallocated_encoding(s); - return; - } - - switch (opcode) { - case 12: /* PACGA */ - if (sf == 0 || !dc_isar_feature(aa64_pauth, s)) { - goto do_unallocated; - } - gen_helper_pacga(cpu_reg(s, rd), tcg_env, - cpu_reg(s, rn), cpu_reg_sp(s, rm)); - break; - default: - do_unallocated: - case 0: /* SUBP(S) */ - case 2: /* UDIV */ - case 3: /* SDIV */ - case 4: /* IRG */ - case 5: /* GMI */ - case 8: /* LSLV */ - case 9: /* LSRV */ - case 10: /* ASRV */ - case 11: /* RORV */ - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: /* CRC32 */ - unallocated_encoding(s); - break; - } -} - /* * Data processing - register * 31 30 29 28 25 21 20 16 10 0 @@ -8674,7 +8631,7 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) if (op0) { /* (1 source) */ disas_data_proc_1src(s, insn); } else { /* (2 source) */ - disas_data_proc_2src(s, insn); + goto do_unallocated; } break; case 0x8 ... 0xf: /* (3 source) */ diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index f0a5ffb1cd..a23d6a6645 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -682,6 +682,8 @@ SUBPS 1 01 11010110 ..... 000000 ..... ..... @rrr IRG 1 00 11010110 ..... 000100 ..... ..... @rrr GMI 1 00 11010110 ..... 000101 ..... ..... @rrr +PACGA 1 00 11010110 ..... 001100 ..... ..... @rrr + # Data Processing (1-source) # Logical (shifted reg) # Add/subtract (shifted reg) From patchwork Tue Dec 10 16:16:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848834 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp417624wrn; Tue, 10 Dec 2024 08:22:27 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU1/sVWMrmh3tR+Ktx5Ki7szibMqj7jKPoZ/HsR3uZIf8bP+wJawBYrOL8ia3NCnwP3Xaug5A==@linaro.org X-Google-Smtp-Source: AGHT+IE61n7HdCnpGQFJZvPBq9KoRSN4amB5kB59S/XatmBLmqFERLz/gwPniXD6nAOnV5d9EP5M X-Received: by 2002:a05:620a:838c:b0:7b6:d1e1:a230 with SMTP id af79cd13be357-7b6dce7750bmr809809385a.36.1733847747242; Tue, 10 Dec 2024 08:22:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847747; cv=none; d=google.com; s=arc-20240605; b=LSmr4FplerJ44Zo/1Dch41Kakdr+78rRL+fjQFaS6/zUFjWk21vf9hPjb+ATarVxu9 r5fVhLz88Gu1GNDXdVWb4X2AYIR7F7FaXPm9uV3v3dtPqRGHwQevkT6Z1uhHAkKLL279 Qnm3YyO2OQGdpW3/Y6Wmyo+nCbYjCWTOJ1AqedAEoIymx4bRbfCqj5ef/xrBPtaY2u0s a7BG2LtrTPGkvF7rLLRaTLV/u+/v2a4IF2H2IKboXF/RcMzdf+xvl5JxpzksEMJNcijO 3ITJN/9QAUcbzjVJAxdz11BXBnvS5MHBZJMfuJIxOV3i4f0i1XBpKdwyNbjoG77wNJRT TlSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=sjwu/WCIKU5sioc59WkYMjpiHpm5dBrQM69XD4ADE/A=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=ReXNZk6kw7MpZQDf3wmSMRrrDyqcpvLD7t8daTZvr1Gmx21ZiJfka5j9Y4KCxG8m+d IoldtdiAyPNvjX8FS90dTxH3XSh9vVqGUyzdKjF0zzXD6y63EqsWRyYO4Sax+AJy93za aNnMfv3zqn6GK0DQ+DrFp2AOqKMwrMeySA7zYtF7X+ScIb5w/Nco1D7md0bH6yvrjgBQ xCkz+0RXitjrRk7wOFcOyCV0ENT4L6gzSVhCDVXoK9H24umbd1gLJm9h1oLjeluNrX2n NIikbSZKLTjlQFZRAKOM7IbkzKOM6hlAgJ5WvDrN2JijXnoAXTGMPS+Ez8NPKmQz1K2c AYPQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gaK86qji; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6e836e8acsi96590185a.10.2024.12.10.08.22.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:22:27 -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=gaK86qji; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2wD-0002Vh-4o; Tue, 10 Dec 2024 11:18:17 -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 1tL2wB-0002Uy-65 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:15 -0500 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2w8-0006Jl-Gh for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:14 -0500 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-540254357c8so1118128e87.1 for ; Tue, 10 Dec 2024 08:18:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847490; x=1734452290; 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=sjwu/WCIKU5sioc59WkYMjpiHpm5dBrQM69XD4ADE/A=; b=gaK86qjiXZ7COFhlO2rt1pJjdkGiGVj4ga0zTQsuP2bg8hG7fv8DE07R2/JirQvPYe Uc1ZeE7N8z4KfMG6Rkq8SVQlCnFpHuc4dSmBteCfjnrot8H0IfG5x+a9u52wx88XNj0D gss8qa/r/fUXFMZwuUoc7v6PpOMjUFogPIjkSgzOhA1rwCBlKVsS5e/rHJ9mQZkUS5kf T/MsYaR0vijfoS1e/6G05HIyVKl4nBrQ2GzqkhOQgsILuNlqlr/Gawxumjl4W5PU+Jz4 bJInVkvmCmWHz9KLkksHlsemm3gX9sch2P3AuaepFgTOq9omASYrsC+ETvPItqpDRDDY e9LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847490; x=1734452290; 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=sjwu/WCIKU5sioc59WkYMjpiHpm5dBrQM69XD4ADE/A=; b=mTH36mYzE14srhy0FxM5d8CLM+OWCfAT2fx1wJ2glALGlUCiVJSgqShlPf0fooyrW/ 3MBV/SUPzv7XMs/eYZgFjfGnyfej8OWb+kd7WOfUcWeMthyW3IKr02+jvcsCcCNl3wSf 1ugim9oDz4j8B9xZXPYY0AX7A9DRmZ3iGv+vPrh6iL/reHul0uBFzm09YgyCFb0UUdPA pGSW8PH6ZKjeNEdvZrWFnpD6BYAR5uURTUzoU0K7DZpVr1a9ZLmO7wNrKXr0wLhvjI07 YszLbSE/WkVuv+TWjcGgv0txcUtP2QOyuDpnJGiRQRs2nwYBSHWFQAJ4MoiWXHomjo+E /s0Q== X-Gm-Message-State: AOJu0YyO6i/FiCk+XNr/azDNF5gl/Rd0IMZVnT4bFIUayotNtQ8ohTXx /v95x9S4ExOFXTvI79JeGoTNKZbYk3v9wwu0jdVLoht9ObK2o/atwFZ0paSm9/ZgWScs2WHXxQ1 FjL7E7r9K X-Gm-Gg: ASbGncsono2KNqK1EwxQGrOpzWbJEQ97JGAy+NtuYxiNesSOlBdQFHv5WJMadyTCJbt Qj47w6Gq2xTtLo6IVdnaULhu31ex45jYpPSqPnnTjQLnicYyoFxepl8j5BqoW9AI1hMGAzpDL0r /KiskZWK8V4Z8Pb6Zk6JJzxuNlD2vGwmvKNQ8CL6cIimRKxNlZqUrDUpjKU31H8F6mCrSVb7wSA PzgIyn0RcnCLWemn+lHgnHE/rO5/uwkGba+U9/JiKnahEDbGt7wueZmbco= X-Received: by 2002:a05:6512:118e:b0:53e:36c8:6e54 with SMTP id 2adb3069b0e04-5402410f35emr1756661e87.42.1733847490035; Tue, 10 Dec 2024 08:18:10 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.18.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:18:08 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 07/69] target/arm: Convert RBIT, REV16, REV32, REV64 to decodetree Date: Tue, 10 Dec 2024 10:16:31 -0600 Message-ID: <20241210161733.1830573-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x136.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 137 +++++++++++++++------------------ target/arm/tcg/a64.decode | 11 +++ 2 files changed, 72 insertions(+), 76 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index ca8b644dc7..1805d77f43 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7684,6 +7684,60 @@ static bool trans_PACGA(DisasContext *s, arg_rrr *a) return false; } +typedef void ArithOneOp(TCGv_i64, TCGv_i64); + +static bool gen_rr(DisasContext *s, int rd, int rn, ArithOneOp fn) +{ + fn(cpu_reg(s, rd), cpu_reg(s, rn)); + return true; +} + +static void gen_rbit32(TCGv_i64 tcg_rd, TCGv_i64 tcg_rn) +{ + TCGv_i32 t32 = tcg_temp_new_i32(); + + tcg_gen_extrl_i64_i32(t32, tcg_rn); + gen_helper_rbit(t32, t32); + tcg_gen_extu_i32_i64(tcg_rd, t32); +} + +static void gen_rev16_xx(TCGv_i64 tcg_rd, TCGv_i64 tcg_rn, TCGv_i64 mask) +{ + TCGv_i64 tcg_tmp = tcg_temp_new_i64(); + + tcg_gen_shri_i64(tcg_tmp, tcg_rn, 8); + tcg_gen_and_i64(tcg_rd, tcg_rn, mask); + tcg_gen_and_i64(tcg_tmp, tcg_tmp, mask); + tcg_gen_shli_i64(tcg_rd, tcg_rd, 8); + tcg_gen_or_i64(tcg_rd, tcg_rd, tcg_tmp); +} + +static void gen_rev16_32(TCGv_i64 tcg_rd, TCGv_i64 tcg_rn) +{ + gen_rev16_xx(tcg_rd, tcg_rn, tcg_constant_i64(0x00ff00ff)); +} + +static void gen_rev16_64(TCGv_i64 tcg_rd, TCGv_i64 tcg_rn) +{ + gen_rev16_xx(tcg_rd, tcg_rn, tcg_constant_i64(0x00ff00ff00ff00ffull)); +} + +static void gen_rev_32(TCGv_i64 tcg_rd, TCGv_i64 tcg_rn) +{ + tcg_gen_bswap32_i64(tcg_rd, tcg_rn, TCG_BSWAP_OZ); +} + +static void gen_rev32(TCGv_i64 tcg_rd, TCGv_i64 tcg_rn) +{ + tcg_gen_bswap64_i64(tcg_rd, tcg_rn); + tcg_gen_rotri_i64(tcg_rd, tcg_rd, 32); +} + +TRANS(RBIT, gen_rr, a->rd, a->rn, a->sf ? gen_helper_rbit64 : gen_rbit32) +TRANS(REV16, gen_rr, a->rd, a->rn, a->sf ? gen_rev16_64 : gen_rev16_32) +TRANS(REV32, gen_rr, a->rd, a->rn, a->sf ? gen_rev32 : gen_rev_32) +TRANS(REV64, gen_rr, a->rd, a->rn, tcg_gen_bswap64_i64) + /* Logical (shifted register) * 31 30 29 28 24 23 22 21 20 16 15 10 9 5 4 0 * +----+-----+-----------+-------+---+------+--------+------+------+ @@ -8302,67 +8356,6 @@ static void handle_cls(DisasContext *s, unsigned int sf, } } -static void handle_rbit(DisasContext *s, unsigned int sf, - unsigned int rn, unsigned int rd) -{ - TCGv_i64 tcg_rd, tcg_rn; - tcg_rd = cpu_reg(s, rd); - tcg_rn = cpu_reg(s, rn); - - if (sf) { - gen_helper_rbit64(tcg_rd, tcg_rn); - } else { - TCGv_i32 tcg_tmp32 = tcg_temp_new_i32(); - tcg_gen_extrl_i64_i32(tcg_tmp32, tcg_rn); - gen_helper_rbit(tcg_tmp32, tcg_tmp32); - tcg_gen_extu_i32_i64(tcg_rd, tcg_tmp32); - } -} - -/* REV with sf==1, opcode==3 ("REV64") */ -static void handle_rev64(DisasContext *s, unsigned int sf, - unsigned int rn, unsigned int rd) -{ - if (!sf) { - unallocated_encoding(s); - return; - } - tcg_gen_bswap64_i64(cpu_reg(s, rd), cpu_reg(s, rn)); -} - -/* REV with sf==0, opcode==2 - * REV32 (sf==1, opcode==2) - */ -static void handle_rev32(DisasContext *s, unsigned int sf, - unsigned int rn, unsigned int rd) -{ - TCGv_i64 tcg_rd = cpu_reg(s, rd); - TCGv_i64 tcg_rn = cpu_reg(s, rn); - - if (sf) { - tcg_gen_bswap64_i64(tcg_rd, tcg_rn); - tcg_gen_rotri_i64(tcg_rd, tcg_rd, 32); - } else { - tcg_gen_bswap32_i64(tcg_rd, tcg_rn, TCG_BSWAP_OZ); - } -} - -/* REV16 (opcode==1) */ -static void handle_rev16(DisasContext *s, unsigned int sf, - unsigned int rn, unsigned int rd) -{ - TCGv_i64 tcg_rd = cpu_reg(s, rd); - TCGv_i64 tcg_tmp = tcg_temp_new_i64(); - TCGv_i64 tcg_rn = read_cpu_reg(s, rn, sf); - TCGv_i64 mask = tcg_constant_i64(sf ? 0x00ff00ff00ff00ffull : 0x00ff00ff); - - tcg_gen_shri_i64(tcg_tmp, tcg_rn, 8); - tcg_gen_and_i64(tcg_rd, tcg_rn, mask); - tcg_gen_and_i64(tcg_tmp, tcg_tmp, mask); - tcg_gen_shli_i64(tcg_rd, tcg_rd, 8); - tcg_gen_or_i64(tcg_rd, tcg_rd, tcg_tmp); -} - /* Data-processing (1 source) * 31 30 29 28 21 20 16 15 10 9 5 4 0 * +----+---+---+-----------------+---------+--------+------+------+ @@ -8388,21 +8381,6 @@ static void disas_data_proc_1src(DisasContext *s, uint32_t insn) #define MAP(SF, O2, O1) ((SF) | (O1 << 1) | (O2 << 7)) switch (MAP(sf, opcode2, opcode)) { - case MAP(0, 0x00, 0x00): /* RBIT */ - case MAP(1, 0x00, 0x00): - handle_rbit(s, sf, rn, rd); - break; - case MAP(0, 0x00, 0x01): /* REV16 */ - case MAP(1, 0x00, 0x01): - handle_rev16(s, sf, rn, rd); - break; - case MAP(0, 0x00, 0x02): /* REV/REV32 */ - case MAP(1, 0x00, 0x02): - handle_rev32(s, sf, rn, rd); - break; - case MAP(1, 0x00, 0x03): /* REV64 */ - handle_rev64(s, sf, rn, rd); - break; case MAP(0, 0x00, 0x04): /* CLZ */ case MAP(1, 0x00, 0x04): handle_clz(s, sf, rn, rd); @@ -8557,6 +8535,13 @@ static void disas_data_proc_1src(DisasContext *s, uint32_t insn) break; default: do_unallocated: + case MAP(0, 0x00, 0x00): /* RBIT */ + case MAP(1, 0x00, 0x00): + case MAP(0, 0x00, 0x01): /* REV16 */ + case MAP(1, 0x00, 0x01): + case MAP(0, 0x00, 0x02): /* REV/REV32 */ + case MAP(1, 0x00, 0x02): + case MAP(1, 0x00, 0x03): /* REV64 */ unallocated_encoding(s); break; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index a23d6a6645..dd44651f34 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -28,6 +28,8 @@ &r rn &rrr rd rn rm &ri rd imm +&rr rd rn +&rr_sf rd rn sf &rri_sf rd rn imm sf &rrr_sf rd rn rm sf &i imm @@ -685,6 +687,15 @@ GMI 1 00 11010110 ..... 000101 ..... ..... @rrr PACGA 1 00 11010110 ..... 001100 ..... ..... @rrr # Data Processing (1-source) + +@rr . .......... ..... ...... rn:5 rd:5 &rr +@rr_sf sf:1 .......... ..... ...... rn:5 rd:5 &rr_sf + +RBIT . 10 11010110 00000 000000 ..... ..... @rr_sf +REV16 . 10 11010110 00000 000001 ..... ..... @rr_sf +REV32 . 10 11010110 00000 000010 ..... ..... @rr_sf +REV64 1 10 11010110 00000 000011 ..... ..... @rr + # Logical (shifted reg) # Add/subtract (shifted reg) # Add/subtract (extended reg) From patchwork Tue Dec 10 16:16:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848807 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp415929wrn; Tue, 10 Dec 2024 08:19:17 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVbMTVyUq8cwWQckOD+3gd8M/F42gw5p5nH8X3OiUmLfQ6vWIIVqGelRhkQBxp1PZPrLUVXfQ==@linaro.org X-Google-Smtp-Source: AGHT+IEt/QvmHxNqKFcwX6GZN4o3Q1SxMzim1Fyb3/F34oNBvajsahSlTTp2P3zxZwmSzBf7xxAg X-Received: by 2002:a05:6214:20c3:b0:6d8:e679:547c with SMTP id 6a1803df08f44-6d8e718513cmr346845436d6.29.1733847557655; Tue, 10 Dec 2024 08:19:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847557; cv=none; d=google.com; s=arc-20240605; b=gOsxOVJ7aOo2HLep/bTrLmsrsgTwPMFnrU0kTOSqjDhSp3blQ85U3QS5WTGwUOg3cQ DOkdlZa6i1LuAYGJtyFCsAv4C0uYNTDdYUe79G2At8iSdBaXz4n8e1oZA16dU8SLxdn5 EuUJcSZWv61GqPO7vgy7cd+LVM0aQnezIsksTzLBVq8KPnkFNW0W9ubkiapUUASBITvp yX97P6LupQ3EZR/tqJyIC/X/nrjwWmlqRrK9MD5ZpyhirgRnxp5if3XqGnqMVsZA36xQ wuEq0AGJ+0OC8t7MorkMZ0wohpl90gKMs+Fu39jpFs6lD/m0RsZZEYlMD9ZqwRenF3BW N4Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=jketwBKoo02OCAcU1bp5I+NgSnbqc1IWZRElDFeh+xg=; fh=OZQBfL75rC14cCDy3q+1fYHCs9KjWAQ7ZJ3hTfS+5lQ=; b=T0ZeSWdOvc8EkvJCYLzSbMIzVaY8GaMRlSY/7AmCTuXvEe8R6JNWztETUE2jZWPeAI K5i5gQTYn3gWWfecJeNoZRI2HqYJaboLol533r6OcGlr1fkIT98EGZoR3cf1dyIlCPKp k00zbbUw6/9+7dCQaOapm3SkJxDe9C7qhRZgUmQHBHQhIJJYOxY8M7YR8myqCzhDGDOu CAcZ2z9rwqbHzbjvuMQfJiYRSlfadrO0fYesF6SGyKTtdyzC3cYnVmLjDxVLaMv7NJ8l /8J1UwSuoyiwnKtzgfVnizytw5zJRp8YmavmhGhivnyEkdrmg3kRByAExV/oXqkXS0Fa TM7Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="glnCh/l0"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8e72003c9si120042086d6.55.2024.12.10.08.19.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:19:17 -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="glnCh/l0"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2wF-0002WJ-7T; Tue, 10 Dec 2024 11:18:19 -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 1tL2wE-0002W0-6Y for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:18 -0500 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2wC-0006Ka-Ej for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:17 -0500 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-54020b0dcd2so2072382e87.1 for ; Tue, 10 Dec 2024 08:18:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847495; x=1734452295; 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=jketwBKoo02OCAcU1bp5I+NgSnbqc1IWZRElDFeh+xg=; b=glnCh/l0d4JLsT1FkAD23fJIkb/0IsE0J70HkT2MvN5Mpy53qr6G6GYXWes2wRHXVi 6MjcMDBhP62uZaYZL/k5VnAY6CRA1QEqJ4813q+c/kEQWQn1GVAUv6rliXnPA+JbCi21 MMxo/3eL4/a95b799Rmv5h92tsN1vTQWIYywHNIfcHT7hGICHHIKlkGGlYZaEQzh6S9M grU086p0m931eCKMm4x308Q7s1z98f/K+tvpC4PV/jCgDUVSMFOzlv2RVS3ZgXA3yqLz z8NndD+PkOarYTWeeuMXIQ2QGlsIpjEZtPVNaS7rFe6j65Uo2tsO4np8a3oc3zJric5N xLnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847495; x=1734452295; 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=jketwBKoo02OCAcU1bp5I+NgSnbqc1IWZRElDFeh+xg=; b=YqSSPL2xAhBZd4PgD0jTp5C2Iyl8zfGbCzwL34+zUNuvqwbkZ0WqSt0bGLL4hPLicE boUGNqhlyycmP8b+dwDUrUUNgBWj4ESggthblCV+NPfqMlnQ2wJdmkpvn4YenTwJ1YC3 Zc9fXOTfNlXFNjvaacR3m1PE5wTOi+gPPxGiB/Xh6ELFN6nJjbk6Zsp5H9qtBXILJz96 sSP66C6AUfDh9r8MFJL4OKppQV+N5dfYjourv6T6NH5Jqwn/vD41tz3NpwCydaOoyDWI 296rnck3SUHpddA3Vz3gvEtdTzs18VaF/6wtk5gb3ab8qVBxCSRp1kxO1iYLWiJDFTM5 /FYA== X-Gm-Message-State: AOJu0YwjFKkS4jJmt46yQoILGhtJ7iOa69csdgPhwEaXknHh9XDluGer Asc3gABu7b9EXQXz/kUL8X9vI0DZrFLPEUd3I3jGPyad/oNiY/83YWkHBfBrWYUxkCRu6viahe3 OATIKNduW X-Gm-Gg: ASbGnctsojQXk4kClk7zqWUyoys0j1EFvw2owk+GuRqliW5Ql8Mbq0tIxLyJCOnWHHi CIeRnVb5p/MbryBUttm559gVGEBYDH8g6KQvrTY3f3otjmbVOfhZ/78HpcCD7VJOPH459CYdVu4 SNIRMQIbUmD3ps/B35X5NZ+CxS7q6SGT1z3gnpcfEEGeoILmjCZNegEeov14srmOwpGqRCXG0iv uA0EWdw7mMucFv5DlHd41uEekAiju0eqlU0aP8DaF3hvlfawvn63oANziw= X-Received: by 2002:a05:6512:3a83:b0:53e:94f8:bb3e with SMTP id 2adb3069b0e04-540251f216emr1408444e87.19.1733847494723; Tue, 10 Dec 2024 08:18:14 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:18:13 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 08/69] target/arm: Convert CLZ, CLS to decodetree Date: Tue, 10 Dec 2024 10:16:32 -0600 Message-ID: <20241210161733.1830573-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x133.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 72 ++++++++++++++-------------------- target/arm/tcg/a64.decode | 3 ++ 2 files changed, 33 insertions(+), 42 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 1805d77f43..552b45b4e2 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7738,6 +7738,32 @@ TRANS(REV16, gen_rr, a->rd, a->rn, a->sf ? gen_rev16_64 : gen_rev16_32) TRANS(REV32, gen_rr, a->rd, a->rn, a->sf ? gen_rev32 : gen_rev_32) TRANS(REV64, gen_rr, a->rd, a->rn, tcg_gen_bswap64_i64) +static void gen_clz32(TCGv_i64 tcg_rd, TCGv_i64 tcg_rn) +{ + TCGv_i32 t32 = tcg_temp_new_i32(); + + tcg_gen_extrl_i64_i32(t32, tcg_rn); + tcg_gen_clzi_i32(t32, t32, 32); + tcg_gen_extu_i32_i64(tcg_rd, t32); +} + +static void gen_clz64(TCGv_i64 tcg_rd, TCGv_i64 tcg_rn) +{ + tcg_gen_clzi_i64(tcg_rd, tcg_rn, 64); +} + +static void gen_cls32(TCGv_i64 tcg_rd, TCGv_i64 tcg_rn) +{ + TCGv_i32 t32 = tcg_temp_new_i32(); + + tcg_gen_extrl_i64_i32(t32, tcg_rn); + tcg_gen_clrsb_i32(t32, t32); + tcg_gen_extu_i32_i64(tcg_rd, t32); +} + +TRANS(CLZ, gen_rr, a->rd, a->rn, a->sf ? gen_clz64 : gen_clz32) +TRANS(CLS, gen_rr, a->rd, a->rn, a->sf ? tcg_gen_clrsb_i64 : gen_cls32) + /* Logical (shifted register) * 31 30 29 28 24 23 22 21 20 16 15 10 9 5 4 0 * +----+-----+-----------+-------+---+------+--------+------+------+ @@ -8322,40 +8348,6 @@ static void disas_cond_select(DisasContext *s, uint32_t insn) } } -static void handle_clz(DisasContext *s, unsigned int sf, - unsigned int rn, unsigned int rd) -{ - TCGv_i64 tcg_rd, tcg_rn; - tcg_rd = cpu_reg(s, rd); - tcg_rn = cpu_reg(s, rn); - - if (sf) { - tcg_gen_clzi_i64(tcg_rd, tcg_rn, 64); - } else { - TCGv_i32 tcg_tmp32 = tcg_temp_new_i32(); - tcg_gen_extrl_i64_i32(tcg_tmp32, tcg_rn); - tcg_gen_clzi_i32(tcg_tmp32, tcg_tmp32, 32); - tcg_gen_extu_i32_i64(tcg_rd, tcg_tmp32); - } -} - -static void handle_cls(DisasContext *s, unsigned int sf, - unsigned int rn, unsigned int rd) -{ - TCGv_i64 tcg_rd, tcg_rn; - tcg_rd = cpu_reg(s, rd); - tcg_rn = cpu_reg(s, rn); - - if (sf) { - tcg_gen_clrsb_i64(tcg_rd, tcg_rn); - } else { - TCGv_i32 tcg_tmp32 = tcg_temp_new_i32(); - tcg_gen_extrl_i64_i32(tcg_tmp32, tcg_rn); - tcg_gen_clrsb_i32(tcg_tmp32, tcg_tmp32); - tcg_gen_extu_i32_i64(tcg_rd, tcg_tmp32); - } -} - /* Data-processing (1 source) * 31 30 29 28 21 20 16 15 10 9 5 4 0 * +----+---+---+-----------------+---------+--------+------+------+ @@ -8381,14 +8373,6 @@ static void disas_data_proc_1src(DisasContext *s, uint32_t insn) #define MAP(SF, O2, O1) ((SF) | (O1 << 1) | (O2 << 7)) switch (MAP(sf, opcode2, opcode)) { - case MAP(0, 0x00, 0x04): /* CLZ */ - case MAP(1, 0x00, 0x04): - handle_clz(s, sf, rn, rd); - break; - case MAP(0, 0x00, 0x05): /* CLS */ - case MAP(1, 0x00, 0x05): - handle_cls(s, sf, rn, rd); - break; case MAP(1, 0x01, 0x00): /* PACIA */ if (s->pauth_active) { tcg_rd = cpu_reg(s, rd); @@ -8542,6 +8526,10 @@ static void disas_data_proc_1src(DisasContext *s, uint32_t insn) case MAP(0, 0x00, 0x02): /* REV/REV32 */ case MAP(1, 0x00, 0x02): case MAP(1, 0x00, 0x03): /* REV64 */ + case MAP(0, 0x00, 0x04): /* CLZ */ + case MAP(1, 0x00, 0x04): + case MAP(0, 0x00, 0x05): /* CLS */ + case MAP(1, 0x00, 0x05): unallocated_encoding(s); break; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index dd44651f34..410eaa9333 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -696,6 +696,9 @@ REV16 . 10 11010110 00000 000001 ..... ..... @rr_sf REV32 . 10 11010110 00000 000010 ..... ..... @rr_sf REV64 1 10 11010110 00000 000011 ..... ..... @rr +CLZ . 10 11010110 00000 000100 ..... ..... @rr_sf +CLS . 10 11010110 00000 000101 ..... ..... @rr_sf + # Logical (shifted reg) # Add/subtract (shifted reg) # Add/subtract (extended reg) From patchwork Tue Dec 10 16:16:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848835 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp417983wrn; Tue, 10 Dec 2024 08:23:06 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXAj9oCmGmYOyoTbu0s+Xc2TGx4zRXGLmLNiO+6yLKHSCrMF9IyC8jWGX0AVidXVkM+JhG8Lg==@linaro.org X-Google-Smtp-Source: AGHT+IErkzhGYj9kWaydXvitpN9Tgl+VqKgolrE2PBupKt56gFNfh6g5FMRCXquXh7QWDjp7l3p0 X-Received: by 2002:a05:622a:58cf:b0:467:5384:50ed with SMTP id d75a77b69052e-46771e9b659mr88586321cf.10.1733847786497; Tue, 10 Dec 2024 08:23:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847786; cv=none; d=google.com; s=arc-20240605; b=BlxpaaR5MLd4cYREno4PcGTHuoi8AXDanPD9Yx/Q7qPaIraMTm0I+7IByfvJoHDHvL VKM2GdjxHpFoGT9+3klNtrE68nYnF7WARuJjVHLD+2qKF1bTZb8bUoZBbDD+C6eAV8Mp owddNsLRdWIyvR0AbYystA0N8mn0C5z3TY6xpOfRozCampONhoPD3/6Y08Ifl/w1CYLo W5PWA9ddWNtDQNqfqA2O9MATvjBT88K/HlECJ8OO5f86Ero0XIIN3qUI7ZY73aVhS1Kx AdTQgSQ8X0i1trKn5OPMjpTb65e3p+btVBXsBWRn/nmcxKQrG38n4NBhyGpBQ47+jhym 9cdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=hyFQvqa4ZP5fftH7OfmG1SrHIoV27DETz0Thv1W0mFA=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=RqXbj2hRauLzRaj5Ti1zpETErlBJMWQPNjJN/PHkSxneVaU51weIhvlm/bUNT90GWY UR5OaH0fUc1zC5f4YSzoIfDJF16uErNZg/cJ1RMfP3qlE/vYxuRtfaXJTHkuK6jPCW7z ff9JzXO7J+8nYkyKhendb7KZ3JaJkTbawQ6SVm3UBxwxUBOMgGApu9FD2udYHUFosC2J HY9hEzXkcVhxDhoczDO/o4zZ6Na7ozaZCmH0WvPhPO5S2C2xB1Lz5vcUk5dqP+w1snF4 ipFteZ5YjNcJ3rXKzDTHfJ1D3S52csLv4fZXuxxDBZCtooF6BOMwFr+ks6zMoPLtriJ7 pIZQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wxfCKH46; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4675d353f39si65808751cf.199.2024.12.10.08.23.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:23: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=wxfCKH46; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2wK-0002Xn-3C; Tue, 10 Dec 2024 11:18:24 -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 1tL2wI-0002XV-IH for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:22 -0500 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2wG-0006LB-DX for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:22 -0500 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-53ff1f7caaeso3304413e87.0 for ; Tue, 10 Dec 2024 08:18:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847499; x=1734452299; 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=hyFQvqa4ZP5fftH7OfmG1SrHIoV27DETz0Thv1W0mFA=; b=wxfCKH4677cCN8GoYrerGE1rI2rBtBzNBvte0dpw/en4y5/e6PI4PVMdhXnW9euEHY kMtHZT55h9wfDDAdPA4DjjDzEEmJeZCTtS36GOu/6yRe7fAjoba1MbvjyN5PKAj6cEFK 0+AHec8XKcrVQ4cNq3fAshnDs9ZF93E2SkOjBYeX2HJjPOaWLsD4YMfL3ffoiqP3H19n WHtf33o/DR2cdpb1D5DQzroP2BqEB6vEtvIrIUlPq1+XS5lEWPacEhEd9ti0uygYf+nR RXrpqUGiYgsMMpNTKhbgJfNaKeFuR5FxLP3xj7PnoQ65IMTn6DtnP91jPzOmLQlvxTe1 HIZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847499; x=1734452299; 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=hyFQvqa4ZP5fftH7OfmG1SrHIoV27DETz0Thv1W0mFA=; b=YSsO/99DCRzfyhXA4jI5EhtujNXRq4Btavn8DeSR6chzAS69/muDaNHytGdgGNBYqy Lk0xa8lt2vfHPiHBcCEvHTyVahUBrTlVNyyS2+XyFduvURdLWcznbqfCiidO8iHrgdgx 2Iyc32e/r+c9cxFzAtW8DA4H7qzyFiw4j+sFaosPgVahRQvI4PG2oxn6+3GcQeKWnyp1 /9wZR/WUeZE8rYoD95amAwjracC6FGOFSiq+xC/eNIiL+eYPpj6+5eLcqvD1GNyDXG+I nzFI8+sWsBJ9k5czbAz+cBzb4UH/ur55FZ9wTfkyYy3IOy7+uhPc5oe3idkn4f4MYzP8 q4Qw== X-Gm-Message-State: AOJu0Yy0tpPtD4yGIbDAP/xEbNfT/AKnO6fq5rMfRi6yK0yfik1bmNh3 Rux8CVZoQweauX9lr+O3ETNPRJizR/asb4Gkq3glE6GJtJXfXxvaf21yZ8Boj93+sKlzH4tIaZ2 e7N2yVHuU X-Gm-Gg: ASbGncshz8Dvxe1lkI3G2/WO+kQFT9+d0lTNfuaAa6ywxtZ5Z/dVWIt2ncEYvZTSfk4 etcQvfLUAyxTX+9869rYrJUVxY2EKB4NJ9lMmld25phxVcMluUxyZyhi0L+XCi2sWn2x8FRzv2s uj4q/tyYanYMjQVREavHOM+teR0PuXl8376+s5H3tY0OOMCRBmkRulF332ZlIPjUU6xUVten1my igsKc7tSzIApc/rvkEWhDYMJuLnAh1iR0a+o/gVf3qUdGN7II36wtavBvM= X-Received: by 2002:a05:6512:138c:b0:540:1a0c:9ba4 with SMTP id 2adb3069b0e04-540240d2faemr1572220e87.29.1733847498707; Tue, 10 Dec 2024 08:18:18 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:18:17 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 09/69] target/arm: Convert PAC[ID]*, AUT[ID]* to decodetree Date: Tue, 10 Dec 2024 10:16:33 -0600 Message-ID: <20241210161733.1830573-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x135.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 This includes PACIA, PACIZA, PACIB, PACIZB, PACDA, PACDZA, PACDB, PACDZB, AUTIA, AUTIZA, AUTIB, AUTIZB, AUTDA, AUTDZA, AUTDB, AUTDZB. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 173 +++++++++------------------------ target/arm/tcg/a64.decode | 13 +++ 2 files changed, 58 insertions(+), 128 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 552b45b4e2..852545dfcc 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7764,6 +7764,35 @@ static void gen_cls32(TCGv_i64 tcg_rd, TCGv_i64 tcg_rn) TRANS(CLZ, gen_rr, a->rd, a->rn, a->sf ? gen_clz64 : gen_clz32) TRANS(CLS, gen_rr, a->rd, a->rn, a->sf ? tcg_gen_clrsb_i64 : gen_cls32) +static bool gen_pacaut(DisasContext *s, arg_pacaut *a, NeonGenTwo64OpEnvFn fn) +{ + TCGv_i64 tcg_rd, tcg_rn; + + if (a->z) { + if (a->rn != 31) { + return false; + } + tcg_rn = tcg_constant_i64(0); + } else { + tcg_rn = cpu_reg_sp(s, a->rn); + } + if (s->pauth_active) { + tcg_rd = cpu_reg(s, a->rd); + fn(tcg_rd, tcg_env, tcg_rd, tcg_rn); + } + return true; +} + +TRANS_FEAT(PACIA, aa64_pauth, gen_pacaut, a, gen_helper_pacia) +TRANS_FEAT(PACIB, aa64_pauth, gen_pacaut, a, gen_helper_pacib) +TRANS_FEAT(PACDA, aa64_pauth, gen_pacaut, a, gen_helper_pacda) +TRANS_FEAT(PACDB, aa64_pauth, gen_pacaut, a, gen_helper_pacdb) + +TRANS_FEAT(AUTIA, aa64_pauth, gen_pacaut, a, gen_helper_autia) +TRANS_FEAT(AUTIB, aa64_pauth, gen_pacaut, a, gen_helper_autib) +TRANS_FEAT(AUTDA, aa64_pauth, gen_pacaut, a, gen_helper_autda) +TRANS_FEAT(AUTDB, aa64_pauth, gen_pacaut, a, gen_helper_autdb) + /* Logical (shifted register) * 31 30 29 28 24 23 22 21 20 16 15 10 9 5 4 0 * +----+-----+-----------+-------+---+------+--------+------+------+ @@ -8373,134 +8402,6 @@ static void disas_data_proc_1src(DisasContext *s, uint32_t insn) #define MAP(SF, O2, O1) ((SF) | (O1 << 1) | (O2 << 7)) switch (MAP(sf, opcode2, opcode)) { - case MAP(1, 0x01, 0x00): /* PACIA */ - if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_pacia(tcg_rd, tcg_env, tcg_rd, cpu_reg_sp(s, rn)); - } else if (!dc_isar_feature(aa64_pauth, s)) { - goto do_unallocated; - } - break; - case MAP(1, 0x01, 0x01): /* PACIB */ - if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_pacib(tcg_rd, tcg_env, tcg_rd, cpu_reg_sp(s, rn)); - } else if (!dc_isar_feature(aa64_pauth, s)) { - goto do_unallocated; - } - break; - case MAP(1, 0x01, 0x02): /* PACDA */ - if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_pacda(tcg_rd, tcg_env, tcg_rd, cpu_reg_sp(s, rn)); - } else if (!dc_isar_feature(aa64_pauth, s)) { - goto do_unallocated; - } - break; - case MAP(1, 0x01, 0x03): /* PACDB */ - if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_pacdb(tcg_rd, tcg_env, tcg_rd, cpu_reg_sp(s, rn)); - } else if (!dc_isar_feature(aa64_pauth, s)) { - goto do_unallocated; - } - break; - case MAP(1, 0x01, 0x04): /* AUTIA */ - if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_autia(tcg_rd, tcg_env, tcg_rd, cpu_reg_sp(s, rn)); - } else if (!dc_isar_feature(aa64_pauth, s)) { - goto do_unallocated; - } - break; - case MAP(1, 0x01, 0x05): /* AUTIB */ - if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_autib(tcg_rd, tcg_env, tcg_rd, cpu_reg_sp(s, rn)); - } else if (!dc_isar_feature(aa64_pauth, s)) { - goto do_unallocated; - } - break; - case MAP(1, 0x01, 0x06): /* AUTDA */ - if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_autda(tcg_rd, tcg_env, tcg_rd, cpu_reg_sp(s, rn)); - } else if (!dc_isar_feature(aa64_pauth, s)) { - goto do_unallocated; - } - break; - case MAP(1, 0x01, 0x07): /* AUTDB */ - if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_autdb(tcg_rd, tcg_env, tcg_rd, cpu_reg_sp(s, rn)); - } else if (!dc_isar_feature(aa64_pauth, s)) { - goto do_unallocated; - } - break; - case MAP(1, 0x01, 0x08): /* PACIZA */ - if (!dc_isar_feature(aa64_pauth, s) || rn != 31) { - goto do_unallocated; - } else if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_pacia(tcg_rd, tcg_env, tcg_rd, tcg_constant_i64(0)); - } - break; - case MAP(1, 0x01, 0x09): /* PACIZB */ - if (!dc_isar_feature(aa64_pauth, s) || rn != 31) { - goto do_unallocated; - } else if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_pacib(tcg_rd, tcg_env, tcg_rd, tcg_constant_i64(0)); - } - break; - case MAP(1, 0x01, 0x0a): /* PACDZA */ - if (!dc_isar_feature(aa64_pauth, s) || rn != 31) { - goto do_unallocated; - } else if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_pacda(tcg_rd, tcg_env, tcg_rd, tcg_constant_i64(0)); - } - break; - case MAP(1, 0x01, 0x0b): /* PACDZB */ - if (!dc_isar_feature(aa64_pauth, s) || rn != 31) { - goto do_unallocated; - } else if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_pacdb(tcg_rd, tcg_env, tcg_rd, tcg_constant_i64(0)); - } - break; - case MAP(1, 0x01, 0x0c): /* AUTIZA */ - if (!dc_isar_feature(aa64_pauth, s) || rn != 31) { - goto do_unallocated; - } else if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_autia(tcg_rd, tcg_env, tcg_rd, tcg_constant_i64(0)); - } - break; - case MAP(1, 0x01, 0x0d): /* AUTIZB */ - if (!dc_isar_feature(aa64_pauth, s) || rn != 31) { - goto do_unallocated; - } else if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_autib(tcg_rd, tcg_env, tcg_rd, tcg_constant_i64(0)); - } - break; - case MAP(1, 0x01, 0x0e): /* AUTDZA */ - if (!dc_isar_feature(aa64_pauth, s) || rn != 31) { - goto do_unallocated; - } else if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_autda(tcg_rd, tcg_env, tcg_rd, tcg_constant_i64(0)); - } - break; - case MAP(1, 0x01, 0x0f): /* AUTDZB */ - if (!dc_isar_feature(aa64_pauth, s) || rn != 31) { - goto do_unallocated; - } else if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_autdb(tcg_rd, tcg_env, tcg_rd, tcg_constant_i64(0)); - } - break; case MAP(1, 0x01, 0x10): /* XPACI */ if (!dc_isar_feature(aa64_pauth, s) || rn != 31) { goto do_unallocated; @@ -8530,6 +8431,22 @@ static void disas_data_proc_1src(DisasContext *s, uint32_t insn) case MAP(1, 0x00, 0x04): case MAP(0, 0x00, 0x05): /* CLS */ case MAP(1, 0x00, 0x05): + case MAP(1, 0x01, 0x00): /* PACIA */ + case MAP(1, 0x01, 0x01): /* PACIB */ + case MAP(1, 0x01, 0x02): /* PACDA */ + case MAP(1, 0x01, 0x03): /* PACDB */ + case MAP(1, 0x01, 0x04): /* AUTIA */ + case MAP(1, 0x01, 0x05): /* AUTIB */ + case MAP(1, 0x01, 0x06): /* AUTDA */ + case MAP(1, 0x01, 0x07): /* AUTDB */ + case MAP(1, 0x01, 0x08): /* PACIZA */ + case MAP(1, 0x01, 0x09): /* PACIZB */ + case MAP(1, 0x01, 0x0a): /* PACDZA */ + case MAP(1, 0x01, 0x0b): /* PACDZB */ + case MAP(1, 0x01, 0x0c): /* AUTIZA */ + case MAP(1, 0x01, 0x0d): /* AUTIZB */ + case MAP(1, 0x01, 0x0e): /* AUTDZA */ + case MAP(1, 0x01, 0x0f): /* AUTDZB */ unallocated_encoding(s); break; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 410eaa9333..9083ac4ac3 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -699,6 +699,19 @@ REV64 1 10 11010110 00000 000011 ..... ..... @rr CLZ . 10 11010110 00000 000100 ..... ..... @rr_sf CLS . 10 11010110 00000 000101 ..... ..... @rr_sf +&pacaut rd rn z +@pacaut . .. ........ ..... .. z:1 ... rn:5 rd:5 &pacaut + +PACIA 1 10 11010110 00001 00.000 ..... ..... @pacaut +PACIB 1 10 11010110 00001 00.001 ..... ..... @pacaut +PACDA 1 10 11010110 00001 00.010 ..... ..... @pacaut +PACDB 1 10 11010110 00001 00.011 ..... ..... @pacaut + +AUTIA 1 10 11010110 00001 00.100 ..... ..... @pacaut +AUTIB 1 10 11010110 00001 00.101 ..... ..... @pacaut +AUTDA 1 10 11010110 00001 00.110 ..... ..... @pacaut +AUTDB 1 10 11010110 00001 00.111 ..... ..... @pacaut + # Logical (shifted reg) # Add/subtract (shifted reg) # Add/subtract (extended reg) From patchwork Tue Dec 10 16:16:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848812 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416305wrn; Tue, 10 Dec 2024 08:20:06 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW1pgNwRLnRL6CT11gnt3Vb9cpjIWVAnU/Yd+3oSNCWSm0ROmGsJ+ombRL7rvc9gY2dviC9qg==@linaro.org X-Google-Smtp-Source: AGHT+IF6RZHbvG0qQ2mGmGTC7VoCCbvOsuNwTvS9mjXqia1tqnQ2WyNCky4ViE8jTJViEUVYOHvq X-Received: by 2002:a05:620a:198e:b0:7b6:d942:c161 with SMTP id af79cd13be357-7b6de6db3fbmr575768085a.8.1733847606104; Tue, 10 Dec 2024 08:20:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847606; cv=none; d=google.com; s=arc-20240605; b=SjkLmNrj3weLlSnRuRPwZ/wd/I+KlQmzT7JC4m7/gzIywx8h4QuUxegQhHU2m0sSf0 I238bBZ9PlmRmoxpsSqkWuhzQlcNSf15oxHLC6rcX9VwS4Fg3UX9TaxetdomVLu2kEN7 76nF6iQ/UVqd98KzXLeJ2vSVQ2a08JmSYxHZxY2IqrIogSCPUU75nIM7EFXsf4aaAfCq gY0Oeprzt8pzsqpyybybPAwoAwJdkA8DyWeDyC4kPYhvsM56z2KrfghKFQ2ybV7AsSB0 +GPMPX3CT4fCoaU1FzesQ8b7fNh9csGQ44BzEXSeM4/BkJ3MeHyW70z8qIHHy+/3hpAG wQ1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=dd2z3le99kkpxlOwdQvMHijmJlZPpIOT1HfWKqviurA=; fh=OZQBfL75rC14cCDy3q+1fYHCs9KjWAQ7ZJ3hTfS+5lQ=; b=WKVu/iVgPALSAxSjCmCqvw/3oB8zhTOm8W/YVLbl91tnfMk7uQhqh28rVxLCPduLbA fu8mhJLxmqvpinxrhtim3kf6C30ZmzIJGdh/0TNke5P6kTLLerWIjjk/vAI1As4RXX9H sN5Yk2laQdhNGEbpa2l++QlmMEQjl0BKswxaTgKn1fgtKbpqaEOA5mlwKW6V2lpJJ8f5 Qv9nvuuqEoB/iE7qhw5O5Z/Cmmjhswalj2B+5hMcktZEXs/uQ/9zZ0uS6egZ4wtDnhZU XJVyeN6hksum1BQkT+j6a2iCsunjr7E8CSgo+i3a2WI+AIMWCkJPgPo4jItzqfM7kXlu ggtA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WDXaL0rZ; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6dcd91e34si395770385a.524.2024.12.10.08.20.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20: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=WDXaL0rZ; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2wN-0002Yo-V3; Tue, 10 Dec 2024 11:18:27 -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 1tL2wM-0002YN-1y for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:26 -0500 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2wK-0006Lo-5x for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:25 -0500 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-5401b7f7141so2257609e87.1 for ; Tue, 10 Dec 2024 08:18:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847502; x=1734452302; 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=dd2z3le99kkpxlOwdQvMHijmJlZPpIOT1HfWKqviurA=; b=WDXaL0rZ9mz/5mxWvcgWSMSq5z80gVWsv4Pb9qVDWEAW0cIfz2MnnLIRhSbRREJeXy PLcTzjJ6mDB0aimZN1imXViI6rph3bJUl5MFhqovrEqHsE3BXOXEJLWcIpBDwMPw6wph j8wvPsWF27lqgMJx0+wgTntIQ0G3aRj1Ut60J3ydtBpCWVr0cpqjFlU8QIkd0ak8tBDa Olom+TT9xuRxlJjRtFoUvHxjbycdFDeAPIoiw7s6xvRJ0eyWQW/6DiRz0BiplyO+5/so HSfq71y2T/hGHFa+pmnQcVnyEoZyuTa9ifX/fgIPcQ0T0vrZVlO8mbjRHvpfJgsc3p8h ME1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847502; x=1734452302; 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=dd2z3le99kkpxlOwdQvMHijmJlZPpIOT1HfWKqviurA=; b=Kotz9nCRNTnR2bHizqEKXc5BUXzVz86pzbXlz8vzSI88656Td7w5ZvASHkfjUaFpq5 KD5se48J6RUjDzLz5JJop7IwZACjdfdL3u17/4ArgcN2//wD7IYOyThlPydF4PWkqVhx kOzOH4bPy7VgEEz661Xmv0j8AQ778K9h4TLvqgKX/vqGZGn/etnEsCD+hWPOD4GoZ1Fi qtzn/VZ3tFsXzJChHxAzNQLDIUsC9b3HnFEQoDap62oA1+OnfcP8xRH26Yo5h7MHbHAJ P4uy6lpm1msOyrLbiGlfyHA8H8KzpbKiS6EP8Cjqww1GSmv2u2KfSfdAmQlMA7xqtO3M jvUA== X-Gm-Message-State: AOJu0Yy2A8utGQhD80LkxBdb3rFTLhIaVa1ysL8piekiAaeOjqlhNa72 a3tdyxXY9rxkcxFuinJXC+9AzgP9RdVo1twV72c5i/cpGEWINlP1/umGxAJNDzRtmXm33dBK+B4 m6yIzOOpo X-Gm-Gg: ASbGnctD4AgjMLnt9EyHNXGKcuHn8TLci83/+WxZxmHRPZm6280ML0+O7zSePpZCjtd 8KBFy5puGyqoaQx3iMsLHelRv8IP5X1oRu1pJ7YfUWVM+9XMVaHz4yO6wk/HyPr0MXPY4vrOy7c khmptVhgYZP/qWpCTUCqR1/GlBIqXjibpqC9ePhcakF4t9Z4Jp/pBTrYtuSl3OiFAgsUSn3zO25 XEoNL8fnK8E4b0MTtvlih7bXUsYPvSXzdlrLLmGR+WR+v2RWldfgX1O+qQ= X-Received: by 2002:a05:6512:402a:b0:53e:39c2:f02b with SMTP id 2adb3069b0e04-53e39c2f164mr4539323e87.42.1733847502509; Tue, 10 Dec 2024 08:18:22 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.18.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:18:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 10/69] target/arm: Convert XPAC[ID] to decodetree Date: Tue, 10 Dec 2024 10:16:34 -0600 Message-ID: <20241210161733.1830573-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12f.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 Remove disas_data_proc_1src, as these were the last insns decoded by that function. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 99 +++++----------------------------- target/arm/tcg/a64.decode | 3 ++ 2 files changed, 16 insertions(+), 86 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 852545dfcc..d92fe68299 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7793,6 +7793,18 @@ TRANS_FEAT(AUTIB, aa64_pauth, gen_pacaut, a, gen_helper_autib) TRANS_FEAT(AUTDA, aa64_pauth, gen_pacaut, a, gen_helper_autda) TRANS_FEAT(AUTDB, aa64_pauth, gen_pacaut, a, gen_helper_autdb) +static bool do_xpac(DisasContext *s, int rd, NeonGenOne64OpEnvFn *fn) +{ + if (s->pauth_active) { + TCGv_i64 tcg_rd = cpu_reg(s, rd); + fn(tcg_rd, tcg_env, tcg_rd); + } + return true; +} + +TRANS_FEAT(XPACI, aa64_pauth, do_xpac, a->rd, gen_helper_xpaci) +TRANS_FEAT(XPACD, aa64_pauth, do_xpac, a->rd, gen_helper_xpacd) + /* Logical (shifted register) * 31 30 29 28 24 23 22 21 20 16 15 10 9 5 4 0 * +----+-----+-----------+-------+---+------+--------+------+------+ @@ -8377,84 +8389,6 @@ static void disas_cond_select(DisasContext *s, uint32_t insn) } } -/* Data-processing (1 source) - * 31 30 29 28 21 20 16 15 10 9 5 4 0 - * +----+---+---+-----------------+---------+--------+------+------+ - * | sf | 1 | S | 1 1 0 1 0 1 1 0 | opcode2 | opcode | Rn | Rd | - * +----+---+---+-----------------+---------+--------+------+------+ - */ -static void disas_data_proc_1src(DisasContext *s, uint32_t insn) -{ - unsigned int sf, opcode, opcode2, rn, rd; - TCGv_i64 tcg_rd; - - if (extract32(insn, 29, 1)) { - unallocated_encoding(s); - return; - } - - sf = extract32(insn, 31, 1); - opcode = extract32(insn, 10, 6); - opcode2 = extract32(insn, 16, 5); - rn = extract32(insn, 5, 5); - rd = extract32(insn, 0, 5); - -#define MAP(SF, O2, O1) ((SF) | (O1 << 1) | (O2 << 7)) - - switch (MAP(sf, opcode2, opcode)) { - case MAP(1, 0x01, 0x10): /* XPACI */ - if (!dc_isar_feature(aa64_pauth, s) || rn != 31) { - goto do_unallocated; - } else if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_xpaci(tcg_rd, tcg_env, tcg_rd); - } - break; - case MAP(1, 0x01, 0x11): /* XPACD */ - if (!dc_isar_feature(aa64_pauth, s) || rn != 31) { - goto do_unallocated; - } else if (s->pauth_active) { - tcg_rd = cpu_reg(s, rd); - gen_helper_xpacd(tcg_rd, tcg_env, tcg_rd); - } - break; - default: - do_unallocated: - case MAP(0, 0x00, 0x00): /* RBIT */ - case MAP(1, 0x00, 0x00): - case MAP(0, 0x00, 0x01): /* REV16 */ - case MAP(1, 0x00, 0x01): - case MAP(0, 0x00, 0x02): /* REV/REV32 */ - case MAP(1, 0x00, 0x02): - case MAP(1, 0x00, 0x03): /* REV64 */ - case MAP(0, 0x00, 0x04): /* CLZ */ - case MAP(1, 0x00, 0x04): - case MAP(0, 0x00, 0x05): /* CLS */ - case MAP(1, 0x00, 0x05): - case MAP(1, 0x01, 0x00): /* PACIA */ - case MAP(1, 0x01, 0x01): /* PACIB */ - case MAP(1, 0x01, 0x02): /* PACDA */ - case MAP(1, 0x01, 0x03): /* PACDB */ - case MAP(1, 0x01, 0x04): /* AUTIA */ - case MAP(1, 0x01, 0x05): /* AUTIB */ - case MAP(1, 0x01, 0x06): /* AUTDA */ - case MAP(1, 0x01, 0x07): /* AUTDB */ - case MAP(1, 0x01, 0x08): /* PACIZA */ - case MAP(1, 0x01, 0x09): /* PACIZB */ - case MAP(1, 0x01, 0x0a): /* PACDZA */ - case MAP(1, 0x01, 0x0b): /* PACDZB */ - case MAP(1, 0x01, 0x0c): /* AUTIZA */ - case MAP(1, 0x01, 0x0d): /* AUTIZB */ - case MAP(1, 0x01, 0x0e): /* AUTDZA */ - case MAP(1, 0x01, 0x0f): /* AUTDZB */ - unallocated_encoding(s); - break; - } - -#undef MAP -} - - /* * Data processing - register * 31 30 29 28 25 21 20 16 10 0 @@ -8464,7 +8398,6 @@ static void disas_data_proc_1src(DisasContext *s, uint32_t insn) */ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) { - int op0 = extract32(insn, 30, 1); int op1 = extract32(insn, 28, 1); int op2 = extract32(insn, 21, 4); int op3 = extract32(insn, 10, 6); @@ -8517,19 +8450,13 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) disas_cond_select(s, insn); break; - case 0x6: /* Data-processing */ - if (op0) { /* (1 source) */ - disas_data_proc_1src(s, insn); - } else { /* (2 source) */ - goto do_unallocated; - } - break; case 0x8 ... 0xf: /* (3 source) */ disas_data_proc_3src(s, insn); break; default: do_unallocated: + case 0x6: /* Data-processing */ unallocated_encoding(s); break; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 9083ac4ac3..0e04ab6ce4 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -712,6 +712,9 @@ AUTIB 1 10 11010110 00001 00.101 ..... ..... @pacaut AUTDA 1 10 11010110 00001 00.110 ..... ..... @pacaut AUTDB 1 10 11010110 00001 00.111 ..... ..... @pacaut +XPACI 1 10 11010110 00001 010000 11111 rd:5 +XPACD 1 10 11010110 00001 010001 11111 rd:5 + # Logical (shifted reg) # Add/subtract (shifted reg) # Add/subtract (extended reg) From patchwork Tue Dec 10 16:16:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848818 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416557wrn; Tue, 10 Dec 2024 08:20:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWWqMVM7K+jjdciRHb2JOIgI+3boLJvry6JiV4eAeEOWkVr/SHaI3rFQXPX77G/e+6Rv8ba5w==@linaro.org X-Google-Smtp-Source: AGHT+IGnm1grIO7ZUTDTHXgumSosWViS826M3xLQzop5AItD78t+7qUXpoFbj2qWlHT1zxYUgRuB X-Received: by 2002:ad4:42c9:0:b0:6d8:b371:6a0f with SMTP id 6a1803df08f44-6d91e415bd8mr62328326d6.31.1733847628893; Tue, 10 Dec 2024 08:20:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847628; cv=none; d=google.com; s=arc-20240605; b=PZ9YBJTCRb8nanuhba5NWOMhHlJjHUBF4YUcvDyup+gwOiecWEocOX/68I18k93wqp Je0ZuaH8xzaI1SZI4WrMyjKcEGONa+ttAKe5vCFXmclT8PkG4JzyrG5WsmXR4r1G/poJ 6TEzdv7O/t3qY4Y/KahBFjDUWRrCwl2zdM7XIuzLDW24zkuK0LYoeyrqXZnkxugCzjW5 muEWVLz7k9UP1PKgDdrn3XLEwcd4gPBOhCAPSTpQwdFz6RgdY7GkZ++i42XstkIAmZxs ngh/CGjXXAJlr03sxx3eQrLGc+tzeYkTQqKhgCS1m+hsz+nYPfH/A6gsQRaes2vXEZsa 1W0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=Mv4+39/cFGoJE7L8lZWTi5JvZoPChXZESu684RPUKCc=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=N9mG8LwN/Vd9B9QdBAMyg0NSNRaZDqgYdD9Qi9oLw2EL0EzRYcUJEultRfzR4+XzUI eVLYzGkMRD0TRNWOFNt5GidOWCa+c6rtZxTNd2XoEWLJMdUkZYfxT8Gu3aHpPmhMBjV/ 3ZaC5fUcp5Ja5r7mmiKlaPyvMNCj4yHLAsMvkjJQEh9qDtG1EOFx49rjbUec2ehr4moz nNupQYGQ50SLqiTQaTl7SzOI9bqNhrCz/tRHpqvJ7DN/S6yoyKkgo32RiSnflXaVehrj IiDdAPbWR3mEul3aMraNnC7ACTCbUGdvN79V+Mm0j4AkQrDG/1Gg8dLLggAIAkmp8+mo KC7g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pUoz1ZdT; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8dac26eaesi146057526d6.482.2024.12.10.08.20.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20:28 -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=pUoz1ZdT; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2wZ-0002b3-Jn; Tue, 10 Dec 2024 11:18:39 -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 1tL2wQ-0002ZU-Ug for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:34 -0500 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2wP-0006MT-3e for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:30 -0500 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-53ffaaeeb76so3062258e87.0 for ; Tue, 10 Dec 2024 08:18:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847507; x=1734452307; 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=Mv4+39/cFGoJE7L8lZWTi5JvZoPChXZESu684RPUKCc=; b=pUoz1ZdTUHlkqHZdZdj05CKelTswUJ0HpaGVwU2QBhOyTGj5h1G1lBVqr1O83Y5ZAr f9xFxXAbu5lTfMUs9HCDw2FPx81lh6qYMh5p3WzijxW9bHTruSM3kJqctvwTcspJo7st ELIe1DCmnKSObU7ndMvWkHCyRFUBVEViTNPM7KzHeWoBQJ7GAT+3VFbHHuK55CnWXEq5 i84xfGFcCAPRXj7NXhX8Sv6v71pjmh3PgFA5ClRssftPzFgzxh8hdkU1r0Pr2BH2vZlQ kTLHLm1fQ8OyVa7GGI7T3gG/V2vdUUbsofNY32yFXmEE2KKshGYypYn+wMjIb9fui4mK JMrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847507; x=1734452307; 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=Mv4+39/cFGoJE7L8lZWTi5JvZoPChXZESu684RPUKCc=; b=RZuCgRwFEa42cuNt4wVpMHxGRFGHHYrqzRV9pV/Ir2TXW5JX6HHY2e5CeJNOGoKR+H uQeKLHIp8ePA6or6+zA82GhZGGDuPZA16aoIMqe28cNSmH76ppUXGQKfWmi5d2U9J622 KxqVD7vZk9y5hQGg38uvQOWoK1CGjTnaczKyEaXPyIGWCDrkvXQdxydWFqNKcCQ/83Om sZPrc9mrmzCtwlNZw6euot0TrneTXjAKgLZN+s+dml+f3jgl4QospVKRQFsoj6LlXotU 58jo5Uac+NBNL3PNm21ahOM7+YS1MCiM39BK4CMgHZ3Jp/A4v7cn50eqwJXUPgMmMWAK ixhA== X-Gm-Message-State: AOJu0Yzh/3+s/YeJGsmCUpB0Z2oEsRfXOrW3ij4XPJvrfD59Uhyte8/s j5eyWTunwsop8Xgbu+POaYGWvapnYSAWolV2iu2etfTBId/C4JteZBlfDL3uQOeK6tCp6Tnu4RP Z3UYa8xWL X-Gm-Gg: ASbGnctC9s1gG4KliozsCA1/dz5UgAbQg8yf+noW1wxce+J84gA7jRo2HylV5O8jHHS TEfpDX7TGVSKHwrUiMBW1MrjuG28QeQ6B8ICZ04udpbGvkT4I2uKyiegCT/6LqdiDSoieFXS8wu 3SuwEDYKdUqnPFXculMCZaKzv2GDupPivtNHl9mP4SIZEUuDoKFVp0ya16n1SHIbbaVFChHWJFI MrJlBZlzMgaRThaEisVEVPy3CbG7E//hte3GOnu+P5GH1oZuWrpO24dXZ0= X-Received: by 2002:a05:6512:1388:b0:53e:385c:e86b with SMTP id 2adb3069b0e04-53e385ceb0amr5008427e87.27.1733847507347; Tue, 10 Dec 2024 08:18:27 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.18.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:18:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 11/69] target/arm: Convert disas_logic_reg to decodetree Date: Tue, 10 Dec 2024 10:16:35 -0600 Message-ID: <20241210161733.1830573-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x135.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 This includes AND, BIC, ORR, ORN, EOR, EON, ANDS, BICS (shifted reg). Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 117 ++++++++++++--------------------- target/arm/tcg/a64.decode | 9 +++ 2 files changed, 51 insertions(+), 75 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index d92fe68299..ecc8899dd8 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7805,96 +7805,65 @@ static bool do_xpac(DisasContext *s, int rd, NeonGenOne64OpEnvFn *fn) TRANS_FEAT(XPACI, aa64_pauth, do_xpac, a->rd, gen_helper_xpaci) TRANS_FEAT(XPACD, aa64_pauth, do_xpac, a->rd, gen_helper_xpacd) -/* Logical (shifted register) - * 31 30 29 28 24 23 22 21 20 16 15 10 9 5 4 0 - * +----+-----+-----------+-------+---+------+--------+------+------+ - * | sf | opc | 0 1 0 1 0 | shift | N | Rm | imm6 | Rn | Rd | - * +----+-----+-----------+-------+---+------+--------+------+------+ - */ -static void disas_logic_reg(DisasContext *s, uint32_t insn) +static bool do_logic_reg(DisasContext *s, arg_logic_shift *a, + ArithTwoOp *fn, ArithTwoOp *inv_fn, bool setflags) { TCGv_i64 tcg_rd, tcg_rn, tcg_rm; - unsigned int sf, opc, shift_type, invert, rm, shift_amount, rn, rd; - sf = extract32(insn, 31, 1); - opc = extract32(insn, 29, 2); - shift_type = extract32(insn, 22, 2); - invert = extract32(insn, 21, 1); - rm = extract32(insn, 16, 5); - shift_amount = extract32(insn, 10, 6); - rn = extract32(insn, 5, 5); - rd = extract32(insn, 0, 5); - - if (!sf && (shift_amount & (1 << 5))) { - unallocated_encoding(s); - return; + if (!a->sf && (a->sa & (1 << 5))) { + return false; } - tcg_rd = cpu_reg(s, rd); + tcg_rd = cpu_reg(s, a->rd); + tcg_rn = cpu_reg(s, a->rn); - if (opc == 1 && shift_amount == 0 && shift_type == 0 && rn == 31) { - /* Unshifted ORR and ORN with WZR/XZR is the standard encoding for - * register-register MOV and MVN, so it is worth special casing. - */ - tcg_rm = cpu_reg(s, rm); - if (invert) { + tcg_rm = read_cpu_reg(s, a->rm, a->sf); + if (a->sa) { + shift_reg_imm(tcg_rm, tcg_rm, a->sf, a->st, a->sa); + } + + (a->n ? inv_fn : fn)(tcg_rd, tcg_rn, tcg_rm); + if (!a->sf) { + tcg_gen_ext32u_i64(tcg_rd, tcg_rd); + } + if (setflags) { + gen_logic_CC(a->sf, tcg_rd); + } + return true; +} + +static bool trans_ORR_r(DisasContext *s, arg_logic_shift *a) +{ + /* + * Unshifted ORR and ORN with WZR/XZR is the standard encoding for + * register-register MOV and MVN, so it is worth special casing. + */ + if (a->sa == 0 && a->st == 0 && a->rn == 31) { + TCGv_i64 tcg_rd = cpu_reg(s, a->rd); + TCGv_i64 tcg_rm = cpu_reg(s, a->rm); + + if (a->n) { tcg_gen_not_i64(tcg_rd, tcg_rm); - if (!sf) { + if (!a->sf) { tcg_gen_ext32u_i64(tcg_rd, tcg_rd); } } else { - if (sf) { + if (a->sf) { tcg_gen_mov_i64(tcg_rd, tcg_rm); } else { tcg_gen_ext32u_i64(tcg_rd, tcg_rm); } } - return; + return true; } - tcg_rm = read_cpu_reg(s, rm, sf); - - if (shift_amount) { - shift_reg_imm(tcg_rm, tcg_rm, sf, shift_type, shift_amount); - } - - tcg_rn = cpu_reg(s, rn); - - switch (opc | (invert << 2)) { - case 0: /* AND */ - case 3: /* ANDS */ - tcg_gen_and_i64(tcg_rd, tcg_rn, tcg_rm); - break; - case 1: /* ORR */ - tcg_gen_or_i64(tcg_rd, tcg_rn, tcg_rm); - break; - case 2: /* EOR */ - tcg_gen_xor_i64(tcg_rd, tcg_rn, tcg_rm); - break; - case 4: /* BIC */ - case 7: /* BICS */ - tcg_gen_andc_i64(tcg_rd, tcg_rn, tcg_rm); - break; - case 5: /* ORN */ - tcg_gen_orc_i64(tcg_rd, tcg_rn, tcg_rm); - break; - case 6: /* EON */ - tcg_gen_eqv_i64(tcg_rd, tcg_rn, tcg_rm); - break; - default: - assert(FALSE); - break; - } - - if (!sf) { - tcg_gen_ext32u_i64(tcg_rd, tcg_rd); - } - - if (opc == 3) { - gen_logic_CC(sf, tcg_rd); - } + return do_logic_reg(s, a, tcg_gen_or_i64, tcg_gen_orc_i64, false); } +TRANS(AND_r, do_logic_reg, a, tcg_gen_and_i64, tcg_gen_andc_i64, false) +TRANS(ANDS_r, do_logic_reg, a, tcg_gen_and_i64, tcg_gen_andc_i64, true) +TRANS(EOR_r, do_logic_reg, a, tcg_gen_xor_i64, tcg_gen_eqv_i64, false) + /* * Add/subtract (extended register) * @@ -8411,11 +8380,9 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) /* Add/sub (shifted register) */ disas_add_sub_reg(s, insn); } - } else { - /* Logical (shifted register) */ - disas_logic_reg(s, insn); + return; } - return; + goto do_unallocated; } switch (op2) { diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 0e04ab6ce4..8e2949d236 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -716,6 +716,15 @@ XPACI 1 10 11010110 00001 010000 11111 rd:5 XPACD 1 10 11010110 00001 010001 11111 rd:5 # Logical (shifted reg) + +&logic_shift rd rn rm sf sa st n +@logic_shift sf:1 .. ..... st:2 n:1 rm:5 sa:6 rn:5 rd:5 &logic_shift + +AND_r . 00 01010 .. . ..... ...... ..... ..... @logic_shift +ORR_r . 01 01010 .. . ..... ...... ..... ..... @logic_shift +EOR_r . 10 01010 .. . ..... ...... ..... ..... @logic_shift +ANDS_r . 11 01010 .. . ..... ...... ..... ..... @logic_shift + # Add/subtract (shifted reg) # Add/subtract (extended reg) # Add/subtract (carry) From patchwork Tue Dec 10 16:16:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848838 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp418413wrn; Tue, 10 Dec 2024 08:23:49 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVWuW+YhOlQ0f8mc36mZrd+SgPzx1tYfUOCU592mBygOKGzxHUoCNxBKluhpOtL+Bomueom4Q==@linaro.org X-Google-Smtp-Source: AGHT+IH+5pInoGyX9IQuEWDsKxDpPfguRAx3lc67txhWYwwVJGTU4ipYyFRq4BJSaZ2AqIRojXA0 X-Received: by 2002:a05:622a:748a:b0:467:86be:faff with SMTP id d75a77b69052e-46786befd59mr11356101cf.55.1733847828769; Tue, 10 Dec 2024 08:23:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847828; cv=none; d=google.com; s=arc-20240605; b=W3OLF2xMpW8aCqN9F+9BHAaWFCMAZDFeRg6IvxeZXS2od0+Gsq6EkwMc/z6JUXRRY5 ASNO2Uky9wVoN6MVyZL8NZSR7BHEJdvOXckRNC6/9jgRktgaW0KQ53gfIk1HlCxPzFYs LzCYWqYSm7/fxRT+UsNFWFJsrp6Ka2sZZ98HBM4liuf+JqSDWRY8x+kb96Io8W1T+xqt i3niZrZNRlPxNPqI9DCdUMdpSd0DpcozGBaIDz08XAhn5Iqhh3PJAdEa/NkfI1gyRuAh U2qylErysC6IqRZPTMpiIz5iVjgM3eG7qTVgHwK7HEkBaemw1kKUXuGmxeqqM7AKD4ov 7ivA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=9Aqe7AiIYBOFmb8LLSvrb79BS28+QL4PQSesWGDIC9U=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=cXTHLbHOrykW6EBFSGe2HcK5YsUtblXsuSFem6vhabMQ4Xp9Wpcdx6b0LaBVze6PiN Taj27fVZ0UzNL+zz8X1zjNlwnvnFpwBaBJl/84g+CCApiE+BSqnwl6PSFvRQlrSjQfo5 U9foZwLwBnp5lyDKVgNt9d1K+s9R/oDuEAi2BS2qp5PW8bdl4Sk3DvdEb28djeyx6MIm FaieeJgVUoIEFH68YAUdV5WsMpicEXpBmZ6AePhSt4EobdoqIKEmQYIp7cTEbBisX8Ci Gioyg6eBuEbHPvCL10MuxxebZayCYcDqRPIwGV6F1uVzg/R6agpWsR1PFWAxlSZI0+Vh 8b7w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="wRMjQuf/"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-467297fcc37si96110141cf.482.2024.12.10.08.23.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:23:48 -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="wRMjQuf/"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2wa-0002bq-JU; Tue, 10 Dec 2024 11:18: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 1tL2wV-0002aN-ET for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:36 -0500 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2wT-0006NS-6Y for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:35 -0500 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5401d3ea5a1so2522945e87.3 for ; Tue, 10 Dec 2024 08:18:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847511; x=1734452311; 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=9Aqe7AiIYBOFmb8LLSvrb79BS28+QL4PQSesWGDIC9U=; b=wRMjQuf/KlcXxSUFHDqFFY6H6weXrqDxa54YsRNi0k9++R08CyLTk/SAdp6Ha6zK4P 70NlM2eX/FerqBiGvpxlIAITNs0lzjX78QsNjMOWQ0rb301HsaO2XWWPFontaeMQHrFU c0yA3ToD0zPQ5jGgCkcOJ5uyFg1FCuQ+5LWs9qUVBkaqW+j25tZkACb/KGHEKUw1Zas5 bRjghBol710httHtxde9YdNVjv5wzwNZ6lRYd/sPnaWrBRABwPkfwdRw71Cx5/jRsODE xRhZX9I9fLFxC+fk2NAMvDRlmfS7dEdnxLA1ZPBhpox/i5MWUzWgPZMy4jqrEK3KExA7 GO4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847511; x=1734452311; 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=9Aqe7AiIYBOFmb8LLSvrb79BS28+QL4PQSesWGDIC9U=; b=JpcN13B6gE0WqQVexTxkk26XGZ4d/8NLxqLhliDNzK4gFV6V3yBjfaH7ubzmvNwS9U 302t0R+eJSQlKPSfWms82lZLCAuaBpIg6hjsrXRA/uLcWx+hlFZFJSzXb0n82zdoOpMx EfX7Eq0VunbooqrsMbFGxr8XfZTcCN0Uir68KPdC7hUTHdJSuu2Oa9FxrUKDYb2DAhzo GjHaBof7FbhHBpWlGEI7JifzQfPtF5/bL1GilxkJ015QWqIR/C/3c91H/GOuQ2RZcuqw TJ/wg0zeZ4E4e3aOlpz4rYdN6nptD09FwDdqd8qyoGrsUepJ12kaoQAuK9V7+H1BTrYT 4DyQ== X-Gm-Message-State: AOJu0Yyt6DJ2YM0EsegMjEtjy1kbjFCdaMhxQJjtDTc1rRnTtMN4ZnA5 IkX51kk5wU/BBoSmvhi2v1S+gc1aFM2Qx6zG6o0JlaJvy2sqrIJfb9SIpeHp19o3o1I1e+07L6c hBDTv+uuV X-Gm-Gg: ASbGncut3zkp1WdJ4VRiiAe+WiPKP2J+9mZfXxcwGQBEaDohlNPFfKbTQjryhCcHxod WP6nRpNC9PGE4hLcnC14tL5frb37KrsM6S8U8s+Cn4F+CwTfPpho7uMBxKVQMMD7eaY0QHryjVk fTC2mNnFAvwe75JhZhCOOfNCrI17XVZyCI9Px8sI0KMuwnV6tigpE7URBsBJ2iu0bpi7fBcTywT XUnV4vRyVgUuqM/y8ch+8pXKDNnAM32P3mJNK4mF8b2XKX+ccomVp3c8vU= X-Received: by 2002:a05:6512:b26:b0:540:2311:28c5 with SMTP id 2adb3069b0e04-54024112f8dmr1769224e87.57.1733847511522; Tue, 10 Dec 2024 08:18:31 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.18.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:18:31 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 12/69] target/arm: Convert disas_add_sub_ext_reg to decodetree Date: Tue, 10 Dec 2024 10:16:36 -0600 Message-ID: <20241210161733.1830573-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12a.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 This includes ADD, SUB, ADDS, SUBS (extended register). Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 65 +++++++++++----------------------- target/arm/tcg/a64.decode | 9 +++++ 2 files changed, 29 insertions(+), 45 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index ecc8899dd8..8f777875fe 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7864,57 +7864,27 @@ TRANS(AND_r, do_logic_reg, a, tcg_gen_and_i64, tcg_gen_andc_i64, false) TRANS(ANDS_r, do_logic_reg, a, tcg_gen_and_i64, tcg_gen_andc_i64, true) TRANS(EOR_r, do_logic_reg, a, tcg_gen_xor_i64, tcg_gen_eqv_i64, false) -/* - * Add/subtract (extended register) - * - * 31|30|29|28 24|23 22|21|20 16|15 13|12 10|9 5|4 0| - * +--+--+--+-----------+-----+--+-------+------+------+----+----+ - * |sf|op| S| 0 1 0 1 1 | opt | 1| Rm |option| imm3 | Rn | Rd | - * +--+--+--+-----------+-----+--+-------+------+------+----+----+ - * - * sf: 0 -> 32bit, 1 -> 64bit - * op: 0 -> add , 1 -> sub - * S: 1 -> set flags - * opt: 00 - * option: extension type (see DecodeRegExtend) - * imm3: optional shift to Rm - * - * Rd = Rn + LSL(extend(Rm), amount) - */ -static void disas_add_sub_ext_reg(DisasContext *s, uint32_t insn) +static bool do_addsub_ext(DisasContext *s, arg_addsub_ext *a, + bool sub_op, bool setflags) { - int rd = extract32(insn, 0, 5); - int rn = extract32(insn, 5, 5); - int imm3 = extract32(insn, 10, 3); - int option = extract32(insn, 13, 3); - int rm = extract32(insn, 16, 5); - int opt = extract32(insn, 22, 2); - bool setflags = extract32(insn, 29, 1); - bool sub_op = extract32(insn, 30, 1); - bool sf = extract32(insn, 31, 1); + TCGv_i64 tcg_rm, tcg_rn, tcg_rd, tcg_result; - TCGv_i64 tcg_rm, tcg_rn; /* temps */ - TCGv_i64 tcg_rd; - TCGv_i64 tcg_result; - - if (imm3 > 4 || opt != 0) { - unallocated_encoding(s); - return; + if (a->sa > 4) { + return false; } /* non-flag setting ops may use SP */ if (!setflags) { - tcg_rd = cpu_reg_sp(s, rd); + tcg_rd = cpu_reg_sp(s, a->rd); } else { - tcg_rd = cpu_reg(s, rd); + tcg_rd = cpu_reg(s, a->rd); } - tcg_rn = read_cpu_reg_sp(s, rn, sf); + tcg_rn = read_cpu_reg_sp(s, a->rn, a->sf); - tcg_rm = read_cpu_reg(s, rm, sf); - ext_and_shift_reg(tcg_rm, tcg_rm, option, imm3); + tcg_rm = read_cpu_reg(s, a->rm, a->sf); + ext_and_shift_reg(tcg_rm, tcg_rm, a->st, a->sa); tcg_result = tcg_temp_new_i64(); - if (!setflags) { if (sub_op) { tcg_gen_sub_i64(tcg_result, tcg_rn, tcg_rm); @@ -7923,19 +7893,25 @@ static void disas_add_sub_ext_reg(DisasContext *s, uint32_t insn) } } else { if (sub_op) { - gen_sub_CC(sf, tcg_result, tcg_rn, tcg_rm); + gen_sub_CC(a->sf, tcg_result, tcg_rn, tcg_rm); } else { - gen_add_CC(sf, tcg_result, tcg_rn, tcg_rm); + gen_add_CC(a->sf, tcg_result, tcg_rn, tcg_rm); } } - if (sf) { + if (a->sf) { tcg_gen_mov_i64(tcg_rd, tcg_result); } else { tcg_gen_ext32u_i64(tcg_rd, tcg_result); } + return true; } +TRANS(ADD_ext, do_addsub_ext, a, false, false) +TRANS(SUB_ext, do_addsub_ext, a, true, false) +TRANS(ADDS_ext, do_addsub_ext, a, false, true) +TRANS(SUBS_ext, do_addsub_ext, a, true, true) + /* * Add/subtract (shifted register) * @@ -8374,8 +8350,7 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) if (!op1) { if (op2 & 8) { if (op2 & 1) { - /* Add/sub (extended register) */ - disas_add_sub_ext_reg(s, insn); + goto do_unallocated; } else { /* Add/sub (shifted register) */ disas_add_sub_reg(s, insn); diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 8e2949d236..0539694506 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -727,6 +727,15 @@ ANDS_r . 11 01010 .. . ..... ...... ..... ..... @logic_shift # Add/subtract (shifted reg) # Add/subtract (extended reg) + +&addsub_ext rd rn rm sf sa st +@addsub_ext sf:1 .. ........ rm:5 st:3 sa:3 rn:5 rd:5 &addsub_ext + +ADD_ext . 00 01011001 ..... ... ... ..... ..... @addsub_ext +SUB_ext . 10 01011001 ..... ... ... ..... ..... @addsub_ext +ADDS_ext . 01 01011001 ..... ... ... ..... ..... @addsub_ext +SUBS_ext . 11 01011001 ..... ... ... ..... ..... @addsub_ext + # Add/subtract (carry) # Rotate right into flags # Evaluate into flags From patchwork Tue Dec 10 16:16:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848832 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp417442wrn; Tue, 10 Dec 2024 08:22:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXjFRZskkMBNSIH01t/GCzukvV05WsZ4FFcEMMjUykhOIoy95KZcExcaICVR7XO6dErkw/zwQ==@linaro.org X-Google-Smtp-Source: AGHT+IFzlxjhhQcXto4apszrFZX3T8vjizc0syRRiVRXu4r4Om+qYKB6lUx97INI43n+0kpqvVin X-Received: by 2002:ac8:5d43:0:b0:460:a928:696f with SMTP id d75a77b69052e-46771f31cf8mr83258291cf.29.1733847725234; Tue, 10 Dec 2024 08:22:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847725; cv=none; d=google.com; s=arc-20240605; b=IMbk1C0v51sxQVW/03jrWuFUspNmGWeU644dJLqdeWjR1on0dgS8otRscGK4rUvzkd DXDqJF8nwLZpIzRjC0hilQu01QxigZdxE8tL5D83g5V05x70MUUFxFJULLXXcdo3VFx/ 5ufULjYpSR2LVFG0kYAs4OHD5NiMSke7NvgDJ6iII0VrO7mtvo8R11rUdCHUH/5LRh73 1YzKfNiiG5KdxrTysHoBH8IQ+U2A1hvJ3NSQC38l35OIQa2MPewlfuq9RZaK7zdEEqEr 35BiO5HJqMzuv9dr0GkwBJ3PsXzSUWr+IY0HMhEvs1PP1we1ps8dRbdUWtUSUQV8mWbs PjNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=NvYUTxGU0SlbdB/A8XWhhOlkaNp7pR5YZMOeGOSqwZc=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=CBcMCRZXJUKLDUmmvRvTUZcDjdl2q08jpJf1wRoV4QhKZUY7t9IWZpRqsCD3c1bap2 EJ73dXna/QHDi0xb8IgGCpig+Aa7tg42FRMDZLFmIvLHSB7A+aDjhEAkjrqNCk+vVKgA HFWrbaE86czlG+uhNRM+R6+hDuOAJHp1PM/Ml4/y58mA+ozxUW9Q6iREOV4rjzVgSJba uW/ovcSX6KQ/lUm/HPCtGnofSdJIhH88si/Dlr3/z2uRRBbcAXARfxCdpJ50X9f60cWg Ol6qQs+gzr60XsJGKfhniZW4A70f5GmfoMeirx2CMDiRiuhbC6hoGiTEKHLuhHwmCgxU ONvQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RGYKuuMb; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46729864ee2si155639741cf.666.2024.12.10.08.22.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:22:05 -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=RGYKuuMb; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2wg-0002cb-9u; Tue, 10 Dec 2024 11:18:46 -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 1tL2wY-0002b4-7T for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:38 -0500 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2wW-0006OD-Gh for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:37 -0500 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-54024aa9febso1380655e87.1 for ; Tue, 10 Dec 2024 08:18:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847515; x=1734452315; 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=NvYUTxGU0SlbdB/A8XWhhOlkaNp7pR5YZMOeGOSqwZc=; b=RGYKuuMbMbyb+rLgLk56XP+ay0zUaoh5Bn5oxmpyqZGtWYnFviHyWMA14SpyAIHqzE 8SGhrEvy2I3kDFplVAzHpiTqzxvHEyErzPZtVDgS2EW3p63FYGWLsuUFwdekfzeXid7X QZO876JGu+WQLpPDPyPGy/yDq8+015BXKPy9cbWbfAqcFioxe9jun08Hc7MvWlGNS++i eEl/n72qPx6CuH+pZaMwQ2mBcMUYncqmFHnEOMtlsRJ0/19QT6uI7AK48qkn4mtqnQrZ 4lp+twlWJ8wZ2AGQ8N0orvCdrBgS0EQhiFdsEFLqskLNPTX6Q4RvVB+D87no7BTQmwv2 q5fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847515; x=1734452315; 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=NvYUTxGU0SlbdB/A8XWhhOlkaNp7pR5YZMOeGOSqwZc=; b=DOry+WJpFHXvglnoC1VgRreV8gRRJw8JtKwEG4DHtKVfMS6mQj2GSQvWlE5q6xX8rz eQ8dlHLLRJ8wsYa21Et3mLiwlv6RvNGQRzWHwwhNaTwuVHxT9hMbH0wHqppr393o7KqO LT+lUVl1pieHedQ9ITa+OEKskOQjB22hQINB/Px0ob9vLSgndaEGolboaYF/343LEGup N8KfajSJGaYCI3NAqI8T+CQgGwj53eqwr19WS+6te1zQ7i+CscA0vRvs/QHxygm+bdVH NNTZX7zLcitPXOb4T6CJLbIqk/ZEDCv9MXUBC25DEWalsKGxa8w/YvCd3hYCdlpZQ8yZ GVJA== X-Gm-Message-State: AOJu0YylH/Nxc4EkM0s2nResG0ETQdXu4/nXcOWjPdKOmJSsfgxkhaUl OitcC6QKoj6ACQPuW0AI+kztsBp0rL4NhOaVWEAAeOJpy+EHUPdEzi4LbfApvVN6QuBbrRr1PCi HsT+UwjKl X-Gm-Gg: ASbGncuVSV4r4W41VQ7pxOxSX9HqOrqH8EHGcj0d+1rspog2VzumNKmBpDSK2Lsp8CB 7f9HOs/3nrlVNzXk2TXtFkXoo5s4QVl1AxF4ObCf/B5bDN4T9Cn+EQDq2iDXlVhbLt7FR69sl7o 4kQct3iKqzoJXuU4aSJfKvwFEbItBcUg28sNWd6ok38DbCuery8iaevYGvSIAtXNKZxd12ZlL8v yge66eZE4R5fi4FzvDGdhQxYd6RXRhhMlD2MgbK9v97AS2brno3qJDf08I= X-Received: by 2002:a05:6512:1382:b0:540:1a0c:9ba6 with SMTP id 2adb3069b0e04-5401a0c9d50mr3898112e87.34.1733847514762; Tue, 10 Dec 2024 08:18:34 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.18.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:18:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 13/69] target/arm: Convert disas_add_sub_reg to decodetree Date: Tue, 10 Dec 2024 10:16:37 -0600 Message-ID: <20241210161733.1830573-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x129.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 This includes ADD, SUB, ADDS, SUBS (shifted register). Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 64 ++++++++++------------------------ target/arm/tcg/a64.decode | 9 +++++ 2 files changed, 27 insertions(+), 46 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 8f777875fe..d570bbb696 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7912,47 +7912,22 @@ TRANS(SUB_ext, do_addsub_ext, a, true, false) TRANS(ADDS_ext, do_addsub_ext, a, false, true) TRANS(SUBS_ext, do_addsub_ext, a, true, true) -/* - * Add/subtract (shifted register) - * - * 31 30 29 28 24 23 22 21 20 16 15 10 9 5 4 0 - * +--+--+--+-----------+-----+--+-------+---------+------+------+ - * |sf|op| S| 0 1 0 1 1 |shift| 0| Rm | imm6 | Rn | Rd | - * +--+--+--+-----------+-----+--+-------+---------+------+------+ - * - * sf: 0 -> 32bit, 1 -> 64bit - * op: 0 -> add , 1 -> sub - * S: 1 -> set flags - * shift: 00 -> LSL, 01 -> LSR, 10 -> ASR, 11 -> RESERVED - * imm6: Shift amount to apply to Rm before the add/sub - */ -static void disas_add_sub_reg(DisasContext *s, uint32_t insn) +static bool do_addsub_reg(DisasContext *s, arg_addsub_shift *a, + bool sub_op, bool setflags) { - int rd = extract32(insn, 0, 5); - int rn = extract32(insn, 5, 5); - int imm6 = extract32(insn, 10, 6); - int rm = extract32(insn, 16, 5); - int shift_type = extract32(insn, 22, 2); - bool setflags = extract32(insn, 29, 1); - bool sub_op = extract32(insn, 30, 1); - bool sf = extract32(insn, 31, 1); + TCGv_i64 tcg_rd, tcg_rn, tcg_rm, tcg_result; - TCGv_i64 tcg_rd = cpu_reg(s, rd); - TCGv_i64 tcg_rn, tcg_rm; - TCGv_i64 tcg_result; - - if ((shift_type == 3) || (!sf && (imm6 > 31))) { - unallocated_encoding(s); - return; + if (a->st == 3 || (!a->sf && (a->sa & 32))) { + return false; } - tcg_rn = read_cpu_reg(s, rn, sf); - tcg_rm = read_cpu_reg(s, rm, sf); + tcg_rd = cpu_reg(s, a->rd); + tcg_rn = read_cpu_reg(s, a->rn, a->sf); + tcg_rm = read_cpu_reg(s, a->rm, a->sf); - shift_reg_imm(tcg_rm, tcg_rm, sf, shift_type, imm6); + shift_reg_imm(tcg_rm, tcg_rm, a->sf, a->st, a->sa); tcg_result = tcg_temp_new_i64(); - if (!setflags) { if (sub_op) { tcg_gen_sub_i64(tcg_result, tcg_rn, tcg_rm); @@ -7961,19 +7936,25 @@ static void disas_add_sub_reg(DisasContext *s, uint32_t insn) } } else { if (sub_op) { - gen_sub_CC(sf, tcg_result, tcg_rn, tcg_rm); + gen_sub_CC(a->sf, tcg_result, tcg_rn, tcg_rm); } else { - gen_add_CC(sf, tcg_result, tcg_rn, tcg_rm); + gen_add_CC(a->sf, tcg_result, tcg_rn, tcg_rm); } } - if (sf) { + if (a->sf) { tcg_gen_mov_i64(tcg_rd, tcg_result); } else { tcg_gen_ext32u_i64(tcg_rd, tcg_result); } + return true; } +TRANS(ADD_r, do_addsub_reg, a, false, false) +TRANS(SUB_r, do_addsub_reg, a, true, false) +TRANS(ADDS_r, do_addsub_reg, a, false, true) +TRANS(SUBS_r, do_addsub_reg, a, true, true) + /* Data-processing (3 source) * * 31 30 29 28 24 23 21 20 16 15 14 10 9 5 4 0 @@ -8348,15 +8329,6 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) int op3 = extract32(insn, 10, 6); if (!op1) { - if (op2 & 8) { - if (op2 & 1) { - goto do_unallocated; - } else { - /* Add/sub (shifted register) */ - disas_add_sub_reg(s, insn); - } - return; - } goto do_unallocated; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 0539694506..27a3101bc6 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -726,6 +726,15 @@ EOR_r . 10 01010 .. . ..... ...... ..... ..... @logic_shift ANDS_r . 11 01010 .. . ..... ...... ..... ..... @logic_shift # Add/subtract (shifted reg) + +&addsub_shift rd rn rm sf sa st +@addsub_shift sf:1 .. ..... st:2 . rm:5 sa:6 rn:5 rd:5 &addsub_shift + +ADD_r . 00 01011 .. 0 ..... ...... ..... ..... @addsub_shift +SUB_r . 10 01011 .. 0 ..... ...... ..... ..... @addsub_shift +ADDS_r . 01 01011 .. 0 ..... ...... ..... ..... @addsub_shift +SUBS_r . 11 01011 .. 0 ..... ...... ..... ..... @addsub_shift + # Add/subtract (extended reg) &addsub_ext rd rn rm sf sa st From patchwork Tue Dec 10 16:16:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848814 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416439wrn; Tue, 10 Dec 2024 08:20:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUiHCt+yry+35XovlNIXn3y0LR485UXa/ny3ZYlbWjkEEV4vtBIHV0CeRFYG4TbKVGFcpgVWA==@linaro.org X-Google-Smtp-Source: AGHT+IGtmTFExPRSLm/PD4wL0aTMFCBujh4J9UbKEeIC6MxDle5AFH5T76+cEekb/hXD+ChuRgBD X-Received: by 2002:a05:6214:f62:b0:6d8:a148:9ac9 with SMTP id 6a1803df08f44-6d8e73be7c3mr293833756d6.30.1733847619367; Tue, 10 Dec 2024 08:20:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847619; cv=none; d=google.com; s=arc-20240605; b=F9qb+QmocBCdTQ2zBED3U1ZCeCqolV7eA6+uCUYJk9Xl+jm3SsCboqCZMhbI+ioydF UPbpP7BPNHhQJvsBflzlZGghxSpA5ejLLpaaESvwxUhs/B1mA+StHUr3LEudEbfywFKk NhftAfoBKpwlpqUmGk3U4AJVjRTZknIFprghudenGVV8ygOmMqgJgHSUwPFo53SbEWPn VDBz8ImNdd9DOKNIjCl0TAMd9ijo3LRQzP4DtOR5/zWoPn/VkR8mDZU/TwOPzAJQd3YS E/GpHNCUiUMjqjnlPWIi2BaPOAlM4jR/rmM5j5A69Y0q2y8JADK1B7iSOmwVkHmFI/Sk Sjng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=KnGIQa/BmdLZVq6MuFlUl+Av3qfctnpKwsMblLrHMtk=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=XVsSAoPsxNLr1rc1sqFQBEHcQiUHnhCr0U581gpx+d7wpsWcUcaDiFPDgm6hBw8auQ zT2R9YLNjrIhNXHr1WnRvG02/7AAfkdzjPmvGNsAxZkwjPISdFODdEaJu9sQwsBJ5t5A EwCck3oyMSdsJXahopNKAeG0zoM8eaNIVaPgmCBLmNxWDYtIy7MzGFEMwvuKLN5uuNZB 0HPfcWTAh7qxhUn16v2MSYx8c4SPsDgc3RVxA0gsewKpVwNwnOlBR6U+xYNsxkPOwXAp rDtf5NMmYeGXSTwT9LpyhOsXChAgTvm48cg7+8wWJ1lIthGUa0smzqzYJm/uLthU9d2H l4WQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eEnFfT2o; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8ea2a9bc4si113924886d6.89.2024.12.10.08.20.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20:19 -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=eEnFfT2o; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xJ-0003CT-IX; Tue, 10 Dec 2024 11:19:25 -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 1tL2wd-0002cp-H7 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:46 -0500 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2wb-0006Oz-I5 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:43 -0500 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-540218726d5so1890360e87.2 for ; Tue, 10 Dec 2024 08:18:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847519; x=1734452319; 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=KnGIQa/BmdLZVq6MuFlUl+Av3qfctnpKwsMblLrHMtk=; b=eEnFfT2ozCcVGOwNcskcHxPbA6ANUnZd8pyoCBV2vpxIjoI2sQV2EmvVdTSVUyH4k6 tafgzXjJWk/AD+kaCKvaZ2qJ96BlQ7A0qy49kS0AUMHTIpWEScOMXdUOO33IWfrAijtd Y4WDVATPm3094wi1PhQYzTEhMrDTc8tXZJ6uyH2acVDSgUUIkdvLxr7OoNWfYPJr4kvx +9bxOPJlO/DOMkZkNxxi0GWE+ClCUoi7MTCw71PlR4H0Wso+JVoP65wV5I5HW3a1efX6 yjTd3WeDMGulcLuWR9SV12qcoGq+COXybcNzfU6yKfckFuaPXWMwihfdXgPatY5ECab7 2w7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847519; x=1734452319; 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=KnGIQa/BmdLZVq6MuFlUl+Av3qfctnpKwsMblLrHMtk=; b=lXm9/YCN5CdJn96ESSZIMaHHLxrZAFFWT0l5QMx/TlBrn2c4quNIpRHhwjHtzlSTin nuQjTiSA0B9DiGq//I+/BaS6l+b7UpysUi3EvjSF6X9eVW/EIgRPDjy0GDBv8p4uz79y 4V1qxhcxumqGK/GTvAjUq6RdhyTQc26sr/n8s6oWS1ecbq1vqOiYsnO2NgUUAmbWMqX1 Nhl9k3avi5AeUJxs2YvBg3D8MZKK3xv/1D1/L8YNCE6N/+MCJ1K0G9WhWI3PmtlySBF2 ttHbB1ZWm/OAPGwjMY0L1NFBKSYFDOug+q742kzHImaJnZSYrcil8LqOu5cgC+ZgYkQl NoSQ== X-Gm-Message-State: AOJu0Yybz59cwE2uxIYzTWnvk5cI2yfhwXiN+Q/Tx1s2EXFGVRNBOBkS KozpjZrQ4n1Pvz75AzzXZEHuw0eC6cAzWsetQaPh3RoFYlU4koLUdybiTRr9cfYT1weoTmIzZ/o RTcgV8fH1 X-Gm-Gg: ASbGncsMxxPOa6DWmOcNh/PKW+rHoC3Qj2qUz5ew/P3pii0ahO2q85wUkvNKWDnKHvk sxlEhq9D6CLxJwvjNIPvoHcD626eXRe4afkLrATLe32Lg3Wnqu6E0jf8dED7YpH4L1WIhT4EjnF XMw9ASj9A7F8diDZOgb+RZQbJriyJZfyHrpOGkL50V2kIseqnzoQfqxU9LE9ZIFUgLzqs4mnqT2 Z6mzBPaD5AlguJGL9+spxA+q+1yL0eV9HNVAEAqn3+o92FmkC2Mfzxia78= X-Received: by 2002:a05:6512:308d:b0:540:1dac:c042 with SMTP id 2adb3069b0e04-540240ac5d6mr1936055e87.8.1733847519334; Tue, 10 Dec 2024 08:18:39 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.18.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:18:38 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 14/69] target/arm: Convert disas_data_proc_3src to decodetree Date: Tue, 10 Dec 2024 10:16:38 -0600 Message-ID: <20241210161733.1830573-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x135.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 This includes MADD, MSUB, SMADDL, SMSUBL, UMADDL, UMSUBL, SMULH, UMULH. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 119 ++++++++++++--------------------- target/arm/tcg/a64.decode | 16 +++++ 2 files changed, 59 insertions(+), 76 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index d570bbb696..99ff787c61 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7955,98 +7955,68 @@ TRANS(SUB_r, do_addsub_reg, a, true, false) TRANS(ADDS_r, do_addsub_reg, a, false, true) TRANS(SUBS_r, do_addsub_reg, a, true, true) -/* Data-processing (3 source) - * - * 31 30 29 28 24 23 21 20 16 15 14 10 9 5 4 0 - * +--+------+-----------+------+------+----+------+------+------+ - * |sf| op54 | 1 1 0 1 1 | op31 | Rm | o0 | Ra | Rn | Rd | - * +--+------+-----------+------+------+----+------+------+------+ - */ -static void disas_data_proc_3src(DisasContext *s, uint32_t insn) +static bool do_mulh(DisasContext *s, arg_rrr *a, + void (*fn)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) { - int rd = extract32(insn, 0, 5); - int rn = extract32(insn, 5, 5); - int ra = extract32(insn, 10, 5); - int rm = extract32(insn, 16, 5); - int op_id = (extract32(insn, 29, 3) << 4) | - (extract32(insn, 21, 3) << 1) | - extract32(insn, 15, 1); - bool sf = extract32(insn, 31, 1); - bool is_sub = extract32(op_id, 0, 1); - bool is_high = extract32(op_id, 2, 1); - bool is_signed = false; - TCGv_i64 tcg_op1; - TCGv_i64 tcg_op2; - TCGv_i64 tcg_tmp; + TCGv_i64 discard = tcg_temp_new_i64(); + TCGv_i64 tcg_rd = cpu_reg(s, a->rd); + TCGv_i64 tcg_rn = cpu_reg(s, a->rn); + TCGv_i64 tcg_rm = cpu_reg(s, a->rm); - /* Note that op_id is sf:op54:op31:o0 so it includes the 32/64 size flag */ - switch (op_id) { - case 0x42: /* SMADDL */ - case 0x43: /* SMSUBL */ - case 0x44: /* SMULH */ - is_signed = true; - break; - case 0x0: /* MADD (32bit) */ - case 0x1: /* MSUB (32bit) */ - case 0x40: /* MADD (64bit) */ - case 0x41: /* MSUB (64bit) */ - case 0x4a: /* UMADDL */ - case 0x4b: /* UMSUBL */ - case 0x4c: /* UMULH */ - break; - default: - unallocated_encoding(s); - return; - } + fn(discard, tcg_rd, tcg_rn, tcg_rm); + return true; +} - if (is_high) { - TCGv_i64 low_bits = tcg_temp_new_i64(); /* low bits discarded */ - TCGv_i64 tcg_rd = cpu_reg(s, rd); - TCGv_i64 tcg_rn = cpu_reg(s, rn); - TCGv_i64 tcg_rm = cpu_reg(s, rm); +TRANS(SMULH, do_mulh, a, tcg_gen_muls2_i64) +TRANS(UMULH, do_mulh, a, tcg_gen_mulu2_i64) - if (is_signed) { - tcg_gen_muls2_i64(low_bits, tcg_rd, tcg_rn, tcg_rm); - } else { - tcg_gen_mulu2_i64(low_bits, tcg_rd, tcg_rn, tcg_rm); - } - return; - } +static bool do_muladd(DisasContext *s, arg_rrrr *a, + bool sf, bool is_sub, MemOp mop) +{ + TCGv_i64 tcg_rd = cpu_reg(s, a->rd); + TCGv_i64 tcg_op1, tcg_op2; - tcg_op1 = tcg_temp_new_i64(); - tcg_op2 = tcg_temp_new_i64(); - tcg_tmp = tcg_temp_new_i64(); - - if (op_id < 0x42) { - tcg_gen_mov_i64(tcg_op1, cpu_reg(s, rn)); - tcg_gen_mov_i64(tcg_op2, cpu_reg(s, rm)); + if (mop == MO_64) { + tcg_op1 = cpu_reg(s, a->rn); + tcg_op2 = cpu_reg(s, a->rm); } else { - if (is_signed) { - tcg_gen_ext32s_i64(tcg_op1, cpu_reg(s, rn)); - tcg_gen_ext32s_i64(tcg_op2, cpu_reg(s, rm)); - } else { - tcg_gen_ext32u_i64(tcg_op1, cpu_reg(s, rn)); - tcg_gen_ext32u_i64(tcg_op2, cpu_reg(s, rm)); - } + tcg_op1 = tcg_temp_new_i64(); + tcg_op2 = tcg_temp_new_i64(); + tcg_gen_ext_i64(tcg_op1, cpu_reg(s, a->rn), mop); + tcg_gen_ext_i64(tcg_op2, cpu_reg(s, a->rm), mop); } - if (ra == 31 && !is_sub) { + if (a->ra == 31 && !is_sub) { /* Special-case MADD with rA == XZR; it is the standard MUL alias */ - tcg_gen_mul_i64(cpu_reg(s, rd), tcg_op1, tcg_op2); + tcg_gen_mul_i64(tcg_rd, tcg_op1, tcg_op2); } else { + TCGv_i64 tcg_tmp = tcg_temp_new_i64(); + TCGv_i64 tcg_ra = cpu_reg(s, a->ra); + tcg_gen_mul_i64(tcg_tmp, tcg_op1, tcg_op2); if (is_sub) { - tcg_gen_sub_i64(cpu_reg(s, rd), cpu_reg(s, ra), tcg_tmp); + tcg_gen_sub_i64(tcg_rd, tcg_ra, tcg_tmp); } else { - tcg_gen_add_i64(cpu_reg(s, rd), cpu_reg(s, ra), tcg_tmp); + tcg_gen_add_i64(tcg_rd, tcg_ra, tcg_tmp); } } if (!sf) { - tcg_gen_ext32u_i64(cpu_reg(s, rd), cpu_reg(s, rd)); + tcg_gen_ext32u_i64(tcg_rd, tcg_rd); } + return true; } +TRANS(MADD_w, do_muladd, a, false, false, MO_64) +TRANS(MSUB_w, do_muladd, a, false, true, MO_64) +TRANS(MADD_x, do_muladd, a, true, false, MO_64) +TRANS(MSUB_x, do_muladd, a, true, true, MO_64) + +TRANS(SMADDL, do_muladd, a, true, false, MO_SL) +TRANS(SMSUBL, do_muladd, a, true, true, MO_SL) +TRANS(UMADDL, do_muladd, a, true, false, MO_UL) +TRANS(UMSUBL, do_muladd, a, true, true, MO_UL) + /* Add/subtract (with carry) * 31 30 29 28 27 26 25 24 23 22 21 20 16 15 10 9 5 4 0 * +--+--+--+------------------------+------+-------------+------+-----+ @@ -8364,13 +8334,10 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) disas_cond_select(s, insn); break; - case 0x8 ... 0xf: /* (3 source) */ - disas_data_proc_3src(s, insn); - break; - default: do_unallocated: case 0x6: /* Data-processing */ + case 0x8 ... 0xf: /* (3 source) */ unallocated_encoding(s); break; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 27a3101bc6..b0cc8bd476 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -753,6 +753,22 @@ SUBS_ext . 11 01011001 ..... ... ... ..... ..... @addsub_ext # Conditional select # Data Processing (3-source) +&rrrr rd rn rm ra +@rrrr . .. ........ rm:5 . ra:5 rn:5 rd:5 &rrrr + +MADD_w 0 00 11011000 ..... 0 ..... ..... ..... @rrrr +MSUB_w 0 00 11011000 ..... 1 ..... ..... ..... @rrrr +MADD_x 1 00 11011000 ..... 0 ..... ..... ..... @rrrr +MSUB_x 1 00 11011000 ..... 1 ..... ..... ..... @rrrr + +SMADDL 1 00 11011001 ..... 0 ..... ..... ..... @rrrr +SMSUBL 1 00 11011001 ..... 1 ..... ..... ..... @rrrr +UMADDL 1 00 11011101 ..... 0 ..... ..... ..... @rrrr +UMSUBL 1 00 11011101 ..... 1 ..... ..... ..... @rrrr + +SMULH 1 00 11011010 ..... 0 11111 ..... ..... @rrr +UMULH 1 00 11011110 ..... 0 11111 ..... ..... @rrr + ### Cryptographic AES AESE 01001110 00 10100 00100 10 ..... ..... @r2r_q1e0 From patchwork Tue Dec 10 16:16:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848813 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416301wrn; Tue, 10 Dec 2024 08:20:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX3NAPyI3v1m6thKqN59tNf82WOnuVA/rVdw11m8eWNb9iyiIlDfvISSw6l0SIFr10EdIlGbQ==@linaro.org X-Google-Smtp-Source: AGHT+IHd3iao5Ch5Ig4ZJnKVG5AlEv49c+S5DU1NWqmieLwkA2uN6wfMOgNcZdw8xlwGBVq+/2gy X-Received: by 2002:ad4:5c49:0:b0:6d8:8f14:2f5c with SMTP id 6a1803df08f44-6d91e36fb15mr106419226d6.23.1733847605302; Tue, 10 Dec 2024 08:20:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847605; cv=none; d=google.com; s=arc-20240605; b=kn+xmyx1SjCU9ukUcC16EFXbihBDtOJ9lqhf5tgkxCcD/IS1DA+GwLrFtPa2JvzHfx tLQ2GZ5hrHfRHj/nzeUkGbGk3YjEjy6U5WLLgFgi9/qQJPXadsvJl37WHcAJu2ff8gPs RRlO88YxXx2eCn/eiU0Z7m7xTMKR3F6uV/gpLNcGpdQs4p6zha5YTx8LcS7CHVA1/0c8 cHMEQzJTw0nM6U5JyRT8uj1p6hIU6mOcgBwYGdwIy4nEH91h0px1dZZx5GUUTejsB+Zm xSB3tvudDb54kSx7wRSF61sLj5I9e91H50f5BGjFnuHKvqc0vuUS2oFjb4lFQsWXYYDo vI0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=4Io19/CScrA5Q2D7CSJ00bcM9NMayI0ImV9POYZmxx0=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=leFzeXtSeU4e8JNBKM+R+kBkeRzFqLQD98zowsfEdfLIvzCExeWDWNzj7xiOA9L0s9 XAdNKXwfZa/kmeJrUM3nCwp0Fry+aBBq1G2A8E4ADUbF8nll+F7GoxW269u8qSyF0HWz GGSu6Kk/QFZQNT5C+Smle80AfSbqQ7BIbws2fpaL2Zga30Wz3Nx5pV4ZGP1TeH1Gr7Ks TkeX9cF9NYv9pe/M61Xz8j/gIhLdjpsJL/6UwZkBMDWFkHE0cgO9ZCcOr/VoJctd9sjh 7WlvBpR13ZRqNbnVdkJutObErkpZaQvDTPAYttdR00F8Q1ysuq3XQQVzi1vYAEdgal6h mRYA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qcJ655o7; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6d4ab0f13si603073385a.7.2024.12.10.08.20.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20:05 -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=qcJ655o7; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2x7-0002vG-D5; Tue, 10 Dec 2024 11:19:19 -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 1tL2wg-0002ip-Oc for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:47 -0500 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2we-0006Pd-Up for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:46 -0500 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-54026562221so728493e87.1 for ; Tue, 10 Dec 2024 08:18:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847523; x=1734452323; 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=4Io19/CScrA5Q2D7CSJ00bcM9NMayI0ImV9POYZmxx0=; b=qcJ655o7q3Zb8YtLuzbz/FEhPFQ2nIFqs9jJVkZGOmGcewsXipnrVxliwZebKt+Cm8 5i1UNq9NckFDqxi5CfrNBHKp2lHy5bB/ScNdpxcOGwQNCyjQvecJVFFdN4TQilruEffV vM8YCVPUydpqODQf60H12lcdl++HelpULOBl3AmHuf+lsfZZOJqvl0wImxqP6OO3B5r5 0oMpKfXWJ/O1m0NrCRCVs8GKhGEMu0x/t/OnZiq2J331sYoG+S09Sebs+8kj3yVBeTvM +8eFvUKaYDarDm20PTyo8mCHYnAhzbEggfDSwrRGUzVARk9dSZtcbRAtZezIwGOXHAm6 zOBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847523; x=1734452323; 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=4Io19/CScrA5Q2D7CSJ00bcM9NMayI0ImV9POYZmxx0=; b=r+BNMTIwxFcWWoZsyWzYZrKrecJomJ6lT1TMA22zYJ45CMDaJ1J//jtEbM5RPSO0gu kU8aCPyPykjBdJ7+u10JY09qkoiNGag42VIm+R3Lyd3aKBJLMIitnnstUMShdu7d84fM yPK1/VxqqLVGVBFNKCRc1JNfHbIizYe/GfxUapgNaxNwSfctbyRXQJGV8bl+hBI8pCmB NoV+qoEdXe8LKT+RnDcI6gMvMSuH4g2QWkyCaz5N7er0GBlvyJu5CcCveSUwbM51ahXB 9tue0bQwtPbCCmzV7qYgdwnPLDuatL1wZUoxJq8wjMNJOu09eEM+R5q/lrDa0TmBcHNZ pCEw== X-Gm-Message-State: AOJu0YySPA4m+i46XQJ7sk1DnhLVqnvioMEscj2P5OF/U4Gjr2XNZiNa Tywys3EVKsQ6YKmp8DcEfehbg4k7bfcXoM3ZHKv49rfrVaPzAGz4gGxTd1dYn1PpiJjTj7LVSHV L8DSvEwEP X-Gm-Gg: ASbGncu6qNZCYbmJS58vWAgN73wXaCwrHd2ZKnC/kP2lrqSpf993LKCGG18AP6EOqZh 6RXzUe3UGxI3gWqXwOBqu+wxdLh2H+sNAtIZ/2FKHviRJhIVVhoZ+2LsesJcWklWtQuqoGO/WWX qwAobQADx9BL1r5OmVAUzFZPlW1wcZQUkKZyaKEmVnO+yKtS3pAUwXNu7pXYGiOyKFZ0TXV0Nuv fvjYAgwqXQtfkrLldPsIrikTqex4RurBQv/2RxGTgSDYSnVhkRwnqMdEDQ= X-Received: by 2002:a05:6512:ba6:b0:540:1c6e:f046 with SMTP id 2adb3069b0e04-54024107755mr1825392e87.36.1733847523210; Tue, 10 Dec 2024 08:18:43 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.18.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:18:42 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 15/69] target/arm: Convert disas_adc_sbc to decodetree Date: Tue, 10 Dec 2024 10:16:39 -0600 Message-ID: <20241210161733.1830573-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12f.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 This includes ADC, SBC, ADCS, SBCS. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 43 +++++++++++++--------------------- target/arm/tcg/a64.decode | 6 +++++ 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 99ff787c61..d7747fcf57 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8017,42 +8017,34 @@ TRANS(SMSUBL, do_muladd, a, true, true, MO_SL) TRANS(UMADDL, do_muladd, a, true, false, MO_UL) TRANS(UMSUBL, do_muladd, a, true, true, MO_UL) -/* Add/subtract (with carry) - * 31 30 29 28 27 26 25 24 23 22 21 20 16 15 10 9 5 4 0 - * +--+--+--+------------------------+------+-------------+------+-----+ - * |sf|op| S| 1 1 0 1 0 0 0 0 | rm | 0 0 0 0 0 0 | Rn | Rd | - * +--+--+--+------------------------+------+-------------+------+-----+ - */ - -static void disas_adc_sbc(DisasContext *s, uint32_t insn) +static bool do_adc_sbc(DisasContext *s, arg_rrr_sf *a, + bool is_sub, bool setflags) { - unsigned int sf, op, setflags, rm, rn, rd; TCGv_i64 tcg_y, tcg_rn, tcg_rd; - sf = extract32(insn, 31, 1); - op = extract32(insn, 30, 1); - setflags = extract32(insn, 29, 1); - rm = extract32(insn, 16, 5); - rn = extract32(insn, 5, 5); - rd = extract32(insn, 0, 5); + tcg_rd = cpu_reg(s, a->rd); + tcg_rn = cpu_reg(s, a->rn); - tcg_rd = cpu_reg(s, rd); - tcg_rn = cpu_reg(s, rn); - - if (op) { + if (is_sub) { tcg_y = tcg_temp_new_i64(); - tcg_gen_not_i64(tcg_y, cpu_reg(s, rm)); + tcg_gen_not_i64(tcg_y, cpu_reg(s, a->rm)); } else { - tcg_y = cpu_reg(s, rm); + tcg_y = cpu_reg(s, a->rm); } if (setflags) { - gen_adc_CC(sf, tcg_rd, tcg_rn, tcg_y); + gen_adc_CC(a->sf, tcg_rd, tcg_rn, tcg_y); } else { - gen_adc(sf, tcg_rd, tcg_rn, tcg_y); + gen_adc(a->sf, tcg_rd, tcg_rn, tcg_y); } + return true; } +TRANS(ADC, do_adc_sbc, a, false, false) +TRANS(SBC, do_adc_sbc, a, true, false) +TRANS(ADCS, do_adc_sbc, a, false, true) +TRANS(SBCS, do_adc_sbc, a, true, true) + /* * Rotate right into flags * 31 30 29 21 15 10 5 4 0 @@ -8305,10 +8297,6 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) switch (op2) { case 0x0: switch (op3) { - case 0x00: /* Add/subtract (with carry) */ - disas_adc_sbc(s, insn); - break; - case 0x01: /* Rotate right into flags */ case 0x21: disas_rotate_right_into_flags(s, insn); @@ -8322,6 +8310,7 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) break; default: + case 0x00: /* Add/subtract (with carry) */ goto do_unallocated; } break; diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index b0cc8bd476..7a40ca455e 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -746,6 +746,12 @@ ADDS_ext . 01 01011001 ..... ... ... ..... ..... @addsub_ext SUBS_ext . 11 01011001 ..... ... ... ..... ..... @addsub_ext # Add/subtract (carry) + +ADC . 00 11010000 ..... 000000 ..... ..... @rrr_sf +ADCS . 01 11010000 ..... 000000 ..... ..... @rrr_sf +SBC . 10 11010000 ..... 000000 ..... ..... @rrr_sf +SBCS . 11 11010000 ..... 000000 ..... ..... @rrr_sf + # Rotate right into flags # Evaluate into flags # Conditional compare (regster) From patchwork Tue Dec 10 16:16:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848819 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416618wrn; Tue, 10 Dec 2024 08:20:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWnC8r3eUNepSWvye65yuXIJbz1JFfSQ+GRoMNs+EeGGprBmofKcre4U0bQ7rNZ9ZZk7CAtMw==@linaro.org X-Google-Smtp-Source: AGHT+IHVhSyTXuRXf0/elWeYYeZiP+hRY2iGg8WxaEgNUg6zF4RqyRQD8Sj3+JXCF5wL+Vz0+XHE X-Received: by 2002:a05:622a:34b:b0:466:a0e2:ae8e with SMTP id d75a77b69052e-46734cc233bmr272705641cf.9.1733847635036; Tue, 10 Dec 2024 08:20:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847635; cv=none; d=google.com; s=arc-20240605; b=cyqRKFM4/FMuPId8t3PR6pUlLq152BMQs/QqWFTuTdNZqb4bKDFzORGGWei5To1CN/ zrsqiaBpt6V9LKwdIgsPmErch0a5A3a5yHjwEsul2c3o5T+pfYfJIgv6qjmcP5fYJTdJ 8buwhlsxqMUtRzwj7T6GCCKemLRneugC8IVldkXDkFJgLKFkBJ1cTChYkPo8YoQuidNu JZZ03r2aV29VvjJmljarmzgT4bKLVzjMIUCG4GSRqO1of24Ez0ECPMf1XWNabmDTUaFD ruZUaam7+U9FS5vu8uZcGGsH9KuRuKyYkJlkr7B15Tot39oD4sivpj2ryXaOc2xgLbPv 3/CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=2oj/RkpXIcAPwY3YCVzEeJhtiY5v3oKNvSYJvuwDEeY=; fh=OZQBfL75rC14cCDy3q+1fYHCs9KjWAQ7ZJ3hTfS+5lQ=; b=amFqnnP2BiH+SYtFbjjz30u9I5lZgANG4QwFG6UloG5mGC43zLDyfQfEFvbnH3zmPf tR0X0hh4hfZklCuo8KAExTd/x5HX/AyCmPAVpXHTW+iXl8SZm4/N1r+1mvo1h4B/XIRX HD+l3HFqy4EJTfNDmVVOvzF1mmEpcJIT5p+w+dLPD+/qvjoZEu6nCdr9m1idj3oSF8Ff GTMn/tVQ9BM2QLepwwuDuE2Ipje/V1dJP7V6GrsSOQAofMkQkC0fN1WACC9y9feiGq/V DubYiXdUjxUEm6zD1CwrYO8N4z7akYAl7ROGAJWmzs1naUCIBgVPS+UBvmrIIUx+F2Op LGYQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WRDiHQRO; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46782e8aae7si13291141cf.59.2024.12.10.08.20.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20: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=WRDiHQRO; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xU-0004Cf-3c; Tue, 10 Dec 2024 11:19:36 -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 1tL2wk-0002nA-UI for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:52 -0500 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2wi-0006QE-Nj for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:50 -0500 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-53df19bf6a9so6636850e87.1 for ; Tue, 10 Dec 2024 08:18:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847527; x=1734452327; 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=2oj/RkpXIcAPwY3YCVzEeJhtiY5v3oKNvSYJvuwDEeY=; b=WRDiHQROX7lsGE37nSzhyfqPvTtkcpJw3/ZZmuX1YcmVgHYtX937lxNw/kpigcpCVB 49LvlYqevIJ93eDEU75tnRGMx3/oG6fu3affHN/qu0kvyEAAMgEONzGYUgEnIzSgSsBf p3Ukswb+7B7MxnobhsAfkjUxpcgtHMBA9XI8V/98B/gEQY5F/fWQIiV4Kjl94BeA4eqr ZdjlvqBQ/gn7boF7oFv83XtL3Kalzr9dOhMr0v17/vqxfQhxRyKPpS2Z7fy4z6JU7d4H 7bkcus7btl4GVFU6ZI+owVFkQ6rW9OUwDjnk64oDBU9dlZ89VSo57iMqaDwUUhv9KtWB 3Fiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847527; x=1734452327; 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=2oj/RkpXIcAPwY3YCVzEeJhtiY5v3oKNvSYJvuwDEeY=; b=t6h6tL9h/yf0I6Z2UhPd6/6moG4+ykJiQzaA7yL1h99yH4KycAp/Z5hIWX0vxeWwa5 SvzEp9Ux02Lo0QzRWoNnO2qthH9Vo6q3mh+QEjG1fZinGkovExieQqhaefd+o+YgxUCI 1+OF+0a0nDZcMZiFV+8qNNhD259u7UiFwmvkU0LTt5El7WynUFq611g1i+RYJwn4FIXt MPY0vuA5KjRzyeFOtTNQED5lwarLwRmGKn30lOmJyiGk1pFPd4GlCAh/0or+OqOFNop8 sDpKvjnGeEKs2qrfGm7Of4Xo7ggBgyjCqOCOUtRsXY3YJEXB67lFts/g+KSp8GezAucf pahQ== X-Gm-Message-State: AOJu0YzSWX7sYwm0iOHDV/W4JRFo5j2B44sgDzqEmWy51ObKpCtJo1m1 JV2aHezlIOsmV6Xv1HD1i3RhO7LqAk/27iQPwLhTDLOeHTNqnNA3AVlEpQ0wgyFv+NImQbGFB2y nhsQWNGCh X-Gm-Gg: ASbGnctN+y+rpZ6/B1F/ZWGTWo8b4yqYmOumoUH/je6gIeI0NS9bJKgKJujikMaY3zd fPnVivGNP3BDJNTI+4+EtcIi3rIpTd/S+0tWAzJWxy6dDQ7oAgSD9XFMIds7MZQhjRhRGGn1E2J URejx09ZSnurKbLwXTvEJJPOnIYyMxRidCx38xVk53fcwLYWKUqWoCtXhaaGXr5ORrN/z9sotTK EwmTzQ7dD+ofSzd17TERbppmT7a1yCxdJ2ibOjMG8j2zXA66jkIQ+H8yVE= X-Received: by 2002:ac2:4e06:0:b0:540:2549:b56e with SMTP id 2adb3069b0e04-5402549b696mr1653248e87.12.1733847527037; Tue, 10 Dec 2024 08:18:47 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:18:45 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 16/69] target/arm: Convert RMIF to decodetree Date: Tue, 10 Dec 2024 10:16:40 -0600 Message-ID: <20241210161733.1830573-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12f.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 32 +++++++++----------------------- target/arm/tcg/a64.decode | 3 +++ 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index d7747fcf57..1af41e22eb 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8045,30 +8045,18 @@ TRANS(SBC, do_adc_sbc, a, true, false) TRANS(ADCS, do_adc_sbc, a, false, true) TRANS(SBCS, do_adc_sbc, a, true, true) -/* - * Rotate right into flags - * 31 30 29 21 15 10 5 4 0 - * +--+--+--+-----------------+--------+-----------+------+--+------+ - * |sf|op| S| 1 1 0 1 0 0 0 0 | imm6 | 0 0 0 0 1 | Rn |o2| mask | - * +--+--+--+-----------------+--------+-----------+------+--+------+ - */ -static void disas_rotate_right_into_flags(DisasContext *s, uint32_t insn) +static bool trans_RMIF(DisasContext *s, arg_RMIF *a) { - int mask = extract32(insn, 0, 4); - int o2 = extract32(insn, 4, 1); - int rn = extract32(insn, 5, 5); - int imm6 = extract32(insn, 15, 6); - int sf_op_s = extract32(insn, 29, 3); + int mask = a->mask; TCGv_i64 tcg_rn; TCGv_i32 nzcv; - if (sf_op_s != 5 || o2 != 0 || !dc_isar_feature(aa64_condm_4, s)) { - unallocated_encoding(s); - return; + if (!dc_isar_feature(aa64_condm_4, s)) { + return false; } - tcg_rn = read_cpu_reg(s, rn, 1); - tcg_gen_rotri_i64(tcg_rn, tcg_rn, imm6); + tcg_rn = read_cpu_reg(s, a->rn, 1); + tcg_gen_rotri_i64(tcg_rn, tcg_rn, a->imm); nzcv = tcg_temp_new_i32(); tcg_gen_extrl_i64_i32(nzcv, tcg_rn); @@ -8086,6 +8074,7 @@ static void disas_rotate_right_into_flags(DisasContext *s, uint32_t insn) if (mask & 1) { /* V */ tcg_gen_shli_i32(cpu_VF, nzcv, 31 - 0); } + return true; } /* @@ -8297,11 +8286,6 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) switch (op2) { case 0x0: switch (op3) { - case 0x01: /* Rotate right into flags */ - case 0x21: - disas_rotate_right_into_flags(s, insn); - break; - case 0x02: /* Evaluate into flags */ case 0x12: case 0x22: @@ -8311,6 +8295,8 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) default: case 0x00: /* Add/subtract (with carry) */ + case 0x01: /* Rotate right into flags */ + case 0x21: goto do_unallocated; } break; diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 7a40ca455e..454494742e 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -753,6 +753,9 @@ SBC . 10 11010000 ..... 000000 ..... ..... @rrr_sf SBCS . 11 11010000 ..... 000000 ..... ..... @rrr_sf # Rotate right into flags + +RMIF 1 01 11010000 imm:6 00001 rn:5 0 mask:4 + # Evaluate into flags # Conditional compare (regster) # Conditional compare (immediate) From patchwork Tue Dec 10 16:16:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848809 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416171wrn; Tue, 10 Dec 2024 08:19:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUauKsZeGrdFuco1dJ8YZ/5v64A2W0K0D9/mM/WDIH/56oqH7MWFlcsdDboDyCSdw0+0hlu9A==@linaro.org X-Google-Smtp-Source: AGHT+IElhn2lGjH7lhvvGjIzrOVRo8hgHyqKFKniV3COeCzy+wx2NuUJpOLBAx7sO/YaWQeuauVJ X-Received: by 2002:a05:6122:8c0b:b0:518:7777:a61e with SMTP id 71dfb90a1353d-51888376817mr5261701e0c.5.1733847587806; Tue, 10 Dec 2024 08:19:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847587; cv=none; d=google.com; s=arc-20240605; b=Px3pQRTmZTX9KDddTmP/LfbCD0njO5MQ9jWl789a6dFb3HoPs1MKbIE5/oM7DejHEl 0FeGNGVvIrCr3IoB57QxqHERKXL6Nwwc4jrT3hqWQDzdeK53hmWVUqANATMygWDMqeaH tZnajiW0n8ZuJQ9itAhEagH3np3ulN1FMFwYKCZ0IYw9lKHrAedI9v8GTMm+rsA+HVXH s7w/JdNr6KPH8UAsXKJ+nwoHvM9Tw3bTGnQZuEl2oSqnc/fnDOB9nnfgRupAxxpXCxuo hKgfWgKqzNWrhcLNcwzebFSwiVlaun106/osMxZr8BttvQpX2Hw6SnWGoPpoCA94SkOz 0RnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=LirZcHgHdp9tBVrM59CgIjq2zHMAEgw0F35SBHQ2JzQ=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=GHQ5XBapAMVgBtTzlABZFYOny45EyKgRmPI0iIUWI+uMq1tOvHUx2ma6oRjoqhAuid /vNp4SfZcIZzEcUx4de4WV9NZ0KXwcVhSs+XYiuVKUuaxFSIOdDZcczeRuDiNkEPA3Fg KQpb2vriZtxe8rpyZe4oWYlu5U5dKGvexxcAactuiZfAPKkZJl9RwZqEJc0Exduz20PB 8yyL/6v3lrSNpqk7hKExWv0INHL2WkrinlbtiR8nvLwMTZVw2QLBAYO/jpriy47uFVl7 Su90q8198Samox0k9JeS87V7Ws85tpsPH2N93KH6ws4VfY9kzayMpMfLPCCZZCB4btZB GXsw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LqQVUnBl; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-5160cef24bfsi2242628e0c.172.2024.12.10.08.19.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:19:47 -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=LqQVUnBl; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xJ-0003B0-7H; Tue, 10 Dec 2024 11:19:25 -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 1tL2wo-0002na-R7 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:01 -0500 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2wm-0006Qk-Rj for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:54 -0500 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-53ff1f7caaeso3305173e87.0 for ; Tue, 10 Dec 2024 08:18:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847531; x=1734452331; 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=LirZcHgHdp9tBVrM59CgIjq2zHMAEgw0F35SBHQ2JzQ=; b=LqQVUnBlT6ufxGBO4V/GjZlv61xRLFywlYNyyWRscreY0OisqGB2+IxCNQFLHCVHT6 GcEGdnge0m18VzRWhzvm+8YVvYl0JOXeaB6WTGkBe5yu1OY82QZNx81ulYuN67SrDLqF ci0roFzIjOYqAqdDuNeMqeQ58rjCgP6FijNw0JrrKfa5mlRadsoZQPvQb1T3uiiS9b6k dNPqK7TPTKaLTk2PgFhyqM5i62/6cY92kGARclj9mivuPJHCkFut7Jx5M/r3dPajZm8u NvsP/r8dHO6Y8NBMvG3csU0H6EpDTvZN0/eSpiayR39PCOipdpOOBVSp9cQ+B1iXmcge nRUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847531; x=1734452331; 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=LirZcHgHdp9tBVrM59CgIjq2zHMAEgw0F35SBHQ2JzQ=; b=w1pJ8+mPlDoWMoQDRH99luet6tT8raYms8vJpI+VrOeEmT+HG9GLGL/SYXXUWiMvx2 rHYJsOMs002K4P34VkkaQZ4LSrsncbcSmjBbtDC3w2mgsGEBlWMw5o30B0d3wuhFDAJi MCp4FjXP2Jzj5wAH5Y14flGu4MKRg1zguy2DVLeNjUxbW5CmXOCH4vrcPIGOr2Y0NNR2 45/l0XBdDKR//slhC2HvUjo3K20XohlvmQxz2q18dfk7z5ahE6XgBks9izZ6o1x7J1/x i63q5Zw5nhinNtU1lKfH+lkGcSWwUXvZa6BNmEiKuBxw2E7qKZYDmIB4uQGS1F3IP/DA 8axw== X-Gm-Message-State: AOJu0YxFrDK+rvWcN7SeEKLtfEW4M14wWT98fWh2+B3uQB1Z3x7gAOsG rCK7sk0aU1Be91pCRdBSgJwKM3boj58m6XMuZBu+gXedJhCiXh1XWt3h704h+eOpVjaMFAEq5es AFySqzcFZ X-Gm-Gg: ASbGncspo8BbB+rjrYl6LOJIrsgvsGU7bEzmOweP9tiRzZ5YLSxFueEkhEhloaP3ivS KuIxT2FbHvqKBjF3HT21f6IWZOPgXq1GcbvRjjyftsQRCpyqpfPAXkoOKZWe++OtL68LO79DtiS M1C4rojI2zhvdnBu1KqMh7+BWgVRiFtpdcZrTVKR9mlZrvpngt9tThgKdtc1OsAkESG3QMMDqqZ CqhQmN/9X51CDpqh4lITfCvK4Gg37AHrqGXpW7IJHXl6q4+ZwhGpHHm0bk= X-Received: by 2002:a05:6512:3e01:b0:53e:389d:8ce4 with SMTP id 2adb3069b0e04-540240e1cf3mr1970327e87.34.1733847531019; Tue, 10 Dec 2024 08:18:51 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.18.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:18:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 17/69] target/arm: Convert SETF8, SETF16 to decodetree Date: Tue, 10 Dec 2024 10:16:41 -0600 Message-ID: <20241210161733.1830573-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x133.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 48 +++++----------------------------- target/arm/tcg/a64.decode | 4 +++ 2 files changed, 11 insertions(+), 41 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 1af41e22eb..774689641d 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8077,38 +8077,21 @@ static bool trans_RMIF(DisasContext *s, arg_RMIF *a) return true; } -/* - * Evaluate into flags - * 31 30 29 21 15 14 10 5 4 0 - * +--+--+--+-----------------+---------+----+---------+------+--+------+ - * |sf|op| S| 1 1 0 1 0 0 0 0 | opcode2 | sz | 0 0 1 0 | Rn |o3| mask | - * +--+--+--+-----------------+---------+----+---------+------+--+------+ - */ -static void disas_evaluate_into_flags(DisasContext *s, uint32_t insn) +static bool do_setf(DisasContext *s, int rn, int shift) { - int o3_mask = extract32(insn, 0, 5); - int rn = extract32(insn, 5, 5); - int o2 = extract32(insn, 15, 6); - int sz = extract32(insn, 14, 1); - int sf_op_s = extract32(insn, 29, 3); - TCGv_i32 tmp; - int shift; + TCGv_i32 tmp = tcg_temp_new_i32(); - if (sf_op_s != 1 || o2 != 0 || o3_mask != 0xd || - !dc_isar_feature(aa64_condm_4, s)) { - unallocated_encoding(s); - return; - } - shift = sz ? 16 : 24; /* SETF16 or SETF8 */ - - tmp = tcg_temp_new_i32(); tcg_gen_extrl_i64_i32(tmp, cpu_reg(s, rn)); tcg_gen_shli_i32(cpu_NF, tmp, shift); tcg_gen_shli_i32(cpu_VF, tmp, shift - 1); tcg_gen_mov_i32(cpu_ZF, cpu_NF); tcg_gen_xor_i32(cpu_VF, cpu_VF, cpu_NF); + return true; } +TRANS_FEAT(SETF8, aa64_condm_4, do_setf, a->rn, 24) +TRANS_FEAT(SETF16, aa64_condm_4, do_setf, a->rn, 16) + /* Conditional compare (immediate / register) * 31 30 29 28 27 26 25 24 23 22 21 20 16 15 12 11 10 9 5 4 3 0 * +--+--+--+------------------------+--------+------+----+--+------+--+-----+ @@ -8277,30 +8260,12 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) { int op1 = extract32(insn, 28, 1); int op2 = extract32(insn, 21, 4); - int op3 = extract32(insn, 10, 6); if (!op1) { goto do_unallocated; } switch (op2) { - case 0x0: - switch (op3) { - case 0x02: /* Evaluate into flags */ - case 0x12: - case 0x22: - case 0x32: - disas_evaluate_into_flags(s, insn); - break; - - default: - case 0x00: /* Add/subtract (with carry) */ - case 0x01: /* Rotate right into flags */ - case 0x21: - goto do_unallocated; - } - break; - case 0x2: /* Conditional compare */ disas_cc(s, insn); /* both imm and reg forms */ break; @@ -8311,6 +8276,7 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) default: do_unallocated: + case 0x0: case 0x6: /* Data-processing */ case 0x8 ... 0xf: /* (3 source) */ unallocated_encoding(s); diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 454494742e..ae2c6831d7 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -757,6 +757,10 @@ SBCS . 11 11010000 ..... 000000 ..... ..... @rrr_sf RMIF 1 01 11010000 imm:6 00001 rn:5 0 mask:4 # Evaluate into flags + +SETF8 0 01 11010000 00000 000010 rn:5 01101 +SETF16 0 01 11010000 00000 010010 rn:5 01101 + # Conditional compare (regster) # Conditional compare (immediate) # Conditional select From patchwork Tue Dec 10 16:16:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848811 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416277wrn; Tue, 10 Dec 2024 08:20:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXwmGpIYhK9UhLJbaH+twxaNRvfDb8qWODpUSCex5tYUlgR2oKLMA2wu7HVGjenzvB1k++ksw==@linaro.org X-Google-Smtp-Source: AGHT+IHYelI2ewcmHATHfQyBR7K7Qwp3znD7mYEP4ECAqLW2EAleUY0VfYRr4cqRkNPFQ0gI4c0v X-Received: by 2002:a05:620a:19a1:b0:7b6:91a4:845b with SMTP id af79cd13be357-7b6bcad2773mr3065632785a.15.1733847601029; Tue, 10 Dec 2024 08:20:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847601; cv=none; d=google.com; s=arc-20240605; b=UVpXBOvdsZJHW8IMM2PDJMD9cNorQdgoSn297SFj5V+rQ6ML1Agi/3O4FlJZSpN3cz UHTm4xBBD1Ns5yEfb2GzRz1PE1RmLbVuw5D5MyvBxI7NkjUu7nXPZ2ryg7EANg/6PkrC AGF/a+jH6UCw1dFO1GjlHpsGeImXYP1OQ0QE47SJ7lMbVLMo6EjRdwvkuwDoOdYSnJMZ J3g0W9MfY5ls9pnf8NIoGoCtT+5mQLC1/1jwDd03P6LwCnBbIYjuu2cwdEV592jg9UJk dzlxTu2mD49Tbv0VlWZo1NHpDgByn7HxpGpHY7EGVxus2ay917NNDF1aW2e4WVijkYs0 mNRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=TmvLC72KaZzM8jiapnL2kS3QqFWjexV3Z72ZJbn8iE0=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=f54GxZ7FGzvFHkaGvqMRdwGxDitxXQVgDw+vKmXkaTkUSpuwC22Zx1DEWImsoGAwe/ iM07u7SRK0FIfjCIWaJTVkCL5USRHU2jGElLmsW3j6zH9RJDB6lgqQ54loo//RWHjmDD NzdRMbi5aF4WLFWns2PwDnQ5VrWFqxdts0i8q8Z0id0rmZiFX6R2ldOhGWKzIxV9uLdI e46K92M0f2LHffzUxNIButpEP0i+LlkoXMxxkp12eyE6E7VE6nCP/3VTY5Uj/LyRyyBn dvVRWmaixvhaOW6/jqKiL6++apigXmn8/KkG2wuFJoTcBMQKmmvhpOUEBK8+p7Z8FMk1 uoiA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PFrFgZWs; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6d87c5556si430304285a.53.2024.12.10.08.20.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20:01 -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=PFrFgZWs; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xK-0003Lt-OI; Tue, 10 Dec 2024 11:19:26 -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 1tL2ww-0002vE-Dt for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:05 -0500 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2wq-0006RN-Ml for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:18:58 -0500 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-30036310158so33201371fa.0 for ; Tue, 10 Dec 2024 08:18:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847535; x=1734452335; 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=TmvLC72KaZzM8jiapnL2kS3QqFWjexV3Z72ZJbn8iE0=; b=PFrFgZWsBmXk00eXOG/Qm813OsJFWkwgVAOWUo7VJP4qMF4Cb7ea9Fs4IqKw/GiIZ6 QGpGel/n9Gieqr+w1i8gab6xxWcz3JFOUWy2yE2HhuaGjx0rBcslNWhJE+lhxuNu4Ztn MHB3Z6vO/x9C3JOZO8DxlMXtlaVAGzy7JVvsIscrLphfCXgSB4WCiwvNRAcoKmbs7d92 gO2xfqMaTTHVHPOPv75dMyHm74+Ij39Qz20nJe+pwMocSP735+K9ctk7KkDGlE4dKTKq Lm0RoOcoQrY8t3k0/Xdcv9oBRGp/ecF+gTPy2H0ZpMrtDJBlwz45ozHpK5uiWs7yJOPS rdBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847535; x=1734452335; 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=TmvLC72KaZzM8jiapnL2kS3QqFWjexV3Z72ZJbn8iE0=; b=YC9r4m3pfhnYR8Nuh3LXHxp57Yzy/HTK7Lk/57UsYDhO+H3+wgq3biyN7XPKmcW6ZS rZtROnS4ecaxnBKxEqPZn1DKFeCV+FxNHc/JUyFk5ivnmAYBUNgMxSqN8JVJRHHeeMe7 W+FwCWfCIdlsVxO44yvqEKKq6rl3P/f1Pss32phntbOskEoZp2WVSfpBdL6Pl4Dg2jCa eYn1Ba7UrE8/ekKaGWFa3lcMubTfMoiq5wM8nKu3QwduR0472Uln9XfDCbP5aWKVCu/q 9Tpi2Q1zs3DwWWRMFEqB0XXwCIBQgPIJD6L8asxNiKELnBOzehmoJo3Ztcs25luv736i U8OA== X-Gm-Message-State: AOJu0YyfzT+lgHTmFvkzITfx1m2HlfzKLhtxvOpYZElQS53DQB0BDcWB X+nfq8GI9/etDRCfuZ1hOZzyMgXRMTbZtEWza4ir8PMNrOVv9Y+DRlP9bsC5JOPTQYWcevVG66n Z19gdjgOr X-Gm-Gg: ASbGnctwbcdZIqwmDO+F6TgqMFITrz9ukC/noIoz9qilOV9uQo4hAtSjnLwlZqJ4lex mPX8CNZSzhrNfAQ5vuOF47gzSVJdck1feHqnTEuxWg2tloJYMz6l7yT6/0Aznax/gMTtRuQOU2Z RL2stgv7/0p8nU67pzgVYf5L6fBH1shodPrdsxA9NnohO67y4X+slxfjzhJMB7TA9L52jSenZLj RrQ1Vp54HvhC1dMzbKF/Uu8ZV1knD2FeIRLT+37+R+9WH8T/XCCwLE5DqU= X-Received: by 2002:a05:6512:33d0:b0:540:2339:376c with SMTP id 2adb3069b0e04-540233937f2mr2174468e87.27.1733847534920; Tue, 10 Dec 2024 08:18:54 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.18.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:18:54 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 18/69] target/arm: Convert CCMP, CCMN to decodetree Date: Tue, 10 Dec 2024 10:16:42 -0600 Message-ID: <20241210161733.1830573-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::230; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x230.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 66 +++++++++++----------------------- target/arm/tcg/a64.decode | 6 ++-- 2 files changed, 25 insertions(+), 47 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 774689641d..56a445a3c2 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8092,68 +8092,46 @@ static bool do_setf(DisasContext *s, int rn, int shift) TRANS_FEAT(SETF8, aa64_condm_4, do_setf, a->rn, 24) TRANS_FEAT(SETF16, aa64_condm_4, do_setf, a->rn, 16) -/* Conditional compare (immediate / register) - * 31 30 29 28 27 26 25 24 23 22 21 20 16 15 12 11 10 9 5 4 3 0 - * +--+--+--+------------------------+--------+------+----+--+------+--+-----+ - * |sf|op| S| 1 1 0 1 0 0 1 0 |imm5/rm | cond |i/r |o2| Rn |o3|nzcv | - * +--+--+--+------------------------+--------+------+----+--+------+--+-----+ - * [1] y [0] [0] - */ -static void disas_cc(DisasContext *s, uint32_t insn) +/* CCMP, CCMN */ +static bool trans_CCMP(DisasContext *s, arg_CCMP *a) { - unsigned int sf, op, y, cond, rn, nzcv, is_imm; - TCGv_i32 tcg_t0, tcg_t1, tcg_t2; - TCGv_i64 tcg_tmp, tcg_y, tcg_rn; + TCGv_i32 tcg_t0 = tcg_temp_new_i32(); + TCGv_i32 tcg_t1 = tcg_temp_new_i32(); + TCGv_i32 tcg_t2 = tcg_temp_new_i32(); + TCGv_i64 tcg_tmp = tcg_temp_new_i64(); + TCGv_i64 tcg_rn, tcg_y; DisasCompare c; - - if (!extract32(insn, 29, 1)) { - unallocated_encoding(s); - return; - } - if (insn & (1 << 10 | 1 << 4)) { - unallocated_encoding(s); - return; - } - sf = extract32(insn, 31, 1); - op = extract32(insn, 30, 1); - is_imm = extract32(insn, 11, 1); - y = extract32(insn, 16, 5); /* y = rm (reg) or imm5 (imm) */ - cond = extract32(insn, 12, 4); - rn = extract32(insn, 5, 5); - nzcv = extract32(insn, 0, 4); + unsigned nzcv; /* Set T0 = !COND. */ - tcg_t0 = tcg_temp_new_i32(); - arm_test_cc(&c, cond); + arm_test_cc(&c, a->cond); tcg_gen_setcondi_i32(tcg_invert_cond(c.cond), tcg_t0, c.value, 0); /* Load the arguments for the new comparison. */ - if (is_imm) { - tcg_y = tcg_temp_new_i64(); - tcg_gen_movi_i64(tcg_y, y); + if (a->imm) { + tcg_y = tcg_constant_i64(a->y); } else { - tcg_y = cpu_reg(s, y); + tcg_y = cpu_reg(s, a->y); } - tcg_rn = cpu_reg(s, rn); + tcg_rn = cpu_reg(s, a->rn); /* Set the flags for the new comparison. */ - tcg_tmp = tcg_temp_new_i64(); - if (op) { - gen_sub_CC(sf, tcg_tmp, tcg_rn, tcg_y); + if (a->op) { + gen_sub_CC(a->sf, tcg_tmp, tcg_rn, tcg_y); } else { - gen_add_CC(sf, tcg_tmp, tcg_rn, tcg_y); + gen_add_CC(a->sf, tcg_tmp, tcg_rn, tcg_y); } - /* If COND was false, force the flags to #nzcv. Compute two masks + /* + * If COND was false, force the flags to #nzcv. Compute two masks * to help with this: T1 = (COND ? 0 : -1), T2 = (COND ? -1 : 0). * For tcg hosts that support ANDC, we can make do with just T1. * In either case, allow the tcg optimizer to delete any unused mask. */ - tcg_t1 = tcg_temp_new_i32(); - tcg_t2 = tcg_temp_new_i32(); tcg_gen_neg_i32(tcg_t1, tcg_t0); tcg_gen_subi_i32(tcg_t2, tcg_t0, 1); + nzcv = a->nzcv; if (nzcv & 8) { /* N */ tcg_gen_or_i32(cpu_NF, cpu_NF, tcg_t1); } else { @@ -8190,6 +8168,7 @@ static void disas_cc(DisasContext *s, uint32_t insn) tcg_gen_and_i32(cpu_VF, cpu_VF, tcg_t2); } } + return true; } /* Conditional select @@ -8266,10 +8245,6 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) } switch (op2) { - case 0x2: /* Conditional compare */ - disas_cc(s, insn); /* both imm and reg forms */ - break; - case 0x4: /* Conditional select */ disas_cond_select(s, insn); break; @@ -8277,6 +8252,7 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) default: do_unallocated: case 0x0: + case 0x2: /* Conditional compare */ case 0x6: /* Data-processing */ case 0x8 ... 0xf: /* (3 source) */ unallocated_encoding(s); diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index ae2c6831d7..a9d7d57199 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -761,8 +761,10 @@ RMIF 1 01 11010000 imm:6 00001 rn:5 0 mask:4 SETF8 0 01 11010000 00000 000010 rn:5 01101 SETF16 0 01 11010000 00000 010010 rn:5 01101 -# Conditional compare (regster) -# Conditional compare (immediate) +# Conditional compare + +CCMP sf:1 op:1 1 11010010 y:5 cond:4 imm:1 0 rn:5 0 nzcv:4 + # Conditional select # Data Processing (3-source) From patchwork Tue Dec 10 16:16:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848841 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp418660wrn; Tue, 10 Dec 2024 08:24:14 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXX0iAABGIiLtvUSxP6SyAPat1rIKtGslQXTYwMvmD+Vrv+GxQqWm/e3Uc9OZKUcuA/hX4+1A==@linaro.org X-Google-Smtp-Source: AGHT+IGvss/CBphcbYwVi7Kv2BHZ5n0+/XVgzvVOJpm/pxJgS0OfEHMKAYUDnTiSV0gCew+aFItz X-Received: by 2002:a05:620a:650a:b0:7b6:c540:9530 with SMTP id af79cd13be357-7b6c54098bemr2001595485a.25.1733847854639; Tue, 10 Dec 2024 08:24:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847854; cv=none; d=google.com; s=arc-20240605; b=Ozxz/qBe9Q6nihki4/uK38/l2jujl5T7AhpJT8sARr/wOWRc/jiCsb77wrXZumN0YS yacF41vWderFBX4y+iX6YoqOrJux+p8S0w79fwfEl5XsKDcznaDukFGJqqxRsZ9zjhw5 NvoPTPZBxIkFVv7+DdYvsPTR0KzRpRni1CkXlSmiBFYx14WysOLc+3dTcr9yw/BHtXLX /IzKGgzjfw5CehosDbArmaZVqpIjUpiJEeGGtZLlaj+3U/V9BeyZDZlAaQtnUBxEtrlN EF91pEPv4GKFqdw8DVOYUxtdixEGcFYqdOHxQdGqI1ky2WTYI2tJx34wrpbsCOpi/XWR tvzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=qB2IZAS09IccrdqxBacklaTzmXPtI54chcpe7/zCzag=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=jxT+V5kRbzsPFFIrFL3oAIGHs+DqowYzVOFU3mBItFOSDN3EKoRVhdR+bSUbYMw8xu shwLUQUqF4B8N2ll0L2bDaRoKgsA7XZiD4J2gkA7Vu0vx1hzYfd3u92WzglwsGpju/P9 O4JEzluGI6hgSsmmlwafnTMt4sPhXFGLD/PSkumjrxDKyhmRMWyN35iSho+XwMobGZU3 t/mWOQ5e2NUf03CsrBHzUslUZHXBtPtvCOejtfMMycaM//8sIMRiROpVI4wSc2ebLnCQ tL4+Bdos8CJ+2zGka/wJaBtBuA3VlmWOipbJAFNUVZBhzYDd4UgP95VmjDapQK1O8QQ2 t1CA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JeZmM7g2; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6c6e7f28bsi893884885a.663.2024.12.10.08.24.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:24:14 -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=JeZmM7g2; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xM-0003T8-4v; Tue, 10 Dec 2024 11:19:28 -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 1tL2x2-0002wB-8l for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:15 -0500 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2ww-0006Rh-66 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:07 -0500 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-54020b0dcd2so2073087e87.1 for ; Tue, 10 Dec 2024 08:18:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847538; x=1734452338; 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=qB2IZAS09IccrdqxBacklaTzmXPtI54chcpe7/zCzag=; b=JeZmM7g2zFg7MX83VqlTD89KFXV6f0R+fAMopwggJZRvbD+PdsNmylCzu5ttii3IM+ ryzFFdI+FGhW2lJ23h5edOMSCXKen6aPpN9hlb8RR9jL8N1hV3akdFlDcSspMZhVgRwS /XuC6fWigxJqZLkJpi9FI79ZyTnmNvqfL4zxJVnk6Xq5kNLP6MIAxkI1VUH1qcJbBTvc S92L5K8hNwwG4c3hN9XjChsgBZIN3qA1KKPbWuo0TuTmMaaSsu//pnsV2TePP5A3/a/y p0XHI6cngQrAEALfqNbrEv9j+r/qXLTJoq9mQHZN93WQWW1LxPZN73S3E+BEucmGnheA tvqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847538; x=1734452338; 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=qB2IZAS09IccrdqxBacklaTzmXPtI54chcpe7/zCzag=; b=O/QRC5czbbkVfTktDQScO2h9D+lxSlUWM4vLOveA1rcewrXPndf6JSseFNgWl/n4QA /GHd26mIuKOG2bFUCnmNQ20uMZ7EKVkoMG/HoMxSTBzBAKVyRyBAyYF1gtAoAtlrzhR3 8VIHbcbQy6+8OYBtSP0QPCJOdGwO5PoLP9ETlCaJNfgtDjeZdR1eQ86kFW7cgxpzTzC1 5JIKDboarPmT8QGYeuAITLlj7QkaMYgrYxnYZMnC/JPLn533iCq14tnmyiOUZ/c9D9Z0 WJ7fmpLv4XdoC3bfx8ccty5ssIKIc5sth3cXKuf4QuBLjDpype5FhE0ue5/xree+yGup DZCg== X-Gm-Message-State: AOJu0YwNj4sPtJ7qC6utbtFuP9SmQMRQRUEE87KoVniyooMpzrLFCyqf 64mhjASylxj17cZa1459g+Pgw29tJLbzOTWz6EV0ilYFjNsVSbX2Rvnn1hsLbRs2VdBT0Vjl+ZE 7YySB5PZ/ X-Gm-Gg: ASbGncuVL/42fycBe7tgznAqhqEMboqPUXa9A4kD9y5ULfA14A4Eq1Vo2kgf2ccFZQz 2pe9fH+/KY8EgCZ9UWgLoblr/uMGi1sAFygUdes5eNZpIwRyvOeh4QyEQY9G1IeFP/WfOSpcFKI bURTlrtdP12BzpzrSX/48ofFkU87WqNIhq/TpQtacT3+qBfbnoFyligrbD+nB5SqvT+2i0O+R08 mlacsQmlc8h9AnBpdIZddbt9qiABcFZb1RXNCV8RaCmmc4WrXERvnC5NGo= X-Received: by 2002:a05:6512:3d09:b0:540:1db4:3c72 with SMTP id 2adb3069b0e04-540251e58ebmr1343187e87.10.1733847537850; Tue, 10 Dec 2024 08:18:57 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.18.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:18:57 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 19/69] target/arm: Convert disas_cond_select to decodetree Date: Tue, 10 Dec 2024 10:16:43 -0600 Message-ID: <20241210161733.1830573-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x134.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 This includes CSEL, CSINC, CSINV, CSNEG. Remove disas_data_proc_reg, as these were the last insns decoded by that function. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 84 ++++++---------------------------- target/arm/tcg/a64.decode | 3 ++ 2 files changed, 17 insertions(+), 70 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 56a445a3c2..9c6365f5ef 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8171,39 +8171,17 @@ static bool trans_CCMP(DisasContext *s, arg_CCMP *a) return true; } -/* Conditional select - * 31 30 29 28 21 20 16 15 12 11 10 9 5 4 0 - * +----+----+---+-----------------+------+------+-----+------+------+ - * | sf | op | S | 1 1 0 1 0 1 0 0 | Rm | cond | op2 | Rn | Rd | - * +----+----+---+-----------------+------+------+-----+------+------+ - */ -static void disas_cond_select(DisasContext *s, uint32_t insn) +static bool trans_CSEL(DisasContext *s, arg_CSEL *a) { - unsigned int sf, else_inv, rm, cond, else_inc, rn, rd; - TCGv_i64 tcg_rd, zero; + TCGv_i64 tcg_rd = cpu_reg(s, a->rd); + TCGv_i64 zero = tcg_constant_i64(0); DisasCompare64 c; - if (extract32(insn, 29, 1) || extract32(insn, 11, 1)) { - /* S == 1 or op2<1> == 1 */ - unallocated_encoding(s); - return; - } - sf = extract32(insn, 31, 1); - else_inv = extract32(insn, 30, 1); - rm = extract32(insn, 16, 5); - cond = extract32(insn, 12, 4); - else_inc = extract32(insn, 10, 1); - rn = extract32(insn, 5, 5); - rd = extract32(insn, 0, 5); + a64_test_cc(&c, a->cond); - tcg_rd = cpu_reg(s, rd); - - a64_test_cc(&c, cond); - zero = tcg_constant_i64(0); - - if (rn == 31 && rm == 31 && (else_inc ^ else_inv)) { + if (a->rn == 31 && a->rm == 31 && (a->else_inc ^ a->else_inv)) { /* CSET & CSETM. */ - if (else_inv) { + if (a->else_inv) { tcg_gen_negsetcond_i64(tcg_invert_cond(c.cond), tcg_rd, c.value, zero); } else { @@ -8211,53 +8189,23 @@ static void disas_cond_select(DisasContext *s, uint32_t insn) tcg_rd, c.value, zero); } } else { - TCGv_i64 t_true = cpu_reg(s, rn); - TCGv_i64 t_false = read_cpu_reg(s, rm, 1); - if (else_inv && else_inc) { + TCGv_i64 t_true = cpu_reg(s, a->rn); + TCGv_i64 t_false = read_cpu_reg(s, a->rm, 1); + + if (a->else_inv && a->else_inc) { tcg_gen_neg_i64(t_false, t_false); - } else if (else_inv) { + } else if (a->else_inv) { tcg_gen_not_i64(t_false, t_false); - } else if (else_inc) { + } else if (a->else_inc) { tcg_gen_addi_i64(t_false, t_false, 1); } tcg_gen_movcond_i64(c.cond, tcg_rd, c.value, zero, t_true, t_false); } - if (!sf) { + if (!a->sf) { tcg_gen_ext32u_i64(tcg_rd, tcg_rd); } -} - -/* - * Data processing - register - * 31 30 29 28 25 21 20 16 10 0 - * +--+---+--+---+-------+-----+-------+-------+---------+ - * | |op0| |op1| 1 0 1 | op2 | | op3 | | - * +--+---+--+---+-------+-----+-------+-------+---------+ - */ -static void disas_data_proc_reg(DisasContext *s, uint32_t insn) -{ - int op1 = extract32(insn, 28, 1); - int op2 = extract32(insn, 21, 4); - - if (!op1) { - goto do_unallocated; - } - - switch (op2) { - case 0x4: /* Conditional select */ - disas_cond_select(s, insn); - break; - - default: - do_unallocated: - case 0x0: - case 0x2: /* Conditional compare */ - case 0x6: /* Data-processing */ - case 0x8 ... 0xf: /* (3 source) */ - unallocated_encoding(s); - break; - } + return true; } static void handle_fp_compare(DisasContext *s, int size, @@ -11212,10 +11160,6 @@ static bool btype_destination_ok(uint32_t insn, bool bt, int btype) static void disas_a64_legacy(DisasContext *s, uint32_t insn) { switch (extract32(insn, 25, 4)) { - case 0x5: - case 0xd: /* Data processing - register */ - disas_data_proc_reg(s, insn); - break; case 0x7: case 0xf: /* Data processing - SIMD and floating point */ disas_data_proc_simd_fp(s, insn); diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index a9d7d57199..5670846768 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -766,6 +766,9 @@ SETF16 0 01 11010000 00000 010010 rn:5 01101 CCMP sf:1 op:1 1 11010010 y:5 cond:4 imm:1 0 rn:5 0 nzcv:4 # Conditional select + +CSEL sf:1 else_inv:1 011010100 rm:5 cond:4 0 else_inc:1 rn:5 rd:5 + # Data Processing (3-source) &rrrr rd rn rm ra From patchwork Tue Dec 10 16:16:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848825 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416770wrn; Tue, 10 Dec 2024 08:20:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX1laXPx15KxOside7Qx6OWQ+Cpzibxkn24mTwkaFeCllB8ES48K4Ze1BZ4eMGJuzy5HAXQ/Q==@linaro.org X-Google-Smtp-Source: AGHT+IHfGN7jrdioWUKXXLhcONek/IofLKKniqYd//4zlxxZ7T97l7ajNH1Zw+Jb8Nsdpc/u0MI1 X-Received: by 2002:ac8:5a44:0:b0:466:8780:5b24 with SMTP id d75a77b69052e-46771eb239emr94164091cf.18.1733847650428; Tue, 10 Dec 2024 08:20:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847650; cv=none; d=google.com; s=arc-20240605; b=PZe+prgLeX3j2nQAUCf9Zv95rDVEfq78fjUph81M3A5iNGGhRtJGwmUhJ5M1o5SshZ LmvsbJDt6/NMCXFHJSVv/y3HgAwx8xo63JKmuIzGbC5KbHXQQsGrtIDenKxozS1/M/rs 2V7HmKbkjEmEAh8zmFtMRGTMiVPCVM4k6+Gc2ehC9fLfm+xXnhaFP0UR7mOtOVrTBvOM iFGdzT27i/TRMgCRiVNGYvpIlalBx0MCJgyVjvceASqGt082Le1hgrwClpPA4JPyOsYK tur1vbEvCJJ08UZ7nwg6XR2Ig67ha+V6V+p+5Sca3f0ayydrdiVzDk+xRFTIcmVntm4j epCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=nBi50fBjO71qRLAMWMSi4czuRa2YaRF8EoteBaucdNo=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=UBLay8bo5309hyz/HKwexlAebeZ8P/6EjYZ9aiCigqoGPvNA5FJ1wgUvQV3cqtGQY8 JIcbrBARfv4rez0S9joWYBCtfaHenSUwv9eKSlT+V3viTYuH1G7WOvbWMSheRa9lcaCS FUWe39AYKB03VTzPza7KMRjFbcAtzw23lWZdXHKqAfFRod157HfOcR8Aj9LQ0jZ+5e6P cJ4FNJbVSdoJvZvedI2fNKzIf/TvkBpmMFL6uehASF/vBQLzfrh41/2kGmTanRez1if+ djqnot2nAFoCJNVExuGycx42TQmcEjFLq62qFT/iYUEuQrVcOhwxXZNwYGoKLJjweb2A QZ6g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ocvRYwMp; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-467297fc63csi138042251cf.380.2024.12.10.08.20.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20:50 -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=ocvRYwMp; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xS-000446-GH; Tue, 10 Dec 2024 11:19:35 -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 1tL2x2-0002wA-8f for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:15 -0500 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2wx-0006SC-KF for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:07 -0500 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-53f22fd6887so3120678e87.2 for ; Tue, 10 Dec 2024 08:19:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847542; x=1734452342; 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=nBi50fBjO71qRLAMWMSi4czuRa2YaRF8EoteBaucdNo=; b=ocvRYwMpabIoR+r0Bp7LNthyF4acAP/KvrSPx1SsuxJSQlhpfoqzQK0Jv3WaAfXysb BeeIC1dthtjJ1OhkW3fS/FhaKVzmEYrGEwTfA/8UuuEsOxtPnMNRX7g8st8IB6paZlNO BMz6eP3LnWPDt8qVgUCtbKsQ8WLQqb7aA8jH3a/Z7QVq5RxwdENuIVjdw6TM5ckBWb2V gYYks8xM3DUe5zD5asFAeNcEjVcWMaUDEhrOurM+0+nMv4paNo/32XFTFAHtrOpZeBYV JDHN57ukB2pxTsDqlVkcL7LJmLxTJ5saMcKpZJ34uck7FBjTvWCagkXBfTEqU0yCktM+ wsEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847542; x=1734452342; 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=nBi50fBjO71qRLAMWMSi4czuRa2YaRF8EoteBaucdNo=; b=cbzTUZxQh+FE2aTjnJcSbefQ4oFsNxbrMgrVjy6RWRH+LO3Ui3Dxv8tXMdEkR/TC1Y A7NUqdJ70Z7xFEZgwvYGlosEZEVt8FFAQ88FatXzL/cBPhQ1e6qLw3P5nvuX+CQVkbyI ydszR4CHgYnukyQLEwKfGaEXUQ30PZcOnn5cw9BBIzapLgAOVC6Pklo4Y3RKRRGJp8qD ZElyx2nQEbKfrtEfJwi8/+M8k2suvnQMG0j/OpKZ0Tq+uqkBsM11quvt7mSIUqjWJWYP 3M+rPGsUdPQPSrWHt+CX0vx+9kojNkdFpKSrgW9nVxoO3Q9y3Xr8jRvjKgR0ePhldpNL tBLg== X-Gm-Message-State: AOJu0Yw0GoD02HCZTtl0+APp81mv4GUnaL0LeApo/vsCJPkVPdD/rNuK NW6E1VFiMNbWdviO1mr4VTAOnUfmdaAY3v8zd+bEn+G4p4xB5w9EzwId4L+W3Kz0nSrnhhwimoC 5E73zrh2f X-Gm-Gg: ASbGncsLWsCfV083jgotyeYATy5hNH6767XBelWaDPpIdJPZ4pLXd6BzOJK4LRMoOv7 Hx6Q8lFdBMDS3CVEIuYrQNwwQowP14LesUMrH6/ySkuuZVNJR8kG5pGibIlbtq/Rvg/S+mkd7q/ EIFJuBigjHtF9gleflhj756AFFv3WB4Ti/3CAIh4eg2Pc3P2hTMlTQoAlX244hvbmX5IV+fSGx0 A5QDKPqFFeOgm/owzjEqy4xqX4doGavdgQ/adYMkMSy2kLkIiqOXA+eHhk= X-Received: by 2002:a05:6512:3b20:b0:53e:398c:bf8f with SMTP id 2adb3069b0e04-53e398cc15cmr6304937e87.32.1733847541830; Tue, 10 Dec 2024 08:19:01 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.18.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:19:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 20/69] target/arm: Introduce fp_access_check_scalar_hsd Date: Tue, 10 Dec 2024 10:16:44 -0600 Message-ID: <20241210161733.1830573-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12c; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12c.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 Provide a simple way to check for float64, float32, and float16 support, as well as the fpu enabled. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 62 ++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 9c6365f5ef..4e47b8a804 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -1239,6 +1239,27 @@ static bool fp_access_check(DisasContext *s) return true; } +/* + * Return <0 for non-supported element sizes, with MO_16 controlled by + * FEAT_FP16; return 0 for fp disabled; otherwise return >0 for success. + */ +static int fp_access_check_scalar_hsd(DisasContext *s, MemOp esz) +{ + switch (esz) { + case MO_64: + case MO_32: + break; + case MO_16: + if (!dc_isar_feature(aa64_fp16, s)) { + return -1; + } + break; + default: + return -1; + } + return fp_access_check(s); +} + /* * Check that SVE access is enabled. If it is, return true. * If not, emit code to generate an appropriate exception and return false. @@ -6628,22 +6649,10 @@ static bool trans_FCSEL(DisasContext *s, arg_FCSEL *a) { TCGv_i64 t_true, t_false; DisasCompare64 c; + int check = fp_access_check_scalar_hsd(s, a->esz); - switch (a->esz) { - case MO_32: - case MO_64: - break; - case MO_16: - if (!dc_isar_feature(aa64_fp16, s)) { - return false; - } - break; - default: - return false; - } - - if (!fp_access_check(s)) { - return true; + if (check <= 0) { + return check == 0; } /* Zero extend sreg & hreg inputs to 64 bits now. */ @@ -6894,22 +6903,15 @@ TRANS(FMINV_s, do_fp_reduction, a, gen_helper_vfp_mins) static bool trans_FMOVI_s(DisasContext *s, arg_FMOVI_s *a) { - switch (a->esz) { - case MO_32: - case MO_64: - break; - case MO_16: - if (!dc_isar_feature(aa64_fp16, s)) { - return false; - } - break; - default: - return false; - } - if (fp_access_check(s)) { - uint64_t imm = vfp_expand_imm(a->esz, a->imm); - write_fp_dreg(s, a->rd, tcg_constant_i64(imm)); + int check = fp_access_check_scalar_hsd(s, a->esz); + uint64_t imm; + + if (check <= 0) { + return check == 0; } + + imm = vfp_expand_imm(a->esz, a->imm); + write_fp_dreg(s, a->rd, tcg_constant_i64(imm)); return true; } From patchwork Tue Dec 10 16:16:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848828 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp417099wrn; Tue, 10 Dec 2024 08:21:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWP1YTBVZK3e7lEllcbfF0SxmcM93krRDczHPr2gsLDYUKz0pvTfffG/N/EXF5gopgeikkP7Q==@linaro.org X-Google-Smtp-Source: AGHT+IGmhr5PuPSUOCAm9PEIxmY++qlcbCaiwbgOiAdObxcy3qcbCjCFmuuI656wo/jh9AApkuzy X-Received: by 2002:a05:6214:1d2e:b0:6d8:8256:41d4 with SMTP id 6a1803df08f44-6d8e71648b7mr257938046d6.19.1733847688198; Tue, 10 Dec 2024 08:21:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847688; cv=none; d=google.com; s=arc-20240605; b=RFLdWS2xppDb1exJOoZpiwEn10lT6X4w55eagVxQdVOFmrlTJ6GmeZ1OJwY7edOusA oYlM2p+7Cz6d87ebLFc4OyPclfcTS/ue4XdxUipPsf/EHT1gW4md4La+mVRoV19FG02j OisGOO1DmHGu1yVRXTDYN1u9BkzTNOtE+ie9Z8zyzma3UHcVcIW6Zfdfh8w0UKxUgv5q wRxIeJfUqV3WF8GFpGIfeeVawh9VP7LA3Yv4rmBdSJUNthmDJb4rOrZPLuiQ5U0D9XDv ESt83/jeG4kJpFhRqTuH2wFPIp5KIKqhJEmomoSgj3bmnfkVN2Ol0zwjcRWfMakyIQO/ 5c4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=OlPqq3SkO/OL532CbnGb++BEeuAMvtHyeW45jNWCD1U=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=lXjqF7FharGU2TJCfbWKVOWkprYFr4R+iTPhKXB3MORFiLyFQ4/OXp41prfB+sjIrL WVlpjIRtFbvZKeEj+VftYI09J3Th5QcM+Fuy3TF/fltOseChB0IfaciBQvJjyP2RL8q7 TgWdtHuKrjWDLMABrKhxEOv4OlmJc51c4xPLijnpZ5t6tUuIjCD7mZnZToLgvByEI6G3 2aZDDLAtWfhI0fPARhqKfAQeDwyBoCRGrSgYLb4AmJZaqcrgo2KIy6YQXO/NAVSLg/yj En5lpsXKGZXrYnwk5bXKeuJ79m8wKkxsgjQPKwu1DviNdI3Z+8gE4wUSo1HiIBnQXOer nXMg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QCT55eQI; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8dabf1425si126013306d6.195.2024.12.10.08.21.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:21:28 -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=QCT55eQI; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xP-0003jx-EA; Tue, 10 Dec 2024 11:19:31 -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 1tL2x4-0002wX-1E for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:15 -0500 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2x0-0006Sc-WC for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:09 -0500 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-5401bd6cdb7so2796412e87.2 for ; Tue, 10 Dec 2024 08:19:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847545; x=1734452345; 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=OlPqq3SkO/OL532CbnGb++BEeuAMvtHyeW45jNWCD1U=; b=QCT55eQI0UFAJyji6xCXvpCz+H+ckjpX1dQVpiV8GYjlw9Ze8p5E9Py96LNSCQAhlX RZ5PHFbCR6LejoSoPEqE0BI8HeuREZdlS2zinUQkd0Wjzh6JM1NwX6O/sjyOnhGoVNU7 FlPtemdmWUCUUtJV9wXRuq8rfyEqpv9GRObiJDFJXSUqGKSpLMpUII+bdxW7LEM8J44k rVtDI3gVeuZibAjfdTCk5JMTKGUqMjC+lG4yY7m40akORhMkXEvendHPsYV3DlF2Fx9V gLfmmfOgDzTNSP9pFN5llnzJNP6aDzT3rvC+yRlB+YtCyN2lGtZHrBhamib5yOVPwMH3 4U1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847545; x=1734452345; 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=OlPqq3SkO/OL532CbnGb++BEeuAMvtHyeW45jNWCD1U=; b=cIvW1A4FKEjFoQ/VEoo/0IGdkvUIvN3pGS6qRHPKQJBGoPBOgRRtqAEBXHL9E+7nfZ JoSs/oaP5Po6j1d8KI91HbXnWCJUGTIyGHsrppMNVCsNxcN5BdWCXaHWAakc2suVp9Ba ZGhnKHWo/cNgrYRrobt7W97uI+d/vl5YTn2x0pnEq/jYWuX3LiGMm542FrT0ZX9DlNuj 28EkJQstC6e2m7lB2VXIC5d+FKpP3NQdEqC2Zv+sPU6NrfCAQELRbkdO7dJ6mRR1CviZ Gl4hrJ3Nh8lzAg5iI2ZPRtsp9CX5Wc4K6w1xndpZoR0Ihmym87WQIxRodlNuDq5ulYzL jJ2Q== X-Gm-Message-State: AOJu0Yy4APRY5dL7fwL2aTCRppyRtpob6GgoJnDwrwrhmrEDpJN/7tsx UHldbmzNohKUUO5L0PZWY2fezpqr54MPAcDBJHhhCNCRNS6MflnjwwMWGZoMC4eF9ixCcbGoS6/ fnjCUpS5H X-Gm-Gg: ASbGncu1K3PhPF0HJ3BnnnaWGOzHLeqMDzsoPK1d2nDTBuchCdCRwKHqm+C1NtbzCJo wJU7u4GfUrlxqnym9s0U2sJ5dwTlwDCzLR0BYGg2xspYcuMrjYszdUfpGzYbniNRMko/let7TN4 TVw4oZkhFV0+arXoxR785aacGb7ywJWkUeqCoOzGHmeiA+qy4e/MX1TSoIa+XSrx1rRw3yQs6HC 7qIprA1QzfJMrGRZMEnjAxfA+1cF7aEnUlkXyEtKSDaOWcRC+swpmGc720= X-Received: by 2002:a05:6512:2209:b0:53e:36ca:6578 with SMTP id 2adb3069b0e04-53e36ca66e1mr7248318e87.43.1733847545119; Tue, 10 Dec 2024 08:19:05 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.19.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:19:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 21/69] target/arm: Introduce fp_access_check_vector_hsd Date: Tue, 10 Dec 2024 10:16:45 -0600 Message-ID: <20241210161733.1830573-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12e.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 Provide a simple way to check for float64, float32, and float16 support vs vector width, as well as the fpu enabled. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 135 +++++++++++++-------------------- 1 file changed, 54 insertions(+), 81 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 4e47b8a804..4611ae4ade 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -1260,6 +1260,28 @@ static int fp_access_check_scalar_hsd(DisasContext *s, MemOp esz) return fp_access_check(s); } +/* Likewise, but vector MO_64 must have two elements. */ +static int fp_access_check_vector_hsd(DisasContext *s, bool is_q, MemOp esz) +{ + switch (esz) { + case MO_64: + if (!is_q) { + return -1; + } + break; + case MO_32: + break; + case MO_16: + if (!dc_isar_feature(aa64_fp16, s)) { + return -1; + } + break; + default: + return -1; + } + return fp_access_check(s); +} + /* * Check that SVE access is enabled. If it is, return true. * If not, emit code to generate an appropriate exception and return false. @@ -5420,27 +5442,14 @@ static bool do_fp3_vector(DisasContext *s, arg_qrrr_e *a, int data, gen_helper_gvec_3_ptr * const fns[3]) { MemOp esz = a->esz; + int check = fp_access_check_vector_hsd(s, a->q, esz); - switch (esz) { - case MO_64: - if (!a->q) { - return false; - } - break; - case MO_32: - break; - case MO_16: - if (!dc_isar_feature(aa64_fp16, s)) { - return false; - } - break; - default: - return false; - } - if (fp_access_check(s)) { - gen_gvec_op3_fpst(s, a->q, a->rd, a->rn, a->rm, - esz == MO_16, data, fns[esz - 1]); + if (check <= 0) { + return check == 0; } + + gen_gvec_op3_fpst(s, a->q, a->rd, a->rn, a->rm, + esz == MO_16, data, fns[esz - 1]); return true; } @@ -5768,34 +5777,24 @@ TRANS_FEAT(FCADD_270, aa64_fcma, do_fp3_vector, a, 1, f_vector_fcadd) static bool trans_FCMLA_v(DisasContext *s, arg_FCMLA_v *a) { - gen_helper_gvec_4_ptr *fn; + static gen_helper_gvec_4_ptr * const fn[] = { + [MO_16] = gen_helper_gvec_fcmlah, + [MO_32] = gen_helper_gvec_fcmlas, + [MO_64] = gen_helper_gvec_fcmlad, + }; + int check; if (!dc_isar_feature(aa64_fcma, s)) { return false; } - switch (a->esz) { - case MO_64: - if (!a->q) { - return false; - } - fn = gen_helper_gvec_fcmlad; - break; - case MO_32: - fn = gen_helper_gvec_fcmlas; - break; - case MO_16: - if (!dc_isar_feature(aa64_fp16, s)) { - return false; - } - fn = gen_helper_gvec_fcmlah; - break; - default: - return false; - } - if (fp_access_check(s)) { - gen_gvec_op4_fpst(s, a->q, a->rd, a->rn, a->rm, a->rd, - a->esz == MO_16, a->rot, fn); + + check = fp_access_check_vector_hsd(s, a->q, a->esz); + if (check <= 0) { + return check == 0; } + + gen_gvec_op4_fpst(s, a->q, a->rd, a->rn, a->rm, a->rd, + a->esz == MO_16, a->rot, fn[a->esz]); return true; } @@ -6337,27 +6336,14 @@ static bool do_fp3_vector_idx(DisasContext *s, arg_qrrx_e *a, gen_helper_gvec_3_ptr * const fns[3]) { MemOp esz = a->esz; + int check = fp_access_check_vector_hsd(s, a->q, esz); - switch (esz) { - case MO_64: - if (!a->q) { - return false; - } - break; - case MO_32: - break; - case MO_16: - if (!dc_isar_feature(aa64_fp16, s)) { - return false; - } - break; - default: - g_assert_not_reached(); - } - if (fp_access_check(s)) { - gen_gvec_op3_fpst(s, a->q, a->rd, a->rn, a->rm, - esz == MO_16, a->idx, fns[esz - 1]); + if (check <= 0) { + return check == 0; } + + gen_gvec_op3_fpst(s, a->q, a->rd, a->rn, a->rm, + esz == MO_16, a->idx, fns[esz - 1]); return true; } @@ -6383,28 +6369,15 @@ static bool do_fmla_vector_idx(DisasContext *s, arg_qrrx_e *a, bool neg) gen_helper_gvec_fmla_idx_d, }; MemOp esz = a->esz; + int check = fp_access_check_vector_hsd(s, a->q, esz); - switch (esz) { - case MO_64: - if (!a->q) { - return false; - } - break; - case MO_32: - break; - case MO_16: - if (!dc_isar_feature(aa64_fp16, s)) { - return false; - } - break; - default: - g_assert_not_reached(); - } - if (fp_access_check(s)) { - gen_gvec_op4_fpst(s, a->q, a->rd, a->rn, a->rm, a->rd, - esz == MO_16, (a->idx << 1) | neg, - fns[esz - 1]); + if (check <= 0) { + return check == 0; } + + gen_gvec_op4_fpst(s, a->q, a->rd, a->rn, a->rm, a->rd, + esz == MO_16, (a->idx << 1) | neg, + fns[esz - 1]); return true; } From patchwork Tue Dec 10 16:16:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848840 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp418429wrn; Tue, 10 Dec 2024 08:23:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVtPXMmK9ZaBrJvnwR1dQhnIv+GpZzghXkQmLkwMshKSVfjZeBttPguz64YEIX2zn0BJy4hGA==@linaro.org X-Google-Smtp-Source: AGHT+IHIRxxh2acPhJshgscnajsEzgDQQ1srxHNwjJpMqyi42Zf3Aw5QmQgCpsLvEBnj0AKslh8Q X-Received: by 2002:a05:620a:1a21:b0:7b6:d026:293 with SMTP id af79cd13be357-7b6dcdcdc72mr750348585a.9.1733847830521; Tue, 10 Dec 2024 08:23:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847830; cv=none; d=google.com; s=arc-20240605; b=awyg5j6OolgA06rGgPed+NHtPLQuVQb0OJi4ygbrjnrI2ZfoyxZufs6IGQhxtlU1zj 0JcB7q/1YziPjiK6vrW4sWqVuuKagiq0fCYi9oahAnNrAHveETEf4ymYnxxLv19JvTv7 3vWsI+wAwCxQB2yVgjqjbI06hFuNfUVPe5Rzp4rAjc1jbGGeJURsqIyW0ZSOhBBimlc5 /yTQG+yLLplrUcUCDIbH0xvrpKpYCbD9WZOIkaoiV0oJpAUCe2ogpUAjNWO37XVxKRzt 89bkEtYhFmZctiTp/VnHTL4HjsuvFjtx2S/rY7nrdduvbkVlCXCmmiBtKTtCotPnkJxL FIJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=17GfbZjW6epwa8YFLq0I3cD8ORZgiSit6nkfbKV++nM=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=SNzrpUmlEBxnv09ma+0rzNgApCJkqy2h5MXFe4Ag91rIEkOKEYJGM8doxPFbV9Uvmt n1pEVErtAU7rbxWwoYTxRZ9BWavFbU8qqaB0QP3Ajdqhfg8ZZtxI2Wvk7AMVtENcnmio wO7MB+CNclVIIdJnz+v5cJreTAS6w7EkJt0WjfcJLQ79vVJCJ2MoF86ej2dQJtSgc8qI ekvN5T8tnn65Qc5x1VeEpAamb8Kkyf1J3r8UAXuBRuxBbpSbU5Oyd+EMq4LJ6Mpo2qYZ HpwaWtHcx+qhsef0f0EXlec8pUY2wfU04S+7WWqwk/g6ZiiDlmPPG3U1qVYDHFf/Ecul G2ow==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OepxT+07; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6d87de3f3si503639785a.226.2024.12.10.08.23.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:23:50 -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=OepxT+07; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xM-0003Tz-4y; Tue, 10 Dec 2024 11:19:28 -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 1tL2x7-0002y6-Kd for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:19 -0500 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2x5-0006TU-1R for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:12 -0500 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-5401b7f7141so2258497e87.1 for ; Tue, 10 Dec 2024 08:19:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847549; x=1734452349; 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=17GfbZjW6epwa8YFLq0I3cD8ORZgiSit6nkfbKV++nM=; b=OepxT+0755leS2+Il+KLj5I8bZSshiS9IAJ4JS0VNfWyiBJf+SRzeAbBCabXu9EwEl bqK8akIJpHCJD/VOK+18svCH7v53k6BA2UChO5an+oJW8h8y22ql8m0FtMc5BFqRm+cX N5Ppi1PqjEXnZ4DTDeepezvGfUbPvCrMZvAVKgzgv8TpQvYiEZZmsznPmjTZQ+CCfiL3 pI3ZrLB7N3dd3StjqeuWtQFeaByfXWV6dJI9jNgsi76ji6yFT8EqVnA4c6xOVCfitEei zxH3HArCUuON5+TpQmb2DR7PxZR+oFPP4KF2kzdb7eJum4gPbr0YF3cwfEwVDNcx+dZv /ztA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847549; x=1734452349; 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=17GfbZjW6epwa8YFLq0I3cD8ORZgiSit6nkfbKV++nM=; b=RCAqPiiH+CY4iqPA5LSUWigVswnFmH+dySucviaPrudw3/s8sv7Ec3ahycI8EjsVMo EB9hu3gCIfbpcUcfqHJ0Cy1WMTwzbVemjeeBgjaJqIWvafNbBPDZFBq/4+0CTHHltd8D 8CV2IHPD3Fs7VqTYcDkX+jXVKlLf2pXNrxrCO0ADKmiyC3ZXA1/Mq97IlHaFbQhaybir Xu/VK3laUb0vfZjf0CQyqzxIqd30BeIDXeh7SbpAkX1wviQKG7KJGIjSxYimkrWCin1z iCwDPWkOhsa467V9b66RPY4aFDaNzC9J4CI4NNGdbvyDB+Ny+IhEnr80cRQkqliKA48C 5ing== X-Gm-Message-State: AOJu0YwTGGCkdJxsJ+MnX4w76F3vwyGELUvD70TkXjsHL8ywBAUvH6Fp YTe3LlnrKGX/vsCX/2cXhU8+cFd5KoIGl9Oqp0ozRQR0fTHOFojZMIJbjM9KobwEsdnfLDb8pkq 7PXmoT0h5 X-Gm-Gg: ASbGncuqjQuLdTaV4VrltittfuEBqUVxPDYAIO3dGMgZ8Va+VhUN2lanXxhM8iFTSB+ sXNDXmtxOzznWYTbAF+HFs/ZLhTjEgcr6Zs0PU5nGULVfLIDzZNmuZx/P8Y+6koml7Zeexsqm+U qivigs5r5sXACkrzO3D5wwsb1hDu8dpGK1+R2c81eF2WtmJ2Ap8b2TyV1Phgtq6WMooETAoMs4V 7id/Pj53KVoFVnfXh4uJm0OK9UUjY/WjePft4nBiQeWsrVQea06HWdWEco= X-Received: by 2002:a19:5e1a:0:b0:53e:2f9d:6a7a with SMTP id 2adb3069b0e04-53e2f9d7be0mr3975966e87.46.1733847549316; Tue, 10 Dec 2024 08:19:09 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:19:08 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 22/69] target/arm: Convert FCMP, FCMPE, FCCMP, FCCMPE to decodetree Date: Tue, 10 Dec 2024 10:16:46 -0600 Message-ID: <20241210161733.1830573-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12f.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 283 ++++++++++++--------------------- target/arm/tcg/a64.decode | 8 + 2 files changed, 112 insertions(+), 179 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 4611ae4ade..a99f3d0d13 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6888,6 +6888,106 @@ static bool trans_FMOVI_s(DisasContext *s, arg_FMOVI_s *a) return true; } +/* + * Floating point compare, conditional compare + */ + +static void handle_fp_compare(DisasContext *s, int size, + unsigned int rn, unsigned int rm, + bool cmp_with_zero, bool signal_all_nans) +{ + TCGv_i64 tcg_flags = tcg_temp_new_i64(); + TCGv_ptr fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + + if (size == MO_64) { + TCGv_i64 tcg_vn, tcg_vm; + + tcg_vn = read_fp_dreg(s, rn); + if (cmp_with_zero) { + tcg_vm = tcg_constant_i64(0); + } else { + tcg_vm = read_fp_dreg(s, rm); + } + if (signal_all_nans) { + gen_helper_vfp_cmped_a64(tcg_flags, tcg_vn, tcg_vm, fpst); + } else { + gen_helper_vfp_cmpd_a64(tcg_flags, tcg_vn, tcg_vm, fpst); + } + } else { + TCGv_i32 tcg_vn = tcg_temp_new_i32(); + TCGv_i32 tcg_vm = tcg_temp_new_i32(); + + read_vec_element_i32(s, tcg_vn, rn, 0, size); + if (cmp_with_zero) { + tcg_gen_movi_i32(tcg_vm, 0); + } else { + read_vec_element_i32(s, tcg_vm, rm, 0, size); + } + + switch (size) { + case MO_32: + if (signal_all_nans) { + gen_helper_vfp_cmpes_a64(tcg_flags, tcg_vn, tcg_vm, fpst); + } else { + gen_helper_vfp_cmps_a64(tcg_flags, tcg_vn, tcg_vm, fpst); + } + break; + case MO_16: + if (signal_all_nans) { + gen_helper_vfp_cmpeh_a64(tcg_flags, tcg_vn, tcg_vm, fpst); + } else { + gen_helper_vfp_cmph_a64(tcg_flags, tcg_vn, tcg_vm, fpst); + } + break; + default: + g_assert_not_reached(); + } + } + + gen_set_nzcv(tcg_flags); +} + +/* FCMP, FCMPE */ +static bool trans_FCMP(DisasContext *s, arg_FCMP *a) +{ + int check = fp_access_check_scalar_hsd(s, a->esz); + + if (check <= 0) { + return check == 0; + } + + handle_fp_compare(s, a->esz, a->rn, a->rm, a->z, a->e); + return true; +} + +/* FCCMP, FCCMPE */ +static bool trans_FCCMP(DisasContext *s, arg_FCCMP *a) +{ + TCGLabel *label_continue = NULL; + int check = fp_access_check_scalar_hsd(s, a->esz); + + if (check <= 0) { + return check == 0; + } + + if (a->cond < 0x0e) { /* not always */ + TCGLabel *label_match = gen_new_label(); + label_continue = gen_new_label(); + arm_gen_test_cc(a->cond, label_match); + /* nomatch: */ + gen_set_nzcv(tcg_constant_i64(a->nzcv << 28)); + tcg_gen_br(label_continue); + gen_set_label(label_match); + } + + handle_fp_compare(s, a->esz, a->rn, a->rm, false, a->e); + + if (label_continue) { + gen_set_label(label_continue); + } + return true; +} + /* * Advanced SIMD Modified Immediate */ @@ -8183,174 +8283,6 @@ static bool trans_CSEL(DisasContext *s, arg_CSEL *a) return true; } -static void handle_fp_compare(DisasContext *s, int size, - unsigned int rn, unsigned int rm, - bool cmp_with_zero, bool signal_all_nans) -{ - TCGv_i64 tcg_flags = tcg_temp_new_i64(); - TCGv_ptr fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); - - if (size == MO_64) { - TCGv_i64 tcg_vn, tcg_vm; - - tcg_vn = read_fp_dreg(s, rn); - if (cmp_with_zero) { - tcg_vm = tcg_constant_i64(0); - } else { - tcg_vm = read_fp_dreg(s, rm); - } - if (signal_all_nans) { - gen_helper_vfp_cmped_a64(tcg_flags, tcg_vn, tcg_vm, fpst); - } else { - gen_helper_vfp_cmpd_a64(tcg_flags, tcg_vn, tcg_vm, fpst); - } - } else { - TCGv_i32 tcg_vn = tcg_temp_new_i32(); - TCGv_i32 tcg_vm = tcg_temp_new_i32(); - - read_vec_element_i32(s, tcg_vn, rn, 0, size); - if (cmp_with_zero) { - tcg_gen_movi_i32(tcg_vm, 0); - } else { - read_vec_element_i32(s, tcg_vm, rm, 0, size); - } - - switch (size) { - case MO_32: - if (signal_all_nans) { - gen_helper_vfp_cmpes_a64(tcg_flags, tcg_vn, tcg_vm, fpst); - } else { - gen_helper_vfp_cmps_a64(tcg_flags, tcg_vn, tcg_vm, fpst); - } - break; - case MO_16: - if (signal_all_nans) { - gen_helper_vfp_cmpeh_a64(tcg_flags, tcg_vn, tcg_vm, fpst); - } else { - gen_helper_vfp_cmph_a64(tcg_flags, tcg_vn, tcg_vm, fpst); - } - break; - default: - g_assert_not_reached(); - } - } - - gen_set_nzcv(tcg_flags); -} - -/* Floating point compare - * 31 30 29 28 24 23 22 21 20 16 15 14 13 10 9 5 4 0 - * +---+---+---+-----------+------+---+------+-----+---------+------+-------+ - * | M | 0 | S | 1 1 1 1 0 | type | 1 | Rm | op | 1 0 0 0 | Rn | op2 | - * +---+---+---+-----------+------+---+------+-----+---------+------+-------+ - */ -static void disas_fp_compare(DisasContext *s, uint32_t insn) -{ - unsigned int mos, type, rm, op, rn, opc, op2r; - int size; - - mos = extract32(insn, 29, 3); - type = extract32(insn, 22, 2); - rm = extract32(insn, 16, 5); - op = extract32(insn, 14, 2); - rn = extract32(insn, 5, 5); - opc = extract32(insn, 3, 2); - op2r = extract32(insn, 0, 3); - - if (mos || op || op2r) { - unallocated_encoding(s); - return; - } - - switch (type) { - case 0: - size = MO_32; - break; - case 1: - size = MO_64; - break; - case 3: - size = MO_16; - if (dc_isar_feature(aa64_fp16, s)) { - break; - } - /* fallthru */ - default: - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - handle_fp_compare(s, size, rn, rm, opc & 1, opc & 2); -} - -/* Floating point conditional compare - * 31 30 29 28 24 23 22 21 20 16 15 12 11 10 9 5 4 3 0 - * +---+---+---+-----------+------+---+------+------+-----+------+----+------+ - * | M | 0 | S | 1 1 1 1 0 | type | 1 | Rm | cond | 0 1 | Rn | op | nzcv | - * +---+---+---+-----------+------+---+------+------+-----+------+----+------+ - */ -static void disas_fp_ccomp(DisasContext *s, uint32_t insn) -{ - unsigned int mos, type, rm, cond, rn, op, nzcv; - TCGLabel *label_continue = NULL; - int size; - - mos = extract32(insn, 29, 3); - type = extract32(insn, 22, 2); - rm = extract32(insn, 16, 5); - cond = extract32(insn, 12, 4); - rn = extract32(insn, 5, 5); - op = extract32(insn, 4, 1); - nzcv = extract32(insn, 0, 4); - - if (mos) { - unallocated_encoding(s); - return; - } - - switch (type) { - case 0: - size = MO_32; - break; - case 1: - size = MO_64; - break; - case 3: - size = MO_16; - if (dc_isar_feature(aa64_fp16, s)) { - break; - } - /* fallthru */ - default: - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - if (cond < 0x0e) { /* not always */ - TCGLabel *label_match = gen_new_label(); - label_continue = gen_new_label(); - arm_gen_test_cc(cond, label_match); - /* nomatch: */ - gen_set_nzcv(tcg_constant_i64(nzcv << 28)); - tcg_gen_br(label_continue); - gen_set_label(label_match); - } - - handle_fp_compare(s, size, rn, rm, false, op); - - if (cond < 0x0e) { - gen_set_label(label_continue); - } -} - /* Floating-point data-processing (1 source) - half precision */ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) { @@ -9107,16 +9039,9 @@ static void disas_data_proc_fp(DisasContext *s, uint32_t insn) disas_fp_fixed_conv(s, insn); } else { switch (extract32(insn, 10, 2)) { - case 1: - /* Floating point conditional compare */ - disas_fp_ccomp(s, insn); - break; - case 2: - /* Floating point data-processing (2 source) */ - unallocated_encoding(s); /* in decodetree */ - break; - case 3: - /* Floating point conditional select */ + case 1: /* Floating point conditional compare */ + case 2: /* Floating point data-processing (2 source) */ + case 3: /* Floating point conditional select */ unallocated_encoding(s); /* in decodetree */ break; case 0: @@ -9127,7 +9052,7 @@ static void disas_data_proc_fp(DisasContext *s, uint32_t insn) break; case 1: /* [15:12] == xx10 */ /* Floating point compare */ - disas_fp_compare(s, insn); + unallocated_encoding(s); /* in decodetree */ break; case 2: /* [15:12] == x100 */ /* Floating point data-processing (1 source) */ diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 5670846768..7868b1cb24 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1325,6 +1325,14 @@ FMINV_s 0110 1110 10 11000 01111 10 ..... ..... @rr_q1e2 FMOVI_s 0001 1110 .. 1 imm:8 100 00000 rd:5 esz=%esz_hsd +# Floating-point Compare + +FCMP 00011110 .. 1 rm:5 001000 rn:5 e:1 z:1 000 esz=%esz_hsd + +# Floating-point Conditional Compare + +FCCMP 00011110 .. 1 rm:5 cond:4 01 rn:5 e:1 nzcv:4 esz=%esz_hsd + # Advanced SIMD Modified Immediate / Shift by Immediate %abcdefgh 16:3 5:5 From patchwork Tue Dec 10 16:16:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848810 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416202wrn; Tue, 10 Dec 2024 08:19:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWJFc1SsZOqYO5W7Pzk4cKaFLCMK13/1wqy3wD7eL57BvpnOMndWvWFo/DwKzh6d0v+8vHm8g==@linaro.org X-Google-Smtp-Source: AGHT+IE7G6Ei6T0eQEmmUNnSK/80MfUjRyPae2cWHwuqdDGdr5Wimv/OiNaSnfLIiTyMi1TJYYn4 X-Received: by 2002:a05:622a:118d:b0:467:6092:8414 with SMTP id d75a77b69052e-4676092879amr148958951cf.0.1733847592266; Tue, 10 Dec 2024 08:19:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847592; cv=none; d=google.com; s=arc-20240605; b=RBZ9pDWPUysxyBg/owXrAMktLgj94I+Deq00tRonPtdP1PeF/9OT71IuKaoX7MoobS 1+oKVniro8DZ8/D6EseOPsVjIxnXBpmQ4HimqdEm2grRMbWwC+HScsW1Lzov3thkgmTt Mum9TRu9+6gm08cdlcA9vRQUApbtDoXLm7UyuDIdHRp4NtQHLkfDQBTwAfj0IRxUB9i+ Bg1bWZs8T3P/CU9gxY8qUjMbHQp+kASc5d1Ww21WOhVKigPg3IsCGCw8Kegrhj6HfYSX ZUuUU/P4dSZ87kHss67lea5zavp4J5CuvHYth+WiySn4LUrvD0rn8duAj3YwfmI3W0iO VEEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=q83e90ulUVLQbtHavUT3vQ1rYdZ/bzv60n0aSWIs0jE=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=WZ5xtbDcArWkUYei5KTRDFHOhy7NPijeAZ2sd9hFFi+ToETlB7fUCUXr5rjm/CoHHl LqHX/bAfzI86ncnXCXCxaTpo46zO8747piMuat7bkDB0blNh+roAdrKiwNrtzDrPBhXs n4fAvd6x4uQNeNuAKos38+LoiUGp7VEsbqQaljl/WwkvWt0qLSJbGDFI/4UGOL9BwWyq XU9ZZNOHyb5stx97nc34IRI6LT4wR0jgkz6OA4Wg4WiYyluHlCez9V4N87PLUQga0XnH oXkn4EUJxokk1yBlo9cOruiAzZw3rh9SVV8aFPS5RdjDxpqrQf2VhOxDpG5cnaMvHQFm OUvQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ycJ/NGjr"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4677fcf10b4si13709541cf.329.2024.12.10.08.19.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:19:52 -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="ycJ/NGjr"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xP-0003n4-MP; Tue, 10 Dec 2024 11:19:31 -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 1tL2xC-00035u-Ay for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:19 -0500 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2xA-0006UB-HD for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:17 -0500 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-54021daa6cbso1929698e87.0 for ; Tue, 10 Dec 2024 08:19:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847555; x=1734452355; 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=q83e90ulUVLQbtHavUT3vQ1rYdZ/bzv60n0aSWIs0jE=; b=ycJ/NGjrBCStnRUG+hkJ8WQqVUNPfHsyufSMgqOmc+5FP01tNhUlN4Xm+4IgPX+33M 4acRW/A9ocIorcyVaNvlvlYYQoUGx646Wb/RGXBTbvS0kv/YXCUV+AB37Ce1pjb3Wa/y zYchIufcrPmjfULn0BNv7/5vs3qBxpUBDHD8UUNd2qxi1EjiVvP6/g55PoQx7f6e796B XgKdP0ZI0E+jAiZ8DQdPYdDYPvGMisofJLu1xw2swdSzQSSCcBogGopeCRi6HSrS2yTy eZt+TsRKjGEa521Cu999epPIfOBdVKlNvb4pcHojI+SoBPaG514SZWrhiXsUflU4109o jzuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847555; x=1734452355; 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=q83e90ulUVLQbtHavUT3vQ1rYdZ/bzv60n0aSWIs0jE=; b=P1PljuC8SlGsqZWBjzEb2s63JPX/UlJyRWuPBPxR4gX0FhELW+uigReuF1gCUJm029 N5VvVEmR4ICrFwzGyCT+v6EbCQj+hehSe5/Rg7bZth3qy6vd8JPdLVcbFKR/rRUxFzQH jgJEd4x+TjFtY8z+Arz35pbmy0GAdcx/4dsxcMJy0hFHBrR9Q6XyXPbF748FzgYHQriE fGTjEA7zI/9VYMdbpySOwgz2j12x4+MRcxqv8kaL1Td9dONtmjxNLtZCDC0v/lTJ3ImV IRM6nHCIbfSycLecfbkQUy1WlL7cLWOYOK5Nygeqo4nYO7UOYbC09qR78VJMSigwLdA9 gsow== X-Gm-Message-State: AOJu0YxPSJwn+gqwoqMtkN7CJ+ne77mGPMfet0NnQ3N0cG2BWY6cRpka X+1/iuYltOequ2KTmQs2m0au8FZAR8gFsHBoT7K2QxZagALk7eUgE7b2M0bYEZOmuUgkDXLjZvz swS8cEzgs X-Gm-Gg: ASbGncvLpl8RWX8FXWPZ4hbD1UmViaQkmijox8VAfhvQb2HO8dZ0xciUjzK/Yzi5jvk a8HtRIaZXQc0BwnBeILRTL6DAaSoA8v8QtwAaVyubsPdZja/VZhJWObhpURPDVE1wu8LeX7l13N r1K/bP+8qMc7a1JqgHq9Z0RCVio2F+HCegQYZws9xNvXkA+VbpVVcaLVyjJqDbWs+zx/atq3bV+ FnaeSP9QPojKJ7eghXl1CXy67Ih3kk8yxBL+Ks+j1imxxbR9IQ6ZsIIJlU= X-Received: by 2002:a05:6512:3b29:b0:540:1c18:4e23 with SMTP id 2adb3069b0e04-5402410f8f3mr2275741e87.47.1733847554763; Tue, 10 Dec 2024 08:19:14 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.19.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:19:13 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 23/69] target/arm: Fix decode of fp16 vector fabs, fneg Date: Tue, 10 Dec 2024 10:16:47 -0600 Message-ID: <20241210161733.1830573-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x130.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 These opcodes are only supported as vector operations, not as advsimd scalar. Set only_in_vector, and remove the unreachable implementation of scalar fneg. Reported-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index a99f3d0d13..f67360c4c5 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -10816,6 +10816,7 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) break; case 0x2f: /* FABS */ case 0x6f: /* FNEG */ + only_in_vector = true; need_fpst = false; break; case 0x7d: /* FRSQRTE */ @@ -10877,9 +10878,6 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x7b: /* FCVTZU */ gen_helper_advsimd_f16touinth(tcg_res, tcg_op, tcg_fpstatus); break; - case 0x6f: /* FNEG */ - tcg_gen_xori_i32(tcg_res, tcg_op, 0x8000); - break; case 0x7d: /* FRSQRTE */ gen_helper_rsqrte_f16(tcg_res, tcg_op, tcg_fpstatus); break; From patchwork Tue Dec 10 16:16:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848854 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp419986wrn; Tue, 10 Dec 2024 08:26:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV62lq9EA+efOj2YzOdCJSmf0HUflJJun/UvDSDT9omD6fFzNQqexTHgvLKrlkWiiSlUYsrrg==@linaro.org X-Google-Smtp-Source: AGHT+IEtzVw/fTHmObboRYWiSd0T4ta2sOyADFOhiSH5o2TkYSWFjfSvFhHFnAY0S4Gp63pG1gJk X-Received: by 2002:a05:6102:e0c:b0:4b1:177f:cc38 with SMTP id ada2fe7eead31-4b11970e3admr3325902137.9.1733848005147; Tue, 10 Dec 2024 08:26:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848005; cv=none; d=google.com; s=arc-20240605; b=a4pAzSEq4pTpeMxt4k5wC8ZNFHl527rU4bsGHwXTM3dpDLIxBeQjiQzXOqVYsEf6qK 57LSOoM6ej1Xt5l4bA3Wds4IrwXjSpTVO6zqrQeKksw7SchiNYtrZzXscor88NbTF+Ob McHW1pn3R4A0gmyPLUeedyelSYfx8Dbk+B6G7XSx27EakOHO01/pAM9EaktLot1qPz6e bc/0yN0wveUs8zuanJwyasA3Xz/u925gRfF3+5A3oHuj1K8AVk42e0X/D800NeFxDdQK kTXilK9Je7LbCiUUz7ef5G03PR4QTAnI002Q5rtASckf9lk9ZZEdJHtBs0lUKh/RxsU1 l0UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=hZUfnoUbCzoibw5eZqOQnMsi9ILH5rDTjy2/cp2KD2c=; fh=9Ev+QBUhk6P6vR3LT1wYeDLexozsz44nqjfoyPajZCc=; b=DxZQGf5zQv5gyUh2uPr5+JP0kYJSDObheluln4taqnnEpRcnsm6QAzlIGnQYOzWW5O FKTY23hC/ftmNs5SpYnZtFw7dg26q2ZJu2lv/YraGKPuhUN8ac+Lkq5C4XMDieLL67M1 8lnZ0QNE0FZFMT00orBdcY4FVYkMRAf6D2sqljKENyIpqbCvI7Hk8qlKC4E/MV0pVMY2 B/glGlCboHpFLSwElbvV/EDII9y6it7zhu8/h/Q9tuaOVvlLu4XW9I21hx4+93T0iNSx wpTXtNWJ+H9HDMgYueWiWiuVxk9h8kA7gb/LWmUK9L9GtK2qatH3pRtydSYalgDP8ua4 3LfQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VpaoakBe; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4b1111ba5d8si1084426137.577.2024.12.10.08.26.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:26:45 -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=VpaoakBe; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xV-0004Lj-KG; Tue, 10 Dec 2024 11:19:37 -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 1tL2xG-0003Ab-Ri for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:24 -0500 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2xE-0006Uu-MZ for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:22 -0500 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-53e389d8dc7so4019804e87.0 for ; Tue, 10 Dec 2024 08:19:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847559; x=1734452359; 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=hZUfnoUbCzoibw5eZqOQnMsi9ILH5rDTjy2/cp2KD2c=; b=VpaoakBe84qii44q2kpX80m3rZkN5ZfDbF0PXnRZK0jrCgyW/t0IenBLec1x7MLQor LlosbPrMq5FMzB5Y03lese+5r14e8wkk/9Dp8sBo8TLMPNI7xhxZvPmj4YcLliQQoFK/ /iLdSV06XI0qyu2U0kbh1NTsZUruj9v7lwdTVAszgYPprmq+MiKXKRfRkOYGyne3eJlH vGD0nU/QrjA/9Y8Wl99In17im8936BO2SXjYMhLssy9srYCRvuvF2bhLEKoMjSC1+Luq 4L7v4w/HTux7vsdVRs+sbNYDCa/ikZ9ga+LmzVa0O+FtNbZ3buUDrxl9luWzJsE2jtUO /mNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847559; x=1734452359; 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=hZUfnoUbCzoibw5eZqOQnMsi9ILH5rDTjy2/cp2KD2c=; b=HTGsrq80jKSaWjGmCERNnY/znyDDlg7WX3b//8lFsDMjN1RNWxup2OgehayNrAvgZ8 EHNCi7gcCWcjinsN/VAhm2n/YvyKaiFkMRkLU8SjE9cnb9BviHtbJMTpOMTOtFnGTvli wf35MT6NwVotgt37yIQZHMPCeibSmJTcOUvQTbLAXhfJlhHQuVB56KnSFjEa241IKAYH dwwQRGPjbhJBkOtkn35fshKsLW3ArCadk4OiPpiQHivgxt6w18tl3u1xwyVNLjyNYZbY sJxwQqcDhxRyFosvofABG6snLTcTg0fwt3iKQ9PSco5Jv2dvsySatWwTQ2CACcyCmB2D /wVg== X-Gm-Message-State: AOJu0YyP4K95s4P9+Mi7OJ0/Yio/DjWa3VkCTLZp5KcfGEkdjsg2Wrd0 QzjKuQrefidj4FsNndfSC30F4PjEJrRzUJU6PusDLwI7U5053iWwFspK3te4Zjvu9SyJUIf0pk+ B2F7wamd6 X-Gm-Gg: ASbGncvLLCJ0FcOdPD7Y1za7H+TTnMPSIOvAYQoRd3tAC7yKmG8gE0zG5AcPqV5tg/6 4F2K40wQEcBRMeSCMMe57duw1jPrJHh2pQVVCKCA6UiaxB7L/SoL4tdaNN8G2cY7WGFb2jSjKm0 J367b/28VaUUrNCBvbwV0YQi48+qOznbSwBVNUBvDIVgB5FNNbMUF6cuHT5RmNv/lKN2flob9v1 X8Q7GFsc7mAxzSQ7bOwCq9dbtc2Bnu2DnN1SpX4yPZnMAgieT38tiHUHKE= X-Received: by 2002:a05:6512:281d:b0:540:2160:1f80 with SMTP id 2adb3069b0e04-540216021e3mr1892283e87.40.1733847558952; Tue, 10 Dec 2024 08:19:18 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.19.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:19:17 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 24/69] target/arm: Convert FMOV, FABS, FNEG (scalar) to decodetree Date: Tue, 10 Dec 2024 10:16:48 -0600 Message-ID: <20241210161733.1830573-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::132; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x132.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 Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 105 +++++++++++++++++++++++---------- target/arm/tcg/a64.decode | 7 +++ 2 files changed, 81 insertions(+), 31 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index f67360c4c5..383ee7f3f0 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8283,6 +8283,67 @@ static bool trans_CSEL(DisasContext *s, arg_CSEL *a) return true; } +typedef struct FPScalar1Int { + void (*gen_h)(TCGv_i32, TCGv_i32); + void (*gen_s)(TCGv_i32, TCGv_i32); + void (*gen_d)(TCGv_i64, TCGv_i64); +} FPScalar1Int; + +static bool do_fp1_scalar_int(DisasContext *s, arg_rr_e *a, + const FPScalar1Int *f) +{ + switch (a->esz) { + case MO_64: + if (fp_access_check(s)) { + TCGv_i64 t = read_fp_dreg(s, a->rn); + f->gen_d(t, t); + write_fp_dreg(s, a->rd, t); + } + break; + case MO_32: + if (fp_access_check(s)) { + TCGv_i32 t = read_fp_sreg(s, a->rn); + f->gen_s(t, t); + write_fp_sreg(s, a->rd, t); + } + break; + case MO_16: + if (!dc_isar_feature(aa64_fp16, s)) { + return false; + } + if (fp_access_check(s)) { + TCGv_i32 t = read_fp_hreg(s, a->rn); + f->gen_h(t, t); + write_fp_sreg(s, a->rd, t); + } + break; + default: + return false; + } + return true; +} + +static const FPScalar1Int f_scalar_fmov = { + tcg_gen_mov_i32, + tcg_gen_mov_i32, + tcg_gen_mov_i64, +}; +TRANS(FMOV_s, do_fp1_scalar_int, a, &f_scalar_fmov) + +static const FPScalar1Int f_scalar_fabs = { + gen_vfp_absh, + gen_vfp_abss, + gen_vfp_absd, +}; +TRANS(FABS_s, do_fp1_scalar_int, a, &f_scalar_fabs) + +static const FPScalar1Int f_scalar_fneg = { + gen_vfp_negh, + gen_vfp_negs, + gen_vfp_negd, +}; +TRANS(FNEG_s, do_fp1_scalar_int, a, &f_scalar_fneg) + /* Floating-point data-processing (1 source) - half precision */ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) { @@ -8291,15 +8352,6 @@ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) TCGv_i32 tcg_res = tcg_temp_new_i32(); switch (opcode) { - case 0x0: /* FMOV */ - tcg_gen_mov_i32(tcg_res, tcg_op); - break; - case 0x1: /* FABS */ - gen_vfp_absh(tcg_res, tcg_op); - break; - case 0x2: /* FNEG */ - gen_vfp_negh(tcg_res, tcg_op); - break; case 0x3: /* FSQRT */ fpst = fpstatus_ptr(FPST_FPCR_F16); gen_helper_sqrt_f16(tcg_res, tcg_op, fpst); @@ -8327,6 +8379,9 @@ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) gen_helper_advsimd_rinth(tcg_res, tcg_op, fpst); break; default: + case 0x0: /* FMOV */ + case 0x1: /* FABS */ + case 0x2: /* FNEG */ g_assert_not_reached(); } @@ -8345,15 +8400,6 @@ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) tcg_res = tcg_temp_new_i32(); switch (opcode) { - case 0x0: /* FMOV */ - tcg_gen_mov_i32(tcg_res, tcg_op); - goto done; - case 0x1: /* FABS */ - gen_vfp_abss(tcg_res, tcg_op); - goto done; - case 0x2: /* FNEG */ - gen_vfp_negs(tcg_res, tcg_op); - goto done; case 0x3: /* FSQRT */ gen_helper_vfp_sqrts(tcg_res, tcg_op, tcg_env); goto done; @@ -8389,6 +8435,9 @@ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) gen_fpst = gen_helper_frint64_s; break; default: + case 0x0: /* FMOV */ + case 0x1: /* FABS */ + case 0x2: /* FNEG */ g_assert_not_reached(); } @@ -8413,22 +8462,10 @@ static void handle_fp_1src_double(DisasContext *s, int opcode, int rd, int rn) TCGv_ptr fpst; int rmode = -1; - switch (opcode) { - case 0x0: /* FMOV */ - gen_gvec_fn2(s, false, rd, rn, tcg_gen_gvec_mov, 0); - return; - } - tcg_op = read_fp_dreg(s, rn); tcg_res = tcg_temp_new_i64(); switch (opcode) { - case 0x1: /* FABS */ - gen_vfp_absd(tcg_res, tcg_op); - goto done; - case 0x2: /* FNEG */ - gen_vfp_negd(tcg_res, tcg_op); - goto done; case 0x3: /* FSQRT */ gen_helper_vfp_sqrtd(tcg_res, tcg_op, tcg_env); goto done; @@ -8461,6 +8498,9 @@ static void handle_fp_1src_double(DisasContext *s, int opcode, int rd, int rn) gen_fpst = gen_helper_frint64_d; break; default: + case 0x0: /* FMOV */ + case 0x1: /* FABS */ + case 0x2: /* FNEG */ g_assert_not_reached(); } @@ -8581,7 +8621,7 @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) goto do_unallocated; } /* fall through */ - case 0x0 ... 0x3: + case 0x3: case 0x8 ... 0xc: case 0xe ... 0xf: /* 32-to-32 and 64-to-64 ops */ @@ -8631,6 +8671,9 @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) default: do_unallocated: + case 0x0: /* FMOV */ + case 0x1: /* FABS */ + case 0x2: /* FNEG */ unallocated_encoding(s); break; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 7868b1cb24..b9cc8963da 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -47,6 +47,7 @@ @rr_h ........ ... ..... ...... rn:5 rd:5 &rr_e esz=1 @rr_d ........ ... ..... ...... rn:5 rd:5 &rr_e esz=3 @rr_sd ........ ... ..... ...... rn:5 rd:5 &rr_e esz=%esz_sd +@rr_hsd ........ ... ..... ...... rn:5 rd:5 &rr_e esz=%esz_hsd @rrr_b ........ ... rm:5 ...... rn:5 rd:5 &rrr_e esz=0 @rrr_h ........ ... rm:5 ...... rn:5 rd:5 &rrr_e esz=1 @@ -1321,6 +1322,12 @@ FMAXV_s 0110 1110 00 11000 01111 10 ..... ..... @rr_q1e2 FMINV_h 0.00 1110 10 11000 01111 10 ..... ..... @qrr_h FMINV_s 0110 1110 10 11000 01111 10 ..... ..... @rr_q1e2 +# Floating-point data processing (1 source) + +FMOV_s 00011110 .. 1 000000 10000 ..... ..... @rr_hsd +FABS_s 00011110 .. 1 000001 10000 ..... ..... @rr_hsd +FNEG_s 00011110 .. 1 000010 10000 ..... ..... @rr_hsd + # Floating-point Immediate FMOVI_s 0001 1110 .. 1 imm:8 100 00000 rd:5 esz=%esz_hsd From patchwork Tue Dec 10 16:16:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848837 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp418301wrn; Tue, 10 Dec 2024 08:23:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX86Uui2LSTEJ7FrPufHUckUv4TpJaqykgJsrX38uY1jfuSMb+YfbDf2J112I4nlfeC14ovKA==@linaro.org X-Google-Smtp-Source: AGHT+IG73esmfHwmtfNsSTW+m6YKNdlsnmUo6OAvyjZbaT5XtDI8nCjIWsN6YC8nUKlXzJVSJHej X-Received: by 2002:a05:620a:8904:b0:79f:67b:4fdc with SMTP id af79cd13be357-7b6dcdc845fmr712649885a.2.1733847816625; Tue, 10 Dec 2024 08:23:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847816; cv=none; d=google.com; s=arc-20240605; b=Ppqj+b3+sxdYncLB9SZaYtLycpmKV6o/918gKkQEFdZjKtddoSoTP/7oz+92wcltRp +bd7DWdhheEbq40Hbz6CL6UH5xIEuS1N/CYsiQhT9rw+Ng7uBBcT9VR3ZW+eizWMVYwg 2lvxkI9zngZ0pZ1U/Ouxso/XwNZfLaYfJLJfDsHnz7dBm8tqMboqo7Vf79JPIFR73xc/ TxOJJTIyDd+lbRoQRI329dM/TKrttES03yJsPtYdgu7ILv8xq+KPUiewe5ZspHdseva4 aaxj3PNRo7jFRPF+WXKps9nd151ype0BoxSO84uZPjt2CwsZ6nzXb3ZfFa535jl6kpqM Z+sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=N1zXLXupdpoNpc9DfQSmYSFNMct53t/YHwICpvsaTEU=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=B/1wEp3EF4DAmAZGVdeg0LuJl9fOPxzK8h1rKj+XBubp0UqHvhNT9Lw+2ekVyb0vwZ vOLDvvUQ0QkSbWN9ekJIKfQeF06fuBcZ2M0K2vKV/6cXIHoxg0NHmWHJ7gnuTtuDQ6B5 hetqeEvMTeOwdwpmcdqUCgVG5DIM+iBv0h/LioaADO29bXszhaB9KsQU68+QMcc1C8HQ CSFL2gQjTrtsqiKVwzm3e6D/GvuKNDHj9H0D3/VClhPU9AnP7bEZSylfDDKgAUE3wL3/ TyzGp/wberx6iH52aBYTPHX9zERhIjoOL6/2f6v5efnukHamP8PO67A16g4nWDE1UrpV 2y1w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mZpsuu2J; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6e5ca6afesi124909085a.323.2024.12.10.08.23.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:23: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=mZpsuu2J; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xa-0004Ve-7p; Tue, 10 Dec 2024 11:19:42 -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 1tL2xJ-0003Ft-Ia for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:25 -0500 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2xH-0006VE-Kp for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:25 -0500 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-53ffaaeeb76so3063501e87.0 for ; Tue, 10 Dec 2024 08:19:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847562; x=1734452362; 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=N1zXLXupdpoNpc9DfQSmYSFNMct53t/YHwICpvsaTEU=; b=mZpsuu2J1gQLgEskcJVYIE1EtR/TvcLPHhlQ10LJlaqFONViw4R1mf72LGuAlIH1ab i90zgBj9o2U7zRMqphpZoIiirVm2OHv8T7n0INJBN5WVQP9S/AAHi+9NhkzeBRhD9YR/ dvIP9VwdlGl/fN3caZCj9owK6PouUBmP8Tq5p/1E5ggAETarKIU5p59dYz+ky7jP3Oaf 5lbW2551SV4QfGEl4fH+8fldVpvHKkbdNCRcYFiLIMjlchZQQ+/HT1DTlD/KlQw9sK5g bn5i0c8YEYCYak1GLOq8rA450WbwRymh1VUJujOEQYMgX3TAk7ikGvA8ZPp9US39cA15 jZ1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847562; x=1734452362; 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=N1zXLXupdpoNpc9DfQSmYSFNMct53t/YHwICpvsaTEU=; b=LG6SxmBnS1Jw/UfciCwKkqD7KuN2+DH/BHUPaanPJt1czkHGJl9Azrt3Io+pnP2TuP 8+Hw7GSR0LwokZEu+YEBYECXTvTc5qRhAo2YZmFzQ5tScC73c39EUmEKiJjiSDKwN0ze ROXtgy27yY2PTkOdLcCcDts0nVKbAD9Kc8ZpJKU1UucPYILE0B1iX6c93DB85RPQEjbd ljkA1Y2kOCC5JM+NAoiUG1hin/9npUvzTnpMlZsviuckiiSDXYyJLqZVB37EJVWBR4xN Nh3gtmvzWs3rAjmXkbGHmU6lKFLumifgTvbmFkkYxBkWtQ8F4vnMRFQRsNp8J1qonH3/ C5pA== X-Gm-Message-State: AOJu0YxydgsJ4EMZXKWwslYgDPFd+HfyDEYzF5rR+kaFd/xUIVHiCtVk gc7tdhwQz6EbJoLGvFaQVsrYun9tNitrVvhG+wv/LEmogSZO2DQnO96GGOWRNpLSeHzZEC7yEBM aasjiCFfj X-Gm-Gg: ASbGncsPGNV4lELBTFQennP1lzscrdfpVWeuv65Xk17DnmIPO3X0TQBPyaUA/0qNn9C XLaz19Jk+tU8RghDAuuR1L5w94UF/7gwMxZQLm7uvTjP//oYUljIRJ3BbRw3TYaBvBWjRq4WgD4 A5GqhHimpqvYonQNIraToG0M7IlMAMVBsoS0DNXfOkFDwmzPDKirPG6e7tXgwxBCEUU7n0Ihw5e 98EENw8WpPTi+VS5WDqvOocrON1TIbpohX9HwMwYHuUGTwA7kbZt7gCIj0= X-Received: by 2002:a05:6512:3d21:b0:540:1d2b:c47f with SMTP id 2adb3069b0e04-5401d2bc4e4mr3481034e87.49.1733847561954; Tue, 10 Dec 2024 08:19:21 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.19.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:19:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 25/69] target/arm: Pass fpstatus to vfp_sqrt* Date: Tue, 10 Dec 2024 10:16:49 -0600 Message-ID: <20241210161733.1830573-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12d; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12d.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 Pass fpstatus not env, like most other fp helpers. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.h | 6 +++--- target/arm/tcg/translate-a64.c | 15 +++++++-------- target/arm/tcg/translate-vfp.c | 6 +++--- target/arm/vfp_helper.c | 12 ++++++------ 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 58919b670e..0a697e752b 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -133,9 +133,9 @@ DEF_HELPER_3(vfp_maxnumd, f64, f64, f64, ptr) DEF_HELPER_3(vfp_minnumh, f16, f16, f16, ptr) DEF_HELPER_3(vfp_minnums, f32, f32, f32, ptr) DEF_HELPER_3(vfp_minnumd, f64, f64, f64, ptr) -DEF_HELPER_2(vfp_sqrth, f16, f16, env) -DEF_HELPER_2(vfp_sqrts, f32, f32, env) -DEF_HELPER_2(vfp_sqrtd, f64, f64, env) +DEF_HELPER_2(vfp_sqrth, f16, f16, ptr) +DEF_HELPER_2(vfp_sqrts, f32, f32, ptr) +DEF_HELPER_2(vfp_sqrtd, f64, f64, ptr) DEF_HELPER_3(vfp_cmph, void, f16, f16, env) DEF_HELPER_3(vfp_cmps, void, f32, f32, env) DEF_HELPER_3(vfp_cmpd, void, f64, f64, env) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 383ee7f3f0..e278c0d87b 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8401,8 +8401,8 @@ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) switch (opcode) { case 0x3: /* FSQRT */ - gen_helper_vfp_sqrts(tcg_res, tcg_op, tcg_env); - goto done; + gen_fpst = gen_helper_vfp_sqrts; + break; case 0x6: /* BFCVT */ gen_fpst = gen_helper_bfcvt; break; @@ -8450,7 +8450,6 @@ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) gen_fpst(tcg_res, tcg_op, fpst); } - done: write_fp_sreg(s, rd, tcg_res); } @@ -8467,8 +8466,8 @@ static void handle_fp_1src_double(DisasContext *s, int opcode, int rd, int rn) switch (opcode) { case 0x3: /* FSQRT */ - gen_helper_vfp_sqrtd(tcg_res, tcg_op, tcg_env); - goto done; + gen_fpst = gen_helper_vfp_sqrtd; + break; case 0x8: /* FRINTN */ case 0x9: /* FRINTP */ case 0xa: /* FRINTM */ @@ -8513,7 +8512,6 @@ static void handle_fp_1src_double(DisasContext *s, int opcode, int rd, int rn) gen_fpst(tcg_res, tcg_op, fpst); } - done: write_fp_dreg(s, rd, tcg_res); } @@ -9459,7 +9457,7 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, gen_vfp_negd(tcg_rd, tcg_rn); break; case 0x7f: /* FSQRT */ - gen_helper_vfp_sqrtd(tcg_rd, tcg_rn, tcg_env); + gen_helper_vfp_sqrtd(tcg_rd, tcg_rn, tcg_fpstatus); break; case 0x1a: /* FCVTNS */ case 0x1b: /* FCVTMS */ @@ -10402,6 +10400,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) handle_2misc_fcmp_zero(s, opcode, false, u, is_q, size, rn, rd); return; case 0x7f: /* FSQRT */ + need_fpstatus = true; if (size == 3 && !is_q) { unallocated_encoding(s); return; @@ -10631,7 +10630,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) gen_vfp_negs(tcg_res, tcg_op); break; case 0x7f: /* FSQRT */ - gen_helper_vfp_sqrts(tcg_res, tcg_op, tcg_env); + gen_helper_vfp_sqrts(tcg_res, tcg_op, tcg_fpstatus); break; case 0x1a: /* FCVTNS */ case 0x1b: /* FCVTMS */ diff --git a/target/arm/tcg/translate-vfp.c b/target/arm/tcg/translate-vfp.c index b6fa28a7bf..c160a86e70 100644 --- a/target/arm/tcg/translate-vfp.c +++ b/target/arm/tcg/translate-vfp.c @@ -2424,17 +2424,17 @@ DO_VFP_2OP(VNEG, dp, gen_vfp_negd, aa32_fpdp_v2) static void gen_VSQRT_hp(TCGv_i32 vd, TCGv_i32 vm) { - gen_helper_vfp_sqrth(vd, vm, tcg_env); + gen_helper_vfp_sqrth(vd, vm, fpstatus_ptr(FPST_FPCR_F16)); } static void gen_VSQRT_sp(TCGv_i32 vd, TCGv_i32 vm) { - gen_helper_vfp_sqrts(vd, vm, tcg_env); + gen_helper_vfp_sqrts(vd, vm, fpstatus_ptr(FPST_FPCR)); } static void gen_VSQRT_dp(TCGv_i64 vd, TCGv_i64 vm) { - gen_helper_vfp_sqrtd(vd, vm, tcg_env); + gen_helper_vfp_sqrtd(vd, vm, fpstatus_ptr(FPST_FPCR)); } DO_VFP_2OP(VSQRT, hp, gen_VSQRT_hp, aa32_fp16_arith) diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 62638d2b1f..f24992c798 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -314,19 +314,19 @@ VFP_BINOP(minnum) VFP_BINOP(maxnum) #undef VFP_BINOP -dh_ctype_f16 VFP_HELPER(sqrt, h)(dh_ctype_f16 a, CPUARMState *env) +dh_ctype_f16 VFP_HELPER(sqrt, h)(dh_ctype_f16 a, void *fpstp) { - return float16_sqrt(a, &env->vfp.fp_status_f16); + return float16_sqrt(a, fpstp); } -float32 VFP_HELPER(sqrt, s)(float32 a, CPUARMState *env) +float32 VFP_HELPER(sqrt, s)(float32 a, void *fpstp) { - return float32_sqrt(a, &env->vfp.fp_status); + return float32_sqrt(a, fpstp); } -float64 VFP_HELPER(sqrt, d)(float64 a, CPUARMState *env) +float64 VFP_HELPER(sqrt, d)(float64 a, void *fpstp) { - return float64_sqrt(a, &env->vfp.fp_status); + return float64_sqrt(a, fpstp); } static void softfloat_to_vfp_compare(CPUARMState *env, FloatRelation cmp) From patchwork Tue Dec 10 16:16:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848836 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp418168wrn; Tue, 10 Dec 2024 08:23:25 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWDkrvwYXw8/Va6GJeAnCY2GlcaedMo76YJ8FV4kJR1TXyTyU7gBg9q/kbU8FQa2iQPLtE0+Q==@linaro.org X-Google-Smtp-Source: AGHT+IET6fATSmOCT2632A3rO4uFS0b7ozoFqpPlBZh/9g/RbYlFP2U3EZ2sY/LUlIszlxxwGorM X-Received: by 2002:a05:622a:30c:b0:461:169e:d2dc with SMTP id d75a77b69052e-46772029ffbmr69002971cf.49.1733847805653; Tue, 10 Dec 2024 08:23:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847805; cv=none; d=google.com; s=arc-20240605; b=YVVa+6MXzs80XisZ7zOJo1Q6dqf14Bzx8hY1uVyWcELUzhOcW1hAdBA0Nnlqvdf4yI +LG8MsK4QGbkf/8BqvXweN3zuL51/aiQs1osjeRUQZAbCU0dDOBN7Yl4RHDai8uJSODe 8J9euZ6QzfS2Lfle8ITqY7zInPiJoBzgcnXxhBHHNRPhP6vkHpCsVA3+pzw/WWTF4HSD e4t785LjaqZZ+7t/NYE5Rl5PTwp7TEk6GhEp8A2EKq0YFqYVy/ANYrfRV6bGZ/qQbCtF XWVa1EIZ0haDwXrQboFvPqagYVQpGD3KStqBH87csbm3Th2L8AMDb4r6AUEy4ftB3FYx HV+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=1UXwx0kDopuEVwiBnbW88lWarbgL+jsSQVFPQ+k0F70=; fh=OZQBfL75rC14cCDy3q+1fYHCs9KjWAQ7ZJ3hTfS+5lQ=; b=bF+wztP1iCjz2REgrL+fkfxCoSxxtuNsHLvBNZwqz9G0MtVvhJ7ahwMTrPqndZg9cK jvSKWmL0IjGVjTvXbeXT6C1uzxiVWOe/RFC0b7gd1927jVIsU6yOxtydAnFBgA4ah3XR 33sPdFyNRLgh0tiK674MA06RIGUIWpk+WpZGFFBRKbP255Eko1BU4Fxy7lrTyGaw5wLb XSnW9zIQdSky8gqKyMFLL20BSqvvKeUYP/VC8+ms1vxOM7b+hxwd/SFVlEq3ttTSGgRo F9dtRxR5aMZ6AWN9yz5f7A0Qd49JksnDGUFvsIbT8Kx08b3mfgPb0122LWcnzq5XfVda 4Evg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="I2evV/m3"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46745a87543si95027351cf.137.2024.12.10.08.23.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:23: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="I2evV/m3"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xa-0004V5-7r; Tue, 10 Dec 2024 11:19:42 -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 1tL2xO-0003fU-6Q for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:30 -0500 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2xM-0006Vy-5p for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:29 -0500 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-30219437e63so25663751fa.1 for ; Tue, 10 Dec 2024 08:19:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847566; x=1734452366; 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=1UXwx0kDopuEVwiBnbW88lWarbgL+jsSQVFPQ+k0F70=; b=I2evV/m3VJZxMfOCGB2GL2GfF0ibnDBMXbUpAYJpAfzZLhvlj2L3gGT1fWtPZtu58j BZ0lN1EWIKxpoS3prLEY+4qaT5bZMq/jc3WjSOJZFJd01OLzrdVJj5B3vi6q+kXfXthe 86b+ElBHelwa/7YvdhPnTjr5bj59KiiAXUjEYgpckZ7s+C7AAYtOuGOpQCdLatYqqq1A 5K+UF6cBpCGVfE6E4bdj8HP7cNKD7sT/hi0sPKYo51QuqKJCBi0/cyFb8dJwM1tU3MkG Q0F4GmCynbNrEqduBBWQSz2pkwTcnGd3wmOAeRfVSwGy5FL0PTLlnFadRTKRc54HrU80 CEyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847566; x=1734452366; 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=1UXwx0kDopuEVwiBnbW88lWarbgL+jsSQVFPQ+k0F70=; b=UbSpZywDIxxonuawomAKwebALKLk+50IkJjWFQa4vn1bYIuuMlxF9FGNlNPOIR08yo SBFDp3eZBdVikuiGaXM3I3kvmEKfwIqsi5kCUsceNxQ8j46r1izpZcbnH2g07DzruHEY dYAiexa0vNJ0FDjmr20N/jwZkzqCG9BIYBj13CGMBhU0REGS9m9TCxl0ZMEcAioWDgsi 40JPqH4NYILJLCjkNyzIVQRQNVGwgqFXrzQC2LEHGli61o6Sd5wGEz2PKSf88vtw/rN+ YbSD/6NuDW7Oyy3ZQ8D0cFy9rjIedfcCpI5PN0fY7r2x9TYGqaT5QsY05ox2LgansqGB FOPw== X-Gm-Message-State: AOJu0Yxv7VbzIuiVrdVezS8UceSFHGbNn6jcbgffnz6Zf68A64JND5Ra xxhpi64HLNmDmwUfOkKd2QTPYpC+1uoxMkMIc+P+i2BCafHcxZdKJfnylwN6gcbAjCEU/iNuwWd d1a6+Z3BK X-Gm-Gg: ASbGncsfMvPQh7abWIFHeaE1LarZWevLWakIsOAQW0NW2fHGq/nrSXz0EjA5J+k0Gaj 5OxFjRh9k23RMc+Sq5prBZzm2s31vCyAFvVWvC6iXcDit86WFrs9UPRP5G784jNeoDJcSiV+Amc LXbQmdoSmeLoec9aMXsz6saLAEre1Ysrgllq6R6v/K2JQ5j2ZsVpw9LZO7SfVcbvY57rQXkVFIR CcKfWq9ae1hPf2/Qa0p4V4rQM6BMJs6hF73iab1U9NP4ELQgTwFP02nnoo= X-Received: by 2002:a05:6512:1250:b0:540:2223:9b1c with SMTP id 2adb3069b0e04-540251fd730mr1441112e87.25.1733847566392; Tue, 10 Dec 2024 08:19:26 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.19.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:19:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 26/69] target/arm: Remove helper_sqrt_f16 Date: Tue, 10 Dec 2024 10:16:50 -0600 Message-ID: <20241210161733.1830573-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::235; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x235.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 This function is identical with helper_vfp_sqrth. Replace all uses. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/tcg/helper-a64.h | 1 - target/arm/tcg/helper-a64.c | 11 ----------- target/arm/tcg/translate-a64.c | 4 ++-- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/target/arm/tcg/helper-a64.h b/target/arm/tcg/helper-a64.h index 481007bf39..203b7b7ac8 100644 --- a/target/arm/tcg/helper-a64.h +++ b/target/arm/tcg/helper-a64.h @@ -80,7 +80,6 @@ DEF_HELPER_2(advsimd_rinth_exact, f16, f16, ptr) DEF_HELPER_2(advsimd_rinth, f16, f16, ptr) DEF_HELPER_2(advsimd_f16tosinth, i32, f16, ptr) DEF_HELPER_2(advsimd_f16touinth, i32, f16, ptr) -DEF_HELPER_2(sqrt_f16, f16, f16, ptr) DEF_HELPER_2(exception_return, void, env, i64) DEF_HELPER_FLAGS_2(dc_zva, TCG_CALL_NO_WG, void, env, i64) diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c index 8f42a28d07..3f4d7b9aba 100644 --- a/target/arm/tcg/helper-a64.c +++ b/target/arm/tcg/helper-a64.c @@ -915,17 +915,6 @@ illegal_return: "resuming execution at 0x%" PRIx64 "\n", cur_el, env->pc); } -/* - * Square Root and Reciprocal square root - */ - -uint32_t HELPER(sqrt_f16)(uint32_t a, void *fpstp) -{ - float_status *s = fpstp; - - return float16_sqrt(a, s); -} - void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in) { uintptr_t ra = GETPC(); diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index e278c0d87b..e6878abd35 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8354,7 +8354,7 @@ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) switch (opcode) { case 0x3: /* FSQRT */ fpst = fpstatus_ptr(FPST_FPCR_F16); - gen_helper_sqrt_f16(tcg_res, tcg_op, fpst); + gen_helper_vfp_sqrth(tcg_res, tcg_op, fpst); break; case 0x8: /* FRINTN */ case 0x9: /* FRINTP */ @@ -10976,7 +10976,7 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) gen_helper_rsqrte_f16(tcg_res, tcg_op, tcg_fpstatus); break; case 0x7f: /* FSQRT */ - gen_helper_sqrt_f16(tcg_res, tcg_op, tcg_fpstatus); + gen_helper_vfp_sqrth(tcg_res, tcg_op, tcg_fpstatus); break; default: g_assert_not_reached(); From patchwork Tue Dec 10 16:16:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848846 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp419480wrn; Tue, 10 Dec 2024 08:25:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWzduJCx3ptrcKorVK7lS3bZbLOERVblTj71u2j8HWTjsBYM227Laj2FR8UczEEG36urqL63w==@linaro.org X-Google-Smtp-Source: AGHT+IH2tQW8Z9fx2i4XvG8lHOJR+sxIJBfmBW/uwIwg0K1Zxx05csiNgkG16/VOaG1tRoaNrHCO X-Received: by 2002:a05:6122:328f:b0:50d:35d9:ad60 with SMTP id 71dfb90a1353d-5188834ce3amr5707296e0c.5.1733847945638; Tue, 10 Dec 2024 08:25:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847945; cv=none; d=google.com; s=arc-20240605; b=gY5/jIu00xbtxyc26q7snWRTJo4UTyTDt16+546cqHBiU7MimxK1tsm3xC7ui63F0r Wrf028sIuxErIBOhV+6dtUEc5nN79v9cgVR8TcKhQR4pB9h5XZ/Cf4sjkO0KNli5Ybdq ZkrHkDzVk99JmZ1YZnahY74R7jF8DJRoj9wFzIR3XbqHkzWd2HVNKZAiq+DN8cDit60P yP41z9x+DQr4fSIwOSSCqYd4fglTMSPiWkl5jJx6oqGYegqRQJI0rbtBGVV+cXTvBZEC sRQTGsvcaxkHMh9trsTIgUoLTRjdh7HkrShnKqtpV1hy5O5kw1zP68zMfB6co/b2oFCk r3SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=McfZQURJzCV4MG39Dc+S7lfs3y6jo+IbKtnV4z9uT+g=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=XbiLqBUIsCpjIrXmV7Sp70MYLHnENqc5/rTX6BFrfnFL3q/pTeXDHcpTQHO/RrHmoX yAuoOXXIbJYCIenvRfW8qPhP7MLZ5g+aykJNgaeUA+tIudb0ZA5Lc939SLUaiui6PBFA s0wb7yjTSiG1mTnVrH38jEaqmCTUG5VBNKWrKF7+KgB0/kW9NySCvAhnrpm1G27uPX8X lp1mszdSw8kzY/84BN+UYCrwd9W84kejHJOqffhAcbaLEhht5irJW2n0pwEGBkyMkB9e P1dvK4jzl/x+8JK/LI7Fv0BeNY5bRH7k0fvH/ZkdH2OhW3mFORW5hwQ1zXRBtUuLubOW VcMw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yizj0zUg; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a1e0cc1a2514c-85c2bd80877si3000223241.97.2024.12.10.08.25.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:25:45 -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=yizj0zUg; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xa-0004c0-Qh; Tue, 10 Dec 2024 11:19:44 -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 1tL2xT-0004AB-2N for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:35 -0500 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2xR-0006Wc-6U for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:34 -0500 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-30227ccf803so18380601fa.2 for ; Tue, 10 Dec 2024 08:19:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847571; x=1734452371; 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=McfZQURJzCV4MG39Dc+S7lfs3y6jo+IbKtnV4z9uT+g=; b=yizj0zUgovLfbsoqJ2HBFQQTUai9qA+O/gi9mTqTT+VRqd0FeAtRK7aJOJtT3UdK+N WrGo5h9nJK5UyRkO0g2aw3qfjjo8foE7JkFWBH78Pa961CIVWFYvEeljsJYMKKt8AvvV IPwGsHmbnY6bU+6p/I4PFzWpaFqrZDP7AKhQ0rKk0UMGTE3WMZ5dvBUXOCvmOyNs9yy9 HU8DA96apNDVc0nMzIVHX2ET13VR/J12bsoqmkNHh6ZQnh9GmKZSVq6ytbKONBg5euND SHS1JXGS1vhBXd8Tr6Yg2XWwuXLBdHMhJTr0hGyZWwyAumJdju/bf4GJ+FVnmfthyknP n8lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847571; x=1734452371; 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=McfZQURJzCV4MG39Dc+S7lfs3y6jo+IbKtnV4z9uT+g=; b=qR3o1QX5/NT21LrXtdkbRRXMiooiHSLZvi3F5mr7vi2/b0RAXcEu/Wz5CdSzWbfJHK 1HzSUcB1LfGFdXH4cUML1Y2L+mtqPZJb2VYWF5069JrGqUAWOqhRNZgLD8UCUUIudwzV PhzEIUXLvK1fK5TeVRcHVw5EoTDDHjpkEqs6BMFKTvZRNjjk3YmofGodN1ZLc3vRpX5L Re+S7euPifvU7Tk2RLUV2oln15KHMPPnIPZww97spEZZmn0cQPQjYc2KaSBvynoXkwkX Eqrq/3z5Ct3wvQM2LGMzIIyErXbBazlg0CJLGtLZ36UyybFLfi+hIB8nOSu3CjqFztiA apDw== X-Gm-Message-State: AOJu0YzYJ8MW7jbYwuiBIK+jx+nPgWxlSI/C96vpFM8S4T14vzEeXjy3 SbNAEUTr0z54livF1ezjm0dvJhsd6GR2jIAZnSCT6b0IPFGQPE4fonLxmE9OgXr1PFRY4WfwBuD ocbyO/56a X-Gm-Gg: ASbGncvay45WhmieIeMz0RhD8HqTXfOoAmIX5Kty1UTZv7bh1AxUfK7mVgJv+dnNZRi tR23NAov3YESSEw66S1Lq3R3KBJT/9tva87IXUQ0BuVULV3D3Dk+TNNzEGBGo7mZ0y+Q93nyNsQ mg1MeGTe4hkRjIqQtoNgfXa/yG4A60ydczLLq7NwwiXmOh7Rc8plYYV1R8uFKBEtLg5CdFXbGJD 3qxMno/imayKDlG3MV7r92hBUL8r7DdO6PhcYksbM3yXQ7BIdgQtOtXBcc= X-Received: by 2002:a05:651c:1992:b0:302:1b18:2c09 with SMTP id 38308e7fff4ca-3021b182f7fmr42697561fa.27.1733847571441; Tue, 10 Dec 2024 08:19:31 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.19.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:19:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 27/69] target/arm: Convert FSQRT (scalar) to decodetree Date: Tue, 10 Dec 2024 10:16:51 -0600 Message-ID: <20241210161733.1830573-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::236; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x236.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 72 ++++++++++++++++++++++++++++------ target/arm/tcg/a64.decode | 1 + 2 files changed, 62 insertions(+), 11 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index e6878abd35..f32cc2f0af 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8344,6 +8344,63 @@ static const FPScalar1Int f_scalar_fneg = { }; TRANS(FNEG_s, do_fp1_scalar_int, a, &f_scalar_fneg) +typedef struct FPScalar1 { + void (*gen_h)(TCGv_i32, TCGv_i32, TCGv_ptr); + void (*gen_s)(TCGv_i32, TCGv_i32, TCGv_ptr); + void (*gen_d)(TCGv_i64, TCGv_i64, TCGv_ptr); +} FPScalar1; + +static bool do_fp1_scalar(DisasContext *s, arg_rr_e *a, + const FPScalar1 *f, int rmode) +{ + TCGv_i32 tcg_rmode = NULL; + TCGv_ptr fpst; + TCGv_i64 t64; + TCGv_i32 t32; + int check = fp_access_check_scalar_hsd(s, a->esz); + + if (check <= 0) { + return check == 0; + } + + fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + if (rmode >= 0) { + tcg_rmode = gen_set_rmode(rmode, fpst); + } + + switch (a->esz) { + case MO_64: + t64 = read_fp_dreg(s, a->rn); + f->gen_d(t64, t64, fpst); + write_fp_dreg(s, a->rd, t64); + break; + case MO_32: + t32 = read_fp_sreg(s, a->rn); + f->gen_s(t32, t32, fpst); + write_fp_sreg(s, a->rd, t32); + break; + case MO_16: + t32 = read_fp_hreg(s, a->rn); + f->gen_h(t32, t32, fpst); + write_fp_sreg(s, a->rd, t32); + break; + default: + g_assert_not_reached(); + } + + if (rmode >= 0) { + gen_restore_rmode(tcg_rmode, fpst); + } + return true; +} + +static const FPScalar1 f_scalar_fsqrt = { + gen_helper_vfp_sqrth, + gen_helper_vfp_sqrts, + gen_helper_vfp_sqrtd, +}; +TRANS(FSQRT_s, do_fp1_scalar, a, &f_scalar_fsqrt, -1) + /* Floating-point data-processing (1 source) - half precision */ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) { @@ -8352,10 +8409,6 @@ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) TCGv_i32 tcg_res = tcg_temp_new_i32(); switch (opcode) { - case 0x3: /* FSQRT */ - fpst = fpstatus_ptr(FPST_FPCR_F16); - gen_helper_vfp_sqrth(tcg_res, tcg_op, fpst); - break; case 0x8: /* FRINTN */ case 0x9: /* FRINTP */ case 0xa: /* FRINTM */ @@ -8382,6 +8435,7 @@ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) case 0x0: /* FMOV */ case 0x1: /* FABS */ case 0x2: /* FNEG */ + case 0x3: /* FSQRT */ g_assert_not_reached(); } @@ -8400,9 +8454,6 @@ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) tcg_res = tcg_temp_new_i32(); switch (opcode) { - case 0x3: /* FSQRT */ - gen_fpst = gen_helper_vfp_sqrts; - break; case 0x6: /* BFCVT */ gen_fpst = gen_helper_bfcvt; break; @@ -8438,6 +8489,7 @@ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) case 0x0: /* FMOV */ case 0x1: /* FABS */ case 0x2: /* FNEG */ + case 0x3: /* FSQRT */ g_assert_not_reached(); } @@ -8465,9 +8517,6 @@ static void handle_fp_1src_double(DisasContext *s, int opcode, int rd, int rn) tcg_res = tcg_temp_new_i64(); switch (opcode) { - case 0x3: /* FSQRT */ - gen_fpst = gen_helper_vfp_sqrtd; - break; case 0x8: /* FRINTN */ case 0x9: /* FRINTP */ case 0xa: /* FRINTM */ @@ -8500,6 +8549,7 @@ static void handle_fp_1src_double(DisasContext *s, int opcode, int rd, int rn) case 0x0: /* FMOV */ case 0x1: /* FABS */ case 0x2: /* FNEG */ + case 0x3: /* FSQRT */ g_assert_not_reached(); } @@ -8619,7 +8669,6 @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) goto do_unallocated; } /* fall through */ - case 0x3: case 0x8 ... 0xc: case 0xe ... 0xf: /* 32-to-32 and 64-to-64 ops */ @@ -8672,6 +8721,7 @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) case 0x0: /* FMOV */ case 0x1: /* FABS */ case 0x2: /* FNEG */ + case 0x3: /* FSQRT */ unallocated_encoding(s); break; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index b9cc8963da..3b1e8e0776 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1327,6 +1327,7 @@ FMINV_s 0110 1110 10 11000 01111 10 ..... ..... @rr_q1e2 FMOV_s 00011110 .. 1 000000 10000 ..... ..... @rr_hsd FABS_s 00011110 .. 1 000001 10000 ..... ..... @rr_hsd FNEG_s 00011110 .. 1 000010 10000 ..... ..... @rr_hsd +FSQRT_s 00011110 .. 1 000011 10000 ..... ..... @rr_hsd # Floating-point Immediate From patchwork Tue Dec 10 16:16:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848816 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416486wrn; Tue, 10 Dec 2024 08:20:22 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUfi0DovMK8DDjz9EBUCPzA8Np7CX15amWpDsQUzzrgyGZLstw5idOLsJkPG4JPJYMOhnbn8w==@linaro.org X-Google-Smtp-Source: AGHT+IHJ7wUize9W4lk6t3GXumx9GoFjWL79xmTobnNfb6iQPXbqFcMOYUcMk0Afu3ynmVKy0wI8 X-Received: by 2002:a05:622a:f:b0:467:5836:a98 with SMTP id d75a77b69052e-46758360f87mr219937391cf.19.1733847622308; Tue, 10 Dec 2024 08:20:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847622; cv=none; d=google.com; s=arc-20240605; b=g75Z5e8kmJ35xCpdGcNeBaQ7mcy2cDHm0wiqLlJ6gEVKvYUqKFuMaGtqAsl1mQelHs xbRgZ+uZZRaBoFFfbiF3ovVN95DQsP+z3sblJCfVFc8FLsssVeViuUsWOyrE3d4dtdKW Gd1v3qO8l3hW70ifEvqNxm3njlb641etM/W5GdyoZXDPeB0r5e50qHCXcrVhIgiWjj/O RttVbqZjlzMnjZ6Yqsv1FicqHTwI2u9mt+Ia9vHmyUK6z3saE8kWNeW0rx23RYQtmvVe fUnY1qTtaNHAqb/275jYi9UtQybKjbWP4ljvWNt5zfUxujNGYo8WlbBxcD/QuHYGITy3 39aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=EG5ap3L6H0uS67mUIBk4bFPwmGZ4OMrw9+6SqLKnO3s=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=RJ0PxBMauza1Xomh/C0xtLXeCbZ0WB/8Wi4dRd40/3UEHflft1oRroxHa0O8+9Yj5j mZdbR4zh8r2Nf9dCopujB4gN5EV/HsZbh0gmuLPhSeH0YZecrFxEB9GHuaW+q5Ak0q/2 eR5qiqGHrnWcI41yPXpHnzggCD3USpxLU7+CPqTq232MEztL/elaA6UfgjSKjbmMFHMW HZbYdgep3t9OdxNKhLhglm/ISK1jRW9psTKVWT+xQcLp4x2oD/YGJXKGlRyYehnLmMti qFZMYlY7Q3DPJVKOOxh4MsZTAROdrqM/CCFAUvP9WD7BEzufUvEaY3BMjaDwU8p3ZxVK HNEg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DPszq0Z4; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-467297fc603si133010301cf.453.2024.12.10.08.20.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20:22 -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=DPszq0Z4; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xl-00056H-U5; Tue, 10 Dec 2024 11:19:54 -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 1tL2xc-0004iZ-PB for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:46 -0500 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2xY-0006Xj-QG for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:43 -0500 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-30225b2586cso20304771fa.0 for ; Tue, 10 Dec 2024 08:19:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847576; x=1734452376; 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=EG5ap3L6H0uS67mUIBk4bFPwmGZ4OMrw9+6SqLKnO3s=; b=DPszq0Z4IBwKv3Hdd2O2RRHZ1N7R+0Tg9IVEOnrshTegpLBLo6NOHgzlO2ymS/hyeI JI+yv5BhU6xlzPjJ2J5PV900psyqrs8mcyfNlTG3SiYUoWwhBf22NEgUYo2u7zHeVGjw 8pTncjKq755bgtsHTk4nS0WKoF4eljVsio7G1OOz1xeFRFFU9RK2ZmtqYfLVjzftv0y9 0OIEQhUogL8+cJxqXJHkc2dGznqv+NK/S0DKm2TvBo2bpMPCoA0yg9dTHSCh8p5d+UVf JigqKup0gwY3PMs7SUTGzDDcf8NvjCcXgO+c37B1omZhy9Uy/cRl5paTuk3MuSLvsXoy f13w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847576; x=1734452376; 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=EG5ap3L6H0uS67mUIBk4bFPwmGZ4OMrw9+6SqLKnO3s=; b=rfR/sjm/Xf5rjRvCLP9FN/1kK1PLzWCH4hw8UOcV6sojUhbuXQ6fAvaajGb7dENI/E y84uke5tEnBtTOkoPMUzimWkfX7ZJCrV3AHrlTOwfj1OyDOBHa2xygsLoDlX2V2KWmd8 15WVhGeFA0UJ4BdotJvh2v9Q4UE9Hg0Tuk836qa9GNx3ROHaKVU+e/Eo6cK2oK2GbubZ kfyZvlvPoUz+DrEsRAHHb+N/4v/5gU4Ye5mH9d8ARkwLEAIPS+HJWUN3cM99V/D18DCr qn+e07z00jtRO/iUhDx6xdm1hfdLrg0QNJYvz3T8aZRYlEcB24GroV3EA+I82mwHhqkV VLpw== X-Gm-Message-State: AOJu0YyDahCO8vlmy21FYzw2qAr+Mz2BqB/SEyNeqIiwm8cKh7ZI7zgX beErQdqzFVIdKLy1Q7t3X3pTJM9zBmjD/0d2mbCYpP82WKZkK9ZedipnIEgb9je+nyAZSoaWVvh o55wdcq/V X-Gm-Gg: ASbGncvZtZITWAy7KyGwXj4JiWmWtHD3obFPVdhxphGwW9taKpqikY/LTj9EBmh+98r s1Ndtrkh4fupgtrFCO5E/mIn6ac8e1FkbTM2pdEbCyYfiQxHW2PlYlTSoo0X2NeV6scyoMwUK/Q NNeIcuJOlj2w9rBJRc0rWYsYBEgCGXmCQw9Jm/eCkt8rd42EizIG/ouyFNGIowI4HOjf1k+TpQ4 065WlJPLm6EkXNiLNL6guKeyLJcidPvl5ZoqkJwdpF38cCxlDSDh7Z0V+w= X-Received: by 2002:a05:6512:308b:b0:53d:f2e8:b37f with SMTP id 2adb3069b0e04-540251d4b7dmr1354003e87.6.1733847576008; Tue, 10 Dec 2024 08:19:36 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.19.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:19:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 28/69] target/arm: Convert FRINT[NPMSAXI] (scalar) to decodetree Date: Tue, 10 Dec 2024 10:16:52 -0600 Message-ID: <20241210161733.1830573-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22c; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x22c.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 Remove handle_fp_1src_half as these were the last insns decoded by that function. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 117 +++++++++++---------------------- target/arm/tcg/a64.decode | 8 +++ 2 files changed, 46 insertions(+), 79 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index f32cc2f0af..45321cdca7 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8401,46 +8401,24 @@ static const FPScalar1 f_scalar_fsqrt = { }; TRANS(FSQRT_s, do_fp1_scalar, a, &f_scalar_fsqrt, -1) -/* Floating-point data-processing (1 source) - half precision */ -static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) -{ - TCGv_ptr fpst = NULL; - TCGv_i32 tcg_op = read_fp_hreg(s, rn); - TCGv_i32 tcg_res = tcg_temp_new_i32(); +static const FPScalar1 f_scalar_frint = { + gen_helper_advsimd_rinth, + gen_helper_rints, + gen_helper_rintd, +}; +TRANS(FRINTN_s, do_fp1_scalar, a, &f_scalar_frint, FPROUNDING_TIEEVEN) +TRANS(FRINTP_s, do_fp1_scalar, a, &f_scalar_frint, FPROUNDING_POSINF) +TRANS(FRINTM_s, do_fp1_scalar, a, &f_scalar_frint, FPROUNDING_NEGINF) +TRANS(FRINTZ_s, do_fp1_scalar, a, &f_scalar_frint, FPROUNDING_ZERO) +TRANS(FRINTA_s, do_fp1_scalar, a, &f_scalar_frint, FPROUNDING_TIEAWAY) +TRANS(FRINTI_s, do_fp1_scalar, a, &f_scalar_frint, -1) - switch (opcode) { - case 0x8: /* FRINTN */ - case 0x9: /* FRINTP */ - case 0xa: /* FRINTM */ - case 0xb: /* FRINTZ */ - case 0xc: /* FRINTA */ - { - TCGv_i32 tcg_rmode; - - fpst = fpstatus_ptr(FPST_FPCR_F16); - tcg_rmode = gen_set_rmode(opcode & 7, fpst); - gen_helper_advsimd_rinth(tcg_res, tcg_op, fpst); - gen_restore_rmode(tcg_rmode, fpst); - break; - } - case 0xe: /* FRINTX */ - fpst = fpstatus_ptr(FPST_FPCR_F16); - gen_helper_advsimd_rinth_exact(tcg_res, tcg_op, fpst); - break; - case 0xf: /* FRINTI */ - fpst = fpstatus_ptr(FPST_FPCR_F16); - gen_helper_advsimd_rinth(tcg_res, tcg_op, fpst); - break; - default: - case 0x0: /* FMOV */ - case 0x1: /* FABS */ - case 0x2: /* FNEG */ - case 0x3: /* FSQRT */ - g_assert_not_reached(); - } - - write_fp_sreg(s, rd, tcg_res); -} +static const FPScalar1 f_scalar_frintx = { + gen_helper_advsimd_rinth_exact, + gen_helper_rints_exact, + gen_helper_rintd_exact, +}; +TRANS(FRINTX_s, do_fp1_scalar, a, &f_scalar_frintx, -1) /* Floating-point data-processing (1 source) - single precision */ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) @@ -8457,20 +8435,6 @@ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) case 0x6: /* BFCVT */ gen_fpst = gen_helper_bfcvt; break; - case 0x8: /* FRINTN */ - case 0x9: /* FRINTP */ - case 0xa: /* FRINTM */ - case 0xb: /* FRINTZ */ - case 0xc: /* FRINTA */ - rmode = opcode & 7; - gen_fpst = gen_helper_rints; - break; - case 0xe: /* FRINTX */ - gen_fpst = gen_helper_rints_exact; - break; - case 0xf: /* FRINTI */ - gen_fpst = gen_helper_rints; - break; case 0x10: /* FRINT32Z */ rmode = FPROUNDING_ZERO; gen_fpst = gen_helper_frint32_s; @@ -8490,6 +8454,13 @@ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) case 0x1: /* FABS */ case 0x2: /* FNEG */ case 0x3: /* FSQRT */ + case 0x8: /* FRINTN */ + case 0x9: /* FRINTP */ + case 0xa: /* FRINTM */ + case 0xb: /* FRINTZ */ + case 0xc: /* FRINTA */ + case 0xe: /* FRINTX */ + case 0xf: /* FRINTI */ g_assert_not_reached(); } @@ -8517,20 +8488,6 @@ static void handle_fp_1src_double(DisasContext *s, int opcode, int rd, int rn) tcg_res = tcg_temp_new_i64(); switch (opcode) { - case 0x8: /* FRINTN */ - case 0x9: /* FRINTP */ - case 0xa: /* FRINTM */ - case 0xb: /* FRINTZ */ - case 0xc: /* FRINTA */ - rmode = opcode & 7; - gen_fpst = gen_helper_rintd; - break; - case 0xe: /* FRINTX */ - gen_fpst = gen_helper_rintd_exact; - break; - case 0xf: /* FRINTI */ - gen_fpst = gen_helper_rintd; - break; case 0x10: /* FRINT32Z */ rmode = FPROUNDING_ZERO; gen_fpst = gen_helper_frint32_d; @@ -8550,6 +8507,13 @@ static void handle_fp_1src_double(DisasContext *s, int opcode, int rd, int rn) case 0x1: /* FABS */ case 0x2: /* FNEG */ case 0x3: /* FSQRT */ + case 0x8: /* FRINTN */ + case 0x9: /* FRINTP */ + case 0xa: /* FRINTM */ + case 0xb: /* FRINTZ */ + case 0xc: /* FRINTA */ + case 0xe: /* FRINTX */ + case 0xf: /* FRINTI */ g_assert_not_reached(); } @@ -8668,9 +8632,6 @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) if (type > 1 || !dc_isar_feature(aa64_frint, s)) { goto do_unallocated; } - /* fall through */ - case 0x8 ... 0xc: - case 0xe ... 0xf: /* 32-to-32 and 64-to-64 ops */ switch (type) { case 0: @@ -8686,15 +8647,6 @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) handle_fp_1src_double(s, opcode, rd, rn); break; case 3: - if (!dc_isar_feature(aa64_fp16, s)) { - goto do_unallocated; - } - - if (!fp_access_check(s)) { - return; - } - handle_fp_1src_half(s, opcode, rd, rn); - break; default: goto do_unallocated; } @@ -8722,6 +8674,13 @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) case 0x1: /* FABS */ case 0x2: /* FNEG */ case 0x3: /* FSQRT */ + case 0x8: /* FRINTN */ + case 0x9: /* FRINTP */ + case 0xa: /* FRINTM */ + case 0xb: /* FRINTZ */ + case 0xc: /* FRINTA */ + case 0xe: /* FRINTX */ + case 0xf: /* FRINTI */ unallocated_encoding(s); break; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 3b1e8e0776..9d2f099c9c 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1329,6 +1329,14 @@ FABS_s 00011110 .. 1 000001 10000 ..... ..... @rr_hsd FNEG_s 00011110 .. 1 000010 10000 ..... ..... @rr_hsd FSQRT_s 00011110 .. 1 000011 10000 ..... ..... @rr_hsd +FRINTN_s 00011110 .. 1 001000 10000 ..... ..... @rr_hsd +FRINTP_s 00011110 .. 1 001001 10000 ..... ..... @rr_hsd +FRINTM_s 00011110 .. 1 001010 10000 ..... ..... @rr_hsd +FRINTZ_s 00011110 .. 1 001011 10000 ..... ..... @rr_hsd +FRINTA_s 00011110 .. 1 001100 10000 ..... ..... @rr_hsd +FRINTX_s 00011110 .. 1 001110 10000 ..... ..... @rr_hsd +FRINTI_s 00011110 .. 1 001111 10000 ..... ..... @rr_hsd + # Floating-point Immediate FMOVI_s 0001 1110 .. 1 imm:8 100 00000 rd:5 esz=%esz_hsd From patchwork Tue Dec 10 16:16:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848829 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp417291wrn; Tue, 10 Dec 2024 08:21:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVbMXvajKEy2fCPuutgtlZH2uwqBMeJIh/BJ0fHc5DCr78JmDjOKRDvi7eFm/UrjqjCm/SM9g==@linaro.org X-Google-Smtp-Source: AGHT+IHPnWLzLWRX6loOa2b1RljnE4SDeszn6PnoZFdsFcu235VZQ6W5o3pvUBEbNf5RmQE2I248 X-Received: by 2002:a05:6214:23c6:b0:6d8:8466:d205 with SMTP id 6a1803df08f44-6d91e300ba4mr83000966d6.6.1733847708753; Tue, 10 Dec 2024 08:21:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847708; cv=none; d=google.com; s=arc-20240605; b=Rx3O/zw0HVNd1YlCjrDqlbYOp9lbD4pX8V63JscLz54u65OpeHCj/Ve9XKOkVpU9vG g1+NcgB0DSwTiSSSm9vgrzQ16z2R5hHPVSpmo5p3DcEHACX+v+0OpxMoRCopMp9ikaXa SUKInMH6rN76FyOfF/JTx34KlXyfVOovfS+IhfFsPx06mTkyb+3Fba6NTACGd2c/nMIB wklYEFLTe5wUod6vJd/JbuwzjfLqU7qurtbnXN5oC4iOGdiOKIOPl+ZFWIBMxjRk3q7o n0P8ndF9Nkxe7pUhj4pKOA9sSoZFT2CXIn/1ztzLCE71BoVSf1Pu+3LlXI8wojB3YXi1 /ihA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=AzRacBoTVvTyHmOFDiNorsk3TiwuSPdvbsL1tVp2ix0=; fh=9Ev+QBUhk6P6vR3LT1wYeDLexozsz44nqjfoyPajZCc=; b=PrOWJrQt9cvDQTbKaivgOU8inV/EXVMlbCep4D7EPRS3OTNkVpF5cT8kP3kbKpnH/S HPw1mfRwBRBbypq7m29uhb1QSifKhlP8G3UmE7RPeiE8pshGnkipfehsrRC/L9LgsrCg xbSYq7wE9UBPtyEheoFnIhXfiAHNhRPuBAwOeHt5DxbMizzjlGU0pzd6lVA0E9Redw9A T0j+Ane0jWoUOFOMOtrZ95Zh4UFDouGT4SDIm8mJDy/s1uxR7ThMUJIvkXcEXQm5/WAO SMbw1C5FlqRb7W4PJCYUey4kARZ6kk5ILvaeMNoflw8iHKN0mIA+qEfEA3dZgK9l3qrt AQsA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EwIBKe8O; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d910a403c3si65272616d6.306.2024.12.10.08.21.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:21:48 -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=EwIBKe8O; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xq-0005mZ-KI; Tue, 10 Dec 2024 11:19:58 -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 1tL2xe-0004r0-RW for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:48 -0500 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2xa-0006Xw-Lf for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:45 -0500 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5401ab97206so2429153e87.3 for ; Tue, 10 Dec 2024 08:19:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847579; x=1734452379; 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=AzRacBoTVvTyHmOFDiNorsk3TiwuSPdvbsL1tVp2ix0=; b=EwIBKe8OTmHBoevqWX7QGPIIqw1509twavTluizUJNxdBcLSpyZiFujuV45jmBpuiy WwOk9QoUClLKXm7Hme0VTZLw1E9IeUUmWSW9NbH2n+iBOzq0au+85M3Ijx/sR3PpqvLG RcOl+wzuX3O/4+XWhlqqkxJWoGyEm/0TgP5stGiEmfVhgvRILs6bxH/alUmO/cwmf+qr XZiG4bZptFn5SraE/iwVI8hZu1+aOdnetXig8lTnCISxQwAbtkETE0rw+REs13NVsI+u jX8unK2FcIvqEcimMDC5ldRdwTNifHnc6BKPNk9rSAZ0GYomQFT2F0z1Mv4ZadQpKkS2 Musg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847579; x=1734452379; 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=AzRacBoTVvTyHmOFDiNorsk3TiwuSPdvbsL1tVp2ix0=; b=gvG7ZyDrdFz05CVSq74z1zulRX4yxAFwvIPXT4DRe5pJc5vO4e4nBl55pO5AasMzLb vF0SqfaUMCrUppoP+Efhj6j0afeKs8pUz1DnIb26cQ+A+Md73kz7yGZKi3YGykT0mv5p Hab6ZAli3PuaP8UcKV+psgCdv7dVJ/F+Fxgl9aTRP14dKqti/tduosAE8Z6w+0kT9uM7 T7aoLEPqIMFbpo3PyZX2tKDNabNUgbBwu0bQfAhDXhoTNp2byAtQpnOnMTywlk+TeY8a MWsh1xwlu31o9RmQSkoE1szquIw4tP3Pt3ROCNHVTmgxZT7nrWjiFYwsjnp+yhB6yaeV 6biQ== X-Gm-Message-State: AOJu0Yz34Cn5U44TVH+tTpB/cQi8DfqntWkuCLUh4Cc45QGdd9tUzIoE gg5YJFvFEkrjQ/2RabiiHRl6MsFqwUGuMo6KWTHYC4kAAypW6FvFcUJQ+wh3Tv4kR+ReEuVqLQe nOm6S+68t X-Gm-Gg: ASbGncvbyJtgCOQwKpy2K/suoTkyEJw7G7S7MVwUehTiORcOI5rHo6JhvIkPDXFK+UN TSYphEEsWbzWuzLi2Ny2H3or8nU7+AFKFLyPcfhbMt+Pzv3RIdgID+100bF2qS6fIHCMDT7gx2E hAffPearq1je+GMMrqwurTaX4e/4W8mrXMHdB6hQdneGVmQuey2OAWnZjUdUPY25P6X9y9YY7c6 gHlX97Za3Y7MXrTiyd7fZOev/8+5s5rQn1vi/i3Se4WMT4Uj54JisMaXAM= X-Received: by 2002:a05:6512:b96:b0:540:2339:375b with SMTP id 2adb3069b0e04-540240e65e3mr1984600e87.32.1733847579395; Tue, 10 Dec 2024 08:19:39 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.19.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:19:38 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 29/69] target/arm: Convert BFCVT to decodetree Date: Tue, 10 Dec 2024 10:16:53 -0600 Message-ID: <20241210161733.1830573-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12a.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 Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 26 +++++++------------------- target/arm/tcg/a64.decode | 3 +++ 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 45321cdca7..ef0379d17f 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8420,6 +8420,11 @@ static const FPScalar1 f_scalar_frintx = { }; TRANS(FRINTX_s, do_fp1_scalar, a, &f_scalar_frintx, -1) +static const FPScalar1 f_scalar_bfcvt = { + .gen_s = gen_helper_bfcvt, +}; +TRANS_FEAT(BFCVT_s, aa64_bf16, do_fp1_scalar, a, &f_scalar_bfcvt, -1) + /* Floating-point data-processing (1 source) - single precision */ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) { @@ -8432,9 +8437,6 @@ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) tcg_res = tcg_temp_new_i32(); switch (opcode) { - case 0x6: /* BFCVT */ - gen_fpst = gen_helper_bfcvt; - break; case 0x10: /* FRINT32Z */ rmode = FPROUNDING_ZERO; gen_fpst = gen_helper_frint32_s; @@ -8454,6 +8456,7 @@ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) case 0x1: /* FABS */ case 0x2: /* FNEG */ case 0x3: /* FSQRT */ + case 0x6: /* BFCVT */ case 0x8: /* FRINTN */ case 0x9: /* FRINTP */ case 0xa: /* FRINTM */ @@ -8652,28 +8655,13 @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) } break; - case 0x6: - switch (type) { - case 1: /* BFCVT */ - if (!dc_isar_feature(aa64_bf16, s)) { - goto do_unallocated; - } - if (!fp_access_check(s)) { - return; - } - handle_fp_1src_single(s, opcode, rd, rn); - break; - default: - goto do_unallocated; - } - break; - default: do_unallocated: case 0x0: /* FMOV */ case 0x1: /* FABS */ case 0x2: /* FNEG */ case 0x3: /* FSQRT */ + case 0x6: /* BFCVT */ case 0x8: /* FRINTN */ case 0x9: /* FRINTP */ case 0xa: /* FRINTM */ diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 9d2f099c9c..4a48fcff1d 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -45,6 +45,7 @@ &qrrrr_e q rd rn rm ra esz @rr_h ........ ... ..... ...... rn:5 rd:5 &rr_e esz=1 +@rr_s ........ ... ..... ...... rn:5 rd:5 &rr_e esz=2 @rr_d ........ ... ..... ...... rn:5 rd:5 &rr_e esz=3 @rr_sd ........ ... ..... ...... rn:5 rd:5 &rr_e esz=%esz_sd @rr_hsd ........ ... ..... ...... rn:5 rd:5 &rr_e esz=%esz_hsd @@ -1337,6 +1338,8 @@ FRINTA_s 00011110 .. 1 001100 10000 ..... ..... @rr_hsd FRINTX_s 00011110 .. 1 001110 10000 ..... ..... @rr_hsd FRINTI_s 00011110 .. 1 001111 10000 ..... ..... @rr_hsd +BFCVT_s 00011110 01 1 000110 10000 ..... ..... @rr_s + # Floating-point Immediate FMOVI_s 0001 1110 .. 1 imm:8 100 00000 rd:5 esz=%esz_hsd From patchwork Tue Dec 10 16:16:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848817 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416514wrn; Tue, 10 Dec 2024 08:20:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXnK94mugfmSK3BvIuV+c0Z2tBt4mQPXLCdqEFyt/IRax7EVWCyIV2I0RT3Upxf8X2smaaAFA==@linaro.org X-Google-Smtp-Source: AGHT+IGAHydCsw9DZcNeq6pQ0yUvoV6sbM4d9M21Kiu4XLLq8/EX/uXgKWCgQM0pha6wuCx7grKH X-Received: by 2002:a05:6214:21a9:b0:6d8:a5f7:f116 with SMTP id 6a1803df08f44-6d91e436370mr87721676d6.42.1733847624580; Tue, 10 Dec 2024 08:20:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847624; cv=none; d=google.com; s=arc-20240605; b=ETYXhJq9gt3qCx7zqVevkocf3waGM+y1kNryXzpx97u0Dp4HUKbyusf4JHpvtgEGO9 ixkf2iR7C966j/p0xbgyuJgES+UTzoNIw0Oxcup5KMA1j1eLqpcqJ/H2lWYNu17dBBwh EgHi4Em/GE2qrusqeLGMMqokkU/myjH79oV84uHx0Xx5PqF/NZEbSh5SNJpGxuspn7a0 yrHwQsqeyM5tP+2KP03A36y4jz98zmPdU7/BQ0QP4lCQCoHYPJ7fbVxS+ttXoYmW1k7G Zk3iuT0Kif/qt2mX9Fqg4VCPiBxG5FdK2l+ROdqIrGCNy4ekCxtgkdbzoMsObpX9ycaw uk9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=0WKSI6cr1CPrTsqeI72Zls4iEeURwQEM5mywoVvBUjA=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=BDMpqmxJKlPsyDXHgBakpf5c20bh59tCqagse4GMRYKMFWojgHydEXZT7E6eVNl8KM xy5pfx9cgGwlBg0RKHLAQ/nZr813i2/4HYQNClrEJoVXQWNuo2uUucGd72d0+buobp6a OvsJx5FxWY0AgsV14G4Ztnfs96B2AkAlLqCjHcuw9kXbwLPleUhajoANYAbtMNUlr7EO C2itoO2Cx+jIYGalmXXte4CoHXCeoSI1Qc1PSVxDtJaoYQOGQPHmvb8o8KQxEvsu647m NLH51c+8tIszJVjNk90eqE3kJwGxrGc//AHZV3QntTYMKdYMqCD5jglvhHExm4/lAOpe Iefg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IcUSA1X9; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=fail header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6e17cbdc6si191396485a.658.2024.12.10.08.20.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20:24 -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=fail header.i=@linaro.org header.s=google header.b=IcUSA1X9; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=fail header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xn-0005LK-GX; Tue, 10 Dec 2024 11:19:55 -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 1tL2xg-0004vD-JM for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:48 -0500 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2xc-0006YO-Q9 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:47 -0500 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-53df19bf6a9so6638075e87.1 for ; Tue, 10 Dec 2024 08:19:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847583; x=1734452383; 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=0WKSI6cr1CPrTsqeI72Zls4iEeURwQEM5mywoVvBUjA=; b=IcUSA1X9kFiKDWEDAhcIW5992AlaV9VxpsTxJn+UCKO8JhPGRp0gNiD19AqDl2hp14 u0/5AWB8BgUZkhnGwvX9iBOIpu7Df3WEPPATvlY2sEKMqRm7iU3fVRfFYDrzVjED9y38 57vydJCIkFPzrXMca9HbM8Fkbk0CG9iGOSlfK95FQIpo0VvEOSFGfDGgh1kfxxeyhSm4 naiZd0CC7POeZjjIneEixwZKTHU5uDiQl6mWkgB+fSkNk8VA7JQ5T1M20VbUElezuRzk AzZ5OX2j6SHH5YDz0g43xjdzcSBDMjJj/TxHMhy4SwKUyigl2NwR92rn5aCJ0ovVssrY g6qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847583; x=1734452383; 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=0WKSI6cr1CPrTsqeI72Zls4iEeURwQEM5mywoVvBUjA=; b=dit+Ioe+CeIYmqO3fFZvOtZ9CMA1aIxrGJDlBgawNMClrEsTlwvhcPJHiinYpct15P TsDvAxkPtLLTosygDubNXBuh2JetVxGF9XgidiJ36jdAiGruHH0ebMXXSkBlY8PnQZl2 dBru2Ii13Z0i1tnxhvXMBE89SfhvY83rq3vOzOxfoff7FtKY8qrgh94OlIpdkXyFLw4e 9FPjEUcmQwLvj0K6Qsju1txtiRi3X00iOcMqrTXjVYXYyo/OzslFfkh7QrSueemMiWrN 1zwyffsjr4Wjhi3ztl7DTC+468KDrwiK6MlU/OpBRHxsoan22RSQRdcB0ZZ4IjVGUWZc qTiw== X-Gm-Message-State: AOJu0YzqiKqpH9LCr5tDECIPznzRz34VF6u9KUQsmDcy/mDbtSErrmmT a6MJ8e9Oe2KJZ/ny1BvKu80+sVS5K6fb9uN3BPWymdDE2KzcaDYpXMRKYxGlbIIH7aWtXciYgiA qOJV7NUbd X-Gm-Gg: ASbGncvvrpjQVtLocwJdtTgVdQOwVbvt2fDhhr9FG76VozKKrvXOUVDaJMbNL3r1HiP txjV/iDcHCM713k3EvcyZf6Ru6xyQEemAKfeYjtRxI0U+Bi6NjB3SN0SPamn9tgqN2EwVnzJAec OGxH2EcuZNE6zwp+uR1jcYoaNeIq8TdCiCRDZmwuPwvwuRKAI7VkI72WiLHwZKgG3eUwF6EDMZO xo178zvixkVUKpvDVbCcyalY68r87+IeVKNHGGKsSzljN9ybY7eDGEy2lE= X-Received: by 2002:a05:6512:2207:b0:53e:3a8a:79b3 with SMTP id 2adb3069b0e04-53e3a8a79bbmr3976421e87.21.1733847583090; Tue, 10 Dec 2024 08:19:43 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.19.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:19:42 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 30/69] target/arm: Convert FRINT{32, 64}[ZX] (scalar) to decodetree Date: Tue, 10 Dec 2024 10:16:54 -0600 Message-ID: <20241210161733.1830573-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12e.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 Remove handle_fp_1src_single and handle_fp_1src_double as these were the last insns decoded by those functions. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 146 ++++----------------------------- target/arm/tcg/a64.decode | 5 ++ 2 files changed, 22 insertions(+), 129 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index ef0379d17f..5a48a2ef2d 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8425,112 +8425,23 @@ static const FPScalar1 f_scalar_bfcvt = { }; TRANS_FEAT(BFCVT_s, aa64_bf16, do_fp1_scalar, a, &f_scalar_bfcvt, -1) -/* Floating-point data-processing (1 source) - single precision */ -static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) -{ - void (*gen_fpst)(TCGv_i32, TCGv_i32, TCGv_ptr); - TCGv_i32 tcg_op, tcg_res; - TCGv_ptr fpst; - int rmode = -1; +static const FPScalar1 f_scalar_frint32 = { + NULL, + gen_helper_frint32_s, + gen_helper_frint32_d, +}; +TRANS_FEAT(FRINT32Z_s, aa64_frint, do_fp1_scalar, a, + &f_scalar_frint32, FPROUNDING_ZERO) +TRANS_FEAT(FRINT32X_s, aa64_frint, do_fp1_scalar, a, &f_scalar_frint32, -1) - tcg_op = read_fp_sreg(s, rn); - tcg_res = tcg_temp_new_i32(); - - switch (opcode) { - case 0x10: /* FRINT32Z */ - rmode = FPROUNDING_ZERO; - gen_fpst = gen_helper_frint32_s; - break; - case 0x11: /* FRINT32X */ - gen_fpst = gen_helper_frint32_s; - break; - case 0x12: /* FRINT64Z */ - rmode = FPROUNDING_ZERO; - gen_fpst = gen_helper_frint64_s; - break; - case 0x13: /* FRINT64X */ - gen_fpst = gen_helper_frint64_s; - break; - default: - case 0x0: /* FMOV */ - case 0x1: /* FABS */ - case 0x2: /* FNEG */ - case 0x3: /* FSQRT */ - case 0x6: /* BFCVT */ - case 0x8: /* FRINTN */ - case 0x9: /* FRINTP */ - case 0xa: /* FRINTM */ - case 0xb: /* FRINTZ */ - case 0xc: /* FRINTA */ - case 0xe: /* FRINTX */ - case 0xf: /* FRINTI */ - g_assert_not_reached(); - } - - fpst = fpstatus_ptr(FPST_FPCR); - if (rmode >= 0) { - TCGv_i32 tcg_rmode = gen_set_rmode(rmode, fpst); - gen_fpst(tcg_res, tcg_op, fpst); - gen_restore_rmode(tcg_rmode, fpst); - } else { - gen_fpst(tcg_res, tcg_op, fpst); - } - - write_fp_sreg(s, rd, tcg_res); -} - -/* Floating-point data-processing (1 source) - double precision */ -static void handle_fp_1src_double(DisasContext *s, int opcode, int rd, int rn) -{ - void (*gen_fpst)(TCGv_i64, TCGv_i64, TCGv_ptr); - TCGv_i64 tcg_op, tcg_res; - TCGv_ptr fpst; - int rmode = -1; - - tcg_op = read_fp_dreg(s, rn); - tcg_res = tcg_temp_new_i64(); - - switch (opcode) { - case 0x10: /* FRINT32Z */ - rmode = FPROUNDING_ZERO; - gen_fpst = gen_helper_frint32_d; - break; - case 0x11: /* FRINT32X */ - gen_fpst = gen_helper_frint32_d; - break; - case 0x12: /* FRINT64Z */ - rmode = FPROUNDING_ZERO; - gen_fpst = gen_helper_frint64_d; - break; - case 0x13: /* FRINT64X */ - gen_fpst = gen_helper_frint64_d; - break; - default: - case 0x0: /* FMOV */ - case 0x1: /* FABS */ - case 0x2: /* FNEG */ - case 0x3: /* FSQRT */ - case 0x8: /* FRINTN */ - case 0x9: /* FRINTP */ - case 0xa: /* FRINTM */ - case 0xb: /* FRINTZ */ - case 0xc: /* FRINTA */ - case 0xe: /* FRINTX */ - case 0xf: /* FRINTI */ - g_assert_not_reached(); - } - - fpst = fpstatus_ptr(FPST_FPCR); - if (rmode >= 0) { - TCGv_i32 tcg_rmode = gen_set_rmode(rmode, fpst); - gen_fpst(tcg_res, tcg_op, fpst); - gen_restore_rmode(tcg_rmode, fpst); - } else { - gen_fpst(tcg_res, tcg_op, fpst); - } - - write_fp_dreg(s, rd, tcg_res); -} +static const FPScalar1 f_scalar_frint64 = { + NULL, + gen_helper_frint64_s, + gen_helper_frint64_d, +}; +TRANS_FEAT(FRINT64Z_s, aa64_frint, do_fp1_scalar, a, + &f_scalar_frint64, FPROUNDING_ZERO) +TRANS_FEAT(FRINT64X_s, aa64_frint, do_fp1_scalar, a, &f_scalar_frint64, -1) static void handle_fp_fcvt(DisasContext *s, int opcode, int rd, int rn, int dtype, int ntype) @@ -8631,30 +8542,6 @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) break; } - case 0x10 ... 0x13: /* FRINT{32,64}{X,Z} */ - if (type > 1 || !dc_isar_feature(aa64_frint, s)) { - goto do_unallocated; - } - /* 32-to-32 and 64-to-64 ops */ - switch (type) { - case 0: - if (!fp_access_check(s)) { - return; - } - handle_fp_1src_single(s, opcode, rd, rn); - break; - case 1: - if (!fp_access_check(s)) { - return; - } - handle_fp_1src_double(s, opcode, rd, rn); - break; - case 3: - default: - goto do_unallocated; - } - break; - default: do_unallocated: case 0x0: /* FMOV */ @@ -8669,6 +8556,7 @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) case 0xc: /* FRINTA */ case 0xe: /* FRINTX */ case 0xf: /* FRINTI */ + case 0x10 ... 0x13: /* FRINT{32,64}{X,Z} */ unallocated_encoding(s); break; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 4a48fcff1d..4f7b3ee3d9 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1340,6 +1340,11 @@ FRINTI_s 00011110 .. 1 001111 10000 ..... ..... @rr_hsd BFCVT_s 00011110 01 1 000110 10000 ..... ..... @rr_s +FRINT32Z_s 00011110 0. 1 010000 10000 ..... ..... @rr_sd +FRINT32X_s 00011110 0. 1 010001 10000 ..... ..... @rr_sd +FRINT64Z_s 00011110 0. 1 010010 10000 ..... ..... @rr_sd +FRINT64X_s 00011110 0. 1 010011 10000 ..... ..... @rr_sd + # Floating-point Immediate FMOVI_s 0001 1110 .. 1 imm:8 100 00000 rd:5 esz=%esz_hsd From patchwork Tue Dec 10 16:16:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848824 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416732wrn; Tue, 10 Dec 2024 08:20:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVZWIzjS20UjXsD+9w47n2H6SZx5pgv5jOc6PLFYHcg0jIADyYSppIKioOcJJDMeDBGF+KxfA==@linaro.org X-Google-Smtp-Source: AGHT+IHzsEH6s7FJIF9TP+gBkiFCyh5RZdClgyQnTxZP24IE2+ZpnYgfQ0JyqpYP3l8RMXpMrZpW X-Received: by 2002:a05:6214:2a4f:b0:6d8:981d:529 with SMTP id 6a1803df08f44-6d91e43ea4fmr78170616d6.48.1733847646734; Tue, 10 Dec 2024 08:20:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847646; cv=none; d=google.com; s=arc-20240605; b=QAWULHa5YvWPhLxWYgWxRDAgRIeKht5Lj5zE74tewE8Qw+WR9YdZooFspU/jIELjBZ ET0irZl0YdldiKrqW53Txny+qBbzqEOtceaXgPLYQGwoCBk0uLi22QcOgGDsUKZKFvGc Ry637oo5KwjKT7jbwBUX0b8DDtUQVUkzj1JZipZu9qALJpme3YjPoPd1DF+YfGA+R2AL sn6qzvXtMGUEG8OKhLZZeL/6YQ0bHmwUY+XyA9DQ28JJeVyimBSFgQrAslWArMIAGyn6 y48dRzy0zyC9w0B8ckkuG0NNYpl1l3JMnlkkI3EMdtQyK7l4Bz7rq96xzUcAQK7p1WnF qvEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=TKDQdzssu+1amspVknrH1gTBhzIp0+Rx6mwL9CLKm6E=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=iHX11B4l2U3k8/z95eJTHpvhTrLcM9M3hJlwprCo60TNAh26dUSqNRyVl8Xp5YFpUq s94mrWPjwfw9Sa6X4pPv5aunAayE+ogPgLr2nX7XFzIllOwys18ipT/I+PEelP7basEG NNaS0FWvFMQeXQqpW2wF3lx+CpZmDmNC80CqxK5MKUQhRG/hr+wrhoy+fhYIsgJ5kl1q UstWDN56LXFRnSpYnmXGWPg9h4gQKeiIYkpiaTb/CR88uLiOxnoqPS+A1V5GTTqb9wDK R7qQdTGXrMKu9kNKtDbYCJef0dWS5bn1eQv3ih69P9CzcrveX9WAyR9JMogIlUbXJZpC Aeaw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aFwPz9H7; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d930161d2dsi8528416d6.99.2024.12.10.08.20.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20: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=aFwPz9H7; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xp-0005fD-Rd; Tue, 10 Dec 2024 11:19:58 -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 1tL2xk-00051F-DC for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:52 -0500 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2xh-0006Yu-9e for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:51 -0500 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-53e3778bffdso4237963e87.0 for ; Tue, 10 Dec 2024 08:19:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847588; x=1734452388; 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=TKDQdzssu+1amspVknrH1gTBhzIp0+Rx6mwL9CLKm6E=; b=aFwPz9H7xPvOyACh5QfjX8WkVA3KbXImBO8F0fyLWK+DbtvTZuv5Hr6Ww1bj2AQyAT Hm/8tfFHmTY11TEMIPwuSKBDHqJu1RO8Q2ZoNCRtXBjL2V/xp/ax18JKYjg+CFa6CEnC +obe49pnQHLF2K2WtfnLzTT4na7Uq/TC9gGQzafvPDVyPubP2P6JjvuI+JZqlwGuB/Fs 3po59i+fFxaaY3ZB7zQwv460ol2O0G6ZTG6rIPV4jy1crmpo4stnPGX5zXqwPTZb8MMx 1nMOtuiHMCPE8bN1HzrKEgdgvAgZ6JnlGgiB+rcDPARNoiQtqaMusWM4zQ4UoLCK3anU 2Hnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847588; x=1734452388; 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=TKDQdzssu+1amspVknrH1gTBhzIp0+Rx6mwL9CLKm6E=; b=qbyfNYRUdfXFGS6jxd8KBW5Wzj8felSgiItVfGPp5p5GAoowubo7vzGSgYk6br+7Pz 7OL87SsNp+87qH7yZbhyH7cB3p551JTRb1x4K7tbQr1+IjJwbVkSvM0fCDF5PV3aJsJf q56fzKE7eKQReA55Uo0iMze1ukGZbK2NMEinBPpBcE0hGrOWb4HNBByukQRpjU5ybieB qGqa1LEsls8GI35GoupimXoOciMPJZjwrRk6EBmXT6IykVBuXtZh6jGnzfHUWN1KrugX sUI5Y4nudNiizCR4UCeBXrGHeWusWY1yAXsAW3qgC9zbjPdRGiqvUNVkSMAPphGojA63 DAVA== X-Gm-Message-State: AOJu0Ywna/bP87CXNm9/c2EiRmIV0u3PQa4MOtxhu3zRZTTOgeDDSnPU ejPCTI7zcLJC6sV+Gt0XdO93GK1iURoAPsLb3yvpoQ9zY6/5a7P+Ql2M5229C1z0sBMuRWAzwSy xM7XgiI+Y X-Gm-Gg: ASbGncuORq3w0DEGI1pHz8th46eKiwS2UcKQbm3siUKfmtNKnBFf3m8ZtvGze3gJhmu UAuussh9K6PvE4xKfsLjvwfouHcAbo4FNYP3LUoa+RANsFmP+KE4ldrUUbhpjRAK+fnHqimpRp/ T7LpfUcj9pmMzgjQZPziGpfYQWfJhXSXbw/i8ExEn4CEnh8swnYHDEXr4jI1Ry4RAW//djUjAh3 vw8tEusk9LisC6Bg/YRVLZORcc5rqkXJCw0hX4beBOanEc82TQcTEpMjGA= X-Received: by 2002:a05:6512:3b8c:b0:540:22e0:1f63 with SMTP id 2adb3069b0e04-540240c9391mr2048093e87.19.1733847587611; Tue, 10 Dec 2024 08:19:47 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.19.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:19:46 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 31/69] target/arm: Convert FCVT (scalar) to decodetree Date: Tue, 10 Dec 2024 10:16:55 -0600 Message-ID: <20241210161733.1830573-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12f.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 Remove handle_fp_fcvt and disas_fp_1src as these were the last insns decoded by those functions. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 172 +++++++++++++-------------------- target/arm/tcg/a64.decode | 7 ++ 2 files changed, 74 insertions(+), 105 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 5a48a2ef2d..7d9353f95e 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8443,123 +8443,85 @@ TRANS_FEAT(FRINT64Z_s, aa64_frint, do_fp1_scalar, a, &f_scalar_frint64, FPROUNDING_ZERO) TRANS_FEAT(FRINT64X_s, aa64_frint, do_fp1_scalar, a, &f_scalar_frint64, -1) -static void handle_fp_fcvt(DisasContext *s, int opcode, - int rd, int rn, int dtype, int ntype) +static bool trans_FCVT_s_ds(DisasContext *s, arg_rr *a) { - switch (ntype) { - case 0x0: - { - TCGv_i32 tcg_rn = read_fp_sreg(s, rn); - if (dtype == 1) { - /* Single to double */ - TCGv_i64 tcg_rd = tcg_temp_new_i64(); - gen_helper_vfp_fcvtds(tcg_rd, tcg_rn, tcg_env); - write_fp_dreg(s, rd, tcg_rd); - } else { - /* Single to half */ - TCGv_i32 tcg_rd = tcg_temp_new_i32(); - TCGv_i32 ahp = get_ahp_flag(); - TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); + if (fp_access_check(s)) { + TCGv_i32 tcg_rn = read_fp_sreg(s, a->rn); + TCGv_i64 tcg_rd = tcg_temp_new_i64(); - gen_helper_vfp_fcvt_f32_to_f16(tcg_rd, tcg_rn, fpst, ahp); - /* write_fp_sreg is OK here because top half of tcg_rd is zero */ - write_fp_sreg(s, rd, tcg_rd); - } - break; - } - case 0x1: - { - TCGv_i64 tcg_rn = read_fp_dreg(s, rn); - TCGv_i32 tcg_rd = tcg_temp_new_i32(); - if (dtype == 0) { - /* Double to single */ - gen_helper_vfp_fcvtsd(tcg_rd, tcg_rn, tcg_env); - } else { - TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); - TCGv_i32 ahp = get_ahp_flag(); - /* Double to half */ - gen_helper_vfp_fcvt_f64_to_f16(tcg_rd, tcg_rn, fpst, ahp); - /* write_fp_sreg is OK here because top half of tcg_rd is zero */ - } - write_fp_sreg(s, rd, tcg_rd); - break; - } - case 0x3: - { - TCGv_i32 tcg_rn = read_fp_sreg(s, rn); - TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_FPCR); - TCGv_i32 tcg_ahp = get_ahp_flag(); - tcg_gen_ext16u_i32(tcg_rn, tcg_rn); - if (dtype == 0) { - /* Half to single */ - TCGv_i32 tcg_rd = tcg_temp_new_i32(); - gen_helper_vfp_fcvt_f16_to_f32(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp); - write_fp_sreg(s, rd, tcg_rd); - } else { - /* Half to double */ - TCGv_i64 tcg_rd = tcg_temp_new_i64(); - gen_helper_vfp_fcvt_f16_to_f64(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp); - write_fp_dreg(s, rd, tcg_rd); - } - break; - } - default: - g_assert_not_reached(); + gen_helper_vfp_fcvtds(tcg_rd, tcg_rn, tcg_env); + write_fp_dreg(s, a->rd, tcg_rd); } + return true; } -/* Floating point data-processing (1 source) - * 31 30 29 28 24 23 22 21 20 15 14 10 9 5 4 0 - * +---+---+---+-----------+------+---+--------+-----------+------+------+ - * | M | 0 | S | 1 1 1 1 0 | type | 1 | opcode | 1 0 0 0 0 | Rn | Rd | - * +---+---+---+-----------+------+---+--------+-----------+------+------+ - */ -static void disas_fp_1src(DisasContext *s, uint32_t insn) +static bool trans_FCVT_s_hs(DisasContext *s, arg_rr *a) { - int mos = extract32(insn, 29, 3); - int type = extract32(insn, 22, 2); - int opcode = extract32(insn, 15, 6); - int rn = extract32(insn, 5, 5); - int rd = extract32(insn, 0, 5); + if (fp_access_check(s)) { + TCGv_i32 tmp = read_fp_sreg(s, a->rn); + TCGv_i32 ahp = get_ahp_flag(); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); - if (mos) { - goto do_unallocated; + gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp); + /* write_fp_sreg is OK here because top half of result is zero */ + write_fp_sreg(s, a->rd, tmp); } + return true; +} - switch (opcode) { - case 0x4: case 0x5: case 0x7: - { - /* FCVT between half, single and double precision */ - int dtype = extract32(opcode, 0, 2); - if (type == 2 || dtype == type) { - goto do_unallocated; - } - if (!fp_access_check(s)) { - return; - } +static bool trans_FCVT_s_sd(DisasContext *s, arg_rr *a) +{ + if (fp_access_check(s)) { + TCGv_i64 tcg_rn = read_fp_dreg(s, a->rn); + TCGv_i32 tcg_rd = tcg_temp_new_i32(); - handle_fp_fcvt(s, opcode, rd, rn, dtype, type); - break; + gen_helper_vfp_fcvtsd(tcg_rd, tcg_rn, tcg_env); + write_fp_sreg(s, a->rd, tcg_rd); } + return true; +} - default: - do_unallocated: - case 0x0: /* FMOV */ - case 0x1: /* FABS */ - case 0x2: /* FNEG */ - case 0x3: /* FSQRT */ - case 0x6: /* BFCVT */ - case 0x8: /* FRINTN */ - case 0x9: /* FRINTP */ - case 0xa: /* FRINTM */ - case 0xb: /* FRINTZ */ - case 0xc: /* FRINTA */ - case 0xe: /* FRINTX */ - case 0xf: /* FRINTI */ - case 0x10 ... 0x13: /* FRINT{32,64}{X,Z} */ - unallocated_encoding(s); - break; +static bool trans_FCVT_s_hd(DisasContext *s, arg_rr *a) +{ + if (fp_access_check(s)) { + TCGv_i64 tcg_rn = read_fp_dreg(s, a->rn); + TCGv_i32 tcg_rd = tcg_temp_new_i32(); + TCGv_i32 ahp = get_ahp_flag(); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); + + gen_helper_vfp_fcvt_f64_to_f16(tcg_rd, tcg_rn, fpst, ahp); + /* write_fp_sreg is OK here because top half of tcg_rd is zero */ + write_fp_sreg(s, a->rd, tcg_rd); } + return true; +} + +static bool trans_FCVT_s_sh(DisasContext *s, arg_rr *a) +{ + if (fp_access_check(s)) { + TCGv_i32 tcg_rn = read_fp_hreg(s, a->rn); + TCGv_i32 tcg_rd = tcg_temp_new_i32(); + TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_FPCR); + TCGv_i32 tcg_ahp = get_ahp_flag(); + + gen_helper_vfp_fcvt_f16_to_f32(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp); + write_fp_sreg(s, a->rd, tcg_rd); + } + return true; +} + +static bool trans_FCVT_s_dh(DisasContext *s, arg_rr *a) +{ + if (fp_access_check(s)) { + TCGv_i32 tcg_rn = read_fp_hreg(s, a->rn); + TCGv_i64 tcg_rd = tcg_temp_new_i64(); + TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_FPCR); + TCGv_i32 tcg_ahp = get_ahp_flag(); + + gen_helper_vfp_fcvt_f16_to_f64(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp); + write_fp_dreg(s, a->rd, tcg_rd); + } + return true; } /* Handle floating point <=> fixed point conversions. Note that we can @@ -8982,7 +8944,7 @@ static void disas_data_proc_fp(DisasContext *s, uint32_t insn) break; case 2: /* [15:12] == x100 */ /* Floating point data-processing (1 source) */ - disas_fp_1src(s, insn); + unallocated_encoding(s); /* in decodetree */ break; case 3: /* [15:12] == 1000 */ unallocated_encoding(s); diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 4f7b3ee3d9..211346c4d9 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1345,6 +1345,13 @@ FRINT32X_s 00011110 0. 1 010001 10000 ..... ..... @rr_sd FRINT64Z_s 00011110 0. 1 010010 10000 ..... ..... @rr_sd FRINT64X_s 00011110 0. 1 010011 10000 ..... ..... @rr_sd +FCVT_s_ds 00011110 00 1 000101 10000 ..... ..... @rr +FCVT_s_hs 00011110 00 1 000111 10000 ..... ..... @rr +FCVT_s_sd 00011110 01 1 000100 10000 ..... ..... @rr +FCVT_s_hd 00011110 01 1 000111 10000 ..... ..... @rr +FCVT_s_sh 00011110 11 1 000100 10000 ..... ..... @rr +FCVT_s_dh 00011110 11 1 000101 10000 ..... ..... @rr + # Floating-point Immediate FMOVI_s 0001 1110 .. 1 imm:8 100 00000 rd:5 esz=%esz_hsd From patchwork Tue Dec 10 16:16:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848823 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416726wrn; Tue, 10 Dec 2024 08:20:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVycbyb/p5ZCewnlTL9YIthfnGMjvk/mdrw4z4Z4SMjpZyVDKK6/m8zTBrXL4E184+eHktJsA==@linaro.org X-Google-Smtp-Source: AGHT+IEcYwIfCI/VBbp3+qccNTFl0c5gVn9s4KkrJy0b1aI+gpregPstXlm5weulL94FwEuGHe7A X-Received: by 2002:a05:6214:2507:b0:6d8:a822:2ee2 with SMTP id 6a1803df08f44-6d8e711808cmr348440536d6.16.1733847646184; Tue, 10 Dec 2024 08:20:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847646; cv=none; d=google.com; s=arc-20240605; b=BkMdA4jWlc8LQfOCSCsijgwYWtcqS3R2yJFAx8NDtOWDuQgDDRiNkb+mOPeje9NlSC 2h7VLuJTHJSPtGixSqou/ldpRoMs0d5TmNxGBSb3Ty+5CwoQrDXOk4yA857PtIgiaOKi 2UV44CWPaNtkE95ZUXdXYDqqkJRzsusbXewF6MnpfyJdynBOjQYIxOqcOZIP2oJHLjOU nzsdPh80UlB+Q8Fu1cbhf3W+OKLzirvGxY/BItP94Y9MkfTxjWaxDt+OeBThP36KRBKg Fb9jdzLD/7ip2QuE0yCXqW8YEs6z6vc71uMpIoUjxtstKB91QEaD36eLU9aurgFPoQ94 AdnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=lluqtpnSNzZuO0ckPq8N6itPAEVKmZGC/zVz09YXfts=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=PkdLHHfY1rPkthbsmE/ZvTCqx92e0/tjI+qRiQjInt94FXHnlDDUhUaPDW7bIIQl93 ygIrpX6IVUor2p/i8dtFqAPmk67H15v0fgywQTjUqd/Nta6FtH7RfpeEIMBAKVFSzO3Q 8BDjsyx2bnQhc2KrEdV9WuqFzBPRo41pf6aRoMBQ7KnyDMVSEoZpU8tId4XWFCnHIkz6 ruQM3yRf/0bsJwJJIAslbwFKq39c8bhrdokdtYwk7P2MAYrZkxZiJB16kdatag6cLf+X llxREm5G/VoUCQBEOuvZcc6nnP3rSqabcbac3lv3oIrmiy/xX32dwBLbDNoBThuAxsCn OAJw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RlY29ggW; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8dac0ba27si141530276d6.357.2024.12.10.08.20.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20: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=RlY29ggW; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2xq-0005mp-Qh; Tue, 10 Dec 2024 11:19:58 -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 1tL2xo-0005VG-9i for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:56 -0500 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2xl-0006Zi-MU for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:55 -0500 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-54024ecc33dso1237103e87.0 for ; Tue, 10 Dec 2024 08:19:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847592; x=1734452392; 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=lluqtpnSNzZuO0ckPq8N6itPAEVKmZGC/zVz09YXfts=; b=RlY29ggW/yST9QiZ9oIlrfUhdxVbMSaAZkb6zBeIzWqoXop03E7h7JKpWGnmdUfYyz BKe8DRSTa22V668/gSG7FUAhQ1Us2UueB7DSbgl66Yrgc/yGDGin5GqtZ1IZ9KqXAyZx fL94QQKwSxAcfz4ZH9PoazB/GuvcHDEONKuZfr3KZo/MA7zx+yqkwcC/mBedqUyeZRA5 dqRGv4yj9+jgsa0hh4xdAfmK0AJoHbAoXxum0RcQllw+z552Lf2OheHk42gpm3tQhY1R TLrymYXRAkWbvp1th/xgSl3/b7CbspA/PYxK6cze+1yvMgA2ntLAsrz36bxdQsZaiOOn Wx/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847592; x=1734452392; 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=lluqtpnSNzZuO0ckPq8N6itPAEVKmZGC/zVz09YXfts=; b=Z4qKvuS3iUAgChln0OUM9q0/oatt2GXWQBon84ZDfUnvrDVkUkTOI3/1OorKt2v8ls jyiel6ykJ23cksQOERfmDS30Tc/dbKkj3EpXxFW1xOMz326j8PVLLlGx07CqVefa4qE4 /wbanndXeB7a+ESHG070RMXNED2Y2p4HMtBToxzq6nDR0HvvoQinhj22cmjr1Rtb4Z32 OPUP7fJH4gk4Kec41qGJfSVU4MoF8UnYZhPb9lSs7rJRWyphb7/SG2zMbsoAsnz3UA7B X7YFI5sJoMo9hsJr3l3He8cp1N0AwpfG80O3fG0GP3RrUys7JrkBlVK2PuPjj2CkAtX4 PQ4g== X-Gm-Message-State: AOJu0Yz2HVUqtxmcMzSi7XFoK94CADARgicOCetplP8QQ+bMJaoFcbMJ 3fHwiDd4CAWrQiKoMTcOMbToE1BWGBdEEj1G1+CCCjrulJSRe7Qj60r1vlaa1DtjFX9BPVGyNDG ySwVVS/fV X-Gm-Gg: ASbGncs7vCQDNQ/cCWFe2YUHEi7LdOLcDqJytwJMbDxvMsWJkS7bhSwkC40hh8rLNBT exwj142n0TxhlgS7hQzCwYlo6UL2RnEAjBPs2jAa52rpqYuBPi1j4UHlPyMiw+LCKItFxKTQlLV cGVrDw7IqzHVsRyyhDc04h/L0lpFKuuZKdJfNc3scKfm9FQ1wOsvHuRErqPP/jrJ8P2jOoOzPvh PisXWIjMwyrY8bWdXXfaacMySxVRxumUuKTxXOH+S3RA7S4pvzyRsdgmK4= X-Received: by 2002:a05:6512:4011:b0:540:2223:9b20 with SMTP id 2adb3069b0e04-54024115ed1mr1613727e87.53.1733847591957; Tue, 10 Dec 2024 08:19:51 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:19:51 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 32/69] target/arm: Convert handle_fpfpcvt to decodetree Date: Tue, 10 Dec 2024 10:16:56 -0600 Message-ID: <20241210161733.1830573-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x134.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 This includes SCVTF, UCVTF, FCVT{N,P,M,Z,A}{S,U}. Remove disas_fp_fixed_conv as those were the last insns decoded by that function. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 391 ++++++++++++++------------------- target/arm/tcg/a64.decode | 40 ++++ 2 files changed, 209 insertions(+), 222 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 7d9353f95e..628def6c7c 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8524,227 +8524,196 @@ static bool trans_FCVT_s_dh(DisasContext *s, arg_rr *a) return true; } -/* Handle floating point <=> fixed point conversions. Note that we can - * also deal with fp <=> integer conversions as a special case (scale == 64) - * OPTME: consider handling that special case specially or at least skipping - * the call to scalbn in the helpers for zero shifts. - */ -static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode, - bool itof, int rmode, int scale, int sf, int type) +static bool do_cvtf_scalar(DisasContext *s, MemOp esz, int rd, int shift, + TCGv_i64 tcg_int, bool is_signed) { - bool is_signed = !(opcode & 1); TCGv_ptr tcg_fpstatus; TCGv_i32 tcg_shift, tcg_single; TCGv_i64 tcg_double; - tcg_fpstatus = fpstatus_ptr(type == 3 ? FPST_FPCR_F16 : FPST_FPCR); + tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + tcg_shift = tcg_constant_i32(shift); - tcg_shift = tcg_constant_i32(64 - scale); - - if (itof) { - TCGv_i64 tcg_int = cpu_reg(s, rn); - if (!sf) { - TCGv_i64 tcg_extend = tcg_temp_new_i64(); - - if (is_signed) { - tcg_gen_ext32s_i64(tcg_extend, tcg_int); - } else { - tcg_gen_ext32u_i64(tcg_extend, tcg_int); - } - - tcg_int = tcg_extend; + switch (esz) { + case MO_64: + tcg_double = tcg_temp_new_i64(); + if (is_signed) { + gen_helper_vfp_sqtod(tcg_double, tcg_int, tcg_shift, tcg_fpstatus); + } else { + gen_helper_vfp_uqtod(tcg_double, tcg_int, tcg_shift, tcg_fpstatus); } + write_fp_dreg(s, rd, tcg_double); + break; - switch (type) { - case 1: /* float64 */ - tcg_double = tcg_temp_new_i64(); - if (is_signed) { - gen_helper_vfp_sqtod(tcg_double, tcg_int, - tcg_shift, tcg_fpstatus); - } else { - gen_helper_vfp_uqtod(tcg_double, tcg_int, - tcg_shift, tcg_fpstatus); - } - write_fp_dreg(s, rd, tcg_double); - break; - - case 0: /* float32 */ - tcg_single = tcg_temp_new_i32(); - if (is_signed) { - gen_helper_vfp_sqtos(tcg_single, tcg_int, - tcg_shift, tcg_fpstatus); - } else { - gen_helper_vfp_uqtos(tcg_single, tcg_int, - tcg_shift, tcg_fpstatus); - } - write_fp_sreg(s, rd, tcg_single); - break; - - case 3: /* float16 */ - tcg_single = tcg_temp_new_i32(); - if (is_signed) { - gen_helper_vfp_sqtoh(tcg_single, tcg_int, - tcg_shift, tcg_fpstatus); - } else { - gen_helper_vfp_uqtoh(tcg_single, tcg_int, - tcg_shift, tcg_fpstatus); - } - write_fp_sreg(s, rd, tcg_single); - break; - - default: - g_assert_not_reached(); + case MO_32: + tcg_single = tcg_temp_new_i32(); + if (is_signed) { + gen_helper_vfp_sqtos(tcg_single, tcg_int, tcg_shift, tcg_fpstatus); + } else { + gen_helper_vfp_uqtos(tcg_single, tcg_int, tcg_shift, tcg_fpstatus); } - } else { - TCGv_i64 tcg_int = cpu_reg(s, rd); - TCGv_i32 tcg_rmode; + write_fp_sreg(s, rd, tcg_single); + break; - if (extract32(opcode, 2, 1)) { - /* There are too many rounding modes to all fit into rmode, - * so FCVTA[US] is a special case. - */ - rmode = FPROUNDING_TIEAWAY; + case MO_16: + tcg_single = tcg_temp_new_i32(); + if (is_signed) { + gen_helper_vfp_sqtoh(tcg_single, tcg_int, tcg_shift, tcg_fpstatus); + } else { + gen_helper_vfp_uqtoh(tcg_single, tcg_int, tcg_shift, tcg_fpstatus); } + write_fp_sreg(s, rd, tcg_single); + break; - tcg_rmode = gen_set_rmode(rmode, tcg_fpstatus); - - switch (type) { - case 1: /* float64 */ - tcg_double = read_fp_dreg(s, rn); - if (is_signed) { - if (!sf) { - gen_helper_vfp_tosld(tcg_int, tcg_double, - tcg_shift, tcg_fpstatus); - } else { - gen_helper_vfp_tosqd(tcg_int, tcg_double, - tcg_shift, tcg_fpstatus); - } - } else { - if (!sf) { - gen_helper_vfp_tould(tcg_int, tcg_double, - tcg_shift, tcg_fpstatus); - } else { - gen_helper_vfp_touqd(tcg_int, tcg_double, - tcg_shift, tcg_fpstatus); - } - } - if (!sf) { - tcg_gen_ext32u_i64(tcg_int, tcg_int); - } - break; - - case 0: /* float32 */ - tcg_single = read_fp_sreg(s, rn); - if (sf) { - if (is_signed) { - gen_helper_vfp_tosqs(tcg_int, tcg_single, - tcg_shift, tcg_fpstatus); - } else { - gen_helper_vfp_touqs(tcg_int, tcg_single, - tcg_shift, tcg_fpstatus); - } - } else { - TCGv_i32 tcg_dest = tcg_temp_new_i32(); - if (is_signed) { - gen_helper_vfp_tosls(tcg_dest, tcg_single, - tcg_shift, tcg_fpstatus); - } else { - gen_helper_vfp_touls(tcg_dest, tcg_single, - tcg_shift, tcg_fpstatus); - } - tcg_gen_extu_i32_i64(tcg_int, tcg_dest); - } - break; - - case 3: /* float16 */ - tcg_single = read_fp_sreg(s, rn); - if (sf) { - if (is_signed) { - gen_helper_vfp_tosqh(tcg_int, tcg_single, - tcg_shift, tcg_fpstatus); - } else { - gen_helper_vfp_touqh(tcg_int, tcg_single, - tcg_shift, tcg_fpstatus); - } - } else { - TCGv_i32 tcg_dest = tcg_temp_new_i32(); - if (is_signed) { - gen_helper_vfp_toslh(tcg_dest, tcg_single, - tcg_shift, tcg_fpstatus); - } else { - gen_helper_vfp_toulh(tcg_dest, tcg_single, - tcg_shift, tcg_fpstatus); - } - tcg_gen_extu_i32_i64(tcg_int, tcg_dest); - } - break; - - default: - g_assert_not_reached(); - } - - gen_restore_rmode(tcg_rmode, tcg_fpstatus); + default: + g_assert_not_reached(); } + return true; } -/* Floating point <-> fixed point conversions - * 31 30 29 28 24 23 22 21 20 19 18 16 15 10 9 5 4 0 - * +----+---+---+-----------+------+---+-------+--------+-------+------+------+ - * | sf | 0 | S | 1 1 1 1 0 | type | 0 | rmode | opcode | scale | Rn | Rd | - * +----+---+---+-----------+------+---+-------+--------+-------+------+------+ - */ -static void disas_fp_fixed_conv(DisasContext *s, uint32_t insn) +static bool do_cvtf_g(DisasContext *s, arg_fcvt *a, bool is_signed) { - int rd = extract32(insn, 0, 5); - int rn = extract32(insn, 5, 5); - int scale = extract32(insn, 10, 6); - int opcode = extract32(insn, 16, 3); - int rmode = extract32(insn, 19, 2); - int type = extract32(insn, 22, 2); - bool sbit = extract32(insn, 29, 1); - bool sf = extract32(insn, 31, 1); - bool itof; + TCGv_i64 tcg_int; + int check = fp_access_check_scalar_hsd(s, a->esz); - if (sbit || (!sf && scale < 32)) { - unallocated_encoding(s); - return; + if (check <= 0) { + return check == 0; } - switch (type) { - case 0: /* float32 */ - case 1: /* float64 */ - break; - case 3: /* float16 */ - if (dc_isar_feature(aa64_fp16, s)) { - break; + if (a->sf) { + tcg_int = cpu_reg(s, a->rn); + } else { + tcg_int = read_cpu_reg(s, a->rn, true); + if (is_signed) { + tcg_gen_ext32s_i64(tcg_int, tcg_int); + } else { + tcg_gen_ext32u_i64(tcg_int, tcg_int); } - /* fallthru */ - default: - unallocated_encoding(s); - return; } - - switch ((rmode << 3) | opcode) { - case 0x2: /* SCVTF */ - case 0x3: /* UCVTF */ - itof = true; - break; - case 0x18: /* FCVTZS */ - case 0x19: /* FCVTZU */ - itof = false; - break; - default: - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - handle_fpfpcvt(s, rd, rn, opcode, itof, FPROUNDING_ZERO, scale, sf, type); + return do_cvtf_scalar(s, a->esz, a->rd, a->shift, tcg_int, is_signed); } +TRANS(SCVTF_g, do_cvtf_g, a, true) +TRANS(UCVTF_g, do_cvtf_g, a, false) + +static void do_fcvt_scalar(DisasContext *s, MemOp out, MemOp esz, + TCGv_i64 tcg_out, int shift, int rn, + ARMFPRounding rmode) +{ + TCGv_ptr tcg_fpstatus; + TCGv_i32 tcg_shift, tcg_rmode, tcg_single; + + tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + tcg_shift = tcg_constant_i32(shift); + tcg_rmode = gen_set_rmode(rmode, tcg_fpstatus); + + switch (esz) { + case MO_64: + read_vec_element(s, tcg_out, rn, 0, MO_64); + switch (out) { + case MO_64 | MO_SIGN: + gen_helper_vfp_tosqd(tcg_out, tcg_out, tcg_shift, tcg_fpstatus); + break; + case MO_64: + gen_helper_vfp_touqd(tcg_out, tcg_out, tcg_shift, tcg_fpstatus); + break; + case MO_32 | MO_SIGN: + gen_helper_vfp_tosld(tcg_out, tcg_out, tcg_shift, tcg_fpstatus); + break; + case MO_32: + gen_helper_vfp_tould(tcg_out, tcg_out, tcg_shift, tcg_fpstatus); + break; + default: + g_assert_not_reached(); + } + break; + + case MO_32: + tcg_single = read_fp_sreg(s, rn); + switch (out) { + case MO_64 | MO_SIGN: + gen_helper_vfp_tosqs(tcg_out, tcg_single, tcg_shift, tcg_fpstatus); + break; + case MO_64: + gen_helper_vfp_touqs(tcg_out, tcg_single, tcg_shift, tcg_fpstatus); + break; + case MO_32 | MO_SIGN: + gen_helper_vfp_tosls(tcg_single, tcg_single, + tcg_shift, tcg_fpstatus); + tcg_gen_extu_i32_i64(tcg_out, tcg_single); + break; + case MO_32: + gen_helper_vfp_touls(tcg_single, tcg_single, + tcg_shift, tcg_fpstatus); + tcg_gen_extu_i32_i64(tcg_out, tcg_single); + break; + default: + g_assert_not_reached(); + } + break; + + case MO_16: + tcg_single = read_fp_hreg(s, rn); + switch (out) { + case MO_64 | MO_SIGN: + gen_helper_vfp_tosqh(tcg_out, tcg_single, tcg_shift, tcg_fpstatus); + break; + case MO_64: + gen_helper_vfp_touqh(tcg_out, tcg_single, tcg_shift, tcg_fpstatus); + break; + case MO_32 | MO_SIGN: + gen_helper_vfp_toslh(tcg_single, tcg_single, + tcg_shift, tcg_fpstatus); + tcg_gen_extu_i32_i64(tcg_out, tcg_single); + break; + case MO_32: + gen_helper_vfp_toulh(tcg_single, tcg_single, + tcg_shift, tcg_fpstatus); + tcg_gen_extu_i32_i64(tcg_out, tcg_single); + break; + default: + g_assert_not_reached(); + } + break; + + default: + g_assert_not_reached(); + } + + gen_restore_rmode(tcg_rmode, tcg_fpstatus); +} + +static bool do_fcvt_g(DisasContext *s, arg_fcvt *a, + ARMFPRounding rmode, bool is_signed) +{ + TCGv_i64 tcg_int; + int check = fp_access_check_scalar_hsd(s, a->esz); + + if (check <= 0) { + return check == 0; + } + + tcg_int = cpu_reg(s, a->rd); + do_fcvt_scalar(s, (a->sf ? MO_64 : MO_32) | (is_signed ? MO_SIGN : 0), + a->esz, tcg_int, a->shift, a->rn, rmode); + + if (!a->sf) { + tcg_gen_ext32u_i64(tcg_int, tcg_int); + } + return true; +} + +TRANS(FCVTNS_g, do_fcvt_g, a, FPROUNDING_TIEEVEN, true) +TRANS(FCVTNU_g, do_fcvt_g, a, FPROUNDING_TIEEVEN, false) +TRANS(FCVTPS_g, do_fcvt_g, a, FPROUNDING_POSINF, true) +TRANS(FCVTPU_g, do_fcvt_g, a, FPROUNDING_POSINF, false) +TRANS(FCVTMS_g, do_fcvt_g, a, FPROUNDING_NEGINF, true) +TRANS(FCVTMU_g, do_fcvt_g, a, FPROUNDING_NEGINF, false) +TRANS(FCVTZS_g, do_fcvt_g, a, FPROUNDING_ZERO, true) +TRANS(FCVTZU_g, do_fcvt_g, a, FPROUNDING_ZERO, false) +TRANS(FCVTAS_g, do_fcvt_g, a, FPROUNDING_TIEAWAY, true) +TRANS(FCVTAU_g, do_fcvt_g, a, FPROUNDING_TIEAWAY, false) + static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof) { /* FMOV: gpr to or from float, double, or top half of quad fp reg, @@ -8844,33 +8813,11 @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn) switch (opcode) { case 2: /* SCVTF */ case 3: /* UCVTF */ - itof = true; - /* fallthru */ case 4: /* FCVTAS */ case 5: /* FCVTAU */ - if (rmode != 0) { - goto do_unallocated; - } - /* fallthru */ case 0: /* FCVT[NPMZ]S */ case 1: /* FCVT[NPMZ]U */ - switch (type) { - case 0: /* float32 */ - case 1: /* float64 */ - break; - case 3: /* float16 */ - if (!dc_isar_feature(aa64_fp16, s)) { - goto do_unallocated; - } - break; - default: - goto do_unallocated; - } - if (!fp_access_check(s)) { - return; - } - handle_fpfpcvt(s, rd, rn, opcode, itof, rmode, 64, sf, type); - break; + goto do_unallocated; default: switch (sf << 7 | type << 5 | rmode << 3 | opcode) { @@ -8924,7 +8871,7 @@ static void disas_data_proc_fp(DisasContext *s, uint32_t insn) unallocated_encoding(s); /* in decodetree */ } else if (extract32(insn, 21, 1) == 0) { /* Floating point to fixed point conversions */ - disas_fp_fixed_conv(s, insn); + unallocated_encoding(s); /* in decodetree */ } else { switch (extract32(insn, 10, 2)) { case 1: /* Floating point conditional compare */ diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 211346c4d9..5e170cec7a 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1323,6 +1323,46 @@ FMAXV_s 0110 1110 00 11000 01111 10 ..... ..... @rr_q1e2 FMINV_h 0.00 1110 10 11000 01111 10 ..... ..... @qrr_h FMINV_s 0110 1110 10 11000 01111 10 ..... ..... @rr_q1e2 +# Conversion between floating-point and fixed-point (general register) + +&fcvt rd rn esz sf shift +%fcvt_shift32 10:5 !function=rsub_32 +%fcvt_shift64 10:6 !function=rsub_64 + +@fcvt32 0 ....... .. ...... 1..... rn:5 rd:5 \ + &fcvt sf=0 esz=%esz_hsd shift=%fcvt_shift32 +@fcvt64 1 ....... .. ...... ...... rn:5 rd:5 \ + &fcvt sf=1 esz=%esz_hsd shift=%fcvt_shift64 + +SCVTF_g . 0011110 .. 000010 ...... ..... ..... @fcvt32 +SCVTF_g . 0011110 .. 000010 ...... ..... ..... @fcvt64 +UCVTF_g . 0011110 .. 000011 ...... ..... ..... @fcvt32 +UCVTF_g . 0011110 .. 000011 ...... ..... ..... @fcvt64 + +FCVTZS_g . 0011110 .. 011000 ...... ..... ..... @fcvt32 +FCVTZS_g . 0011110 .. 011000 ...... ..... ..... @fcvt64 +FCVTZU_g . 0011110 .. 011001 ...... ..... ..... @fcvt32 +FCVTZU_g . 0011110 .. 011001 ...... ..... ..... @fcvt64 + +# Conversion between floating-point and integer (general register) + +@icvt sf:1 ....... .. ...... ...... rn:5 rd:5 \ + &fcvt esz=%esz_hsd shift=0 + +SCVTF_g . 0011110 .. 100010 000000 ..... ..... @icvt +UCVTF_g . 0011110 .. 100011 000000 ..... ..... @icvt + +FCVTNS_g . 0011110 .. 100000 000000 ..... ..... @icvt +FCVTNU_g . 0011110 .. 100001 000000 ..... ..... @icvt +FCVTPS_g . 0011110 .. 101000 000000 ..... ..... @icvt +FCVTPU_g . 0011110 .. 101001 000000 ..... ..... @icvt +FCVTMS_g . 0011110 .. 110000 000000 ..... ..... @icvt +FCVTMU_g . 0011110 .. 110001 000000 ..... ..... @icvt +FCVTZS_g . 0011110 .. 111000 000000 ..... ..... @icvt +FCVTZU_g . 0011110 .. 111001 000000 ..... ..... @icvt +FCVTAS_g . 0011110 .. 100100 000000 ..... ..... @icvt +FCVTAU_g . 0011110 .. 100101 000000 ..... ..... @icvt + # Floating-point data processing (1 source) FMOV_s 00011110 .. 1 000000 10000 ..... ..... @rr_hsd From patchwork Tue Dec 10 16:16:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848845 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp419259wrn; Tue, 10 Dec 2024 08:25:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXjU24KCUydcQL4I/doZwBK2Zg/BT5wDMyH3b9If6YU8tocpqPQOHo7lGGMiRuImB9LsxhdNA==@linaro.org X-Google-Smtp-Source: AGHT+IHLGhtce+Zn6n5Civ3AUi705wrcNm3pIr+Ekmkj32UKgH15usfrL5e+bfSQYGB8IeTOOk4r X-Received: by 2002:a05:6102:cca:b0:4af:4902:153e with SMTP id ada2fe7eead31-4b11610558dmr6186462137.9.1733847917999; Tue, 10 Dec 2024 08:25:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847917; cv=none; d=google.com; s=arc-20240605; b=VkL9MHl+foi7iFEBwGbv3YDsb5F45DdAWI7F0ZCeK1v1+uMTU/+Eg0AN2951dQfbek oYmve/rALnJROIe9unw6fcWf9XcC1B3Gm81v5gUWDzcoEoWeKDHfKvr0xMqxAOeLJki1 VVFmEgSzGAlY91gygNlyaLH3PP1itZMiKW9hIh9JfY3YOxuSrdvR0S3aw2pTBD8n4fTE VyNd0JVJILs+i9ilVBiEF6VKLPtuVgxipC2yNdz0pAhCQ0PmwpWNqJzTQuH64mFypBbA BY4zYY+UWHUWETbtIoKYSG+EdskOynwi4BnzHaz4Vi1PJCcUIMW31Gk4ZZwHtasgN9TL iaOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=EWe0cS5erMqHnf9Y4yFydHawcmr3E5Sxjh2zbuzMCj8=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=TTiaqWVn0JYhg7IoWXmFfipKFP+EICnotdguS5wOeblOYzZcwYliK9Zf7bMK+1WQoq C4k6zOHEMTIzXkV4cxKh0vEEWAeM4K6cqXY1sqMvcHzFK29IAIm16zjoYcAm8swK/eYu MI5AKGIPWXjv+kkSKDfa6aAhLlY5hPGEBUJJKDVeM0bsohZEtueQYsOde75Sse14x9Xq gbVy/TTQA2ZGR/xSClOcxKa4d6cQ/vjxB5avS+D80kTPOKrNczOXfDPpVtzT+FxzJlq7 8fwACl/2lz8Rz2BnEcMoits8yC30sl8go2UnA/bD7h6+kYCz1MUG2evaPgIxxwfRjeDJ +jiA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UzAAlujc; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4afe8e0cf12si1928747137.260.2024.12.10.08.25.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:25:17 -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=UzAAlujc; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2y0-0007AP-1q; Tue, 10 Dec 2024 11:20:08 -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 1tL2xr-0005uR-4c for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:59 -0500 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2xp-0006ag-AO for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:19:58 -0500 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-53df80eeeedso5538258e87.2 for ; Tue, 10 Dec 2024 08:19:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847596; x=1734452396; 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=EWe0cS5erMqHnf9Y4yFydHawcmr3E5Sxjh2zbuzMCj8=; b=UzAAlujcLfKwstqxSOMYgvizPbXBqk3SzqnhJCgLk302PaFkSrQlcsv1wOTA1JTcKF 5/9+D6XVLUsSzWhSJgFy9mzvqeVA4cpgM2AnFRNeBcvO4pZoD8rjtypGZHfd13PIC8TG dCV8IvyIL3tnBmlJcgaABidciLqMEbIFXaVYP+keJKssl4UIhCEd838mZu37P7wxOvkV YJGgVq0aQVLrAegHRTjnJJ6Zsb/zhyNCwrEhqO3rHJI5FMelwZW8xGJSZy0r9871oEzJ 3HhP+uNOCrR3JEJs5OjeVAJ1uZt0YzpZtLHBRJG8gPM+cfsrAaTosKJkHUp0AfbkSBl+ sFeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847596; x=1734452396; 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=EWe0cS5erMqHnf9Y4yFydHawcmr3E5Sxjh2zbuzMCj8=; b=Fxo5L11Y9TvD4RlFoVuQKwXTtTb2pz8ODXQq8tkcj1grPuYpJw/hNho6m8VkO/AHxy hZhFUo2kL3gRC7pHeP3Cjh+qLSt2O1tSta8F9fEL/ypUwJwhIcm0OLYrjThjzpi7CPDR 8gMSNpOsPsvBsyaf6jrvE0Zus7JHJgv2OOHH4kmcER4rvZlXXL8ZLXQMJf8NoS5vcyGv P1ekiAboLSHGSpK7F5okbiR8qNlU/tH0ChlQm+ADwfo77y0vQqDstJfXgSMvHuIC2oD0 i38RqMGSudeGxrIENvUds1S0nnlYXZnhCL6iPOcKfbEfjTvl1+kDRC0Uq0m6MBGAffjD Jtcw== X-Gm-Message-State: AOJu0YzINqzsCcKz1ABHkh24IwbiMSmblB2SadKS97Rp7aA5Wm7vx6OC j5PW7K1ImNVMWGJBW4zyDTffAzq6bl7bJcnndByHPjHpDY9eR6YePEDR4KcpupXCuOEr2aK4TUg G+PiIdIKL X-Gm-Gg: ASbGncuG7clzuePABhYSlGECS4Mpe7mpnVKbkthX6juHTxPHEQYTAcnwa14W5PkHI6O mpaKDl8EbRMejVaQyPu3VvRiElMCxHuTPj068x6u9tRgHSeyCaFXxezzJz6eWJ7G3Fd7f3u9u+z eevvhZyvHMlv0h8fsjHzkiH8ZoYJrB4gYv0bjDKSkmFLItWPek5RnpUwlSAnAyYtmJnVRVxb1d0 ZBDA9bW99b+7M77bMem5jeMSXKLTZI9XadGoHGHPipoUB5ECD/fZvt3D98= X-Received: by 2002:a05:6512:23a2:b0:540:20f5:be88 with SMTP id 2adb3069b0e04-540240ae6afmr1862193e87.5.1733847595607; Tue, 10 Dec 2024 08:19:55 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:19:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 33/69] target/arm: Convert FJCVTZS to decodetree Date: Tue, 10 Dec 2024 10:16:57 -0600 Message-ID: <20241210161733.1830573-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x131.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 41 +++++++++++++++++----------------- target/arm/tcg/a64.decode | 2 ++ 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 628def6c7c..152bb4b1b3 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8714,6 +8714,26 @@ TRANS(FCVTZU_g, do_fcvt_g, a, FPROUNDING_ZERO, false) TRANS(FCVTAS_g, do_fcvt_g, a, FPROUNDING_TIEAWAY, true) TRANS(FCVTAU_g, do_fcvt_g, a, FPROUNDING_TIEAWAY, false) +static bool trans_FJCVTZS(DisasContext *s, arg_FJCVTZS *a) +{ + if (!dc_isar_feature(aa64_jscvt, s)) { + return false; + } + if (fp_access_check(s)) { + TCGv_i64 t = read_fp_dreg(s, a->rn); + TCGv_ptr fpstatus = fpstatus_ptr(FPST_FPCR); + + gen_helper_fjcvtzs(t, t, fpstatus); + + tcg_gen_ext32u_i64(cpu_reg(s, a->rd), t); + tcg_gen_extrh_i64_i32(cpu_ZF, t); + tcg_gen_movi_i32(cpu_CF, 0); + tcg_gen_movi_i32(cpu_NF, 0); + tcg_gen_movi_i32(cpu_VF, 0); + } + return true; +} + static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof) { /* FMOV: gpr to or from float, double, or top half of quad fp reg, @@ -8775,20 +8795,6 @@ static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof) } } -static void handle_fjcvtzs(DisasContext *s, int rd, int rn) -{ - TCGv_i64 t = read_fp_dreg(s, rn); - TCGv_ptr fpstatus = fpstatus_ptr(FPST_FPCR); - - gen_helper_fjcvtzs(t, t, fpstatus); - - tcg_gen_ext32u_i64(cpu_reg(s, rd), t); - tcg_gen_extrh_i64_i32(cpu_ZF, t); - tcg_gen_movi_i32(cpu_CF, 0); - tcg_gen_movi_i32(cpu_NF, 0); - tcg_gen_movi_i32(cpu_VF, 0); -} - /* Floating point <-> integer conversions * 31 30 29 28 24 23 22 21 20 19 18 16 15 10 9 5 4 0 * +----+---+---+-----------+------+---+-------+-----+-------------+----+----+ @@ -8843,13 +8849,6 @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn) break; case 0b00111110: /* FJCVTZS */ - if (!dc_isar_feature(aa64_jscvt, s)) { - goto do_unallocated; - } else if (fp_access_check(s)) { - handle_fjcvtzs(s, rd, rn); - } - break; - default: do_unallocated: unallocated_encoding(s); diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 5e170cec7a..cd10961618 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1363,6 +1363,8 @@ FCVTZU_g . 0011110 .. 111001 000000 ..... ..... @icvt FCVTAS_g . 0011110 .. 100100 000000 ..... ..... @icvt FCVTAU_g . 0011110 .. 100101 000000 ..... ..... @icvt +FJCVTZS 0 0011110 01 111110 000000 ..... ..... @rr + # Floating-point data processing (1 source) FMOV_s 00011110 .. 1 000000 10000 ..... ..... @rr_hsd From patchwork Tue Dec 10 16:16:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848826 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416779wrn; Tue, 10 Dec 2024 08:20:51 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUJhNyf6b/6VbsITG35PxQcIft4l2Fs9h0OAsjMGaIvYau6aMIBKB8NsVm6vpF1eHtZ07xwIg==@linaro.org X-Google-Smtp-Source: AGHT+IHIJKllvYTLieyZcN0DW/EZW5jiJ04iW3sIwNgsLKbVuAtGL42jN4eQ7S9DX68XXLY7yFqb X-Received: by 2002:a05:620a:2484:b0:7b6:d079:7496 with SMTP id af79cd13be357-7b6d0797671mr1536536685a.46.1733847651101; Tue, 10 Dec 2024 08:20:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847651; cv=none; d=google.com; s=arc-20240605; b=Q3I8S/AsD1EZikmbTpvcF8cSmC3R44GOcpBKcGXl4j/xep9e11EZa/4O0FZ0waetfr PoJCa2/utCX4B8dVDeyVtBOK/K70vHOltLBz7MKvsC746Z1wNAFVNcgJwi0gXB+jJM8Z 8/+nA6yknqZrw7hMK9L92gIp4OOuBijYEfd+5okLRmvV1lJuHmzwo3Y12YluPEvYh6pN t7XK6v4WFVgViNe8aYFHuvLEhCaiP/9Jtz5F1SLCot8KatFIoSq6pjskJ3jADIRpC+lc NMWKvNcAtTLV4hkbYKBG/AnlRv6W/q0UOcknvyAvv4rxgJGsnBJo1+vJS47KxbDIzqx5 XOYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=UELUc/4Dw3Vx9AqPdOZATxZaSuazTpDkae/a8W/pq2E=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=OYNzqLxsVpTCsVmSDxJFwPLjefCd9cAwI/ySfgc0s4RXbyo98ivtwM0HIk50hZ8hpI 4e57nsZCw+Zdy92E7EAKmaFYjqd8S5UDdhcl6tY8vD4qjPYNiWSaBsLftOmSQJYmfjod KlwePR8UkFtrC/9ItzcxD6bb7JIUi2ZkZoX+9IuRPtDoARn+ErpYlGetFug3LYpXCZns QmanKtvqLp5y3hjGMhUY3WdcocQ7p9NTThbFsUvtu72+ppbECq2e9o1kT0nY0UgZpnAd xUm1agZdHb4dbXa6YdYm/+GVARUno0yxhm+jRtEeNslI2pfO5G/qr6wwJ7aYxoS8/7cb 4C5g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zc+cjXMG; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6b5a8fdd4si1554870985a.295.2024.12.10.08.20.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20:51 -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=Zc+cjXMG; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2y2-0007Sc-7x; Tue, 10 Dec 2024 11:20:10 -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 1tL2xw-0006ek-0S for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:20:04 -0500 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2xt-0006bF-1g for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:20:03 -0500 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5401c52000dso2585721e87.3 for ; Tue, 10 Dec 2024 08:20:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847599; x=1734452399; 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=UELUc/4Dw3Vx9AqPdOZATxZaSuazTpDkae/a8W/pq2E=; b=Zc+cjXMGtZQwegU6JPpaBhS/85CEvo/6tORiZQVEh9ncCu6EgRjqfURe2KVYDOwmzI cVVKUaX/Z7XZFLnsCtH1HBQ85JUVyhNOV+zm91MVw83Weds/cYNK4wv2g0AbEu/mckya Kbg0XYZbKe3IrR5GY4w0RBFC3Q0FMm7+9wUs99aZGuo66jFUILSOdSEqxhjgt1qhILwt M/7lnBmP4diIAV5LWFWar3JCcGYYBGnVXY/o3pOZabnLACSTcsGtIH5CYJuQ3GW2IdhB A7QLPzS373Oi4vDbBdodUEdXGmQghZ8hzd3IMpueYpvcgg3I+ynLT3q5mKVVQGOkrNYb IsqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847599; x=1734452399; 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=UELUc/4Dw3Vx9AqPdOZATxZaSuazTpDkae/a8W/pq2E=; b=Je/A4SFLw5zNNVap5CKrjz/KgpiyAGfpF3bVmPwXzRgoR7rtmkQBT6Bmqpvo5Vdyg9 ZMev7Mi1eL3se/qm9l8gZ0MCLZEcmsNkqLyVJIQ5jY79zfwXhDIE9qOvYiH9YojBz16v 5EB/LwS7P+eHaA9IExGa0Xte1nNlINEOJpSY2sPmibJZ4IvhJjL3INX8fmKDKxWp1jX6 DdoHAj0guPlMVUwTP6jAUV56565hGyWXjPyiox3dHmY8qGTZJm/9ooeI66v2E/9gHzRh vA9wPW8uiWZcO4iFKl/E+G1PdIa8YUAwXvzOv9mvKNxQIxOrSyf+Zst8jAT2c1oZBdkq Hmpg== X-Gm-Message-State: AOJu0Yyd3YydP4LiYY/y1L+JGF47s4sKXsqly+XjTASy8x+hRkYp5A3s SSxx8WGRKu0E2xXVN05xfmJeSwa2kHcN5UBP+mRpGzuVxWo12fFkSl8nQ4llO/GMxwUili/uXww RaAAeRpJ+ X-Gm-Gg: ASbGncsXxqKIV8suQYYv8tqc5t5XTzOSmfBk6ki94DwvOIOlSh0TkQLPc+FXAxKxK1d garwLqiU2A5ATjI9vMtpks16avk3LvyZEqrrwhuQhd+5vzgJApTr7G+uifmhKUg6nGBTiL7sveQ RNot2D8Z/hHj4CX8dV6MV0dwbEknR2FxH0krt+/hcQO36eM8wte4XPGd//VXeHsRB/HWb//Pjus ZEc0YGbLsAYYxxaXfkf9EeMPTHW4m+vHqz8XHmzJVROFGH+sO7SMPUrGqI= X-Received: by 2002:a05:6512:3d0e:b0:540:22e0:1f80 with SMTP id 2adb3069b0e04-54022e02207mr2395540e87.20.1733847599302; Tue, 10 Dec 2024 08:19:59 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.19.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:19:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 34/69] target/arm: Convert handle_fmov to decodetree Date: Tue, 10 Dec 2024 10:16:58 -0600 Message-ID: <20241210161733.1830573-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12b.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 Remove disas_fp_int_conv and disas_data_proc_fp as these were the last insns decoded by those functions. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 232 ++++++++++----------------------- target/arm/tcg/a64.decode | 14 ++ 2 files changed, 86 insertions(+), 160 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 152bb4b1b3..7128e4fabe 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8734,175 +8734,87 @@ static bool trans_FJCVTZS(DisasContext *s, arg_FJCVTZS *a) return true; } -static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof) +static bool trans_FMOV_hx(DisasContext *s, arg_rr *a) { - /* FMOV: gpr to or from float, double, or top half of quad fp reg, - * without conversion. - */ - - if (itof) { - TCGv_i64 tcg_rn = cpu_reg(s, rn); - TCGv_i64 tmp; - - switch (type) { - case 0: - /* 32 bit */ - tmp = tcg_temp_new_i64(); - tcg_gen_ext32u_i64(tmp, tcg_rn); - write_fp_dreg(s, rd, tmp); - break; - case 1: - /* 64 bit */ - write_fp_dreg(s, rd, tcg_rn); - break; - case 2: - /* 64 bit to top half. */ - tcg_gen_st_i64(tcg_rn, tcg_env, fp_reg_hi_offset(s, rd)); - clear_vec_high(s, true, rd); - break; - case 3: - /* 16 bit */ - tmp = tcg_temp_new_i64(); - tcg_gen_ext16u_i64(tmp, tcg_rn); - write_fp_dreg(s, rd, tmp); - break; - default: - g_assert_not_reached(); - } - } else { - TCGv_i64 tcg_rd = cpu_reg(s, rd); - - switch (type) { - case 0: - /* 32 bit */ - tcg_gen_ld32u_i64(tcg_rd, tcg_env, fp_reg_offset(s, rn, MO_32)); - break; - case 1: - /* 64 bit */ - tcg_gen_ld_i64(tcg_rd, tcg_env, fp_reg_offset(s, rn, MO_64)); - break; - case 2: - /* 64 bits from top half */ - tcg_gen_ld_i64(tcg_rd, tcg_env, fp_reg_hi_offset(s, rn)); - break; - case 3: - /* 16 bit */ - tcg_gen_ld16u_i64(tcg_rd, tcg_env, fp_reg_offset(s, rn, MO_16)); - break; - default: - g_assert_not_reached(); - } + if (!dc_isar_feature(aa64_fp16, s)) { + return false; } + if (fp_access_check(s)) { + TCGv_i64 tcg_rn = cpu_reg(s, a->rn); + TCGv_i64 tmp = tcg_temp_new_i64(); + tcg_gen_ext16u_i64(tmp, tcg_rn); + write_fp_dreg(s, a->rd, tmp); + } + return true; } -/* Floating point <-> integer conversions - * 31 30 29 28 24 23 22 21 20 19 18 16 15 10 9 5 4 0 - * +----+---+---+-----------+------+---+-------+-----+-------------+----+----+ - * | sf | 0 | S | 1 1 1 1 0 | type | 1 | rmode | opc | 0 0 0 0 0 0 | Rn | Rd | - * +----+---+---+-----------+------+---+-------+-----+-------------+----+----+ - */ -static void disas_fp_int_conv(DisasContext *s, uint32_t insn) +static bool trans_FMOV_sw(DisasContext *s, arg_rr *a) { - int rd = extract32(insn, 0, 5); - int rn = extract32(insn, 5, 5); - int opcode = extract32(insn, 16, 3); - int rmode = extract32(insn, 19, 2); - int type = extract32(insn, 22, 2); - bool sbit = extract32(insn, 29, 1); - bool sf = extract32(insn, 31, 1); - bool itof = false; - - if (sbit) { - goto do_unallocated; - } - - switch (opcode) { - case 2: /* SCVTF */ - case 3: /* UCVTF */ - case 4: /* FCVTAS */ - case 5: /* FCVTAU */ - case 0: /* FCVT[NPMZ]S */ - case 1: /* FCVT[NPMZ]U */ - goto do_unallocated; - - default: - switch (sf << 7 | type << 5 | rmode << 3 | opcode) { - case 0b01100110: /* FMOV half <-> 32-bit int */ - case 0b01100111: - case 0b11100110: /* FMOV half <-> 64-bit int */ - case 0b11100111: - if (!dc_isar_feature(aa64_fp16, s)) { - goto do_unallocated; - } - /* fallthru */ - case 0b00000110: /* FMOV 32-bit */ - case 0b00000111: - case 0b10100110: /* FMOV 64-bit */ - case 0b10100111: - case 0b11001110: /* FMOV top half of 128-bit */ - case 0b11001111: - if (!fp_access_check(s)) { - return; - } - itof = opcode & 1; - handle_fmov(s, rd, rn, type, itof); - break; - - case 0b00111110: /* FJCVTZS */ - default: - do_unallocated: - unallocated_encoding(s); - return; - } - break; + if (fp_access_check(s)) { + TCGv_i64 tcg_rn = cpu_reg(s, a->rn); + TCGv_i64 tmp = tcg_temp_new_i64(); + tcg_gen_ext32u_i64(tmp, tcg_rn); + write_fp_dreg(s, a->rd, tmp); } + return true; } -/* FP-specific subcases of table C3-6 (SIMD and FP data processing) - * 31 30 29 28 25 24 0 - * +---+---+---+---------+-----------------------------+ - * | | 0 | | 1 1 1 1 | | - * +---+---+---+---------+-----------------------------+ - */ -static void disas_data_proc_fp(DisasContext *s, uint32_t insn) +static bool trans_FMOV_dx(DisasContext *s, arg_rr *a) { - if (extract32(insn, 24, 1)) { - unallocated_encoding(s); /* in decodetree */ - } else if (extract32(insn, 21, 1) == 0) { - /* Floating point to fixed point conversions */ - unallocated_encoding(s); /* in decodetree */ - } else { - switch (extract32(insn, 10, 2)) { - case 1: /* Floating point conditional compare */ - case 2: /* Floating point data-processing (2 source) */ - case 3: /* Floating point conditional select */ - unallocated_encoding(s); /* in decodetree */ - break; - case 0: - switch (ctz32(extract32(insn, 12, 4))) { - case 0: /* [15:12] == xxx1 */ - /* Floating point immediate */ - unallocated_encoding(s); /* in decodetree */ - break; - case 1: /* [15:12] == xx10 */ - /* Floating point compare */ - unallocated_encoding(s); /* in decodetree */ - break; - case 2: /* [15:12] == x100 */ - /* Floating point data-processing (1 source) */ - unallocated_encoding(s); /* in decodetree */ - break; - case 3: /* [15:12] == 1000 */ - unallocated_encoding(s); - break; - default: /* [15:12] == 0000 */ - /* Floating point <-> integer conversions */ - disas_fp_int_conv(s, insn); - break; - } - break; - } + if (fp_access_check(s)) { + TCGv_i64 tcg_rn = cpu_reg(s, a->rn); + write_fp_dreg(s, a->rd, tcg_rn); } + return true; +} + +static bool trans_FMOV_ux(DisasContext *s, arg_rr *a) +{ + if (fp_access_check(s)) { + TCGv_i64 tcg_rn = cpu_reg(s, a->rn); + tcg_gen_st_i64(tcg_rn, tcg_env, fp_reg_hi_offset(s, a->rd)); + clear_vec_high(s, true, a->rd); + } + return true; +} + +static bool trans_FMOV_xh(DisasContext *s, arg_rr *a) +{ + if (!dc_isar_feature(aa64_fp16, s)) { + return false; + } + if (fp_access_check(s)) { + TCGv_i64 tcg_rd = cpu_reg(s, a->rd); + tcg_gen_ld16u_i64(tcg_rd, tcg_env, fp_reg_offset(s, a->rn, MO_16)); + } + return true; +} + +static bool trans_FMOV_ws(DisasContext *s, arg_rr *a) +{ + if (fp_access_check(s)) { + TCGv_i64 tcg_rd = cpu_reg(s, a->rd); + tcg_gen_ld32u_i64(tcg_rd, tcg_env, fp_reg_offset(s, a->rn, MO_32)); + } + return true; +} + +static bool trans_FMOV_xd(DisasContext *s, arg_rr *a) +{ + if (fp_access_check(s)) { + TCGv_i64 tcg_rd = cpu_reg(s, a->rd); + tcg_gen_ld_i64(tcg_rd, tcg_env, fp_reg_offset(s, a->rn, MO_64)); + } + return true; +} + +static bool trans_FMOV_xu(DisasContext *s, arg_rr *a) +{ + if (fp_access_check(s)) { + TCGv_i64 tcg_rd = cpu_reg(s, a->rd); + tcg_gen_ld_i64(tcg_rd, tcg_env, fp_reg_hi_offset(s, a->rn)); + } + return true; } /* Common vector code for handling integer to FP conversion */ @@ -10819,7 +10731,7 @@ static void disas_data_proc_simd(DisasContext *s, uint32_t insn) static void disas_data_proc_simd_fp(DisasContext *s, uint32_t insn) { if (extract32(insn, 28, 1) == 1 && extract32(insn, 30, 1) == 0) { - disas_data_proc_fp(s, insn); + unallocated_encoding(s); /* in decodetree */ } else { /* SIMD, including crypto */ disas_data_proc_simd(s, insn); diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index cd10961618..5b9f7caa7f 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1365,6 +1365,20 @@ FCVTAU_g . 0011110 .. 100101 000000 ..... ..... @icvt FJCVTZS 0 0011110 01 111110 000000 ..... ..... @rr +FMOV_ws 0 0011110 00 100110 000000 ..... ..... @rr +FMOV_sw 0 0011110 00 100111 000000 ..... ..... @rr + +FMOV_xd 1 0011110 01 100110 000000 ..... ..... @rr +FMOV_dx 1 0011110 01 100111 000000 ..... ..... @rr + +# Move to/from upper half of 128-bit +FMOV_xu 1 0011110 10 101110 000000 ..... ..... @rr +FMOV_ux 1 0011110 10 101111 000000 ..... ..... @rr + +# Half-precision allows both sf=0 and sf=1 with identical results +FMOV_xh - 0011110 11 100110 000000 ..... ..... @rr +FMOV_hx - 0011110 11 100111 000000 ..... ..... @rr + # Floating-point data processing (1 source) FMOV_s 00011110 .. 1 000000 10000 ..... ..... @rr_hsd From patchwork Tue Dec 10 16:16:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848827 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416780wrn; Tue, 10 Dec 2024 08:20:51 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU2/zULwqBlyB7YhTgwmvyf3z/ELxS0IRFKEINUarFksChbsCu6Nuy7X90kzb5E5yoq7n4dBg==@linaro.org X-Google-Smtp-Source: AGHT+IF1qg2qaM2cgllUSdePxILlfYMxzJ9/hzmEtgl7VHWyWai443yPcbVazoS741O/v6TVJUmJ X-Received: by 2002:a05:622a:1441:b0:467:5f95:679 with SMTP id d75a77b69052e-4675f950817mr146643141cf.42.1733847651096; Tue, 10 Dec 2024 08:20:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847651; cv=none; d=google.com; s=arc-20240605; b=XWItB5ujZ0MdVz8q3bEK4M7jOt/+vFr4wv+a5s5MEVZxhr5yLrjnHU4FMnFp+dOf5q pFYsMfihZeMU3xMdyHPU0dAXSLJFJmHI0rq9Mii0F+S15H3eG3OfFg4FogRNkU+zZY6e DyH8rKYfYCuM5iqwuS8JRfOQycqOA54BdWsdJ2n2cduYyvc4uI6mC4Pqo81rDB9Or2Qw olJthkVCIABTorNsrWSQNLU6440AfYtdDMfaHpcYWhcfa62SFZRkltsHfIlDa2XXFzI+ Pp/pXQQoBDl9ZBOYqca06bYD7tusq9/S/Pv9RdmB8g39E5DENyqiQck6fUnVWcY29aOo WKtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=dbaNen81XcZUkoDJ8z9fRGUGgulx7bfrXVNgwOgzEP4=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=eo1ErbPBQFxWNmt2pLUezZAqoNLvZWeF2tIT0R8kprkmfYeGNHpX+SM7MybvPmE/Qs ZlpaXK5IEEO1VeBPVOO816v8iCA+ncajzohJa32RlM/cjFEiOFt6yp/957sb4/Ws7Mno wQdPBE7g2c6fC0zZ515GWy1tDrEUSQagMDfL3XLPYL4+PVbuyVsHAThR5f5BhUaD7UJ5 mmhqKuwhdA4aQf1ivzxZaArZOeTdVZxr1KyXFVSLXBvkNAiaj7qVz7CQu+w3emP4E7Xk 44fz4YEOyRUj9NcEKTfuxFrQjC7r3b+LY9dLk5GKtZFJBefZidXIu/Yfdt5ETxqvsQwN M13A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fq3hRdZp; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-467297b980csi161819041cf.306.2024.12.10.08.20.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20:51 -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=Fq3hRdZp; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2y7-0007tT-RB; Tue, 10 Dec 2024 11:20:16 -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 1tL2xz-00076e-8T for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:20:07 -0500 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2xw-0006d0-V4 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:20:06 -0500 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-54021daa6cbso1930375e87.0 for ; Tue, 10 Dec 2024 08:20:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847603; x=1734452403; 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=dbaNen81XcZUkoDJ8z9fRGUGgulx7bfrXVNgwOgzEP4=; b=Fq3hRdZpGTsrfkkHBHNlg/BLRMQe+7pdaFRhva3v11arOAWg5KNbteRszBtKgro6hS wdDAAlnayhe6NQZUOMePGB2ke+9uXfYbXTKTnS/H+nyKX01XmRwFZo/3uC/OOSSeLxFg BhT+qSn4w+hCYDFUvWVDUp47Vw30X0X7dKuyHA/5QT/q2xUE9Nie4n137WMxlMPAG8zq Q8fX+CK5ZT7YqoMX+KV64J7+k7pQmlBVLovLYGJCRpR7xIPEO2dubR2kuFLYvAAhWXu+ 9HB0JbBNRoH9SAYuHhw0QiMOqDLuEJZGXL1hO4w7wKIYt7e0xUtPNF5Iy4cnDcaTYzO8 HY+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847603; x=1734452403; 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=dbaNen81XcZUkoDJ8z9fRGUGgulx7bfrXVNgwOgzEP4=; b=dKhTBzNKMc++Q0QXMg+zGEUBYxjLr6unwXZCTGUc/bU0dszoi/AH53DX9PCgaA6JLW ZN/ZznEjN6xP6bM5L3K6xMV2ccpsYa2WoNcyHkg37Pe4JXuX6sf0jxnVG+o4HGJ71IXb WNxD8CHLf7m2lKSA22YYI6gf2Bcavhrdu68uJEJxeoH53+FfbCjRojDuZV1ukAPokTx0 8ju5gAJipFq+giFJp/+/SVF69738cby+AydL82c6GZu9c4gpqAkPzoDh4cJgwe0OUJkJ xMqR2PrvHEc4joIlY1zrw7fiKpJMmbr41fiqxTjcBUufC2xH840zgDXT8scbvwnXed91 FVaQ== X-Gm-Message-State: AOJu0YwCnVUw4/HZCGGdUNfzf2vFHM2MzpQ6guj2lDKOjyqENGo1z5lh oNIlhzt7WBRpt5Huirj8jtAJWzr+Oz2kMNoYNeo9fwb7/oZnRUSnVFBNeeXoGgO+txIpmfhTTOU d8gdx0Yhd X-Gm-Gg: ASbGncvfymDpXzf5K4hnwP2CeYDmMdYEY8OIFJV4lttIujoQ4bUSY11WUn3R8yp88A6 uRNdTMj2kjpvCCU7cCOh4Rwu6iH81TStszd4bsiO9izZksk0CQnerNHoJW/wxE5rMy2v6fLzbGk szYL7o4jbsDdjGSbTvyn/Gx66s4dr+IQR+k7LbpenBti3S96iUlHG+kKugwGz5wamGIPy2FLLzj i7fICqU+UrwRc6fXlw3a+I+WVHzKF2O9b4F7i6A/F5q9+00jOGNdJke53I= X-Received: by 2002:a05:6512:230d:b0:540:20da:c34e with SMTP id 2adb3069b0e04-540240be1f1mr1429379e87.21.1733847603011; Tue, 10 Dec 2024 08:20:03 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.19.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:20:02 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 35/69] target/arm: Convert SQABS, SQNEG to decodetree Date: Tue, 10 Dec 2024 10:16:59 -0600 Message-ID: <20241210161733.1830573-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x130.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 123 +++++++++++++++++++++------------ target/arm/tcg/a64.decode | 11 +++ 2 files changed, 89 insertions(+), 45 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 7128e4fabe..c6260a272a 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8817,6 +8817,78 @@ static bool trans_FMOV_xu(DisasContext *s, arg_rr *a) return true; } +typedef struct ENVScalar1 { + NeonGenOneOpEnvFn *gen_bhs[3]; + NeonGenOne64OpEnvFn *gen_d; +} ENVScalar1; + +static bool do_env_scalar1(DisasContext *s, arg_rr_e *a, const ENVScalar1 *f) +{ + if (!fp_access_check(s)) { + return true; + } + if (a->esz == MO_64) { + TCGv_i64 t = read_fp_dreg(s, a->rn); + f->gen_d(t, tcg_env, t); + write_fp_dreg(s, a->rd, t); + } else { + TCGv_i32 t = tcg_temp_new_i32(); + + read_vec_element_i32(s, t, a->rn, 0, a->esz); + f->gen_bhs[a->esz](t, tcg_env, t); + write_fp_sreg(s, a->rd, t); + } + return true; +} + +static bool do_env_vector1(DisasContext *s, arg_qrr_e *a, const ENVScalar1 *f) +{ + if (a->esz == MO_64 && !a->q) { + return false; + } + if (!fp_access_check(s)) { + return true; + } + if (a->esz == MO_64) { + TCGv_i64 t = tcg_temp_new_i64(); + + for (int i = 0; i < 2; ++i) { + read_vec_element(s, t, a->rn, i, MO_64); + f->gen_d(t, tcg_env, t); + write_vec_element(s, t, a->rd, i, MO_64); + } + } else { + TCGv_i32 t = tcg_temp_new_i32(); + int n = (a->q ? 16 : 8) >> a->esz; + + for (int i = 0; i < n; ++i) { + read_vec_element_i32(s, t, a->rn, i, a->esz); + f->gen_bhs[a->esz](t, tcg_env, t); + write_vec_element_i32(s, t, a->rd, i, a->esz); + } + } + clear_vec_high(s, a->q, a->rd); + return true; +} + +static const ENVScalar1 f_scalar_sqabs = { + { gen_helper_neon_qabs_s8, + gen_helper_neon_qabs_s16, + gen_helper_neon_qabs_s32 }, + gen_helper_neon_qabs_s64, +}; +TRANS(SQABS_s, do_env_scalar1, a, &f_scalar_sqabs) +TRANS(SQABS_v, do_env_vector1, a, &f_scalar_sqabs) + +static const ENVScalar1 f_scalar_sqneg = { + { gen_helper_neon_qneg_s8, + gen_helper_neon_qneg_s16, + gen_helper_neon_qneg_s32 }, + gen_helper_neon_qneg_s64, +}; +TRANS(SQNEG_s, do_env_scalar1, a, &f_scalar_sqneg) +TRANS(SQNEG_v, do_env_vector1, a, &f_scalar_sqneg) + /* Common vector code for handling integer to FP conversion */ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, int elements, int is_signed, @@ -9129,13 +9201,6 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, */ tcg_gen_not_i64(tcg_rd, tcg_rn); break; - case 0x7: /* SQABS, SQNEG */ - if (u) { - gen_helper_neon_qneg_s64(tcg_rd, tcg_env, tcg_rn); - } else { - gen_helper_neon_qabs_s64(tcg_rd, tcg_env, tcg_rn); - } - break; case 0xa: /* CMLT */ cond = TCG_COND_LT; do_cmop: @@ -9198,6 +9263,7 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, gen_helper_frint64_d(tcg_rd, tcg_rn, tcg_fpstatus); break; default: + case 0x7: /* SQABS, SQNEG */ g_assert_not_reached(); } } @@ -9540,8 +9606,6 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) TCGv_ptr tcg_fpstatus; switch (opcode) { - case 0x7: /* SQABS / SQNEG */ - break; case 0xa: /* CMLT */ if (u) { unallocated_encoding(s); @@ -9640,6 +9704,7 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) break; default: case 0x3: /* USQADD / SUQADD */ + case 0x7: /* SQABS / SQNEG */ unallocated_encoding(s); return; } @@ -9669,18 +9734,6 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) read_vec_element_i32(s, tcg_rn, rn, 0, size); switch (opcode) { - case 0x7: /* SQABS, SQNEG */ - { - NeonGenOneOpEnvFn *genfn; - static NeonGenOneOpEnvFn * const fns[3][2] = { - { gen_helper_neon_qabs_s8, gen_helper_neon_qneg_s8 }, - { gen_helper_neon_qabs_s16, gen_helper_neon_qneg_s16 }, - { gen_helper_neon_qabs_s32, gen_helper_neon_qneg_s32 }, - }; - genfn = fns[size][u]; - genfn(tcg_rd, tcg_env, tcg_rn); - break; - } case 0x1a: /* FCVTNS */ case 0x1b: /* FCVTMS */ case 0x1c: /* FCVTAS */ @@ -9698,6 +9751,7 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) tcg_fpstatus); break; default: + case 0x7: /* SQABS, SQNEG */ g_assert_not_reached(); } @@ -10055,12 +10109,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) return; } break; - case 0x7: /* SQABS, SQNEG */ - if (size == 3 && !is_q) { - unallocated_encoding(s); - return; - } - break; case 0xc ... 0xf: case 0x16 ... 0x1f: { @@ -10231,6 +10279,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } default: case 0x3: /* SUQADD, USQADD */ + case 0x7: /* SQABS, SQNEG */ unallocated_encoding(s); return; } @@ -10321,13 +10370,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) tcg_gen_clrsb_i32(tcg_res, tcg_op); } break; - case 0x7: /* SQABS, SQNEG */ - if (u) { - gen_helper_neon_qneg_s32(tcg_res, tcg_env, tcg_op); - } else { - gen_helper_neon_qabs_s32(tcg_res, tcg_env, tcg_op); - } - break; case 0x2f: /* FABS */ gen_vfp_abss(tcg_res, tcg_op); break; @@ -10376,6 +10418,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) gen_helper_frint64_s(tcg_res, tcg_op, tcg_fpstatus); break; default: + case 0x7: /* SQABS, SQNEG */ g_assert_not_reached(); } } else { @@ -10391,17 +10434,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) gen_helper_neon_cnt_u8(tcg_res, tcg_op); } break; - case 0x7: /* SQABS, SQNEG */ - { - NeonGenOneOpEnvFn *genfn; - static NeonGenOneOpEnvFn * const fns[2][2] = { - { gen_helper_neon_qabs_s8, gen_helper_neon_qneg_s8 }, - { gen_helper_neon_qabs_s16, gen_helper_neon_qneg_s16 }, - }; - genfn = fns[size][u]; - genfn(tcg_res, tcg_env, tcg_op); - break; - } case 0x4: /* CLS, CLZ */ if (u) { if (size == 0) { @@ -10418,6 +10450,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } break; default: + case 0x7: /* SQABS, SQNEG */ g_assert_not_reached(); } } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 5b9f7caa7f..17ecdac9db 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -47,6 +47,7 @@ @rr_h ........ ... ..... ...... rn:5 rd:5 &rr_e esz=1 @rr_s ........ ... ..... ...... rn:5 rd:5 &rr_e esz=2 @rr_d ........ ... ..... ...... rn:5 rd:5 &rr_e esz=3 +@rr_e ........ esz:2 . ..... ...... rn:5 rd:5 &rr_e @rr_sd ........ ... ..... ...... rn:5 rd:5 &rr_e esz=%esz_sd @rr_hsd ........ ... ..... ...... rn:5 rd:5 &rr_e esz=%esz_hsd @@ -1626,3 +1627,13 @@ UQRSHRN_si 0111 11110 .... ... 10011 1 ..... ..... @shri_s SQRSHRUN_si 0111 11110 .... ... 10001 1 ..... ..... @shri_b SQRSHRUN_si 0111 11110 .... ... 10001 1 ..... ..... @shri_h SQRSHRUN_si 0111 11110 .... ... 10001 1 ..... ..... @shri_s + +# Advanced SIMD scalar two-register miscellaneous + +SQABS_s 0101 1110 ..1 00000 01111 0 ..... ..... @rr_e +SQNEG_s 0111 1110 ..1 00000 01111 0 ..... ..... @rr_e + +# Advanced SIMD two-register miscellaneous + +SQABS_v 0.00 1110 ..1 00000 01111 0 ..... ..... @qrr_e +SQNEG_v 0.10 1110 ..1 00000 01111 0 ..... ..... @qrr_e From patchwork Tue Dec 10 16:17:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848822 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp416642wrn; Tue, 10 Dec 2024 08:20:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW2lku8DPosW2vdJC6Ov2eeme6NRYx824jC6ylrxSdx9dohgOMjEC5/k9aV9VJzK4MWCnkK5Q==@linaro.org X-Google-Smtp-Source: AGHT+IHGr3t9BR0vPmpGozVKPErDXcYcckuxRo/dz0bcfuyPNDI2kkOXdFNCy7OfhoY7rYCOgjCR X-Received: by 2002:a05:620a:d85:b0:7a9:c24e:4df8 with SMTP id af79cd13be357-7b6bcb9170cmr2872559585a.44.1733847636735; Tue, 10 Dec 2024 08:20:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847636; cv=none; d=google.com; s=arc-20240605; b=DmFIDNQyBbogzj/1c5ra8O/Mnso6xVtNjH05TkeJVKW8H/BhvIa0e0lGvIIdfkiE55 J9AVv5UKUpIIznKIU2s9yweC+n3IP0U3gRTI9NjWd1mZ1/5dwIIFG1+tSKDszDEpc7OX 0QfS6dowzi+NnavXfbYdZGdYonQkvvYLUkQR7mrmLT9nob+zHcAWWOHb5q2houjIck1E JfmCrL73Rmggs4UlZlYhLf+7CxA2mYHLNC/XBNXupxJW0jr2MG60YCPNSwI+wsM2Ck3v ppi0jRJl/c4n1OlSsPRDIIzpsZYJucViSh7/wfKgltMXZrIIEYgFlbRrLyHNEjHSY7Ev 3V0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=fLDdVIEyiQ83QEn5t6ocELqe/4+cBzBoAHlegW6lApE=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=lH810Q6RGFw6YSkFSb0r2J+fXgFZzyf25J+vLA08BU0Y+6FJ7fKUXYQDD/cAud/CCy KJ8I6rXXnVRrlrqpdQy25F1DztZDO9V6gHmIi77MORUBZuICe5k+jw9PV8hg4GvGe7Gu YtTxE9coktCPbTD20MpxIb/sirRMN9JVNF+TX9OIgD9h4qVlhvOy/X6zAURJ5OPdDo3o 7DgD/MnvGa+7kWRnkyB1F3Z6y0NtViVVcyewgbQgAT7yngpqlrQKy0FPLU28m1WT0lG4 dm5lRrA2NrO5JIDWfxyoaCWyjMezBNlJCB9b9HlN/UrDtX/MMDNYfNdgXT7xKr3yE470 eb+g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ONaWte9o; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6d7086ee2si511802485a.618.2024.12.10.08.20.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:20: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=ONaWte9o; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2y7-0007vD-RG; Tue, 10 Dec 2024 11:20:16 -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 1tL2y2-0007cS-VO for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:20:11 -0500 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2y0-0006oL-H6 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:20:10 -0500 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-53df19bf6a9so6638474e87.1 for ; Tue, 10 Dec 2024 08:20:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847607; x=1734452407; 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=fLDdVIEyiQ83QEn5t6ocELqe/4+cBzBoAHlegW6lApE=; b=ONaWte9oQ7G6Cskcg1u7otwc5K8lFEosz4OJky4HEcz8FQn7Yi1D9r3sme9QqbBk/S p+3e1phJa3tlFZ50s49g+iPeHuQUfOozdWRbeXvgKpzNu91koRni99dDTF0E6hPRRZKg T6upWC2VFgvSzTYSHw7Bo+4zCxnGi6v/bGTFYmicdZ1tPl0aMRPcFulyy4tRd/0LxKm2 1eNZG0qYvurisfqMpBFrNM0/tZEJc96DoBX2sS23G9H3wRBsdme9b2ZCmjboQBfxytQF 1doot+r4VhLUD0KQQ9msc1Q45KKajjoCkm2rpSSuRqW5pW2HpPC2AazQ1hp07RuOOErV XifQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847607; x=1734452407; 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=fLDdVIEyiQ83QEn5t6ocELqe/4+cBzBoAHlegW6lApE=; b=IxAAoseD49LKLNYjNZ2r4xp1+YM3JQ8n8bA89bzzhD8dchTatIwMwRf0C/z+nvYg7l 6ItzRJOuI165GqB0J7uHDZQZkZzTVm6BUrL6IKfYUkFZPrmSAYx6sTemmagfaS0l/Vhj s5ABwMRoMR/CVKrUYhahDMLTFw8LBozUg1HN17MKp4JMlpyFWWwTFrb22Ky8ctfvKTuu /bqMDOvVBVbSlg/yRyUGoiZnOLChw/qjw7gbmd3JwnqW/wVTt97COKC9v/MAeLm2dGn8 ANinAw5WkpasiG97hFJezfN4mYQ1O7zTABR4hqp5HrK5SSG1V7DxErflTZ6oQfkkcmg4 ZSQw== X-Gm-Message-State: AOJu0YzNgHJ4EhAlFraHjOwDQ/tqOKfpF+8kB2LT+cjx86YZgp+Dw1PC /vfB5SMjQcmnWnEmbvveMV4PVqQ4kmGd7ZwdNCjkwPsL4ANUBIcskmDQRrmW5nA70U+cLmaMr6Q 1HwA54Rfi X-Gm-Gg: ASbGncujod68A7pizGd8y0P0hYUuiYbN0/4N1Cw9OwkSiqeksFXpSM8nF/2kshhPyoy z9UrMtiUoRYz5z0kekPqNvaoHpcpIUu6CpQI+LWYt3kFfdaZI7QNoXALKhjdnyoSGf6vlD0Ic3K jB2DX+LfZ35mu02N3bneKofH2N24cZLJK2emDU+U1MShGLSFLGgDHVNcyQ6Bs+qx+1mgDEY/7Pg L6QOj7AQgdVdrnAX5uQMG3snKtHmq/EqnbRn8PbBSQcJjjMwXPYlYXNblE= X-Received: by 2002:a05:6512:3503:b0:540:19d8:148f with SMTP id 2adb3069b0e04-54019d81704mr4561952e87.32.1733847606746; Tue, 10 Dec 2024 08:20:06 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.20.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:20:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 36/69] target/arm: Convert ABS, NEG to decodetree Date: Tue, 10 Dec 2024 10:17:00 -0600 Message-ID: <20241210161733.1830573-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x136.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 46 +++++++++++++++++++++++----------- target/arm/tcg/a64.decode | 4 +++ 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index c6260a272a..bdbdc466ac 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8889,6 +8889,33 @@ static const ENVScalar1 f_scalar_sqneg = { TRANS(SQNEG_s, do_env_scalar1, a, &f_scalar_sqneg) TRANS(SQNEG_v, do_env_vector1, a, &f_scalar_sqneg) +static bool do_scalar1_d(DisasContext *s, arg_rr *a, ArithOneOp *f) +{ + if (fp_access_check(s)) { + TCGv_i64 t = read_fp_dreg(s, a->rn); + f(t, t); + write_fp_dreg(s, a->rd, t); + } + return true; +} + +TRANS(ABS_s, do_scalar1_d, a, tcg_gen_abs_i64) +TRANS(NEG_s, do_scalar1_d, a, tcg_gen_neg_i64) + +static bool do_gvec_fn2(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) +{ + if (!a->q && a->esz == MO_64) { + return false; + } + if (fp_access_check(s)) { + gen_gvec_fn2(s, a->q, a->rd, a->rn, fn, a->esz); + } + return true; +} + +TRANS(ABS_v, do_gvec_fn2, a, tcg_gen_gvec_abs) +TRANS(NEG_v, do_gvec_fn2, a, tcg_gen_gvec_neg) + /* Common vector code for handling integer to FP conversion */ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, int elements, int is_signed, @@ -9213,13 +9240,6 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, case 0x9: /* CMEQ, CMLE */ cond = u ? TCG_COND_LE : TCG_COND_EQ; goto do_cmop; - case 0xb: /* ABS, NEG */ - if (u) { - tcg_gen_neg_i64(tcg_rd, tcg_rn); - } else { - tcg_gen_abs_i64(tcg_rd, tcg_rn); - } - break; case 0x2f: /* FABS */ gen_vfp_absd(tcg_rd, tcg_rn); break; @@ -9264,6 +9284,7 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, break; default: case 0x7: /* SQABS, SQNEG */ + case 0xb: /* ABS, NEG */ g_assert_not_reached(); } } @@ -9614,7 +9635,6 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) /* fall through */ case 0x8: /* CMGT, CMGE */ case 0x9: /* CMEQ, CMLE */ - case 0xb: /* ABS, NEG */ if (size != 3) { unallocated_encoding(s); return; @@ -9705,6 +9725,7 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) default: case 0x3: /* USQADD / SUQADD */ case 0x7: /* SQABS / SQNEG */ + case 0xb: /* ABS, NEG */ unallocated_encoding(s); return; } @@ -10103,7 +10124,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) /* fall through */ case 0x8: /* CMGT, CMGE */ case 0x9: /* CMEQ, CMLE */ - case 0xb: /* ABS, NEG */ if (size == 3 && !is_q) { unallocated_encoding(s); return; @@ -10280,6 +10300,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) default: case 0x3: /* SUQADD, USQADD */ case 0x7: /* SQABS, SQNEG */ + case 0xb: /* ABS, NEG */ unallocated_encoding(s); return; } @@ -10324,12 +10345,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_clt0, size); return; case 0xb: - if (u) { /* ABS, NEG */ - gen_gvec_fn2(s, is_q, rd, rn, tcg_gen_gvec_neg, size); - } else { - gen_gvec_fn2(s, is_q, rd, rn, tcg_gen_gvec_abs, size); - } - return; + g_assert_not_reached(); } if (size == 3) { diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 17ecdac9db..f112951df7 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1632,8 +1632,12 @@ SQRSHRUN_si 0111 11110 .... ... 10001 1 ..... ..... @shri_s SQABS_s 0101 1110 ..1 00000 01111 0 ..... ..... @rr_e SQNEG_s 0111 1110 ..1 00000 01111 0 ..... ..... @rr_e +ABS_s 0101 1110 111 00000 10111 0 ..... ..... @rr +NEG_s 0111 1110 111 00000 10111 0 ..... ..... @rr # Advanced SIMD two-register miscellaneous SQABS_v 0.00 1110 ..1 00000 01111 0 ..... ..... @qrr_e SQNEG_v 0.10 1110 ..1 00000 01111 0 ..... ..... @qrr_e +ABS_v 0.00 1110 ..1 00000 10111 0 ..... ..... @qrr_e +NEG_v 0.10 1110 ..1 00000 10111 0 ..... ..... @qrr_e From patchwork Tue Dec 10 16:17:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848831 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp417362wrn; Tue, 10 Dec 2024 08:21:56 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXx4sQ5iovdmupPd8tEuqQT+cljnXaj3zpM/VFfDMEvocLvs6C6g+JTVAkvu0Asd0jU8U8n1g==@linaro.org X-Google-Smtp-Source: AGHT+IEsiL0BpkKhGQ/JupUvPxVKI0gCuoV7JuRjzxaEyxdUM8WomGhLtUjI7gArzKIh5vMWhQzY X-Received: by 2002:a05:622a:7488:b0:467:864b:dd79 with SMTP id d75a77b69052e-467864be21cmr12195691cf.49.1733847716338; Tue, 10 Dec 2024 08:21:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847716; cv=none; d=google.com; s=arc-20240605; b=OiGoJkLH77+L11iM8LPwb5csOIyI9AARYNJmrPRv3Ah71xr4YZ2KRDcXEI0HkpEFkv pbHjIRWkmlJoTJAJ4uxthRWYoQWG7QWlKjkUv1UA6MzuzdRy2xFzBP2koNz/XPf2A8mi QBnSzXxBufjiLt4uyoeQZrC2ib9qrKxs3dYiOq4wku3s0r9MnnoOuTJ1vSNZ0hbWXRmT P7CmfrtLi4dwdgVW3Qy2ZZB1JgJXYPbt8lSbplp9Uz/RXgePkxqavbnpDyQAp+RLfRuB U7pjaHGGmTCMFZRuH/aVE8xfEbmm1P/Hy4r+wvxFYUSHtFHljp/zkIdNeDCBYbmm9lzL jzKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=6DQlHI7uclEdcPfrfvz33hHRsZVW+9hnV/7JAZehGk4=; fh=OZQBfL75rC14cCDy3q+1fYHCs9KjWAQ7ZJ3hTfS+5lQ=; b=T3lfU/yPvP0FMkPgEV0nzgFaqJjl3WXdngaR4oVpM62vjiX48Lzu1Q+NCx6tmVKZ21 6snC9A4uZgEeoyHIXvQe2A9SOausGXDLjGCltQF7+dM8E5ukFRdagTw1U6fscf9dDard KQBj6coMyQI+YRnI536YnZGEo/HKq8yYVgq6sb3Y4/WR+UpbQcoiz0TbPwWDzXMeJrH9 0n0rLKbyFqvPJDrniUR73t/Dr/H3ETk6n8Yr3S5PumfWpGuTxN/e2N9rIISHx5nO4ge9 s8O7M9Xm+JE6kj3Syp7nTHFqaaxIj1SzI0nRJ6chXPOY54811t4Kh66GXoMON1Hros9s Dtew==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dvgCbJHS; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-467851adda4si9532251cf.582.2024.12.10.08.21.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:21:56 -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=dvgCbJHS; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2yF-0000Hj-F4; Tue, 10 Dec 2024 11:20: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 1tL2y6-0007ph-1k for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:20:14 -0500 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2y4-0006pQ-3i for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:20:13 -0500 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-53ffaaeeb76so3064232e87.0 for ; Tue, 10 Dec 2024 08:20:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847610; x=1734452410; 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=6DQlHI7uclEdcPfrfvz33hHRsZVW+9hnV/7JAZehGk4=; b=dvgCbJHSjDiNWUH/H/Kp5s7dgWGvDiD3YfPFR8RMorffhw1zQ8EPOfRickhnHvuWUz 4wrcrEWKZ8BhzDFBwjZ/dsRuwgrnVPd4g1wHGuDRfCVMi6ZvLuQeyjTuKkPwH9onwhwN tW9i4oJaEqmm5Ilaap/3QumCM04jMQ4IdjXsyV9ZTQFY86bAJXwy2pZmpR0OTxnf3m1j GR743O2GbFmpL6kMhfLeNl32PKiiUipJ2JhsdCCjjBH24wJQlF8dgEZGEpI87e5ZCI7Y Yh2zypKL6NzC3s0DaF+HMeNxPdLqT+sJ2YS8MTRCboefqSlL6fE0DUO23IYEHAxEQ7Dx /dvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847610; x=1734452410; 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=6DQlHI7uclEdcPfrfvz33hHRsZVW+9hnV/7JAZehGk4=; b=GkDePkJkOzgN+C+/tIPTIUPJ52R6+liJw8ERQzOuKxPpCVELnLYpVuD+gX6hLq4kmY 8GRalQEg9t20eKj5ySwZSBsvTxKcgMXAPQOXotdVxzfinSXFPrXPLBwpDEF3o4RQBGuL VJ1UZZzJihqTh7riA3LQvZfizJEwqDTPFlmnGNKOhvF4PRTz14SV2AxecTCvQw54wFb5 Xm6Ix5+0vbVfhtWXfdkX/sLrJIMKu5K2tRxffn6EYRFEdn32/h4b7yZeXh1PYrjBxzt5 Ip7zhWZo4rGjcRGsXjCCk5c6/4Df/Evb2KtQOTDgl+o4HnqbR46PA9oQ4gzfp8wFGG5A 9xsw== X-Gm-Message-State: AOJu0YyWgTUalgeV1F7lFII5AbofBikLmswrEbv3wbSs6Z+WB+l/W83s MTTvTEvy53+W64p0Ksit+HPooH0q+xuQnWc7iqkt5RjCXqagd70zUdMy8A3HNXOBW8Rb9gU5A+b SnXWQhK5t X-Gm-Gg: ASbGnctgrld4nieZVzOnbxfcbkN7EvWUNRbQfvVgVZ+RTz1Bif7l1TENhEL/MoYkLq8 J9aNTfyn5kvAGrOfMrauSrFfTSSp2hp3pAo+LmJ3NBm7yMWUUDsqI2jil2focjAGKA6+uG2fMzt cIA4C98HTDUOa3kX6E0yURKs8BAn8Ula8m0NDZVdRn7i+IoecD5RmHTCsfNA4g0w6ScwfYXMQZS XuLUTjh4LAR69TfVe3ZT+Gex9wU1JVvBR9D8//Y3razc7xo5AVphzdEUq4= X-Received: by 2002:a05:6512:6c8:b0:53f:f71:4d74 with SMTP id 2adb3069b0e04-53f0f714e3amr5508310e87.8.1733847610127; Tue, 10 Dec 2024 08:20:10 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.20.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:20:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 37/69] target/arm: Introduce gen_gvec_cls, gen_gvec_clz Date: Tue, 10 Dec 2024 10:17:01 -0600 Message-ID: <20241210161733.1830573-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x136.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 Add gvec interfaces for CLS and CLZ operations. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/tcg/translate.h | 5 +++++ target/arm/tcg/gengvec.c | 35 +++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 29 +++++++-------------------- target/arm/tcg/translate-neon.c | 29 ++------------------------- 4 files changed, 49 insertions(+), 49 deletions(-) diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index 20cd0e851c..5c6c24f057 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -578,6 +578,11 @@ void gen_gvec_umaxp(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, void gen_gvec_uminp(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_cls(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_clz(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz); + /* * Forward to the isar_feature_* tests given a DisasContext pointer. */ diff --git a/target/arm/tcg/gengvec.c b/target/arm/tcg/gengvec.c index f652520b65..834b2961c0 100644 --- a/target/arm/tcg/gengvec.c +++ b/target/arm/tcg/gengvec.c @@ -2358,3 +2358,38 @@ void gen_gvec_urhadd(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, assert(vece <= MO_32); tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, opr_sz, max_sz, &g[vece]); } + +void gen_gvec_cls(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz) +{ + static const GVecGen2 g[] = { + { .fni4 = gen_helper_neon_cls_s8, + .vece = MO_8 }, + { .fni4 = gen_helper_neon_cls_s16, + .vece = MO_16 }, + { .fni4 = tcg_gen_clrsb_i32, + .vece = MO_32 }, + }; + assert(vece <= MO_32); + tcg_gen_gvec_2(rd_ofs, rn_ofs, opr_sz, max_sz, &g[vece]); +} + +static void gen_clz32_i32(TCGv_i32 d, TCGv_i32 n) +{ + tcg_gen_clzi_i32(d, n, 32); +} + +void gen_gvec_clz(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz) +{ + static const GVecGen2 g[] = { + { .fni4 = gen_helper_neon_clz_u8, + .vece = MO_8 }, + { .fni4 = gen_helper_neon_clz_u16, + .vece = MO_16 }, + { .fni4 = gen_clz32_i32, + .vece = MO_32 }, + }; + assert(vece <= MO_32); + tcg_gen_gvec_2(rd_ofs, rn_ofs, opr_sz, max_sz, &g[vece]); +} diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index bdbdc466ac..77d9f6452a 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -10321,6 +10321,13 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } switch (opcode) { + case 0x4: /* CLZ, CLS */ + if (u) { + gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_clz, size); + } else { + gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_cls, size); + } + return; case 0x5: if (u && size == 0) { /* NOT */ gen_gvec_fn2(s, is_q, rd, rn, tcg_gen_gvec_not, 0); @@ -10379,13 +10386,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) if (size == 2) { /* Special cases for 32 bit elements */ switch (opcode) { - case 0x4: /* CLS */ - if (u) { - tcg_gen_clzi_i32(tcg_res, tcg_op, 32); - } else { - tcg_gen_clrsb_i32(tcg_res, tcg_op); - } - break; case 0x2f: /* FABS */ gen_vfp_abss(tcg_res, tcg_op); break; @@ -10450,21 +10450,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) gen_helper_neon_cnt_u8(tcg_res, tcg_op); } break; - case 0x4: /* CLS, CLZ */ - if (u) { - if (size == 0) { - gen_helper_neon_clz_u8(tcg_res, tcg_op); - } else { - gen_helper_neon_clz_u16(tcg_res, tcg_op); - } - } else { - if (size == 0) { - gen_helper_neon_cls_s8(tcg_res, tcg_op); - } else { - gen_helper_neon_cls_s16(tcg_res, tcg_op); - } - } - break; default: case 0x7: /* SQABS, SQNEG */ g_assert_not_reached(); diff --git a/target/arm/tcg/translate-neon.c b/target/arm/tcg/translate-neon.c index 9c8829ad7d..1c89a53272 100644 --- a/target/arm/tcg/translate-neon.c +++ b/target/arm/tcg/translate-neon.c @@ -3120,6 +3120,8 @@ DO_2MISC_VEC(VCGT0, gen_gvec_cgt0) DO_2MISC_VEC(VCLE0, gen_gvec_cle0) DO_2MISC_VEC(VCGE0, gen_gvec_cge0) DO_2MISC_VEC(VCLT0, gen_gvec_clt0) +DO_2MISC_VEC(VCLS, gen_gvec_cls) +DO_2MISC_VEC(VCLZ, gen_gvec_clz) static bool trans_VMVN(DisasContext *s, arg_2misc *a) { @@ -3227,33 +3229,6 @@ static bool trans_VREV16(DisasContext *s, arg_2misc *a) return do_2misc(s, a, gen_rev16); } -static bool trans_VCLS(DisasContext *s, arg_2misc *a) -{ - static NeonGenOneOpFn * const fn[] = { - gen_helper_neon_cls_s8, - gen_helper_neon_cls_s16, - gen_helper_neon_cls_s32, - NULL, - }; - return do_2misc(s, a, fn[a->size]); -} - -static void do_VCLZ_32(TCGv_i32 rd, TCGv_i32 rm) -{ - tcg_gen_clzi_i32(rd, rm, 32); -} - -static bool trans_VCLZ(DisasContext *s, arg_2misc *a) -{ - static NeonGenOneOpFn * const fn[] = { - gen_helper_neon_clz_u8, - gen_helper_neon_clz_u16, - do_VCLZ_32, - NULL, - }; - return do_2misc(s, a, fn[a->size]); -} - static bool trans_VCNT(DisasContext *s, arg_2misc *a) { if (a->size != 0) { From patchwork Tue Dec 10 16:17: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: 848833 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp417610wrn; Tue, 10 Dec 2024 08:22:25 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXiTgXYJZXiZu5wlBF+IfZMLvEojYy9qhqMsXjAc7+TPXJazeSyyyy5q1tcdqsvBGLrnmRLEA==@linaro.org X-Google-Smtp-Source: AGHT+IHy6ZHLrjjp/mmePVrpY9dAboJ6baRwCXTk4ukruuvmbiog/WhXMNpwozNg/3CHizeFuBYZ X-Received: by 2002:a05:6214:f62:b0:6d8:a148:9ac9 with SMTP id 6a1803df08f44-6d8e73be7c3mr293944096d6.30.1733847745232; Tue, 10 Dec 2024 08:22:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847745; cv=none; d=google.com; s=arc-20240605; b=T8YN+kKB2oCys8WNOZKux9nyDAQZdwVyWeCRh+d9X7ei2ewzBkwwroZ+zJTnMEsJv4 vWWTd8KG0G5LV9BohNUZuhMey4PCz7LoOIKQBYNrgtr3CU7KZwdp8VF9RJ19hogvG8iU CUgpJcPlO1EzQRr95A70+zeVzpA7FmwZnuW+blE+HyTAEfIfdmHOSlhD9AYeNCCGqQjL vNuX6DEdMElwa6PaYipFFq99KZm6o1uu7lPgiXhhJCY9z3kNl9RFpkXMJ6CykwfJw+ER wXF7YJDjki8+y7M0q8fYAnylHASLh2r8R1loy0N6bldEN4ZX+nJeLCrJtveuf852wXy9 2p8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=RUmkPDjfVEf4M3Y0WpkeuqJdcwozkZ699EhdgSni6SA=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=kyA/ijH+ap4TgH2/0X8dQTTBuzlIu+MlHe3g/WmOq/ciLt4NUCb11sQZtEtNLlxQPF /5UO7ifo6veQBq53/hlypfUivVpoCIzVG3eQfO6IhJ8q08EsFTkagJIB9mwfxrqs4dzy /SLphch4WglW/wfo7PaoPsFLWWLubYwhwgzspn9EIg6U93bjsNWui1x/PqyttGGmypwG ID45zAfL4HFvQvHFsR62qncRkLqMmRzt7JqZ0sffHPUnB1dy1UzWXLCvMX3AA0nabIsO nJO1Er42ZqK9ggd3B8d+yL78VT3q5IHuZG+03j8aZuce7QQWTwbr7TqC1fJGMviCSE5k oc/g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UOaQIgVp; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6e4a0bbdcsi136453985a.79.2024.12.10.08.22.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:22: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=UOaQIgVp; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2yC-0008Tt-WC; Tue, 10 Dec 2024 11:20:21 -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 1tL2y9-0008Dy-TD for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:20:18 -0500 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2y7-0006qt-NT for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:20:17 -0500 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-53df19bf6a9so6638621e87.1 for ; Tue, 10 Dec 2024 08:20:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847614; x=1734452414; 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=RUmkPDjfVEf4M3Y0WpkeuqJdcwozkZ699EhdgSni6SA=; b=UOaQIgVpiLquLsOIyKGVCOoy705NC8TefL/4sIN+3IJ0UM7+fGboeY5gkcahF43H/O +rhCMV2TKcO9zuLWmIFD6avN0OTLzfhyY4gKzjeUGEgnhT+vRclmYDzMVzzp++0p1qh4 63wy+fwoAzfRh8l6/T/+7hnt/uvQ7UEchOjB83O6+Fnfpwy2JcSfrQ5UkmRs904SOGmy G8y64GRN7R/VK3ZyuLsuQZ+14Xu3B6tI1hdjYEbBuYLrK2/YxdSP0VDhoZTblAug1j3z HIuW3DInSzR2vKuoIDa9DYNsV/hBG7GsUFru1gmAPovCkohq4f6IiSCcowWFR3Jbhuhb AlgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847614; x=1734452414; 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=RUmkPDjfVEf4M3Y0WpkeuqJdcwozkZ699EhdgSni6SA=; b=XfobpVh1D5epGbZA9o3ngfj2kFlH3udYazEAkgZvWsdSoxJ6ehAW8gy5X0zkaGK/kq OUuvHkwEH5bn3ss5hTugau741+1iENbe2e6572srWygrFkJbhUCf2almc02pEmbxYv1G iZA0Kp7Q3/G7iJwKP//lDzUt81jew0ryKKqExDv+Fnavmw8pJDpNDKuqzYEiFiV4141o IopwBIau073StqKtwA+cnr90AmvVts4l9T4F3+CRx5QcRTG2YAN7urmXJbwen+l9jGbQ KhbN6tlDDHoZpjh8Z05QiOM1SMunrtAP9HYhuTyoK6asRZyspYPSjPbKDWoqrvnaeuqx 4wWQ== X-Gm-Message-State: AOJu0YwstPmB+LgjxbcO85a672US9ubWgT+G5m7unu169/xmvIdFP5gE A5JGrD8YKhcwjbKgNXDg278PDnlFOItfJIkZe8gp1nETaisr9CCnSxgGrujFzmUhHWKYVkN2Qts d798s5H3O X-Gm-Gg: ASbGncsFoYOostbxdpGO70Z96BIpU3dbKf3K1sblpYPLjzW/3IfbEp03xrA2zeoQCf9 v3bUrEB1kZaLldO8v/k34fyGRkXIK2hmkIhSsXUd4wSzntWRalRSHS1OW3zC5G3XbJ9QhLZJ7oo 1b7xhlcrqXiXfYyEEm9BqWaK6uKlSKn/v+tNzLKlX2pM7bOyUuuwxRYBlQ8FhEu2vpumgJTX/re omeAYyMLH/kmn4keAJYoPTJuLQo8bSHMSCBtLZDRl+j2qjyPGB2E4VuniE= X-Received: by 2002:a05:6512:159a:b0:540:1e5e:3876 with SMTP id 2adb3069b0e04-5401e5e398amr3404427e87.52.1733847613943; Tue, 10 Dec 2024 08:20:13 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.20.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:20:12 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 38/69] target/arm: Convert CLS, CLZ (vector) to decodetree Date: Tue, 10 Dec 2024 10:17:02 -0600 Message-ID: <20241210161733.1830573-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::132; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x132.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 37 ++++++++++++++++------------------ target/arm/tcg/a64.decode | 2 ++ 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 77d9f6452a..bf993783ac 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8916,6 +8916,20 @@ static bool do_gvec_fn2(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) TRANS(ABS_v, do_gvec_fn2, a, tcg_gen_gvec_abs) TRANS(NEG_v, do_gvec_fn2, a, tcg_gen_gvec_neg) +static bool do_gvec_fn2_bhs(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) +{ + if (a->esz == MO_64) { + return false; + } + if (fp_access_check(s)) { + gen_gvec_fn2(s, a->q, a->rd, a->rn, fn, a->esz); + } + return true; +} + +TRANS(CLS_v, do_gvec_fn2_bhs, a, gen_gvec_cls) +TRANS(CLZ_v, do_gvec_fn2_bhs, a, gen_gvec_clz) + /* Common vector code for handling integer to FP conversion */ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, int elements, int is_signed, @@ -9215,13 +9229,6 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, TCGCond cond; switch (opcode) { - case 0x4: /* CLS, CLZ */ - if (u) { - tcg_gen_clzi_i64(tcg_rd, tcg_rn, 64); - } else { - tcg_gen_clrsb_i64(tcg_rd, tcg_rn); - } - break; case 0x5: /* NOT */ /* This opcode is shared with CNT and RBIT but we have earlier * enforced that size == 3 if and only if this is the NOT insn. @@ -9283,6 +9290,7 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, gen_helper_frint64_d(tcg_rd, tcg_rn, tcg_fpstatus); break; default: + case 0x4: /* CLS, CLZ */ case 0x7: /* SQABS, SQNEG */ case 0xb: /* ABS, NEG */ g_assert_not_reached(); @@ -10089,12 +10097,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) handle_2misc_narrow(s, false, opcode, u, is_q, size, rn, rd); return; - case 0x4: /* CLS, CLZ */ - if (size == 3) { - unallocated_encoding(s); - return; - } - break; case 0x2: /* SADDLP, UADDLP */ case 0x6: /* SADALP, UADALP */ if (size == 3) { @@ -10299,6 +10301,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } default: case 0x3: /* SUQADD, USQADD */ + case 0x4: /* CLS, CLZ */ case 0x7: /* SQABS, SQNEG */ case 0xb: /* ABS, NEG */ unallocated_encoding(s); @@ -10321,13 +10324,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } switch (opcode) { - case 0x4: /* CLZ, CLS */ - if (u) { - gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_clz, size); - } else { - gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_cls, size); - } - return; case 0x5: if (u && size == 0) { /* NOT */ gen_gvec_fn2(s, is_q, rd, rn, tcg_gen_gvec_not, 0); @@ -10351,6 +10347,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0xa: /* CMLT */ gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_clt0, size); return; + case 0x4: /* CLZ, CLS */ case 0xb: g_assert_not_reached(); } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index f112951df7..32355ee633 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1641,3 +1641,5 @@ SQABS_v 0.00 1110 ..1 00000 01111 0 ..... ..... @qrr_e SQNEG_v 0.10 1110 ..1 00000 01111 0 ..... ..... @qrr_e ABS_v 0.00 1110 ..1 00000 10111 0 ..... ..... @qrr_e NEG_v 0.10 1110 ..1 00000 10111 0 ..... ..... @qrr_e +CLS_v 0.00 1110 ..1 00000 01001 0 ..... ..... @qrr_e +CLZ_v 0.10 1110 ..1 00000 01001 0 ..... ..... @qrr_e From patchwork Tue Dec 10 16:17:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848830 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp417351wrn; Tue, 10 Dec 2024 08:21:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUARypzXKISuCzfakWtfSvwqGryGEfdze0ZMpIqKw8Z/JoWDpYb6TTE3mQUa2QgbnturtK7GA==@linaro.org X-Google-Smtp-Source: AGHT+IF/Z8IKHZJzwGoMXKIwIl7An4xCDoYe3tPjhz9j41HRdPsFSTzfkmGbvzAnMj2waLFDoBwl X-Received: by 2002:a05:622a:a08:b0:466:af35:92d5 with SMTP id d75a77b69052e-46771eea4c6mr80239261cf.25.1733847715645; Tue, 10 Dec 2024 08:21:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847715; cv=none; d=google.com; s=arc-20240605; b=kN0Ep0NE5BLKq7omTA2OiD2KwdGx5Nng+L3HBjD7Ay5E+y5lFxqwOOCvhaaMHKc5rP /0jTncCz0GvyTjef+q1LuAhLval/wOUNf3gOC6DHODQsIDlaqjCa0CbVAdQ7s57PZCye vW2tBH3m2JVni/m8OahM4e2o0PpaAsSMm4W/yscglCNgcL/4NwCeLg/p9AZIazNdmDue GlJzx20Fqr8O3mNBaBL52123pRj20UmwvYMI7yw+BdedtwPmM+x4G49pc1Oc1fWjnuWr wLVHTRqFCVul+ydrnxyc2WMeDctSFht9A0n+l4LhRhTK0xghDZnjDqfDN2DH+16dLmOh lE2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=03xpSjdU8Lg60/GRm5ycw84YKSH6ssdmmvij/MVKqHA=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=dA1co0pK5/wsCB9Dq+IKWrfZZKH1fUjRN8wmSW2mgRQ6BMHGQFRHxZi8f59ZYKtGCk JXCvq6u5uQtPFFX06WY3bHQo1EOCRv3qOhvOCsOOdUaW9uffDZi6MB4GDO5D+0jOFrd9 7A8F3dxxhrkPTA0YZcZz6CPvFXcEGWWg8zGsFXfySjm014/Ep2hauxro2RARPRVgiydu C5KA990evvOTRyxw0znq8Asf1gncTiIe2pnmxPb+ts0wEhsIG3Hpes44udNLepKpcAWg U9/2cUOzkyukSY7NpFDVfQe3F6wUU2YaPTMwhB3ueU80iKsBUfC7+F8uYovDOhZgRqpB FZOg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OLKWhDDV; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-467297fcc58si134804561cf.388.2024.12.10.08.21.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:21:55 -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=OLKWhDDV; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL2yH-0000YK-N5; Tue, 10 Dec 2024 11:20:25 -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 1tL2yD-0000Ca-Lm for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:20:21 -0500 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL2yB-0006s1-Ct for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:20:21 -0500 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-540218726d5so1891981e87.2 for ; Tue, 10 Dec 2024 08:20:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847618; x=1734452418; 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=03xpSjdU8Lg60/GRm5ycw84YKSH6ssdmmvij/MVKqHA=; b=OLKWhDDVfQAYHWUO7ikvTseWum75KRNdeinImwAaJGS8CPGhi9PRbgZhO3fMFhRwYs NKNalx9Y03vLl9V/XMv+UbFgUTcfWnUY+u7uFCQ9lF9bRwcgpCYvwgne0DTZwVNqE1DH a8mzD+tAqum79nW4LHfXNS7DNJbd/+q7j8VFI/ozT3SqrP3C+MZDpzOwXHjUQZl0VQpn 1x5gaEXmmM3mnkiBUi+npWmrOP5v3vj6Xta4yp3bH654yqmHpSY9eHLlA9S0Dg8yhwu5 6BBftAo7y3jOl+vtX6+LSVzRwX+xp9Bjeiedga9q8Q9wfPFmVbOzFEfawYQW0Ia6yEVe eV8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847618; x=1734452418; 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=03xpSjdU8Lg60/GRm5ycw84YKSH6ssdmmvij/MVKqHA=; b=E5QZb6qYeBTNsDaGxaAVEXxfRMmIPSibpCzgngRFUHOMOb9zSQpAz6aPUK7DNr0RxG AVdI/sN+jqovzCLbBCXFQPucP1uWGYL9Xh6KHtSGjVutbw6dt3q0YctfeDH9Odw7sugB DVLvzDEJZVM4+11+cwnBeed67T1d0c/8nhRMwz8losgEdb8UNPz8+oJxppF6oAUfL+iC qbidPMjVDhVGuMAiegLeo2t71v78gKt3xfRuqer0MpApwWes4YXivFMTo/TS0uEGWSb4 srIjOFHK0Tdp7jZ0MnJBcjRv55ygUnD/6Hwydzf0ihNtS8e6CuiTnj7oVZ6OIWC5j4cu hCDA== X-Gm-Message-State: AOJu0YxjmM8HcZK41nAlzIXuruCVoAQSn/1B5vipwWxu/6I9f7/grqtn 41HI2pr3hdPRj31UG6BIA+pH5nTI2o2gSbjr47ylCwvhs0AuQTJFP3g+jjfKDwiDEjOaBr/bbU/ FahyHh5xM X-Gm-Gg: ASbGnctMDWYYxMlVRj6YCLgBZ+9zkfNsANfmz34mNy14c/KHDFewI4orM29h4t4e0P5 ywvisZSzNsLRt7w1MhrkdJ0BWfQpwkbmLYnarisN+kS7ynWhu3s4QEPbSRiG/Zr5iXRSBY2NvbK tl8Jeg/ogtqmAUUeKBA3hinmtH3AumTg83xyCXsjrqKYUiMhUpPnhGMsYtTiYqYutKnHf07usLE pzVwSzltM6TWJqU//Hrs3eVIBfOy1FS2XE7ljZ3htnK84/6W2qm7cpb8MU= X-Received: by 2002:ac2:5b85:0:b0:540:2543:1b19 with SMTP id 2adb3069b0e04-54025431b7cmr1155085e87.24.1733847617635; Tue, 10 Dec 2024 08:20:17 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53f93377eefsm1026343e87.67.2024.12.10.08.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:20:17 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 39/69] target/arm: Introduce gen_gvec_cnt, gen_gvec_rbit Date: Tue, 10 Dec 2024 10:17:03 -0600 Message-ID: <20241210161733.1830573-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x131.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 Add gvec interfaces for CNT and RBIT operations. Use ctpop8 for CNT and revbit+bswap for RBIT. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.h | 4 ++-- target/arm/tcg/translate.h | 4 ++++ target/arm/tcg/gengvec.c | 16 ++++++++++++++++ target/arm/tcg/neon_helper.c | 21 --------------------- target/arm/tcg/translate-a64.c | 32 +++++++++----------------------- target/arm/tcg/translate-neon.c | 16 ++++++++-------- target/arm/tcg/vec_helper.c | 24 ++++++++++++++++++++++++ 7 files changed, 63 insertions(+), 54 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 0a697e752b..167e331a83 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -363,8 +363,8 @@ DEF_HELPER_1(neon_clz_u16, i32, i32) DEF_HELPER_1(neon_cls_s8, i32, i32) DEF_HELPER_1(neon_cls_s16, i32, i32) DEF_HELPER_1(neon_cls_s32, i32, i32) -DEF_HELPER_1(neon_cnt_u8, i32, i32) -DEF_HELPER_FLAGS_1(neon_rbit_u8, TCG_CALL_NO_RWG_SE, i32, i32) +DEF_HELPER_FLAGS_3(gvec_cnt_b, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_rbit_b, TCG_CALL_NO_RWG, void, ptr, ptr, i32) DEF_HELPER_3(neon_qdmulh_s16, i32, env, i32, i32) DEF_HELPER_3(neon_qrdmulh_s16, i32, env, i32, i32) diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index 5c6c24f057..cb8e1b2586 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -582,6 +582,10 @@ void gen_gvec_cls(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t opr_sz, uint32_t max_sz); void gen_gvec_clz(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_cnt(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_rbit(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz); /* * Forward to the isar_feature_* tests given a DisasContext pointer. diff --git a/target/arm/tcg/gengvec.c b/target/arm/tcg/gengvec.c index 834b2961c0..85a0b50496 100644 --- a/target/arm/tcg/gengvec.c +++ b/target/arm/tcg/gengvec.c @@ -2393,3 +2393,19 @@ void gen_gvec_clz(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, assert(vece <= MO_32); tcg_gen_gvec_2(rd_ofs, rn_ofs, opr_sz, max_sz, &g[vece]); } + +void gen_gvec_cnt(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz) +{ + assert(vece == MO_8); + tcg_gen_gvec_2_ool(rd_ofs, rn_ofs, opr_sz, max_sz, 0, + gen_helper_gvec_cnt_b); +} + +void gen_gvec_rbit(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz) +{ + assert(vece == MO_8); + tcg_gen_gvec_2_ool(rd_ofs, rn_ofs, opr_sz, max_sz, 0, + gen_helper_gvec_rbit_b); +} diff --git a/target/arm/tcg/neon_helper.c b/target/arm/tcg/neon_helper.c index 93b2076c64..4e501925de 100644 --- a/target/arm/tcg/neon_helper.c +++ b/target/arm/tcg/neon_helper.c @@ -525,27 +525,6 @@ uint32_t HELPER(neon_cls_s32)(uint32_t x) return count - 1; } -/* Bit count. */ -uint32_t HELPER(neon_cnt_u8)(uint32_t x) -{ - x = (x & 0x55555555) + ((x >> 1) & 0x55555555); - x = (x & 0x33333333) + ((x >> 2) & 0x33333333); - x = (x & 0x0f0f0f0f) + ((x >> 4) & 0x0f0f0f0f); - return x; -} - -/* Reverse bits in each 8 bit word */ -uint32_t HELPER(neon_rbit_u8)(uint32_t x) -{ - x = ((x & 0xf0f0f0f0) >> 4) - | ((x & 0x0f0f0f0f) << 4); - x = ((x & 0x88888888) >> 3) - | ((x & 0x44444444) >> 1) - | ((x & 0x22222222) << 1) - | ((x & 0x11111111) << 3); - return x; -} - #define NEON_QDMULH16(dest, src1, src2, round) do { \ uint32_t tmp = (int32_t)(int16_t) src1 * (int16_t) src2; \ if ((tmp ^ (tmp << 1)) & SIGNBIT) { \ diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index bf993783ac..31f1d3961d 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -10324,12 +10324,15 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } switch (opcode) { - case 0x5: - if (u && size == 0) { /* NOT */ + case 0x5: /* CNT, NOT, RBIT */ + if (!u) { + gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_cnt, 0); + } else if (size) { + gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_rbit, 0); + } else { gen_gvec_fn2(s, is_q, rd, rn, tcg_gen_gvec_not, 0); - return; } - break; + return; case 0x8: /* CMGT, CMGE */ if (u) { gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_cge0, size); @@ -10374,13 +10377,14 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } else { int pass; + assert(size == 2); for (pass = 0; pass < (is_q ? 4 : 2); pass++) { TCGv_i32 tcg_op = tcg_temp_new_i32(); TCGv_i32 tcg_res = tcg_temp_new_i32(); read_vec_element_i32(s, tcg_op, rn, pass, MO_32); - if (size == 2) { + { /* Special cases for 32 bit elements */ switch (opcode) { case 0x2f: /* FABS */ @@ -10434,25 +10438,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x7: /* SQABS, SQNEG */ g_assert_not_reached(); } - } else { - /* Use helpers for 8 and 16 bit elements */ - switch (opcode) { - case 0x5: /* CNT, RBIT */ - /* For these two insns size is part of the opcode specifier - * (handled earlier); they always operate on byte elements. - */ - if (u) { - gen_helper_neon_rbit_u8(tcg_res, tcg_op); - } else { - gen_helper_neon_cnt_u8(tcg_res, tcg_op); - } - break; - default: - case 0x7: /* SQABS, SQNEG */ - g_assert_not_reached(); - } } - write_vec_element_i32(s, tcg_res, rd, pass, MO_32); } } diff --git a/target/arm/tcg/translate-neon.c b/target/arm/tcg/translate-neon.c index 1c89a53272..50d0bf7753 100644 --- a/target/arm/tcg/translate-neon.c +++ b/target/arm/tcg/translate-neon.c @@ -3131,6 +3131,14 @@ static bool trans_VMVN(DisasContext *s, arg_2misc *a) return do_2misc_vec(s, a, tcg_gen_gvec_not); } +static bool trans_VCNT(DisasContext *s, arg_2misc *a) +{ + if (a->size != 0) { + return false; + } + return do_2misc_vec(s, a, gen_gvec_cnt); +} + #define WRAP_2M_3_OOL_FN(WRAPNAME, FUNC, DATA) \ static void WRAPNAME(unsigned vece, uint32_t rd_ofs, \ uint32_t rm_ofs, uint32_t oprsz, \ @@ -3229,14 +3237,6 @@ static bool trans_VREV16(DisasContext *s, arg_2misc *a) return do_2misc(s, a, gen_rev16); } -static bool trans_VCNT(DisasContext *s, arg_2misc *a) -{ - if (a->size != 0) { - return false; - } - return do_2misc(s, a, gen_helper_neon_cnt_u8); -} - static void gen_VABS_F(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, uint32_t oprsz, uint32_t maxsz) { diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index e825d501a2..60381258cf 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -3072,3 +3072,27 @@ DO_CLAMP(gvec_uclamp_b, uint8_t) DO_CLAMP(gvec_uclamp_h, uint16_t) DO_CLAMP(gvec_uclamp_s, uint32_t) DO_CLAMP(gvec_uclamp_d, uint64_t) + +/* Bit count in each 8-bit word. */ +void HELPER(gvec_cnt_b)(void *vd, void *vn, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc); + uint8_t *d = vd, *n = vn; + + for (i = 0; i < opr_sz; ++i) { + d[i] = ctpop8(n[i]); + } + clear_tail(d, opr_sz, simd_maxsz(desc)); +} + +/* Reverse bits in each 8 bit word */ +void HELPER(gvec_rbit_b)(void *vd, void *vn, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc); + uint64_t *d = vd, *n = vn; + + for (i = 0; i < opr_sz / 8; ++i) { + d[i] = revbit64(bswap64(n[i])); + } + clear_tail(d, opr_sz, simd_maxsz(desc)); +} From patchwork Tue Dec 10 16:17: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: 848839 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp418416wrn; Tue, 10 Dec 2024 08:23:49 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUy2ZGvRQYBjIZP2GX1Dd3PK6pbdqMOV9phOjtgxGtiFwEoR5SfligQfpkmop2yy86ki6eFmw==@linaro.org X-Google-Smtp-Source: AGHT+IH1vkjIDWQyp8x5tqAiffqLaALAlKsRsQmM1bxBqg3m2z0P8iHM2nOuy3w5ekSEeLb+rizm X-Received: by 2002:a05:6214:c82:b0:6d8:8f81:e2ea with SMTP id 6a1803df08f44-6d8e71a6756mr251654096d6.31.1733847828989; Tue, 10 Dec 2024 08:23:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847828; cv=none; d=google.com; s=arc-20240605; b=k+jJfCsGwPt5s9rP+UFcRM3PKJVwtBNMpZZFIPaWknQRKSfW9QK5JnGsDuPY4ExU+C HLCvrvN7T6Kis2xKT92gb5Cv6C2dYKL8NKbhg4YmexVYzxEL+ONr0LJvnuUZch5Njc0b mSq0Mpo3R8NCkQrEiNSfU2VeDKWQg1DQr7zOWe9d2HeKgHK954pp/JkhxKw6OpoqrqxC zjAqPofR4/ZAwPPcRCzg8mjO5pNuBTElTdJJbVSu2yI15i0eyKhL2YF4Bvj3yVHuwLYA 3NlGHxEQQfhXawLKBcm8oL5NCnFnXhap3RdlF7pQJj16k2Frl+3Usae1KSgsmKh1pVgE BUtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=9SJEXkrSGon3EHg9IFxjdqrgnXkODMT4emZTm+1wSC8=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=Khm9HDE1bt1ZwPb9Vf2DiR7CdLNZ6zsZPUWdkxNHf8OeuR7ofr4RguyRTxwWANUunL dgvnNHYKSt7ZPl3j8PGo5nh/zvx4T8Bctufq5z8Prsm/LA0iqJuXYcccM1LOEVUHAa34 YJCPsy+vv4ekxcaA6wnXnWNDOQgW6npogzO4p77x2/jYSDCtDe8TmrZnMHIxjG7DXBMf hzb3pwZdunuwWj+gN4f2ANYqbKDZ/wwWBVzEgK5XtjFzePVQ+X07o5YnFq1o9w+1CYG6 z9K4+818sjrshVfXK61BnEQUVBtvE0e5q+3ili2m3KjYFcvSnfYyJ+IC7H3T+7WrK/rY BJ5g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XMbyHTgy; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d90664eb34si82109146d6.34.2024.12.10.08.23.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:23:48 -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=XMbyHTgy; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL31R-00050t-LO; Tue, 10 Dec 2024 11:23:42 -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 1tL31G-0004gj-Av for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:23:31 -0500 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL31D-0007LE-Hm for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:23:29 -0500 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-5401be44b58so2711333e87.0 for ; Tue, 10 Dec 2024 08:23:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847806; x=1734452606; 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=9SJEXkrSGon3EHg9IFxjdqrgnXkODMT4emZTm+1wSC8=; b=XMbyHTgy6DYCjCVR5kVEySdvNLekFwxy8/+EfYnf8yh/nimNNhbiaYwVP9yMEGkJTN 3tDRtF4TZzZjeDprtnH4RXiijoHmnUpIAMoY+2W2CCEr80+BlsRGL4yyZRXdmsuWMYzw Tc+TGIiEn/z/y88wo0GSX9omdajFIqxJtcVSbDZ6nTpBxod6+f4ddSGC6x7rOHNyZk9u elnMVgh3eQSSNrcueVDsMC4l22X+E0jLgqDc5CvFLVoc4uy75C2/bcf0ApD+EzMDagQz nCrw4fTvC4ZXaG2G8WJ5YfxqOUApTEvC0mN96ujnR6JhmGEznu84rpExzOpaIQB+gxTW aU0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847806; x=1734452606; 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=9SJEXkrSGon3EHg9IFxjdqrgnXkODMT4emZTm+1wSC8=; b=ZMQmZadOWEvGRWL3TeUtJKMzrqbbBoI1O+9yPzNn4COd7zPTJePGA5ipRnlUw/fFw4 KWmQ/gX8yGoI3RqeXDlJzF2YzRjORIKIJuolJ/W6gDIaFreZj7Y6YUY6PhACDsSJt4d3 LFANIPutBkbYseXjAuUfMe+TFPxLGS2DnhqwW093+/fWY4i8gYOs5Ozlw/uRqTck7uQ9 vArs/xOH9M+bshr7qbQQkyRCaOQQ21/+Sr05GQEIA4Tm/2+4juJr0PoZItwcM4GzmDMh yREp8WrYG2SVI/8hbCK2ViCEBiT1oc7E7fhu1QdTTzZsutuHv1Vq2hl0jXPC75R6hXi2 mw5w== X-Gm-Message-State: AOJu0YwgEmaJ12AFXvLD1rpGkpCNL2zRiw2OvTVq+imBi3kURrUqgRTq O0oJN6Yji2MRIBwikwiTDKPvL1h3XdmeDbfYGMhPGgRmMnMQAeIQT60y4sL2vVCQwqUjIMagdDs pKqG//TGp X-Gm-Gg: ASbGncvhuKjtpvZahbfdCxI3HDofrw0U7bn3oAYVtlp/AGZblCTUPRcafWSOlif8nC9 mm4DoFU2wM/0l9dzfnj8gVhDU8au0gYs6til5yCNcFWCBwbfP6yeua57xeOp32CLHGdkEmOfMna s4Scncbf/iKlfXvVAhlFfYy+t5vb7kFb0JmVXQTGb4wWndcpDZNfkGiCEUvEdTz4bNbaToPlG63 PqP0wHlLfpEKa4/ZIG6Oznko3Jjiu4PtmTMMKzhHe0qOqJS3Z3xi4LFZqk= X-Received: by 2002:a05:6512:3f12:b0:540:1d37:e6e with SMTP id 2adb3069b0e04-5401d371169mr3695025e87.33.1733847805853; Tue, 10 Dec 2024 08:23:25 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.23.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:23:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 40/69] target/arm: Convert CNT, NOT, RBIT (vector) to decodetree Date: Tue, 10 Dec 2024 10:17:04 -0600 Message-ID: <20241210161733.1830573-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x136.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 34 ++++++---------------------------- target/arm/tcg/a64.decode | 4 ++++ 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 31f1d3961d..894c33ed1f 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8915,6 +8915,9 @@ static bool do_gvec_fn2(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) TRANS(ABS_v, do_gvec_fn2, a, tcg_gen_gvec_abs) TRANS(NEG_v, do_gvec_fn2, a, tcg_gen_gvec_neg) +TRANS(NOT_v, do_gvec_fn2, a, tcg_gen_gvec_not) +TRANS(CNT_v, do_gvec_fn2, a, gen_gvec_cnt) +TRANS(RBIT_v, do_gvec_fn2, a, gen_gvec_rbit) static bool do_gvec_fn2_bhs(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) { @@ -9229,12 +9232,6 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, TCGCond cond; switch (opcode) { - case 0x5: /* NOT */ - /* This opcode is shared with CNT and RBIT but we have earlier - * enforced that size == 3 if and only if this is the NOT insn. - */ - tcg_gen_not_i64(tcg_rd, tcg_rn); - break; case 0xa: /* CMLT */ cond = TCG_COND_LT; do_cmop: @@ -9291,6 +9288,7 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, break; default: case 0x4: /* CLS, CLZ */ + case 0x5: /* NOT */ case 0x7: /* SQABS, SQNEG */ case 0xb: /* ABS, NEG */ g_assert_not_reached(); @@ -10072,19 +10070,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x1: /* REV16 */ handle_rev(s, opcode, u, is_q, size, rn, rd); return; - case 0x5: /* CNT, NOT, RBIT */ - if (u && size == 0) { - /* NOT */ - break; - } else if (u && size == 1) { - /* RBIT */ - break; - } else if (!u && size == 0) { - /* CNT */ - break; - } - unallocated_encoding(s); - return; case 0x12: /* XTN, XTN2, SQXTUN, SQXTUN2 */ case 0x14: /* SQXTN, SQXTN2, UQXTN, UQXTN2 */ if (size == 3) { @@ -10302,6 +10287,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) default: case 0x3: /* SUQADD, USQADD */ case 0x4: /* CLS, CLZ */ + case 0x5: /* CNT, NOT, RBIT */ case 0x7: /* SQABS, SQNEG */ case 0xb: /* ABS, NEG */ unallocated_encoding(s); @@ -10324,15 +10310,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } switch (opcode) { - case 0x5: /* CNT, NOT, RBIT */ - if (!u) { - gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_cnt, 0); - } else if (size) { - gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_rbit, 0); - } else { - gen_gvec_fn2(s, is_q, rd, rn, tcg_gen_gvec_not, 0); - } - return; case 0x8: /* CMGT, CMGE */ if (u) { gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_cge0, size); @@ -10351,6 +10328,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_clt0, size); return; case 0x4: /* CLZ, CLS */ + case 0x5: /* CNT, NOT, RBIT */ case 0xb: g_assert_not_reached(); } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 32355ee633..bac81eec7e 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -71,6 +71,7 @@ @rrr_q1e3 ........ ... rm:5 ...... rn:5 rd:5 &qrrr_e q=1 esz=3 @rrrr_q1e3 ........ ... rm:5 . ra:5 rn:5 rd:5 &qrrrr_e q=1 esz=3 +@qrr_b . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=0 @qrr_h . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=1 @qrr_e . q:1 ...... esz:2 ...... ...... rn:5 rd:5 &qrr_e @@ -1643,3 +1644,6 @@ ABS_v 0.00 1110 ..1 00000 10111 0 ..... ..... @qrr_e NEG_v 0.10 1110 ..1 00000 10111 0 ..... ..... @qrr_e CLS_v 0.00 1110 ..1 00000 01001 0 ..... ..... @qrr_e CLZ_v 0.10 1110 ..1 00000 01001 0 ..... ..... @qrr_e +CNT_v 0.00 1110 001 00000 01011 0 ..... ..... @qrr_b +NOT_v 0.10 1110 001 00000 01011 0 ..... ..... @qrr_b +RBIT_v 0.10 1110 011 00000 01011 0 ..... ..... @qrr_b From patchwork Tue Dec 10 16:17:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848872 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp421962wrn; Tue, 10 Dec 2024 08:30:20 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX7t+FJpA0FvRk0HCQgM/wlwqsKxE0i4aa2nVC4I6PvNnSO8qtLm0nSKuN2MJFa0Ay4gSNqQA==@linaro.org X-Google-Smtp-Source: AGHT+IEMNPejVpTC5Gfqp6+xq+W8XB2rzcuAWO4ROlXsayT1WnxUu2hbSTWuG9TcmtqbI9fUdXzZ X-Received: by 2002:a05:6214:2029:b0:6d8:7ed4:336a with SMTP id 6a1803df08f44-6d8e71e8ba2mr237783536d6.31.1733848220231; Tue, 10 Dec 2024 08:30:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848220; cv=none; d=google.com; s=arc-20240605; b=EbMi/ZOhY9wSnPOG7NnAsj9ywzov98qg1UqTXuoDJ+xxArEj5CNZGEqBVCEyiFNA3d j7wsrqfrk9Z4bOiiyTVknyAH6gQcahL8a0jb3NL2HPqvvOjzFYZ67FyJOSAty4ou/FMA NCqfZxAOdpgI4eTdijPBgbQ/qFM727RkVWzRZdCq1Ht8WFxgBDsI5DRBt70nt2DdZwmb FUsUGet5if4zMfamNxzLOO1NWP6t53s8pz1Pf4V+MWkAaTlc9tg+YmaOOZw6phHjzyde xHHebyrQb36k+pXQtjkxYxluBCHA0QMigDonfVMj0j2mvUusOHJl5vVhR96DHc7mu9Io LMIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=GYWISUXxM/3Drujw1rOpjgKt5oRl+JDgu9IdrFJ+rCM=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=LAB78NmkSjmWLg+cIh/QXuuOpMCBGGg5nyqEkHIZTy9NTVry1fH1Ctsy2gGYIE8QRe EO1OG2JnkTjuIeMpV4AH4lolrpZTWrqNPzkEHCahFPbhhxsw7efpQRR5Gz2gHgI0n3jk YtuHereRI/J969TeeK83dOUk2WrrmUrhM4S6ZGaF8CaTiXXKx+SgA1dRWxfMBVRs2lIQ jwgmac5jLhf16vRJFX7U9T1v84fdcPewHIBxVYzS5Wtpv08TJZZ5LM72CGyQ3t4hFFSH 04l6OcBBupQ/XyHU/9wII7kCoh7yyeG9ip3IvDzCL44fpjkKICMqMOJTVgBR5KqeWy5X JZbA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CF94pKOj; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8daa07f46si145757006d6.181.2024.12.10.08.30.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:30:20 -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=CF94pKOj; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL31V-0005Jx-0r; Tue, 10 Dec 2024 11:23:45 -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 1tL31L-0004qT-1I for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:23:36 -0500 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL31I-0007MM-EG for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:23:34 -0500 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-5401d3ea5a1so2527209e87.3 for ; Tue, 10 Dec 2024 08:23:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847811; x=1734452611; 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=GYWISUXxM/3Drujw1rOpjgKt5oRl+JDgu9IdrFJ+rCM=; b=CF94pKOju8m6JqoD8NitpRcwOqQKFWSJzm8giSdspYZBBBRJl9z4nMH6tuKiEn7aSZ L05jItDE8c1E2AUiDlj+Tm/I2Lx3M6qpGvkzE20MU407u6KNha4m+OeL/vCQWmClQEvV 76AM+IZBqqZmCTtAYmwKKWKo5uhbW6HOx/UWP2/IgHEnawG8PbuRbL24hoYDoZ/8VOjx g02F37QfKo875tplF8VqmKum2H1Xsexhq6ZCQze6z5OeVOTZvy4VgIePeKmcrLzbEErp 7DYUYre9A5V1LNv9DBdoHmoooX4LhslfFC3my38fEXW+FTJ2dDQIEe0TUH+iHe4EpLSN 4zfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847811; x=1734452611; 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=GYWISUXxM/3Drujw1rOpjgKt5oRl+JDgu9IdrFJ+rCM=; b=UL2+n1aJWE/zybOYHYProd/DmhU1Y+X3U2k00et8Che+EqjCZZ1/jy+/8HqCezJaJ3 fn1vgDew1iKXtNS57iNs+qDr6+rYU+I4k/bDOaDeO0kLQI7Ob0kJHqRVMNm0Ec9RZKBq k6OkdbeBI/C9Mkp8tBtd9wdODu2hpSSXUD6G9mDs1pkrkQYJHuqF2Cmj76LEGxfto6rT cvJitAejkHCe7w1zuYg5CJ/BeJmiIIeztSdVgiGUi3IcG1mElhIBYBnHiXkCK3c4SzJW AdXLwsOWOn69gbf68ELtuD+M9Ztz4gfRHSbqqxYM4JNVEey/hrEhBEHeH7IX0/z5nCu9 ArrA== X-Gm-Message-State: AOJu0Ywug04x5xWI/0YTdqRiirUVMv5c3yXr+DRh+HE24JW1AseAmM4c T1Kd0IkGWXprYlFMQBXdb2ju5Cb8aAEoR6wVQS8sCpdz6Lm0nfLOQwgmWtRj1FlrMGdcekTkVrV FB70V4s3V X-Gm-Gg: ASbGncv7JBN6jaC9Fl0msrBU90KlbN26Jak6UI0NvdsTSLkZeXDmovAxZGOVd8R9/Kt DyjnFo3tBekZocrpe4QZErH6Cf/O05PrVuyd7GUPBu11flKnbvuK6QDBnoIPkRsjHR7qDsv/EgQ Wqr1p+FtBWrD8DMGc71/Wwe5A9FkwAVyDQpLh41nxS/nzcBPU/kRM0wW9ptDraK1A9n4GlB/4OD 0vkDugv/80l6SClkEyUfpaWcd/9XJku3sVTNa6wXcHgRb6/Z+N40AjwZgw= X-Received: by 2002:a05:6512:3da3:b0:53e:350a:7298 with SMTP id 2adb3069b0e04-540240d2de6mr1384800e87.25.1733847810812; Tue, 10 Dec 2024 08:23:30 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.23.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:23:29 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 41/69] target/arm: Convert CMGT, CMGE, GMLT, GMLE, CMEQ (zero) to decodetree Date: Tue, 10 Dec 2024 10:17:05 -0600 Message-ID: <20241210161733.1830573-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12f.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 94 +++++++++++----------------------- target/arm/tcg/a64.decode | 10 ++++ 2 files changed, 40 insertions(+), 64 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 894c33ed1f..c737a35121 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8902,6 +8902,22 @@ static bool do_scalar1_d(DisasContext *s, arg_rr *a, ArithOneOp *f) TRANS(ABS_s, do_scalar1_d, a, tcg_gen_abs_i64) TRANS(NEG_s, do_scalar1_d, a, tcg_gen_neg_i64) +static bool do_cmop0_d(DisasContext *s, arg_rr *a, TCGCond cond) +{ + if (fp_access_check(s)) { + TCGv_i64 t = read_fp_dreg(s, a->rn); + tcg_gen_negsetcond_i64(cond, t, t, tcg_constant_i64(0)); + write_fp_dreg(s, a->rd, t); + } + return true; +} + +TRANS(CMGT0_s, do_cmop0_d, a, TCG_COND_GT) +TRANS(CMGE0_s, do_cmop0_d, a, TCG_COND_GE) +TRANS(CMLE0_s, do_cmop0_d, a, TCG_COND_LE) +TRANS(CMLT0_s, do_cmop0_d, a, TCG_COND_LT) +TRANS(CMEQ0_s, do_cmop0_d, a, TCG_COND_EQ) + static bool do_gvec_fn2(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) { if (!a->q && a->esz == MO_64) { @@ -8918,6 +8934,11 @@ TRANS(NEG_v, do_gvec_fn2, a, tcg_gen_gvec_neg) TRANS(NOT_v, do_gvec_fn2, a, tcg_gen_gvec_not) TRANS(CNT_v, do_gvec_fn2, a, gen_gvec_cnt) TRANS(RBIT_v, do_gvec_fn2, a, gen_gvec_rbit) +TRANS(CMGT0_v, do_gvec_fn2, a, gen_gvec_cgt0) +TRANS(CMGE0_v, do_gvec_fn2, a, gen_gvec_cge0) +TRANS(CMLT0_v, do_gvec_fn2, a, gen_gvec_clt0) +TRANS(CMLE0_v, do_gvec_fn2, a, gen_gvec_cle0) +TRANS(CMEQ0_v, do_gvec_fn2, a, gen_gvec_ceq0) static bool do_gvec_fn2_bhs(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) { @@ -9229,21 +9250,7 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, * The caller only need provide tcg_rmode and tcg_fpstatus if the op * requires them. */ - TCGCond cond; - switch (opcode) { - case 0xa: /* CMLT */ - cond = TCG_COND_LT; - do_cmop: - /* 64 bit integer comparison against zero, result is test ? -1 : 0. */ - tcg_gen_negsetcond_i64(cond, tcg_rd, tcg_rn, tcg_constant_i64(0)); - break; - case 0x8: /* CMGT, CMGE */ - cond = u ? TCG_COND_GE : TCG_COND_GT; - goto do_cmop; - case 0x9: /* CMEQ, CMLE */ - cond = u ? TCG_COND_LE : TCG_COND_EQ; - goto do_cmop; case 0x2f: /* FABS */ gen_vfp_absd(tcg_rd, tcg_rn); break; @@ -9290,6 +9297,9 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, case 0x4: /* CLS, CLZ */ case 0x5: /* NOT */ case 0x7: /* SQABS, SQNEG */ + case 0x8: /* CMGT, CMGE */ + case 0x9: /* CMEQ, CMLE */ + case 0xa: /* CMLT */ case 0xb: /* ABS, NEG */ g_assert_not_reached(); } @@ -9633,19 +9643,6 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) TCGv_ptr tcg_fpstatus; switch (opcode) { - case 0xa: /* CMLT */ - if (u) { - unallocated_encoding(s); - return; - } - /* fall through */ - case 0x8: /* CMGT, CMGE */ - case 0x9: /* CMEQ, CMLE */ - if (size != 3) { - unallocated_encoding(s); - return; - } - break; case 0x12: /* SQXTUN */ if (!u) { unallocated_encoding(s); @@ -9731,6 +9728,9 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) default: case 0x3: /* USQADD / SUQADD */ case 0x7: /* SQABS / SQNEG */ + case 0x8: /* CMGT, CMGE */ + case 0x9: /* CMEQ, CMLE */ + case 0xa: /* CMLT */ case 0xb: /* ABS, NEG */ unallocated_encoding(s); return; @@ -10103,19 +10103,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } handle_shll(s, is_q, size, rn, rd); return; - case 0xa: /* CMLT */ - if (u == 1) { - unallocated_encoding(s); - return; - } - /* fall through */ - case 0x8: /* CMGT, CMGE */ - case 0x9: /* CMEQ, CMLE */ - if (size == 3 && !is_q) { - unallocated_encoding(s); - return; - } - break; case 0xc ... 0xf: case 0x16 ... 0x1f: { @@ -10289,6 +10276,9 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x4: /* CLS, CLZ */ case 0x5: /* CNT, NOT, RBIT */ case 0x7: /* SQABS, SQNEG */ + case 0x8: /* CMGT, CMGE */ + case 0x9: /* CMEQ, CMLE */ + case 0xa: /* CMLT */ case 0xb: /* ABS, NEG */ unallocated_encoding(s); return; @@ -10309,30 +10299,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) tcg_rmode = NULL; } - switch (opcode) { - case 0x8: /* CMGT, CMGE */ - if (u) { - gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_cge0, size); - } else { - gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_cgt0, size); - } - return; - case 0x9: /* CMEQ, CMLE */ - if (u) { - gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_cle0, size); - } else { - gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_ceq0, size); - } - return; - case 0xa: /* CMLT */ - gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_clt0, size); - return; - case 0x4: /* CLZ, CLS */ - case 0x5: /* CNT, NOT, RBIT */ - case 0xb: - g_assert_not_reached(); - } - if (size == 3) { /* All 64-bit element operations can be shared with scalar 2misc */ int pass; diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index bac81eec7e..247d3a7bda 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1635,6 +1635,11 @@ SQABS_s 0101 1110 ..1 00000 01111 0 ..... ..... @rr_e SQNEG_s 0111 1110 ..1 00000 01111 0 ..... ..... @rr_e ABS_s 0101 1110 111 00000 10111 0 ..... ..... @rr NEG_s 0111 1110 111 00000 10111 0 ..... ..... @rr +CMGT0_s 0101 1110 111 00000 10001 0 ..... ..... @rr +CMGE0_s 0111 1110 111 00000 10001 0 ..... ..... @rr +CMEQ0_s 0101 1110 111 00000 10011 0 ..... ..... @rr +CMLE0_s 0111 1110 111 00000 10011 0 ..... ..... @rr +CMLT0_s 0101 1110 111 00000 10101 0 ..... ..... @rr # Advanced SIMD two-register miscellaneous @@ -1647,3 +1652,8 @@ CLZ_v 0.10 1110 ..1 00000 01001 0 ..... ..... @qrr_e CNT_v 0.00 1110 001 00000 01011 0 ..... ..... @qrr_b NOT_v 0.10 1110 001 00000 01011 0 ..... ..... @qrr_b RBIT_v 0.10 1110 011 00000 01011 0 ..... ..... @qrr_b +CMGT0_v 0.00 1110 ..1 00000 10001 0 ..... ..... @qrr_e +CMGE0_v 0.10 1110 ..1 00000 10001 0 ..... ..... @qrr_e +CMEQ0_v 0.00 1110 ..1 00000 10011 0 ..... ..... @qrr_e +CMLE0_v 0.10 1110 ..1 00000 10011 0 ..... ..... @qrr_e +CMLT0_v 0.00 1110 ..1 00000 10101 0 ..... ..... @qrr_e From patchwork Tue Dec 10 16:17:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848844 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp419060wrn; Tue, 10 Dec 2024 08:24:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWgZxg/mnM6ZqgqeEGsIPEdYV0hphyBZy546ROyUzeq0cth1hiLxwKKLjClJR2ycVTPQQy9Mw==@linaro.org X-Google-Smtp-Source: AGHT+IGBfSSFUe6NDbezVtl/F8R7LUm0is7Ylw1QYgorwKQV5tB1VtVrSHh8K4OtlpMQVD7eycEx X-Received: by 2002:a05:6102:b0b:b0:4af:f275:e747 with SMTP id ada2fe7eead31-4b1161cd149mr5984690137.22.1733847896818; Tue, 10 Dec 2024 08:24:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847896; cv=none; d=google.com; s=arc-20240605; b=iNnPYXqeSVZ1KUsJM3RiRPP6uEKkyOoO9rf0phBAz2byPAEUjps0fyjkHAcuE1rVY3 ASPt2dkctoGjQ+THKAt1ir0tBufh1byQ8Y2synj3zQQaSYMFtg2fMkRMmgQOHtJhlilO QpH+SJHUFW/9rDWbWKUVgQIH4ApB0MaEemQrpjsst4eZScb6a81HO9nNUPgDmMxVNDbz T8gtxnFg62IUDflC906ozcaMT7qRk3B9XZm6DNXGM18UMSBuBC/yrK/ltlv7Fjsr5tGT LHkXkKMK9cstGoC+bqRByYlh8WN99q+ANqL889nq8HE0iW87plRgHxt6PD5hSG4J9l8Y D6Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=NjJ6yNZWB0Ib9R3vyjGZylRzzND6ZWaBRLDVA9KvYvo=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=FzhHHKIZOxsi/Gd7eS8BiUBP5dPh1qSzquvzCTrC00O9BW7PFp7IOEdFdUtz6NQvNv 5N6pmOduSYkoCggCNPe+XqkTuTUMCeaf//FaDFi9Me7UlC92Js2DFcaX9OgJ9CF3mpde eHHYtVr5T/1/gUml6ACNSUyiDaqzhmk3x28kgbr9sMIFpgZntOE60OEboX5kAJYw2Z3c 1WMvbrAky57Ls6LJmAY8XelMy9prQFVjwJr6G1s3N8kF9rUAIcVtqGQQRLB6jFhf9Snx ndY7a6xdqaRaGLQq5iqJYklWF8wx/BqaKUQNW6WUURJX8yFIBocwlM/76Hto9fWFFCyJ JcbQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lWNEBztZ; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4b11198f77fsi926438137.78.2024.12.10.08.24.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:24:56 -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=lWNEBztZ; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL31b-00060Q-Jd; Tue, 10 Dec 2024 11:23:51 -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 1tL31O-0004zs-7U for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:23:39 -0500 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL31M-0007N1-CV for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:23:37 -0500 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-3022598e213so20344981fa.0 for ; Tue, 10 Dec 2024 08:23:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847815; x=1734452615; 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=NjJ6yNZWB0Ib9R3vyjGZylRzzND6ZWaBRLDVA9KvYvo=; b=lWNEBztZYLCb64kyI/v+XzOtegyvsbRJLza3YPV0hCZfA7ATrjPO+3+EWrSzutgJET tTAwPX6RI3RJCR/kTYhuy90FjchU66iGyndfR6uwgDS2/DZiQaeiILDZ4s8OU3FpMQub oRA6//5sqjSOCbx+Gm1IFWfUINAtnCp+yM9UxVK6fv0OH/cn5G+J+N08BnJboJAgb4dr 9g3Y7uQHwI9TR5aoNcX0ywbgH+6z6HHBWO4me5S5ug31+PFJhzBe7sEqkI3fGzOR4gkg s6gNlMyTKoOOy/momY2PJFNqt22v9MbAH/nsR2+4dr/9ogZ1a+DuDV7xRb/J5U/TzOKS r7Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847815; x=1734452615; 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=NjJ6yNZWB0Ib9R3vyjGZylRzzND6ZWaBRLDVA9KvYvo=; b=Q67TquWuw0VJMOfLd++g1qekrX7CRGF4OHuxMoI0cbnCOE47UZPgZGqjmYYjJqfG5b SnjslTPOJ2eTf4D0H2+k1CSObx8NeNuxgFXSirLoYcbUbXAlh8r/SaTn37EsAi2sTObD qHJdy9aAlOk10UitvBu717iW/D4ZrMje7tGkWcHMmN6YhSytFRzveBPn/GFTwpXxRyH8 XntgWkm8eN9MwgPmMR+OckYhm3JbiRv5BLS2vdEdFVH8iy93qOc0EkJaHOjcAB8zF1lk 6Aw1Z/ouvhQCKMgEx0RgBlD9ztlCn1Yz7tSsj0mkZ1xVagwjJGqLh+9D1xXTYJ9QyO56 5ZpQ== X-Gm-Message-State: AOJu0YwUJweDDHUFxl59U6wcavRm19cg+dwLplo3sfaFahpttu0uB3az EL8HY+R01tGpXUHKxkf3uaqFt2hqXPXi8mWM3J9H0GvkzZIhZjfBjWJYWD5NpIHMjqSXUDGQnmS BpdIKlExP X-Gm-Gg: ASbGnctPAnPCyxEjAaDUMaXlrIsy7yOug6mzFVpSnCZA9FHFcX1g2nh8aj576gyHCUs n80Y+D+QjImiX9SciFt5jRxfxzkXXnYUBEEHM1PEKIlH5fNYvC17wO/62g4E3rYIDzDVHBnziOw T8p5rkOiy1iJTNBc3WqcURjrDVUQG80G1peSz69ylKUpKJJ+5orpCvBefjRj+vUPtYgN+Wl0Z5n JuZqLK78XIg2nOuHvZuDUp1ljB/xJtKFXLaASzT7q/imGAtRdPyvtjL1o4= X-Received: by 2002:a05:6512:4022:b0:53d:ed4e:e5af with SMTP id 2adb3069b0e04-540240d3308mr1820561e87.33.1733847814694; Tue, 10 Dec 2024 08:23:34 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.23.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:23:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 42/69] target/arm: Introduce gen_gvec_rev{16,32,64} Date: Tue, 10 Dec 2024 10:17:06 -0600 Message-ID: <20241210161733.1830573-43-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::230; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x230.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate.h | 6 +++ target/arm/tcg/gengvec.c | 58 ++++++++++++++++++++++ target/arm/tcg/translate-neon.c | 88 +++++++-------------------------- 3 files changed, 81 insertions(+), 71 deletions(-) diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index cb8e1b2586..342ebedafc 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -586,6 +586,12 @@ void gen_gvec_cnt(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t opr_sz, uint32_t max_sz); void gen_gvec_rbit(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_rev16(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_rev32(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_rev64(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz); /* * Forward to the isar_feature_* tests given a DisasContext pointer. diff --git a/target/arm/tcg/gengvec.c b/target/arm/tcg/gengvec.c index 85a0b50496..33c0a94958 100644 --- a/target/arm/tcg/gengvec.c +++ b/target/arm/tcg/gengvec.c @@ -2409,3 +2409,61 @@ void gen_gvec_rbit(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, tcg_gen_gvec_2_ool(rd_ofs, rn_ofs, opr_sz, max_sz, 0, gen_helper_gvec_rbit_b); } + +void gen_gvec_rev16(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz) +{ + assert(vece == MO_8); + tcg_gen_gvec_rotli(MO_16, rd_ofs, rn_ofs, 8, opr_sz, max_sz); +} + +static void gen_bswap32_i64(TCGv_i64 d, TCGv_i64 n) +{ + tcg_gen_bswap64_i64(d, n); + tcg_gen_rotli_i64(d, d, 32); +} + +void gen_gvec_rev32(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz) +{ + static const GVecGen2 g = { + .fni8 = gen_bswap32_i64, + .fni4 = tcg_gen_bswap32_i32, + .prefer_i64 = TCG_TARGET_REG_BITS == 64, + .vece = MO_32 + }; + + switch (vece) { + case MO_16: + tcg_gen_gvec_rotli(MO_32, rd_ofs, rn_ofs, 16, opr_sz, max_sz); + break; + case MO_8: + tcg_gen_gvec_2(rd_ofs, rn_ofs, opr_sz, max_sz, &g); + break; + default: + g_assert_not_reached(); + } +} + +void gen_gvec_rev64(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz) +{ + static const GVecGen2 g[] = { + { .fni8 = tcg_gen_bswap64_i64, + .vece = MO_64 }, + { .fni8 = tcg_gen_hswap_i64, + .vece = MO_64 }, + }; + + switch (vece) { + case MO_32: + tcg_gen_gvec_rotli(MO_64, rd_ofs, rn_ofs, 32, opr_sz, max_sz); + break; + case MO_8: + case MO_16: + tcg_gen_gvec_2(rd_ofs, rn_ofs, opr_sz, max_sz, &g[vece]); + break; + default: + g_assert_not_reached(); + } +} diff --git a/target/arm/tcg/translate-neon.c b/target/arm/tcg/translate-neon.c index 50d0bf7753..ca6f5578b4 100644 --- a/target/arm/tcg/translate-neon.c +++ b/target/arm/tcg/translate-neon.c @@ -2565,58 +2565,6 @@ static bool trans_VDUP_scalar(DisasContext *s, arg_VDUP_scalar *a) return true; } -static bool trans_VREV64(DisasContext *s, arg_VREV64 *a) -{ - int pass, half; - TCGv_i32 tmp[2]; - - if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { - return false; - } - - /* UNDEF accesses to D16-D31 if they don't exist. */ - if (!dc_isar_feature(aa32_simd_r32, s) && - ((a->vd | a->vm) & 0x10)) { - return false; - } - - if ((a->vd | a->vm) & a->q) { - return false; - } - - if (a->size == 3) { - return false; - } - - if (!vfp_access_check(s)) { - return true; - } - - tmp[0] = tcg_temp_new_i32(); - tmp[1] = tcg_temp_new_i32(); - - for (pass = 0; pass < (a->q ? 2 : 1); pass++) { - for (half = 0; half < 2; half++) { - read_neon_element32(tmp[half], a->vm, pass * 2 + half, MO_32); - switch (a->size) { - case 0: - tcg_gen_bswap32_i32(tmp[half], tmp[half]); - break; - case 1: - gen_swap_half(tmp[half], tmp[half]); - break; - case 2: - break; - default: - g_assert_not_reached(); - } - } - write_neon_element32(tmp[1], a->vd, pass * 2, MO_32); - write_neon_element32(tmp[0], a->vd, pass * 2 + 1, MO_32); - } - return true; -} - static bool do_2misc_pairwise(DisasContext *s, arg_2misc *a, NeonGenWidenFn *widenfn, NeonGenTwo64OpFn *opfn, @@ -3122,6 +3070,7 @@ DO_2MISC_VEC(VCGE0, gen_gvec_cge0) DO_2MISC_VEC(VCLT0, gen_gvec_clt0) DO_2MISC_VEC(VCLS, gen_gvec_cls) DO_2MISC_VEC(VCLZ, gen_gvec_clz) +DO_2MISC_VEC(VREV64, gen_gvec_rev64) static bool trans_VMVN(DisasContext *s, arg_2misc *a) { @@ -3139,6 +3088,22 @@ static bool trans_VCNT(DisasContext *s, arg_2misc *a) return do_2misc_vec(s, a, gen_gvec_cnt); } +static bool trans_VREV16(DisasContext *s, arg_2misc *a) +{ + if (a->size != 0) { + return false; + } + return do_2misc_vec(s, a, gen_gvec_rev16); +} + +static bool trans_VREV32(DisasContext *s, arg_2misc *a) +{ + if (a->size != 0 && a->size != 1) { + return false; + } + return do_2misc_vec(s, a, gen_gvec_rev32); +} + #define WRAP_2M_3_OOL_FN(WRAPNAME, FUNC, DATA) \ static void WRAPNAME(unsigned vece, uint32_t rd_ofs, \ uint32_t rm_ofs, uint32_t oprsz, \ @@ -3218,25 +3183,6 @@ static bool do_2misc(DisasContext *s, arg_2misc *a, NeonGenOneOpFn *fn) return true; } -static bool trans_VREV32(DisasContext *s, arg_2misc *a) -{ - static NeonGenOneOpFn * const fn[] = { - tcg_gen_bswap32_i32, - gen_swap_half, - NULL, - NULL, - }; - return do_2misc(s, a, fn[a->size]); -} - -static bool trans_VREV16(DisasContext *s, arg_2misc *a) -{ - if (a->size != 0) { - return false; - } - return do_2misc(s, a, gen_rev16); -} - static void gen_VABS_F(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, uint32_t oprsz, uint32_t maxsz) { From patchwork Tue Dec 10 16:17:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848849 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp419746wrn; Tue, 10 Dec 2024 08:26:13 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXKB4wkVRTTtAUgInietiZfbx9FzEBUumMXFDvFH7Xl+xK38lfUx9J3B8evr5mv/WbwiwYLxg==@linaro.org X-Google-Smtp-Source: AGHT+IEsX52peam1UC3RwvtlzdIlcLnn02kvreUW2mJZFYbUD6s5lE0O46yXOXSYyFwKx9eIzW0W X-Received: by 2002:a05:6102:441c:b0:4b0:49ba:8278 with SMTP id ada2fe7eead31-4b11627880amr5585163137.25.1733847973604; Tue, 10 Dec 2024 08:26:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847973; cv=none; d=google.com; s=arc-20240605; b=MPes7dFcas8VCBnEad7PvageGKnMWZr4W1ZXUlBhc1Lhbwazus6XPy7Tt2J/4cNIUJ /kf1dkFvi658qljF5pKrrXwokDDW6t+0jGtMpIW74hAM4xiaQO56YYLI00kFXLMZ+L9L yzgASofK6geEMFR5TWHW+5nBXTQy8Y87ZfLHP4Ah+ZQnK8H69sIHbsv2dYuKOoTc61sH 73rDAlPgBnN9m/t2XuRSIqfGjPD8aXc68pWfcL6BKWWTawdZnTwFTAj9mRyt69Ri0NFs 3tHmd8D64nRqOb73fETS/YiTMui9SZg6+4zGRxQ8XKYUo7pZva+WZEDWRpi9IJEhTFXM NuZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=IE8JGMQCGp7GAj77eQk0VVYvmtYbR6TxiLKDi8J590s=; fh=9Ev+QBUhk6P6vR3LT1wYeDLexozsz44nqjfoyPajZCc=; b=EoXu5W7iRfZIZixd5wIcMu7IzNFOhc9u/YqmdVC71Gob0OyhjiOMryRHh3BXRZfGCP tmiG7r48sLM0VUrpL5s+WvcgDqjF830pohrmbcjiIGFCmR8XVgUDeJ8nc9/1Hj7Hi8u5 Xow8j3jqjzijLQNuqg2WwMqqeu04jr944Awawuy6vL9Vku4LMCYXdvHWMrBeR/MELKh1 Xldn4uMmdPNMNfxdj0xnLCkqG3KMR/5NJQgXNIQQD3m30S02Hm95E4e0sn8RFfmezO+j DYur3fCUjotty8ob8ivXzdMRI3dMiETtnqzcvU7SlwRFn4AtElapS4CFTXzfnx8Ug0cV VVKQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xkP+yKhL; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4afe3d9675bsi1613121137.435.2024.12.10.08.26.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:26:13 -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=xkP+yKhL; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL31c-00065w-Oj; Tue, 10 Dec 2024 11:23:53 -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 1tL31T-0005B0-4j for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:23:43 -0500 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL31Q-0007Nl-9P for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:23:42 -0500 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-53e399e3310so3735554e87.1 for ; Tue, 10 Dec 2024 08:23:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847818; x=1734452618; 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=IE8JGMQCGp7GAj77eQk0VVYvmtYbR6TxiLKDi8J590s=; b=xkP+yKhL5NnP2qPchCyM5P/8prgwb/5ZIoZLMoi/gKbAmeLCAQb7P3GwAc6h1xaxuZ iVqvApLcxHLKt2IqJeu5bILU1FrJLo8TJNnZsGsPu8JwgPXrTSrns0QBdwgecJb0w8+P C8Z1P9GW63fgw667Kc2zRLs4v5OZ6aY2ZzGVgV5Qt9Y8bnbJgkw9Gzct90zFn4GhKzFC 0AnKokc+ghHA0R6dyNVWynHO4uVtHbF+jLIJbGMteSt1jWPG7NrjM27ZiqHMbrhGlcQM 7QETOlJUOo4qEAW4r93Fj7d5bhsnSwzyCt+oqS9upFkK3auLrpwwjz7U8mhitnXmDhz1 Z3oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847818; x=1734452618; 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=IE8JGMQCGp7GAj77eQk0VVYvmtYbR6TxiLKDi8J590s=; b=lyq8lFMGdMs9SCk8LYHIj7LGK8QQ7VR73hb9LC95oUbOsEaKGX4ZKDMmlqxP9Sd6Nq JeDJbV/GJrikOXekUU4CFDqGi0uIM+BWWz3T2+hxBXS7vQXs8YhjDgZuxPEE1qrYfyqk 165JATZbYaracgJMuQbPp6uSgQE3oHnyIxENf7BmmQcBD03tX8AnL6cUh1BdGn3DduAK hwscn7SA7ITxlPh101efh6qBzzbQn8hqahEv2uh+6ymkEHEsJ/txhorg+R7YXd65Kb6u ShQi8K2Qm/zLGdeAJmKQQFSWBpIRN1vznTy910fjJB3E5o1L9gXSlXK9hQqqc/a4olL6 GFag== X-Gm-Message-State: AOJu0YyylapIsmQg7Ku5JjJkoQRzkUX0Mxj2rp2n6xIUTP8BAovkrzWj ZNsHK+2dUNPVMpaEE87xA40DltH0zmhCUQfhmcIfp4RCa/zrzQ2HUlapJTw2GyCrEKucbVuA1DO W3R206Vbd X-Gm-Gg: ASbGncvmZrxfNO9EURNzK3Fq+wTolZKgvsbg4qCpfxRjjihXZT6KXY4emjocensM7TO lq8TSJwgF7KFVc0ZtJzGAZBGLfNJNnWqIlPpj8YMr0/NM1XkVcp4BPLTpsqmQN4mV549QAQ4i8q aQaFPM4DksM+2ziMkHQhzbvuDlrQIpHkWVjeaou65O91Qha3WCa9r5tz6UpMnm9ns/PuhKAOp/B 1hVI3/r1FmgFiStR2AjCKc+BYhFWdOCUAK1cZ6sJOnS9ach2hQwG3V0tCY= X-Received: by 2002:a05:6512:3e2a:b0:53e:39e6:a1c2 with SMTP id 2adb3069b0e04-53e39e6a2e7mr6342125e87.44.1733847818349; Tue, 10 Dec 2024 08:23:38 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.23.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:23:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 43/69] target/arm: Convert handle_rev to decodetree Date: Tue, 10 Dec 2024 10:17:07 -0600 Message-ID: <20241210161733.1830573-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12e.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 This includes REV16, REV32, REV64. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 79 +++------------------------------- target/arm/tcg/a64.decode | 5 +++ 2 files changed, 10 insertions(+), 74 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index c737a35121..9ce58586a8 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8939,6 +8939,8 @@ TRANS(CMGE0_v, do_gvec_fn2, a, gen_gvec_cge0) TRANS(CMLT0_v, do_gvec_fn2, a, gen_gvec_clt0) TRANS(CMLE0_v, do_gvec_fn2, a, gen_gvec_cle0) TRANS(CMEQ0_v, do_gvec_fn2, a, gen_gvec_ceq0) +TRANS(REV16_v, do_gvec_fn2, a, gen_gvec_rev16) +TRANS(REV32_v, do_gvec_fn2, a, gen_gvec_rev32) static bool do_gvec_fn2_bhs(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) { @@ -8953,6 +8955,7 @@ static bool do_gvec_fn2_bhs(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) TRANS(CLS_v, do_gvec_fn2_bhs, a, gen_gvec_cls) TRANS(CLZ_v, do_gvec_fn2_bhs, a, gen_gvec_clz) +TRANS(REV64_v, do_gvec_fn2_bhs, a, gen_gvec_rev64) /* Common vector code for handling integer to FP conversion */ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, @@ -9882,76 +9885,6 @@ static void handle_2misc_widening(DisasContext *s, int opcode, bool is_q, } } -static void handle_rev(DisasContext *s, int opcode, bool u, - bool is_q, int size, int rn, int rd) -{ - int op = (opcode << 1) | u; - int opsz = op + size; - int grp_size = 3 - opsz; - int dsize = is_q ? 128 : 64; - int i; - - if (opsz >= 3) { - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - if (size == 0) { - /* Special case bytes, use bswap op on each group of elements */ - int groups = dsize / (8 << grp_size); - - for (i = 0; i < groups; i++) { - TCGv_i64 tcg_tmp = tcg_temp_new_i64(); - - read_vec_element(s, tcg_tmp, rn, i, grp_size); - switch (grp_size) { - case MO_16: - tcg_gen_bswap16_i64(tcg_tmp, tcg_tmp, TCG_BSWAP_IZ); - break; - case MO_32: - tcg_gen_bswap32_i64(tcg_tmp, tcg_tmp, TCG_BSWAP_IZ); - break; - case MO_64: - tcg_gen_bswap64_i64(tcg_tmp, tcg_tmp); - break; - default: - g_assert_not_reached(); - } - write_vec_element(s, tcg_tmp, rd, i, grp_size); - } - clear_vec_high(s, is_q, rd); - } else { - int revmask = (1 << grp_size) - 1; - int esize = 8 << size; - int elements = dsize / esize; - TCGv_i64 tcg_rn = tcg_temp_new_i64(); - TCGv_i64 tcg_rd[2]; - - for (i = 0; i < 2; i++) { - tcg_rd[i] = tcg_temp_new_i64(); - tcg_gen_movi_i64(tcg_rd[i], 0); - } - - for (i = 0; i < elements; i++) { - int e_rev = (i & 0xf) ^ revmask; - int w = (e_rev * esize) / 64; - int o = (e_rev * esize) % 64; - - read_vec_element(s, tcg_rn, rn, i, size); - tcg_gen_deposit_i64(tcg_rd[w], tcg_rd[w], tcg_rn, o, esize); - } - - for (i = 0; i < 2; i++) { - write_vec_element(s, tcg_rd[i], rd, i, MO_64); - } - clear_vec_high(s, true, rd); - } -} - static void handle_2misc_pairwise(DisasContext *s, int opcode, bool u, bool is_q, int size, int rn, int rd) { @@ -10066,10 +9999,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) TCGv_ptr tcg_fpstatus; switch (opcode) { - case 0x0: /* REV64, REV32 */ - case 0x1: /* REV16 */ - handle_rev(s, opcode, u, is_q, size, rn, rd); - return; case 0x12: /* XTN, XTN2, SQXTUN, SQXTUN2 */ case 0x14: /* SQXTN, SQXTN2, UQXTN, UQXTN2 */ if (size == 3) { @@ -10272,6 +10201,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) break; } default: + case 0x0: /* REV64, REV32 */ + case 0x1: /* REV16 */ case 0x3: /* SUQADD, USQADD */ case 0x4: /* CLS, CLZ */ case 0x5: /* CNT, NOT, RBIT */ diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 247d3a7bda..05f1bc99b5 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -73,6 +73,7 @@ @qrr_b . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=0 @qrr_h . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=1 +@qrr_bh . q:1 ...... . esz:1 ...... ...... rn:5 rd:5 &qrr_e @qrr_e . q:1 ...... esz:2 ...... ...... rn:5 rd:5 &qrr_e @qrrr_b . q:1 ...... ... rm:5 ...... rn:5 rd:5 &qrrr_e esz=0 @@ -1657,3 +1658,7 @@ CMGE0_v 0.10 1110 ..1 00000 10001 0 ..... ..... @qrr_e CMEQ0_v 0.00 1110 ..1 00000 10011 0 ..... ..... @qrr_e CMLE0_v 0.10 1110 ..1 00000 10011 0 ..... ..... @qrr_e CMLT0_v 0.00 1110 ..1 00000 10101 0 ..... ..... @qrr_e + +REV16_v 0.00 1110 001 00000 00011 0 ..... ..... @qrr_b +REV32_v 0.10 1110 0.1 00000 00001 0 ..... ..... @qrr_bh +REV64_v 0.00 1110 ..1 00000 00001 0 ..... ..... @qrr_e From patchwork Tue Dec 10 16:17:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848842 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp418679wrn; Tue, 10 Dec 2024 08:24:16 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW6IvVai/Jvh7yXWLSjJwpZwYiVlf58pTk+scVFEUpGx1tsh24UIwQHv0DVd3G+pmPuWMY79g==@linaro.org X-Google-Smtp-Source: AGHT+IGz9jB03AHXVneDQitKf6NNvhY9PFm891AXXJzs8ph9NSdKkEffAYUyuza3Q1VmkR8MaYAq X-Received: by 2002:ad4:5ec8:0:b0:6d8:a48e:a027 with SMTP id 6a1803df08f44-6d91e3472c1mr91451706d6.2.1733847856466; Tue, 10 Dec 2024 08:24:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847856; cv=none; d=google.com; s=arc-20240605; b=Y/pj15OVSsVh9uAzpMiE/r+xeKv1B2Y2FyUcq2MvtoWQHuTWiOk/kS6IXy6hliW24R +14hBbcYuab+/WdSSSZ32tCRuADdvb8IZDAK1Ebg/ctD37NMD8jsXnkVCkuyloP/33iY F+eF+36GgbbbkUeaos3be44+nBqBbHSYO4RWN1z5zMcei5r/HWTCTWT8zEu30QgQ+SB8 IkbSadSS4LDce9eqTMVX/IvyXung02MdSvSczjfCltzmr36JKlCJVIr1MjmqAEBH1T0N MtVNmMX0T+SYTkVJ9pQl5IeqF/WKo+2QCLSsW4hB4tjiydFNBXYXO3nWcR1hZvhX2lsn i/IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=smbyKQCqSEurcIaPfQOlMDEox7tcetGuPWi/Xxn9Tl8=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=B/EqsGphFa4j3pRGaP4ZngcHH9HuifDN7h3tdAlVICBNPifXwDEEQOl+8mNLStu1oR fg9zCiQRi/qARG7oDTbSKHTlZcbTjsL2qofWheCeedqBNNq5LpB7Y32vyp1kFOyw5K4q gn85Q3g7v6yso81KmSLczH6qbMVZITbrtqYPIMLOUG3etKZoQtvhQJmb4yHdSrQob/Kn +WkjoGfuxLp/nE1kq+7iokYlUcbqTLOdUSaZ6VUQg4FBzxPwmPQm0PljLfHFjLrutHVY EqhQP5rUN31iFvdM3/xeOA9XiP59n+DEBCtUvBrfjVRv8ijOocydvInbj/uk8IdVd7QW wGtg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jYvjm+aO; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=fail header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8dac297b7si144377526d6.494.2024.12.10.08.24.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:24:16 -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=fail header.i=@linaro.org header.s=google header.b=jYvjm+aO; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=fail header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL31m-0006iV-VQ; Tue, 10 Dec 2024 11:24:03 -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 1tL31W-0005bb-7I for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:23:46 -0500 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL31T-0007OH-V4 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:23:45 -0500 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-53e399e3310so3735621e87.1 for ; Tue, 10 Dec 2024 08:23:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847822; x=1734452622; 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=smbyKQCqSEurcIaPfQOlMDEox7tcetGuPWi/Xxn9Tl8=; b=jYvjm+aOjg9+Z2xyBsUS+iUDFLsCE2VrbdJ95zghN8C/meSGK8KxPYGUZeTbJ0gQvu s05Kc0AD0VMzg7ATXDUXZkIY/aB0+jutovVUZcNG+OH9zP85/KFyx6X+EqOOuuBf6/gE JhUPZ4TNI9V2riQJZlQ91IStO0AkvmwwCI7mQUE6E3blCqCgIdK4nBw1B5ioxb8Y6Jwe 7Tsih6dB4C67dMh0/5EYC1o0gxaEl02JR8kLEGxR8Al7uEs11TYlWqAb6Bn6gDzaN/ie phCa0+3XhtmMD0O8h6kF8xf+sH6OTPTuXgbvaaHDeK4K2awyqj4JB+u7nS8Ry4tTUNCh qGfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847822; x=1734452622; 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=smbyKQCqSEurcIaPfQOlMDEox7tcetGuPWi/Xxn9Tl8=; b=sxNMao8vuHhEdv+4cPPWEdfSlDieDNKd8tUIpwJ5mdAAo3AC3PdWzALpaNaZh4IolQ T1IMFwZehFwtfJ2M8JWpzzFVOLeYsOJYoqR0sy5EUez/pG77WJL0Rn0piCzGDLdBmhW9 cuczFpeNRtWUKfw63SJBFH/dBLNumJRS2kxNaVq6yIFIy1O5bH1o7wjNeARuI1/4Pipr 7jSPWam1Mx3OEBXFa30K/2HawE4bZ8vIhpp+AYPU/xg5STLyW/8opI8KnKERmPj7wIIb xjcFQQTG4UboKxRRwDYBBhp9RLC2EQXtTiHb85qNeefLGvl1eqlEFgn9bHkDsz9oCi5B WyAg== X-Gm-Message-State: AOJu0YxlCrlaljkc3akGEJTImfOHueP97X3skVG7rXZnZvgWtMv99Jpy /ao6UxSgZ4Fssa+Wf68dbhr/iVGyYyYTftnOz2fc7cUXqfDQFIIa6gEtOoSh1jaiCm7lb7Umz5w VQgENZS+X X-Gm-Gg: ASbGncs3nWSM0uyZ6UIDolBBl5Hesa2FQrYXlujU0eW1UcI5LOCYnGwUdimEloSQSKD RpngHAOQcp+aQcUCmTF+mEjNeCxj+7mP94Ida8BdAvTeOZhNciGXeDcL/4u6+t7dagynb85xblv 2wYwmGksJ9DzdJBABSA0tsHOSX2G0N9h1PNTu9NPpotmGoG+hutfT1D0JGGBjOWBeWcd8DDnSla n4m8voIybLsjcHntTFED4jD4RP036Z1Q26WI2JOP4HiamLnJo8beT8qy00= X-Received: by 2002:ac2:4e09:0:b0:540:2231:4a04 with SMTP id 2adb3069b0e04-54022314b6dmr2260826e87.39.1733847822212; Tue, 10 Dec 2024 08:23:42 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.23.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:23:41 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 44/69] target/arm: Move helper_neon_addlp_{s8, s16} to neon_helper.c Date: Tue, 10 Dec 2024 10:17:08 -0600 Message-ID: <20241210161733.1830573-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::132; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x132.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 Move from helper-a64.c to neon_helper.c so that these functions are available for arm32 code as well. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.h | 2 ++ target/arm/tcg/helper-a64.h | 2 -- target/arm/tcg/helper-a64.c | 43 ------------------------------------ target/arm/tcg/neon_helper.c | 43 ++++++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 167e331a83..57e0ce387b 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -399,6 +399,8 @@ DEF_HELPER_2(neon_addl_u16, i64, i64, i64) DEF_HELPER_2(neon_addl_u32, i64, i64, i64) DEF_HELPER_2(neon_paddl_u16, i64, i64, i64) DEF_HELPER_2(neon_paddl_u32, i64, i64, i64) +DEF_HELPER_FLAGS_1(neon_addlp_s8, TCG_CALL_NO_RWG_SE, i64, i64) +DEF_HELPER_FLAGS_1(neon_addlp_s16, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_2(neon_subl_u16, i64, i64, i64) DEF_HELPER_2(neon_subl_u32, i64, i64, i64) DEF_HELPER_3(neon_addl_saturate_s32, i64, env, i64, i64) diff --git a/target/arm/tcg/helper-a64.h b/target/arm/tcg/helper-a64.h index 203b7b7ac8..f811bb85dc 100644 --- a/target/arm/tcg/helper-a64.h +++ b/target/arm/tcg/helper-a64.h @@ -41,9 +41,7 @@ DEF_HELPER_FLAGS_3(recpsf_f64, TCG_CALL_NO_RWG, f64, f64, f64, ptr) DEF_HELPER_FLAGS_3(rsqrtsf_f16, TCG_CALL_NO_RWG, f16, f16, f16, ptr) DEF_HELPER_FLAGS_3(rsqrtsf_f32, TCG_CALL_NO_RWG, f32, f32, f32, ptr) DEF_HELPER_FLAGS_3(rsqrtsf_f64, TCG_CALL_NO_RWG, f64, f64, f64, ptr) -DEF_HELPER_FLAGS_1(neon_addlp_s8, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_1(neon_addlp_u8, TCG_CALL_NO_RWG_SE, i64, i64) -DEF_HELPER_FLAGS_1(neon_addlp_s16, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_1(neon_addlp_u16, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_2(frecpx_f64, TCG_CALL_NO_RWG, f64, f64, ptr) DEF_HELPER_FLAGS_2(frecpx_f32, TCG_CALL_NO_RWG, f32, f32, ptr) diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c index 3f4d7b9aba..9b3c407be3 100644 --- a/target/arm/tcg/helper-a64.c +++ b/target/arm/tcg/helper-a64.c @@ -306,39 +306,6 @@ float64 HELPER(rsqrtsf_f64)(float64 a, float64 b, void *fpstp) return float64_muladd(a, b, float64_three, float_muladd_halve_result, fpst); } -/* Pairwise long add: add pairs of adjacent elements into - * double-width elements in the result (eg _s8 is an 8x8->16 op) - */ -uint64_t HELPER(neon_addlp_s8)(uint64_t a) -{ - uint64_t nsignmask = 0x0080008000800080ULL; - uint64_t wsignmask = 0x8000800080008000ULL; - uint64_t elementmask = 0x00ff00ff00ff00ffULL; - uint64_t tmp1, tmp2; - uint64_t res, signres; - - /* Extract odd elements, sign extend each to a 16 bit field */ - tmp1 = a & elementmask; - tmp1 ^= nsignmask; - tmp1 |= wsignmask; - tmp1 = (tmp1 - nsignmask) ^ wsignmask; - /* Ditto for the even elements */ - tmp2 = (a >> 8) & elementmask; - tmp2 ^= nsignmask; - tmp2 |= wsignmask; - tmp2 = (tmp2 - nsignmask) ^ wsignmask; - - /* calculate the result by summing bits 0..14, 16..22, etc, - * and then adjusting the sign bits 15, 23, etc manually. - * This ensures the addition can't overflow the 16 bit field. - */ - signres = (tmp1 ^ tmp2) & wsignmask; - res = (tmp1 & ~wsignmask) + (tmp2 & ~wsignmask); - res ^= signres; - - return res; -} - uint64_t HELPER(neon_addlp_u8)(uint64_t a) { uint64_t tmp; @@ -348,16 +315,6 @@ uint64_t HELPER(neon_addlp_u8)(uint64_t a) return tmp; } -uint64_t HELPER(neon_addlp_s16)(uint64_t a) -{ - int32_t reslo, reshi; - - reslo = (int32_t)(int16_t)a + (int32_t)(int16_t)(a >> 16); - reshi = (int32_t)(int16_t)(a >> 32) + (int32_t)(int16_t)(a >> 48); - - return (uint32_t)reslo | (((uint64_t)reshi) << 32); -} - uint64_t HELPER(neon_addlp_u16)(uint64_t a) { uint64_t tmp; diff --git a/target/arm/tcg/neon_helper.c b/target/arm/tcg/neon_helper.c index 4e501925de..b92ddd4914 100644 --- a/target/arm/tcg/neon_helper.c +++ b/target/arm/tcg/neon_helper.c @@ -866,6 +866,49 @@ uint64_t HELPER(neon_paddl_u32)(uint64_t a, uint64_t b) return low + ((uint64_t)high << 32); } +/* Pairwise long add: add pairs of adjacent elements into + * double-width elements in the result (eg _s8 is an 8x8->16 op) + */ +uint64_t HELPER(neon_addlp_s8)(uint64_t a) +{ + uint64_t nsignmask = 0x0080008000800080ULL; + uint64_t wsignmask = 0x8000800080008000ULL; + uint64_t elementmask = 0x00ff00ff00ff00ffULL; + uint64_t tmp1, tmp2; + uint64_t res, signres; + + /* Extract odd elements, sign extend each to a 16 bit field */ + tmp1 = a & elementmask; + tmp1 ^= nsignmask; + tmp1 |= wsignmask; + tmp1 = (tmp1 - nsignmask) ^ wsignmask; + /* Ditto for the even elements */ + tmp2 = (a >> 8) & elementmask; + tmp2 ^= nsignmask; + tmp2 |= wsignmask; + tmp2 = (tmp2 - nsignmask) ^ wsignmask; + + /* calculate the result by summing bits 0..14, 16..22, etc, + * and then adjusting the sign bits 15, 23, etc manually. + * This ensures the addition can't overflow the 16 bit field. + */ + signres = (tmp1 ^ tmp2) & wsignmask; + res = (tmp1 & ~wsignmask) + (tmp2 & ~wsignmask); + res ^= signres; + + return res; +} + +uint64_t HELPER(neon_addlp_s16)(uint64_t a) +{ + int32_t reslo, reshi; + + reslo = (int32_t)(int16_t)a + (int32_t)(int16_t)(a >> 16); + reshi = (int32_t)(int16_t)(a >> 32) + (int32_t)(int16_t)(a >> 48); + + return (uint32_t)reslo | (((uint64_t)reshi) << 32); +} + uint64_t HELPER(neon_subl_u16)(uint64_t a, uint64_t b) { uint64_t mask; From patchwork Tue Dec 10 16:17:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848855 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp420001wrn; Tue, 10 Dec 2024 08:26:47 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVoj54jpGp1KrcNgDIAo0SwQ6VCtpPko3HeK0FHKakZulqAknuppNEvur5nP7G0IhpWTalHQQ==@linaro.org X-Google-Smtp-Source: AGHT+IEQqNt7AiRdma55SCqH2GNry6G8wQQ7BJckiuBFFg7vDNBtlkzoIYmddZ8ijPrE5toEkYtc X-Received: by 2002:a05:6102:1627:b0:4b0:4d6:bff1 with SMTP id ada2fe7eead31-4b004d6c19fmr6174107137.14.1733848006874; Tue, 10 Dec 2024 08:26:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848006; cv=none; d=google.com; s=arc-20240605; b=DzOxAcguxYHOxFj6VbJmA8YqpB5daRNyt03r/jX0Q2CI6E9TQd3ETkytlPWgmn3w6j kpuITydMqB2I07m9LzC0pr+m7PUES/K6DK/JegIgkvnRKKgswYVo5m6QdhpeE+NapLVu KMYQDuliW7ArTvED47PPSoSWUEIyG4VN1JcyrFdgLU70muHRu7+dTY5ozvKiVl/sfPYa /CZGGL+WgjOC1SbtVNstAUjVLimOkzAONa9tFVfkud+/yyZ/K5zUpSAlCXl2acIhTV3S 7ySGM1D39pAe2ppwv42MvX+V45VrJdkgO7FtjngfRSQQEFP+CWX2eIttBvKufI8N+mjH Yz1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=4zG86Y19MBGCwLzxG+giH5jIu2mrSyv/3KKPj8MjTGI=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=gwNCGa0SO1ZLfZl+YhO9t4CSbR5T5qLn4Wk4ZJ23p/a98d8YThEDAhfhPCOlowESbo TKBssFmchEgDMhFQdVkbjlJxteau6f6iLiTCKLZT2sCh6h+JH7yIfJvtqLZwAjJk8HyS oFQNeV+e9IWL6XMO3SaleH2XHIHKFEuFZW5faV8IyY0o19f25AZsvnWPgV2D0bgxXFSy Q7fnzbzozwaeWPv35jO+/gLZWoJPxhg7i+HVeei7eiWI06178nuCd2pBKxKbDBJ4nRW0 8VlP8avDCWwuJJLWwWu9eUVvIv03n30PWW/ABMoahyLvgiHR/pWqt9PVroPiVzhCAVka 82PQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WRU+fCwa; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4afd9226074si2713669137.598.2024.12.10.08.26.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:26: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=WRU+fCwa; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL31o-0006rJ-DQ; Tue, 10 Dec 2024 11:24:04 -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 1tL31h-0006Kc-D2 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:23:58 -0500 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL31e-0007P7-W8 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:23:57 -0500 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-53f22fd6887so3125166e87.2 for ; Tue, 10 Dec 2024 08:23:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847828; x=1734452628; 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=4zG86Y19MBGCwLzxG+giH5jIu2mrSyv/3KKPj8MjTGI=; b=WRU+fCwaOtUJDmR4HUgnjOKeG+TatBZLjS6Er3eziW1u/EmrpqG9uipw8QnUW8t43T Ntz/J1Y95rMo6oirbxWbFrnFcN5my9082xR6M+zUoBjNOuEkukX801FxSDKpZ3D72r3L /q60sP1BG0faf03iWJZB62M9l7j5GGfQaLfkVC0+RTry1BGrfzXmUwfRKYpYOgFGshKM eNTf1UDk495aB11o7vJHG6vdoH1edMTECWwjCJskZTuHowEL1PWf1tQCecyWVfIfkboH x5DjlZ3DoJ4T2ssG/JJ6TJJZDgpNK2p1kTcsr0Kp5aB61cvKv0E2FDdO5iXwuQ/20Sej 8oHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847828; x=1734452628; 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=4zG86Y19MBGCwLzxG+giH5jIu2mrSyv/3KKPj8MjTGI=; b=KEdpQW6jj2G17DbnXWu+CRDW7x6W3wSYs4nNAuDMpaSVxMaztF8JISI6jyH0KCRe4W ljFfQM6oY7r1WcMGst5eTntZarYRSVBZhMKLHylRTkmmb01ivzNu+RBAnQci0nfO3LNk ekJWS8YWR6n2uYSFyIf6RMMHTsEndYS0fHjYQT/VaNgkjJvTP48zK3fCiLLfE60v162q 1tJsPgM0NjFi4LwBiH9j5j11sjs6RsBE4/q2hxWiL7JXs5SpLoZ8VesBPNeJbmZWzU2m g/vjJ4VGyPC9uJXe/1UzwCAhUvKnaijIIZIiYOhG9I/Kuxv7gKWyIOmbzwhS5Zm1SIiM kgHQ== X-Gm-Message-State: AOJu0Yxsf2hD+I3U859rayA9FRI260E+FaPmcf/1wgDYiUJY6Mm77o2E SGDnTSPvUV2SJj9VzlVamwezjIxepGjaEES9D8Luvi2WvkLK4i21YA9xWNa0kB/EBS3nBlSoYVO EGYqFMoRE X-Gm-Gg: ASbGncsGyQldh5Ef+qcUzeQLmn9GqJwSgtcAr+9liTggx7rxddLUyPdBTR93iePwQhA vhFF7vNW0NBGdyY54qmJeKlvBYCJiLwimVXS4Hu6o5VdfuHXGInFeObRLTijtv0jyihwDXhvW0V H4g2L9KPmdA6zTeC61reKyTMrxyIPYDmcUHyWWdvKFuxT4adl6yzBxR8ozm70YmcGW4+SmUlhZi dkKjmP0dRMgED0dudL1i7K0h5T7zKVDdtINoGoMF9kmn2GgisTrabqjlnA= X-Received: by 2002:a05:6512:2384:b0:53e:37a5:4caf with SMTP id 2adb3069b0e04-53e37a54f91mr5909980e87.11.1733847827956; Tue, 10 Dec 2024 08:23:47 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.23.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:23:46 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 45/69] target/arm: Introduce gen_gvec_{s,u}{add,ada}lp Date: Tue, 10 Dec 2024 10:17:09 -0600 Message-ID: <20241210161733.1830573-46-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x129.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 Pairwise addition with and without accumulation. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.h | 2 - target/arm/tcg/translate.h | 9 ++ target/arm/tcg/gengvec.c | 230 ++++++++++++++++++++++++++++++++ target/arm/tcg/neon_helper.c | 22 --- target/arm/tcg/translate-neon.c | 150 +-------------------- 5 files changed, 243 insertions(+), 170 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 57e0ce387b..6369d07d05 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -397,8 +397,6 @@ DEF_HELPER_1(neon_widen_s16, i64, i32) DEF_HELPER_2(neon_addl_u16, i64, i64, i64) DEF_HELPER_2(neon_addl_u32, i64, i64, i64) -DEF_HELPER_2(neon_paddl_u16, i64, i64, i64) -DEF_HELPER_2(neon_paddl_u32, i64, i64, i64) DEF_HELPER_FLAGS_1(neon_addlp_s8, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_1(neon_addlp_s16, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_2(neon_subl_u16, i64, i64, i64) diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index 342ebedafc..edd775d564 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -593,6 +593,15 @@ void gen_gvec_rev32(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, void gen_gvec_rev64(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_saddlp(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_sadalp(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_uaddlp(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_uadalp(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz); + /* * Forward to the isar_feature_* tests given a DisasContext pointer. */ diff --git a/target/arm/tcg/gengvec.c b/target/arm/tcg/gengvec.c index 33c0a94958..2755da8ac7 100644 --- a/target/arm/tcg/gengvec.c +++ b/target/arm/tcg/gengvec.c @@ -2467,3 +2467,233 @@ void gen_gvec_rev64(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, g_assert_not_reached(); } } + +static void gen_saddlp_vec(unsigned vece, TCGv_vec d, TCGv_vec n) +{ + int half = 4 << vece; + TCGv_vec t = tcg_temp_new_vec_matching(d); + + tcg_gen_shli_vec(vece, t, n, half); + tcg_gen_sari_vec(vece, d, n, half); + tcg_gen_sari_vec(vece, t, t, half); + tcg_gen_add_vec(vece, d, d, t); +} + +static void gen_saddlp_s_i64(TCGv_i64 d, TCGv_i64 n) +{ + TCGv_i64 t = tcg_temp_new_i64(); + + tcg_gen_ext32s_i64(t, n); + tcg_gen_sari_i64(d, n, 32); + tcg_gen_add_i64(d, d, t); +} + +void gen_gvec_saddlp(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz) +{ + static const TCGOpcode vecop_list[] = { + INDEX_op_sari_vec, INDEX_op_shli_vec, INDEX_op_add_vec, 0 + }; + static const GVecGen2 g[] = { + { .fniv = gen_saddlp_vec, + .fni8 = gen_helper_neon_addlp_s8, + .opt_opc = vecop_list, + .vece = MO_16 }, + { .fniv = gen_saddlp_vec, + .fni8 = gen_helper_neon_addlp_s16, + .opt_opc = vecop_list, + .vece = MO_32 }, + { .fniv = gen_saddlp_vec, + .fni8 = gen_saddlp_s_i64, + .opt_opc = vecop_list, + .vece = MO_64 }, + }; + assert(vece <= MO_32); + tcg_gen_gvec_2(rd_ofs, rn_ofs, opr_sz, max_sz, &g[vece]); +} + +static void gen_sadalp_vec(unsigned vece, TCGv_vec d, TCGv_vec n) +{ + TCGv_vec t = tcg_temp_new_vec_matching(d); + + gen_saddlp_vec(vece, t, n); + tcg_gen_add_vec(vece, d, d, t); +} + +static void gen_sadalp_b_i64(TCGv_i64 d, TCGv_i64 n) +{ + TCGv_i64 t = tcg_temp_new_i64(); + + gen_helper_neon_addlp_s8(t, n); + tcg_gen_vec_add16_i64(d, d, t); +} + +static void gen_sadalp_h_i64(TCGv_i64 d, TCGv_i64 n) +{ + TCGv_i64 t = tcg_temp_new_i64(); + + gen_helper_neon_addlp_s16(t, n); + tcg_gen_vec_add32_i64(d, d, t); +} + +static void gen_sadalp_s_i64(TCGv_i64 d, TCGv_i64 n) +{ + TCGv_i64 t = tcg_temp_new_i64(); + + gen_saddlp_s_i64(t, n); + tcg_gen_add_i64(d, d, t); +} + +void gen_gvec_sadalp(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz) +{ + static const TCGOpcode vecop_list[] = { + INDEX_op_sari_vec, INDEX_op_shli_vec, INDEX_op_add_vec, 0 + }; + static const GVecGen2 g[] = { + { .fniv = gen_sadalp_vec, + .fni8 = gen_sadalp_b_i64, + .opt_opc = vecop_list, + .load_dest = true, + .vece = MO_16 }, + { .fniv = gen_sadalp_vec, + .fni8 = gen_sadalp_h_i64, + .opt_opc = vecop_list, + .load_dest = true, + .vece = MO_32 }, + { .fniv = gen_sadalp_vec, + .fni8 = gen_sadalp_s_i64, + .opt_opc = vecop_list, + .load_dest = true, + .vece = MO_64 }, + }; + assert(vece <= MO_32); + tcg_gen_gvec_2(rd_ofs, rn_ofs, opr_sz, max_sz, &g[vece]); +} + +static void gen_uaddlp_vec(unsigned vece, TCGv_vec d, TCGv_vec n) +{ + int half = 4 << vece; + TCGv_vec t = tcg_temp_new_vec_matching(d); + TCGv_vec m = tcg_constant_vec_matching(d, vece, MAKE_64BIT_MASK(0, half)); + + tcg_gen_shri_vec(vece, t, n, half); + tcg_gen_and_vec(vece, d, n, m); + tcg_gen_add_vec(vece, d, d, t); +} + +static void gen_uaddlp_b_i64(TCGv_i64 d, TCGv_i64 n) +{ + TCGv_i64 t = tcg_temp_new_i64(); + TCGv_i64 m = tcg_constant_i64(dup_const(MO_16, 0xff)); + + tcg_gen_shri_i64(t, n, 8); + tcg_gen_and_i64(d, n, m); + tcg_gen_and_i64(t, t, m); + /* No carry between widened unsigned elements. */ + tcg_gen_add_i64(d, d, t); +} + +static void gen_uaddlp_h_i64(TCGv_i64 d, TCGv_i64 n) +{ + TCGv_i64 t = tcg_temp_new_i64(); + TCGv_i64 m = tcg_constant_i64(dup_const(MO_32, 0xffff)); + + tcg_gen_shri_i64(t, n, 16); + tcg_gen_and_i64(d, n, m); + tcg_gen_and_i64(t, t, m); + /* No carry between widened unsigned elements. */ + tcg_gen_add_i64(d, d, t); +} + +static void gen_uaddlp_s_i64(TCGv_i64 d, TCGv_i64 n) +{ + TCGv_i64 t = tcg_temp_new_i64(); + + tcg_gen_ext32u_i64(t, n); + tcg_gen_shri_i64(d, n, 32); + tcg_gen_add_i64(d, d, t); +} + +void gen_gvec_uaddlp(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz) +{ + static const TCGOpcode vecop_list[] = { + INDEX_op_shri_vec, INDEX_op_add_vec, 0 + }; + static const GVecGen2 g[] = { + { .fniv = gen_uaddlp_vec, + .fni8 = gen_uaddlp_b_i64, + .opt_opc = vecop_list, + .vece = MO_16 }, + { .fniv = gen_uaddlp_vec, + .fni8 = gen_uaddlp_h_i64, + .opt_opc = vecop_list, + .vece = MO_32 }, + { .fniv = gen_uaddlp_vec, + .fni8 = gen_uaddlp_s_i64, + .opt_opc = vecop_list, + .vece = MO_64 }, + }; + assert(vece <= MO_32); + tcg_gen_gvec_2(rd_ofs, rn_ofs, opr_sz, max_sz, &g[vece]); +} + +static void gen_uadalp_vec(unsigned vece, TCGv_vec d, TCGv_vec n) +{ + TCGv_vec t = tcg_temp_new_vec_matching(d); + + gen_uaddlp_vec(vece, t, n); + tcg_gen_add_vec(vece, d, d, t); +} + +static void gen_uadalp_b_i64(TCGv_i64 d, TCGv_i64 n) +{ + TCGv_i64 t = tcg_temp_new_i64(); + + gen_uaddlp_b_i64(t, n); + tcg_gen_vec_add16_i64(d, d, t); +} + +static void gen_uadalp_h_i64(TCGv_i64 d, TCGv_i64 n) +{ + TCGv_i64 t = tcg_temp_new_i64(); + + gen_uaddlp_h_i64(t, n); + tcg_gen_vec_add32_i64(d, d, t); +} + +static void gen_uadalp_s_i64(TCGv_i64 d, TCGv_i64 n) +{ + TCGv_i64 t = tcg_temp_new_i64(); + + gen_uaddlp_s_i64(t, n); + tcg_gen_add_i64(d, d, t); +} + +void gen_gvec_uadalp(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz) +{ + static const TCGOpcode vecop_list[] = { + INDEX_op_shri_vec, INDEX_op_add_vec, 0 + }; + static const GVecGen2 g[] = { + { .fniv = gen_uadalp_vec, + .fni8 = gen_uadalp_b_i64, + .load_dest = true, + .opt_opc = vecop_list, + .vece = MO_16 }, + { .fniv = gen_uadalp_vec, + .fni8 = gen_uadalp_h_i64, + .load_dest = true, + .opt_opc = vecop_list, + .vece = MO_32 }, + { .fniv = gen_uadalp_vec, + .fni8 = gen_uadalp_s_i64, + .load_dest = true, + .opt_opc = vecop_list, + .vece = MO_64 }, + }; + assert(vece <= MO_32); + tcg_gen_gvec_2(rd_ofs, rn_ofs, opr_sz, max_sz, &g[vece]); +} diff --git a/target/arm/tcg/neon_helper.c b/target/arm/tcg/neon_helper.c index b92ddd4914..1a22857b5e 100644 --- a/target/arm/tcg/neon_helper.c +++ b/target/arm/tcg/neon_helper.c @@ -844,28 +844,6 @@ uint64_t HELPER(neon_addl_u32)(uint64_t a, uint64_t b) return (a + b) ^ mask; } -uint64_t HELPER(neon_paddl_u16)(uint64_t a, uint64_t b) -{ - uint64_t tmp; - uint64_t tmp2; - - tmp = a & 0x0000ffff0000ffffull; - tmp += (a >> 16) & 0x0000ffff0000ffffull; - tmp2 = b & 0xffff0000ffff0000ull; - tmp2 += (b << 16) & 0xffff0000ffff0000ull; - return ( tmp & 0xffff) - | ((tmp >> 16) & 0xffff0000ull) - | ((tmp2 << 16) & 0xffff00000000ull) - | ( tmp2 & 0xffff000000000000ull); -} - -uint64_t HELPER(neon_paddl_u32)(uint64_t a, uint64_t b) -{ - uint32_t low = a + (a >> 32); - uint32_t high = b + (b >> 32); - return low + ((uint64_t)high << 32); -} - /* Pairwise long add: add pairs of adjacent elements into * double-width elements in the result (eg _s8 is an 8x8->16 op) */ diff --git a/target/arm/tcg/translate-neon.c b/target/arm/tcg/translate-neon.c index ca6f5578b4..19a18018f1 100644 --- a/target/arm/tcg/translate-neon.c +++ b/target/arm/tcg/translate-neon.c @@ -2565,152 +2565,6 @@ static bool trans_VDUP_scalar(DisasContext *s, arg_VDUP_scalar *a) return true; } -static bool do_2misc_pairwise(DisasContext *s, arg_2misc *a, - NeonGenWidenFn *widenfn, - NeonGenTwo64OpFn *opfn, - NeonGenTwo64OpFn *accfn) -{ - /* - * Pairwise long operations: widen both halves of the pair, - * combine the pairs with the opfn, and then possibly accumulate - * into the destination with the accfn. - */ - int pass; - - if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { - return false; - } - - /* UNDEF accesses to D16-D31 if they don't exist. */ - if (!dc_isar_feature(aa32_simd_r32, s) && - ((a->vd | a->vm) & 0x10)) { - return false; - } - - if ((a->vd | a->vm) & a->q) { - return false; - } - - if (!widenfn) { - return false; - } - - if (!vfp_access_check(s)) { - return true; - } - - for (pass = 0; pass < a->q + 1; pass++) { - TCGv_i32 tmp; - TCGv_i64 rm0_64, rm1_64, rd_64; - - rm0_64 = tcg_temp_new_i64(); - rm1_64 = tcg_temp_new_i64(); - rd_64 = tcg_temp_new_i64(); - - tmp = tcg_temp_new_i32(); - read_neon_element32(tmp, a->vm, pass * 2, MO_32); - widenfn(rm0_64, tmp); - read_neon_element32(tmp, a->vm, pass * 2 + 1, MO_32); - widenfn(rm1_64, tmp); - - opfn(rd_64, rm0_64, rm1_64); - - if (accfn) { - TCGv_i64 tmp64 = tcg_temp_new_i64(); - read_neon_element64(tmp64, a->vd, pass, MO_64); - accfn(rd_64, tmp64, rd_64); - } - write_neon_element64(rd_64, a->vd, pass, MO_64); - } - return true; -} - -static bool trans_VPADDL_S(DisasContext *s, arg_2misc *a) -{ - static NeonGenWidenFn * const widenfn[] = { - gen_helper_neon_widen_s8, - gen_helper_neon_widen_s16, - tcg_gen_ext_i32_i64, - NULL, - }; - static NeonGenTwo64OpFn * const opfn[] = { - gen_helper_neon_paddl_u16, - gen_helper_neon_paddl_u32, - tcg_gen_add_i64, - NULL, - }; - - return do_2misc_pairwise(s, a, widenfn[a->size], opfn[a->size], NULL); -} - -static bool trans_VPADDL_U(DisasContext *s, arg_2misc *a) -{ - static NeonGenWidenFn * const widenfn[] = { - gen_helper_neon_widen_u8, - gen_helper_neon_widen_u16, - tcg_gen_extu_i32_i64, - NULL, - }; - static NeonGenTwo64OpFn * const opfn[] = { - gen_helper_neon_paddl_u16, - gen_helper_neon_paddl_u32, - tcg_gen_add_i64, - NULL, - }; - - return do_2misc_pairwise(s, a, widenfn[a->size], opfn[a->size], NULL); -} - -static bool trans_VPADAL_S(DisasContext *s, arg_2misc *a) -{ - static NeonGenWidenFn * const widenfn[] = { - gen_helper_neon_widen_s8, - gen_helper_neon_widen_s16, - tcg_gen_ext_i32_i64, - NULL, - }; - static NeonGenTwo64OpFn * const opfn[] = { - gen_helper_neon_paddl_u16, - gen_helper_neon_paddl_u32, - tcg_gen_add_i64, - NULL, - }; - static NeonGenTwo64OpFn * const accfn[] = { - gen_helper_neon_addl_u16, - gen_helper_neon_addl_u32, - tcg_gen_add_i64, - NULL, - }; - - return do_2misc_pairwise(s, a, widenfn[a->size], opfn[a->size], - accfn[a->size]); -} - -static bool trans_VPADAL_U(DisasContext *s, arg_2misc *a) -{ - static NeonGenWidenFn * const widenfn[] = { - gen_helper_neon_widen_u8, - gen_helper_neon_widen_u16, - tcg_gen_extu_i32_i64, - NULL, - }; - static NeonGenTwo64OpFn * const opfn[] = { - gen_helper_neon_paddl_u16, - gen_helper_neon_paddl_u32, - tcg_gen_add_i64, - NULL, - }; - static NeonGenTwo64OpFn * const accfn[] = { - gen_helper_neon_addl_u16, - gen_helper_neon_addl_u32, - tcg_gen_add_i64, - NULL, - }; - - return do_2misc_pairwise(s, a, widenfn[a->size], opfn[a->size], - accfn[a->size]); -} - typedef void ZipFn(TCGv_ptr, TCGv_ptr); static bool do_zip_uzp(DisasContext *s, arg_2misc *a, @@ -3071,6 +2925,10 @@ DO_2MISC_VEC(VCLT0, gen_gvec_clt0) DO_2MISC_VEC(VCLS, gen_gvec_cls) DO_2MISC_VEC(VCLZ, gen_gvec_clz) DO_2MISC_VEC(VREV64, gen_gvec_rev64) +DO_2MISC_VEC(VPADDL_S, gen_gvec_saddlp) +DO_2MISC_VEC(VPADDL_U, gen_gvec_uaddlp) +DO_2MISC_VEC(VPADAL_S, gen_gvec_sadalp) +DO_2MISC_VEC(VPADAL_U, gen_gvec_uadalp) static bool trans_VMVN(DisasContext *s, arg_2misc *a) { From patchwork Tue Dec 10 16:17:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848843 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp419057wrn; Tue, 10 Dec 2024 08:24:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWsW6Km4FL4gobsuWT6DD8v0IBrQDKYUj56zR+uS0MKyrf+qx9c24PZ03zUL2ChDfmD8h8A7w==@linaro.org X-Google-Smtp-Source: AGHT+IEs4DAnkOaBjyNdT/eYv1+b2O3VjvqJrj9NFd7dPTGOxxoyFLDbpx5deKLfpQ+kG0fxpvxA X-Received: by 2002:a05:6102:f0f:b0:4af:f32e:ea76 with SMTP id ada2fe7eead31-4b11601d4c4mr5244276137.5.1733847896823; Tue, 10 Dec 2024 08:24:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847896; cv=none; d=google.com; s=arc-20240605; b=dFh+/CQdXglO/7ZQiPvWrNcBFDNXQh0ek9RtHBZn5BZIbjDtWhm4G/wMuTr8eESTgs WdF8gMmjgn2ykE5ni6VIgWVU6T6G505glVR1Hy3leOVaEsy/CW5tVC7IVLNfoc+Es4nl kV9f9ENfBQIwH+wUL1K/SIFRjPMzPanGG1MZujj4YUAivMztrzXiFjv7IY3RnViLFNwE W7SxaCG2N7it4r86R5/fX60MPjJzxmjM6FYdcM6qgJTcOQrb/HFwtpdB8Xl8JSoEhHpZ L0JjJZ3TCfUDWX+tAluRSEAvlsZ7Fogc2A7VBIsClZGBCLwNJrzLsRtStqn48CH07KP5 RVLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=Tlc1sDdBI3Qf2hIRGDjmYPYJZUpS4oICL8uTmdB2efI=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=Dy6c47TwYc3LRdSKa5HFYFnrmUthJShL3whsNUx480j9Chae2cay95hM8HoGEHWcgn ls4kI6gHjiKfzwlg8elSepFML4gHQgogbWpwshjbtMMO7U5DHiI0fwRDGSPx3P6TkRi+ m8+R1GKYotHB4lGJpeantaBJZawisKebIO7jEzTwuQvHsm6JT+cib9/IXWLM1USq7ByQ 5nCk8Rp/ydyq+zPgQ5kJjR/zkmY+e5WCeQvdVo14Oujlso5oC+Ia94dUgBoPj1rQEWxi Dji99QaHVy+Ly6+G9uW39CW6kv5mrLBbydUlLby5GIf3Ui81vekK33C/rhHJpbem5Mbf xahg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lVOoJG71; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4afe56a0df4si1781795137.169.2024.12.10.08.24.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:24:56 -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=lVOoJG71; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL31k-0006VD-W9; Tue, 10 Dec 2024 11:24:01 -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 1tL31g-0006Hr-U5 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:23:56 -0500 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL31f-0007Pa-0G for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:23:56 -0500 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-5401ab97206so2432923e87.3 for ; Tue, 10 Dec 2024 08:23:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847833; x=1734452633; 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=Tlc1sDdBI3Qf2hIRGDjmYPYJZUpS4oICL8uTmdB2efI=; b=lVOoJG71KKb0AhwLfPpKWdaCy6oXU/Ral29GRWzmg5ZIytbLEeC9+5x8I6G0UuNVnW Q1NuQQ8oIST4WKw68CuPWIvS+gH0mH8oQXsbzjw+oSJgMBLA8AcbXViXVFJFBbEqlHzX B3iBSy94kZqer77FycjwHDJNfwMehJ1va3rTsqduDqnoB7k78y2SLIUfY9H/41Gbzh7t GYH9yq0o+sN8fJe6+0Rv+DwOmCpttQn58nltfF9wFAOcanHS3Wqhx4vEqb65vSPy7aUs 9cZa+Gc4wOVJe39+vzeCvXv46lymc1sQl83TWAV8QgvQf9vFYO7Phx4tO+daQlwusWK7 l7Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847833; x=1734452633; 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=Tlc1sDdBI3Qf2hIRGDjmYPYJZUpS4oICL8uTmdB2efI=; b=r+r4Kp3xaou1f7ccuVHr3DhYwWQV9Y4fGUQbAwUJyFdDi/IzbeG8UIi/s//if99tKg sbF7KrqmM+obCvdAaPZZzmm+LO3ELnojFiRfLL/fF5PjdvnvXFIGCpI6izRmzmu+EGY8 bNolv0dUSkbA65tDG/uc7y9ZGuyDoftrOcyUo7r4PxldWalzNkNFLrzr+MwW6pzIR8QQ Wol57TmEptxOwitGc6rBizjWhQJk9ypiqNfKG9cQVRCnhOBnncAet44o7PAmsQKwjGnh ZJQuv/3RiRdD6QupR/KJggkpVG34a8YAoBMZl+aXVxGBo0uumVXHmZSVuVu1ESRDBEfp DLGg== X-Gm-Message-State: AOJu0Yx2mZ2QBdL2Hik1Ana1YFGyexmp6o4LluqjcevG9Urg2KJ1YflQ pgsPGU1F1wp+pfdzcuFDlKHCC2mbfSMPQB9TwgjQNZslKeMyB8eSDtXmSB9dSJ7GBKJkksPGIid 8WGIC1aBO X-Gm-Gg: ASbGncvrB6TPkzmIKbaErbklgvV2TzvBYkZUvejg/osXn7jogOdsfrVBp0Y9mueuMO/ ELETyGF4OHDiCiUrbNCU0qC1cQPG4/HWLf3ZPKjEQbJyV84IbVgBNfEji+QcyreMo9andTnLKfA zqAXJAVH95AHNNNjOsq9xWIL9OwxGRlcw7ClRu9TTVCaczsBVaHghYC5FU60UGEVr6jyYjTh48h NP8kYnfZ4ZfHD/Cn9rIOWR0M2GFPEs4UXNEu7MftR4om+2J7Vku7n5Xjok= X-Received: by 2002:a05:6512:6d6:b0:53f:5e23:fb73 with SMTP id 2adb3069b0e04-5402411c0e7mr1775476e87.57.1733847832636; Tue, 10 Dec 2024 08:23:52 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:23:51 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 46/69] target/arm: Convert handle_2misc_pairwise to decodetree Date: Tue, 10 Dec 2024 10:17:10 -0600 Message-ID: <20241210161733.1830573-47-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x130.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 This includes SADDLP, UADDLP, SADALP, UADALP. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/helper-a64.h | 2 - target/arm/tcg/helper-a64.c | 18 -------- target/arm/tcg/translate-a64.c | 84 +++------------------------------- target/arm/tcg/a64.decode | 5 ++ 4 files changed, 11 insertions(+), 98 deletions(-) diff --git a/target/arm/tcg/helper-a64.h b/target/arm/tcg/helper-a64.h index f811bb85dc..ac7ca190fa 100644 --- a/target/arm/tcg/helper-a64.h +++ b/target/arm/tcg/helper-a64.h @@ -41,8 +41,6 @@ DEF_HELPER_FLAGS_3(recpsf_f64, TCG_CALL_NO_RWG, f64, f64, f64, ptr) DEF_HELPER_FLAGS_3(rsqrtsf_f16, TCG_CALL_NO_RWG, f16, f16, f16, ptr) DEF_HELPER_FLAGS_3(rsqrtsf_f32, TCG_CALL_NO_RWG, f32, f32, f32, ptr) DEF_HELPER_FLAGS_3(rsqrtsf_f64, TCG_CALL_NO_RWG, f64, f64, f64, ptr) -DEF_HELPER_FLAGS_1(neon_addlp_u8, TCG_CALL_NO_RWG_SE, i64, i64) -DEF_HELPER_FLAGS_1(neon_addlp_u16, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_2(frecpx_f64, TCG_CALL_NO_RWG, f64, f64, ptr) DEF_HELPER_FLAGS_2(frecpx_f32, TCG_CALL_NO_RWG, f32, f32, ptr) DEF_HELPER_FLAGS_2(frecpx_f16, TCG_CALL_NO_RWG, f16, f16, ptr) diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c index 9b3c407be3..3de564e0fe 100644 --- a/target/arm/tcg/helper-a64.c +++ b/target/arm/tcg/helper-a64.c @@ -306,24 +306,6 @@ float64 HELPER(rsqrtsf_f64)(float64 a, float64 b, void *fpstp) return float64_muladd(a, b, float64_three, float_muladd_halve_result, fpst); } -uint64_t HELPER(neon_addlp_u8)(uint64_t a) -{ - uint64_t tmp; - - tmp = a & 0x00ff00ff00ff00ffULL; - tmp += (a >> 8) & 0x00ff00ff00ff00ffULL; - return tmp; -} - -uint64_t HELPER(neon_addlp_u16)(uint64_t a) -{ - uint64_t tmp; - - tmp = a & 0x0000ffff0000ffffULL; - tmp += (a >> 16) & 0x0000ffff0000ffffULL; - return tmp; -} - /* Floating-point reciprocal exponent - see FPRecpX in ARM ARM */ uint32_t HELPER(frecpx_f16)(uint32_t a, void *fpstp) { diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 9ce58586a8..29d55bcedd 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8956,6 +8956,10 @@ static bool do_gvec_fn2_bhs(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) TRANS(CLS_v, do_gvec_fn2_bhs, a, gen_gvec_cls) TRANS(CLZ_v, do_gvec_fn2_bhs, a, gen_gvec_clz) TRANS(REV64_v, do_gvec_fn2_bhs, a, gen_gvec_rev64) +TRANS(SADDLP_v, do_gvec_fn2_bhs, a, gen_gvec_saddlp) +TRANS(UADDLP_v, do_gvec_fn2_bhs, a, gen_gvec_uaddlp) +TRANS(SADALP_v, do_gvec_fn2_bhs, a, gen_gvec_sadalp) +TRANS(UADALP_v, do_gvec_fn2_bhs, a, gen_gvec_uadalp) /* Common vector code for handling integer to FP conversion */ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, @@ -9885,73 +9889,6 @@ static void handle_2misc_widening(DisasContext *s, int opcode, bool is_q, } } -static void handle_2misc_pairwise(DisasContext *s, int opcode, bool u, - bool is_q, int size, int rn, int rd) -{ - /* Implement the pairwise operations from 2-misc: - * SADDLP, UADDLP, SADALP, UADALP. - * These all add pairs of elements in the input to produce a - * double-width result element in the output (possibly accumulating). - */ - bool accum = (opcode == 0x6); - int maxpass = is_q ? 2 : 1; - int pass; - TCGv_i64 tcg_res[2]; - - if (size == 2) { - /* 32 + 32 -> 64 op */ - MemOp memop = size + (u ? 0 : MO_SIGN); - - for (pass = 0; pass < maxpass; pass++) { - TCGv_i64 tcg_op1 = tcg_temp_new_i64(); - TCGv_i64 tcg_op2 = tcg_temp_new_i64(); - - tcg_res[pass] = tcg_temp_new_i64(); - - read_vec_element(s, tcg_op1, rn, pass * 2, memop); - read_vec_element(s, tcg_op2, rn, pass * 2 + 1, memop); - tcg_gen_add_i64(tcg_res[pass], tcg_op1, tcg_op2); - if (accum) { - read_vec_element(s, tcg_op1, rd, pass, MO_64); - tcg_gen_add_i64(tcg_res[pass], tcg_res[pass], tcg_op1); - } - } - } else { - for (pass = 0; pass < maxpass; pass++) { - TCGv_i64 tcg_op = tcg_temp_new_i64(); - NeonGenOne64OpFn *genfn; - static NeonGenOne64OpFn * const fns[2][2] = { - { gen_helper_neon_addlp_s8, gen_helper_neon_addlp_u8 }, - { gen_helper_neon_addlp_s16, gen_helper_neon_addlp_u16 }, - }; - - genfn = fns[size][u]; - - tcg_res[pass] = tcg_temp_new_i64(); - - read_vec_element(s, tcg_op, rn, pass, MO_64); - genfn(tcg_res[pass], tcg_op); - - if (accum) { - read_vec_element(s, tcg_op, rd, pass, MO_64); - if (size == 0) { - gen_helper_neon_addl_u16(tcg_res[pass], - tcg_res[pass], tcg_op); - } else { - gen_helper_neon_addl_u32(tcg_res[pass], - tcg_res[pass], tcg_op); - } - } - } - } - if (!is_q) { - tcg_res[1] = tcg_constant_i64(0); - } - for (pass = 0; pass < 2; pass++) { - write_vec_element(s, tcg_res[pass], rd, pass, MO_64); - } -} - static void handle_shll(DisasContext *s, bool is_q, int size, int rn, int rd) { /* Implement SHLL and SHLL2 */ @@ -10011,17 +9948,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) handle_2misc_narrow(s, false, opcode, u, is_q, size, rn, rd); return; - case 0x2: /* SADDLP, UADDLP */ - case 0x6: /* SADALP, UADALP */ - if (size == 3) { - unallocated_encoding(s); - return; - } - if (!fp_access_check(s)) { - return; - } - handle_2misc_pairwise(s, opcode, u, is_q, size, rn, rd); - return; case 0x13: /* SHLL, SHLL2 */ if (u == 0 || size == 3) { unallocated_encoding(s); @@ -10203,9 +10129,11 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) default: case 0x0: /* REV64, REV32 */ case 0x1: /* REV16 */ + case 0x2: /* SADDLP, UADDLP */ case 0x3: /* SUQADD, USQADD */ case 0x4: /* CLS, CLZ */ case 0x5: /* CNT, NOT, RBIT */ + case 0x6: /* SADALP, UADALP */ case 0x7: /* SQABS, SQNEG */ case 0x8: /* CMGT, CMGE */ case 0x9: /* CMEQ, CMLE */ diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 05f1bc99b5..f3488766b2 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1662,3 +1662,8 @@ CMLT0_v 0.00 1110 ..1 00000 10101 0 ..... ..... @qrr_e REV16_v 0.00 1110 001 00000 00011 0 ..... ..... @qrr_b REV32_v 0.10 1110 0.1 00000 00001 0 ..... ..... @qrr_bh REV64_v 0.00 1110 ..1 00000 00001 0 ..... ..... @qrr_e + +SADDLP_v 0.00 1110 ..1 00000 00101 0 ..... ..... @qrr_e +UADDLP_v 0.10 1110 ..1 00000 00101 0 ..... ..... @qrr_e +SADALP_v 0.00 1110 ..1 00000 01101 0 ..... ..... @qrr_e +UADALP_v 0.10 1110 ..1 00000 01101 0 ..... ..... @qrr_e From patchwork Tue Dec 10 16:17:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848856 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp420463wrn; Tue, 10 Dec 2024 08:27:39 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU/8H7QGiHbbqFoVRm91Kbkb/bhgHz1oawY+zUxherbLl+4eB6dcLVIfMGlhBj7SvL75RYuIA==@linaro.org X-Google-Smtp-Source: AGHT+IFwK30lw9P+zdavLF4W0s8obsn7I752W5mRFRx3v0WocL5EP9enOlANZ6fUqqcIpGKWIf+b X-Received: by 2002:a05:6102:2ac8:b0:4b1:1a9d:8248 with SMTP id ada2fe7eead31-4b11a9d82f6mr3332835137.15.1733848059132; Tue, 10 Dec 2024 08:27:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848059; cv=none; d=google.com; s=arc-20240605; b=BvC+1n+YIFx5cFSzS3ctjtfwYuulOxWE25qCyjxyxwmDD3eJxXWaCf/VFdjIcgPs0e dNIeDLWDp4+rON3WOEV45KznL016JPamqOMtSONXQjg/DTKeVgqsxqASPN+2tEX2FHBb dyjfrPUaVJHs4Et3WkH7KkAiYzkpPmB/t+XcbOyQ3WCnYzczCEEOoGGLRMjYxXRdhxLm Tj4wzWAzDMNrxG/QhjRtHk5m16Tu/KTPUVgxTuYTUJTi6O7I6hHETWrlJA9pP+Pgb4Oe Lzpj7co1s+grwZDNEHlyMloYGX9j60QpKHaMAnnguTrPVjwNcBvOsoGccLQf4vfEXp8P LO+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=/lj9qTaRMEepyhNy18XDaVZRLAOfWJDrTDDoQoevOKs=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=lIg7Mt/6bG+qzQCAP/1kMt79X0I/V7ZGDu+bkE14KYRALb1iglt3bsVuYO7SwfYqW1 1OqD/MTlEL0/MinLjJ6iOJ2WJ70osHOmUXXiL6s9nf6krFobEty9Z7+jWAfLPKP9aKiR xLoTV8SCo5oAZCA6fvXF8adSHOF7dnB/mJ6kkWNSpc+cuFpF/J/fTOk5SL/RG446sb/e 5l/6fmkuPmPxcjDDMeh6MoN4lYfTSf0iACg62yA2GYtOubv0PznI9saeYpD931uqQn8Z 89egDHT39ah7S9Q7xZ/XIZFb6PoYJYfMvChXp29/C2TRCHPPI5sopoitZfoTBSr67wxw whQg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vF6JOrxs; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4affa4d57e2si1164270137.650.2024.12.10.08.27.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:27: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=vF6JOrxs; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL31q-00071g-7c; Tue, 10 Dec 2024 11:24: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 1tL31l-0006ju-G5 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:01 -0500 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL31j-0007RH-IL for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:01 -0500 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-5401e6efffcso2540117e87.3 for ; Tue, 10 Dec 2024 08:23:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847838; x=1734452638; 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=/lj9qTaRMEepyhNy18XDaVZRLAOfWJDrTDDoQoevOKs=; b=vF6JOrxsaT7R25JwtHS38K31huR5juDfD06IKny63NubmcLjsIoSBa43WRzLNibhv1 0op1++bU86EGoUfBYMOA76+JMHyRK9uOUc2DcLf/wjZAS7pBL5QXaANvIlpR19HkzjsJ bN0lF+68XY4+PNRtCkYk737Guinl+pgPUVhqAThu0HI5QrSbdUHxc9TIcmAsGGppeECK Wj5GSlPUdt7vAOXp9/jUmXkK/il0wbHJGa3+1/FMtFHPqyiBjq6vQtgnRWbpeaDlMRNg ZHZwkAoNIAAEch5Y5xmcfXov8qG3I8XcdD3UL09V+luslAYGWatqGl7MY2GANN+yKwme bBkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847838; x=1734452638; 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=/lj9qTaRMEepyhNy18XDaVZRLAOfWJDrTDDoQoevOKs=; b=j6lOlRRruODUs7+RiD5xyvGbKh4YkFvTgk6UYWoLy3JxGZCzcFLCOWTYWO2mRtmfT6 itB2vB09mEAlEKE2NsLS+A3mYKVU1GYKEUjm5FjeNSfXNRhxusV1Y0GZZ3kLAoDfmCnD 4NEHV1k9dFeFpbF0hNDzbH5RhnDnM+yrSMMhHxlq6QLMe2MRAfdqAm1Iz06ibNlt25Wb FnEVY1twh6oExhEh+QgCFtKc4cKVmI57WHHnd9uogxWRW853WS9k9dSchzIETQ+PlFgh CaUNnEZgd1tRIcT7n1SjfXL1ldaRA6X9LCvgFYC2tH5qW/EpoqqP+LT70ab4ArigKS/1 lsrQ== X-Gm-Message-State: AOJu0YyH4Mo6Q05zZ+728mxqZ+rQAReJfvYMw4DgFuV063ECP9JfU0nI aii8Nlu6qrqVd90Xf8LHD3YbZk0LNiH90OX/+JliYm1TsGgOMC1G2gnluXt1Tcw1D8CuMSIO+Wh Cclabbbt8 X-Gm-Gg: ASbGncuXlv0dO2diGiW9gTe0BPQY1jh82MWNwAs5FPLnVkACogwBwgba817cwxA7O8g ARiy83zUaz3EEJp1QWD+4IX7QUPvhbXo2QWHjobc59BfDIcZZn3/L5LSgU1t9zrkChKFiG02Hcj 5XMMFpdGgL/vldU7lbUrK4zn6nv4nShbQLZX9v+xrSA9qInj+TY8P24iM569OwD7Fw8+qF5xEia Vjq0mxt4lSNA1VP5tTMZCk5tRREufTtZBfdvifBBO4PPhM3qCeYBDHIOtk= X-Received: by 2002:a19:f00c:0:b0:540:255d:b2f with SMTP id 2adb3069b0e04-540255d158emr1173071e87.6.1733847837849; Tue, 10 Dec 2024 08:23:57 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.23.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:23:56 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 47/69] target/arm: Remove helper_neon_{add,sub}l_u{16,32} Date: Tue, 10 Dec 2024 10:17:11 -0600 Message-ID: <20241210161733.1830573-48-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x135.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 These have generic equivalents: tcg_gen_vec_{add,sub}{16,32}_i64. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.h | 4 ---- target/arm/tcg/neon_helper.c | 36 --------------------------------- target/arm/tcg/translate-neon.c | 22 ++++++++++---------- 3 files changed, 11 insertions(+), 51 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 6369d07d05..04e422ab08 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -395,12 +395,8 @@ DEF_HELPER_1(neon_widen_s8, i64, i32) DEF_HELPER_1(neon_widen_u16, i64, i32) DEF_HELPER_1(neon_widen_s16, i64, i32) -DEF_HELPER_2(neon_addl_u16, i64, i64, i64) -DEF_HELPER_2(neon_addl_u32, i64, i64, i64) DEF_HELPER_FLAGS_1(neon_addlp_s8, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_1(neon_addlp_s16, TCG_CALL_NO_RWG_SE, i64, i64) -DEF_HELPER_2(neon_subl_u16, i64, i64, i64) -DEF_HELPER_2(neon_subl_u32, i64, i64, i64) DEF_HELPER_3(neon_addl_saturate_s32, i64, env, i64, i64) DEF_HELPER_3(neon_addl_saturate_s64, i64, env, i64, i64) DEF_HELPER_2(neon_abdl_u16, i64, i32, i32) diff --git a/target/arm/tcg/neon_helper.c b/target/arm/tcg/neon_helper.c index 1a22857b5e..c687e882ad 100644 --- a/target/arm/tcg/neon_helper.c +++ b/target/arm/tcg/neon_helper.c @@ -826,24 +826,6 @@ uint64_t HELPER(neon_widen_s16)(uint32_t x) return ((uint32_t)(int16_t)x) | (high << 32); } -uint64_t HELPER(neon_addl_u16)(uint64_t a, uint64_t b) -{ - uint64_t mask; - mask = (a ^ b) & 0x8000800080008000ull; - a &= ~0x8000800080008000ull; - b &= ~0x8000800080008000ull; - return (a + b) ^ mask; -} - -uint64_t HELPER(neon_addl_u32)(uint64_t a, uint64_t b) -{ - uint64_t mask; - mask = (a ^ b) & 0x8000000080000000ull; - a &= ~0x8000000080000000ull; - b &= ~0x8000000080000000ull; - return (a + b) ^ mask; -} - /* Pairwise long add: add pairs of adjacent elements into * double-width elements in the result (eg _s8 is an 8x8->16 op) */ @@ -887,24 +869,6 @@ uint64_t HELPER(neon_addlp_s16)(uint64_t a) return (uint32_t)reslo | (((uint64_t)reshi) << 32); } -uint64_t HELPER(neon_subl_u16)(uint64_t a, uint64_t b) -{ - uint64_t mask; - mask = (a ^ ~b) & 0x8000800080008000ull; - a |= 0x8000800080008000ull; - b &= ~0x8000800080008000ull; - return (a - b) ^ mask; -} - -uint64_t HELPER(neon_subl_u32)(uint64_t a, uint64_t b) -{ - uint64_t mask; - mask = (a ^ ~b) & 0x8000000080000000ull; - a |= 0x8000000080000000ull; - b &= ~0x8000000080000000ull; - return (a - b) ^ mask; -} - uint64_t HELPER(neon_addl_saturate_s32)(CPUARMState *env, uint64_t a, uint64_t b) { uint32_t x, y; diff --git a/target/arm/tcg/translate-neon.c b/target/arm/tcg/translate-neon.c index 19a18018f1..0821f10fad 100644 --- a/target/arm/tcg/translate-neon.c +++ b/target/arm/tcg/translate-neon.c @@ -1560,8 +1560,8 @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a, NULL, NULL, \ }; \ static NeonGenTwo64OpFn * const addfn[] = { \ - gen_helper_neon_##OP##l_u16, \ - gen_helper_neon_##OP##l_u32, \ + tcg_gen_vec_##OP##16_i64, \ + tcg_gen_vec_##OP##32_i64, \ tcg_gen_##OP##_i64, \ NULL, \ }; \ @@ -1639,8 +1639,8 @@ static bool do_narrow_3d(DisasContext *s, arg_3diff *a, static bool trans_##INSN##_3d(DisasContext *s, arg_3diff *a) \ { \ static NeonGenTwo64OpFn * const addfn[] = { \ - gen_helper_neon_##OP##l_u16, \ - gen_helper_neon_##OP##l_u32, \ + tcg_gen_vec_##OP##16_i64, \ + tcg_gen_vec_##OP##32_i64, \ tcg_gen_##OP##_i64, \ NULL, \ }; \ @@ -1761,8 +1761,8 @@ static bool trans_VABAL_S_3d(DisasContext *s, arg_3diff *a) NULL, }; static NeonGenTwo64OpFn * const addfn[] = { - gen_helper_neon_addl_u16, - gen_helper_neon_addl_u32, + tcg_gen_vec_add16_i64, + tcg_gen_vec_add32_i64, tcg_gen_add_i64, NULL, }; @@ -1779,8 +1779,8 @@ static bool trans_VABAL_U_3d(DisasContext *s, arg_3diff *a) NULL, }; static NeonGenTwo64OpFn * const addfn[] = { - gen_helper_neon_addl_u16, - gen_helper_neon_addl_u32, + tcg_gen_vec_add16_i64, + tcg_gen_vec_add32_i64, tcg_gen_add_i64, NULL, }; @@ -1840,8 +1840,8 @@ static bool trans_VMULL_U_3d(DisasContext *s, arg_3diff *a) NULL, \ }; \ static NeonGenTwo64OpFn * const accfn[] = { \ - gen_helper_neon_##ACC##l_u16, \ - gen_helper_neon_##ACC##l_u32, \ + tcg_gen_vec_##ACC##16_i64, \ + tcg_gen_vec_##ACC##32_i64, \ tcg_gen_##ACC##_i64, \ NULL, \ }; \ @@ -2371,7 +2371,7 @@ static bool trans_VMULL_U_2sc(DisasContext *s, arg_2scalar *a) }; \ static NeonGenTwo64OpFn * const accfn[] = { \ NULL, \ - gen_helper_neon_##ACC##l_u32, \ + tcg_gen_vec_##ACC##32_i64, \ tcg_gen_##ACC##_i64, \ NULL, \ }; \ From patchwork Tue Dec 10 16:17:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848858 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp420565wrn; Tue, 10 Dec 2024 08:27:51 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVyyHSK7EmqKZHYc1sc8tyyyT/uj6dbYP8b/R07aq585BdCgNhi3q8HpIl0kA3A8EeX8eQhRg==@linaro.org X-Google-Smtp-Source: AGHT+IECqPBI4sIFSMs3mdnisfjBQXH554kutILyp1z7YHnrQZ7dUSDEMld1WTHHJUY50KnH5kBl X-Received: by 2002:a05:6102:3909:b0:4af:a925:6b40 with SMTP id ada2fe7eead31-4afcaaf3bbcmr17004154137.20.1733848071077; Tue, 10 Dec 2024 08:27:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848071; cv=none; d=google.com; s=arc-20240605; b=VbeE3mBzvhgOU2tLVvwFzJ7FphYcEziKGQnlynVodPAoLSNVvzXp0+JIK90p/UFc6/ WRSX+3fpKZWvyZCn9W4djSzHnO56R5GFvA5H2tR7fSunDYIu15iKY/y/OZgbBX6Q3Fnt 2Vq+r5Ry5D3dSRRHkHvXaD1ILDnj9VR7UM6cLSppmBmava10QaQDVn3vcCDt7/NmeHy2 uVHud+F/PtDh1bHOoWequ4eUnVvdYZXnVBNNTdd/8KuD0rq/jA/k65MyoLSbuvsUGK2A S+DraPwGq9fyMsTyULjbTcphKE1puh/NHuYy04CJzDBVr3y61/2nrNwccRLos2u8z+BG i0jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=n0qyOU3LcRXKe6qOmmCQNxZ02hAR2DxZjcJ1eX1Yeyw=; fh=OZQBfL75rC14cCDy3q+1fYHCs9KjWAQ7ZJ3hTfS+5lQ=; b=EXu1Qt/F0dyxOaihpuae4/sKdC8vAr4WQFGtrHspYV1ae8uS8BIuNcHUICfvLTX1qy uYYw141Mj6zRFuQJnYM4Oh064Qlb729AIx2f+oqEHfKfamJSADyo2Hnq7C6g/ysG8eSr R3peDpL1+MHDIqFeDjPVuCOyiPIyoW1KmqLKtpsTblaXls+F9d1fUtza99EvWxUF6sgD u4p37azC1x1466tXbX/tBgbzFGlOv1y2Z9pw8BFEbgaWeMBSsoFWDIM3qwC/poPi2/3+ t1knNYdYUdrvEGs3uQm6GNqq85ugcbco8nOtfFx0d3tZKx6hRM1ykL0r/9pz0tCq27en veCA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EUSnm3yp; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4afe67be6ccsi1477865137.451.2024.12.10.08.27.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:27:51 -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=EUSnm3yp; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL31y-0007Ua-7f; Tue, 10 Dec 2024 11:24:16 -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 1tL31p-0006xP-6t for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:05 -0500 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL31n-0007SV-92 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:04 -0500 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-540218726d5so1895501e87.2 for ; Tue, 10 Dec 2024 08:24:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847841; x=1734452641; 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=n0qyOU3LcRXKe6qOmmCQNxZ02hAR2DxZjcJ1eX1Yeyw=; b=EUSnm3ypj3hZJhgiClw5ZzKqJ7wobwLIavYnWwh5x6M+retpBLRZxQLrRM02Yooo6B 6rhHVKdV5ditKaaQzQQc6gND26398MITBPeokJfaujJUWMYyved/lwfWUTEUvTXmCylW kNYqE4VpaJDCymGk6APGtFflvsazPHZk9t3fHO2w57C3ERuIhywslTrMI+u99XElq/ZO HgJ9D+KRc4vzVAQIMmF8C0lZzq6ijwuEaGM/qr18MrfWVkaScBb2cEe0IFqITgEyTTuO MYVMmKD+VM5BQ12ic/GsDXE1cQl678fQshpTrhGItk7D+QT3LeqcnpONQR6fH1xnrXkd RZCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847841; x=1734452641; 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=n0qyOU3LcRXKe6qOmmCQNxZ02hAR2DxZjcJ1eX1Yeyw=; b=BcsVaUIMDczfVIVD2M0OpD8J4/aWZUx6WcKyfmEP7w0w0zsWMAKzwKK7W5TqRy59kR QLE9ZiKDLKGbC8E0BoLVfv2tVPLGhYy6Scc5yBwUC3F4wtqzNmXvoUSc4YbwEYFwhCZm zMTh758VpgeDypY7CtUO9LVM/PJfwZMPge74Tw/KjMZDX0gs5ZvZcKdMPM/9uBIf0upA TJWV83oesaMDgYW+MyDYV1Md2ELidOVKhoMkVEo8vN8WR0St6f3uSiVJQXBFUwQ+rIKk R+pRblinuZ7N3419W1m+LE8V/qQL6IM68nDzt+WhhU5mutTozx4jKuRGaIVpfkyyrSWB jRXw== X-Gm-Message-State: AOJu0YyzEfPo5Sx3YBQAoEMQ7hmwMcWgSa3Y2PRbX3as8M8Fy/sMm+Vm IF5RloovQGNkN11ZUEhCIDUxPZh8UPPHDdmQ2iPOoyR99cukPoBYQy2/TbE3KcjrFRD4cZFDA6k 7KtuV8PAV X-Gm-Gg: ASbGnctjeIGXA1Y1IeiGJ9TYS8N8Q3IM9GpVG5IA8DofEs//W18JV5nL9Iy6yG8y0xy pVpSfkfx/6hPhRRnLK+hRqLkUjFDPMI1cxr4Hi0qJorF16Wi7O3muImX1BnrLnpm88faU/67n2f ON/1gu/ZgbIdpxbm7Tinw5At1zL4I89bCafSTaLhGK1L8QluEEbVht1stovcltl4wBa727mk1y3 urJhtp70Kp0+eqlb5T3ISp+WUS+sgbdAtk0GODlQ7QNxMAH7ViPZNg5wBs= X-Received: by 2002:a05:6512:33ca:b0:540:1c6e:f040 with SMTP id 2adb3069b0e04-5402410748cmr1749376e87.45.1733847841521; Tue, 10 Dec 2024 08:24:01 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.23.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 48/69] target/arm: Introduce clear_vec Date: Tue, 10 Dec 2024 10:17:12 -0600 Message-ID: <20241210161733.1830573-49-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12b.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 In a couple of places, clearing the entire vector before storing one element is the easiest solution. Wrap that into a helper function. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 29d55bcedd..6655468df0 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -628,7 +628,16 @@ static TCGv_i32 read_fp_hreg(DisasContext *s, int reg) return v; } -/* Clear the bits above an N-bit vector, for N = (is_q ? 128 : 64). +static void clear_vec(DisasContext *s, int rd) +{ + unsigned ofs = fp_reg_offset(s, rd, MO_64); + unsigned vsz = vec_full_reg_size(s); + + tcg_gen_gvec_dup_imm(MO_64, ofs, vsz, vsz, 0); +} + +/* + * Clear the bits above an N-bit vector, for N = (is_q ? 128 : 64). * If SVE is not enabled, then there are only 128 bits in the vector. */ static void clear_vec_high(DisasContext *s, bool is_q, int rd) @@ -4851,7 +4860,6 @@ static bool trans_SM3SS1(DisasContext *s, arg_SM3SS1 *a) TCGv_i32 tcg_op2 = tcg_temp_new_i32(); TCGv_i32 tcg_op3 = tcg_temp_new_i32(); TCGv_i32 tcg_res = tcg_temp_new_i32(); - unsigned vsz, dofs; read_vec_element_i32(s, tcg_op1, a->rn, 3, MO_32); read_vec_element_i32(s, tcg_op2, a->rm, 3, MO_32); @@ -4863,9 +4871,7 @@ static bool trans_SM3SS1(DisasContext *s, arg_SM3SS1 *a) tcg_gen_rotri_i32(tcg_res, tcg_res, 25); /* Clear the whole register first, then store bits [127:96]. */ - vsz = vec_full_reg_size(s); - dofs = vec_full_reg_offset(s, a->rd); - tcg_gen_gvec_dup_imm(MO_64, dofs, vsz, vsz, 0); + clear_vec(s, a->rd); write_vec_element_i32(s, tcg_res, a->rd, 3, MO_32); } return true; @@ -6307,7 +6313,6 @@ static bool do_scalar_muladd_widening_idx(DisasContext *s, arg_rrx_e *a, TCGv_i64 t0 = tcg_temp_new_i64(); TCGv_i64 t1 = tcg_temp_new_i64(); TCGv_i64 t2 = tcg_temp_new_i64(); - unsigned vsz, dofs; if (acc) { read_vec_element(s, t0, a->rd, 0, a->esz + 1); @@ -6317,9 +6322,7 @@ static bool do_scalar_muladd_widening_idx(DisasContext *s, arg_rrx_e *a, fn(t0, t1, t2); /* Clear the whole register first, then store scalar. */ - vsz = vec_full_reg_size(s); - dofs = vec_full_reg_offset(s, a->rd); - tcg_gen_gvec_dup_imm(MO_64, dofs, vsz, vsz, 0); + clear_vec(s, a->rd); write_vec_element(s, t0, a->rd, 0, a->esz + 1); } return true; From patchwork Tue Dec 10 16:17:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848866 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp421604wrn; Tue, 10 Dec 2024 08:29:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV8mSZV1YGG1FgKZxHgAHD5kXiI2qDOK1ZwecocFoFwib3xjC2wVCZOWxfpRWc4Yfd7NR9DBw==@linaro.org X-Google-Smtp-Source: AGHT+IF1XGq2dXMp4M+Z0uGuutrvpkhOI+EcD9L9iTqPANjc/VvnjW8tNCsI6oQFfbRRvUk1gSgu X-Received: by 2002:a05:6214:529e:b0:6d4:10b0:c249 with SMTP id 6a1803df08f44-6d8e71349e1mr279671526d6.22.1733848188620; Tue, 10 Dec 2024 08:29:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848188; cv=none; d=google.com; s=arc-20240605; b=iv57UYMmD4uc+D4WBH3i6kbGijm8eYvd22EW+Cta1PVQFY0lIccQbfs5dymoNRihvs 45tnHQ40XFSXycqDqLlCwX3AUspRIQJqS+5JIOLWJxKR7ZH3BQMVk9EhiFvyz8X0Ddju RSRoJiw9Tk1Z+SJ4J8SNnfnHlwplZwbmKl7QsvUp2PhVfmU9mU8DTBO7ssMWa8iOskFf heggj8j6jzLQZcRX6wPpd+CK6Fr77Q9RSNGiovNkbgjc+uotBjZ//BDMb2wMzvXnzdve 7YmbYYXF23toeCZcnlQTeTp+cI2aB3cVi2mv8NH4S3ouTgNnY3t/DmogXUXztlB7LG8P sGPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=xUecK3E1/dcQry3nyFCyRebBoZWMuQHeuKyFcmMyNaU=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=F8x3uTWEBYThnn/2imFuPamLdmsyPkNHBEPCg1smHt2YoVtvJ7UlXnDmd6AopW1iAf salb1hWi5U+u02Sa4o5zeC8Bmej1xvcXUFotV1tmm6V1UrAXy6II1x2dZDpu9SedhU7p oT1nBrJWNnket4Lx3NDQvOfdx0xg+ARo6qGQeXNlCdXHLN9UTLUIp+QxAjDv38Utu5sa SIJwS6+/3qIffTNPMPQ9ehKZCPqULOXA7b83stNvVqyFd8pGNolB7MuY1svsbub8GHY4 tloIW2xjBS2Qif9CQwE0RCx4GDINcOnMA6c1IEbwnrIqJfZ3MJvKQuyseF1tNtQRo65s cSMQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lwcIT3Xj; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8f58f23d2si100390416d6.114.2024.12.10.08.29.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:29:48 -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=lwcIT3Xj; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL32L-0007iC-7I; Tue, 10 Dec 2024 11:24:41 -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 1tL31t-0007UY-JB for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:12 -0500 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL31r-0007TT-DL for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:09 -0500 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-5401ab97206so2433135e87.3 for ; Tue, 10 Dec 2024 08:24:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847846; x=1734452646; 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=xUecK3E1/dcQry3nyFCyRebBoZWMuQHeuKyFcmMyNaU=; b=lwcIT3Xj4zDfOsxLZ/U8BuanAyp8Sj34gAVBdASeG20/E4ubSs008Ka4EdxO6KXhof n6h+Y0lEmWVHfOBaCGdw05/OpuyGVjwjBNXBkn6Tnq+AtY58bgdrbOiZU2nS5LU1Yt/1 oovzaI47zXNK96zU7Kx9g5whKZmt3dXzalTYFgW0U2OjRgjsiqtwTCc/acnVKQxFfPL7 EuJcNm9jznckYaXKU5iUX643OuUDIajyV1BGuZ2AthqLITNNpxL6s+KTAc189DfmZqNW 1lMVvhdQYkjsQAa1hJuwL1jUiH7Zy9GBTpXpWr541LEgdv3sEvZxGoPHSH0jXjKv59OA liVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847846; x=1734452646; 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=xUecK3E1/dcQry3nyFCyRebBoZWMuQHeuKyFcmMyNaU=; b=jNVSqnEaS1sYazHI9d90h5mpwM4JNMZ1lTJqhb7swW6XYDjYxSd4IyxwZ1DrYPGjlH KgrFiaFXSrv37dUHR+zY38BvHOgcjpekaVmPOrvnA1Xa/KP04R2wStDe4U15JjYx8vbS F8kIHBCRtBUSK7/rX9bYStGIhYH7U0Dam1HjggTK9NXfmxMBv1EwSMjipyzDqriHhdnX yB52rLOsnYKsNqU3fJqnioEZ1MZDoH9sL5dGMhkInclTsMlBoILkGtZjBOO6M5152DXK A++PbV6m7FsxFb/HgAUTmcV1HwTeBNpdfFHObt6dTdARGJZKDasknLEClRZbsMPVi9nT +gDQ== X-Gm-Message-State: AOJu0Yx0B3NG6ZQNdwddbnbBsL3fMzix5lejfKnzkwqvJSIDnkcynC2v xh23lTY39GYKc2i5XTFyDjxQ2lfQOYb85+xh+QcGr0Zv1tYgmgFlvXsjFFSg8mzH7jTp5dUZnYg O6SUfUFUQ X-Gm-Gg: ASbGncs1qGpbywTBR4Ws5Zs7FZiJqg2N1jcm6Rn6eGpMO6/+R2KjS25UU/DVVAhPv48 rI3Qq2vVhlw55DZIVBJNwMcXenyHQk/sQbnreCR1CH7frjUYxtKKvptG9jvX7FM7a9ntc1a4Gok 0BISbMyv2yfteZS89gxHhmsvfNpgugCdsCk432IMJHpUX6uCY65pokulgJ8CijvFANafMQyABIE M+KmSCXYxIL/21CIPxB+DlFkeKApVz9dL0EPmM6HKx95JHoGu3T0A/pjHE= X-Received: by 2002:a05:6512:68b:b0:53e:39ba:fb4b with SMTP id 2adb3069b0e04-540240d9b76mr1734672e87.26.1733847845682; Tue, 10 Dec 2024 08:24:05 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 49/69] target/arm: Convert XTN, SQXTUN, SQXTN, UQXTN to decodetree Date: Tue, 10 Dec 2024 10:17:13 -0600 Message-ID: <20241210161733.1830573-50-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12c; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12c.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 153 ++++++++++++++++++++------------- target/arm/tcg/a64.decode | 9 ++ 2 files changed, 102 insertions(+), 60 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 6655468df0..f9d203f7e6 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8921,6 +8921,62 @@ TRANS(CMLE0_s, do_cmop0_d, a, TCG_COND_LE) TRANS(CMLT0_s, do_cmop0_d, a, TCG_COND_LT) TRANS(CMEQ0_s, do_cmop0_d, a, TCG_COND_EQ) +static bool do_2misc_narrow_scalar(DisasContext *s, arg_rr_e *a, + ArithOneOp * const fn[3]) +{ + if (a->esz == MO_64) { + return false; + } + if (fp_access_check(s)) { + TCGv_i64 t = tcg_temp_new_i64(); + + read_vec_element(s, t, a->rn, 0, a->esz + 1); + fn[a->esz](t, t); + clear_vec(s, a->rd); + write_vec_element(s, t, a->rd, 0, a->esz); + } + return true; +} + +#define WRAP_ENV(NAME) \ + static void gen_##NAME(TCGv_i64 d, TCGv_i64 n) \ + { gen_helper_##NAME(d, tcg_env, n); } + +WRAP_ENV(neon_unarrow_sat8) +WRAP_ENV(neon_unarrow_sat16) +WRAP_ENV(neon_unarrow_sat32) + +static ArithOneOp * const f_scalar_sqxtun[] = { + gen_neon_unarrow_sat8, + gen_neon_unarrow_sat16, + gen_neon_unarrow_sat32, +}; +TRANS(SQXTUN_s, do_2misc_narrow_scalar, a, f_scalar_sqxtun) + +WRAP_ENV(neon_narrow_sat_s8) +WRAP_ENV(neon_narrow_sat_s16) +WRAP_ENV(neon_narrow_sat_s32) + +static ArithOneOp * const f_scalar_sqxtn[] = { + gen_neon_narrow_sat_s8, + gen_neon_narrow_sat_s16, + gen_neon_narrow_sat_s32, +}; +TRANS(SQXTN_s, do_2misc_narrow_scalar, a, f_scalar_sqxtn) + +WRAP_ENV(neon_narrow_sat_u8) +WRAP_ENV(neon_narrow_sat_u16) +WRAP_ENV(neon_narrow_sat_u32) + +static ArithOneOp * const f_scalar_uqxtn[] = { + gen_neon_narrow_sat_u8, + gen_neon_narrow_sat_u16, + gen_neon_narrow_sat_u32, +}; +TRANS(UQXTN_s, do_2misc_narrow_scalar, a, f_scalar_uqxtn) + +#undef WRAP_ENV + static bool do_gvec_fn2(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) { if (!a->q && a->esz == MO_64) { @@ -8964,6 +9020,37 @@ TRANS(UADDLP_v, do_gvec_fn2_bhs, a, gen_gvec_uaddlp) TRANS(SADALP_v, do_gvec_fn2_bhs, a, gen_gvec_sadalp) TRANS(UADALP_v, do_gvec_fn2_bhs, a, gen_gvec_uadalp) +static bool do_2misc_narrow_vector(DisasContext *s, arg_qrr_e *a, + ArithOneOp * const fn[3]) +{ + if (a->esz == MO_64) { + return false; + } + if (fp_access_check(s)) { + TCGv_i64 t0 = tcg_temp_new_i64(); + TCGv_i64 t1 = tcg_temp_new_i64(); + + read_vec_element(s, t0, a->rn, 0, MO_64); + read_vec_element(s, t1, a->rn, 1, MO_64); + fn[a->esz](t0, t0); + fn[a->esz](t1, t1); + write_vec_element(s, t0, a->rd, a->q ? 2 : 0, MO_32); + write_vec_element(s, t1, a->rd, a->q ? 3 : 1, MO_32); + clear_vec_high(s, a->q, a->rd); + } + return true; +} + +static ArithOneOp * const f_scalar_xtn[] = { + gen_helper_neon_narrow_u8, + gen_helper_neon_narrow_u16, + tcg_gen_ext32u_i64, +}; +TRANS(XTN, do_2misc_narrow_vector, a, f_scalar_xtn) +TRANS(SQXTUN_v, do_2misc_narrow_vector, a, f_scalar_sqxtun) +TRANS(SQXTN_v, do_2misc_narrow_vector, a, f_scalar_sqxtn) +TRANS(UQXTN_v, do_2misc_narrow_vector, a, f_scalar_uqxtn) + /* Common vector code for handling integer to FP conversion */ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, int elements, int is_signed, @@ -9546,38 +9633,6 @@ static void handle_2misc_narrow(DisasContext *s, bool scalar, tcg_res[pass] = tcg_temp_new_i64(); switch (opcode) { - case 0x12: /* XTN, SQXTUN */ - { - static NeonGenOne64OpFn * const xtnfns[3] = { - gen_helper_neon_narrow_u8, - gen_helper_neon_narrow_u16, - tcg_gen_ext32u_i64, - }; - static NeonGenOne64OpEnvFn * const sqxtunfns[3] = { - gen_helper_neon_unarrow_sat8, - gen_helper_neon_unarrow_sat16, - gen_helper_neon_unarrow_sat32, - }; - if (u) { - genenvfn = sqxtunfns[size]; - } else { - genfn = xtnfns[size]; - } - break; - } - case 0x14: /* SQXTN, UQXTN */ - { - static NeonGenOne64OpEnvFn * const fns[3][2] = { - { gen_helper_neon_narrow_sat_s8, - gen_helper_neon_narrow_sat_u8 }, - { gen_helper_neon_narrow_sat_s16, - gen_helper_neon_narrow_sat_u16 }, - { gen_helper_neon_narrow_sat_s32, - gen_helper_neon_narrow_sat_u32 }, - }; - genenvfn = fns[size][u]; - break; - } case 0x16: /* FCVTN, FCVTN2 */ /* 32 bit to 16 bit or 64 bit to 32 bit float conversion */ if (size == 2) { @@ -9618,6 +9673,8 @@ static void handle_2misc_narrow(DisasContext *s, bool scalar, } break; default: + case 0x12: /* XTN, SQXTUN */ + case 0x14: /* SQXTN, UQXTN */ g_assert_not_reached(); } @@ -9653,22 +9710,6 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) TCGv_ptr tcg_fpstatus; switch (opcode) { - case 0x12: /* SQXTUN */ - if (!u) { - unallocated_encoding(s); - return; - } - /* fall through */ - case 0x14: /* SQXTN, UQXTN */ - if (size == 3) { - unallocated_encoding(s); - return; - } - if (!fp_access_check(s)) { - return; - } - handle_2misc_narrow(s, true, opcode, u, false, size, rn, rd); - return; case 0xc ... 0xf: case 0x16 ... 0x1d: case 0x1f: @@ -9742,6 +9783,8 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) case 0x9: /* CMEQ, CMLE */ case 0xa: /* CMLT */ case 0xb: /* ABS, NEG */ + case 0x12: /* SQXTUN */ + case 0x14: /* SQXTN, UQXTN */ unallocated_encoding(s); return; } @@ -9939,18 +9982,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) TCGv_ptr tcg_fpstatus; switch (opcode) { - case 0x12: /* XTN, XTN2, SQXTUN, SQXTUN2 */ - case 0x14: /* SQXTN, SQXTN2, UQXTN, UQXTN2 */ - if (size == 3) { - unallocated_encoding(s); - return; - } - if (!fp_access_check(s)) { - return; - } - - handle_2misc_narrow(s, false, opcode, u, is_q, size, rn, rd); - return; case 0x13: /* SHLL, SHLL2 */ if (u == 0 || size == 3) { unallocated_encoding(s); @@ -10142,6 +10173,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x9: /* CMEQ, CMLE */ case 0xa: /* CMLT */ case 0xb: /* ABS, NEG */ + case 0x12: /* XTN, XTN2, SQXTUN, SQXTUN2 */ + case 0x14: /* SQXTN, SQXTN2, UQXTN, UQXTN2 */ unallocated_encoding(s); return; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index f3488766b2..295329448f 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1642,6 +1642,10 @@ CMEQ0_s 0101 1110 111 00000 10011 0 ..... ..... @rr CMLE0_s 0111 1110 111 00000 10011 0 ..... ..... @rr CMLT0_s 0101 1110 111 00000 10101 0 ..... ..... @rr +SQXTUN_s 0111 1110 ..1 00001 00101 0 ..... ..... @rr_e +SQXTN_s 0101 1110 ..1 00001 01001 0 ..... ..... @rr_e +UQXTN_s 0111 1110 ..1 00001 01001 0 ..... ..... @rr_e + # Advanced SIMD two-register miscellaneous SQABS_v 0.00 1110 ..1 00000 01111 0 ..... ..... @qrr_e @@ -1667,3 +1671,8 @@ SADDLP_v 0.00 1110 ..1 00000 00101 0 ..... ..... @qrr_e UADDLP_v 0.10 1110 ..1 00000 00101 0 ..... ..... @qrr_e SADALP_v 0.00 1110 ..1 00000 01101 0 ..... ..... @qrr_e UADALP_v 0.10 1110 ..1 00000 01101 0 ..... ..... @qrr_e + +XTN 0.00 1110 ..1 00001 00101 0 ..... ..... @qrr_e +SQXTUN_v 0.10 1110 ..1 00001 00101 0 ..... ..... @qrr_e +SQXTN_v 0.00 1110 ..1 00001 01001 0 ..... ..... @qrr_e +UQXTN_v 0.10 1110 ..1 00001 01001 0 ..... ..... @qrr_e From patchwork Tue Dec 10 16:17:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848861 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp421029wrn; Tue, 10 Dec 2024 08:28:41 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX71JfaxGvm7Epc3zeeNu4i0bAGkcbYujUOCfgj5YMssAryINAF9/82BgKGm0vjf7a93qodjA==@linaro.org X-Google-Smtp-Source: AGHT+IHcX8G80m2NN495LoPnmUspD2VPlwV+E9Z7soF6ukIgtQAqX+PTk0CqRc3BWx6XGsEDt5Di X-Received: by 2002:a05:6214:2488:b0:6d4:238e:35bb with SMTP id 6a1803df08f44-6d8e715ddc9mr322623436d6.18.1733848121756; Tue, 10 Dec 2024 08:28:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848121; cv=none; d=google.com; s=arc-20240605; b=K/B8gNDepV7T2ap9rbNFQ9ED95BYLLkDUAbh1LEwvTU4+iYyqtu2M4b3gEgNBhQfjd HdtqDYtR9GwgzuLXCaBrC1cxznhwQ/XMC8CFc/x4AHviXPXRVLe1gJHG9SFqODyDFDfX /WtwPiNn78FANh+Y2wpuZawEHPrdPv3qY80Dv5nlGRya0Zz0ygNrd41zkMXvPKkWXO6T x5RN63KNCHJ9dli2uj4Cl5Xr9OollAy4lwsiuGtRe5XTNHbc0ralb0KCZJumfWtsA0ZU DCMQ4QSAnFyH7twSt5IgVBq6HFDqJvMkcHcHEQKywWh7iVTrZDKrRm5/lgg5fdMyHgMc lnDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=qH4CPUTXR8BSz86LZEoH93nMlJ9bGid/Em49QpR++nw=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=k0uy1olK2b3bJQhsxTY1u4CSJhTzKE8bmso5inImX1AgrgxXE/ZCjcNMR4WbCs6hl2 EE0tKAsd+F3l/42Nh6AV3pFroT5NeEEKuJT4k3GB9Z93FsAREDeg4YvLOJyxf86X3QNP 4lYcf8Lzjq0cKUkDK9n0BsRH00DK339iixD5XA5ZacCjr4X9kHYzybuXm30KHGBCSjqJ pbEPAnt/bWpjBhdM6h9A6UXzLA0xTJNwoXHZ56hmEvF4/o1vqyUNQbIizNLgh3LsAbFX 9/IuDA/DUuT2zFJ368URDHRqrH0avDAH8AKCkJlYLGX5fNgM4c9nV5nDoENiNvjAzBqJ aM/Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DP2cVLeC; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6e43e68e4si147032385a.365.2024.12.10.08.28.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:28:41 -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=DP2cVLeC; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL32b-00087j-S9; Tue, 10 Dec 2024 11:24:54 -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 1tL31x-0007Xi-7o for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:14 -0500 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL31v-0007UL-F6 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:12 -0500 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-540215984f0so2050382e87.1 for ; Tue, 10 Dec 2024 08:24:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847850; x=1734452650; 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=qH4CPUTXR8BSz86LZEoH93nMlJ9bGid/Em49QpR++nw=; b=DP2cVLeCn/ic9OUu9KTrmPtLJ8qQHJoAgdFcaSNlGW+TJ5G9iSMdSKSqDkUoThlGaa 7hEaSkdxFKMK1VkGt2FDT1+v+kWZ+b0zIbMYzJuUjgawhz1uw/+q5GVT6qSiTSkCMqEQ XLwlT7CcXu7IzQCHOuN8Kl0qTx+F8O6cPcUan3pfQ6R5Wivq98qBuL4FOC5nMFdis1xn m9vCSl/W53PdaJD+UsExjgxKXMDEpYznYuzRo7W1cGNF0B9TTTAPrQBn5YtTQVd5v8OV TE7JsCldgkmkjXB989oHdvfAXUm5/lJfj7ND1cv4gb3OrSoQ1G327npiixLJOP+kvJsu drDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847850; x=1734452650; 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=qH4CPUTXR8BSz86LZEoH93nMlJ9bGid/Em49QpR++nw=; b=cQXo/BRoWEuX/XHmr1MyY43zhO31+jkcb4R0K0DawRgX3XR232WxGXSHKtcJaXXgqf 31tbytg5O/0IX/SHfU3c7jSrckg7Xr9/PPrlk+yMi+XaLh6qabAIXdWlZxFcSW4RsYHG cEdi/kRxt6bX31FC6yQWWAk1ENnxtoIH5aDQn6Lqs6p2DjIs6y9nIm10YgpND7TVff2C zp7KqXs7lhulyuGd8OXcl7VS9FifuPYLcAAZoBONgyX3WZ8dFSCIb69funVAjuy1YYSX zaUsMiwtVCTsPiGmPcBJa4WzyBBUNkrLDRwWhCnES4QlU5sAOsCRCJ2UVJYC6RYRyNAa Qvyg== X-Gm-Message-State: AOJu0Yw4mtWWJxjahxckqexGpgIcGP2RtqbCidq9hKX7BnpvW68YdkLZ khEZ9hsOna5AxCc7WyNwaFdjhJkdIhlsafgzQKxl/7O8v8iJW84utQqcBYF2lD/BLR1XieeUeJ9 Pu4IAbPLL X-Gm-Gg: ASbGncsqLA5Pl0/AkvN7GhxvLfaBobthVL92z/iBVjgHqRvHX6SdXApuBfkTlFkvpmn TVd5l/h0kS2k/LqYEPQ7AzXUZ1VcOLSIM200P6BEUaCeX21o+8kT9j2AJkYFkSf4S8blLyFTwIg 4itjs8vmj/jLU+w8UbhEMRIBXH/zg3/na5OfmF1M9evv8q5PHGJuqvqwqfHoDkdKZXA/63CsCNk /Y7no6Sxyy3sxtw9R1zmOUDxRkOqOu0T0d+rNaP+Mk/7Pes+q0Kzqfx3eA= X-Received: by 2002:a05:6512:ea0:b0:540:2092:934 with SMTP id 2adb3069b0e04-540240cd264mr1538453e87.25.1733847849638; Tue, 10 Dec 2024 08:24:09 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:08 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 50/69] target/arm: Convert FCVTN, BFCVTN to decodetree Date: Tue, 10 Dec 2024 10:17:14 -0600 Message-ID: <20241210161733.1830573-51-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12c; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12c.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 89 ++++++++++++++++++---------------- target/arm/tcg/a64.decode | 5 ++ 2 files changed, 52 insertions(+), 42 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index f9d203f7e6..f04d03ff6e 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9051,6 +9051,49 @@ TRANS(SQXTUN_v, do_2misc_narrow_vector, a, f_scalar_sqxtun) TRANS(SQXTN_v, do_2misc_narrow_vector, a, f_scalar_sqxtn) TRANS(UQXTN_v, do_2misc_narrow_vector, a, f_scalar_uqxtn) +static void gen_fcvtn_hs(TCGv_i64 d, TCGv_i64 n) +{ + TCGv_i32 tcg_lo = tcg_temp_new_i32(); + TCGv_i32 tcg_hi = tcg_temp_new_i32(); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); + TCGv_i32 ahp = get_ahp_flag(); + + tcg_gen_extr_i64_i32(tcg_lo, tcg_hi, n); + gen_helper_vfp_fcvt_f32_to_f16(tcg_lo, tcg_lo, fpst, ahp); + gen_helper_vfp_fcvt_f32_to_f16(tcg_hi, tcg_hi, fpst, ahp); + tcg_gen_deposit_i32(tcg_lo, tcg_lo, tcg_hi, 16, 16); + tcg_gen_extu_i32_i64(d, tcg_lo); +} + +static void gen_fcvtn_sd(TCGv_i64 d, TCGv_i64 n) +{ + TCGv_i32 tmp = tcg_temp_new_i32(); + gen_helper_vfp_fcvtsd(tmp, n, tcg_env); + tcg_gen_extu_i32_i64(d, tmp); +} + +static ArithOneOp * const f_vector_fcvtn[] = { + NULL, + gen_fcvtn_hs, + gen_fcvtn_sd, +}; +TRANS(FCVTN_v, do_2misc_narrow_vector, a, f_vector_fcvtn) + +static void gen_bfcvtn_hs(TCGv_i64 d, TCGv_i64 n) +{ + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); + TCGv_i32 tmp = tcg_temp_new_i32(); + gen_helper_bfcvt_pair(tmp, n, fpst); + tcg_gen_extu_i32_i64(d, tmp); +} + +static ArithOneOp * const f_vector_bfcvtn[] = { + NULL, + gen_bfcvtn_hs, + NULL, +}; +TRANS_FEAT(BFCVTN_v, aa64_bf16, do_2misc_narrow_vector, a, f_vector_bfcvtn) + /* Common vector code for handling integer to FP conversion */ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, int elements, int is_signed, @@ -9633,33 +9676,6 @@ static void handle_2misc_narrow(DisasContext *s, bool scalar, tcg_res[pass] = tcg_temp_new_i64(); switch (opcode) { - case 0x16: /* FCVTN, FCVTN2 */ - /* 32 bit to 16 bit or 64 bit to 32 bit float conversion */ - if (size == 2) { - TCGv_i32 tmp = tcg_temp_new_i32(); - gen_helper_vfp_fcvtsd(tmp, tcg_op, tcg_env); - tcg_gen_extu_i32_i64(tcg_res[pass], tmp); - } else { - TCGv_i32 tcg_lo = tcg_temp_new_i32(); - TCGv_i32 tcg_hi = tcg_temp_new_i32(); - TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); - TCGv_i32 ahp = get_ahp_flag(); - - tcg_gen_extr_i64_i32(tcg_lo, tcg_hi, tcg_op); - gen_helper_vfp_fcvt_f32_to_f16(tcg_lo, tcg_lo, fpst, ahp); - gen_helper_vfp_fcvt_f32_to_f16(tcg_hi, tcg_hi, fpst, ahp); - tcg_gen_deposit_i32(tcg_lo, tcg_lo, tcg_hi, 16, 16); - tcg_gen_extu_i32_i64(tcg_res[pass], tcg_lo); - } - break; - case 0x36: /* BFCVTN, BFCVTN2 */ - { - TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); - TCGv_i32 tmp = tcg_temp_new_i32(); - gen_helper_bfcvt_pair(tmp, tcg_op, fpst); - tcg_gen_extu_i32_i64(tcg_res[pass], tmp); - } - break; case 0x56: /* FCVTXN, FCVTXN2 */ { /* @@ -9675,6 +9691,8 @@ static void handle_2misc_narrow(DisasContext *s, bool scalar, default: case 0x12: /* XTN, SQXTUN */ case 0x14: /* SQXTN, UQXTN */ + case 0x16: /* FCVTN, FCVTN2 */ + case 0x36: /* BFCVTN, BFCVTN2 */ g_assert_not_reached(); } @@ -10088,21 +10106,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) unallocated_encoding(s); return; } - /* fall through */ - case 0x16: /* FCVTN, FCVTN2 */ - /* handle_2misc_narrow does a 2*size -> size operation, but these - * instructions encode the source size rather than dest size. - */ - if (!fp_access_check(s)) { - return; - } - handle_2misc_narrow(s, false, opcode, 0, is_q, size - 1, rn, rd); - return; - case 0x36: /* BFCVTN, BFCVTN2 */ - if (!dc_isar_feature(aa64_bf16, s) || size != 2) { - unallocated_encoding(s); - return; - } if (!fp_access_check(s)) { return; } @@ -10155,6 +10158,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } break; default: + case 0x16: /* FCVTN, FCVTN2 */ + case 0x36: /* BFCVTN, BFCVTN2 */ unallocated_encoding(s); return; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 295329448f..456912cd7c 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -21,6 +21,7 @@ %rd 0:5 %esz_sd 22:1 !function=plus_2 +%esz_hs 22:1 !function=plus_1 %esz_hsd 22:2 !function=xor_2 %hl 11:1 21:1 %hlm 11:1 20:2 @@ -74,6 +75,7 @@ @qrr_b . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=0 @qrr_h . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=1 @qrr_bh . q:1 ...... . esz:1 ...... ...... rn:5 rd:5 &qrr_e +@qrr_hs . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=%esz_hs @qrr_e . q:1 ...... esz:2 ...... ...... rn:5 rd:5 &qrr_e @qrrr_b . q:1 ...... ... rm:5 ...... rn:5 rd:5 &qrrr_e esz=0 @@ -1676,3 +1678,6 @@ XTN 0.00 1110 ..1 00001 00101 0 ..... ..... @qrr_e SQXTUN_v 0.10 1110 ..1 00001 00101 0 ..... ..... @qrr_e SQXTN_v 0.00 1110 ..1 00001 01001 0 ..... ..... @qrr_e UQXTN_v 0.10 1110 ..1 00001 01001 0 ..... ..... @qrr_e + +FCVTN_v 0.00 1110 0.1 00001 01101 0 ..... ..... @qrr_hs +BFCVTN_v 0.00 1110 101 00001 01101 0 ..... ..... @qrr_h From patchwork Tue Dec 10 16:17:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848860 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp420998wrn; Tue, 10 Dec 2024 08:28:37 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVT/s9MabIfhgYbYa6a71GFj3cMj00rmAecbgm9MRFjShhQ9L2wF42X3Bq8OFFHaCWhYuG02A==@linaro.org X-Google-Smtp-Source: AGHT+IEOL144LSbq+5WKGuurWuOGTD8YaN4C3JIlsw5pXo5+6J+wDKc5MhmSvGmiFkZBb+SI7S5E X-Received: by 2002:a05:620a:2b4d:b0:7b6:c90e:e227 with SMTP id af79cd13be357-7b6dce18442mr773354385a.20.1733848117181; Tue, 10 Dec 2024 08:28:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848117; cv=none; d=google.com; s=arc-20240605; b=SIkXJVGBreedo6T91jVgJR6NpeEn9oWfMEfzqlP9HZtrn5g5nBeTjRP9URWgzRJn7w 6ttVbseqe2wDL/C3AdNc/QnGZdtOPVnATVD1ktuS6dyK1wL2bA+3c1OfIn75DcyVlkaU MSk/qtu4jxQM/1ZiCH2tcvKphZfJzIYv6mcYNpdasVnrQ+VakxYNqLFrWrT5JgFYo8b0 6kjb9vjbPQwIFUg6CdGmXIfTz021Jgc3cJytXR2W75Zpj/z2h1nAkyykWg6gboz+L/sm HlI6r65Nk/fgM7rw7+bMjKQ71Qxlg+lh7V2x65vYsV1NWcL7RF89dYCuFj4fHaaxgpEK BM0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=EYb+n5bf8yfbIFORvUjBb1Jdgr3gp8V9Adl24WCF1Ss=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=Suts19pXTJ1cyc6K/ZJV5vwqW7ykEMMlPrCQOFLKGQ1o/IFadKj8+3V0wxMIMAYnsd KOg3c7Jv61/nJf39blRojOL6n96Vfz0YrkUkBEYrLsLcqMHitxpr3QMNPSkIWK5KeyEP MFU0bEU9MbY5Vf0vfdXXMTip6dNEgxnXhQSicxT3WaG1c/RDH9BHhz4qndX9oARGEpXn AbRgwBjIFI3/eJEXqa2a1/jl47WzwD3G/b7eOIQ1gBmZS8JViNSjQ4YVeHQl/a9iXxIv YtaM3Vh/oohZ5eLqjvVfKZtb6nrodbtU1IIcnrt9I7QkNECM4GHoLyrCUbX+FVEOGYR2 yJyg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RUDL7Rtw; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6cb1cad32si786399785a.256.2024.12.10.08.28.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:28:37 -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=RUDL7Rtw; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL32a-0007w6-2T; Tue, 10 Dec 2024 11:24:52 -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 1tL320-0007fv-28 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:16 -0500 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL31y-0007Um-6G for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:15 -0500 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-5401be44b58so2712320e87.0 for ; Tue, 10 Dec 2024 08:24:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847852; x=1734452652; 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=EYb+n5bf8yfbIFORvUjBb1Jdgr3gp8V9Adl24WCF1Ss=; b=RUDL7Rtwv6THCmNjKbO2m2KmXFpL65OrOr91GEtB4OR11h6gaHAnM+Cwv5ItU4kOoz 65KJ2tsoLTklhRolXsSkh8pcM+Lxc6F8bpu/pOeJul3DyPM7wpdG2iDXOb3CTuK5ggWv jPATS5D8nb2h05W8N8GnUm90gLI7J8ruff9234gDb/oZiFf/CC+84gsKj93i5Yu6Ov6z 6Qlt6FiNfTNkzhNmlw9vSn0Pp18w1aQnqjCHbTmyJ+9Gcx1kRjgRGdtvv4/b2kpa/M5j CdILpe5mHfekPxHXXQIMHC0PWevhbd+HFSnfft5cVrYk/TpQ9tYHKdzna22yofvGBTPL 7zdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847852; x=1734452652; 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=EYb+n5bf8yfbIFORvUjBb1Jdgr3gp8V9Adl24WCF1Ss=; b=S12OWAmRVzEEaJVzcF/MRHAmeQ76PUyxZ4Xi1OdHoFJxv6bXt5g3Sv0O3bt9bZtDJs N7MyfMuwvRMEiqhHCRVce3BBSoCHjDO+DeYJ8R8iGZSrIlQKe6yhg7mE0i2uw4w7Gv9g MKeYjlygyCNu8Q4QIyt9zJwr+7iPkBn6lAOOQiNuA2tz1trPgck0jw2tTypnTufeX8PS g29bAR0/y1z60lHOrgtHHPDv67EVNpxV/PAI32l2I6+4p0uhjDeXvPX7Wd62oaQTBUtX TK0DrcbicQxTC2tpf81ir2ggU86aHhzvSLdMY8iUlPor22/zVK5xmGx7WgFGAL2P969Y tazA== X-Gm-Message-State: AOJu0Ywy2LAumDBpeD12ifHQao9gP0J17jGudGmcmwqjBMdUgJ6GFoKa RwPXIZQhtN+6ouXyEiVrpUz0AXvRbe+8ZjCTgUoHL7ookYTSJeptGCs4hOFf1rOw7tHJ8546T7K yGzLUnbDE X-Gm-Gg: ASbGncuDxIKxotYL2pukrZGUjnAoiVAYq9xtx5s81NsBHr/VLoYIH54RJVI4PAVPHgn dRQAaJwcPiP6cM1GwacIRsFIemhZBQNL4oe/AZR2ChtKDRgeMjwupU6FKksDEKNzjnWB41a6ydc jYiYX6YMhDKoddCfkyyi9CboPE0L33PKY9YaNSqthZaGHRxwrkfKtpsIS3Ezx9INuOPzaIdobaI f4wTMio/b0eEAm2DSZf+mucWUxS2MzXO5TXn9ZB238ap/El6KtfVixk5vE= X-Received: by 2002:ac2:42cc:0:b0:53e:2e6b:3858 with SMTP id 2adb3069b0e04-53e2e6b3920mr5992264e87.48.1733847852504; Tue, 10 Dec 2024 08:24:12 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:12 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 51/69] target/arm: Convert FCVTXN to decodetree Date: Tue, 10 Dec 2024 10:17:15 -0600 Message-ID: <20241210161733.1830573-52-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12f.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 Remove handle_2misc_narrow as this was the last insn decoded by that function. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 101 +++++++-------------------------- target/arm/tcg/a64.decode | 4 ++ 2 files changed, 24 insertions(+), 81 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index f04d03ff6e..7bbfd64eba 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8975,6 +8975,24 @@ static ArithOneOp * const f_scalar_uqxtn[] = { }; TRANS(UQXTN_s, do_2misc_narrow_scalar, a, f_scalar_uqxtn) +static void gen_fcvtxn_sd(TCGv_i64 d, TCGv_i64 n) +{ + /* + * 64 bit to 32 bit float conversion + * with von Neumann rounding (round to odd) + */ + TCGv_i32 tmp = tcg_temp_new_i32(); + gen_helper_fcvtx_f64_to_f32(tmp, n, tcg_env); + tcg_gen_extu_i32_i64(d, tmp); +} + +static ArithOneOp * const f_scalar_fcvtxn[] = { + NULL, + NULL, + gen_fcvtxn_sd, +}; +TRANS(FCVTXN_s, do_2misc_narrow_scalar, a, f_scalar_fcvtxn) + #undef WRAP_ENV static bool do_gvec_fn2(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) @@ -9078,6 +9096,7 @@ static ArithOneOp * const f_vector_fcvtn[] = { gen_fcvtn_sd, }; TRANS(FCVTN_v, do_2misc_narrow_vector, a, f_vector_fcvtn) +TRANS(FCVTXN_v, do_2misc_narrow_vector, a, f_scalar_fcvtxn) static void gen_bfcvtn_hs(TCGv_i64 d, TCGv_i64 n) { @@ -9647,68 +9666,6 @@ static void handle_2misc_reciprocal(DisasContext *s, int opcode, } } -static void handle_2misc_narrow(DisasContext *s, bool scalar, - int opcode, bool u, bool is_q, - int size, int rn, int rd) -{ - /* Handle 2-reg-misc ops which are narrowing (so each 2*size element - * in the source becomes a size element in the destination). - */ - int pass; - TCGv_i64 tcg_res[2]; - int destelt = is_q ? 2 : 0; - int passes = scalar ? 1 : 2; - - if (scalar) { - tcg_res[1] = tcg_constant_i64(0); - } - - for (pass = 0; pass < passes; pass++) { - TCGv_i64 tcg_op = tcg_temp_new_i64(); - NeonGenOne64OpFn *genfn = NULL; - NeonGenOne64OpEnvFn *genenvfn = NULL; - - if (scalar) { - read_vec_element(s, tcg_op, rn, pass, size + 1); - } else { - read_vec_element(s, tcg_op, rn, pass, MO_64); - } - tcg_res[pass] = tcg_temp_new_i64(); - - switch (opcode) { - case 0x56: /* FCVTXN, FCVTXN2 */ - { - /* - * 64 bit to 32 bit float conversion - * with von Neumann rounding (round to odd) - */ - TCGv_i32 tmp = tcg_temp_new_i32(); - assert(size == 2); - gen_helper_fcvtx_f64_to_f32(tmp, tcg_op, tcg_env); - tcg_gen_extu_i32_i64(tcg_res[pass], tmp); - } - break; - default: - case 0x12: /* XTN, SQXTUN */ - case 0x14: /* SQXTN, UQXTN */ - case 0x16: /* FCVTN, FCVTN2 */ - case 0x36: /* BFCVTN, BFCVTN2 */ - g_assert_not_reached(); - } - - if (genfn) { - genfn(tcg_res[pass], tcg_op); - } else if (genenvfn) { - genenvfn(tcg_res[pass], tcg_env, tcg_op); - } - } - - for (pass = 0; pass < 2; pass++) { - write_vec_element(s, tcg_res[pass], rd, destelt + pass, MO_32); - } - clear_vec_high(s, is_q, rd); -} - /* AdvSIMD scalar two reg misc * 31 30 29 28 24 23 22 21 17 16 12 11 10 9 5 4 0 * +-----+---+-----------+------+-----------+--------+-----+------+------+ @@ -9780,15 +9737,6 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) rmode = FPROUNDING_TIEAWAY; break; case 0x56: /* FCVTXN, FCVTXN2 */ - if (size == 2) { - unallocated_encoding(s); - return; - } - if (!fp_access_check(s)) { - return; - } - handle_2misc_narrow(s, true, opcode, u, false, size - 1, rn, rd); - return; default: unallocated_encoding(s); return; @@ -10101,16 +10049,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } handle_2misc_reciprocal(s, opcode, false, u, is_q, size, rn, rd); return; - case 0x56: /* FCVTXN, FCVTXN2 */ - if (size == 2) { - unallocated_encoding(s); - return; - } - if (!fp_access_check(s)) { - return; - } - handle_2misc_narrow(s, false, opcode, 0, is_q, size - 1, rn, rd); - return; case 0x17: /* FCVTL, FCVTL2 */ if (!fp_access_check(s)) { return; @@ -10160,6 +10098,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) default: case 0x16: /* FCVTN, FCVTN2 */ case 0x36: /* BFCVTN, BFCVTN2 */ + case 0x56: /* FCVTXN, FCVTXN2 */ unallocated_encoding(s); return; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 456912cd7c..d8902dfb22 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -74,6 +74,7 @@ @qrr_b . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=0 @qrr_h . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=1 +@qrr_s . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=2 @qrr_bh . q:1 ...... . esz:1 ...... ...... rn:5 rd:5 &qrr_e @qrr_hs . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=%esz_hs @qrr_e . q:1 ...... esz:2 ...... ...... rn:5 rd:5 &qrr_e @@ -1648,6 +1649,8 @@ SQXTUN_s 0111 1110 ..1 00001 00101 0 ..... ..... @rr_e SQXTN_s 0101 1110 ..1 00001 01001 0 ..... ..... @rr_e UQXTN_s 0111 1110 ..1 00001 01001 0 ..... ..... @rr_e +FCVTXN_s 0111 1110 011 00001 01101 0 ..... ..... @rr_s + # Advanced SIMD two-register miscellaneous SQABS_v 0.00 1110 ..1 00000 01111 0 ..... ..... @qrr_e @@ -1680,4 +1683,5 @@ SQXTN_v 0.00 1110 ..1 00001 01001 0 ..... ..... @qrr_e UQXTN_v 0.10 1110 ..1 00001 01001 0 ..... ..... @qrr_e FCVTN_v 0.00 1110 0.1 00001 01101 0 ..... ..... @qrr_hs +FCVTXN_v 0.10 1110 011 00001 01101 0 ..... ..... @qrr_s BFCVTN_v 0.00 1110 101 00001 01101 0 ..... ..... @qrr_h From patchwork Tue Dec 10 16:17:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848851 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp419893wrn; Tue, 10 Dec 2024 08:26:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXq8Y1chaj7lNGRZgMTRZFCBV/4B0NDQ8BZH8lLmaaDCDSXckcze6UemIOvk1Q9s1s1vb5cZQ==@linaro.org X-Google-Smtp-Source: AGHT+IGCJjHoUqygO8xej9eZUKoWL/Fk8TD7YUa9y7aYAVKWbTXR2R6ysLpfyOgEcyaoWDkTdbG6 X-Received: by 2002:a05:6102:f09:b0:4b1:ed1:56ac with SMTP id ada2fe7eead31-4b11609a224mr6297899137.12.1733847992785; Tue, 10 Dec 2024 08:26:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847992; cv=none; d=google.com; s=arc-20240605; b=isEQcgjuu4/NqLKZZyll2MM92VptuvJb+fUvCViNYh2j6EA69EmrZAObsMzphtnxWm rH+GDkeBkriAXOKYod0c9a5rMQy9PkbQ4Wh1aRokjGk8brBwgBdiO/EZUBJMoc7J5zzF xY3dEfayMq2S/xnchGmTYZu4BUuWHReTYopbUC8bUcYmlGW8bzh+p4uKQaecoIIQwLdr oogjx47n2+QNE7KE9DXTvVm2cYWTUsxU2aGUXJ3hDyEkOlixrlhlOCEVRlz+EV40Wrbr CdzoqL0dr9/pg321wdWZYv+mtPcWf9ZNzeWmKk7DKX48qXvYrVZ7TqfNmuOVWfNBcYB+ md/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=JzySngICOAtOAYkigRVd8AIybGWb+hn87I8nJlSebK0=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=MV+N5M/CCuAtTJy2ABy6hRhh2b47X7wIJEmXsSwoWieS9arvI0Z2GJe/kJpKr9KJbI Q7dT+G0oYXVEj06JgvS/JUaV2vSp+KWT+EtzgmQV1m5irLiPfqyYuD7qqjrjBub3XTUV 6RUi1vrzRMn++Y8aJOxIDj90/e6cY2X+7Zdrqn9RUO4mtnqUeTH/axxsM3R8TI+0+5ES yt5m2KR4vDBWXNzr9LKMTVmFiCVTAhEUmZ94SI2YIOp3KELjlChFO/RfKiWMRchyH7Pu Krpvu3cohqLCvSONsciAU3+cTTkK5RZQ24X5ugBkGGulZymE/ZFIqW7ZsQnooyrZGqfk Lnog==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DThJEViG; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4afea741718si1408212137.687.2024.12.10.08.26.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:26:32 -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=DThJEViG; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL32d-0008G9-2J; Tue, 10 Dec 2024 11:24:55 -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 1tL32F-0007t7-DY for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:35 -0500 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL322-0007Vg-VP for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:21 -0500 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-3003e203acaso29793471fa.1 for ; Tue, 10 Dec 2024 08:24:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847857; x=1734452657; 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=JzySngICOAtOAYkigRVd8AIybGWb+hn87I8nJlSebK0=; b=DThJEViGRV5TG5gz2Zk5oLILRvr6Xx2gSs0yX3X4YRyVM017zuTEIh5ZBB/JnwMU+K U9HAC6sMZM+naoTFJsZMSY/zo8IKCxk6hjZZVEPKgmP3/5n5rj0njQ6nSKj1lcXkNvnG KWSUk3Dqp74k5GwJsZFvWmYgibEdxebT/bNv41Cno8pNtgu8319IswJ2ljAPV+1W8M/m Qh+LT512CDHyIufVBuUfGUxux56BPQKxoINwpfRbOPPU6bopt9cQGQHrK6JINFaB3f/r QpOVh4gspFgHQKG0mRmb7S1v4/xOiS5oYUjFq2BcQq23Nu0tpvL+Mj70JQzxGqSSK/5o 3cKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847857; x=1734452657; 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=JzySngICOAtOAYkigRVd8AIybGWb+hn87I8nJlSebK0=; b=Dy7UBns/Mz+KCEMf57JACkwGb8R5WScv7QZhP5SnjICqnvKgkFnTlaV9kmU4fjN9J/ 0X+0eImNGDiXsCVtIJebhWSuDYpCdTY2EmStOT4r4UpnUxar/0JmuJS1U7E6YsEQyGvi oxu0CQqEYCHoPe3VyW1bVinV3RvnE9Rfc85C85AWIPSz+o1LNPwkSPsrCzT4Jprmtgnz CKT2nDC8PYbtGX7gM5jb519PS07wBY0WhaTbfwQ/Bylt/nEwGNXUgzH0jYcl4bG7VCBO j6MV2aId+yyyz3yWjZiGuiathC/o6UwLTlthLL7g80lknO898FKbeAeUIuE69VOoR6Rj ycYg== X-Gm-Message-State: AOJu0Yzznyb2dK1EMZDKOtfE1vF7/vx7uTf6fr1oBXmco/JBR6TMdRH3 Qjh6GO8VzoT8rh5/drh/SZ5dvrEVBnU+Mj6IZiLO4yZgvIzDI8O2LQ1buXJk+TpwjGiBYyTWrgf gHRz6xWey X-Gm-Gg: ASbGnctdpn44LWFXhpmDvRtGWgH1nlciH1Shvzw+QRzqqOqGUj5sZ3qiPcsIhumyNG+ OSjRz+wLDNae0x720Ws9V5hns/HCcd8JuT31oywLQSWZ/wxGW91Dt/uMKaaCzr/9LeB2ed6Wl4o CJLSizJYNlrp/6625nLCmGapNN1lytg0LZAjc4GzXRAHYOmnr9x8L38BIrl2u19eDPolIwm/ZxY 3pxsmfTfh68kaWRBJ6xljnwhtnLzHOjHHvOyOPyv+dQeqDcRsrlFEkkEM8= X-Received: by 2002:a05:6512:3d18:b0:53e:2c74:d65a with SMTP id 2adb3069b0e04-5402410f85amr2088384e87.41.1733847857210; Tue, 10 Dec 2024 08:24:17 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:15 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 52/69] target/arm: Convert SHLL to decodetree Date: Tue, 10 Dec 2024 10:17:16 -0600 Message-ID: <20241210161733.1830573-53-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22c; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x22c.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 75 +++++++++++++++++----------------- target/arm/tcg/a64.decode | 2 + 2 files changed, 40 insertions(+), 37 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 7bbfd64eba..397420a141 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9113,6 +9113,43 @@ static ArithOneOp * const f_vector_bfcvtn[] = { }; TRANS_FEAT(BFCVTN_v, aa64_bf16, do_2misc_narrow_vector, a, f_vector_bfcvtn) +static bool trans_SHLL_v(DisasContext *s, arg_qrr_e *a) +{ + static NeonGenWidenFn * const widenfns[3] = { + gen_helper_neon_widen_u8, + gen_helper_neon_widen_u16, + tcg_gen_extu_i32_i64, + }; + NeonGenWidenFn *widenfn; + TCGv_i64 tcg_res[2]; + TCGv_i32 tcg_op; + int part, pass; + + if (a->esz == MO_64) { + return false; + } + if (!fp_access_check(s)) { + return true; + } + + tcg_op = tcg_temp_new_i32(); + widenfn = widenfns[a->esz]; + part = a->q ? 2 : 0; + + for (pass = 0; pass < 2; pass++) { + read_vec_element_i32(s, tcg_op, a->rn, part + pass, MO_32); + tcg_res[pass] = tcg_temp_new_i64(); + widenfn(tcg_res[pass], tcg_op); + tcg_gen_shli_i64(tcg_res[pass], tcg_res[pass], 8 << a->esz); + } + + for (pass = 0; pass < 2; pass++) { + write_vec_element(s, tcg_res[pass], a->rd, pass, MO_64); + } + return true; +} + + /* Common vector code for handling integer to FP conversion */ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, int elements, int is_signed, @@ -9901,33 +9938,6 @@ static void handle_2misc_widening(DisasContext *s, int opcode, bool is_q, } } -static void handle_shll(DisasContext *s, bool is_q, int size, int rn, int rd) -{ - /* Implement SHLL and SHLL2 */ - int pass; - int part = is_q ? 2 : 0; - TCGv_i64 tcg_res[2]; - - for (pass = 0; pass < 2; pass++) { - static NeonGenWidenFn * const widenfns[3] = { - gen_helper_neon_widen_u8, - gen_helper_neon_widen_u16, - tcg_gen_extu_i32_i64, - }; - NeonGenWidenFn *widenfn = widenfns[size]; - TCGv_i32 tcg_op = tcg_temp_new_i32(); - - read_vec_element_i32(s, tcg_op, rn, part + pass, MO_32); - tcg_res[pass] = tcg_temp_new_i64(); - widenfn(tcg_res[pass], tcg_op); - tcg_gen_shli_i64(tcg_res[pass], tcg_res[pass], 8 << size); - } - - for (pass = 0; pass < 2; pass++) { - write_vec_element(s, tcg_res[pass], rd, pass, MO_64); - } -} - /* AdvSIMD two reg misc * 31 30 29 28 24 23 22 21 17 16 12 11 10 9 5 4 0 * +---+---+---+-----------+------+-----------+--------+-----+------+------+ @@ -9948,16 +9958,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) TCGv_ptr tcg_fpstatus; switch (opcode) { - case 0x13: /* SHLL, SHLL2 */ - if (u == 0 || size == 3) { - unallocated_encoding(s); - return; - } - if (!fp_access_check(s)) { - return; - } - handle_shll(s, is_q, size, rn, rd); - return; case 0xc ... 0xf: case 0x16 ... 0x1f: { @@ -10118,6 +10118,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0xa: /* CMLT */ case 0xb: /* ABS, NEG */ case 0x12: /* XTN, XTN2, SQXTUN, SQXTUN2 */ + case 0x13: /* SHLL, SHLL2 */ case 0x14: /* SQXTN, SQXTN2, UQXTN, UQXTN2 */ unallocated_encoding(s); return; diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index d8902dfb22..ec0d46a563 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1685,3 +1685,5 @@ UQXTN_v 0.10 1110 ..1 00001 01001 0 ..... ..... @qrr_e FCVTN_v 0.00 1110 0.1 00001 01101 0 ..... ..... @qrr_hs FCVTXN_v 0.10 1110 011 00001 01101 0 ..... ..... @qrr_s BFCVTN_v 0.00 1110 101 00001 01101 0 ..... ..... @qrr_h + +SHLL_v 0.10 1110 ..1 00001 00111 0 ..... ..... @qrr_e From patchwork Tue Dec 10 16:17:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848868 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp421788wrn; Tue, 10 Dec 2024 08:30:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVzQatrgQOKxaNkXnv5kQzXa4IB5dnncRIfLHW3BYLiU3DOTzbpit0YESgN4TQjjNtN1EsrWQ==@linaro.org X-Google-Smtp-Source: AGHT+IGrso4n/Hud7DIpcQR8+kYHVwpSzvzGLKeOneYCzLCQH8VEHLo3zyAbfaRksbcewB+Rvcpl X-Received: by 2002:a05:6214:e6b:b0:6d8:5642:d9dc with SMTP id 6a1803df08f44-6d91e30b243mr91708516d6.11.1733848205060; Tue, 10 Dec 2024 08:30:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848205; cv=none; d=google.com; s=arc-20240605; b=jv2MP0vC0Vz4XcyknSAAkB+MHmpaUMWrDJAcCgpWaFKM4VwVM+Uconl6/1eoQC5O2e AHv3VIDAt1d/q8NO7KGNkMZyuiy75PuF0kDyzJJ305+H0y3AtG1xh5tZbFu+xUoUyPKl Vhis8UClMJPHYtcL/ZcwglDxxkA42v4qJ7uQEAPSJp6J77097Lnw8y96fYSBybqRB01X WtH5OZPLHYpU8gj2Mal1KxLfLqzbNzIZxlrN7IwZCPLYYDkqRc817eWYVLryejZnOfOV d1KAE/W+FPrNxdTCocbx6YxYNWDes8x9eMdCWJzEBms8e5zktdw0JaUEdXbHsQRwp2ET rp3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=TrtbMxhB7QypfthbdI/dreoH2lLNkOWwe1R5ZbE+fj8=; fh=9Ev+QBUhk6P6vR3LT1wYeDLexozsz44nqjfoyPajZCc=; b=LHNtoguwdMguqELVEP4iiT+Lu3fKaBwwJ3JKkxp7NtTsrthd0PLHl6qkmhmvQFEyJp /UrYZtX6FRZmoB0NLK2oqZ2MeYLqmcsCF3c4VqP1Z1PsUnaE6/ITZJSF3kQ4YnvG+liM QxT9QZF1bvt99sPm7hXoqzpB7WAJV8NjiXwpl3kb1LAOY81qFsaEvtRjdwByOBDrdX1m rxWnp/71QJofXKLFPb3Gt/mBOJJP2F8FbN4PtKGVPo6pRkMCGue8AZmPHNowDmTh/NtU DU7/UEnYTRPic5ff6F0MVW9G06pH4QdfobQ4uh9/ihwAPlbNEQl2dTU10EWFSnUXLm93 c8ug==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pEKSaCta; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8e651914dsi129128056d6.361.2024.12.10.08.30.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:30:05 -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=pEKSaCta; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL32i-0000M6-QF; Tue, 10 Dec 2024 11:25:00 -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 1tL32O-0007tj-KH for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:41 -0500 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32I-0007WI-4j for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:40 -0500 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-300479ca5c6so29294331fa.3 for ; Tue, 10 Dec 2024 08:24:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847860; x=1734452660; 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=TrtbMxhB7QypfthbdI/dreoH2lLNkOWwe1R5ZbE+fj8=; b=pEKSaCtaL97guwQWI9C9KYADOxffjoilOwDs4998ytAFVVtkrDOjJ74K62TWqETuZE 1dCOyO6Z2VzHIh2tDWK4LK36tdk3OIq8YWyl10rF3X1cWdY1dWMn+KNoZGb8OQ97z3NW UN56QWziXuHxQ74sez3n+xsLnKZ1I8lh9peFkeuMo03U3f8gnTi4aqWoZ57ii0MvDGkt 9zV2zqPjOgoRt15uMXMVTuW1/qJz8c9WatH03gZRztBy5tcrh84S++chHXwRGAKFPBXt wh3Qz3fvoDfVgAOA4lqHSII20kLc7vE0lZz32bLYBqn3vbcV5v5jV044qz3y3L/tvg4L dV2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847860; x=1734452660; 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=TrtbMxhB7QypfthbdI/dreoH2lLNkOWwe1R5ZbE+fj8=; b=GLaBfiTRh1S4Q4rr4ktbP6UPwrQ3Tpg679LVrDGapp8VJDoc51Oi3wvsKq2yR+q6+Q 877DFFDNDLMovhlabbikYeYADVtxaQz829PTehWKu5XjJDW/uzjAiXt5JKqvoq74e6Fq BTJNbSLDDiquzH3Vb9YIh78ssO12+uuRtk6tPk9OxtdoNqoz8uzr22Er4GUHYHIWGP7M //b0Vo60XG95hDijWluvjrc8abq7Vd5g0WgmllDO2er2aBsyU3QXltz6X9MUsi9i2yR7 oT8J18xckTL3NNyuSQ377gZtjtNl7ZuMLcpvfItajv5SdHh9DMGB1rYs7oI6pBzuCIH/ ulig== X-Gm-Message-State: AOJu0YyoiFFBQGg34kQq3KhpMvZYjCgRn2bao48KCAePGjAJaqXCdOQz uVYGcR9J2WsTjNSeLZgnIajFWN9VKwnXqQUaeIhzmyhqKLFMwCpDa0tw7ZinFqpghOYdE2oMQ+8 q0hFVTyIH X-Gm-Gg: ASbGncuUwpp4S4zhtGpWFI2++5BlHpP9GcyejN19oCh+gBcXXmm+vCPPICXdvV0US6M /rqQOZJlk2wvpIR+Bs7frnyI+P/rDQgLo9nOKKWMTbUaSY5dqzwcOBgiIk+4tg1hzlbgT1Z7Xlm gsN/MdY82bz1//zSnWjbj00y755kyg6g2Bgo7YMcO8/Z9RUJduJpNqD8R6GkXnx5HNxRLbySmCy EXtaqdNPtSsV4GtVxkDVzAknf4jPvUM9IYmTJf70Bf8xCy56F0lDyVykFE= X-Received: by 2002:a05:6512:6cc:b0:53f:22f8:74f with SMTP id 2adb3069b0e04-54024107643mr2084979e87.44.1733847859655; Tue, 10 Dec 2024 08:24:19 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 53/69] target/arm: Implement gen_gvec_fabs, gen_gvec_fneg Date: Tue, 10 Dec 2024 10:17:17 -0600 Message-ID: <20241210161733.1830573-54-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x22e.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 Move the current implementation out of translate-neon.c, and extend to handle all element sizes. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/translate.h | 6 ++++++ target/arm/tcg/gengvec.c | 14 ++++++++++++++ target/arm/tcg/translate-neon.c | 20 ++------------------ 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index edd775d564..b996de2c15 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -602,6 +602,12 @@ void gen_gvec_uaddlp(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, void gen_gvec_uadalp(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t opr_sz, uint32_t max_sz); +/* These exclusively manipulate the sign bit. */ +void gen_gvec_fabs(unsigned vece, uint32_t dofs, uint32_t aofs, + uint32_t oprsz, uint32_t maxsz); +void gen_gvec_fneg(unsigned vece, uint32_t dofs, uint32_t aofs, + uint32_t oprsz, uint32_t maxsz); + /* * Forward to the isar_feature_* tests given a DisasContext pointer. */ diff --git a/target/arm/tcg/gengvec.c b/target/arm/tcg/gengvec.c index 2755da8ac7..01c9d5436d 100644 --- a/target/arm/tcg/gengvec.c +++ b/target/arm/tcg/gengvec.c @@ -2697,3 +2697,17 @@ void gen_gvec_uadalp(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, assert(vece <= MO_32); tcg_gen_gvec_2(rd_ofs, rn_ofs, opr_sz, max_sz, &g[vece]); } + +void gen_gvec_fabs(unsigned vece, uint32_t dofs, uint32_t aofs, + uint32_t oprsz, uint32_t maxsz) +{ + uint64_t s_bit = 1ull << ((8 << vece) - 1); + tcg_gen_gvec_andi(vece, dofs, aofs, s_bit - 1, oprsz, maxsz); +} + +void gen_gvec_fneg(unsigned vece, uint32_t dofs, uint32_t aofs, + uint32_t oprsz, uint32_t maxsz) +{ + uint64_t s_bit = 1ull << ((8 << vece) - 1); + tcg_gen_gvec_xori(vece, dofs, aofs, s_bit, oprsz, maxsz); +} diff --git a/target/arm/tcg/translate-neon.c b/target/arm/tcg/translate-neon.c index 0821f10fad..b9b3d1c1fb 100644 --- a/target/arm/tcg/translate-neon.c +++ b/target/arm/tcg/translate-neon.c @@ -3041,14 +3041,6 @@ static bool do_2misc(DisasContext *s, arg_2misc *a, NeonGenOneOpFn *fn) return true; } -static void gen_VABS_F(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, - uint32_t oprsz, uint32_t maxsz) -{ - tcg_gen_gvec_andi(vece, rd_ofs, rm_ofs, - vece == MO_16 ? 0x7fff : 0x7fffffff, - oprsz, maxsz); -} - static bool trans_VABS_F(DisasContext *s, arg_2misc *a) { if (a->size == MO_16) { @@ -3058,15 +3050,7 @@ static bool trans_VABS_F(DisasContext *s, arg_2misc *a) } else if (a->size != MO_32) { return false; } - return do_2misc_vec(s, a, gen_VABS_F); -} - -static void gen_VNEG_F(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, - uint32_t oprsz, uint32_t maxsz) -{ - tcg_gen_gvec_xori(vece, rd_ofs, rm_ofs, - vece == MO_16 ? 0x8000 : 0x80000000, - oprsz, maxsz); + return do_2misc_vec(s, a, gen_gvec_fabs); } static bool trans_VNEG_F(DisasContext *s, arg_2misc *a) @@ -3078,7 +3062,7 @@ static bool trans_VNEG_F(DisasContext *s, arg_2misc *a) } else if (a->size != MO_32) { return false; } - return do_2misc_vec(s, a, gen_VNEG_F); + return do_2misc_vec(s, a, gen_gvec_fneg); } static bool trans_VRECPE(DisasContext *s, arg_2misc *a) From patchwork Tue Dec 10 16:17:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848862 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp421063wrn; Tue, 10 Dec 2024 08:28:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV0nYV/0jtGRUl8GcAP7rIMKZ57xjPpSzwITa+Ugd5Xvlli8MOuf9O35hGF792mvyjPY9uBAg==@linaro.org X-Google-Smtp-Source: AGHT+IEQh4xqcU+yYKxmHdTyKJfLv97edWbYTrdwKYVb1VZHuBCrxpIDdXGiSwxgVmvEeHKJaXGH X-Received: by 2002:a05:6122:2087:b0:50d:a31c:678c with SMTP id 71dfb90a1353d-518882ec754mr5452486e0c.2.1733848125025; Tue, 10 Dec 2024 08:28:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848125; cv=none; d=google.com; s=arc-20240605; b=cVpOh3/hUpM3gklOuzrTyq4Af+l2XirEgJJmcphokjuSLNotSZrgk7qSn2+D2c22bN tUW2Ey8AhIjuE3gN35pNM7YZYuYDzKGwS47g9KFEkiDtG8b7AAWGYYokJRSLRSgKw146 EJgy569/n/4Q+OhoE6jxG5tc6MX3Ngy6rXzSf5W2RwMSUyPgJz2q9EPMvQCQoProK7W2 4r2xz5gICZSoeHoAKBqFQnS4Qxo1ezthWgXl1l0r8561yn5e50p6pbnD4VGcZk7eQvHE 7TQlMa2CcNmhUx0iXFok67Zi76VWcfStoKcBtAafpCrb0QOKPgF2W4gzNC03QF4rqCGy if/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=Z2U87xV0PneFZ0LP+4k0VFCAsx+oD0LRoCH5ryjoGxM=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=F042SRipq6DXLuW6/t40wWwHcM3CLO4b1W073+x2s9ErXhkxrKgSQrCfcGFB7DV8sY HKPjp1KgueFrXHDuCf8NmWQj8u3y3RN4nn/ItOEDFGofJgiGn2H29uXw9b0qDRzE+PRz xt5wab10Hlj8xbiXIeUrv4PM//dToltYgtucO0opBHyG4C06I5/4cFJWmpv1V9wxBJo0 sM6a6pdMaAnsnXloUOUxnf6tW0BYq0zd7A9uQKGnVN5HXJABiAo4bgC0YXSWnbFUU2zZ uZQ9mQW9aF5GSoe/UFS8Ny6NeCM1eGQQK6CZ6HZ9vVVkt+tQAJeb325CFuavc0kfgmTp XxZg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SapsFqLq; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-516f9472a88si1289359e0c.273.2024.12.10.08.28.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:28:45 -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=SapsFqLq; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL33B-0001ZG-FA; Tue, 10 Dec 2024 11:25:29 -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 1tL32Q-0007uM-9l for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:44 -0500 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32J-0007Wa-HC for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:41 -0500 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-54021daa6cbso1934576e87.0 for ; Tue, 10 Dec 2024 08:24:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847863; x=1734452663; 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=Z2U87xV0PneFZ0LP+4k0VFCAsx+oD0LRoCH5ryjoGxM=; b=SapsFqLqGCjwA8GS3OYSyTVAV0dZWvUZPo+0itr2DC/P2crvlZldpu9tKo9KA0SZIk QfWAdycuQx42eKq76Imy0q2sT643jaEGbIJl3BQ+jMLtSSUsUGAm1dTTSU2qOu12nYsB UtMueasODyvmjTIsoTgjgA0ZPpBXprfcFxc9xQeVtkoSZs4v+lrFyRQXyREseto9/lcz C4fpCgbIJVU4IMPfgD15c5miTB455z9G6bfGuAZeedh3zOPWG3UELZlTnR+G7/Q8+k39 BPjnlplPLTBF6phbjchA+Jcg/0IjrEQY5CszskB7Aku36hn+i0/mKdUUtCJIOYgA9aeY I7EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847863; x=1734452663; 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=Z2U87xV0PneFZ0LP+4k0VFCAsx+oD0LRoCH5ryjoGxM=; b=JeUsGWLShIyLra8tFjIyX/SheHczmB7pN9oeuQSrKEi61gDjHnz8sM5vhr4izZSgj3 TeC4wASVjXnP/1at16k+ZsZaTSaUAn9RIA5AG+RHneRf8Fv6kTNZYzuW9wXXIzKEkCmH UHnHg/2PcuVrxiX4D8NneT3t1LM/xJO4jnDz1Lnl5on+ZQIt3GmS/zRdYP4cwMyfP9PW qvMcaus4CbeVCJNmuq3G/DeSA03p8HHMPw/xuJWEf1XHZtaHWCOW9pjVZ8UF4pCruCsx ImOzUhd3MD0JTwMyubSOEuhl4gzTgwIClPIczFaf9C6w+kmuLXzO2Mwgu09JSkr90rXE 0hgg== X-Gm-Message-State: AOJu0YxaaCJ/GE6pGfPcuXIMNvOeT3RLEdvBwyos/3DV2vW8dgXbR6Tn bdqg807jUr6Th/Wxuc/g23wiubizuxVYgPfu9YvW48XvB0BvAJ9tbCyF8uN4fTsCqj8QOQKMxmX vu6bToDM0 X-Gm-Gg: ASbGncvLoAD8lYOmkhN8Vbueq30NwM3b/HSYV3Jydh5kpMlYsJzmFD4jiidGnzNXP7V /JjuBcM8cCcb6/DqtmknTC3lh9OSK8GEt+i7EBD2lH6LTp7auixZGUDSakK0NPtHbwCEwd0kgPw zrVLSkw5EdsnhWyolqX11LE03smadVezpJNuvec7X4DIhtMOHD/cW6MqVSVgn/a2yJhQO4GJIIa kYpI3EtCS9GfGAiNeeVt6lTKxE01M/qjueK5YQS4RGwTLgQNT5hSe4g11Y= X-Received: by 2002:a05:6512:6cc:b0:53f:22f8:74f with SMTP id 2adb3069b0e04-54024107643mr2085047e87.44.1733847863413; Tue, 10 Dec 2024 08:24:23 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 54/69] target/arm: Convert FABS, FNEG (vector) to decodetree Date: Tue, 10 Dec 2024 10:17:18 -0600 Message-ID: <20241210161733.1830573-55-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12f.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 54 +++++++++++++++------------------- target/arm/tcg/a64.decode | 7 +++++ 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 397420a141..f810e31ccc 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9149,6 +9149,20 @@ static bool trans_SHLL_v(DisasContext *s, arg_qrr_e *a) return true; } +static bool do_fabs_fneg_v(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) +{ + int check = fp_access_check_vector_hsd(s, a->q, a->esz); + + if (check <= 0) { + return check == 0; + } + + gen_gvec_fn2(s, a->q, a->rd, a->rn, fn, a->esz); + return true; +} + +TRANS(FABS_v, do_fabs_fneg_v, a, gen_gvec_fabs) +TRANS(FNEG_v, do_fabs_fneg_v, a, gen_gvec_fneg) /* Common vector code for handling integer to FP conversion */ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, @@ -9447,12 +9461,6 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, * requires them. */ switch (opcode) { - case 0x2f: /* FABS */ - gen_vfp_absd(tcg_rd, tcg_rn); - break; - case 0x6f: /* FNEG */ - gen_vfp_negd(tcg_rd, tcg_rn); - break; case 0x7f: /* FSQRT */ gen_helper_vfp_sqrtd(tcg_rd, tcg_rn, tcg_fpstatus); break; @@ -9497,6 +9505,8 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, case 0x9: /* CMEQ, CMLE */ case 0xa: /* CMLT */ case 0xb: /* ABS, NEG */ + case 0x2f: /* FABS */ + case 0x6f: /* FNEG */ g_assert_not_reached(); } } @@ -9968,13 +9978,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) opcode |= (extract32(size, 1, 1) << 5) | (u << 6); size = is_double ? 3 : 2; switch (opcode) { - case 0x2f: /* FABS */ - case 0x6f: /* FNEG */ - if (size == 3 && !is_q) { - unallocated_encoding(s); - return; - } - break; case 0x1d: /* SCVTF */ case 0x5d: /* UCVTF */ { @@ -10099,6 +10102,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x16: /* FCVTN, FCVTN2 */ case 0x36: /* BFCVTN, BFCVTN2 */ case 0x56: /* FCVTXN, FCVTXN2 */ + case 0x2f: /* FABS */ + case 0x6f: /* FNEG */ unallocated_encoding(s); return; } @@ -10171,12 +10176,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) { /* Special cases for 32 bit elements */ switch (opcode) { - case 0x2f: /* FABS */ - gen_vfp_abss(tcg_res, tcg_op); - break; - case 0x6f: /* FNEG */ - gen_vfp_negs(tcg_res, tcg_op); - break; case 0x7f: /* FSQRT */ gen_helper_vfp_sqrts(tcg_res, tcg_op, tcg_fpstatus); break; @@ -10220,6 +10219,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) break; default: case 0x7: /* SQABS, SQNEG */ + case 0x2f: /* FABS */ + case 0x6f: /* FNEG */ g_assert_not_reached(); } } @@ -10362,15 +10363,12 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x7b: /* FCVTZU */ rmode = FPROUNDING_ZERO; break; - case 0x2f: /* FABS */ - case 0x6f: /* FNEG */ - only_in_vector = true; - need_fpst = false; - break; case 0x7d: /* FRSQRTE */ case 0x7f: /* FSQRT (vector) */ break; default: + case 0x2f: /* FABS */ + case 0x6f: /* FNEG */ unallocated_encoding(s); return; } @@ -10472,12 +10470,6 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x59: /* FRINTX */ gen_helper_advsimd_rinth_exact(tcg_res, tcg_op, tcg_fpstatus); break; - case 0x2f: /* FABS */ - tcg_gen_andi_i32(tcg_res, tcg_op, 0x7fff); - break; - case 0x6f: /* FNEG */ - tcg_gen_xori_i32(tcg_res, tcg_op, 0x8000); - break; case 0x7d: /* FRSQRTE */ gen_helper_rsqrte_f16(tcg_res, tcg_op, tcg_fpstatus); break; @@ -10485,6 +10477,8 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) gen_helper_vfp_sqrth(tcg_res, tcg_op, tcg_fpstatus); break; default: + case 0x2f: /* FABS */ + case 0x6f: /* FNEG */ g_assert_not_reached(); } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index ec0d46a563..f46bd1a715 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -77,6 +77,7 @@ @qrr_s . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=2 @qrr_bh . q:1 ...... . esz:1 ...... ...... rn:5 rd:5 &qrr_e @qrr_hs . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=%esz_hs +@qrr_sd . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=%esz_sd @qrr_e . q:1 ...... esz:2 ...... ...... rn:5 rd:5 &qrr_e @qrrr_b . q:1 ...... ... rm:5 ...... rn:5 rd:5 &qrrr_e esz=0 @@ -1687,3 +1688,9 @@ FCVTXN_v 0.10 1110 011 00001 01101 0 ..... ..... @qrr_s BFCVTN_v 0.00 1110 101 00001 01101 0 ..... ..... @qrr_h SHLL_v 0.10 1110 ..1 00001 00111 0 ..... ..... @qrr_e + +FABS_v 0.00 1110 111 11000 11111 0 ..... ..... @qrr_h +FABS_v 0.00 1110 1.1 00000 11111 0 ..... ..... @qrr_sd + +FNEG_v 0.10 1110 111 11000 11111 0 ..... ..... @qrr_h +FNEG_v 0.10 1110 1.1 00000 11111 0 ..... ..... @qrr_sd From patchwork Tue Dec 10 16:17:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848864 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp421408wrn; Tue, 10 Dec 2024 08:29:25 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVmlLZrXVHRMZGn3qT8cUwyMTZNVXRNNawMSXuh54M61m2hQ86WziVakvs71QPmMvcUAJbWYA==@linaro.org X-Google-Smtp-Source: AGHT+IE0Pe7NRGGxGBESpA+7nQnTDoPk01gWJ0vDSDEseypFrhwO38lrqvmqDE8kqjrYlqP8DqBW X-Received: by 2002:a05:6102:3588:b0:4af:eb78:2879 with SMTP id ada2fe7eead31-4b116238a27mr5175686137.23.1733848165564; Tue, 10 Dec 2024 08:29:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848165; cv=none; d=google.com; s=arc-20240605; b=S3JXcKOH2gS5cI6ytjQoI3tC+XO9/MrgbqyMpfQXMUgmoD17+1GFd8rgWucnH216aJ MA7ZWyYPsnXR997+YO1yYRai+LJTyBvxfGw6eZPOc+PtcvakQ/01HAfLvhiZa7gh/BD7 YFMR6aFr4SYof0WPs3EwKhE9iMjl3kbqL6LgPGuq5B1lcGrWPgVGeEpei+5//oJ6tVhE 5be1ogFNCDjBVF6ljvg0v7ktH5yTPZhABVhgoqClhK75eP9X05HdXkvEY9Y/5dRn+s/V S7SpuuAYVEBIQ+dqp0TKnwkq9MOLX2lk5k0MGyGaq29yF0J3smFGoywEFRWeflyBUGC4 w5tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=X2MkVYunVkKmUvj6RPjfdhN6vrB0UjSjV1F2stZxQnk=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=I8F9BPNKNZ0Ze+Hb/SiviV0nZJ/MDpDy9VDe1aAk7/hLQDaftf5u5hA9eWmVz0PBda wfV8gc7KHqhLQeNxFlTgxXoXFm/PTi02hR7VYz66mm0YQXmi8hG8dnO9YggJSME2UK3z TGjOuO5RtfGBj9HXsY4M5c9JVGhj61NZSadscMRFDX7UiJTF8dZJ+W5YTGATJLuciQ7T UgW9OXiYOJHdRV8QIlK4EMvqM7bCJgJlVnmLG1WndcN+YIYVYEyYLeo3Pg2gqiG3p8Yh 1N+Yc9sFEZoYiWTDxrNz6pEwGmV3C9tEYwGJaTILDsXn6QEMmGEEt6833HRPrcS5yHhc 1AdA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lzimNxu+; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4afd20becfasi2328262137.358.2024.12.10.08.29.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:29: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=lzimNxu+; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL32v-00012L-6j; Tue, 10 Dec 2024 11:25:16 -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 1tL32N-0007ti-50 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:41 -0500 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32G-0007Ws-8v for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:35 -0500 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-5401c52000dso2590103e87.3 for ; Tue, 10 Dec 2024 08:24:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847866; x=1734452666; 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=X2MkVYunVkKmUvj6RPjfdhN6vrB0UjSjV1F2stZxQnk=; b=lzimNxu+wkyI4KJwFuMYWiVtg0YKRxDmX1nRBkJsGLLy8KnFq8WhJrAyXSu8zNz1to skQZ0prioMFVVLBoQsXiK6zVpEKIKOpV/XOruBXfdxVh0TRshoU+Ey+yhWH+1KV1be2d SI9dH/dKEfJmaIWp01uNoeT+BAoafBktMqOuC4+PczI/4gNQ+KMR81EtLG3fx+A95i/u AKHTMQK4BIe//dJE4RTlYtuZaSNVmVlDPoE9NxHUalTD88PaXrDWO0Djkmj5vnPitnUw JqTA1qapfKi1NdgEBE8Fh/UciinBUbx8FEGeaYy9vk62w6XTNavj7ZnDtynB8ZWZmz5D WpWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847866; x=1734452666; 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=X2MkVYunVkKmUvj6RPjfdhN6vrB0UjSjV1F2stZxQnk=; b=bTk4X17HpE3x7TgW47tXnchWqc6mUBMhjVcnj2NQlvL21ulin4iqS4q/lQtqMjzyqZ wysgzL8vcBWa0FJJHgEhiUySDm0LZaNPSTXrYe/inurq7sZLs/Lc65uqCzYxqTk+fDA0 PNFb1SeD7Zhy3zIl6uTbuX2UkcMJu8Fh8FnwHrtKo94h+1TA1eyA1uqa5W2rDOyagv8X Rmui5Fo5w1FE5LB+NlyLUyD8VZKzBbXD2YAh1wlSN2BCLhXJ6cttRmJEyatU1F8e4AxJ En5ANN9GXzZonuAeTzicgg1fFTDKWamW6RQioMs6+lHH5XF5HiSC5xeTEKiJIlSlx+0U 6J/g== X-Gm-Message-State: AOJu0YzjXTVq9yBwU6nRsjtwQODLxxiEOsorFcT/5SeWznizVpEP9VUE AKA6nCVIyt5INajdzwZKbTvWXbsr/kTlDzseDlCE08tb2pJ6BPOfEBQf4f0+LoByGlXf3ogrSO7 nfmlDFWGz X-Gm-Gg: ASbGncu4WGPeHOcLP5kRET2+NzvMrr9iHohPrrijxW0h8fqw+MMr8sDygoPZ4jMQTPK ymN1auVXZlLrlESwUG2RJFhhjf1qngxSKgvhwE/P85PF7971bnwAbvAkQog5EILqO2E5hp0Sqw7 4LinKEzVh1f3CDU81rzSSPKPRblSP7MXVhBR/PyiBCWOV7vSIE3Ft+FnFUVozaDXpkzcXb9u3NM A1xTP9h+qKjIotHFeLUsAXCslaDuGm9BbktTHUb2IE0bWQ+IRUKTQU5mmg= X-Received: by 2002:a05:6512:124f:b0:540:1dac:c032 with SMTP id 2adb3069b0e04-5401dacc1bbmr3140318e87.6.1733847866249; Tue, 10 Dec 2024 08:24:26 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 55/69] target/arm: Convert FSQRT (vector) to decodetree Date: Tue, 10 Dec 2024 10:17:19 -0600 Message-ID: <20241210161733.1830573-56-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x134.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 67 +++++++++++++++++++++++++--------- target/arm/tcg/a64.decode | 3 ++ 2 files changed, 53 insertions(+), 17 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index f810e31ccc..287e9338a4 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9164,6 +9164,51 @@ static bool do_fabs_fneg_v(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) TRANS(FABS_v, do_fabs_fneg_v, a, gen_gvec_fabs) TRANS(FNEG_v, do_fabs_fneg_v, a, gen_gvec_fneg) +static bool do_fp1_vector(DisasContext *s, arg_qrr_e *a, + const FPScalar1 *f, int rmode) +{ + TCGv_i32 tcg_rmode = NULL; + TCGv_ptr fpst; + int check = fp_access_check_vector_hsd(s, a->q, a->esz); + + if (check <= 0) { + return check == 0; + } + + fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + if (rmode >= 0) { + tcg_rmode = gen_set_rmode(rmode, fpst); + } + + if (a->esz == MO_64) { + TCGv_i64 t64 = tcg_temp_new_i64(); + + for (int pass = 0; pass < 2; ++pass) { + read_vec_element(s, t64, a->rn, pass, MO_64); + f->gen_d(t64, t64, fpst); + write_vec_element(s, t64, a->rd, pass, MO_64); + } + } else { + TCGv_i32 t32 = tcg_temp_new_i32(); + void (*gen)(TCGv_i32, TCGv_i32, TCGv_ptr) + = (a->esz == MO_16 ? f->gen_h : f->gen_s); + + for (int pass = 0, n = (a->q ? 16 : 8) >> a->esz; pass < n; ++pass) { + read_vec_element_i32(s, t32, a->rn, pass, a->esz); + gen(t32, t32, fpst); + write_vec_element_i32(s, t32, a->rd, pass, a->esz); + } + } + clear_vec_high(s, a->q, a->rd); + + if (rmode >= 0) { + gen_restore_rmode(tcg_rmode, fpst); + } + return true; +} + +TRANS(FSQRT_v, do_fp1_vector, a, &f_scalar_fsqrt, -1) + /* Common vector code for handling integer to FP conversion */ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, int elements, int is_signed, @@ -9461,9 +9506,6 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, * requires them. */ switch (opcode) { - case 0x7f: /* FSQRT */ - gen_helper_vfp_sqrtd(tcg_rd, tcg_rn, tcg_fpstatus); - break; case 0x1a: /* FCVTNS */ case 0x1b: /* FCVTMS */ case 0x1c: /* FCVTAS */ @@ -9507,6 +9549,7 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, case 0xb: /* ABS, NEG */ case 0x2f: /* FABS */ case 0x6f: /* FNEG */ + case 0x7f: /* FSQRT */ g_assert_not_reached(); } } @@ -10004,13 +10047,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } handle_2misc_fcmp_zero(s, opcode, false, u, is_q, size, rn, rd); return; - case 0x7f: /* FSQRT */ - need_fpstatus = true; - if (size == 3 && !is_q) { - unallocated_encoding(s); - return; - } - break; case 0x1a: /* FCVTNS */ case 0x1b: /* FCVTMS */ case 0x3a: /* FCVTPS */ @@ -10104,6 +10140,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x56: /* FCVTXN, FCVTXN2 */ case 0x2f: /* FABS */ case 0x6f: /* FNEG */ + case 0x7f: /* FSQRT */ unallocated_encoding(s); return; } @@ -10176,9 +10213,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) { /* Special cases for 32 bit elements */ switch (opcode) { - case 0x7f: /* FSQRT */ - gen_helper_vfp_sqrts(tcg_res, tcg_op, tcg_fpstatus); - break; case 0x1a: /* FCVTNS */ case 0x1b: /* FCVTMS */ case 0x1c: /* FCVTAS */ @@ -10221,6 +10255,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x7: /* SQABS, SQNEG */ case 0x2f: /* FABS */ case 0x6f: /* FNEG */ + case 0x7f: /* FSQRT */ g_assert_not_reached(); } } @@ -10364,11 +10399,11 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) rmode = FPROUNDING_ZERO; break; case 0x7d: /* FRSQRTE */ - case 0x7f: /* FSQRT (vector) */ break; default: case 0x2f: /* FABS */ case 0x6f: /* FNEG */ + case 0x7f: /* FSQRT (vector) */ unallocated_encoding(s); return; } @@ -10473,12 +10508,10 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x7d: /* FRSQRTE */ gen_helper_rsqrte_f16(tcg_res, tcg_op, tcg_fpstatus); break; - case 0x7f: /* FSQRT */ - gen_helper_vfp_sqrth(tcg_res, tcg_op, tcg_fpstatus); - break; default: case 0x2f: /* FABS */ case 0x6f: /* FNEG */ + case 0x7f: /* FSQRT */ g_assert_not_reached(); } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index f46bd1a715..1e0eb4a748 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1694,3 +1694,6 @@ FABS_v 0.00 1110 1.1 00000 11111 0 ..... ..... @qrr_sd FNEG_v 0.10 1110 111 11000 11111 0 ..... ..... @qrr_h FNEG_v 0.10 1110 1.1 00000 11111 0 ..... ..... @qrr_sd + +FSQRT_v 0.10 1110 111 11001 11111 0 ..... ..... @qrr_h +FSQRT_v 0.10 1110 1.1 00001 11111 0 ..... ..... @qrr_sd From patchwork Tue Dec 10 16:17:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848853 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp419922wrn; Tue, 10 Dec 2024 08:26:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU6epqhipSh2NGb8y80YLFwtp7RMjhh+MnNuWLWLhpYzJZ7g8d5dS6K8EP5O415K+fBsmqTZg==@linaro.org X-Google-Smtp-Source: AGHT+IGnhqH4IjkmfQJ2ocv7pVffOe2uZG5HySgN2V3G15jYEDBHaqHOaqjybnsFxnITPV0Ovmos X-Received: by 2002:a05:6122:4588:b0:517:4e40:6838 with SMTP id 71dfb90a1353d-5188837d3ecmr5390763e0c.6.1733847996521; Tue, 10 Dec 2024 08:26:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847996; cv=none; d=google.com; s=arc-20240605; b=LDxbZ0ZKegBgeHdkowAdKa9sorVMahUP9QlnjmWZQzgEvD9Wxa67VIqKMxWUiSjS2t WYZiKuF77K2QljKu5+gtAS54eB8nayn1feKbWgJ6bSMejafo/1yek03gav/ODb5N7UtY H9syh6bilavlrhHSJHcR+yqsbWk6ZkSTlSP8lavSB3bep2ZRb7DJpItazQIpySZu/Fev g6x/DeApUZWElOr6tfJzT5VNekkEsulLK77SS0tF7qGcUeqae65hON+iXmlGP+MQCBJD 1xrHDyCpznyHFBx+EtL41rdjtjy6JDiPfIFho/Bov2D/nO0VQNBLdexSKY1YdkCwYS9u MSqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=Dn+oPG8iCaoQw0cP17ZB2UufuSUcPmfb3W6rznKLWtE=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=EVMPVJ5tRKBb1XOgHWPvKEp0O7wnUC3X8SMQ6WJyXJtM7mKQwgqvU3thlyvUdMzdYb S9FAtzLK4Wy6zE2k9GSDbUxslGp0XeNCqPyEJz2uThBPOuZn/278F9RJSDDxLYk7SOEU DG2/Ll+WECUPGwNNyrIUP1ul/fCQ9IJDpiqi08NF5lCsV7PjZ+5I4QWN/kRETl1sA8JD gqUTDjSwGYaoUIFkyIddTNGK142P/HkSlk3G+xZP3KwjaBLKhdRRXFwzYriSscGz2Rtk fudt4kbt/qvOASwDWIG0wwMVBw8YeGOhykLq1kFQOy9C3bq3tE9GCgpCL0dIRi9BO+Xu fVmg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m+8tFuOT; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-51879cf9a5bsi1031624e0c.76.2024.12.10.08.26.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:26: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=m+8tFuOT; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL33F-000270-KD; Tue, 10 Dec 2024 11:25:34 -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 1tL32Q-0007uQ-Im for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:45 -0500 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32I-0007X9-4j for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:42 -0500 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-30225b2586cso20336381fa.0 for ; Tue, 10 Dec 2024 08:24:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847870; x=1734452670; 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=Dn+oPG8iCaoQw0cP17ZB2UufuSUcPmfb3W6rznKLWtE=; b=m+8tFuOTp4JMaGRevZcxTGrI41pzr/+RQbz3vILKej3v2kmtFFPmQ/IRC06udbdpai N66DzY91MRuWVlC7GdQYO7yNnMsO3Xo12SoDR4cpy3gzOQM1B+3ANd78BB1+vVBUoCa8 vSMHf7i5GXAod33tA7aT5LD/i6YM0b1qXwOjxZfQVm3kOUFHgnyEabtGyY6dxBZ+Mv5v y/MLnaMm7MuY4GXYafPHZGK80kRVBujO3DxmJXvpOVkyA+U35pIS78KmsLJiSa2iwNP4 eIM4vd+WQ4vltDojt4qBv52VRrWD45ifBTLEJhBbltxWykri+J76BUk/CWZ8Fw083TKU 6zFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847870; x=1734452670; 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=Dn+oPG8iCaoQw0cP17ZB2UufuSUcPmfb3W6rznKLWtE=; b=t7cfHVDqeNNkcNWwmyo3PIHOXWFFHB8SiluhKAY7ez6eXH3EE/uXwqMm18fyInk3zr bMxBddgbCS+imPeZ2r/6LtAw+e4LCCaxb3X4DIHiT74X1nZAAHItevFT5C9IS+fjHYj6 k38OeHqprJcm2p5ta+kq2+Dxj42uHm4gPGy4495p1AcbkXXfseSajU6Z6IylMl6f70/v dtOjUyH7mX0MkJ45ZuCs12PwDiL5fW+xoLxd1vOPIgS6i5z0jsngoTRmudQUyy+j7PXn RNLr9UUsyz74od2lVyw8VWVh+eZBceqLp7RgFDPkvoJVO5uqAo4B0SoUMrfmM7+Nq5XN mU+w== X-Gm-Message-State: AOJu0YxVV3agWBIkyBxZ/x5pa/76NM6QjD+rQihSBb02YUUVJ6nlDfqv svdZyDdzV4f6/0nk03ycDJjkC10EUzByfVHZXiD0t3fqQIOeZqKtFyIBrkSvJtqTZvWTw/UVAGx 1w/fJcHbo X-Gm-Gg: ASbGncvMU0D1cEMqrvh+wcmQBOgYNFTGHJbwvcWtt+cFWotZHGEuq5gnCNZaqZA4N8l CQzTCqhU5CPUKa41GbT+NQGNTeUox5sJILT1vck3NLaBKdTQDOR50A0essuWb4nybr7KDOPJw/8 tvtC8Jb0z2JFoywM47xSNRwqyGjPv6Aqit+/+SMau9trUa1T64tzUlCUbbQje3DkPmp5hnM2ny0 F1TIcEZlsnIYti8e+YcC/wm5/LYPz11daxGu0scr2sHh4JRFSaD2/AYeeg= X-Received: by 2002:a05:6512:12c2:b0:540:23d4:3493 with SMTP id 2adb3069b0e04-540251ecd3dmr1249491e87.17.1733847870087; Tue, 10 Dec 2024 08:24:30 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:28 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 56/69] target/arm: Convert FRINT* (vector) to decodetree Date: Tue, 10 Dec 2024 10:17:20 -0600 Message-ID: <20241210161733.1830573-57-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::232; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x232.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 176 ++++++++++++--------------------- target/arm/tcg/a64.decode | 26 +++++ 2 files changed, 88 insertions(+), 114 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 287e9338a4..0f924b07dc 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9209,6 +9209,21 @@ static bool do_fp1_vector(DisasContext *s, arg_qrr_e *a, TRANS(FSQRT_v, do_fp1_vector, a, &f_scalar_fsqrt, -1) +TRANS(FRINTN_v, do_fp1_vector, a, &f_scalar_frint, FPROUNDING_TIEEVEN) +TRANS(FRINTP_v, do_fp1_vector, a, &f_scalar_frint, FPROUNDING_POSINF) +TRANS(FRINTM_v, do_fp1_vector, a, &f_scalar_frint, FPROUNDING_NEGINF) +TRANS(FRINTZ_v, do_fp1_vector, a, &f_scalar_frint, FPROUNDING_ZERO) +TRANS(FRINTA_v, do_fp1_vector, a, &f_scalar_frint, FPROUNDING_TIEAWAY) +TRANS(FRINTI_v, do_fp1_vector, a, &f_scalar_frint, -1) +TRANS(FRINTX_v, do_fp1_vector, a, &f_scalar_frintx, -1) + +TRANS_FEAT(FRINT32Z_v, aa64_frint, do_fp1_vector, a, + &f_scalar_frint32, FPROUNDING_ZERO) +TRANS_FEAT(FRINT32X_v, aa64_frint, do_fp1_vector, a, &f_scalar_frint32, -1) +TRANS_FEAT(FRINT64Z_v, aa64_frint, do_fp1_vector, a, + &f_scalar_frint64, FPROUNDING_ZERO) +TRANS_FEAT(FRINT64X_v, aa64_frint, do_fp1_vector, a, &f_scalar_frint64, -1) + /* Common vector code for handling integer to FP conversion */ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, int elements, int is_signed, @@ -9520,25 +9535,6 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, case 0x7b: /* FCVTZU */ gen_helper_vfp_touqd(tcg_rd, tcg_rn, tcg_constant_i32(0), tcg_fpstatus); break; - case 0x18: /* FRINTN */ - case 0x19: /* FRINTM */ - case 0x38: /* FRINTP */ - case 0x39: /* FRINTZ */ - case 0x58: /* FRINTA */ - case 0x79: /* FRINTI */ - gen_helper_rintd(tcg_rd, tcg_rn, tcg_fpstatus); - break; - case 0x59: /* FRINTX */ - gen_helper_rintd_exact(tcg_rd, tcg_rn, tcg_fpstatus); - break; - case 0x1e: /* FRINT32Z */ - case 0x5e: /* FRINT32X */ - gen_helper_frint32_d(tcg_rd, tcg_rn, tcg_fpstatus); - break; - case 0x1f: /* FRINT64Z */ - case 0x5f: /* FRINT64X */ - gen_helper_frint64_d(tcg_rd, tcg_rn, tcg_fpstatus); - break; default: case 0x4: /* CLS, CLZ */ case 0x5: /* NOT */ @@ -9550,6 +9546,17 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, case 0x2f: /* FABS */ case 0x6f: /* FNEG */ case 0x7f: /* FSQRT */ + case 0x18: /* FRINTN */ + case 0x19: /* FRINTM */ + case 0x38: /* FRINTP */ + case 0x39: /* FRINTZ */ + case 0x58: /* FRINTA */ + case 0x79: /* FRINTI */ + case 0x59: /* FRINTX */ + case 0x1e: /* FRINT32Z */ + case 0x5e: /* FRINT32X */ + case 0x1f: /* FRINT64Z */ + case 0x5f: /* FRINT64X */ g_assert_not_reached(); } } @@ -10094,46 +10101,12 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } handle_2misc_widening(s, opcode, is_q, size, rn, rd); return; - case 0x18: /* FRINTN */ - case 0x19: /* FRINTM */ - case 0x38: /* FRINTP */ - case 0x39: /* FRINTZ */ - rmode = extract32(opcode, 5, 1) | (extract32(opcode, 0, 1) << 1); - /* fall through */ - case 0x59: /* FRINTX */ - case 0x79: /* FRINTI */ - need_fpstatus = true; - if (size == 3 && !is_q) { - unallocated_encoding(s); - return; - } - break; - case 0x58: /* FRINTA */ - rmode = FPROUNDING_TIEAWAY; - need_fpstatus = true; - if (size == 3 && !is_q) { - unallocated_encoding(s); - return; - } - break; case 0x7c: /* URSQRTE */ if (size == 3) { unallocated_encoding(s); return; } break; - case 0x1e: /* FRINT32Z */ - case 0x1f: /* FRINT64Z */ - rmode = FPROUNDING_ZERO; - /* fall through */ - case 0x5e: /* FRINT32X */ - case 0x5f: /* FRINT64X */ - need_fpstatus = true; - if ((size == 3 && !is_q) || !dc_isar_feature(aa64_frint, s)) { - unallocated_encoding(s); - return; - } - break; default: case 0x16: /* FCVTN, FCVTN2 */ case 0x36: /* BFCVTN, BFCVTN2 */ @@ -10141,6 +10114,17 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x2f: /* FABS */ case 0x6f: /* FNEG */ case 0x7f: /* FSQRT */ + case 0x18: /* FRINTN */ + case 0x19: /* FRINTM */ + case 0x38: /* FRINTP */ + case 0x39: /* FRINTZ */ + case 0x59: /* FRINTX */ + case 0x79: /* FRINTI */ + case 0x58: /* FRINTA */ + case 0x1e: /* FRINT32Z */ + case 0x1f: /* FRINT64Z */ + case 0x5e: /* FRINT32X */ + case 0x5f: /* FRINT64X */ unallocated_encoding(s); return; } @@ -10229,33 +10213,25 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) gen_helper_vfp_touls(tcg_res, tcg_op, tcg_constant_i32(0), tcg_fpstatus); break; - case 0x18: /* FRINTN */ - case 0x19: /* FRINTM */ - case 0x38: /* FRINTP */ - case 0x39: /* FRINTZ */ - case 0x58: /* FRINTA */ - case 0x79: /* FRINTI */ - gen_helper_rints(tcg_res, tcg_op, tcg_fpstatus); - break; - case 0x59: /* FRINTX */ - gen_helper_rints_exact(tcg_res, tcg_op, tcg_fpstatus); - break; case 0x7c: /* URSQRTE */ gen_helper_rsqrte_u32(tcg_res, tcg_op); break; - case 0x1e: /* FRINT32Z */ - case 0x5e: /* FRINT32X */ - gen_helper_frint32_s(tcg_res, tcg_op, tcg_fpstatus); - break; - case 0x1f: /* FRINT64Z */ - case 0x5f: /* FRINT64X */ - gen_helper_frint64_s(tcg_res, tcg_op, tcg_fpstatus); - break; default: case 0x7: /* SQABS, SQNEG */ case 0x2f: /* FABS */ case 0x6f: /* FNEG */ case 0x7f: /* FSQRT */ + case 0x18: /* FRINTN */ + case 0x19: /* FRINTM */ + case 0x38: /* FRINTP */ + case 0x39: /* FRINTZ */ + case 0x58: /* FRINTA */ + case 0x79: /* FRINTI */ + case 0x59: /* FRINTX */ + case 0x1e: /* FRINT32Z */ + case 0x5e: /* FRINT32X */ + case 0x1f: /* FRINT64Z */ + case 0x5f: /* FRINT64X */ g_assert_not_reached(); } } @@ -10289,7 +10265,6 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) int rn, rd; bool is_q; bool is_scalar; - bool only_in_vector = false; int pass; TCGv_i32 tcg_rmode = NULL; @@ -10343,31 +10318,6 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x3d: /* FRECPE */ case 0x3f: /* FRECPX */ break; - case 0x18: /* FRINTN */ - only_in_vector = true; - rmode = FPROUNDING_TIEEVEN; - break; - case 0x19: /* FRINTM */ - only_in_vector = true; - rmode = FPROUNDING_NEGINF; - break; - case 0x38: /* FRINTP */ - only_in_vector = true; - rmode = FPROUNDING_POSINF; - break; - case 0x39: /* FRINTZ */ - only_in_vector = true; - rmode = FPROUNDING_ZERO; - break; - case 0x58: /* FRINTA */ - only_in_vector = true; - rmode = FPROUNDING_TIEAWAY; - break; - case 0x59: /* FRINTX */ - case 0x79: /* FRINTI */ - only_in_vector = true; - /* current rounding mode */ - break; case 0x1a: /* FCVTNS */ rmode = FPROUNDING_TIEEVEN; break; @@ -10404,6 +10354,13 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x2f: /* FABS */ case 0x6f: /* FNEG */ case 0x7f: /* FSQRT (vector) */ + case 0x18: /* FRINTN */ + case 0x19: /* FRINTM */ + case 0x38: /* FRINTP */ + case 0x39: /* FRINTZ */ + case 0x58: /* FRINTA */ + case 0x59: /* FRINTX */ + case 0x79: /* FRINTI */ unallocated_encoding(s); return; } @@ -10415,11 +10372,6 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) unallocated_encoding(s); return; } - /* FRINTxx is only in the vector form */ - if (only_in_vector) { - unallocated_encoding(s); - return; - } } if (!fp_access_check(s)) { @@ -10494,17 +10446,6 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x7b: /* FCVTZU */ gen_helper_advsimd_f16touinth(tcg_res, tcg_op, tcg_fpstatus); break; - case 0x18: /* FRINTN */ - case 0x19: /* FRINTM */ - case 0x38: /* FRINTP */ - case 0x39: /* FRINTZ */ - case 0x58: /* FRINTA */ - case 0x79: /* FRINTI */ - gen_helper_advsimd_rinth(tcg_res, tcg_op, tcg_fpstatus); - break; - case 0x59: /* FRINTX */ - gen_helper_advsimd_rinth_exact(tcg_res, tcg_op, tcg_fpstatus); - break; case 0x7d: /* FRSQRTE */ gen_helper_rsqrte_f16(tcg_res, tcg_op, tcg_fpstatus); break; @@ -10512,6 +10453,13 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x2f: /* FABS */ case 0x6f: /* FNEG */ case 0x7f: /* FSQRT */ + case 0x18: /* FRINTN */ + case 0x19: /* FRINTM */ + case 0x38: /* FRINTP */ + case 0x39: /* FRINTZ */ + case 0x58: /* FRINTA */ + case 0x79: /* FRINTI */ + case 0x59: /* FRINTX */ g_assert_not_reached(); } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 1e0eb4a748..5e02144f65 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1697,3 +1697,29 @@ FNEG_v 0.10 1110 1.1 00000 11111 0 ..... ..... @qrr_sd FSQRT_v 0.10 1110 111 11001 11111 0 ..... ..... @qrr_h FSQRT_v 0.10 1110 1.1 00001 11111 0 ..... ..... @qrr_sd + +FRINTN_v 0.00 1110 011 11001 10001 0 ..... ..... @qrr_h +FRINTN_v 0.00 1110 0.1 00001 10001 0 ..... ..... @qrr_sd + +FRINTM_v 0.00 1110 011 11001 10011 0 ..... ..... @qrr_h +FRINTM_v 0.00 1110 0.1 00001 10011 0 ..... ..... @qrr_sd + +FRINTP_v 0.00 1110 111 11001 10001 0 ..... ..... @qrr_h +FRINTP_v 0.00 1110 1.1 00001 10001 0 ..... ..... @qrr_sd + +FRINTZ_v 0.00 1110 111 11001 10011 0 ..... ..... @qrr_h +FRINTZ_v 0.00 1110 1.1 00001 10011 0 ..... ..... @qrr_sd + +FRINTA_v 0.10 1110 011 11001 10001 0 ..... ..... @qrr_h +FRINTA_v 0.10 1110 0.1 00001 10001 0 ..... ..... @qrr_sd + +FRINTX_v 0.10 1110 011 11001 10011 0 ..... ..... @qrr_h +FRINTX_v 0.10 1110 0.1 00001 10011 0 ..... ..... @qrr_sd + +FRINTI_v 0.10 1110 111 11001 10011 0 ..... ..... @qrr_h +FRINTI_v 0.10 1110 1.1 00001 10011 0 ..... ..... @qrr_sd + +FRINT32Z_v 0.00 1110 0.1 00001 11101 0 ..... ..... @qrr_sd +FRINT32X_v 0.10 1110 0.1 00001 11101 0 ..... ..... @qrr_sd +FRINT64Z_v 0.00 1110 0.1 00001 11111 0 ..... ..... @qrr_sd +FRINT64X_v 0.10 1110 0.1 00001 11111 0 ..... ..... @qrr_sd From patchwork Tue Dec 10 16:17:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848871 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp421945wrn; Tue, 10 Dec 2024 08:30:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVXcJwKTDAkOl3andtVPpQr9XmTQ6zN0ilcGFAQZGIxmkYgjZooqlCaXAs55VDxdcKvHw/S5g==@linaro.org X-Google-Smtp-Source: AGHT+IEiaVrt5LH4I7pPiXtZdXN7R0yppcaVE5O1DM17DaV9rlb+QAgU22uLr/xUJVx3kkOM+t4U X-Received: by 2002:ac8:59ca:0:b0:458:34fb:5d59 with SMTP id d75a77b69052e-46734cf34admr260542151cf.29.1733848218467; Tue, 10 Dec 2024 08:30:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848218; cv=none; d=google.com; s=arc-20240605; b=f7M0neZtVy+zS2PbhA7alpXcw/fyvG+XjpgAkeFV3bx2DyaCl5snBeg84xKsr5bcDx 5MPOk9jejaXMOUAstNhUISrQD1lB9SIrdqj+nBc4bje9LIBVfjSiax6JE+z8xiEwzLIO 68vgrL+8JyYNtjTCjDULSMiq9ijqGc/XPxHwyniycOSHf9F2gUch1IqaUiEf8zd4OIaL 6fz8aB6hyZW2QUz9R0LDUbaKFWUBw+Tz76XokjncfuZzddOLVIbwXX/UUa6MWc9QKqnT zHPGeYMtUuy3069pcmHfePZXwP1qhieMl299uA8v9My4i9w1fs4p/SBMcCcsZ3HYiD8i czZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=c7yOIgCfYAXIlxzBS7Y/cffRsUFfY+7qJLLPOfonFXk=; fh=9Ev+QBUhk6P6vR3LT1wYeDLexozsz44nqjfoyPajZCc=; b=AYBRYxgEm77AaiRzWBoXhUkDwxc5uOQJkN3SmaFQg0AbCY1uCU1YgBwRa813gYIdIO 1EcNrkoSCUnUn4va/QFwa4agitLHppBTjiYhLI5isBtjXHpx2anRS7ujCazGDVvPW2sJ Wdfr31U4u7W7Y76MZCd4VVZLjIdmIt2ZXY6JT4L75QTwQPyUMsLq1SGxya01p2eAHrjP CWMLLm9wg4Wl6qtlf6RFMZtxuLMZQkcbtd6bue70b4sD7ArWwNpkAHJCtTEiLkqRwL0J ql2moLECkDQdtBKMh+FTH9yFUC86JLVbSrL4/yLMsYLILYUW76LNrrHLhmAnCZaXdgev sLig==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=arHEQ+pN; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-467296bb290si152836991cf.141.2024.12.10.08.30.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:30:18 -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=arHEQ+pN; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL32l-0000Xu-BC; Tue, 10 Dec 2024 11:25:04 -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 1tL32Q-0007uN-F4 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:44 -0500 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32M-0007Xu-RJ for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:42 -0500 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-53e3a37ae07so3469637e87.3 for ; Tue, 10 Dec 2024 08:24:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847873; x=1734452673; 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=c7yOIgCfYAXIlxzBS7Y/cffRsUFfY+7qJLLPOfonFXk=; b=arHEQ+pNMcgYHKTwz+sUdsfCqG8ZE3f8iPRRaKEmkDloURKVliDQbBE+5V7jHVyWYX er4lTNP5cJSYCWZtKGEg0HoPwUGWUOlH8tw23Li+a76l9YWPDLTpPh8wq7t9NZLt4HIt iwTk7InnqkTZozMsiddGYbIQXoOvP9Fleixdbfmy0yG9Bd+hMnq0YSw2ZhbV227KByQy AeB4kLT8tJul6o/OM9HTU5k0lEK9q6PBn2mSvx0GzGsS8wg0HvpehxeVaJb+b7ULv2Qj wLEv7uXhTu00V+23DAc4pYkfuOQ9FNhK00fDDyle/ig2pSyICA7OMf3/5mOJAwMExzW9 pv/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847873; x=1734452673; 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=c7yOIgCfYAXIlxzBS7Y/cffRsUFfY+7qJLLPOfonFXk=; b=t/inB3x6cjz1bcnRRiSSgUFsEgsxyxpI48BJGZo1kFNopF5y0P9d5SoodNL0t2cwmQ +e/AKyO4Wbw4qUNTc/LbT/Z5GAKwYv0ahxfaoaVB/VXFJs+a2x74gPtH/EinWEk1aXLE nv4QjLyRFek/zjh1palHlpj2sUcuIxztUq1PMpjpJkBR9p/MBSAOCwQAEuJridvC9urB qijp091pxgswzKrDVtQCIZzY7X9J+P5db4e7tYK4KSMf06VGPPUJdz5l6NGYOwDiv2zG 7SYkqNk8mmVTgH+3iPCDZE7mjwfTh6FLjX4CCl/WQxlckIZA0aZlYuLejKfv1ktBmxpW hWdw== X-Gm-Message-State: AOJu0YxGcC/H+mW8/lVh392bgeLi7Y+IvI07VT9hRSmPkFg5wdQpJS4R 4ff9YV17nNRWoD6D59mAbSQylK+zTOZO7N9FTb+TvcvvYjwauY0b2ew6KTSRomqIz5MkMb5tHs9 3V3dsPZJz X-Gm-Gg: ASbGnctz0Mu49PRFwBWlLWxUNXNmriqMokcI+V5DkdtPLyFBBGuf6GzztKo7ySCBZZk 9M12ifYR+92McZGlToQgg18/czJu+a0OYZFNFRH6m7enEymOBZL+T0PxPVHF2Ix0uuCjL/4KArT GQkv3Ej2/AK5C1WjifdrXwzhMfCSwx9EPv93S7FDo+WbkzwWD6S98HMRvWTQQfI4e7+BadqenNk FrBU7DQcpqZc8ABEOoPsovRTKYe4t95Zvn93JhETOfOJY5MvJYQpKKQEYc= X-Received: by 2002:a05:6512:402a:b0:53e:39c2:f02b with SMTP id 2adb3069b0e04-53e39c2f164mr4545331e87.42.1733847873052; Tue, 10 Dec 2024 08:24:33 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:32 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 57/69] target/arm: Convert FCVT* (vector, integer) scalar to decodetree Date: Tue, 10 Dec 2024 10:17:21 -0600 Message-ID: <20241210161733.1830573-58-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x134.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 Arm silliness with naming, the scalar insns described as part of the vector instructions, as separate from the "regular" scalar insns which output to general registers. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 133 ++++++++++++++------------------- target/arm/tcg/a64.decode | 30 ++++++++ 2 files changed, 86 insertions(+), 77 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 0f924b07dc..71f1d6f778 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8674,6 +8674,16 @@ static void do_fcvt_scalar(DisasContext *s, MemOp out, MemOp esz, tcg_shift, tcg_fpstatus); tcg_gen_extu_i32_i64(tcg_out, tcg_single); break; + case MO_16 | MO_SIGN: + gen_helper_vfp_toshh(tcg_single, tcg_single, + tcg_shift, tcg_fpstatus); + tcg_gen_extu_i32_i64(tcg_out, tcg_single); + break; + case MO_16: + gen_helper_vfp_touhh(tcg_single, tcg_single, + tcg_shift, tcg_fpstatus); + tcg_gen_extu_i32_i64(tcg_out, tcg_single); + break; default: g_assert_not_reached(); } @@ -8717,6 +8727,42 @@ TRANS(FCVTZU_g, do_fcvt_g, a, FPROUNDING_ZERO, false) TRANS(FCVTAS_g, do_fcvt_g, a, FPROUNDING_TIEAWAY, true) TRANS(FCVTAU_g, do_fcvt_g, a, FPROUNDING_TIEAWAY, false) +/* + * FCVT* (vector), scalar version. + * Which sounds weird, but really just means output to fp register + * instead of output to general register. Input and output element + * size are always equal. + */ +static bool do_fcvt_f(DisasContext *s, arg_fcvt *a, + ARMFPRounding rmode, bool is_signed) +{ + TCGv_i64 tcg_int; + int check = fp_access_check_scalar_hsd(s, a->esz); + + if (check <= 0) { + return check == 0; + } + + tcg_int = tcg_temp_new_i64(); + do_fcvt_scalar(s, a->esz | (is_signed ? MO_SIGN : 0), + a->esz, tcg_int, a->shift, a->rn, rmode); + + clear_vec(s, a->rd); + write_vec_element(s, tcg_int, a->rd, 0, a->esz); + return true; +} + +TRANS(FCVTNS_f, do_fcvt_f, a, FPROUNDING_TIEEVEN, true) +TRANS(FCVTNU_f, do_fcvt_f, a, FPROUNDING_TIEEVEN, false) +TRANS(FCVTPS_f, do_fcvt_f, a, FPROUNDING_POSINF, true) +TRANS(FCVTPU_f, do_fcvt_f, a, FPROUNDING_POSINF, false) +TRANS(FCVTMS_f, do_fcvt_f, a, FPROUNDING_NEGINF, true) +TRANS(FCVTMU_f, do_fcvt_f, a, FPROUNDING_NEGINF, false) +TRANS(FCVTZS_f, do_fcvt_f, a, FPROUNDING_ZERO, true) +TRANS(FCVTZU_f, do_fcvt_f, a, FPROUNDING_ZERO, false) +TRANS(FCVTAS_f, do_fcvt_f, a, FPROUNDING_TIEAWAY, true) +TRANS(FCVTAU_f, do_fcvt_f, a, FPROUNDING_TIEAWAY, false) + static bool trans_FJCVTZS(DisasContext *s, arg_FJCVTZS *a) { if (!dc_isar_feature(aa64_jscvt, s)) { @@ -9776,10 +9822,6 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) int opcode = extract32(insn, 12, 5); int size = extract32(insn, 22, 2); bool u = extract32(insn, 29, 1); - bool is_fcvt = false; - int rmode; - TCGv_i32 tcg_rmode; - TCGv_ptr tcg_fpstatus; switch (opcode) { case 0xc ... 0xf: @@ -9824,15 +9866,8 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) case 0x5b: /* FCVTMU */ case 0x7a: /* FCVTPU */ case 0x7b: /* FCVTZU */ - is_fcvt = true; - rmode = extract32(opcode, 5, 1) | (extract32(opcode, 0, 1) << 1); - break; case 0x1c: /* FCVTAS */ case 0x5c: /* FCVTAU */ - /* TIEAWAY doesn't fit in the usual rounding mode encoding */ - is_fcvt = true; - rmode = FPROUNDING_TIEAWAY; - break; case 0x56: /* FCVTXN, FCVTXN2 */ default: unallocated_encoding(s); @@ -9851,59 +9886,7 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) unallocated_encoding(s); return; } - - if (!fp_access_check(s)) { - return; - } - - if (is_fcvt) { - tcg_fpstatus = fpstatus_ptr(FPST_FPCR); - tcg_rmode = gen_set_rmode(rmode, tcg_fpstatus); - } else { - tcg_fpstatus = NULL; - tcg_rmode = NULL; - } - - if (size == 3) { - TCGv_i64 tcg_rn = read_fp_dreg(s, rn); - TCGv_i64 tcg_rd = tcg_temp_new_i64(); - - handle_2misc_64(s, opcode, u, tcg_rd, tcg_rn, tcg_rmode, tcg_fpstatus); - write_fp_dreg(s, rd, tcg_rd); - } else { - TCGv_i32 tcg_rn = tcg_temp_new_i32(); - TCGv_i32 tcg_rd = tcg_temp_new_i32(); - - read_vec_element_i32(s, tcg_rn, rn, 0, size); - - switch (opcode) { - case 0x1a: /* FCVTNS */ - case 0x1b: /* FCVTMS */ - case 0x1c: /* FCVTAS */ - case 0x3a: /* FCVTPS */ - case 0x3b: /* FCVTZS */ - gen_helper_vfp_tosls(tcg_rd, tcg_rn, tcg_constant_i32(0), - tcg_fpstatus); - break; - case 0x5a: /* FCVTNU */ - case 0x5b: /* FCVTMU */ - case 0x5c: /* FCVTAU */ - case 0x7a: /* FCVTPU */ - case 0x7b: /* FCVTZU */ - gen_helper_vfp_touls(tcg_rd, tcg_rn, tcg_constant_i32(0), - tcg_fpstatus); - break; - default: - case 0x7: /* SQABS, SQNEG */ - g_assert_not_reached(); - } - - write_fp_sreg(s, rd, tcg_rd); - } - - if (is_fcvt) { - gen_restore_rmode(tcg_rmode, tcg_fpstatus); - } + g_assert_not_reached(); } /* AdvSIMD shift by immediate @@ -10391,30 +10374,26 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) TCGv_i32 tcg_res = tcg_temp_new_i32(); switch (fpop) { - case 0x1a: /* FCVTNS */ - case 0x1b: /* FCVTMS */ - case 0x1c: /* FCVTAS */ - case 0x3a: /* FCVTPS */ - case 0x3b: /* FCVTZS */ - gen_helper_advsimd_f16tosinth(tcg_res, tcg_op, tcg_fpstatus); - break; case 0x3d: /* FRECPE */ gen_helper_recpe_f16(tcg_res, tcg_op, tcg_fpstatus); break; case 0x3f: /* FRECPX */ gen_helper_frecpx_f16(tcg_res, tcg_op, tcg_fpstatus); break; + case 0x7d: /* FRSQRTE */ + gen_helper_rsqrte_f16(tcg_res, tcg_op, tcg_fpstatus); + break; + default: + case 0x1a: /* FCVTNS */ + case 0x1b: /* FCVTMS */ + case 0x1c: /* FCVTAS */ + case 0x3a: /* FCVTPS */ + case 0x3b: /* FCVTZS */ case 0x5a: /* FCVTNU */ case 0x5b: /* FCVTMU */ case 0x5c: /* FCVTAU */ case 0x7a: /* FCVTPU */ case 0x7b: /* FCVTZU */ - gen_helper_advsimd_f16touinth(tcg_res, tcg_op, tcg_fpstatus); - break; - case 0x7d: /* FRSQRTE */ - gen_helper_rsqrte_f16(tcg_res, tcg_op, tcg_fpstatus); - break; - default: g_assert_not_reached(); } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 5e02144f65..f7fcc32adc 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1652,6 +1652,36 @@ UQXTN_s 0111 1110 ..1 00001 01001 0 ..... ..... @rr_e FCVTXN_s 0111 1110 011 00001 01101 0 ..... ..... @rr_s +@icvt_h . ....... .. ...... ...... rn:5 rd:5 \ + &fcvt sf=0 esz=1 shift=0 +@icvt_sd . ....... .. ...... ...... rn:5 rd:5 \ + &fcvt sf=0 esz=%esz_sd shift=0 + +FCVTNS_f 0101 1110 011 11001 10101 0 ..... ..... @icvt_h +FCVTNS_f 0101 1110 0.1 00001 10101 0 ..... ..... @icvt_sd +FCVTNU_f 0111 1110 011 11001 10101 0 ..... ..... @icvt_h +FCVTNU_f 0111 1110 0.1 00001 10101 0 ..... ..... @icvt_sd + +FCVTPS_f 0101 1110 111 11001 10101 0 ..... ..... @icvt_h +FCVTPS_f 0101 1110 1.1 00001 10101 0 ..... ..... @icvt_sd +FCVTPU_f 0111 1110 111 11001 10101 0 ..... ..... @icvt_h +FCVTPU_f 0111 1110 1.1 00001 10101 0 ..... ..... @icvt_sd + +FCVTMS_f 0101 1110 011 11001 10111 0 ..... ..... @icvt_h +FCVTMS_f 0101 1110 0.1 00001 10111 0 ..... ..... @icvt_sd +FCVTMU_f 0111 1110 011 11001 10111 0 ..... ..... @icvt_h +FCVTMU_f 0111 1110 0.1 00001 10111 0 ..... ..... @icvt_sd + +FCVTZS_f 0101 1110 111 11001 10111 0 ..... ..... @icvt_h +FCVTZS_f 0101 1110 1.1 00001 10111 0 ..... ..... @icvt_sd +FCVTZU_f 0111 1110 111 11001 10111 0 ..... ..... @icvt_h +FCVTZU_f 0111 1110 1.1 00001 10111 0 ..... ..... @icvt_sd + +FCVTAS_f 0101 1110 011 11001 11001 0 ..... ..... @icvt_h +FCVTAS_f 0101 1110 0.1 00001 11001 0 ..... ..... @icvt_sd +FCVTAU_f 0111 1110 011 11001 11001 0 ..... ..... @icvt_h +FCVTAU_f 0111 1110 0.1 00001 11001 0 ..... ..... @icvt_sd + # Advanced SIMD two-register miscellaneous SQABS_v 0.00 1110 ..1 00000 01111 0 ..... ..... @qrr_e From patchwork Tue Dec 10 16:17:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848857 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp420471wrn; Tue, 10 Dec 2024 08:27:40 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUHWhw6WPH9BYahe7lJZ3m43fgO88hDCtlO9qipi70frqaXfKSn8aO3Dgw4j0IwabV3jQpigw==@linaro.org X-Google-Smtp-Source: AGHT+IEVtbcSJXsEwKcKW9aowXpXVVRoxhtZkeziIE/eQzXECJpGkOLn/AAZg8cQdM9PJWSor2lB X-Received: by 2002:ad4:5967:0:b0:6d8:aa14:f5b8 with SMTP id 6a1803df08f44-6d8e73e901bmr288871656d6.40.1733848060025; Tue, 10 Dec 2024 08:27:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848060; cv=none; d=google.com; s=arc-20240605; b=Le4Ci0TBHtdl4BzKFs6s1+H+lB2hSQXT4hk2tBhwPztNkLfLMegBhMpcxhbEOcGewQ xcVtxLtyi3q/JUNwjPiBN+Lzs3qFUwiAHfmsnw5eXA/0rBLUEupvwEtn5ArP/JRSO2EQ U+jU+A9+eRo/qvWeWmvBpUxATDJtAHyS+xwuvkzqttanUGgXEBXFVfDnaa/+xEIBpEBX NmOOz3eTlRBUZuOpL1scaL2750mjFvFnoaGU+0GHpxEUGP02T8qgN3Mr5vuKR9qbIQRw 1QnutG+Ohsct8IxqL4ZgBY+D8RnLBqGbGDNne5ZFLBMvpZznBNlhaCED4cu4A16+8T9m 1nPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=OMQODLqfyrvJTt7Lk1K/EtG7UVPb+CtVlPyHLcmR18I=; fh=9Ev+QBUhk6P6vR3LT1wYeDLexozsz44nqjfoyPajZCc=; b=CSEq6fX5JaH5BFNzV2m2Hdua2onlPfUUk8dkmuVfvucy3scKeWwzWBRiG4L9i8RXIb vNEGHGsL5qa8EW8uruUbU/fB6beUo9ZrMOlprwpGQKpYNCJGrftsWGCXzHKr3ktEZ6vF M0ZRknkWUnEDhw5s9kWRm+qruH1vkYtdBkYG30BTLVW0ztmpRBe3ZK/9Nre0B7hoOVQm gaQy65m/T+/j/JQc2rdCDgq8E+fIlfqlZr+Uf/YmOCMRgTPFZ12RC9erdABDG1lhJM+2 H72birzwnHjYfOxpPt/ZUScV/qnJ6dexgfPc8OFHs3QSXKqKQtq4VxC9mzoSJ2/RaRfR HqOw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IPEGobOF; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d92797341bsi19805416d6.123.2024.12.10.08.27.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:27:40 -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=IPEGobOF; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL32f-0008Rs-LC; Tue, 10 Dec 2024 11:24:57 -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 1tL32T-0007ur-3d for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:48 -0500 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32N-0007YF-UC for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:44 -0500 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-53e3a37ae07so3469702e87.3 for ; Tue, 10 Dec 2024 08:24:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847877; x=1734452677; 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=OMQODLqfyrvJTt7Lk1K/EtG7UVPb+CtVlPyHLcmR18I=; b=IPEGobOF9fKYsiZxFIMaKWDQDmvofUIV+zT/TVRLmK70gUUT3MLAc0avKRatpU1eYh LQ6EI7aepX4hEiP+mPtl4g4mIuJha41nBXmq5wtinuyCnsPXOt8JkMsWr/jN7ONBI8cn xfJjWJw2H1QW2kpKPPqBUAYR8t4rOOOlFQZ7qsqJXecP3BvQUrCjmBOcSzHSxthqSoAa nFW1wM84B2DYdgtbHD7hhk02fF6k+uzAnSOK/owxzs8lbXvq0vmoQHLAb+BtVI+I2NDs IPVASApyn9Wp8Z9tfcGwIM5K/S3opO0kQ+w4bTqbx30vg4lau1F9Z9DydoHX+bH2LwLd Ek/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847877; x=1734452677; 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=OMQODLqfyrvJTt7Lk1K/EtG7UVPb+CtVlPyHLcmR18I=; b=aoOYpjzOW5ReTvjg1s2z2mHiKh0r/GwuH/6FmbIOL1Gud2RLBr3YCxOw1cxyIrU2p8 41+QJ3OwhHhFIiIwKnVzE4kvKCpXVtZYBqreeqVlLhmE6Z5OB3L2UYH+SZ2vNY9clQ7F X+6wf4Eb0hGcmkp0i2G01EdoWEULwy+mZI4lzNSwcShYvFRVKkoyGdFZeC93D25nHvoR CMEYy7EDwFgBRdieiCmBACKYJN/aE0lt9DKLFoD1Us6n6d6iU+6xiV2QTV5D4vDKHusR VTzSff/8KLnX6zXK8l9zwuadMC8gOV0CQocRS5/7/2uFulRSOGN5q8u5o2fcUbRMI0uj /FvA== X-Gm-Message-State: AOJu0Yx9hjSE6/yz52bx68CYv2JhxY6ygUkI657rc9eXSFpRkfB3xReO QRbhYtoVWvSrL3ehD9A8QaiSi4rom7jPZwercLr+aoB9fXl8PexhRSPcs5K9FDDvNH8kCGdhALb CKwfV/Mo4 X-Gm-Gg: ASbGnctKAT4TpVOBLDVvKMWj1+GwJH1ZPOOUE+nm2TGwwazA7oAATuwPrQE4mNzDJD9 367SrbH992W0WUx6Kf65BEeyWYKxEdVkwLhX++hvl2TIftHnjn0hWWPyhesDW2u7oxjqJT0SM/H zWXkdqZ1G7zqNS461rVsGv/NMcWe+uRc4gcCMzhPl8dHSahG5+ZoP7Dq+09cERRag7W5S2OqDfQ evoc+hbaU5CFtwoMy1z9MOrP23t5v0ttVnw+da7U47qq8GtbeqssdkB38s= X-Received: by 2002:a05:6512:3a85:b0:540:1d58:da75 with SMTP id 2adb3069b0e04-5401d58dc6emr3139181e87.14.1733847876750; Tue, 10 Dec 2024 08:24:36 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:35 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 58/69] target/arm: Convert FCVT* (vector, fixed-point) scalar to decodetree Date: Tue, 10 Dec 2024 10:17:22 -0600 Message-ID: <20241210161733.1830573-59-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x129.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 Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 4 +--- target/arm/tcg/a64.decode | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 71f1d6f778..894befef4d 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9535,9 +9535,6 @@ static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn) handle_simd_shift_intfp_conv(s, true, false, is_u, immh, immb, opcode, rn, rd); break; - case 0x1f: /* FCVTZS, FCVTZU */ - handle_simd_shift_fpint_conv(s, true, false, is_u, immh, immb, rn, rd); - break; default: case 0x00: /* SSHR / USHR */ case 0x02: /* SSRA / USRA */ @@ -9551,6 +9548,7 @@ static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn) case 0x11: /* SQRSHRUN */ case 0x12: /* SQSHRN, UQSHRN */ case 0x13: /* SQRSHRN, UQRSHRN */ + case 0x1f: /* FCVTZS, FCVTZU */ unallocated_encoding(s); break; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index f7fcc32adc..f66f62da4f 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1682,6 +1682,25 @@ FCVTAS_f 0101 1110 0.1 00001 11001 0 ..... ..... @icvt_sd FCVTAU_f 0111 1110 011 11001 11001 0 ..... ..... @icvt_h FCVTAU_f 0111 1110 0.1 00001 11001 0 ..... ..... @icvt_sd +%fcvt_f_sh_h 16:4 !function=rsub_16 +%fcvt_f_sh_s 16:5 !function=rsub_32 +%fcvt_f_sh_d 16:6 !function=rsub_64 + +@fcvt_fixed_h .... .... . 001 .... ...... rn:5 rd:5 \ + &fcvt sf=0 esz=1 shift=%fcvt_f_sh_h +@fcvt_fixed_s .... .... . 01 ..... ...... rn:5 rd:5 \ + &fcvt sf=0 esz=2 shift=%fcvt_f_sh_s +@fcvt_fixed_d .... .... . 1 ...... ...... rn:5 rd:5 \ + &fcvt sf=0 esz=3 shift=%fcvt_f_sh_d + +FCVTZS_f 0101 1111 0 ....... 111111 ..... ..... @fcvt_fixed_h +FCVTZS_f 0101 1111 0 ....... 111111 ..... ..... @fcvt_fixed_s +FCVTZS_f 0101 1111 0 ....... 111111 ..... ..... @fcvt_fixed_d + +FCVTZU_f 0111 1111 0 ....... 111111 ..... ..... @fcvt_fixed_h +FCVTZU_f 0111 1111 0 ....... 111111 ..... ..... @fcvt_fixed_s +FCVTZU_f 0111 1111 0 ....... 111111 ..... ..... @fcvt_fixed_d + # Advanced SIMD two-register miscellaneous SQABS_v 0.00 1110 ..1 00000 01111 0 ..... ..... @qrr_e From patchwork Tue Dec 10 16:17:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848869 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp421805wrn; Tue, 10 Dec 2024 08:30:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUIW+0nVAzGifXxbbsZP2QjBPNifiT3FbrYnVNhPtRXYnY61f0z/e2g2FeAhOi8d3bC8qJd0A==@linaro.org X-Google-Smtp-Source: AGHT+IFg5yO2HXhVNGXAiUzW352k6LQ11NzcHrC16pXTmEM846ORoeZrbkH6GcsyVhm22pkXEunG X-Received: by 2002:a05:6214:dae:b0:6d8:8f3d:4d82 with SMTP id 6a1803df08f44-6d91e43dd03mr75550156d6.46.1733848206839; Tue, 10 Dec 2024 08:30:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848206; cv=none; d=google.com; s=arc-20240605; b=JUf206hSGsU7zCGj3KWMozXHU7zMrVkg/E3XBfRnJ61fKnJmcj1XdOavv3QG1JbcQD UkqUP+g0WyhbzxsCuikGJoc6SYGeYm7tIWD8LzweEmPNYse8i5hh/O5DqqOVxCbMQ/ju ES7NA11NwJgK4cHCHD7GmYJHn8fdC0SMjEXKgIYOLznpT+SIotb7lN6jGhx3LYNnsCmT rtKIEMTH9WxtPQ7kXk2ELfjWiu+sIqPEkpkR/qjRWNpJ5mZnbWXtj+V61cYn8Gs73XrJ NaEsmY24OODD5jCgU/fZ3jU7XaPqK7BcWPLbjZeraMaUZvZeM65tarkSmn1ikH9ISjm9 a5yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=SjNCXqWLXBfOyQBfYtoOK+ENmcPrhXIDdj2qnDqUAHQ=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=ZMbDBQoPLlaq/bU9ePUjUqxXMayyK5y2hdGgBGjAc5dgc8qYjYHbSUoI780+C9hb60 plBhS0A8qX0GPIXN8i05DtD6V6oP3RMfGxREWx7Y3ADC9SMqouiLwFz8LgdGrEZ2eYlp 6q8U7h8CZMhtwMW8G+R6glzsNZn8wvVfzOss9snoY+UWBznELz5MaDwk3Lv2AI2w4Q1i nXO4EKx0QCaqTxAk0ePCIXA08FEuLfgMMBP9QOOQw1CPlDT3OdZW1P1w8MwAZZYoElp/ mXp8O5+gkDyoEiAQWPJeMtSfQthmSyxDcrWzQN0Of+dx0vSeH5748Sg3uiYgoJaz2NbZ NICA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rfwv6EP7; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d90de0c0c8si68607636d6.464.2024.12.10.08.30.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:30: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=rfwv6EP7; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL33L-0002tO-Aj; Tue, 10 Dec 2024 11:25:39 -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 1tL32T-0007ut-3i for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:48 -0500 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32Q-0007ZQ-70 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:44 -0500 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-5401e6efffcso2540809e87.3 for ; Tue, 10 Dec 2024 08:24:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847880; x=1734452680; 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=SjNCXqWLXBfOyQBfYtoOK+ENmcPrhXIDdj2qnDqUAHQ=; b=rfwv6EP7u02Undpu5ZIIsq8Nflri1YUslmRBk/fYeXp3G6vBV+R5xIhgZUwXT0OFhE XaYNSOUZYNGk3JpoPYHWXitGEB1285WqpFtPkp3keORnJViU5AcQx7PhxpOK27Rc4wy6 T5XUV43kzVW8NGra8hM4ZQc28mf+swhqXTdAzormYn2LRnWswizaP7NsyHu0qaelDZby HPYGGpt8VB8wuNLIkiVN4q7LPStPwLXO67W56PgCuSAwgE0wiRtW5zj4QH8pnKzy6UTW DEAJPMPdFvvyOyLBNU03FhL/g2rOynNIoXOyJHZLLaoBnNneQMJ8xuuAGd3wpT2hIoTU ihTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847880; x=1734452680; 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=SjNCXqWLXBfOyQBfYtoOK+ENmcPrhXIDdj2qnDqUAHQ=; b=XKm/aYFxc/Z+mYM5PEXd+2NFd8nRNgo3DhebZXJP2NzZOaOWhGtcHXdEu9UEsuqjUO 1n94gR1G++J2m0BNofhRl54ACCzaJfFyBLV5bubfwjEMWdYJDo7uP4iv+2dAuKEzsyKU I8vSEPTFCsm36Glzy+JPdqD4N1FWuOM5/IcapE29JkXmpme+r5Fv5Y3AlSlLeuZ7Dihz p0ytIWW26PsMfXyaLXzZ7Vd9XiFHPupQ+hlDBvYDiC3Ucj88T/4OyJWpDF/rih160Ecp hw4BbndLZSmZTi1w+cdyydU6qW6NBAChIjlyN/2iRjuiGTCR22wb6PwzhNoyuubUmLNd 8fcA== X-Gm-Message-State: AOJu0YwZTl1rLxd/JsefySl9LVaf36FvKOJ+GeT/uwa1FCFyDQyKgI33 KhIJ9TINdBd9fsj3SILZCTl0fVF/VmNZcdHojijprHqgzYuYdF5VVkg7gVUo0z/NHX4pylfznE2 6tkjhA1cz X-Gm-Gg: ASbGncv3aTYdQ412WWAyIfA1DymKh2S8esQePPn1Df9EpHWZyBkXnzOFzRzc5Ju42AV sDC4tWsTnxVZEvvKgu6wgFvnl7v+cAjnodoX0XBkq/G0dZ1GHq9SX0ZfCl0AgPZUIa52kdXJAQf ESoWTNeYEKQGLTPlEWQ+ukCkxCpBJ6kudpB2EtxOaTUGE7s3b4q2ePj3adJLxn8JZyhtmPZBXip 92HzZpPBFjZS7ufzizfokjEtkDJXJl0pfOkLU+JWoNOAFmun/hv9IemzSw= X-Received: by 2002:a05:6512:3d11:b0:53e:3a01:cf4d with SMTP id 2adb3069b0e04-540240d1138mr1928041e87.31.1733847880500; Tue, 10 Dec 2024 08:24:40 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 59/69] target/arm: Convert [US]CVTF (vector, integer) scalar to decodetree Date: Tue, 10 Dec 2024 10:17:23 -0600 Message-ID: <20241210161733.1830573-60-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12e.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 35 ++++++++++++++++++++++++---------- target/arm/tcg/a64.decode | 6 ++++++ 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 894befef4d..6e9d040ebf 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8599,6 +8599,29 @@ static bool do_cvtf_g(DisasContext *s, arg_fcvt *a, bool is_signed) TRANS(SCVTF_g, do_cvtf_g, a, true) TRANS(UCVTF_g, do_cvtf_g, a, false) +/* + * [US]CVTF (vector), scalar version. + * Which sounds weird, but really just means input from fp register + * instead of input from general register. Input and output element + * size are always equal. + */ +static bool do_cvtf_f(DisasContext *s, arg_fcvt *a, bool is_signed) +{ + TCGv_i64 tcg_int; + int check = fp_access_check_scalar_hsd(s, a->esz); + + if (check <= 0) { + return check == 0; + } + + tcg_int = tcg_temp_new_i64(); + read_vec_element(s, tcg_int, a->rn, 0, a->esz | (is_signed ? MO_SIGN : 0)); + return do_cvtf_scalar(s, a->esz, a->rd, a->shift, tcg_int, is_signed); +} + +TRANS(SCVTF_f, do_cvtf_f, a, true) +TRANS(UCVTF_f, do_cvtf_f, a, false) + static void do_fcvt_scalar(DisasContext *s, MemOp out, MemOp esz, TCGv_i64 tcg_out, int shift, int rn, ARMFPRounding rmode) @@ -9838,16 +9861,6 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) case 0x6d: /* FCMLE (zero) */ handle_2misc_fcmp_zero(s, opcode, true, u, true, size, rn, rd); return; - case 0x1d: /* SCVTF */ - case 0x5d: /* UCVTF */ - { - bool is_signed = (opcode == 0x1d); - if (!fp_access_check(s)) { - return; - } - handle_simd_intfp_conv(s, rd, rn, 1, is_signed, 0, size); - return; - } case 0x3d: /* FRECPE */ case 0x3f: /* FRECPX */ case 0x7d: /* FRSQRTE */ @@ -9867,6 +9880,8 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) case 0x1c: /* FCVTAS */ case 0x5c: /* FCVTAU */ case 0x56: /* FCVTXN, FCVTXN2 */ + case 0x1d: /* SCVTF */ + case 0x5d: /* UCVTF */ default: unallocated_encoding(s); return; diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index f66f62da4f..146500d9c4 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1657,6 +1657,12 @@ FCVTXN_s 0111 1110 011 00001 01101 0 ..... ..... @rr_s @icvt_sd . ....... .. ...... ...... rn:5 rd:5 \ &fcvt sf=0 esz=%esz_sd shift=0 +SCVTF_f 0101 1110 011 11001 11011 0 ..... ..... @icvt_h +SCVTF_f 0101 1110 0.1 00001 11011 0 ..... ..... @icvt_sd + +UCVTF_f 0111 1110 011 11001 11011 0 ..... ..... @icvt_h +UCVTF_f 0111 1110 0.1 00001 11011 0 ..... ..... @icvt_sd + FCVTNS_f 0101 1110 011 11001 10101 0 ..... ..... @icvt_h FCVTNS_f 0101 1110 0.1 00001 10101 0 ..... ..... @icvt_sd FCVTNU_f 0111 1110 011 11001 10101 0 ..... ..... @icvt_h From patchwork Tue Dec 10 16:17:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848848 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp419651wrn; Tue, 10 Dec 2024 08:26:02 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWRI+dxxtqS3XfwVfhQn9764krvhr6Nz4qX675sBrOHAmfr9GFrFXhOBiLYPQiTS/0CTt7DjA==@linaro.org X-Google-Smtp-Source: AGHT+IFlztZKN4f2aK9EDWsRb5EoGbKa8+4l2Bl/Tevgh34aD3WgqPcXuVUJHe65/5Z9vA1nJbih X-Received: by 2002:a05:6102:26d6:b0:4af:fa7d:71bd with SMTP id ada2fe7eead31-4affa7d83a6mr8335084137.3.1733847962734; Tue, 10 Dec 2024 08:26:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847962; cv=none; d=google.com; s=arc-20240605; b=NUbDTD5GI+s1ujlU/q6WeEg5Mwe6Dj7Y6+64JmwP4Ieq2IpZWGs+MAipTpih9glRnx 5XigAfFc9IQ7f4YRwhlcHIVSEe8peyBI5pPygNCMRJE6UwP3FOUZ82VhGqZM3g4ChQPS crrNsLSloIMVy24w+IUnZR914A7VLKSqtFiiKH5LWQMbIduyIj83yZ0BRDU9ft/y3yoj ge2cKlw0kD1+qIcdVFBydINMC80zTHo1ujTCWszqdt/uRDsfGRu1fzb48VURmRGi6Mpi kVKi90b2fkk4TA+wo0jAFCNkKKzr9jasdJu0EahQGxQsbtc7OJjCdeuIjDPTydQeZfrN BCog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=vVi8HKOFpwBjScONxOFKy9dvoAVKizq2Tu+OgqB6Ev8=; fh=9Ev+QBUhk6P6vR3LT1wYeDLexozsz44nqjfoyPajZCc=; b=QRXJDCd9utJCEAiZKyevTTIombmmmM6inq3mm6AgHsZUF4f8vaKp4tsxZPju9vhWeS he1b5DF7bT/FLdhLgs9lMWqhJ+H5bJAQBMWVFkMVxhQzgrya7Q6NxP+fWmnaYkxgyQRc kZAm4QAcGDeOe8D9gEOUj22cnmh6HB5+lmRrolcByr4vwSqYt1QyTBpFjavPNZ2tbQm3 R9imtdE8urIPXs5tvlU9oyCnPyPgUVgCwReZHaXhQjUorrMGOzPN3s1h1PV+XLoBv7YB mc+TiiuUGFZlg9436kO0rbT/HF/zKrdIbtz5/1gzvQvBT4NnFQ/f/unXR7RuKwnpAN2Q HXEg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="e+7/e1A8"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4afeb8878b1si1409401137.508.2024.12.10.08.26.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:26:02 -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="e+7/e1A8"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL33B-0001US-4v; Tue, 10 Dec 2024 11:25:29 -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 1tL32V-0007vW-Nf for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:50 -0500 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32T-0007bG-TC for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:47 -0500 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-53df6322ea7so6691559e87.0 for ; Tue, 10 Dec 2024 08:24:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847884; x=1734452684; 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=vVi8HKOFpwBjScONxOFKy9dvoAVKizq2Tu+OgqB6Ev8=; b=e+7/e1A8viKTedkXeJWiFAusJOolIQlnMuKGpMFicaGp2WJsVhXmBLpcLPAeewIpdL 2GB2SJN+YP0PEpMSPrsgylI4VOPY795fK0Yzkoe0Mpt9xtDc+fWU1YGn/UdZ6g9hjn2w 1h3vCwz7N71NgNaJqvUTA2QvEpX0tvvckrEjl6WV32d9CU9pVKicfjRoWsGyXGffnvYs cp0UXrkj4TiUbw7l9j1QFN7fZHH9DvUSbwML/gJesJl1egze2jrPNH+tj++hTMCB1BnJ mGilgifzrQfnOk+xOiwCb8CmVbSqukP65fINnkH2yQdZ23TGmQVgsv571jmBY/4W9uKj AdvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847884; x=1734452684; 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=vVi8HKOFpwBjScONxOFKy9dvoAVKizq2Tu+OgqB6Ev8=; b=apYNz6OFLb/v1JVKHz/EqnutcJV1B9M+D8cTGZNwvCWJGNXoWPbnFCzsIJ8xgghGHd neb9QMy+1C+gg/E9Qj7SYPhOTb3uwuyvQLo749zNHOiWo3Wq+C7KwgOAq1e7bWIp0M61 buY5AAAm/4r8/Xuv9TvylDaDe8s6HKse+0znRC4L1xZpT27lflLX96ZgN3eFDipUrMLY Z4NbbAudta3on+EvVeUlIzscJln5+ysZ0Q7m3hMkZvBrFuJpq7+2a+UMw21/5Wi8t16x y+SB/SdAXQY5gb4K3FFXuFYM+e+C78qbH2U1H/7pcEKN45T2EjuENJLNCZP4T6idXwHG L/DQ== X-Gm-Message-State: AOJu0Yz3MY8m7bCWN7Bjj6e0/jIAL4XZOFNi1f3ptJkZZQF46/MdLYlF /FQ5IZO1BfHJ/W+5dW6+xmv4sPKGGZrQcH7w1trg3ZXvK8GK/uwu9o7WJh2WT5cMCASVuJj5Uqj lKOHkcOvu X-Gm-Gg: ASbGncsbPu/xlOKOKJzeK7P35lyYF6MhLUPQxUMrGXLeA3DNJ/3PIh7WryXA+Zdk4Ou ht/auLBXMKnNlIz2uTzKvtM7mYvWbjyXIHjMxTvqVeHRaF/MsVuTwDBS2ahMXnh/By9Rnskg3u+ FdL3jFzbvurZUwF/zqVyNnQI4hpqDnmlgO56wABYC7AEwpuWVrErh0gUXikdVgHy3kg6Rv7r9vn GrViq17aoJRTNUg9iJLU4lgI1E4FU+lIjy/+AXJJRJWmRwK3lVAwWl3qsQ= X-Received: by 2002:a05:6512:2395:b0:540:1a3f:e848 with SMTP id 2adb3069b0e04-540240bc467mr1987456e87.15.1733847884222; Tue, 10 Dec 2024 08:24:44 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:43 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 60/69] target/arm: Convert [US]CVTF (vector, fixed-point) scalar to decodetree Date: Tue, 10 Dec 2024 10:17:24 -0600 Message-ID: <20241210161733.1830573-61-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::132; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x132.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 Remove disas_simd_scalar_shift_imm as these were the last insns decoded by that function. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 47 ---------------------------------- target/arm/tcg/a64.decode | 8 ++++++ 2 files changed, 8 insertions(+), 47 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 6e9d040ebf..08f24908a4 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9531,52 +9531,6 @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar, gen_restore_rmode(tcg_rmode, tcg_fpstatus); } -/* AdvSIMD scalar shift by immediate - * 31 30 29 28 23 22 19 18 16 15 11 10 9 5 4 0 - * +-----+---+-------------+------+------+--------+---+------+------+ - * | 0 1 | U | 1 1 1 1 1 0 | immh | immb | opcode | 1 | Rn | Rd | - * +-----+---+-------------+------+------+--------+---+------+------+ - * - * This is the scalar version so it works on a fixed sized registers - */ -static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn) -{ - int rd = extract32(insn, 0, 5); - int rn = extract32(insn, 5, 5); - int opcode = extract32(insn, 11, 5); - int immb = extract32(insn, 16, 3); - int immh = extract32(insn, 19, 4); - bool is_u = extract32(insn, 29, 1); - - if (immh == 0) { - unallocated_encoding(s); - return; - } - - switch (opcode) { - case 0x1c: /* SCVTF, UCVTF */ - handle_simd_shift_intfp_conv(s, true, false, is_u, immh, immb, - opcode, rn, rd); - break; - default: - case 0x00: /* SSHR / USHR */ - case 0x02: /* SSRA / USRA */ - case 0x04: /* SRSHR / URSHR */ - case 0x06: /* SRSRA / URSRA */ - case 0x08: /* SRI */ - case 0x0a: /* SHL / SLI */ - case 0x0c: /* SQSHLU */ - case 0x0e: /* SQSHL, UQSHL */ - case 0x10: /* SQSHRUN */ - case 0x11: /* SQRSHRUN */ - case 0x12: /* SQSHRN, UQSHRN */ - case 0x13: /* SQRSHRN, UQRSHRN */ - case 0x1f: /* FCVTZS, FCVTZU */ - unallocated_encoding(s); - break; - } -} - static void handle_2misc_64(DisasContext *s, int opcode, bool u, TCGv_i64 tcg_rd, TCGv_i64 tcg_rn, TCGv_i32 tcg_rmode, TCGv_ptr tcg_fpstatus) @@ -10476,7 +10430,6 @@ static const AArch64DecodeTable data_proc_simd[] = { { 0x0e200800, 0x9f3e0c00, disas_simd_two_reg_misc }, { 0x0f000400, 0x9f800400, disas_simd_shift_imm }, { 0x5e200800, 0xdf3e0c00, disas_simd_scalar_two_reg_misc }, - { 0x5f000400, 0xdf800400, disas_simd_scalar_shift_imm }, { 0x0e780800, 0x8f7e0c00, disas_simd_two_reg_misc_fp16 }, { 0x00000000, 0x00000000, NULL } }; diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 146500d9c4..30e1834d99 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1699,6 +1699,14 @@ FCVTAU_f 0111 1110 0.1 00001 11001 0 ..... ..... @icvt_sd @fcvt_fixed_d .... .... . 1 ...... ...... rn:5 rd:5 \ &fcvt sf=0 esz=3 shift=%fcvt_f_sh_d +SCVTF_f 0101 1111 0 ....... 111001 ..... ..... @fcvt_fixed_h +SCVTF_f 0101 1111 0 ....... 111001 ..... ..... @fcvt_fixed_s +SCVTF_f 0101 1111 0 ....... 111001 ..... ..... @fcvt_fixed_d + +UCVTF_f 0111 1111 0 ....... 111001 ..... ..... @fcvt_fixed_h +UCVTF_f 0111 1111 0 ....... 111001 ..... ..... @fcvt_fixed_s +UCVTF_f 0111 1111 0 ....... 111001 ..... ..... @fcvt_fixed_d + FCVTZS_f 0101 1111 0 ....... 111111 ..... ..... @fcvt_fixed_h FCVTZS_f 0101 1111 0 ....... 111111 ..... ..... @fcvt_fixed_s FCVTZS_f 0101 1111 0 ....... 111111 ..... ..... @fcvt_fixed_d From patchwork Tue Dec 10 16:17:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848874 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp422084wrn; Tue, 10 Dec 2024 08:30:30 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVPYNtKiTtrL8NCHPgE8Kps+fVgGjjjHF9vGxD80flK4I71ykGEWRzyEROe9baVLay0V83THA==@linaro.org X-Google-Smtp-Source: AGHT+IFtOk4g1eo6nBBZoIFHZuk8/b/VxxUkWX6oENolymsJqPah9IN4QchehJa7DSQ9Mk6I2PLV X-Received: by 2002:a05:620a:3901:b0:7b6:ea22:3069 with SMTP id af79cd13be357-7b6ea22343fmr102713785a.26.1733848230064; Tue, 10 Dec 2024 08:30:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848230; cv=none; d=google.com; s=arc-20240605; b=Wb1CQKsYYdu6IFLE4RdkbzwbZ8Wlm4ZQp/C2j2J6Rp7AqIJR+M1HuuIekDUVJM5zO5 Z5yeoGIAKd8luP+dvyb/T8IIq4NUl39tMe4TnMBVVRH1tgCNbQh68SnZs+Wygmb/Cr/P 7ndqnOH3q7WJKNcRfy+ITBZ4oFQ+bFrXkDa/MGYJzTzeOvq4wC8iNxYTPWMb7E//+9a8 KPWViIr/0MwYyqf5i9e8nj98xa8NZ5I+0aT5+qjioQh7BvO7IOYyK2L8FhmAzYNJxGae VGTYwayN1f722KCCelBxpOANcrU97oTfdb4ItxYSTyK8Z/Y4WmaKw5jM7OKkzN1lgQU4 azMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=liAAdjYKod9NdKwXJas+WzjDNtaLglsOGyeZ0ckUOos=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=lnBXz922Y6iYP9QMYHP+MkiwsncM0MS0PGVUMqu5YQQWZxnKWzZ70LHQQm+soUB+v+ BjDKYeaR5WRMuRiKsDhHn6ujmbbo281KxNvkbjgo8YpBz6Gw53EpxpRxX4Slhxw666Yl jYHTIyaD+SiT70ReVRaujAdPj9KWNWMc3PXgbt1OI6XVpkYVFnQgND1FUdWsW/AOJT6l 9orHVxyAAeHU2oOij1grw6kG1o2sRyK5EHc7ebJTTZErcP5meeMwgjhI2/87bB0+ZT1p 4gRQFnR5Av0e4r/QreHAUs4iNxN8sChOWD76W9M0Ixy2Vd4zz70BKUI9jmY9FUVcRXPI Bn4w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xEx0dY5c; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6c8882809si92702685a.347.2024.12.10.08.30.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:30:30 -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=xEx0dY5c; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL33E-0001sn-AI; Tue, 10 Dec 2024 11:25:32 -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 1tL32f-0008Tf-A8 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:57 -0500 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32Y-0007cs-VV for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:57 -0500 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-5401be44b58so2713067e87.0 for ; Tue, 10 Dec 2024 08:24:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847889; x=1734452689; 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=liAAdjYKod9NdKwXJas+WzjDNtaLglsOGyeZ0ckUOos=; b=xEx0dY5cEdE9SaW5odMwohJB2vW7Oly9RwjVOiVCMPPkqeSCkqTTQMmwJhcNAXLUXe ylWcPDtgEhsHIkafLhptj/wdjPzvl5/YYxGfY5lBscpYVD+NyZIieZIDuAgQQ8M6ZSIO JILNS04KOwxNVhSK6ieN7qxtFthENMZzU9syRvk+aRdUieTApO7v/L5PtS5hy5xZu7sU 5sN2Z4AkWaD6gkrPyyFi/mHHPTt2zUt1s2ovg/FlbSgwsMSSFvo7+s878uSVCL6kPt5r DpPON9OKKyV40BToze0etzujETx7qSoRM9ASl+KCbqFh1OxR+f8LVCSdlNK0iNcSaYEI QUgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847889; x=1734452689; 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=liAAdjYKod9NdKwXJas+WzjDNtaLglsOGyeZ0ckUOos=; b=QjEkHjb0NxQ87ZAHheu3ktZdiSP33hybG6yGdS68qeV5fLBePJGkeDvjavH38ypqu/ SvSv8Mrw4bjqvpHz/IQzI8JolmV6awDDEDpta1jcXFeEHR+bC7rvEKezEPOe22yp7yX6 XnKtWH+ftyEqFWC6nDV5uUHlAcFJI8WBjYweBHUJHJD7G2Za46vclzNKM0ab1EWpwJ7V eY5SuGvH7lbv6B9Y5sQ9fEjqtZZFuGNPkM4xjQkd7+xrS4YbTQv4dL+efVyyy05+fWF4 scbrvl1H5HNIA/egJ48rCF8kvu2XW8kXr1BIWMPA/Nc4mJH2cXB0bteUOp+fdWwnMCM8 aHbA== X-Gm-Message-State: AOJu0Yy5f7CCkxnnXmZEacOU1+z2AGOFMQB7V7MDyfpdZYxuEk2hs5uE zjMQi0u00bB/EmmX8mtuJp40YTQEL1hYEds3UDLIkhNe+YfIBICgJWlf0VMrdwwDoVncVdsW1qD uhtG+rLV9 X-Gm-Gg: ASbGncv/jYUKuZ7//eQCFXGVrcCVpRRWTrIL4NVcUT7kmnk0oXnC42KnL0v7trGjlYU Tq28hLy2W+ooLTmYOBc8984WIDzSIONIroLcUmJdVW3MmDU7CaNR5R3luTx/sgl4W/RoJlxAdsF 05HPPgujdGWYaa9spNd0Rxt2KTl4xkA5oPUZBgO0JANaSUfOXqp7nJmD+eb2myeSHmYS6690AZE hgvIgqPJTZBAg0cdzYUff/nDYWU+qSXGkqtcrxh3Zwx9PiGeCKwmJHBzBU= X-Received: by 2002:a05:6512:3b29:b0:540:2339:3761 with SMTP id 2adb3069b0e04-5402339387fmr3130757e87.31.1733847889253; Tue, 10 Dec 2024 08:24:49 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 61/69] target/arm: Rename helper_gvec_vcvt_[hf][su] with _rz Date: Tue, 10 Dec 2024 10:17:25 -0600 Message-ID: <20241210161733.1830573-62-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x130.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 Emphasize that these functions use round-to-zero mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.h | 8 ++++---- target/arm/tcg/translate-neon.c | 8 ++++---- target/arm/tcg/vec_helper.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 04e422ab08..f2cfee40de 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -650,13 +650,13 @@ DEF_HELPER_FLAGS_4(gvec_touizs, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_sf, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_uf, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4(gvec_vcvt_fs, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4(gvec_vcvt_fu, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_vcvt_rz_fs, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_vcvt_rz_fu, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_sh, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_uh, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4(gvec_vcvt_hs, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_4(gvec_vcvt_hu, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_vcvt_rz_hs, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_vcvt_rz_hu, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_rm_ss, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_rm_us, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) diff --git a/target/arm/tcg/translate-neon.c b/target/arm/tcg/translate-neon.c index b9b3d1c1fb..f9ca889bec 100644 --- a/target/arm/tcg/translate-neon.c +++ b/target/arm/tcg/translate-neon.c @@ -1409,13 +1409,13 @@ static bool do_fp_2sh(DisasContext *s, arg_2reg_shift *a, DO_FP_2SH(VCVT_SF, gen_helper_gvec_vcvt_sf) DO_FP_2SH(VCVT_UF, gen_helper_gvec_vcvt_uf) -DO_FP_2SH(VCVT_FS, gen_helper_gvec_vcvt_fs) -DO_FP_2SH(VCVT_FU, gen_helper_gvec_vcvt_fu) +DO_FP_2SH(VCVT_FS, gen_helper_gvec_vcvt_rz_fs) +DO_FP_2SH(VCVT_FU, gen_helper_gvec_vcvt_rz_fu) DO_FP_2SH(VCVT_SH, gen_helper_gvec_vcvt_sh) DO_FP_2SH(VCVT_UH, gen_helper_gvec_vcvt_uh) -DO_FP_2SH(VCVT_HS, gen_helper_gvec_vcvt_hs) -DO_FP_2SH(VCVT_HU, gen_helper_gvec_vcvt_hu) +DO_FP_2SH(VCVT_HS, gen_helper_gvec_vcvt_rz_hs) +DO_FP_2SH(VCVT_HU, gen_helper_gvec_vcvt_rz_hu) static bool do_1reg_imm(DisasContext *s, arg_1reg_imm *a, GVecGen2iFn *fn) diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index 60381258cf..282dba4bfd 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -2507,12 +2507,12 @@ DO_3OP_PAIR(gvec_uminp_s, MIN, uint32_t, H4) DO_VCVT_FIXED(gvec_vcvt_sf, helper_vfp_sltos, uint32_t) DO_VCVT_FIXED(gvec_vcvt_uf, helper_vfp_ultos, uint32_t) -DO_VCVT_FIXED(gvec_vcvt_fs, helper_vfp_tosls_round_to_zero, uint32_t) -DO_VCVT_FIXED(gvec_vcvt_fu, helper_vfp_touls_round_to_zero, uint32_t) +DO_VCVT_FIXED(gvec_vcvt_rz_fs, helper_vfp_tosls_round_to_zero, uint32_t) +DO_VCVT_FIXED(gvec_vcvt_rz_fu, helper_vfp_touls_round_to_zero, uint32_t) DO_VCVT_FIXED(gvec_vcvt_sh, helper_vfp_shtoh, uint16_t) DO_VCVT_FIXED(gvec_vcvt_uh, helper_vfp_uhtoh, uint16_t) -DO_VCVT_FIXED(gvec_vcvt_hs, helper_vfp_toshh_round_to_zero, uint16_t) -DO_VCVT_FIXED(gvec_vcvt_hu, helper_vfp_touhh_round_to_zero, uint16_t) +DO_VCVT_FIXED(gvec_vcvt_rz_hs, helper_vfp_toshh_round_to_zero, uint16_t) +DO_VCVT_FIXED(gvec_vcvt_rz_hu, helper_vfp_touhh_round_to_zero, uint16_t) #undef DO_VCVT_FIXED From patchwork Tue Dec 10 16:17:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848859 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp420748wrn; Tue, 10 Dec 2024 08:28:08 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVWNSrm0O+G7Q2rbNu/9L5T7to68tRoK5Kkk27FKv3xEnv6HHlPLF7HeLYFBH/c4qaemA64AA==@linaro.org X-Google-Smtp-Source: AGHT+IEsFcdmqmaQCSprh+HZY4aLR3dkT6/MHEE7w0gN5kOgQpJtIhuEYXnAXVQ34tgQcZJNx1xt X-Received: by 2002:a05:622a:6f01:b0:467:5414:9cf9 with SMTP id d75a77b69052e-46754149e64mr143510141cf.18.1733848088646; Tue, 10 Dec 2024 08:28:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848088; cv=none; d=google.com; s=arc-20240605; b=ILagNXAjOVAj96fQIY0BqX1swrdHTpYZZZSN4WDdjqQz3uR9uKg2SkEEsfImYiV/pn ox+PDQ0L8nhachx9NnQchwel3WXKaKiLIX8MBhpLmmcn8P2Ae5klvonc/1obQI9ZSYoE dBL4n9w9TbPxQPJSe+qS1i+C9eKOoCZpTOFBoFbpt1jIwl9Bs4LFKHMaalj26Zs2pUR3 x2UYPsEdhcI9IbKvhh1FFSTN8REJLZ2A9bRKmqi5LD/2YUcPGKAF5iykP1/npQXJn48I lvTl09PZZ0AHURf/+Dl1D41ORCvoUVYRR1zYhA71DOAXf9TOVLct7hCMHvuyKjev0Oqj YX+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=R5bEIdy5EcFEcDttJZgVYPiO4o+GM3mQeqtfWkezW2M=; fh=9Ev+QBUhk6P6vR3LT1wYeDLexozsz44nqjfoyPajZCc=; b=PYcQbsH0UPgP4na8NbRBWtG6nGnwPkGMjDP2zdsPPtOsorXkyvzoHswksxfNH6G/3V QrUdLNluV0IQrHTx1XMO0d7IlLpd6rrS51ujfTzauKKZE5TCuKGb/JotkjkuZN6l3KpC PBpXmv7vuQViRsQ64OkpiFipe0UgIvoa/6szx/2c+RvVR/6LTcAEWY1RoBwCcJI3bMnR vrbby3qX79mN+qj12BiQsOfRxJoPO55pVl6+F+maNHrkJ0aX33XtHpt9PRc1KK/k31YJ ytV9N0djWPxP5ZDV6Ezy+j5Jo8hPzK6XDQdOMpoUt9cugAL4211CgP1+Ac8s9ywpvzYg 0+7Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EnBzFTaI; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-467476dd9f1si95585941cf.645.2024.12.10.08.28.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:28:08 -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=EnBzFTaI; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL33B-0001el-O8; Tue, 10 Dec 2024 11:25:29 -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 1tL32h-0000Bh-GJ for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:59 -0500 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32d-0007de-Dg for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:24:59 -0500 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-3022c61557cso17047831fa.0 for ; Tue, 10 Dec 2024 08:24:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847893; x=1734452693; 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=R5bEIdy5EcFEcDttJZgVYPiO4o+GM3mQeqtfWkezW2M=; b=EnBzFTaIRFuZD8z2fvb7NfqUjvxoOTJnJrdeBT2wO3qMa6fV1WMpwlQjSsVk4Swplp 5eVGzGa2SXItNkniNkS/8BKK/YKJ9g/Z/+17iJswyH5xjdJN6gnkbD6AyLF7E+5/GNo1 dfDq7aSGgaE/Rf2c1oDSUFc3/Q383/s3SSkvcX8t2HZWQF4jt1YgN8QPq9FkOvHZJUXI ayfqjkmHZoOv1IaLo/QUCY10IqaJ+4lX6A390Eq4J6jFW1VkWAuH+TrBd9uDUIuSIPIV 6nStCFnBcFcG8hQ7RNa0hk6vPMg/T9PnnWojFO3SNgzO3EJDFMO/4S0XplMn1YsALf4Z ChSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847893; x=1734452693; 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=R5bEIdy5EcFEcDttJZgVYPiO4o+GM3mQeqtfWkezW2M=; b=VzsDm57iXj1bWG3Ic+yknPgjUlM08V32oxIl/Iqa/0eCar8tS4ll4ZFXvepb/QWfrX dEyBIKBDt1jWhixnZ4auwxE22aOH6wKKczinS3SfQuIZZRmqs9JT0aODHItqgWdMqBnC fpgEXcaNB+hrBPQ4ig+UT27KlIVQxkfQrlkaMFRugd2srmbDlWqEwfIImC/6H25q/jqa dDUPhURmOt+SIkHIo76j/5SdhnhAhVUhgcYQEL+TAPoRVE+p2MsGuaDLwB9oVL8PiCRq ez3jRxhruYbKdM7OUdZEmDihaTEBBsgV8z836jV149C47cj1biNSA9CJzMvHYP9Sd8f1 ZxGQ== X-Gm-Message-State: AOJu0YxGPsvrkFpFeHNWd+VP1ZKx5T6WXCZbOqj0b7zvMXi5EqAbowi0 W7gc8Uehm8s8oqyKsn8bbx30csPMZhuCGGYuBaSV/4tsGWFWiLWFVOaLXb5nmkG5PQs4QLYf+Zi GyjI/kHdR X-Gm-Gg: ASbGncuDm4xs3d/rvFEP+mqcNBzpHJcc2KKeEsCN/C0QghxkEqCHr04XxYhdAOKdmnT 8vsrhC5k2HiHyDyzHyFcejK1U3TMzbDL0e2IArIZuBJ/oEcK9nnPGVENXjUEAEjJYqoRbdgy6qh N0Z1MeS4EJY64vHpm6D3KhllYQYHpfN/VhNEmWoRy0k0BjXV3nFiZeDdEbCkRs+WUoSajKJ/kyc 8YpW3Qt6f0lVjBzNsBhOtkUmbDyOl46IiLE4eH3g3Q4QG3S11UCmGmnQSg= X-Received: by 2002:a05:6512:3b20:b0:540:1f67:6895 with SMTP id 2adb3069b0e04-540240c9721mr1932023e87.18.1733847892819; Tue, 10 Dec 2024 08:24:52 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:52 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 62/69] target/arm: Convert [US]CVTF (vector) to decodetree Date: Tue, 10 Dec 2024 10:17:26 -0600 Message-ID: <20241210161733.1830573-63-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22f; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x22f.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 Remove handle_simd_intfp_conv and handle_simd_shift_intfp_conv as these were the last insns decoded by those functions. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/helper.h | 3 + target/arm/tcg/translate-a64.c | 201 ++++++--------------------------- target/arm/tcg/vec_helper.c | 7 +- target/arm/tcg/a64.decode | 22 ++++ 4 files changed, 66 insertions(+), 167 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index f2cfee40de..b227ac54d9 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -658,6 +658,9 @@ DEF_HELPER_FLAGS_4(gvec_vcvt_uh, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_rz_hs, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_rz_hu, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_vcvt_sd, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_vcvt_ud, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + DEF_HELPER_FLAGS_4(gvec_vcvt_rm_ss, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_rm_us, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_rm_sh, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 08f24908a4..0f94fa4fdc 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9293,141 +9293,44 @@ TRANS_FEAT(FRINT64Z_v, aa64_frint, do_fp1_vector, a, &f_scalar_frint64, FPROUNDING_ZERO) TRANS_FEAT(FRINT64X_v, aa64_frint, do_fp1_vector, a, &f_scalar_frint64, -1) -/* Common vector code for handling integer to FP conversion */ -static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, - int elements, int is_signed, - int fracbits, int size) +static bool do_gvec_op2_fpst(DisasContext *s, MemOp esz, bool is_q, + int rd, int rn, int data, + gen_helper_gvec_2_ptr * const fns[3]) { - TCGv_ptr tcg_fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); - TCGv_i32 tcg_shift = NULL; + int check = fp_access_check_vector_hsd(s, is_q, esz); + TCGv_ptr fpst; - MemOp mop = size | (is_signed ? MO_SIGN : 0); - int pass; - - if (fracbits || size == MO_64) { - tcg_shift = tcg_constant_i32(fracbits); + if (check <= 0) { + return check == 0; } - if (size == MO_64) { - TCGv_i64 tcg_int64 = tcg_temp_new_i64(); - TCGv_i64 tcg_double = tcg_temp_new_i64(); - - for (pass = 0; pass < elements; pass++) { - read_vec_element(s, tcg_int64, rn, pass, mop); - - if (is_signed) { - gen_helper_vfp_sqtod(tcg_double, tcg_int64, - tcg_shift, tcg_fpst); - } else { - gen_helper_vfp_uqtod(tcg_double, tcg_int64, - tcg_shift, tcg_fpst); - } - if (elements == 1) { - write_fp_dreg(s, rd, tcg_double); - } else { - write_vec_element(s, tcg_double, rd, pass, MO_64); - } - } - } else { - TCGv_i32 tcg_int32 = tcg_temp_new_i32(); - TCGv_i32 tcg_float = tcg_temp_new_i32(); - - for (pass = 0; pass < elements; pass++) { - read_vec_element_i32(s, tcg_int32, rn, pass, mop); - - switch (size) { - case MO_32: - if (fracbits) { - if (is_signed) { - gen_helper_vfp_sltos(tcg_float, tcg_int32, - tcg_shift, tcg_fpst); - } else { - gen_helper_vfp_ultos(tcg_float, tcg_int32, - tcg_shift, tcg_fpst); - } - } else { - if (is_signed) { - gen_helper_vfp_sitos(tcg_float, tcg_int32, tcg_fpst); - } else { - gen_helper_vfp_uitos(tcg_float, tcg_int32, tcg_fpst); - } - } - break; - case MO_16: - if (fracbits) { - if (is_signed) { - gen_helper_vfp_sltoh(tcg_float, tcg_int32, - tcg_shift, tcg_fpst); - } else { - gen_helper_vfp_ultoh(tcg_float, tcg_int32, - tcg_shift, tcg_fpst); - } - } else { - if (is_signed) { - gen_helper_vfp_sitoh(tcg_float, tcg_int32, tcg_fpst); - } else { - gen_helper_vfp_uitoh(tcg_float, tcg_int32, tcg_fpst); - } - } - break; - default: - g_assert_not_reached(); - } - - if (elements == 1) { - write_fp_sreg(s, rd, tcg_float); - } else { - write_vec_element_i32(s, tcg_float, rd, pass, size); - } - } - } - - clear_vec_high(s, elements << size == 16, rd); + fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + tcg_gen_gvec_2_ptr(vec_full_reg_offset(s, rd), + vec_full_reg_offset(s, rn), fpst, + is_q ? 16 : 8, vec_full_reg_size(s), + data, fns[esz - 1]); + return true; } -/* UCVTF/SCVTF - Integer to FP conversion */ -static void handle_simd_shift_intfp_conv(DisasContext *s, bool is_scalar, - bool is_q, bool is_u, - int immh, int immb, int opcode, - int rn, int rd) -{ - int size, elements, fracbits; - int immhb = immh << 3 | immb; +static gen_helper_gvec_2_ptr * const f_scvtf_v[] = { + gen_helper_gvec_vcvt_sh, + gen_helper_gvec_vcvt_sf, + gen_helper_gvec_vcvt_sd, +}; +TRANS(SCVTF_vi, do_gvec_op2_fpst, + a->esz, a->q, a->rd, a->rn, 0, f_scvtf_v) +TRANS(SCVTF_vf, do_gvec_op2_fpst, + a->esz, a->q, a->rd, a->rn, a->shift, f_scvtf_v) - if (immh & 8) { - size = MO_64; - if (!is_scalar && !is_q) { - unallocated_encoding(s); - return; - } - } else if (immh & 4) { - size = MO_32; - } else if (immh & 2) { - size = MO_16; - if (!dc_isar_feature(aa64_fp16, s)) { - unallocated_encoding(s); - return; - } - } else { - /* immh == 0 would be a failure of the decode logic */ - g_assert(immh == 1); - unallocated_encoding(s); - return; - } - - if (is_scalar) { - elements = 1; - } else { - elements = (8 << is_q) >> size; - } - fracbits = (16 << size) - immhb; - - if (!fp_access_check(s)) { - return; - } - - handle_simd_intfp_conv(s, rd, rn, elements, !is_u, fracbits, size); -} +static gen_helper_gvec_2_ptr * const f_ucvtf_v[] = { + gen_helper_gvec_vcvt_uh, + gen_helper_gvec_vcvt_uf, + gen_helper_gvec_vcvt_ud, +}; +TRANS(UCVTF_vi, do_gvec_op2_fpst, + a->esz, a->q, a->rd, a->rn, 0, f_ucvtf_v) +TRANS(UCVTF_vf, do_gvec_op2_fpst, + a->esz, a->q, a->rd, a->rn, a->shift, f_ucvtf_v) /* FCVTZS, FVCVTZU - FP to fixedpoint conversion */ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar, @@ -9878,10 +9781,6 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn) } switch (opcode) { - case 0x1c: /* SCVTF / UCVTF */ - handle_simd_shift_intfp_conv(s, false, is_q, is_u, immh, immb, - opcode, rn, rd); - break; case 0x1f: /* FCVTZS/ FCVTZU */ handle_simd_shift_fpint_conv(s, false, is_q, is_u, immh, immb, rn, rd); return; @@ -9899,6 +9798,7 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn) case 0x12: /* SQSHRN / UQSHRN */ case 0x13: /* SQRSHRN / UQRSHRN */ case 0x14: /* SSHLL / USHLL */ + case 0x1c: /* SCVTF / UCVTF */ unallocated_encoding(s); return; } @@ -9978,21 +9878,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) opcode |= (extract32(size, 1, 1) << 5) | (u << 6); size = is_double ? 3 : 2; switch (opcode) { - case 0x1d: /* SCVTF */ - case 0x5d: /* UCVTF */ - { - bool is_signed = (opcode == 0x1d) ? true : false; - int elements = is_double ? 2 : is_q ? 4 : 2; - if (is_double && !is_q) { - unallocated_encoding(s); - return; - } - if (!fp_access_check(s)) { - return; - } - handle_simd_intfp_conv(s, rd, rn, elements, is_signed, 0, size); - return; - } case 0x2c: /* FCMGT (zero) */ case 0x2d: /* FCMEQ (zero) */ case 0x2e: /* FCMLT (zero) */ @@ -10075,6 +9960,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x1f: /* FRINT64Z */ case 0x5e: /* FRINT32X */ case 0x5f: /* FRINT64X */ + case 0x1d: /* SCVTF */ + case 0x5d: /* UCVTF */ unallocated_encoding(s); return; } @@ -10240,24 +10127,6 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) fpop = deposit32(fpop, 6, 1, u); switch (fpop) { - case 0x1d: /* SCVTF */ - case 0x5d: /* UCVTF */ - { - int elements; - - if (is_scalar) { - elements = 1; - } else { - elements = (is_q ? 8 : 4); - } - - if (!fp_access_check(s)) { - return; - } - handle_simd_intfp_conv(s, rd, rn, elements, !u, 0, MO_16); - return; - } - break; case 0x2c: /* FCMGT (zero) */ case 0x2d: /* FCMEQ (zero) */ case 0x2e: /* FCMLT (zero) */ @@ -10311,6 +10180,8 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x58: /* FRINTA */ case 0x59: /* FRINTX */ case 0x79: /* FRINTI */ + case 0x1d: /* SCVTF */ + case 0x5d: /* UCVTF */ unallocated_encoding(s); return; } diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index 282dba4bfd..aa85cea0ca 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -2505,12 +2505,15 @@ DO_3OP_PAIR(gvec_uminp_s, MIN, uint32_t, H4) clear_tail(d, oprsz, simd_maxsz(desc)); \ } +DO_VCVT_FIXED(gvec_vcvt_sd, helper_vfp_sqtod, uint64_t) +DO_VCVT_FIXED(gvec_vcvt_ud, helper_vfp_uqtod, uint64_t) DO_VCVT_FIXED(gvec_vcvt_sf, helper_vfp_sltos, uint32_t) DO_VCVT_FIXED(gvec_vcvt_uf, helper_vfp_ultos, uint32_t) -DO_VCVT_FIXED(gvec_vcvt_rz_fs, helper_vfp_tosls_round_to_zero, uint32_t) -DO_VCVT_FIXED(gvec_vcvt_rz_fu, helper_vfp_touls_round_to_zero, uint32_t) DO_VCVT_FIXED(gvec_vcvt_sh, helper_vfp_shtoh, uint16_t) DO_VCVT_FIXED(gvec_vcvt_uh, helper_vfp_uhtoh, uint16_t) + +DO_VCVT_FIXED(gvec_vcvt_rz_fs, helper_vfp_tosls_round_to_zero, uint32_t) +DO_VCVT_FIXED(gvec_vcvt_rz_fu, helper_vfp_touls_round_to_zero, uint32_t) DO_VCVT_FIXED(gvec_vcvt_rz_hs, helper_vfp_toshh_round_to_zero, uint16_t) DO_VCVT_FIXED(gvec_vcvt_rz_hu, helper_vfp_touhh_round_to_zero, uint16_t) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 30e1834d99..4f832e7a4c 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1786,3 +1786,25 @@ FRINT32Z_v 0.00 1110 0.1 00001 11101 0 ..... ..... @qrr_sd FRINT32X_v 0.10 1110 0.1 00001 11101 0 ..... ..... @qrr_sd FRINT64Z_v 0.00 1110 0.1 00001 11111 0 ..... ..... @qrr_sd FRINT64X_v 0.10 1110 0.1 00001 11111 0 ..... ..... @qrr_sd + +SCVTF_vi 0.00 1110 011 11001 11011 0 ..... ..... @qrr_h +SCVTF_vi 0.00 1110 0.1 00001 11011 0 ..... ..... @qrr_sd + +UCVTF_vi 0.10 1110 011 11001 11011 0 ..... ..... @qrr_h +UCVTF_vi 0.10 1110 0.1 00001 11011 0 ..... ..... @qrr_sd + +&fcvt_q rd rn esz q shift +@fcvtq_h . q:1 . ...... 001 .... ...... rn:5 rd:5 \ + &fcvt_q esz=1 shift=%fcvt_f_sh_h +@fcvtq_s . q:1 . ...... 01 ..... ...... rn:5 rd:5 \ + &fcvt_q esz=2 shift=%fcvt_f_sh_s +@fcvtq_d . q:1 . ...... 1 ...... ...... rn:5 rd:5 \ + &fcvt_q esz=3 shift=%fcvt_f_sh_d + +SCVTF_vf 0.00 11110 ....... 111001 ..... ..... @fcvtq_h +SCVTF_vf 0.00 11110 ....... 111001 ..... ..... @fcvtq_s +SCVTF_vf 0.00 11110 ....... 111001 ..... ..... @fcvtq_d + +UCVTF_vf 0.10 11110 ....... 111001 ..... ..... @fcvtq_h +UCVTF_vf 0.10 11110 ....... 111001 ..... ..... @fcvtq_s +UCVTF_vf 0.10 11110 ....... 111001 ..... ..... @fcvtq_d From patchwork Tue Dec 10 16:17:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848867 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp421672wrn; Tue, 10 Dec 2024 08:29:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW5yPj99r3euVbVdAiVfcnNBPTAiFBgXDcluJTQ+OxxJS+mDJuegmLVwaQ+HBCJ8vjUN0FFNQ==@linaro.org X-Google-Smtp-Source: AGHT+IFiq8jYOWOE00oZjNq1ySS4P2bhsM2QWv1vZwxmYfFY1M2N1LgTptGv37qXd9ADTOTp5ddP X-Received: by 2002:a05:622a:130c:b0:467:70ce:75f4 with SMTP id d75a77b69052e-46770ce7a55mr82959871cf.28.1733848195629; Tue, 10 Dec 2024 08:29:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848195; cv=none; d=google.com; s=arc-20240605; b=RDQM7a670zJI+/H71/NU3fUhmFk4ZFTqoQfqYTGtQhR+Hcnwc35847TryohO0Zz3cU b6ZMClAp6SScbZimpPIwb5lsU5waTczHStNZhJvcWbptEltWDgpX9N7IyQQwkFLu/Rk8 YdWcU0CujoHAG6Zvu5o5fMA5Lvj52uQXcWDy0j99q0rZW6n9wqDlGD6RG/H00nODC8NE XfBPtvpcQ3DTlu7tU89elZf6mrUIO6xhqmzqYdZkBlGku3ctyUkKsCPMPPiB7U3Nc7+A mXRWW7IglJn25aXkcDzB5kEEAGmwN8M4CV8WrkOc6S3WQyAmOFw6sPJ5lQjXaNw4ka81 kSLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=vL0IkRbzyzTmgSkob8iw7n8NRX8uGpW6FN24HKKb4W8=; fh=9Ev+QBUhk6P6vR3LT1wYeDLexozsz44nqjfoyPajZCc=; b=IjBz/He43GOWzqF1nXK4FlM7mSxke74GArqhDQm8sjmXp9RYwluGl5xWmnon2VrVYt 1rFdC9wY8HPKxsyAAvhZ/Fq0v/D4L5XRa0E7CzZwgtJ8Bn3wl2wO4eJHoFDHqTpcz68J FPhgYEZgvDb+1cKahTCG7iBoRavmMciJ1dHAa6MY/VD92QbPaXgE4iryuhxObbxsWsif YysFqjbqijuEFTRGC7CzdJ3J7cmrCOEnuIPZOCWlbIoKkPZh2FMiathjJiP5YlOZ+sOX poWG8Jv+or/4poGI2IJD06qDbp8RSbJXTaUpjLq09jn6GsWR9Mxme587nqGjAaA1l0LO TVYw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Vf9zaAWz; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4674d3d98ffsi88404701cf.288.2024.12.10.08.29.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:29:55 -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=Vf9zaAWz; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL33G-0002Kt-SV; Tue, 10 Dec 2024 11:25:36 -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 1tL32j-0000PJ-6J for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:25:01 -0500 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32g-0007dy-9A for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:25:00 -0500 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-30229d5b21cso16506281fa.1 for ; Tue, 10 Dec 2024 08:24:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847896; x=1734452696; 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=vL0IkRbzyzTmgSkob8iw7n8NRX8uGpW6FN24HKKb4W8=; b=Vf9zaAWzS/0AWnlSKC/Lec6ffcU/HraDgzbVErHS7r2FbTvyGAUs36Z2zwAZ3Z8mKx kvFMCt4SDRJfYRzWfPREdORM93ITpGzajVP5nVvJbQIcID5nb37fK/b44+tjvlEUvgVR Wx9dzTLNCjJ2o4nmUYTLJG4n5e+UEPZrjxT2zcMJ5eEOkp3fHk1UugbC269K85PCNECS Vc7bFjiziM7XaubrFz44b2ie0kGd4uXDJy7B0ZXRWa343G8sCYf1yNhbjxVEyT5dqdq5 tXaJWoOPQUsP8wuzqZ/fagVADCpeIc7TnREWLyedz27asfxZFW7EeFcLLcSGRXGM6Tu4 4vqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847896; x=1734452696; 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=vL0IkRbzyzTmgSkob8iw7n8NRX8uGpW6FN24HKKb4W8=; b=mH4kaAr4EVZ8FOuD/D8ZDs3gEYUcfoRyRGJ5SfNxBZDzGunROIO8uRlnKhf+zHs8zi qDP5jW4Yca2dbrmUGOyP4nyq9B6SDMuOehUg5rSmwR5KuvvE7DUwI0QZ/7Q87NxgFf55 ucZRgGFvXfhzkvBgA+LtNxJXGJVASjlp4vAHn6ZZQfU4WHJHvwbXapFx5GxooXwkBI6L m4bRUFDRiln0a0CqAj8z6xQ2IpPMURT6bjeljikyrAaq0kd0W3VHRGWZzbvcN7pckEMj ozW8DspK46Y+1qU4tXtmgkazV5SLv1+bGqYP5VgF0sjXi68/fDn1R0324YGXTVvmCzex Jjfw== X-Gm-Message-State: AOJu0YzaWZ+63w2iKXl9tTSh1c2J3azfRipIjqXbVDjVlyT4FsWzcU7N JA8yh+6V8f2tmw+ON/6xXAithKa1+GufLgbbiSYWXJDXfdqzRd1ia5Q3iIYms6fEK5QfloRhPsu PkUZfzOKh X-Gm-Gg: ASbGncuHS1uhMfz+HdRkSaUS8zNS6CiqxtHSk4PzgudJzjGLGOuaEdQ26/0Ltcw4JUd h96M8qxCxCHBxub5hhQAzfWvNjdez6ORiKEIkCITmg1NY84v0O19D0V1FX4TPYWscq9ORRwO/rC SlRYI5en3rInPuDohnQ7nmhj5dfihpgfzBz8OeTOxhATgDKlvGciC4L95HSTkC/q6TH61aZyhXw sy5UDCxLl/vZrMDTlO3kI8I8iDdzbMhDCA3lLwFyHtelTDhWtwn8gza9xo= X-Received: by 2002:a05:6512:108c:b0:540:1a33:ded8 with SMTP id 2adb3069b0e04-540240c04fcmr2140661e87.17.1733847895895; Tue, 10 Dec 2024 08:24:55 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 63/69] target/arm: Convert FCVTZ[SU] (vector, fixed-point) to decodetree Date: Tue, 10 Dec 2024 10:17:27 -0600 Message-ID: <20241210161733.1830573-64-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::233; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x233.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 Remove handle_simd_shift_fpint_conv and disas_simd_shift_imm as these were the last insns decoded by those functions. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/helper.h | 4 + target/arm/tcg/translate-a64.c | 160 +++------------------------------ target/arm/tcg/vec_helper.c | 2 + target/arm/vfp_helper.c | 4 + target/arm/tcg/a64.decode | 8 ++ 5 files changed, 32 insertions(+), 146 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index b227ac54d9..0c8a56c3ae 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -178,8 +178,10 @@ DEF_HELPER_3(vfp_touhs_round_to_zero, i32, f32, i32, ptr) DEF_HELPER_3(vfp_touls_round_to_zero, i32, f32, i32, ptr) DEF_HELPER_3(vfp_toshd_round_to_zero, i64, f64, i32, ptr) DEF_HELPER_3(vfp_tosld_round_to_zero, i64, f64, i32, ptr) +DEF_HELPER_3(vfp_tosqd_round_to_zero, i64, f64, i32, ptr) DEF_HELPER_3(vfp_touhd_round_to_zero, i64, f64, i32, ptr) DEF_HELPER_3(vfp_tould_round_to_zero, i64, f64, i32, ptr) +DEF_HELPER_3(vfp_touqd_round_to_zero, i64, f64, i32, ptr) DEF_HELPER_3(vfp_touhh, i32, f16, i32, ptr) DEF_HELPER_3(vfp_toshh, i32, f16, i32, ptr) DEF_HELPER_3(vfp_toulh, i32, f16, i32, ptr) @@ -660,6 +662,8 @@ DEF_HELPER_FLAGS_4(gvec_vcvt_rz_hu, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_sd, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_ud, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_vcvt_rz_ds, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_vcvt_rz_du, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_rm_ss, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_rm_us, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 0f94fa4fdc..1c4e53770b 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9332,107 +9332,21 @@ TRANS(UCVTF_vi, do_gvec_op2_fpst, TRANS(UCVTF_vf, do_gvec_op2_fpst, a->esz, a->q, a->rd, a->rn, a->shift, f_ucvtf_v) -/* FCVTZS, FVCVTZU - FP to fixedpoint conversion */ -static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar, - bool is_q, bool is_u, - int immh, int immb, int rn, int rd) -{ - int immhb = immh << 3 | immb; - int pass, size, fracbits; - TCGv_ptr tcg_fpstatus; - TCGv_i32 tcg_rmode, tcg_shift; +static gen_helper_gvec_2_ptr * const f_fcvtzs_vf[] = { + gen_helper_gvec_vcvt_rz_hs, + gen_helper_gvec_vcvt_rz_fs, + gen_helper_gvec_vcvt_rz_ds, +}; +TRANS(FCVTZS_vf, do_gvec_op2_fpst, + a->esz, a->q, a->rd, a->rn, a->shift, f_fcvtzs_vf) - if (immh & 0x8) { - size = MO_64; - if (!is_scalar && !is_q) { - unallocated_encoding(s); - return; - } - } else if (immh & 0x4) { - size = MO_32; - } else if (immh & 0x2) { - size = MO_16; - if (!dc_isar_feature(aa64_fp16, s)) { - unallocated_encoding(s); - return; - } - } else { - /* Should have split out AdvSIMD modified immediate earlier. */ - assert(immh == 1); - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - assert(!(is_scalar && is_q)); - - tcg_fpstatus = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); - tcg_rmode = gen_set_rmode(FPROUNDING_ZERO, tcg_fpstatus); - fracbits = (16 << size) - immhb; - tcg_shift = tcg_constant_i32(fracbits); - - if (size == MO_64) { - int maxpass = is_scalar ? 1 : 2; - - for (pass = 0; pass < maxpass; pass++) { - TCGv_i64 tcg_op = tcg_temp_new_i64(); - - read_vec_element(s, tcg_op, rn, pass, MO_64); - if (is_u) { - gen_helper_vfp_touqd(tcg_op, tcg_op, tcg_shift, tcg_fpstatus); - } else { - gen_helper_vfp_tosqd(tcg_op, tcg_op, tcg_shift, tcg_fpstatus); - } - write_vec_element(s, tcg_op, rd, pass, MO_64); - } - clear_vec_high(s, is_q, rd); - } else { - void (*fn)(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); - int maxpass = is_scalar ? 1 : ((8 << is_q) >> size); - - switch (size) { - case MO_16: - if (is_u) { - fn = gen_helper_vfp_touhh; - } else { - fn = gen_helper_vfp_toshh; - } - break; - case MO_32: - if (is_u) { - fn = gen_helper_vfp_touls; - } else { - fn = gen_helper_vfp_tosls; - } - break; - default: - g_assert_not_reached(); - } - - for (pass = 0; pass < maxpass; pass++) { - TCGv_i32 tcg_op = tcg_temp_new_i32(); - - read_vec_element_i32(s, tcg_op, rn, pass, size); - fn(tcg_op, tcg_op, tcg_shift, tcg_fpstatus); - if (is_scalar) { - if (size == MO_16 && !is_u) { - tcg_gen_ext16u_i32(tcg_op, tcg_op); - } - write_fp_sreg(s, rd, tcg_op); - } else { - write_vec_element_i32(s, tcg_op, rd, pass, size); - } - } - if (!is_scalar) { - clear_vec_high(s, is_q, rd); - } - } - - gen_restore_rmode(tcg_rmode, tcg_fpstatus); -} +static gen_helper_gvec_2_ptr * const f_fcvtzu_vf[] = { + gen_helper_gvec_vcvt_rz_hu, + gen_helper_gvec_vcvt_rz_fu, + gen_helper_gvec_vcvt_rz_du, +}; +TRANS(FCVTZU_vf, do_gvec_op2_fpst, + a->esz, a->q, a->rd, a->rn, a->shift, f_fcvtzu_vf) static void handle_2misc_64(DisasContext *s, int opcode, bool u, TCGv_i64 tcg_rd, TCGv_i64 tcg_rn, @@ -9759,51 +9673,6 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) g_assert_not_reached(); } -/* AdvSIMD shift by immediate - * 31 30 29 28 23 22 19 18 16 15 11 10 9 5 4 0 - * +---+---+---+-------------+------+------+--------+---+------+------+ - * | 0 | Q | U | 0 1 1 1 1 0 | immh | immb | opcode | 1 | Rn | Rd | - * +---+---+---+-------------+------+------+--------+---+------+------+ - */ -static void disas_simd_shift_imm(DisasContext *s, uint32_t insn) -{ - int rd = extract32(insn, 0, 5); - int rn = extract32(insn, 5, 5); - int opcode = extract32(insn, 11, 5); - int immb = extract32(insn, 16, 3); - int immh = extract32(insn, 19, 4); - bool is_u = extract32(insn, 29, 1); - bool is_q = extract32(insn, 30, 1); - - if (immh == 0) { - unallocated_encoding(s); - return; - } - - switch (opcode) { - case 0x1f: /* FCVTZS/ FCVTZU */ - handle_simd_shift_fpint_conv(s, false, is_q, is_u, immh, immb, rn, rd); - return; - default: - case 0x00: /* SSHR / USHR */ - case 0x02: /* SSRA / USRA (accumulate) */ - case 0x04: /* SRSHR / URSHR (rounding) */ - case 0x06: /* SRSRA / URSRA (accum + rounding) */ - case 0x08: /* SRI */ - case 0x0a: /* SHL / SLI */ - case 0x0c: /* SQSHLU */ - case 0x0e: /* SQSHL, UQSHL */ - case 0x10: /* SHRN / SQSHRUN */ - case 0x11: /* RSHRN / SQRSHRUN */ - case 0x12: /* SQSHRN / UQSHRN */ - case 0x13: /* SQRSHRN / UQRSHRN */ - case 0x14: /* SSHLL / USHLL */ - case 0x1c: /* SCVTF / UCVTF */ - unallocated_encoding(s); - return; - } -} - static void handle_2misc_widening(DisasContext *s, int opcode, bool is_q, int size, int rn, int rd) { @@ -10299,7 +10168,6 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) static const AArch64DecodeTable data_proc_simd[] = { /* pattern , mask , fn */ { 0x0e200800, 0x9f3e0c00, disas_simd_two_reg_misc }, - { 0x0f000400, 0x9f800400, disas_simd_shift_imm }, { 0x5e200800, 0xdf3e0c00, disas_simd_scalar_two_reg_misc }, { 0x0e780800, 0x8f7e0c00, disas_simd_two_reg_misc_fp16 }, { 0x00000000, 0x00000000, NULL } diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index aa85cea0ca..9b269a4f18 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -2512,6 +2512,8 @@ DO_VCVT_FIXED(gvec_vcvt_uf, helper_vfp_ultos, uint32_t) DO_VCVT_FIXED(gvec_vcvt_sh, helper_vfp_shtoh, uint16_t) DO_VCVT_FIXED(gvec_vcvt_uh, helper_vfp_uhtoh, uint16_t) +DO_VCVT_FIXED(gvec_vcvt_rz_ds, helper_vfp_tosqd_round_to_zero, uint64_t) +DO_VCVT_FIXED(gvec_vcvt_rz_du, helper_vfp_touqd_round_to_zero, uint64_t) DO_VCVT_FIXED(gvec_vcvt_rz_fs, helper_vfp_tosls_round_to_zero, uint32_t) DO_VCVT_FIXED(gvec_vcvt_rz_fu, helper_vfp_touls_round_to_zero, uint32_t) DO_VCVT_FIXED(gvec_vcvt_rz_hs, helper_vfp_toshh_round_to_zero, uint16_t) diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index f24992c798..5a19af509c 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -495,6 +495,10 @@ VFP_CONV_FIX_A64(sq, h, 16, dh_ctype_f16, 64, int64) VFP_CONV_FIX(uh, h, 16, dh_ctype_f16, 32, uint16) VFP_CONV_FIX(ul, h, 16, dh_ctype_f16, 32, uint32) VFP_CONV_FIX_A64(uq, h, 16, dh_ctype_f16, 64, uint64) +VFP_CONV_FLOAT_FIX_ROUND(sq, d, 64, float64, 64, int64, + float_round_to_zero, _round_to_zero) +VFP_CONV_FLOAT_FIX_ROUND(uq, d, 64, float64, 64, uint64, + float_round_to_zero, _round_to_zero) #undef VFP_CONV_FIX #undef VFP_CONV_FIX_FLOAT diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 4f832e7a4c..61d519b96a 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1808,3 +1808,11 @@ SCVTF_vf 0.00 11110 ....... 111001 ..... ..... @fcvtq_d UCVTF_vf 0.10 11110 ....... 111001 ..... ..... @fcvtq_h UCVTF_vf 0.10 11110 ....... 111001 ..... ..... @fcvtq_s UCVTF_vf 0.10 11110 ....... 111001 ..... ..... @fcvtq_d + +FCVTZS_vf 0.00 11110 ....... 111111 ..... ..... @fcvtq_h +FCVTZS_vf 0.00 11110 ....... 111111 ..... ..... @fcvtq_s +FCVTZS_vf 0.00 11110 ....... 111111 ..... ..... @fcvtq_d + +FCVTZU_vf 0.10 11110 ....... 111111 ..... ..... @fcvtq_h +FCVTZU_vf 0.10 11110 ....... 111111 ..... ..... @fcvtq_s +FCVTZU_vf 0.10 11110 ....... 111111 ..... ..... @fcvtq_d From patchwork Tue Dec 10 16:17:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848863 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp421071wrn; Tue, 10 Dec 2024 08:28:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXFhqDAEyHDuvvb4vxKEIYU1CR0exE+q1UwR1rxyg8A+Yf85DfiiUNO1G+l/FSavh1fgYg8Ig==@linaro.org X-Google-Smtp-Source: AGHT+IHQotJefLSVMze8k2NAwJnezHufNp+6NQ5rvFogTn2ngeRdzOGyK6rGz2STHWgpFRLq/Koc X-Received: by 2002:a05:622a:8e:b0:467:76cc:622d with SMTP id d75a77b69052e-46776cce242mr58039541cf.11.1733848126266; Tue, 10 Dec 2024 08:28:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848126; cv=none; d=google.com; s=arc-20240605; b=Abksc8nSVCMyu18BDTTJViJPi876Wle5eGXWzMLNF4vvYuzbOwqBpNUeSWeFna+y73 FT6ltYUNEOblJ1iVZkAcxbo9m0rdR5IL8o9mdu0G6y3Acdw+Vz3EMNPa2PRbNb3qKREr 1pKKovsj/q37gnsuCdmIElcydfZvogdQdWFBTxLLqG9xwRZGrtCPvDzeL3V2ErtR5/Zu 8NrT4xtPBafZAd4SnlF5ZKmnbPZTrGDpwYpRzCKw1yQ+bvT2i97f7USVz9ZgUt7L+M1W 8VMbYn7zttYb1H4g2kO2VpeGsBkDaW5bEkCedFHmHizX9YJRBt7xv+UCQ7TPRtt04Gw8 B4Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=c2qTvTIdkL/bh0JGhbrtOjGfpblOfuvSgvAVFjIBR38=; fh=9Ev+QBUhk6P6vR3LT1wYeDLexozsz44nqjfoyPajZCc=; b=RKxEdWd2p5ezCl9633o30iUGMtoEAO2JQxw8HB6h0foa3U4oGp//R2D8hguQjYqwcL y1LPrn2LbaOeRcNUFSY/0uN3pQCJvp0IQQjVKp9uXtxFHylf5rF2UfVHTsEctt+yMlGy 9inl107dN4zKVjkCwkbThf/TO5neOtME3OapGVORxFhLJXwoAOaJ5HiY9Kd3syW8xtRu /IJwOABnyV9wt9hq7UIg0XOyc0OHKdatLmP74XJQRIl/yiKTaBRNmpySWr4U7ty32bez hLlM/DUfGm+1dkkmGR6NgBnrD6mlUt1vaYP3T+Vgo/MsUzjShkIbroxG6ywmzgQ8TXrB Brrg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I+6kBJ5P; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-467296b6fffsi164803771cf.102.2024.12.10.08.28.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:28: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=I+6kBJ5P; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL33T-00040T-Ck; Tue, 10 Dec 2024 11:25:47 -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 1tL32l-0000c2-KB for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:25:04 -0500 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32i-0007ei-Oh for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:25:03 -0500 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-5401e6efffcso2541067e87.3 for ; Tue, 10 Dec 2024 08:25:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847899; x=1734452699; 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=c2qTvTIdkL/bh0JGhbrtOjGfpblOfuvSgvAVFjIBR38=; b=I+6kBJ5P15BXAPGy85hLIm3Wo0CxcYM1F1UsWxi6SdgDrHwJ2zAaCis8QQJHg6dnk0 mU2XlypiPZKWovh15yUGW9foOhg/P9LKiN8ZTJOfVzr4lR1d/Kz6BKrvGmSEZ8oS7/qn JBg55Lk8kfgEWlPgykNKiLsuMe4t8puAJM6Ewos9lmDuKT/459XjH9vMx7c+A40Ph2hR XSMYC6r9XvGDcpcqVkVViFBrXwHXY730MW4Wc93sdUnK5IacQfqVnHTLhYX+6Lstpo3r cFPd1V8+u7yuCjvvz+ifjQXAl/qUBRlIcyLdcMj+VnnlWX36SwlJaMUf8l153AebE0XJ gXOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847899; x=1734452699; 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=c2qTvTIdkL/bh0JGhbrtOjGfpblOfuvSgvAVFjIBR38=; b=cNENfKHJRGzIgmTASARVpdZRacqn565UHzehXQR6/1Q7dSF2H1tO8k5ZZ1WcS84tFG JorZ4+coJSN/cCowhQt3yHbJCh7sbQoEFHomS/WUCj+0dGD7FuRt8VTOf4/nCCEwVJ5x KkbwDs+NTKw3mwbMfpaRSHNNboX69Xz0/eAS1kTOCZhddM5onl/rtw/usNB7mIYkEYcc B9OI6bnRAKGsKDpZk4IBin0hApuQpGqTGbuQz3rxk1Un7gGjxOMgiOc0OoelnksD1fQF 0TIx1iPo76Z0lcM9hXIWpq2wXol5M3kjFwCEOEYqUh2wXymeyD7ydOexkrFiLrscIwrK ++Tg== X-Gm-Message-State: AOJu0YwFJrB2Uqed/Sik/+zM8CpAw064kvDsrFJ0qYqX4vOb7rm/Incv nMvQkmSwmYMlEtPhI8ngNYG+N1g2Ea9iHucev4qlLCYV3h6Vzwldm9IxId1in9rZrridLXrC67k panBkTNm2 X-Gm-Gg: ASbGnctKPe8qs1J2xXCWeaTD9lXwIclX2dujcR7sCvxLFQMYkIArtsrzm0w2ScJnNI/ Sva8QRdRiMvOU/yws5GRQfCTo4eCHjzbUYQnByKtoyKYcVtuhUAwaBQIYebdO19OQwHSaij3j0w EfjFdTZob98peJ4Pewu/YJS1DYUIfFLPdoffgJB/B13iJqr5Y+m26o/j7DEz+sC6tfDuFBH4nPD W7VDGTeVahjE1Za6d3g1gIcDtvMNxEL+kDvsQicJ2LHgju7cq5HITN8Sns= X-Received: by 2002:a05:6512:691:b0:53e:39c2:f031 with SMTP id 2adb3069b0e04-5402410d981mr1839950e87.53.1733847898848; Tue, 10 Dec 2024 08:24:58 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:24:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 64/69] target/arm: Convert FCVT* (vector, integer) to decodetree Date: Tue, 10 Dec 2024 10:17:28 -0600 Message-ID: <20241210161733.1830573-65-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x130.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 Remove handle_2misc_64 as these were the last insns decoded by that function. Remove helper_advsimd_f16to[su]inth as unused; we now always go through helper_vfp_to[su]hh or a specialized vector function instead. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/helper.h | 2 + target/arm/tcg/helper-a64.h | 2 - target/arm/tcg/helper-a64.c | 32 ----- target/arm/tcg/translate-a64.c | 227 +++++++++++---------------------- target/arm/tcg/vec_helper.c | 2 + target/arm/tcg/a64.decode | 25 ++++ 6 files changed, 102 insertions(+), 188 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 0c8a56c3ae..64aa603465 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -665,6 +665,8 @@ DEF_HELPER_FLAGS_4(gvec_vcvt_ud, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_rz_ds, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_rz_du, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_vcvt_rm_sd, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_vcvt_rm_ud, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_rm_ss, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_rm_us, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_vcvt_rm_sh, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) diff --git a/target/arm/tcg/helper-a64.h b/target/arm/tcg/helper-a64.h index ac7ca190fa..3c0774139b 100644 --- a/target/arm/tcg/helper-a64.h +++ b/target/arm/tcg/helper-a64.h @@ -74,8 +74,6 @@ DEF_HELPER_3(advsimd_mulx2h, i32, i32, i32, ptr) DEF_HELPER_4(advsimd_muladd2h, i32, i32, i32, i32, ptr) DEF_HELPER_2(advsimd_rinth_exact, f16, f16, ptr) DEF_HELPER_2(advsimd_rinth, f16, f16, ptr) -DEF_HELPER_2(advsimd_f16tosinth, i32, f16, ptr) -DEF_HELPER_2(advsimd_f16touinth, i32, f16, ptr) DEF_HELPER_2(exception_return, void, env, i64) DEF_HELPER_FLAGS_2(dc_zva, TCG_CALL_NO_WG, void, env, i64) diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c index 3de564e0fe..28de7468cd 100644 --- a/target/arm/tcg/helper-a64.c +++ b/target/arm/tcg/helper-a64.c @@ -618,38 +618,6 @@ uint32_t HELPER(advsimd_rinth)(uint32_t x, void *fp_status) return ret; } -/* - * Half-precision floating point conversion functions - * - * There are a multitude of conversion functions with various - * different rounding modes. This is dealt with by the calling code - * setting the mode appropriately before calling the helper. - */ - -uint32_t HELPER(advsimd_f16tosinth)(uint32_t a, void *fpstp) -{ - float_status *fpst = fpstp; - - /* Invalid if we are passed a NaN */ - if (float16_is_any_nan(a)) { - float_raise(float_flag_invalid, fpst); - return 0; - } - return float16_to_int16(a, fpst); -} - -uint32_t HELPER(advsimd_f16touinth)(uint32_t a, void *fpstp) -{ - float_status *fpst = fpstp; - - /* Invalid if we are passed a NaN */ - if (float16_is_any_nan(a)) { - float_raise(float_flag_invalid, fpst); - return 0; - } - return float16_to_uint16(a, fpst); -} - static int el_from_spsr(uint32_t spsr) { /* Return the exception level that this SPSR is requesting a return to, diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 1c4e53770b..ec1ce44c4b 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9348,56 +9348,38 @@ static gen_helper_gvec_2_ptr * const f_fcvtzu_vf[] = { TRANS(FCVTZU_vf, do_gvec_op2_fpst, a->esz, a->q, a->rd, a->rn, a->shift, f_fcvtzu_vf) -static void handle_2misc_64(DisasContext *s, int opcode, bool u, - TCGv_i64 tcg_rd, TCGv_i64 tcg_rn, - TCGv_i32 tcg_rmode, TCGv_ptr tcg_fpstatus) -{ - /* Handle 64->64 opcodes which are shared between the scalar and - * vector 2-reg-misc groups. We cover every integer opcode where size == 3 - * is valid in either group and also the double-precision fp ops. - * The caller only need provide tcg_rmode and tcg_fpstatus if the op - * requires them. - */ - switch (opcode) { - case 0x1a: /* FCVTNS */ - case 0x1b: /* FCVTMS */ - case 0x1c: /* FCVTAS */ - case 0x3a: /* FCVTPS */ - case 0x3b: /* FCVTZS */ - gen_helper_vfp_tosqd(tcg_rd, tcg_rn, tcg_constant_i32(0), tcg_fpstatus); - break; - case 0x5a: /* FCVTNU */ - case 0x5b: /* FCVTMU */ - case 0x5c: /* FCVTAU */ - case 0x7a: /* FCVTPU */ - case 0x7b: /* FCVTZU */ - gen_helper_vfp_touqd(tcg_rd, tcg_rn, tcg_constant_i32(0), tcg_fpstatus); - break; - default: - case 0x4: /* CLS, CLZ */ - case 0x5: /* NOT */ - case 0x7: /* SQABS, SQNEG */ - case 0x8: /* CMGT, CMGE */ - case 0x9: /* CMEQ, CMLE */ - case 0xa: /* CMLT */ - case 0xb: /* ABS, NEG */ - case 0x2f: /* FABS */ - case 0x6f: /* FNEG */ - case 0x7f: /* FSQRT */ - case 0x18: /* FRINTN */ - case 0x19: /* FRINTM */ - case 0x38: /* FRINTP */ - case 0x39: /* FRINTZ */ - case 0x58: /* FRINTA */ - case 0x79: /* FRINTI */ - case 0x59: /* FRINTX */ - case 0x1e: /* FRINT32Z */ - case 0x5e: /* FRINT32X */ - case 0x1f: /* FRINT64Z */ - case 0x5f: /* FRINT64X */ - g_assert_not_reached(); - } -} +static gen_helper_gvec_2_ptr * const f_fcvt_s_vi[] = { + gen_helper_gvec_vcvt_rm_sh, + gen_helper_gvec_vcvt_rm_ss, + gen_helper_gvec_vcvt_rm_sd, +}; + +static gen_helper_gvec_2_ptr * const f_fcvt_u_vi[] = { + gen_helper_gvec_vcvt_rm_uh, + gen_helper_gvec_vcvt_rm_us, + gen_helper_gvec_vcvt_rm_ud, +}; + +TRANS(FCVTNS_vi, do_gvec_op2_fpst, + a->esz, a->q, a->rd, a->rn, float_round_nearest_even, f_fcvt_s_vi) +TRANS(FCVTNU_vi, do_gvec_op2_fpst, + a->esz, a->q, a->rd, a->rn, float_round_nearest_even, f_fcvt_u_vi) +TRANS(FCVTPS_vi, do_gvec_op2_fpst, + a->esz, a->q, a->rd, a->rn, float_round_up, f_fcvt_s_vi) +TRANS(FCVTPU_vi, do_gvec_op2_fpst, + a->esz, a->q, a->rd, a->rn, float_round_up, f_fcvt_u_vi) +TRANS(FCVTMS_vi, do_gvec_op2_fpst, + a->esz, a->q, a->rd, a->rn, float_round_down, f_fcvt_s_vi) +TRANS(FCVTMU_vi, do_gvec_op2_fpst, + a->esz, a->q, a->rd, a->rn, float_round_down, f_fcvt_u_vi) +TRANS(FCVTZS_vi, do_gvec_op2_fpst, + a->esz, a->q, a->rd, a->rn, float_round_to_zero, f_fcvt_s_vi) +TRANS(FCVTZU_vi, do_gvec_op2_fpst, + a->esz, a->q, a->rd, a->rn, float_round_to_zero, f_fcvt_u_vi) +TRANS(FCVTAS_vi, do_gvec_op2_fpst, + a->esz, a->q, a->rd, a->rn, float_round_ties_away, f_fcvt_s_vi) +TRANS(FCVTAU_vi, do_gvec_op2_fpst, + a->esz, a->q, a->rd, a->rn, float_round_ties_away, f_fcvt_u_vi) static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, bool is_scalar, bool is_u, bool is_q, @@ -9758,30 +9740,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } handle_2misc_fcmp_zero(s, opcode, false, u, is_q, size, rn, rd); return; - case 0x1a: /* FCVTNS */ - case 0x1b: /* FCVTMS */ - case 0x3a: /* FCVTPS */ - case 0x3b: /* FCVTZS */ - case 0x5a: /* FCVTNU */ - case 0x5b: /* FCVTMU */ - case 0x7a: /* FCVTPU */ - case 0x7b: /* FCVTZU */ - need_fpstatus = true; - rmode = extract32(opcode, 5, 1) | (extract32(opcode, 0, 1) << 1); - if (size == 3 && !is_q) { - unallocated_encoding(s); - return; - } - break; - case 0x5c: /* FCVTAU */ - case 0x1c: /* FCVTAS */ - need_fpstatus = true; - rmode = FPROUNDING_TIEAWAY; - if (size == 3 && !is_q) { - unallocated_encoding(s); - return; - } - break; case 0x3c: /* URECPE */ if (size == 3) { unallocated_encoding(s); @@ -9831,6 +9789,16 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x5f: /* FRINT64X */ case 0x1d: /* SCVTF */ case 0x5d: /* UCVTF */ + case 0x1a: /* FCVTNS */ + case 0x1b: /* FCVTMS */ + case 0x3a: /* FCVTPS */ + case 0x3b: /* FCVTZS */ + case 0x5a: /* FCVTNU */ + case 0x5b: /* FCVTMU */ + case 0x7a: /* FCVTPU */ + case 0x7b: /* FCVTZU */ + case 0x5c: /* FCVTAU */ + case 0x1c: /* FCVTAS */ unallocated_encoding(s); return; } @@ -9871,26 +9839,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) tcg_rmode = NULL; } - if (size == 3) { - /* All 64-bit element operations can be shared with scalar 2misc */ - int pass; - - /* Coverity claims (size == 3 && !is_q) has been eliminated - * from all paths leading to here. - */ - tcg_debug_assert(is_q); - for (pass = 0; pass < 2; pass++) { - TCGv_i64 tcg_op = tcg_temp_new_i64(); - TCGv_i64 tcg_res = tcg_temp_new_i64(); - - read_vec_element(s, tcg_op, rn, pass, MO_64); - - handle_2misc_64(s, opcode, u, tcg_res, tcg_op, - tcg_rmode, tcg_fpstatus); - - write_vec_element(s, tcg_res, rd, pass, MO_64); - } - } else { + { int pass; assert(size == 2); @@ -9903,22 +9852,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) { /* Special cases for 32 bit elements */ switch (opcode) { - case 0x1a: /* FCVTNS */ - case 0x1b: /* FCVTMS */ - case 0x1c: /* FCVTAS */ - case 0x3a: /* FCVTPS */ - case 0x3b: /* FCVTZS */ - gen_helper_vfp_tosls(tcg_res, tcg_op, - tcg_constant_i32(0), tcg_fpstatus); - break; - case 0x5a: /* FCVTNU */ - case 0x5b: /* FCVTMU */ - case 0x5c: /* FCVTAU */ - case 0x7a: /* FCVTPU */ - case 0x7b: /* FCVTZU */ - gen_helper_vfp_touls(tcg_res, tcg_op, - tcg_constant_i32(0), tcg_fpstatus); - break; case 0x7c: /* URSQRTE */ gen_helper_rsqrte_u32(tcg_res, tcg_op); break; @@ -9938,6 +9871,16 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x5e: /* FRINT32X */ case 0x1f: /* FRINT64Z */ case 0x5f: /* FRINT64X */ + case 0x1a: /* FCVTNS */ + case 0x1b: /* FCVTMS */ + case 0x1c: /* FCVTAS */ + case 0x3a: /* FCVTPS */ + case 0x3b: /* FCVTZS */ + case 0x5a: /* FCVTNU */ + case 0x5b: /* FCVTMU */ + case 0x5c: /* FCVTAU */ + case 0x7a: /* FCVTPU */ + case 0x7b: /* FCVTZU */ g_assert_not_reached(); } } @@ -10006,36 +9949,6 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x3d: /* FRECPE */ case 0x3f: /* FRECPX */ break; - case 0x1a: /* FCVTNS */ - rmode = FPROUNDING_TIEEVEN; - break; - case 0x1b: /* FCVTMS */ - rmode = FPROUNDING_NEGINF; - break; - case 0x1c: /* FCVTAS */ - rmode = FPROUNDING_TIEAWAY; - break; - case 0x3a: /* FCVTPS */ - rmode = FPROUNDING_POSINF; - break; - case 0x3b: /* FCVTZS */ - rmode = FPROUNDING_ZERO; - break; - case 0x5a: /* FCVTNU */ - rmode = FPROUNDING_TIEEVEN; - break; - case 0x5b: /* FCVTMU */ - rmode = FPROUNDING_NEGINF; - break; - case 0x5c: /* FCVTAU */ - rmode = FPROUNDING_TIEAWAY; - break; - case 0x7a: /* FCVTPU */ - rmode = FPROUNDING_POSINF; - break; - case 0x7b: /* FCVTZU */ - rmode = FPROUNDING_ZERO; - break; case 0x7d: /* FRSQRTE */ break; default: @@ -10051,6 +9964,16 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x79: /* FRINTI */ case 0x1d: /* SCVTF */ case 0x5d: /* UCVTF */ + case 0x1a: /* FCVTNS */ + case 0x1b: /* FCVTMS */ + case 0x1c: /* FCVTAS */ + case 0x3a: /* FCVTPS */ + case 0x3b: /* FCVTZS */ + case 0x5a: /* FCVTNU */ + case 0x5b: /* FCVTMU */ + case 0x5c: /* FCVTAU */ + case 0x7a: /* FCVTPU */ + case 0x7b: /* FCVTZU */ unallocated_encoding(s); return; } @@ -10115,23 +10038,9 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) read_vec_element_i32(s, tcg_op, rn, pass, MO_16); switch (fpop) { - case 0x1a: /* FCVTNS */ - case 0x1b: /* FCVTMS */ - case 0x1c: /* FCVTAS */ - case 0x3a: /* FCVTPS */ - case 0x3b: /* FCVTZS */ - gen_helper_advsimd_f16tosinth(tcg_res, tcg_op, tcg_fpstatus); - break; case 0x3d: /* FRECPE */ gen_helper_recpe_f16(tcg_res, tcg_op, tcg_fpstatus); break; - case 0x5a: /* FCVTNU */ - case 0x5b: /* FCVTMU */ - case 0x5c: /* FCVTAU */ - case 0x7a: /* FCVTPU */ - case 0x7b: /* FCVTZU */ - gen_helper_advsimd_f16touinth(tcg_res, tcg_op, tcg_fpstatus); - break; case 0x7d: /* FRSQRTE */ gen_helper_rsqrte_f16(tcg_res, tcg_op, tcg_fpstatus); break; @@ -10146,6 +10055,16 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x58: /* FRINTA */ case 0x79: /* FRINTI */ case 0x59: /* FRINTX */ + case 0x1a: /* FCVTNS */ + case 0x1b: /* FCVTMS */ + case 0x1c: /* FCVTAS */ + case 0x3a: /* FCVTPS */ + case 0x3b: /* FCVTZS */ + case 0x5a: /* FCVTNU */ + case 0x5b: /* FCVTMU */ + case 0x5c: /* FCVTAU */ + case 0x7a: /* FCVTPU */ + case 0x7b: /* FCVTZU */ g_assert_not_reached(); } diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index 9b269a4f18..0aee38a3bc 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -2537,6 +2537,8 @@ DO_VCVT_FIXED(gvec_vcvt_rz_hu, helper_vfp_touhh_round_to_zero, uint16_t) clear_tail(d, oprsz, simd_maxsz(desc)); \ } +DO_VCVT_RMODE(gvec_vcvt_rm_sd, helper_vfp_tosqd, uint64_t) +DO_VCVT_RMODE(gvec_vcvt_rm_ud, helper_vfp_touqd, uint64_t) DO_VCVT_RMODE(gvec_vcvt_rm_ss, helper_vfp_tosls, uint32_t) DO_VCVT_RMODE(gvec_vcvt_rm_us, helper_vfp_touls, uint32_t) DO_VCVT_RMODE(gvec_vcvt_rm_sh, helper_vfp_toshh, uint16_t) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 61d519b96a..05a0b84416 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1793,6 +1793,31 @@ SCVTF_vi 0.00 1110 0.1 00001 11011 0 ..... ..... @qrr_sd UCVTF_vi 0.10 1110 011 11001 11011 0 ..... ..... @qrr_h UCVTF_vi 0.10 1110 0.1 00001 11011 0 ..... ..... @qrr_sd +FCVTNS_vi 0.00 1110 011 11001 10101 0 ..... ..... @qrr_h +FCVTNS_vi 0.00 1110 0.1 00001 10101 0 ..... ..... @qrr_sd +FCVTNU_vi 0.10 1110 011 11001 10101 0 ..... ..... @qrr_h +FCVTNU_vi 0.10 1110 0.1 00001 10101 0 ..... ..... @qrr_sd + +FCVTPS_vi 0.00 1110 111 11001 10101 0 ..... ..... @qrr_h +FCVTPS_vi 0.00 1110 1.1 00001 10101 0 ..... ..... @qrr_sd +FCVTPU_vi 0.10 1110 111 11001 10101 0 ..... ..... @qrr_h +FCVTPU_vi 0.10 1110 1.1 00001 10101 0 ..... ..... @qrr_sd + +FCVTMS_vi 0.00 1110 011 11001 10111 0 ..... ..... @qrr_h +FCVTMS_vi 0.00 1110 0.1 00001 10111 0 ..... ..... @qrr_sd +FCVTMU_vi 0.10 1110 011 11001 10111 0 ..... ..... @qrr_h +FCVTMU_vi 0.10 1110 0.1 00001 10111 0 ..... ..... @qrr_sd + +FCVTZS_vi 0.00 1110 111 11001 10111 0 ..... ..... @qrr_h +FCVTZS_vi 0.00 1110 1.1 00001 10111 0 ..... ..... @qrr_sd +FCVTZU_vi 0.10 1110 111 11001 10111 0 ..... ..... @qrr_h +FCVTZU_vi 0.10 1110 1.1 00001 10111 0 ..... ..... @qrr_sd + +FCVTAS_vi 0.00 1110 011 11001 11001 0 ..... ..... @qrr_h +FCVTAS_vi 0.00 1110 0.1 00001 11001 0 ..... ..... @qrr_sd +FCVTAU_vi 0.10 1110 011 11001 11001 0 ..... ..... @qrr_h +FCVTAU_vi 0.10 1110 0.1 00001 11001 0 ..... ..... @qrr_sd + &fcvt_q rd rn esz q shift @fcvtq_h . q:1 . ...... 001 .... ...... rn:5 rd:5 \ &fcvt_q esz=1 shift=%fcvt_f_sh_h From patchwork Tue Dec 10 16:17:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848870 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp421918wrn; Tue, 10 Dec 2024 08:30:16 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVf3EuwQlYh/4MulUV5MgHTdNLu2YM1l3J/BOEIsgUxo/mCVE4AVPSYZOf7aJS932cDEvUkOA==@linaro.org X-Google-Smtp-Source: AGHT+IHyhYCALI86Ak7GE1xbgRut7rleyDjr2hQNti5rm5K1Da4j/5HhEv3stDP1LilypwwSm8HV X-Received: by 2002:a05:620a:4390:b0:7b6:d65a:d6d7 with SMTP id af79cd13be357-7b6dcec8e49mr746905285a.62.1733848216182; Tue, 10 Dec 2024 08:30:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848216; cv=none; d=google.com; s=arc-20240605; b=kRZAUpUBo4l2SwmbiySKYceHSztMwyHAtpEY7+56tAyfPp30yNxKrVFXmZDY0PBVbr TFrDA8rzUOdEGsyP+mzSy5YQ+Ee2I1Vh5LsREpJ/GtMA0lsftuAVS4Kl9JSrlz+UL8jL 9k+8c5LCCTBDAUkJkvjuk1BStjcjpMqwg359G8+04bZJhKtNsXnmlcMJ1awNq+pJd29r PFjw8Onwo/Gx7tdJCfkO3vQBRHUU2WyLSV6VW+8wANueSneyO0rPwq4lO4tFZ6qIonsD jesQMSpzfG9Q1SqA992zXXHueRfEJVQ1LE0q6ZkfmfpxwydyeBUSjlDnSoOYhRR2i5EZ H1lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=cRCBV/vxkr7Qx5oWfMmaKCyFFKH0t7hRxCOfnp+rU/M=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=Y0+SjI/Acana1xfpkJfarNFl3d2RMufmmdk2sN4baEKzYT5WJ3DXYczDGbLChkouze k1+acU6wbKYqS5BJrNf/ptYeJNZyjHkuFHv2quAo6bDq9rcq6NeQa3yCVLWR7fU9iLKt n4vkzyPgpcqdiVW3K9u3MY7gA8efwKoHeOMYSMV2GfWrIe+fnHBpGOCdddK68mI2tQ5h phtxdjXMsJaf74t5UA0YMtlU4KK4ZMY9YQQV7cEBuF+TiK8GVYdTPoqtQcflk2dOPVTX K0n6OFSbKSTdw1o/LyDwY4m2XyqFExDV/NpLFkHam2XDq8JKCsdQXTvak+p6z6SEpI9o qzWA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="m0Ua0/kh"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6b5aaa6c0si1405511385a.455.2024.12.10.08.30.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:30:16 -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="m0Ua0/kh"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL33L-0002tM-35; Tue, 10 Dec 2024 11:25:39 -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 1tL32o-0000t5-Ph for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:25:07 -0500 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32l-0007fM-NH for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:25:06 -0500 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-53e3778bffdso4243354e87.0 for ; Tue, 10 Dec 2024 08:25:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847902; x=1734452702; 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=cRCBV/vxkr7Qx5oWfMmaKCyFFKH0t7hRxCOfnp+rU/M=; b=m0Ua0/kh+Z3o8S55dUTcIbf2gIEHnq2+DbOkqrO6/ICO/Oo4j9F5nzy8KpVLw+jNvs /Ffr9AnwKxVMQLPgGyG9SKDq1me4D3CJKA15LgNdPxQMyGhDdICjT9cWANViqdjarCTN UwR59FwRLgJAGtqP2sEbw7nZDDSGhhAo3K2XIzlQXHedjddRg3onwIJPPDQFHQBFJQVp suhz1DXaTA3i8av3x9VO3XqC7dsCTKgz53UmydzuuMNXtVaEn6sit8tHfvfW4o6RU5Yu J9z5vJvRZYQLChZfXJ/17t6QCqPWwk+Q0/YThkJHnmZFRX/gm9GGt46WJjkGbH5r8Eob nUXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847902; x=1734452702; 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=cRCBV/vxkr7Qx5oWfMmaKCyFFKH0t7hRxCOfnp+rU/M=; b=mrxCWVA44TS65b4EPLGZOQGDAgOk7L6TdC5miD5cf/eSk84zOEn3Gd2ZqRPXWcA+TV ftXJE2M30tF9xjB3BLFZrVMMGZ+Ac6icUR6QlcLuJXjbsttd+FzA+F956622Fl0v51/9 dHi8FaUZ4Jl2HG7IlTwgwQuKxgyliHd4JTQzGHG7qQzTDhN42EgEnCfoatz12u++KOJL MvZCYp9ibCvPDAt2NAPbIOFBquLt90Zg8WYT6B+nt67VAcayQsdqcB9yTNmnAYBdkzbp Qd82vQhO5CerspsBtFo0GKxQ5+yS/Hu1IeyArS8lL+jtFIfVTio+hNJxB/BurmnMdCkE +4Qw== X-Gm-Message-State: AOJu0YxUn5yHriSs94bGPbuPYzbatzKVhVQnL5v+OQ2R4hQkLryLeqyd SUOsCAhATstSWb2E47TXBm3jlCJ04E+QmIy+fMNMk5vVUY0U2fBioZqrUaKJ28m8nrdCMJAyXGr FGzlXszi1 X-Gm-Gg: ASbGnctNkq1T6o324os6JfWfevd4Dptqe0jyx5WSbkVFwEUV/vtT6nGos54vvA0cSMT xVUzH6VwDZzfW531w73TJvU/RLM01hGXLqS5mIvQ4wXk6MoFHpmQ19FB28IFlP5G54uYJcvOmit 1PPld9WrFozZMuofoG/6Yt/7cq2dMyvO3kHKKB/CNhsuCISeBjMrJ0QUJA94uBUDdrBMT3aam3l IERFKrwtSCqEbxxmzWt1K8KALAeytPdpnxmKrub0GIIXMl+P2oMMjD02u4= X-Received: by 2002:a05:6512:2214:b0:53e:350a:72a0 with SMTP id 2adb3069b0e04-5402411a6ccmr2217356e87.51.1733847901755; Tue, 10 Dec 2024 08:25:01 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.24.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:25:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 65/69] target/arm: Convert handle_2misc_fcmp_zero to decodetree Date: Tue, 10 Dec 2024 10:17:29 -0600 Message-ID: <20241210161733.1830573-66-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12a.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 This includes FCMEQ, FCMGT, FCMGE, FCMLT, FCMLE. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.h | 5 + target/arm/tcg/translate-a64.c | 249 +++++++++++++-------------------- target/arm/tcg/vec_helper.c | 4 +- target/arm/tcg/a64.decode | 30 ++++ 4 files changed, 138 insertions(+), 150 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 64aa603465..1132a5cab6 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -688,18 +688,23 @@ DEF_HELPER_FLAGS_4(gvec_frsqrte_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_fcgt0_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_fcgt0_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_fcgt0_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_fcge0_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_fcge0_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_fcge0_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_fceq0_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_fceq0_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_fceq0_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_fcle0_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_fcle0_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_fcle0_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_fclt0_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_fclt0_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_fclt0_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(gvec_fadd_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(gvec_fadd_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index ec1ce44c4b..1776862161 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -5250,6 +5250,61 @@ static const FPScalar f_scalar_frsqrts = { }; TRANS(FRSQRTS_s, do_fp3_scalar, a, &f_scalar_frsqrts) +static bool do_fcmp0_s(DisasContext *s, arg_rr_e *a, + const FPScalar *f, bool swap) +{ + switch (a->esz) { + case MO_64: + if (fp_access_check(s)) { + TCGv_i64 t0 = read_fp_dreg(s, a->rn); + TCGv_i64 t1 = tcg_constant_i64(0); + if (swap) { + f->gen_d(t0, t1, t0, fpstatus_ptr(FPST_FPCR)); + } else { + f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_FPCR)); + } + write_fp_dreg(s, a->rd, t0); + } + break; + case MO_32: + if (fp_access_check(s)) { + TCGv_i32 t0 = read_fp_sreg(s, a->rn); + TCGv_i32 t1 = tcg_constant_i32(0); + if (swap) { + f->gen_s(t0, t1, t0, fpstatus_ptr(FPST_FPCR)); + } else { + f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_FPCR)); + } + write_fp_sreg(s, a->rd, t0); + } + break; + case MO_16: + if (!dc_isar_feature(aa64_fp16, s)) { + return false; + } + if (fp_access_check(s)) { + TCGv_i32 t0 = read_fp_hreg(s, a->rn); + TCGv_i32 t1 = tcg_constant_i32(0); + if (swap) { + f->gen_h(t0, t1, t0, fpstatus_ptr(FPST_FPCR_F16)); + } else { + f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_FPCR_F16)); + } + write_fp_sreg(s, a->rd, t0); + } + break; + default: + return false; + } + return true; +} + +TRANS(FCMEQ0_s, do_fcmp0_s, a, &f_scalar_fcmeq, false) +TRANS(FCMGT0_s, do_fcmp0_s, a, &f_scalar_fcmgt, false) +TRANS(FCMGE0_s, do_fcmp0_s, a, &f_scalar_fcmge, false) +TRANS(FCMLT0_s, do_fcmp0_s, a, &f_scalar_fcmgt, true) +TRANS(FCMLE0_s, do_fcmp0_s, a, &f_scalar_fcmge, true) + static bool do_satacc_s(DisasContext *s, arg_rrr_e *a, MemOp sgn_n, MemOp sgn_m, void (*gen_bhs)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64, MemOp), @@ -9381,134 +9436,40 @@ TRANS(FCVTAS_vi, do_gvec_op2_fpst, TRANS(FCVTAU_vi, do_gvec_op2_fpst, a->esz, a->q, a->rd, a->rn, float_round_ties_away, f_fcvt_u_vi) -static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, - bool is_scalar, bool is_u, bool is_q, - int size, int rn, int rd) -{ - bool is_double = (size == MO_64); - TCGv_ptr fpst; +static gen_helper_gvec_2_ptr * const f_fceq0[] = { + gen_helper_gvec_fceq0_h, + gen_helper_gvec_fceq0_s, + gen_helper_gvec_fceq0_d, +}; +TRANS(FCMEQ0_v, do_gvec_op2_fpst, a->esz, a->q, a->rd, a->rn, 0, f_fceq0) - if (!fp_access_check(s)) { - return; - } +static gen_helper_gvec_2_ptr * const f_fcgt0[] = { + gen_helper_gvec_fcgt0_h, + gen_helper_gvec_fcgt0_s, + gen_helper_gvec_fcgt0_d, +}; +TRANS(FCMGT0_v, do_gvec_op2_fpst, a->esz, a->q, a->rd, a->rn, 0, f_fcgt0) - fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); +static gen_helper_gvec_2_ptr * const f_fcge0[] = { + gen_helper_gvec_fcge0_h, + gen_helper_gvec_fcge0_s, + gen_helper_gvec_fcge0_d, +}; +TRANS(FCMGE0_v, do_gvec_op2_fpst, a->esz, a->q, a->rd, a->rn, 0, f_fcge0) - if (is_double) { - TCGv_i64 tcg_op = tcg_temp_new_i64(); - TCGv_i64 tcg_zero = tcg_constant_i64(0); - TCGv_i64 tcg_res = tcg_temp_new_i64(); - NeonGenTwoDoubleOpFn *genfn; - bool swap = false; - int pass; +static gen_helper_gvec_2_ptr * const f_fclt0[] = { + gen_helper_gvec_fclt0_h, + gen_helper_gvec_fclt0_s, + gen_helper_gvec_fclt0_d, +}; +TRANS(FCMLT0_v, do_gvec_op2_fpst, a->esz, a->q, a->rd, a->rn, 0, f_fclt0) - switch (opcode) { - case 0x2e: /* FCMLT (zero) */ - swap = true; - /* fallthrough */ - case 0x2c: /* FCMGT (zero) */ - genfn = gen_helper_neon_cgt_f64; - break; - case 0x2d: /* FCMEQ (zero) */ - genfn = gen_helper_neon_ceq_f64; - break; - case 0x6d: /* FCMLE (zero) */ - swap = true; - /* fall through */ - case 0x6c: /* FCMGE (zero) */ - genfn = gen_helper_neon_cge_f64; - break; - default: - g_assert_not_reached(); - } - - for (pass = 0; pass < (is_scalar ? 1 : 2); pass++) { - read_vec_element(s, tcg_op, rn, pass, MO_64); - if (swap) { - genfn(tcg_res, tcg_zero, tcg_op, fpst); - } else { - genfn(tcg_res, tcg_op, tcg_zero, fpst); - } - write_vec_element(s, tcg_res, rd, pass, MO_64); - } - - clear_vec_high(s, !is_scalar, rd); - } else { - TCGv_i32 tcg_op = tcg_temp_new_i32(); - TCGv_i32 tcg_zero = tcg_constant_i32(0); - TCGv_i32 tcg_res = tcg_temp_new_i32(); - NeonGenTwoSingleOpFn *genfn; - bool swap = false; - int pass, maxpasses; - - if (size == MO_16) { - switch (opcode) { - case 0x2e: /* FCMLT (zero) */ - swap = true; - /* fall through */ - case 0x2c: /* FCMGT (zero) */ - genfn = gen_helper_advsimd_cgt_f16; - break; - case 0x2d: /* FCMEQ (zero) */ - genfn = gen_helper_advsimd_ceq_f16; - break; - case 0x6d: /* FCMLE (zero) */ - swap = true; - /* fall through */ - case 0x6c: /* FCMGE (zero) */ - genfn = gen_helper_advsimd_cge_f16; - break; - default: - g_assert_not_reached(); - } - } else { - switch (opcode) { - case 0x2e: /* FCMLT (zero) */ - swap = true; - /* fall through */ - case 0x2c: /* FCMGT (zero) */ - genfn = gen_helper_neon_cgt_f32; - break; - case 0x2d: /* FCMEQ (zero) */ - genfn = gen_helper_neon_ceq_f32; - break; - case 0x6d: /* FCMLE (zero) */ - swap = true; - /* fall through */ - case 0x6c: /* FCMGE (zero) */ - genfn = gen_helper_neon_cge_f32; - break; - default: - g_assert_not_reached(); - } - } - - if (is_scalar) { - maxpasses = 1; - } else { - int vector_size = 8 << is_q; - maxpasses = vector_size >> size; - } - - for (pass = 0; pass < maxpasses; pass++) { - read_vec_element_i32(s, tcg_op, rn, pass, size); - if (swap) { - genfn(tcg_res, tcg_zero, tcg_op, fpst); - } else { - genfn(tcg_res, tcg_op, tcg_zero, fpst); - } - if (is_scalar) { - write_fp_sreg(s, rd, tcg_res); - } else { - write_vec_element_i32(s, tcg_res, rd, pass, size); - } - } - - if (!is_scalar) { - clear_vec_high(s, is_q, rd); - } - } -} +static gen_helper_gvec_2_ptr * const f_fcle0[] = { + gen_helper_gvec_fcle0_h, + gen_helper_gvec_fcle0_s, + gen_helper_gvec_fcle0_d, +}; +TRANS(FCMLE0_v, do_gvec_op2_fpst, a->esz, a->q, a->rd, a->rn, 0, f_fcle0) static void handle_2misc_reciprocal(DisasContext *s, int opcode, bool is_scalar, bool is_u, bool is_q, @@ -9607,13 +9568,6 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) opcode |= (extract32(size, 1, 1) << 5) | (u << 6); size = extract32(size, 0, 1) ? 3 : 2; switch (opcode) { - case 0x2c: /* FCMGT (zero) */ - case 0x2d: /* FCMEQ (zero) */ - case 0x2e: /* FCMLT (zero) */ - case 0x6c: /* FCMGE (zero) */ - case 0x6d: /* FCMLE (zero) */ - handle_2misc_fcmp_zero(s, opcode, true, u, true, size, rn, rd); - return; case 0x3d: /* FRECPE */ case 0x3f: /* FRECPX */ case 0x7d: /* FRSQRTE */ @@ -9635,6 +9589,11 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) case 0x56: /* FCVTXN, FCVTXN2 */ case 0x1d: /* SCVTF */ case 0x5d: /* UCVTF */ + case 0x2c: /* FCMGT (zero) */ + case 0x2d: /* FCMEQ (zero) */ + case 0x2e: /* FCMLT (zero) */ + case 0x6c: /* FCMGE (zero) */ + case 0x6d: /* FCMLE (zero) */ default: unallocated_encoding(s); return; @@ -9729,17 +9688,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) opcode |= (extract32(size, 1, 1) << 5) | (u << 6); size = is_double ? 3 : 2; switch (opcode) { - case 0x2c: /* FCMGT (zero) */ - case 0x2d: /* FCMEQ (zero) */ - case 0x2e: /* FCMLT (zero) */ - case 0x6c: /* FCMGE (zero) */ - case 0x6d: /* FCMLE (zero) */ - if (size == 3 && !is_q) { - unallocated_encoding(s); - return; - } - handle_2misc_fcmp_zero(s, opcode, false, u, is_q, size, rn, rd); - return; case 0x3c: /* URECPE */ if (size == 3) { unallocated_encoding(s); @@ -9799,6 +9747,11 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x7b: /* FCVTZU */ case 0x5c: /* FCVTAU */ case 0x1c: /* FCVTAS */ + case 0x2c: /* FCMGT (zero) */ + case 0x2d: /* FCMEQ (zero) */ + case 0x2e: /* FCMLT (zero) */ + case 0x6c: /* FCMGE (zero) */ + case 0x6d: /* FCMLE (zero) */ unallocated_encoding(s); return; } @@ -9939,13 +9892,6 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) fpop = deposit32(fpop, 6, 1, u); switch (fpop) { - case 0x2c: /* FCMGT (zero) */ - case 0x2d: /* FCMEQ (zero) */ - case 0x2e: /* FCMLT (zero) */ - case 0x6c: /* FCMGE (zero) */ - case 0x6d: /* FCMLE (zero) */ - handle_2misc_fcmp_zero(s, fpop, is_scalar, 0, is_q, MO_16, rn, rd); - return; case 0x3d: /* FRECPE */ case 0x3f: /* FRECPX */ break; @@ -9974,6 +9920,11 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x5c: /* FCVTAU */ case 0x7a: /* FCVTPU */ case 0x7b: /* FCVTZU */ + case 0x2c: /* FCMGT (zero) */ + case 0x2d: /* FCMEQ (zero) */ + case 0x2e: /* FCMLT (zero) */ + case 0x6c: /* FCMGE (zero) */ + case 0x6d: /* FCMLE (zero) */ unallocated_encoding(s); return; } diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index 0aee38a3bc..0f4b5670f3 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -1253,8 +1253,10 @@ DO_2OP(gvec_touszh, vfp_touszh, float16) #define DO_2OP_CMP0(FN, CMPOP, DIRN) \ WRAP_CMP0_##DIRN(FN, CMPOP, float16) \ WRAP_CMP0_##DIRN(FN, CMPOP, float32) \ + WRAP_CMP0_##DIRN(FN, CMPOP, float64) \ DO_2OP(gvec_f##FN##0_h, float16_##FN##0, float16) \ - DO_2OP(gvec_f##FN##0_s, float32_##FN##0, float32) + DO_2OP(gvec_f##FN##0_s, float32_##FN##0, float32) \ + DO_2OP(gvec_f##FN##0_d, float64_##FN##0, float64) DO_2OP_CMP0(cgt, cgt, FWD) DO_2OP_CMP0(cge, cge, FWD) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 05a0b84416..d1c4a330f2 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1652,6 +1652,21 @@ UQXTN_s 0111 1110 ..1 00001 01001 0 ..... ..... @rr_e FCVTXN_s 0111 1110 011 00001 01101 0 ..... ..... @rr_s +FCMGT0_s 0101 1110 111 11000 11001 0 ..... ..... @rr_h +FCMGT0_s 0101 1110 1.1 00000 11001 0 ..... ..... @rr_sd + +FCMGE0_s 0111 1110 111 11000 11001 0 ..... ..... @rr_h +FCMGE0_s 0111 1110 1.1 00000 11001 0 ..... ..... @rr_sd + +FCMEQ0_s 0101 1110 111 11000 11011 0 ..... ..... @rr_h +FCMEQ0_s 0101 1110 1.1 00000 11011 0 ..... ..... @rr_sd + +FCMLE0_s 0111 1110 111 11000 11011 0 ..... ..... @rr_h +FCMLE0_s 0111 1110 1.1 00000 11011 0 ..... ..... @rr_sd + +FCMLT0_s 0101 1110 111 11000 11101 0 ..... ..... @rr_h +FCMLT0_s 0101 1110 1.1 00000 11101 0 ..... ..... @rr_sd + @icvt_h . ....... .. ...... ...... rn:5 rd:5 \ &fcvt sf=0 esz=1 shift=0 @icvt_sd . ....... .. ...... ...... rn:5 rd:5 \ @@ -1818,6 +1833,21 @@ FCVTAS_vi 0.00 1110 0.1 00001 11001 0 ..... ..... @qrr_sd FCVTAU_vi 0.10 1110 011 11001 11001 0 ..... ..... @qrr_h FCVTAU_vi 0.10 1110 0.1 00001 11001 0 ..... ..... @qrr_sd +FCMGT0_v 0.00 1110 111 11000 11001 0 ..... ..... @qrr_h +FCMGT0_v 0.00 1110 1.1 00000 11001 0 ..... ..... @qrr_sd + +FCMGE0_v 0.10 1110 111 11000 11001 0 ..... ..... @qrr_h +FCMGE0_v 0.10 1110 1.1 00000 11001 0 ..... ..... @qrr_sd + +FCMEQ0_v 0.00 1110 111 11000 11011 0 ..... ..... @qrr_h +FCMEQ0_v 0.00 1110 1.1 00000 11011 0 ..... ..... @qrr_sd + +FCMLE0_v 0.10 1110 111 11000 11011 0 ..... ..... @qrr_h +FCMLE0_v 0.10 1110 1.1 00000 11011 0 ..... ..... @qrr_sd + +FCMLT0_v 0.00 1110 111 11000 11101 0 ..... ..... @qrr_h +FCMLT0_v 0.00 1110 1.1 00000 11101 0 ..... ..... @qrr_sd + &fcvt_q rd rn esz q shift @fcvtq_h . q:1 . ...... 001 .... ...... rn:5 rd:5 \ &fcvt_q esz=1 shift=%fcvt_f_sh_h From patchwork Tue Dec 10 16:17:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848865 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp421414wrn; Tue, 10 Dec 2024 08:29:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUu7sSrsZRlQq+FmaF6Wu1utELDTWDHsRotfykU4vn34rwZzrsUYgx431Tau6tk23djlRxu0A==@linaro.org X-Google-Smtp-Source: AGHT+IHZEpl7XFVEgtvumWJ6FTX0MTA1fyfwVkBi2kPr8HW2AuyvzaMhGsjJT0mvFNdHyA+yaoWX X-Received: by 2002:a05:620a:2728:b0:7b1:527f:cf4f with SMTP id af79cd13be357-7b6dce86c9cmr884535085a.42.1733848165928; Tue, 10 Dec 2024 08:29:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848165; cv=none; d=google.com; s=arc-20240605; b=K32X3UjcVVO3gKwmspf2uQJ+tz7XoIaGQPj5Ylr1Foo+3ZVFeedpj+3cjo5Pn0l5w3 UihjKwcEw0P0NuT9VyjPLSstseI+SdguAvD5/DMgXxm62cHsvDPpfMdFQdxk5YFTWZMo XJrEa9ExAtDTiqgxfzg0ZGfo23nnFTFuUlkNLsygCJuIpLaBUgiUE5N5o7tQP2jEcFGy /5hcmOeVsjM4eZpCSiWxXjuQqNnvxoIax48vBreIa8tUq4XZRxQF4EqnMoAVxpuC6K7J YsVlRAtPZc2Vsui/0hV2lf696EYMUVOaJE0NYfwA+UiuGqLwZnYAtD4AlnMExXYx2tcS MPOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=RQ5vVXYptQzG1sUMwxsVVVONjUivNJ0StC+U2jug2Ok=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=Y3AYdtBFw+agxfmPXAFZbCxFoHvQqKB13kqntBiotpvZsIHUqiqD+nHcazU4MMCJzz f4lQkx/cZKLolN68V1nM+MbHVWLXp25y07qdXekPYfLJj9L20LreniprE5Ot8LBsk3oE 9WO5c+U/V07z9pnx0W87P6/Oyofn/EHvOxumJRv8ve7rOuMd2rlZuUV4mnJTIPeFA2Oq TsPrg/im6jqBhF5awrpLedMEAeEkc0vtO0RdyYZWb9ndDsf13EicXX1o4vauFXAMvopH JRmdmqOySrA7HXDgZfeiFmmJ8v6kxx0sVshnInZyAWwgx1rfvJzeRMPdouOuY6F6t4+q Evig==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p+WdN6Ky; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6e9530e0esi67978785a.650.2024.12.10.08.29.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:29: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=p+WdN6Ky; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL33a-0004rU-HR; Tue, 10 Dec 2024 11:25:55 -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 1tL32r-00015o-SL for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:25:11 -0500 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32o-0007ft-S3 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:25:09 -0500 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-5401d3ea5a1so2528499e87.3 for ; Tue, 10 Dec 2024 08:25:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847905; x=1734452705; 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=RQ5vVXYptQzG1sUMwxsVVVONjUivNJ0StC+U2jug2Ok=; b=p+WdN6KyJaiFleJvkACLnOtKBwaxGpq0XqVywj6c2ceLU27z0HPNKGLF629YxK5b0E m26lIwH4kP/dnVoWTCXBbCR8BHnwnNBobl7qgR+1ftMFMxjtxw81W8DThaT0O6r0hcR5 1jkN0SKbWPhvTNjYzS72Sqrxal/e2rdUo3fz+n1G2+l3jFHddGgF+xyZ3MLExAuSwkHs LN19oD+dye/Sm6FTnMc7EaJSHl38l6+KEggfG1dOByCyQXWGABoalr/sAanf8PC1vfj2 0j9u24U+KBF7E7FhgASkSFXWmtaxFawnchJ2cPQYpv7SeLu0IBf4ZxzyjYBF2M9LS1oy 7BJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847905; x=1734452705; 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=RQ5vVXYptQzG1sUMwxsVVVONjUivNJ0StC+U2jug2Ok=; b=MKZl2BmpL5a5TjvggLajWfJksIMDQuprjgnsSkFfo2O7XWK82Dfgt2h6VegfeeNlTY 8HmqS1JPsIHxnfDNmj2wO8UXddWTN5ByY01Nr6rj4cTep1MwW/bHg2IfkrA2RRMLgkB/ bFOZWSzwOhuv1vjlaqqgqWY3DabS+JdoHU4TQsk1pT9HEAXbX0eZNLVBsK6aZnkW1ggt v/glL3i1jRFjm0PNxUk47FzkMrkj5FlrWokwpp7L4cbbeG6jGkkJDBtwXaz3ph9an+mL TEAlffUTrgLsCAdirnHoeUcAgpccJMRYvM3Fl0qCkiyp6PhZb8K0icDMlGiqM1wByTUs bkBw== X-Gm-Message-State: AOJu0YztCU3MUl/p+CITgDl7srafNvF7Q8j0+d7nn9cWu4WumZM6LYyK 5dzcJyfpiPR4JxmkBJk5YwMK80VfGHGp2va6zmR1XZxueKAJc+LtR2X1FDMOBgyADzA1OZiFVr6 eaYQCJ0eW X-Gm-Gg: ASbGncsrCLf0FGs1cry5cdLVbVjyCjE2s9awAMpHq3oYeDYNyRx7NYZNqBR//Clyal4 bfY5cSoeObb8Q4dwOIXBcRgRqJrnDe+8cA0E5rtd4UzVS9HL36IdkpOlEMtf39qjehdkmtKzNTz qIxODfc0SZOEr2amleNEkgrBcA9pEwHXSLSPDxfiXVfJC58dUphP9ZJiLmquxAeYp8KsiYlgcmF KsVchtkVPXi6r/laSXN8CfjLNYsKqZDQEjYeSkp1ZyKJndh017roOBTB6A= X-Received: by 2002:a05:6512:308d:b0:53e:37a5:4caa with SMTP id 2adb3069b0e04-540240ae679mr1830032e87.5.1733847904669; Tue, 10 Dec 2024 08:25:04 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.25.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:25:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 66/69] target/arm: Convert FRECPE, FRECPX, FRSQRTE to decodetree Date: Tue, 10 Dec 2024 10:17:30 -0600 Message-ID: <20241210161733.1830573-67-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x134.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 Remove disas_simd_scalar_two_reg_misc and disas_simd_two_reg_misc_fp16 as these were the last insns decoded by those functions. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 329 ++++----------------------------- target/arm/tcg/a64.decode | 15 ++ 2 files changed, 53 insertions(+), 291 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 1776862161..63cf25251b 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8501,6 +8501,27 @@ TRANS_FEAT(FRINT64Z_s, aa64_frint, do_fp1_scalar, a, &f_scalar_frint64, FPROUNDING_ZERO) TRANS_FEAT(FRINT64X_s, aa64_frint, do_fp1_scalar, a, &f_scalar_frint64, -1) +static const FPScalar1 f_scalar_frecpe = { + gen_helper_recpe_f16, + gen_helper_recpe_f32, + gen_helper_recpe_f64, +}; +TRANS(FRECPE_s, do_fp1_scalar, a, &f_scalar_frecpe, -1) + +static const FPScalar1 f_scalar_frecpx = { + gen_helper_frecpx_f16, + gen_helper_frecpx_f32, + gen_helper_frecpx_f64, +}; +TRANS(FRECPX_s, do_fp1_scalar, a, &f_scalar_frecpx, -1) + +static const FPScalar1 f_scalar_frsqrte = { + gen_helper_rsqrte_f16, + gen_helper_rsqrte_f32, + gen_helper_rsqrte_f64, +}; +TRANS(FRSQRTE_s, do_fp1_scalar, a, &f_scalar_frsqrte, -1) + static bool trans_FCVT_s_ds(DisasContext *s, arg_rr *a) { if (fp_access_check(s)) { @@ -9471,36 +9492,28 @@ static gen_helper_gvec_2_ptr * const f_fcle0[] = { }; TRANS(FCMLE0_v, do_gvec_op2_fpst, a->esz, a->q, a->rd, a->rn, 0, f_fcle0) +static gen_helper_gvec_2_ptr * const f_frecpe[] = { + gen_helper_gvec_frecpe_h, + gen_helper_gvec_frecpe_s, + gen_helper_gvec_frecpe_d, +}; +TRANS(FRECPE_v, do_gvec_op2_fpst, a->esz, a->q, a->rd, a->rn, 0, f_frecpe) + +static gen_helper_gvec_2_ptr * const f_frsqrte[] = { + gen_helper_gvec_frsqrte_h, + gen_helper_gvec_frsqrte_s, + gen_helper_gvec_frsqrte_d, +}; +TRANS(FRSQRTE_v, do_gvec_op2_fpst, a->esz, a->q, a->rd, a->rn, 0, f_frsqrte) + static void handle_2misc_reciprocal(DisasContext *s, int opcode, bool is_scalar, bool is_u, bool is_q, int size, int rn, int rd) { bool is_double = (size == 3); - TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); if (is_double) { - TCGv_i64 tcg_op = tcg_temp_new_i64(); - TCGv_i64 tcg_res = tcg_temp_new_i64(); - int pass; - - for (pass = 0; pass < (is_scalar ? 1 : 2); pass++) { - read_vec_element(s, tcg_op, rn, pass, MO_64); - switch (opcode) { - case 0x3d: /* FRECPE */ - gen_helper_recpe_f64(tcg_res, tcg_op, fpst); - break; - case 0x3f: /* FRECPX */ - gen_helper_frecpx_f64(tcg_res, tcg_op, fpst); - break; - case 0x7d: /* FRSQRTE */ - gen_helper_rsqrte_f64(tcg_res, tcg_op, fpst); - break; - default: - g_assert_not_reached(); - } - write_vec_element(s, tcg_res, rd, pass, MO_64); - } - clear_vec_high(s, !is_scalar, rd); + g_assert_not_reached(); } else { TCGv_i32 tcg_op = tcg_temp_new_i32(); TCGv_i32 tcg_res = tcg_temp_new_i32(); @@ -9520,14 +9533,8 @@ static void handle_2misc_reciprocal(DisasContext *s, int opcode, gen_helper_recpe_u32(tcg_res, tcg_op); break; case 0x3d: /* FRECPE */ - gen_helper_recpe_f32(tcg_res, tcg_op, fpst); - break; case 0x3f: /* FRECPX */ - gen_helper_frecpx_f32(tcg_res, tcg_op, fpst); - break; case 0x7d: /* FRSQRTE */ - gen_helper_rsqrte_f32(tcg_res, tcg_op, fpst); - break; default: g_assert_not_reached(); } @@ -9544,76 +9551,6 @@ static void handle_2misc_reciprocal(DisasContext *s, int opcode, } } -/* AdvSIMD scalar two reg misc - * 31 30 29 28 24 23 22 21 17 16 12 11 10 9 5 4 0 - * +-----+---+-----------+------+-----------+--------+-----+------+------+ - * | 0 1 | U | 1 1 1 1 0 | size | 1 0 0 0 0 | opcode | 1 0 | Rn | Rd | - * +-----+---+-----------+------+-----------+--------+-----+------+------+ - */ -static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) -{ - int rd = extract32(insn, 0, 5); - int rn = extract32(insn, 5, 5); - int opcode = extract32(insn, 12, 5); - int size = extract32(insn, 22, 2); - bool u = extract32(insn, 29, 1); - - switch (opcode) { - case 0xc ... 0xf: - case 0x16 ... 0x1d: - case 0x1f: - /* Floating point: U, size[1] and opcode indicate operation; - * size[0] indicates single or double precision. - */ - opcode |= (extract32(size, 1, 1) << 5) | (u << 6); - size = extract32(size, 0, 1) ? 3 : 2; - switch (opcode) { - case 0x3d: /* FRECPE */ - case 0x3f: /* FRECPX */ - case 0x7d: /* FRSQRTE */ - if (!fp_access_check(s)) { - return; - } - handle_2misc_reciprocal(s, opcode, true, u, true, size, rn, rd); - return; - case 0x1a: /* FCVTNS */ - case 0x1b: /* FCVTMS */ - case 0x3a: /* FCVTPS */ - case 0x3b: /* FCVTZS */ - case 0x5a: /* FCVTNU */ - case 0x5b: /* FCVTMU */ - case 0x7a: /* FCVTPU */ - case 0x7b: /* FCVTZU */ - case 0x1c: /* FCVTAS */ - case 0x5c: /* FCVTAU */ - case 0x56: /* FCVTXN, FCVTXN2 */ - case 0x1d: /* SCVTF */ - case 0x5d: /* UCVTF */ - case 0x2c: /* FCMGT (zero) */ - case 0x2d: /* FCMEQ (zero) */ - case 0x2e: /* FCMLT (zero) */ - case 0x6c: /* FCMGE (zero) */ - case 0x6d: /* FCMLE (zero) */ - default: - unallocated_encoding(s); - return; - } - break; - default: - case 0x3: /* USQADD / SUQADD */ - case 0x7: /* SQABS / SQNEG */ - case 0x8: /* CMGT, CMGE */ - case 0x9: /* CMEQ, CMLE */ - case 0xa: /* CMLT */ - case 0xb: /* ABS, NEG */ - case 0x12: /* SQXTUN */ - case 0x14: /* SQXTN, UQXTN */ - unallocated_encoding(s); - return; - } - g_assert_not_reached(); -} - static void handle_2misc_widening(DisasContext *s, int opcode, bool is_q, int size, int rn, int rd) { @@ -9693,13 +9630,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) unallocated_encoding(s); return; } - /* fall through */ - case 0x3d: /* FRECPE */ - case 0x7d: /* FRSQRTE */ - if (size == 3 && !is_q) { - unallocated_encoding(s); - return; - } if (!fp_access_check(s)) { return; } @@ -9752,6 +9682,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x2e: /* FCMLT (zero) */ case 0x6c: /* FCMGE (zero) */ case 0x6d: /* FCMLE (zero) */ + case 0x3d: /* FRECPE */ + case 0x7d: /* FRSQRTE */ unallocated_encoding(s); return; } @@ -9847,189 +9779,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } } -/* AdvSIMD [scalar] two register miscellaneous (FP16) - * - * 31 30 29 28 27 24 23 22 21 17 16 12 11 10 9 5 4 0 - * +---+---+---+---+---------+---+-------------+--------+-----+------+------+ - * | 0 | Q | U | S | 1 1 1 0 | a | 1 1 1 1 0 0 | opcode | 1 0 | Rn | Rd | - * +---+---+---+---+---------+---+-------------+--------+-----+------+------+ - * mask: 1000 1111 0111 1110 0000 1100 0000 0000 0x8f7e 0c00 - * val: 0000 1110 0111 1000 0000 1000 0000 0000 0x0e78 0800 - * - * This actually covers two groups where scalar access is governed by - * bit 28. A bunch of the instructions (float to integral) only exist - * in the vector form and are un-allocated for the scalar decode. Also - * in the scalar decode Q is always 1. - */ -static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) -{ - int fpop, opcode, a, u; - int rn, rd; - bool is_q; - bool is_scalar; - - int pass; - TCGv_i32 tcg_rmode = NULL; - TCGv_ptr tcg_fpstatus = NULL; - bool need_fpst = true; - int rmode = -1; - - if (!dc_isar_feature(aa64_fp16, s)) { - unallocated_encoding(s); - return; - } - - rd = extract32(insn, 0, 5); - rn = extract32(insn, 5, 5); - - a = extract32(insn, 23, 1); - u = extract32(insn, 29, 1); - is_scalar = extract32(insn, 28, 1); - is_q = extract32(insn, 30, 1); - - opcode = extract32(insn, 12, 5); - fpop = deposit32(opcode, 5, 1, a); - fpop = deposit32(fpop, 6, 1, u); - - switch (fpop) { - case 0x3d: /* FRECPE */ - case 0x3f: /* FRECPX */ - break; - case 0x7d: /* FRSQRTE */ - break; - default: - case 0x2f: /* FABS */ - case 0x6f: /* FNEG */ - case 0x7f: /* FSQRT (vector) */ - case 0x18: /* FRINTN */ - case 0x19: /* FRINTM */ - case 0x38: /* FRINTP */ - case 0x39: /* FRINTZ */ - case 0x58: /* FRINTA */ - case 0x59: /* FRINTX */ - case 0x79: /* FRINTI */ - case 0x1d: /* SCVTF */ - case 0x5d: /* UCVTF */ - case 0x1a: /* FCVTNS */ - case 0x1b: /* FCVTMS */ - case 0x1c: /* FCVTAS */ - case 0x3a: /* FCVTPS */ - case 0x3b: /* FCVTZS */ - case 0x5a: /* FCVTNU */ - case 0x5b: /* FCVTMU */ - case 0x5c: /* FCVTAU */ - case 0x7a: /* FCVTPU */ - case 0x7b: /* FCVTZU */ - case 0x2c: /* FCMGT (zero) */ - case 0x2d: /* FCMEQ (zero) */ - case 0x2e: /* FCMLT (zero) */ - case 0x6c: /* FCMGE (zero) */ - case 0x6d: /* FCMLE (zero) */ - unallocated_encoding(s); - return; - } - - - /* Check additional constraints for the scalar encoding */ - if (is_scalar) { - if (!is_q) { - unallocated_encoding(s); - return; - } - } - - if (!fp_access_check(s)) { - return; - } - - if (rmode >= 0 || need_fpst) { - tcg_fpstatus = fpstatus_ptr(FPST_FPCR_F16); - } - - if (rmode >= 0) { - tcg_rmode = gen_set_rmode(rmode, tcg_fpstatus); - } - - if (is_scalar) { - TCGv_i32 tcg_op = read_fp_hreg(s, rn); - TCGv_i32 tcg_res = tcg_temp_new_i32(); - - switch (fpop) { - case 0x3d: /* FRECPE */ - gen_helper_recpe_f16(tcg_res, tcg_op, tcg_fpstatus); - break; - case 0x3f: /* FRECPX */ - gen_helper_frecpx_f16(tcg_res, tcg_op, tcg_fpstatus); - break; - case 0x7d: /* FRSQRTE */ - gen_helper_rsqrte_f16(tcg_res, tcg_op, tcg_fpstatus); - break; - default: - case 0x1a: /* FCVTNS */ - case 0x1b: /* FCVTMS */ - case 0x1c: /* FCVTAS */ - case 0x3a: /* FCVTPS */ - case 0x3b: /* FCVTZS */ - case 0x5a: /* FCVTNU */ - case 0x5b: /* FCVTMU */ - case 0x5c: /* FCVTAU */ - case 0x7a: /* FCVTPU */ - case 0x7b: /* FCVTZU */ - g_assert_not_reached(); - } - - /* limit any sign extension going on */ - tcg_gen_andi_i32(tcg_res, tcg_res, 0xffff); - write_fp_sreg(s, rd, tcg_res); - } else { - for (pass = 0; pass < (is_q ? 8 : 4); pass++) { - TCGv_i32 tcg_op = tcg_temp_new_i32(); - TCGv_i32 tcg_res = tcg_temp_new_i32(); - - read_vec_element_i32(s, tcg_op, rn, pass, MO_16); - - switch (fpop) { - case 0x3d: /* FRECPE */ - gen_helper_recpe_f16(tcg_res, tcg_op, tcg_fpstatus); - break; - case 0x7d: /* FRSQRTE */ - gen_helper_rsqrte_f16(tcg_res, tcg_op, tcg_fpstatus); - break; - default: - case 0x2f: /* FABS */ - case 0x6f: /* FNEG */ - case 0x7f: /* FSQRT */ - case 0x18: /* FRINTN */ - case 0x19: /* FRINTM */ - case 0x38: /* FRINTP */ - case 0x39: /* FRINTZ */ - case 0x58: /* FRINTA */ - case 0x79: /* FRINTI */ - case 0x59: /* FRINTX */ - case 0x1a: /* FCVTNS */ - case 0x1b: /* FCVTMS */ - case 0x1c: /* FCVTAS */ - case 0x3a: /* FCVTPS */ - case 0x3b: /* FCVTZS */ - case 0x5a: /* FCVTNU */ - case 0x5b: /* FCVTMU */ - case 0x5c: /* FCVTAU */ - case 0x7a: /* FCVTPU */ - case 0x7b: /* FCVTZU */ - g_assert_not_reached(); - } - - write_vec_element_i32(s, tcg_res, rd, pass, MO_16); - } - - clear_vec_high(s, is_q, rd); - } - - if (tcg_rmode) { - gen_restore_rmode(tcg_rmode, tcg_fpstatus); - } -} - /* C3.6 Data processing - SIMD, inc Crypto * * As the decode gets a little complex we are using a table based @@ -10038,8 +9787,6 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) static const AArch64DecodeTable data_proc_simd[] = { /* pattern , mask , fn */ { 0x0e200800, 0x9f3e0c00, disas_simd_two_reg_misc }, - { 0x5e200800, 0xdf3e0c00, disas_simd_scalar_two_reg_misc }, - { 0x0e780800, 0x8f7e0c00, disas_simd_two_reg_misc_fp16 }, { 0x00000000, 0x00000000, NULL } }; diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index d1c4a330f2..9b3b09c3bb 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1667,6 +1667,15 @@ FCMLE0_s 0111 1110 1.1 00000 11011 0 ..... ..... @rr_sd FCMLT0_s 0101 1110 111 11000 11101 0 ..... ..... @rr_h FCMLT0_s 0101 1110 1.1 00000 11101 0 ..... ..... @rr_sd +FRECPE_s 0101 1110 111 11001 11011 0 ..... ..... @rr_h +FRECPE_s 0101 1110 1.1 00001 11011 0 ..... ..... @rr_sd + +FRECPX_s 0101 1110 111 11001 11111 0 ..... ..... @rr_h +FRECPX_s 0101 1110 1.1 00001 11111 0 ..... ..... @rr_sd + +FRSQRTE_s 0111 1110 111 11001 11011 0 ..... ..... @rr_h +FRSQRTE_s 0111 1110 1.1 00001 11011 0 ..... ..... @rr_sd + @icvt_h . ....... .. ...... ...... rn:5 rd:5 \ &fcvt sf=0 esz=1 shift=0 @icvt_sd . ....... .. ...... ...... rn:5 rd:5 \ @@ -1848,6 +1857,12 @@ FCMLE0_v 0.10 1110 1.1 00000 11011 0 ..... ..... @qrr_sd FCMLT0_v 0.00 1110 111 11000 11101 0 ..... ..... @qrr_h FCMLT0_v 0.00 1110 1.1 00000 11101 0 ..... ..... @qrr_sd +FRECPE_v 0.00 1110 111 11001 11011 0 ..... ..... @qrr_h +FRECPE_v 0.00 1110 1.1 00001 11011 0 ..... ..... @qrr_sd + +FRSQRTE_v 0.10 1110 111 11001 11011 0 ..... ..... @qrr_h +FRSQRTE_v 0.10 1110 1.1 00001 11011 0 ..... ..... @qrr_sd + &fcvt_q rd rn esz q shift @fcvtq_h . q:1 . ...... 001 .... ...... rn:5 rd:5 \ &fcvt_q esz=1 shift=%fcvt_f_sh_h From patchwork Tue Dec 10 16:17:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848850 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp419769wrn; Tue, 10 Dec 2024 08:26:17 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX8XxWjDLwhUSzhWzIHJ3F7ssfXrSrMhS7Gy82XSsnqPqwxmlcHl/NvmTSMBoPsEWYd+c7eRA==@linaro.org X-Google-Smtp-Source: AGHT+IGcQMO+10zS4ZctvRsq6z6YJUbnthvKiZFhgn07EOSFn5qeoVZOwWuxv5KkWjQhYaQNhKBY X-Received: by 2002:a05:6102:5491:b0:4af:c435:58b5 with SMTP id ada2fe7eead31-4b1161c26f6mr6022366137.22.1733847977048; Tue, 10 Dec 2024 08:26:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847977; cv=none; d=google.com; s=arc-20240605; b=ScJlH+4i9eBZmKeYlU6Ir389BHOcTo7+umwrYoqkQ2RSC0klMtzLCkuxoC+nZBosFC vEwJSB7M+RdqDlvkDU9fmjBayffjEOo+GNIuLoC06eVsDDk0vczWE+YXczzCUOinFmbd eiQDsOr4ZDg9YX1aC3BOMRuTrMMqyvH9kLp/eTHTc1vqC3ifqVC8+OhCKlPnWtcdA1Oq mi8YS0e0rDLGkL1ADy25mjcDMhCp/Kq+nvhNuv1JtiMIlHjR7U8tYH0slASgzCymn2os 7xf7Ey+xf3aFHUbOiCrbgQXzUJmh9kO+7obB6z9vzXXXOkICw1LEHcMuF9y4ULwI2Bck 23Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=tqVb2Q5hg/RzZZ6DxpbE6MUffVDXywo5HLKvgPknPPQ=; fh=9Ev+QBUhk6P6vR3LT1wYeDLexozsz44nqjfoyPajZCc=; b=ajd3pP9zs7BHJsD8HdEFG20uZto7ELXFILB1kVx73IKu2MCMdoOTe5Yz4alBIQRsB6 QAleXDWBPGj6YTdMTWq8QIDWJ23LxzWOdqx61FP+bE9tIDraFroBSZkUxxMvPqctBi3M hz2GaLlS7QqOWb9x37AnpJoFIQiL/qL6sD/nlueD7LV/VD+3pb7VCNdFP/gW0zUVmrkE At2a1TJzqV/uanDL2L5gJjJSxNw3p1ubA34GdmNEotl+ppU5DY8SAZZBdrIQahXPTyJG +MAw9BYU9Ob9sRQ0CbQUZbBZmhafY5buTcsOKNTT3hJxCHzLZvhHoW2sd7ZvXk3Zv7CW hwZw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c2MYG0qm; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4afe9739537si1763871137.430.2024.12.10.08.26.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:26:17 -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=c2MYG0qm; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL33d-00059B-En; Tue, 10 Dec 2024 11:25:57 -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 1tL32u-0001CR-Sb for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:25:14 -0500 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32s-0007gW-KL for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:25:12 -0500 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-53e3a227b82so3266675e87.0 for ; Tue, 10 Dec 2024 08:25:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847908; x=1734452708; 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=tqVb2Q5hg/RzZZ6DxpbE6MUffVDXywo5HLKvgPknPPQ=; b=c2MYG0qmuHIKGoJZCFSch8h/aFZ9LkfI1qC9eNwAnDu2TxXcfN3z2T7acljaTfQqPu t4gbTid3vKFL0Xg5cGTA9YHmyDnz4P8BsNQ76gFryfUCsrBwk95FC+N6Sa2D1e8swQE0 pgtcn9CZTJtz8ZUFIPIccFDux1aXe6/m6Q4irK/dmZm2Snec3XiNAMGY6c/mE8UxsE+S hMoz/XfLuCGvZGUI5Sdv/WqxG0MQ/3ASdeDagzDHFYVkxiaW8NMj2NrMcl1unjgqurFu e+bZumD2GnL3BXW2GJgyNWvSEsQ3XHbmO4R+wZ6LWvOoexUIbY2KVTzG9phF1lEEI36+ InGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847908; x=1734452708; 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=tqVb2Q5hg/RzZZ6DxpbE6MUffVDXywo5HLKvgPknPPQ=; b=M/gviRQJhhCcUNqdILoLXEA8amZPGMER2n5KfICOd0CJQ2EJ2mBAgMWQ1HPfzAbV3g ntsaEzj+NxgOfLHu+bStK8p5IskDQcr65ClaJYHjDXXHLnck3NdU03FHOipI2ALKTIaf fRkuey8r5BcIiVqPAPodzjS+bjiZ/LEg8Fn3vOh2Ta0SpkvGQJ4P7bxBvbNVwGuVwcRk N4vwkVHFebl2ntAhlKk85SuEF5ehljec+1YqDJaVlVTgJzQTBLbZP6amSRKPbVlMJD5K AYy+OATxN+hvmp0PLg8xE8sxMpcY997CS028wfSyGl1mAoRbPHtMvOvnqn5Zhy3xAXvC agww== X-Gm-Message-State: AOJu0Yzc3vKOI1Gx1pIwPRaCjGpfYCsTb6rPOWN6X+4wAmkO4pLZ6Gak bZ/DcRXjJQOwr1tgA9P2NgyEiN8HQ6wrAr12ti5dTu3Yn5wgKSndvuXy6yNy1D7tTEH01kXtg2c CVedxwUGw X-Gm-Gg: ASbGnct80sHg15clGGUYK+ydBy4e/vyANEgYCz8DKjhvAsY6SSp5W/NiqpZMYocBdCN a56nHS9J1eglpUsoTAiNHrJiqTALJ3xajX9TAOb8TF6TCINY1pZNPY+tZwkKOIgvmWEYe9Fumos SAonhwyCxYvAiOhhyByQV5FC9ffqoTjc/6croxWccJLHkqVXNJndDhcKPMzMKvrOEatvWv7RlNY DfnETquBYZN+UiYqOFB3HvbhxPRlK3Zyee7rSK0UsgxCVbwMj8r9jViXqg= X-Received: by 2002:a05:6512:3ba3:b0:53e:3a73:6ddc with SMTP id 2adb3069b0e04-53e3a736e1dmr4858225e87.33.1733847908037; Tue, 10 Dec 2024 08:25:08 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.25.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:25:06 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 67/69] target/arm: Introduce gen_gvec_urecpe, gen_gvec_ursqrte Date: Tue, 10 Dec 2024 10:17:31 -0600 Message-ID: <20241210161733.1830573-68-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12d; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12d.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 Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/helper.h | 3 +++ target/arm/tcg/translate.h | 5 +++++ target/arm/tcg/gengvec.c | 16 ++++++++++++++++ target/arm/tcg/translate-neon.c | 4 ++-- target/arm/tcg/vec_helper.c | 22 ++++++++++++++++++++++ 5 files changed, 48 insertions(+), 2 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 1132a5cab6..9919b1367b 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -1121,6 +1121,9 @@ DEF_HELPER_FLAGS_4(gvec_uminp_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_uminp_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_uminp_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_urecpe_s, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_ursqrte_s, TCG_CALL_NO_RWG, void, ptr, ptr, i32) + #ifdef TARGET_AARCH64 #include "tcg/helper-a64.h" #include "tcg/helper-sve.h" diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index b996de2c15..9b9abf1992 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -608,6 +608,11 @@ void gen_gvec_fabs(unsigned vece, uint32_t dofs, uint32_t aofs, void gen_gvec_fneg(unsigned vece, uint32_t dofs, uint32_t aofs, uint32_t oprsz, uint32_t maxsz); +void gen_gvec_urecpe(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_ursqrte(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz); + /* * Forward to the isar_feature_* tests given a DisasContext pointer. */ diff --git a/target/arm/tcg/gengvec.c b/target/arm/tcg/gengvec.c index 01c9d5436d..01867f8ace 100644 --- a/target/arm/tcg/gengvec.c +++ b/target/arm/tcg/gengvec.c @@ -2711,3 +2711,19 @@ void gen_gvec_fneg(unsigned vece, uint32_t dofs, uint32_t aofs, uint64_t s_bit = 1ull << ((8 << vece) - 1); tcg_gen_gvec_xori(vece, dofs, aofs, s_bit, oprsz, maxsz); } + +void gen_gvec_urecpe(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz) +{ + assert(vece == MO_32); + tcg_gen_gvec_2_ool(rd_ofs, rn_ofs, opr_sz, max_sz, 0, + gen_helper_gvec_urecpe_s); +} + +void gen_gvec_ursqrte(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t opr_sz, uint32_t max_sz) +{ + assert(vece == MO_32); + tcg_gen_gvec_2_ool(rd_ofs, rn_ofs, opr_sz, max_sz, 0, + gen_helper_gvec_ursqrte_s); +} diff --git a/target/arm/tcg/translate-neon.c b/target/arm/tcg/translate-neon.c index f9ca889bec..c4fecb8fd6 100644 --- a/target/arm/tcg/translate-neon.c +++ b/target/arm/tcg/translate-neon.c @@ -3070,7 +3070,7 @@ static bool trans_VRECPE(DisasContext *s, arg_2misc *a) if (a->size != 2) { return false; } - return do_2misc(s, a, gen_helper_recpe_u32); + return do_2misc_vec(s, a, gen_gvec_urecpe); } static bool trans_VRSQRTE(DisasContext *s, arg_2misc *a) @@ -3078,7 +3078,7 @@ static bool trans_VRSQRTE(DisasContext *s, arg_2misc *a) if (a->size != 2) { return false; } - return do_2misc(s, a, gen_helper_rsqrte_u32); + return do_2misc_vec(s, a, gen_gvec_ursqrte); } #define WRAP_1OP_ENV_FN(WRAPNAME, FUNC) \ diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index 0f4b5670f3..c824e8307b 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -3105,3 +3105,25 @@ void HELPER(gvec_rbit_b)(void *vd, void *vn, uint32_t desc) } clear_tail(d, opr_sz, simd_maxsz(desc)); } + +void HELPER(gvec_urecpe_s)(void *vd, void *vn, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc); + uint32_t *d = vd, *n = vn; + + for (i = 0; i < opr_sz / 4; ++i) { + d[i] = helper_recpe_u32(n[i]); + } + clear_tail(d, opr_sz, simd_maxsz(desc)); +} + +void HELPER(gvec_ursqrte_s)(void *vd, void *vn, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc); + uint32_t *d = vd, *n = vn; + + for (i = 0; i < opr_sz / 4; ++i) { + d[i] = helper_rsqrte_u32(n[i]); + } + clear_tail(d, opr_sz, simd_maxsz(desc)); +} From patchwork Tue Dec 10 16:17:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848847 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp419492wrn; Tue, 10 Dec 2024 08:25:47 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVHSSVsjzpG0FPR2t9k5nLW5Hujkuj2gfvemeLSQMrIjAnia1x7cHDEyfUYY/a6yZvlWpKtvw==@linaro.org X-Google-Smtp-Source: AGHT+IEfzDYsjOwoHso59Q9KRRTtdCwaTXGIlR3Q2ITdQhMF4BkcSm2ozgAlmFI51wDxJLpZesjK X-Received: by 2002:a05:620a:6017:b0:7b1:4a2a:9ae0 with SMTP id af79cd13be357-7b6de6e7ee9mr618437685a.9.1733847946975; Tue, 10 Dec 2024 08:25:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733847946; cv=none; d=google.com; s=arc-20240605; b=E5XUT0Fj522U0uKbJDgusGGfqSNPIsntXtl3dk4ozp4DMLYImqrFfHAYYQ8DuQ0cgT mfXs/LmCws0jgYl4d1vv82vmBLvI+BhwkL2HgFn7MtrrR0Fom5JlKtZAE0wOX0HhtmwM rAQO0F8HKNiQjGPrmjyPDh505zuOxnkSnJ7d0UCdMnTJ0qNIliYtoj7VuZu8nYEkzeYL hC2QxXj9ncWtxdUzhvaclT1JmMNUaAQqwRcjGzRSudSwcWpqJogviFjMnoVIsyjidgmC 9Xpbu3PjtTQIwSwfyuxBA/6TJptJfrci7ilhx3/9ELmk+KMtR0XvLce+6HGoIhqjhtRD ALpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=X7TOpv3kgexSJr/pjNNgY/t3k2kRwvkkQ7tr2vV9UmI=; fh=9Ev+QBUhk6P6vR3LT1wYeDLexozsz44nqjfoyPajZCc=; b=B7XF/V9LJvasc7xV8FyqPfyRHjD9e+28dFGve1WGEbkyB9C+czeGionW/IOMcgQA5R p4It0HkpxORdB+nyibXt1n8fY0kcwvEpcPYGdo+aPQisUQc6Z2tBqOMnWOcRWDmhbFF6 lt+wyioj6Fxlr+T4stu2g4kdBRSCOzhXCmU46cIUcWCNlB2ozWUf13RYv1/rz27ka8kJ kQIO18AIt9XQDpQeeca9cWBTE2RDvOtoydf+4Yedwpn3aRySPY4JDuUalzEAin3T8+6p c9UxtG/KMswwM7gpeUS91Xc+IoHgvLOzk+abqdCBfttf1T/JBQEALVa4KFrM1JtWPVfI gS1A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SBLKYUsr; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4affb74b28bsi1316900137.215.2024.12.10.08.25.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:25: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=SBLKYUsr; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL33M-00033Q-Fi; Tue, 10 Dec 2024 11:25:41 -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 1tL32w-0001EY-G4 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:25:16 -0500 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32u-0007h2-9o for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:25:14 -0500 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-5401d3ea5a1so2528570e87.3 for ; Tue, 10 Dec 2024 08:25:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847910; x=1734452710; 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=X7TOpv3kgexSJr/pjNNgY/t3k2kRwvkkQ7tr2vV9UmI=; b=SBLKYUsrBdmyUermWfX2W+8YGUUZpfOh6j59ppQ9rpkWGGfrnHZJp6WtopYLagjVG8 jwb+Ct4zUxdJKrAVYmh4HSo3NkY+YQKDswegkz1uk+PdnEKi733KzK8DM4GxTNfGWSDx nM5cAH5wnairydcDjV6LxaeHgY1yxSZsdtbKfRgzbztyNETYItTZHN/toPXLHV1ZT14i UVIPimxrQyZw0B/y47l20FYJ03juKBzr3kY8w77K04E7gcCLbnD1Pc+9ixCRiY+jkCq8 PS5hYs+w69gl47jaQFs4UPMCbvUz/IhXEWKdGRQEHnvMYmiz31LU6qqZZt/x61eCzhFV YNGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847910; x=1734452710; 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=X7TOpv3kgexSJr/pjNNgY/t3k2kRwvkkQ7tr2vV9UmI=; b=O6fkR9jZ4bYoJ2+X1VarEtNOdyE/CrpHEfw6D4eEqdRr7MAx1xekgpfkcZuoPj43RY rU6yvFJhc30ktcIlO04YAuKKb59wrPFYp5UX2ZoYQ6gzQuFuMpEUX/haSB09SmIj5PFX IEk8F3/nHXsJFEBvL8TTiTiQkjrKBuaSbAVBbTDE5LpJmxK4uqeIyjwl3AWRQ8c/3iey Gg+J1bPUb15aJ8Ws0BOJtrETXHdvxKUoC1Fn8K0Aa9d4lZM5T03E7kgWVXGMW7tSLgKj bdOU1a/oUKMCnjxTrfPeffweLTnePUKPk2VpxiN9EP1DJe7cKHofrAn1COk7E4516mNd EtJQ== X-Gm-Message-State: AOJu0YyNUovsM/U3oPG4SowZg4kZX5zKHDXw3IKToZof07dRpZRGgr2G uv659o4mzdqkqGW+Iq+dBV8Y41OmWhnhACYZ0sBko3sShW44q6nf0JfAKIpTsewH5r42qb1Bv4x bIdKwVf4J X-Gm-Gg: ASbGnctP0Z5m5Fg31+6RfwFRtvPpFsJWNnAyPFeDdMQY2jUwDqp/66M/1BbNosZUobc QIBNmMDI0DGfAAs324BoyOyI5zTDMuImqyw1eVQE+a30uWauI6nCukAKhZrv3PkJ2R3h7N56oT9 aVTcTqooHJdXLqWFcsdz7F2SjXFQPyBEZQNCAAPs1E5ne605aI0PcruFpGxeheHsfSW2N2W6Zq0 pejdtKO/+GrsXotyhGGioaqvTil//wZ5P0ErVRJEM5+/REI1DTb1R0oMMM= X-Received: by 2002:a05:6512:1381:b0:540:216e:b279 with SMTP id 2adb3069b0e04-540240d306amr1902783e87.31.1733847910510; Tue, 10 Dec 2024 08:25:10 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.25.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:25:10 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 68/69] target/arm: Convert URECPE and URSQRTE to decodetree Date: Tue, 10 Dec 2024 10:17:32 -0600 Message-ID: <20241210161733.1830573-69-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x135.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 Remove handle_2misc_reciprocal as these were the last insns decoded by that function. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 139 ++------------------------------- target/arm/tcg/a64.decode | 3 + 2 files changed, 8 insertions(+), 134 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 63cf25251b..fa3170da86 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9163,6 +9163,8 @@ TRANS(CMLE0_v, do_gvec_fn2, a, gen_gvec_cle0) TRANS(CMEQ0_v, do_gvec_fn2, a, gen_gvec_ceq0) TRANS(REV16_v, do_gvec_fn2, a, gen_gvec_rev16) TRANS(REV32_v, do_gvec_fn2, a, gen_gvec_rev32) +TRANS(URECPE_v, do_gvec_fn2, a, gen_gvec_urecpe) +TRANS(URSQRTE_v, do_gvec_fn2, a, gen_gvec_ursqrte) static bool do_gvec_fn2_bhs(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) { @@ -9506,51 +9508,6 @@ static gen_helper_gvec_2_ptr * const f_frsqrte[] = { }; TRANS(FRSQRTE_v, do_gvec_op2_fpst, a->esz, a->q, a->rd, a->rn, 0, f_frsqrte) -static void handle_2misc_reciprocal(DisasContext *s, int opcode, - bool is_scalar, bool is_u, bool is_q, - int size, int rn, int rd) -{ - bool is_double = (size == 3); - - if (is_double) { - g_assert_not_reached(); - } else { - TCGv_i32 tcg_op = tcg_temp_new_i32(); - TCGv_i32 tcg_res = tcg_temp_new_i32(); - int pass, maxpasses; - - if (is_scalar) { - maxpasses = 1; - } else { - maxpasses = is_q ? 4 : 2; - } - - for (pass = 0; pass < maxpasses; pass++) { - read_vec_element_i32(s, tcg_op, rn, pass, MO_32); - - switch (opcode) { - case 0x3c: /* URECPE */ - gen_helper_recpe_u32(tcg_res, tcg_op); - break; - case 0x3d: /* FRECPE */ - case 0x3f: /* FRECPX */ - case 0x7d: /* FRSQRTE */ - default: - g_assert_not_reached(); - } - - if (is_scalar) { - write_fp_sreg(s, rd, tcg_res); - } else { - write_vec_element_i32(s, tcg_res, rd, pass, MO_32); - } - } - if (!is_scalar) { - clear_vec_high(s, is_q, rd); - } - } -} - static void handle_2misc_widening(DisasContext *s, int opcode, bool is_q, int size, int rn, int rd) { @@ -9609,10 +9566,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) bool is_q = extract32(insn, 30, 1); int rn = extract32(insn, 5, 5); int rd = extract32(insn, 0, 5); - bool need_fpstatus = false; - int rmode = -1; - TCGv_i32 tcg_rmode; - TCGv_ptr tcg_fpstatus; switch (opcode) { case 0xc ... 0xf: @@ -9625,28 +9578,12 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) opcode |= (extract32(size, 1, 1) << 5) | (u << 6); size = is_double ? 3 : 2; switch (opcode) { - case 0x3c: /* URECPE */ - if (size == 3) { - unallocated_encoding(s); - return; - } - if (!fp_access_check(s)) { - return; - } - handle_2misc_reciprocal(s, opcode, false, u, is_q, size, rn, rd); - return; case 0x17: /* FCVTL, FCVTL2 */ if (!fp_access_check(s)) { return; } handle_2misc_widening(s, opcode, is_q, size, rn, rd); return; - case 0x7c: /* URSQRTE */ - if (size == 3) { - unallocated_encoding(s); - return; - } - break; default: case 0x16: /* FCVTN, FCVTN2 */ case 0x36: /* BFCVTN, BFCVTN2 */ @@ -9684,6 +9621,8 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x6d: /* FCMLE (zero) */ case 0x3d: /* FRECPE */ case 0x7d: /* FRSQRTE */ + case 0x3c: /* URECPE */ + case 0x7c: /* URSQRTE */ unallocated_encoding(s); return; } @@ -9708,75 +9647,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) unallocated_encoding(s); return; } - - if (!fp_access_check(s)) { - return; - } - - if (need_fpstatus || rmode >= 0) { - tcg_fpstatus = fpstatus_ptr(FPST_FPCR); - } else { - tcg_fpstatus = NULL; - } - if (rmode >= 0) { - tcg_rmode = gen_set_rmode(rmode, tcg_fpstatus); - } else { - tcg_rmode = NULL; - } - - { - int pass; - - assert(size == 2); - for (pass = 0; pass < (is_q ? 4 : 2); pass++) { - TCGv_i32 tcg_op = tcg_temp_new_i32(); - TCGv_i32 tcg_res = tcg_temp_new_i32(); - - read_vec_element_i32(s, tcg_op, rn, pass, MO_32); - - { - /* Special cases for 32 bit elements */ - switch (opcode) { - case 0x7c: /* URSQRTE */ - gen_helper_rsqrte_u32(tcg_res, tcg_op); - break; - default: - case 0x7: /* SQABS, SQNEG */ - case 0x2f: /* FABS */ - case 0x6f: /* FNEG */ - case 0x7f: /* FSQRT */ - case 0x18: /* FRINTN */ - case 0x19: /* FRINTM */ - case 0x38: /* FRINTP */ - case 0x39: /* FRINTZ */ - case 0x58: /* FRINTA */ - case 0x79: /* FRINTI */ - case 0x59: /* FRINTX */ - case 0x1e: /* FRINT32Z */ - case 0x5e: /* FRINT32X */ - case 0x1f: /* FRINT64Z */ - case 0x5f: /* FRINT64X */ - case 0x1a: /* FCVTNS */ - case 0x1b: /* FCVTMS */ - case 0x1c: /* FCVTAS */ - case 0x3a: /* FCVTPS */ - case 0x3b: /* FCVTZS */ - case 0x5a: /* FCVTNU */ - case 0x5b: /* FCVTMU */ - case 0x5c: /* FCVTAU */ - case 0x7a: /* FCVTPU */ - case 0x7b: /* FCVTZU */ - g_assert_not_reached(); - } - } - write_vec_element_i32(s, tcg_res, rd, pass, MO_32); - } - } - clear_vec_high(s, is_q, rd); - - if (tcg_rmode) { - gen_restore_rmode(tcg_rmode, tcg_fpstatus); - } + g_assert_not_reached(); } /* C3.6 Data processing - SIMD, inc Crypto diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 9b3b09c3bb..f35d123821 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1863,6 +1863,9 @@ FRECPE_v 0.00 1110 1.1 00001 11011 0 ..... ..... @qrr_sd FRSQRTE_v 0.10 1110 111 11001 11011 0 ..... ..... @qrr_h FRSQRTE_v 0.10 1110 1.1 00001 11011 0 ..... ..... @qrr_sd +URECPE_v 0.00 1110 101 00001 11001 0 ..... ..... @qrr_s +URSQRTE_v 0.10 1110 101 00001 11001 0 ..... ..... @qrr_s + &fcvt_q rd rn esz q shift @fcvtq_h . q:1 . ...... 001 .... ...... rn:5 rd:5 \ &fcvt_q esz=1 shift=%fcvt_f_sh_h From patchwork Tue Dec 10 16:17:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848873 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp422008wrn; Tue, 10 Dec 2024 08:30:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWcumRhNPxlEWEmvNxxpjsY+iySkJCmObuF6r1iAmxrR/+bVb9/9I8eRTH+zZGvCF859Sp8GA==@linaro.org X-Google-Smtp-Source: AGHT+IG0MkaMJoEtwA+pqevDHm3nacH+qgxYzsaE1TUyc9LqPjgYd7cUvtVMFg2aCJEFkan9DIfq X-Received: by 2002:a05:6214:c64:b0:6d8:6a74:ae68 with SMTP id 6a1803df08f44-6d8e71ad632mr277892466d6.29.1733848222701; Tue, 10 Dec 2024 08:30:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733848222; cv=none; d=google.com; s=arc-20240605; b=Wy6WL3O+uu3uZool+S8VuTpKknr5iBhsH3ZlMZk8XAzkqpMZckZDtbGx8t3uktTxjD oWEKIhGZaLX+13JnUJYmCQm7Fj/8ARLmAl+1z9q8cL3QFVDImLyIPJBpTd+ia4o3bW71 ZTNxDFthjeqvOYsFKa00ZJ1e3FBz+ldqUAZ0mBpmMZNOuV4dA3FTuubWGpya0Azxhgx8 dNH4HQ7CehQPnW050kqJts/7srl2+oap+RiTFgIsLYqj/oCRlKcPvyh39EXLK/BcJDrq m8O4Zl+4Zg+IL9KIMItt8RgIxfzdoxAVW9k6temYtgEEO7sJKPWQ1A/c1a/jQuew1JkP 4QVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=YgMoUG1TjCgvuCMS0XzFgGW8rdp5HC+s8kCN2kuLaCY=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=EPBcHcn40VRudLa9GoLAWHep/apIc1SQDvgSskGcQY++F9Nt7pOafieyqsBOm+8XLI lFQGGIHL/lJ1/gz9vDT/1s2fH6cu7GJ/+vZRwslzjiSrzWqaCpLIDDAIsx3mvbURqdUr W14lQInJrmUBZIjhXlK2+ZODhgNSZXRal5l7pyotL6ighKrSHs7xDsdBeErRcbt2+Af3 OMlmY+Pfg4J6fVEDajuA935WebagFTG+K+jozM1nhU4rDKyRVF8sGz5/jh00NtG1Jwij FZ6dk1Osmut/gGG1XzKsJYYD+g5cd/Sb1qkxaei5AbWEiPprml2gVrUSsTP960iD7t1e SGsg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OZeBZbpW; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d92e7580e9si11027646d6.322.2024.12.10.08.30.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 08:30:22 -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=OZeBZbpW; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL33P-0003Sl-8i; Tue, 10 Dec 2024 11:25: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 1tL331-0001QS-HX for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:25:22 -0500 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL32z-0007hp-4K for qemu-devel@nongnu.org; Tue, 10 Dec 2024 11:25:19 -0500 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-540218726d5so1896685e87.2 for ; Tue, 10 Dec 2024 08:25:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733847915; x=1734452715; 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=YgMoUG1TjCgvuCMS0XzFgGW8rdp5HC+s8kCN2kuLaCY=; b=OZeBZbpWnT2ebZAiOo8wUVNGO5tysu2V4udlSpPt7cM0n+9MXgGTfD9RkvuUbzEjqR mY1f6TgPapAJPVP8TuTE4T1rkrRPoMkQ0oUCI8J0G5OD+zjw7qFE4MxqHY+90f4+hVix iMASj7cx+9IDXVCLjwjRbAmTA8JpTt9m1vKGrj8GmgYUYwEqmXVYo2jHET2GDTm2fQwp BX5yxpGRLzRMMEGql0kkCsash633wryRC85hKo5qYLZFEKCviZmG9nMSxU5R4E9BjQRq Dbg+nD8IrDqUFYP276ji6CdgqttLV2Q6OB0lixsUINeVossWrrsTaQrCefxgOrnnvHMQ Koow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733847915; x=1734452715; 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=YgMoUG1TjCgvuCMS0XzFgGW8rdp5HC+s8kCN2kuLaCY=; b=q4NwpkOtpwNQCF1eAznITsUVINHLgKMVkT24y+idGQwL+OJH7ACBzwc94LWlFPaAC/ 6CJm+oLW8K7nfUpP1s2vrivOdf16fR2nRK0gcgp/UzMpxoc3jiY7z+hyABBAUPmob3nW 29QkCAeJo9gWmPZ52Z0mY/rC4y1NFx0B6C+0gfjF8qaU8SjLW1Dv2vWz0GV5kQ9FySo8 1oKd9pxdxZp1ozutcRg44viVANMdsymEeLRFIRIbdy+503yeM93NmSbXcdcWHaLVo9JR NVDBVudnszXwbKT3wV4TGlCvTLatlndrKaqM1p0xSn73Y7iWrLYpFZsoAUZKb5sikFNn 0MnQ== X-Gm-Message-State: AOJu0YzTnMWLSrCULKM7rX0iqVzlWG5y/TjvDwKfwtz+MkfAGoLFysJ6 xKynwNzyrz7ASISvUS4GPq4fcnt8RX8DNdhn/La2zWxjj3OPbgLk5bINFpuZMFfl6oPUWrQq4y9 D/KKte70U X-Gm-Gg: ASbGncsrKnduh+3mWEuSxHNV8j35Zi2dIHAQthS92K3dz5afXLpDGh/+i4LCtAnQPyH Dm7vvtjW3jjYvnOk0eIa3tLtjHAsb4ftqkcDx/rNdlUfHN7boDc1sG1ze/9T+KCiSCHdrXczesc UIwB+TVqC9GCZni5f9tjW9uZ93vnVhpXJQa/TGH0YLQsQFCY72oX8p2BvZRAuqi+TLACGjr/1tU axeglbB7ksu1aFmHwBEWG1cipX6SKJD+DKFH9KU09+EWZcJ2aQQqhur17Q= X-Received: by 2002:a05:6512:2205:b0:540:788:d6d8 with SMTP id 2adb3069b0e04-540240bd722mr2014064e87.18.1733847915117; Tue, 10 Dec 2024 08:25:15 -0800 (PST) Received: from stoup.. ([91.209.212.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5402960b0absm26024e87.102.2024.12.10.08.25.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:25:13 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 69/69] target/arm: Convert FCVTL to decodetree Date: Tue, 10 Dec 2024 10:17:33 -0600 Message-ID: <20241210161733.1830573-70-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210161733.1830573-1-richard.henderson@linaro.org> References: <20241210161733.1830573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12d; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12d.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 Remove lookup_disas_fn, handle_2misc_widening, disas_simd_two_reg_misc, disas_data_proc_simd, disas_data_proc_simd_fp, disas_a64_legacy, as this is the final insn to be converted. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 202 +++------------------------------ target/arm/tcg/a64.decode | 2 + 2 files changed, 18 insertions(+), 186 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index fa3170da86..3e57b98c27 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -1465,31 +1465,6 @@ static inline void gen_check_sp_alignment(DisasContext *s) */ } -/* - * This provides a simple table based table lookup decoder. It is - * intended to be used when the relevant bits for decode are too - * awkwardly placed and switch/if based logic would be confusing and - * deeply nested. Since it's a linear search through the table, tables - * should be kept small. - * - * It returns the first handler where insn & mask == pattern, or - * NULL if there is no match. - * The table is terminated by an empty mask (i.e. 0) - */ -static inline AArch64DecodeFn *lookup_disas_fn(const AArch64DecodeTable *table, - uint32_t insn) -{ - const AArch64DecodeTable *tptr = table; - - while (tptr->mask) { - if ((insn & tptr->mask) == tptr->pattern) { - return tptr->disas_fn; - } - tptr++; - } - return NULL; -} - /* * The instruction disassembly implemented here matches * the instruction encoding classifications in chapter C4 @@ -9508,8 +9483,7 @@ static gen_helper_gvec_2_ptr * const f_frsqrte[] = { }; TRANS(FRSQRTE_v, do_gvec_op2_fpst, a->esz, a->q, a->rd, a->rn, 0, f_frsqrte) -static void handle_2misc_widening(DisasContext *s, int opcode, bool is_q, - int size, int rn, int rd) +static bool trans_FCVTL_v(DisasContext *s, arg_qrr_e *a) { /* Handle 2-reg-misc ops which are widening (so each size element * in the source becomes a 2*size element in the destination. @@ -9517,173 +9491,43 @@ static void handle_2misc_widening(DisasContext *s, int opcode, bool is_q, */ int pass; - if (size == 3) { + if (!fp_access_check(s)) { + return true; + } + + if (a->esz == MO_64) { /* 32 -> 64 bit fp conversion */ TCGv_i64 tcg_res[2]; - int srcelt = is_q ? 2 : 0; + TCGv_i32 tcg_op = tcg_temp_new_i32(); + int srcelt = a->q ? 2 : 0; for (pass = 0; pass < 2; pass++) { - TCGv_i32 tcg_op = tcg_temp_new_i32(); tcg_res[pass] = tcg_temp_new_i64(); - - read_vec_element_i32(s, tcg_op, rn, srcelt + pass, MO_32); + read_vec_element_i32(s, tcg_op, a->rn, srcelt + pass, MO_32); gen_helper_vfp_fcvtds(tcg_res[pass], tcg_op, tcg_env); } for (pass = 0; pass < 2; pass++) { - write_vec_element(s, tcg_res[pass], rd, pass, MO_64); + write_vec_element(s, tcg_res[pass], a->rd, pass, MO_64); } } else { /* 16 -> 32 bit fp conversion */ - int srcelt = is_q ? 4 : 0; + int srcelt = a->q ? 4 : 0; TCGv_i32 tcg_res[4]; TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); TCGv_i32 ahp = get_ahp_flag(); for (pass = 0; pass < 4; pass++) { tcg_res[pass] = tcg_temp_new_i32(); - - read_vec_element_i32(s, tcg_res[pass], rn, srcelt + pass, MO_16); + read_vec_element_i32(s, tcg_res[pass], a->rn, srcelt + pass, MO_16); gen_helper_vfp_fcvt_f16_to_f32(tcg_res[pass], tcg_res[pass], fpst, ahp); } for (pass = 0; pass < 4; pass++) { - write_vec_element_i32(s, tcg_res[pass], rd, pass, MO_32); + write_vec_element_i32(s, tcg_res[pass], a->rd, pass, MO_32); } } -} - -/* AdvSIMD two reg misc - * 31 30 29 28 24 23 22 21 17 16 12 11 10 9 5 4 0 - * +---+---+---+-----------+------+-----------+--------+-----+------+------+ - * | 0 | Q | U | 0 1 1 1 0 | size | 1 0 0 0 0 | opcode | 1 0 | Rn | Rd | - * +---+---+---+-----------+------+-----------+--------+-----+------+------+ - */ -static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) -{ - int size = extract32(insn, 22, 2); - int opcode = extract32(insn, 12, 5); - bool u = extract32(insn, 29, 1); - bool is_q = extract32(insn, 30, 1); - int rn = extract32(insn, 5, 5); - int rd = extract32(insn, 0, 5); - - switch (opcode) { - case 0xc ... 0xf: - case 0x16 ... 0x1f: - { - /* Floating point: U, size[1] and opcode indicate operation; - * size[0] indicates single or double precision. - */ - int is_double = extract32(size, 0, 1); - opcode |= (extract32(size, 1, 1) << 5) | (u << 6); - size = is_double ? 3 : 2; - switch (opcode) { - case 0x17: /* FCVTL, FCVTL2 */ - if (!fp_access_check(s)) { - return; - } - handle_2misc_widening(s, opcode, is_q, size, rn, rd); - return; - default: - case 0x16: /* FCVTN, FCVTN2 */ - case 0x36: /* BFCVTN, BFCVTN2 */ - case 0x56: /* FCVTXN, FCVTXN2 */ - case 0x2f: /* FABS */ - case 0x6f: /* FNEG */ - case 0x7f: /* FSQRT */ - case 0x18: /* FRINTN */ - case 0x19: /* FRINTM */ - case 0x38: /* FRINTP */ - case 0x39: /* FRINTZ */ - case 0x59: /* FRINTX */ - case 0x79: /* FRINTI */ - case 0x58: /* FRINTA */ - case 0x1e: /* FRINT32Z */ - case 0x1f: /* FRINT64Z */ - case 0x5e: /* FRINT32X */ - case 0x5f: /* FRINT64X */ - case 0x1d: /* SCVTF */ - case 0x5d: /* UCVTF */ - case 0x1a: /* FCVTNS */ - case 0x1b: /* FCVTMS */ - case 0x3a: /* FCVTPS */ - case 0x3b: /* FCVTZS */ - case 0x5a: /* FCVTNU */ - case 0x5b: /* FCVTMU */ - case 0x7a: /* FCVTPU */ - case 0x7b: /* FCVTZU */ - case 0x5c: /* FCVTAU */ - case 0x1c: /* FCVTAS */ - case 0x2c: /* FCMGT (zero) */ - case 0x2d: /* FCMEQ (zero) */ - case 0x2e: /* FCMLT (zero) */ - case 0x6c: /* FCMGE (zero) */ - case 0x6d: /* FCMLE (zero) */ - case 0x3d: /* FRECPE */ - case 0x7d: /* FRSQRTE */ - case 0x3c: /* URECPE */ - case 0x7c: /* URSQRTE */ - unallocated_encoding(s); - return; - } - break; - } - default: - case 0x0: /* REV64, REV32 */ - case 0x1: /* REV16 */ - case 0x2: /* SADDLP, UADDLP */ - case 0x3: /* SUQADD, USQADD */ - case 0x4: /* CLS, CLZ */ - case 0x5: /* CNT, NOT, RBIT */ - case 0x6: /* SADALP, UADALP */ - case 0x7: /* SQABS, SQNEG */ - case 0x8: /* CMGT, CMGE */ - case 0x9: /* CMEQ, CMLE */ - case 0xa: /* CMLT */ - case 0xb: /* ABS, NEG */ - case 0x12: /* XTN, XTN2, SQXTUN, SQXTUN2 */ - case 0x13: /* SHLL, SHLL2 */ - case 0x14: /* SQXTN, SQXTN2, UQXTN, UQXTN2 */ - unallocated_encoding(s); - return; - } - g_assert_not_reached(); -} - -/* C3.6 Data processing - SIMD, inc Crypto - * - * As the decode gets a little complex we are using a table based - * approach for this part of the decode. - */ -static const AArch64DecodeTable data_proc_simd[] = { - /* pattern , mask , fn */ - { 0x0e200800, 0x9f3e0c00, disas_simd_two_reg_misc }, - { 0x00000000, 0x00000000, NULL } -}; - -static void disas_data_proc_simd(DisasContext *s, uint32_t insn) -{ - /* Note that this is called with all non-FP cases from - * table C3-6 so it must UNDEF for entries not specifically - * allocated to instructions in that table. - */ - AArch64DecodeFn *fn = lookup_disas_fn(&data_proc_simd[0], insn); - if (fn) { - fn(s, insn); - } else { - unallocated_encoding(s); - } -} - -/* C3.6 Data processing - SIMD and floating point */ -static void disas_data_proc_simd_fp(DisasContext *s, uint32_t insn) -{ - if (extract32(insn, 28, 1) == 1 && extract32(insn, 30, 1) == 0) { - unallocated_encoding(s); /* in decodetree */ - } else { - /* SIMD, including crypto */ - disas_data_proc_simd(s, insn); - } + clear_vec_high(s, true, a->rd); + return true; } static bool trans_OK(DisasContext *s, arg_OK *a) @@ -9749,20 +9593,6 @@ static bool btype_destination_ok(uint32_t insn, bool bt, int btype) return false; } -/* C3.1 A64 instruction index by encoding */ -static void disas_a64_legacy(DisasContext *s, uint32_t insn) -{ - switch (extract32(insn, 25, 4)) { - case 0x7: - case 0xf: /* Data processing - SIMD and floating point */ - disas_data_proc_simd_fp(s, insn); - break; - default: - unallocated_encoding(s); - break; - } -} - static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu) { @@ -9965,7 +9795,7 @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) if (!disas_a64(s, insn) && !disas_sme(s, insn) && !disas_sve(s, insn)) { - disas_a64_legacy(s, insn); + unallocated_encoding(s); } /* diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index f35d123821..7aa10f5147 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1866,6 +1866,8 @@ FRSQRTE_v 0.10 1110 1.1 00001 11011 0 ..... ..... @qrr_sd URECPE_v 0.00 1110 101 00001 11001 0 ..... ..... @qrr_s URSQRTE_v 0.10 1110 101 00001 11001 0 ..... ..... @qrr_s +FCVTL_v 0.00 1110 0.1 00001 01111 0 ..... ..... @qrr_sd + &fcvt_q rd rn esz q shift @fcvtq_h . q:1 . ...... 001 .... ...... rn:5 rd:5 \ &fcvt_q esz=1 shift=%fcvt_f_sh_h