Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

How to inline C string functions

jpburke
Beginner
700 Views
Is there a way to inline C library string functions like strcpy and strcmp? I'm assuming ICC does have inline-able versions of these functions?

Thanks.
0 Kudos
4 Replies
TimP
Honored Contributor III
700 Views
Quoting - jpburke
Is there a way to inline C library string functions like strcpy and strcmp? I'm assuming ICC does have inline-able versions of these functions?

If you look at the icc header files, you will see that there are special sse4.2 strcmp intrinsics in You could look up the white papers on the subject.
In libirc, you will find sse2 and sse4 versions of strcpy(); unlike memcpy(), the function isn't amenable to in-lining, even for specific short constant string lengths, although you are welcome to supply your own source code.
0 Kudos
JenniferJ
Moderator
700 Views
Compiler will decide what's best to use in the code. Different places may use different strcpy. It depends on the length of the string, and there're many versions of strcpy/strcmp etc.

So just try different options, and see which one gives you the best performance on your targeted system.

Jennifer

0 Kudos
jpburke
Beginner
700 Views
Compiler will decide what's best to use in the code. Different places may use different strcpy. It depends on the length of the string, and there're many versions of strcpy/strcmp etc.

So just try different options, and see which one gives you the best performance on your targeted system.

Jennifer

Is there a compiler option that will output which function calls have been replaced with intrinic functions?

Thanks
0 Kudos
Om_S_Intel
Employee
700 Views
Quoting - jpburke
Is there a compiler option that will output which function calls have been replaced with intrinic functions?

Thanks

There is no such documented option.
0 Kudos
Reply