cross platform diff/xcb

Added support for sse2, rdtsc, and iaca on *nix. Should work with gcc and clang but I didn't test with clang. See the attachment for the diff against the end of day 120.

It would be helpful if this or something like it were integrated on the stream.

maybe this rdtsc def is better?
alternateTSC - http://www-unix.mcs.anl.gov/~kazutomo/rdtsc.html

Also updated xcb_handmade to day 120 and sent a pull request to the maintainer.

The address is https://github.com/manypeople/xcb_handmade

edit:
I forgot to mention, though it doesn't seem to matter on windows, on *nix
the "IACA_END" needs to be outside the end of the loop IACA_START is in. You
can see the IACA manual for details.

Edited by people on
Why do we need a different rdtsc definition for each compiler when MSVC, LLVM and GCC all support the __rdtsc operation? Or maybe a better alternative is to use _rdtsc as this is the format defined in the Intel Intrinsics Guide?

https://forums.handmadehero.org/i...p/forum?view=topic&catid=4&id=539
Good point :)

Then the section in handmade_platform.h
1
2
3
extern struct game_memory *DebugGlobalMemory;
#if _MSC_VER
#define BEGIN_TIMED_BLOCK(ID) uint64 StartCycleCount##ID = __rdtsc();


could be changed to either remove the #if or:
1
2
3
extern struct game_memory *DebugGlobalMemory;
#if _MSC_VER || __GNUC__ || __clang__
#define BEGIN_TIMED_BLOCK(ID) uint64 StartCycleCount##ID = __rdtsc();
Yes, something like that B)

As someone was pointing out, the COMPILER_X flags should be used if we for some reason would like a compiler specific version of these functions.

@Casey For now all non MSVC compilers default to COMPILER_LLVM which makes the “SEE/NEON optimizations are not available for this compiler” error useless. Could you please add a COMPILER_GCC flag?
I've updated the diff to be against after day 121 and cleaned it up.
people

Also updated xcb_handmade to day 120 and sent a pull request to the maintainer.


Hey there!

I don't see a pull request in GitHub. I'd be happy to review and apply if you send me one.

Thanks!

Neil
Hi, I sent a git (not github) pull request to your email address, I've updated the repository since then, I'll try sending a github pull request.

edit:
you should be able to run:
1
git pull https://github.com/manypeople/xcb_handmade.git master


I'm still trying to work out the github pull request.

edit2:
I think beacause I didn't fork in the github interface, it won't let me select your repository in the "Comparing changes" section to do a pull request.

I attached an updated git pull request below.

Edited by people on
@nxsy

I deleted my github repository and forked a new one from yours.

This made it possible to create a github pull request against your repository.

I also merged some commits of yours that I didn't notice.