Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
2
2022fall-Compiler_CMinus
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李晓奇
2022fall-Compiler_CMinus
Commits
556544ce
Commit
556544ce
authored
Jan 15, 2023
by
张栋澈
🤡
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Lab4.2] Update hidden functional testcases
parent
4d31b582
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
15176 additions
and
0 deletions
+15176
-0
tests/4-ir-opt/testcases/GVN/functional/bin2.cminus
tests/4-ir-opt/testcases/GVN/functional/bin2.cminus
+19
-0
tests/4-ir-opt/testcases/GVN/functional/bin2.json
tests/4-ir-opt/testcases/GVN/functional/bin2.json
+106
-0
tests/4-ir-opt/testcases/GVN/functional/complex.cminus
tests/4-ir-opt/testcases/GVN/functional/complex.cminus
+177
-0
tests/4-ir-opt/testcases/GVN/functional/complex.json
tests/4-ir-opt/testcases/GVN/functional/complex.json
+14174
-0
tests/4-ir-opt/testcases/GVN/functional/loop2d1.cminus
tests/4-ir-opt/testcases/GVN/functional/loop2d1.cminus
+20
-0
tests/4-ir-opt/testcases/GVN/functional/loop2d1.json
tests/4-ir-opt/testcases/GVN/functional/loop2d1.json
+180
-0
tests/4-ir-opt/testcases/GVN/functional/recursive_vpf.cminus
tests/4-ir-opt/testcases/GVN/functional/recursive_vpf.cminus
+45
-0
tests/4-ir-opt/testcases/GVN/functional/recursive_vpf.json
tests/4-ir-opt/testcases/GVN/functional/recursive_vpf.json
+455
-0
No files found.
tests/4-ir-opt/testcases/GVN/functional/bin2.cminus
0 → 100644
View file @
556544ce
/* c and d are redundant, a and b is not redundant */
int main(void) {
int a;
int b;
int c;
int d;
if (input() > input()) {
a = input();
b = a + a;
c = a + b;
} else {
a = input();
b = a;
c = a + b;
}
output(c);
d = a + b;
output(d);
}
tests/4-ir-opt/testcases/GVN/functional/bin2.json
0 → 100644
View file @
556544ce
[
{
"function"
:
"main"
,
"pout"
:
{
"label_entry"
:
[
[
"%op0"
,
],
[
"%op1"
,
],
[
"%op2"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
],
"label5"
:
[
[
"%op0"
,
],
[
"%op1"
,
],
[
"%op2"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
[
"%op6"
,
"%op12"
,
],
[
"%op7"
,
"%op11"
,
],
[
"%op8"
,
"%op10"
,
],
],
"label9"
:
[
[
"%op0"
,
],
[
"%op1"
,
],
[
"%op2"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
[
"%op12"
,
],
[
"%op11"
,
],
[
"%op13"
,
"%op10"
,
],
],
"label14"
:
[
[
"%op0"
,
],
[
"%op1"
,
],
[
"%op2"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
[
"%op15"
,
"%op12"
,
"%op11"
,
],
[
"%op16"
,
"%op10"
,
],
],
}
},
]
\ No newline at end of file
tests/4-ir-opt/testcases/GVN/functional/complex.cminus
0 → 100644
View file @
556544ce
int state;
int buffer[32768];
int getrandom(void) {
state = state + (state * 8192);
state = state + (state / 131072);
state = state + (state * 32);
return state;
}
int remainder(int x, int y) {
int t;
t = x / y;
return x - y * t;
}
int rotlone(int x) { return x * 2 + remainder(x, 2); }
int rotlfive(int x) { return x * 32 + remainder(x, 32); }
int rotlthirty(int x) { return x * 1073741824 + remainder(x, 1073741824); }
int andc(int a, int b) { return a + b; }
int notc(int x) {
int t;
t = 0 - 1;
return t - x;
}
int xorc(int a, int b) { return a - andc(a, b) + b - andc(a, b); }
int orc(int a, int b) { return xorc(xorc(a, b), andc(a, b)); }
/* we need to change the first argument to `inputarr` to avoid conflict with the function `input` */
void pseudosha(int inputarr[], int inputlen, int outputarray[]) {
int ha;
int hb;
int hc;
int hd;
int he;
int a;
int b;
int c;
int d;
int e;
int f;
int k;
int origlen;
int chunkstart;
int words[80];
int i;
int t;
ha = 1732584193;
hb = 0 - 271733879;
hc = 0 - 1732584194;
hd = 271733878;
he = 0 - 1009589776;
origlen = inputlen;
inputarr[inputlen] = 128;
inputlen = inputlen + 1;
while (remainder(inputlen, 64) != 60) {
inputarr[inputlen] = 0;
inputlen = inputlen + 1;
}
inputarr[inputlen] = remainder(origlen / 16777216, 256);
inputarr[inputlen + 1] = remainder(origlen / 65536, 256);
inputarr[inputlen + 2] = remainder(origlen / 256, 256);
inputarr[inputlen + 3] = remainder(origlen, 256);
inputlen = inputlen + 4;
chunkstart = 0;
while (chunkstart < inputlen) {
a = ha;
b = hb;
c = hc;
d = hd;
e = he;
i = 0;
while (i < 16) {
words[i] = inputarr[chunkstart + i * 4] * 16777216 + inputarr[chunkstart + i * 4 + 1] * 65536 +
inputarr[chunkstart + i * 4 + 2] * 256 + inputarr[chunkstart + i * 4 + 3] * 1;
i = i + 1;
}
while (i < 80) {
words[i] = rotlone(xorc(xorc(xorc(words[i - 3], words[i - 8]), words[i - 14]), words[i - 16]));
i = i + 1;
}
i = 0;
while (i < 80) {
if (i < 20) {
f = orc(andc(b, c), andc(notc(b), d));
k = 1518500249;
} else if (i < 40) {
f = xorc(xorc(b, c), d);
k = 1859775361;
} else if (i < 60) {
f = orc(orc(andc(b, c), andc(b, d)), andc(c, d));
k = 0 - 1894007588;
} else {
f = xorc(xorc(b, c), d);
k = 0 - 899497722;
}
t = rotlfive(a) + f + e + k + words[i];
e = d;
d = c;
c = rotlthirty(b);
b = a;
a = t;
i = i + 1;
}
ha = ha + a;
hb = hb + b;
hc = hc + c;
hd = hd + d;
he = he + e;
chunkstart = chunkstart + 64;
}
/* see the comment below for this strange indexing */
outputarray[input()] = ha;
outputarray[input()] = hb;
outputarray[input()] = hc;
outputarray[input()] = hd;
outputarray[input()] = he;
}
int main(void) {
int rounds;
int i;
int outputarray[5];
int outputbuf[5];
int len;
state = 19260817;
i = 0;
rounds = 12;
state = input();
rounds = input();
/**
* note: this should be outputbuf[0] ... outputbuf[4], but some students think
* icmp slt i32 0, 0
* and
* icmp slt i32 1, 0
* are equivalent, while some not,
* so we use input() to assure all the non-negative checks are distinct
**/
outputbuf[input()] = 0;
outputbuf[input()] = 0;
outputbuf[input()] = 0;
outputbuf[input()] = 0;
outputbuf[input()] = 0;
while (rounds > 0) {
len = 32000;
i = 0;
while (i < len) {
buffer[i] = remainder(getrandom(), 256);
i = i + 1;
}
pseudosha(buffer, len, outputarray);
i = 0;
while (i < 5) {
outputbuf[i] = xorc(outputbuf[i], outputarray[i]);
i = i + 1;
}
rounds = rounds - 1;
}
i = 0;
while (i < 5) {
output(outputbuf[i]);
i = i + 1;
}
return 0;
}
tests/4-ir-opt/testcases/GVN/functional/complex.json
0 → 100644
View file @
556544ce
This source diff could not be displayed because it is too large. You can
view the blob
instead.
tests/4-ir-opt/testcases/GVN/functional/loop2d1.cminus
0 → 100644
View file @
556544ce
int main(void) {
int i;
int j;
int sum;
i = 0;
j = 0;
sum = 0;
while (i < 10) {
j = 0;
while (j < 5) {
/* i+1 in this block are redundant */
sum = sum + (i + 1) * (i + 1) * (j + 1) * (j + 1);
j = j + 1;
}
/* but not this one */
i = i + 1;
}
output(sum);
return 0;
}
tests/4-ir-opt/testcases/GVN/functional/loop2d1.json
0 → 100644
View file @
556544ce
[
{
"function"
:
"main"
,
"pout"
:
{
"label_entry"
:
[
[
"%op3"
,
"%op1"
,
],
],
"label0"
:
[
[
"%op1"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
[
"%op5"
,
],
[
"%op6"
,
],
],
"label7"
:
[
[
"%op10"
,
"%op1"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
[
"%op5"
,
],
[
"%op6"
,
],
[
"%op11"
,
],
],
"label8"
:
[
[
"%op1"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
[
"%op5"
,
],
[
"%op6"
,
],
],
"label9"
:
[
[
"%op4"
,
],
[
"%op5"
,
],
[
"%op6"
,
],
[
"%op3"
,
],
[
"%op1"
,
],
[
"%op10"
,
],
[
"%op11"
,
],
[
"%op12"
,
],
[
"%op13"
,
],
[
"%op14"
,
],
],
"label15"
:
[
[
"%op4"
,
],
[
"%op5"
,
],
[
"%op6"
,
],
[
"%op3"
,
],
[
"%op1"
,
],
[
"%op12"
,
],
[
"%op13"
,
],
[
"%op14"
,
],
[
"%op16"
,
"%op17"
,
],
[
"%op18"
,
],
[
"%op19"
,
"%op21"
,
"%op24"
,
"%op11"
,
],
[
"%op20"
,
],
[
"%op22"
,
],
[
"%op23"
,
"%op10"
,
],
],
"label25"
:
[
[
"%op4"
,
],
[
"%op5"
,
],
[
"%op6"
,
],
[
"%op10"
,
"%op1"
,
],
[
"%op11"
,
],
[
"%op12"
,
],
[
"%op13"
,
],
[
"%op14"
,
],
[
"%op26"
,
"%op3"
,
],
],
}
},
]
\ No newline at end of file
tests/4-ir-opt/testcases/GVN/functional/recursive_vpf.cminus
0 → 100644
View file @
556544ce
int one(void) { return 1; }
int main(void) {
int a;
int b;
int c;
int d;
int e;
int i;
int n;
float f;
a = input();
b = input();
i = n = c = d = e = 0;
f = 0.0;
if (a > b) {
f = input() / 2.0;
c = f + 8;
outputFloat(c * 0.01);
/**
* note: this was supposed to be a constant (eg. d = 23)
* but the documentation over-constrained
* so we have to relax a little bit in this case
**/
d = input();
e = c / d;
} else if (a < b - 10) {
c = d = one();
e = c / d;
} else {
n = input();
i = 0;
c = d = one() + one();
e = c / d;
while (i < n) {
c = d = one() * one();
e = c / d;
output(i);
i = i + 1;
}
}
outputFloat(e);
output(c / d);
return 0;
}
tests/4-ir-opt/testcases/GVN/functional/recursive_vpf.json
0 → 100644
View file @
556544ce
[
{
"function"
:
"one"
,
"pout"
:
{
"label_entry"
:
[],
}
},
{
"function"
:
"main"
,
"pout"
:
{
"label_entry"
:
[
[
"%op0"
,
],
[
"%op1"
,
],
[
"%op2"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
],
"label5"
:
[
[
"%op0"
,
],
[
"%op1"
,
],
[
"%op2"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
[
"%op6"
,
],
[
"%op7"
,
],
[
"%op8"
,
],
[
"%op9"
,
],
[
"%op10"
,
],
[
"%op11"
,
"%op22"
,
],
[
"%op12"
,
],
[
"%op13"
,
],
[
"%op14"
,
"%op21"
,
],
[
"%op15"
,
"%op20"
,
],
],
"label16"
:
[
[
"%op0"
,
],
[
"%op1"
,
],
[
"%op2"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
[
"%op24"
,
"%op20"
,
],
[
"%op21"
,
],
[
"%op22"
,
],
[
"%op23"
,
],
],
"label25"
:
[
[
"%op0"
,
],
[
"%op1"
,
],
[
"%op2"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
[
"%op26"
,
],
[
"%op27"
,
],
[
"%op28"
,
],
[
"%op29"
,
],
],
"label30"
:
[
[
"%op0"
,
],
[
"%op1"
,
],
[
"%op2"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
[
"%op26"
,
],
[
"%op27"
,
],
[
"%op28"
,
],
[
"%op29"
,
],
[
"%op31"
,
"%op38"
,
"%op37"
,
],
[
"%op32"
,
"%op36"
,
],
],
"label33"
:
[
[
"%op0"
,
],
[
"%op1"
,
],
[
"%op2"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
[
"%op26"
,
],
[
"%op27"
,
],
[
"%op28"
,
],
[
"%op29"
,
],
[
"%op20"
,
"%op36"
,
],
[
"%op22"
,
"%op38"
,
"%op21"
,
"%op37"
,
],
],
"label39"
:
[
[
"%op0"
,
],
[
"%op1"
,
],
[
"%op2"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
[
"%op26"
,
],
[
"%op27"
,
],
[
"%op28"
,
],
[
"%op29"
,
],
[
"%op40"
,
],
[
"%op41"
,
"%op42"
,
],
[
"%op43"
,
"%op49"
,
"%op48"
,
],
[
"%op44"
,
"%op47"
,
],
[
"%op46"
,
],
],
"label45"
:
[
[
"%op0"
,
],
[
"%op1"
,
],
[
"%op2"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
[
"%op26"
,
],
[
"%op27"
,
],
[
"%op28"
,
],
[
"%op29"
,
],
[
"%op40"
,
],
[
"%op41"
,
"%op42"
,
],
[
"%op43"
,
],
[
"%op44"
,
],
[
"%op46"
,
],
[
"%op47"
,
],
[
"%op49"
,
"%op48"
,
],
[
"%op50"
,
],
[
"%op51"
,
],
[
"%op52"
,
],
],
"label53"
:
[
[
"%op0"
,
],
[
"%op1"
,
],
[
"%op2"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
[
"%op26"
,
],
[
"%op27"
,
],
[
"%op28"
,
],
[
"%op29"
,
],
[
"%op40"
,
],
[
"%op41"
,
"%op42"
,
"%op54"
,
"%op55"
,
],
[
"%op43"
,
],
[
"%op44"
,
],
[
"%op50"
,
],
[
"%op51"
,
],
[
"%op52"
,
],
[
"%op56"
,
"%op49"
,
"%op48"
,
],
[
"%op57"
,
"%op47"
,
],
[
"%op58"
,
"%op46"
,
],
],
"label59"
:
[
[
"%op0"
,
],
[
"%op1"
,
],
[
"%op2"
,
],
[
"%op3"
,
],
[
"%op4"
,
],
[
"%op26"
,
],
[
"%op27"
,
],
[
"%op28"
,
],
[
"%op29"
,
],
[
"%op40"
,
],
[
"%op41"
,
"%op42"
,
],
[
"%op43"
,
],
[
"%op44"
,
],
[
"%op46"
,
],
[
"%op36"
,
"%op47"
,
],
[
"%op38"
,
"%op49"
,
"%op37"
,
"%op48"
,
],
[
"%op50"
,
],
[
"%op51"
,
],
[
"%op52"
,
],
],
}
},
]
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment