This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/49363] [feature request] multiple target attribute (and runtime dispatching based on cpuid)
- From: "tmsriram at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 10 May 2012 16:48:45 +0000
- Subject: [Bug middle-end/49363] [feature request] multiple target attribute (and runtime dispatching based on cpuid)
- Auto-submitted: auto-generated
- References: <bug-49363-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49363
--- Comment #18 from Sriraman Tallam <tmsriram at google dot com> 2012-05-10 16:48:45 UTC ---
On Thu, May 10, 2012 at 3:16 AM, vincenzo.innocente at cern dot ch
<gcc-bugzilla@gcc.gnu.org> wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49363
>
> --- Comment #17 from vincenzo Innocente <vincenzo.innocente at cern dot ch> 2012-05-10 10:16:13 UTC ---
> I tested this
>
> float x[1024], y[1024], z[1024], w[1024];
>
> void foo() {
> Âfor (int i=0; i!=1024; ++i)
> Â Â x[i]=y[i]*z[i]+w[i];
> }
>
>
> void __attribute__ ((target("arch=corei7"))) foo() {
> Âfor (int i=0; i!=1024; ++i)
> Â Â x[i]=y[i]*z[i]+w[i];
> }
>
> void __attribute__ ((target("avx"))) foo() {
> Âfor (int i=0; i!=1024; ++i)
> Â Â x[i]=y[i]*z[i]+w[i];
> }
>
>
> and see the three versions generated Â+ the "resolver".
>
> As you notice the source code is identical as I'm exploiting compiler
> autovectorization here.
> In this case I was hoping that a single declaration such as Â__attribute__
> ((target("arch=corei7,avx")))
> or Â__attribute__ ((target("arch=corei7),target("avx"))) would generate the two
> versions w/o hang to duplicate the source code.
> Is this possible to support?
Yes, this is on the list of things to add. The front-end should clone
the bodies and tag the attributes appropriately.
Thanks,
-Sri,
>
> --
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug.