Skip to content

Commit c07518e

Browse files
polgreenAalok Thakkar
authored and
Aalok Thakkar
committed
support muli-ary multiplication in the SMT2 front-end
This adds support for muli-ary multiplication to the SMT2 front-end.
1 parent 1fad927 commit c07518e

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

regression/smt2_solver/basic-bv1/basic-bv1.smt2

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@
1414
(define-fun b09 () Bool (= (bvlshr #xf0 #x03) #x1e)) ; unsigned (logical) shift right
1515
(define-fun b10 () Bool (= (bvashr #xf0 #x03) #xfe)) ; signed (arithmetical) shift right#x0a
1616

17+
; Multi-ary variants, where applicable
18+
(define-fun b11 () Bool (= (bvadd #x07 #x03 #x01) #x0b)) ; addition
19+
(define-fun b12 () Bool (= (bvmul #x07 #x03 #x01) #x15)) ; multiplication
20+
1721
; rotation
18-
(define-fun b11 () Bool (= ((_ rotate_left 2) #xf7) #xdf)) ; rotation left
19-
(define-fun b12 () Bool (= ((_ rotate_right 2) #x07) #xc1)) ; rotation right
22+
(define-fun b13 () Bool (= ((_ rotate_left 2) #xf7) #xdf)) ; rotation left
23+
(define-fun b14 () Bool (= ((_ rotate_right 2) #x07) #xc1)) ; rotation right
2024

2125
; Bitwise Operations
2226

@@ -63,7 +67,7 @@
6367
; all must be true
6468

6569
(assert (not (and
66-
b01 b02 b03 b04 b05 b06 b07 b08 b09 b10 b11 b12
70+
b01 b02 b03 b04 b05 b06 b07 b08 b09 b10 b11 b12 b13 b14
6771
d01
6872
power-test
6973
p1 p2 p3 p4 p5 p6 p7 p8)))

src/solvers/smt2/smt2_parser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,8 +1034,8 @@ void smt2_parsert::setup_expressions()
10341034
expressions["bvadd"] = [this] { return multi_ary(ID_plus, operands()); };
10351035
expressions["+"] = [this] { return multi_ary(ID_plus, operands()); };
10361036
expressions["bvsub"] = [this] { return binary(ID_minus, operands()); };
1037-
expressions["bvmul"] = [this] { return binary(ID_mult, operands()); };
1038-
expressions["*"] = [this] { return binary(ID_mult, operands()); };
1037+
expressions["bvmul"] = [this] { return multi_ary(ID_mult, operands()); };
1038+
expressions["*"] = [this] { return multi_ary(ID_mult, operands()); };
10391039

10401040
expressions["-"] = [this] {
10411041
auto op = operands();

0 commit comments

Comments
 (0)