Hi all,

I was wondering whether it's possible to disable a CPU's SSE support.

The problem is that I'm developing software which should run on a wide variety of x86 processors, but I only have two modern systems (with SSE). SSE instructions are used extensively if detected, and an FPU-only fallback path is chosen when not. But it's hard to verify that I'm definitely not using any SSE instruction. It would be very handy if it were possible to disable SSE support at the CPU level and get an exception if it tries to execute an SSE instruction.

I have an Athlon 64 X2 desktop and a Core 2 Duo laptop...

Thanks!
Posted on 2007-04-02 12:13:08 by C0D1F1ED
I think reading the section 10.2.3.1 SIMD Floating-Point Mask and Flag Bits and probably some other sections in IA-32 Intel? Architecture Software Developer?s Manual (Volume 1 - Basic Architecture) Intel? manual will help you with this.
Posted on 2007-04-02 12:28:20 by XCHG
If you are using some sort of routine to determine instruction set support
just either disable it or hardcode after the test that it only has FPU support.

Or for the SSE code, comment it out or replace it with nops or use conditional assembly so it wont be present thus can't be used.
Posted on 2007-04-02 15:32:56 by dsouza123

I think reading the section 10.2.3.1 SIMD Floating-Point Mask and Flag Bits and probably some other sections in IA-32 Intel? Architecture Software Developer?s Manual (Volume 1 - Basic Architecture) Intel? manual will help you with this.

Enabling all SSE exceptions is indeed a good idea to detect the execution of SSE instructions. It's no guarantee, but it's better than nothing... Thanks!
Posted on 2007-04-03 00:42:25 by C0D1F1ED

If you are using some sort of routine to determine instruction set support
just either disable it or hardcode after the test that it only has FPU support.

The problem isn't detecting SSE support. I'd like to disable the CPU's ability to execute SSE instructions entirely so that I can detect when I've made a mistake in the FPU-only code path and used an SSE instruction.
Or for the SSE code, comment it out or replace it with nops or use conditional assembly so it wont be present thus can't be used.

I'm talking about -lots- of code in a complex multimedia application. Originally it used SSE extensively, but now I've also written an FPU-only version for older processors. However, if I made a mistake and it still contains even one SSE instruction it won't run on Pentium 2's or older Athlons. So I need my modern systems to act like they don't support SSE at all. Ideally.
Posted on 2007-04-03 00:53:24 by C0D1F1ED
This might sound ridiculous but why don't you simply search for SSE instructions in the application's directory and remove/replace them with FPU instructions?
Posted on 2007-04-03 08:52:34 by XCHG
I would suggest putting the FPU and SSE versions in two separate libraries. Load the most appropriate one and make sure that the respective functions' use of FPU/SSE instructions are completely encapsulated (store values in GPR/variables instead.)

This way has its obvious disadvantages, but would add a bit more ease and consistency in the development process.
Posted on 2007-04-03 09:02:55 by SpooK
Probably won't work, SpooK - considering that C0D1F1ED wrote softwire, he's most likely using dynamic code generation for this project.

I'd recommend setting an unhandled exception filter, look for invalid opcode exception, do proper reporting, and let someone with an older system do testing.
Posted on 2007-04-03 10:09:10 by f0dder