aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/rtl/hipe_rtl_arith.inc
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-05-31 15:00:02 +0200
committerSverker Eriksson <[email protected]>2016-05-31 15:00:02 +0200
commit78b50b543395f9af748e2b00afb8c0266e708514 (patch)
treeacf9bfb112d9c276c52d6ad7d460be1ff10d1b7e /lib/hipe/rtl/hipe_rtl_arith.inc
parent17e95dd8dcb0149b771d4aafaeeebc715ee59d3d (diff)
parentf2ef57d35c27e62f7df6de312ff613bd9afd3c1d (diff)
downloadotp-78b50b543395f9af748e2b00afb8c0266e708514.tar.gz
otp-78b50b543395f9af748e2b00afb8c0266e708514.tar.bz2
otp-78b50b543395f9af748e2b00afb8c0266e708514.zip
Merge branch 'kostis/hipe-cleanup-19-rc1'
Diffstat (limited to 'lib/hipe/rtl/hipe_rtl_arith.inc')
-rw-r--r--lib/hipe/rtl/hipe_rtl_arith.inc55
1 files changed, 31 insertions, 24 deletions
diff --git a/lib/hipe/rtl/hipe_rtl_arith.inc b/lib/hipe/rtl/hipe_rtl_arith.inc
index 645bc83f9f..0c396c8e76 100644
--- a/lib/hipe/rtl/hipe_rtl_arith.inc
+++ b/lib/hipe/rtl/hipe_rtl_arith.inc
@@ -47,73 +47,80 @@ eval_alu(Op, Arg1, Arg2)
Res = (Arg1 - Arg2) band ?WORDMASK,
N = sign_bit(Res),
Z = zero(Res),
- V = (Sign1 and (not Sign2) and (not N))
+ V = (Sign1 andalso (not Sign2) andalso (not N))
or
- ((not Sign1) and Sign2 and N),
- C = ((not Sign1) and Sign2)
+ ((not Sign1) andalso Sign2 andalso N),
+ C = ((not Sign1) andalso Sign2)
or
- (N and ((not Sign1) or Sign2));
+ (N andalso ((not Sign1) orelse Sign2)),
+ {Res, N, Z, V, C};
'add' ->
Res = (Arg1 + Arg2) band ?WORDMASK,
N = sign_bit(Res),
Z = zero(Res),
- V = (Sign1 and Sign2 and (not N))
+ V = (Sign1 andalso Sign2 andalso (not N))
or
- ((not Sign1) and (not Sign2) and N),
- C = (Sign1 and Sign2)
+ ((not Sign1) andalso (not Sign2) andalso N),
+ C = (Sign1 andalso Sign2)
or
- ((not N) and (Sign1 or Sign2));
+ ((not N) andalso (Sign1 orelse Sign2)),
+ {Res, N, Z, V, C};
'mul' ->
FullRes = Arg1 * Arg2,
Res = FullRes band ?WORDMASK,
ResHi = FullRes bsr ?BITS,
N = sign_bit(Res),
Z = zero(Res),
- V = (N and (ResHi =/= -1)) or ((not N) and (ResHi =/= 0)),
- C = V;
+ V = (N andalso (ResHi =/= -1)) orelse ((not N) andalso (ResHi =/= 0)),
+ C = V,
+ {Res, N, Z, V, C};
'sra' ->
Res = (Arg1 bsr Arg2) band ?WORDMASK,
N = sign_bit(Res),
Z = zero(Res),
V = 0,
- C = 0;
+ C = 0,
+ {Res, N, Z, V, C};
'srl' ->
Res = (Arg1 bsr Arg2) band shiftmask(Arg2),
N = sign_bit(Res),
Z = zero(Res),
V = 0,
- C = 0;
+ C = 0,
+ {Res, N, Z, V, C};
'sll' ->
Res = (Arg1 bsl Arg2) band ?WORDMASK,
N = sign_bit(Res),
Z = zero(Res),
V = 0,
- C = 0;
+ C = 0,
+ {Res, N, Z, V, C};
'or' ->
Res = (Arg1 bor Arg2) band ?WORDMASK,
N = sign_bit(Res),
Z = zero(Res),
V = 0,
- C = 0;
+ C = 0,
+ {Res, N, Z, V, C};
'and' ->
Res = (Arg1 band Arg2) band ?WORDMASK,
N = sign_bit(Res),
Z = zero(Res),
V = 0,
- C = 0;
+ C = 0,
+ {Res, N, Z, V, C};
'xor' ->
Res = (Arg1 bxor Arg2) band ?WORDMASK,
N = sign_bit(Res),
Z = zero(Res),
V = 0,
- C = 0;
+ C = 0,
+ {Res, N, Z, V, C};
Op ->
- Res = N = Z = V = C = 0,
?EXIT({"unknown alu op", Op})
- end,
- {Res, N, Z, V, C};
+ end;
eval_alu(Op, Arg1, Arg2) ->
- ?EXIT({argument_overflow,Op,Arg1,Arg2}).
+ ?EXIT({argument_overflow, Op, Arg1, Arg2}).
%% Björn & Bjarni:
%% We need to be able to do evaluations based only on the bits, since
@@ -130,9 +137,9 @@ eval_cond_bits(Cond, N, Z, V, C) ->
'ne' ->
not Z;
'gt' ->
- not (Z or (N xor V));
+ not (Z orelse (N xor V));
'gtu' ->
- not (C or Z);
+ not (C orelse Z);
'ge' ->
not (N xor V);
'geu'->
@@ -142,9 +149,9 @@ eval_cond_bits(Cond, N, Z, V, C) ->
'ltu'->
C;
'le' ->
- Z or (N xor V);
+ Z orelse (N xor V);
'leu'->
- C or Z;
+ C orelse Z;
'overflow' ->
V;
'not_overflow' ->