nounroll
This commit is contained in:
parent
2cad0798af
commit
e7cc64aa89
@ -82,6 +82,7 @@ BQNV bqn_makeChar(uint32_t c) { return makeX(m_c32(c)); }
|
||||
static usz calcIA(size_t rank, size_t* shape) {
|
||||
if (rank>UR_MAX) thrM("Rank too large");
|
||||
usz r = 1;
|
||||
NOUNROLL
|
||||
for (size_t i = 0; i < rank; i++) if (mulOn(r, shape[i])) thrM("Size too large");
|
||||
return r;
|
||||
}
|
||||
@ -97,7 +98,7 @@ static void copyBData(B* r, BQNV* data, usz ia) {
|
||||
}
|
||||
}
|
||||
#define CPYSH(R) usz* sh = arr_shAlloc(R, r0); \
|
||||
if (sh) for (size_t i = 0; RARE(i < r0); i++) sh[i] = sh0[i];
|
||||
if (sh) NOUNROLL for (size_t i = 0; RARE(i < r0); i++) sh[i] = sh0[i];
|
||||
|
||||
BQNV bqn_makeI8Arr (size_t r0, size_t* sh0, i8* data) { usz ia=calcIA(r0,sh0); i8* rp; Arr* r = m_i8arrp (&rp,ia); CPYSH(r); memcpy(rp,data,ia*1); return makeX(taga(r)); }
|
||||
BQNV bqn_makeI16Arr(size_t r0, size_t* sh0, i16* data) { usz ia=calcIA(r0,sh0); i16* rp; Arr* r = m_i16arrp(&rp,ia); CPYSH(r); memcpy(rp,data,ia*2); return makeX(taga(r)); }
|
||||
|
||||
7
src/h.h
7
src/h.h
@ -138,6 +138,13 @@ typedef double f64;
|
||||
#define N64x "%"SCNx64
|
||||
#define N64d "%"SCNd64
|
||||
#define N64u "%"SCNu64
|
||||
#if __clang__
|
||||
#define NOUNROLL _Pragma("clang loop unroll(disable)") _Pragma("clang loop vectorize(disable)")
|
||||
#elif __GNUC__
|
||||
#define NOUNROLL _Pragma("GCC unroll 1")
|
||||
#else
|
||||
#define NOUNROLL
|
||||
#endif
|
||||
|
||||
#define JOIN0(A,B) A##B
|
||||
#define JOIN(A,B) JOIN0(A,B)
|
||||
|
||||
@ -19,10 +19,7 @@ u64 alSize;
|
||||
|
||||
FORCE_INLINE void BN(splitTo)(EmptyValue* c, i64 from, i64 to, bool notEqual) {
|
||||
c->mmInfo = MMI(to);
|
||||
#ifdef __clang__
|
||||
#pragma clang loop unroll(disable) // at least n repetitions happen with probability 2^-n, so unrolling is kind of stupid
|
||||
#endif
|
||||
while (from != to) {
|
||||
NOUNROLL while (from != to) {
|
||||
from--;
|
||||
EmptyValue* b = (EmptyValue*) (BSZ(from) + (u8*)c);
|
||||
b->type = t_empty;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user