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: liuhongt X-Patchwork-Id: 158344 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp350535vqb; Wed, 25 Oct 2023 18:15:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFSKF/8rkyuRFIlNAQn+7rEGxiVCOXaY6pN4AS9NfPg0pXtg87tJx5Kyp3NptaCD5m5/VYK X-Received: by 2002:a05:620a:269b:b0:775:77a5:f20b with SMTP id c27-20020a05620a269b00b0077577a5f20bmr18197446qkp.59.1698282907290; Wed, 25 Oct 2023 18:15:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698282907; cv=pass; d=google.com; s=arc-20160816; b=Uq2kVqrLC0zGmlNSJIyQ/l9wDCOJD6sg28b/zLca7/H2tBgxLpzDC4bZ7t5lJI9T/J inuIIaWBDQd7evy4A9bd/AIq5AlujW0aJ8GarbPCbzn/rdLYQ2vHHPY/tOQqrcNXSGWe XUYpa63GgsTF34wzc/NX/uZ70Wa4fO7WDEOH29tmwhDKu4Enp25PKIBRzY88/Bn/qgVu UdCdgj9QQ5ewlUyEWOUdL9Evnx91b6DO9yZDkXG/d4P2KX8Qi66SOU46l7ZWEbxDPhbD flTaOo5tYoP7H3Ad4RzPMu+BM8ZHgaSAEYhQFDMuvHzHOWHx/54fpaTRBhyrVLsCGhR5 omrA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=zN7Mas+KCPLFrQwHWR7Me8z46uWi3MCsdYc+cZUvJxE=; fh=ChXOctppJn0KECDRINafwUY5xHRufGHaa0Ju9pddrcQ=; b=DdtwBc9UAxytMfM0x9OvhgwHMPuIvpL9D/yVpYFOVtQqs4ttIq9MRRclfOKzpgxlM3 mGl3tNpVFgzj27PkOkhcJx3dv+I8UacQ/698rlqNA4yucG+I3GMuVgjcKOwQ7cZpdZ+z TYVL3Oe3nvPOUku+GgU64pz76iiHYtJDFyfAi5TWb8CqE8PaLG30d6D+7L5Gn3R73uMa gBd4Gj/+Yxhds2j86ie1I8ozGRQp1SSvmrJoqZQWZlfDuJ49FkTxTl6fuRxnBCwPtJKV qTdJRkTHguMXa8gnwIqz2Qsbv9hsv1M/Rq/pE+Jf6cO86MEmVUFYrq3QM2xEfM6RBFiF DogA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="na8/7wmU"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id w22-20020a05620a445600b007775b775bddsi8424978qkp.703.2023.10.25.18.15.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 18:15:07 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="na8/7wmU"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0B68B3856968 for ; Thu, 26 Oct 2023 01:15:07 +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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780778697931094955 X-GMAIL-MSGID: 1780778697931094955 >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); }