Skip to content

Commit a15654c

Browse files
authored
[HWToBTOR2] Fix incorrect le/ge predicate name emission (#8028)
1 parent f58c2d9 commit a15654c

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

lib/Conversion/HWToBTOR2/HWToBTOR2.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,14 @@ struct ConvertHWToBTOR2Pass
711711
// Check for special cases where hw doesn't align with btor syntax
712712
if (pred == "ne")
713713
pred = "neq";
714+
else if (pred == "ule")
715+
pred = "ulte";
716+
else if (pred == "sle")
717+
pred = "slte";
718+
else if (pred == "uge")
719+
pred = "ugte";
720+
else if (pred == "sge")
721+
pred = "sgte";
714722

715723
// Width of result is always 1 for comparison
716724
genSort("bitvec", 1);

test/Conversion/HWToBTOR2/comb.mlir

+12
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ module {
3939
// CHECK: [[NID12:[0-9]+]] ugt [[NID3]] [[NID10]] 2
4040
%5 = comb.icmp bin ugt %3, %a : i32
4141

42+
// CHECK: [[NID13:[0-9]+]] ulte [[NID3]] [[NID10]] 2
43+
%6 = comb.icmp bin ule %3, %a : i32
44+
45+
// CHECK: [[NID14:[0-9]+]] slte [[NID3]] [[NID10]] 2
46+
%7 = comb.icmp bin sle %3, %a : i32
47+
48+
// CHECK: [[NID15:[0-9]+]] ugte [[NID3]] [[NID10]] 2
49+
%8 = comb.icmp bin uge %3, %a : i32
50+
51+
// CHECK: [[NID16:[0-9]+]] sgte [[NID3]] [[NID10]] 2
52+
%9 = comb.icmp bin sge %3, %a : i32
53+
4254
// CHECK: [[NID13:[0-9]+]] implies [[NID3]] [[NID5]] [[NID12]]
4355
// CHECK: [[NID14:[0-9]+]] not [[NID3]] [[NID13]]
4456
// CHECK: [[NID15:[0-9]+]] bad [[NID14:[0-9]+]]

0 commit comments

Comments
 (0)