2012-07-20 09:50:53 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
int a, b, c;
|
|
|
|
int result;
|
|
|
|
|
|
|
|
a = 1;
|
2013-10-22 02:12:45 +02:00
|
|
|
result = 0x0;
|
2012-07-20 09:50:53 +02:00
|
|
|
__asm
|
2013-10-22 02:12:45 +02:00
|
|
|
("l.add r1, r1, r0\n\t" /* clear carry */
|
|
|
|
"l.addic %0, %0, 0xffff\n\t"
|
2012-07-20 09:50:53 +02:00
|
|
|
: "+r"(a)
|
|
|
|
);
|
|
|
|
if (a != result) {
|
|
|
|
printf("first addic error\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2013-10-22 02:12:45 +02:00
|
|
|
a = -1;
|
2012-07-20 09:50:53 +02:00
|
|
|
result = 0x201;
|
|
|
|
__asm
|
2013-10-22 02:12:45 +02:00
|
|
|
("l.add r1, r1, r0\n\t" /* clear carry */
|
|
|
|
"l.addic %0, %0, 0x1\n\t"
|
2012-07-20 09:50:53 +02:00
|
|
|
"l.ori %0, r0, 0x100\n\t"
|
|
|
|
"l.addic %0, %0, 0x100\n\t"
|
|
|
|
: "+r"(a)
|
|
|
|
);
|
|
|
|
if (a != result) {
|
|
|
|
printf("second addic error\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|