28335对多个.bit操作和对.all操作所花费的时间一样吗?
GpioCtrlRegs.GPCMUX1.bit.GPIO64 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO65 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO66 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO67 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO68 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO69 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO70 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO71 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO72 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO73 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO74 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO75 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO76 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO77 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO78 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO79 = 0;
和
GpioCtrlRegs.GPCMUX1.all = 0x0000;
他们所花费的时间一样吗?或者编译器会把他们编译成相同的汇编代码吗?
囧:
不一样,肯定是一起操作快。你上面的对bit操作等于是每次写寄存器的一个bit,但是写的还是一个WORD,而下面的一个WORD一次就写进寄存器了肯定会快
28335对多个.bit操作和对.all操作所花费的时间一样吗?
GpioCtrlRegs.GPCMUX1.bit.GPIO64 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO65 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO66 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO67 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO68 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO69 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO70 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO71 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO72 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO73 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO74 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO75 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO76 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO77 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO78 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO79 = 0;
和
GpioCtrlRegs.GPCMUX1.all = 0x0000;
他们所花费的时间一样吗?或者编译器会把他们编译成相同的汇编代码吗?
Travel Zhou:
回复 Hank Zhao:
嗯,就是说是否优化是与优化等级有关的
28335对多个.bit操作和对.all操作所花费的时间一样吗?
GpioCtrlRegs.GPCMUX1.bit.GPIO64 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO65 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO66 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO67 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO68 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO69 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO70 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO71 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO72 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO73 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO74 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO75 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO76 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO77 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO78 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO79 = 0;
和
GpioCtrlRegs.GPCMUX1.all = 0x0000;
他们所花费的时间一样吗?或者编译器会把他们编译成相同的汇编代码吗?
Travel Zhou:
回复 囧:
嗯,是每次写寄存器的一个bit,但是写的还是一个WORD,好像TI文档有提及,那些写1操作的需要注意。
28335对多个.bit操作和对.all操作所花费的时间一样吗?
GpioCtrlRegs.GPCMUX1.bit.GPIO64 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO65 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO66 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO67 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO68 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO69 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO70 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO71 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO72 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO73 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO74 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO75 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO76 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO77 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO78 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO79 = 0;
和
GpioCtrlRegs.GPCMUX1.all = 0x0000;
他们所花费的时间一样吗?或者编译器会把他们编译成相同的汇编代码吗?
囧:
回复 Travel Zhou:
优化不会优化掉寄存器的配置
28335对多个.bit操作和对.all操作所花费的时间一样吗?
GpioCtrlRegs.GPCMUX1.bit.GPIO64 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO65 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO66 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO67 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO68 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO69 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO70 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO71 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO72 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO73 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO74 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO75 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO76 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO77 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO78 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO79 = 0;
和
GpioCtrlRegs.GPCMUX1.all = 0x0000;
他们所花费的时间一样吗?或者编译器会把他们编译成相同的汇编代码吗?
Travel Zhou:
回复 囧:
这个当然,比较关注优化后,是否会减少对应的汇编指令,好像我还没有使用过CCS的优化功能
28335对多个.bit操作和对.all操作所花费的时间一样吗?
GpioCtrlRegs.GPCMUX1.bit.GPIO64 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO65 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO66 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO67 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO68 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO69 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO70 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO71 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO72 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO73 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO74 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO75 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO76 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO77 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO78 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO79 = 0;
和
GpioCtrlRegs.GPCMUX1.all = 0x0000;
他们所花费的时间一样吗?或者编译器会把他们编译成相同的汇编代码吗?
囧:
回复 Travel Zhou:
有可能的,当然优化后也会有变量可能出问题的概率,所以谨慎使用,或者一遍写程序一遍优化,不要做完整个项目再去开优化
28335对多个.bit操作和对.all操作所花费的时间一样吗?
GpioCtrlRegs.GPCMUX1.bit.GPIO64 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO65 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO66 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO67 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO68 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO69 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO70 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO71 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO72 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO73 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO74 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO75 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO76 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO77 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO78 = 0;
GpioCtrlRegs.GPCMUX1.bit.GPIO79 = 0;
和
GpioCtrlRegs.GPCMUX1.all = 0x0000;
他们所花费的时间一样吗?或者编译器会把他们编译成相同的汇编代码吗?
Travel Zhou:
回复 囧:
嗯,多谢耐心指导,祝您工作愉快