neon_check.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
  11. ==============================================================================*/
  12. #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_CHECK_H_
  13. #define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_CHECK_H_
  14. #if defined(__ARM_NEON__) || defined(__ARM_NEON)
  15. #define USE_NEON
  16. #include <arm_neon.h>
  17. #endif
  18. #if defined __GNUC__ && defined __SSE4_1__ && !defined TF_LITE_DISABLE_X86_NEON
  19. #define USE_NEON
  20. #include "NEON_2_SSE.h"
  21. #endif
  22. // NEON_OR_PORTABLE(SomeFunc, args) calls NeonSomeFunc(args) if USE_NEON is
  23. // defined, PortableSomeFunc(args) otherwise.
  24. #ifdef USE_NEON
  25. // Always use Neon code
  26. #define NEON_OR_PORTABLE(funcname, ...) Neon##funcname(__VA_ARGS__)
  27. #else
  28. // No NEON available: Use Portable code
  29. #define NEON_OR_PORTABLE(funcname, ...) Portable##funcname(__VA_ARGS__)
  30. #endif // defined(USE_NEON)
  31. #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_CHECK_H_