From patchwork Mon Jan 26 21:30:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 433055 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 7DD6B140145 for ; Tue, 27 Jan 2015 08:31:12 +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:subject:message-id:reply-to:mime-version:content-type; q=dns; s=default; b=DFS5auTDsOh9Ai6EYlItcBeVk5V/jDwBoZi2WMvjnZq /8SOOgnK6yE6LAUbnGMfYzu/yIz80KEfz5CTYDrHTzicLW29l7juxmSbOQaY1DHd uGpN1uzxTxIRhH5eJPJkxMG1H3cfuL1CPIAdVX2MZsjc6nqbvrurSAzA3fkzQMik = 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:subject:message-id:reply-to:mime-version:content-type; s=default; bh=ghe7Pck55XXkV0aGIYrZKTyrwrs=; b=wAPEaBDEjuj/E64wC Q4izQoeaDv6JdpYaMpbiwpQE4mw6Og5AJU9+9nVDi5BVgQK9FqshbziBokloEclT RC1HOva2U6nFeU8nX7Dt/xknZjwkHyjqbGEseGJzn79LweW3DOAImgU6KaeD193S aVGEiMYDlYOY5cH5YpAflaz+/A= Received: (qmail 15660 invoked by alias); 26 Jan 2015 21:31:05 -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 15643 invoked by uid 89); 26 Jan 2015 21:31:04 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 26 Jan 2015 21:31:03 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0QLV0vb022035 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 26 Jan 2015 16:31:01 -0500 Received: from tucnak.zalov.cz (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t0QLUx25027988 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO) for ; Mon, 26 Jan 2015 16:31:00 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.9/8.14.9) with ESMTP id t0QLUwgT012512 for ; Mon, 26 Jan 2015 22:30:58 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.9/8.14.9/Submit) id t0QLUvmp012511 for gcc-patches@gcc.gnu.org; Mon, 26 Jan 2015 22:30:57 +0100 Date: Mon, 26 Jan 2015 22:30:57 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] Fix #pragma omp declare simd mangling (PR middle-end/64421) Message-ID: <20150126213057.GX1746@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi! If #pragma omp declare simd function has a name set using __asm, DECL_ASSEMBLER_NAME starts with *. We certainly don't want to put that * as part of the mangled name, if not anything else because most of the assemblers don't handle it as part of identifiers. Fixed thusly, committed to trunk so far. 2015-01-26 Jakub Jelinek PR middle-end/64421 * omp-low.c (simd_clone_mangle): If DECL_ASSEMBLER_NAME starts with asterisk, skip the first character. * gcc.dg/vect/pr64421.c: New test. Jakub --- gcc/omp-low.c.jj 2015-01-23 19:18:55.000000000 +0100 +++ gcc/omp-low.c 2015-01-26 12:57:14.415403539 +0100 @@ -12663,9 +12663,11 @@ simd_clone_mangle (struct cgraph_node *n } pp_underscore (&pp); - pp_string (&pp, - IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl))); - const char *str = pp_formatted_text (&pp); + const char *str = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl)); + if (*str == '*') + ++str; + pp_string (&pp, str); + str = pp_formatted_text (&pp); /* If there already is a SIMD clone with the same mangled name, don't add another one. This can happen e.g. for --- gcc/testsuite/gcc.dg/vect/pr64421.c.jj 2015-01-26 13:48:02.732154064 +0100 +++ gcc/testsuite/gcc.dg/vect/pr64421.c 2015-01-26 13:47:53.000000000 +0100 @@ -0,0 +1,36 @@ +/* PR middle-end/64421 */ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#include "tree-vect.h" + +#pragma omp declare simd linear (y) notinbranch +int foo (int x, int y) __asm ("bar"); + +#pragma omp declare simd linear (y) notinbranch +int +foo (int x, int y) +{ + return x + y; +} + +int a[1024] = { 1, 2 }; + +int +main () +{ + int i; + check_vect (); + #pragma omp simd + for (i = 0; i < 1024; i++) + a[i] = foo (a[i], i); + if (a[0] != 1 || a[1] != 3) + abort (); + for (i = 2; i < 1024; i++) + if (a[i] != i) + abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */