summaryrefslogtreecommitdiffstats
path: root/opengl/libagl/matrix.h
diff options
context:
space:
mode:
authorKeun-young Park <keunyoung@google.com>2013-03-29 06:15:58 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-03-29 06:15:58 +0000
commit906bd0422a99b37663a1cb130bf061fdbb3ea189 (patch)
treefab34517a3cad3d2bb3e2dccc3c045b42afe9b3d /opengl/libagl/matrix.h
parentd3b2c029eba356e7bed3754d60ade556c216348e (diff)
parentb43722c3dd69a90f0d0665912bd543aa12521c58 (diff)
downloadframeworks_native-906bd0422a99b37663a1cb130bf061fdbb3ea189.zip
frameworks_native-906bd0422a99b37663a1cb130bf061fdbb3ea189.tar.gz
frameworks_native-906bd0422a99b37663a1cb130bf061fdbb3ea189.tar.bz2
Merge "[MIPS] Add MIPS architecture support to libagl"
Diffstat (limited to 'opengl/libagl/matrix.h')
-rw-r--r--opengl/libagl/matrix.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/opengl/libagl/matrix.h b/opengl/libagl/matrix.h
index c9a38a9..5bd717a 100644
--- a/opengl/libagl/matrix.h
+++ b/opengl/libagl/matrix.h
@@ -74,6 +74,30 @@ GLfixed vsquare3(GLfixed a, GLfixed b, GLfixed c)
);
return r;
+#elif defined(__mips__)
+
+ GLfixed res;
+ int32_t t1,t2,t3;
+ asm(
+ "mult %[a], %[a] \r\n"
+ "li %[res],0x8000 \r\n"
+ "madd %[b],%[b] \r\n"
+ "move %[t3],$zero \r\n"
+ "madd %[c],%[c] \r\n"
+ "mflo %[t1]\r\n"
+ "mfhi %[t2]\r\n"
+ "addu %[t1],%[res],%[t1]\r\n" /*add 0x8000*/
+ "sltu %[t3],%[t1],%[res]\r\n"
+ "addu %[t2],%[t2],%[t3]\r\n"
+ "srl %[res],%[t1],16\r\n"
+ "sll %[t2],%[t2],16\r\n"
+ "or %[res],%[res],%[t2]\r\n"
+ : [res]"=&r"(res),[t1]"=&r"(t1),[t2]"=&r"(t2),[t3]"=&r"(t3)
+ : [a] "r" (a),[b] "r" (b),[c] "r" (c)
+ : "%hi","%lo"
+ );
+ return res;
+
#else
return (( int64_t(a)*a +
@@ -136,6 +160,26 @@ static inline GLfixed mla3a( GLfixed a0, GLfixed b0,
);
return r;
+#elif defined(__mips__)
+
+ GLfixed res;
+ int32_t t1,t2;
+ asm(
+ "mult %[a0],%[b0] \r\n"
+ "madd %[a1],%[b1] \r\n"
+ "madd %[a2],%[b2] \r\n"
+ "mflo %[t2]\r\n"
+ "mfhi %[t1]\r\n"
+ "srl %[t2],%[t2],16\r\n"
+ "sll %[t1],%[t1],16\r\n"
+ "or %[t2],%[t2],%[t1]\r\n"
+ "addu %[res],%[t2],%[c]"
+ : [res]"=&r"(res),[t1]"=&r"(t1),[t2]"=&r"(t2)
+ : [a0] "r" (a0),[b0] "r" (b0),[a1] "r" (a1),[b1] "r" (b1),[a2] "r" (a2),[b2] "r" (b2),[c] "r" (c)
+ : "%hi","%lo"
+ );
+ return res;
+
#else
return (( int64_t(a0)*b0 +