This is something has not been done since the initial
port of SGI compiler from MIPS to Itanium, because
gcc's internal tree represents C multi-dimensional
arrays as array of array. As the result, the LNO
for C won't be able to match the performance of F90
multi-dimentional array.
I believe this is something on the TODO list. I would
encourge developers in Pro64 community to sign up this
activity. It is absolutely crucial for C/C++
performance.
Shin
--- Arthur Stoutchinin <Arthur.Stoutchinin@xxxxxx>
wrote:
> In the following example:
>
> 2-dimensional arrays seem to be represented as
> 1-dimensional array of
> 1-dimensional arrays, therefore WN_num_dim(array) =
> 1. How will it be
> recognized
> in the back-end as being WN_num_dim(array) = 2 ? The
> fact that
> it is a single-dimensional array seems to annoy
> ARRAY_ACCESS analysis in
>
> the LNO (Do_Automatic_Transformation in
> lno/snl_test.cxx).
>
> A.Stoutchinin
>
>
===============================================================
> C program:
>
> void interchange () {
> int i, j;
> short x[1000][100];
> short a[1000][100];
>
> for (i=0; i<1000; i++) {
> for (j=0; j<100; j++) {
> x[i][j] = x[i][j] * a[i][j];
> }
> }
>
> for (i=0; i<1000; i++) {
> for (j=0; j<100; j++) {
> printf ("%d\n", x[i][j]);
> }
> }
>
> return;
> }
>
>
===============================================================
> The front-end WHIRL output looks like so:
>
===============================================================
>
> LOC 1 4
> FUNC_ENTRY <1,39,interchange>
> BODY
> BLOCK
> END_BLOCK
> BLOCK
> END_BLOCK
> BLOCK
> PRAGMA 0 120 <null-st> 0 (0x0) # PREAMBLE_END
> LOC 1 9
> I4INTCONST 0 (0x0)
> I4STID 0 <2,1,i> T<4,.predef_I4,4>
> WHILE_DO
> I4I4LDID 0 <2,1,i> T<4,.predef_I4,4>
> I4INTCONST 999 (0x3e7)
> I4I4LE
> BODY
> BLOCK
> LOC 1 10
> I4INTCONST 0 (0x0)
> I4STID 0 <2,2,j> T<4,.predef_I4,4>
> WHILE_DO
> I4I4LDID 0 <2,2,j> T<4,.predef_I4,4>
> I4INTCONST 99 (0x63)
> I4I4LE
> BODY
> BLOCK
> LOC 1 11
> A4LDA 0 <2,3,x> T<49,anon_ptr.,4>
> I4INTCONST 1000 (0x3e8)
> I4I4LDID 0 <2,1,i> T<4,.predef_I4,4>
> A4ARRAY 1 200
> I4INTCONST 100 (0x64)
> I4I4LDID 0 <2,2,j> T<4,.predef_I4,4>
> A4ARRAY 1 2
> I4I2ILOAD 0 T<3,.predef_I2,2> T<50,anon_ptr.,4>
> A4LDA 0 <2,4,a> T<49,anon_ptr.,4>
> I4INTCONST 1000 (0x3e8)
> I4I4LDID 0 <2,1,i> T<4,.predef_I4,4>
> A4ARRAY 1 200
> I4INTCONST 100 (0x64)
> I4I4LDID 0 <2,2,j> T<4,.predef_I4,4>
> A4ARRAY 1 2
> I4I2ILOAD 0 T<3,.predef_I2,2> T<50,anon_ptr.,4>
> I4MPY
> A4LDA 0 <2,3,x> T<49,anon_ptr.,4>
> I4INTCONST 1000 (0x3e8)
> I4I4LDID 0 <2,1,i> T<4,.predef_I4,4>
> A4ARRAY 1 200
> I4INTCONST 100 (0x64)
> I4I4LDID 0 <2,2,j> T<4,.predef_I4,4>
> A4ARRAY 1 2
> I2ISTORE 0 T<50,anon_ptr.,4>
> LOC 1 12
> LABEL L2 0
> I4I4LDID 0 <2,2,j> T<4,.predef_I4,4>
> I4INTCONST 1 (0x1)
> I4ADD
> I4STID 0 <2,2,j> T<4,.predef_I4,4>
> END_BLOCK
> LOC 1 13
> LABEL L1 0
> I4I4LDID 0 <2,1,i> T<4,.predef_I4,4>
> I4INTCONST 1 (0x1)
> I4ADD
> I4STID 0 <2,1,i> T<4,.predef_I4,4>
> END_BLOCK
> LOC 1 15
> I4INTCONST 0 (0x0)
> I4STID 0 <2,1,i> T<4,.predef_I4,4>
> WHILE_DO
> I4I4LDID 0 <2,1,i> T<4,.predef_I4,4>
> I4INTCONST 999 (0x3e7)
> I4I4LE
> BODY
> BLOCK
> LOC 1 16
> I4INTCONST 0 (0x0)
> I4STID 0 <2,2,j> T<4,.predef_I4,4>
> WHILE_DO
> I4I4LDID 0 <2,2,j> T<4,.predef_I4,4>
> I4INTCONST 99 (0x63)
> I4I4LE
> BODY
> BLOCK
> LOC 1 17
> A4LDA 0 <1,41,(4_bytes)_"%d\n\000">
> T<53,anon_ptr.,4>
> A4PARM 2 T<30,anon_ptr.,4> # by_value
> A4LDA 0 <2,3,x> T<49,anon_ptr.,4>
> I4INTCONST 1000 (0x3e8)
> I4I4LDID 0 <2,1,i> T<4,.predef_I4,4>
> A4ARRAY 1 200
> I4INTCONST 100 (0x64)
> I4I4LDID 0 <2,2,j> T<4,.predef_I4,4>
> A4ARRAY 1 2
> I4I2ILOAD 0 T<4,.predef_I4,4> T<50,anon_ptr.,4>
> I4PARM 2 T<4,.predef_I4,4> # by_value
> VCALL 126 <1,40,printf> # flags 0x7e
> LOC 1 18
> LABEL L4 0
> I4I4LDID 0 <2,2,j> T<4,.predef_I4,4>
> I4INTCONST 1 (0x1)
> I4ADD
> I4STID 0 <2,2,j> T<4,.predef_I4,4>
> END_BLOCK
> LOC 1 19
> LABEL L3 0
> I4I4LDID 0 <2,1,i> T<4,.predef_I4,4>
> I4INTCONST 1 (0x1)
> I4ADD
> I4STID 0 <2,1,i> T<4,.predef_I4,4>
> END_BLOCK
> LOC 1 21
> RETURN
> END_BLOCK
>
>
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
|