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 _____ From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Chris Lattner Sent: Friday, 18 July, 2008 20:06 To: LLVM Developers Mailing List Subject: Re: [LLVMdev] Changing target features from C++ On Jul 18, 2008, at 8:42 AM, Nicolas Capens wrote: 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? The JIT defaults to using whatever it can. You can hack X86Subtarget::AutoDetectSubtargetFeatures() to disable specific features. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080720/9f1542d0/attachment.html>
On Jul 20, 2008, at 2:59 AM, Nicolas Capens wrote:> 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… >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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080720/a73bd7ee/attachment.html>
On Sunday 20 July 2008, Chris Lattner wrote:> On Jul 20, 2008, at 2:59 AM, Nicolas Capens wrote: > > 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… > > 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.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::cl::ParseCommandLineOptions(2, argv, ""); -- Cyrille Berger
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 From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Chris Lattner Sent: Sunday, 20 July, 2008 19:32 To: LLVM Developers Mailing List Subject: Re: [LLVMdev] Changing target features from C++ On Jul 20, 2008, at 2:59 AM, Nicolas Capens wrote: 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. 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080721/35ad3414/attachment.html>