SIMDBool32x4Operation.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #include "RuntimeLanguagePch.h"
  6. #if defined(_M_ARM32_OR_ARM64)
  7. namespace Js
  8. {
  9. SIMDValue SIMDBool32x4Operation::OpBool32x4(bool x, bool y, bool z, bool w)
  10. {
  11. SIMDValue result;
  12. result.i32[SIMD_X] = x ? -1 : 0;
  13. result.i32[SIMD_Y] = y ? -1 : 0;
  14. result.i32[SIMD_Z] = z ? -1 : 0;
  15. result.i32[SIMD_W] = w ? -1 : 0;
  16. return result;
  17. }
  18. SIMDValue SIMDBool32x4Operation::OpBool32x4(const SIMDValue& v)
  19. {
  20. // overload function with input parameter as SIMDValue for completeness
  21. SIMDValue result;
  22. result = v;
  23. return result;
  24. }
  25. // Unary Ops
  26. bool SIMDBool32x4Operation::OpAnyTrue(const SIMDValue& simd)
  27. {
  28. return simd.i32[SIMD_X] || simd.i32[SIMD_Y] || simd.i32[SIMD_Z] || simd.i32[SIMD_W];
  29. }
  30. bool SIMDBool32x4Operation::OpAllTrue(const SIMDValue& simd)
  31. {
  32. return simd.i32[SIMD_X] && simd.i32[SIMD_Y] && simd.i32[SIMD_Z] && simd.i32[SIMD_W];
  33. }
  34. }
  35. #endif