summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-09-12 10:31:23 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2008-09-12 10:31:23 +0100
commit176c454765b88c71d8b1ef474bc0fd53cb253a08 (patch)
tree76a2aee9ab3ae7f94661faf305d1b7b7b82b5cb3 /src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c
parent1f135456795adfb1d739a6fb66ab9540aa79b461 (diff)
parentaa66f08a21b791f338b519f0c2162cd8f7b3aeb0 (diff)
Merge commit 'origin/gallium-0.1' into gallium-0.2
Conflicts: progs/fp/Makefile
Diffstat (limited to 'src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c')
-rw-r--r--src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c45
1 files changed, 36 insertions, 9 deletions
diff --git a/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c b/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c
index 61010e4333..a04cc6c4ff 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c
+++ b/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c
@@ -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);
}