Skip to content

Commit b249ac4

Browse files
authored
Merge pull request #6253 from TGWDB/Output_c_rol_ror
Add conversion for rol and ror operators to c output
2 parents 5d4b780 + 4763289 commit b249ac4

File tree

18 files changed

+2596
-0
lines changed

18 files changed

+2596
-0
lines changed

regression/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ add_subdirectory(cbmc-incr-smt2)
3636
add_subdirectory(cbmc-incr)
3737
add_subdirectory(cbmc-with-incr)
3838
add_subdirectory(array-refinement-with-incr)
39+
add_subdirectory(goto-instrument-json)
3940
add_subdirectory(goto-instrument-wmm-core)
4041
add_subdirectory(goto-instrument-typedef)
4142
add_subdirectory(smt2_solver)

regression/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ DIRS = cbmc \
1414
cbmc-incr \
1515
cbmc-with-incr \
1616
array-refinement-with-incr \
17+
goto-instrument-json \
1718
goto-instrument-wmm-core \
1819
goto-instrument-typedef \
1920
smt2_solver \
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
add_test_pl_tests(
2+
"${CMAKE_CURRENT_SOURCE_DIR}/chain.sh $<TARGET_FILE:symtab2gb> $<TARGET_FILE:goto-instrument>"
3+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
default: tests.log
2+
3+
include ../../src/config.inc
4+
include ../../src/common
5+
6+
test:
7+
@../test.pl -e -p -c '../chain.sh $(exe) ../../../src/symtab2gb/symtab2gb ../../../src/goto-instrument/goto-instrument'
8+
9+
tests.log:
10+
@../test.pl -e -p -c '../chain.sh $(exe) ../../../src/symtab2gb/symtab2gb ../../../src/goto-instrument/goto-instrument'
11+
12+
clean:
13+
@for dir in *; do \
14+
$(RM) tests.log; \
15+
if [ -d "$$dir" ]; then \
16+
cd "$$dir"; \
17+
$(RM) *.out *.gb; \
18+
cd ..; \
19+
fi \
20+
done
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
symtab2gb_exe=$1
6+
goto_instrument_exe=$2
7+
8+
name=${*:$#}
9+
10+
args=${*:3:$#-3}
11+
12+
$symtab2gb_exe "${name}"
13+
$goto_instrument_exe "${args}" a.out
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CORE
2+
test-signed.json
3+
--dump-c
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
signed char rol8=\(unsigned char\)'8' << 3 % 8 \| \(unsigned char\)'8' >> 8 - 3 % 8;
7+
--
8+
irep
9+
--
10+
This tests that the rol goto operation is converted into suitable bit
11+
twiddling operations in C representation. This is also checks that
12+
signed rotations cast to unsigned to perform the shifts to avoid
13+
sign bit problems. Also the negative check for "irep" checks that no
14+
irep is failing conversion.

0 commit comments

Comments
 (0)