ARM: Implement the udiv instruction.

This commit is contained in:
Gabe Black 2010-06-02 12:58:11 -05:00
parent f3e65c2de2
commit c3bf29bbea
2 changed files with 15 additions and 1 deletions

View file

@ -303,7 +303,7 @@ def format Thumb32LongMulMulAccAndDiv() {{
break;
case 0x3:
if (op2 == 0xf) {
return new WarnUnimplemented("udiv", machInst);
return new Udiv(machInst, rdhi, rn, rm);
}
break;
case 0x4:

View file

@ -53,4 +53,18 @@ let {{
header_output = RegRegRegOpDeclare.subst(sdivIop)
decoder_output = RegRegRegOpConstructor.subst(sdivIop)
exec_output = PredOpExecute.subst(sdivIop)
udivCode = '''
if (Op2.uw == 0) {
Dest.uw = 0;
} else {
Dest.uw = Op1.uw / Op2.uw;
}
'''
udivIop = InstObjParams("udiv", "Udiv", "RegRegRegOp",
{ "code": udivCode,
"predicate_test": predicateTest }, [])
header_output += RegRegRegOpDeclare.subst(udivIop)
decoder_output += RegRegRegOpConstructor.subst(udivIop)
exec_output += PredOpExecute.subst(udivIop)
}};