On-line engine blitz tourney June

Discussion of chess software programming and technical issues.

Moderator: Ras

AlvaroBegue
Posts: 932
Joined: Tue Mar 09, 2010 3:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)

Re: On-line engine blitz tourney June

Post by AlvaroBegue »

D Sceviour wrote:
AlvaroBegue wrote:Why are you guys calling these things in assembly? I use built-in functions like __builtin_ctzll and I don't have to worry about such low-level details as what bits in rax are set by some instruction. I thought everyone would be using built-in functions these days.
The problem with built-in function is they are too big. They are subroutines that push and pull stuff off the stack. The stack pointer has to be reset. They might include error and bound tests. They might perform thread locks. Tight hand coded routines are preferable for things like a move generator. Why use a hundred instructions when one will do?
Have you actually tried using built-in functions? Give them I try and look at the assembly the compiler generates, with optimizations enabled, of course. I don't see any function calls, any manipulation of the stack, any error checking or anything of the sort. I think you might need to get more comfortable with how well modern compilers can do these things.
jdart
Posts: 4420
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: On-line engine blitz tourney June

Post by jdart »

Intrinsics (aka builtins as GNU calls them) are different from library functions.

The compiler will produce the instructions inline.

And as another poster noted, there is no real reason not to use the builtins, although there is no common naming convention or syntax for these across compilers. I have a bunch of #ifdefs to select the right one. But my Linux code uses inline assembly by default, largely for historical reasons.

--Jon