#include <revolution/os.h> // GQR type formats #define OS_GQR_F32 0x0000 #define OS_GQR_U8 0x0004 #define OS_GQR_U16 0x0005 #define OS_GQR_S8 0x0006 #define OS_GQR_S16 0x0007 // GQR scale factors #define OS_GQR_SCALE_NONE 0 #define OS_GQR_SCALE_2 1 #define OS_GQR_SCALE_4 2 #define OS_GQR_SCALE_8 3 #define OS_GQR_SCALE_16 4 #define OS_GQR_SCALE_32 5 #define OS_GQR_SCALE_64 6 #define OS_GQR_SCALE_128 7 #define OS_GQR_SCALE_256 8 #define OS_GQR_SCALE_512 9 #define OS_GQR_SCALE_1024 10 #define OS_GQR_SCALE_2048 11 #define OS_GQR_SCALE_4096 12 #define OS_GQR_SCALE_8192 13 #define OS_GQR_SCALE_16384 14 #define OS_GQR_SCALE_32768 15 #define OS_GQR_SCALE_65536 16 #define OS_GQR_SCALE_MAX 31 #define OS_GQR_DIVIDE_2 63 #define OS_GQR_DIVIDE_4 62 #define OS_GQR_DIVIDE_8 61 #define OS_GQR_DIVIDE_16 60 #define OS_GQR_DIVIDE_32 59 #define OS_GQR_DIVIDE_64 58 #define OS_GQR_DIVIDE_128 57 #define OS_GQR_DIVIDE_256 56 #define OS_GQR_DIVIDE_512 55 #define OS_GQR_DIVIDE_1024 54 #define OS_GQR_DIVIDE_2048 53 #define OS_GQR_DIVIDE_4096 52 #define OS_GQR_DIVIDE_8192 51 #define OS_GQR_DIVIDE_16384 50 #define OS_GQR_DIVIDE_32768 49 #define OS_GQR_DIVIDE_65536 48 #define OS_GQR_DIVIDE_MAX 32 inline void OSSetGQR2(u32 type, u32 scale); inline void OSSetGQR3(u32 type, u32 scale); inline void OSSetGQR4(u32 type, u32 scale); inline void OSSetGQR5(u32 type, u32 scale); inline void OSSetGQR6(u32 type, u32 scale); inline void OSSetGQR7(u32 type, u32 scale);
| type | Data Types. The specifiable values are: OS_GQR_F32, OS_GQR_S8, OS_GQR_S16, OS_GQR_U8, OS_GQR_U16. |
|---|---|
scale |
Scaling coefficient. The specifiable values are: OS_GQR_SCALE_* or OS_GQR_DIVIDE_*. |
None.
Sets a value to a GQR (quantization register) in the Broadway CPU. These register values are used to convert from floating-point to integer or vice versa with a paired single floating-point load/store instruction.
The type argument defines the data type used to load floating-point values from memory or store floating-point values into memory. The scale argument defines the scale factor when a value is stored into memory as an integer value. For loading a value from memory, the inverted scale factor is applied. For example, If you use OS_GQR_SCALE_4, the value will be scaled by 4 when stored, and divided by 4 when loaded.)
The Broadway CPU has 8 GQRs. Since GQR0 and GQR1 are reserved for the system, no APIs to modify them are available.
Note: OS fast cast functions use GQR2 to GQR5. If you change them after OSInitFastCast is called, such OS fast-cast functions as OSf32tos16 and OSf32tos8 will not behave correctly. In such a case, call the OSInitFastCast function again to re-initialize the four registers.
OSInitFastCast, OSf32tos16, OSf32tos8, OSf32tou16, OSf32tou8, OSs16tof32, OSs8tof32, OSu16tof32, OSu8tof32
2006/03/01 Initial version.
CONFIDENTIAL