From patchwork Fri Jan 13 11:40:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 714999 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3v0LKh5zN7z9svs for ; Fri, 13 Jan 2017 22:40:40 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="JI631in7"; dkim-atps=neutral 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:mime-version:content-type; q=dns; s=default; b=gfum6oOqzSHLBI7kzal+ozI0ZsaCdFq+w+zQidudateu4x4hxF xLjyRXNyAppaHoggknftH86D35tQCr111X/6vlD265KILOnu/NUA7Lm6v4ofetNA RA8WYJ/1HJzYbLcy6XVEv5/d2mJE3fdV/YxAq71zrxsOhR1rU8rnJhItE= 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:mime-version:content-type; s= default; bh=WcMJqseknC0zLmG2s+4ruqmPQJY=; b=JI631in7alvJMVnmqqg9 l7lcg7QrTxnIsKkwZQ4ecbmayehG2Dki/eMjC7Si55lQvSchsFMNfyj8UbWmEBK1 eBqmz9t1BdhNAiXs4nN9S3A9lJzvSXQ9BFT5ylgnflFw5FqIeI9TZz++Fr8jF5M6 6zSg6iRDpfeSrxYMREzT4W4= Received: (qmail 33194 invoked by alias); 13 Jan 2017 11:40:30 -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 33184 invoked by uid 89); 13 Jan 2017 11:40:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=flag_pic, lo_sum, TARGET_64BIT, U*1 X-HELO: mail-pf0-f196.google.com Received: from mail-pf0-f196.google.com (HELO mail-pf0-f196.google.com) (209.85.192.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Jan 2017 11:40:19 +0000 Received: by mail-pf0-f196.google.com with SMTP id 127so8127635pfg.0 for ; Fri, 13 Jan 2017 03:40:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=GDiXwM5BQ1yL7uPpkgVPF0vtckDeHjGM3kWyIXP93pY=; b=SmSXSa/imMdReFBa9PfdjsH3LIsFfNPzuE+QFHqdzpqMRPZB55TIobyDy7R9KCsU92 OJ9cfRd7PvnqWaJXEnbjYte9Xiys8WF7L2DqaT+otqCjrsHSuE3FSi2CkOC9P/w3RHpM IeTyunZDIVyucBXcQfqaR1sAx4clc4sLs3+QI5n26ggvmyJ461ZjfhI1Njzql9j5RMz2 WDgUbwvUZkuExyyBG7GKsdgY8S0N1ghj6sgFFHpoDmHS0lpTvHojy1TIKhvAVRhH6vZq qSuaEUX0KMn6VwG5zFuFqGuNHCx0hCkzvSMFxG08GVLTpbT5ES6T1fYYDcU7/4fnom7o 9VpA== X-Gm-Message-State: AIkVDXJg1ibA+hD1KBckFH+y4nIbIDJ0v7e8Hs5oVwWVDOh2OJua9QWX3oI8ucf/ILL65w== X-Received: by 10.98.16.7 with SMTP id y7mr22111711pfi.55.1484307618081; Fri, 13 Jan 2017 03:40:18 -0800 (PST) Received: from bubble.grove.modra.org (CPE-58-160-71-80.tyqh2.lon.bigpond.net.au. [58.160.71.80]) by smtp.gmail.com with ESMTPSA id i10sm28810056pgd.37.2017.01.13.03.40.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jan 2017 03:40:17 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id B7B41C17DA; Fri, 13 Jan 2017 22:10:12 +1030 (ACDT) Date: Fri, 13 Jan 2017 22:10:12 +1030 From: Alan Modra To: gcc-patches@gcc.gnu.org Cc: Segher Boessenkool Subject: PR79066, non-PIC code generated for powerpc glibc with -fpic Message-ID: <20170113114012.GT32333@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes Bootstrapped and regression tested powerpc64-linux biarch. elf_high has said "Elf specific ways of loading addresses for non-PIC code" ^^^^^^^ right from the inital V4 support in 1995. OK for mainline? PR target/79066 * config/rs6000/rs6000.md (elf_high, elf_low): Disable when pic. testsuite/ * gcc.target/powerpc/pr79066.c: New. diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 80c10a7..98209fa 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -10597,14 +10597,14 @@ (define_insn_and_split "*tocref" (define_insn "elf_high" [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r") (high:SI (match_operand 1 "" "")))] - "TARGET_ELF && ! TARGET_64BIT" + "TARGET_ELF && !TARGET_64BIT && !flag_pic" "lis %0,%1@ha") (define_insn "elf_low" [(set (match_operand:SI 0 "gpc_reg_operand" "=r") (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b") (match_operand 2 "" "")))] - "TARGET_ELF && ! TARGET_64BIT" + "TARGET_ELF && !TARGET_64BIT && !flag_pic" "la %0,%2@l(%1)") ;; Call and call_value insns diff --git a/gcc/testsuite/gcc.target/powerpc/pr79066.c b/gcc/testsuite/gcc.target/powerpc/pr79066.c new file mode 100644 index 0000000..86b2014 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr79066.c @@ -0,0 +1,14 @@ +/* { dg-do compile { target { fpic && ilp32 } } } */ +/* { dg-options "-O2 -fpic" } */ +/* { dg-final { scan-assembler-not "lis.*@ha" } } */ + +union U { double x; int i[2]; }; + +double +foo (double x) +{ + union U v; + v.i[0] = 0x7ff00000; + v.i[1] = 0; + return x / v.x; +}