gallium: added spe_splat_word()
authorBrian Paul <brian.paul@tungstengraphics.com>
Sat, 13 Sep 2008 03:08:01 +0000 (21:08 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Sat, 13 Sep 2008 03:08:01 +0000 (21:08 -0600)
src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c
src/gallium/auxiliary/rtasm/rtasm_ppc_spe.h

index 62e3adb..89f8e24 100644 (file)
@@ -540,4 +540,29 @@ spe_zero(struct spe_function *p, unsigned rT)
 }
 
 
+void
+spe_splat_word(struct spe_function *p, unsigned rT, unsigned rA, int word)
+{
+   assert(word >= 0);
+   assert(word <= 3);
+
+   if (word == 0) {
+      int tmp1 = rT;
+      spe_ila(p, tmp1, 66051);
+      spe_shufb(p, rT, rA, rA, tmp1);
+   }
+   else {
+      /* XXX review this, we may not need the rotqbyi instruction */
+      int tmp1 = rT;
+      int tmp2 = spe_allocate_available_register(p);
+
+      spe_ila(p, tmp1, 66051);
+      spe_rotqbyi(p, tmp2, rA, 4 * word);
+      spe_shufb(p, rT, tmp2, tmp2, tmp1);
+
+      spe_release_register(p, tmp2);
+   }
+}
+
+
 #endif /* GALLIUM_CELL */
index d95e5aa..7a3ab9a 100644 (file)
@@ -308,6 +308,10 @@ spe_move(struct spe_function *p, unsigned rT, unsigned rA);
 extern void
 spe_zero(struct spe_function *p, unsigned rT);
 
+/** rT = splat(rA, word) */
+extern void
+spe_splat_word(struct spe_function *p, unsigned rT, unsigned rA, int word);
+
 
 /* Floating-point instructions
  */