File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 20
20
#include " ieee_float.h"
21
21
#include " invariant.h"
22
22
#include " namespace.h"
23
+ #include " pointer_offset_size.h"
23
24
#include " rational.h"
24
25
#include " rational_tools.h"
25
26
#include " std_expr.h"
@@ -1146,6 +1147,32 @@ bool simplify_exprt::simplify_extractbits(extractbits_exprt &expr)
1146
1147
1147
1148
return false ;
1148
1149
}
1150
+ else if (expr.src ().id () == ID_concatenation)
1151
+ {
1152
+ // the most-significant bit comes first in an concatenation_exprt, hence we
1153
+ // count down
1154
+ mp_integer offset = width;
1155
+
1156
+ forall_operands (it, expr.src ())
1157
+ {
1158
+ mp_integer op_width = pointer_offset_bits (it->type (), ns);
1159
+
1160
+ if (op_width <= 0 )
1161
+ return true ;
1162
+
1163
+ if (start + 1 == offset && end + op_width == offset)
1164
+ {
1165
+ exprt tmp = *it;
1166
+ if (tmp.type () != expr.type ())
1167
+ return true ;
1168
+
1169
+ expr.swap (tmp);
1170
+ return false ;
1171
+ }
1172
+
1173
+ offset -= op_width;
1174
+ }
1175
+ }
1149
1176
1150
1177
return true ;
1151
1178
}
You can’t perform that action at this time.
0 commit comments