aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-11-14 15:42:57 +0100
committerMagnus Lång <[email protected]>2016-11-16 17:22:05 +0100
commit053e54e5a937deb685dc71e3873074cb8efc96ea (patch)
tree465b60ec3ea1ba540a18be74776f71c436161415
parent6ce54e9665788e6a172950c68fb58158e923c6ec (diff)
downloadotp-053e54e5a937deb685dc71e3873074cb8efc96ea.tar.gz
otp-053e54e5a937deb685dc71e3873074cb8efc96ea.tar.bz2
otp-053e54e5a937deb685dc71e3873074cb8efc96ea.zip
hipe_tagscheme: Simplify test_two_fixnums with imm
test_two_fixnums would previously only check its right-hand argument for immediates, but not it's left. Now, test_two_fixnums reduces to test_fixnum if either argument is an immediate.
-rw-r--r--lib/hipe/rtl/hipe_tagscheme.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/hipe/rtl/hipe_tagscheme.erl b/lib/hipe/rtl/hipe_tagscheme.erl
index 566a28cd59..5d11b9b82e 100644
--- a/lib/hipe/rtl/hipe_tagscheme.erl
+++ b/lib/hipe/rtl/hipe_tagscheme.erl
@@ -464,12 +464,17 @@ test_fixnums_1([Arg1, Arg2|Args], Acc) ->
test_two_fixnums(Arg1, Arg2, FalseLab) ->
TrueLab = hipe_rtl:mk_new_label(),
- case hipe_rtl:is_imm(Arg2) of
+ case hipe_rtl:is_imm(Arg1) orelse hipe_rtl:is_imm(Arg2) of
true ->
- Value = hipe_rtl:imm_value(Arg2),
+ {Imm, Var} =
+ case hipe_rtl:is_imm(Arg1) of
+ true -> {Arg1, Arg2};
+ false -> {Arg2, Arg1}
+ end,
+ Value = hipe_rtl:imm_value(Imm),
case Value band ?TAG_IMMED1_MASK of
?TAG_IMMED1_SMALL ->
- [test_fixnum(Arg1, hipe_rtl:label_name(TrueLab), FalseLab, 0.99),
+ [test_fixnum(Var, hipe_rtl:label_name(TrueLab), FalseLab, 0.99),
TrueLab];
_ ->
[hipe_rtl:mk_goto(FalseLab)]