[llvm-dev] AVX2 codegen

Toshiyasu Morita via llvm-dev llvm-dev at lists.llvm.org
Tue May 9 16:53:31 PDT 2017


Still having trouble with generating AVX2 instructions.

I've tried setting the mattrs when generating the JIT:

  printf("getHostCPUFeatures(): %s\n", features);

  std::vector< std::string> machine_attrs;
  machine_attrs.push_back(features);

  std::string Error;
  EngineBuilder builder(std::move(Mod));
  builder.setEngineKind(EngineKind::JIT)
         .setErrorStr(&Error)
         .setOptLevel((CodeGenOpt::Level)options.OptLevel)
         .setCodeModel(unwrap(options.CodeModel))
         .setTargetOptions(targetOptions)
         .setMCPU(llvm::sys::getHostCPUName())
         .setMAttrs(machine_attrs);

where features is:

GetHostCPUFeatures():
+sse2,+cx16,+bmi2,+fsgsbase,+popcnt,+aes,+mmx,+xsave,+invpcid,+avx,+fma,+bmi,+rdrnd,+sse4.1,+sse4.2,+avx2,+sse,+lzcnt,+pclmul,+f16c,+ssse3,+cmov,+movbe,+xsaveopt,+sse3

Anything I am missing?

Do the module target-features override the MAttr, or the reverse?

Toshi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170509/87661346/attachment.html>


More information about the llvm-dev mailing list