473,326 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

inline a function from a .s file?

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
--
"God save the queen
and her fascist regime" -- Sex Pistols
May 10 '07 #1
10 1581
In article <sl************************@s2.enemy.org>,
Chris J. Mutter <cj********@s2.enemy.orgwrote:
>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
--
Prototypes are supertypes of their clones. -- maplesoft
May 10 '07 #2
Chris J. Mutter wrote:
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.
May 10 '07 #3
In article <f1*********@canopus.cc.umanitoba.ca>,
Walter Roberson <ro******@ibd.nrc-cnrc.gc.cawrote:
>In article <sl************************@s2.enemy.org>,
Chris J. Mutter <cj********@s2.enemy.orgwrote:
>>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.

You may find some or all of the following links helpful in understanding
why this is so:

http://en.wikipedia.org/wiki/Aspergers
http://en.wikipedia.org/wiki/Clique
http://en.wikipedia.org/wiki/C_programming_language

May 10 '07 #4
On Thu, 10 May 2007 16:55:18 +0000 (UTC),
Kenny McCormack <ga*****@xmission.xmission.comwrote:

| In article <f1*********@canopus.cc.umanitoba.ca>,
| Walter Roberson <ro******@ibd.nrc-cnrc.gc.cawrote:
| >In article <sl************************@s2.enemy.org>,
| >Chris J. Mutter <cj********@s2.enemy.orgwrote:
| >>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
--
"God save the queen
and her fascist regime" -- Sex Pistols
May 10 '07 #5
Chris J. Mutter wrote:
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/i...ShowForum.aspx
May 10 '07 #6
Chris J. Mutter <cj********@s2.enemy.orgwrote:
Kenny McCormack <ga*****@xmission.xmission.comwrote:
(the usual)
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.

--
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gmail.com | don't, I need to know. Flames welcome.
May 10 '07 #7
Chris J. Mutter said:
On Thu, 10 May 2007 16:55:18 +0000 (UTC),
Kenny McCormack <ga*****@xmission.xmission.comwrote:
<the usual troll junk>
>
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...

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
May 10 '07 #8
Chris J. Mutter wrote On 05/10/07 13:12,:
On Thu, 10 May 2007 16:55:18 +0000 (UTC),
Kenny McCormack <ga*****@xmission.xmission.comwrote:

| In article <f1*********@canopus.cc.umanitoba.ca>,
| Walter Roberson <ro******@ibd.nrc-cnrc.gc.cawrote:
| >In article <sl************************@s2.enemy.org>,
| >Chris J. Mutter <cj********@s2.enemy.orgwrote:
| >>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.

--
Er*********@sun.com
May 10 '07 #9
"Chris J. Mutter" wrote:
Kenny McCormack <ga*****@xmission.xmission.comwrote:
.... snip ...
>|
| IOW, nobody here gives a shit about you or your problems.

and i thought comp.lang.c is full of helpful and nice people...
McCormack is a known troll. Ignore it.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
<http://kadaitcha.cx/vista/dogsbreakfast/index.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

May 11 '07 #10
In article <46***************@yahoo.com>,
CBFalconer <cb********@maineline.netwrote:
>"Chris J. Mutter" wrote:
>Kenny McCormack <ga*****@xmission.xmission.comwrote:
... snip ...
>>|
| IOW, nobody here gives a shit about you or your problems.

and i thought comp.lang.c is full of helpful and nice people...
Now, you know better.
>McCormack is a known troll. Ignore it.
Or enjoy it. You need someone to poke holes in these stuffed shirts.

May 11 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

47
by: Richard Hayden | last post by:
Hi, I have the following code: /******************************** file1.c #include <iostream> extern void dummy(); inline int testfunc() {
21
by: Rubén Campos | last post by:
I haven't found any previous message related to what I'm going to ask here, but accept my anticipated excuses if I'm wrong. I want to ask about the real usefulness of the 'inline' keyword. I've...
7
by: Srini | last post by:
Hello, Rules for inline functions say that they have to be defined in the same compilation unit as their declarations. For class member functions this means that the inline member functions must...
6
by: John Ratliff | last post by:
I was reading the C++ FAQ Lite about inline functions, and it says the following (http://www.parashift.com/c++-faq-lite/inline-functions.html#faq-9.7) " It's usually imperative that the...
6
by: RainBow | last post by:
Greetings!! I introduced the so-called "thin-template" pattern for controlling the code bloat caused due to template usage. However, one of the functions in the template happens to be virtual...
4
by: Nish | last post by:
Hi, I have a question regarding inline functions in C. If I declare a function as inline in the header file but do not define it there. Then I define that function in .c file, however neither...
6
by: Sharon | last post by:
Usually it is common to write the class member function in the class H file, but some people like to write the function body in the C++ file. Can anybody tell me what are the cases where inline...
3
by: Bilgehan.Balban | last post by:
Hi, My observation was that a function with `inline' qualifier has file scope in C++ and it's symbol is not exported. Contrary to this, in C an `inline' function symbol is exported, unless it...
9
by: Bilgehan.Balban | last post by:
Hi, If I define an inline function in one .c file, and use it from another, after compiling and linking the two, it seems the function is not inlined but rather called as a regular function. I...
7
by: Wu Shaohua | last post by:
Hi Guys, 1. As we know usually we should not define a constructor as inline. I also learned if we define a member function inside the class this member function will be automatically be...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.