[Mesa-dev] [PATCH 7/8] R600/SI: add OMOD patterns

Christian König deathsimple at vodafone.de
Tue Feb 19 05:54:29 PST 2013


From: Christian König <christian.koenig at amd.com>

Signed-off-by: Christian König <christian.koenig at amd.com>
---
 lib/Target/R600/AMDGPUInstructions.td |   15 +++++++++++++++
 lib/Target/R600/SIInstructions.td     |   18 ++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/lib/Target/R600/AMDGPUInstructions.td b/lib/Target/R600/AMDGPUInstructions.td
index 960f108..da3d7b7 100644
--- a/lib/Target/R600/AMDGPUInstructions.td
+++ b/lib/Target/R600/AMDGPUInstructions.td
@@ -102,11 +102,26 @@ def FP_ZERO : PatLeaf <
   [{return N->getValueAPF().isZero();}]
 >;
 
+def FP_0_5 : PatLeaf <
+  (fpimm),
+  [{return N->isExactlyValue(0.5);}]
+>;
+
 def FP_ONE : PatLeaf <
   (fpimm),
   [{return N->isExactlyValue(1.0);}]
 >;
 
+def FP_TWO : PatLeaf <
+  (fpimm),
+  [{return N->isExactlyValue(2.0);}]
+>;
+
+def FP_FOUR : PatLeaf <
+  (fpimm),
+  [{return N->isExactlyValue(4.0);}]
+>;
+
 let isCodeGenOnly = 1, isPseudo = 1 in {
 
 let usesCustomInserter = 1  in {
diff --git a/lib/Target/R600/SIInstructions.td b/lib/Target/R600/SIInstructions.td
index 71de032..3b7cc6f 100644
--- a/lib/Target/R600/SIInstructions.td
+++ b/lib/Target/R600/SIInstructions.td
@@ -1229,6 +1229,24 @@ def : Pat <
    0 /* ABS */, 0 /* CLAMP */, 0 /* OMOD */, 1 /* NEG */)
 >;
 
+def : Pat <
+  (fmul VReg_32:$src, (f32 FP_0_5)),
+  (V_ADD_F32_e64 VReg_32:$src, (i32 0x80 /* SRC1 */),
+   0 /* ABS */, 0 /* CLAMP */, 3 /* OMOD */, 0 /* NEG */)
+>;
+
+def : Pat <
+  (fmul VReg_32:$src, (f32 FP_TWO)),
+  (V_ADD_F32_e64 VReg_32:$src, (i32 0x80 /* SRC1 */),
+   0 /* ABS */, 0 /* CLAMP */, 1 /* OMOD */, 0 /* NEG */)
+>;
+
+def : Pat <
+  (fmul VReg_32:$src, (f32 FP_FOUR)),
+  (V_ADD_F32_e64 VReg_32:$src, (i32 0x80 /* SRC1 */),
+   0 /* ABS */, 0 /* CLAMP */, 2 /* OMOD */, 0 /* NEG */)
+>;
+
 /********** ================== **********/
 /********** Immediate Patterns **********/
 /********** ================== **********/
-- 
1.7.10.4



More information about the mesa-dev mailing list