How to use SSE, inline assembly

Started by
1 comment, last by TimothyFarrar 16 years, 3 months ago
I found this page http://www.ibm.com/developerworks/linux/library/l-ia.html?dwzone=linux so I can perhaps understand some of that AT&T syntax and port my inline assembly code to Linux. The inline assembly is done in VC++, for the Windows platform. Problem is that this is too much work. I was thinking maybe there is an easier way. Has anyone used Intel's or AMD's math toolkit? I just need to multiply matrix by vector, vector by matrix. PS : Matrices are in column major format.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Advertisement
Look on compiler's sse intrinsics, you can see good example of math operations in nebula device sdk: http://www.koders.com/cpp/fid6BFC8022681B932C0CFF0644DB9C58C63B59B1F8.aspx?s=sse+_mm_shuffle+nebula
I believe gcc has some built in vectorization ability without inline assembly or intrinsics. Might want to google that.

Intrinsics are really easy to use however, and also tend to port really well between windows/unix/mac on different compilers.

_|imothy Farrar :: www.farrarfocus.com/atom

This topic is closed to new replies.

Advertisement