From patchwork Fri Dec 25 20:19:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352293 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7943216jai; Fri, 25 Dec 2020 12:20:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJx98FdIaiJdwdndD3C+DQ7mkOtuYSPuIKZMcxMYNQooKksQVEffQaT6+NogDVGFcJkbMr1C X-Received: by 2002:a25:e907:: with SMTP id n7mr48250177ybd.288.1608927629707; Fri, 25 Dec 2020 12:20:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608927629; cv=none; d=google.com; s=arc-20160816; b=mDKMACwJ4493UvdEnBn2ngoZJyp6T9HisYTpqQWSpvgLdcOQM/lpm9AyaLfhZ7qAbE o0Tw9hSa8W/LqLZvsforX+I7FaGaKxJzjvNY+Uzw9KGXSzDmF242C2r72bVokwaiomvQ LLISQj8838Cjbhd7z90ve1Xa4JbaVaXyLG3oFHFBdczaK92TyHNGHyim9a4vpEhQ1QK4 IkmCQ/DXWGFehDp72BzsR+9zDQ0yqcIjQraT+t3tSOfXzLzRnQG0lkoWjHsxq7ZSMchO jNXIPdIGP1BLhGRFEaskpPKToXHtMNMGqTakNabC3q/gEKkOtm+mypOnQkpvwxT43Uft 06TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=9CqpWUkwS4uMUt5TO1bM8albvCwOVKljT5cmFJ6ZDcU=; b=Twll1ejiJ5VdWSKjs1+mVUhXLON1FaoNV6sYdVLaHEXEAFnvD4RzGUwdjmw5evWTU9 QJAXa5oMUsvdooKjZaVZlQZpOS/HXsNGUgKd+VZz8cORocXguMWiSKb2Sfr2nZS/DQ0t RZv/LIpgg1X8LpV2CPLWIrTAlhWCCobfqO6rY0yXHVG/u9VfoOGimVnRWGGnQaPtD4SG 2VycbqfpVHhuOw4c8bKaYuP8NmnJL9a4lc1cpB4lHV+2Z0bXcpAufJA2BAG6q+1N8wGV w/+GNiqK9GO3bpG74d96KO6Xp5LqQtl1v+eXKtqBKAdJRkdMzlBV29HVSZMeHdCbAIlW hntA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="s99N/ora"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d3si29175343ybi.471.2020.12.25.12.20.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Dec 2020 12:20:29 -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="s99N/ora"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kstZd-00030v-3t for patch@linaro.org; Fri, 25 Dec 2020 15:20:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kstZG-0002yg-GE for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:06 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:44772) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kstZB-00059M-9A for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:06 -0500 Received: by mail-pl1-x62c.google.com with SMTP id r4so2703814pls.11 for ; Fri, 25 Dec 2020 12:20:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=9CqpWUkwS4uMUt5TO1bM8albvCwOVKljT5cmFJ6ZDcU=; b=s99N/oraQO6I0fQqQVxnttunz4ST0elk3Adrr9HqurLmVNrR9RmE7HyUrN04WVb1eQ YAytXOs9FBVej14h75WTFhVNbe/g2HanHCMLez6TbWfWo1MHOjbnufDLE/KcxoMTUzy8 9SAJc35x2YhF/fYSpUG2hWM6g6gSxw9+8qCM/UgPWjqBb7hR44ZcYoJk2u+EIJaa/4b+ 2D0uCBfFfxK8E0lhdrtQU3+mq4lKZA0xPPzj2QecwGFOBIJjnr3iUKQTrQ+xVuuXvwoW S34j83bWAXMEZACZy0t82+n6jdjK+/7cIYhKVR/DL5LH0PPYlfqT2FuRqqY9CO+vJcnK 7eYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9CqpWUkwS4uMUt5TO1bM8albvCwOVKljT5cmFJ6ZDcU=; b=XasB3DfnkCyqJ8W92xbF1wWZc+D6lE5QZ+pnOZ4Bl6zJv5BT2AgvXi9zATqqN2q3Yh 32pE5LgPZcXjn+5tLRqfGI9jTGjqegoDveeAaInbWK0Ierm7VSP0iM4CHhxdLHCk5gov roFIInQGPXJe730pzqTvw+iLOWUkjBThsLR/6NeoSJV+900HCzMHCJ7/aiZbm3/Zi8Qf AagohT170VedATYAhhKM8qxB1pr3gPiokzUnxKKljZp18LF5mgtF+dPQAU3rOm9dJVLT xTnXLoDaTzNd/z+0LfETecG9VBb1ZL2lwrmIiDRg6NcXWWcUVbZUZPycatffGWEeCmnk 9gmA== X-Gm-Message-State: AOAM531gjbu0QAAApmDxrGkzPnHKHpG1TkXEcTh/joYQxeSMhhOkag+N WwuWb5M23h1IaV3CQ5z8QB9A9QxgBWMSvQ== X-Received: by 2002:a17:90a:5405:: with SMTP id z5mr10134215pjh.13.1608927599637; Fri, 25 Dec 2020 12:19:59 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id l8sm5816497pjt.32.2020.12.25.12.19.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:19:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 01/16] tcg/s390x: Rename from tcg/s390 Date: Fri, 25 Dec 2020 12:19:41 -0800 Message-Id: <20201225201956.692861-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201225201956.692861-1-richard.henderson@linaro.org> References: <20201225201956.692861-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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.23 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" This emphasizes that we don't support s390, only 64-bit s390x hosts. Signed-off-by: Richard Henderson --- meson.build | 2 -- tcg/{s390 => s390x}/tcg-target-conset.h | 0 tcg/{s390 => s390x}/tcg-target-constr.h | 0 tcg/{s390 => s390x}/tcg-target.h | 0 tcg/{s390 => s390x}/tcg-target.c.inc | 0 5 files changed, 2 deletions(-) rename tcg/{s390 => s390x}/tcg-target-conset.h (100%) rename tcg/{s390 => s390x}/tcg-target-constr.h (100%) rename tcg/{s390 => s390x}/tcg-target.h (100%) rename tcg/{s390 => s390x}/tcg-target.c.inc (100%) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth diff --git a/meson.build b/meson.build index 372576f82c..a6c8b4d431 100644 --- a/meson.build +++ b/meson.build @@ -117,8 +117,6 @@ if 'CONFIG_TCG_INTERPRETER' in config_host tcg_arch = 'tci' elif config_host['ARCH'] == 'sparc64' tcg_arch = 'sparc' -elif config_host['ARCH'] == 's390x' - tcg_arch = 's390' elif config_host['ARCH'] in ['x86_64', 'x32'] tcg_arch = 'i386' elif config_host['ARCH'] == 'ppc64' diff --git a/tcg/s390/tcg-target-conset.h b/tcg/s390x/tcg-target-conset.h similarity index 100% rename from tcg/s390/tcg-target-conset.h rename to tcg/s390x/tcg-target-conset.h diff --git a/tcg/s390/tcg-target-constr.h b/tcg/s390x/tcg-target-constr.h similarity index 100% rename from tcg/s390/tcg-target-constr.h rename to tcg/s390x/tcg-target-constr.h diff --git a/tcg/s390/tcg-target.h b/tcg/s390x/tcg-target.h similarity index 100% rename from tcg/s390/tcg-target.h rename to tcg/s390x/tcg-target.h diff --git a/tcg/s390/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc similarity index 100% rename from tcg/s390/tcg-target.c.inc rename to tcg/s390x/tcg-target.c.inc From patchwork Fri Dec 25 20:19:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352296 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7944906jai; Fri, 25 Dec 2020 12:24:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJyMYM+MlnLxwFXShYEeg9cIWTjT4/G1RlvqsvRhkFw9U+IVp/uZkta5ClLgDQCB22fLW5FS X-Received: by 2002:a25:ab74:: with SMTP id u107mr48599727ybi.44.1608927882838; Fri, 25 Dec 2020 12:24:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608927882; cv=none; d=google.com; s=arc-20160816; b=zum8RlHB0yWaMbCM8dIHztyAZbEkTPcoqw6GMZ4zcBQW7uAoVxdER9Ddg9TlHpTRvN kstRc89UcwDWkwAIxCPPplEu0kCIJXJgreA1or9JNzuk5yYn802vDsn++1nuEBahTFvz eidIlJeMiHV4pO/uCiwgMPwtGKYEith1seiqx2lqmJmayW4vqmKWOVBenoR9B12j+0/W kenl9h7Cm3MGkTie/6hzAhQGzOrpA4oQa0wDEWHZ+z6jiqCtCgVI6krC8bLU3jF9SrUi 9oxSnz3Mb6KDLEFJmHrvzszf1jDiTLUiG0MGzUunHWI4SFjGVhvMQXZcnFBVMxBcPjOa zopA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=1J9nlBVMJZk0bxErAsNacKrjHaLVpeu1J9qgQgNBAH4=; b=OPpMHA05TbyrhyYTVA/yQ/eFT90TKMUqhDoXsDnn76BhPDsriFTSwDKvZ+yFL6Gk/F vdM7XRKEBAkiJg22QViguEzAISYWJmKoIFW/byhaln6ukFvg/t7NAVvjI2vHzzS+XLam 0zQbhm8PHZ249FFBjZOiJ4B9bZMkIQ0wBsB7TgD8Xv6Rjj7kvxwv7dBd/tZV2ctdM8V0 S5zmyVypx2a5ftjpGXLukX0lfdl4lsQEJAWooDgSmYDNO1D9y48ltqmYumhOsOf+9kH5 bxY2qBr+YbiBmRcToXdAEH+nA1Nm+DjCRvuN2feas/gYfOmUor7AY7WQzUpUKRyaxNFE AAuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=adllleEy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m74si36009286ybm.161.2020.12.25.12.24.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Dec 2020 12:24:42 -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=adllleEy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kstdi-0006at-5U for patch@linaro.org; Fri, 25 Dec 2020 15:24:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kstZH-0002yq-HQ for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:07 -0500 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:46251) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kstZF-00059U-2T for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:07 -0500 Received: by mail-pl1-x633.google.com with SMTP id v3so2697910plz.13 for ; Fri, 25 Dec 2020 12:20:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1J9nlBVMJZk0bxErAsNacKrjHaLVpeu1J9qgQgNBAH4=; b=adllleEyoy9WBs6qNIyMiGFUqpNJMLPVFDmdsoHNkFS90d60PBOQQO6FiW+d7LEW3X gSVDuUaYvLeDZwt8mhg2E+/EEYr1q8RafIsOdi82tY569+nI8tQHy9l0itnjueCH7pv7 KmyX7AY1R9f6tB9u+ok5pkvmqDMQpKBpAf+eVxgEgmkbyDbpAwx6QkKA7S7BR/h8O/CQ vAWw+8B/R2hNoo+gnT57AFBkRLAmoNs3T5PyHs7nAw9D4HUarUrZNaHQaH8moYDbTRNr wylTsChvvod3+IB+KTCAJ0RM7HK0jzf5j4ilXUUkhLX64Kww7UGXLy0vx2kUvNaHw2Ls Ti/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1J9nlBVMJZk0bxErAsNacKrjHaLVpeu1J9qgQgNBAH4=; b=NGzLx0oIBd1lSXZf2XlI/mjqgOoHJH0xxaiAPAelL2Oz/oEyyozuI7SClEamq8aYG+ AaYVvuFXjRenl69NjM3dyZpZN1UqSgwxiBnrDklRLFAiTaudaTPfnBGucMQC4Xzp9ZEh i+SdFlMi8eEfF0wvmvlK9KUhCDvHNODiLHU3RDFbSGxLcjfG1Fruv3vucJBDdv3edBs0 5K4NT7q9FM143308Hu1xpUeZAikVldAuUBcrd4+rFUBRSgqOdgig9rNrxoFhP/8vHhML xh3zoXIBfuBWmV5vBrP9A/MytcgWeosx98CR4MzDvnLURzh8AyU/Y+N9HiINjeDiI17u B8Qg== X-Gm-Message-State: AOAM533AlmllY767uNjpAnyC/+JoeowrZHPA1QZZGRjIpH1eVOEfdkui NVjXUdgmnsf1Kf38LBGBA8QuGzpsIyIdHQ== X-Received: by 2002:a17:90a:73c5:: with SMTP id n5mr9816857pjk.118.1608927600829; Fri, 25 Dec 2020 12:20:00 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id l8sm5816497pjt.32.2020.12.25.12.19.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:20:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 02/16] tcg/s390x: Change FACILITY representation Date: Fri, 25 Dec 2020 12:19:42 -0800 Message-Id: <20201225201956.692861-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201225201956.692861-1-richard.henderson@linaro.org> References: <20201225201956.692861-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We will shortly need to be able to check facilities beyond the first 64. Instead of explicitly masking against s390_facilities, create a HAVE_FACILITY macro that indexes an array. Reviewed-by: David Hildenbrand Signed-off-by: Richard Henderson --- v2: Change name to HAVE_FACILITY (david) --- tcg/s390x/tcg-target.h | 29 ++++++++------- tcg/s390x/tcg-target.c.inc | 74 +++++++++++++++++++------------------- 2 files changed, 52 insertions(+), 51 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index 63c8797bd3..264c8c1e97 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -52,16 +52,19 @@ typedef enum TCGReg { /* A list of relevant facilities used by this translator. Some of these are required for proper operation, and these are checked at startup. */ -#define FACILITY_ZARCH_ACTIVE (1ULL << (63 - 2)) -#define FACILITY_LONG_DISP (1ULL << (63 - 18)) -#define FACILITY_EXT_IMM (1ULL << (63 - 21)) -#define FACILITY_GEN_INST_EXT (1ULL << (63 - 34)) -#define FACILITY_LOAD_ON_COND (1ULL << (63 - 45)) +#define FACILITY_ZARCH_ACTIVE 2 +#define FACILITY_LONG_DISP 18 +#define FACILITY_EXT_IMM 21 +#define FACILITY_GEN_INST_EXT 34 +#define FACILITY_LOAD_ON_COND 45 #define FACILITY_FAST_BCR_SER FACILITY_LOAD_ON_COND #define FACILITY_DISTINCT_OPS FACILITY_LOAD_ON_COND -#define FACILITY_LOAD_ON_COND2 (1ULL << (63 - 53)) +#define FACILITY_LOAD_ON_COND2 53 -extern uint64_t s390_facilities; +extern uint64_t s390_facilities[1]; + +#define HAVE_FACILITY(X) \ + ((s390_facilities[FACILITY_##X / 64] >> (63 - FACILITY_##X % 64)) & 1) /* optional instructions */ #define TCG_TARGET_HAS_div2_i32 1 @@ -82,8 +85,8 @@ extern uint64_t s390_facilities; #define TCG_TARGET_HAS_clz_i32 0 #define TCG_TARGET_HAS_ctz_i32 0 #define TCG_TARGET_HAS_ctpop_i32 0 -#define TCG_TARGET_HAS_deposit_i32 (s390_facilities & FACILITY_GEN_INST_EXT) -#define TCG_TARGET_HAS_extract_i32 (s390_facilities & FACILITY_GEN_INST_EXT) +#define TCG_TARGET_HAS_deposit_i32 HAVE_FACILITY(GEN_INST_EXT) +#define TCG_TARGET_HAS_extract_i32 HAVE_FACILITY(GEN_INST_EXT) #define TCG_TARGET_HAS_sextract_i32 0 #define TCG_TARGET_HAS_extract2_i32 0 #define TCG_TARGET_HAS_movcond_i32 1 @@ -96,7 +99,7 @@ extern uint64_t s390_facilities; #define TCG_TARGET_HAS_extrl_i64_i32 0 #define TCG_TARGET_HAS_extrh_i64_i32 0 #define TCG_TARGET_HAS_goto_ptr 1 -#define TCG_TARGET_HAS_direct_jump (s390_facilities & FACILITY_GEN_INST_EXT) +#define TCG_TARGET_HAS_direct_jump HAVE_FACILITY(GEN_INST_EXT) #define TCG_TARGET_HAS_div2_i64 1 #define TCG_TARGET_HAS_rot_i64 1 @@ -116,11 +119,11 @@ extern uint64_t s390_facilities; #define TCG_TARGET_HAS_eqv_i64 0 #define TCG_TARGET_HAS_nand_i64 0 #define TCG_TARGET_HAS_nor_i64 0 -#define TCG_TARGET_HAS_clz_i64 (s390_facilities & FACILITY_EXT_IMM) +#define TCG_TARGET_HAS_clz_i64 HAVE_FACILITY(EXT_IMM) #define TCG_TARGET_HAS_ctz_i64 0 #define TCG_TARGET_HAS_ctpop_i64 0 -#define TCG_TARGET_HAS_deposit_i64 (s390_facilities & FACILITY_GEN_INST_EXT) -#define TCG_TARGET_HAS_extract_i64 (s390_facilities & FACILITY_GEN_INST_EXT) +#define TCG_TARGET_HAS_deposit_i64 HAVE_FACILITY(GEN_INST_EXT) +#define TCG_TARGET_HAS_extract_i64 HAVE_FACILITY(GEN_INST_EXT) #define TCG_TARGET_HAS_sextract_i64 0 #define TCG_TARGET_HAS_extract2_i64 0 #define TCG_TARGET_HAS_movcond_i64 1 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 087b4a2f5c..5a7e9d1dd5 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -53,7 +53,7 @@ We don't need this when we have pc-relative loads with the general instructions extension facility. */ #define TCG_REG_TB TCG_REG_R12 -#define USE_REG_TB (!(s390_facilities & FACILITY_GEN_INST_EXT)) +#define USE_REG_TB (!HAVE_FACILITY(GEN_INST_EXT)) #ifndef CONFIG_SOFTMMU #define TCG_GUEST_BASE_REG TCG_REG_R13 @@ -364,7 +364,7 @@ static void * const qemu_st_helpers[16] = { #endif static tcg_insn_unit *tb_ret_addr; -uint64_t s390_facilities; +uint64_t s390_facilities[1]; static bool patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) @@ -566,7 +566,7 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, } /* Try all 48-bit insns that can load it in one go. */ - if (s390_facilities & FACILITY_EXT_IMM) { + if (HAVE_FACILITY(EXT_IMM)) { if (sval == (int32_t)sval) { tcg_out_insn(s, RIL, LGFI, ret, sval); return; @@ -609,7 +609,7 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, } /* Otherwise, stuff it in the constant pool. */ - if (s390_facilities & FACILITY_GEN_INST_EXT) { + if (HAVE_FACILITY(GEN_INST_EXT)) { tcg_out_insn(s, RIL, LGRL, ret, 0); new_pool_label(s, sval, R_390_PC32DBL, s->code_ptr - 2, 2); } else if (USE_REG_TB && !in_prologue) { @@ -694,7 +694,7 @@ static void tcg_out_ld_abs(TCGContext *s, TCGType type, TCGReg dest, void *abs) { intptr_t addr = (intptr_t)abs; - if ((s390_facilities & FACILITY_GEN_INST_EXT) && !(addr & 1)) { + if (HAVE_FACILITY(GEN_INST_EXT) && !(addr & 1)) { ptrdiff_t disp = tcg_pcrel_diff(s, abs) >> 1; if (disp == (int32_t)disp) { if (type == TCG_TYPE_I32) { @@ -728,7 +728,7 @@ static inline void tcg_out_risbg(TCGContext *s, TCGReg dest, TCGReg src, static void tgen_ext8s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src) { - if (s390_facilities & FACILITY_EXT_IMM) { + if (HAVE_FACILITY(EXT_IMM)) { tcg_out_insn(s, RRE, LGBR, dest, src); return; } @@ -748,7 +748,7 @@ static void tgen_ext8s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src) static void tgen_ext8u(TCGContext *s, TCGType type, TCGReg dest, TCGReg src) { - if (s390_facilities & FACILITY_EXT_IMM) { + if (HAVE_FACILITY(EXT_IMM)) { tcg_out_insn(s, RRE, LLGCR, dest, src); return; } @@ -768,7 +768,7 @@ static void tgen_ext8u(TCGContext *s, TCGType type, TCGReg dest, TCGReg src) static void tgen_ext16s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src) { - if (s390_facilities & FACILITY_EXT_IMM) { + if (HAVE_FACILITY(EXT_IMM)) { tcg_out_insn(s, RRE, LGHR, dest, src); return; } @@ -788,7 +788,7 @@ static void tgen_ext16s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src) static void tgen_ext16u(TCGContext *s, TCGType type, TCGReg dest, TCGReg src) { - if (s390_facilities & FACILITY_EXT_IMM) { + if (HAVE_FACILITY(EXT_IMM)) { tcg_out_insn(s, RRE, LLGHR, dest, src); return; } @@ -876,7 +876,7 @@ static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) tgen_ext32u(s, dest, dest); return; } - if (s390_facilities & FACILITY_EXT_IMM) { + if (HAVE_FACILITY(EXT_IMM)) { if ((val & valid) == 0xff) { tgen_ext8u(s, TCG_TYPE_I64, dest, dest); return; @@ -897,7 +897,7 @@ static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) } /* Try all 48-bit insns that can perform it in one go. */ - if (s390_facilities & FACILITY_EXT_IMM) { + if (HAVE_FACILITY(EXT_IMM)) { for (i = 0; i < 2; i++) { tcg_target_ulong mask = ~(0xffffffffull << i*32); if (((val | ~valid) & mask) == mask) { @@ -906,7 +906,7 @@ static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) } } } - if ((s390_facilities & FACILITY_GEN_INST_EXT) && risbg_mask(val)) { + if (HAVE_FACILITY(GEN_INST_EXT) && risbg_mask(val)) { tgen_andi_risbg(s, dest, dest, val); return; } @@ -955,7 +955,7 @@ static void tgen_ori(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) } /* Try all 48-bit insns that can perform it in one go. */ - if (s390_facilities & FACILITY_EXT_IMM) { + if (HAVE_FACILITY(EXT_IMM)) { for (i = 0; i < 2; i++) { tcg_target_ulong mask = (0xffffffffull << i*32); if ((val & mask) != 0 && (val & ~mask) == 0) { @@ -980,7 +980,7 @@ static void tgen_ori(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) /* Perform the OR via sequential modifications to the high and low parts. Do this via recursion to handle 16-bit vs 32-bit masks in each half. */ - tcg_debug_assert(s390_facilities & FACILITY_EXT_IMM); + tcg_debug_assert(HAVE_FACILITY(EXT_IMM)); tgen_ori(s, type, dest, val & 0x00000000ffffffffull); tgen_ori(s, type, dest, val & 0xffffffff00000000ull); } @@ -989,7 +989,7 @@ static void tgen_ori(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) static void tgen_xori(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) { /* Try all 48-bit insns that can perform it in one go. */ - if (s390_facilities & FACILITY_EXT_IMM) { + if (HAVE_FACILITY(EXT_IMM)) { if ((val & 0xffffffff00000000ull) == 0) { tcg_out_insn(s, RIL, XILF, dest, val); return; @@ -1013,7 +1013,7 @@ static void tgen_xori(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) -(intptr_t)s->code_gen_ptr); } else { /* Perform the xor by parts. */ - tcg_debug_assert(s390_facilities & FACILITY_EXT_IMM); + tcg_debug_assert(HAVE_FACILITY(EXT_IMM)); if (val & 0xffffffff) { tcg_out_insn(s, RIL, XILF, dest, val); } @@ -1047,7 +1047,7 @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, goto exit; } - if (s390_facilities & FACILITY_EXT_IMM) { + if (HAVE_FACILITY(EXT_IMM)) { if (type == TCG_TYPE_I32) { op = (is_unsigned ? RIL_CLFI : RIL_CFI); tcg_out_insn_RIL(s, op, r1, c2); @@ -1110,7 +1110,7 @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond, bool have_loc; /* With LOC2, we can always emit the minimum 3 insns. */ - if (s390_facilities & FACILITY_LOAD_ON_COND2) { + if (HAVE_FACILITY(LOAD_ON_COND2)) { /* Emit: d = 0, d = (cc ? 1 : d). */ cc = tgen_cmp(s, type, cond, c1, c2, c2const, false); tcg_out_movi(s, TCG_TYPE_I64, dest, 0); @@ -1118,7 +1118,7 @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond, return; } - have_loc = (s390_facilities & FACILITY_LOAD_ON_COND) != 0; + have_loc = HAVE_FACILITY(LOAD_ON_COND); /* For HAVE_LOC, only the paths through GTU/GT/LEU/LE are smaller. */ restart: @@ -1204,7 +1204,7 @@ static void tgen_movcond(TCGContext *s, TCGType type, TCGCond c, TCGReg dest, TCGArg v3, int v3const) { int cc; - if (s390_facilities & FACILITY_LOAD_ON_COND) { + if (HAVE_FACILITY(LOAD_ON_COND)) { cc = tgen_cmp(s, type, c, c1, c2, c2const, false); if (v3const) { tcg_out_insn(s, RIE, LOCGHI, dest, v3, cc); @@ -1237,7 +1237,7 @@ static void tgen_clz(TCGContext *s, TCGReg dest, TCGReg a1, } else { tcg_out_mov(s, TCG_TYPE_I64, dest, a2); } - if (s390_facilities & FACILITY_LOAD_ON_COND) { + if (HAVE_FACILITY(LOAD_ON_COND)) { /* Emit: if (one bit found) dest = r0. */ tcg_out_insn(s, RRF, LOCGR, dest, TCG_REG_R0, 2); } else { @@ -1329,7 +1329,7 @@ static void tgen_brcond(TCGContext *s, TCGType type, TCGCond c, { int cc; - if (s390_facilities & FACILITY_GEN_INST_EXT) { + if (HAVE_FACILITY(GEN_INST_EXT)) { bool is_unsigned = is_unsigned_cond(c); bool in_range; S390Opcode opc; @@ -1523,7 +1523,7 @@ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGReg addr_reg, MemOp opc, cross pages using the address of the last byte of the access. */ a_off = (a_bits >= s_bits ? 0 : s_mask - a_mask); tlb_mask = (uint64_t)TARGET_PAGE_MASK | a_mask; - if ((s390_facilities & FACILITY_GEN_INST_EXT) && a_off == 0) { + if (HAVE_FACILITY(GEN_INST_EXT) && a_off == 0) { tgen_andi_risbg(s, TCG_REG_R3, addr_reg, tlb_mask); } else { tcg_out_insn(s, RX, LA, TCG_REG_R3, addr_reg, TCG_REG_NONE, a_off); @@ -1810,7 +1810,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_out_insn(s, RI, AHI, a0, a2); break; } - if (s390_facilities & FACILITY_EXT_IMM) { + if (HAVE_FACILITY(EXT_IMM)) { tcg_out_insn(s, RIL, AFI, a0, a2); break; } @@ -2034,7 +2034,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_out_insn(s, RI, AGHI, a0, a2); break; } - if (s390_facilities & FACILITY_EXT_IMM) { + if (HAVE_FACILITY(EXT_IMM)) { if (a2 == (int32_t)a2) { tcg_out_insn(s, RIL, AGFI, a0, a2); break; @@ -2259,8 +2259,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, /* The host memory model is quite strong, we simply need to serialize the instruction stream. */ if (args[0] & TCG_MO_ST_LD) { - tcg_out_insn(s, RR, BCR, - s390_facilities & FACILITY_FAST_BCR_SER ? 14 : 15, 0); + tcg_out_insn(s, RR, BCR, HAVE_FACILITY(FAST_BCR_SER) ? 14 : 15, 0); } break; @@ -2323,7 +2322,7 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_or_i64: case INDEX_op_xor_i32: case INDEX_op_xor_i64: - return (s390_facilities & FACILITY_DISTINCT_OPS + return (HAVE_FACILITY(DISTINCT_OPS) ? C_O1_I2(r, r, ri) : C_O1_I2(r, 0, ri)); @@ -2331,19 +2330,19 @@ static int tcg_target_op_def(TCGOpcode op) /* If we have the general-instruction-extensions, then we have MULTIPLY SINGLE IMMEDIATE with a signed 32-bit, otherwise we have only MULTIPLY HALFWORD IMMEDIATE, with a signed 16-bit. */ - return (s390_facilities & FACILITY_GEN_INST_EXT + return (HAVE_FACILITY(GEN_INST_EXT) ? C_O1_I2(r, 0, ri) : C_O1_I2(r, 0, rI)); case INDEX_op_mul_i64: - return (s390_facilities & FACILITY_GEN_INST_EXT + return (HAVE_FACILITY(GEN_INST_EXT) ? C_O1_I2(r, 0, rJ) : C_O1_I2(r, 0, rI)); case INDEX_op_shl_i32: case INDEX_op_shr_i32: case INDEX_op_sar_i32: - return (s390_facilities & FACILITY_DISTINCT_OPS + return (HAVE_FACILITY(DISTINCT_OPS) ? C_O1_I2(r, r, ri) : C_O1_I2(r, 0, ri)); @@ -2387,7 +2386,7 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_movcond_i32: case INDEX_op_movcond_i64: - return (s390_facilities & FACILITY_LOAD_ON_COND2 + return (HAVE_FACILITY(LOAD_ON_COND2) ? C_O1_I4(r, r, ri, rI, 0) : C_O1_I4(r, r, ri, r, 0)); @@ -2402,13 +2401,13 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_add2_i32: case INDEX_op_sub2_i32: - return (s390_facilities & FACILITY_EXT_IMM + return (HAVE_FACILITY(EXT_IMM) ? C_O2_I4(r, r, 0, 1, ri, r) : C_O2_I4(r, r, 0, 1, r, r)); case INDEX_op_add2_i64: case INDEX_op_sub2_i64: - return (s390_facilities & FACILITY_EXT_IMM + return (HAVE_FACILITY(EXT_IMM) ? C_O2_I4(r, r, 0, 1, rA, r) : C_O2_I4(r, r, 0, 1, r, r)); @@ -2424,13 +2423,12 @@ static void query_s390_facilities(void) /* Is STORE FACILITY LIST EXTENDED available? Honestly, I believe this is present on all 64-bit systems, but let's check for it anyway. */ if (hwcap & HWCAP_S390_STFLE) { - register int r0 __asm__("0"); - register void *r1 __asm__("1"); + register int r0 __asm__("0") = ARRAY_SIZE(s390_facilities) - 1; + register void *r1 __asm__("1") = s390_facilities; /* stfle 0(%r1) */ - r1 = &s390_facilities; asm volatile(".word 0xb2b0,0x1000" - : "=r"(r0) : "0"(0), "r"(r1) : "memory", "cc"); + : "=r"(r0) : "r"(r0), "r"(r1) : "memory", "cc"); } } From patchwork Fri Dec 25 20:19:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352297 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7944986jai; Fri, 25 Dec 2020 12:24:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxm5sPIR0PjCpsXFXIup9y0gWwh+S/DJWT8s0/THvd74UB9Hj+Z4P2AO5NyGkD6Yil2C9gG X-Received: by 2002:a25:ab30:: with SMTP id u45mr49440582ybi.516.1608927898500; Fri, 25 Dec 2020 12:24:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608927898; cv=none; d=google.com; s=arc-20160816; b=aMOmOzHaa+nnC77Mb7Kznsdw8V8C3SHS+WODog/9OHRrFDo8H3a9lGOoemVVfus3d0 jY05+uC1+grSpP4il9dZHbkUJdmsR96pojsDarcZ1aYP2m72up7ifbSOGJg2XhAcbfBL R5WMzFUBmjw+2tyU26lKgvIbHwkfVOMBaDQsV8IlkLRunGTWyJeq+kfoDsEU+QEKG6XU 8CNk7/QhuDlRUhIvTp8GIY/hqT3jJg1wTW7OVmFGvEZPM17CuZ5wIyEmD6WoAUiuWhA0 wgJ315Iov4rzhHX6mFmUVh4Y6JD/44yXW1QLm9lXyxpyezsTyMgeF+fc690OYcs0qBqU RSyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=8HiXBeIwsexO2t9WEInvhxfOSjvRfRmoEdDEiBM8nzc=; b=uI1qY185HjeXJAM0fWmsEciVhFdqF9ssG+Eqrw5Cdt3foQYfC4Yg10kvKoCjSs43uH I/qh3AYHsALoa0qCdYtLUHtIMNPSDFcNUsLX43scQ15lTmBmXoidQQwZ4Fi+I9IIOohR 8/6YPU/0pqKmQ6pDFVlOZS9ZzdRw7qIz9cy1fTabeMWztj40dlJ/u+gRxwCg2utIi9N5 QwsZCMtC3A+fO8fgPUpF3JTrKz/Hd0wXnAbDYywhypLpQwVw+1h786z/nLeZR6HHvZWJ PSXRoENnIfJOhzKvqGDsIWbe2ojwQet6NxE7tTYQOJKxFWLgBgQOZkruM/1dOuF47mDv e/xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ASk730HX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e124si26167669ybb.272.2020.12.25.12.24.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Dec 2020 12:24:58 -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=ASk730HX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kstdx-0006gx-Vf for patch@linaro.org; Fri, 25 Dec 2020 15:24:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kstZH-0002yx-PJ for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:07 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:54560) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kstZF-00059d-8R for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:07 -0500 Received: by mail-pj1-x102d.google.com with SMTP id f14so2675526pju.4 for ; Fri, 25 Dec 2020 12:20:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8HiXBeIwsexO2t9WEInvhxfOSjvRfRmoEdDEiBM8nzc=; b=ASk730HXYbzjZM81H6t8WObJVRPyrDXiEJEV51jAW2pBnSBrwizrivUZ7Ax75FYqQ0 oA+cUavBWlQ4yUvpgGOigfLY9EYTgOjQZsMq1vMZsve5c9i8NkrbFnyfDNTpXRJ0RSUN ChZnJu3QfOaGVEj7G7MPlLygzpUTXZepyOzJRLliWGC0nz4i6c+YmKOaAgWu1jvyHExm yzludOtlw5OmcW2LZ1NZns4LFNyG2aDcmg507bYpJmqIdeejrgGueKVutmqfZa+3RLbI RwYkrYtb0xxBoV13AmFKGMrNt2INEbqOwMrI+McYP/ekylFDTcBm2nelGQul7Qv8Gf6r Db+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8HiXBeIwsexO2t9WEInvhxfOSjvRfRmoEdDEiBM8nzc=; b=V5DDPdu1E6G0yayHbgf87vKxoh8JHzM9zCAvXBOOqfLAtwLXO2hj8+IPOkNneXPkSd 8npO7YvXyEXwSRKzroHEbQZCKTQO7rOaO+iRXK6E2N6wUnk36lFXTYEG1aYQc85w5S0Q 750d8Bk6Ah56FAqVtqtDlQsZJO8QxS3iJbK3NcNeenmd5eS7x8WTOp0itqKe/IFhaez3 NOWEVRGhvRKbhqINn5/7NIQgEsL+VJbVF2b8rMn7IUEXQKqR7k1XLb/5Qm7H66Q/eKTN smkW9vAcYSl923E/Bo9jus/m87ym2CmtErGleyHdkbGyUMDA+oCt1Jh/SoFT3SdvMtRa 1mAg== X-Gm-Message-State: AOAM532AO+fWfIfeHozykVO20DqdbujasPSFmdXWJY/1Ow8Za4/KDeFv wnvcV9pVQBrd1vqbtPLXwyutQHgjBhrO6A== X-Received: by 2002:a17:90a:4083:: with SMTP id l3mr9961015pjg.109.1608927601983; Fri, 25 Dec 2020 12:20:01 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id l8sm5816497pjt.32.2020.12.25.12.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:20:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 03/16] tcg/s390x: Merge TCG_AREG0 and TCG_REG_CALL_STACK into TCGReg Date: Fri, 25 Dec 2020 12:19:43 -0800 Message-Id: <20201225201956.692861-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201225201956.692861-1-richard.henderson@linaro.org> References: <20201225201956.692861-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" They are rightly values in the same enumeration. Reviewed-by: David Hildenbrand Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.h | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index 264c8c1e97..a78a2c4398 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -29,22 +29,13 @@ #define TCG_TARGET_TLB_DISPLACEMENT_BITS 19 typedef enum TCGReg { - TCG_REG_R0 = 0, - TCG_REG_R1, - TCG_REG_R2, - TCG_REG_R3, - TCG_REG_R4, - TCG_REG_R5, - TCG_REG_R6, - TCG_REG_R7, - TCG_REG_R8, - TCG_REG_R9, - TCG_REG_R10, - TCG_REG_R11, - TCG_REG_R12, - TCG_REG_R13, - TCG_REG_R14, - TCG_REG_R15 + TCG_REG_R0, TCG_REG_R1, TCG_REG_R2, TCG_REG_R3, + TCG_REG_R4, TCG_REG_R5, TCG_REG_R6, TCG_REG_R7, + TCG_REG_R8, TCG_REG_R9, TCG_REG_R10, TCG_REG_R11, + TCG_REG_R12, TCG_REG_R13, TCG_REG_R14, TCG_REG_R15, + + TCG_AREG0 = TCG_REG_R10, + TCG_REG_CALL_STACK = TCG_REG_R15 } TCGReg; #define TCG_TARGET_NB_REGS 16 @@ -135,7 +126,6 @@ extern uint64_t s390_facilities[1]; #define TCG_TARGET_HAS_mulsh_i64 0 /* used for function call generation */ -#define TCG_REG_CALL_STACK TCG_REG_R15 #define TCG_TARGET_STACK_ALIGN 8 #define TCG_TARGET_CALL_STACK_OFFSET 160 @@ -144,10 +134,6 @@ extern uint64_t s390_facilities[1]; #define TCG_TARGET_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) -enum { - TCG_AREG0 = TCG_REG_R10, -}; - static inline void flush_icache_range(uintptr_t start, uintptr_t stop) { } From patchwork Fri Dec 25 20:19:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352294 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7943769jai; Fri, 25 Dec 2020 12:21:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJz812mxbhwP+1IWVgBhKgyZRIiOcMUf5843EUdopfpVCQZCAZdjRSZ2ib3kZDEOK8kpMIfL X-Received: by 2002:a25:40d1:: with SMTP id n200mr48765327yba.266.1608927716453; Fri, 25 Dec 2020 12:21:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608927716; cv=none; d=google.com; s=arc-20160816; b=t3ZmqWJ9WKCk54pxSFbklcajlShprXMbRqGEgqcOIAlGvAWhWySJswzJScqwa6l3+5 VWp6bxKwfvcDXrwMi0tq2z2/lPfS2TGp5x4R2JqoTUiqe5eGstzeAmD2fip0WW55iAIe 1hmqYqZK2eOpjG/VE5OF9tZ+XcazzcrUb1K6WhDB0OtzdxgAbIgh0MIaLH5+nQGHPARy FE3jz83dZz2fgOwlSyGz1aiSXeD44qDugEhhjKeZfvaJf0cjaA0W2uDABIgpcM8XN4R8 RLZgkxgJUc9NgKOWgMmY7Hvc2M/u9J/f+hbL2exR1/783GZPS7CZW2z3ERU8iBbLt/RJ vbSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=FzoC1QPq31WRy5c5ZdFg7bCaExQg5zSJ21EOxJtQI+w=; b=qD0zmzCEtlEVbLYYmcQxr5LVcUmFQa7ZaKVd6P2X9aBYLJYH+CkQ484aqZgy4f/akX evMaKH+T7QLbthAcAiF0TQ4FekOib991TA37H5I3JRVMn2NzAZ/4yIw0CKNYTkmziuLi VfcHgqIQfsCrrJke/pXzX3xASrZkMVgjX2JHqBf2oAiBfmPpH5pYlwjN4lOiQGVv8sOt POhC80mJAZSmjLMudzrrclOrqdzOnLkOn6UQEjyd7dzN7pYUk2WJrImM67tSXL3dd2qx SQ04/7p1OfKF8ixgxTDbKoId8HPxUL/6tvWA5cj0HG2i/IHf9EdH/ENWjM6Wur10FWwz fuyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vpVEZQIm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 77si25033123ybc.401.2020.12.25.12.21.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Dec 2020 12: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=vpVEZQIm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kstb1-00032Y-R2 for patch@linaro.org; Fri, 25 Dec 2020 15:21:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kstZH-0002yn-Ah for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:07 -0500 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:38224) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kstZF-00059m-89 for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:07 -0500 Received: by mail-pj1-x102f.google.com with SMTP id j13so2854419pjz.3 for ; Fri, 25 Dec 2020 12:20:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=FzoC1QPq31WRy5c5ZdFg7bCaExQg5zSJ21EOxJtQI+w=; b=vpVEZQImeYJOxbj3v79KNIAcp9NYwSavmKF5JSZm7YWkM70szdxnNHSvttDgEmhBGq 69g1U7JPKtf+0UCGNaiz1R5sxyvR4zkei/c2pDKnVi79xTgmSa71B1Q7O/0zvwJWQfos xmyVrFaM4OZQlAQpMpWjTL0gz+RTVLsTMOgaTQ+RqG0uFZjBV7x+3++9qGBHvwiRcAhS Ih14keFiJ136XopI8oD/zamJP0YE+RLw68US2ze4S2wC6m1aN9EEYe0MEFlR+M8DhsY0 lAtghrHuyWJBUIxb6QvIm1p4IAC9e0w7B167IzFgaH5wGXl5vWPVHbWTfxQVMy4WqV8I i1nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FzoC1QPq31WRy5c5ZdFg7bCaExQg5zSJ21EOxJtQI+w=; b=N+WaOPUGGBQ0+6SqXE2jBkRmc1xzZ6BB9QDKCdDzNnwJAjIZYAZz2e0HpE5Xb9eGBW 6IZSZbOy/IZFzGwWdA+L/nVXbNrswAoL2cIviiWV/5/Qy7ihT80vXLKdV69Zo2M5FQkT UWXuxzvJbx8coVRwFAyGCOYR9ihDipy8HKGwV8J3wwqIz+0NU7DTgy4cVKtxZ4RxwyBI uHIKDQreiMHixDXxJv5qiwD5w1/Cu2P709DSDVmDwJF6XX1qPFzn9UG/vd4qMjDa6SGK KcyecL+5b40T4r4Qw8wSKsVe85SLzIPWgUv9WyjLhMIBkSIjS+039U2pIl3JZbKuOpJz pE3w== X-Gm-Message-State: AOAM532xNcHsAZSAnqDkmqhzSbplWuIDp8MnhFdjfqCztmXfYvAnlXpN 6LS+bkLeDUXwrzbUTDCYMQODbTinLURjxw== X-Received: by 2002:a17:90b:a04:: with SMTP id gg4mr10037839pjb.8.1608927602941; Fri, 25 Dec 2020 12:20:02 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id l8sm5816497pjt.32.2020.12.25.12.20.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:20:02 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 04/16] tcg/s390x: Add host vector framework Date: Fri, 25 Dec 2020 12:19:44 -0800 Message-Id: <20201225201956.692861-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201225201956.692861-1-richard.henderson@linaro.org> References: <20201225201956.692861-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.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.23 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" Add registers and function stubs. The functionality is disabled via squashing s390_facilities[2] to 0. We must still include results for the mandatory opcodes in tcg_target_op_def, as all opcodes are checked during tcg init. Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target-conset.h | 4 + tcg/s390x/tcg-target-constr.h | 1 + tcg/s390x/tcg-target.h | 35 ++++++++- tcg/s390x/tcg-target.opc.h | 12 +++ tcg/s390x/tcg-target.c.inc | 135 +++++++++++++++++++++++++++++++++- 5 files changed, 182 insertions(+), 5 deletions(-) create mode 100644 tcg/s390x/tcg-target.opc.h -- 2.25.1 diff --git a/tcg/s390x/tcg-target-conset.h b/tcg/s390x/tcg-target-conset.h index e68baabbfd..88d1ec349c 100644 --- a/tcg/s390x/tcg-target-conset.h +++ b/tcg/s390x/tcg-target-conset.h @@ -8,13 +8,17 @@ C_O0_I1(r) C_O0_I2(L, L) C_O0_I2(r, r) C_O0_I2(r, ri) +C_O0_I2(v, r) C_O1_I1(r, L) C_O1_I1(r, r) +C_O1_I1(v, r) +C_O1_I1(v, vr) C_O1_I2(r, 0, ri) C_O1_I2(r, 0, rI) C_O1_I2(r, 0, rJ) C_O1_I2(r, r, ri) C_O1_I2(r, rZ, r) +C_O1_I2(v, v, v) C_O1_I4(r, r, ri, r, 0) C_O1_I4(r, r, ri, rI, 0) C_O2_I2(b, a, 0, r) diff --git a/tcg/s390x/tcg-target-constr.h b/tcg/s390x/tcg-target-constr.h index 885e91e19b..8202312017 100644 --- a/tcg/s390x/tcg-target-constr.h +++ b/tcg/s390x/tcg-target-constr.h @@ -8,6 +8,7 @@ REGS('r', 0xffff) REGS('L', 0xffff & ~((1 << TCG_REG_R2) | (1 << TCG_REG_R3) | (1 << TCG_REG_R4))) REGS('a', 1u << TCG_REG_R2) REGS('b', 1u << TCG_REG_R3) +REGS('v', 0xffffffff00000000ull) CONST('A', TCG_CT_CONST_S33) CONST('I', TCG_CT_CONST_S16) diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index a78a2c4398..e61c376673 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -34,11 +34,20 @@ typedef enum TCGReg { TCG_REG_R8, TCG_REG_R9, TCG_REG_R10, TCG_REG_R11, TCG_REG_R12, TCG_REG_R13, TCG_REG_R14, TCG_REG_R15, + TCG_REG_V0 = 32, TCG_REG_V1, TCG_REG_V2, TCG_REG_V3, + TCG_REG_V4, TCG_REG_V5, TCG_REG_V6, TCG_REG_V7, + TCG_REG_V8, TCG_REG_V9, TCG_REG_V10, TCG_REG_V11, + TCG_REG_V12, TCG_REG_V13, TCG_REG_V14, TCG_REG_V15, + TCG_REG_V16, TCG_REG_V17, TCG_REG_V18, TCG_REG_V19, + TCG_REG_V20, TCG_REG_V21, TCG_REG_V22, TCG_REG_V23, + TCG_REG_V24, TCG_REG_V25, TCG_REG_V26, TCG_REG_V27, + TCG_REG_V28, TCG_REG_V29, TCG_REG_V30, TCG_REG_V31, + TCG_AREG0 = TCG_REG_R10, TCG_REG_CALL_STACK = TCG_REG_R15 } TCGReg; -#define TCG_TARGET_NB_REGS 16 +#define TCG_TARGET_NB_REGS 64 /* A list of relevant facilities used by this translator. Some of these are required for proper operation, and these are checked at startup. */ @@ -51,8 +60,9 @@ typedef enum TCGReg { #define FACILITY_FAST_BCR_SER FACILITY_LOAD_ON_COND #define FACILITY_DISTINCT_OPS FACILITY_LOAD_ON_COND #define FACILITY_LOAD_ON_COND2 53 +#define FACILITY_VECTOR 129 -extern uint64_t s390_facilities[1]; +extern uint64_t s390_facilities[3]; #define HAVE_FACILITY(X) \ ((s390_facilities[FACILITY_##X / 64] >> (63 - FACILITY_##X % 64)) & 1) @@ -125,6 +135,27 @@ extern uint64_t s390_facilities[1]; #define TCG_TARGET_HAS_muluh_i64 0 #define TCG_TARGET_HAS_mulsh_i64 0 +#define TCG_TARGET_HAS_v64 HAVE_FACILITY(VECTOR) +#define TCG_TARGET_HAS_v128 HAVE_FACILITY(VECTOR) +#define TCG_TARGET_HAS_v256 0 + +#define TCG_TARGET_HAS_andc_vec 0 +#define TCG_TARGET_HAS_orc_vec 0 +#define TCG_TARGET_HAS_not_vec 0 +#define TCG_TARGET_HAS_neg_vec 0 +#define TCG_TARGET_HAS_abs_vec 0 +#define TCG_TARGET_HAS_roti_vec 0 +#define TCG_TARGET_HAS_rots_vec 0 +#define TCG_TARGET_HAS_rotv_vec 0 +#define TCG_TARGET_HAS_shi_vec 0 +#define TCG_TARGET_HAS_shs_vec 0 +#define TCG_TARGET_HAS_shv_vec 0 +#define TCG_TARGET_HAS_mul_vec 0 +#define TCG_TARGET_HAS_sat_vec 0 +#define TCG_TARGET_HAS_minmax_vec 0 +#define TCG_TARGET_HAS_bitsel_vec 0 +#define TCG_TARGET_HAS_cmpsel_vec 0 + /* used for function call generation */ #define TCG_TARGET_STACK_ALIGN 8 #define TCG_TARGET_CALL_STACK_OFFSET 160 diff --git a/tcg/s390x/tcg-target.opc.h b/tcg/s390x/tcg-target.opc.h new file mode 100644 index 0000000000..7a4578e9b4 --- /dev/null +++ b/tcg/s390x/tcg-target.opc.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2019 Linaro + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. + * + * See the COPYING file in the top-level directory for details. + * + * Target-specific opcodes for host vector expansion. These will be + * emitted by tcg_expand_vec_op. For those familiar with GCC internals, + * consider these to be UNSPEC with names. + */ diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 5a7e9d1dd5..6140385e4e 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -255,8 +255,13 @@ typedef enum S390Opcode { #ifdef CONFIG_DEBUG_TCG static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { - "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7", - "%r8", "%r9", "%r10" "%r11" "%r12" "%r13" "%r14" "%r15" + "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7", + "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + "%v0", "%v1", "%v2", "%v3", "%v4", "%v5", "%v6", "%v7", + "%v8", "%v9", "%v10", "%v11", "%v12", "%v13", "%v14", "%v15", + "%v16", "%v17", "%v18", "%v19", "%v20", "%v21", "%v22", "%v23", + "%v24", "%v25", "%v26", "%v27", "%v28", "%v29", "%v30", "%v31", }; #endif @@ -282,6 +287,32 @@ static const int tcg_target_reg_alloc_order[] = { TCG_REG_R4, TCG_REG_R3, TCG_REG_R2, + + /* V8-V15 are call saved, and omitted. */ + TCG_REG_V0, + TCG_REG_V1, + TCG_REG_V2, + TCG_REG_V3, + TCG_REG_V4, + TCG_REG_V5, + TCG_REG_V6, + TCG_REG_V7, + TCG_REG_V16, + TCG_REG_V17, + TCG_REG_V18, + TCG_REG_V19, + TCG_REG_V20, + TCG_REG_V21, + TCG_REG_V22, + TCG_REG_V23, + TCG_REG_V24, + TCG_REG_V25, + TCG_REG_V26, + TCG_REG_V27, + TCG_REG_V28, + TCG_REG_V29, + TCG_REG_V30, + TCG_REG_V31, }; static const int tcg_target_call_iarg_regs[] = { @@ -364,7 +395,7 @@ static void * const qemu_st_helpers[16] = { #endif static tcg_insn_unit *tb_ret_addr; -uint64_t s390_facilities[1]; +uint64_t s390_facilities[3]; static bool patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) @@ -2271,6 +2302,42 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, } } +static bool tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece, + TCGReg dst, TCGReg src) +{ + g_assert_not_reached(); +} + +static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, + TCGReg dst, TCGReg base, intptr_t offset) +{ + g_assert_not_reached(); +} + +static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, + TCGReg dst, int64_t val) +{ + g_assert_not_reached(); +} + +static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, + unsigned vecl, unsigned vece, + const TCGArg *args, const int *const_args) +{ + g_assert_not_reached(); +} + +int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) +{ + return 0; +} + +void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, + TCGArg a0, ...) +{ + g_assert_not_reached(); +} + static int tcg_target_op_def(TCGOpcode op) { switch (op) { @@ -2411,11 +2478,34 @@ static int tcg_target_op_def(TCGOpcode op) ? C_O2_I4(r, r, 0, 1, rA, r) : C_O2_I4(r, r, 0, 1, r, r)); + case INDEX_op_st_vec: + return C_O0_I2(v, r); + case INDEX_op_ld_vec: + case INDEX_op_dupm_vec: + return C_O1_I1(v, r); + case INDEX_op_dup_vec: + return C_O1_I1(v, vr); + case INDEX_op_add_vec: + case INDEX_op_sub_vec: + case INDEX_op_and_vec: + case INDEX_op_or_vec: + case INDEX_op_xor_vec: + case INDEX_op_cmp_vec: + return C_O1_I2(v, v, v); + default: g_assert_not_reached(); } } +/* + * Mainline glibc added HWCAP_S390_VX before it was kernel abi. + * Some distros have fixed this up locally, others have not. + */ +#ifndef HWCAP_S390_VXRS +#define HWCAP_S390_VXRS 2048 +#endif + static void query_s390_facilities(void) { unsigned long hwcap = qemu_getauxval(AT_HWCAP); @@ -2430,6 +2520,16 @@ static void query_s390_facilities(void) asm volatile(".word 0xb2b0,0x1000" : "=r"(r0) : "r"(r0), "r"(r1) : "memory", "cc"); } + + /* + * Use of vector registers requires os support beyond the facility bit. + * If the kernel does not advertise support, disable the facility bits. + * There is nothing else we currently care about in the 3rd word, so + * disable VECTOR with one store. + */ + if (1 || !(hwcap & HWCAP_S390_VXRS)) { + s390_facilities[2] = 0; + } } static void tcg_target_init(TCGContext *s) @@ -2438,6 +2538,10 @@ static void tcg_target_init(TCGContext *s) tcg_target_available_regs[TCG_TYPE_I32] = 0xffff; tcg_target_available_regs[TCG_TYPE_I64] = 0xffff; + if (HAVE_FACILITY(VECTOR)) { + tcg_target_available_regs[TCG_TYPE_V64] = 0xffffffff00000000ull; + tcg_target_available_regs[TCG_TYPE_V128] = 0xffffffff00000000ull; + } tcg_target_call_clobber_regs = 0; tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_R0); @@ -2452,6 +2556,31 @@ static void tcg_target_init(TCGContext *s) /* The return register can be considered call-clobbered. */ tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_R14); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V0); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V1); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V2); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V3); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V4); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V5); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V6); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V7); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V16); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V17); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V18); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V19); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V20); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V21); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V22); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V23); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V24); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V25); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V26); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V27); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V28); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V29); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V30); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_V31); + s->reserved_regs = 0; tcg_regset_set_reg(s->reserved_regs, TCG_TMP0); /* XXX many insns can't be used with R0, so we better avoid it for now */ From patchwork Fri Dec 25 20:19:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352301 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7945915jai; Fri, 25 Dec 2020 12:27:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSC/S8CpW7FANgFWyRjYrm1po3BooqaB5KP9jrkzkMGPOkXJkhagE6g3MbzJzPtSKkxHXI X-Received: by 2002:a25:da56:: with SMTP id n83mr50802899ybf.265.1608928055734; Fri, 25 Dec 2020 12:27:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608928055; cv=none; d=google.com; s=arc-20160816; b=kXHrHXvzasQbW9PGndEXe5+yFY3OIaXdE0IzYFQz0PiZIHyguCnvrb80KR32PdJkFg FJFuIPEdu8viLqWD1g0OyYYhJ19Q3njadU4WStkdnwZmJE77UbJUmXKWRRW4VmtC9Iqz j8J2eU40SiL8/RLnlQaqBvBw15HiMZEp/pzeq/5s6TS7y50foNbqaTpUFs6hVaUQFmuw jYIHbVQhfY/dila0IdHHiNV6d1Xpma1shwO7Wgv56FbD4150Un4q7C9xt7E5e+Ny5tqt nNLpinTvMQ8DPA9Qmu54yTqarCYO7tmEYlx5fRMRXlgsrPPxUMQKn8TKhtQDwxAUdUG6 WPNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=VXmyEYzdYmPuTOx3NJVtk+/Y1Dnx3UzO+mJ+oYiTdRI=; b=jVZdw8VAVwTKIbPwDYSW060AGoT8ePszugLhx95ZGqg9YTYK1mR5Ez1Ju9s0/+W0rk uKaivj/oaIThiqavGJGgEUyC0sQhDX0fy1aBwJpRqNtuIuawho21XY3lj+GAYLKMxCNr 3A4v5Br2QcuipFnPraK2no4Jj6t5vmtZ/W9nGxzTRUzITh395pK4Y159KFq5gaeD8lwB TSUgkP0/W/ZirKtypb+k7vWJ+bce9mVukxC15phijRxJX+m6Xr/hjaTwxK4G2kmjSmbx WvPvauD+0cJQtaASgZmSkiduqDf5WDHXShkv9MCt0alO7tebivdUrLSOOe7Y2gZl6h/x wc5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gDNcdOOi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n197si27835700ybg.488.2020.12.25.12.27.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Dec 2020 12:27: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=gDNcdOOi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kstgV-0001lE-58 for patch@linaro.org; Fri, 25 Dec 2020 15:27:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kstZI-0002zJ-6C for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:08 -0500 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:36803) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kstZF-00059q-Bs for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:07 -0500 Received: by mail-pl1-x633.google.com with SMTP id j1so2730492pld.3 for ; Fri, 25 Dec 2020 12:20:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=VXmyEYzdYmPuTOx3NJVtk+/Y1Dnx3UzO+mJ+oYiTdRI=; b=gDNcdOOitM98DUvzBebltt3ekox2HBxtkgCaRY+Sq2z1nBjYmbctc8H/joG93vubdM YkLdZYo6LR725g5QcdVvdUq2gfP1TWmuvcUEWSj45FLBa3/3l6ttlyJ5PM1p9lIqmY7Q /GWVv9JTI3RdC43xigSzKflZ5ZSANbH51yi/8mudpupmD9Q719LtTNvMB4RkYfAHbrrX Cqn0g2HNOC+1jQwmfs6p9hQY9YTRcsqq2UYQ7UBW0kaEaOqlNCj2SbbJOKRzwqwltHQM l/NOlOgQf0M2zl+blVCmGjWOuLQBoo+ifz+1knI1dTtFsRLW0HWNL4iSwPXEJweiokev Aoag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VXmyEYzdYmPuTOx3NJVtk+/Y1Dnx3UzO+mJ+oYiTdRI=; b=Z00CaBOToUFt8Crohp38a2b+/Gw3Y3WYErJb57P3gfIqK2LNO73P5VTbTZCxvuwOCq U2RrbKXVr2hU1u6GWWARNrYnQkVqGl9UlhVhb1BvYZz0L24XE2pZAOSpfr5Wx7kJlbkN +JWgSHPbNbiYctl4S1J6PEKWQkoZyQGoUAGDdNSmF34g6hmaxWrvb4TysiTxbE1uvNTn HGaqlvtuBayJ4hljh14ToUXGQtEG9qnuE158P3in4lgIM8Nt7ha1G7crMTpjyefOi5Oh cKBkviHEo7r7L6vXFELxbUxwHA9KGW+BCBEdMAotSdC+TD1fSy5A/r9BTO0r+NZhheHW C+MQ== X-Gm-Message-State: AOAM533SaW9qs1Bg77O2Sb1dtxOBfCkxrTrccu30lpSefPzoEZayhyh/ QdzhtDDLJAAxHR9N/bKMyKrtmHv2V4w/kw== X-Received: by 2002:a17:90a:c082:: with SMTP id o2mr10106229pjs.197.1608927603815; Fri, 25 Dec 2020 12:20:03 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id l8sm5816497pjt.32.2020.12.25.12.20.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:20:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 05/16] tcg/s390x: Implement tcg_out_ld/st for vector types Date: Fri, 25 Dec 2020 12:19:45 -0800 Message-Id: <20201225201956.692861-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201225201956.692861-1-richard.henderson@linaro.org> References: <20201225201956.692861-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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.23 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" Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 117 +++++++++++++++++++++++++++++++++---- 1 file changed, 105 insertions(+), 12 deletions(-) -- 2.25.1 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 6140385e4e..bae70b9119 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -250,6 +250,12 @@ typedef enum S390Opcode { RX_STC = 0x42, RX_STH = 0x40, + VRX_VL = 0xe706, + VRX_VLLEZ = 0xe704, + VRX_VST = 0xe70e, + VRX_VSTEF = 0xe70b, + VRX_VSTEG = 0xe70a, + NOP = 0x0707, } S390Opcode; @@ -516,6 +522,26 @@ static void tcg_out_insn_RSY(TCGContext *s, S390Opcode op, TCGReg r1, #define tcg_out_insn_RX tcg_out_insn_RS #define tcg_out_insn_RXY tcg_out_insn_RSY +static int RXB(TCGReg v1, TCGReg v2, TCGReg v3, TCGReg v4) +{ + return ((v1 & 16) << (7 - 3)) + | ((v2 & 16) << (6 - 3)) + | ((v3 & 16) << (5 - 3)) + | ((v4 & 16) << (4 - 3)); +} + +static void tcg_out_insn_VRX(TCGContext *s, S390Opcode op, TCGReg v1, + TCGReg b2, TCGReg x2, intptr_t d2, int m3) +{ + tcg_debug_assert(v1 >= TCG_REG_V0 && v1 <= TCG_REG_V31); + tcg_debug_assert(d2 >= 0 && d2 <= 0xfff); + tcg_debug_assert(x2 <= TCG_REG_R15); + tcg_debug_assert(b2 <= TCG_REG_R15); + tcg_out16(s, (op & 0xff00) | ((v1 & 15) << 4) | x2); + tcg_out16(s, (b2 << 12) | d2); + tcg_out16(s, (op & 0x00ff) | RXB(v1, 0, 0, 0) | (m3 << 12)); +} + /* Emit an opcode with "type-checking" of the format. */ #define tcg_out_insn(S, FMT, OP, ...) \ glue(tcg_out_insn_,FMT)(S, glue(glue(FMT,_),OP), ## __VA_ARGS__) @@ -692,25 +718,92 @@ static void tcg_out_mem(TCGContext *s, S390Opcode opc_rx, S390Opcode opc_rxy, } } +static void tcg_out_vrx_mem(TCGContext *s, S390Opcode opc_vrx, + TCGReg data, TCGReg base, TCGReg index, + tcg_target_long ofs, int m3) +{ + if (ofs < 0 || ofs >= 0x1000) { + if (ofs >= -0x80000 && ofs < 0x80000) { + tcg_out_insn(s, RXY, LAY, TCG_TMP0, base, index, ofs); + base = TCG_TMP0; + index = TCG_REG_NONE; + ofs = 0; + } else { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_TMP0, ofs); + if (index != TCG_REG_NONE) { + tcg_out_insn(s, RRE, AGR, TCG_TMP0, index); + } + index = TCG_TMP0; + ofs = 0; + } + } + tcg_out_insn_VRX(s, opc_vrx, data, base, index, ofs, m3); +} /* load data without address translation or endianness conversion */ -static inline void tcg_out_ld(TCGContext *s, TCGType type, TCGReg data, - TCGReg base, intptr_t ofs) +static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg data, + TCGReg base, intptr_t ofs) { - if (type == TCG_TYPE_I32) { - tcg_out_mem(s, RX_L, RXY_LY, data, base, TCG_REG_NONE, ofs); - } else { - tcg_out_mem(s, 0, RXY_LG, data, base, TCG_REG_NONE, ofs); + switch (type) { + case TCG_TYPE_I32: + if (likely(data < 16)) { + tcg_out_mem(s, RX_L, RXY_LY, data, base, TCG_REG_NONE, ofs); + break; + } + tcg_out_vrx_mem(s, VRX_VLLEZ, data, base, TCG_REG_NONE, ofs, MO_32); + break; + + case TCG_TYPE_I64: + if (likely(data < 16)) { + tcg_out_mem(s, 0, RXY_LG, data, base, TCG_REG_NONE, ofs); + break; + } + /* fallthru */ + + case TCG_TYPE_V64: + tcg_out_vrx_mem(s, VRX_VLLEZ, data, base, TCG_REG_NONE, ofs, MO_64); + break; + + case TCG_TYPE_V128: + /* Hint quadword aligned. */ + tcg_out_vrx_mem(s, VRX_VL, data, base, TCG_REG_NONE, ofs, 4); + break; + + default: + g_assert_not_reached(); } } -static inline void tcg_out_st(TCGContext *s, TCGType type, TCGReg data, - TCGReg base, intptr_t ofs) +static void tcg_out_st(TCGContext *s, TCGType type, TCGReg data, + TCGReg base, intptr_t ofs) { - if (type == TCG_TYPE_I32) { - tcg_out_mem(s, RX_ST, RXY_STY, data, base, TCG_REG_NONE, ofs); - } else { - tcg_out_mem(s, 0, RXY_STG, data, base, TCG_REG_NONE, ofs); + switch (type) { + case TCG_TYPE_I32: + if (likely(data < 16)) { + tcg_out_mem(s, RX_ST, RXY_STY, data, base, TCG_REG_NONE, ofs); + } else { + tcg_out_vrx_mem(s, VRX_VSTEF, data, base, TCG_REG_NONE, ofs, 1); + } + break; + + case TCG_TYPE_I64: + if (likely(data < 16)) { + tcg_out_mem(s, 0, RXY_STG, data, base, TCG_REG_NONE, ofs); + break; + } + /* fallthru */ + + case TCG_TYPE_V64: + tcg_out_vrx_mem(s, VRX_VSTEG, data, base, TCG_REG_NONE, ofs, 0); + break; + + case TCG_TYPE_V128: + /* Hint quadword aligned. */ + tcg_out_vrx_mem(s, VRX_VST, data, base, TCG_REG_NONE, ofs, 4); + break; + + default: + g_assert_not_reached(); } } From patchwork Fri Dec 25 20:19:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352302 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7946433jai; Fri, 25 Dec 2020 12:29:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJx7nn/oXAwjtJYSLZGeDfNTK+SWAviATc0FjOqT/Hr+ju9J162TnFYfT3Z3DKy8FeZeSQWR X-Received: by 2002:a05:6902:6c6:: with SMTP id m6mr49242368ybt.348.1608928156070; Fri, 25 Dec 2020 12:29:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608928156; cv=none; d=google.com; s=arc-20160816; b=M3OiVUSEPZ1IJki8AynLC1tLehQRWvvX+jprZC1ExstZzG9rXFFfKX/tLaAHEisN5n qMktjFJ+fVDsqU/ehzOhuaQcC6GE/p5/Q5r4VmeicyitrLpQraI5T3PEHZ3jF0VP3hf+ dXAG9wcld+Th5ZpmfgIM2R7sjeoKZjXe/tK+Fo3UIwoou1xzg97JNW0EHQn2TT+vcQST fn0CMmPfN/oIczEbOPysm4TNLFTA4dI3h3dh+TfX6VWpdd6OsVkvSuVzMUXdX/X/l1AW 8j8o5MhQrbNoC00cZ6y7Wk6GQaoCq1/lz6x+FnEQJ1g7lr7knpEG+uDFZe91cC/lAMYs nnNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=xtPkJYSqxzCzENf0a3Xp5948v1FzYU34Jldab6lT+9g=; b=A2ElGHJQhIuhjVxEQcSSJjH3rPiqsPyOvD6WyiD95XAiJT+rqvcbCsKXoePv3W7kmQ xeMp+yAfjHRMMDgpa4ERTjCPbvTD4vdn7UrgmN5NI6tR7Dh91GGwaZUYu6CcEi4IYOxy Wj5bTYbITtPaS5YyvqhMDI6aqWjD2NjuUFRGDKJ3gzTHWDmsc5kU5wZMVW8B3JPDJvCO 3wNOJZmmnznIiqKAWTiC+vknXSK/eH3TxUHdZa26VWr+vmnSIsjAgby+J1wdXBC0f7Qu CfDxwVJw56shb3MweuOLc0KD4m0/Qut9yMJp353H7YcvI+L38XMlDzoqOoqoW8+N07S1 j1TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n6BLIuCf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p187si27321667yba.163.2020.12.25.12.29.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Dec 2020 12:29: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=n6BLIuCf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksti7-0004ST-FG for patch@linaro.org; Fri, 25 Dec 2020 15:29:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kstZJ-00030l-Kf for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:09 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:33324) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kstZG-0005AC-I4 for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:09 -0500 Received: by mail-pl1-x635.google.com with SMTP id b8so2737026plx.0 for ; Fri, 25 Dec 2020 12:20:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=xtPkJYSqxzCzENf0a3Xp5948v1FzYU34Jldab6lT+9g=; b=n6BLIuCf9moEbOGcTNNM9o7UYB518FWCvhhYUMUUONvP0mvuDHm+TIRrwb0XiGBH5K gmguTwv/3py8S6NG/gNV3934gBYejS0nXx1DgRcTMAG2b42mf6QoBO/jw62/aJWRfz4z gCSKYtLDoQp/cFRVZSRwUw/E4QfTx+YYFfIZH8umKZY5Dw0APSNHeTHqi2y7jNCrh10X UrmJuWrdc2rE19Aw101Kme8OBIg2Og3HjjGHAt5IYgjcLea3nAoLb2bgiCK9tegwFJ0e Q2ukMF3lN7JAv8hxjkKTEjhRj3Z/F0wcC6StrSUuJDgjfTzJVAYJeKDLcgneZS+hTXBO RH5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xtPkJYSqxzCzENf0a3Xp5948v1FzYU34Jldab6lT+9g=; b=JHoximL5qQydux9cMgwR+AIqIZsInow0jqzTjJFBpqD9Cb7XnJoxljqSPcSuZ/aQoH nN9L2Zt+zi+t0ucuD8je1quSOA4ETZ07RnZideL3LkTVbXI/XY9Vi2LLImfwWzxtsW1r QmAnA6ei+BPlXXfeEAXX82LcROxS4WaSQvfpacI5XwBjEyKR9czuQvaHmos2Eid8NUVR a5CBIERzJqcIy/VsNF5DG2GJ7cfuqtqDU+C1Q6Cbgx5Q07XP8D0Y6DgP/s3QJ7VqnHmu s6SBRlyucmnaZ81+3QNA/UqsiHAuxWIk2d6nVj2Bol7juAWAQj4sEc6YpwbOrsk+ZDhj s9Gg== X-Gm-Message-State: AOAM531r1jwhDJ/uz5P9RzI8tsaw0CQX2lWLey6X1AkyXvCztKLgPNfX aTycbgDtDQujYiWtxDjeMqtNBD0jU7rf3A== X-Received: by 2002:a17:90b:2282:: with SMTP id kx2mr9674644pjb.77.1608927605083; Fri, 25 Dec 2020 12:20:05 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id l8sm5816497pjt.32.2020.12.25.12.20.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:20:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 06/16] tcg/s390x: Implement tcg_out_mov for vector types Date: Fri, 25 Dec 2020 12:19:46 -0800 Message-Id: <20201225201956.692861-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201225201956.692861-1-richard.henderson@linaro.org> References: <20201225201956.692861-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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.23 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" Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 72 +++++++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index bae70b9119..50113dbdd7 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -250,6 +250,11 @@ typedef enum S390Opcode { RX_STC = 0x42, RX_STH = 0x40, + VRRa_VLR = 0xe756, + + VRSb_VLVG = 0xe722, + VRSc_VLGV = 0xe721, + VRX_VL = 0xe706, VRX_VLLEZ = 0xe704, VRX_VST = 0xe70e, @@ -530,6 +535,39 @@ static int RXB(TCGReg v1, TCGReg v2, TCGReg v3, TCGReg v4) | ((v4 & 16) << (4 - 3)); } +static void tcg_out_insn_VRRa(TCGContext *s, S390Opcode op, + TCGReg v1, TCGReg v2, int m3) +{ + tcg_debug_assert(v1 >= TCG_REG_V0 && v1 <= TCG_REG_V31); + tcg_debug_assert(v2 >= TCG_REG_V0 && v2 <= TCG_REG_V31); + tcg_out16(s, (op & 0xff00) | ((v1 & 15) << 4) | (v2 & 15)); + tcg_out32(s, (op & 0x00ff) | RXB(v1, v2, 0, 0) | (m3 << 12)); +} + +static void tcg_out_insn_VRSb(TCGContext *s, S390Opcode op, TCGReg v1, + intptr_t d2, TCGReg b2, TCGReg r3, int m4) +{ + tcg_debug_assert(v1 >= TCG_REG_V0 && v1 <= TCG_REG_V31); + tcg_debug_assert(d2 >= 0 && d2 <= 0xfff); + tcg_debug_assert(b2 <= TCG_REG_R15); + tcg_debug_assert(r3 <= TCG_REG_R15); + tcg_out16(s, (op & 0xff00) | ((v1 & 15) << 4) | r3); + tcg_out16(s, b2 << 12 | d2); + tcg_out16(s, (op & 0x00ff) | RXB(v1, 0, 0, 0) | (m4 << 12)); +} + +static void tcg_out_insn_VRSc(TCGContext *s, S390Opcode op, TCGReg r1, + intptr_t d2, TCGReg b2, TCGReg v3, int m4) +{ + tcg_debug_assert(r1 <= TCG_REG_R15); + tcg_debug_assert(d2 >= 0 && d2 <= 0xfff); + tcg_debug_assert(b2 <= TCG_REG_R15); + tcg_debug_assert(v3 >= TCG_REG_V0 && v3 <= TCG_REG_V31); + tcg_out16(s, (op & 0xff00) | (r1 << 4) | (v3 & 15)); + tcg_out16(s, b2 << 12 | d2); + tcg_out16(s, (op & 0x00ff) | RXB(0, 0, v3, 0) | (m4 << 12)); +} + static void tcg_out_insn_VRX(TCGContext *s, S390Opcode op, TCGReg v1, TCGReg b2, TCGReg x2, intptr_t d2, int m3) { @@ -563,12 +601,38 @@ static void tcg_out_sh32(TCGContext* s, S390Opcode op, TCGReg dest, static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg dst, TCGReg src) { - if (src != dst) { - if (type == TCG_TYPE_I32) { + if (src == dst) { + return true; + } + switch (type) { + case TCG_TYPE_I32: + if (likely(dst < 16 && src < 16)) { tcg_out_insn(s, RR, LR, dst, src); - } else { - tcg_out_insn(s, RRE, LGR, dst, src); + break; } + /* fallthru */ + + case TCG_TYPE_I64: + if (likely(dst < 16)) { + if (likely(src < 16)) { + tcg_out_insn(s, RRE, LGR, dst, src); + } else { + tcg_out_insn(s, VRSc, VLGV, dst, 0, 0, src, 3); + } + break; + } else if (src < 16) { + tcg_out_insn(s, VRSb, VLVG, dst, 0, 0, src, 3); + break; + } + /* fallthru */ + + case TCG_TYPE_V64: + case TCG_TYPE_V128: + tcg_out_insn(s, VRRa, VLR, dst, src, 0); + break; + + default: + g_assert_not_reached(); } return true; } From patchwork Fri Dec 25 20:19:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352295 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7943776jai; Fri, 25 Dec 2020 12:21:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxnDMSL9okeXgz0eGjyb/rZ0pr1bWM4xVolrHNK/xMjY5YMzpcqDtrtE8jpnAxvQHNB+xtx X-Received: by 2002:a25:3206:: with SMTP id y6mr49502624yby.127.1608927717826; Fri, 25 Dec 2020 12:21:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608927717; cv=none; d=google.com; s=arc-20160816; b=m+o009W+77RwIWwXChR8bMBYN49N4iGC+3xmFFIPzwwT2PJ0YjmrKrNEaXwNWcYjp4 ML1Occ+KZnv9mOraiPjCbus9vH/VrYZVI37AUMgxAxVzTN7AuRDI5SuT5+AJUbo0eJrK pGSs6+oXCgmitKkbtC/Pixi19/0Ieb7ldlLr+Ulx9hsuBwE6T/vG2YX4XnnGvzcZVvua p6mg0xRX/6Ak1ImQgG1uMoo28+b8g7T0vc5pTEhOttfilsGagIh2IF5A7NKKceTKUvHm 6bbwfdGHq4TRc127tOFNYpD/syrc6owa/0kBC1w4mVT14zKg7qA4O6XAyi2n+fVdnsfp prxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ybgxSgF17wnGwAL3lO0iHlUSyPDecVyF741ftLcDrKk=; b=LxrOkOxjCpRKHXkzza4yUrYMqpRd8DcGQGQyBeC4kt2LRbOqFiGsYt2NMjsHfzmX1e j2S600tRRZlLU2ln8nFj75Jkwd4/uLZzDXTXfZ9qyWA8YqFORQBXhWzVHLZ3DBcSeqxC qVTuUbShFnG9C2FMgV4skTXVuLZtu13xizOxxQniN1XTs/G8DXbzpqmhUEap4VHMEuw/ lyA2kZhRhTzu50A7rLTGsMaK18UkkX6dFG6zE9PKS9rfJVIiWvMue6tSKl6WRfkJtmDR QcgYbIn9Mqq9qXaSD55oZdz/ExNL6W0yyH6I/dpHIA4x1AVnJHREDJvHk8jaFrdZHnLw muwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WDTF/oC8"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m193si33801651ybf.253.2020.12.25.12.21.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Dec 2020 12:21:57 -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="WDTF/oC8"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kstb3-00036R-9G for patch@linaro.org; Fri, 25 Dec 2020 15:21:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kstZL-00032s-D9 for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:11 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:53072) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kstZH-0005BC-SV for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:11 -0500 Received: by mail-pj1-x102d.google.com with SMTP id v1so2680476pjr.2 for ; Fri, 25 Dec 2020 12:20:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ybgxSgF17wnGwAL3lO0iHlUSyPDecVyF741ftLcDrKk=; b=WDTF/oC8Qy6eTqsc+72CsrZYboaWQ0kMkvA8ywA/wGxGKzhVSgpJPHu92X5oZjfYBP aIGy4dUTnOO6JVppyZnLsVc79P5NifbVRt0oNJ/zdh9j5zHrulyMFGNzWMdjkYvchjXc nzYX8xZ8l0FoExdE8AcXYpoNyfzcECkB9N4N5YFI35C3RIs8XZB/0bkYkWvykd2JD55/ Xb1JNOrls/azbTmMf64pj54NX6lJakE5nbXSWXdiluUq3I9nAFXvaXpxjk3qU23mwUfs 88CjcYFktn3MSyqv41ygoqIikjo59+d0SReAx4vn2QYH/qGlHpM+QbfNKIZ+bXfFEB3s BP8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ybgxSgF17wnGwAL3lO0iHlUSyPDecVyF741ftLcDrKk=; b=naHXzdMccaQKFFn2ljLyDob7KfMYV/3kMtF9atFoHl0oRbTLsfRDkKmJMl9u2cFfKU 781TnqfQP8ezbPScZgnqZp/5zRj3xT1SREhROXk6gmQe+rWPaR3wH10fUCZO/Qq5sYyB 1E6o2dplfnDoLYhXStzCaSKkPqbM/ZQLnvE86NDyUkGVhJfUaknu965jwIBweux20eH4 0GhXdWxeysnjmvviXAGYKD67sR+4lkhipubjWRTtIBvntmet7iPB3p2Q03rTpJdcaG94 soEnt0Br3Fkxfx/P1OMwA1THNI5EJUymyXJp+/7qWqntTrLULT7bphLirjy15ElHrDFT wOXw== X-Gm-Message-State: AOAM531p98KOGbWUOFDxWMDUe5W0OOwfnWiDy7UKnbCJkm2PI7hKjhAd fDpGkhLcWa9GdYiU/fiCvFURQUtw0ZFbew== X-Received: by 2002:a17:90a:c085:: with SMTP id o5mr10082704pjs.210.1608927606283; Fri, 25 Dec 2020 12:20:06 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id l8sm5816497pjt.32.2020.12.25.12.20.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:20:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 07/16] tcg/s390x: Implement tcg_out_dup*_vec Date: Fri, 25 Dec 2020 12:19:47 -0800 Message-Id: <20201225201956.692861-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201225201956.692861-1-richard.henderson@linaro.org> References: <20201225201956.692861-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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.23 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" Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 122 ++++++++++++++++++++++++++++++++++++- 1 file changed, 119 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 50113dbdd7..808d50190f 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -250,13 +250,20 @@ typedef enum S390Opcode { RX_STC = 0x42, RX_STH = 0x40, + VRIa_VGBM = 0xe744, + VRIa_VREPI = 0xe745, + VRIb_VGM = 0xe746, + VRIc_VREP = 0xe74d, + VRRa_VLR = 0xe756, + VRRf_VLVGP = 0xe762, VRSb_VLVG = 0xe722, VRSc_VLGV = 0xe721, VRX_VL = 0xe706, VRX_VLLEZ = 0xe704, + VRX_VLREP = 0xe705, VRX_VST = 0xe70e, VRX_VSTEF = 0xe70b, VRX_VSTEG = 0xe70a, @@ -535,6 +542,34 @@ static int RXB(TCGReg v1, TCGReg v2, TCGReg v3, TCGReg v4) | ((v4 & 16) << (4 - 3)); } +static void tcg_out_insn_VRIa(TCGContext *s, S390Opcode op, + TCGReg v1, uint16_t i2, int m3) +{ + tcg_debug_assert(v1 >= TCG_REG_V0 && v1 <= TCG_REG_V31); + tcg_out16(s, (op & 0xff00) | ((v1 & 15) << 4)); + tcg_out16(s, i2); + tcg_out16(s, (op & 0x00ff) | RXB(v1, 0, 0, 0) | (m3 << 12)); +} + +static void tcg_out_insn_VRIb(TCGContext *s, S390Opcode op, + TCGReg v1, uint8_t i2, uint8_t i3, int m4) +{ + tcg_debug_assert(v1 >= TCG_REG_V0 && v1 <= TCG_REG_V31); + tcg_out16(s, (op & 0xff00) | ((v1 & 15) << 4)); + tcg_out16(s, (i2 << 8) | (i3 & 0xff)); + tcg_out16(s, (op & 0x00ff) | RXB(v1, 0, 0, 0) | (m4 << 12)); +} + +static void tcg_out_insn_VRIc(TCGContext *s, S390Opcode op, + TCGReg v1, uint16_t i2, TCGReg v3, int m4) +{ + tcg_debug_assert(v1 >= TCG_REG_V0 && v1 <= TCG_REG_V31); + tcg_debug_assert(v3 >= TCG_REG_V0 && v3 <= TCG_REG_V31); + tcg_out16(s, (op & 0xff00) | ((v1 & 15) << 4) | (v3 & 15)); + tcg_out16(s, i2); + tcg_out16(s, (op & 0x00ff) | RXB(v1, 0, v3, 0) | (m4 << 12)); +} + static void tcg_out_insn_VRRa(TCGContext *s, S390Opcode op, TCGReg v1, TCGReg v2, int m3) { @@ -544,6 +579,17 @@ static void tcg_out_insn_VRRa(TCGContext *s, S390Opcode op, tcg_out32(s, (op & 0x00ff) | RXB(v1, v2, 0, 0) | (m3 << 12)); } +static void tcg_out_insn_VRRf(TCGContext *s, S390Opcode op, + TCGReg v1, TCGReg r2, TCGReg r3) +{ + tcg_debug_assert(v1 >= TCG_REG_V0 && v1 <= TCG_REG_V31); + tcg_debug_assert(r2 <= TCG_REG_R15); + tcg_debug_assert(r3 <= TCG_REG_R15); + tcg_out16(s, (op & 0xff00) | ((v1 & 15) << 4) | r2); + tcg_out16(s, r3 << 12); + tcg_out16(s, (op & 0x00ff) | RXB(v1, 0, 0, 0)); +} + static void tcg_out_insn_VRSb(TCGContext *s, S390Opcode op, TCGReg v1, intptr_t d2, TCGReg b2, TCGReg r3, int m4) { @@ -2462,19 +2508,89 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, static bool tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece, TCGReg dst, TCGReg src) { - g_assert_not_reached(); + if (src < 16) { + /* Replicate general register into two MO_64. */ + tcg_out_insn(s, VRRf, VLVGP, dst, src, src); + if (vece == MO_64) { + return true; + } + } + + /* + * Recall that the "standard" integer, within a vector, is the + * rightmost element of the leftmost doubleword, a-la VLLEZ. + */ + tcg_out_insn(s, VRIc, VREP, dst, (8 >> vece) - 1, src, vece); + return true; } static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, TCGReg dst, TCGReg base, intptr_t offset) { - g_assert_not_reached(); + tcg_out_vrx_mem(s, VRX_VLREP, dst, base, TCG_REG_NONE, offset, vece); + return true; } static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, TCGReg dst, int64_t val) { - g_assert_not_reached(); + int i, mask, msb, lsb; + + /* Look for int16_t elements. */ + if (vece <= MO_16 || + (vece == MO_32 ? (int32_t)val : val) == (int16_t)val) { + tcg_out_insn(s, VRIa, VREPI, dst, val, vece); + return; + } + + /* Look for bit masks. */ + if (vece == MO_32) { + if (risbg_mask((int32_t)val)) { + /* Handle wraparound by swapping msb and lsb. */ + if ((val & 0x80000001u) == 0x80000001u) { + msb = 32 - ctz32(~val); + lsb = clz32(~val) - 1; + } else { + msb = clz32(val); + lsb = 31 - ctz32(val); + } + tcg_out_insn(s, VRIb, VGM, dst, lsb, msb, MO_32); + return; + } + } else { + if (risbg_mask(val)) { + /* Handle wraparound by swapping msb and lsb. */ + if ((val & 0x8000000000000001ull) == 0x8000000000000001ull) { + /* Handle wraparound by swapping msb and lsb. */ + msb = 64 - ctz64(~val); + lsb = clz64(~val) - 1; + } else { + msb = clz64(val); + lsb = 63 - ctz64(val); + } + tcg_out_insn(s, VRIb, VGM, dst, lsb, msb, MO_64); + return; + } + } + + /* Look for all bytes 0x00 or 0xff. */ + for (i = mask = 0; i < 8; i++) { + uint8_t byte = val >> (i * 8); + if (byte == 0xff) { + mask |= 1 << i; + } else if (byte != 0) { + break; + } + } + if (i == 8) { + tcg_out_insn(s, VRIa, VGBM, dst, mask * 0x0101, 0); + return; + } + + /* Otherwise, stuff it in the constant pool. */ + tcg_out_insn(s, RIL, LARL, TCG_TMP0, 0); + new_pool_label(s, val, R_390_PC32DBL, s->code_ptr - 2, 2); + tcg_out_insn(s, VRX, VLREP, dst, TCG_TMP0, TCG_REG_NONE, 0, MO_64); } static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, From patchwork Fri Dec 25 20:19:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352298 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7944998jai; Fri, 25 Dec 2020 12:25:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJy42beuZAXFx7/joPSROzhTJbNRKxhXufxvthGVh0naQlmDZylfwrOPp3BSczqbBFAbvS8Q X-Received: by 2002:a25:cb88:: with SMTP id b130mr47498748ybg.433.1608927900335; Fri, 25 Dec 2020 12:25:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608927900; cv=none; d=google.com; s=arc-20160816; b=nABCsSwHKOzwE5vN4G//vqY2C3QwuBYV90JUF+GRUF149Rdqu9Vpe7fFXQvDLGJAdx Q6ZR0snQIgIv+APAESPkzeBLlRTgxdXu+3VcpUTQ8jhZ9zTpa7FjWQMVMRb1ipEZVEat pKjxCk28E4TYIuvwxDTS/0IwmJk7aBdUDKBU4jJeUOBVz8cAeZOC5pmYBH909o+Xrlew pdzeQS2EEBDCMVoGT3wIoY5EHOn9AiIdYyt5n/qjHoh0oUW4jCRXmH0EsZbaCAbn2KYh pNYj5TR//4fw1dfudarbrqgP9jS+D6rnOgS8wUWDI7m6uZnWbBmWLfpuMUYMqXNKwars yxew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=JcL23TZPnjsseMydd3TwINwkRfPiWIOjf4vhZmHNHgM=; b=EYhdO0R8N7rCJ2Ya7+ZPY7/cLQze3qLQyRQGPk2dee/PTzrBSJZ+eT4XI4IVew7CIF 7GK9zwjHLTm4rwGAkIH74wRdoyydJWqf60In/PS834ROkr3CQD2Y3iGUmQN/NLUWR3ul 5emFPUArHyINelDO8V0MFFa44JNezvC3/PoEfRt7Y6KFaUZavL2dCccH7KUxEk+9n7wH 2rcaHKVHZFKCWOGRJBmjujh7DmhLwqHdmJcThgKZVQhIRewHchlj6eKI/bfh1Eu/CUf1 1womPeXPzRuUyLNgWevLF2yV0x7sdBI99U69a39tdol59JoogK1RYi0UAHVrVCO02uzq 9Icw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=efyTAz79; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o138si26168397yba.85.2020.12.25.12.25.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Dec 2020 12:25:00 -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=efyTAz79; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kstdz-0006j9-P2 for patch@linaro.org; Fri, 25 Dec 2020 15:24:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kstZL-00032d-5j for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:11 -0500 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:51662) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kstZJ-0005BY-4p for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:10 -0500 Received: by mail-pj1-x1034.google.com with SMTP id z12so2679463pjn.1 for ; Fri, 25 Dec 2020 12:20:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=JcL23TZPnjsseMydd3TwINwkRfPiWIOjf4vhZmHNHgM=; b=efyTAz797u8k4NBSupXbLkHddUcTcWYn0jdBt6kKiEhU0SfcLxGDJPepycYntKW3TA CrMW7bj9VXx2VAevuzXWrw2GydL0ajXl/W9hNJUYlsr8Ak/sw9iWVHaBzwXrUJGrjQ3b PerRsyx/TwNR3ACeW8KVD10vcPcLJnCcUEPOSg/foTddSXA8d82CU22FWq0r36x21Eld JQ37oQv4C5O9toJIPcrLdJ3ULQrPQE8mVmjI/0DRJDTmKI8yhb+PZNZmrcVhVWTVpGNQ 4FGVyROsNiT1hcKaXe2NAA+tfdkrtWn7zwJnOM85R/r/NJhTw71jLXu/2ch2V1nQNxtL QAUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JcL23TZPnjsseMydd3TwINwkRfPiWIOjf4vhZmHNHgM=; b=kIatwdL41ertEhbQfDSV6bTkNwjDbAdIH0OWTvleIP/VfCfOyMx4eMiH9U+vuBepno D9H+KOnT+AqjQw6IpWblY55z0OtVIJan4l4T26DG4ufc3kVF3vFUh1f92kquErJRp1H9 Zqs8R+avx08ZjrzxxYS2UXAK0r+sZO7NrxSXZo3jODbhZ1+L8RpIkqHeUElbkPZrgvyH kBuHkFjEz1YvQVpg4DtjRTXFzkChS1B0pXMhPCWUkHqUYbKGKjdztioQhhRJngXiD5rG AAZt53I+DkKOyoTsXHxQZHXK1QdoAAIqAp4K7JH7ydrH4MlEM9RDHv1yGui+o1KMzgnR YbHg== X-Gm-Message-State: AOAM532x9w9seTcnDjs3jQruX+f7e8KLVKRsqm6+Ekc0pBvOQCKLbWiH 1C0RbGn+AivyZJvvd2Vwtp/k37bCb87dXw== X-Received: by 2002:a17:90b:50a:: with SMTP id r10mr9853908pjz.103.1608927607540; Fri, 25 Dec 2020 12:20:07 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id l8sm5816497pjt.32.2020.12.25.12.20.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:20:07 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 08/16] tcg/s390x: Implement minimal vector operations Date: Fri, 25 Dec 2020 12:19:48 -0800 Message-Id: <20201225201956.692861-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201225201956.692861-1-richard.henderson@linaro.org> References: <20201225201956.692861-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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.23 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" Implementing add, sub, and, or, xor as the minimal set. This allows us to actually enable vectors in query_s390_facilities. Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 154 ++++++++++++++++++++++++++++++++++++- 1 file changed, 150 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 808d50190f..d4a5783c1c 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -256,6 +256,14 @@ typedef enum S390Opcode { VRIc_VREP = 0xe74d, VRRa_VLR = 0xe756, + VRRc_VA = 0xe7f3, + VRRc_VCEQ = 0xe7f8, /* we leave the m5 cs field 0 */ + VRRc_VCH = 0xe7fb, /* " */ + VRRc_VCHL = 0xe7f9, /* " */ + VRRc_VN = 0xe768, + VRRc_VO = 0xe76a, + VRRc_VS = 0xe7f7, + VRRc_VX = 0xe76d, VRRf_VLVGP = 0xe762, VRSb_VLVG = 0xe722, @@ -579,6 +587,17 @@ static void tcg_out_insn_VRRa(TCGContext *s, S390Opcode op, tcg_out32(s, (op & 0x00ff) | RXB(v1, v2, 0, 0) | (m3 << 12)); } +static void tcg_out_insn_VRRc(TCGContext *s, S390Opcode op, + TCGReg v1, TCGReg v2, TCGReg v3, int m4) +{ + tcg_debug_assert(v1 >= TCG_REG_V0 && v1 <= TCG_REG_V31); + tcg_debug_assert(v2 >= TCG_REG_V0 && v2 <= TCG_REG_V31); + tcg_debug_assert(v3 >= TCG_REG_V0 && v3 <= TCG_REG_V31); + tcg_out16(s, (op & 0xff00) | ((v1 & 15) << 4) | (v2 & 15)); + tcg_out16(s, v3 << 12); + tcg_out16(s, (op & 0x00ff) | RXB(v1, v2, v3, 0) | (m4 << 12)); +} + static void tcg_out_insn_VRRf(TCGContext *s, S390Opcode op, TCGReg v1, TCGReg r2, TCGReg r3) { @@ -2597,18 +2616,145 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, unsigned vecl, unsigned vece, const TCGArg *args, const int *const_args) { - g_assert_not_reached(); + TCGType type = vecl + TCG_TYPE_V64; + TCGArg a0 = args[0], a1 = args[1], a2 = args[2]; + + switch (opc) { + case INDEX_op_ld_vec: + tcg_out_ld(s, type, a0, a1, a2); + break; + case INDEX_op_st_vec: + tcg_out_st(s, type, a0, a1, a2); + break; + case INDEX_op_dupm_vec: + tcg_out_dupm_vec(s, type, vece, a0, a1, a2); + break; + + case INDEX_op_add_vec: + tcg_out_insn(s, VRRc, VA, a0, a1, a2, vece); + break; + case INDEX_op_sub_vec: + tcg_out_insn(s, VRRc, VS, a0, a1, a2, vece); + break; + case INDEX_op_and_vec: + tcg_out_insn(s, VRRc, VN, a0, a1, a2, 0); + break; + case INDEX_op_or_vec: + tcg_out_insn(s, VRRc, VO, a0, a1, a2, 0); + break; + case INDEX_op_xor_vec: + tcg_out_insn(s, VRRc, VX, a0, a1, a2, 0); + break; + + case INDEX_op_cmp_vec: + switch ((TCGCond)args[3]) { + case TCG_COND_EQ: + tcg_out_insn(s, VRRc, VCEQ, a0, a1, a2, vece); + break; + case TCG_COND_GT: + tcg_out_insn(s, VRRc, VCH, a0, a1, a2, vece); + break; + case TCG_COND_GTU: + tcg_out_insn(s, VRRc, VCHL, a0, a1, a2, vece); + break; + default: + g_assert_not_reached(); + } + break; + + case INDEX_op_mov_vec: /* Always emitted via tcg_out_mov. */ + case INDEX_op_dup_vec: /* Always emitted via tcg_out_dup_vec. */ + default: + g_assert_not_reached(); + } } int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) { - return 0; + switch (opc) { + case INDEX_op_add_vec: + case INDEX_op_sub_vec: + case INDEX_op_and_vec: + case INDEX_op_or_vec: + case INDEX_op_xor_vec: + return 1; + case INDEX_op_cmp_vec: + return -1; + default: + return 0; + } +} + +static bool expand_vec_cmp_noinv(TCGType type, unsigned vece, TCGv_vec v0, + TCGv_vec v1, TCGv_vec v2, TCGCond cond) +{ + bool need_swap = false, need_inv = false; + + switch (cond) { + case TCG_COND_EQ: + case TCG_COND_GT: + case TCG_COND_GTU: + break; + case TCG_COND_NE: + case TCG_COND_LE: + case TCG_COND_LEU: + need_inv = true; + break; + case TCG_COND_LT: + case TCG_COND_LTU: + need_swap = true; + break; + case TCG_COND_GE: + case TCG_COND_GEU: + need_swap = need_inv = true; + break; + default: + g_assert_not_reached(); + } + + if (need_inv) { + cond = tcg_invert_cond(cond); + } + if (need_swap) { + TCGv_vec t1; + t1 = v1, v1 = v2, v2 = t1; + cond = tcg_swap_cond(cond); + } + + vec_gen_4(INDEX_op_cmp_vec, type, vece, tcgv_vec_arg(v0), + tcgv_vec_arg(v1), tcgv_vec_arg(v2), cond); + + return need_inv; +} + +static void expand_vec_cmp(TCGType type, unsigned vece, TCGv_vec v0, + TCGv_vec v1, TCGv_vec v2, TCGCond cond) +{ + if (expand_vec_cmp_noinv(type, vece, v0, v1, v2, cond)) { + tcg_gen_not_vec(vece, v0, v0); + } } void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, TCGArg a0, ...) { - g_assert_not_reached(); + va_list va; + TCGv_vec v0, v1, v2; + + va_start(va, a0); + v0 = temp_tcgv_vec(arg_temp(a0)); + v1 = temp_tcgv_vec(arg_temp(va_arg(va, TCGArg))); + v2 = temp_tcgv_vec(arg_temp(va_arg(va, TCGArg))); + + switch (opc) { + case INDEX_op_cmp_vec: + expand_vec_cmp(type, vece, v0, v1, v2, va_arg(va, TCGArg)); + break; + + default: + g_assert_not_reached(); + } + va_end(va); } static int tcg_target_op_def(TCGOpcode op) @@ -2800,7 +2946,7 @@ static void query_s390_facilities(void) * There is nothing else we currently care about in the 3rd word, so * disable VECTOR with one store. */ - if (1 || !(hwcap & HWCAP_S390_VXRS)) { + if (!(hwcap & HWCAP_S390_VXRS)) { s390_facilities[2] = 0; } } From patchwork Fri Dec 25 20:19:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352300 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7945700jai; Fri, 25 Dec 2020 12:26:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJyRug/OGUkB5YHlNCkQ/PbWrqA9FmOegd/6vE9uOaJO8IoUUhPzaQI7bbw0ucx3DJ/xB1Fl X-Received: by 2002:a25:374c:: with SMTP id e73mr52298186yba.376.1608928018826; Fri, 25 Dec 2020 12:26:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608928018; cv=none; d=google.com; s=arc-20160816; b=ZtV5AcZcpKzYj41wwuycUJX28MgtLLwRGkOc7S8FZD5XxKeB/yAKepwIhrCgEhQyA3 WNE/dWgoqaF5tgWW7BFmOSKlmEeFzr/LF3jJQR1s9HgcFj/KIlnzcvkPPHsOOuPPZETa SStjiQXaC9LREVmdgvlSVJ7aNxFdMJAISakK+7Y7/B/ofmeVdYqNAvwqjO4wRDqwkd4Z CC0kHKMoDDMxGjypw5YIXIZIQRR8tZoV6pOGeG4nYr8ITVb1fQgH3oHPQp39q1O2R+BW 9QDg0NDwVu7rom4kc/tQqDc5MPe+sG2yCaaVE9xFabGQ86lY8IlYbiEQ56kKTIhKtdeO wl3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=KrVLDx19b/T9Urp9g1W3X5Yu2LdiB/68xltM+LHapo4=; b=tOoiCXGS3FrUiYEr0Mfh5RzLxVSbcb2418xShaWaql0+x83iYnuVD/o9gyZBek+nAp /CZEUAzySy7UBhM6nOKFfgNdccSfQah915Xwqug2GMQRgQZT4g0R0JIgqBdYaokPO2C1 tkmJVXY/XB9KtXCyCHJCBvmKmZTtRt7f6rjVAYbh+ivyP5mdI8n2q8oQjGSJEjVlMfH6 VoofvdMc9bEFRnlXbOf9HutGPcI1G3Zr6PyvgRJojvBvL71KV7TBoCxSitwBJ+klOXt0 LEQVLMAl7V8pcFCFwH8pLXKf4+a+TGM0BBuoTA0W0NSnCveA1MAnfg0KwEur9YCDWgwb DBng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rkNrlHPn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x3si29651675ybn.333.2020.12.25.12.26.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Dec 2020 12:26:58 -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=rkNrlHPn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kstfu-0001iT-9h for patch@linaro.org; Fri, 25 Dec 2020 15:26:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38490) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kstZM-00033x-6l for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:12 -0500 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:54565) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kstZK-0005CO-8n for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:11 -0500 Received: by mail-pj1-x1032.google.com with SMTP id f14so2675603pju.4 for ; Fri, 25 Dec 2020 12:20:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=KrVLDx19b/T9Urp9g1W3X5Yu2LdiB/68xltM+LHapo4=; b=rkNrlHPnllfAoyKWtC+YnhzHKlp6qk/IQXDQAVRGbO36/DaaRtHIPe0F68cTczq3Q6 2YqDRHOP9qC9HMUvj62qo1hEpzEwEhmTpXstu+UtefYpcHExyWA7k27C9Diu2WK4rhIa enDHOtJkQ1NqeOd/z9LWnRKP+oA5b81H/QoX2gNHF2hoLdSTYwRrsmUL4d2jGjneP7uh AKjh2D7a18nHszVmSD0TmBSsbNTdxfAC0+bMKzFzBUFrXdvnMkne8l/2zbgNjqth+CSl sutpAQ5wMnRVV2ljo1SWWZuPUOIStcpPRlSKEqaT0S+fSQkNFORN79VupWghj/LZm9Lq xw7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KrVLDx19b/T9Urp9g1W3X5Yu2LdiB/68xltM+LHapo4=; b=IrDrfHhSD4ew8sXZhd7vawDhqu+dBbLQjjLkFXDLWFwqN+XTWGg0scEIpST1d5N3s4 8AkP2UCsJcz0NZX9KUiCe2ofvMCHupl3nt+39ak52E/bpo/bZdaoC+5Fmsxj0O4L5zXB zdIXvyJ6cR72+RO9qSOXIR8CK3b/+eTU8oM+AAMn3yxAvTz5/aiwQ6pR5ChBCQhSAcJk aC1yq0WTA65gT9fjqBaYnMeCC11cSh8/QgYd2pT5uNbSyEznNczT0wime21eICLrrYkF cF2DoEJL1evcm5hvyc9cRrdjOd3lvJ4Q0PA6bupKZFW+l0X1f/fXFStQtwAxqBbgyK5G mDFg== X-Gm-Message-State: AOAM533UwRrnwYyRXargGUGGWvO/kUSXQvIm8zXcvQMktYe4DAPHxbhh oS4mnXbajbMocUy+T27EZQOmxImDOK54sA== X-Received: by 2002:a17:90b:4a4c:: with SMTP id lb12mr9903767pjb.162.1608927608711; Fri, 25 Dec 2020 12:20:08 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id l8sm5816497pjt.32.2020.12.25.12.20.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:20:08 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 09/16] tcg/s390x: Implement andc, orc, abs, neg, not vector operations Date: Fri, 25 Dec 2020 12:19:49 -0800 Message-Id: <20201225201956.692861-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201225201956.692861-1-richard.henderson@linaro.org> References: <20201225201956.692861-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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.23 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" These logical and arithmetic operations are optional but trivial. Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target-conset.h | 1 + tcg/s390x/tcg-target.h | 10 +++++----- tcg/s390x/tcg-target.c.inc | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 39 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/tcg/s390x/tcg-target-conset.h b/tcg/s390x/tcg-target-conset.h index 88d1ec349c..c44d5f181c 100644 --- a/tcg/s390x/tcg-target-conset.h +++ b/tcg/s390x/tcg-target-conset.h @@ -12,6 +12,7 @@ C_O0_I2(v, r) C_O1_I1(r, L) C_O1_I1(r, r) C_O1_I1(v, r) +C_O1_I1(v, v) C_O1_I1(v, vr) C_O1_I2(r, 0, ri) C_O1_I2(r, 0, rI) diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index e61c376673..f4a1de931a 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -139,11 +139,11 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_v128 HAVE_FACILITY(VECTOR) #define TCG_TARGET_HAS_v256 0 -#define TCG_TARGET_HAS_andc_vec 0 -#define TCG_TARGET_HAS_orc_vec 0 -#define TCG_TARGET_HAS_not_vec 0 -#define TCG_TARGET_HAS_neg_vec 0 -#define TCG_TARGET_HAS_abs_vec 0 +#define TCG_TARGET_HAS_andc_vec 1 +#define TCG_TARGET_HAS_orc_vec 1 +#define TCG_TARGET_HAS_not_vec 1 +#define TCG_TARGET_HAS_neg_vec 1 +#define TCG_TARGET_HAS_abs_vec 1 #define TCG_TARGET_HAS_roti_vec 0 #define TCG_TARGET_HAS_rots_vec 0 #define TCG_TARGET_HAS_rotv_vec 0 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index d4a5783c1c..6c16ae0fcf 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -255,13 +255,18 @@ typedef enum S390Opcode { VRIb_VGM = 0xe746, VRIc_VREP = 0xe74d, + VRRa_VLC = 0xe7de, + VRRa_VLP = 0xe7df, VRRa_VLR = 0xe756, VRRc_VA = 0xe7f3, VRRc_VCEQ = 0xe7f8, /* we leave the m5 cs field 0 */ VRRc_VCH = 0xe7fb, /* " */ VRRc_VCHL = 0xe7f9, /* " */ VRRc_VN = 0xe768, + VRRc_VNC = 0xe769, + VRRc_VNO = 0xe76b, VRRc_VO = 0xe76a, + VRRc_VOC = 0xe76f, VRRc_VS = 0xe7f7, VRRc_VX = 0xe76d, VRRf_VLVGP = 0xe762, @@ -2630,6 +2635,16 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, tcg_out_dupm_vec(s, type, vece, a0, a1, a2); break; + case INDEX_op_abs_vec: + tcg_out_insn(s, VRRa, VLP, a0, a1, vece); + break; + case INDEX_op_neg_vec: + tcg_out_insn(s, VRRa, VLC, a0, a1, vece); + break; + case INDEX_op_not_vec: + tcg_out_insn(s, VRRc, VNO, a0, a1, a1, 0); + break; + case INDEX_op_add_vec: tcg_out_insn(s, VRRc, VA, a0, a1, a2, vece); break; @@ -2639,9 +2654,15 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, case INDEX_op_and_vec: tcg_out_insn(s, VRRc, VN, a0, a1, a2, 0); break; + case INDEX_op_andc_vec: + tcg_out_insn(s, VRRc, VNC, a0, a1, a2, 0); + break; case INDEX_op_or_vec: tcg_out_insn(s, VRRc, VO, a0, a1, a2, 0); break; + case INDEX_op_orc_vec: + tcg_out_insn(s, VRRc, VOC, a0, a1, a2, 0); + break; case INDEX_op_xor_vec: tcg_out_insn(s, VRRc, VX, a0, a1, a2, 0); break; @@ -2672,10 +2693,15 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) { switch (opc) { + case INDEX_op_abs_vec: case INDEX_op_add_vec: - case INDEX_op_sub_vec: case INDEX_op_and_vec: + case INDEX_op_andc_vec: + case INDEX_op_neg_vec: + case INDEX_op_not_vec: case INDEX_op_or_vec: + case INDEX_op_orc_vec: + case INDEX_op_sub_vec: case INDEX_op_xor_vec: return 1; case INDEX_op_cmp_vec: @@ -2904,10 +2930,16 @@ static int tcg_target_op_def(TCGOpcode op) return C_O1_I1(v, r); case INDEX_op_dup_vec: return C_O1_I1(v, vr); + case INDEX_op_abs_vec: + case INDEX_op_neg_vec: + case INDEX_op_not_vec: + return C_O1_I1(v, v); case INDEX_op_add_vec: case INDEX_op_sub_vec: case INDEX_op_and_vec: + case INDEX_op_andc_vec: case INDEX_op_or_vec: + case INDEX_op_orc_vec: case INDEX_op_xor_vec: case INDEX_op_cmp_vec: return C_O1_I2(v, v, v); From patchwork Fri Dec 25 20:19:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352303 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7946627jai; Fri, 25 Dec 2020 12:29:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxMfjqD9kjzA3S3f50/zkvsZmXL+GidD+rHJspMjtHwDEIxrL2xiuY+3S1nnYpC1wIMNe0+ X-Received: by 2002:a25:2c58:: with SMTP id s85mr51026318ybs.366.1608928194700; Fri, 25 Dec 2020 12:29:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608928194; cv=none; d=google.com; s=arc-20160816; b=Dlip2QwPezeaa0z0DjMl6lnGtV04lS8twn0zNypyelWfDG7U/LTs/P3FDQLM+ghGF2 kD5G2iR19ujqFVEFO2A79ohQ2YlkwlKSxx3xrvdq2XVfZiJi8xrAgq/lGTACvmz5jyeM TNY0YeJ3fNmjUNJFkWVsIIfPmKuy6ONsyZSQ4pvBJEJ3VjjRhrK6YPQHDUzx3uWF8cOk KiZMxl9VXe0KwuYUCjH320dxI2TS3Bp4TCp1fqQCfTF8W9CXgZUZiIhoMAEJYq9nJzA1 kYHj2saFOu9ewumUbmEWy/gKvFBS2F5HOpOjNa4/R92CKnMdPE+69J6ige1uPS7dFXq+ BaSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=X08V9XmvMW+KNLUQAibo13Y4Y2jKTgkyyKKTZwdBNxA=; b=S0T/OJXod5XmbcBdu9iRKrSEqJcFt93jMWRoQ9Ulp8MiC0b1/pjskI3N+gxBVRwPau Z7ZES/6XTWjK1VWVnko/xgpkGBuAAR30ovultjoAriRys/v/XY7ZiiPrC2zs3Gzrh+aS wMAL4MGRR5MoezN0xZ2rrK1L9Tb94EM7WTStJChikWpEOlpgakq4Br+MC1fM3QGzKxXX pI6rVjSEsvKew8bm+tKvIXafSGJZg5gAiF44S5tWtvzZu9I4Hs9KQStaRGhKlOX5kpN+ 9AFbk0aoiWKtC0x1ymx81O25AxaZpxi1O49UlF9/jkrtkHG/9pmThu4tBWlyaPCZXzt7 nUXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BmfzOR+v; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s5si28003026ybq.464.2020.12.25.12.29.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Dec 2020 12:29:54 -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=BmfzOR+v; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kstik-0004QD-74 for patch@linaro.org; Fri, 25 Dec 2020 15:29:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kstZM-00035L-Ql for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:12 -0500 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:53596) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kstZL-0005CX-5k for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:12 -0500 Received: by mail-pj1-x1030.google.com with SMTP id iq13so2679065pjb.3 for ; Fri, 25 Dec 2020 12:20:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=X08V9XmvMW+KNLUQAibo13Y4Y2jKTgkyyKKTZwdBNxA=; b=BmfzOR+vHexEsrwLPO4Cji95ScJRTgd7WLNuMaQRiHzTa//lVM9SKVUCAhQoAbe+U7 hFZKXuhRDseXOJepwS+WPwMGW/dOAV1LMgrUC3Pq3SmhIX4DR6SS/d0vENPyv+9A6adG UNmXfZPN8yB1R8HYYrBX8ELISu8/jAPrt+u52pzeYcLxt1BUPkJT08/8TXS45H4Y1nBo t846cRoG+7IFm99hGMWqT4jXeF+PB3tFrUiEoQi0d8DhLzST4zmjyg59/kFAR9kp2N7d uw/012L6OO62qDxa1tPpaDoBSNZ2XluME1pV53/cOCFKKATDgC7iHc3Kc4TUivAUsc/D iGkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X08V9XmvMW+KNLUQAibo13Y4Y2jKTgkyyKKTZwdBNxA=; b=p1t6qZWmo3yEPoo0fuFi5MwCnq2+YA4+nvSoHkFTZ1LSb/z2qAmxqBdGQ360unKjt7 wVu42BSZ/ATMX+twICOEhTe3n0riMesQT63Clwic/YS0dufhJQ4o+kPYvRHeSXzbArwy 9QPVrpY+IXg0qQA4/2ksVoVnmgDWoEoprkLG7+55e/WIr+RaZFX2AXOA5AzrQNavc4ug ZEeNXGWdrHLLlh2FOjGt2fHs5OYJ7IuKVZ8NfYtIUjq8/DOzBEhg/PTKUuWN+WhPklDZ /fg8tUPXEUa9xcHzSZSAdBslNY45AsuRInle4NsbFc/fTHBk9M4prESLkjN666TvfGRt l4NQ== X-Gm-Message-State: AOAM533Q9errGZ9Z6edM4eRSCswJ0L3KImciXZ7+SjTVOyXx47mmtga/ yBX4Uu4RuXTjX8RGsrXCgzQMMLfH2Dz4qw== X-Received: by 2002:a17:90a:7e88:: with SMTP id j8mr9875480pjl.217.1608927609588; Fri, 25 Dec 2020 12:20:09 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id l8sm5816497pjt.32.2020.12.25.12.20.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:20:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 10/16] tcg/s390x: Implement TCG_TARGET_HAS_mul_vec Date: Fri, 25 Dec 2020 12:19:50 -0800 Message-Id: <20201225201956.692861-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201225201956.692861-1-richard.henderson@linaro.org> References: <20201225201956.692861-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.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.23 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" Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.h | 2 +- tcg/s390x/tcg-target.c.inc | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index f4a1de931a..3f0be23323 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -150,7 +150,7 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_shi_vec 0 #define TCG_TARGET_HAS_shs_vec 0 #define TCG_TARGET_HAS_shv_vec 0 -#define TCG_TARGET_HAS_mul_vec 0 +#define TCG_TARGET_HAS_mul_vec 1 #define TCG_TARGET_HAS_sat_vec 0 #define TCG_TARGET_HAS_minmax_vec 0 #define TCG_TARGET_HAS_bitsel_vec 0 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 6c16ae0fcf..c5c17adc0c 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -262,6 +262,7 @@ typedef enum S390Opcode { VRRc_VCEQ = 0xe7f8, /* we leave the m5 cs field 0 */ VRRc_VCH = 0xe7fb, /* " */ VRRc_VCHL = 0xe7f9, /* " */ + VRRc_VML = 0xe7a2, VRRc_VN = 0xe768, VRRc_VNC = 0xe769, VRRc_VNO = 0xe76b, @@ -2657,6 +2658,9 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, case INDEX_op_andc_vec: tcg_out_insn(s, VRRc, VNC, a0, a1, a2, 0); break; + case INDEX_op_mul_vec: + tcg_out_insn(s, VRRc, VML, a0, a1, a2, vece); + break; case INDEX_op_or_vec: tcg_out_insn(s, VRRc, VO, a0, a1, a2, 0); break; @@ -2706,6 +2710,8 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) return 1; case INDEX_op_cmp_vec: return -1; + case INDEX_op_mul_vec: + return vece < MO_64; default: return 0; } @@ -2942,6 +2948,7 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_orc_vec: case INDEX_op_xor_vec: case INDEX_op_cmp_vec: + case INDEX_op_mul_vec: return C_O1_I2(v, v, v); default: From patchwork Fri Dec 25 20:19:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352304 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7947417jai; Fri, 25 Dec 2020 12:31:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzv4lWAlLUyyHQWK4nUT+JvbXgiVBNqLk7I2HmLbbdQY9Kn0nPFTbnVF0qiHXYtL897qtys X-Received: by 2002:a25:2394:: with SMTP id j142mr16259456ybj.254.1608928284759; Fri, 25 Dec 2020 12:31:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608928284; cv=none; d=google.com; s=arc-20160816; b=rg0FDrZ2vVT+4oU3PBzkwyRPi4CWEVwI7qDbEiOykl/EXh9UomwkObr9qPDj0wzUJa qFfAZDhUK4CwuUEmWL2BeIxYZj7hhS5762dHFmvNaz13he8f6sAYH5mII3H9wAMHBasP WJPJm9/T8F0vDLfe9/cCdb2DXqbrExgHVFdz22Mdanbc8NlS9APfkwIYr8Pf4UNbE6a4 S4hO4qswEyzANb8l07oFwwVmgPbJKEXF32Tv7u8akAV2qV19SHzifaE91GWbYcmvVfcg Nkd/dxh2JtAht2bJM23mzJzq6U1KGtcnMUZUZ3DWAYXMneXn5bubbbJaj5p9zt0hApok BcTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=gtgLkycaCNbpvxv3G7Bhe7Cbw5c0KGYZhP5BMnkzD8w=; b=DJWWSpIK6Ze/jdCCWqsJs3hD+Fa1YxUMZj0zeuOxz/CeiCp3k73sQWMi/zt73Qp57R ROzxviXpHlHBbSQ+0owmknKAgJcQEtjqtvkk3kpfk+PlAPrKprN1ryTTHYvKMUeee7zx KUiM12WKHJ6ZfLE/8xIdo0c7xePCb1JpDWm/BvQlK3xsn8HZG01IslAi+thV6h0RgRcD VeGh0jHx1UJEFGFSB4kCwpchTHW56uJFgsDk8qQPUQvj30GBn05GlISB3YmXXbvqD4Bu C0Q8qIFkd1uJ2IDIDZFip6ivffZTAneT58fgL5zC6K3gNqswK2fT1DFB0LRn+mpwJU+p rzvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CEuCPmgN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n124si31388450ybc.139.2020.12.25.12.31.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Dec 2020 12:31: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=pass header.i=@linaro.org header.s=google header.b=CEuCPmgN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kstkC-0006QQ-7K for patch@linaro.org; Fri, 25 Dec 2020 15:31:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kstZO-00038m-TI for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:14 -0500 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:35508) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kstZM-0005Cx-J9 for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:14 -0500 Received: by mail-pg1-x531.google.com with SMTP id n7so3513464pgg.2 for ; Fri, 25 Dec 2020 12:20:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=gtgLkycaCNbpvxv3G7Bhe7Cbw5c0KGYZhP5BMnkzD8w=; b=CEuCPmgNXUOO7RrFfE6N8bdr1Zye5U6oP7xph5AB9ATqpB+8yMdGC/iEdvm9m5Kwfx 7VklRDmQpFWpU7qF/e8/hfWptM9DrWefOv5RdrqBz/JdBZNpbwGHiqJ3Bbn5rovgbFhB IP3jztLqP5EillsnBjZlPR4sOHIMITjLdG/80vFukvdXuRrIim85hsjBZzNyzTtXY+td agmUlMgxQCKQa4wr9Nw5v3vJufxratdhjNfWkEqqBwtBaMtaTwOe0+ncLcxyOD2TRf04 Eoy6C6lxcO9Pt849CizTuLgsxaJ2cZvFHJongY+ngz5z44WpEdKUXmOPVuGLMjhbDBsO 3+zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gtgLkycaCNbpvxv3G7Bhe7Cbw5c0KGYZhP5BMnkzD8w=; b=b7njhN5wXklB2iUlRcJVSCXduUNq4AjA0zZXgoDMEugeXqfVu9q6zbUqmD5jL1+a6W f0HdTPtqI8FnuOPPz0SfxqVI7w8bbSP2tiGgcoYnUgiefxZGwZ3ZNcpqGhEudeJVpCmx WatQglHBX9TIC+myQdqqT6GuJQNG38de05BMEaTPrR41GMPR736xSoPOMHwARNsWTBrN MLcRzBOuYCoLm2TRU2ZXknJlFEC1LUqIFfcsQ30bVkKZVM7lVglMkjBuLr4Jf8bq1I5A ZNFzFuODCVrFVApqTC0/3B2bZ1iSteSf5w9TSZ76J4fB8mHdslYvAsb67BAMskkR8lj/ nMbg== X-Gm-Message-State: AOAM5317c+WtOlLNXlu8UUmqZuXZJ0W6SCyLPWH2nltmm95Q/fPXL6LX sFuV0jvwY+oBKWyVmRGZvv0Z5n7pFZk3GA== X-Received: by 2002:a62:1ccb:0:b029:1ad:8138:dc42 with SMTP id c194-20020a621ccb0000b02901ad8138dc42mr12825149pfc.0.1608927610744; Fri, 25 Dec 2020 12:20:10 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id l8sm5816497pjt.32.2020.12.25.12.20.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:20:10 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 11/16] tcg/s390x: Implement vector shift operations Date: Fri, 25 Dec 2020 12:19:51 -0800 Message-Id: <20201225201956.692861-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201225201956.692861-1-richard.henderson@linaro.org> References: <20201225201956.692861-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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.23 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" Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target-conset.h | 1 + tcg/s390x/tcg-target.h | 12 ++--- tcg/s390x/tcg-target.c.inc | 93 ++++++++++++++++++++++++++++++++++- 3 files changed, 99 insertions(+), 7 deletions(-) -- 2.25.1 diff --git a/tcg/s390x/tcg-target-conset.h b/tcg/s390x/tcg-target-conset.h index c44d5f181c..9c7dd85eac 100644 --- a/tcg/s390x/tcg-target-conset.h +++ b/tcg/s390x/tcg-target-conset.h @@ -19,6 +19,7 @@ C_O1_I2(r, 0, rI) C_O1_I2(r, 0, rJ) C_O1_I2(r, r, ri) C_O1_I2(r, rZ, r) +C_O1_I2(v, v, r) C_O1_I2(v, v, v) C_O1_I4(r, r, ri, r, 0) C_O1_I4(r, r, ri, rI, 0) diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index 3f0be23323..a97738e525 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -144,12 +144,12 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_not_vec 1 #define TCG_TARGET_HAS_neg_vec 1 #define TCG_TARGET_HAS_abs_vec 1 -#define TCG_TARGET_HAS_roti_vec 0 -#define TCG_TARGET_HAS_rots_vec 0 -#define TCG_TARGET_HAS_rotv_vec 0 -#define TCG_TARGET_HAS_shi_vec 0 -#define TCG_TARGET_HAS_shs_vec 0 -#define TCG_TARGET_HAS_shv_vec 0 +#define TCG_TARGET_HAS_roti_vec 1 +#define TCG_TARGET_HAS_rots_vec 1 +#define TCG_TARGET_HAS_rotv_vec 1 +#define TCG_TARGET_HAS_shi_vec 1 +#define TCG_TARGET_HAS_shs_vec 1 +#define TCG_TARGET_HAS_shv_vec 1 #define TCG_TARGET_HAS_mul_vec 1 #define TCG_TARGET_HAS_sat_vec 0 #define TCG_TARGET_HAS_minmax_vec 0 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index c5c17adc0c..259b63d8bc 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -262,6 +262,10 @@ typedef enum S390Opcode { VRRc_VCEQ = 0xe7f8, /* we leave the m5 cs field 0 */ VRRc_VCH = 0xe7fb, /* " */ VRRc_VCHL = 0xe7f9, /* " */ + VRRc_VERLLV = 0xe773, + VRRc_VESLV = 0xe770, + VRRc_VESRAV = 0xe77a, + VRRc_VESRLV = 0xe778, VRRc_VML = 0xe7a2, VRRc_VN = 0xe768, VRRc_VNC = 0xe769, @@ -272,6 +276,10 @@ typedef enum S390Opcode { VRRc_VX = 0xe76d, VRRf_VLVGP = 0xe762, + VRSa_VERLL = 0xe733, + VRSa_VESL = 0xe730, + VRSa_VESRA = 0xe73a, + VRSa_VESRL = 0xe738, VRSb_VLVG = 0xe722, VRSc_VLGV = 0xe721, @@ -615,6 +623,18 @@ static void tcg_out_insn_VRRf(TCGContext *s, S390Opcode op, tcg_out16(s, (op & 0x00ff) | RXB(v1, 0, 0, 0)); } +static void tcg_out_insn_VRSa(TCGContext *s, S390Opcode op, TCGReg v1, + intptr_t d2, TCGReg b2, TCGReg v3, int m4) +{ + tcg_debug_assert(v1 >= TCG_REG_V0 && v1 <= TCG_REG_V31); + tcg_debug_assert(d2 >= 0 && d2 <= 0xfff); + tcg_debug_assert(b2 <= TCG_REG_R15); + tcg_debug_assert(v3 >= TCG_REG_V0 && v3 <= TCG_REG_V31); + tcg_out16(s, (op & 0xff00) | ((v1 & 15) << 4) | (v3 & 15)); + tcg_out16(s, b2 << 12 | d2); + tcg_out16(s, (op & 0x00ff) | RXB(v1, 0, v3, 0) | (m4 << 12)); +} + static void tcg_out_insn_VRSb(TCGContext *s, S390Opcode op, TCGReg v1, intptr_t d2, TCGReg b2, TCGReg r3, int m4) { @@ -2671,6 +2691,43 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, tcg_out_insn(s, VRRc, VX, a0, a1, a2, 0); break; + case INDEX_op_shli_vec: + tcg_out_insn(s, VRSa, VESL, a0, a2, TCG_REG_NONE, a1, vece); + break; + case INDEX_op_shri_vec: + tcg_out_insn(s, VRSa, VESRL, a0, a2, TCG_REG_NONE, a1, vece); + break; + case INDEX_op_sari_vec: + tcg_out_insn(s, VRSa, VESRA, a0, a2, TCG_REG_NONE, a1, vece); + break; + case INDEX_op_rotli_vec: + tcg_out_insn(s, VRSa, VERLL, a0, a2, TCG_REG_NONE, a1, vece); + break; + case INDEX_op_shls_vec: + tcg_out_insn(s, VRSa, VESL, a0, 0, a2, a1, vece); + break; + case INDEX_op_shrs_vec: + tcg_out_insn(s, VRSa, VESRL, a0, 0, a2, a1, vece); + break; + case INDEX_op_sars_vec: + tcg_out_insn(s, VRSa, VESRA, a0, 0, a2, a1, vece); + break; + case INDEX_op_rotls_vec: + tcg_out_insn(s, VRSa, VERLL, a0, 0, a2, a1, vece); + break; + case INDEX_op_shlv_vec: + tcg_out_insn(s, VRRc, VESLV, a0, a1, a2, vece); + break; + case INDEX_op_shrv_vec: + tcg_out_insn(s, VRRc, VESRLV, a0, a1, a2, vece); + break; + case INDEX_op_sarv_vec: + tcg_out_insn(s, VRRc, VESRAV, a0, a1, a2, vece); + break; + case INDEX_op_rotlv_vec: + tcg_out_insn(s, VRRc, VERLLV, a0, a1, a2, vece); + break; + case INDEX_op_cmp_vec: switch ((TCGCond)args[3]) { case TCG_COND_EQ: @@ -2705,10 +2762,23 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_not_vec: case INDEX_op_or_vec: case INDEX_op_orc_vec: + case INDEX_op_rotli_vec: + case INDEX_op_rotls_vec: + case INDEX_op_rotlv_vec: + case INDEX_op_sari_vec: + case INDEX_op_sars_vec: + case INDEX_op_sarv_vec: + case INDEX_op_shli_vec: + case INDEX_op_shls_vec: + case INDEX_op_shlv_vec: + case INDEX_op_shri_vec: + case INDEX_op_shrs_vec: + case INDEX_op_shrv_vec: case INDEX_op_sub_vec: case INDEX_op_xor_vec: return 1; case INDEX_op_cmp_vec: + case INDEX_op_rotrv_vec: return -1; case INDEX_op_mul_vec: return vece < MO_64; @@ -2771,7 +2841,7 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, TCGArg a0, ...) { va_list va; - TCGv_vec v0, v1, v2; + TCGv_vec v0, v1, v2, t0; va_start(va, a0); v0 = temp_tcgv_vec(arg_temp(a0)); @@ -2783,6 +2853,13 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, expand_vec_cmp(type, vece, v0, v1, v2, va_arg(va, TCGArg)); break; + case INDEX_op_rotrv_vec: + t0 = tcg_temp_new_vec(type); + tcg_gen_neg_vec(vece, t0, v2); + tcg_gen_rotlv_vec(vece, v0, v1, t0); + tcg_temp_free_vec(t0); + break; + default: g_assert_not_reached(); } @@ -2939,6 +3016,10 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_abs_vec: case INDEX_op_neg_vec: case INDEX_op_not_vec: + case INDEX_op_rotli_vec: + case INDEX_op_sari_vec: + case INDEX_op_shli_vec: + case INDEX_op_shri_vec: return C_O1_I1(v, v); case INDEX_op_add_vec: case INDEX_op_sub_vec: @@ -2949,7 +3030,17 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_xor_vec: case INDEX_op_cmp_vec: case INDEX_op_mul_vec: + case INDEX_op_rotlv_vec: + case INDEX_op_rotrv_vec: + case INDEX_op_shlv_vec: + case INDEX_op_shrv_vec: + case INDEX_op_sarv_vec: return C_O1_I2(v, v, v); + case INDEX_op_rotls_vec: + case INDEX_op_shls_vec: + case INDEX_op_shrs_vec: + case INDEX_op_sars_vec: + return C_O1_I2(v, v, r); default: g_assert_not_reached(); From patchwork Fri Dec 25 20:19:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352305 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7947433jai; Fri, 25 Dec 2020 12:31:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJx9KVhA0n3scdqIwn7a+nwpM+HvRmarh2AaF+3LUYgZU2DDBRQBSMhTCFDs/HWl7mHGDXT1 X-Received: by 2002:a25:75d6:: with SMTP id q205mr51672773ybc.383.1608928286465; Fri, 25 Dec 2020 12:31:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608928286; cv=none; d=google.com; s=arc-20160816; b=k/6l+TaiuFfFMNfE+4yQmKE0dMpyuRyiilBsugt6aE+YTBbyok2m0nGM8rIWyUf/F6 /LrTxlfLjgrFkxOaudDxtntUfNVZ98y1nWhLDEzulrjwiiRhY50Vi3QIuZ3Szaqfaifh PBvbUCgDD36ZyCknQSPEQ0DtsIm4SyX3EUDGRfqcSyPIqFDKzqLaFJfFT4HDkXrnqsJm Y5oVMHD0R4NCPhDYxVUFTXPHWlqnd9upDlEwJGAU5x0ZcB5xND+H7hX/S6jt3MNxbyuF wasLWOprZxafcRuVHCoMe8bM6THf+4t7qRGStDcdCrTJR11E9c7Kn+nrpP3fUqjSicOf CWQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Xxdlselw+eX7K6I9BjGaSB/WVE8EMZ3le/2fkC19IbY=; b=fGCDsOC9ApLEQB3tfE/wlmCCaBlk7TsNzrQ4fIamd7td7/QAqBEfWr/U2lwXvzRjd/ 2IBelEtunjg1DH7jbI17oeqGGln7ePNXRHU602N1c7/4Yqm6BkI1ldjgzqsRkqq482RV a7LD/VsZh6Tja+28P4VX9o9wwBpIoXHxa+SoarWsZaVPIyvTDqrUys6nfVD3meEpPVLH kOFnGwxHVOjiDUnV1NKAc9NyQ52jBn+urBIuAZ+OEYCN1/MtDN8aMp5qYFPi+Ys0rdDA HPbNowkmlRAyc390R9J2K4b78eQYfJUAOBreZglPZiJ+YKSzbs6vk2UkvJCbJyXpSYVP icjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bI7dzE2M; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l17si25419013ybl.375.2020.12.25.12.31.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Dec 2020 12:31:26 -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=bI7dzE2M; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54808 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kstkD-0006TY-Tm for patch@linaro.org; Fri, 25 Dec 2020 15:31:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kstZP-0003A3-BL for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:15 -0500 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:33314) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kstZN-0005DG-EC for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:15 -0500 Received: by mail-pl1-x62a.google.com with SMTP id b8so2737095plx.0 for ; Fri, 25 Dec 2020 12:20:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Xxdlselw+eX7K6I9BjGaSB/WVE8EMZ3le/2fkC19IbY=; b=bI7dzE2MA/eD5jnwd7+0e4WVJ5tr+K+nxUEhuj61uWaTUM7ZQf8LSGCKDO1Fbav0uo 1r3Y4xUEaWJykPP22WShMIHE9MQLxS/5lIHSN1EcmuVxZiOivrAWtaT720HleE46UnFm 3it08SfYr2yRKfGPhLoZZ5j4zrPCuw9FT9/FAXtPzfTtonCnSJ54JeO9ZbzMZg8qjsgs OWgcD9+OaUpjT+pRF7nNJo/YIJkBCl+CGgZlq4w+yjWj5NkQqJOR9iqDICitmTl0qyok i1fmlFL7xHZMacEs+y2cBa36JDmVl8fnPMOiWwbH4XacK/btjKmc/tPBsGj008mkCpEE 2SnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Xxdlselw+eX7K6I9BjGaSB/WVE8EMZ3le/2fkC19IbY=; b=E6lbBcQkre0usBOaA68+ym8tTNOQwK+XqQCXlpM3A4BUSytX2fh/8I1r++DCosBg2S RzjxZt33U9VSuSl+MCbWgxAWJd4ghuz15C34tj35z2At/C2+nNy46ggmYlWjhhgmkZg/ TyjwziNbIxo//bLzh4djxXHLDlCaZIPpTtJ8aGOH9MD+xToX8fgZ3hPsKvIFo00feTET 6iSG6aTRELEfE7iCHW1gqcXsy9Ctj0wRy4asvUoOM2sT4wu5Fa6fYzaLt/V5fi2S11dg nFrP6aIbXlfw4N7Edk9GDcrbIRF5f2s9Ozy8kXlcEiHQ4f/J8BzpEpgc/aONzFi0+y2A Kwgg== X-Gm-Message-State: AOAM532rGZ3Koc/Gfy5k5SiWD+JmCy6u/r9lYVS8IdylmL8jYXuEfXpS 0zq92eFNnUj2WvWeMhi733ELX/pwz7oRng== X-Received: by 2002:a17:90a:5513:: with SMTP id b19mr10015827pji.99.1608927611791; Fri, 25 Dec 2020 12:20:11 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id l8sm5816497pjt.32.2020.12.25.12.20.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:20:11 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 12/16] tcg/s390x: Implement TCG_TARGET_HAS_minmax_vec Date: Fri, 25 Dec 2020 12:19:52 -0800 Message-Id: <20201225201956.692861-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201225201956.692861-1-richard.henderson@linaro.org> References: <20201225201956.692861-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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.23 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" Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.h | 2 +- tcg/s390x/tcg-target.c.inc | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index a97738e525..acea745016 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -152,7 +152,7 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_shv_vec 1 #define TCG_TARGET_HAS_mul_vec 1 #define TCG_TARGET_HAS_sat_vec 0 -#define TCG_TARGET_HAS_minmax_vec 0 +#define TCG_TARGET_HAS_minmax_vec 1 #define TCG_TARGET_HAS_bitsel_vec 0 #define TCG_TARGET_HAS_cmpsel_vec 0 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 259b63d8bc..36e5924353 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -267,6 +267,10 @@ typedef enum S390Opcode { VRRc_VESRAV = 0xe77a, VRRc_VESRLV = 0xe778, VRRc_VML = 0xe7a2, + VRRc_VMN = 0xe7fe, + VRRc_VMNL = 0xe7fc, + VRRc_VMX = 0xe7ff, + VRRc_VMXL = 0xe7fd, VRRc_VN = 0xe768, VRRc_VNC = 0xe769, VRRc_VNO = 0xe76b, @@ -2728,6 +2732,19 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, tcg_out_insn(s, VRRc, VERLLV, a0, a1, a2, vece); break; + case INDEX_op_smin_vec: + tcg_out_insn(s, VRRc, VMN, a0, a1, a2, vece); + break; + case INDEX_op_smax_vec: + tcg_out_insn(s, VRRc, VMX, a0, a1, a2, vece); + break; + case INDEX_op_umin_vec: + tcg_out_insn(s, VRRc, VMNL, a0, a1, a2, vece); + break; + case INDEX_op_umax_vec: + tcg_out_insn(s, VRRc, VMXL, a0, a1, a2, vece); + break; + case INDEX_op_cmp_vec: switch ((TCGCond)args[3]) { case TCG_COND_EQ: @@ -2774,7 +2791,11 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_shri_vec: case INDEX_op_shrs_vec: case INDEX_op_shrv_vec: + case INDEX_op_smax_vec: + case INDEX_op_smin_vec: case INDEX_op_sub_vec: + case INDEX_op_umax_vec: + case INDEX_op_umin_vec: case INDEX_op_xor_vec: return 1; case INDEX_op_cmp_vec: @@ -3035,6 +3056,10 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_shlv_vec: case INDEX_op_shrv_vec: case INDEX_op_sarv_vec: + case INDEX_op_smax_vec: + case INDEX_op_smin_vec: + case INDEX_op_umax_vec: + case INDEX_op_umin_vec: return C_O1_I2(v, v, v); case INDEX_op_rotls_vec: case INDEX_op_shls_vec: From patchwork Fri Dec 25 20:19:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352308 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7949418jai; Fri, 25 Dec 2020 12:36:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHQrCMD/Kwd0gPShdN46paiCapG+MmGR+/lnBd65MsAhCW80yPBWNF5+nbNBXChGfAv+o8 X-Received: by 2002:a25:8112:: with SMTP id o18mr21369012ybk.208.1608928567338; Fri, 25 Dec 2020 12:36:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608928567; cv=none; d=google.com; s=arc-20160816; b=H4DhWLWokYHvXf+17EoRmMga1A2+9P2ucEhF3lTSJ51WD9NweeukP/xDcXdaUcHzNa Ed/chJHH8piJ6Za7c04Oq9g/uTayaj297eiAS83bQ3/WZycdYma1wVVbaqX6uWtGfntv mxcvV4PbL8TB4AXxFKU4vONZRzNDQLsmdnWiz06poeqZi6Myp1eg7MKx4V7W0tMCM2Qr kc6oROC2uyGXH7ZA1RMwv4smk3eF1zzHkheCYTqIL/B+8scJuTDmrAkyC/EAvDuF2BVF GvjKYSp4tWuMIYz7d04pd4K8MGMpTSU2/WeurWlMD+jom279FXKLi7/enOo2Cc+qZQJT 1IgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=FnMPyDvv8qty8IO8qnH26ldICiCh5lihNUWEYMvpptg=; b=LZxyaQWd1BLWXSmD1bRtlTENwB6X23WXuYqtLazxaZy11CEeU6o3fRGegkxNylvIB6 SsTr0dr611uj4ChLrwM56NVSD4Hreg143FpI2z/NARI7ji6KXlBFGonL4HVznCT9wXp/ 8LJRVqcWeJKeJgTPciSW0z7JC9vUbl5/GpKO3Xm7MkAZGyyyun3FjaiplzzlBGAdOwOx ScbpZBCauCFUG8glmidtGNX5EHP3KQ+h7dvNNWlMfjcoOYY3+pz0fWIz8J6gCupTQg8D Xl2NtlEVUQOp/dCyf5qBnpSER+oWZ9CQVWRURdJtMqHF9RIDpaP68G3pODFrewvpp/dn v/lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UbicDmUA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y13si16784954ybj.57.2020.12.25.12.36.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Dec 2020 12:36:07 -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=UbicDmUA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kstok-0002Ww-Sv for patch@linaro.org; Fri, 25 Dec 2020 15:36:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kstZS-0003HQ-7E for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:18 -0500 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:38929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kstZO-0005Ex-Nb for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:17 -0500 Received: by mail-pg1-x52a.google.com with SMTP id f17so3496223pge.6 for ; Fri, 25 Dec 2020 12:20:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=FnMPyDvv8qty8IO8qnH26ldICiCh5lihNUWEYMvpptg=; b=UbicDmUAJvMOGsWSkGL/+mVIvw5Ma7ysXht2PJH0KvhUiGENQR6YxRuo9xOA+19bBl rXhRRCwya9LCiM22txikfDlabxIsknrVn4US+rsLpsNsp3WSj0Zs4VfY/LdTazVKUasA 16dVOI+qjtYrdG9TM64yUI6BCfK0R1Tqf003A2lSh3rQrSUOOH4NoPoooWJvYkrgIeFO MPwWni+KDMkU2DLoiqbXynnOSn0MeDyXhzNbQ5tj3n6lJfkaAs8zqZGTaOghboToqkxG LgL8SZc+wJdcsywLCvXQDNTwg1ZKdlARCQWK6JI3C25UvrqnfmF5s6pqmJkWmjuA1bR0 R8jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FnMPyDvv8qty8IO8qnH26ldICiCh5lihNUWEYMvpptg=; b=h7+SZsFpwTowlrNHUSmm70WDch0hYCAxpVJfGr9bqAwsSCWKRSVL6wy2jN1Qi+rHEN Y2Rp/6pd5fJz/GD74Pg4REzANSoZe9nNDYUj7snpLSNVhpk66eEPwAqb1N4gZBVLZzUF JkcFaSidgVgPJWBY0ezouzR+/lTA2SxB/HVXFtSDPFYkokAHSWSYXZqa5bGLrzbZcFsD BkkykvxwRgQdZAiREvmqASuJ2HNzs354H/HQYx0Yia2IKzDkRB37H6PagFHA097qUnh3 WYVICOwy4vgUEU87vTMwH0pzGRHuSBXjCip7ooIwIp1B99VYTG0I8djud+Ggf+qsuUsf t5Fw== X-Gm-Message-State: AOAM531B4INbn2divtHdnF9TLfoZ2V1G2xYbpXq2cDw6ZMSIjP3tRWmw S5pBwSkVeP8KvI9qnsvC5+LS2sLDkWAs1Q== X-Received: by 2002:aa7:9f0f:0:b029:19b:c68f:61cd with SMTP id g15-20020aa79f0f0000b029019bc68f61cdmr31432212pfr.45.1608927612954; Fri, 25 Dec 2020 12:20:12 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id l8sm5816497pjt.32.2020.12.25.12.20.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:20:12 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 13/16] tcg: Expand usadd/ussub with umin/umax Date: Fri, 25 Dec 2020 12:19:53 -0800 Message-Id: <20201225201956.692861-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201225201956.692861-1-richard.henderson@linaro.org> References: <20201225201956.692861-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.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.23 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" For usadd, we only have to consider overflow. Since ~B + B == -1, the maximum value for A that saturates is ~B. For ussub, we only have to consider underflow. The minimum value that saturates to 0 from A - B is B. Signed-off-by: Richard Henderson --- tcg/tcg-op-vec.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index d19aa7373e..9747b7bb06 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -120,6 +120,18 @@ bool tcg_can_emit_vecop_list(const TCGOpcode *list, continue; } break; + case INDEX_op_usadd_vec: + if (tcg_can_emit_vec_op(INDEX_op_umin_vec, type, vece) || + tcg_can_emit_vec_op(INDEX_op_cmp_vec, type, vece)) { + continue; + } + break; + case INDEX_op_ussub_vec: + if (tcg_can_emit_vec_op(INDEX_op_umax_vec, type, vece) || + tcg_can_emit_vec_op(INDEX_op_cmp_vec, type, vece)) { + continue; + } + break; case INDEX_op_cmpsel_vec: case INDEX_op_smin_vec: case INDEX_op_smax_vec: @@ -604,7 +616,18 @@ void tcg_gen_ssadd_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) void tcg_gen_usadd_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3_nofail(vece, r, a, b, INDEX_op_usadd_vec); + if (!do_op3(vece, r, a, b, INDEX_op_usadd_vec)) { + const TCGOpcode *hold_list = tcg_swap_vecop_list(NULL); + TCGv_vec t = tcg_temp_new_vec_matching(r); + + /* usadd(a, b) = min(a, ~b) + b */ + tcg_gen_not_vec(vece, t, b); + tcg_gen_umin_vec(vece, t, t, a); + tcg_gen_add_vec(vece, r, r, b); + + tcg_temp_free_vec(t); + tcg_swap_vecop_list(hold_list); + } } void tcg_gen_sssub_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) @@ -614,7 +637,17 @@ void tcg_gen_sssub_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) void tcg_gen_ussub_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b) { - do_op3_nofail(vece, r, a, b, INDEX_op_ussub_vec); + if (!do_op3(vece, r, a, b, INDEX_op_ussub_vec)) { + const TCGOpcode *hold_list = tcg_swap_vecop_list(NULL); + TCGv_vec t = tcg_temp_new_vec_matching(r); + + /* ussub(a, b) = max(a, b) - b */ + tcg_gen_umax_vec(vece, t, a, b); + tcg_gen_sub_vec(vece, r, t, b); + + tcg_temp_free_vec(t); + tcg_swap_vecop_list(hold_list); + } } static void do_minmax(unsigned vece, TCGv_vec r, TCGv_vec a, From patchwork Fri Dec 25 20:19:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352306 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7948543jai; Fri, 25 Dec 2020 12:34:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVs3UFKdVGiib+dUv2v7Dgjjnwnb6gW96wtbjZzi3k0vaIr49b6ShOoDb8fYtmppTWQZGd X-Received: by 2002:a5b:ac4:: with SMTP id a4mr54019426ybr.187.1608928451425; Fri, 25 Dec 2020 12:34:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608928451; cv=none; d=google.com; s=arc-20160816; b=aLULYOwACBtVf446r3gARuubXz5M5yD1RcnQ38UYJyibFSNGa8Ns+WWWpJZ4fmpRlO KlN0JwXls/cic2o2PyqQ3Uk1TK2BHl7jbOWD3f8mWxqVzx7HK/fSIKZS76Z9BInydTUY Ud9AigUxVVrxIYeq4ygrimt8tOODlPzjZ5FCTGqWkSoqUdKO7EpQ8bCGFDye1jRHdiPM mPJkOaOUHuDRtqFaCUC719m4md4rYB9Bb6R2SRRsLx2EKUCMrMchbSw5WUcu2h4nzmtC uwl65Z/QFv9UYrcCtHrJdz6PdM9cXiXAoAMws1xdmwINjWMjV7Q0HdikwIujqIx8FU9h 5ykw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=4hWRe/MilldCXwfwUKlxB4qn+rTkcTstfPjX6z+KyaY=; b=Cb27bDGkr06NzpacUB0q6ko9lW+l2zoklagjl36eWKG5tbR979sYmKBn+TXLzpuqeO GuwWg/Oy5P8a13oSAyN17vietDk8TkiTtgszKOoMokULP4wTS0faL+VcseVyRSoxZOXU dOQ84Ao9gxApVutZOT0uwjdLlkW6aVD77dQcY1IZIhntLsU8qRImESfr3J0J0tfFp+WM sFR35enzlD23IVELLxHlsz5T59PuTrKjubfUxxMakHKAvY3TFnYF0bhm710V/UVRHvBz EeR6VUycuY9LCF48c9H5S75hiNr0VBXE/yIJR9skvMUAvUSHuVHhxy1xQDntWj+OfaQ/ J7nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uNLUB6we; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 135si28179696ybl.177.2020.12.25.12.34.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Dec 2020 12:34:11 -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=uNLUB6we; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kstms-0008Ps-TA for patch@linaro.org; Fri, 25 Dec 2020 15:34:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kstZS-0003Gs-2k for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:18 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:40310) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kstZP-0005GA-M9 for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:17 -0500 Received: by mail-pl1-x630.google.com with SMTP id q4so2714971plr.7 for ; Fri, 25 Dec 2020 12:20:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=4hWRe/MilldCXwfwUKlxB4qn+rTkcTstfPjX6z+KyaY=; b=uNLUB6weJ/Q5Tt+x0xIgwzbVq1ME1fVhTB9UIbMUlkBP8orIX5RsvOK2Vx91KJv/e8 z9f5AIXxnwE8j0oN4CuUUDBNaLDTIgaXHUF0ZOiPMH//9BeK9XyYbsxX+KQETHgAbUNx xajZvh9qnvdRtal/FpRdDBkRlbvRmrpoZaitgf/6w8qkbPlaCIXw5bc8tj6lVCZWb0tE h/DdLsmSxGxK2XQv2qODvklLGTeNnHx5BW3KaYZhHwAzNR1UZ+yjfgUDIUUWZWx/wxkQ DSGZbaPj3JCU25Hd2XYla/QdIvEg+jM7byocdMhTRlQDR84F1TFUhGNP2Y3wpWOw2UzA C5Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4hWRe/MilldCXwfwUKlxB4qn+rTkcTstfPjX6z+KyaY=; b=sfXqn3hoxcu43IuQHHJ1uEO6OWvV+3KlxnlLBwR7vB+tQdhfRuQQ20PW4i3fc8AwJ7 tmB6ApjrqatV6b8qNMoXLuLTCjVWHDqIt8L3becSuy7eMK8aGC0C5i9wPlnaO51vcaVJ r1OiC3aWuplWU/Av6ShCiepf94IxPlqHaUV1TEW+XjuZYu/6akz1QmuhshceQ+B/IJW7 +CyRdDz0AMSjNdJpdGqI8UR+cnKUTCf2JCFUKsgsbOklVVhKsyhT0+3q8y/4EQ1M7Pf9 xHyZdSSjkMAkZSDuV1LeYt7uB6aV+SQdM8/7z9BxsE7H+bu5hQBnUNPfAz8e6+3xgCIe irJw== X-Gm-Message-State: AOAM532nereU8g113vtuhbO5dBfvlhhrClujNgqgNUjBTTpBL3M4Rfd7 q8wwT/a/UX7F5e4yZPTGq6oJ5s4rqmn5TA== X-Received: by 2002:a17:902:b943:b029:dc:6bd:5562 with SMTP id h3-20020a170902b943b02900dc06bd5562mr34498103pls.59.1608927613851; Fri, 25 Dec 2020 12:20:13 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id l8sm5816497pjt.32.2020.12.25.12.20.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:20:13 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 14/16] tcg/s390x: Implement TCG_TARGET_HAS_sat_vec Date: Fri, 25 Dec 2020 12:19:54 -0800 Message-Id: <20201225201956.692861-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201225201956.692861-1-richard.henderson@linaro.org> References: <20201225201956.692861-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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.23 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" The unsigned saturations are handled via generic code using min/max. The signed saturations are expanded using double-sized arithmetic and a saturating pack. Since all operations are done via expansion, do not actually set TCG_TARGET_HAS_sat_vec. Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.opc.h | 3 ++ tcg/s390x/tcg-target.c.inc | 63 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) -- 2.25.1 diff --git a/tcg/s390x/tcg-target.opc.h b/tcg/s390x/tcg-target.opc.h index 7a4578e9b4..85d51cd65e 100644 --- a/tcg/s390x/tcg-target.opc.h +++ b/tcg/s390x/tcg-target.opc.h @@ -10,3 +10,6 @@ * emitted by tcg_expand_vec_op. For those familiar with GCC internals, * consider these to be UNSPEC with names. */ +DEF(s390_vuph_vec, 1, 1, 0, IMPLVEC) +DEF(s390_vupl_vec, 1, 1, 0, IMPLVEC) +DEF(s390_vpks_vec, 1, 2, 0, IMPLVEC) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 36e5924353..ab53c8a05c 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -276,7 +276,10 @@ typedef enum S390Opcode { VRRc_VNO = 0xe76b, VRRc_VO = 0xe76a, VRRc_VOC = 0xe76f, + VRRc_VPKS = 0xe797, /* we leave the m5 cs field 0 */ VRRc_VS = 0xe7f7, + VRRa_VUPH = 0xe7d7, + VRRa_VUPL = 0xe7d6, VRRc_VX = 0xe76d, VRRf_VLVGP = 0xe762, @@ -2761,6 +2764,16 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, } break; + case INDEX_op_s390_vuph_vec: + tcg_out_insn(s, VRRa, VUPH, a0, a1, vece); + break; + case INDEX_op_s390_vupl_vec: + tcg_out_insn(s, VRRa, VUPL, a0, a1, vece); + break; + case INDEX_op_s390_vpks_vec: + tcg_out_insn(s, VRRc, VPKS, a0, a1, a2, vece); + break; + case INDEX_op_mov_vec: /* Always emitted via tcg_out_mov. */ case INDEX_op_dup_vec: /* Always emitted via tcg_out_dup_vec. */ default: @@ -2803,6 +2816,9 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) return -1; case INDEX_op_mul_vec: return vece < MO_64; + case INDEX_op_ssadd_vec: + case INDEX_op_sssub_vec: + return vece < MO_64 ? -1 : 0; default: return 0; } @@ -2858,6 +2874,43 @@ static void expand_vec_cmp(TCGType type, unsigned vece, TCGv_vec v0, } } +static void expand_vec_sat(TCGType type, unsigned vece, TCGv_vec v0, + TCGv_vec v1, TCGv_vec v2, TCGOpcode add_sub_opc) +{ + TCGv_vec h1 = tcg_temp_new_vec(type); + TCGv_vec h2 = tcg_temp_new_vec(type); + TCGv_vec l1 = tcg_temp_new_vec(type); + TCGv_vec l2 = tcg_temp_new_vec(type); + + tcg_debug_assert (vece < MO_64); + + /* Unpack with sign-extension. */ + vec_gen_2(INDEX_op_s390_vuph_vec, type, vece, + tcgv_vec_arg(h1), tcgv_vec_arg(v1)); + vec_gen_2(INDEX_op_s390_vuph_vec, type, vece, + tcgv_vec_arg(h2), tcgv_vec_arg(v2)); + + vec_gen_2(INDEX_op_s390_vupl_vec, type, vece, + tcgv_vec_arg(l1), tcgv_vec_arg(v1)); + vec_gen_2(INDEX_op_s390_vupl_vec, type, vece, + tcgv_vec_arg(l2), tcgv_vec_arg(v2)); + + /* Arithmetic on a wider element size. */ + vec_gen_3(add_sub_opc, type, vece + 1, tcgv_vec_arg(h1), + tcgv_vec_arg(h1), tcgv_vec_arg(h2)); + vec_gen_3(add_sub_opc, type, vece + 1, tcgv_vec_arg(l1), + tcgv_vec_arg(l1), tcgv_vec_arg(l2)); + + /* Pack with saturation. */ + vec_gen_3(INDEX_op_s390_vpks_vec, type, vece + 1, + tcgv_vec_arg(v0), tcgv_vec_arg(h1), tcgv_vec_arg(l1)); + + tcg_temp_free_vec(h1); + tcg_temp_free_vec(h2); + tcg_temp_free_vec(l1); + tcg_temp_free_vec(l2); +} + void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, TCGArg a0, ...) { @@ -2881,6 +2934,13 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, tcg_temp_free_vec(t0); break; + case INDEX_op_ssadd_vec: + expand_vec_sat(type, vece, v0, v1, v2, INDEX_op_add_vec); + break; + case INDEX_op_sssub_vec: + expand_vec_sat(type, vece, v0, v1, v2, INDEX_op_sub_vec); + break; + default: g_assert_not_reached(); } @@ -3041,6 +3101,8 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_sari_vec: case INDEX_op_shli_vec: case INDEX_op_shri_vec: + case INDEX_op_s390_vuph_vec: + case INDEX_op_s390_vupl_vec: return C_O1_I1(v, v); case INDEX_op_add_vec: case INDEX_op_sub_vec: @@ -3060,6 +3122,7 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_smin_vec: case INDEX_op_umax_vec: case INDEX_op_umin_vec: + case INDEX_op_s390_vpks_vec: return C_O1_I2(v, v, v); case INDEX_op_rotls_vec: case INDEX_op_shls_vec: From patchwork Fri Dec 25 20:19:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352299 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7945123jai; Fri, 25 Dec 2020 12:25:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzpWAQi6FSZo52dSGYZTMD6INqC0sXJ1DoM21dwz5KDH2z9lU4pND73gRxNdTmQjPNnSMn4 X-Received: by 2002:a05:6902:20a:: with SMTP id j10mr51624055ybs.293.1608927922612; Fri, 25 Dec 2020 12:25:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608927922; cv=none; d=google.com; s=arc-20160816; b=RS7f3ON8dICNz8zzT8rwz4IjBmwwmGR9905sT0O3l3E/WEuQulG8u1y6ZB48J1+gbR aDHx+KTqX5D40LxrMFOZrpi1paRbxLv1cvsknTROthOYumeMiSlbesXj570WgtLrtRnQ 2986Jq3OGcpiba3VPXEUFyCyCnX+erRECjrmoGPD+16hBQ40GPQ0JZ3bQmsXWUc2l3bf 63cli6vgNXj0UvAADQvrTVS0S5KrxXpS4pVLoVvHDb9ISAhch7BupAHEb1d06MR1ENwT upGRQ4CIXUY/E6C5CrFxjRDobWB65mp35sHnHrQwTO3cMa3dgYa4JiMA6KDQHea3qpKI xl+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=jlVa78AQQNkl87QPxsSEB+lmpeBmWuJ4zOM7kPKIAtQ=; b=HYaqeqGRMvKe1rLOL2aoty38E/u2j4Lf+qx32q+jtMRmASAXOhWBarYU33WJ894N6L FaCyB2JzIzHO62fRpgSGxOA7Jf/geZr3xPFm+fXefdT1sMzjpffkFMdlr+/0yI79MqSh gQbAeb9dtojv/8HJ1klJyLhyYMAYhg4pj8E5nV+gK8JQSOksUcXHGf3SF6BIjpkwWle9 sAMGIyHmqnPHekjLAi2iGYqiAs1B6fKp+hILKtc+ooTXfVTZ6Vq/UC9qgbVmW4M9Uah+ a45yahEsKN4SrNkXmg0MvHQtOHt9aEgqzKUKjR219YrqabGawb9zzKT+2zXW5eO+yc9D Rm1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="zShr/Aaj"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g37si27467312ybj.451.2020.12.25.12.25.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Dec 2020 12:25: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="zShr/Aaj"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksteM-0006Uf-3A for patch@linaro.org; Fri, 25 Dec 2020 15:25:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kstZS-0003Ie-Nw for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:18 -0500 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:45386) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kstZQ-0005Gy-LF for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:18 -0500 Received: by mail-pg1-x52f.google.com with SMTP id v19so3477132pgj.12 for ; Fri, 25 Dec 2020 12:20:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=jlVa78AQQNkl87QPxsSEB+lmpeBmWuJ4zOM7kPKIAtQ=; b=zShr/Aaj+MSeA4JPkE6XYW9tyi8EoxNFnR7evJhBGPBsq3gkfR2frS0b0HPvU373D+ m8P770mNv7SVlCdkFo62qcSOq4fPuig7xClLms5PUl96ONxr1Z/Yx6SAwXDxINyrCeT3 x8I5L32C57IqT2GJA5DfW/aQDGwoTIQwITEZJyacn05Ilgt7BCK/H0r3QbbaqbxOtTc7 9GV4oxq6iQXIx/miXpAEV1RaF3YSU/MnI6GRnLJv/lLiilWBCzvwufg0o/GI0gKGBoQQ k+iJ5636dBoRNKBx54AZyhBFnGs36JsK8duqcbd5pkouIh0fMcd927yDzqGIQNc2y7RD wb3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jlVa78AQQNkl87QPxsSEB+lmpeBmWuJ4zOM7kPKIAtQ=; b=Thw0r96uRAxVjzdbB1vfAFnIWfEFSsN6tnQEanySjBe388gVf7whgZkH7TuaGxjbSg 1/4ekrA8yBN914vSh9BTqu+hlE2lKFSPPxUZ/XZOw4kA1P+VI84a70IwhNZXy5S+u8Uu Sk1jcAyfjHehtpt7l0seD7mZpARttdJbDtjlwG/Dyjs1lxfppZTy5ZJrEVQJ/0WhgCat qmSpP1kcblEgGfM3nNHHqm4IIVkK91t8bc0QDMkwQ/3ETDuW9PdO57DRcihAeVMD9kyn FxzOgIo/HhUur82eC/UjfLdFXkraBzjErXDxckzlrTbjYk6EVmhrarIgrBANEx+iMmnz VKzg== X-Gm-Message-State: AOAM530ut3qQhxPuAa0xM2ev4FYzLFhIU66N43NSIn7AkLqHqkZKpqgc i+eA+eAIk5fD06XjDuzO/LiFBgYpb3M95Q== X-Received: by 2002:a63:d305:: with SMTP id b5mr10165429pgg.452.1608927614966; Fri, 25 Dec 2020 12:20:14 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id l8sm5816497pjt.32.2020.12.25.12.20.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:20:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 15/16] tcg/s390x: Implement TCG_TARGET_HAS_bitsel_vec Date: Fri, 25 Dec 2020 12:19:55 -0800 Message-Id: <20201225201956.692861-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201225201956.692861-1-richard.henderson@linaro.org> References: <20201225201956.692861-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52f.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.23 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" Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target-conset.h | 1 + tcg/s390x/tcg-target.h | 2 +- tcg/s390x/tcg-target.c.inc | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/tcg/s390x/tcg-target-conset.h b/tcg/s390x/tcg-target-conset.h index 9c7dd85eac..4890dbf807 100644 --- a/tcg/s390x/tcg-target-conset.h +++ b/tcg/s390x/tcg-target-conset.h @@ -21,6 +21,7 @@ C_O1_I2(r, r, ri) C_O1_I2(r, rZ, r) C_O1_I2(v, v, r) C_O1_I2(v, v, v) +C_O1_I3(v, v, v, v) C_O1_I4(r, r, ri, r, 0) C_O1_I4(r, r, ri, rI, 0) C_O2_I2(b, a, 0, r) diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index acea745016..afd90788c0 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -153,7 +153,7 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_mul_vec 1 #define TCG_TARGET_HAS_sat_vec 0 #define TCG_TARGET_HAS_minmax_vec 1 -#define TCG_TARGET_HAS_bitsel_vec 0 +#define TCG_TARGET_HAS_bitsel_vec 1 #define TCG_TARGET_HAS_cmpsel_vec 0 /* used for function call generation */ diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index ab53c8a05c..251287dd29 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -281,6 +281,7 @@ typedef enum S390Opcode { VRRa_VUPH = 0xe7d7, VRRa_VUPL = 0xe7d6, VRRc_VX = 0xe76d, + VRRe_VSEL = 0xe78d, VRRf_VLVGP = 0xe762, VRSa_VERLL = 0xe733, @@ -619,6 +620,18 @@ static void tcg_out_insn_VRRc(TCGContext *s, S390Opcode op, tcg_out16(s, (op & 0x00ff) | RXB(v1, v2, v3, 0) | (m4 << 12)); } +static void tcg_out_insn_VRRe(TCGContext *s, S390Opcode op, + TCGReg v1, TCGReg v2, TCGReg v3, TCGReg v4) +{ + tcg_debug_assert(v1 >= TCG_REG_V0 && v1 <= TCG_REG_V31); + tcg_debug_assert(v2 >= TCG_REG_V0 && v2 <= TCG_REG_V31); + tcg_debug_assert(v3 >= TCG_REG_V0 && v3 <= TCG_REG_V31); + tcg_debug_assert(v4 >= TCG_REG_V0 && v4 <= TCG_REG_V31); + tcg_out16(s, (op & 0xff00) | ((v1 & 15) << 4) | (v2 & 15)); + tcg_out16(s, v3 << 12); + tcg_out16(s, (op & 0x00ff) | RXB(v1, v2, v3, v4) | ((v4 & 15) << 12)); +} + static void tcg_out_insn_VRRf(TCGContext *s, S390Opcode op, TCGReg v1, TCGReg r2, TCGReg r3) { @@ -2748,6 +2761,10 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, tcg_out_insn(s, VRRc, VMXL, a0, a1, a2, vece); break; + case INDEX_op_bitsel_vec: + tcg_out_insn(s, VRRe, VSEL, a0, a1, a2, args[3]); + break; + case INDEX_op_cmp_vec: switch ((TCGCond)args[3]) { case TCG_COND_EQ: @@ -2788,6 +2805,7 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_add_vec: case INDEX_op_and_vec: case INDEX_op_andc_vec: + case INDEX_op_bitsel_vec: case INDEX_op_neg_vec: case INDEX_op_not_vec: case INDEX_op_or_vec: @@ -3129,6 +3147,8 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_shrs_vec: case INDEX_op_sars_vec: return C_O1_I2(v, v, r); + case INDEX_op_bitsel_vec: + return C_O1_I3(v, v, v, v); default: g_assert_not_reached(); From patchwork Fri Dec 25 20:19:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352307 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7948564jai; Fri, 25 Dec 2020 12:34:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbTPdBVDuc6C8+1WGhBuaOzhRwX/PVE56kvUdKJ2SmC4Y9pR/h15GZfGPsYliNrdvJkZ9F X-Received: by 2002:a25:a28d:: with SMTP id c13mr50878109ybi.420.1608928453767; Fri, 25 Dec 2020 12:34:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608928453; cv=none; d=google.com; s=arc-20160816; b=cEE6bbT6kDqWWyuTuFWu6A+aI8nu/MXwbyQmy7NVOr/GTCvnBGdpXOptPQgV5wkUQC yv5gnV3ox5UXsrxORVh7YrqeWUfmdga+6sJnXvDlqWLfJwSTfoAr1rr47abjloNWwQKb anfYclACZpate8fHATMZZt7WpYms+gZlReO0nT6CfuLL86oty6gJ1ebGjyFQsKsYXjMI y/uQMMVAyVXusGA5iXM897Y9PWuLN97B54bxBvjQzMWNwm6lZU0nKRfzzYjjhL8DljWm bDBEC22cNW+r1Kt5La3IoaYM4LuO3/O6Z2DzdZbORfjjWEDKJFWJfF85UI3FPEEYiitH hweA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=abCFmcdljX+t9z34gD3bXt4KVs6SigpcHBBDndfp4Sc=; b=URYngcpOp/qcTJmzOwLh37U75TmPrWBktpStjZNbeOaxrSzGVCPPTxnmuc/wJAxX8Q CeqvIAh5hAZXJ2Qg9ubGLu/l6Mx6tqhMtqoW1yJ7ISi2unj/ZiJfvMtjywXX/teIOU1T MXyPJP9QDQGVFP6vdDdNzbYvdbF4wLucqYaV7n51t8HzfV3nzYoe3qIrJ4HKJ2XzGy13 8hz5X1SIPWT7+2lEK6MosdMeigTNjgYEDAKMvNny/1+eDBF0eQ5Xa+x5MMzNc3N3i5Kd am2Vf4u/Nt6o/iZkj3dH3VtjEMff+Qqr5T1QEjKOQITT6jQTGFQjY3EjJns15V/D/1+5 /B8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rnnJfibQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b8si26324852ybo.100.2020.12.25.12.34.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Dec 2020 12:34: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=rnnJfibQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kstmv-0008T6-5s for patch@linaro.org; Fri, 25 Dec 2020 15:34:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kstZU-0003MF-8a for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:20 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:46245) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kstZR-0005HQ-H6 for qemu-devel@nongnu.org; Fri, 25 Dec 2020 15:20:19 -0500 Received: by mail-pl1-x62c.google.com with SMTP id v3so2698055plz.13 for ; Fri, 25 Dec 2020 12:20:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=abCFmcdljX+t9z34gD3bXt4KVs6SigpcHBBDndfp4Sc=; b=rnnJfibQk+eqdFAThgEifjI2k3/vpK89dWT3/b4dtyawN79+oC8dTNNL8kLqW+NohG VR9fFohKILYKdTfRkuQZKnfWBKA00raAwQOHLrDJ+vhiHHF0b6kZJ/63oLoeDp2OCjHA MNVQ79LJeKz6ZZyYhggHA3HRf/JHAnz25pAR21hEeag9kuSkWmXtX8hvBFA+PJNZXrBF mgZ5qAEOmBCV4+x/vofcPaihQxtw4WwbbUPNCmz8rgJhI/iHkwR6za9b5JRXCGjvYM1i TjcBmQgHTRAOBrWg3+bAV1ygvDTQPcjndAS0+X59eaUvIAGY81qFZk9XnDKOi7GL09aA kbQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=abCFmcdljX+t9z34gD3bXt4KVs6SigpcHBBDndfp4Sc=; b=uhFWQB+xvCr/laZOXI6NEATSNY2BB0g4lRGGaVggN0Asgi55Li47qsv56jJIoavAxh ZTU5dS+hlDuh1l6EcOKSMfXVhc7nRUxJy965FLMmAYD/pusw/489x1OzDWtiINaFiNtx tOO9vMuubqE6DG9xz9hurES8MVCPUCcIgK1FKHybItVrfgIGsCl5rgGZbwSqNPdhwuxS GdGYgymfV10Yz04N888JLgFbkmryZJIRG1kttaYkSa6k/YL2DMr0q089rTonGqHxzKMQ LLK5MH/UW7QQCQ1f1UyVlUXwQQRixt7Buk3jo6WsNeSNt5X57BTqKwGBX8Lnz/S+Bg4O 8E8g== X-Gm-Message-State: AOAM531i2on/AqYdz+OJeXDj+tSMhskA0eFADTDpCAfAR0VuU4EOWgN4 m3rquDFyx02KbHMdQYyuOaf/bTOBTcQycg== X-Received: by 2002:a17:90a:a10e:: with SMTP id s14mr9615418pjp.133.1608927615924; Fri, 25 Dec 2020 12:20:15 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id l8sm5816497pjt.32.2020.12.25.12.20.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:20:15 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 16/16] tcg/s390x: Implement TCG_TARGET_HAS_cmpsel_vec Date: Fri, 25 Dec 2020 12:19:56 -0800 Message-Id: <20201225201956.692861-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201225201956.692861-1-richard.henderson@linaro.org> References: <20201225201956.692861-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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.23 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" This is via expansion; don't actually set TCG_TARGET_HAS_cmpsel_vec. Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 251287dd29..a345775e60 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -2830,6 +2830,7 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_xor_vec: return 1; case INDEX_op_cmp_vec: + case INDEX_op_cmpsel_vec: case INDEX_op_rotrv_vec: return -1; case INDEX_op_mul_vec: @@ -2892,6 +2893,21 @@ static void expand_vec_cmp(TCGType type, unsigned vece, TCGv_vec v0, } } +static void expand_vec_cmpsel(TCGType type, unsigned vece, TCGv_vec v0, + TCGv_vec c1, TCGv_vec c2, + TCGv_vec v3, TCGv_vec v4, TCGCond cond) +{ + TCGv_vec t = tcg_temp_new_vec(type); + + if (expand_vec_cmp_noinv(type, vece, t, c1, c2, cond)) { + /* Invert the sense of the compare by swapping arguments. */ + tcg_gen_bitsel_vec(vece, v0, t, v4, v3); + } else { + tcg_gen_bitsel_vec(vece, v0, t, v3, v4); + } + tcg_temp_free_vec(t); +} + static void expand_vec_sat(TCGType type, unsigned vece, TCGv_vec v0, TCGv_vec v1, TCGv_vec v2, TCGOpcode add_sub_opc) { @@ -2933,7 +2949,7 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, TCGArg a0, ...) { va_list va; - TCGv_vec v0, v1, v2, t0; + TCGv_vec v0, v1, v2, v3, v4, t0; va_start(va, a0); v0 = temp_tcgv_vec(arg_temp(a0)); @@ -2945,6 +2961,12 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, expand_vec_cmp(type, vece, v0, v1, v2, va_arg(va, TCGArg)); break; + case INDEX_op_cmpsel_vec: + v3 = temp_tcgv_vec(arg_temp(va_arg(va, TCGArg))); + v4 = temp_tcgv_vec(arg_temp(va_arg(va, TCGArg))); + expand_vec_cmpsel(type, vece, v0, v1, v2, v3, v4, va_arg(va, TCGArg)); + break; + case INDEX_op_rotrv_vec: t0 = tcg_temp_new_vec(type); tcg_gen_neg_vec(vece, t0, v2);