pekka.jaaskelainen added inline comments.
================ Comment at: docs/UsersManual.rst:2065 + + $ clang -cc1 -triple spir64-unknown-unknown -cl-ext=-cl_khr_fp64 test.cl + ---------------- Anastasia wrote: > pekka.jaaskelainen wrote: > > Is this correct? I cannot make it work: > > > > ``` > > ~/local/stow/llvm-4.0-unpatched-Debug/bin/clang -Xclang > > -finclude-default-header -emit-llvm -cc1 -triple spir64-unknown-unknown > > kernel/test_halfs.cl -c -S -o - > > clang-4.0: error: unknown argument: '-cc1' > > clang-4.0: error: unknown argument: '-triple' > > clang-4.0: error: no such file or directory: 'spir64-unknown-unknown' > > ``` > > > > -target works instead. (But reveals another issue, there's no printf() > > declaration, should I file a bug?) > > > > ``` > > ~/local/stow/llvm-4.0-unpatched-Debug/bin/clang -Xclang > > -finclude-default-header -emit-llvm -target spir64-unknown-unknown > > kernel/test_halfs.cl -c -S -o - > > kernel/test_halfs.cl:10:9: warning: implicit declaration of function > > 'printf' is invalid in C99 [-Wimplicit-function-declaration] > > printf("max(a,b)[0] type=uint2 a=0x15b348c9 b=0xf88e7d07 > > want=0xf88e7d07 got=%x\n", max_[0]); > > ^ > > kernel/test_halfs.cl:10:9: error: function with no prototype cannot use the > > spir_function calling convention > > 1 warning and 1 error generated. > > ``` > > > > With 3.9 that kernel which calls printf() passes: > > ``` > > /local/stow/llvm-3.9-debug/bin/clang -Xclang -finclude-default-header > > -emit-llvm -target spir64-unknown-unknown kernel/test_halfs.cl -c -S -o - > > ; ModuleID = 'kernel/test_halfs.cl' > > source_filename = "kernel/test_halfs.cl" > > target datalayout = > > "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" > > target triple = "spir64-unknown-unknown" > > .... > > ``` > > > > > > > It should be -triple with -cc1 and -target without. > > clang -cc1 -triple ... > clang -target ... > > We have disabled the C99 builtin functions as per spec v1.2 s6.9.f, but the > OpenCL builtins should be available via the header now. > > As I can see declaration of printf is in the header under CL1.2 and higher. > > Could you try this command instead: > clang -std=CL1.2 test.cl -Xclang -finclude-default-header > Yes, std=CL1.2 helped, good point! But -cc1 -triple doesn't work (unknown argument). However -target works. This is with Clang 4.0. https://reviews.llvm.org/D28080 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits