Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/LADSoft/OrangeC
Browse files Browse the repository at this point in the history
  • Loading branch information
LADSoft committed Nov 11, 2018
2 parents 8ceed97 + 256d463 commit 75b1026
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/occ/x86/beIntrins.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,24 @@ void promoteToBoolean(AMODE* addr)
{
addr->length = ISZ_UCHAR;
gen_code(op_setne, addr, NULL);
gen_code(op_movzx, makedreg(EAX), addr);
}
BOOLEAN handleBSR()
{
AMODE* al = makedreg(EAX);
gen_code(op_bsr, makedreg(ECX), makedreg(EDX));
AMODE* ecx = makedreg(ECX);
ecx->mode = am_indisp;
gen_code(op_bsr, makedreg(EAX), makedreg(EDX));
gen_code(op_mov, ecx, makedreg(EAX));
promoteToBoolean(al);
return TRUE;
}
BOOLEAN handleBSF()
{
AMODE* al = makedreg(EAX);
gen_code(op_bsf, makedreg(ECX), makedreg(EDX));
AMODE* ecx = makedreg(ECX);
ecx->mode = am_indisp;
gen_code(op_bsf, makedreg(EAX), makedreg(EDX));
gen_code(op_mov, ecx, makedreg(EAX));
promoteToBoolean(al);
return TRUE;
}
Expand Down
2 changes: 1 addition & 1 deletion src/occ/x86/beIntrinsicProtos.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef PROTO
#define PROTO(PROT, NAME, FUNC) PROT
# define PROTO(PROT, NAME, FUNC) PROT
#endif
PROTO("unsigned __fastcall __builtin_clz(unsigned val);", __builtin_clz, handleCLZ)
PROTO("unsigned __fastcall __builtin_clzl(unsigned long val);", __builtin_clzl, handleCLZ)
Expand Down

0 comments on commit 75b1026

Please sign in to comment.