EasyManua.ls Logo

Renesas SuperH SH-4A - MAC.L (Multiply and Accumulate Long): 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 253 of 448
10.1.28 MAC.L (Multiply and Accumulate Long): Arithmetic Instruction
Format Operation Instruction Code Cycle T Bit
MAC.L @Rm+,@Rn+ Signed,
(Rn) × (Rm) + MAC MAC
Rn + 4 Rn, Rm + 4 Rm
0000nnnnmmmm1111 5 —
Description: This instruction performs signed multiplication of the 32-bit operands whose
addresses are the contents of general registers Rm and Rn, adds the 64-bit result to the MAC
register contents, and stores the result in the MAC register. Operands Rm and Rn are each
incremented by 4 each time they are read.
If the S bit is 0, the 64-bit result is stored in the linked MACH and MACL registers.
If the S bit is 1, the addition to the MAC register contents is a saturation operation at the 48th bit
from the LSB. In a saturation operation, only the lower 48 bits of the MAC register are valid, and
the result range is limited to H'FFFF800000000000 (minimum value) to H'00007FFFFFFFFFFF
(maximum value).
Notes: None
Operation:
MACL(long m, long n) /* MAC.L @Rm+,@Rn+ */
{
unsigned long RnL,RnH,RmL,RmH,Res0,Res1,Res2;
unsigned long temp0,temp1,temp2,temp3;
long tempm,tempn,fnLmL;
tempn = (long)Read_Long(R[n]);
R[n] += 4;
tempm = (long)Read_Long(R[m]);
R[m] += 4;
if ((long)(tempn^tempm)<0) fnLmL = -1;
else fnLmL = 0;
if (tempn<0) tempn = 0-tempn;
if (tempm<0) tempm = 0-tempm;

Table of Contents

Related product manuals