mirror of
https://github.com/kmc7468/cs420.git
synced 2026-11-04 00:00:29 +09:00
Add complement example
This commit is contained in:
1 parent
448335dc39
commit
c8813ac7a2
6 files changed
+80
No files matched your search
@@ -0,0 +1,6 @@
|
|||||||
|
int nonce = 1; // For random input
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int a = ~nonce;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
var i32 @nonce = 1
|
||||||
|
|
||||||
|
fun i32 @main () {
|
||||||
|
init:
|
||||||
|
bid: b0
|
||||||
|
allocations:
|
||||||
|
%l0:i32:a
|
||||||
|
|
||||||
|
block b0:
|
||||||
|
%b0:i0:i32 = load @nonce:i32*
|
||||||
|
%b0:i1:i32 = xor %b0:i0:i32 -1:i32
|
||||||
|
%b0:i2:unit = store %b0:i1:i32 %l0:i32*
|
||||||
|
%b0:i3:i32 = load %l0:i32*
|
||||||
|
ret %b0:i3:i32
|
||||||
|
|
||||||
|
block b1:
|
||||||
|
ret 0:i32
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
var i32 @nonce = 1
|
||||||
|
|
||||||
|
fun i32 @main () {
|
||||||
|
init:
|
||||||
|
bid: b0
|
||||||
|
allocations:
|
||||||
|
%l0:i32:a
|
||||||
|
|
||||||
|
block b0:
|
||||||
|
%b0:i0:i32 = load @nonce:i32*
|
||||||
|
%b0:i1:i32 = xor %b0:i0:i32 -1:i32
|
||||||
|
%b0:i2:unit = store %b0:i1:i32 %l0:i32*
|
||||||
|
%b0:i3:i32 = load %l0:i32*
|
||||||
|
ret %b0:i3:i32
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
var i32 @nonce = 1
|
||||||
|
|
||||||
|
fun i32 @main () {
|
||||||
|
init:
|
||||||
|
bid: b0
|
||||||
|
allocations:
|
||||||
|
%l0:i32:a
|
||||||
|
|
||||||
|
block b0:
|
||||||
|
%b0:i0:i32 = load @nonce:i32*
|
||||||
|
%b0:i1:i32 = xor %b0:i0:i32 -1:i32
|
||||||
|
%b0:i2:unit = nop
|
||||||
|
%b0:i3:unit = nop
|
||||||
|
ret %b0:i1:i32
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
var i32 @nonce = 1
|
||||||
|
|
||||||
|
fun i32 @main () {
|
||||||
|
init:
|
||||||
|
bid: b0
|
||||||
|
allocations:
|
||||||
|
|
||||||
|
|
||||||
|
block b0:
|
||||||
|
%b0:i0:i32 = load @nonce:i32*
|
||||||
|
%b0:i1:i32 = xor %b0:i0:i32 -1:i32
|
||||||
|
ret %b0:i1:i32
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
var i32 @nonce = 1
|
||||||
|
|
||||||
|
fun i32 @main () {
|
||||||
|
init:
|
||||||
|
bid: b0
|
||||||
|
allocations:
|
||||||
|
|
||||||
|
|
||||||
|
block b0:
|
||||||
|
%b0:i0:i32 = load @nonce:i32*
|
||||||
|
%b0:i1:i32 = xor %b0:i0:i32 -1:i32
|
||||||
|
ret %b0:i1:i32
|
||||||
|
}
|
||||||
Reference in new issue
Block a user