From 0d6f8021ee8874f4537e92a3621321086b268e24 Mon Sep 17 00:00:00 2001 From: bellard Date: Mon, 14 Apr 2003 22:23:55 +0000 Subject: update --- tcctest.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tcctest.c') diff --git a/tcctest.c b/tcctest.c index da2f0c1..c49a1a8 100644 --- a/tcctest.c +++ b/tcctest.c @@ -1841,6 +1841,20 @@ static __inline__ __const__ unsigned int swab32(unsigned int x) return x; } +static __inline__ unsigned long long mul64(unsigned int a, unsigned int b) +{ + unsigned long long res; + __asm__("mull %2" : "=A" (res) : "a" (a), "r" (b)); + return res; +} + +static __inline__ unsigned long long inc64(unsigned long long a) +{ + unsigned long long res; + __asm__("addl $1, %%eax ; adcl $0, %%edx" : "=A" (res) : "A" (a)); + return res; +} + unsigned int set; void asm_test(void) @@ -1849,10 +1863,17 @@ void asm_test(void) unsigned int val; printf("inline asm:\n"); + /* test the no operand case */ + asm volatile ("xorl %eax, %eax"); + memcpy1(buf, "hello", 6); strncat1(buf, " worldXXXXX", 3); printf("%s\n", buf); + /* 'A' constraint test */ + printf("mul64=0x%Lx\n", mul64(0x12345678, 0xabcd1234)); + printf("inc64=0x%Lx\n", inc64(0x12345678ffffffff)); + set = 0xff; sigdelset1(&set, 2); sigaddset1(&set, 16); -- cgit v1.3.1