Download MIPSproTM Assembly Language Programmer`s Guide

Transcript
6: Coprocessor Instruction Set
• Round toward zero rounds toward zero. It rounds to the value that is closest to
and not greater in magnitude than the infinitely precise result. To select this mode,
set bits 1..0 of control register 31 to 1.
• Round toward positive infinity rounds to the value that is closest to and not less
than the infinitely precise result. To select this mode, set bits 1..0 of control register
31 to 2.
• Round toward negative infinity rounds toward negative infinity. It rounds to the
value that is closest to and not greater than the infinitely precise result. To select
this mode, set bits 1..0 of control register 31 to 3.
To set the rounding mode:
/* setting the rounding mode
RoundNearest = Ox0
RoundZero = Ox1
RoundPosInf = Ox2
RoundNegInf = Ox3
cfc1 rt2, $31
and rt, Oxfffffffc
or rt, RoundZero
ctc1 rt, $f31
86
*/
#
#
#
#
move from coprocessor 1
zero the round mode bits
set mask as round to zero
move to coprocessor 1
007–2418–006