[llvm] r215746 - R600/SI: Refactor fneg / fabs patterns
Matt Arsenault
Matthew.Arsenault at amd.com
Fri Aug 15 11:42:11 PDT 2014
Author: arsenm
Date: Fri Aug 15 13:42:11 2014
New Revision: 215746
URL: http://llvm.org/viewvc/llvm-project?rev=215746&view=rev
Log:
R600/SI: Refactor fneg / fabs patterns
Modified:
llvm/trunk/lib/Target/R600/SIInstructions.td
Modified: llvm/trunk/lib/Target/R600/SIInstructions.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/SIInstructions.td?rev=215746&r1=215745&r2=215746&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/SIInstructions.td (original)
+++ llvm/trunk/lib/Target/R600/SIInstructions.td Fri Aug 15 13:42:11 2014
@@ -2334,33 +2334,28 @@ def : Pat <
(V_OR_B32_e32 $src, (V_MOV_B32_e32 0x80000000)) /* Set sign bit */
>;
-def FABS_SI : AMDGPUShaderInst <
- (outs VReg_32:$dst),
- (ins VSrc_32:$src0),
- "FABS_SI $dst, $src0",
- []
-> {
+class SIUnaryCustomInsertInst<string name, SDPatternOperator node,
+ ValueType vt,
+ RegisterClass dstrc,
+ RegisterClass srcrc> :
+ AMDGPUShaderInst<
+ (outs dstrc:$dst),
+ (ins srcrc:$src0),
+ name#" $dst, $src0",
+ [(set vt:$dst, (node vt:$src0))]> {
let usesCustomInserter = 1;
}
-def : Pat <
- (fabs f32:$src),
- (FABS_SI f32:$src)
->;
+def FABS_SI : SIUnaryCustomInsertInst<"FABS_SI", fabs,
+ f32, VReg_32, VSrc_32>;
+def FNEG_SI : SIUnaryCustomInsertInst<"FNEG_SI", fneg,
+ f32, VReg_32, VSrc_32>;
-def FNEG_SI : AMDGPUShaderInst <
- (outs VReg_32:$dst),
- (ins VSrc_32:$src0),
- "FNEG_SI $dst, $src0",
- []
-> {
- let usesCustomInserter = 1;
-}
+def FABS64_SI : SIUnaryCustomInsertInst<"FABS64_SI", fabs,
+ f64, VReg_64, VSrc_64>;
+def FNEG64_SI : SIUnaryCustomInsertInst<"FNEG64_SI", fneg,
+ f64, VReg_64, VSrc_64>;
-def : Pat <
- (fneg f32:$src),
- (FNEG_SI f32:$src)
->;
/********** ================== **********/
/********** Immediate Patterns **********/
More information about the llvm-commits
mailing list