asm volatile(".loop:\n" " mov $1, %%eax;\n" " add %%eax, tsx_cnt;\n" " '''.byte 0xc7, 0xf8;'''\n" /* xbegin */ " '''.long .fail-.begin;'''\n" ".begin:\n" " addl %0, sum;\n" " '''.byte 0x0f, 0x01, 0xd5'''\n" /* xend */ " jmp .done;\n" ".fail:\n" " jmp .loop;\n" ".done:\n" ::"r"(s):"%rax");
最近の gas を入れれば xbegin/xend が使える