inline a function from a .s file?

C

Chris J. Mutter

hello,

is it possible to inline a function declared in a .s
file (i.e. a optimized version of sqrtl) within a main
program loop?

i used the intel c/c++ compiler as follows:

icc -O3 sqrtlof.c dbl_ext_sqrt.s -o sqrtlof

but objdump -d showed that there is still a call to
the function dbl_ext_sqrt() and the compiler report
states that the function could not be inlined because
its extern:

INLINING REPORT: (main)

-> dbl_ext_sqrt(EXTERN)

i defined the function as 'static inline'.

exactly the same behaviour when i use gcc on the same
machine.

regars,
cjm
 
W

Walter Roberson

is it possible to inline a function declared in a .s
file (i.e. a optimized version of sqrtl) within a main
program loop?

That's something you need to ask about in a newsgroup
that knows something about your compiler(s). The standard
C language doesn't know anything about .s files
 
J

jacob navia

Chris said:
hello,

is it possible to inline a function declared in a .s
file (i.e. a optimized version of sqrtl) within a main
program loop?

i used the intel c/c++ compiler as follows:

icc -O3 sqrtlof.c dbl_ext_sqrt.s -o sqrtlof

This is nonsense. How do you expect that that function
will be inlined by the compiler if you define it in
another file?

You should read the documentation of your compiler to
1) Figure out what is the method for using assembly within a
c function
2) Write your function using inline assembler like this
asm("movl foo,eax");
or whatever the compiler docs tell you (see step 1).
3) declare your function

static inline myasmfn(int n)
{
asm("movl %eax,%ecx");
...
}

and that *could* work.
 
C

Chris J. Mutter

On Thu, 10 May 2007 16:55:18 +0000 (UTC),

| In article <[email protected]>,
| >In article <[email protected]>,
| >>is it possible to inline a function declared in a .s
| >>file (i.e. a optimized version of sqrtl) within a main
| >>program loop?
| >
| >That's something you need to ask about in a newsgroup
| >that knows something about your compiler(s). The standard
| >C language doesn't know anything about .s files
|
| IOW, nobody here gives a shit about you or your problems.

and i thought comp.lang.c is full of helpful and nice people...

later,
cjm
 
T

Tim Prince

Chris said:
hello,

is it possible to inline a function declared in a .s
file (i.e. a optimized version of sqrtl) within a main
program loop?

i used the intel c/c++ compiler as follows:

icc -O3 sqrtlof.c dbl_ext_sqrt.s -o sqrtlof

This is a C compiler. Intel C++ is invoked by icpc.
Intel C supports in-lining across files only with specific options to
invoke that, and the code must be all C. Also, if you want 80-bit long
double, I believe you must specify that on command line.
You can't optimize sqrt any better than by allowing your compiler to use
the builtin sqrt().
I believe the FAQ would suggest you consult the documentation of your
compiler, before asking such questions. Then, if they don't fit the
usual c.l.c definition, go to a forum specific to your compiler:
http://softwarecommunity.intel.com/isn/Community/en-US/forums/1016/ShowForum.aspx
 
C

Christopher Benson-Manica

and i thought comp.lang.c is full of helpful and nice people...

You'll be better off ignoring Mr. McCormack. As you can see, he's not
a particularly nice or helpful individual.
 
R

Richard Heathfield

Chris J. Mutter said:
On Thu, 10 May 2007 16:55:18 +0000 (UTC),
and i thought comp.lang.c is full of helpful and nice people...

Alas, not /quite/ full. You just met one of the exceptions. Best not to
encourage them...
 
E

Eric Sosman

Chris J. Mutter wrote On 05/10/07 13:12,:
On Thu, 10 May 2007 16:55:18 +0000 (UTC),

| In article <[email protected]>,
| >In article <[email protected]>,
| >>is it possible to inline a function declared in a .s
| >>file (i.e. a optimized version of sqrtl) within a main
| >>program loop?
| >
| >That's something you need to ask about in a newsgroup
| >that knows something about your compiler(s). The standard
| >C language doesn't know anything about .s files
|
| IOW, nobody here gives a shit about you or your problems.

and i thought comp.lang.c is full of helpful and nice people...

Ah, you've met our McCormack. He lives under a
bridge and threatens to devour the Billy Goats Gruff.

http://www.pitt.edu/~dash/type0122e.html

He can also be found in killfiles.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,609
Members
45,253
Latest member
BlytheFant

Latest Threads

Top