http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57561

            Bug ID: 57561
           Summary: gnu function multiversion - resolver doesn't use isa
                    priority according to documentation
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mib.bugzilla at gmail dot com

In this test case, the resolver function doesn't find the correct version,
according to the documentation e.g. mmx should not preceed sse4.2
(Using gcc 4.8.1 on x86 system)
grep movl fu.s | grep arch
        movl    $_Z3fumv.arch_corei7_avx2, %eax
        movl    $_Z3fumv.arch_corei7_avx, %eax
        movl    $_Z3fumv.arch_corei7_popcnt, %eax
        movl    $_Z3fumv.arch_corei7_mmx, %eax
        movl    $_Z3fumv.arch_corei7_sse4.2, %eax
        movl    $_Z3fumv.arch_corei7_sse4.1, %eax
        movl    $_Z3fumv.arch_corei7_ssse3, %eax
        movl    $_Z3fumv.arch_corei7_sse, %eax
        movl    $_Z3fumv.arch_corei7_sse2, %eax
        movl    $_Z3fumv.arch_corei7_sse3, %eax

cat fu.cpp
 __attribute__ ((target("default"))) int fum () { return 0; }
 __attribute__ ((target("arch=corei7,sse3"))) int fum () { return 0; }
 __attribute__ ((target("arch=corei7,sse2"))) int fum () { return 0; }
 __attribute__ ((target("arch=corei7,sse"))) int fum () { return 0; }
 __attribute__ ((target("arch=corei7,ssse3"))) int fum () { return 0; }
 __attribute__ ((target("arch=corei7,sse4.1"))) int fum () { return 0; }
 __attribute__ ((target("arch=corei7,sse4.2"))) int fum () { return 0; }
 __attribute__ ((target("arch=corei7,popcnt"))) int fum () { return 0; }
 __attribute__ ((target("arch=corei7,avx"))) int fum () { return 0; }
 __attribute__ ((target("arch=corei7,avx2"))) int fum () { return 0; }
 __attribute__ ((target("arch=corei7,mmx"))) int fum () { return 0; }

int (*p)() = &fum;

int foo(void)
{
  int j = fum();
  return j;
}

Reply via email to