[PATCH] D26711: [AMDGPU] Refactor v_mac_{f16, f32} into a class NFC
Konstantin Zhuravlyov via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 15 15:43:24 PST 2016
kzhuravl created this revision.
kzhuravl added reviewers: tstellarAMD, arsenm.
kzhuravl added a subscriber: llvm-commits.
Herald added subscribers: tony-tye, yaxunl, nhaehnle, wdng.
https://reviews.llvm.org/D26711
Files:
lib/Target/AMDGPU/SIInstructions.td
Index: lib/Target/AMDGPU/SIInstructions.td
===================================================================
--- lib/Target/AMDGPU/SIInstructions.td
+++ lib/Target/AMDGPU/SIInstructions.td
@@ -478,23 +478,18 @@
(V_CNDMASK_B32_e64 $src2, $src1, $src0)
>;
-// 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)
->;
+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>;
/********** ============================================ **********/
/********** Extraction, Insertion, Building and Casting **********/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26711.78090.patch
Type: text/x-patch
Size: 1611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161115/803b8104/attachment.bin>
More information about the llvm-commits
mailing list