Last active
May 29, 2017 20:42
-
-
Save mfleming/c55bc466d0d359f6ef5799eb3c0b1446 to your computer and use it in GitHub Desktop.
LMBench ops model example
This file contains 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
#include <stdint.h> | |
#define TEN(a) a a a a a a a a a a | |
static volatile uint64_t use_result_dummy; | |
void | |
use_int(int result) { use_result_dummy += result; } | |
void | |
do_int64_mul(unsigned int iterations, unsigned int N) | |
{ | |
register int64_t r = (int64_t)N + 37420; | |
register int64_t s = (int64_t)N + 4; | |
register int64_t t; | |
r += (int64_t)(N + 6)<<32; | |
t = r * s * s * s * s * s * s * s * s * s * s - r; | |
while (iterations-- > 0) { | |
TEN(r *= s;); r -= t; | |
TEN(r *= s;); r -= t; | |
} | |
use_int((int)r); | |
} | |
int main(int argc, char **argv) | |
{ | |
int i; | |
for (i = 0; i < 30; i++) | |
do_int64_mul(153592747 ,1); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment