6#ifndef __UTIL_MATH_FLOAT8_H__
7#define __UTIL_MATH_FLOAT8_H__
10# error "Do not include this file directly, include util/types.h instead."
18 return vfloat8(_mm256_setzero_ps());
32 return vfloat8(_mm256_add_ps(a.m256,
b.m256));
35 a.a +
b.a, a.b +
b.b, a.c +
b.c, a.d +
b.d, a.e +
b.e, a.f +
b.f, a.g +
b.g, a.h +
b.h);
52 __m256 mask = _mm256_castsi256_ps(_mm256_set1_epi32(0x80000000));
53 return vfloat8(_mm256_xor_ps(a.m256, mask));
55 return make_vfloat8(-a.a, -a.b, -a.c, -a.d, -a.e, -a.f, -a.g, -a.h);
62 return vfloat8(_mm256_sub_ps(a.m256,
b.m256));
65 a.a -
b.a, a.b -
b.b, a.c -
b.c, a.d -
b.d, a.e -
b.e, a.f -
b.f, a.g -
b.g, a.h -
b.h);
82 return vfloat8(_mm256_mul_ps(a.m256,
b.m256));
85 a.a *
b.a, a.b *
b.b, a.c *
b.c, a.d *
b.d, a.e *
b.e, a.f *
b.f, a.g *
b.g, a.h *
b.h);
102 return vfloat8(_mm256_div_ps(a.m256,
b.m256));
105 a.a /
b.a, a.b /
b.b, a.c /
b.c, a.d /
b.d, a.e /
b.e, a.f /
b.f, a.g /
b.g, a.h /
b.h);
147 return (_mm256_movemask_ps(_mm256_castsi256_ps(
148 _mm256_cmpeq_epi32(_mm256_castps_si256(a.m256), _mm256_castps_si256(
b.m256)))) &
149 0b11111111) == 0b11111111;
151 return (a.a ==
b.a && a.b ==
b.b && a.c ==
b.c && a.d ==
b.d && a.e ==
b.e && a.f ==
b.f &&
152 a.g ==
b.g && a.h ==
b.h);
159 return vfloat8(_mm256_xor_ps(a.m256,
b.m256));
175 return vfloat8(_mm256_rcp_ps(a.m256));
191 return vfloat8(_mm256_sqrt_ps(a.m256));
217 vfloat8
b(_mm256_hadd_ps(a.m256, a.m256));
218 vfloat8 h(_mm256_hadd_ps(
b.m256,
b.m256));
221 return a.a + a.b + a.c + a.d + a.e + a.f + a.g + a.h;
233 return vfloat8(_mm256_min_ps(a.m256,
b.m256));
249 return vfloat8(_mm256_max_ps(a.m256,
b.m256));
264 return min(
max(a, mn), mx);
270 return vfloat8(_mm256_blendv_ps(
b, a, _mm256_castsi256_ps(mask)));
273 (mask.b) ? a.b :
b.b,
274 (mask.c) ? a.c :
b.c,
275 (mask.d) ? a.d :
b.d,
276 (mask.e) ? a.e :
b.e,
277 (mask.f) ? a.f :
b.f,
278 (mask.g) ? a.g :
b.g,
279 (mask.h) ? a.h :
b.h);
286 return vfloat8(_mm256_and_ps(a.m256, _mm256_castsi256_ps(_mm256_set1_epi32(0x7fffffff))));
301 return a + t * (
b - a);
306 return a + t * (
b - a);
329 vfloat8 t(_mm256_dp_ps(a.m256,
b.m256, 0xFF));
332 return (a.a *
b.a) + (a.b *
b.b) + (a.c *
b.c) + (a.d *
b.d) + (a.e *
b.e) + (a.f *
b.f) +
333 (a.g *
b.g) + (a.h *
b.h);
356 return max(
max(
max(a.a, a.b), max(a.c, a.d)), max(
max(a.e, a.f), max(a.g, a.h)));
372 (
b.b != 0.0f) ? a.b /
b.b : 0.0f,
373 (
b.c != 0.0f) ? a.c /
b.c : 0.0f,
374 (
b.d != 0.0f) ? a.d /
b.d : 0.0f,
375 (
b.e != 0.0f) ? a.e /
b.e : 0.0f,
376 (
b.f != 0.0f) ? a.f /
b.f : 0.0f,
377 (
b.g != 0.0f) ? a.g /
b.g : 0.0f,
378 (
b.h != 0.0f) ? a.h /
b.h : 0.0f);
404 return vint8(_mm256_castps_si256(a));
420# ifdef __KERNEL_AVX__
421 return float4(_mm256_extractf128_ps(a.m256, 0));
428# ifdef __KERNEL_AVX__
429 return float4(_mm256_extractf128_ps(a.m256, 1));
435template<
int i0,
int i1,
int i2,
int i3,
int i4,
int i5,
int i6,
int i7>
438# ifdef __KERNEL_AVX__
439 return vfloat8(_mm256_permutevar_ps(a, _mm256_set_epi32(i7, i6, i5, i4, i3, i2, i1, i0)));
441 return make_vfloat8(a[i0], a[i1], a[i2], a[i3], a[i4 + 4], a[i5 + 4], a[i6 + 4], a[i7 + 4]);
445template<
size_t i0,
size_t i1,
size_t i2,
size_t i3>
448# ifdef __KERNEL_AVX__
449 return vfloat8(_mm256_shuffle_ps(a,
b, _MM_SHUFFLE(i3, i2, i1, i0)));
451 return make_vfloat8(shuffle<i0, i1, i2, i3>(high(a), high(
b)),
452 shuffle<i0, i1, i2, i3>(low(a), low(
b)));
456template<
size_t i0,
size_t i1,
size_t i2,
size_t i3>
459 return shuffle<i0, i1, i2, i3>(a, a);
463 return shuffle<i0, i0, i0, i0>(a,
b);
467 return shuffle<i0>(a, a);
472# ifdef __KERNEL_AVX__
473 __m256
b = shuffle<i, i, i, i>(a).m256;
474 return _mm256_cvtss_f32(
b);
__forceinline float extract(const int4 &b)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
local_group_size(16, 16) .push_constant(Type b
#define ccl_device_forceinline
#define ccl_device_inline
#define CCL_NAMESPACE_END
ccl_device_inline vfloat8 safe_divide(const vfloat8 a, const float b)
ccl_device_inline vfloat8 exp(vfloat8 v)
ccl_device_inline vfloat8 operator/=(vfloat8 a, float f)
ccl_device_inline vfloat8 one_vfloat8()
ccl_device_inline vfloat8 sqrt(const vfloat8 a)
ccl_device_inline vfloat8 operator*(const vfloat8 a, const vfloat8 b)
ccl_device_inline bool operator==(const vfloat8 a, const vfloat8 b)
ccl_device_inline vfloat8 fabs(const vfloat8 a)
ccl_device_inline vfloat8 ensure_finite(vfloat8 v)
ccl_device_inline float average(const vfloat8 a)
ccl_device_inline vfloat8 sqr(const vfloat8 a)
ccl_device_inline vfloat8 operator+=(vfloat8 a, const vfloat8 b)
ccl_device_inline vfloat8 operator-(const vfloat8 a)
ccl_device_inline vfloat8 operator/(const vfloat8 a, const vfloat8 b)
ccl_device_inline vfloat8 rcp(const vfloat8 a)
ccl_device_inline vfloat8 operator-=(vfloat8 a, const vfloat8 b)
ccl_device_inline bool isequal(const vfloat8 a, const vfloat8 b)
ccl_device_inline float reduce_add(const vfloat8 a)
ccl_device_inline vint8 cast(const vfloat8 a)
ccl_device_inline bool is_zero(const vfloat8 a)
ccl_device_inline float dot(const vfloat8 a, const vfloat8 b)
CCL_NAMESPACE_BEGIN ccl_device_inline vfloat8 zero_vfloat8()
ccl_device_inline bool isfinite_safe(vfloat8 v)
ccl_device_inline vfloat8 operator*=(vfloat8 a, const vfloat8 b)
ccl_device_inline float reduce_min(const vfloat8 a)
ccl_device_inline vfloat8 select(const vint8 mask, const vfloat8 a, const vfloat8 b)
ccl_device_inline vfloat8 clamp(const vfloat8 a, const vfloat8 mn, const vfloat8 mx)
ccl_device_inline vfloat8 operator+(const vfloat8 a, const vfloat8 b)
ccl_device_inline vfloat8 pow(vfloat8 v, float e)
ccl_device_inline float reduce_max(const vfloat8 a)
ccl_device_inline vfloat8 log(vfloat8 v)
ccl_device_inline const vfloat8 operator^(const vfloat8 a, const vfloat8 b)
VecBase< float, 4 > float4
ccl_device_inline vfloat8 make_vfloat8(float f)
ccl_device_inline vint8 make_vint8(int a, int b, int c, int d, int e, int f, int g, int h)