diff --git a/refinement/tests/samples/switching_llvm.c b/refinement/tests/samples/switching_llvm.c new file mode 100644 index 00000000..6bd5d77c --- /dev/null +++ b/refinement/tests/samples/switching_llvm.c @@ -0,0 +1,22 @@ +#include + +int64_t __ucmpdi2() {}; +int64_t select(int64_t a, int64_t b) +{ + switch (a) { + case 0: return b; + case 1: return b+1; + case 2: return b<<1; + case 3: return b+b; + case 4: return b<<2; + case 5: return b+5; + default: return 0; + } + // Has a "jmp rax", which is a classify failure "stmtsTerm = unknown transfer" +} + +void _start() +{ + int64_t r = select(3, 4); + return; +} diff --git a/refinement/tests/samples/switching_llvm.x86.exe b/refinement/tests/samples/switching_llvm.x86.exe new file mode 100755 index 00000000..6ecc0a14 Binary files /dev/null and b/refinement/tests/samples/switching_llvm.x86.exe differ diff --git a/refinement/tests/samples/switching_many_llvm.c b/refinement/tests/samples/switching_many_llvm.c new file mode 100644 index 00000000..b450b2e1 --- /dev/null +++ b/refinement/tests/samples/switching_many_llvm.c @@ -0,0 +1,65 @@ +#include + +// Similar to switching.c, but switching.c has only a single instance +// in a single function and this has multiple instances in multiple +// functions. + +int64_t __ucmpdi2() {}; +int64_t reflect(int64_t a, int64_t b, int64_t c) +{ + switch (b) { + case 0: return b+5; + case 1: return a+b; + case 3: return a<>2; + case 3: return b>>2; + case 4: return a^2; + case 5: return b^2; + default: return 1; + } + default: return ~0; + } + default: return 0; + } +} + +int64_t select(int64_t a, int64_t b) +{ + switch (a) { + case 0: return b; + case 1: return b+1; + case 2: return b<<1; + case 3: return b+b; + case 4: return b<<2; + case 5: switch (b) { + case 0 : return b+5; + case 1 : return a+b; + // specifically missing case 2, should still generate a + // jump expression. + case 3 : return a<