[PATCH] Emit minnum / maxnum for __builtin_fmin/fmax
Matthew.Arsenault at amd.com
Wed Oct 22 12:24:34 PDT 2014
Well first, I would think the point of using __builtin is to specifically get the intrinsic, and not use the library function.
I don’t think they are treated the same as libcalls in most situations, but the current situation is not easy to follow. First, I mostly care about targets that do not have calls and TargetLibraryInfo isn’t particularly helpful or meaningful as is. I think if there is an equivalent intrinsic for the library function, it should always be used instead for consistency. The current state where a call is sometimes treated as an intrinsic and sometimes isn't is pretty confusing (It’s also something else I probably need to add support for for minnum / maxnum). Some places end up trying to consider both forms, or some forget one or the other. Maybe there should be a pass that translates all of the libcalls into equivalent intrinsics?
Intrinsics are considered many more places than query TargetLibraryInfo, e.g. isSafeToSpeculativelyExecute checks many intrinsics but no libcalls. I’m also not sure how the call form interacts with -fno-builtin. I don’t think a regular call can / is considered as a candidate for vectorization, but the intrinsics are.
More information about the cfe-commits