-
Enhancement
-
Resolution: Unresolved
-
Low
-
Code Generation Tools
-
CODEGEN-9976
-
MSP430_21.6.0.LTS
-
default
The attached file.c includes these lines ...
uint8_t shift_right_toU8(uint16_t val) { return val >> 8U; }
It has 3 more functions that are similar. Build it ...
% cl430 -k -o file.c
Then inspect the resulting file.asm. The key lines for the function above are ...
shift_right_toU8: ;* --------------------------------------------------------------------------* ;** 5 ----------------------- return (unsigned char)(val>>8u); SWPB r12 ; [] |5| MOV.B r12,r12 ; [] |5| MOV.B r12,r12 ; [] |5| RET ; []
The second MOV.B is redundant.
The other 3 functions, while similar, sometimes have the same problem, but sometimes not.