Skip to content

[clang] The VecLib bitfield in CodeGenOptions.def is too small for 9 different vector libraries #108704

@pawosm-arm

Description

@pawosm-arm

The VecLib bitfield is defined in clang/include/clang/Basic/CodeGenOptions.def as such:

// Vector functions library to use.
ENUM_CODEGENOPT(VecLib, llvm::driver::VectorLibrary, 3, llvm::driver::VectorLibrary::NoLibrary)

When this bitfield had been introduced, there were not many of the Vector Libraries to choose. Now we have 9 of them, as defined in Options.td:

def fveclib : Joined<["-"], "fveclib=">, Group<f_Group>,
  Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
    HelpText<"Use the given vector functions library">,
    Values<"Accelerate,libmvec,MASSV,SVML,SLEEF,Darwin_libsystem_m,ArmPL,AMDLIBM,none">,
    NormalizedValuesScope<"llvm::driver::VectorLibrary">,
    NormalizedValues<["Accelerate", "LIBMVEC", "MASSV", "SVML", "SLEEF",
                      "Darwin_libsystem_m", "ArmPL", "AMDLIBM", "NoLibrary"]>,
    MarshallingInfoEnum<CodeGenOpts<"VecLib">, "NoLibrary">;

In effect, they are not encoded correclty resulting in mysterious cases of the lost vectorization opportunity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clangClang issues not falling into any other category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions