comparison run/mini/__asm1.d @ 1628:c6ef09dfba4d

add mini test set from ldc project
author Moritz Warning <moritzwarning@web.de>
date Mon, 10 Jan 2011 19:47:18 +0100
parents
children
comparison
equal deleted inserted replaced
1627:e1b954780837 1628:c6ef09dfba4d
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 }