Strange ARM optimisation issue in (android-ndk) gcc 4.8

2014-11-17 Thread Andrea Martino
Hi all, Today I noticed something strange with the way gcc optimises ternary operations in c (and c++). Consider the following example where I call foo(int) passing the clamped value of (s0, s1, s2): /**/ #include

Re: Strange ARM optimisation issue in (android-ndk) gcc 4.8

2014-11-17 Thread Joey Ye
This doesn't seem like a bug to me, unless they run with unexpected results. My guess of the reason of different generated code can be the mapping of registers and variables. s0, s1, s2 are not symmetric as they are mapping to different parameter registers. GCC may choose different sequence, in