diff options
author | Elliott Hughes <enh@google.com> | 2013-12-16 19:55:21 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-12-16 19:55:21 +0000 |
commit | c29664284b59cf8ebc9bb51d4713ff4280341b5a (patch) | |
tree | 7e6032ec29ecc75d8609e3202a0a562086b9082c /include/private | |
parent | dd2b85221b5ce9cd08ade794835b42be13b91e13 (diff) | |
parent | 49a88c3cf38e9c17a756434880fb01971018a9c6 (diff) | |
download | system_core-c29664284b59cf8ebc9bb51d4713ff4280341b5a.zip system_core-c29664284b59cf8ebc9bb51d4713ff4280341b5a.tar.gz system_core-c29664284b59cf8ebc9bb51d4713ff4280341b5a.tar.bz2 |
am 49a88c3c: am 410a1966: am fd382f2e: am fd7eabe4: Merge "Pixelflinger: Add AArch64 support to pixelflinger JIT."
* commit '49a88c3cf38e9c17a756434880fb01971018a9c6':
Pixelflinger: Add AArch64 support to pixelflinger JIT.
Diffstat (limited to 'include/private')
-rw-r--r-- | include/private/pixelflinger/ggl_fixed.h | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/include/private/pixelflinger/ggl_fixed.h b/include/private/pixelflinger/ggl_fixed.h index 217ec04..d0493f3 100644 --- a/include/private/pixelflinger/ggl_fixed.h +++ b/include/private/pixelflinger/ggl_fixed.h @@ -457,6 +457,69 @@ inline int64_t gglMulii(int32_t x, int32_t y) { return u.res; } +#elif defined(__aarch64__) + +// inline AArch64 implementations + +inline GGLfixed gglMulx(GGLfixed x, GGLfixed y, int shift) CONST; +inline GGLfixed gglMulx(GGLfixed x, GGLfixed y, int shift) +{ + GGLfixed result; + GGLfixed round; + + asm("mov %x[round], #1 \n" + "lsl %x[round], %x[round], %x[shift] \n" + "lsr %x[round], %x[round], #1 \n" + "smaddl %x[result], %w[x], %w[y],%x[round] \n" + "lsr %x[result], %x[result], %x[shift] \n" + : [round]"=&r"(round), [result]"=&r"(result) \ + : [x]"r"(x), [y]"r"(y), [shift] "r"(shift) \ + : + ); + return result; +} +inline GGLfixed gglMulAddx(GGLfixed x, GGLfixed y, GGLfixed a, int shift) CONST; +inline GGLfixed gglMulAddx(GGLfixed x, GGLfixed y, GGLfixed a, int shift) +{ + GGLfixed result; + asm("smull %x[result], %w[x], %w[y] \n" + "lsr %x[result], %x[result], %x[shift] \n" + "add %w[result], %w[result], %w[a] \n" + : [result]"=&r"(result) \ + : [x]"r"(x), [y]"r"(y), [a]"r"(a), [shift] "r"(shift) \ + : + ); + return result; +} + +inline GGLfixed gglMulSubx(GGLfixed x, GGLfixed y, GGLfixed a, int shift) CONST; +inline GGLfixed gglMulSubx(GGLfixed x, GGLfixed y, GGLfixed a, int shift) +{ + + GGLfixed result; + int rshift; + + asm("smull %x[result], %w[x], %w[y] \n" + "lsr %x[result], %x[result], %x[shift] \n" + "sub %w[result], %w[result], %w[a] \n" + : [result]"=&r"(result) \ + : [x]"r"(x), [y]"r"(y), [a]"r"(a), [shift] "r"(shift) \ + : + ); + return result; +} +inline int64_t gglMulii(int32_t x, int32_t y) CONST; +inline int64_t gglMulii(int32_t x, int32_t y) +{ + int64_t res; + asm("smull %x0, %w1, %w2 \n" + : "=r"(res) + : "%r"(x), "r"(y) + : + ); + return res; +} + #else // ---------------------------------------------------------------------- inline GGLfixed gglMulx(GGLfixed a, GGLfixed b, int shift) CONST; @@ -498,7 +561,7 @@ inline GGLfixed gglMulSubx(GGLfixed a, GGLfixed b, GGLfixed c) { inline int32_t gglClz(int32_t x) CONST; inline int32_t gglClz(int32_t x) { -#if (defined(__arm__) && !defined(__thumb__)) || defined(__mips__) +#if (defined(__arm__) && !defined(__thumb__)) || defined(__mips__) || defined(__aarch64__) return __builtin_clz(x); #else if (!x) return 32; @@ -554,6 +617,8 @@ inline GGLfixed gglClampx(GGLfixed c) // clamps to zero in one instruction, but gcc won't generate it and // replace it by a cmp + movlt (it's quite amazing actually). asm("bic %0, %1, %1, asr #31\n" : "=r"(c) : "r"(c)); +#elif defined(__aarch64__) + asm("bic %w0, %w1, %w1, asr #31\n" : "=r"(c) : "r"(c)); #else c &= ~(c>>31); #endif |