Skip to content

Commit d194fa1

Browse files
author
Dwight Guth
authored
Equality function on mint (#1138)
This is used by the pattern matcher when nonlinear matching occurs.
1 parent 9418f9d commit d194fa1

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

config/llvm_header.inc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,5 +256,25 @@ entry:
256256
ret i64 %steps
257257
}
258258
259+
define i1 @hook_MINT_eq_32(i32 %0, i32 %1) {
260+
%ret = icmp eq i32 %0, %1
261+
ret i1 %ret
262+
}
263+
264+
define i1 @hook_MINT_eq_64(i64 %0, i64 %1) {
265+
%ret = icmp eq i64 %0, %1
266+
ret i1 %ret
267+
}
268+
269+
define i1 @hook_MINT_eq_160(i160 %0, i160 %1) {
270+
%ret = icmp eq i160 %0, %1
271+
ret i1 %ret
272+
}
273+
274+
define i1 @hook_MINT_eq_256(i256 %0, i256 %1) {
275+
%ret = icmp eq i256 %0, %1
276+
ret i1 %ret
277+
}
278+
259279
attributes #0 = { noreturn }
260280
)LLVM"

matching/src/main/scala/org/kframework/backend/llvm/matching/pattern/SortCategory.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,6 @@ case class MIntS(bitwidth: Int) extends SortCategory {
663663
matrix.compiledCases,
664664
matrix.compiledDefault
665665
)
666-
def equalityFun: String = ???
666+
def equalityFun: String = "hook_MINT_eq_" + bitwidth
667667
override def length(rawLength: Int): Int = 1 << bitwidth
668668
}

0 commit comments

Comments
 (0)