[llvm] r287077 - [AMDGPU] Refactor v_mac_{f16, f32} patterns into a class NFC
Konstantin Zhuravlyov via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 15 19:39:13 PST 2016
Author: kzhuravl
Date: Tue Nov 15 21:39:12 2016
New Revision: 287077
URL: http://llvm.org/viewvc/llvm-project?rev=287077&view=rev
Log:
[AMDGPU] Refactor v_mac_{f16, f32} patterns into a class NFC
Differential Revision: https://reviews.llvm.org/D26711
Modified:
llvm/trunk/lib/Target/AMDGPU/SIInstructions.td
Modified: llvm/trunk/lib/Target/AMDGPU/SIInstructions.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIInstructions.td?rev=287077&r1=287076&r2=287077&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIInstructions.td (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIInstructions.td Tue Nov 15 21:39:12 2016
@@ -468,41 +468,36 @@ def : Pat <
// VOP2 Patterns
//===----------------------------------------------------------------------===//
-multiclass SelectPat<ValueType vt, Instruction inst> {
+multiclass FMADPat <ValueType vt, Instruction inst> {
+ def : Pat <
+ (vt (fmad (VOP3NoMods0 vt:$src0, i32:$src0_modifiers, i1:$clamp, i32:$omod),
+ (VOP3NoMods vt:$src1, i32:$src1_modifiers),
+ (VOP3NoMods vt:$src2, i32:$src2_modifiers))),
+ (inst $src0_modifiers, $src0, $src1_modifiers, $src1,
+ $src2_modifiers, $src2, $clamp, $omod)
+ >;
+}
+
+defm : FMADPat <f16, V_MAC_F16_e64>;
+defm : FMADPat <f32, V_MAC_F32_e64>;
+
+multiclass SelectPat <ValueType vt, Instruction inst> {
def : Pat <
(vt (select i1:$src0, vt:$src1, vt:$src2)),
(inst $src2, $src1, $src0)
>;
}
-defm : SelectPat<i16, V_CNDMASK_B32_e64>;
-defm : SelectPat<i32, V_CNDMASK_B32_e64>;
-defm : SelectPat<f16, V_CNDMASK_B32_e64>;
-defm : SelectPat<f32, V_CNDMASK_B32_e64>;
+defm : SelectPat <i16, V_CNDMASK_B32_e64>;
+defm : SelectPat <i32, V_CNDMASK_B32_e64>;
+defm : SelectPat <f16, V_CNDMASK_B32_e64>;
+defm : SelectPat <f32, V_CNDMASK_B32_e64>;
def : Pat <
(i32 (add (i32 (ctpop i32:$popcnt)), i32:$val)),
(V_BCNT_U32_B32_e64 $popcnt, $val)
>;
-// Pattern for V_MAC_F16
-def : Pat <
- (f16 (fmad (VOP3NoMods0 f16:$src0, i32:$src0_modifiers, i1:$clamp, i32:$omod),
- (VOP3NoMods f16:$src1, i32:$src1_modifiers),
- (VOP3NoMods f16:$src2, i32:$src2_modifiers))),
- (V_MAC_F16_e64 $src0_modifiers, $src0, $src1_modifiers, $src1,
- $src2_modifiers, $src2, $clamp, $omod)
->;
-
-// Pattern for V_MAC_F32
-def : Pat <
- (f32 (fmad (VOP3NoMods0 f32:$src0, i32:$src0_modifiers, i1:$clamp, i32:$omod),
- (VOP3NoMods f32:$src1, i32:$src1_modifiers),
- (VOP3NoMods f32:$src2, i32:$src2_modifiers))),
- (V_MAC_F32_e64 $src0_modifiers, $src0, $src1_modifiers, $src1,
- $src2_modifiers, $src2, $clamp, $omod)
->;
-
/********** ============================================ **********/
/********** Extraction, Insertion, Building and Casting **********/
/********** ============================================ **********/
More information about the llvm-commits
mailing list