From: Christian König <christian.koe...@amd.com> Signed-off-by: Christian König <christian.koe...@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 833e6cd..7c157e9 100644 --- a/lib/Target/R600/SIInstructions.td +++ b/lib/Target/R600/SIInstructions.td @@ -1232,6 +1232,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 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev