Tool/software: TI C/C++ Compiler
how is the V (Overflow) Flag set in an ARMCL Processor?
Got the understanding from the manuals, “Overflow flag will be set, if the result of an add, subtract, or compare is greater than or equal to 231, or less than -231 and if you add to positives and get a negative or subtract to negatives and get a positive!
Below are the scenarios which I tried. In both the case
CASE #1
int of_check = 0xFFFFFFFF;
of_check++;
of_check++;
*((uint32*)0xc002002C) = of_check;
CASE #2:
int range1 = 0x7fffffff;
int range2 = 0x7fffffff;
int res;
res = range1 + range2;
*((uint32*)0xc0020030) = res;
CASE #3:
int a = 0x80000000;
int b = 0x10000000;
int result = a+b;
*((int*)0xc0020030) = result;
Note* : When I try the above case, the corresponding object code is not generated by the ARMCL compiler.
My Question is,
- How is the V-Flag set?
- Why V-Flag is not set for the cases which I tried?
- How the ARMCL compiler eliminates the code in object file case#3, without generating the warning/Error while building the application?