From a79bc75b7201a74a394a7fc0e8d0a9749378e725 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Wed, 7 Dec 2011 08:30:38 -0800 Subject: [PATCH] Add a number of symbol names to list to make internal after loading builtins. Fixes issue #131; because they weren't being marked as internal before, when compiling to multiple targets these would lead to multiply-defined symbols. --- builtins-sse2-x2.ll | 4 ++-- builtins-sse2.ll | 4 ++-- builtins-sse4-x2.ll | 2 +- builtins.cpp | 8 ++++++++ expr.cpp | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/builtins-sse2-x2.ll b/builtins-sse2-x2.ll index fddf5fad..b5eaa889 100644 --- a/builtins-sse2-x2.ll +++ b/builtins-sse2-x2.ll @@ -301,7 +301,7 @@ define i32 @__movmsk(<8 x i32>) nounwind readnone alwaysinline { } define <4 x float> @__vec4_add_float(<4 x float> %v0, - <4 x float> %v1) nounwind readnone alwaysinline { + <4 x float> %v1) nounwind readnone alwaysinline { %v = fadd <4 x float> %v0, %v1 ret <4 x float> %v } @@ -325,7 +325,7 @@ define float @__reduce_max_float(<8 x float>) nounwind readnone alwaysinline { ; helper function for reduce_add_int32 define <4 x i32> @__vec4_add_int32(<4 x i32> %v0, - <4 x i32> %v1) nounwind readnone alwaysinline { + <4 x i32> %v1) nounwind readnone alwaysinline { %v = add <4 x i32> %v0, %v1 ret <4 x i32> %v } diff --git a/builtins-sse2.ll b/builtins-sse2.ll index 18640a68..c49d6b2c 100644 --- a/builtins-sse2.ll +++ b/builtins-sse2.ll @@ -144,7 +144,7 @@ define <4 x double> @__ceil_varying_double(<4 x double>) nounwind readonly alway ; from %1, and otherwise return the value from %0. define <4 x i32> @__vselect_i32(<4 x i32>, <4 x i32> , - <4 x i32> %mask) nounwind readnone alwaysinline { + <4 x i32> %mask) nounwind readnone alwaysinline { %notmask = xor <4 x i32> %mask, %cleared_old = and <4 x i32> %0, %notmask %masked_new = and <4 x i32> %1, %mask @@ -153,7 +153,7 @@ define <4 x i32> @__vselect_i32(<4 x i32>, <4 x i32> , } define <4 x float> @__vselect_float(<4 x float>, <4 x float>, - <4 x i32> %mask) nounwind readnone alwaysinline { + <4 x i32> %mask) nounwind readnone alwaysinline { %v0 = bitcast <4 x float> %0 to <4 x i32> %v1 = bitcast <4 x float> %1 to <4 x i32> %r = call <4 x i32> @__vselect_i32(<4 x i32> %v0, <4 x i32> %v1, <4 x i32> %mask) diff --git a/builtins-sse4-x2.ll b/builtins-sse4-x2.ll index 4f5d9f8e..fd399884 100644 --- a/builtins-sse4-x2.ll +++ b/builtins-sse4-x2.ll @@ -252,7 +252,7 @@ define float @__reduce_max_float(<8 x float>) nounwind readnone alwaysinline { ; helper function for reduce_add_int32 define <4 x i32> @__vec4_add_int32(<4 x i32> %v0, - <4 x i32> %v1) nounwind readnone alwaysinline { + <4 x i32> %v1) nounwind readnone alwaysinline { %v = add <4 x i32> %v0, %v1 ret <4 x i32> %v } diff --git a/builtins.cpp b/builtins.cpp index 572ea1e3..443b3beb 100644 --- a/builtins.cpp +++ b/builtins.cpp @@ -311,8 +311,12 @@ lCheckModuleIntrinsics(llvm::Module *module) { static void lSetInternalFunctions(llvm::Module *module) { const char *names[] = { + "__add_float", + "__add_int32", + "__add_uniform_double", "__add_uniform_int32", "__add_uniform_int64", + "__add_varying_double", "__add_varying_int32", "__add_varying_int64", "__aos_to_soa3_float", @@ -543,6 +547,10 @@ lSetInternalFunctions(llvm::Module *module) { "__svml_pow", "__undef_uniform", "__undef_varying", + "__vec4_add_float", + "__vec4_add_int32", + "__vselect_float", + "__vselect_i32", }; int count = sizeof(names) / sizeof(names[0]); diff --git a/expr.cpp b/expr.cpp index fd535bea..a87a26cc 100644 --- a/expr.cpp +++ b/expr.cpp @@ -3157,7 +3157,7 @@ IndexExpr::GetLValue(FunctionEmitContext *ctx) const { for (int i = 0; i < count; ++i) { if (indices[i] < 0 || indices[i] >= nElements) Warning(index->pos, "Array index \"%d\" may be out of bounds for " - "\"%d\" element array.", indices[i], nElements); + "%d element array.", indices[i], nElements); } } }