Removed magics: mAbsI64
This commit is contained in:
parent
3984fecae6
commit
87b6220897
6 changed files with 9 additions and 12 deletions
|
|
@ -551,7 +551,7 @@ type
|
||||||
mLeU, mLtU, mLeU64, mLtU64,
|
mLeU, mLtU, mLeU64, mLtU64,
|
||||||
mEqEnum, mLeEnum, mLtEnum, mEqCh, mLeCh, mLtCh, mEqB, mLeB, mLtB, mEqRef,
|
mEqEnum, mLeEnum, mLtEnum, mEqCh, mLeCh, mLtCh, mEqB, mLeB, mLtB, mEqRef,
|
||||||
mEqUntracedRef, mLePtr, mLtPtr, mEqCString, mXor, mEqProc, mUnaryMinusI,
|
mEqUntracedRef, mLePtr, mLtPtr, mEqCString, mXor, mEqProc, mUnaryMinusI,
|
||||||
mUnaryMinusI64, mAbsI, mAbsI64, mNot,
|
mUnaryMinusI64, mAbsI, mNot,
|
||||||
mUnaryPlusI, mBitnotI,
|
mUnaryPlusI, mBitnotI,
|
||||||
mUnaryPlusF64, mUnaryMinusF64, mAbsF64, mZe8ToI, mZe8ToI64,
|
mUnaryPlusF64, mUnaryMinusF64, mAbsF64, mZe8ToI, mZe8ToI64,
|
||||||
mZe16ToI, mZe16ToI64, mZe32ToI64, mZeIToI64, mToU8, mToU16, mToU32,
|
mZe16ToI, mZe16ToI64, mZe32ToI64, mZeIToI64, mToU8, mToU16, mToU32,
|
||||||
|
|
@ -603,7 +603,7 @@ const
|
||||||
mLeU, mLtU, mLeU64, mLtU64,
|
mLeU, mLtU, mLeU64, mLtU64,
|
||||||
mEqEnum, mLeEnum, mLtEnum, mEqCh, mLeCh, mLtCh, mEqB, mLeB, mLtB, mEqRef,
|
mEqEnum, mLeEnum, mLtEnum, mEqCh, mLeCh, mLtCh, mEqB, mLeB, mLtB, mEqRef,
|
||||||
mEqProc, mEqUntracedRef, mLePtr, mLtPtr, mEqCString, mXor, mUnaryMinusI,
|
mEqProc, mEqUntracedRef, mLePtr, mLtPtr, mEqCString, mXor, mUnaryMinusI,
|
||||||
mUnaryMinusI64, mAbsI, mAbsI64, mNot,
|
mUnaryMinusI64, mAbsI, mNot,
|
||||||
mUnaryPlusI, mBitnotI,
|
mUnaryPlusI, mBitnotI,
|
||||||
mUnaryPlusF64, mUnaryMinusF64, mAbsF64, mZe8ToI, mZe8ToI64,
|
mUnaryPlusF64, mUnaryMinusF64, mAbsF64, mZe8ToI, mZe8ToI64,
|
||||||
mZe16ToI, mZe16ToI64, mZe32ToI64, mZeIToI64, mToU8, mToU16, mToU32,
|
mZe16ToI, mZe16ToI64, mZe32ToI64, mZeIToI64, mToU8, mToU16, mToU32,
|
||||||
|
|
|
||||||
|
|
@ -525,11 +525,10 @@ proc binaryArithOverflow(p: BProc, e: PNode, d: var TLoc, m: TMagic) =
|
||||||
|
|
||||||
proc unaryArithOverflow(p: BProc, e: PNode, d: var TLoc, m: TMagic) =
|
proc unaryArithOverflow(p: BProc, e: PNode, d: var TLoc, m: TMagic) =
|
||||||
const
|
const
|
||||||
opr: array[mUnaryMinusI..mAbsI64, string] = [
|
opr: array[mUnaryMinusI..mAbsI, string] = [
|
||||||
mUnaryMinusI: "((NI$2)-($1))",
|
mUnaryMinusI: "((NI$2)-($1))",
|
||||||
mUnaryMinusI64: "-($1)",
|
mUnaryMinusI64: "-($1)",
|
||||||
mAbsI: "($1 > 0? ($1) : -($1))",
|
mAbsI: "($1 > 0? ($1) : -($1))"]
|
||||||
mAbsI64: "($1 > 0? ($1) : -($1))"]
|
|
||||||
var
|
var
|
||||||
a: TLoc
|
a: TLoc
|
||||||
t: PType
|
t: PType
|
||||||
|
|
@ -1647,7 +1646,7 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) =
|
||||||
case op
|
case op
|
||||||
of mOr, mAnd: genAndOr(p, e, d, op)
|
of mOr, mAnd: genAndOr(p, e, d, op)
|
||||||
of mNot..mToBiggestInt: unaryArith(p, e, d, op)
|
of mNot..mToBiggestInt: unaryArith(p, e, d, op)
|
||||||
of mUnaryMinusI..mAbsI64: unaryArithOverflow(p, e, d, op)
|
of mUnaryMinusI..mAbsI: unaryArithOverflow(p, e, d, op)
|
||||||
of mAddF64..mDivF64: binaryFloatArith(p, e, d, op)
|
of mAddF64..mDivF64: binaryFloatArith(p, e, d, op)
|
||||||
of mShrI..mXor: binaryArith(p, e, d, op)
|
of mShrI..mXor: binaryArith(p, e, d, op)
|
||||||
of mEqProc: genEqProc(p, e, d)
|
of mEqProc: genEqProc(p, e, d)
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,6 @@ const # magic checked op; magic unchecked op; checked op; unchecked op
|
||||||
["negInt", "", "negInt($1)", "-($1)"], # UnaryMinusI
|
["negInt", "", "negInt($1)", "-($1)"], # UnaryMinusI
|
||||||
["negInt64", "", "negInt64($1)", "-($1)"], # UnaryMinusI64
|
["negInt64", "", "negInt64($1)", "-($1)"], # UnaryMinusI64
|
||||||
["absInt", "", "absInt($1)", "Math.abs($1)"], # AbsI
|
["absInt", "", "absInt($1)", "Math.abs($1)"], # AbsI
|
||||||
["absInt64", "", "absInt64($1)", "Math.abs($1)"], # AbsI64
|
|
||||||
["", "", "!($1)", "!($1)"], # Not
|
["", "", "!($1)", "!($1)"], # Not
|
||||||
["", "", "+($1)", "+($1)"], # UnaryPlusI
|
["", "", "+($1)", "+($1)"], # UnaryPlusI
|
||||||
["", "", "~($1)", "~($1)"], # BitnotI
|
["", "", "~($1)", "~($1)"], # BitnotI
|
||||||
|
|
@ -392,7 +391,6 @@ const # magic checked op; magic unchecked op; checked op; unchecked op
|
||||||
["negInt", "", "negInt($1)", "-($1)"], # UnaryMinusI
|
["negInt", "", "negInt($1)", "-($1)"], # UnaryMinusI
|
||||||
["negInt64", "", "negInt64($1)", "-($1)"], # UnaryMinusI64
|
["negInt64", "", "negInt64($1)", "-($1)"], # UnaryMinusI64
|
||||||
["absInt", "", "absInt($1)", "Math.abs($1)"], # AbsI
|
["absInt", "", "absInt($1)", "Math.abs($1)"], # AbsI
|
||||||
["absInt64", "", "absInt64($1)", "Math.abs($1)"], # AbsI64
|
|
||||||
["", "", "not ($1)", "not ($1)"], # Not
|
["", "", "not ($1)", "not ($1)"], # Not
|
||||||
["", "", "+($1)", "+($1)"], # UnaryPlusI
|
["", "", "+($1)", "+($1)"], # UnaryPlusI
|
||||||
["", "", "~($1)", "~($1)"], # BitnotI
|
["", "", "~($1)", "~($1)"], # BitnotI
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ proc getIntervalType*(m: TMagic, n: PNode): PType =
|
||||||
else:
|
else:
|
||||||
result = makeRangeF(a, abs(getFloat(a.n.sons[1])),
|
result = makeRangeF(a, abs(getFloat(a.n.sons[1])),
|
||||||
abs(getFloat(a.n.sons[0])))
|
abs(getFloat(a.n.sons[0])))
|
||||||
of mAbsI, mAbsI64:
|
of mAbsI:
|
||||||
let a = n.sons[1].typ
|
let a = n.sons[1].typ
|
||||||
if isIntRange(a):
|
if isIntRange(a):
|
||||||
if a.n[0].intVal <= 0:
|
if a.n[0].intVal <= 0:
|
||||||
|
|
@ -298,7 +298,7 @@ proc evalOp(m: TMagic, n, a, b, c: PNode): PNode =
|
||||||
result = newFloatNodeT(toFloat(int(getInt(a))), n)
|
result = newFloatNodeT(toFloat(int(getInt(a))), n)
|
||||||
of mToInt, mToBiggestInt: result = newIntNodeT(system.toInt(getFloat(a)), n)
|
of mToInt, mToBiggestInt: result = newIntNodeT(system.toInt(getFloat(a)), n)
|
||||||
of mAbsF64: result = newFloatNodeT(abs(getFloat(a)), n)
|
of mAbsF64: result = newFloatNodeT(abs(getFloat(a)), n)
|
||||||
of mAbsI, mAbsI64:
|
of mAbsI:
|
||||||
if getInt(a) >= 0: result = a
|
if getInt(a) >= 0: result = a
|
||||||
else: result = newIntNodeT(- getInt(a), n)
|
else: result = newIntNodeT(- getInt(a), n)
|
||||||
of mZe8ToI, mZe8ToI64, mZe16ToI, mZe16ToI64, mZe32ToI64, mZeIToI64:
|
of mZe8ToI, mZe8ToI64, mZe16ToI, mZe16ToI64, mZe32ToI64, mZeIToI64:
|
||||||
|
|
|
||||||
|
|
@ -1013,7 +1013,7 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest; m: TMagic) =
|
||||||
c.gABC(n, opcCallSite, dest)
|
c.gABC(n, opcCallSite, dest)
|
||||||
of mNGenSym: genBinaryABC(c, n, dest, opcGenSym)
|
of mNGenSym: genBinaryABC(c, n, dest, opcGenSym)
|
||||||
of mMinI, mMaxI, mAbsF64, mMinF64, mMaxF64, mAbsI,
|
of mMinI, mMaxI, mAbsF64, mMinF64, mMaxF64, mAbsI,
|
||||||
mAbsI64, mDotDot:
|
mDotDot:
|
||||||
c.genCall(n, dest)
|
c.genCall(n, dest)
|
||||||
of mExpandToAst:
|
of mExpandToAst:
|
||||||
if n.len != 2:
|
if n.len != 2:
|
||||||
|
|
|
||||||
|
|
@ -2304,7 +2304,7 @@ proc abs*(x: int16): int16 {.magic: "AbsI", noSideEffect.} =
|
||||||
if x < 0: -x else: x
|
if x < 0: -x else: x
|
||||||
proc abs*(x: int32): int32 {.magic: "AbsI", noSideEffect.} =
|
proc abs*(x: int32): int32 {.magic: "AbsI", noSideEffect.} =
|
||||||
if x < 0: -x else: x
|
if x < 0: -x else: x
|
||||||
proc abs*(x: int64): int64 {.magic: "AbsI64", noSideEffect.} =
|
proc abs*(x: int64): int64 {.magic: "AbsI", noSideEffect.} =
|
||||||
## returns the absolute value of `x`. If `x` is ``low(x)`` (that
|
## returns the absolute value of `x`. If `x` is ``low(x)`` (that
|
||||||
## is -MININT for its type), an overflow exception is thrown (if overflow
|
## is -MININT for its type), an overflow exception is thrown (if overflow
|
||||||
## checking is turned on).
|
## checking is turned on).
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue