Hi all,
How do I properly/conveniently change ISA features of the code to be generated? For instance I have a Core 2 Duo with SSSE3 but I’d also like to test whether everything would JIT compile correctly on something with just SSE2 (a Pentium 4) or even older. In other words, how do I prevent LLVM from using certain target features?
Thanks,
Nicolas Capens
The JIT defaults to using whatever it can. You can hack X86Subtarget::AutoDetectSubtargetFeatures() to disable specific features.
-Chris
Hi Chris,
I see. While hacking AutoDetectSubtargetFeatures() works for me for now,
would it be useful to define an interface for X86Subtarget to change the
features in a cleaner way? Would methods like disableSSEn()/enableSSEn()
work or do you have another suggestion? I certainly want to avoid a
situation where one module uses other settings than another module.
Thanks,
Nicolas
Why would this be useful for other users? It seems best to always take advantage of features the cpu has if possible, and the JIT has perfect knowledge of what the host cpu has.
-Chris
Unless it leads to crash. Currently, in my code I had to disable use of
SSE/MMX because when I enable them, the code I generate trigger a crash.
While it would be lovely to find the problem and report it to be fixed (I did
find a reason in llvm 2.2 but it was fixed in 2.3 before I could report 
but the problem I found disappeared, but it still crash
). In the mean
time, until I have the time to identify the reason of the crash, I still want
my library to be useful, hence the need to disable SSE/MMX.
That said, I found an other way around the problem, adding this to the code:
char** argv = new char*[2];
argv[0] = const_cast<char*>( "GTLVM");
argv[1] =
const_cast<char*>( "-mattr=-3dnow,-3dnowa,-mmx,-sse,-sse2,-sse3,-ssse3" );
llvm:
:ParseCommandLineOptions(2, argv, "");
Hi Chris,
I need it to test correct code generation on a wide variety of CPUs. I’m not entirely confident that if it runs fine on my Core 2 it will run fine on a Pentium 4 or an Athlon 64, etc. (especially since I use lots of vector operations). And since I don’t have ten different systems to test on I need to make sure LLVM can be forced not to use certain CPU features.
Cheers,
Nicolas