brintos

brintos / llvm-project-archived public Read only

0
0
Text · 439 B · 1b87833 Raw
22 lines · cpp
1 2unsigned char asmFunc(unsigned char a, unsigned char b) {3  unsigned int la = a;4  unsigned int lb = b;5  unsigned int bigres;6  unsigned char res;7  __asm__ ("0:\n1:\n" : [bigres] "=la"(bigres) : [la] "0"(la), [lb] "c"(lb) :8                        "edx", "cc");9  res = bigres;10  return res;11}12 13int asmFunc2(int i) {14  int res;15  asm ("mov %1, %0 \t\n"16       "inc %0 "17      : "=r" (res)18      : "r" (i)19      : "cc");20  return res;21}22