kit

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

icmp_cset_eqne_long.c (447B)


      1 /* icmp == and != on 64-bit longs materialized to booleans (cmp x,x + cset
      2  * eq/ne). Values exceed the 32-bit range so the x-register compare is used.
      3  * volatile defeats folding.
      4  * Exit code: a=b=0x100000001, c differs: eq=1 ne=1
      5  *   1*20 + 1*20 + 2 = 42. */
      6 int test_main(void) {
      7   volatile long a = 0x100000001L, b = 0x100000001L, c = 0x200000002L;
      8   int eq = (a == b); /* 1 */
      9   int ne = (a != c); /* 1 */
     10   return eq * 20 + ne * 20 + 2;
     11 }