Ignore:
Timestamp:
Jun 18, 2021, 12:20:59 PM (3 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
c7d8696a
Parents:
dcbfcbc
Message:

Implementing language-provided syntax for (array) dimensions.

Former z(i) and Z(N) macros are eliminated.

Location:
tests/array-container
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • tests/array-container/array-basic.cfa

    rdcbfcbc r6e50a6b  
    6161forall( [Nw], [Nx], [Ny], [Nz] )
    6262void fillHelloData( array( float, Nw, Nx, Ny, Nz ) & wxyz ) {
    63     for (w; z(Nw))
    64     for (x; z(Nx))
    65     for (y; z(Ny))
    66     for (z; z(Nz))
     63    for (w; Nw)
     64    for (x; Nx)
     65    for (y; Ny)
     66    for (z; Nz)
    6767        wxyz[w][x][y][z] = getMagicNumber(w, x, y, z);
    6868}
    6969
    70 forall( [Zn]
     70forall( [N]
    7171      , S & | sized(S)
    7272      )
    73 float total1d_low( arpk(Zn, S, float, float ) & a ) {
     73float total1d_low( arpk(N, S, float, float ) & a ) {
    7474    float total = 0.0f;
    75     for (i; z(Zn))
     75    for (i; N)
    7676        total += a[i];
    7777    return total;
     
    9898
    9999    expect = 0;
    100     for (i; z(Nw))
     100    for (i; Nw)
    101101        expect += getMagicNumber( i, slice_ix, slice_ix, slice_ix );
    102102    printf("expect Ws             = %f\n", expect);
     
    117117
    118118    expect = 0;
    119     for (i; z(Nx))
     119    for (i; Nx)
    120120        expect += getMagicNumber( slice_ix, i, slice_ix, slice_ix );
    121121    printf("expect Xs             = %f\n", expect);
  • tests/array-container/array-md-sbscr-cases.cfa

    rdcbfcbc r6e50a6b  
    2020forall( [Nw], [Nx], [Ny], [Nz] )
    2121void fillHelloData( array( float, Nw, Nx, Ny, Nz ) & wxyz ) {
    22     for (w; z(Nw))
    23     for (x; z(Nx))
    24     for (y; z(Ny))
    25     for (z; z(Nz))
     22    for (w; Nw)
     23    for (x; Nx)
     24    for (y; Ny)
     25    for (z; Nz)
    2626        wxyz[w][x][y][z] = getMagicNumber(w, x, y, z);
    2727}
     
    246246    assert(( wxyz[[2,  3,  4,  5]] == valExpected ));
    247247
    248     for ( i; z(Nw) ) {
     248    for ( i; Nw ) {
    249249        assert(( wxyz[[ i, 3, 4, 5 ]] == getMagicNumber(i, 3, 4, 5) ));
    250250    }
    251251
    252     for ( i; z(Nx) ) {
     252    for ( i; Nx ) {
    253253        assert(( wxyz[[ 2, i, 4, 5 ]] == getMagicNumber(2, i, 4, 5) ));
    254254    }
    255255
    256     for ( i; z(Ny) ) {
     256    for ( i; Ny ) {
    257257        assert(( wxyz[[ 2, 3, i, 5 ]] == getMagicNumber(2, 3, i, 5) ));
    258258    }
    259259
    260     for ( i; z(Nz) ) {
     260    for ( i; Nz ) {
    261261        assert(( wxyz[[ 2, 3, 4, i ]] == getMagicNumber(2, 3, 4, i) ));
    262262    }
    263263
    264     for ( i; z(Nw) ) {
     264    for ( i; Nw ) {
    265265        assert(( wxyz[[ i, all, 4, 5 ]][3] == getMagicNumber(i, 3, 4, 5) ));
    266266    }
    267267
    268     for ( i; z(Nw) ) {
     268    for ( i; Nw ) {
    269269        assert(( wxyz[[ all, 3, 4, 5 ]][i] == getMagicNumber(i, 3, 4, 5) ));
    270270    }
Note: See TracChangeset for help on using the changeset viewer.