Mercurial > projects > ldc
annotate tests/mini/multiarr1.d @ 979:523bf4f166bc
Fix some assembler issues:
The assembler was miscompiling "add" (specifically, the "add reg/mem, imm"
variations).
The change that caused this seems to have been made because without it, some
"add"s didn't compile at all.
This patch reverts the previous change, and makes sure assembler operands are
remapped correctly even though the input operands auto-generated due to
updating operations aren't explicitly used.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Wed, 18 Feb 2009 21:46:14 +0100 |
parents | 1bb99290e03a |
children |
rev | line source |
---|---|
64
b688ad419f8c
[svn r68] Added support for multi-dimensional static arrays.
lindquist
parents:
diff
changeset
|
1 module multiarr1; |
b688ad419f8c
[svn r68] Added support for multi-dimensional static arrays.
lindquist
parents:
diff
changeset
|
2 |
b688ad419f8c
[svn r68] Added support for multi-dimensional static arrays.
lindquist
parents:
diff
changeset
|
3 void main() |
b688ad419f8c
[svn r68] Added support for multi-dimensional static arrays.
lindquist
parents:
diff
changeset
|
4 { |
b688ad419f8c
[svn r68] Added support for multi-dimensional static arrays.
lindquist
parents:
diff
changeset
|
5 int[16][16] a; |
339
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
94
diff
changeset
|
6 assert(a[0][0] == 0); |
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
94
diff
changeset
|
7 assert(a[0][1] == 0); |
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
94
diff
changeset
|
8 assert(a[0][2] == 0); |
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
94
diff
changeset
|
9 assert(a[0][3] == 0); |
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
94
diff
changeset
|
10 assert(a[10][13] == 0); |
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
94
diff
changeset
|
11 assert(a[15][15] == 0); |
64
b688ad419f8c
[svn r68] Added support for multi-dimensional static arrays.
lindquist
parents:
diff
changeset
|
12 a[10][13] = 42; |
339
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
94
diff
changeset
|
13 assert(a[0][0] == 0); |
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
94
diff
changeset
|
14 assert(a[10][13] == 42); |
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
94
diff
changeset
|
15 assert(a[15][15] == 0); |
94
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
64
diff
changeset
|
16 { |
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
64
diff
changeset
|
17 int* l = cast(int*)a; |
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
64
diff
changeset
|
18 l += 10*16+13; |
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
64
diff
changeset
|
19 assert(*l == 42); |
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
64
diff
changeset
|
20 } |
64
b688ad419f8c
[svn r68] Added support for multi-dimensional static arrays.
lindquist
parents:
diff
changeset
|
21 } |