From patchwork Fri Oct 17 14:30:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Stupachenko X-Patchwork-Id: 400539 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 F3C9F14008C for ; Sat, 18 Oct 2014 01:30:53 +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 :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=yIyRHSlZ1J4AKZIo3Nmhr/YUiVGc3xN81maWNXcLGmML8G +USjZAXNCYYEL3LzZBjhGujxCLb/yrYVbIrA4FmXTq0D5v9HT3FKaYhc39klB0/f wfoYEoQ5lEhA6PVHkDuy/fETPlAzZUVU8/NzMEpvl5L355BKI3DCad/dfbHOg= 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 :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=96J6kQBW/loXgnybFHRXpRs860Q=; b=QgeJ3nQ9c6zpoO2xRtk0 uVZLaVLU6EBpxYATqBT2phqVnYjbC54+UTsH25yQCHcVrXLXQW3BeRLU4S3lu+9F PCCKfnjzdChrrvHNZtc1BVu9xyQoimwG504FtsgRBZz3Xs006esMNqChj5iXAgOF Cch93MreFcrDskWkDkDCLi4= Received: (qmail 32426 invoked by alias); 17 Oct 2014 14:30:46 -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 32416 invoked by uid 89); 17 Oct 2014 14:30:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f172.google.com Received: from mail-ie0-f172.google.com (HELO mail-ie0-f172.google.com) (209.85.223.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 17 Oct 2014 14:30:44 +0000 Received: by mail-ie0-f172.google.com with SMTP id rl12so849241iec.17 for ; Fri, 17 Oct 2014 07:30:42 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.107.34.199 with SMTP id i190mr9441434ioi.4.1413556242713; Fri, 17 Oct 2014 07:30:42 -0700 (PDT) Received: by 10.107.6.95 with HTTP; Fri, 17 Oct 2014 07:30:42 -0700 (PDT) Date: Fri, 17 Oct 2014 18:30:42 +0400 Message-ID: Subject: [PATCH, x86, 63534] Fix '-p' profile for 32 bit PIC mode From: Evgeny Stupachenko To: GCC Patches , Jakub Jelinek , Jeff Law , Uros Bizjak , vmakarov X-IsSubscribed: yes Hi, The patch fixes profile in 32bits PIC mode (only -p option affected). x86 bootstrap, make check passed spec2000 o2 -p train data on Corei7: CINT -5% CFP +1,5 compared to a compiler before "enabling ebx". There is a potential performance improve after the patch applied suggested by Jakub: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63534#c8 There is opened bug on this: PR63527. However the fix of the bug is more complicated. Is it ok? ChangeLog 2014-10-16 Evgeny Stupachenko PR target/63534 * config/i386/i386.c (x86_function_profiler): Add GOT register init for mcount call. else { diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index a3ca2ed..5117572 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -39119,11 +39126,15 @@ x86_function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED) } else if (flag_pic) { + fprintf (file,"\tpush\t%%ebx\n"); + fprintf (file,"\tcall\t__x86.get_pc_thunk.bx\n"); + fprintf (file,"\taddl\t$_GLOBAL_OFFSET_TABLE_, %%ebx\n"); #ifndef NO_PROFILE_COUNTERS fprintf (file, "\tleal\t%sP%d@GOTOFF(%%ebx),%%" PROFILE_COUNT_REGISTER "\n", LPREFIX, labelno); #endif fprintf (file, "1:\tcall\t*%s@GOT(%%ebx)\n", mcount_name); + fprintf (file,"\tpop\t%%ebx\n"); }