Mercurial > projects > ldc
comparison tests/mini/__asm1.d @ 1154:9279a9dc6df3
Added support for tuple return with __asmtuple!(int,int) etc.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Sat, 28 Mar 2009 08:25:58 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1153:4454126b4345 | 1154:9279a9dc6df3 |
---|---|
1 import ldc.llvmasm; | |
2 void main() { | |
3 version(X86) | |
4 { | |
5 int i; | |
6 __asm("movl $1, $0", "=*m,i", &i, 42); | |
7 assert(i == 42); | |
8 | |
9 int j = __asm!(int)("movl $1, %eax", "={ax},i", 42); | |
10 assert(j == 42); | |
11 | |
12 auto k = __asmtuple!(int,int)("mov $2, %eax ; mov $3, %edx", "={ax},={dx},i,i", 10, 20); | |
13 assert(k.v[0] == 10); | |
14 assert(k.v[1] == 20); | |
15 } | |
16 else version(PPC) | |
17 { | |
18 int j = 42; | |
19 int i = __asm!(int)("li $1, $0", "=r,*m", &j); | |
20 assert(i == 42); | |
21 } | |
22 } |