aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/rtl/hipe_rtl_binary_construct.erl
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2017-04-09 13:27:51 +0200
committerMagnus Lång <[email protected]>2017-11-05 19:07:07 +0100
commit354f6d1c29ecaabab8a5aa3f1c95a4188a0aa542 (patch)
tree6e193c79976cb6e2c4e7121e39f790a0e234b7b1 /lib/hipe/rtl/hipe_rtl_binary_construct.erl
parentd71a2715c181f4659251723575eea79ee531729a (diff)
downloadotp-354f6d1c29ecaabab8a5aa3f1c95a4188a0aa542.tar.gz
otp-354f6d1c29ecaabab8a5aa3f1c95a4188a0aa542.tar.bz2
otp-354f6d1c29ecaabab8a5aa3f1c95a4188a0aa542.zip
HiPE: Make is_divisible a primop
Since gcunsafe values are live over is_divisible calls (although only the happy path, which never GCd), it should be a primop so there cannot be any GCs.
Diffstat (limited to 'lib/hipe/rtl/hipe_rtl_binary_construct.erl')
-rw-r--r--lib/hipe/rtl/hipe_rtl_binary_construct.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/hipe/rtl/hipe_rtl_binary_construct.erl b/lib/hipe/rtl/hipe_rtl_binary_construct.erl
index bc215e3abe..bc29e1d081 100644
--- a/lib/hipe/rtl/hipe_rtl_binary_construct.erl
+++ b/lib/hipe/rtl/hipe_rtl_binary_construct.erl
@@ -1210,6 +1210,12 @@ is_divisible(Dividend, Divisor, SuccLbl, FailLbl) ->
[hipe_rtl:mk_branch(Dividend, 'and', Mask, eq, SuccLbl, FailLbl, 0.99)];
false ->
%% We need division, fall back to a primop
- [hipe_rtl:mk_call([], is_divisible, [Dividend, hipe_rtl:mk_imm(Divisor)],
- SuccLbl, FailLbl, not_remote)]
+ [Tmp] = create_regs(1),
+ RetLbl = hipe_rtl:mk_new_label(),
+ [hipe_rtl:mk_call([Tmp], is_divisible,
+ [Dividend, hipe_rtl:mk_imm(Divisor)],
+ hipe_rtl:label_name(RetLbl), [], not_remote),
+ RetLbl,
+ hipe_rtl:mk_branch(Tmp, ne, hipe_rtl:mk_imm(0),
+ SuccLbl, FailLbl, 0.99)]
end.