mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Rename _bsr/_bsf to bsr/bsf
Now that these functions are behind _COSMO_SOURCE there's no reason for having the ugly underscore anymore. To use these functions, you need to pass -mcosmo to cosmocc.
This commit is contained in:
parent
a6baba1b07
commit
8bfd56b59e
53 changed files with 110 additions and 93 deletions
14
third_party/chibicc/asm.c
vendored
14
third_party/chibicc/asm.c
vendored
|
@ -301,7 +301,7 @@ static void PickAsmRegisters(Asm *a) {
|
|||
if (!(m = a->ops[i].regmask)) break;
|
||||
if (popcnt(m) != j) break;
|
||||
if (!(m &= regset)) CouldNotAllocateRegister(&a->ops[i], "rm");
|
||||
pick = 1 << (a->ops[i].reg = _bsf(m));
|
||||
pick = 1 << (a->ops[i].reg = bsf(m));
|
||||
if (pick & PRECIOUS) a->regclob |= pick;
|
||||
regset &= ~pick;
|
||||
a->ops[i].regmask = 0;
|
||||
|
@ -309,14 +309,14 @@ static void PickAsmRegisters(Asm *a) {
|
|||
case kAsmXmm:
|
||||
if (!(m = a->ops[i].regmask)) break;
|
||||
if (!(m &= xmmset)) CouldNotAllocateRegister(&a->ops[i], "xmm");
|
||||
xmmset &= ~(1 << (a->ops[i].reg = _bsf(m)));
|
||||
xmmset &= ~(1 << (a->ops[i].reg = bsf(m)));
|
||||
a->ops[i].regmask = 0;
|
||||
break;
|
||||
case kAsmFpu:
|
||||
if (!(m = a->ops[i].x87mask)) break;
|
||||
if (popcnt(m) != j) break;
|
||||
if (!(m &= x87sts)) CouldNotAllocateRegister(&a->ops[i], "fpu");
|
||||
x87sts &= ~(1 << (a->ops[i].reg = _bsf(m)));
|
||||
x87sts &= ~(1 << (a->ops[i].reg = bsf(m)));
|
||||
a->ops[i].x87mask = 0;
|
||||
break;
|
||||
default:
|
||||
|
@ -540,7 +540,7 @@ static char *HandleAsmSpecifier(Asm *a, char *p) {
|
|||
if ((i = c - '0') >= a->n) {
|
||||
error_tok(a->tok, "bad asm reference at offset %d", p - a->str);
|
||||
}
|
||||
z = _bsr(a->ops[i].node->ty->size);
|
||||
z = bsr(a->ops[i].node->ty->size);
|
||||
if (z > 3 && a->ops[i].type == kAsmReg) {
|
||||
error_tok(a->tok, "bad asm op size");
|
||||
}
|
||||
|
@ -679,7 +679,7 @@ static void StoreAsmOutputs(Asm *a) {
|
|||
println("\tset%s\t(%%rax)", a->ops[i].str + a->ops[i].predicate);
|
||||
break;
|
||||
case kAsmReg:
|
||||
z = _bsr(a->ops[i].node->ty->size);
|
||||
z = bsr(a->ops[i].node->ty->size);
|
||||
if (a->ops[i].reg) {
|
||||
gen_addr(a->ops[i].node);
|
||||
if (z > 3) error_tok(a->tok, "bad asm out size");
|
||||
|
@ -734,7 +734,7 @@ static void StoreAsmOutputs(Asm *a) {
|
|||
static void PushClobbers(Asm *a) {
|
||||
int i, regs = a->regclob & PRECIOUS;
|
||||
while (regs) {
|
||||
i = _bsf(regs);
|
||||
i = bsf(regs);
|
||||
pushreg(kGreg[3][i]);
|
||||
regs &= ~(1 << i);
|
||||
}
|
||||
|
@ -743,7 +743,7 @@ static void PushClobbers(Asm *a) {
|
|||
static void PopClobbers(Asm *a) {
|
||||
int i, regs = a->regclob & PRECIOUS;
|
||||
while (regs) {
|
||||
i = _bsr(regs);
|
||||
i = bsr(regs);
|
||||
popreg(kGreg[3][i]);
|
||||
regs &= ~(1 << i);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue