https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89907

            Bug ID: 89907
           Summary: Incorrect check_avx2_available
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: testsuite
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

target-supports.exp has

# Return true if we are compiling for AVX target.

proc check_avx_available { } {
  if { [check_no_compiler_messages avx_available assembly {
    #ifndef __AVX__
    #error unsupported
    #endif
  } ""] } {
    return 1;
  }
  return 0;
}

# Return true if we are compiling for AVX2 target.

proc check_avx2_available { } {
  if { [check_no_compiler_messages avx_available assembly {
                                   ^^^^^ It should be "avx2_available".
    #ifndef __AVX2__
    #error unsupported
    #endif
  } ""] } {
    return 1;
  }
  return 0;
}

When check_avx_available is called before check_avx2_available,
check_avx2_available will get the wrong result on AVX machines.

Reply via email to