EasyManua.ls Logo

Renesas SuperH SH-4A - NEGC (Negate with Carry): Arithmetic Instruction

Renesas SuperH SH-4A
472 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Rev. 1.50, 10/04, page 287 of 448
10.1.44 NEGC (Negate with Carry): Arithmetic Instruction
Format Operation Instruction Code Cycle T Bit
NEGC Rm,Rn 0 – Rm – T Rn,
borrow T
0110nnnnmmmm1010 1 Borrow
Description: This instruction subtracts the contents of general register Rm and the T bit from 0
and stores the result in Rn. A borrow resulting from the operation is reflected in the T bit. The
NEGC instruction is used for sign inversion of a value exceeding 32 bits.
Notes: None
Operation:
NEGC(long m, long n) /* NEGC Rm,Rn */
{
unsigned long temp;
temp = 0-R[m];
R[n] = temp-T;
if (0<temp) T = 1;
else T = 0;
if (temp<R[n]) T = 1;
PC += 2;
}
Example:
CLRT ;Sign inversion of R0:R1 (64 bits)
NEGC R1,R1 ;Before execution R1 = H'00000001, T = 0
;After execution R1 = H'FFFFFFFF, T = 1
NEGC R0,R0 ;Before execution R0 = H'00000000, T = 1
;After execution R0 = H'FFFFFFFF, T = 1

Table of Contents

Related product manuals