OSSetGQR2 / OSSetGQR3 / OSSetGQR4 / OSSetGQR5 / OSSetGQR6 / OSSetGQR7

Syntax

#include <cafe/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

static inline void OSSetGQR2(u32 type, u32 scale);
static inline void OSSetGQR3(u32 type, u32 scale);
static inline void OSSetGQR4(u32 type, u32 scale);
static inline void OSSetGQR5(u32 type, u32 scale);
static inline void OSSetGQR6(u32 type, u32 scale);
static inline void OSSetGQR7(u32 type, u32 scale);

Parameters

type Data Types Can specify the following values: OS_GQR_F32, OS_GQR_S8, OS_GQR_S16, OS_GQR_U8, OS_GQR_U16.
scale Scaling factor. Can specify the following values: OS_GQR_SCALE_* or OS_GQR_DIVIDE_*.

Return Values

None.

Description

Sets values to a GQR in the Broadway CPU. These register values are used by a single floating-point paired load/store instructions to convert from float to int or vice versa.

The type argument defines the data type used to load float values from memory or store float values into memory. The scale argument defines the scale factor when a value is stored in memory as an integer value. When loading a value from memory, an inverted scale factor is applied. (For example, if you use OS_GQR_SCALE_4, the value is multiplied 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, there are no functions available to modify them.

NOTE:
OS fast-cast functions use GQR2 to GQR5. If you change these registers after the OSInitFastCast function is called, OS fast-cast functions (OSf32tos16, OSf32tos8, etc.) do not function properly. In such cases, call the OSInitFastCast function again to reinitialize these four registers.

Do Not Call From

OSSetGQR2

Multiple threads This function is not thread-safe.

OSSetGQR3

Multiple threads This function is not thread-safe.

OSSetGQR4

Multiple threads This function is not thread-safe.

OSSetGQR5

Multiple threads This function is not thread-safe.

OSSetGQR6

Multiple threads This function is not thread-safe.

OSSetGQR7

Multiple threads This function is not thread-safe.

See Also

OSInitFastCast
OSf32tos16
OSf32tos8
OSf32tou16
OSf32tou8
OSs16tof32
OSs8tof32
OSu16tof32
OSu8tof32

Revision History

2013-05-08 Automated cleanup pass.
2010-08-30 Initial version.


CONFIDENTIAL