0

I'm trying to revers this section of code, but I don't get it fully.

loc_2F2E0
VLDR            D19, =210.0
MOVS            R1, #0
VLDR            D18, =190.0
MOVS            R0, #0
VCMPE.F64       D17, D19
VMRS            APSR_nzcv, FPSCR
VCMPE.F64       D17, D18
IT MI
MOVMI           R1, #1
VMRS            APSR_nzcv, FPSCR
VCMPE.F64       D17, D19
IT GT
MOVGT           R0, #1
VMRS            APSR_nzcv, FPSCR
BNE             loc_2F348

As far as I can understand, what happens is:

D19 = 210.0;
R1 = 0;
D18 = 190.0;
R0 = 0;
if(D17 < D19 && D17 >= D18){
    R1 = 1;
}
if(D17 > D19){
    R0 = 1;
}
if(D17 != D19){
    // goes to loc_2F348
}

But I'm pretty sure I have made some mistakes on the VCMPE IT MI IT GT MOVMI and MOVGT, but I'm not sure.

2

For the flags to be visible by the IT block, they need to be moved to APSR.

This means that the IT MI block will only have the flags from VCMPE.F64 D17, D19, and the IT GT block will only see the result of VCMPE.F64 D17, D18

D19 = 210.0;
R1 = 0;
D18 = 190.0;
R0 = 0;
if(D17 < D19) {
    R1 = 1;
}
if(D17 > D18) {
    R0 = 1;
}
if(D17 != D19){
    // goes to loc_2F348
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.