|
|
1.1 ! root 1: #include <stdio.h> ! 2: #include <stdlib.h> ! 3: #include <stdint.h> ! 4: #include "sys.h" ! 5: #include "crisutils.h" ! 6: ! 7: #define cris_moveq(dst, src) \ ! 8: asm volatile ("moveq %1, %0\n" : "=r" (dst) : "i" (src)); ! 9: ! 10: ! 11: ! 12: int main(void) ! 13: { ! 14: int t; ! 15: ! 16: cris_tst_cc_init(); ! 17: asm volatile ("setf\tzvnc\n"); ! 18: cris_moveq(t, 10); ! 19: cris_tst_cc(1, 1, 1, 1); ! 20: if (t != 10) ! 21: err(); ! 22: ! 23: /* make sure moveq doesnt clobber the zflag. */ ! 24: cris_tst_cc_init(); ! 25: asm volatile ("setf vnc\n"); ! 26: asm volatile ("clearf z\n"); ! 27: cris_moveq(t, 0); ! 28: cris_tst_cc(1, 0, 1, 1); ! 29: if (t != 0) ! 30: err(); ! 31: ! 32: /* make sure moveq doesnt clobber the nflag. ! 33: Also check large immediates */ ! 34: cris_tst_cc_init(); ! 35: asm volatile ("setf zvc\n"); ! 36: asm volatile ("clearf n\n"); ! 37: cris_moveq(t, -31); ! 38: cris_tst_cc(0, 1, 1, 1); ! 39: if (t != -31) ! 40: err(); ! 41: ! 42: cris_tst_cc_init(); ! 43: asm volatile ("setf nzvc\n"); ! 44: cris_moveq(t, 31); ! 45: cris_tst_cc(1, 1, 1, 1); ! 46: if (t != 31) ! 47: err(); ! 48: ! 49: pass(); ! 50: return 0; ! 51: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.