Skip to content

Commit 0706281

Browse files
committed
add cases for MInt{8}, MInt{16}, and MInt{128}
1 parent b43935a commit 0706281

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

config/llvm_header.inc

+15
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,16 @@ entry:
251251
ret i64 %steps
252252
}
253253
254+
define i1 @hook_MINT_eq_8(i8 %0, i8 %1) {
255+
%ret = icmp eq i8 %0, %1
256+
ret i1 %ret
257+
}
258+
259+
define i1 @hook_MINT_eq_16(i16 %0, i16 %1) {
260+
%ret = icmp eq i16 %0, %1
261+
ret i1 %ret
262+
}
263+
254264
define i1 @hook_MINT_eq_32(i32 %0, i32 %1) {
255265
%ret = icmp eq i32 %0, %1
256266
ret i1 %ret
@@ -261,6 +271,11 @@ define i1 @hook_MINT_eq_64(i64 %0, i64 %1) {
261271
ret i1 %ret
262272
}
263273
274+
define i1 @hook_MINT_eq_128(i128 %0, i128 %1) {
275+
%ret = icmp eq i128 %0, %1
276+
ret i1 %ret
277+
}
278+
264279
define i1 @hook_MINT_eq_160(i160 %0, i160 %1) {
265280
%ret = icmp eq i160 %0, %1
266281
ret i1 %ret

debug/kgdb.py

+6
Original file line numberDiff line numberDiff line change
@@ -647,10 +647,16 @@ def append(self, subject, isVar, sort):
647647
self.result += "\\dv{" + sort + "}(\"" + string + "\")"
648648
elif cat == @STRINGBUFFER_LAYOUT@:
649649
self.appendStringBuffer(arg.cast(self.stringbuffer_ptr_ptr).dereference(), sort)
650+
elif cat == @MINT_LAYOUT@ + 8:
651+
self.appendMInt(arg, 1, sort)
652+
elif cat == @MINT_LAYOUT@ + 16:
653+
self.appendMInt(arg, 2, sort)
650654
elif cat == @MINT_LAYOUT@ + 32:
651655
self.appendMInt(arg, 4, sort)
652656
elif cat == @MINT_LAYOUT@ + 64:
653657
self.appendMInt(arg, 8, sort)
658+
elif cat == @MINT_LAYOUT@ + 128:
659+
self.appendMInt(arg, 16, sort)
654660
elif cat == @MINT_LAYOUT@ + 160:
655661
self.appendMInt(arg, 20, sort)
656662
elif cat == @MINT_LAYOUT@ + 256:

runtime/collections/hash.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ __attribute__((always_inline)) void add_hash8(void *h, uint8_t data) {
1919
hash_length++;
2020
}
2121

22+
__attribute__((always_inline)) void add_hash16(void *h, uint16_t data) {
23+
auto *buf = (uint8_t *)&data;
24+
add_hash8(h, buf[0]);
25+
add_hash8(h, buf[1]);
26+
}
27+
2228
__attribute__((always_inline)) void add_hash32(void *h, uint32_t data) {
2329
auto *buf = (uint8_t *)&data;
2430
add_hash8(h, buf[0]);
@@ -124,6 +130,16 @@ void k_hash(block *arg, void *h) {
124130
k_hash(*childptrptr, h);
125131
break;
126132
}
133+
case MINT_LAYOUT + 8: {
134+
auto *intptr = (uint8_t *)(argintptr + offset);
135+
add_hash8(h, *intptr);
136+
break;
137+
}
138+
case MINT_LAYOUT + 16: {
139+
auto *intptr = (uint16_t *)(argintptr + offset);
140+
add_hash16(h, *intptr);
141+
break;
142+
}
127143
case MINT_LAYOUT + 32: {
128144
auto *intptr = (uint32_t *)(argintptr + offset);
129145
add_hash32(h, *intptr);

runtime/collections/kelemle.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,24 @@ bool hook_KEQUAL_eq(block *arg1, block *arg2) {
125125
}
126126
break;
127127
}
128+
case MINT_LAYOUT + 8: {
129+
auto *child1ptr = (int8_t *)(child1intptr);
130+
auto *child2ptr = (int8_t *)(child2intptr);
131+
bool cmp = *child1ptr == *child2ptr;
132+
if (!cmp) {
133+
return false;
134+
}
135+
break;
136+
}
137+
case MINT_LAYOUT + 16: {
138+
auto *child1ptr = (int16_t *)(child1intptr);
139+
auto *child2ptr = (int16_t *)(child2intptr);
140+
bool cmp = *child1ptr == *child2ptr;
141+
if (!cmp) {
142+
return false;
143+
}
144+
break;
145+
}
128146
case MINT_LAYOUT + 32: {
129147
auto *child1ptr = (int32_t *)(child1intptr);
130148
auto *child2ptr = (int32_t *)(child2intptr);

0 commit comments

Comments
 (0)