From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23550 invoked by alias); 10 Apr 2018 13:26:43 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 23510 invoked by uid 89); 10 Apr 2018 13:26:42 -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_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-wm0-f48.google.com Received: from mail-wm0-f48.google.com (HELO mail-wm0-f48.google.com) (74.125.82.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Apr 2018 13:26:41 +0000 Received: by mail-wm0-f48.google.com with SMTP id u189so26101827wmd.1; Tue, 10 Apr 2018 06:26:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:cc:from :message-id; bh=Wr8PVvGOIh3XJA0286tTq+m2BPDkwSCFWVRwqwR7KM0=; b=Cc4sQqadsTSamC494Reh7Vi7CxpcfzkjkzLUkIz/WdCD4JkTdosZk1mIG+UPlzFgXF V9UmXmBjT8RO468hd8FAihPNT/pM5//KNn7dQLsF2PbOSU+rhqrSEai+TPjL+YIo2Rp9 /MVpcRtxSeJNw0x+cd58lbLT76fEfR4zo6ARR6XPnERJ95SHpfQv97fBfJcx6ruGWoDO aBq8hBgZHdmMSskq6/htoCVA2u14DuEsYCRhsqoVNJ0OCVp7jn9GtPQujVic/xUz+M8m c1VmNw2jeK9YZx4YwlU7+pHqA33XKz+hSCj917A/oz8MIRgiLcP3KPakroq2spsE8nkQ D/4Q== X-Gm-Message-State: ALQs6tD3abgrBUcbVv5qSP5QDjHf4DH3F5+9YPCAdjgxULKCzSshrpV6 r0bwUiEASgcXRA9Ry1RdiQ8= X-Google-Smtp-Source: AIpwx49trA0JVBSlFY6Pu7HSHjVAq2G21LT5WamU3DeXVxbZ8TMKxegPSjqR5+BAmQDvg4POOu56mQ== X-Received: by 10.28.149.71 with SMTP id x68mr1840109wmd.78.1523366799249; Tue, 10 Apr 2018 06:26:39 -0700 (PDT) Received: from [192.168.178.32] (p2E530C99.dip0.t-ipconnect.de. [46.83.12.153]) by smtp.gmail.com with ESMTPSA id n64sm1661830wmd.11.2018.04.10.06.26.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Apr 2018 06:26:38 -0700 (PDT) Date: Tue, 10 Apr 2018 13:27:00 -0000 User-Agent: K-9 Mail for Android In-Reply-To: <20180410130655.GD8577@tucnak> References: <6a8d496b-d830-5eb2-eba3-c2e452d06493@arm.com> <80c395e1-9de5-1d9c-35b6-1ccfdfa6a9e5@arm.com> <20180410102954.GB8577@tucnak> <20180410130655.GD8577@tucnak> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: libmvec in gcc to have vector math in fortran To: Jakub Jelinek CC: Szabolcs Nagy ,Janne Blomqvist ,nd@arm.com,GCC Development ,Fortran List ,Steve Ellcey From: Richard Biener Message-ID: <98A434FE-32AD-43ED-AA66-A49177BF5D6B@gmail.com> X-IsSubscribed: yes X-SW-Source: 2018-04/txt/msg00068.txt.bz2 On April 10, 2018 3:06:55 PM GMT+02:00, Jakub Jelinek wr= ote: >On Tue, Apr 10, 2018 at 02:55:43PM +0200, Richard Biener wrote: >> > And the easiest solution is in the Fortran FE based on some flag >> > (e.g. -mveclibabi=3Dglibc) through a target hook add >> > __attribute__((__simd__ ("notinbranch"))) >> > to the builtins like __builtin_sin etc. that have them in the >> > glibc header (x86_64 -m64 and -ffast-math only): >> > >> > # undef __DECL_SIMD_cos >> > # define __DECL_SIMD_cos __DECL_SIMD_x86_64 >> > # undef __DECL_SIMD_cosf >> > # define __DECL_SIMD_cosf __DECL_SIMD_x86_64 >> > # undef __DECL_SIMD_sin >> > # define __DECL_SIMD_sin __DECL_SIMD_x86_64 >> > # undef __DECL_SIMD_sinf >> > # define __DECL_SIMD_sinf __DECL_SIMD_x86_64 >> > # undef __DECL_SIMD_sincos >> > # define __DECL_SIMD_sincos __DECL_SIMD_x86_64 >> > # undef __DECL_SIMD_sincosf >> > # define __DECL_SIMD_sincosf __DECL_SIMD_x86_64 >> > # undef __DECL_SIMD_log >> > # define __DECL_SIMD_log __DECL_SIMD_x86_64 >> > # undef __DECL_SIMD_logf >> > # define __DECL_SIMD_logf __DECL_SIMD_x86_64 >> > # undef __DECL_SIMD_exp >> > # define __DECL_SIMD_exp __DECL_SIMD_x86_64 >> > # undef __DECL_SIMD_expf >> > # define __DECL_SIMD_expf __DECL_SIMD_x86_64 >> > # undef __DECL_SIMD_pow >> > # define __DECL_SIMD_pow __DECL_SIMD_x86_64 >> > # undef __DECL_SIMD_powf >> > # define __DECL_SIMD_powf __DECL_SIMD_x86_64 >> > >> > The sincos/sincosf stuff is questionable, because some glibc >versions >> > implement it incorrectly and the simd ("notinbranch") attribute >isn't that >> > useful for it anyway, we'd want to use extra clauses so that it >doesn't need >> > to do scatter stores. >>=20 >> I wonder if it is possible for glibc to ship a "module" for fortran >instead >> containing the appropriate declarations and gfortran auto-include >that >> (if present). > >Then we'd run into module binary format changing every release, so hard >for >glibc to ship that. It's just nobody bothered to implement version dependent parsing (it's plai= n text after all).=20 >Another thing is how would we express it in the module, >we could just use OpenMP syntax, > interface > function sin(x) bind(C,name=3D"__builtin_sin") result(res) > import > !$omp declare simd notinbranch > real(c_double) :: res > real(c_double),value :: x > end function > end interface >but we'd need to temporarily enable OpenMP while parsing that module. >I see Fortran now supports already >!GCC$ attributes stdcall, fastcall::test >Could we support >!GCC$ attributes simd >and >!GCC$ attributes simd('notinbranch') >too? I guess that would be useful indeed.=20 Richard.=20 > Jakub