From 8af5ed9e15cfb48817c0f1f46b66b8fe54412036 Mon Sep 17 00:00:00 2001 From: Bruno Cardoso Lopes Date: Fri, 18 Jun 2010 23:13:35 +0000 Subject: [PATCH] Apply some refactor to packed instructions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106349 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86InstrFormats.td | 12 ++++ lib/Target/X86/X86InstrSSE.td | 92 ++++++++++--------------------- 2 files changed, 42 insertions(+), 62 deletions(-) diff --git a/lib/Target/X86/X86InstrFormats.td b/lib/Target/X86/X86InstrFormats.td index b0f7b40b19e..a52db350500 100644 --- a/lib/Target/X86/X86InstrFormats.td +++ b/lib/Target/X86/X86InstrFormats.td @@ -225,6 +225,18 @@ class SI o, Format F, dag outs, dag ins, string asm, list pattern> let AsmString = !if(hasVEX_4VPrefix, !strconcat("v", asm), asm); } +// PI - SSE 1 & 2 packed instructions +class PI o, Format F, dag outs, dag ins, string asm, list pattern, + Domain d> + : I { + let Predicates = !if(hasVEX_4VPrefix /* VEX_4V */, + !if(hasOpSizePrefix /* OpSize */, [HasAVX, HasSSE2], [HasAVX, HasSSE1]), + !if(hasOpSizePrefix /* OpSize */, [HasSSE2], [HasSSE1])); + + // AVX instructions have a 'v' prefix in the mnemonic + let AsmString = !if(hasVEX_4VPrefix, !strconcat("v", asm), asm); +} + // SSE1 Instruction Templates: // // SSI - SSE1 instructions with XS prefix. diff --git a/lib/Target/X86/X86InstrSSE.td b/lib/Target/X86/X86InstrSSE.td index e5e9d59e344..0c7e7fc5315 100644 --- a/lib/Target/X86/X86InstrSSE.td +++ b/lib/Target/X86/X86InstrSSE.td @@ -657,6 +657,19 @@ multiclass sse12_fp_scalar opc, string OpcodeStr, SDNode OpNode, OpcodeStr, [(set RC:$dst, (OpNode RC:$src1, (load addr:$src2)))]>; } +/// sse12_fp_packed - SSE 1 & 2 packed instructions class +multiclass sse12_fp_packed opc, string OpcodeStr, SDNode OpNode, + RegisterClass RC, ValueType vt, + X86MemOperand x86memop, PatFrag mem_frag, + Domain d> { + let isCommutable = 1 in + def rr : PI; + def rm : PI; +} + /// basic_sse12_fp_binop_rm - SSE 1 & 2 binops come in both scalar and /// vector forms. /// @@ -673,7 +686,6 @@ multiclass basic_sse12_fp_binop_rm opc, string OpcodeStr, SDNode OpNode, bit Commutable = 0> { let Constraints = "", isAsmParserOnly = 1 in { - // Scalar operation, reg+reg. defm V#NAME#SS : sse12_fp_scalar, XS, VEX_4V; @@ -681,78 +693,34 @@ multiclass basic_sse12_fp_binop_rm opc, string OpcodeStr, defm V#NAME#SD : sse12_fp_scalar, XD, VEX_4V; + + defm V#NAME#PS : sse12_fp_packed, + VEX_4V; + + defm V#NAME#PD : sse12_fp_packed, + OpSize, VEX_4V; } let Constraints = "$src1 = $dst" in { - // Scalar operation, reg+reg. defm SS : sse12_fp_scalar, XS; + defm SD : sse12_fp_scalar, XD; - } - - // Vector operation, reg+reg. - def PSrr : PSI { - let isCommutable = Commutable; - } - def PDrr : PDI { - let isCommutable = Commutable; - } + defm PS : sse12_fp_packed, TB; - def V#NAME#PSrr : VPSI { - let isCommutable = Commutable; - let Constraints = ""; - let isAsmParserOnly = 1; - } - - def V#NAME#PDrr : VPDI { - let isCommutable = Commutable; - let Constraints = ""; - let isAsmParserOnly = 1; - } - - // Vector operation, reg+mem. - def PSrm : PSI; - - def PDrm : PDI; - - def V#NAME#PSrm : VPSI { - let Constraints = ""; - let isAsmParserOnly = 1; - } - - def V#NAME#PDrm : VPDI { - let Constraints = ""; - let isAsmParserOnly = 1; + defm PD : sse12_fp_packed, TB, OpSize; } // Intrinsic operation, reg+reg. -- 2.34.1