modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/pr89369.c (about) 1 /* PR target/89369 */ 2 3 #if __SIZEOF_INT__ == 4 && __SIZEOF_LONG_LONG__ == 8 && __CHAR_BIT__ == 8 4 struct S { unsigned int u[4]; }; 5 6 static void 7 foo (struct S *out, struct S const *in, int shift) 8 { 9 unsigned long long th, tl, oh, ol; 10 th = ((unsigned long long) in->u[3] << 32) | in->u[2]; 11 tl = ((unsigned long long) in->u[1] << 32) | in->u[0]; 12 oh = th >> (shift * 8); 13 ol = tl >> (shift * 8); 14 ol |= th << (64 - shift * 8); 15 out->u[1] = ol >> 32; 16 out->u[0] = ol; 17 out->u[3] = oh >> 32; 18 out->u[2] = oh; 19 } 20 21 static void 22 bar (struct S *out, struct S const *in, int shift) 23 { 24 unsigned long long th, tl, oh, ol; 25 th = ((unsigned long long) in->u[3] << 32) | in->u[2]; 26 tl = ((unsigned long long) in->u[1] << 32) | in->u[0]; 27 oh = th << (shift * 8); 28 ol = tl << (shift * 8); 29 oh |= tl >> (64 - shift * 8); 30 out->u[1] = ol >> 32; 31 out->u[0] = ol; 32 out->u[3] = oh >> 32; 33 out->u[2] = oh; 34 } 35 36 __attribute__((noipa)) static void 37 baz (struct S *r, struct S *a, struct S *b, struct S *c, struct S *d) 38 { 39 struct S x, y; 40 bar (&x, a, 1); 41 foo (&y, c, 1); 42 r->u[0] = a->u[0] ^ x.u[0] ^ ((b->u[0] >> 11) & 0xdfffffefU) ^ y.u[0] ^ (d->u[0] << 18); 43 r->u[1] = a->u[1] ^ x.u[1] ^ ((b->u[1] >> 11) & 0xddfecb7fU) ^ y.u[1] ^ (d->u[1] << 18); 44 r->u[2] = a->u[2] ^ x.u[2] ^ ((b->u[2] >> 11) & 0xbffaffffU) ^ y.u[2] ^ (d->u[2] << 18); 45 r->u[3] = a->u[3] ^ x.u[3] ^ ((b->u[3] >> 11) & 0xbffffff6U) ^ y.u[3] ^ (d->u[3] << 18); 46 } 47 48 int 49 main () 50 { 51 struct S a[] = { { 0x000004d3, 0xbc5448db, 0xf22bde9f, 0xebb44f8f }, 52 { 0x03a32799, 0x60be8246, 0xa2d266ed, 0x7aa18536 }, 53 { 0x15a38518, 0xcf655ce1, 0xf3e09994, 0x50ef69fe }, 54 { 0x88274b07, 0xe7c94866, 0xc0ea9f47, 0xb6a83c43 }, 55 { 0xcd0d0032, 0x5d47f5d7, 0x5a0afbf6, 0xaea87b24 }, 56 { 0, 0, 0, 0 } }; 57 baz (&a[5], &a[0], &a[1], &a[2], &a[3]); 58 if (a[4].u[0] != a[5].u[0] || a[4].u[1] != a[5].u[1] 59 || a[4].u[2] != a[5].u[2] || a[4].u[3] != a[5].u[3]) 60 __builtin_abort (); 61 return 0; 62 } 63 #else 64 int 65 main () 66 { 67 return 0; 68 } 69 #endif