mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
gallium: add special cases in spe_load_float(), spe_load_int(), added spe_splat()
This commit is contained in:
parent
be925ab6e8
commit
178bbaff80
2 changed files with 40 additions and 9 deletions
|
|
@ -473,21 +473,48 @@ EMIT_R (spe_mtspr, 0x10c);
|
|||
void
|
||||
spe_load_float(struct spe_function *p, unsigned rT, float x)
|
||||
{
|
||||
union {
|
||||
float f;
|
||||
unsigned u;
|
||||
} bits;
|
||||
bits.f = x;
|
||||
spe_ilhu(p, rT, bits.u >> 16);
|
||||
spe_iohl(p, rT, bits.u & 0xffff);
|
||||
if (x == 0.0f) {
|
||||
spe_il(p, rT, 0x0);
|
||||
}
|
||||
else if (x == 0.5f) {
|
||||
spe_ilhu(p, rT, 0x3f00);
|
||||
}
|
||||
else if (x == 1.0f) {
|
||||
spe_ilhu(p, rT, 0x3f80);
|
||||
}
|
||||
else if (x == -1.0f) {
|
||||
spe_ilhu(p, rT, 0xbf80);
|
||||
}
|
||||
else {
|
||||
union {
|
||||
float f;
|
||||
unsigned u;
|
||||
} bits;
|
||||
bits.f = x;
|
||||
spe_ilhu(p, rT, bits.u >> 16);
|
||||
spe_iohl(p, rT, bits.u & 0xffff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
spe_load_int(struct spe_function *p, unsigned rT, int i)
|
||||
{
|
||||
spe_ilhu(p, rT, i >> 16);
|
||||
spe_iohl(p, rT, i & 0xffff);
|
||||
if (-32768 <= i && i <= 32767) {
|
||||
spe_il(p, rT, i);
|
||||
}
|
||||
else {
|
||||
spe_ilhu(p, rT, i >> 16);
|
||||
spe_iohl(p, rT, i & 0xffff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
spe_splat(struct spe_function *p, unsigned rT, unsigned rA)
|
||||
{
|
||||
spe_ila(p, rT, 66051);
|
||||
spe_shufb(p, rT, rA, rA, rT);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -292,6 +292,10 @@ spe_load_float(struct spe_function *p, unsigned rT, float x);
|
|||
extern void
|
||||
spe_load_int(struct spe_function *p, unsigned rT, int i);
|
||||
|
||||
/** Replicate word 0 of rA across rT. */
|
||||
extern void
|
||||
spe_splat(struct spe_function *p, unsigned rT, unsigned rA);
|
||||
|
||||
/** Complement/invert all bits in rT. */
|
||||
extern void
|
||||
spe_complement(struct spe_function *p, unsigned rT);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue