From patchwork Mon Nov 26 20:52:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1003483 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-490918-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="vyRZ14fL"; 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 433fHt4kcXz9s3Z for ; Tue, 27 Nov 2018 07:52:42 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=JFCBawzKOkhRzfldwzYHJq3lEJzE5 nnd+1rH1pHemV15Xo0VLsfP7eQEC9WD8uZy8u5mJcDCn6QGNY3jptouizUigLAZ0 b0OhrL+NS5NyYKKWZVo9dFsdSdZBYgt6wxdW9N4cPkrgJvJLemgz892Kq2hpZ2+Y iYecyoZ/AGKrjI= 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=31yiHrsf1Z3OcBxwva+i43domjY=; b=vyR Z14fLk1owCePd0taHgkp1GyK63zHxkthzIhlXdh+WANrk0E1LAIJFQTDjZdaevhA ePG/ASJOTt/AHxSd0dJv/BLGCWk7yeEnflW26tlEf0kLG+N+tLaOsbMd4+CabxIt UsHIa87Aqkk45znSP4vhCtgxZiFt5zImCASqSFss= Received: (qmail 101072 invoked by alias); 26 Nov 2018 20:52:35 -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 101055 invoked by uid 89); 26 Nov 2018 20:52:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=wrt X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 26 Nov 2018 20:52:34 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 27DBB88E71; Mon, 26 Nov 2018 20:52:33 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-117-187.ams2.redhat.com [10.36.117.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF2C85DE70; Mon, 26 Nov 2018 20:52:32 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id wAQKqUDj018161; Mon, 26 Nov 2018 21:52:30 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id wAQKqTsf018160; Mon, 26 Nov 2018 21:52:29 +0100 Date: Mon, 26 Nov 2018 21:52:29 +0100 From: Jakub Jelinek To: Uros Bizjak , Andi Kleen Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix ptwrite64 handling with -m32 (PR target/88195) Message-ID: <20181126205229.GJ12380@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes Hi! The following patch makes def_builtin2 behave consistently wrt. OPTION_MASK_ISA_64BIT requirement to def_builtin. The latter has: tree decl = NULL_TREE; if (!(mask & OPTION_MASK_ISA_64BIT) || TARGET_64BIT) { ... } return decl; and so if some builtin requires TARGET_64BIT, it is never defined for -m32; that is an option affecting the whole TU. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2018-11-26 Jakub Jelinek PR target/88195 * config/i386/i386.c (def_builtin2): If tcode == VOID_FTYPE_UINT64 and !TARGET_64BIT, return NULL_TREE. * gcc.target/i386/pr88195.c: New test. Jakub --- gcc/config/i386/i386.c.jj 2018-11-22 22:35:05.741447372 +0100 +++ gcc/config/i386/i386.c 2018-11-26 14:31:28.074501784 +0100 @@ -30179,9 +30179,13 @@ def_builtin2 (HOST_WIDE_INT mask, const { tree decl = NULL_TREE; - ix86_builtins_isa[(int) code].isa2 = mask; if (tcode == VOID_FTYPE_UINT64) - ix86_builtins_isa[(int) code].isa = OPTION_MASK_ISA_64BIT; + { + if (!TARGET_64BIT) + return decl; + ix86_builtins_isa[(int) code].isa = OPTION_MASK_ISA_64BIT; + } + ix86_builtins_isa[(int) code].isa2 = mask; if (mask == 0 || (mask & ix86_isa_flags2) != 0 --- gcc/testsuite/gcc.target/i386/pr88195.c.jj 2018-11-26 14:41:29.098641863 +0100 +++ gcc/testsuite/gcc.target/i386/pr88195.c 2018-11-26 14:41:00.366113191 +0100 @@ -0,0 +1,8 @@ +/* PR target/88195 */ +/* { dg-options "-mptwrite" } */ + +void +foo (void) +{ + __builtin_ia32_ptwrite64 (1); /* { dg-warning "implicit declaration of function" "" { target ia32 } } */ +}