diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2014-05-22 18:00:20 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2014-05-22 18:00:20 +0000 |
commit | f15a05623e5263f9232f8796587ee1cedcf7b15c (patch) | |
tree | b04403b1a2a59235266c5e4f25d0b6d4f2ed6f10 /llvm/lib/Target | |
parent | eb260206c3c7c47b5cb70c36bbea58c7d5cf03b7 (diff) | |
download | bcm5719-llvm-f15a05623e5263f9232f8796587ee1cedcf7b15c.tar.gz bcm5719-llvm-f15a05623e5263f9232f8796587ee1cedcf7b15c.zip |
R600: Expand mad24 for GPUs without it
llvm-svn: 209457
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/R600/AMDGPUInstructions.td | 10 | ||||
-rw-r--r-- | llvm/lib/Target/R600/CaymanInstructions.td | 1 | ||||
-rw-r--r-- | llvm/lib/Target/R600/EvergreenInstructions.td | 8 | ||||
-rw-r--r-- | llvm/lib/Target/R600/R600Instructions.td | 6 |
4 files changed, 24 insertions, 1 deletions
diff --git a/llvm/lib/Target/R600/AMDGPUInstructions.td b/llvm/lib/Target/R600/AMDGPUInstructions.td index 127b74a0edb..8a9ab54657f 100644 --- a/llvm/lib/Target/R600/AMDGPUInstructions.td +++ b/llvm/lib/Target/R600/AMDGPUInstructions.td @@ -433,6 +433,16 @@ class UMad24Pat<Instruction Inst> : Pat < (Inst $src0, $src1, $src2) >; +class IMad24ExpandPat<Instruction MulInst, Instruction AddInst> : Pat < + (AMDGPUmad_i24 i32:$src0, i32:$src1, i32:$src2), + (AddInst (MulInst $src0, $src1), $src2) +>; + +class UMad24ExpandPat<Instruction MulInst, Instruction AddInst> : Pat < + (AMDGPUmad_u24 i32:$src0, i32:$src1, i32:$src2), + (AddInst (MulInst $src0, $src1), $src2) +>; + include "R600Instructions.td" include "R700Instructions.td" diff --git a/llvm/lib/Target/R600/CaymanInstructions.td b/llvm/lib/Target/R600/CaymanInstructions.td index 6dded24c6fe..58424a61722 100644 --- a/llvm/lib/Target/R600/CaymanInstructions.td +++ b/llvm/lib/Target/R600/CaymanInstructions.td @@ -49,6 +49,7 @@ def COS_cm : COS_Common<0x8E>; def : POW_Common <LOG_IEEE_cm, EXP_IEEE_cm, MUL>; defm DIV_cm : DIV_Common<RECIP_IEEE_cm>; +def : UMad24ExpandPat<MULLO_UINT_cm, ADD_INT>; // RECIP_UINT emulation for Cayman // The multiplication scales from [0,1] to the unsigned integer range diff --git a/llvm/lib/Target/R600/EvergreenInstructions.td b/llvm/lib/Target/R600/EvergreenInstructions.td index d9931c81d62..77416671a90 100644 --- a/llvm/lib/Target/R600/EvergreenInstructions.td +++ b/llvm/lib/Target/R600/EvergreenInstructions.td @@ -75,6 +75,9 @@ def COS_eg : COS_Common<0x8E>; def : POW_Common <LOG_IEEE_eg, EXP_IEEE_eg, MUL>; def : Pat<(fsqrt f32:$src), (MUL $src, (RECIPSQRT_CLAMPED_eg $src))>; +def : IMad24ExpandPat<MULLO_INT_eg, ADD_INT>; +def : UMad24ExpandPat<MULLO_UINT_eg, ADD_INT>; + //===----------------------------------------------------------------------===// // Memory read/write instructions //===----------------------------------------------------------------------===// @@ -301,8 +304,11 @@ def BFM_INT_eg : R600_2OP <0xA0, "BFM_INT", >; def MULADD_UINT24_eg : R600_3OP <0x10, "MULADD_UINT24", - [(set i32:$dst, (add (AMDGPUmul_u24 i32:$src0, i32:$src1), i32:$src2))], VecALU + [(set i32:$dst, (AMDGPUmad_u24 i32:$src0, i32:$src1, i32:$src2))], VecALU >; + +def : UMad24Pat<MULADD_UINT24_eg>; + def BIT_ALIGN_INT_eg : R600_3OP <0xC, "BIT_ALIGN_INT", [], VecALU>; def : ROTRPattern <BIT_ALIGN_INT_eg>; def MULADD_eg : MULADD_Common<0x14>; diff --git a/llvm/lib/Target/R600/R600Instructions.td b/llvm/lib/Target/R600/R600Instructions.td index d2075c0577b..0c804ffe5d4 100644 --- a/llvm/lib/Target/R600/R600Instructions.td +++ b/llvm/lib/Target/R600/R600Instructions.td @@ -1625,6 +1625,12 @@ def : DwordAddrPat <i32, R600_Reg32>; } // End isR600toCayman Predicate +let Predicates = [isR600] in { +// Intrinsic patterns +def : IMad24ExpandPat<MULLO_INT_r600, ADD_INT>; +def : UMad24ExpandPat<MULLO_UINT_r600, ADD_INT>; +} // End isR600 + def getLDSNoRetOp : InstrMapping { let FilterClass = "R600_LDS_1A1D"; let RowFields = ["BaseOp"]; |