On Fri, Oct 21, 2016 at 5:37 PM, Uros Bizjak <ubiz...@gmail.com> wrote: > On Fri, Oct 21, 2016 at 5:26 PM, Jakub Jelinek <ja...@redhat.com> wrote: > >> This patch on top of the just posted patch adds folding for a couple more >> builtins (though, hundreds or thousands of other md builtins remain unfolded >> even though they actually could be folded for e.g. const arguments).
Just a few words regarding other unfolded builtins. x86 intrinsics (and consequently builtins) are considered as a convenient way to emit assembly instructions. So, the same rules as when writting assembly, although slightly relaxed, should apply there. IMO, compiler optimizations with intrinsics should be an exception, not the rule. As an example, __builtin_ctz, __builtin_clz and functionaly similar target-builtins are rather messy w.r.t to "undefinedness", so I think this fact warrants some help from the compiler. But there is no need to handle every single builtin - only a competent person that knows the background of these intrinsics should use them. Uros.