[LLVMdev] Building for a specific target, corei7

Kaylor, Andrew andrew.kaylor at intel.com
Fri Oct 11 13:12:12 PDT 2013


Hi Varun,

Have you tried your experiment with icc by any chance?

The MCJIT component does not assume that you will be executing the generated code on the host system because it can be used to generate code for external targets.  However, you can specify the CPU by calling setCPU() on the EngineBuilder object before creating your execution engine.  (You can use sys::getHostCPUName() to figure out what CPU you are running on and that will further detect AVX support, which you don't get with the general "corei7" cpu flag.) I would expect that if you do that it would generate similar code to clang.

-Andy


From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Varun Agrawal
Sent: Thursday, October 10, 2013 10:52 PM
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] Building for a specific target, corei7

Hi,

I am using the LLVM JIT infrastructure (MCJIT). I wanted to see if there are any performance gains as the compiler can detect the target CPU at runtime. But, I didn't see any improvement (I compile with -no-mmx and -no-sse).

I then tried an experiment, where I compiled the program with clang-3.3, with and without specifying the target cpu as "corei7". I was shocked to see that the only difference in the two binaries were related to "Instruction Set Extensions".

Further I tried the same experiment with gcc, and saw that the instructions were shuffled around in the binary. I expected this, because every CPU differs in some way or the other (has different buffer size for out-of-order execution, different cache sizes, etc.).

For clang, I was passing the "-march=corei7" flag.
For gcc, I was passing the "-mcpu=corei7" flag.

Am I passing the correct flags?
Any help, comments or suggestions, would be helpful.

Thanks,
--
Varun Agrawal
PhD Student
Computer Science, Stony Brook University
http://compas.cs.stonybrook.edu/~vagrawal/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131011/449ec587/attachment.html>


More information about the llvm-dev mailing list