|
From: Bertho S. <lc...@va...> - 2026-06-09 14:24:07
|
On 6/9/26 2:08 AM, andy pugh wrote: >> I'm not sure I can "see" the problem anymore ;-) >>> (U8)((U32)((U32)((U32)((U32)((U32)((U32)((U32)((S32)(((FLAG)((S32)((S32)(((FLAG)((S32) >>> ((S32)(((FLAG)((S32)((S32)(tmp_Switch1_bhzg ? 1 : 0) > > I wonder if it matters, or if the compiler loses it all? Quite a few of the casts are duplicates and can be discarded. The compiler will detect the constants. It will most certainly be able to do quite a bit of folding if you let it. If the input variables are real bool type, then the ternaries will be reduced further. Even the multiplications turn out to be constants (it multiplies a ternary 0/1 result). Only the FLAG cast might be consequential if it is a bool. However, looking at it would only cast ternary 0 or 1 results to bool, which is, well, a bool in C. > I might need to manually strip the casts, compile both and inspect. > (And if it is actually different, and worse, have words. we pay for this) Compile inspecting may be interesting. My guess is it just works fine. But when it generates this, then, regardless whether it works, you pay too much. ;-) -- Greetings Bertho (disclaimers are disclaimed) |