remove SkFixedMul_arm()

The portable SkFixedMul_longlong (here now renamed SkFixedMul)
generates shorter, equivalent code,

from
   0:   fb81 0200       smull   r0, r2, r1, r0
   4:   ea4f 4010       mov.w   r0, r0, lsr #16
   8:   ea40 4002       orr.w   r0, r0, r2, lsl #16

to
   0:   fb81 0100       smull   r0, r1, r1, r0
   4:   0c00            lsrs    r0, r0, #16
   6:   ea40 4001       orr.w   r0, r0, r1, lsl #16

(Notice, 2 bytes saved.)

Change-Id: Icb0f7e6d4379086fc602f956a4beb1265a9759bc
Reviewed-on: https://skia-review.googlesource.com/69440
Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2017-11-09 12:55:32 -05:00 committed by Skia Commit-Bot
parent e580649a38
commit ea000ff330

View File

@ -86,13 +86,12 @@ static inline SkFixed SkFixedFloorToFixed(SkFixed x) {
#define SkFixedDiv(numer, denom) \
SkToS32(SkTPin<int64_t>((SkLeftShift((int64_t)(numer), 16) / (denom)), SK_MinS32, SK_MaxS32))
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Now look for ASM overrides for our portable versions (should consider putting this in its own file)
inline SkFixed SkFixedMul_longlong(SkFixed a, SkFixed b) {
static inline SkFixed SkFixedMul(SkFixed a, SkFixed b) {
return (SkFixed)((int64_t)a * b >> 16);
}
#define SkFixedMul(a,b) SkFixedMul_longlong(a,b)
///////////////////////////////////////////////////////////////////////////////
// Platform-specific alternatives to our portable versions.
// The VCVT float-to-fixed instruction is part of the VFPv3 instruction set.
#if defined(__ARM_VFPV3__)
@ -111,23 +110,6 @@ inline SkFixed SkFixedMul_longlong(SkFixed a, SkFixed b) {
#define SkFloatToFixed(x) SkFloatToFixed_arm(x)
#endif
#if defined(SK_CPU_ARM32)
inline SkFixed SkFixedMul_arm(SkFixed x, SkFixed y)
{
int32_t t;
asm("smull %0, %2, %1, %3 \n"
"mov %0, %0, lsr #16 \n"
"orr %0, %0, %2, lsl #16 \n"
: "=r"(x), "=&r"(y), "=r"(t)
: "r"(x), "1"(y)
:
);
return x;
}
#undef SkFixedMul
#define SkFixedMul(x, y) SkFixedMul_arm(x, y)
#endif
///////////////////////////////////////////////////////////////////////////////
#define SkFixedToScalar(x) SkFixedToFloat(x)