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;
Summary of Contents for SuperH SH-4A
Page 2: ...Rev 1 50 10 04 page ii of xx ...
Page 8: ...Rev 1 50 10 04 page viii of xx ...
Page 116: ...Rev 1 50 10 04 page 96 of 448 ...
Page 178: ...Rev 1 50 10 04 page 158 of 448 ...
Page 206: ...Rev 1 50 10 04 page 186 of 448 ...
Page 231: ...Rev 1 50 10 04 page 211 of 448 Possible Exceptions Slot illegal instruction exception ...
Page 235: ...Rev 1 50 10 04 page 215 of 448 Possible Exceptions Slot illegal instruction exception ...
Page 238: ...Rev 1 50 10 04 page 218 of 448 Possible Exceptions Slot illegal instruction exception ...
Page 408: ...Rev 1 50 10 04 page 388 of 448 Possible Exceptions Inexact Not generated when FPSCR PR 1 ...
Page 446: ...Rev 1 50 10 04 page 426 of 448 ...
Page 468: ...Rev 1 50 10 04 page 448 of 448 ...
Page 471: ......
Page 472: ...SH 4A Software Manual ...