[Cbe-oss-dev] spu-gcc inline asm
Phil Pratt-Szeliga
pcpratts at syr.edu
Sat Jul 18 01:27:01 EST 2009
Hi,
Yes, I just figured that out by playing with the r and setting it to g.
This works:
asm ("lr $3,%0;\t\n\
brsl $0, function1;"
: /* no output args */
: "r" (arg1)
);
I don't have a webpage yet, I plan to write one during my user
documentation phase at the end.
I am working to create the framework for OpenCL. OpenCL is a new
standard by the same group
that brought OpenGL, etc. It's purpose is to have one language that
can be compiled onto
the CPU, Cell and GPU and a runtime to supply thread ids, barriers,
etc. I am working on
a small subset that doesn't include the OpenCL C compiler (yet). For
part of my doctoral work
I am going to be making a source to source compiler to go from OpenCL
C to CPU/GPU/Cell.
My git repository is at:
http://github.com/pcpratts/gcc_opencl/tree/master if you want to take
a look. Right now hardly works on the cell and the cpu is coming
along. Even after gsoc is over
I hope to be the maintainer for this.
Phil Pratt-Szeliga
On Fri, Jul 17, 2009 at 11:17 AM, Brian Watt<bwatt at us.ibm.com> wrote:
>
> Hi Phil,
>
> Compiling with -S options produces an assember output and the error is
> coming from an andbi $3,$3,$2 which thinks that $2 is an immediate value and
> not a register, change andbi to andb at the minimum. Note: I'm interested in
> learning more about your SoC project. Do you have a webpage?
>
> Brian Watt, IBM
>
>
> Phil Pratt-Szeliga <pcpratts at syr.edu>
> Sent by: cbe-oss-dev-bounces+bwatt=us.ibm.com at lists.ozlabs.org
>
> 07/17/2009 09:32 AM
>
> To
> cbe-oss-dev at lists.ozlabs.org
> cc
> Subject
> [Cbe-oss-dev] spu-gcc inline asm
>
>
>
>
> Hello,
>
> I am doing something for google summer of code (I am working on opencl
> for gcc) and I am having trouble jumping
> to a function that is downloaded at runtime.
>
> The first step is to jump to a function with arguments. It works
> using inline assembly using no arguments, but I can't
> figure out how to make it work with an argument. Is the spu-gcc
> inline assembly syntax different?
>
> Sincerely,
> Phil Pratt-Szeliga
>
>
> /* spu_example.c */
> /* compile with: spu-gcc spu_example.c*/
>
> void function1(unsigned long long arg)
> {
> printf("hello world %llu\n", arg);
> }
>
> int main(unsigned long long spe_id, unsigned long long
> program_data_ea, unsigned long long env) {
>
> /* works fine */
> function1(10);
>
> /* works fine */
> unsigned long long arg1 = 20;
> asm("andbi $3,$3,20;\
> brsl $0, function1;");
>
> /* gives me the compiler error #1 */
> asm ("andbi $3,$3,%0"
> : /* no output args */
> : "r" (arg1)
> );
> asm("brsl $0, function1");
> }
>
>
> /* Compiler error #1:
>
> /tmp/ccyF7J51.s: Assembler messages:
> /tmp/ccyF7J51.s:249: Warning: Treating '$2' as a symbol.
> /tmp/ccmkHyG2.o: In function `main':
> spu.c:(.text+0x3a0): undefined reference to `$2'
> collect2: ld returned 1 exit status
>
> */
> _______________________________________________
> cbe-oss-dev mailing list
> cbe-oss-dev at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/cbe-oss-dev
>
>
More information about the cbe-oss-dev
mailing list