Page 1 of 1

SDL frontend: compiling asm hq filters

Posted: Sun Jun 08, 2008 1:45 pm
by mnk

First of all, it seems that cmake 2.6.0 is required to do it,

cause for some reason I was unable to use them, till I upgraded.

Now, a question: why does compiling of c version take a few orders of magnitude more time than the asm version ?

And a minor annoyance:

unless I add '-w-orphan-labels' in CMakeLists.txt, I'm flooded with warnings while I compile those filters.


This is a reply, cause otherwise I'd have to rewrite most of first post.

It looks like it's not only version problem, I have to delete CMakeFiles/CMakeASMCompiler.cmake first time it's generated and rerun cmake to get it to work.

Also, it looks like a certain block in CMakeLists.txt should actually loke like this:

Code: Select all

IF( NOT USE_ASM_CORE )
   ADD_DEFINITIONS (-DC_CORE)
ELSE ( NOT USE_ASM_CORE )
   ADD_DEFINITIONS (-UC_CORE)
ENDIF( NOT USE_ASM_CORE )

to work correctly.

 

Well, there are actually at least two problems:

the one above is caused by following line:

Code: Select all

ADD_DEFINITIONS (-DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DHAVE_ZLIB_H -DFINAL_VERSION -DBKPT_SUPPORT -DSDL -DUSE_OPENGL -DC_CORE -DSYSCONFDIR='"${SYSCONFDIR}"')

-DC_CORE should be removed

the other is that that quoting of defines in incorrect, cmake_policy( SET CMP0005 NEW ) doesn't work together with current quoting style of CMakeLists.txt.


SDL frontend: compiling asm hq filters

Posted: Sun Jun 08, 2008 2:45 pm
by xKiv

Now, a question: why does compiling of c version take a few orders of magnitude more time than the asm version ?

Possibly because (most modern) C compilers are optimizing (and spend a lot of time generating "best" machine code for your processor), whereas assembler compilers usually aren't (and generate the code the programmer (or even coder) thought would be best).

 

It looks like it's not only version problem, I have to delete CMakeFiles/CMakeASMCompiler.cmake first time it's generated and rerun cmake to get it to work.

 

This is the intended behavior for cmake.

 

Also, it looks like a certain block in CMakeLists.txt should actually loke like this:

Code: Select all

IF( NOT USE_ASM_CORE )
   ADD_DEFINITIONS (-DC_CORE)
ELSE ( NOT USE_ASM_CORE )
   ADD_DEFINITIONS (-UC_CORE)
ENDIF( NOT USE_ASM_CORE )

<div>

to work correctly.

</div>

 

You are probably right (there's an unconditional ADD_DEFINITIONS (... -DC_CORE ...)), but I will leave this to somebody who knows.


SDL frontend: compiling asm hq filters

Posted: Sun Jun 08, 2008 3:36 pm
by mnk

The catch is that I meant:

I have to run cmake, delete CMakeFiles/CMakeASMCompiler.cmake first time it's generated and rerun cmake to get it to work.

And it should either set that policy to old or require cmake 2.6.0.


SDL frontend: compiling asm hq filters

Posted: Sun Jun 08, 2008 4:27 pm
by xKiv

The catch is that I meant:

I have to run cmake, delete CMakeFiles/CMakeASMCompiler.cmake first time it's generated and rerun cmake to get it to work.

And it should either set that policy to old or require cmake 2.6.0.

 

Without deleting CMakeCache.txt?

Well, that's supposedly to be expected from cmake sometimes ... but I still don't see why, this time.

 


 

How does it fail?

What's in your generated CMakeFiles/CMakeASMCompiler.cmake after the first run and then after the second run?


SDL frontend: compiling asm hq filters

Posted: Sun Jun 08, 2008 4:47 pm
by bgK

Ooops looks like I broke CMake quite severely.

Thanks for your comments.

Does rev 571 work better ?


SDL frontend: compiling asm hq filters

Posted: Mon Jun 09, 2008 8:05 am
by mnk

It does work better, but that asm problem is still there.

The incorrect CMakeFiles/CMakeASMCompiler.cmake:

Code: Select all

SET(CMAKE_ASM_COMPILER "/usr/bin/nasm")
SET(CMAKE_ASM_COMPILER_ARG1 "")
SET(CMAKE_AR "/usr/bin/ar")
SET(CMAKE_RANLIB "/usr/bin/ranlib")
SET(CMAKE_LINKER "/usr/bin/ld")
SET(CMAKE_ASM_COMPILER_LOADED 1)
SET(CMAKE_ASM_COMPILER_ENV_VAR "ASM")

SET(CMAKE_ASM_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
SET(CMAKE_ASM_LINKER_PREFERENCE 0)

the correct one:

Code: Select all

SET(CMAKE_ASM_COMPILER "/usr/bin/nasm")
SET(CMAKE_ASM_COMPILER_LOADED 1)
SET(CMAKE_ASM_COMPILER_ENV_VAR "ASM")

SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS nasm;asm;nas)
SET(CMAKE_ASM_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
SET(CMAKE_ASM_LINKER_PREFERENCE None)
IF(UNIX)
       SET(CMAKE_ASM_OUTPUT_EXTENSION .o)
ELSE(UNIX)
       SET(CMAKE_ASM_OUTPUT_EXTENSION .obj)
ENDIF(UNIX)

This looks like a conflict between files in CMakeScripts and those provided by cmake 2.6.0.


SDL frontend: compiling asm hq filters

Posted: Mon Jun 09, 2008 3:36 pm
by Nach

I can confirm I have this problem with r571 too.