Revision: 124234 Author: clattner Date: 2007-02-23 20:15:35 -0800 (Fri, 23 Feb 2007)
Log Message: ----------- Change LLVM_TARGET_INTRINSIC_LOWER to not implicitly return. Change LLVM_TARGET_INTRINSIC_LOWER to pass in the exp of the call. Change llvm-i386.c to emit an error on a bogus _mm_shuffle_epi32, instead of producing an arcane error message from llvm stuff. Modified Paths: -------------- apple-local/branches/llvm/gcc/config/i386/i386.h apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp apple-local/branches/llvm/gcc/config/rs6000/llvm-rs6000.cpp apple-local/branches/llvm/gcc/config/rs6000/rs6000.h apple-local/branches/llvm/gcc/llvm-convert.cpp apple-local/branches/llvm/gcc/llvm-internal.h Modified: apple-local/branches/llvm/gcc/config/i386/i386.h =================================================================== --- apple-local/branches/llvm/gcc/config/i386/i386.h 2007-02-23 20:14:43 UTC (rev 124233) +++ apple-local/branches/llvm/gcc/config/i386/i386.h 2007-02-24 04:15:35 UTC (rev 124234) @@ -4059,12 +4059,12 @@ * macro should call the target TreeToLLVM::TargetIntrinsicLower method and * return true.This macro is invoked from a method in the TreeToLLVM class. */ -#define LLVM_TARGET_INTRINSIC_LOWER(BUILTIN_CODE, DESTLOC, RESULT, \ +#define LLVM_TARGET_INTRINSIC_LOWER(EXP, BUILTIN_CODE, DESTLOC, RESULT, \ DESTTY, OPS, ARGS, CURBB, \ RESISSIGNED, EXPISSIGNED) \ - return TargetIntrinsicLower(BUILTIN_CODE, DESTLOC, RESULT, \ - DESTTY, OPS, ARGS, CURBB, \ - RESISSIGNED, EXPISSIGNED); + TargetIntrinsicLower(EXP, BUILTIN_CODE, DESTLOC, RESULT, \ + DESTTY, OPS, ARGS, CURBB, \ + RESISSIGNED, EXPISSIGNED); /* APPLE LOCAL end LLVM */ /* Modified: apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp =================================================================== --- apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp 2007-02-23 20:14:43 UTC (rev 124233) +++ apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp 2007-02-24 04:15:35 UTC (rev 124234) @@ -30,6 +30,10 @@ #include "llvm/Intrinsics.h" #include "llvm/Module.h" +extern "C" { +#include "toplev.h" +} + /* TargetIntrinsicCastResult - This function just provides a frequently * used sequence for use inside TargetIntrinsicLower. */ static void TargetIntrinsicCastResult(Value *&Result, const Type *ResultType, bool ResIsSigned, bool ExpIsSigned, @@ -48,7 +52,8 @@ * LLVM code, emit the code now. If we can handle the code, this macro should * emit the code, return true. */ -bool TreeToLLVM::TargetIntrinsicLower(unsigned FnCode, +bool TreeToLLVM::TargetIntrinsicLower(tree exp, + unsigned FnCode, Value *DestLoc, Value *&Result, const Type *ResultType, @@ -280,9 +285,12 @@ Result = BuildVectorShuffle(Ops[0], Ops[1], ((EV & 0x03) >> 0), ((EV & 0x0c) >> 2), ((EV & 0x30) >> 4)+4, ((EV & 0xc0) >> 6)+4); - return true; + } else { + error("%Hmask must be an immediate", &EXPR_LOCATION(exp)); + Result = Ops[0]; } - return false; + + return true; case IX86_BUILTIN_PSHUFW: case IX86_BUILTIN_PSHUFD: if (ConstantInt *Elt = dyn_cast<ConstantInt>(Ops[1])) { @@ -290,9 +298,11 @@ Result = BuildVectorShuffle(Ops[0], Ops[0], ((EV & 0x03) >> 0), ((EV & 0x0c) >> 2), ((EV & 0x30) >> 4), ((EV & 0xc0) >> 6)); - return true; + } else { + error("%Hmask must be an immediate", &EXPR_LOCATION(exp)); + Result = Ops[0]; } - return false; + return true; case IX86_BUILTIN_PSHUFHW: if (ConstantInt *Elt = dyn_cast<ConstantInt>(Ops[1])) { int EV = Elt->getZExtValue(); @@ -310,9 +320,12 @@ ((EV & 0x03) >> 0), ((EV & 0x0c) >> 2), ((EV & 0x30) >> 4), ((EV & 0xc0) >> 6), 4, 5, 6, 7); - return true; + } else { + error("%Hmask must be an immediate", &EXPR_LOCATION(exp)); + Result = Ops[0]; } - return false; + + return true; case IX86_BUILTIN_PUNPCKHBW128: Result = BuildVectorShuffle(Ops[0], Ops[1], 8, 24, 9, 25, 10, 26, 11, 27, Modified: apple-local/branches/llvm/gcc/config/rs6000/llvm-rs6000.cpp =================================================================== --- apple-local/branches/llvm/gcc/config/rs6000/llvm-rs6000.cpp 2007-02-23 20:14:43 UTC (rev 124233) +++ apple-local/branches/llvm/gcc/config/rs6000/llvm-rs6000.cpp 2007-02-24 04:15:35 UTC (rev 124234) @@ -114,7 +114,8 @@ * invocation into normal LLVM code. If the target can handle the builtin, this * function should emit the expanded code and return true. */ -bool TreeToLLVM::TargetIntrinsicLower(unsigned FnCode, +bool TreeToLLVM::TargetIntrinsicLower(tree_node *exp, + unsigned FnCode, Value *DestLoc, Value *&Result, const Type *ResultType, Modified: apple-local/branches/llvm/gcc/config/rs6000/rs6000.h =================================================================== --- apple-local/branches/llvm/gcc/config/rs6000/rs6000.h 2007-02-23 20:14:43 UTC (rev 124233) +++ apple-local/branches/llvm/gcc/config/rs6000/rs6000.h 2007-02-24 04:15:35 UTC (rev 124234) @@ -3640,11 +3640,11 @@ * macro should call the target TreeToLLVM::TargetIntrinsicLower method and * return true.This macro is invoked from a method in the TreeToLLVM class. */ -#define LLVM_TARGET_INTRINSIC_LOWER(BUILTIN_CODE, DESTLOC, RESULT, \ +#define LLVM_TARGET_INTRINSIC_LOWER(EXP, BUILTIN_CODE, DESTLOC, RESULT, \ DESTTY, OPS, ARGS, CURBB, \ RESISSIGNED, EXPISSIGNED) \ - return TargetIntrinsicLower(BUILTIN_CODE, DESTLOC, RESULT, \ - DESTTY, OPS, ARGS, CURBB, \ - RESISSIGNED, EXPISSIGNED); + TargetIntrinsicLower(EXP, BUILTIN_CODE, DESTLOC, RESULT, \ + DESTTY, OPS, ARGS, CURBB, \ + RESISSIGNED, EXPISSIGNED); /* APPLE LOCAL end LLVM */ Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp =================================================================== --- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-02-23 20:14:43 UTC (rev 124233) +++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-02-24 04:15:35 UTC (rev 124234) @@ -3448,8 +3448,9 @@ bool ResIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_TYPE(fndecl))); bool ExpIsSigned = !TYPE_UNSIGNED(TREE_TYPE(exp)); unsigned FnCode = DECL_FUNCTION_CODE(fndecl); - LLVM_TARGET_INTRINSIC_LOWER(FnCode, DestLoc, Result, ResultType, Operands, - Args, CurBB, ResIsSigned, ExpIsSigned); + return LLVM_TARGET_INTRINSIC_LOWER(exp, FnCode, DestLoc, Result, ResultType, + Operands, Args, CurBB, ResIsSigned, + ExpIsSigned); #endif return false; } Modified: apple-local/branches/llvm/gcc/llvm-internal.h =================================================================== --- apple-local/branches/llvm/gcc/llvm-internal.h 2007-02-23 20:14:43 UTC (rev 124233) +++ apple-local/branches/llvm/gcc/llvm-internal.h 2007-02-24 04:15:35 UTC (rev 124234) @@ -473,7 +473,8 @@ Value *EmitCONSTRUCTOR(tree_node *exp, Value *DestLoc); // Optional target defined builtin intrinsic expanding function. - bool TargetIntrinsicLower(unsigned FnCode, + bool TargetIntrinsicLower(tree_node *exp, + unsigned FnCode, Value *DestLoc, Value *&Result, const Type *ResultType, _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits