From 4b1734f70b86e05bfa5b21ace3478d837e723431 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Fri, 31 Mar 2006 21:29:33 +0000 Subject: [PATCH] Added support for SSE3 horizontal ops: haddp{s|d} and hsub{s|d}. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27310 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86InstrSSE.td | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/lib/Target/X86/X86InstrSSE.td b/lib/Target/X86/X86InstrSSE.td index 38158a24f4b..4c3e2cac780 100644 --- a/lib/Target/X86/X86InstrSSE.td +++ b/lib/Target/X86/X86InstrSSE.td @@ -145,6 +145,8 @@ def SHUFP_int_shuffle_mask : PatLeaf<(build_vector), [{ // PDI - SSE2 instructions with TB and OpSize prefixes. // PSIi8 - SSE1 instructions with ImmT == Imm8 and TB prefix. // PDIi8 - SSE2 instructions with ImmT == Imm8 and TB and OpSize prefixes. +// S3SI - SSE3 instructions with XD prefix. +// S3DI - SSE3 instructions with TB and OpSize prefixes. class SSI o, Format F, dag ops, string asm, list pattern> : I, XS, Requires<[HasSSE1]>; class SDI o, Format F, dag ops, string asm, list pattern> @@ -161,6 +163,27 @@ class PDIi8 o, Format F, dag ops, string asm, list pattern> : X86Inst, TB, OpSize, Requires<[HasSSE2]> { let Pattern = pattern; } +class S3SI o, Format F, dag ops, string asm, list pattern> + : I, XD, Requires<[HasSSE3]>; +class S3DI o, Format F, dag ops, string asm, list pattern> + : I, TB, OpSize, Requires<[HasSSE3]>; + +//===----------------------------------------------------------------------===// +// Helpers for defining instructions that directly correspond to intrinsics. +class S3S_Intrr o, string asm, Intrinsic IntId> + : S3SI; +class S3S_Intrm o, string asm, Intrinsic IntId> + : S3SI; +class S3D_Intrr o, string asm, Intrinsic IntId> + : S3DI; +class S3D_Intrm o, string asm, Intrinsic IntId> + : S3DI; // Some 'special' instructions def IMPLICIT_DEF_FR32 : I<0, Pseudo, (ops FR32:$dst), @@ -1073,6 +1096,26 @@ def UNPCKLPDrm : PDI<0x14, MRMSrcMem, UNPCKL_shuffle_mask)))]>; } +// Horizontal ops +let isTwoAddress = 1 in { +def HADDPSrr : S3S_Intrr<0x7C, "haddps {$src2, $dst|$dst, $src2}", + int_x86_sse3_hadd_ps>; +def HADDPSrm : S3S_Intrm<0x7C, "haddps {$src2, $dst|$dst, $src2}", + int_x86_sse3_hadd_ps>; +def HADDPDrr : S3D_Intrr<0x7C, "haddpd {$src2, $dst|$dst, $src2}", + int_x86_sse3_hadd_pd>; +def HADDPDrm : S3D_Intrm<0x7C, "haddpd {$src2, $dst|$dst, $src2}", + int_x86_sse3_hadd_pd>; +def HSUBPSrr : S3S_Intrr<0x7C, "hsubps {$src2, $dst|$dst, $src2}", + int_x86_sse3_hsub_ps>; +def HSUBPSrm : S3S_Intrm<0x7C, "hsubps {$src2, $dst|$dst, $src2}", + int_x86_sse3_hsub_ps>; +def HSUBPDrr : S3D_Intrr<0x7C, "hsubpd {$src2, $dst|$dst, $src2}", + int_x86_sse3_hsub_pd>; +def HSUBPDrm : S3D_Intrm<0x7C, "hsubpd {$src2, $dst|$dst, $src2}", + int_x86_sse3_hsub_pd>; +} + //===----------------------------------------------------------------------===// // SSE integer instructions //===----------------------------------------------------------------------===//