Skip to content

Commit

Permalink
R600/SI: Handle MSAA texture targets
Browse files Browse the repository at this point in the history
Patch by: Marek Olšák

Signed-off-by: Marek Olšák <[email protected]>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188421 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
tstellarAMD committed Aug 14, 2013
1 parent a7b7ab3 commit 67ca7b1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
16 changes: 15 additions & 1 deletion lib/Target/R600/R600Instructions.td
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def TEX_RECT : PatLeaf<
def TEX_ARRAY : PatLeaf<
(imm),
[{uint32_t TType = (uint32_t)N->getZExtValue();
return TType == 9 || TType == 10 || TType == 15 || TType == 16;
return TType == 9 || TType == 10 || TType == 16;
}]
>;

Expand All @@ -241,6 +241,20 @@ def TEX_SHADOW_ARRAY : PatLeaf<
}]
>;

def TEX_MSAA : PatLeaf<
(imm),
[{uint32_t TType = (uint32_t)N->getZExtValue();
return TType == 14;
}]
>;

def TEX_ARRAY_MSAA : PatLeaf<
(imm),
[{uint32_t TType = (uint32_t)N->getZExtValue();
return TType == 15;
}]
>;

class EG_CF_RAT <bits <8> cfinst, bits <6> ratinst, bits<4> mask, dag outs,
dag ins, string asm, list<dag> pattern> :
InstR600ISA <outs, ins, asm, pattern>,
Expand Down
19 changes: 18 additions & 1 deletion lib/Target/R600/SIInstructions.td
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ defm S_BUFFER_LOAD_DWORDX16 : SMRD_Helper <

//def S_MEMTIME : SMRD_ <0x0000001e, "S_MEMTIME", []>;
//def S_DCACHE_INV : SMRD_ <0x0000001f, "S_DCACHE_INV", []>;
//def IMAGE_LOAD : MIMG_NoPattern_ <"IMAGE_LOAD", 0x00000000>;
def IMAGE_LOAD : MIMG_NoSampler_Helper <0x00000000, "IMAGE_LOAD">;
def IMAGE_LOAD_MIP : MIMG_NoSampler_Helper <0x00000001, "IMAGE_LOAD_MIP">;
//def IMAGE_LOAD_PCK : MIMG_NoPattern_ <"IMAGE_LOAD_PCK", 0x00000002>;
//def IMAGE_LOAD_PCK_SGN : MIMG_NoPattern_ <"IMAGE_LOAD_PCK_SGN", 0x00000003>;
Expand Down Expand Up @@ -1397,9 +1397,21 @@ class ImageLoadArrayPattern<Intrinsic name, MIMG opcode, ValueType addr_type> :
(opcode 0xf, 0, 0, 1, 0, 0, 0, 0, $addr, $rsrc)
>;

class ImageLoadMSAAPattern<Intrinsic name, MIMG opcode, ValueType addr_type> : Pat <
(name addr_type:$addr, v32i8:$rsrc, TEX_MSAA),
(opcode 0xf, 0, 0, 0, 0, 0, 0, 0, $addr, $rsrc)
>;

class ImageLoadArrayMSAAPattern<Intrinsic name, MIMG opcode, ValueType addr_type> : Pat <
(name addr_type:$addr, v32i8:$rsrc, TEX_ARRAY_MSAA),
(opcode 0xf, 0, 0, 1, 0, 0, 0, 0, $addr, $rsrc)
>;

multiclass ImageLoadPatterns<ValueType addr_type> {
def : ImageLoadPattern <int_SI_imageload, IMAGE_LOAD_MIP, addr_type>;
def : ImageLoadArrayPattern <int_SI_imageload, IMAGE_LOAD_MIP, addr_type>;
def : ImageLoadMSAAPattern <int_SI_imageload, IMAGE_LOAD, addr_type>;
def : ImageLoadArrayMSAAPattern <int_SI_imageload, IMAGE_LOAD, addr_type>;
}

defm : ImageLoadPatterns<v2i32>;
Expand All @@ -1416,6 +1428,11 @@ def : Pat <
(IMAGE_GET_RESINFO 0xf, 0, 0, 1, 0, 0, 0, 0, (V_MOV_B32_e32 $mipid), $rsrc)
>;

def : Pat <
(int_SI_resinfo i32:$mipid, v32i8:$rsrc, TEX_ARRAY_MSAA),
(IMAGE_GET_RESINFO 0xf, 0, 0, 1, 0, 0, 0, 0, (V_MOV_B32_e32 $mipid), $rsrc)
>;

/********** ============================================ **********/
/********** Extraction, Insertion, Building and Casting **********/
/********** ============================================ **********/
Expand Down
2 changes: 1 addition & 1 deletion test/CodeGen/R600/llvm.SI.imageload.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;RUN: llc < %s -march=r600 -mcpu=verde | FileCheck %s

;CHECK-DAG: IMAGE_LOAD_MIP {{VGPR[0-9]+_VGPR[0-9]+_VGPR[0-9]+_VGPR[0-9]+}}, 15, 0, 0, -1
;CHECK-DAG: IMAGE_LOAD {{VGPR[0-9]+_VGPR[0-9]+_VGPR[0-9]+_VGPR[0-9]+}}, 15, 0, 0, -1
;CHECK-DAG: IMAGE_LOAD_MIP {{VGPR[0-9]+_VGPR[0-9]+}}, 3, 0, 0, 0
;CHECK-DAG: IMAGE_LOAD_MIP {{VGPR[0-9]+}}, 2, 0, 0, 0
;CHECK-DAG: IMAGE_LOAD_MIP {{VGPR[0-9]+}}, 1, 0, 0, 0
Expand Down

0 comments on commit 67ca7b1

Please sign in to comment.