on master help sign in
C codegen for bitmanip and bit comparators
commit88eb2bf5b5085da1097c64de4cf679bd58f6a7fa authorErkin Batu Altunbaş <erkinbatu@gmail.com> dateFri 28 Dec 2012, 00:34 (14 years ago) parentebacfee
3 files changed+492−48
rts/idris_bitstring.c+384−48 rts/idris_bitstring.h+52 src/IRTS/CodegenC.hs+56
rts/idris_bitstring.c+384−48
@@ -95,45 +95,87 @@ VAL idris_b8SDiv(VM *vm, VAL a, VAL b) {
9595 return cl;
9696}
9797
98−VAL idris_b8Z16(VM *vm, VAL a) {
98+VAL idris_b8Lt(VM *vm, VAL a, VAL b) {
9999 VAL cl = allocate(vm, sizeof(Closure), 0);
100− SETTY(cl, BITS16);
101− cl->info.bits16 = (uint16_t) a->info.bits8;
100+ SETTY(cl, BITS8);
101+ cl->info.bits8 = a->info.bits8 < b->info.bits8;
102102 return cl;
103103}
104104
105−VAL idris_b8Z32(VM *vm, VAL a) {
105+VAL idris_b8Gt(VM *vm, VAL a, VAL b) {
106106 VAL cl = allocate(vm, sizeof(Closure), 0);
107− SETTY(cl, BITS32);
108− cl->info.bits32 = (uint32_t) a->info.bits8;
107+ SETTY(cl, BITS8);
108+ cl->info.bits8 = a->info.bits8 > b->info.bits8;
109109 return cl;
110110}
111111
112−VAL idris_b8Z64(VM *vm, VAL a) {
112+VAL idris_b8Eq(VM *vm, VAL a, VAL b) {
113113 VAL cl = allocate(vm, sizeof(Closure), 0);
114− SETTY(cl, BITS16);
115− cl->info.bits64 = (uint64_t) a->info.bits8;
114+ SETTY(cl, BITS8);
115+ cl->info.bits8 = a->info.bits8 == b->info.bits8;
116116 return cl;
117117}
118118
119−VAL idris_b8S16(VM *vm, VAL a) {
119+VAL idris_b8Lte(VM *vm, VAL a, VAL b) {
120120 VAL cl = allocate(vm, sizeof(Closure), 0);
121− SETTY(cl, BITS16);
122− cl->info.bits16 = (uint16_t) (int16_t) (int8_t) a->info.bits8;
121+ SETTY(cl, BITS8);
122+ cl->info.bits8 = a->info.bits8 <= b->info.bits8;
123123 return cl;
124124}
125125
126−VAL idris_b8S32(VM *vm, VAL a) {
126+VAL idris_b8Gte(VM *vm, VAL a, VAL b) {
127127 VAL cl = allocate(vm, sizeof(Closure), 0);
128− SETTY(cl, BITS32);
129− cl->info.bits32 = (uint32_t) (int32_t) (int8_t) a->info.bits8;
128+ SETTY(cl, BITS8);
129+ cl->info.bits8 = a->info.bits8 >= b->info.bits8;
130130 return cl;
131131}
132132
133−VAL idris_b8S64(VM *vm, VAL a) {
133+VAL idris_b8Compl(VM *vm, VAL a) {
134134 VAL cl = allocate(vm, sizeof(Closure), 0);
135− SETTY(cl, BITS64);
136− cl->info.bits64 = (uint64_t) (int64_t) (int8_t) a->info.bits8;
135+ SETTY(cl, BITS8);
136+ cl->info.bits8 = ~ a->info.bits8;
137+ return cl;
138+}
139+
140+VAL idris_b8And(VM *vm, VAL a, VAL b) {
141+ VAL cl = allocate(vm, sizeof(Closure), 0);
142+ SETTY(cl, BITS8);
143+ cl->info.bits8 = a->info.bits8 & b->info.bits8;
144+ return cl;
145+}
146+
147+VAL idris_b8Or(VM *vm, VAL a, VAL b) {
148+ VAL cl = allocate(vm, sizeof(Closure), 0);
149+ SETTY(cl, BITS8);
150+ cl->info.bits8 = a->info.bits8 | b->info.bits8;
151+ return cl;
152+}
153+
154+VAL idris_b8Xor(VM *vm, VAL a, VAL b) {
155+ VAL cl = allocate(vm, sizeof(Closure), 0);
156+ SETTY(cl, BITS8);
157+ cl->info.bits8 = a->info.bits8 ^ b->info.bits8;
158+ return cl;
159+}
160+
161+VAL idris_b8Shl(VM *vm, VAL a, VAL b) {
162+ VAL cl = allocate(vm, sizeof(Closure), 0);
163+ SETTY(cl, BITS8);
164+ cl->info.bits8 = a->info.bits8 << b->info.bits8;
165+ return cl;
166+}
167+
168+VAL idris_b8LShr(VM *vm, VAL a, VAL b) {
169+ VAL cl = allocate(vm, sizeof(Closure), 0);
170+ SETTY(cl, BITS8);
171+ cl->info.bits8 = a->info.bits8 >> b->info.bits8;
172+ return cl;
173+}
174+
175+VAL idris_b8AShr(VM *vm, VAL a, VAL b) {
176+ VAL cl = allocate(vm, sizeof(Closure), 0);
177+ SETTY(cl, BITS8);
178+ cl->info.bits8 = (uint8_t) (((int8_t)a->info.bits8) >> ((int8_t)b->info.bits8));
137179 return cl;
138180}
139181
@@ -169,42 +211,91 @@ VAL idris_b16SDiv(VM *vm, VAL a, VAL b) {
169211 VAL cl = allocate(vm, sizeof(Closure), 0);
170212 SETTY(cl, BITS16);
171213 cl->info.bits16 =
172− (uint16_t) (((int16_t) a->info.bits16) / ((int16_t) b->info.bits16));
214+ (uint16_t) (((int16_t) a->info.bits16) / ((int16_t) b->info.bits16));
173215 return cl;
174216}
175217
176−VAL idris_b16Z32(VM *vm, VAL a) {
218+VAL idris_b16Lt(VM *vm, VAL a, VAL b) {
177219 VAL cl = allocate(vm, sizeof(Closure), 0);
178− SETTY(cl, BITS32);
179− cl->info.bits32 = (uint32_t) a->info.bits16;
220+ SETTY(cl, BITS16);
221+ cl->info.bits16 = a->info.bits16 < b->info.bits16;
180222 return cl;
181223}
182224
183−VAL idris_b16Z64(VM *vm, VAL a) {
225+VAL idris_b16Gt(VM *vm, VAL a, VAL b) {
184226 VAL cl = allocate(vm, sizeof(Closure), 0);
185− SETTY(cl, BITS64);
186− cl->info.bits64 = (uint64_t) a->info.bits16;
227+ SETTY(cl, BITS16);
228+ cl->info.bits16 = a->info.bits16 > b->info.bits16;
187229 return cl;
188230}
189231
190−VAL idris_b16S32(VM *vm, VAL a) {
232+VAL idris_b16Eq(VM *vm, VAL a, VAL b) {
191233 VAL cl = allocate(vm, sizeof(Closure), 0);
192− SETTY(cl, BITS32);
193− cl->info.bits32 = (uint32_t) (int32_t) (int16_t) a->info.bits16;
234+ SETTY(cl, BITS16);
235+ cl->info.bits16 = a->info.bits16 == b->info.bits16;
194236 return cl;
195237}
196238
197−VAL idris_b16S64(VM *vm, VAL a) {
239+VAL idris_b16Lte(VM *vm, VAL a, VAL b) {
198240 VAL cl = allocate(vm, sizeof(Closure), 0);
199− SETTY(cl, BITS64);
200− cl->info.bits64 = (uint64_t) (int64_t) (int16_t) a->info.bits16;
241+ SETTY(cl, BITS16);
242+ cl->info.bits16 = a->info.bits16 <= b->info.bits16;
201243 return cl;
202244}
203245
204−VAL idris_b16T8(VM *vm, VAL a) {
246+VAL idris_b16Gte(VM *vm, VAL a, VAL b) {
205247 VAL cl = allocate(vm, sizeof(Closure), 0);
206− SETTY(cl, BITS8);
207− cl->info.bits8 = (uint8_t) a->info.bits16;
248+ SETTY(cl, BITS16);
249+ cl->info.bits16 = a->info.bits16 >= b->info.bits16;
250+ return cl;
251+}
252+
253+VAL idris_b16Compl(VM *vm, VAL a) {
254+ VAL cl = allocate(vm, sizeof(Closure), 0);
255+ SETTY(cl, BITS16);
256+ cl->info.bits16 = ~ a->info.bits16;
257+ return cl;
258+}
259+
260+VAL idris_b16And(VM *vm, VAL a, VAL b) {
261+ VAL cl = allocate(vm, sizeof(Closure), 0);
262+ SETTY(cl, BITS16);
263+ cl->info.bits16 = a->info.bits16 & b->info.bits16;
264+ return cl;
265+}
266+
267+VAL idris_b16Or(VM *vm, VAL a, VAL b) {
268+ VAL cl = allocate(vm, sizeof(Closure), 0);
269+ SETTY(cl, BITS16);
270+ cl->info.bits16 = a->info.bits16 | b->info.bits16;
271+ return cl;
272+}
273+
274+VAL idris_b16Xor(VM *vm, VAL a, VAL b) {
275+ VAL cl = allocate(vm, sizeof(Closure), 0);
276+ SETTY(cl, BITS16);
277+ cl->info.bits16 = a->info.bits16 ^ b->info.bits16;
278+ return cl;
279+}
280+
281+VAL idris_b16Shl(VM *vm, VAL a, VAL b) {
282+ VAL cl = allocate(vm, sizeof(Closure), 0);
283+ SETTY(cl, BITS16);
284+ cl->info.bits16 = a->info.bits16 << b->info.bits16;
285+ return cl;
286+}
287+
288+VAL idris_b16LShr(VM *vm, VAL a, VAL b) {
289+ VAL cl = allocate(vm, sizeof(Closure), 0);
290+ SETTY(cl, BITS16);
291+ cl->info.bits16 = a->info.bits16 >> b->info.bits16;
292+ return cl;
293+}
294+
295+VAL idris_b16AShr(VM *vm, VAL a, VAL b) {
296+ VAL cl = allocate(vm, sizeof(Closure), 0);
297+ SETTY(cl, BITS16);
298+ cl->info.bits16 = (uint16_t) (((int16_t)a->info.bits16) >> ((int16_t)b->info.bits16));
208299 return cl;
209300}
210301
@@ -240,35 +331,91 @@ VAL idris_b32SDiv(VM *vm, VAL a, VAL b) {
240331 VAL cl = allocate(vm, sizeof(Closure), 0);
241332 SETTY(cl, BITS32);
242333 cl->info.bits32 =
243− (uint32_t) (((int32_t) a->info.bits32) / ((int32_t) b->info.bits32));
334+ (uint32_t) (((int32_t) a->info.bits32) / ((int32_t) b->info.bits32));
244335 return cl;
245336}
246337
247−VAL idris_b32Z64(VM *vm, VAL a) {
338+VAL idris_b32Lt(VM *vm, VAL a, VAL b) {
248339 VAL cl = allocate(vm, sizeof(Closure), 0);
249− SETTY(cl, BITS64);
250− cl->info.bits64 = (uint64_t) a->info.bits32;
340+ SETTY(cl, BITS32);
341+ cl->info.bits32 = a->info.bits32 < b->info.bits32;
251342 return cl;
252343}
253344
254−VAL idris_b32S64(VM *vm, VAL a) {
345+VAL idris_b32Gt(VM *vm, VAL a, VAL b) {
255346 VAL cl = allocate(vm, sizeof(Closure), 0);
256− SETTY(cl, BITS64);
257− cl->info.bits64 = (uint64_t) (int64_t) (int32_t) a->info.bits32;
347+ SETTY(cl, BITS32);
348+ cl->info.bits32 = a->info.bits32 > b->info.bits32;
258349 return cl;
259350}
260351
261−VAL idris_b32T8(VM *vm, VAL a) {
352+VAL idris_b32Eq(VM *vm, VAL a, VAL b) {
262353 VAL cl = allocate(vm, sizeof(Closure), 0);
263− SETTY(cl, BITS8);
264− cl->info.bits8 = (uint8_t) a->info.bits32;
354+ SETTY(cl, BITS32);
355+ cl->info.bits32 = a->info.bits32 == b->info.bits32;
265356 return cl;
266357}
267358
268−VAL idris_b32T16(VM *vm, VAL a) {
359+VAL idris_b32Lte(VM *vm, VAL a, VAL b) {
269360 VAL cl = allocate(vm, sizeof(Closure), 0);
270− SETTY(cl, BITS16);
271− cl->info.bits16 = (uint16_t) a->info.bits32;
361+ SETTY(cl, BITS32);
362+ cl->info.bits32 = a->info.bits32 <= b->info.bits32;
363+ return cl;
364+}
365+
366+VAL idris_b32Gte(VM *vm, VAL a, VAL b) {
367+ VAL cl = allocate(vm, sizeof(Closure), 0);
368+ SETTY(cl, BITS32);
369+ cl->info.bits32 = a->info.bits32 >= b->info.bits32;
370+ return cl;
371+}
372+
373+VAL idris_b32Compl(VM *vm, VAL a) {
374+ VAL cl = allocate(vm, sizeof(Closure), 0);
375+ SETTY(cl, BITS32);
376+ cl->info.bits32 = ~ a->info.bits32;
377+ return cl;
378+}
379+
380+VAL idris_b32And(VM *vm, VAL a, VAL b) {
381+ VAL cl = allocate(vm, sizeof(Closure), 0);
382+ SETTY(cl, BITS32);
383+ cl->info.bits32 = a->info.bits32 & b->info.bits32;
384+ return cl;
385+}
386+
387+VAL idris_b32Or(VM *vm, VAL a, VAL b) {
388+ VAL cl = allocate(vm, sizeof(Closure), 0);
389+ SETTY(cl, BITS32);
390+ cl->info.bits32 = a->info.bits32 | b->info.bits32;
391+ return cl;
392+}
393+
394+VAL idris_b32Xor(VM *vm, VAL a, VAL b) {
395+ VAL cl = allocate(vm, sizeof(Closure), 0);
396+ SETTY(cl, BITS32);
397+ cl->info.bits32 = a->info.bits32 ^ b->info.bits32;
398+ return cl;
399+}
400+
401+VAL idris_b32Shl(VM *vm, VAL a, VAL b) {
402+ VAL cl = allocate(vm, sizeof(Closure), 0);
403+ SETTY(cl, BITS32);
404+ cl->info.bits32 = a->info.bits32 << b->info.bits32;
405+ return cl;
406+}
407+
408+VAL idris_b32LShr(VM *vm, VAL a, VAL b) {
409+ VAL cl = allocate(vm, sizeof(Closure), 0);
410+ SETTY(cl, BITS32);
411+ cl->info.bits32 = a->info.bits32 >> b->info.bits32;
412+ return cl;
413+}
414+
415+VAL idris_b32AShr(VM *vm, VAL a, VAL b) {
416+ VAL cl = allocate(vm, sizeof(Closure), 0);
417+ SETTY(cl, BITS32);
418+ cl->info.bits32 = (uint32_t) (((int32_t)a->info.bits32) >> ((int32_t)b->info.bits32));
272419 return cl;
273420}
274421
@@ -304,7 +451,196 @@ VAL idris_b64SDiv(VM *vm, VAL a, VAL b) {
304451 VAL cl = allocate(vm, sizeof(Closure), 0);
305452 SETTY(cl, BITS64);
306453 cl->info.bits64 =
307− (uint64_t) (((int64_t) a->info.bits64) / ((int64_t) b->info.bits64));
454+ (uint64_t) (((int64_t) a->info.bits64) / ((int64_t) b->info.bits64));
455+ return cl;
456+}
457+
458+VAL idris_b64Lt(VM *vm, VAL a, VAL b) {
459+ VAL cl = allocate(vm, sizeof(Closure), 0);
460+ SETTY(cl, BITS64);
461+ cl->info.bits64 = a->info.bits64 < b->info.bits64;
462+ return cl;
463+}
464+
465+VAL idris_b64Gt(VM *vm, VAL a, VAL b) {
466+ VAL cl = allocate(vm, sizeof(Closure), 0);
467+ SETTY(cl, BITS64);
468+ cl->info.bits64 = a->info.bits64 > b->info.bits64;
469+ return cl;
470+}
471+
472+VAL idris_b64Eq(VM *vm, VAL a, VAL b) {
473+ VAL cl = allocate(vm, sizeof(Closure), 0);
474+ SETTY(cl, BITS64);
475+ cl->info.bits64 = a->info.bits64 == b->info.bits64;
476+ return cl;
477+}
478+
479+VAL idris_b64Lte(VM *vm, VAL a, VAL b) {
480+ VAL cl = allocate(vm, sizeof(Closure), 0);
481+ SETTY(cl, BITS64);
482+ cl->info.bits64 = a->info.bits64 <= b->info.bits64;
483+ return cl;
484+}
485+
486+VAL idris_b64Gte(VM *vm, VAL a, VAL b) {
487+ VAL cl = allocate(vm, sizeof(Closure), 0);
488+ SETTY(cl, BITS64);
489+ cl->info.bits64 = a->info.bits64 >= b->info.bits64;
490+ return cl;
491+}
492+
493+VAL idris_b64Compl(VM *vm, VAL a) {
494+ VAL cl = allocate(vm, sizeof(Closure), 0);
495+ SETTY(cl, BITS64);
496+ cl->info.bits64 = ~ a->info.bits64;
497+ return cl;
498+}
499+
500+VAL idris_b64And(VM *vm, VAL a, VAL b) {
501+ VAL cl = allocate(vm, sizeof(Closure), 0);
502+ SETTY(cl, BITS64);
503+ cl->info.bits64 = a->info.bits64 & b->info.bits64;
504+ return cl;
505+}
506+
507+VAL idris_b64Or(VM *vm, VAL a, VAL b) {
508+ VAL cl = allocate(vm, sizeof(Closure), 0);
509+ SETTY(cl, BITS64);
510+ cl->info.bits64 = a->info.bits64 | b->info.bits64;
511+ return cl;
512+}
513+
514+VAL idris_b64Xor(VM *vm, VAL a, VAL b) {
515+ VAL cl = allocate(vm, sizeof(Closure), 0);
516+ SETTY(cl, BITS64);
517+ cl->info.bits64 = a->info.bits64 ^ b->info.bits64;
518+ return cl;
519+}
520+
521+VAL idris_b64Shl(VM *vm, VAL a, VAL b) {
522+ VAL cl = allocate(vm, sizeof(Closure), 0);
523+ SETTY(cl, BITS64);
524+ cl->info.bits64 = a->info.bits64 << b->info.bits64;
525+ return cl;
526+}
527+
528+VAL idris_b64LShr(VM *vm, VAL a, VAL b) {
529+ VAL cl = allocate(vm, sizeof(Closure), 0);
530+ SETTY(cl, BITS64);
531+ cl->info.bits64 = a->info.bits64 >> b->info.bits64;
532+ return cl;
533+}
534+
535+VAL idris_b64AShr(VM *vm, VAL a, VAL b) {
536+ VAL cl = allocate(vm, sizeof(Closure), 0);
537+ SETTY(cl, BITS64);
538+ cl->info.bits64 = (uint64_t) (((int64_t)a->info.bits64) >> ((int64_t)b->info.bits64));
539+ return cl;
540+}
541+
542+VAL idris_b8Z16(VM *vm, VAL a) {
543+ VAL cl = allocate(vm, sizeof(Closure), 0);
544+ SETTY(cl, BITS16);
545+ cl->info.bits16 = (uint16_t) a->info.bits8;
546+ return cl;
547+}
548+
549+VAL idris_b8Z32(VM *vm, VAL a) {
550+ VAL cl = allocate(vm, sizeof(Closure), 0);
551+ SETTY(cl, BITS32);
552+ cl->info.bits32 = (uint32_t) a->info.bits8;
553+ return cl;
554+}
555+
556+VAL idris_b8Z64(VM *vm, VAL a) {
557+ VAL cl = allocate(vm, sizeof(Closure), 0);
558+ SETTY(cl, BITS16);
559+ cl->info.bits64 = (uint64_t) a->info.bits8;
560+ return cl;
561+}
562+
563+VAL idris_b8S16(VM *vm, VAL a) {
564+ VAL cl = allocate(vm, sizeof(Closure), 0);
565+ SETTY(cl, BITS16);
566+ cl->info.bits16 = (uint16_t) (int16_t) (int8_t) a->info.bits8;
567+ return cl;
568+}
569+
570+VAL idris_b8S32(VM *vm, VAL a) {
571+ VAL cl = allocate(vm, sizeof(Closure), 0);
572+ SETTY(cl, BITS32);
573+ cl->info.bits32 = (uint32_t) (int32_t) (int8_t) a->info.bits8;
574+ return cl;
575+}
576+
577+VAL idris_b8S64(VM *vm, VAL a) {
578+ VAL cl = allocate(vm, sizeof(Closure), 0);
579+ SETTY(cl, BITS64);
580+ cl->info.bits64 = (uint64_t) (int64_t) (int8_t) a->info.bits8;
581+ return cl;
582+}
583+
584+VAL idris_b16Z32(VM *vm, VAL a) {
585+ VAL cl = allocate(vm, sizeof(Closure), 0);
586+ SETTY(cl, BITS32);
587+ cl->info.bits32 = (uint32_t) a->info.bits16;
588+ return cl;
589+}
590+
591+VAL idris_b16Z64(VM *vm, VAL a) {
592+ VAL cl = allocate(vm, sizeof(Closure), 0);
593+ SETTY(cl, BITS64);
594+ cl->info.bits64 = (uint64_t) a->info.bits16;
595+ return cl;
596+}
597+
598+VAL idris_b16S32(VM *vm, VAL a) {
599+ VAL cl = allocate(vm, sizeof(Closure), 0);
600+ SETTY(cl, BITS32);
601+ cl->info.bits32 = (uint32_t) (int32_t) (int16_t) a->info.bits16;
602+ return cl;
603+}
604+
605+VAL idris_b16S64(VM *vm, VAL a) {
606+ VAL cl = allocate(vm, sizeof(Closure), 0);
607+ SETTY(cl, BITS64);
608+ cl->info.bits64 = (uint64_t) (int64_t) (int16_t) a->info.bits16;
609+ return cl;
610+}
611+
612+VAL idris_b16T8(VM *vm, VAL a) {
613+ VAL cl = allocate(vm, sizeof(Closure), 0);
614+ SETTY(cl, BITS8);
615+ cl->info.bits8 = (uint8_t) a->info.bits16;
616+ return cl;
617+}
618+
619+VAL idris_b32Z64(VM *vm, VAL a) {
620+ VAL cl = allocate(vm, sizeof(Closure), 0);
621+ SETTY(cl, BITS64);
622+ cl->info.bits64 = (uint64_t) a->info.bits32;
623+ return cl;
624+}
625+
626+VAL idris_b32S64(VM *vm, VAL a) {
627+ VAL cl = allocate(vm, sizeof(Closure), 0);
628+ SETTY(cl, BITS64);
629+ cl->info.bits64 = (uint64_t) (int64_t) (int32_t) a->info.bits32;
630+ return cl;
631+}
632+
633+VAL idris_b32T8(VM *vm, VAL a) {
634+ VAL cl = allocate(vm, sizeof(Closure), 0);
635+ SETTY(cl, BITS8);
636+ cl->info.bits8 = (uint8_t) a->info.bits32;
637+ return cl;
638+}
639+
640+VAL idris_b32T16(VM *vm, VAL a) {
641+ VAL cl = allocate(vm, sizeof(Closure), 0);
642+ SETTY(cl, BITS16);
643+ cl->info.bits16 = (uint16_t) a->info.bits32;
308644 return cl;
309645}
310646
rts/idris_bitstring.h+52
@@ -16,6 +16,22 @@ VAL idris_b8Minus(VM *vm, VAL a, VAL b);
1616VAL idris_b8Times(VM *vm, VAL a, VAL b);
1717VAL idris_b8UDiv(VM *vm, VAL a, VAL b);
1818VAL idris_b8SDiv(VM *vm, VAL a, VAL b);
19+VAL idris_b8Lt(VM *vm, VAL a, VAL b);
20+VAL idris_b8Gt(VM *vm, VAL a, VAL b);
21+VAL idris_b8Eq(VM *vm, VAL a, VAL b);
22+VAL idris_b8Lte(VM *vm, VAL a, VAL b);
23+VAL idris_b8Gte(VM *vm, VAL a, VAL b);
24+VAL idris_b8And(VM *vm, VAL a, VAL b);
25+VAL idris_b8Or(VM *vm, VAL a, VAL b);
26+VAL idris_b8Neg(VM *vm, VAL a);
27+VAL idris_b8XOr(VM *vm, VAL a, VAL b);
28+VAL idris_b8Shl(VM *vm, VAL a, VAL b);
29+VAL idris_b8LShr(VM *vm, VAL a, VAL b);
30+VAL idris_b8AShr(VM *vm, VAL a, VAL b);
31+
32+VAL idris_b16Eq(VM *vm, VAL a, VAL b);
33+VAL idris_b32Eq(VM *vm, VAL a, VAL b);
34+VAL idris_b64Eq(VM *vm, VAL a, VAL b);
1935
2036VAL idris_b8Z16(VM *vm, VAL a);
2137VAL idris_b8Z32(VM *vm, VAL a);
@@ -29,6 +45,18 @@ VAL idris_b16Minus(VM *vm, VAL a, VAL b);
2945VAL idris_b16Times(VM *vm, VAL a, VAL b);
3046VAL idris_b16UDiv(VM *vm, VAL a, VAL b);
3147VAL idris_b16SDiv(VM *vm, VAL a, VAL b);
48+VAL idris_b16Lt(VM *vm, VAL a, VAL b);
49+VAL idris_b16Gt(VM *vm, VAL a, VAL b);
50+VAL idris_b16Eq(VM *vm, VAL a, VAL b);
51+VAL idris_b16Lte(VM *vm, VAL a, VAL b);
52+VAL idris_b16Gte(VM *vm, VAL a, VAL b);
53+VAL idris_b16And(VM *vm, VAL a, VAL b);
54+VAL idris_b16Or(VM *vm, VAL a, VAL b);
55+VAL idris_b16Neg(VM *vm, VAL a);
56+VAL idris_b16XOr(VM *vm, VAL a, VAL b);
57+VAL idris_b16Shl(VM *vm, VAL a, VAL b);
58+VAL idris_b16LShr(VM *vm, VAL a, VAL b);
59+VAL idris_b16AShr(VM *vm, VAL a, VAL b);
3260
3361VAL idris_b16Z32(VM *vm, VAL a);
3462VAL idris_b16Z64(VM *vm, VAL a);
@@ -41,6 +69,18 @@ VAL idris_b32Minus(VM *vm, VAL a, VAL b);
4169VAL idris_b32Times(VM *vm, VAL a, VAL b);
4270VAL idris_b32UDiv(VM *vm, VAL a, VAL b);
4371VAL idris_b32SDiv(VM *vm, VAL a, VAL b);
72+VAL idris_b32Lt(VM *vm, VAL a, VAL b);
73+VAL idris_b32Gt(VM *vm, VAL a, VAL b);
74+VAL idris_b32Eq(VM *vm, VAL a, VAL b);
75+VAL idris_b32Lte(VM *vm, VAL a, VAL b);
76+VAL idris_b32Gte(VM *vm, VAL a, VAL b);
77+VAL idris_b32And(VM *vm, VAL a, VAL b);
78+VAL idris_b32Or(VM *vm, VAL a, VAL b);
79+VAL idris_b32Neg(VM *vm, VAL a);
80+VAL idris_b32XOr(VM *vm, VAL a, VAL b);
81+VAL idris_b32Shl(VM *vm, VAL a, VAL b);
82+VAL idris_b32LShr(VM *vm, VAL a, VAL b);
83+VAL idris_b32AShr(VM *vm, VAL a, VAL b);
4484
4585VAL idris_b32Z64(VM *vm, VAL a);
4686VAL idris_b32S64(VM *vm, VAL a);
@@ -52,6 +92,18 @@ VAL idris_b64Minus(VM *vm, VAL a, VAL b);
5292VAL idris_b64Times(VM *vm, VAL a, VAL b);
5393VAL idris_b64UDiv(VM *vm, VAL a, VAL b);
5494VAL idris_b64SDiv(VM *vm, VAL a, VAL b);
95+VAL idris_b64Lt(VM *vm, VAL a, VAL b);
96+VAL idris_b64Gt(VM *vm, VAL a, VAL b);
97+VAL idris_b64Eq(VM *vm, VAL a, VAL b);
98+VAL idris_b64Lte(VM *vm, VAL a, VAL b);
99+VAL idris_b64Gte(VM *vm, VAL a, VAL b);
100+VAL idris_b64And(VM *vm, VAL a, VAL b);
101+VAL idris_b64Or(VM *vm, VAL a, VAL b);
102+VAL idris_b64Neg(VM *vm, VAL a);
103+VAL idris_b64XOr(VM *vm, VAL a, VAL b);
104+VAL idris_b64Shl(VM *vm, VAL a, VAL b);
105+VAL idris_b64LShr(VM *vm, VAL a, VAL b);
106+VAL idris_b64AShr(VM *vm, VAL a, VAL b);
55107
56108VAL idris_b64T8(VM *vm, VAL a);
57109VAL idris_b64T16(VM *vm, VAL a);
src/IRTS/CodegenC.hs+56
@@ -304,6 +304,20 @@ doOp v LIntB64 [x] = v ++ "idris_b64(" ++ creg x ++ ")"
304304
305305doOp v LB32Int [x] = v ++ "idris_castB32Int(" ++ creg x ++ ")"
306306
307+doOp v LB8Lt [x, y] = v ++ "idris_b8Lt(" ++ creg x ++ "," ++ creg y ++ ")"
308+doOp v LB8Lte [x, y] = v ++ "idris_b8Lte(" ++ creg x ++ "," ++ creg y ++ ")"
309+doOp v LB8Eq [x, y] = v ++ "idris_b8Eq(" ++ creg x ++ "," ++ creg y ++ ")"
310+doOp v LB8Gte [x, y] = v ++ "idris_b8Gte(" ++ creg x ++ "," ++ creg y ++ ")"
311+doOp v LB8Gt [x, y] = v ++ "idris_b8Gt(" ++ creg x ++ "," ++ creg y ++ ")"
312+
313+doOp v LB8Shl [x, y] = v ++ "idris_b8Shl(" ++ creg x ++ "," ++ creg y ++ ")"
314+doOp v LB8LShr [x, y] = v ++ "idris_b8Shr(" ++ creg x ++ "," ++ creg y ++ ")"
315+doOp v LB8AShr [x, y] = v ++ "idris_b8AShr(" ++ creg x ++ "," ++ creg y ++ ")"
316+doOp v LB8And [x, y] = v ++ "idris_b8And(" ++ creg x ++ "," ++ creg y ++ ")"
317+doOp v LB8Or [x, y] = v ++ "idris_b8Or(" ++ creg x ++ "," ++ creg y ++ ")"
318+doOp v LB8Xor [x, y] = v ++ "idris_b8Xor(" ++ creg x ++ "," ++ creg y ++ ")"
319+doOp v LB8Compl [x, y] = v ++ "idris_b8Compl(" ++ creg x ++ "," ++ creg y ++ ")"
320+
307321doOp v LB8Plus [x, y] = v ++ "idris_b8Plus(" ++ creg x ++ "," ++ creg y ++ ")"
308322doOp v LB8Minus [x, y] = v ++ "idris_b8Minus(" ++ creg x ++ "," ++ creg y ++ ")"
309323doOp v LB8Times [x, y] = v ++ "idris_b8Times(" ++ creg x ++ "," ++ creg y ++ ")"
@@ -317,6 +331,20 @@ doOp v LB8S16 [x] = v ++ "idris_b8S16(" ++ creg x ++ ")"
317331doOp v LB8S32 [x] = v ++ "idris_b8S32(" ++ creg x ++ ")"
318332doOp v LB8S64 [x] = v ++ "idris_b8S64(" ++ creg x ++ ")"
319333
334+doOp v LB16Lt [x, y] = v ++ "idris_b16Lt(" ++ creg x ++ "," ++ creg y ++ ")"
335+doOp v LB16Lte [x, y] = v ++ "idris_b16Lte(" ++ creg x ++ "," ++ creg y ++ ")"
336+doOp v LB16Eq [x, y] = v ++ "idris_b16Eq(" ++ creg x ++ "," ++ creg y ++ ")"
337+doOp v LB16Gte [x, y] = v ++ "idris_b16Gte(" ++ creg x ++ "," ++ creg y ++ ")"
338+doOp v LB16Gt [x, y] = v ++ "idris_b16Gt(" ++ creg x ++ "," ++ creg y ++ ")"
339+
340+doOp v LB16Shl [x, y] = v ++ "idris_b16Shl(" ++ creg x ++ "," ++ creg y ++ ")"
341+doOp v LB16LShr [x, y] = v ++ "idris_b16Shr(" ++ creg x ++ "," ++ creg y ++ ")"
342+doOp v LB16AShr [x, y] = v ++ "idris_b16AShr(" ++ creg x ++ "," ++ creg y ++ ")"
343+doOp v LB16And [x, y] = v ++ "idris_b16And(" ++ creg x ++ "," ++ creg y ++ ")"
344+doOp v LB16Or [x, y] = v ++ "idris_b16Or(" ++ creg x ++ "," ++ creg y ++ ")"
345+doOp v LB16Xor [x, y] = v ++ "idris_b16Xor(" ++ creg x ++ "," ++ creg y ++ ")"
346+doOp v LB16Compl [x, y] = v ++ "idris_b16Compl(" ++ creg x ++ "," ++ creg y ++ ")"
347+
320348doOp v LB16Plus [x, y] =
321349 v ++ "idris_b16Plus(" ++ creg x ++ "," ++ creg y ++ ")"
322350doOp v LB16Minus [x, y] =
@@ -334,6 +362,20 @@ doOp v LB16S32 [x] = v ++ "idris_b16S32(" ++ creg x ++ ")"
334362doOp v LB16S64 [x] = v ++ "idris_b16S64(" ++ creg x ++ ")"
335363doOp v LB16T8 [x] = v ++ "idris_b16T8(" ++ creg x ++ ")"
336364
365+doOp v LB32Lt [x, y] = v ++ "idris_b32Lt(" ++ creg x ++ "," ++ creg y ++ ")"
366+doOp v LB32Lte [x, y] = v ++ "idris_b32Lte(" ++ creg x ++ "," ++ creg y ++ ")"
367+doOp v LB32Eq [x, y] = v ++ "idris_b32Eq(" ++ creg x ++ "," ++ creg y ++ ")"
368+doOp v LB32Gte [x, y] = v ++ "idris_b32Gte(" ++ creg x ++ "," ++ creg y ++ ")"
369+doOp v LB32Gt [x, y] = v ++ "idris_b32Gt(" ++ creg x ++ "," ++ creg y ++ ")"
370+
371+doOp v LB32Shl [x, y] = v ++ "idris_b32Shl(" ++ creg x ++ "," ++ creg y ++ ")"
372+doOp v LB32LShr [x, y] = v ++ "idris_b32Shr(" ++ creg x ++ "," ++ creg y ++ ")"
373+doOp v LB32AShr [x, y] = v ++ "idris_b32AShr(" ++ creg x ++ "," ++ creg y ++ ")"
374+doOp v LB32And [x, y] = v ++ "idris_b32And(" ++ creg x ++ "," ++ creg y ++ ")"
375+doOp v LB32Or [x, y] = v ++ "idris_b32Or(" ++ creg x ++ "," ++ creg y ++ ")"
376+doOp v LB32Xor [x, y] = v ++ "idris_b32Xor(" ++ creg x ++ "," ++ creg y ++ ")"
377+doOp v LB32Compl [x, y] = v ++ "idris_b32Compl(" ++ creg x ++ "," ++ creg y ++ ")"
378+
337379doOp v LB32Plus [x, y] =
338380 v ++ "idris_b32Plus(" ++ creg x ++ "," ++ creg y ++ ")"
339381doOp v LB32Minus [x, y] =
@@ -350,6 +392,20 @@ doOp v LB32S64 [x] = v ++ "idris_b32S64(" ++ creg x ++ ")"
350392doOp v LB32T8 [x] = v ++ "idris_b32T8(" ++ creg x ++ ")"
351393doOp v LB32T16 [x] = v ++ "idris_b32T16(" ++ creg x ++ ")"
352394
395+doOp v LB64Lt [x, y] = v ++ "idris_b64Lt(" ++ creg x ++ "," ++ creg y ++ ")"
396+doOp v LB64Lte [x, y] = v ++ "idris_b64Lte(" ++ creg x ++ "," ++ creg y ++ ")"
397+doOp v LB64Eq [x, y] = v ++ "idris_b64Eq(" ++ creg x ++ "," ++ creg y ++ ")"
398+doOp v LB64Gte [x, y] = v ++ "idris_b64Gte(" ++ creg x ++ "," ++ creg y ++ ")"
399+doOp v LB64Gt [x, y] = v ++ "idris_b64Gt(" ++ creg x ++ "," ++ creg y ++ ")"
400+
401+doOp v LB64Shl [x, y] = v ++ "idris_b64Shl(" ++ creg x ++ "," ++ creg y ++ ")"
402+doOp v LB64LShr [x, y] = v ++ "idris_b64Shr(" ++ creg x ++ "," ++ creg y ++ ")"
403+doOp v LB64AShr [x, y] = v ++ "idris_b64AShr(" ++ creg x ++ "," ++ creg y ++ ")"
404+doOp v LB64And [x, y] = v ++ "idris_b64And(" ++ creg x ++ "," ++ creg y ++ ")"
405+doOp v LB64Or [x, y] = v ++ "idris_b64Or(" ++ creg x ++ "," ++ creg y ++ ")"
406+doOp v LB64Xor [x, y] = v ++ "idris_b64Xor(" ++ creg x ++ "," ++ creg y ++ ")"
407+doOp v LB64Compl [x, y] = v ++ "idris_b64Compl(" ++ creg x ++ "," ++ creg y ++ ")"
408+
353409doOp v LB64Plus [x, y] =
354410 v ++ "idris_b64Plus(" ++ creg x ++ "," ++ creg y ++ ")"
355411doOp v LB64Minus [x, y] =