Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > How to understand this function declaration: void ne10_fir_float_neon(const ne10_fir_instance_f32_t *S, ne10_float32_t *pSrc, ne10_float32_t*pDst, ne10_uint32_t blockSize) asm("ne10_fir_float_neon")

Reply
Thread Tools

How to understand this function declaration: void ne10_fir_float_neon(const ne10_fir_instance_f32_t *S, ne10_float32_t *pSrc, ne10_float32_t*pDst, ne10_uint32_t blockSize) asm("ne10_fir_float_neon")

 
 
fl
Guest
Posts: n/a
 
      01-12-2014
Hi,
I am using an ARM NEON library, which has several similar function declaration:

void ne10_fir_float_neon (const ne10_fir_instance_f32_t *S, ne10_float32_t *pSrc, ne10_float32_t *pDst, ne10_uint32_t blockSize) asm("ne10_fir_float_neon")

"ne10_fir_float_neon" shows two times above. I cannot understand it. Could you explain it to me?


Thanks,
 
Reply With Quote
 
 
 
 
BartC
Guest
Posts: n/a
 
      01-12-2014


"fl" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
> I am using an ARM NEON library, which has several similar function
> declaration:
>
> void ne10_fir_float_neon (const ne10_fir_instance_f32_t *S, ne10_float32_t
> *pSrc, ne10_float32_t *pDst, ne10_uint32_t blockSize)
> asm("ne10_fir_float_neon")
>
> "ne10_fir_float_neon" shows two times above. I cannot understand it. Could
> you explain it to me?


It's just a standard function definition that takes four parameters. The asm
bit at the end looks odd though, especially as it's not in {...} braces. The
name inside is presumably a macro or perhaps even an instruction.

But, are you using the right version of this library? The only reference I
found mentions also this other version:

void ne10_fir_float_c (const ne10_fir_instance_f32_t *S, ne10_float32_t
*pSrc, ne10_float32_t *pDst, ne10_uint32_t blockSize)

which is conventional C, and there's even a link to its definition (no asm
in sight). (http://projectne10.github.io/Ne10/doc/group__FIR.html)

--
Bartc

 
Reply With Quote
 
 
 
 
Eric Sosman
Guest
Posts: n/a
 
      01-12-2014
On 1/12/2014 2:12 PM, Richard Damon wrote:
> On 1/12/14, 11:02 AM, fl wrote:
>> Hi, I am using an ARM NEON library, which has several similar
>> function declaration:
>>
>> void ne10_fir_float_neon (const ne10_fir_instance_f32_t *S,
>> ne10_float32_t *pSrc, ne10_float32_t *pDst, ne10_uint32_t blockSize)
>> asm("ne10_fir_float_neon")
>>
>> "ne10_fir_float_neon" shows two times above. I cannot understand it.
>> Could you explain it to me?
>>
>>
>> Thanks,
>>

>
> Note, that while the asm keyword is reserved in the standard, and a
> syntax defined for its use, what it does and how it does it is
> implementation defined.


Nitpick: The Standard does not define `asm' as a keyword (see
6.4.1p1) or as a reserved identifier (7.1.3, K.3.1.2), nor does it
define any particular syntax.

The only mention of `asm' in the C11 draft I have (N1570) is
in J.5.10. Appendix J is marked as "informative" rather than as
"normative," so nothing therein is binding on any implementation.
Section J.5 is titled "Common extensions," and J.5.10 merely
describes "the most common" form an `asm' extension takes in those
(non-conforming, see 7.1.3p2 and J.5p1) implementations that provide
one; this is some ways short of defining a syntax.

> [...] You would need to
> read the documentation for your compiler to find out what it really means.


Right, because the C language says nothing about any meaning
it might have -- in short, it's not C.

--
Eric Sosman
http://www.velocityreviews.com/forums/(E-Mail Removed)d
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      01-12-2014
Richard Damon <(E-Mail Removed)> writes:
[...]
> Note, that while the asm keyword is reserved in the standard, and a
> syntax defined for its use, what it does and how it does it is
> implementation defined.


No, the asm keyword is not reserved.

The only mention of it in the lastest standard is in Annex J,
"Common extensions":

The asm keyword may be used to insert assembly language directly
into the translator output (6.. The most common implementation
is via a statement of the form:

asm (character-string-literal );

The introduction to that section says:

The following extensions are widely used in many systems, but
are not portable to all implementations. The inclusion of any
extension that may cause a strictly conforming program to become
invalid renders an implementation nonconforming. Examples of
such extensions are new keywords, [SNIP]

So a conforming implementation *cannot* treat "asm" as a keyword,
unless it does so in a carefully limited way (for example,
recognizing it only in a context where a non-reserved identifier
would not be allowed).

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      01-12-2014
fl <(E-Mail Removed)> writes:
> I am using an ARM NEON library, which has several similar function declaration:
>
> void ne10_fir_float_neon (const ne10_fir_instance_f32_t *S, ne10_float32_t *pSrc, ne10_float32_t *pDst, ne10_uint32_t blockSize) asm("ne10_fir_float_neon")
>
> "ne10_fir_float_neon" shows two times above. I cannot understand it. Could you explain it to me?


It's helpful to format your posts here so the text doesn't exceed about
72 columns. I know that a lot of forums don't use explicit line breaks;
this one does.

Reformatting your code for better readability:

void ne10_fir_float_neon
(const ne10_fir_instance_f32_t *S,
ne10_float32_t *pSrc,
ne10_float32_t *pDst,
ne10_uint32_t blockSize)
asm("ne10_fir_float_neon")

The first part of that is an ordinary function declaration, possibly the
initial part of a function *definition*. (A definition would normally
have the code that implements the function enclosed in { and }.)
Presumably the types ne10_fir_instance_f32_t, ne10_float32_t, and
ne10_uint32_ are defined elsewhere.

The last line is non-standard, but it's not uncommon for C compilers to
treat "asm" as an additional keyword that specifies inline assembly
language. My best guess is that

asm("ne10_fir_float_neon")

is a directive specifying that that function is defined elsewhere in
assembly language, but you'll have to consult your compiler's
documentation to find out exactly what it means.

(Are you by any chance missing a semicolon or two?)

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
James Kuyper
Guest
Posts: n/a
 
      01-13-2014
On 01/12/2014 11:02 AM, fl wrote:
> Hi,
> I am using an ARM NEON library, which has several similar function declaration:
>
> void ne10_fir_float_neon (const ne10_fir_instance_f32_t *S, ne10_float32_t *pSrc, ne10_float32_t *pDst, ne10_uint32_t blockSize) asm("ne10_fir_float_neon")
>
> "ne10_fir_float_neon" shows two times above. I cannot understand it. Could you explain it to me?


No one has directly addressed the main issue you were raising, the two
different occurrences of ne10_fir_float_neon in that code. The first
occurrence simply provides the name for the function being declared. If
'asm' is a macro, then the second occurrence is simply a string literal,
and you'll need to find out how asm is #defined in order to determine
what the significance of that string literal is. It's more likely,
however, that 'asm' is the keyword that implements a non-standard
extension to C; in that case, "ne10_fir_float_neon" might or might not
be a string literal - the quote marks might simply be part of the syntax
associated with the asm keyword. You'll need to find which compiler that
code was intended to be compiled by, and look at that compiler's
documentation to find out what 'asm' will do with "ne10_fir_float_neon".
--
James Kuyper
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I encode and decode this data to write to a file? cl@isbd.net Python 11 05-01-2013 11:36 PM
Sunday 18th 12N-3P PDST Global Python Mtg - BerkeleyTIP - forforwarding john_re Python 0 10-18-2009 08:45 AM
is const necessary in eg int compar(const void *, const void *) lovecreatesbeauty@gmail.c0m C Programming 26 11-10-2008 09:47 PM
"void Method()" vs "void Method(void)" Ollej Reemt C++ 7 04-22-2005 03:47 AM
Function parameter in: "void __cdecl Function(class Class1 *,float const (* const)[4]);" Polanski24 C++ 1 04-11-2005 12:48 PM



Advertisments