------- Comment #2 from jakub at gcc dot gnu dot org 2009-07-10 16:31 ------- Created an attachment (id=18174) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18174&action=view) gcc45-pr40643.patch
Inline minmaxloc patch. Is this the behavior we want? If NaNs aren't supported and array size is known, no mask, then inline maxloc/minloc should be quite a bit faster (condition should be just val < limit instead of val < limit || (pos == 0 && val == limit)). On the other side, if array size isn't known at compile time (or non-scalar mask is used) and NaNs must be supported, the loop is more expensive. I haven't touched minmaxval inline expansion yet, there I'm afraid for floating point without -ffast-math the loop will have to be quite a bit slower than what we do ATM, as we'd need to return -inf for maxval on array full of -infs (or full of nans with at least one -inf), or nan for array full of nans, but for empty array or completely masked away array -huge. The patch also disables the inline expansion for -O0, I think at -O0 we should aim at generating smaller and more easily debuggable code. Probably we shouldn't be expanding this inline for optimize_size either. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40643