From patchwork Thu Oct 26 01:14:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liu, Hongtao" X-Patchwork-Id: 1855557 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=na8/7wmU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SG7BS2rnwz202k for ; Thu, 26 Oct 2023 12:14:56 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0DB653857702 for ; Thu, 26 Oct 2023 01:14:52 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by sourceware.org (Postfix) with ESMTPS id 34A413858C31 for ; Thu, 26 Oct 2023 01:14:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 34A413858C31 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 34A413858C31 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.55.52.93 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698282878; cv=none; b=D6G4dr4My1CA/Z0oW5NFmUD0FAxe8LvtPhwvnUFSZPiL2IHBYYlGHeTjyRZW4NyCz8X/pWsfFnCL2PjvaExWpvY/zTnjqjwC07nKQiX8IxoZFKec7pi6Hjh0/0a9DI3h+SzqpVZb9lkEwK9V47IsJrY7R/NfPCLzZlqVY86PyDs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698282878; c=relaxed/simple; bh=PHzazmWTVtwfJc1p087wDn092aXRNGGGg49G3rUCgvM=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=bjAHNHv5fQJnm1tTZ49Qu5W9whjgxE6vfmktRqK7jV3FfOmA6nJqY6r9UiHFGNw8iTkMJnSEXIUAhXGPJcZlQPwTdQcw8AmyzzBJM/aEj5ii1+txyVwxkE5Vnh1OFW7OHJCtS74uaiDNRlk3todIyFXT1mTmZMqGtid6pHuxR+c= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698282876; x=1729818876; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=PHzazmWTVtwfJc1p087wDn092aXRNGGGg49G3rUCgvM=; b=na8/7wmUOUIjZZE4umgj5VUocruVHrL8swGCpXgHYgdVy6aSOK2ZBGnD i05ORLOtYzuCPRJNpYavNMC0vsAmWTGzeMtrudAaWH2uAIpu6li7gIlH0 VJcz9Yo5u3VPw8Cvf3O9/DDmN6kOb4TRzgscmfjqICqNqVJvA+HDPTzl5 nsAsYjoPPPOi4BH/brjM7TEZROdtaztCA8J2ZU+CvD+Y/4LCUAXmhLh0c URTAUmw6KdoZFhTsLHNpbnM6BT9TouWDaDMkVQ9sDjuIv+rSdzMfP4cRT uxEwhyCjkIigS0v+mr0PObfDohy6bjBJUIh9orAJwJ3t/rPRCffAcCdmC w==; X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="384644489" X-IronPort-AV: E=Sophos;i="6.03,252,1694761200"; d="scan'208";a="384644489" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2023 18:14:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="875730702" X-IronPort-AV: E=Sophos;i="6.03,252,1694761200"; d="scan'208";a="875730702" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by fmsmga002.fm.intel.com with ESMTP; 25 Oct 2023 18:14:32 -0700 Received: from shliclel4217.sh.intel.com (shliclel4217.sh.intel.com [10.239.240.127]) by shvmail03.sh.intel.com (Postfix) with ESMTP id 2FAE91005703; Thu, 26 Oct 2023 09:14:32 +0800 (CST) From: liuhongt To: gcc-patches@gcc.gnu.org Cc: crazylht@gmail.com, hjl.tools@gmail.com Subject: [PATCH V2 1/2] Pass type of comparison operands instead of comparison result to truth_type_for in build_vec_cmp. Date: Thu, 26 Oct 2023 09:14:31 +0800 Message-Id: <20231026011432.3484969-1-hongtao.liu@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org >I think it's indeed on purpose that the result of v1 < v2 is a signed >integer vector type. >But build_vec_cmp should not use the truth type for the result but instead the >truth type for the comparison, so Change build_vec_cmp in both c/c++, also notice for jit part, it already uses type of comparison instead of the result. gcc/c/ChangeLog: * c-typeck.cc (build_vec_cmp): Pass type of arg0 to truth_type_for. gcc/cp/ChangeLog: * typeck.cc (build_vec_cmp): Pass type of arg0 to truth_type_for. --- gcc/c/c-typeck.cc | 2 +- gcc/cp/typeck.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index e55e887da14..41ee38368f2 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -11982,7 +11982,7 @@ build_vec_cmp (tree_code code, tree type, { tree zero_vec = build_zero_cst (type); tree minus_one_vec = build_minus_one_cst (type); - tree cmp_type = truth_type_for (type); + tree cmp_type = truth_type_for (TREE_TYPE (arg0)); tree cmp = build2 (code, cmp_type, arg0, arg1); return build3 (VEC_COND_EXPR, type, cmp, minus_one_vec, zero_vec); } diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc index 8132bd7fccc..7b2ad51bde7 100644 --- a/gcc/cp/typeck.cc +++ b/gcc/cp/typeck.cc @@ -4826,7 +4826,7 @@ build_vec_cmp (tree_code code, tree type, { tree zero_vec = build_zero_cst (type); tree minus_one_vec = build_minus_one_cst (type); - tree cmp_type = truth_type_for (type); + tree cmp_type = truth_type_for (TREE_TYPE (arg0)); tree cmp = build2 (code, cmp_type, arg0, arg1); return build3 (VEC_COND_EXPR, type, cmp, minus_one_vec, zero_vec); }