CPU feature control for JIT

Hi all,

Is there a convenient way to control the instruction set extensions used for JIT compilation?

In particular I’m looking at selecting the SSE level, for debugging and performance comparison purposes. There appear to be command-line options for Clang but I haven’t figured out yet how to control them directly for JIT compilation. And obviously I don’t want it to generate code unsupported by the CPU either (i.e. I only want to force the SSE level lower, not higher). Is this already supported, or would anyone else be interested in that and/or be able to suggest how best to add this feature?



The JIT autosenses the current CPU and forces the features it detects, you can hack this by (e.g.) changing X86Subtarget::AutoDetectSubtargetFeatures.


Hi Chris,

That’s what I’m currently doing, but I was hoping for a built-in way to do that. I assume other JIT users would like control over this as well, so would you be interested in a patch if I can create a clean interface for this?

Suggestions for how to approach this would be very welcome. My current proprietary hack uses global variables, which I assume are not popular. :wink: