This question came to my mind while writing some firmware for a PIC microcontroller.
There are two methods I know to initialize registers in a microcontroller. Say for an example, if we are initializing a port as outputs, one way is to write a command like the following and it will assign 1
to every bit in TRISx register
Method 1
TRISX = 0xFF;
The same thing can be done by assigning bits individually.
Method 2
_TRISX0 = 1;
_TRISX1 = 1;
_TRISX2 = 1;
...
_TRISX7 = 1;
My question is, will it get treated as same by compiler and the time taken to complete both the operations are same? Or does method 1 take one clock cycle while method 2 takes 8 (I mean ~8 times slower)?
I tried reading X16 compiler guide but couldn't find any tips.