Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Imported small internal tests: - cfi_instrs_reordered.s - no_entry_reordering.test - no_relocs.test - pie.test (cherry picked from FBD31514823)
- Loading branch information
Showing
6 changed files
with
1,122 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
.globl _start | ||
.type _start, %function | ||
_start: | ||
# FDATA: 0 [unknown] 0 1 _start 0 0 792 | ||
.cfi_startproc | ||
LBB00: | ||
movl $0x0, %eax | ||
jmp Ltmp0 | ||
|
||
LFT0: | ||
cmpl $0x0, %eax | ||
jmp Ltmp1 | ||
|
||
Ltmp1: | ||
jmp LBB00 | ||
# FDATA: 1 _start #Ltmp1# 1 _start #LBB00# 13 792 | ||
|
||
Ltmp0: | ||
jmp Ltmp2 | ||
|
||
Ltmp2: | ||
jmp Ltmp3 | ||
|
||
Ltmp3: | ||
jmp Ltmp4 | ||
|
||
Ltmp4: | ||
jmp Ltmp5 | ||
|
||
Ltmp5: | ||
jmp Ltmp6 | ||
|
||
Ltmp6: | ||
jmp Ltmp7 | ||
|
||
Ltmp7: | ||
jmp Ltmp8 | ||
|
||
Ltmp8: | ||
jmp Ltmp9 | ||
|
||
Ltmp9: | ||
jmp Ltmp10 | ||
|
||
Ltmp10: | ||
jmp Ltmp11 | ||
|
||
Ltmp11: | ||
retq | ||
.cfi_endproc | ||
.size _start, .-_start |
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,38 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int total = 0; | ||
|
||
int inc(int x) { | ||
switch (x) { | ||
case 0: total += 1 + 0; return 1; | ||
case 1: total += 1 + 1; return 2; | ||
case 2: total += 1 + 2; return 3; | ||
case 3: total += 1 + 3; return 4; | ||
case 4: total += 1 + 4; return 5; | ||
case 5: total += 1 + 5; return 6; | ||
default: return x + 1; | ||
} | ||
} | ||
|
||
int inc_dup(int x) { | ||
switch (x) { | ||
case 0: total += 2 + 0; return 1; | ||
case 1: total += 2 + 1; return 2; | ||
case 2: total += 2 + 2; return 3; | ||
case 3: total += 2 + 3; return 4; | ||
case 4: total += 2 + 4; return 5; | ||
case 5: total += 2 + 5; return 6; | ||
default: return x + 1; | ||
} | ||
} | ||
|
||
int main() { | ||
int c = 0; | ||
for (int i = 0; i < 10000000; ++i) { | ||
int a = rand() % 7; | ||
int b = rand() % 7; | ||
c += inc(a) - 2*inc_dup(b); | ||
} | ||
return c == 0; | ||
} |
Oops, something went wrong.