Kevin Ma

MSC8122  - different compiler optimization levels, intrinsics

Discussion created by Kevin Ma on Jul 18, 2007
Latest reply on Jul 18, 2007 by CrasyCat
I'm optimizing a project for Starcore MSC8122 with CW v5.7.0 (build 2262) in Windows XP. In my project I found issues that,
(1) (Without using any intrinsics) when compiling with O1, O2 or O3, results are wrong;
(2) Without intrinsics some modules/functions are ok with O3, but when using "norm_l" intrinsic, result at O0 is ok but at O1/O3 is wrong. Debugging revealed at least one problem: at one place the compiler was getting the value for a variable from a wrong place (pointed by stack pointer SP + wrong offset).
I understand (1) somewhat, although it's hardly acceptable. For (2), what can be the reason? Is it because my code is all in integer mode? norm_l is supposed to give same result for intergers or fractionals, since no shifting or saturation is involved, right?
Added part number to subject.

Message Edited by NLFSJ on 2007-07-17 06:42 PM