From 163d8ce61f1c2bede7b67f06a3bdc51380e714cd Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 21 Jul 2014 17:44:29 +0000 Subject: [PATCH] R600/SI: Refactor VOP3 instruction definitions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213571 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrFormats.td | 2 + lib/Target/R600/SIInstrInfo.td | 71 ++++++++++++++++++++++--------- 2 files changed, 52 insertions(+), 21 deletions(-) diff --git a/lib/Target/R600/SIInstrFormats.td b/lib/Target/R600/SIInstrFormats.td index e85564ee1e7..00e69ddbeea 100644 --- a/lib/Target/R600/SIInstrFormats.td +++ b/lib/Target/R600/SIInstrFormats.td @@ -57,6 +57,8 @@ class VOP3Common pattern> : let hasSideEffects = 0; let UseNamedOperandTable = 1; let VOP3 = 1; + + int Size = 8; } //===----------------------------------------------------------------------===// diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index f3517035f35..b0ac20f558d 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -284,16 +284,54 @@ class SIMCInstr { int Subtarget = subtarget; } +class VOP3_Pseudo pattern, string opName> : + VOP3Common , + VOP , + SIMCInstr { + let isPseudo = 1; +} + +class VOP3_Real_si op, dag outs, dag ins, string asm, string opName> : + VOP3 , + SIMCInstr; + multiclass VOP3_m op, dag outs, dag ins, string asm, list pattern, string opName> { - def "" : VOP3Common , VOP , - SIMCInstr { - let isPseudo = 1; - } + def "" : VOP3_Pseudo ; + + def _si : VOP3_Real_si ; + +} + +multiclass VOP3_1_m op, dag outs, dag ins, string asm, + list pattern, string opName> { + + def "" : VOP3_Pseudo ; + + let src1 = 0, src1_modifiers = 0, src2 = 0, src2_modifiers = 0 in { + + def _si : VOP3_Real_si < + {1, 1, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, + outs, ins, asm, opName + >; + + } // src1 = 0, src1_modifiers = 0, src2 = 0, src2_modifiers = 0 +} + +multiclass VOP3_2_m op, dag outs, dag ins, string asm, + list pattern, string opName, string revOp> { - def _si : VOP3 , SIMCInstr; + def "" : VOP3_Pseudo ; + let src2 = 0, src2_modifiers = 0 in { + + def _si : VOP3_Real_si < + {1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, + outs, ins, asm, opName>, + VOP2_REV; + + } // src2 = 0, src2_modifiers = 0 } // This must always be right before the operand being input modified. @@ -309,17 +347,11 @@ multiclass VOP1_Helper op, RegisterClass drc, RegisterClass src, opName#"_e32 $dst, $src0", pattern >, VOP ; - def _e64 : VOP3 < - {1, 1, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, + defm _e64 : VOP3_1_m < + op, (outs drc:$dst), (ins InputMods:$src0_modifiers, src:$src0, i32imm:$clamp, i32imm:$omod), - opName#"_e64 $dst, $src0_modifiers, $clamp, $omod", [] - >, VOP { - let src1 = 0; - let src1_modifiers = 0; - let src2 = 0; - let src2_modifiers = 0; - } + opName#"_e64 $dst, $src0_modifiers, $clamp, $omod", [], opName>; } multiclass VOP1_32 op, string opName, list pattern> @@ -341,17 +373,14 @@ multiclass VOP2_Helper op, RegisterClass vrc, RegisterClass arc, opName#"_e32 $dst, $src0, $src1", pattern >, VOP , VOP2_REV; - def _e64 : VOP3 < - {1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, + defm _e64 : VOP3_2_m < + op, (outs vrc:$dst), (ins InputMods:$src0_modifiers, arc:$src0, InputMods:$src1_modifiers, arc:$src1, i32imm:$clamp, i32imm:$omod), - opName#"_e64 $dst, $src0_modifiers, $src1_modifiers, $clamp, $omod", [] - >, VOP , VOP2_REV { - let src2 = 0; - let src2_modifiers = 0; - } + opName#"_e64 $dst, $src0_modifiers, $src1_modifiers, $clamp, $omod", [], + opName, revOp>; } multiclass VOP2_32 op, string opName, list pattern, -- 2.34.1