summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw
diff options
context:
space:
mode:
authorMichal Krol <michal@ubuntu-vbox.(none)>2008-06-02 21:51:31 +0200
committerMichal Krol <michal@ubuntu-vbox.(none)>2008-06-02 21:51:31 +0200
commit58cccc8d6b49c75eeabe9b61055e69de824ff757 (patch)
treee5803b9dcf7d07b9a003a68b16583302333ccb0c /src/gallium/auxiliary/draw
parent969a207fe356d152b65085a9113502c7fbb5712e (diff)
draw: Fix DP3 implementation by replacing SSE with x87 version.
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_aos.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c
index 725f36b5025..5bfcd96ac3d 100644
--- a/src/gallium/auxiliary/draw/draw_vs_aos.c
+++ b/src/gallium/auxiliary/draw/draw_vs_aos.c
@@ -962,8 +962,35 @@ static boolean emit_COS( struct aos_compilation *cp, const struct tgsi_full_inst
return TRUE;
}
+#if 1
+
+/* The x87 version.
+ */
+static boolean emit_DP3( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
+{
+ struct x86_reg st1 = x86_make_reg( file_x87, 1 );
+
+ x87_fld_src( cp, &op->FullSrcRegisters[0], 0 );
+ x87_fld_src( cp, &op->FullSrcRegisters[1], 0 );
+ x87_fmulp( cp->func, st1 );
+ x87_fld_src( cp, &op->FullSrcRegisters[0], 1 );
+ x87_fld_src( cp, &op->FullSrcRegisters[1], 1 );
+ x87_fmulp( cp->func, st1 );
+ x87_faddp( cp->func, st1 );
+ x87_fld_src( cp, &op->FullSrcRegisters[0], 2 );
+ x87_fld_src( cp, &op->FullSrcRegisters[1], 2 );
+ x87_fmulp( cp->func, st1 );
+ x87_faddp( cp->func, st1 );
+
+ x87_fstp_dest4( cp, &op->FullDstRegisters[0] );
+
+ return TRUE;
+}
+
+#else
/* The dotproduct instructions don't really do that well in sse:
+ * XXX: produces wrong results -- disabled.
*/
static boolean emit_DP3( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{
@@ -985,7 +1012,7 @@ static boolean emit_DP3( struct aos_compilation *cp, const struct tgsi_full_inst
return TRUE;
}
-
+#endif
static boolean emit_DP4( struct aos_compilation *cp, const struct tgsi_full_instruction *op )
{