6 /* Apparently the "b" register constraint is like "r" except that it
7 disallows the use of r0, which means it is safe to use in places
8 where the appearance of r0 would cause a problem due to it being
11 static void announce ( char* str
)
13 printf("------ %s ------\n", str
);
19 char* a1
= malloc(100);
20 char* a2
= malloc(100);
21 strcpy(a1
,"here is a stringHERE IS A STRING");
23 announce("lswi n == 8 (fe special cased)");
24 asm volatile("li 5,0\n\t"
29 : : "b"(a1
), "b"(a2
) : "r3", "r4", "r5",
32 for (i
= 0; i
< 12; i
++)
33 printf("%d = 0x%2x\n", i
, a2
[i
]);
37 announce("lswi n /= 8");
38 asm volatile("lswi 3,%0, 9\n\t"
42 : : "b"(a1
), "b"(a2
) : "r3", "r4", "r5",
45 for (i
= 0; i
< 12; i
++)
46 printf("%d = 0x%2x\n", i
, a2
[i
]);
53 asm volatile("li 8, 11\n\t"
59 : : "b"(a1
), "b"(a2
), "b"(16) : "r3", "r4", "r5", "r8",
62 for (i
= 0; i
< 12; i
++)
63 printf("%d = 0x%2x\n", i
, a2
[i
]);
67 announce("stswi n == 8 (fe special cased)");
70 asm volatile("lswi 3,%0, 19\n\t"
72 : : "b"(a1
), "b"(a2
) : "r3","r4","r5","r6","r7",
78 announce("stswi n /= 8");
81 asm volatile("lswi 3,%0, 19\n\t"
83 : : "b"(a1
), "b"(a2
) : "r3","r4","r5","r6","r7",
92 asm volatile("li 8, 11\n\t"
96 : : "b"(a1
), "b"(a2
), "b"(16) : "r3", "r4", "r5", "r8",
98 printf("%s\n", a2
+16);