From 345032a7211a6f983d59c30c0b3fa2b96819532a Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 20 Feb 2012 07:35:45 +0000 Subject: Add 3dNOW intrinsic header to x86intrin.h, conditioned on __3dNOW__ to match the behavior of GCC. Also add a test for these intrinsics, which apparently have *zero* tests. =[ Not surprisingly, Clang crashed when compiling these. Fix the bug in CodeGen where we failed to bitcast the argument type to x86mmx prior to calling the LLVM intrinsic. This fixes an assert on the new 3dnow-builtins.c test. This is one issue impacting the efforts to get Clang to emulate the Microsoft intrinsics headers -- 3dnow intrinsics are implictitly made available there. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150948 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGBuiltin.cpp | 2 ++ lib/Headers/x86intrin.h | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index 038631e5ca..ff25609b67 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -2240,6 +2240,8 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, ID = Intrinsic::x86_3dnowa_pswapd; break; } + llvm::Type *MMXTy = llvm::Type::getX86_MMXTy(getLLVMContext()); + Ops[0] = Builder.CreateBitCast(Ops[0], MMXTy, "cast"); llvm::Function *F = CGM.getIntrinsic(ID); return Builder.CreateCall(F, Ops, name); } diff --git a/lib/Headers/x86intrin.h b/lib/Headers/x86intrin.h index 5f9bea7107..f5e4d883e8 100644 --- a/lib/Headers/x86intrin.h +++ b/lib/Headers/x86intrin.h @@ -26,6 +26,10 @@ #include +#ifdef __3dNOW__ +#include +#endif + #ifdef __BMI__ #include #endif @@ -46,6 +50,6 @@ #include #endif -// FIXME: SSE4A, 3dNOW, XOP, LWP, ABM +// FIXME: SSE4A, XOP, LWP, ABM #endif /* __X86INTRIN_H */ -- cgit v1.2.3-18-g5258