Commit 78810cfa authored by Christian Dietrich's avatar Christian Dietrich

x86: use popcnt for code generation

We explicitly enable the popcnt instruction in the code generation stage.

Change-Id: I799aabebede13da1dae3adc0e8cd864b4bc817f6
parent 04832d46
......@@ -138,7 +138,7 @@ endif()
# we use our own linker (python) script, that calls llvm-link, llc and the system linker
# setting CMAKE_*_LINK_EXECUTABLE at this point in the CMake run seems a bit unusual, but works as intended
set(LINK_EXECUTABLE "${PROJECT_SOURCE_DIR}/toolchain/ --clang ${CMAKE_C_COMPILER} --march x86 --mcpu ${CMAKE_C_ARCH} --llvm-dir ${CCDIR} --ar ${CMAKE_AR} <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> -o <TARGET>")
set(LINK_EXECUTABLE "${PROJECT_SOURCE_DIR}/toolchain/ --clang ${CMAKE_C_COMPILER} --march x86 --mcpu ${CMAKE_C_ARCH} -mattr=+popcnt --llvm-dir ${CCDIR} --ar ${CMAKE_AR} <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> -o <TARGET>")
......@@ -95,10 +95,12 @@ if __name__ == "__main__":
archives = [x for x in unkown_args if x.endswith(".a")]
elf_files = [x for x in unkown_args if is_elf_file(x)]
llvm_files = [x for x in unkown_args if is_llvm_file(x)]
compiler_flags = [x for x in unkown_args if x.startswith("-mattr")]
# Remove file arguments from unkown args
linker_flags = [x for x in unkown_args
if not(x in archives + elf_files + llvm_files)]
if not(x in archives + elf_files + llvm_files + compiler_flags)]
if args.march:
llc_march = "-march=" + args.march
......@@ -119,6 +121,7 @@ if __name__ == "__main__":
bitcode = llvm_link(llvm_files, args.linker_prefix + "-stage1.bc")
bitcode_opt = llvm_opt(bitcode, args.linker_prefix + "-stage2.bc")
llc_flags = [llc_march, llc_mcpu, "-filetype=obj", "-ffunction-sections", "-fdata-sections", "-nozero-initialized-in-bss"]
llc_flags += compiler_flags
llc_flags = [x for x in llc_flags if not x == ""]
system_object = llvm_llc(bitcode_opt, args.linker_prefix + ".obj", llc_flags)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment