annotate run/c/cdouble_01_A.d @ 1630:d0efa3ae5522 default tip

run/mini/naked_asm5: New x86_64 ABI passes the arguments in reverse order.
author David Nadlinger <code@klickverbot.at>
date Sat, 23 Apr 2011 22:57:32 +0200
parents b8c0195059d9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
560
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
1 // $HeadURL$
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
2 // $Date$
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
3 // $Author$
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
4
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
5 // @author@ Nick <Nick_member@pathlink.com>
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
6 // @date@ 2005-05-25
1489
b8c0195059d9 changed nntp: URLs to http: URLs
thomask
parents: 920
diff changeset
7 // @uri@ http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=4162
560
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
8
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
9 module dstress.run.c.cdouble_01_A;
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
10
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
11 int main(){
920
5511f9277078 testcase review
thomask
parents: 560
diff changeset
12 static cdouble[] params = [1.0 + 0.0i, 3.0 + 0.0i, 5.0 + 0.0i];
560
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
13
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
14 cdouble[] sums = new cdouble[3];
920
5511f9277078 testcase review
thomask
parents: 560
diff changeset
15 sums[] = 0.0 + 0.0i;
560
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
16
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
17 foreach(cdouble d; params){
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
18 cdouble prod = d;
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
19
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
20 for(int i; i<2; i++){
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
21 sums[i] += prod;
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
22 prod *= d;
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
23 }
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
24 sums[2] += prod;
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
25 }
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
26
920
5511f9277078 testcase review
thomask
parents: 560
diff changeset
27 assert(sums[0].re == 9.0);
5511f9277078 testcase review
thomask
parents: 560
diff changeset
28 assert(sums[0].im == 0.0);
5511f9277078 testcase review
thomask
parents: 560
diff changeset
29 assert(sums[1].re == 35.0);
5511f9277078 testcase review
thomask
parents: 560
diff changeset
30 assert(sums[1].im == 0.0);
5511f9277078 testcase review
thomask
parents: 560
diff changeset
31 assert(sums[2].re == 153.0);
5511f9277078 testcase review
thomask
parents: 560
diff changeset
32 assert(sums[2].im == 0.0);
560
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
33
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
34 return 0;
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
35 }