Skip to content

Commit

Permalink
Update the helper files so that the library can be compiled with newe…
Browse files Browse the repository at this point in the history
…r compilers.

Manually rebased.
  • Loading branch information
Naoki Shibata committed Oct 10, 2024
1 parent dcf7ebd commit f3c56d9
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
10 changes: 5 additions & 5 deletions src/arch/helperavx.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static INLINE int vavailability_i(int name) {

#endif // #if !defined(SLEEF_GENHEADER)

static INLINE void vprefetch_v_p(const void *ptr) { _mm_prefetch(ptr, _MM_HINT_T0); }
static INLINE void vprefetch_v_p(const void *ptr) { _mm_prefetch((const char *)ptr, _MM_HINT_T0); }

static INLINE int vtestallones_i_vo32(vopmask g) {
return _mm_test_all_ones(_mm_and_si128(_mm256_extractf128_si256(g, 0), _mm256_extractf128_si256(g, 1)));
Expand Down Expand Up @@ -516,10 +516,10 @@ static INLINE float vcast_f_vf(vfloat v) {
#endif
//

#define PNMASK ((vdouble) { +0.0, -0.0, +0.0, -0.0 })
#define NPMASK ((vdouble) { -0.0, +0.0, -0.0, +0.0 })
#define PNMASKf ((vfloat) { +0.0f, -0.0f, +0.0f, -0.0f, +0.0f, -0.0f, +0.0f, -0.0f })
#define NPMASKf ((vfloat) { -0.0f, +0.0f, -0.0f, +0.0f, -0.0f, +0.0f, -0.0f, +0.0f })
#define PNMASK _mm256_set_pd( -0.0, +0.0, -0.0, +0.0 )
#define NPMASK _mm256_set_pd( +0.0, -0.0, +0.0, -0.0 )
#define PNMASKf _mm256_set_ps( -0.0f, +0.0f, -0.0f, +0.0f, -0.0f, +0.0f, -0.0f, +0.0f )
#define NPMASKf _mm256_set_ps( +0.0f, -0.0f, +0.0f, -0.0f, +0.0f, -0.0f, +0.0f, -0.0f )

static INLINE vdouble vposneg_vd_vd(vdouble d) { return vreinterpret_vd_vm(vxor_vm_vm_vm(vreinterpret_vm_vd(d), vreinterpret_vm_vd(PNMASK))); }
static INLINE vdouble vnegpos_vd_vd(vdouble d) { return vreinterpret_vd_vm(vxor_vm_vm_vm(vreinterpret_vm_vd(d), vreinterpret_vm_vd(NPMASK))); }
Expand Down
10 changes: 5 additions & 5 deletions src/arch/helperavx2.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static INLINE int vavailability_i(int name) {

#endif // #if !defined(SLEEF_GENHEADER)

static INLINE void vprefetch_v_p(const void *ptr) { _mm_prefetch(ptr, _MM_HINT_T0); }
static INLINE void vprefetch_v_p(const void *ptr) { _mm_prefetch((const char *)ptr, _MM_HINT_T0); }

static INLINE int vtestallones_i_vo32(vopmask g) {
return _mm_test_all_ones(_mm_and_si128(_mm256_extractf128_si256(g, 0), _mm256_extractf128_si256(g, 1)));
Expand Down Expand Up @@ -392,10 +392,10 @@ static INLINE vfloat vgather_vf_p_vi2(const float *ptr, vint2 vi2) { return _mm2

//

#define PNMASK ((vdouble) { +0.0, -0.0, +0.0, -0.0 })
#define NPMASK ((vdouble) { -0.0, +0.0, -0.0, +0.0 })
#define PNMASKf ((vfloat) { +0.0f, -0.0f, +0.0f, -0.0f, +0.0f, -0.0f, +0.0f, -0.0f })
#define NPMASKf ((vfloat) { -0.0f, +0.0f, -0.0f, +0.0f, -0.0f, +0.0f, -0.0f, +0.0f })
#define PNMASK _mm256_set_pd( -0.0, +0.0, -0.0, +0.0 )
#define NPMASK _mm256_set_pd( +0.0, -0.0, +0.0, -0.0 )
#define PNMASKf _mm256_set_ps( -0.0f, +0.0f, -0.0f, +0.0f, -0.0f, +0.0f, -0.0f, +0.0f )
#define NPMASKf _mm256_set_ps( +0.0f, -0.0f, +0.0f, -0.0f, +0.0f, -0.0f, +0.0f, -0.0f )

static INLINE vdouble vposneg_vd_vd(vdouble d) { return vreinterpret_vd_vm(vxor_vm_vm_vm(vreinterpret_vm_vd(d), vreinterpret_vm_vd(PNMASK))); }
static INLINE vdouble vnegpos_vd_vd(vdouble d) { return vreinterpret_vd_vm(vxor_vm_vm_vm(vreinterpret_vm_vd(d), vreinterpret_vm_vd(NPMASK))); }
Expand Down
10 changes: 5 additions & 5 deletions src/arch/helperavx2_128.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static INLINE int vavailability_i(int name) {

#endif // #if !defined(SLEEF_GENHEADER)

static INLINE void vprefetch_v_p(const void *ptr) { _mm_prefetch(ptr, _MM_HINT_T0); }
static INLINE void vprefetch_v_p(const void *ptr) { _mm_prefetch((const char *)ptr, _MM_HINT_T0); }

static INLINE int vtestallones_i_vo32(vopmask g) { return _mm_movemask_epi8(g) == 0xFFFF; }
static INLINE int vtestallones_i_vo64(vopmask g) { return _mm_movemask_epi8(g) == 0xFFFF; }
Expand Down Expand Up @@ -371,10 +371,10 @@ static INLINE float vcast_f_vf(vfloat v) {

//

#define PNMASK ((vdouble) { +0.0, -0.0 })
#define NPMASK ((vdouble) { -0.0, +0.0 })
#define PNMASKf ((vfloat) { +0.0f, -0.0f, +0.0f, -0.0f })
#define NPMASKf ((vfloat) { -0.0f, +0.0f, -0.0f, +0.0f })
#define PNMASK _mm_set_pd( -0.0, +0.0 )
#define NPMASK _mm_set_pd( +0.0, -0.0 )
#define PNMASKf _mm_set_ps( -0.0f, +0.0f, -0.0f, +0.0f )
#define NPMASKf _mm_set_ps( +0.0f, -0.0f, +0.0f, -0.0f )

static INLINE vdouble vposneg_vd_vd(vdouble d) { return vreinterpret_vd_vm(vxor_vm_vm_vm(vreinterpret_vm_vd(d), vreinterpret_vm_vd(PNMASK))); }
static INLINE vdouble vnegpos_vd_vd(vdouble d) { return vreinterpret_vd_vm(vxor_vm_vm_vm(vreinterpret_vm_vd(d), vreinterpret_vm_vd(NPMASK))); }
Expand Down
2 changes: 1 addition & 1 deletion src/arch/helperavx512f.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static INLINE int vavailability_i(int name) {

#endif // #if !defined(SLEEF_GENHEADER)

static INLINE void vprefetch_v_p(const void *ptr) { _mm_prefetch(ptr, _MM_HINT_T0); }
static INLINE void vprefetch_v_p(const void *ptr) { _mm_prefetch((const char *)ptr, _MM_HINT_T0); }

#ifdef __INTEL_COMPILER
static INLINE int vtestallones_i_vo64(vopmask g) { return _mm512_mask2int(g) == 0xff; }
Expand Down
4 changes: 2 additions & 2 deletions src/arch/helperneon32.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,10 @@ static INLINE int vavailability_i(int name) {
}


static INLINE vfloat vload_vf_p(const float *ptr) { return vld1q_f32(__builtin_assume_aligned(ptr, 16)); }
static INLINE vfloat vload_vf_p(const float *ptr) { return vld1q_f32((const float32_t*)__builtin_assume_aligned(ptr, 16)); }
static INLINE vfloat vloadu_vf_p(const float *ptr) { return vld1q_f32(ptr); }

static INLINE void vstore_v_p_vf(float *ptr, vfloat v) { vst1q_f32(__builtin_assume_aligned(ptr, 16), v); }
static INLINE void vstore_v_p_vf(float *ptr, vfloat v) { vst1q_f32((float32_t*)__builtin_assume_aligned(ptr, 16), v); }
static INLINE void vstoreu_v_p_vf(float *ptr, vfloat v) { vst1q_f32(ptr, v); }

static INLINE vfloat vgather_vf_p_vi2(const float *ptr, vint2 vi2) {
Expand Down
10 changes: 5 additions & 5 deletions src/arch/helpersse2.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static INLINE int vavailability_i(int name) {

#endif // #if !defined(SLEEF_GENHEADER)

static INLINE void vprefetch_v_p(const void *ptr) { _mm_prefetch(ptr, _MM_HINT_T0); }
static INLINE void vprefetch_v_p(const void *ptr) { _mm_prefetch((const char *)ptr, _MM_HINT_T0); }

static INLINE int vtestallones_i_vo32(vopmask g) { return _mm_movemask_epi8(g) == 0xFFFF; }
static INLINE int vtestallones_i_vo64(vopmask g) { return _mm_movemask_epi8(g) == 0xFFFF; }
Expand Down Expand Up @@ -420,10 +420,10 @@ static INLINE float vcast_f_vf(vfloat v) {

//

#define PNMASK ((vdouble) { +0.0, -0.0 })
#define NPMASK ((vdouble) { -0.0, +0.0 })
#define PNMASKf ((vfloat) { +0.0f, -0.0f, +0.0f, -0.0f })
#define NPMASKf ((vfloat) { -0.0f, +0.0f, -0.0f, +0.0f })
#define PNMASK _mm_set_pd( -0.0, +0.0 )
#define NPMASK _mm_set_pd( +0.0, -0.0 )
#define PNMASKf _mm_set_ps( -0.0f, +0.0f, -0.0f, +0.0f )
#define NPMASKf _mm_set_ps( +0.0f, -0.0f, +0.0f, -0.0f )

static INLINE vdouble vposneg_vd_vd(vdouble d) { return vreinterpret_vd_vm(vxor_vm_vm_vm(vreinterpret_vm_vd(d), vreinterpret_vm_vd(PNMASK))); }
static INLINE vdouble vnegpos_vd_vd(vdouble d) { return vreinterpret_vd_vm(vxor_vm_vm_vm(vreinterpret_vm_vd(d), vreinterpret_vm_vd(NPMASK))); }
Expand Down

0 comments on commit f3c56d9

Please sign in to comment.