From patchwork Wed Aug 21 02:25:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xionghu Luo X-Patchwork-Id: 1150526 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-507408-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="BgfiapEa"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46Cs4R34F7z9sNF for ; Wed, 21 Aug 2019 12:27:00 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:mime-version:content-transfer-encoding :message-id; q=dns; s=default; b=Xa8b33dtbZk7AoJF/1NszrCVy91Kqdm IRtCU1JK64XrYu3yuF8iA/c42YJAzexbYFrpPQYtQ/+ppqg0dt6BuPNpXETGlC+/ 2YPdzhwFC1N4JiCpkBEWVYaokD0l5bAvCcqhIClTaPC/0BiJnSuNXvU5F5iOHwTw omx75AwCfAZY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:mime-version:content-transfer-encoding :message-id; s=default; bh=zxjrMBEFz4wlwCxZlg7JTNyok38=; b=Bgfia pEaRgbNvuJr465sLuzDWiLaK5ZUHnpzgT1gtJ5w4hOs2dYN7UzG+1kECfeYRL6V7 dQLXgYdieUSodlaQLKzdB7DQJMUHJvYjAPNB8JrIwdLr8Mttt7/DxsI85z+I01x3 Q+on/mQVLd0OEhEbRqTsgSetuUVARF9sFHFWw8= Received: (qmail 30893 invoked by alias); 21 Aug 2019 02:26:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 30313 invoked by uid 89); 21 Aug 2019 02:25:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, MEDICAL_SUBJECT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=Luo, luo, H*Ad:U*wschmidt, HContent-Transfer-Encoding:8bit X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Aug 2019 02:25:57 +0000 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x7L2LuFL127475 for ; Tue, 20 Aug 2019 22:25:55 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ugtf7nq7g-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 20 Aug 2019 22:25:55 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 21 Aug 2019 03:25:53 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 21 Aug 2019 03:25:52 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x7L2PoYH23855356 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Aug 2019 02:25:50 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 82941AE04D; Wed, 21 Aug 2019 02:25:50 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D1E84AE045; Wed, 21 Aug 2019 02:25:49 +0000 (GMT) Received: from moose1.pok.stglabs.ibm.com (unknown [9.114.13.14]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 21 Aug 2019 02:25:49 +0000 (GMT) From: Xiong Hu Luo To: gcc-patches@gcc.gnu.org Cc: richard.sandiford@arm.com, rguenth@gcc.gnu.org, segher@kernel.crashing.org, wschmidt@linux.ibm.com, luoxhu@linux.ibm.com Subject: [PATCH] Add MD Function type check for builtin_md vectorize Date: Tue, 20 Aug 2019 22:25:36 -0400 MIME-Version: 1.0 x-cbid: 19082102-4275-0000-0000-0000035B505E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19082102-4276-0000-0000-0000386D71E4 Message-Id: <20190821022536.64555-1-luoxhu@linux.ibm.com> The DECL_MD_FUNCTION_CODE added in r274404(PR 91421) by rsandifo requires that DECL to be a BUILTIN_IN_MD class built-in, asserts will happen when lto as the patch r274411(PR 91287) outputs some math function symbol to the object, this patch will check function type before do builtin_md vectorize. gcc/ChangeLog 2019-08-21 Xiong Hu Luo * tree-vect-stmts.c (vectorizable_call): Check callee built-in type. * gcc/tree.h (DECL_MD_FUNCTION_P): New function. --- gcc/tree-vect-stmts.c | 2 +- gcc/tree.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 1e2dfe5d22d..ef947f20d63 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -3376,7 +3376,7 @@ vectorizable_call (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, if (cfn != CFN_LAST) fndecl = targetm.vectorize.builtin_vectorized_function (cfn, vectype_out, vectype_in); - else if (callee) + else if (callee && DECL_MD_FUNCTION_P (callee)) fndecl = targetm.vectorize.builtin_md_vectorized_function (callee, vectype_out, vectype_in); } diff --git a/gcc/tree.h b/gcc/tree.h index b910c5cb475..8cce89e5cf3 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -3905,6 +3905,18 @@ DECL_MD_FUNCTION_CODE (const_tree decl) return fndecl.function_code; } +/* Return true if decl is a FUNCTION_DECL with built-in class BUILT_IN_MD. + Otherwise return false. */ +inline bool +DECL_MD_FUNCTION_P (const_tree decl) +{ + const tree_function_decl &fndecl = FUNCTION_DECL_CHECK (decl)->function_decl; + if (fndecl.built_in_class == BUILT_IN_MD) + return true; + else + return false; +} + /* Return the frontend-specific built-in function that DECL represents, given that it is known to be a FUNCTION_DECL with built-in class BUILT_IN_FRONTEND. */