From patchwork Thu Jan 2 18:06:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 854729 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp7907374wrq; Thu, 2 Jan 2025 10:22:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV4DTX7hEpfqNXRy2dGXfQPpjDmlWFB/K8ePwn6+KnD4uOxyk9fXRL4c+7KWupaLSSDyU3x8g==@linaro.org X-Google-Smtp-Source: AGHT+IHdjtk7Lsf1zeBslbOiTmPC0qTYn3fl2VNntXs+lrGBoeqovjFA1aFV4jyV0VCCcFQglld/ X-Received: by 2002:a05:622a:14d4:b0:467:4fc5:9d71 with SMTP id d75a77b69052e-46a4a8fba06mr735997851cf.28.1735842144728; Thu, 02 Jan 2025 10:22:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735842144; cv=none; d=google.com; s=arc-20240605; b=A81kLEObk4myeFl+oeTfPviKKx6tviq4FmxIxsoP8MzuIlJnHTitylPbTGGhpUoxTa l4m26ZWV08cAzYfNQYiMTpNgqnydMSnNAOMngVbfzQB8/JOeNCItC/9A2CEJ7ghkZvgD TLTxFeDR/ZI+nqrXjYZq57NJ8xxCusfFJHQYbazj20E+RP/jQLUka5uL9iWYltId61QT 4THAiKIHkGHoXHOaB3QBloDP8lEJoj7ddjv63J0Dm8GcpsEG2nx1BHngQLQguHVsdKqw aBagRArpfu6lHmMhOeibUk+xkTuWPP15oUIeYP04NAt6LTdPBx0tIy4UvyDG/IflcvFA VT8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=qRTRGU6k78zuTqZxSVPRDcDDC4xOL8LEthPY2mCtCXw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ZJgWMT88nv/1++T4m6oz2ZNzf6vTDAe6JcDkEAMBxh4Z494eXoYZ6ZRpmIbGtLsZ4l jsyDGBa2+p3/A8zKdztFBqIj9p0XsYCTFf7wGOe3w8oi9hPKkP80birOH/5RnWdyhXaN 7EG2lVaHPppBAHMuU+Dfjic0yOv4A6LtXfXYgc8oMK05l1271adml414lCfWC9KQYX0v d+Jo8CjmCPjUUH8cizOLlMBhnzI2nKoUlBqojszxgIwLgkOBNSrPmwhmeE+iTD7wCr7B 0FBh5Uj6XVd9Z/gXt73yLiF29DKRNJDDqDewwNJoCRYkIfua8CnP7liPsIkzzM7TZXwz pXhA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FMbJuThj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46a3e685b4fsi339401351cf.77.2025.01.02.10.22.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jan 2025 10:22: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=FMbJuThj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTPfU-0004FC-EM; Thu, 02 Jan 2025 13:11:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tTPeg-0007Qg-1x for qemu-devel@nongnu.org; Thu, 02 Jan 2025 13:10:47 -0500 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTPed-0006Fa-3r for qemu-devel@nongnu.org; Thu, 02 Jan 2025 13:10:45 -0500 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-21649a7bcdcso154755955ad.1 for ; Thu, 02 Jan 2025 10:10:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735841442; x=1736446242; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=qRTRGU6k78zuTqZxSVPRDcDDC4xOL8LEthPY2mCtCXw=; b=FMbJuThjEJiVWBDew0iW7EpNqua3ZqMqz/5BoiEsJNTkwwufXcjnJH7X1n55L1SJ4/ yfEegLUmwPG3v943Rpr+KfbnjLYcehlZoya3YYKqO27EacXkgRHqHtLCh11Ayj56Hrvh yDtgX0dnlsJ4SbDuLcdeRJVuraFR14NZKYy8CNrjuVoDGvPUOSkZxPDoLrNQQlfo3T0P oR6TJOsRQ/T2X72Qv3YAgtw0NUY/FpQfOHQTQh2YqijbVCiY0BIFE1E/Huk/TVuGg8xz vfJWY/c0dMZjiNf/UUDqAbiys+Mra4M9+6FiQKv4Uqogpr76lXDEYAu6vLgSlsWrQZZv rXPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735841442; x=1736446242; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qRTRGU6k78zuTqZxSVPRDcDDC4xOL8LEthPY2mCtCXw=; b=Glt2S+gzM6rLWGKmdeL/YvwTJoIpHvIivm8zmZ5TCEUIbfk52UuBP6l4FjrpytMJvc Qlj7p5VUXgnG9MUjJ1tdvgHM9Pjc7Wz9iCghUbA41feVAVMdGiz2zT0KMy7jGJ2BVeus eOdt7uNr/JgZTJEni4eRoJ6Q7BCFxawwomhQveo4fw0brzTnPRBKKygu9vDJE3AIhs7+ /Dsf8XRiXzUIHemhrBf2fgj0Yf9Ui2ni25RqizgOW9H2IALHzIw5jKrTQGmvF2XLoWzP XmuzZ0GJNjSebNfSoL3F2pAH012ycMxk1X9D/v+vgfwPUxjtzzOjRu+aVVc90i5dRKZ4 ol6A== X-Gm-Message-State: AOJu0YxqJZIRoUeKmBG3CgsaNmzpleSYSZcPOx5m/X921AJPelHArIFF BgpEqmAByYYge+JgY9xI1a7m9J2LKc6yhEXc0ri9p5jIxBsxg91NnMthhjSZhF2wG4/1rhy2U/q Z X-Gm-Gg: ASbGncsNL5IK/MzhCbl9fahpLoL3c3KF9YKpvZ0EC88cWCcHJmhRWdw3aPf8YX+Y7Ej s9MAP3VkX+7BX/7e8tVLRkMxsd7ejii3Pnh8jEBcQWbcu51KbiB6nGNZiEvawd7mjg7tkDaslYw SvjhI4NrCMjkxLwfMi9g70Px4o5Ocqy9svpVfw7CfMEOVp4Uf8EUQWzMUe4jf98BvRHsSvD2hNa ZpLWlkyl/+unPPVBsdoK9k8OeQDg2pHA+x/gXgkL8LPa/yiL0oBxQaIXlvlvg== X-Received: by 2002:a05:6a21:e96:b0:1e0:f390:f300 with SMTP id adf61e73a8af0-1e5e082f951mr64459404637.44.1735841441816; Thu, 02 Jan 2025 10:10:41 -0800 (PST) Received: from stoup.. ([63.239.63.212]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8dbaf1sm24620827b3a.112.2025.01.02.10.10.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jan 2025 10:10:41 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 60/73] tcg: Change have_vec to has_type in tcg_op_supported Date: Thu, 2 Jan 2025 10:06:40 -0800 Message-ID: <20250102180654.1420056-61-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250102180654.1420056-1-richard.henderson@linaro.org> References: <20250102180654.1420056-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Test each vector type, not just lumping them all together. Add tests for I32 (always true) and I64 (64-bit hosts). Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- tcg/tcg.c | 66 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index c604785d39..3d641d6d00 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2136,8 +2136,28 @@ TCGTemp *tcgv_i32_temp(TCGv_i32 v) */ bool tcg_op_supported(TCGOpcode op, TCGType type) { - const bool have_vec - = TCG_TARGET_HAS_v64 | TCG_TARGET_HAS_v128 | TCG_TARGET_HAS_v256; + bool has_type; + + switch (type) { + case TCG_TYPE_I32: + has_type = true; + break; + case TCG_TYPE_I64: + has_type = TCG_TARGET_REG_BITS == 64; + break; + case TCG_TYPE_V64: + has_type = TCG_TARGET_HAS_v64; + break; + case TCG_TYPE_V128: + has_type = TCG_TARGET_HAS_v128; + break; + case TCG_TYPE_V256: + has_type = TCG_TARGET_HAS_v256; + break; + default: + has_type = false; + break; + } switch (op) { case INDEX_op_discard: @@ -2327,60 +2347,60 @@ bool tcg_op_supported(TCGOpcode op, TCGType type) case INDEX_op_or_vec: case INDEX_op_xor_vec: case INDEX_op_cmp_vec: - return have_vec; + return has_type; case INDEX_op_dup2_vec: - return have_vec && TCG_TARGET_REG_BITS == 32; + return has_type && TCG_TARGET_REG_BITS == 32; case INDEX_op_not_vec: - return have_vec && TCG_TARGET_HAS_not(type); + return has_type && TCG_TARGET_HAS_not(type); case INDEX_op_neg_vec: - return have_vec && TCG_TARGET_HAS_neg_vec; + return has_type && TCG_TARGET_HAS_neg_vec; case INDEX_op_abs_vec: - return have_vec && TCG_TARGET_HAS_abs_vec; + return has_type && TCG_TARGET_HAS_abs_vec; case INDEX_op_andc_vec: - return have_vec && TCG_TARGET_HAS_andc(type); + return has_type && TCG_TARGET_HAS_andc(type); case INDEX_op_orc_vec: - return have_vec && TCG_TARGET_HAS_orc(type); + return has_type && TCG_TARGET_HAS_orc(type); case INDEX_op_nand_vec: - return have_vec && TCG_TARGET_HAS_nand(type); + return has_type && TCG_TARGET_HAS_nand(type); case INDEX_op_nor_vec: - return have_vec && TCG_TARGET_HAS_nor(type); + return has_type && TCG_TARGET_HAS_nor(type); case INDEX_op_eqv_vec: - return have_vec && TCG_TARGET_HAS_eqv(type); + return has_type && TCG_TARGET_HAS_eqv(type); case INDEX_op_mul_vec: - return have_vec && TCG_TARGET_HAS_mul_vec; + return has_type && TCG_TARGET_HAS_mul_vec; case INDEX_op_shli_vec: case INDEX_op_shri_vec: case INDEX_op_sari_vec: - return have_vec && TCG_TARGET_HAS_shi_vec; + return has_type && TCG_TARGET_HAS_shi_vec; case INDEX_op_shls_vec: case INDEX_op_shrs_vec: case INDEX_op_sars_vec: - return have_vec && TCG_TARGET_HAS_shs_vec; + return has_type && TCG_TARGET_HAS_shs_vec; case INDEX_op_shlv_vec: case INDEX_op_shrv_vec: case INDEX_op_sarv_vec: - return have_vec && TCG_TARGET_HAS_shv_vec; + return has_type && TCG_TARGET_HAS_shv_vec; case INDEX_op_rotli_vec: - return have_vec && TCG_TARGET_HAS_roti_vec; + return has_type && TCG_TARGET_HAS_roti_vec; case INDEX_op_rotls_vec: - return have_vec && TCG_TARGET_HAS_rots_vec; + return has_type && TCG_TARGET_HAS_rots_vec; case INDEX_op_rotlv_vec: case INDEX_op_rotrv_vec: - return have_vec && TCG_TARGET_HAS_rotv_vec; + return has_type && TCG_TARGET_HAS_rotv_vec; case INDEX_op_ssadd_vec: case INDEX_op_usadd_vec: case INDEX_op_sssub_vec: case INDEX_op_ussub_vec: - return have_vec && TCG_TARGET_HAS_sat_vec; + return has_type && TCG_TARGET_HAS_sat_vec; case INDEX_op_smin_vec: case INDEX_op_umin_vec: case INDEX_op_smax_vec: case INDEX_op_umax_vec: - return have_vec && TCG_TARGET_HAS_minmax_vec; + return has_type && TCG_TARGET_HAS_minmax_vec; case INDEX_op_bitsel_vec: - return have_vec && TCG_TARGET_HAS_bitsel_vec; + return has_type && TCG_TARGET_HAS_bitsel_vec; case INDEX_op_cmpsel_vec: - return have_vec && TCG_TARGET_HAS_cmpsel_vec; + return has_type && TCG_TARGET_HAS_cmpsel_vec; default: tcg_debug_assert(op > INDEX_op_last_generic && op < NB_OPS);