Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/bench/omc_efficiency/kernels/leafcall.c # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / bench / omc_efficiency / kernels / leafcall.c` 24 lines ยท 1205 bytes Raw Blame History 1 /* leafcall.c -- REFERENCE TWIN ONLY (gcc oracle) of kernels/leafcall.om: same calls, same output. 2 noinline keeps the call a call, as in the Omega kernel. */ 3 #include 4 #include 5 #include 6 static void putnum(uint64_t v) { printf("%llu\n", (unsigned long long)v); } 7 /* OMC-EFF-2: the computation is timed in process with CLOCK_MONOTONIC and the nanoseconds go to stderr. 8 The empty asm statements are compiler barriers: they keep the timed work between the two clock reads. */ 9 static uint64_t nowns(void) { struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); return (uint64_t)t.tv_sec * 1000000000u + (uint64_t)t.tv_nsec; } 10 static void putns(uint64_t t0, uint64_t t1) { fprintf(stderr, "%llu\n", (unsigned long long)(t1 - t0)); } 11 static __attribute__((noinline)) uint64_t mix(uint64_t x, uint64_t k) { return (x * k) ^ (x >> 5); } 12 int main(void) { 13 uint64_t t0 = nowns(); 14 uint64_t s = 1, t = 0; 15 __asm__ volatile("" : "+r"(s), "+r"(t)); 16 for (uint64_t i = 0; i < 30000000u; i++) { 17 s += mix(i, 2654435761u); 18 t ^= s; 19 } 20 __asm__ volatile("" : : "r"(s), "r"(t) : "memory"); 21 putns(t0, nowns()); 22 putnum(s); putnum(t); 23 return 0; 24 }