summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorDaniel Dragan <bulk88@hotmail.com>2014-09-18 23:24:18 -0400
committerFather Chrysostomos <sprout@cpan.org>2014-09-18 21:54:18 -0700
commit0789821b290971da5bf9411a333ee664f86aff6e (patch)
treea443a8694a6ff87135c2a79959f56cbf30631777 /pp_ctl.c
parentd8c6310a4f016fa2e6af68b606ee53084fbf4a8a (diff)
downloadperl-0789821b290971da5bf9411a333ee664f86aff6e.tar.gz
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
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c25
1 files changed, 13 insertions, 12 deletions
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");