GSoC/GCI Archive
Google Code-in 2012 BRL-CAD

Implement runtime detection of SSE

completed by: Skriptkid

mentors: Erik

BRL-CAD will optionally leverage SSE instructions for some operations but SSE-support is set at compile-time. If you attempt to perform SSE instructions on non-SSE hardware, it'll basically halt the application with an illegal instruction exception. That's a fancy way of saying it crashes.

This task involves implementing a function (that will go into our LIBBU utility library) to reports whether SSE support is available at runtime. The most prevalent method for doing this is demonstrated by the Mesa folks where you set up an exception handler for SIGILL and attempt an SSE instruction. That's obviously a non-solution for Windows platforms, but is better than nothing and more useful than a Windows-only solution. Even better if you can handle both or implement a cross-platform solution. You'll implement a bu_sse_init() function that returns an error if SSE is not available at runtime.


  • include/bu.h
  • src/libbu/sse.c