Change the marker byte for stubs from 0xcd to 0xce (another form of
[oota-llvm.git] / lib / Target / X86 / X86InstrSSE.td
index fefdba096ab1ec5b506ae7fcc340b45189857f4d..795776708e6a758e6d3048a647b4b60536db67b8 100644 (file)
@@ -69,7 +69,8 @@ def X86pcmpgtw : SDNode<"X86ISD::PCMPGTW", SDTIntBinOp>;
 def X86pcmpgtd : SDNode<"X86ISD::PCMPGTD", SDTIntBinOp>;
 def X86pcmpgtq : SDNode<"X86ISD::PCMPGTQ", SDTIntBinOp>;
 
-def SDTX86CmpPTest : SDTypeProfile<0, 2, [SDTCisVT<0, v4f32>, SDTCisVT<1, v4f32>]>;
+def SDTX86CmpPTest : SDTypeProfile<0, 2, [SDTCisVT<0, v4f32>,
+                                         SDTCisVT<1, v4f32>]>;
 def X86ptest   : SDNode<"X86ISD::PTEST", SDTX86CmpPTest>;
 
 //===----------------------------------------------------------------------===//
@@ -87,10 +88,12 @@ def sse_load_f64 : ComplexPattern<v2f64, 5, "SelectScalarSSELoad", [],
 def ssmem : Operand<v4f32> {
   let PrintMethod = "printf32mem";
   let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc_nosp, i32imm, i8imm);
+  let ParserMatchClass = X86MemAsmOperand;
 }
 def sdmem : Operand<v2f64> {
   let PrintMethod = "printf64mem";
   let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc_nosp, i32imm, i8imm);
+  let ParserMatchClass = X86MemAsmOperand;
 }
 
 //===----------------------------------------------------------------------===//
@@ -469,7 +472,7 @@ def Int_COMISSrm: PSI<0x2F, MRMSrcMem, (outs), (ins VR128:$src1, f128mem:$src2),
 // that start with 'Fs'.
 
 // Alias instructions that map fld0 to pxor for sse.
-let isReMaterializable = 1, isAsCheapAsAMove = 1 in
+let isReMaterializable = 1, isAsCheapAsAMove = 1, isCodeGenOnly = 1 in
 def FsFLD0SS : I<0xEF, MRMInitReg, (outs FR32:$dst), (ins),
                  "pxor\t$dst, $dst", [(set FR32:$dst, fp32imm0)]>,
                Requires<[HasSSE1]>, TB, OpSize;
@@ -989,7 +992,8 @@ def STMXCSR : PSI<0xAE, MRM3m, (outs), (ins i32mem:$dst),
 // Alias instructions that map zero vector to pxor / xorp* for sse.
 // We set canFoldAsLoad because this can be converted to a constant-pool
 // load of an all-zeros value if folding it would be beneficial.
-let isReMaterializable = 1, isAsCheapAsAMove = 1, canFoldAsLoad = 1 in
+let isReMaterializable = 1, isAsCheapAsAMove = 1, canFoldAsLoad = 1,
+    isCodeGenOnly = 1 in
 def V_SET0 : PSI<0x57, MRMInitReg, (outs VR128:$dst), (ins),
                  "xorps\t$dst, $dst",
                  [(set VR128:$dst, (v4i32 immAllZerosV))]>;
@@ -1205,7 +1209,7 @@ def Int_COMISDrm: PDI<0x2F, MRMSrcMem, (outs), (ins VR128:$src1, f128mem:$src2),
 // that start with 'Fs'.
 
 // Alias instructions that map fld0 to pxor for sse.
-let isReMaterializable = 1, isAsCheapAsAMove = 1 in
+let isReMaterializable = 1, isAsCheapAsAMove = 1, isCodeGenOnly = 1 in
 def FsFLD0SD : I<0xEF, MRMInitReg, (outs FR64:$dst), (ins),
                  "pxor\t$dst, $dst", [(set FR64:$dst, fpimm0)]>,
                Requires<[HasSSE2]>, TB, OpSize;
@@ -2242,7 +2246,8 @@ def : Pat<(membarrier (i8 imm:$ll), (i8 imm:$ls), (i8 imm:$sl), (i8 imm:$ss),
 // Alias instructions that map zero vector to pxor / xorp* for sse.
 // We set canFoldAsLoad because this can be converted to a constant-pool
 // load of an all-ones value if folding it would be beneficial.
-let isReMaterializable = 1, isAsCheapAsAMove = 1, canFoldAsLoad = 1 in
+let isReMaterializable = 1, isAsCheapAsAMove = 1, canFoldAsLoad = 1,
+    isCodeGenOnly = 1 in
   def V_SETALLONES : PDI<0x76, MRMInitReg, (outs VR128:$dst), (ins),
                          "pcmpeqd\t$dst, $dst",
                          [(set VR128:$dst, (v4i32 immAllOnesV))]>;
@@ -3652,6 +3657,11 @@ def MOVNTDQArm : SS48I<0x2A, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src),
                        "movntdqa\t{$src, $dst|$dst, $src}",
                        [(set VR128:$dst, (int_x86_sse41_movntdqa addr:$src))]>;
 
+
+//===----------------------------------------------------------------------===//
+// SSE4.2 Instructions
+//===----------------------------------------------------------------------===//
+
 /// SS42I_binop_rm_int - Simple SSE 4.2 binary operator
 let Constraints = "$src1 = $dst" in {
   multiclass SS42I_binop_rm_int<bits<8> opc, string OpcodeStr,
@@ -3683,70 +3693,166 @@ def : Pat<(v2i64 (X86pcmpgtq VR128:$src1, (memop addr:$src2))),
 // This set of instructions are only rm, the only difference is the size
 // of r and m.
 let Constraints = "$src1 = $dst" in {
-  def CRC32m8  : SS42FI<0xF0, MRMSrcMem, (outs GR32:$dst), 
+  def CRC32m8  : SS42FI<0xF0, MRMSrcMem, (outs GR32:$dst),
                       (ins GR32:$src1, i8mem:$src2),
                       "crc32 \t{$src2, $src1|$src1, $src2}",
                        [(set GR32:$dst,
                          (int_x86_sse42_crc32_8 GR32:$src1,
                          (load addr:$src2)))]>, OpSize;
-  def CRC32r8  : SS42FI<0xF0, MRMSrcReg, (outs GR32:$dst), 
+  def CRC32r8  : SS42FI<0xF0, MRMSrcReg, (outs GR32:$dst),
                       (ins GR32:$src1, GR8:$src2),
                       "crc32 \t{$src2, $src1|$src1, $src2}",
                        [(set GR32:$dst,
-                         (int_x86_sse42_crc32_8 GR32:$src1, GR8:$src2))]>, 
+                         (int_x86_sse42_crc32_8 GR32:$src1, GR8:$src2))]>,
                          OpSize;
-  def CRC32m16  : SS42FI<0xF1, MRMSrcMem, (outs GR32:$dst), 
+  def CRC32m16  : SS42FI<0xF1, MRMSrcMem, (outs GR32:$dst),
                       (ins GR32:$src1, i16mem:$src2),
                       "crc32 \t{$src2, $src1|$src1, $src2}",
                        [(set GR32:$dst,
                          (int_x86_sse42_crc32_16 GR32:$src1,
                          (load addr:$src2)))]>,
                          OpSize;
-  def CRC32r16  : SS42FI<0xF1, MRMSrcReg, (outs GR32:$dst), 
+  def CRC32r16  : SS42FI<0xF1, MRMSrcReg, (outs GR32:$dst),
                       (ins GR32:$src1, GR16:$src2),
                       "crc32 \t{$src2, $src1|$src1, $src2}",
                        [(set GR32:$dst,
-                         (int_x86_sse42_crc32_16 GR32:$src1, GR16:$src2))]>, 
+                         (int_x86_sse42_crc32_16 GR32:$src1, GR16:$src2))]>,
                          OpSize;
-  def CRC32m32  : SS42FI<0xF1, MRMSrcMem, (outs GR32:$dst), 
+  def CRC32m32  : SS42FI<0xF1, MRMSrcMem, (outs GR32:$dst),
                       (ins GR32:$src1, i32mem:$src2),
                       "crc32 \t{$src2, $src1|$src1, $src2}",
                        [(set GR32:$dst,
                          (int_x86_sse42_crc32_32 GR32:$src1,
                          (load addr:$src2)))]>, OpSize;
-  def CRC32r32  : SS42FI<0xF1, MRMSrcReg, (outs GR32:$dst), 
+  def CRC32r32  : SS42FI<0xF1, MRMSrcReg, (outs GR32:$dst),
                       (ins GR32:$src1, GR32:$src2),
                       "crc32 \t{$src2, $src1|$src1, $src2}",
                        [(set GR32:$dst,
-                         (int_x86_sse42_crc32_32 GR32:$src1, GR32:$src2))]>, 
+                         (int_x86_sse42_crc32_32 GR32:$src1, GR32:$src2))]>,
                          OpSize;
-  def CRC64m64  : SS42FI<0xF0, MRMSrcMem, (outs GR64:$dst), 
+  def CRC64m64  : SS42FI<0xF0, MRMSrcMem, (outs GR64:$dst),
                       (ins GR64:$src1, i64mem:$src2),
                       "crc32 \t{$src2, $src1|$src1, $src2}",
                        [(set GR64:$dst,
                          (int_x86_sse42_crc32_64 GR64:$src1,
                          (load addr:$src2)))]>,
                          OpSize, REX_W;
-  def CRC64r64  : SS42FI<0xF0, MRMSrcReg, (outs GR64:$dst), 
+  def CRC64r64  : SS42FI<0xF0, MRMSrcReg, (outs GR64:$dst),
                       (ins GR64:$src1, GR64:$src2),
                       "crc32 \t{$src2, $src1|$src1, $src2}",
                        [(set GR64:$dst,
-                         (int_x86_sse42_crc32_64 GR64:$src1, GR64:$src2))]>, 
+                         (int_x86_sse42_crc32_64 GR64:$src1, GR64:$src2))]>,
                          OpSize, REX_W;
-                         
-  // TODO: These correspond to int_x86_sse42_crc32_8 but with a 64-bit src
-  // and dest, figure it out.
-  //def CRC64m8  : SS42FI<0xF1, MRMSrcMem, (outs GR64:$dst), 
-  //                    (ins GR32:$src1, i8mem:$src2),
-  //                    "crc32 \t{$src2, $src1|$src1, $src2}",
-  //                     [(set GR64:$dst,
-  //                       (int_x86_sse42_crc32_8 GR64:$src1,
-  //                       (load addr:$src2)))]>, 
-  //                       OpSize, REX_W;
-  //def CRC64r8  : SS42FI<0xF1, MRMSrcReg, (outs GR64:$dst), 
-  //                    (ins GR64:$src1, GR8:$src2),
-  //                    "crc32 \t{$src2, $src1|$src1, $src2}",
-  //                     [(set GR64:$dst,
-  //                       (int_x86_sse42_crc32_8 GR32:$src1, GR8:$src2))]>, 
-  //                       OpSize, REX_W;
 }
+
+// String/text processing instructions.
+let Defs = [EFLAGS], usesCustomDAGSchedInserter = 1 in {
+def PCMPISTRM128REG : SS42AI<0, Pseudo, (outs VR128:$dst),
+                       (ins VR128:$src1, VR128:$src2, i8imm:$src3),
+                   "#PCMPISTRM128rr PSEUDO!",
+                   [(set VR128:$dst,
+                       (int_x86_sse42_pcmpistrm128 VR128:$src1, VR128:$src2,
+                                                   imm:$src3))]>, OpSize;
+def PCMPISTRM128MEM : SS42AI<0, Pseudo, (outs VR128:$dst),
+                       (ins VR128:$src1, i128mem:$src2, i8imm:$src3),
+                   "#PCMPISTRM128rm PSEUDO!",
+                   [(set VR128:$dst,
+                       (int_x86_sse42_pcmpistrm128 VR128:$src1,
+                                                   (load addr:$src2),
+                                                   imm:$src3))]>, OpSize;
+}
+
+let Defs = [XMM0, EFLAGS] in {
+def PCMPISTRM128rr : SS42AI<0x62, MRMSrcReg, (outs),
+                           (ins VR128:$src1, VR128:$src2, i8imm:$src3),
+                    "pcmpistrm\t{$src3, $src2, $src1|$src1, $src2, $src3}",
+                    []>, OpSize;
+def PCMPISTRM128rm : SS42AI<0x62, MRMSrcMem, (outs),
+                           (ins VR128:$src1, i128mem:$src2, i8imm:$src3),
+                    "pcmpistrm\t{$src3, $src2, $src1|$src1, $src2, $src3}",
+                    []>, OpSize;
+}
+
+let Defs = [EFLAGS], Uses = [EAX, EDX],
+       usesCustomDAGSchedInserter = 1 in {
+def PCMPESTRM128REG : SS42AI<0, Pseudo, (outs VR128:$dst),
+                       (ins VR128:$src1, VR128:$src3, i8imm:$src5),
+                   "#PCMPESTRM128rr PSEUDO!",
+                   [(set VR128:$dst,
+                       (int_x86_sse42_pcmpestrm128 VR128:$src1, EAX,
+                                                   VR128:$src3,
+                                                   EDX, imm:$src5))]>, OpSize;
+def PCMPESTRM128MEM : SS42AI<0, Pseudo, (outs VR128:$dst),
+                       (ins VR128:$src1, i128mem:$src3, i8imm:$src5),
+                   "#PCMPESTRM128rm PSEUDO!",
+                   [(set VR128:$dst,
+                       (int_x86_sse42_pcmpestrm128 VR128:$src1, EAX,
+                                                   (load addr:$src3),
+                                                   EDX, imm:$src5))]>, OpSize;
+}
+
+let Defs = [XMM0, EFLAGS], Uses = [EAX, EDX] in {
+def PCMPESTRM128rr : SS42AI<0x60, MRMSrcReg, (outs),
+                           (ins VR128:$src1, VR128:$src3, i8imm:$src5),
+                    "pcmpestrm\t{$src5, $src3, $src1|$src1, $src3, $src5}",
+                    []>, OpSize;
+def PCMPESTRM128rm : SS42AI<0x60, MRMSrcMem, (outs),
+                           (ins VR128:$src1, i128mem:$src3, i8imm:$src5),
+                    "pcmpestrm\t{$src5, $src3, $src1|$src1, $src3, $src5}",
+                    []>, OpSize;
+}
+
+let Defs = [ECX, EFLAGS] in {
+  multiclass SS42AI_pcmpistri<Intrinsic IntId128> {
+    def rr : SS42AI<0x63, MRMSrcReg, (outs),
+               (ins VR128:$src1, VR128:$src2, i8imm:$src3),
+               "pcmpistri\t{$src3, $src2, $src1|$src1, $src2, $src3}",
+               [(set ECX,
+                  (IntId128 VR128:$src1, VR128:$src2, imm:$src3)),
+                (implicit EFLAGS)]>,
+               OpSize;
+    def rm : SS42AI<0x63, MRMSrcMem, (outs),
+               (ins VR128:$src1, i128mem:$src2, i8imm:$src3),
+               "pcmpistri\t{$src3, $src2, $src1|$src1, $src2, $src3}",
+               [(set ECX,
+                 (IntId128 VR128:$src1, (load addr:$src2), imm:$src3)),
+                (implicit EFLAGS)]>,
+               OpSize;
+  }
+}
+
+defm PCMPISTRI  : SS42AI_pcmpistri<int_x86_sse42_pcmpistri128>;
+defm PCMPISTRIA : SS42AI_pcmpistri<int_x86_sse42_pcmpistria128>;
+defm PCMPISTRIC : SS42AI_pcmpistri<int_x86_sse42_pcmpistric128>;
+defm PCMPISTRIO : SS42AI_pcmpistri<int_x86_sse42_pcmpistrio128>;
+defm PCMPISTRIS : SS42AI_pcmpistri<int_x86_sse42_pcmpistris128>;
+defm PCMPISTRIZ : SS42AI_pcmpistri<int_x86_sse42_pcmpistriz128>;
+
+let Defs = [ECX, EFLAGS] in {
+let Uses = [EAX, EDX] in {
+  multiclass SS42AI_pcmpestri<Intrinsic IntId128> {
+    def rr : SS42AI<0x61, MRMSrcReg, (outs),
+               (ins VR128:$src1, VR128:$src3, i8imm:$src5),
+               "pcmpestri\t{$src5, $src3, $src1|$src1, $src3, $src5}",
+               [(set ECX,
+                  (IntId128 VR128:$src1, EAX, VR128:$src3, EDX, imm:$src5)),
+                (implicit EFLAGS)]>,
+               OpSize;
+    def rm : SS42AI<0x61, MRMSrcMem, (outs),
+               (ins VR128:$src1, i128mem:$src3, i8imm:$src5),
+               "pcmpestri\t{$src5, $src3, $src1|$src1, $src3, $src5}",
+               [(set ECX,
+                 (IntId128 VR128:$src1, EAX, (load addr:$src3),
+                   EDX, imm:$src5)),
+                (implicit EFLAGS)]>,
+               OpSize;
+  }
+}
+}
+
+defm PCMPESTRI  : SS42AI_pcmpestri<int_x86_sse42_pcmpestri128>;
+defm PCMPESTRIA : SS42AI_pcmpestri<int_x86_sse42_pcmpestria128>;
+defm PCMPESTRIC : SS42AI_pcmpestri<int_x86_sse42_pcmpestric128>;
+defm PCMPESTRIO : SS42AI_pcmpestri<int_x86_sse42_pcmpestrio128>;
+defm PCMPESTRIS : SS42AI_pcmpestri<int_x86_sse42_pcmpestris128>;
+defm PCMPESTRIZ : SS42AI_pcmpestri<int_x86_sse42_pcmpestriz128>;