@@ -45,42 +45,18 @@ use crate::{
45
45
} ;
46
46
47
47
pub ( crate ) fn bin_op_to_icmp_predicate ( op : BinOp , signed : bool ) -> IntPredicate {
48
- match op {
49
- BinOp :: Eq => IntPredicate :: IntEQ ,
50
- BinOp :: Ne => IntPredicate :: IntNE ,
51
- BinOp :: Lt => {
52
- if signed {
53
- IntPredicate :: IntSLT
54
- } else {
55
- IntPredicate :: IntULT
56
- }
57
- }
58
- BinOp :: Le => {
59
- if signed {
60
- IntPredicate :: IntSLE
61
- } else {
62
- IntPredicate :: IntULE
63
- }
64
- }
65
- BinOp :: Gt => {
66
- if signed {
67
- IntPredicate :: IntSGT
68
- } else {
69
- IntPredicate :: IntUGT
70
- }
71
- }
72
- BinOp :: Ge => {
73
- if signed {
74
- IntPredicate :: IntSGE
75
- } else {
76
- IntPredicate :: IntUGE
77
- }
78
- }
79
- op => bug ! (
80
- "comparison_op_to_icmp_predicate: expected comparison operator, \
81
- found {:?}",
82
- op
83
- ) ,
48
+ match ( op, signed) {
49
+ ( BinOp :: Eq , _) => IntPredicate :: IntEQ ,
50
+ ( BinOp :: Ne , _) => IntPredicate :: IntNE ,
51
+ ( BinOp :: Lt , true ) => IntPredicate :: IntSLT ,
52
+ ( BinOp :: Lt , false ) => IntPredicate :: IntULT ,
53
+ ( BinOp :: Le , true ) => IntPredicate :: IntSLE ,
54
+ ( BinOp :: Le , false ) => IntPredicate :: IntULE ,
55
+ ( BinOp :: Gt , true ) => IntPredicate :: IntSGT ,
56
+ ( BinOp :: Gt , false ) => IntPredicate :: IntUGT ,
57
+ ( BinOp :: Ge , true ) => IntPredicate :: IntSGE ,
58
+ ( BinOp :: Ge , false ) => IntPredicate :: IntUGE ,
59
+ op => bug ! ( "bin_op_to_icmp_predicate: expected comparison operator, found {:?}" , op) ,
84
60
}
85
61
}
86
62
@@ -92,13 +68,7 @@ pub(crate) fn bin_op_to_fcmp_predicate(op: BinOp) -> RealPredicate {
92
68
BinOp :: Le => RealPredicate :: RealOLE ,
93
69
BinOp :: Gt => RealPredicate :: RealOGT ,
94
70
BinOp :: Ge => RealPredicate :: RealOGE ,
95
- op => {
96
- bug ! (
97
- "comparison_op_to_fcmp_predicate: expected comparison operator, \
98
- found {:?}",
99
- op
100
- ) ;
101
- }
71
+ op => bug ! ( "bin_op_to_fcmp_predicate: expected comparison operator, found {:?}" , op) ,
102
72
}
103
73
}
104
74
0 commit comments