Skip to content

Commit bc98a9b

Browse files
committed
([-.-.) has different pristinity in 32-bit
1 parent 4b53ea3 commit bc98a9b

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed

jsrc/j.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1960,7 +1960,7 @@ static inline __attribute__((__always_inline__)) float64x2_t vec_and_pd(float64x
19601960
#define PRISTXFER(z,w) AFLAGORLOCAL(z,PRISTFROMW(w)) PRISTCOMMON(w)
19611961
// transfer pristinity of w to z, destroying w
19621962
#define PRISTXFERF(z,w) AFLAGORLOCAL(z,PRISTFROMW(w)) PRISTCLRF(w) // use w bit of jtinplace
1963-
#define PRISTXFERAF(z,a) AFLAGORLOCAL(z,PRISTFROMA(w)) PRISTCLRF(a) // use a bit of jtinplace
1963+
#define PRISTXFERAF(z,a) AFLAGORLOCAL(z,PRISTFROMA(a)) PRISTCLRF(a) // use a bit of jtinplace
19641964
// same, but with an added condition (in bit 0)
19651965
#define PRISTXFERFIF(z,w,cond)AFLAGORLOCAL(z,AFLAG(w)&(((cond)&SGNTO0(AC(w))&((I)jtinplace>>JTINPLACEWX))<<AFPRISTINEX)) PRISTCLRF(w)
19661966
// transfer pristinity from a AND w to z (not if a==w)

jsrc/vi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ F2(jtless){A x=w;I ar,at,k,r,*s,wr,*ws,wt;
14231423
// if nothing special (like sparse, or incompatible types, or x requires conversion) do the fast way; otherwise (-. x e. y) # y
14241424
RZ(x=!ISSPARSE(at)&&HOMO(at,wt)&&TYPESEQ(at,maxtype(at,wt))&&!(AFLAG(a)&AFNJA)?indexofsub(ILESS,x,a):
14251425
repeat(not(eps(a,x)),a));
1426-
// We extracted from a, so mark it non-pristine. If a was pristine and inplaceable, transfer its pristine status to the result
1426+
// We extracted from a, so mark it non-pristine. If a was pristine and abandoned, transfer its pristine status to the result
14271427
PRISTXFERAF(x,a)
14281428
RETF(x);
14291429
} /* a-.w */

jsrc/viavx.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,12 +1247,16 @@ F2(jtless){A x=w;I ar,at,k,r,*s,wr,*ws;
12471247
wr=AR(w); r=MAX(1,ar); I wn=AN(w); I wi,ai; SETIC(w,wi); SETIC(a,ai);
12481248
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
12491249
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
1250-
if(ar==wr+1){ // is just 1 cell of y?
1250+
if((ar^1)+wr==0){ // taking a single atom from a list?
1251+
// if # y speedup if(ar==wr+1){ // is just 1 cell of y?
12511252
// 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
12521253
J jtipx=(J)(((I)jtinplace&~(JTINPLACEA+JTINPLACEW))+(((I)jtinplace>>1)&JTINPLACEW)); // move input inplace-x flag to inplace-w
1253-
if(wr==0){RZ(x=jtrepeat(jtipx,ne(a,w),a)) // ((x ~: y) # x), inplaceable on the #
1254+
RZ(x=jtrepeat(jtipx,ne(a,w),a)) // ((x ~: y) # x), inplaceable on the #
1255+
#if 0 // until x # y has a fast-copy for strings of 1s this isn't so fast
1256+
if(wr==0){
12541257
}else{IRS2(a,w,0,wr,wr,jtnotmatch,x); RZ(x=jtrepeat(jtipx,x,a)) // ((x ~.@-:"yr) # x), inplaceable on the #
12551258
}
1259+
#endif
12561260
}else{
12571261
// if w's rank is larger than that of a cell of a, reheader w to look like a list of such cells
12581262
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
@@ -1287,7 +1291,7 @@ DF2(jtintersect){A x=w;I ar,at,k,r,*s,wr,*ws;
12871291
POPCCT
12881292
RZ(x);
12891293
// obsolete PRISTXFERAF(x,a)
1290-
if(unlikely(at&BOX)){PRISTCLRF(a) PRISTCLRF(w)} // result is non-pristine, and both a and w also
1294+
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
12911295
RETF(x);
12921296
}
12931297

jsrc/vrep.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ static REPF(jtrepbdx){A z;I c,k,m,p;
123123
I bitstack; // the bits packed together
124124
if(n>=2*BSIZE){
125125
// n>=64, bitpipe0 has the bits to process (and if n>=128 bitpipe1 is in flight).
126+
// scaf if all 64 bits are 1s, copy full cachelines to the output. They will be misaligned, alas
126127
bitstack=(I)(UI4)_mm256_movemask_epi8(_mm256_cmpeq_epi8(bitpipe00,i1))
127128
|((I)(UI4)_mm256_movemask_epi8(_mm256_cmpeq_epi8(bitpipe01,i1))<<BSIZE);
128129
}else{

test/g221.ijs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ end.
128128
100 test 4 %~ i. 100x
129129

130130

131-
4!:55 ;:'b t test xx yy'
131+
4!:55 ;:'b t test val xx yy'
132132

133133

134134

test/g631.ijs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ NB. dyad doesn't support prist yet '2' +&.> ckprist 0 1 1 ] 5 NB. scaf
232232
~. ckprist 0 1 0 0 ] 5
233233
~. ckprist 0 1 0 0 ] 4 5
234234
'<"0 i. 3' -. ckprist 0 1 2 0 ] 5
235-
'<"0 i. 3' ([-.-.) ckprist 0 0 ] 5
235+
'<"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
236236
|. ckprist 0 1 0 0 ] 5
237237
|.!.a: ckprist 0 0 0 0 ] 5
238238
'3' |. ckprist 0 1 0 0 ] 5

0 commit comments

Comments
 (0)