Skip to content

Commit

Permalink
([-.-.) has different pristinity in 32-bit
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryHRich committed Jan 24, 2025
1 parent 4b53ea3 commit bc98a9b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion jsrc/j.h
Original file line number Diff line number Diff line change
Expand Up @@ -1960,7 +1960,7 @@ static inline __attribute__((__always_inline__)) float64x2_t vec_and_pd(float64x
#define PRISTXFER(z,w) AFLAGORLOCAL(z,PRISTFROMW(w)) PRISTCOMMON(w)
// transfer pristinity of w to z, destroying w
#define PRISTXFERF(z,w) AFLAGORLOCAL(z,PRISTFROMW(w)) PRISTCLRF(w) // use w bit of jtinplace
#define PRISTXFERAF(z,a) AFLAGORLOCAL(z,PRISTFROMA(w)) PRISTCLRF(a) // use a bit of jtinplace
#define PRISTXFERAF(z,a) AFLAGORLOCAL(z,PRISTFROMA(a)) PRISTCLRF(a) // use a bit of jtinplace
// same, but with an added condition (in bit 0)
#define PRISTXFERFIF(z,w,cond)AFLAGORLOCAL(z,AFLAG(w)&(((cond)&SGNTO0(AC(w))&((I)jtinplace>>JTINPLACEWX))<<AFPRISTINEX)) PRISTCLRF(w)
// transfer pristinity from a AND w to z (not if a==w)
Expand Down
2 changes: 1 addition & 1 deletion jsrc/vi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ F2(jtless){A x=w;I ar,at,k,r,*s,wr,*ws,wt;
// if nothing special (like sparse, or incompatible types, or x requires conversion) do the fast way; otherwise (-. x e. y) # y
RZ(x=!ISSPARSE(at)&&HOMO(at,wt)&&TYPESEQ(at,maxtype(at,wt))&&!(AFLAG(a)&AFNJA)?indexofsub(ILESS,x,a):
repeat(not(eps(a,x)),a));
// We extracted from a, so mark it non-pristine. If a was pristine and inplaceable, transfer its pristine status to the result
// We extracted from a, so mark it non-pristine. If a was pristine and abandoned, transfer its pristine status to the result
PRISTXFERAF(x,a)
RETF(x);
} /* a-.w */
Expand Down
10 changes: 7 additions & 3 deletions jsrc/viavx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1247,12 +1247,16 @@ F2(jtless){A x=w;I ar,at,k,r,*s,wr,*ws;
wr=AR(w); r=MAX(1,ar); I wn=AN(w); I wi,ai; SETIC(w,wi); SETIC(a,ai);
if(unlikely(ar>1+wr))RCA(a); // if w's rank is smaller than that of a cell of a, nothing can be removed, return a
if(unlikely(MIN(ai,wi)==0)&&(ar!=0))RCA(a); // if either arg has no items, there's nothing to remove, return a, unless atom must become a list
if(ar==wr+1){ // is just 1 cell of y?
if((ar^1)+wr==0){ // taking a single atom from a list?
// if # y speedup if(ar==wr+1){ // is just 1 cell of y?
// if y has rank 1 less than x, execute as ((x ~: y) # x) if y is atomic or ((x ~.@-:"yr) # x) if y is an array. Inplace x. Use IRS and leave comparison tolerance as set
J jtipx=(J)(((I)jtinplace&~(JTINPLACEA+JTINPLACEW))+(((I)jtinplace>>1)&JTINPLACEW)); // move input inplace-x flag to inplace-w
if(wr==0){RZ(x=jtrepeat(jtipx,ne(a,w),a)) // ((x ~: y) # x), inplaceable on the #
RZ(x=jtrepeat(jtipx,ne(a,w),a)) // ((x ~: y) # x), inplaceable on the #
#if 0 // until x # y has a fast-copy for strings of 1s this isn't so fast
if(wr==0){
}else{IRS2(a,w,0,wr,wr,jtnotmatch,x); RZ(x=jtrepeat(jtipx,x,a)) // ((x ~.@-:"yr) # x), inplaceable on the #
}
#endif
}else{
// if w's rank is larger than that of a cell of a, reheader w to look like a list of such cells
if(unlikely((-wr&-(r^wr))<0)){RZ(x=virtual(w,0,r)); AN(x)=wn; s=AS(x); ws=AS(w); k=ar>wr?0:1+wr-r; I s0; PRODX(s0,k,ws,1) s[0]=s0; MCISH(1+s,k+ws,r-1);} // use fauxvirtual here
Expand Down Expand Up @@ -1287,7 +1291,7 @@ DF2(jtintersect){A x=w;I ar,at,k,r,*s,wr,*ws;
POPCCT
RZ(x);
// obsolete PRISTXFERAF(x,a)
if(unlikely(at&BOX)){PRISTCLRF(a) PRISTCLRF(w)} // result is non-pristine, and both a and w also
if(unlikely(at&BOX))PRISTXFERAF(x,a) // the boxes in w cannot get to the result, even though their values participate; so pristinity depends entirely on a
RETF(x);
}

Expand Down
1 change: 1 addition & 0 deletions jsrc/vrep.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ static REPF(jtrepbdx){A z;I c,k,m,p;
I bitstack; // the bits packed together
if(n>=2*BSIZE){
// n>=64, bitpipe0 has the bits to process (and if n>=128 bitpipe1 is in flight).
// scaf if all 64 bits are 1s, copy full cachelines to the output. They will be misaligned, alas
bitstack=(I)(UI4)_mm256_movemask_epi8(_mm256_cmpeq_epi8(bitpipe00,i1))
|((I)(UI4)_mm256_movemask_epi8(_mm256_cmpeq_epi8(bitpipe01,i1))<<BSIZE);
}else{
Expand Down
2 changes: 1 addition & 1 deletion test/g221.ijs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ end.
100 test 4 %~ i. 100x


4!:55 ;:'b t test xx yy'
4!:55 ;:'b t test val xx yy'



Expand Down
2 changes: 1 addition & 1 deletion test/g631.ijs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ NB. dyad doesn't support prist yet '2' +&.> ckprist 0 1 1 ] 5 NB. scaf
~. ckprist 0 1 0 0 ] 5
~. ckprist 0 1 0 0 ] 4 5
'<"0 i. 3' -. ckprist 0 1 2 0 ] 5
'<"0 i. 3' ([-.-.) ckprist 0 0 ] 5
'<"0 i. 3' ([-.-.) ckprist (0 , IF64 , 2 0) ] 5 NB. In 32-bit ([-.-.) is not recognized as a compound and it is not seen that a is marked inplaceable for the rightmost -. but it can't get its result to the final output
|. ckprist 0 1 0 0 ] 5
|.!.a: ckprist 0 0 0 0 ] 5
'3' |. ckprist 0 1 0 0 ] 5
Expand Down

0 comments on commit bc98a9b

Please sign in to comment.