From c9b903138d8a3db151e90e8c3099ff005a4a5244 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 21 Jan 2013 15:40:48 +0000 Subject: [PATCH] R600/SI: Use unnormalized coordinates for sampling with the RECT target. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Patch by: Michel Dänzer Reviewed-by: Tom Stellard Reviewed-by: Christian König Signed-off-by: Michel Dänzer llvm-svn: 173053 --- llvm/lib/Target/R600/R600Instructions.td | 7 +++++++ llvm/lib/Target/R600/SIInstructions.td | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/llvm/lib/Target/R600/R600Instructions.td b/llvm/lib/Target/R600/R600Instructions.td index 64bab18..b15ea76 100644 --- a/llvm/lib/Target/R600/R600Instructions.td +++ b/llvm/lib/Target/R600/R600Instructions.td @@ -342,6 +342,13 @@ def TEX_SHADOW : PatLeaf< }] >; +def TEX_RECT : PatLeaf< + (imm), + [{uint32_t TType = (uint32_t)N->getZExtValue(); + return TType == 5; + }] +>; + class EG_CF_RAT cf_inst, bits <6> rat_inst, bits<4> rat_id, dag outs, dag ins, string asm, list pattern> : InstR600ISA { diff --git a/llvm/lib/Target/R600/SIInstructions.td b/llvm/lib/Target/R600/SIInstructions.td index 0f9d572..4164c55 100644 --- a/llvm/lib/Target/R600/SIInstructions.td +++ b/llvm/lib/Target/R600/SIInstructions.td @@ -1191,6 +1191,12 @@ def : Pat < SReg_256:$rsrc, SReg_128:$sampler) >; +def : Pat < + (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, SReg_128:$sampler, TEX_RECT), + (IMAGE_SAMPLE imm:$writemask, 1, 0, 0, 0, 0, 0, 0, VReg_128:$coord, + SReg_256:$rsrc, SReg_128:$sampler) +>; + /* int_SI_sample_lod */ def : Pat < (int_SI_sample_lod imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, SReg_128:$sampler, imm), -- 2.7.4