[PATCH] fdo30337{a,b}: New tests for radeon presubtract.

Tom Stellard tstellar at gmail.com
Sat Sep 25 22:02:10 PDT 2010


---
 tests/all.tests                      |    2 ++
 tests/shaders/generic/fdo30337a.vpfp |   17 +++++++++++++++++
 tests/shaders/generic/fdo30337b.vpfp |   25 +++++++++++++++++++++++++
 3 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100644 tests/shaders/generic/fdo30337a.vpfp
 create mode 100644 tests/shaders/generic/fdo30337b.vpfp

diff --git a/tests/all.tests b/tests/all.tests
index a380085..5745553 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -575,6 +575,8 @@ def add_vpfpgeneric(name):
 add_vpfpgeneric('arl')
 add_vpfpgeneric('big-param')
 add_vpfpgeneric('dataflow-bug')
+add_vpfpgeneric('fdo30337a')
+add_vpfpgeneric('fdo30337b')
 add_vpfpgeneric('fogcoord-dp3')
 add_vpfpgeneric('fogcoord-dph')
 add_vpfpgeneric('fogcoord-dp4')
diff --git a/tests/shaders/generic/fdo30337a.vpfp b/tests/shaders/generic/fdo30337a.vpfp
new file mode 100644
index 0000000..48b97d7
--- /dev/null
+++ b/tests/shaders/generic/fdo30337a.vpfp
@@ -0,0 +1,17 @@
+!!ARBvp1.0
+OPTION ARB_position_invariant;
+END
+
+!!ARBfp1.0
+#This tests instructions like: ADD Temp[0], Temp[0], Temp[1] where one of
+#the source registers is the same as the destination register.  These
+#should not be replaced with presubtract operations.
+TEMP color;
+MOV color, {0.1, 0.4, 0.8, 1.0};
+ADD color.x, color.x, color.x;
+ADD color.y, color.x, color.y;
+MOV result.color, color;
+END
+
+!!test
+expected          0.2     0.6      0.8      1.0
diff --git a/tests/shaders/generic/fdo30337b.vpfp b/tests/shaders/generic/fdo30337b.vpfp
new file mode 100644
index 0000000..e6809fc
--- /dev/null
+++ b/tests/shaders/generic/fdo30337b.vpfp
@@ -0,0 +1,25 @@
+!!ARBvp1.0
+OPTION ARB_position_invariant;
+END
+
+!!ARBfp1.0
+#This test is for instructions that read from more components than the
+#presubtract operation writes.  For example:
+#ADD Temp[0].x Temp[1].x, Temp[2].x
+#MUL Temp[4]x. Temp[0].x, Temp[5].x
+#DP3 Temp[6].x Temp[0].xyz, Temp[0].xyz
+#The ADD instruction can be converted to a presubtract operation and be
+#used by the MUL instruction, but it cannot be used by the DP3 instruction
+#since that instruction reads from more than just the x component of Temp[0].
+#Therefore the ADD instruction should not be removed.
+TEMP color;
+MOV color, {0.1, 0.4, 0.8, 1.0};
+SUB color.x, color.x, color.x;
+ADD color.y, color.x, color.y;
+SUB color.z, color.x, color.x;
+DP3 color.w, color, color;
+MOV result.color, color;
+END
+
+!!test
+expected          0.0     0.4      0.0      0.16
-- 
1.7.2.2


--KsGdsel6WgEHnImy--


More information about the Piglit mailing list