Rev. 1.50, 10/04, page 387 of 448
10.3.11 FLOAT (Floating-point Convert from Integer): Floating-Point Instruction
PR
Format
Operation
Instruction Code
Cycle
T Bit
0
FLOAT FPUL,FRn
(float)FPUL
→
FRn
1111nnnn00101101
1 —
1
FLOAT FPUL,DRn
(double)FPUL
→
DRn
1111nnn000101101
1 —
Description:
When FPSCR.PR = 0: Taking the contents of FPUL as a 32-bit integer, converts this integer to a
single-precision floating-point number and stores the result in FRn.
When FPSCR.PR = 1: Taking the contents of FPUL as a 32-bit integer, converts this integer to a
double-precision floating-point number and stores the result in DRn.
When FPSCR.enable.I = 1 and FPSCR.PR = 0, an FPU exception trap is generated regardless of
whether or not an exception has occurred. When an exception occurs, correct exception
information is reflected in FPSCR.cause and FPSCR.flag, and FRn is not updated. Appropriate
processing should therefore be performed by software.
Notes:
None
Operation:
void FLOAT(int n, float *FPUL)
{
union {
double d;
int l[2];
} tmp;
pc += 2;
clear_cause();
if(FPSCR.PR==0){
FR[n] = *FPUL; /* convert from integer to float */
tmp.d = *FPUL;
if(tmp.l[1] & 0x1fffffff) inexact();
} else {
DR[n>>1] = *FPUL; /* convert from integer to double */
}
}
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 ...