From 0789821b290971da5bf9411a333ee664f86aff6e Mon Sep 17 00:00:00 2001 From: Daniel Dragan Date: Thu, 18 Sep 2014 23:24:18 -0400 Subject: remove duplicate SvNV calls in pp_enteriter commit a2309040b8 added duplicate SvNV calls, remove them. Reorder the "SvUV_nomg(sv) > (UV)IV_MAX || SvNV_nomg(sv) > (NV)UV_MAX" so the var will be stored in a FP CPU reg for all comparisons, and not saved/fetched to/from mem across the SvUV func call. Due to complexity, I am not unrolling and fusing SvNV_nomg and SvOK. VC 2003 32b size of func in machine code bytes before 0x4d3 after 0x4a2 --- pp_ctl.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'pp_ctl.c') diff --git a/pp_ctl.c b/pp_ctl.c index d5c8d7e9c9..db125b80be 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -2121,29 +2121,30 @@ PP(pp_enteriter) SvGETMAGIC(sv); SvGETMAGIC(right); if (RANGE_IS_NUMERIC(sv,right)) { + NV nv; cx->cx_type &= ~CXTYPEMASK; cx->cx_type |= CXt_LOOP_LAZYIV; /* Make sure that no-one re-orders cop.h and breaks our assumptions */ assert(CxTYPE(cx) == CXt_LOOP_LAZYIV); #ifdef NV_PRESERVES_UV - if ((SvOK(sv) && ((SvNV_nomg(sv) < (NV)IV_MIN) || - (SvNV_nomg(sv) > (NV)IV_MAX))) + if ((SvOK(sv) && (((nv = SvNV_nomg(sv)) < (NV)IV_MIN) || + (nv > (NV)IV_MAX))) || - (SvOK(right) && ((SvNV_nomg(right) > (NV)IV_MAX) || - (SvNV_nomg(right) < (NV)IV_MIN)))) + (SvOK(right) && (((nv = SvNV_nomg(right)) > (NV)IV_MAX) || + (nv < (NV)IV_MIN)))) #else - if ((SvOK(sv) && ((SvNV_nomg(sv) <= (NV)IV_MIN) + if ((SvOK(sv) && (((nv = SvNV_nomg(sv)) <= (NV)IV_MIN) || - ((SvNV_nomg(sv) > 0) && - ((SvUV_nomg(sv) > (UV)IV_MAX) || - (SvNV_nomg(sv) > (NV)UV_MAX))))) + ((nv > 0) && + ((nv > (NV)UV_MAX) || + (SvUV_nomg(sv) > (UV)IV_MAX))))) || - (SvOK(right) && ((SvNV_nomg(right) <= (NV)IV_MIN) + (SvOK(right) && (((nv = SvNV_nomg(right)) <= (NV)IV_MIN) || - ((SvNV_nomg(right) > 0) && - ((SvUV_nomg(right) > (UV)IV_MAX) || - (SvNV_nomg(right) > (NV)UV_MAX)) + ((nv > 0) && + ((nv > (NV)UV_MAX) || + (SvUV_nomg(right) > (UV)IV_MAX)) )))) #endif DIE(aTHX_ "Range iterator outside integer range"); -- cgit v1.2.1