-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend lexing and parsing with `<<r` and `>>r`. Extend latex and EasyCrypt printing. Define operators in `eclib/JWord.ec`. Implement lowering for x86 and ARM-M4. Add rotation operators to CHANGELOG
- Loading branch information
Showing
22 changed files
with
288 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
export | ||
fn ror(reg u32 arg0, reg u32 arg1) -> reg u32 { | ||
reg u32 x; | ||
x = arg0 >>r arg1; | ||
|
||
// Immediates. | ||
x = x >>r 1; | ||
x = x >>r 4; | ||
x = x >>r 31; | ||
|
||
// Set flags. | ||
reg bool n, z, c, v; | ||
n, z, c, v, _ = #MOVS(x); | ||
|
||
// Conditions. | ||
x = x >>r arg0 if z; // EQ | ||
x = x >>r arg0 if !z; // NE | ||
x = x >>r arg0 if c; // CS | ||
x = x >>r arg0 if !c; // CC | ||
x = x >>r arg0 if n; // MI | ||
x = x >>r arg0 if !n; // PL | ||
x = x >>r arg0 if v; // VS | ||
x = x >>r arg0 if !v; // VC | ||
x = x >>r arg0 if c && !z; // HI | ||
x = x >>r arg0 if !c || z; // LS | ||
x = x >>r arg0 if n == v; // GE | ||
x = x >>r arg0 if n != v; // LT | ||
x = x >>r arg0 if !z && n == v; // GT | ||
x = x >>r arg0 if z || n != v; // LE | ||
|
||
x = x >>r 1 if !!!!z; | ||
|
||
reg u32 res; | ||
res = x; | ||
return res; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,31 @@ | ||
/* Register rotations. */ | ||
|
||
export | ||
fn f(reg u64 x) -> reg u64 { | ||
reg u64 a, b, c; | ||
reg u8 d; | ||
reg bool cf, of; | ||
|
||
a = x; | ||
d = 4; | ||
_, _, a = #ROL(a, d); | ||
of, cf, b = #ROL(a, 2); | ||
cf, b += x + cf; | ||
_, _, c = #ROR(b, d); | ||
_, _, c = #ROR(c, 3); | ||
return c; | ||
reg u64 a, b, c; | ||
reg u8 d; | ||
reg bool cf, of; | ||
|
||
a = x; | ||
d = 4; | ||
|
||
// Left rotations (flags are discarded). | ||
a = a <<r d; | ||
a = a <<r 2; | ||
|
||
// Intrinsic syntax. | ||
_, _, a = #ROL(a, d); | ||
of, cf, b = #ROL(a, 2); | ||
|
||
cf, b += x + cf; | ||
|
||
// Right rotations (flags are discarded). | ||
c = b >>r d; | ||
c = b >>r 3; | ||
|
||
// Intrinsic syntax. | ||
_, _, c = #ROR(b, d); | ||
_, _, c = #ROR(c, 3); | ||
|
||
return c; | ||
} |
Oops, something went wrong.