Handmade Hero»Forums»Code
39 posts
cross platform diff/xcb
Edited by people on
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.
Kim
Kim Jørgensen
64 posts
cross platform diff/xcb
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
39 posts
cross platform diff/xcb
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();
Kim
Kim Jørgensen
64 posts
cross platform diff/xcb
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?
39 posts
cross platform diff/xcb
I've updated the diff to be against after day 121 and cleaned it up.
Neil Blakey-Milner
45 posts
cross platform diff/xcb
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
39 posts
cross platform diff/xcb
Edited by people on
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.
39 posts
cross platform diff/xcb
@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.