Patches 58 and 59 fix the {min,max}loc and {min,max}val intrinsics which use multiple loops. See the comments in the patches for details. Patch 57 avoids duplicated offset calculation in the code generated. OK?