[Kstars-devel] KDE/kdeedu/kstars/kstars
Alexey Khudyakov
alexey.skladnoy at gmail.com
Sat May 30 23:20:25 CEST 2009
SVN commit 975737 by khudyakov:
Some cleaning in quaternion.{h,cpp}
* Unused class QuaternionSSE is removed.
* Unused declation removed. They most likely related with SSE.
* Typedef removed. Things are clearer without it.
* 'virtual' annotation removed from function. It has no effect but slow
things down a bit. Destrutor removed as well. It's not needed.
CCMAIL:kstars-devel at kde.org
M +0 -81 quaternion.cpp
M +3 -26 quaternion.h
--- trunk/KDE/kdeedu/kstars/kstars/quaternion.cpp #975736:975737
@@ -138,87 +138,6 @@
}
-void QuaternionSSE::rotateAroundAxis(const Quaternion &q) {
-
- Quaternion::rotateAroundAxis(q);
- /*
- __asm__ (
-
- "movl %0, %%esi \n\t"
- "movups (%%esi), %%xmm0 \n\t" // load this into xmm0
-
- "movups (%1), %%xmm1 \n\t" // load q into xmm1
- "movaps (%c2), %%xmm5 \n\t"
- "movaps (%c3), %%xmm6 \n\t"
- "movaps (%4), %%xmm7 \n\t"
-
- "xorps %%xmm2, %%xmm2 \n\t" // result register: xmm2
-
- "movaps %%xmm0, %%xmm4 \n\t"
- "shufps $0x55, %%xmm4, %%xmm4 \n\t" // put const multiplier into xmm4
- "mulps %%xmm1, %%xmm4 \n\t" // this[1] * q into xmm1
- "shufps $0xB1, %%xmm4, %%xmm4 \n\t" // q: xwzy
- "xorps %%xmm7, %%xmm4 \n\t"
- // "mulps %%xmm7, %%xmm4 \n\t"
- "addps %%xmm4, %%xmm2 \n\t" // add to total result
-
- "movaps %%xmm0, %%xmm4 \n\t"
- "shufps $0xAA, %%xmm4, %%xmm4 \n\t" // put const multiplier into xmm4
- "mulps %%xmm1, %%xmm4 \n\t" // this[1] * q into xmm1
- "shufps $0x4E, %%xmm4, %%xmm4 \n\t" // q: zxyw
- "xorps %%xmm5, %%xmm4 \n\t"
- // "mulps %%xmm5, %%xmm4 \n\t"
- "addps %%xmm4, %%xmm2 \n\t" // add to total result
-
- "shufps $0xFF, %%xmm0, %%xmm0 \n\t" // put const multiplier into xmm4
- "mulps %%xmm1, %%xmm0 \n\t" // this[1] * q into xmm1
- "shufps $0x1B, %%xmm0, %%xmm0 \n\t" // q: zxyw
- "xorps %%xmm6, %%xmm0 \n\t"
- // "mulps %%xmm6, %%xmm0 \n\t"
- "addps %%xmm0, %%xmm2 \n\t" // add to total result
-
- "movaps %%xmm2, %%xmm0 \n\t" // load new _q into xmm0, q is in xmm1 already
- "xorps %%xmm2, %%xmm2 \n\t" // reset result register: xmm2
-
- "movss %%xmm1, %%xmm4 \n\t" // FIXME: movaps -> movss (-1 Cylce)
- "shufps $0x0, %%xmm4, %%xmm4 \n\t" // put const multiplier into xmm4
- "mulps %%xmm0, %%xmm4 \n\t" // q * _q into xmm4
- "addps %%xmm4, %%xmm2 \n\t" // add to total result
-
- "movaps %%xmm1, %%xmm4 \n\t"
- "shufps $0x55, %%xmm4, %%xmm4 \n\t" // put const multiplier into xmm4
- "xorps %%xmm6, %%xmm4 \n\t"
- // "mulps %%xmm6, %%xmm4 \n\t"
- "movaps %%xmm0, %%xmm3 \n\t"
- "shufps $0xB1, %%xmm3, %%xmm3 \n\t" // distribute q-components correctly
- "mulps %%xmm3, %%xmm4 \n\t" // q * _q into xmm4
- "addps %%xmm4, %%xmm2 \n\t" // add to total result
-
- "movaps %%xmm1, %%xmm4 \n\t"
- "shufps $0xAA, %%xmm4, %%xmm4 \n\t" // put const multiplier into xmm4
- "xorps %%xmm7, %%xmm4 \n\t"
- // "mulps %%xmm7, %%xmm4 \n\t"
- "movaps %%xmm0, %%xmm3 \n\t"
- "shufps $0x4E, %%xmm3, %%xmm3 \n\t" // distribute q-components correctly
- "mulps %%xmm3, %%xmm4 \n\t" // q * _q into xmm4
- "addps %%xmm4, %%xmm2 \n\t" // add to total result
-
- "movaps %%xmm1, %%xmm4 \n\t"
- "shufps $0xFF, %%xmm4, %%xmm4 \n\t" // put const multiplier into xmm4
- "xorps %%xmm5, %%xmm4 \n\t"
- // "mulps %%xmm5, %%xmm4 \n\t"
- "shufps $0x1B, %%xmm0, %%xmm0 \n\t" // distribute q-components correctly
- "mulps %%xmm0, %%xmm4 \n\t" // q * _q into xmm4
- "addps %%xmm4, %%xmm2 \n\t" // add to total result
-
- "movups %%xmm2, (%%esi) \n\t" // return
-
- :
- : "D"(v), "r"(q.v), "%ir"( sgn_pmpp), "%ir"( sgn_ppmp ), "r"( sgn_pppm )
- : "%esi", "memory" );
- */
-}
-
void Quaternion::getSpherical(float &alpha, float &beta) {
if(fabs(v[Q_Y]) > 1.0f) {
if(v[Q_Y] > 1.0f) v[Q_Y] = 1.0f;
--- trunk/KDE/kdeedu/kstars/kstars/quaternion.h #975736:975737
@@ -26,31 +26,13 @@
Q_W = 3
};
-#ifdef __GNUC__
-typedef int xmmint[4] __attribute__ ((aligned (16)));
-typedef float xmmfloat[4] __attribute__ ((aligned (16)));
-#else
-typedef int xmmint[4];
-typedef float xmmfloat[4];
-#endif
+typedef float matrix[3][4];
-typedef xmmfloat matrix[3];
-
-static const xmmfloat fsgn_pmpp = { 1.0f, -1.0f, 1.0f, 1.0f };
-static const xmmfloat fsgn_ppmp = { 1.0f, 1.0f, -1.0f, 1.0f };
-static const xmmfloat fsgn_pppm = { 1.0f, 1.0f, 1.0f, -1.0f };
-
-static const xmmint sgn_pmpp = { 0, 1 << 31, 0, 0 };
-static const xmmint sgn_ppmp = { 0, 0, 1 << 31, 0 };
-static const xmmint sgn_pppm = { 0, 0, 0, 1 << 31 };
-
-
class Quaternion {
public:
Quaternion();
Quaternion(float w, float x, float y, float z);
Quaternion(float alpha, float beta);
- virtual ~Quaternion(){ }
// Operators
Quaternion operator*(const Quaternion &q) const;
@@ -65,7 +47,7 @@
void createFromEuler(float pitch, float yaw, float roll);
void display() const;
- virtual void rotateAroundAxis(const Quaternion &q);
+ void rotateAroundAxis(const Quaternion &q);
void getSpherical(float &alpha, float &beta);
@@ -75,12 +57,7 @@
void rotateAroundAxis(const matrix &m);
// TODO: Better add accessors...
- xmmfloat v;
+ float v[4];
};
-class QuaternionSSE : public Quaternion {
-public:
- void rotateAroundAxis(const Quaternion &q);
-};
-
#endif
More information about the Kstars-devel
mailing list