This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code to test how well compilers optimize division by constants | |
// See: http://ridiculousfish.com/blog/posts/labor-of-division-episode-iii.html | |
// gcc -std=gnu11 -Wall -Wextra -O3 constant_division.c -o constant_division | |
// objdump -d constant_division | less | |
#ifndef COUNT | |
#define COUNT (1000 * 1000) | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gcc -fno-inline -std=gnu99 -Wall -O3 align.c -o align -lm -DLIKWID -llikwid -lpthread | |
// objdump -d align | less (to confirm that the code hasn't been optimized out) | |
// likwid -m -C2 -g BRANCH align | |
#include <math.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#ifndef ALIGN | |
#define ALIGN 8 |
NewerOlder