Annotation of qemu/tests/cris/check_bound.c, revision 1.1

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: extern inline int cris_bound_b(int v, int b) {
        !             8:        int r = v;
        !             9:        asm ("bound.b\t%1, %0\n" : "+r" (r) : "ri" (b));
        !            10:        return r;
        !            11: }
        !            12: 
        !            13: extern inline int cris_bound_w(int v, int b) {
        !            14:        int r = v;
        !            15:        asm ("bound.w\t%1, %0\n" : "+r" (r) : "ri" (b));
        !            16:        return r;
        !            17: }
        !            18: 
        !            19: extern inline int cris_bound_d(int v, int b) {
        !            20:        int r = v;
        !            21:        asm ("bound.d\t%1, %0\n" : "+r" (r) : "ri" (b));
        !            22:        return r;
        !            23: }
        !            24: 
        !            25: int main(void)
        !            26: {
        !            27:        int r;
        !            28: 
        !            29:        cris_tst_cc_init();
        !            30:        r = cris_bound_d(-1, 2);
        !            31:        cris_tst_cc(0, 0, 0, 0);
        !            32:        if (r != 2)
        !            33:                err();
        !            34: 
        !            35:        cris_tst_cc_init();
        !            36:        r = cris_bound_d(2, 0xffffffff);
        !            37:        cris_tst_cc(0, 0, 0, 0);
        !            38:        if (r != 2)
        !            39:                err();
        !            40: 
        !            41:        cris_tst_cc_init();
        !            42:        r = cris_bound_d(0xffff, 0xffff);
        !            43:        cris_tst_cc(0, 0, 0, 0);
        !            44:        if (r != 0xffff)
        !            45:                err();
        !            46: 
        !            47:        cris_tst_cc_init();
        !            48:        r = cris_bound_d(-1, 0xffffffff);
        !            49:        cris_tst_cc(1, 0, 0, 0);
        !            50:        if (r != 0xffffffff)
        !            51:                err();
        !            52: 
        !            53:        cris_tst_cc_init();
        !            54:        r = cris_bound_d(0x78134452, 0x5432f789);
        !            55:        cris_tst_cc(0, 0, 0, 0);
        !            56:        if (r != 0x5432f789)
        !            57:                err();
        !            58: 
        !            59:        cris_tst_cc_init();
        !            60:        r = cris_bound_w(-1, 2);
        !            61:        cris_tst_cc(0, 0, 0, 0);
        !            62:        if (r != 2)
        !            63:                err();
        !            64: 
        !            65:        cris_tst_cc_init();
        !            66:        r = cris_bound_w(-1, 0xffff);
        !            67:        cris_tst_cc(0, 0, 0, 0);
        !            68:        if (r != 0xffff)
        !            69:                err();
        !            70: 
        !            71:        cris_tst_cc_init();
        !            72:        r = cris_bound_w(2, 0xffff);
        !            73:        cris_tst_cc(0, 0, 0, 0);
        !            74:        if (r != 2)
        !            75:                err();
        !            76: 
        !            77:        cris_tst_cc_init();
        !            78:        r = cris_bound_w(0xfedaffff, 0xffff);
        !            79:        cris_tst_cc(0, 0, 0, 0);
        !            80:        if (r != 0xffff)
        !            81:                err();
        !            82: 
        !            83:        cris_tst_cc_init();
        !            84:        r = cris_bound_w(0x78134452, 0xf789);
        !            85:        cris_tst_cc(0, 0, 0, 0);
        !            86:        if (r != 0xf789)
        !            87:                err();
        !            88: 
        !            89:        cris_tst_cc_init();
        !            90:        r = cris_bound_b(-1, 2);
        !            91:        cris_tst_cc(0, 0, 0, 0);
        !            92:        if (r != 2)
        !            93:                err();
        !            94: 
        !            95:        cris_tst_cc_init();
        !            96:        r = cris_bound_b(2, 0xff);
        !            97:        cris_tst_cc(0, 0, 0, 0);
        !            98:        if (r != 2)
        !            99:                err();
        !           100: 
        !           101:        cris_tst_cc_init();
        !           102:        r = cris_bound_b(-1, 0xff);
        !           103:        cris_tst_cc(0, 0, 0, 0);
        !           104:        if (r != 0xff)
        !           105:                err();
        !           106: 
        !           107:        cris_tst_cc_init();
        !           108:        r = cris_bound_b(0xff, 0xff);
        !           109:        cris_tst_cc(0, 0, 0, 0);
        !           110:        if (r != 0xff)
        !           111:                err();
        !           112: 
        !           113:        cris_tst_cc_init();
        !           114:        r = cris_bound_b(0xfeda49ff, 0xff);
        !           115:        cris_tst_cc(0, 0, 0, 0);
        !           116:        if (r != 0xff)
        !           117:                err();
        !           118: 
        !           119:        cris_tst_cc_init();
        !           120:        r = cris_bound_b(0x78134452, 0x89);
        !           121:        cris_tst_cc(0, 0, 0, 0);
        !           122:        if (r != 0x89)
        !           123:                err();
        !           124: 
        !           125:        cris_tst_cc_init();
        !           126:        r = cris_bound_w(0x78134452, 0);
        !           127:        cris_tst_cc(0, 1, 0, 0);
        !           128:        if (r != 0)
        !           129:                err();
        !           130: 
        !           131:        cris_tst_cc_init();
        !           132:        r = cris_bound_b(0xffff, -1);
        !           133:        cris_tst_cc(0, 0, 0, 0);
        !           134:        if (r != 0xff)
        !           135:                err();
        !           136: 
        !           137:        pass();
        !           138:        return 0;
        !           139: }

unix.superglobalmegacorp.com

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