Memory API
This API provides special instruction intrinsics, cache operations and memcpy()-type routines. shz_memcpy() is a generic drop-in memcpy() replacement; when you know and control the alignment and batch sizes, you can micro-optimize by calling the most specific specialization instead. sq_ routines write through the SH4 store queues, and _xmtrx routines use the XMTRX register bank as a scratch buffer, clobbering it. memcpy()-like routines will typically always check for proper alignment and size increments of parameters using assert(), so make sure to build a release build (-DNDEBUG) for maximal gainz when not debugging. There is no shz_memset() yet; it is listed as a TODO in the header.
- C header:
#include <sh4zam/shz_mem.h> - C++ header:
#include <sh4zam/shz_mem.hpp> - Symbols: 24
Suffixes
Section titled “Suffixes”Suffixes used in this module. The full list is in Naming and Suffixes.
sq_: Writes through the SH4 store queues (burst writes to memory or the PVR)._xmtrx: Uses the XMTRX register bank as a 64-byte scratch buffer. Clobbers XMTRX.memcpyN: A numeric suffix onmemcpy/memsetnames the element granularity or count, e.g.shz_memcpy32_1copies exactly one 32-byte line.
Specializations
Section titled “Specializations”Specialized routines for specific sizes + alignments.
| Symbol | Description |
|---|---|
shz_memcpy1 | Undocumented upstream. |
shz_memcpy2 | Undocumented upstream. |
shz_memcpy4 | Undocumented upstream. |
shz_memcpy8 | Undocumented upstream. |
shz_memcpy32 | Undocumented upstream. |
shz_sq_memcpy32 | Undocumented upstream. |
shz_sq_memcpy32_xmtrx | Undocumented upstream. |
shz_memcpy64 | Undocumented upstream. |
shz_memcpy128 | Undocumented upstream. |
C stdlib Replacements
Section titled “C stdlib Replacements”Routine replacing the C standard library copy/set API.
| Symbol | Description |
|---|---|
SHZ_ACCESS | Generic drop-in fast memcpy() replacement. |
shz_memcpy | Undocumented upstream. |
shz_memmove | Undocumented upstream. |
Constant-sized Operations
Section titled “Constant-sized Operations”Specialized routines for operating on statically sized buffers.
| Symbol | Description |
|---|---|
shz_memcpy2_8 | Undocumented upstream. |
shz_memcpy2_16 | Undocumented upstream. |
shz_memcpy4_16 | Undocumented upstream. |
shz_memcpy32_1 | Undocumented upstream. |
shz_memswap32_1 | Undocumented upstream. |
shz_memswap32_1_xmtrx | Undocumented upstream. |
shz_sq_memcpy32_1 | Undocumented upstream. |
shz_sq_memcpy32_1_xmtrx | Undocumented upstream. |
Macros
Section titled “Macros”| Symbol | Description |
|---|---|
SHZ_PREFETCH | Used to prepopulate the cache line mapping to the given address, before it is used. |
Not in upstream reference
Section titled “Not in upstream reference”Public declarations that upstream keeps out of its Doxygen reference. Listed for completeness; prefer the documented API.
| Symbol | Description |
|---|---|
shz_memset8 | Undocumented upstream. |
shz_memset2_16 | Undocumented upstream. |
shz_dcache_alloc_line | Undocumented upstream. |