Changeset 127

Show
Ignore:
Timestamp:
11/05/07 02:54:54 (1 year ago)
Author:
Don Clugston
Message:

Updated comments and example code for DMD 1.023, which now aligns static arrays so that they can be used with SSE.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/blade/BladeDemo.d

    r126 r127  
    1 //  Written in the D programming language 1.0 
     1//  Written in the D programming language 1.0. 
    22/** 
    33* BLADE 0.3Alpha -- Basic Linear Algebra D Expressions 
     
    99import std.stdio; 
    1010 
    11 // Unfortunately static arrays in D aren't aligned to 128-bit boundaries yet
     11// Local arrays in D aren't aligned to 128-bit boundaries
    1212// In such cases, the library generates an 'SSE misalignment' assert error, 
    1313// to avoid segfaults. 
    14 // For now, only use heap arrays with SSE/SSE2. 
     14// Use heap-allocated arrays, or static arrays (DMD 1.023 or later) 
     15// cdouble[] always remains aligned, even when sliced. 
    1516     
    1617void main() 
    1718{ 
    1819     
    19     auto z = [3.4, 565, 31.3]; 
     20    static z = [3.4, 565, 31.3, 0]; 
    2021    double [] a = new double[4]; 
    21     double [] d = new double[4]; 
     22    double [] d = [17.0, 28.25, 1, 56.2]; 
    2223    a[0..$] = [3.4, 565, 31.3, 41.8]; 
    23     d[0..$] = [17.0, 28.25, 1, 56.2];; 
    2424    auto w2=z.ptr; 
    2525    float[] q = new float[4]; 
     
    3232    } 
    3333 
    34     mixin(vectorize(" a   += d*2.01")); 
     34    mixin(vectorize(" a   += d*2.01-z")); 
    3535    mixin(vectorize(" a   += r*2.01")); 
    3636    mixin(vectorize(" q   += q*2.01"));