From: Chris Lattner Date: Sun, 2 Mar 2008 08:47:13 +0000 (+0000) Subject: add support for the sse.cmp.* intrinsics, which fixes sse.isamax with the CBE. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4e22012ea4c8bc35fb2ec3d025962843bec53ad7;p=oota-llvm.git add support for the sse.cmp.* intrinsics, which fixes sse.isamax with the CBE. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47824 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 411b69299cf..f3f7485014f 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -2507,7 +2507,11 @@ void CWriter::lowerIntrinsics(Function &F) { case Intrinsic::prefetch: case Intrinsic::dbg_stoppoint: case Intrinsic::powi: - // We directly implement these intrinsics + case Intrinsic::x86_sse_cmp_ss: + case Intrinsic::x86_sse_cmp_ps: + case Intrinsic::x86_sse2_cmp_sd: + case Intrinsic::x86_sse2_cmp_pd: + // We directly implement these intrinsics break; default: // If this is an intrinsic that directly corresponds to a GCC @@ -2768,6 +2772,40 @@ bool CWriter::visitBuiltinCall(CallInst &I, Intrinsic::ID ID, << SPI.getFileName() << "\"\n"; return true; } + case Intrinsic::x86_sse_cmp_ss: + case Intrinsic::x86_sse_cmp_ps: + case Intrinsic::x86_sse2_cmp_sd: + case Intrinsic::x86_sse2_cmp_pd: + Out << '('; + printType(Out, I.getType()); + Out << ')'; + // Multiple GCC builtins multiplex onto this intrinsic. + switch (cast(I.getOperand(3))->getZExtValue()) { + default: assert(0 && "Invalid llvm.x86.sse.cmp!"); + case 0: Out << "__builtin_ia32_cmpeq"; break; + case 1: Out << "__builtin_ia32_cmplt"; break; + case 2: Out << "__builtin_ia32_cmple"; break; + case 3: Out << "__builtin_ia32_cmpunord"; break; + case 4: Out << "__builtin_ia32_cmpneq"; break; + case 5: Out << "__builtin_ia32_cmpnlt"; break; + case 6: Out << "__builtin_ia32_cmpnle"; break; + case 7: Out << "__builtin_ia32_cmpord"; break; + } + if (ID == Intrinsic::x86_sse_cmp_ps || ID == Intrinsic::x86_sse2_cmp_pd) + Out << 'p'; + else + Out << 's'; + if (ID == Intrinsic::x86_sse_cmp_ss || ID == Intrinsic::x86_sse_cmp_ps) + Out << 's'; + else + Out << 'd'; + + Out << "("; + writeOperand(I.getOperand(1)); + Out << ", "; + writeOperand(I.getOperand(2)); + Out << ")"; + return true; } }