Annotation of qemu/tests/cris/check_addc.c, revision 1.1.1.2

1.1       root        1: #include <stdio.h>
                      2: #include <stdlib.h>
                      3: #include <stdint.h>
                      4: #include "sys.h"
                      5: #include "crisutils.h"
                      6: 
1.1.1.2 ! root        7: static inline int cris_addc(int a, const int b)
        !             8: {
1.1       root        9:        asm ("addc\t%1, %0\n" : "+r" (a) : "r" (b));
                     10:        return a;
                     11: }
                     12: 
                     13: #define verify_addc(a, b, res, n, z, v, c)  \
                     14: {                                           \
                     15:        int r;                              \
                     16:        r = cris_addc((a), (b));            \
                     17:        cris_tst_cc((n), (z), (v), (c));    \
                     18:        if (r != (res))                     \
                     19:                err();                      \
                     20: }
                     21: 
                     22: int main(void)
                     23: {
                     24:        cris_tst_cc_init();
                     25:        asm volatile ("clearf cz");
                     26:        verify_addc(0, 0, 0, 0, 0, 0, 0);
                     27: 
                     28:        cris_tst_cc_init();
                     29:        asm volatile ("setf z");
                     30:        verify_addc(0, 0, 0, 0, 1, 0, 0);
                     31: 
                     32:        cris_tst_cc_init();
                     33:        asm volatile ("setf cz");
                     34:        verify_addc(0, 0, 1, 0, 0, 0, 0);
                     35:        cris_tst_cc_init();
                     36:        asm volatile ("clearf c");
                     37:        verify_addc(-1, 2, 1, 0, 0, 0, 1);
                     38: 
                     39:        cris_tst_cc_init();
                     40:        asm volatile ("clearf nzv");
                     41:        asm volatile ("setf c");
                     42:        verify_addc(-1, 2, 2, 0, 0, 0, 1);
                     43: 
                     44:        cris_tst_cc_init();
                     45:        asm volatile ("setf c");
                     46:        verify_addc(0xffff, 0xffff, 0x1ffff, 0, 0, 0, 0);
                     47: 
                     48:        cris_tst_cc_init();
                     49:        asm volatile ("clearf nzvc");
                     50:        verify_addc(-1, -1, 0xfffffffe, 1, 0, 0, 1);
                     51: 
                     52:        cris_tst_cc_init();
                     53:        asm volatile ("setf c");
                     54:        verify_addc(0x78134452, 0x5432f789, 0xcc463bdc, 1, 0, 1, 0);
                     55: 
                     56:        pass();
                     57:        return 0;
                     58: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.