From bb5c43e73da17281f7de0b28bb8767406cea728b Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Fri, 14 Apr 2006 01:39:53 +0000 Subject: [PATCH] pcmpeq* and pcmpgt* intrinsics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27685 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IntrinsicsX86.td | 22 +++++++++++ lib/Target/X86/X86InstrSSE.td | 70 ++++++++++++++++++++++++++++++++++- 2 files changed, 90 insertions(+), 2 deletions(-) diff --git a/include/llvm/IntrinsicsX86.td b/include/llvm/IntrinsicsX86.td index c63323843ae..9b0a9827ffe 100644 --- a/include/llvm/IntrinsicsX86.td +++ b/include/llvm/IntrinsicsX86.td @@ -345,6 +345,28 @@ let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.". llvm_v4i32_ty], [IntrNoMem]>; } +// Integer comparison ops +let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.". + def int_x86_sse2_pcmpeq_b : GCCBuiltin<"__builtin_ia32_pcmpeqb128">, + Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, + llvm_v16i8_ty], [IntrNoMem]>; + def int_x86_sse2_pcmpeq_w : GCCBuiltin<"__builtin_ia32_pcmpeqw128">, + Intrinsic<[llvm_v8i16_ty, llvm_v8i16_ty, + llvm_v8i16_ty], [IntrNoMem]>; + def int_x86_sse2_pcmpeq_d : GCCBuiltin<"__builtin_ia32_pcmpeqd128">, + Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty, + llvm_v4i32_ty], [IntrNoMem]>; + def int_x86_sse2_pcmpgt_b : GCCBuiltin<"__builtin_ia32_pcmpgtb128">, + Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, + llvm_v16i8_ty], [IntrNoMem]>; + def int_x86_sse2_pcmpgt_w : GCCBuiltin<"__builtin_ia32_pcmpgtw128">, + Intrinsic<[llvm_v8i16_ty, llvm_v8i16_ty, + llvm_v8i16_ty], [IntrNoMem]>; + def int_x86_sse2_pcmpgt_d : GCCBuiltin<"__builtin_ia32_pcmpgtd128">, + Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty, + llvm_v4i32_ty], [IntrNoMem]>; +} + // Conversion ops let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.". def int_x86_sse2_cvtdq2pd : GCCBuiltin<"__builtin_ia32_cvtdq2pd">, diff --git a/lib/Target/X86/X86InstrSSE.td b/lib/Target/X86/X86InstrSSE.td index 98ca527578c..d524eb7814a 100644 --- a/lib/Target/X86/X86InstrSSE.td +++ b/lib/Target/X86/X86InstrSSE.td @@ -1148,10 +1148,76 @@ def CMPPSrm : PSIi8<0xC2, MRMSrcMem, (load addr:$src), imm:$cc))]>; def CMPPDrr : PDIi8<0xC2, MRMSrcReg, (ops VR128:$dst, VR128:$src1, VR128:$src, SSECC:$cc), - "cmp${cc}pd {$src, $dst|$dst, $src}", []>; + "cmp${cc}pd {$src, $dst|$dst, $src}", + [(set VR128:$dst, (int_x86_sse2_cmp_pd VR128:$src1, + VR128:$src, imm:$cc))]>; def CMPPDrm : PDIi8<0xC2, MRMSrcMem, (ops VR128:$dst, VR128:$src1, f128mem:$src, SSECC:$cc), - "cmp${cc}pd {$src, $dst|$dst, $src}", []>; + "cmp${cc}pd {$src, $dst|$dst, $src}", + [(set VR128:$dst, (int_x86_sse2_cmp_pd VR128:$src1, + (load addr:$src), imm:$cc))]>; + +def PCMPEQBrr : PDI<0x74, MRMSrcReg, + (ops VR128:$dst, VR128:$src1, VR128:$src2), + "pcmpeqb {$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_pcmpeq_b VR128:$src1, + VR128:$src2))]>; +def PCMPEQBrm : PDI<0x74, MRMSrcReg, + (ops VR128:$dst, VR128:$src1, i128mem:$src2), + "pcmpeqb {$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_pcmpeq_b VR128:$src1, + (bc_v16i8 (loadv2i64 addr:$src2))))]>; +def PCMPEQWrr : PDI<0x75, MRMSrcReg, + (ops VR128:$dst, VR128:$src1, VR128:$src2), + "pcmpeqw {$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_pcmpeq_w VR128:$src1, + VR128:$src2))]>; +def PCMPEQWrm : PDI<0x75, MRMSrcReg, + (ops VR128:$dst, VR128:$src1, i128mem:$src2), + "pcmpeqw {$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_pcmpeq_w VR128:$src1, + (bc_v8i16 (loadv2i64 addr:$src2))))]>; +def PCMPEQDrr : PDI<0x76, MRMSrcReg, + (ops VR128:$dst, VR128:$src1, VR128:$src2), + "pcmpeqd {$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_pcmpeq_d VR128:$src1, + VR128:$src2))]>; +def PCMPEQDrm : PDI<0x76, MRMSrcReg, + (ops VR128:$dst, VR128:$src1, i128mem:$src2), + "pcmpeqd {$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_pcmpeq_d VR128:$src1, + (bc_v4i32 (loadv2i64 addr:$src2))))]>; + +def PCMPGTBrr : PDI<0x64, MRMSrcReg, + (ops VR128:$dst, VR128:$src1, VR128:$src2), + "pcmpgtb {$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_pcmpgt_b VR128:$src1, + VR128:$src2))]>; +def PCMPGTBrm : PDI<0x64, MRMSrcReg, + (ops VR128:$dst, VR128:$src1, i128mem:$src2), + "pcmpgtb {$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_pcmpgt_b VR128:$src1, + (bc_v16i8 (loadv2i64 addr:$src2))))]>; +def PCMPGTWrr : PDI<0x65, MRMSrcReg, + (ops VR128:$dst, VR128:$src1, VR128:$src2), + "pcmpgtw {$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_pcmpgt_w VR128:$src1, + VR128:$src2))]>; +def PCMPGTWrm : PDI<0x65, MRMSrcReg, + (ops VR128:$dst, VR128:$src1, i128mem:$src2), + "pcmpgtw {$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_pcmpgt_w VR128:$src1, + (bc_v8i16 (loadv2i64 addr:$src2))))]>; +def PCMPGTDrr : PDI<0x66, MRMSrcReg, + (ops VR128:$dst, VR128:$src1, VR128:$src2), + "pcmpgtd {$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_pcmpgt_d VR128:$src1, + VR128:$src2))]>; +def PCMPGTDrm : PDI<0x66, MRMSrcReg, + (ops VR128:$dst, VR128:$src1, i128mem:$src2), + "pcmpgtd {$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse2_pcmpgt_d VR128:$src1, + (bc_v4i32 (loadv2i64 addr:$src2))))]>; } // Shuffle and unpack instructions