kit

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

sw_long.c (566B)


      1 /* A switch on a 64-bit (long) selector with far-apart case values, forcing a
      2  * compare-and-branch chain over 64-bit registers. This exercises the x-register
      3  * compare path feeding the dispatch. volatile selector defeats folding. The
      4  * value 0x100000000 (2^32) selects the case returning 42. Exit code 42. */
      5 int sel(long x) {
      6   switch (x) {
      7     case 0L:
      8       return 10;
      9     case 0x100000000L:
     10       return 42;
     11     case 0x200000000L:
     12       return 12;
     13     default:
     14       return 99;
     15   }
     16 }
     17 int test_main(void) {
     18   volatile long x = 0x100000000L;
     19   return sel(x);
     20 }