kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

asm_popcnt.c (351B)


      1 /* Wasm-target structural check: inline asm with a WAT template.
      2  * The snippet pops the input local (index 0), runs i32.popcnt, and
      3  * stores the result into the output local (index 1). */
      4 int popcnt(int x) {
      5   int r;
      6   __asm__ volatile(
      7       "local.get 0\n"
      8       "i32.popcnt\n"
      9       "local.set 1\n"
     10       : "=r"(r)
     11       : "r"(x));
     12   return r;
     13 }