157641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org/*
257641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org * Copyright 2014 ARM Ltd.
357641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org *
457641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org * Use of this source code is governed by a BSD-style license that can be
557641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org * found in the LICENSE file.
657641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org */
757641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org
857641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org#include "SkUtils.h"
957641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org#include "SkUtilsArm.h"
1057641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org
1157641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org#if defined(SK_CPU_LENDIAN) && !SK_ARM_NEON_IS_NONE
1257641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.orgextern "C" void memset16_neon(uint16_t dst[], uint16_t value, int count);
1357641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.orgextern "C" void memset32_neon(uint32_t dst[], uint32_t value, int count);
1457641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org#endif
1557641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org
1657641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org#if defined(SK_CPU_LENDIAN)
1757641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.orgextern "C" void arm_memset16(uint16_t* dst, uint16_t value, int count);
1857641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.orgextern "C" void arm_memset32(uint32_t* dst, uint32_t value, int count);
1957641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org#endif
2057641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org
2157641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.orgSkMemset16Proc SkMemset16GetPlatformProc() {
2257641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org    // FIXME: memset.arm.S is using syntax incompatible with XCode
2357641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org#if !defined(SK_CPU_LENDIAN) || defined(SK_BUILD_FOR_IOS)
2457641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org    return NULL;
2557641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org#elif SK_ARM_NEON_IS_DYNAMIC
2657641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org    if (sk_cpu_arm_has_neon()) {
2757641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org        return memset16_neon;
2857641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org    } else {
2957641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org        return arm_memset16;
3057641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org    }
3157641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org#elif SK_ARM_NEON_IS_ALWAYS
3257641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org    return memset16_neon;
3357641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org#else
3457641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org    return arm_memset16;
3557641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org#endif
3657641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org}
3757641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org
3857641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.orgSkMemset32Proc SkMemset32GetPlatformProc() {
3957641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org    // FIXME: memset.arm.S is using syntax incompatible with XCode
4057641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org#if !defined(SK_CPU_LENDIAN) || defined(SK_BUILD_FOR_IOS)
4157641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org    return NULL;
4257641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org#elif SK_ARM_NEON_IS_DYNAMIC
4357641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org    if (sk_cpu_arm_has_neon()) {
4457641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org        return memset32_neon;
4557641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org    } else {
4657641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org        return arm_memset32;
4757641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org    }
4857641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org#elif SK_ARM_NEON_IS_ALWAYS
4957641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org    return memset32_neon;
5057641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org#else
5157641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org    return arm_memset32;
5257641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org#endif
5357641651275c139e34be3f1cd963ff35b8362051commit-bot@chromium.org}
54f0ea77a3630e6d1c01d83aa5430b3780da9e88b6commit-bot@chromium.org
55f0ea77a3630e6d1c01d83aa5430b3780da9e88b6commit-bot@chromium.orgSkMemcpy32Proc SkMemcpy32GetPlatformProc() {
56f0ea77a3630e6d1c01d83aa5430b3780da9e88b6commit-bot@chromium.org    return NULL;
57f0ea77a3630e6d1c01d83aa5430b3780da9e88b6commit-bot@chromium.org}
58