buliding for arm or x86_64

Hi,

I am trying to build libclc for arm or x86_64 by slightly modifying the configure file(adding x86_64 and arm as available target).

I just bumped into some problems: It can’t build all the functions correctly.

x86_64: cross.cl dot.cl fmax.cl, fmin.cl … etc are ok. When it comes to hypot.cl, it fails.

the following are the error msg.

LLVM-CC x86_64–linux/lib/math/hypot.cl.bc
Intrinsic name not mangled correctly for type arguments!
double (double)* @llvm.sqrt.v2f32
Broken module found, compilation aborted!
0 libLLVM-3.4svn.so 0x00002ae689a530f2 llvm::sys::PrintStackTrace(_IO_FILE*) + 34
1 libLLVM-3.4svn.so 0x00002ae689a524d9
2 libpthread.so.0 0x00002ae68aa6fcb0
3 libc.so.6 0x00002ae68b1ca425 gsignal + 53
4 libc.so.6 0x00002ae68b1cdb8b abort + 379
5 libLLVM-3.4svn.so 0x00002ae689284838
6 libLLVM-3.4svn.so 0x00002ae689292523
7 libLLVM-3.4svn.so 0x00002ae689269e2f llvm::FPPassManager::runOnFunction(llvm::Function&) + 607
8 libLLVM-3.4svn.so 0x00002ae689269f67 llvm::FunctionPassManagerImpl::run(llvm::Function&) + 167
9 libLLVM-3.4svn.so 0x00002ae68926a11d llvm::FunctionPassManager::run(llvm::Function&) + 205
10 clang 0x0000000000765125 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 3429
11 clang 0x00000000007626cd
12 clang 0x000000000090a1b4 clang::ParseAST(clang::Sema&, bool, bool) + 372
13 clang 0x00000000005dc45a clang::FrontendAction::Execute() + 282
14 clang 0x00000000005bf6f0 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 352
15 clang 0x00000000005a54ea clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1722
16 clang 0x000000000059e850 cc1_main(char const**, char const**, char const*, void*) + 1232
17 clang 0x000000000059ce0e main + 622
18 libc.so.6 0x00002ae68b1b576d __libc_start_main + 237
19 clang 0x000000000059e211
Stack dump:
0. Program arguments: /home/mtk04454/packages/llvm-svn/bin/clang -cc1 -triple x86_64–linux -emit-llvm-bc -disable-free -main-file-name hypot.cl -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version 2.22 -coverage-file /home/mtk04454/libclc.build/x86_64–linux/lib/math/hypot.cl.bc -resource-dir /home/mtk04454/packages/llvm-svn/bin/…/lib/clang/3.4 -dependency-file x86_64–linux/lib/math/hypot.cl.bc.d -MT x86_64–linux/lib/math/hypot.cl.bc -D cl_clang_storage_class_specifiers -D cl_khr_fp64 -I …/libclc/generic/lib/math -I …/libclc/generic/include -internal-isystem /usr/local/include -internal-isystem /home/mtk04454/packages/llvm-svn/bin/…/lib/clang/3.4/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/mtk04454/libclc.build -ferror-limit 19 -fmessage-length 0 -mstackrealign -fobjc-runtime=gcc -fobjc-default-synthesize-properties -fdiagnostics-show-option -vectorize-slp -o x86_64–linux/lib/math/hypot.cl.bc -x cl …/libclc/generic/lib/math/hypot.cl

  1. parser at end of file
  2. Per-function optimization
  3. Running pass ‘Module Verifier’ on function ‘@Z5hypotDv2_fS
    clang: error: unable to execute command: Aborted (core dumped)
    clang: error: clang frontend command failed due to signal (use -v to see invocation)
    clang version 3.4 (trunk 188858)
    Target: x86_64–linux
    Thread model: posix

Does anyone know how to build libclc for arm or x86_64 correctly?

  Does libclc support arm/x86 already?

Hi,

I am trying to build libclc for arm or x86_64 by slightly modifying the
configure file(adding x86_64 and arm as available target).

I just bumped into some problems: It can't build all the functions
correctly.

x86_64: cross.cl dot.cl fmax.cl, fmin.cl ... etc are ok. When it comes to
hypot.cl, it fails.

the following are the error msg.

LLVM-CC x86_64--linux/lib/math/hypot.cl.bc
Intrinsic name not mangled correctly for type arguments!
double (double)* @llvm.sqrt.v2f32
Broken module found, compilation aborted!
0 libLLVM-3.4svn.so 0x00002ae689a530f2
llvm::sys::PrintStackTrace(_IO_FILE*) + 34
1 libLLVM-3.4svn.so 0x00002ae689a524d9
2 libpthread.so.0 0x00002ae68aa6fcb0
3 libc.so.6 0x00002ae68b1ca425 gsignal + 53
4 libc.so.6 0x00002ae68b1cdb8b abort + 379
5 libLLVM-3.4svn.so 0x00002ae689284838
6 libLLVM-3.4svn.so 0x00002ae689292523
7 libLLVM-3.4svn.so 0x00002ae689269e2f
llvm::FPPassManager::runOnFunction(llvm::Function&) + 607
8 libLLVM-3.4svn.so 0x00002ae689269f67
llvm::FunctionPassManagerImpl::run(llvm::Function&) + 167
9 libLLVM-3.4svn.so 0x00002ae68926a11d
llvm::FunctionPassManager::run(llvm::Function&) + 205
10 clang 0x0000000000765125
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 3429
11 clang 0x00000000007626cd
12 clang 0x000000000090a1b4 clang::ParseAST(clang::Sema&, bool,
bool) + 372
13 clang 0x00000000005dc45a clang::FrontendAction::Execute() +
282
14 clang 0x00000000005bf6f0
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 352
15 clang 0x00000000005a54ea
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1722
16 clang 0x000000000059e850 cc1_main(char const**, char
const**, char const*, void*) + 1232
17 clang 0x000000000059ce0e main + 622
18 libc.so.6 0x00002ae68b1b576d __libc_start_main + 237
19 clang 0x000000000059e211
Stack dump:
0. Program arguments: /home/mtk04454/packages/llvm-svn/bin/clang -cc1
-triple x86_64--linux -emit-llvm-bc -disable-free -main-file-name
hypot.cl-mrelocation-model static -mdisable-fp-elim -fmath-errno
-masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64
-target-linker-version 2.22 -coverage-file
/home/mtk04454/libclc.build/x86_64--linux/lib/math/hypot.cl.bc
-resource-dir /home/mtk04454/packages/llvm-svn/bin/../lib/clang/3.4
-dependency-file x86_64--linux/lib/math/hypot.cl.bc.d -MT
x86_64--linux/lib/math/hypot.cl.bc -D cl_clang_storage_class_specifiers -D
cl_khr_fp64 -I ../libclc/generic/lib/math -I ../libclc/generic/include
-internal-isystem /usr/local/include -internal-isystem
/home/mtk04454/packages/llvm-svn/bin/../lib/clang/3.4/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /home/mtk04454/libclc.build -ferror-limit 19
-fmessage-length 0 -mstackrealign -fobjc-runtime=gcc
-fobjc-default-synthesize-properties -fdiagnostics-show-option
-vectorize-slp -o x86_64--linux/lib/math/hypot.cl.bc -x cl
../libclc/generic/lib/math/hypot.cl
1. <eof> parser at end of file
2. Per-function optimization
3. Running pass 'Module Verifier' on function '@_Z5hypotDv2_fS_'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.4 (trunk 188858)
Target: x86_64--linux
Thread model: posix

===

It says it does not mangle correctly, but it does not show up at r600 and
ptx.

This looks like it might be a bug in clang. You should file a bug at
llvm.org/bugs and post clang's debug files from /tmp

Does anyone know how to build libclc for arm or x86_64 correctly?

I'm not sure if anyone has tried this before, but it should work. If
you remove hypot.ll from generic/lib/SOURCES and reconfigure, does
everything build correctly?

-Tom