PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / pr55150-1.c
blobe42066b60c96bc35fe0d1f601928ea13dbd3c738
1 /* PR middle-end/55150 */
2 /* { dg-do compile } */
3 /* { dg-options "-Os -g" } */
4 /* { dg-require-effective-target int32plus } */
6 typedef unsigned int KEY_TABLE_TYPE[(272 / 4)];
7 typedef unsigned int u32;
8 typedef unsigned char u8;
9 static const u32 Camellia_SBOX[][256] = {
11 static const u32 SIGMA[] = {
12 0xa09e667f, 0x3bcc908b, 0xb67ae858, 0x4caa73b2, 0xc6ef372f, 0xe94f82be, 0x54ff53a5, 0xf1d36f1c, 0x10e527fa, 0xde682d1d, 0xb05688c2, 0xb3e6c1fd };
13 int Camellia_Ekeygen (int keyBitLength, const u8 * rawKey, KEY_TABLE_TYPE k) {
14 register u32 s0, s1, s2, s3;
15 k[0] = s0 = ( {
16 u32 r = *(const u32 *) (rawKey);
20 k[2] = s2 = ( {
21 u32 r = *(const u32 *) (rawKey + 8);
25 k[3] = s3 = ( {
26 u32 r = *(const u32 *) (rawKey + 12);
30 if (keyBitLength != 128) {
31 k[8] = s0 = ( {
32 u32 r = *(const u32 *) (rawKey + 16);
36 if (keyBitLength == 192) {
37 k[10] = s2 = ~s0;
38 k[11] = s3 = ~s1;
41 s0 ^= k[0], s1 ^= k[1], s2 ^= k[2], s3 ^= k[3];
42 if (keyBitLength == 128) {
43 k[4] = s0, k[5] = s1, k[6] = s2, k[7] = s3;
45 else {
46 k[12] = s0, k[13] = s1, k[14] = s2, k[15] = s3;
47 s0 ^= k[8], s1 ^= k[9], s2 ^= k[10], s3 ^= k[11];
48 do {
49 register u32 _t0, _t1, _t2, _t3;
50 _t0 = s2 ^ ((SIGMA + 10))[0];
51 _t3 ^= Camellia_SBOX[3][(_t0 >> 8) & 0xff];
52 s1 ^= _t3;
54 while (0);
55 do {
56 u32 _t0 = s0 >> (32 - 30);
57 s2 = (s2 << 30) | (s3 >> (32 - 30));
58 s3 = (s3 << 30) | _t0;
60 while (0);
61 k[40] = s0, k[41] = s1, k[42] = s2, k[43] = s3;
62 k[64] = s1, k[65] = s2, k[66] = s3, k[67] = s0;
63 s0 = k[8], s1 = k[9], s2 = k[10], s3 = k[11];
64 k[36] = s0, k[37] = s1, k[38] = s2, k[39] = s3;
65 s0 = k[12], s1 = k[13], s2 = k[14], s3 = k[15];
66 do {
67 s1 = (s1 << 15) | (s2 >> (32 - 15));
69 while (0);
70 k[12] = s0, k[13] = s1, k[14] = s2, k[15] = s3;
71 k[44] = s1, k[45] = s2, k[46] = s3, k[47] = s0;