File tree Expand file tree Collapse file tree 2 files changed +14
-22
lines changed
compiler/rustc_codegen_llvm/src/gotoc
src/test/cbmc/BitwiseArithOperators Expand file tree Collapse file tree 2 files changed +14
-22
lines changed Original file line number Diff line number Diff line change @@ -48,30 +48,12 @@ impl<'tcx> GotocCtx<'tcx> {
48
48
let ce1 = self . codegen_operand ( e1) ;
49
49
let ce2 = self . codegen_operand ( e2) ;
50
50
match op {
51
+ BinOp :: BitAnd => ce1. bitand ( ce2) ,
52
+ BinOp :: BitOr => ce1. bitor ( ce2) ,
53
+ BinOp :: BitXor => ce1. bitxor ( ce2) ,
51
54
BinOp :: Div => ce1. div ( ce2) ,
52
55
BinOp :: Rem => ce1. rem ( ce2) ,
53
- BinOp :: BitXor => {
54
- if self . operand_ty ( e1) . is_bool ( ) {
55
- ce1. xor ( ce2)
56
- } else {
57
- ce1. bitxor ( ce2)
58
- }
59
- }
60
- BinOp :: BitAnd => {
61
- if self . operand_ty ( e1) . is_bool ( ) {
62
- ce1. and ( ce2)
63
- } else {
64
- ce1. bitand ( ce2)
65
- }
66
- }
67
- BinOp :: BitOr => {
68
- if self . operand_ty ( e1) . is_bool ( ) {
69
- ce1. or ( ce2)
70
- } else {
71
- ce1. bitor ( ce2)
72
- }
73
- }
74
- _ => unreachable ! ( ) ,
56
+ _ => unreachable ! ( "Unexpected {:?}" , op) ,
75
57
}
76
58
}
77
59
Original file line number Diff line number Diff line change
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0 OR MIT
3
+ include ! ( "../../rmc-prelude.rs" ) ;
4
+
5
+ fn main ( ) {
6
+ let a: bool = __nondet ( ) ;
7
+ let b: bool = __nondet ( ) ;
8
+ let c = a ^ b;
9
+ assert ! ( ( a == b && !c) || ( a != b && c) ) ;
10
+ }
You can’t perform that action at this time.
0 commit comments