Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a rewrite rule to collapse constant casts #494

Merged
merged 2 commits into from
Jan 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 66 additions & 70 deletions curve25519_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -748,43 +748,41 @@ static void fiat_25519_to_bytes(uint8_t out1[32], const uint32_t arg1[10]) {
uint8_t x81 = (uint8_t)(x78 & UINT8_C(0xff));
uint8_t x82 = (uint8_t)(x80 >> 8);
uint8_t x83 = (uint8_t)(x80 & UINT8_C(0xff));
fiat_25519_uint1 x84 = (fiat_25519_uint1)(x82 >> 8);
uint8_t x85 = (uint8_t)(x82 & UINT8_C(0xff));
uint32_t x86 = (x84 + x32);
uint32_t x87 = (x86 >> 8);
uint8_t x88 = (uint8_t)(x86 & UINT8_C(0xff));
uint32_t x89 = (x87 >> 8);
uint8_t x84 = (uint8_t)(x82 & UINT8_C(0xff));
uint32_t x85 = (x32 >> 8);
uint8_t x86 = (uint8_t)(x32 & UINT8_C(0xff));
uint32_t x87 = (x85 >> 8);
uint8_t x88 = (uint8_t)(x85 & UINT8_C(0xff));
fiat_25519_uint1 x89 = (fiat_25519_uint1)(x87 >> 8);
uint8_t x90 = (uint8_t)(x87 & UINT8_C(0xff));
fiat_25519_uint1 x91 = (fiat_25519_uint1)(x89 >> 8);
uint8_t x92 = (uint8_t)(x89 & UINT8_C(0xff));
uint32_t x93 = (x91 + x45);
uint32_t x94 = (x93 >> 8);
uint8_t x95 = (uint8_t)(x93 & UINT8_C(0xff));
uint32_t x96 = (x94 >> 8);
uint32_t x91 = (x89 + x45);
uint32_t x92 = (x91 >> 8);
uint8_t x93 = (uint8_t)(x91 & UINT8_C(0xff));
uint32_t x94 = (x92 >> 8);
uint8_t x95 = (uint8_t)(x92 & UINT8_C(0xff));
uint8_t x96 = (uint8_t)(x94 >> 8);
uint8_t x97 = (uint8_t)(x94 & UINT8_C(0xff));
uint8_t x98 = (uint8_t)(x96 >> 8);
uint8_t x99 = (uint8_t)(x96 & UINT8_C(0xff));
uint32_t x100 = (x98 + x44);
uint32_t x101 = (x100 >> 8);
uint8_t x102 = (uint8_t)(x100 & UINT8_C(0xff));
uint32_t x103 = (x101 >> 8);
uint32_t x98 = (x96 + x44);
uint32_t x99 = (x98 >> 8);
uint8_t x100 = (uint8_t)(x98 & UINT8_C(0xff));
uint32_t x101 = (x99 >> 8);
uint8_t x102 = (uint8_t)(x99 & UINT8_C(0xff));
uint8_t x103 = (uint8_t)(x101 >> 8);
uint8_t x104 = (uint8_t)(x101 & UINT8_C(0xff));
uint8_t x105 = (uint8_t)(x103 >> 8);
uint8_t x106 = (uint8_t)(x103 & UINT8_C(0xff));
uint32_t x107 = (x105 + x43);
uint32_t x108 = (x107 >> 8);
uint8_t x109 = (uint8_t)(x107 & UINT8_C(0xff));
uint32_t x110 = (x108 >> 8);
uint32_t x105 = (x103 + x43);
uint32_t x106 = (x105 >> 8);
uint8_t x107 = (uint8_t)(x105 & UINT8_C(0xff));
uint32_t x108 = (x106 >> 8);
uint8_t x109 = (uint8_t)(x106 & UINT8_C(0xff));
uint8_t x110 = (uint8_t)(x108 >> 8);
uint8_t x111 = (uint8_t)(x108 & UINT8_C(0xff));
uint8_t x112 = (uint8_t)(x110 >> 8);
uint8_t x113 = (uint8_t)(x110 & UINT8_C(0xff));
uint32_t x114 = (x112 + x42);
uint32_t x115 = (x114 >> 8);
uint8_t x116 = (uint8_t)(x114 & UINT8_C(0xff));
uint32_t x117 = (x115 >> 8);
uint32_t x112 = (x110 + x42);
uint32_t x113 = (x112 >> 8);
uint8_t x114 = (uint8_t)(x112 & UINT8_C(0xff));
uint32_t x115 = (x113 >> 8);
uint8_t x116 = (uint8_t)(x113 & UINT8_C(0xff));
uint8_t x117 = (uint8_t)(x115 >> 8);
uint8_t x118 = (uint8_t)(x115 & UINT8_C(0xff));
uint8_t x119 = (uint8_t)(x117 >> 8);
uint8_t x120 = (uint8_t)(x117 & UINT8_C(0xff));
out1[0] = x51;
out1[1] = x53;
out1[2] = x55;
Expand All @@ -800,23 +798,23 @@ static void fiat_25519_to_bytes(uint8_t out1[32], const uint32_t arg1[10]) {
out1[12] = x79;
out1[13] = x81;
out1[14] = x83;
out1[15] = x85;
out1[16] = x88;
out1[17] = x90;
out1[18] = x92;
out1[19] = x95;
out1[20] = x97;
out1[21] = x99;
out1[22] = x102;
out1[23] = x104;
out1[24] = x106;
out1[25] = x109;
out1[26] = x111;
out1[27] = x113;
out1[28] = x116;
out1[29] = x118;
out1[30] = x120;
out1[31] = x119;
out1[15] = x84;
out1[16] = x86;
out1[17] = x88;
out1[18] = x90;
out1[19] = x93;
out1[20] = x95;
out1[21] = x97;
out1[22] = x100;
out1[23] = x102;
out1[24] = x104;
out1[25] = x107;
out1[26] = x109;
out1[27] = x111;
out1[28] = x114;
out1[29] = x116;
out1[30] = x118;
out1[31] = x117;
}

/*
Expand Down Expand Up @@ -880,30 +878,28 @@ static void fiat_25519_from_bytes(uint32_t out1[10], const uint8_t arg1[32]) {
uint8_t x52 = (uint8_t)(x51 >> 25);
uint32_t x53 = (x51 & UINT32_C(0x1ffffff));
uint32_t x54 = (x52 + x41);
fiat_25519_uint1 x55 = (fiat_25519_uint1)(x54 >> 26);
uint32_t x56 = (x54 & UINT32_C(0x3ffffff));
uint32_t x57 = (x55 + x40);
uint8_t x58 = (uint8_t)(x57 >> 25);
uint32_t x59 = (x57 & UINT32_C(0x1ffffff));
uint32_t x60 = (x58 + x39);
uint8_t x61 = (uint8_t)(x60 >> 26);
uint32_t x62 = (x60 & UINT32_C(0x3ffffff));
uint32_t x63 = (x61 + x38);
uint8_t x64 = (uint8_t)(x63 >> 25);
uint32_t x65 = (x63 & UINT32_C(0x1ffffff));
uint32_t x66 = (x64 + x37);
uint8_t x67 = (uint8_t)(x66 >> 26);
uint32_t x68 = (x66 & UINT32_C(0x3ffffff));
uint32_t x69 = (x67 + x36);
uint32_t x55 = (x54 & UINT32_C(0x3ffffff));
uint8_t x56 = (uint8_t)(x40 >> 25);
uint32_t x57 = (x40 & UINT32_C(0x1ffffff));
uint32_t x58 = (x56 + x39);
uint8_t x59 = (uint8_t)(x58 >> 26);
uint32_t x60 = (x58 & UINT32_C(0x3ffffff));
uint32_t x61 = (x59 + x38);
uint8_t x62 = (uint8_t)(x61 >> 25);
uint32_t x63 = (x61 & UINT32_C(0x1ffffff));
uint32_t x64 = (x62 + x37);
uint8_t x65 = (uint8_t)(x64 >> 26);
uint32_t x66 = (x64 & UINT32_C(0x3ffffff));
uint32_t x67 = (x65 + x36);
out1[0] = x35;
out1[1] = x47;
out1[2] = x50;
out1[3] = x53;
out1[4] = x56;
out1[5] = x59;
out1[6] = x62;
out1[7] = x65;
out1[8] = x68;
out1[9] = x69;
out1[4] = x55;
out1[5] = x57;
out1[6] = x60;
out1[7] = x63;
out1[8] = x66;
out1[9] = x67;
}

Loading