Go to the source code of this file.
Defines | |
| #define | paired_load(gqr, data, single) |
| Loads a Paired Single. | |
| #define | paired_store(gqr, data, single, pair) |
| Stores a Paired Single. | |
| #define | paired_abs(pair) |
| Absolute value of a Paired Single. | |
| #define | paired_nabs(pair) |
| Negative absolute value of a Paired Single. | |
| #define | paired_neg(pair) |
| Negative value of a Paired Single. | |
| #define | paired_reciprocal(pair) |
| Estimated reciprocal of a Paired Single. | |
| #define | paired_sqrt_reciprocal(pair) |
| Estimated reciprocal of the square root of a Paired Single. | |
| #define | paired_add(pair0, pair1) |
| Add Paired Singles. | |
| #define | paired_div(dend, sor) |
| Divide Paired Singles. | |
| #define | paired_mul(pair0, pair1) |
| Multiply Paired Singles. | |
| #define | paired_sub(uend, hend) |
| Subtract Paired Singles. | |
| #define | paired_madd(mul0, mul1, add) |
| Multiply then add Paired Singles. | |
| #define | paired_madds0(mul0, mul1, add) |
| Multiply then add Paired Singles Scalar high. | |
| #define | paired_madds1(mul0, mul1, add) |
| Multiply then add Paired Singles Scalar low. | |
| #define | paired_msub(mul0, mul1, sub) |
| Multiply then subtract Paired Singles. | |
| #define | paired_muls0(mul0, mul1) |
| Multiply Scalar high. | |
| #define | paired_muls1(mul0, mul1) |
| Multiply Scalar low. | |
| #define | paired_nmadd(mul0, mul1, add) |
| Negative multiply then add Paired Singles. | |
| #define | paired_nmsub(mul0, mul1, sub) |
| Negative multiply then subtract Paired Singles. | |
| #define | paired_merge00(pair0, pair1) |
| Merge high. | |
| #define | paired_merge01(pair0, pair1) |
| Merge direct. | |
| #define | paired_merge10(pair0, pair1) |
| Merge swapped. | |
| #define | paired_merge11(pair0, pair1) |
| Merge low. | |
| #define | paired_select(sel, pos, neg) |
| Select. | |
| #define | paired_sum0(pair0, pair1, pair2) |
| Vector Sum high. | |
| #define | paired_sum1(pair0, pair1, pair2) |
| Vector Sum low. | |
Enumerations | |
| enum | gqr_type_t { GQR_TYPE_FLOAT = 0, GQR_TYPE_U8 = 4, GQR_TYPE_U16, GQR_TYPE_S8, GQR_TYPE_S16 } |
Functions | |
| void | paired_set_gqr (int gqr, int mode, gqr_type_t type, int scale) |
| Sets up a GQR. | |
| void | paired_get_gqr (int gqr, int mode, gqr_type_t *type, int *scale) |
| Gets information from a GQR. | |
An abstraction of the paired singles instructions. These functions are better documented on http://wiibrew.org/wiki/Paired_single
| #define paired_abs | ( | pair | ) |
({ \
double out; \
asm volatile \
(" ps_abs %0, %1\n" \
: "=f"(out) \
: "f"(pair) \
); \
out; \
})
Absolute value of a Paired Single.
| pair | the pair to get the absolute values of. |
| #define paired_add | ( | pair0, | |||
| pair1 | ) |
({ \
double out; \
asm volatile \
(" ps_add %0, %1, %2\n" \
: "=f"(out) \
: "f"(pair0), "f"(pair1) \
); \
out; \
})
Add Paired Singles.
| pair0 | the first pair. | |
| pair1 | the seconds pair. |
| #define paired_div | ( | dend, | |||
| sor | ) |
({ \
double out; \
asm volatile \
(" ps_div %0, %1, %2\n" \
: "=f"(out) \
: "f"(dend), "f"(sor) \
); \
out; \
})
Divide Paired Singles.
| dend | the dividend pair. | |
| sor | the divisor pair. |
| #define paired_load | ( | gqr, | |||
| data, | |||||
| single | ) |
({ \
double pair; \
asm volatile \
(" psq_lx %0, 0, %1, 0, %3\n" \
: "=f"(pair) /* The FPR target */ \
: "rm"(data), "i"(single), "i"(gqr) \
); \
pair; \
})
Loads a Paired Single.
| gqr | the GQR to use for dequantization of the data. | |
| data | a pointer to the data to dequantize into the paired single. Must be a 2-element array. | |
| single | if this is non-zero, only one number will be dequantized into PS0. PS1 will be loaded with 1.0. |
| #define paired_madd | ( | mul0, | |||
| mul1, | |||||
| add | ) |
({ \
double out; \
asm volatile \
(" ps_madd %0, %1, %2, %3\n" \
: "=f"(out) \
: "f"(mul0), "f"(mul1), "f"(add) \
); \
out; \
})
Multiply then add Paired Singles.
| mul0 | the first multiply pair. | |
| mul1 | the other multiply pair. | |
| add | the addition pair. |
| #define paired_madds0 | ( | mul0, | |||
| mul1, | |||||
| add | ) |
({ \
double out; \
asm volatile \
(" ps_madds0 %0, %1, %2, %3\n" \
: "=f"(out) \
: "f"(mul0), "f"(mul1), "f"(add) \
); \
out; \
})
Multiply then add Paired Singles Scalar high.
| mul0 | the first multiply pair. | |
| mul1 | the other multiply pair. (only PS0 is used) | |
| add | the addition pair. |
| #define paired_madds1 | ( | mul0, | |||
| mul1, | |||||
| add | ) |
({ \
double out; \
asm volatile \
(" ps_madds1 %0, %1, %2, %3\n" \
: "=f"(out) \
: "f"(mul0), "f"(mul1), "f"(add) \
); \
out; \
})
Multiply then add Paired Singles Scalar low.
| mul0 | the first multiply pair. | |
| mul1 | the other multiply pair. (only PS1 is used) | |
| add | the addition pair. |
| #define paired_merge00 | ( | pair0, | |||
| pair1 | ) |
({ \
double out; \
asm volatile \
(" ps_merge00 %0, %1, %2\n" \
: "=f"(out) \
: "f"(pair0), "f"(pair1) \
); \
out; \
})
Merge high.
| pair0 | the first pair. (only PS0 is used) | |
| pair1 | the other pair. (only PS0 is used) |
| #define paired_merge01 | ( | pair0, | |||
| pair1 | ) |
({ \
double out; \
asm volatile \
(" ps_merge01 %0, %1, %2\n" \
: "=f"(out) \
: "f"(pair0), "f"(pair1) \
); \
out; \
})
Merge direct.
| pair0 | the first pair. (only PS0 is used) | |
| pair1 | the other pair. (only PS1 is used) |
| #define paired_merge10 | ( | pair0, | |||
| pair1 | ) |
({ \
double out; \
asm volatile \
(" ps_merge10 %0, %1, %2\n" \
: "=f"(out) \
: "f"(pair0), "f"(pair1) \
); \
out; \
})
Merge swapped.
| pair0 | the first pair. (only PS1 is used) | |
| pair1 | the other pair. (only PS0 is used) |
| #define paired_merge11 | ( | pair0, | |||
| pair1 | ) |
({ \
double out; \
asm volatile \
(" ps_merge11 %0, %1, %2\n" \
: "=f"(out) \
: "f"(pair0), "f"(pair1) \
); \
out; \
})
Merge low.
| pair0 | the first pair. (only PS1 is used) | |
| pair1 | the other pair. (only PS1 is used) |
| #define paired_msub | ( | mul0, | |||
| mul1, | |||||
| sub | ) |
({ \
double out; \
asm volatile \
(" ps_msub %0, %1, %2, %3\n" \
: "=f"(out) \
: "f"(mul0), "f"(mul1), "f"(sub) \
); \
out; \
})
Multiply then subtract Paired Singles.
| mul0 | the first multiply pair. | |
| mul1 | the other multiply pair. | |
| sub | the subtraction pair. |
| #define paired_mul | ( | pair0, | |||
| pair1 | ) |
({ \
double out; \
asm volatile \
(" ps_mul %0, %1, %2\n" \
: "=f"(out) \
: "f"(pair0), "f"(pair1) \
); \
out; \
})
Multiply Paired Singles.
| pair0 | the first pair. | |
| pair1 | the seconds pair. |
| #define paired_muls0 | ( | mul0, | |||
| mul1 | ) |
({ \
double out; \
asm volatile \
(" ps_muls0 %0, %1, %2\n" \
: "=f"(out) \
: "f"(mul0), "f"(mul1) \
); \
out; \
})
Multiply Scalar high.
| mul0 | the first multiply pair. | |
| mul1 | the other multiply pair. (only PS0 is used) |
| #define paired_muls1 | ( | mul0, | |||
| mul1 | ) |
({ \
double out; \
asm volatile \
(" ps_muls1 %0, %1, %2\n" \
: "=f"(out) \
: "f"(mul0), "f"(mul1) \
); \
out; \
})
Multiply Scalar low.
| mul0 | the first multiply pair. | |
| mul1 | the other multiply pair. (only PS1 is used) |
| #define paired_nabs | ( | pair | ) |
({ \
double out; \
asm volatile \
(" ps_nabs %0, %1\n" \
: "=f"(out) \
: "f"(pair) \
); \
out; \
})
Negative absolute value of a Paired Single.
| pair | the pair to get the negative absolute values of. |
| #define paired_neg | ( | pair | ) |
({ \
double out; \
asm volatile \
(" ps_neg %0, %1\n" \
: "=f"(out) \
: "f"(pair) \
); \
out; \
})
Negative value of a Paired Single.
| pair | the pair to get the negative of. |
| #define paired_nmadd | ( | mul0, | |||
| mul1, | |||||
| add | ) |
({ \
double out; \
asm volatile \
(" ps_nmadd %0, %1, %2, %3\n" \
: "=f"(out) \
: "f"(mul0), "f"(mul1), "f"(add) \
); \
out; \
})
Negative multiply then add Paired Singles.
| mul0 | the first multiply pair. | |
| mul1 | the other multiply pair. | |
| add | the addition pair. |
| #define paired_nmsub | ( | mul0, | |||
| mul1, | |||||
| sub | ) |
({ \
double out; \
asm volatile \
(" ps_nmsub %0, %1, %2, %3\n" \
: "=f"(out) \
: "f"(mul0), "f"(mul1), "f"(sub) \
); \
out; \
})
Negative multiply then subtract Paired Singles.
| mul0 | the first multiply pair. | |
| mul1 | the other multiply pair. | |
| sub | the subtraction pair. |
| #define paired_reciprocal | ( | pair | ) |
({ \
double out; \
asm volatile \
(" ps_res %0, %1\n" \
: "=f"(out) \
: "f"(pair) \
); \
out; \
})
Estimated reciprocal of a Paired Single.
| pair | the pair to get the estimated reciprocal of. |
| #define paired_select | ( | sel, | |||
| pos, | |||||
| neg | ) |
({ \
double out; \
asm volatile \
(" ps_sel %0, %1, %2, %3\n" \
: "=f"(out) \
: "f"(sel), "f"(pos), "f"(neg) \
); \
out; \
})
Select.
if(sel(ps0) >= 0) ret(ps0) = pos(ps0) else ret(ps0) = neg(ps0) if(sel(ps1) >= 0) ret(ps1) = pos(ps1) else ret(ps1) = neg(ps1)
| sel | the selector pair. | |
| pos | the pair to use for positives. | |
| neg | the pair to use for negatives. |
| #define paired_sqrt_reciprocal | ( | pair | ) |
({ \
double out; \
asm volatile \
(" ps_rsqrte %0, %1\n" \
: "=f"(out) \
: "f"(pair) \
); \
out; \
})
Estimated reciprocal of the square root of a Paired Single.
| pair | the pair to get the estimated reciprocal of the square root of. |
| #define paired_store | ( | gqr, | |||
| data, | |||||
| single, | |||||
| pair | ) |
asm volatile \ (" psq_st %1, %0, 0, %3\n" \ : "=m"(data) \ : "f"(pair), "i"(single), "i"(gqr) \ );
Stores a Paired Single.
| gqr | the GQR to use for quantization of the data. | |
| data | a pointer to which the data quantized from the paired single will be placed. Must a 2-element array. | |
| single | if this is non-zero, only one number will be quantized from PS0. | |
| pair | A double containing the paired singles. |
| #define paired_sub | ( | uend, | |||
| hend | ) |
({ \
double out; \
asm volatile \
(" ps_sub %0, %1, %2\n" \
: "=f"(out) \
: "f"(uend), "f"(hend) \
); \
out; \
})
Subtract Paired Singles.
| uend | the minuend. | |
| hend | the subtrahend. |
| #define paired_sum0 | ( | pair0, | |||
| pair1, | |||||
| pair2 | ) |
({ \
double out; \
asm volatile \
(" ps_sum0 %0, %1, %2, %3\n" \
: "=f"(out) \
: "f"(pair0), "f"(pair2), "f"(pair1) \
); \
out; \
})
Vector Sum high.
| pair0 | the first addition pair. (only PS0 used) | |
| pair1 | the second addition pair. (only PS1 used) | |
| pair2 | the copy pair. (only PS1 used) |
| #define paired_sum1 | ( | pair0, | |||
| pair1, | |||||
| pair2 | ) |
({ \
double out; \
asm volatile \
(" ps_sum1 %0, %1, %2, %3\n" \
: "=f"(out) \
: "f"(pair0), "f"(pair2), "f"(pair1) \
); \
out; \
})
Vector Sum low.
| pair0 | the first addition pair. (only PS0 used) | |
| pair1 | the second addition pair. (only PS1 used) | |
| pair2 | the copy pair. (only PS0 used) |
| enum gqr_type_t |
| void paired_get_gqr | ( | int | gqr, | |
| int | mode, | |||
| gqr_type_t * | type, | |||
| int * | scale | |||
| ) |
Gets information from a GQR.
| gqr | which GQR to obtain information from. | |
| mode | whether to get load or store information. 0 for store, 1 for load. | |
| type | a pointer to a variable to hold the conversion type. | |
| scale | a pointer to a variable to hold the conversion scale value. |
| void paired_set_gqr | ( | int | gqr, | |
| int | mode, | |||
| gqr_type_t | type, | |||
| int | scale | |||
| ) |
Sets up a GQR.
This function loads a Graphics Quantization Register with the specified parameters, to prepare for loading a Paired Single.
| gqr | which GQR to load. | |
| mode | whether to change the load or store information. 0 for store, 1 for load. | |
| type | the conversion type. (as described by the gqr_load_t enum) | |
| scale | the conversion scale value. This is only applied to integer types, and a signed integer that scales as in val = num / (2^scale). |
1.6.3