arb1: use MAD opcode for SRCMOD_SIGN instead of a SUB+MUL pair.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 18 Apr 2012 00:59:12 -0400
changeset 1098 ef8be3b15633
parent 1097 cc3b4d123312
child 1099 aef946714f39
arb1: use MAD opcode for SRCMOD_SIGN instead of a SUB+MUL pair.
mojoshader.c
--- a/mojoshader.c	Wed Apr 18 00:52:18 2012 -0400
+++ b/mojoshader.c	Wed Apr 18 00:59:12 2012 -0400
@@ -3807,10 +3807,9 @@
             premod_str = "-";
             // fall through.
         case SRCMOD_SIGN:
-            output_line(ctx, "SUB %s, %s, { 0.5, 0.5, 0.5, 0.5 };",
-                        regtype_str, buf);
-            output_line(ctx, "MUL %s, %s, { 2.0, 2.0, 2.0, 2.0 };",
-                        regtype_str, regtype_str);
+            output_line(ctx,
+                "MAD %s, %s, { 2.0, 2.0, 2.0, 2.0 }, { -1.0, -1.0, -1.0, -1.0 };",
+                regtype_str, buf);
             break;
 
         case SRCMOD_COMPLEMENT: