qemu/tests/tcg/cris/libc/check_addoq.c
<<
>>
Prefs
   1#include <stdio.h>
   2#include <stdlib.h>
   3#include <stdint.h>
   4#include "sys.h"
   5#include "crisutils.h"
   6
   7/* this would be better to do in asm, it's an orgy in GCC inline asm now.  */
   8
   9/* ACR will be clobbered.  */
  10#define cris_addoq(o, v) \
  11        asm volatile ("addoq\t%1, %0, $acr\n" : : "r" (v), "i" (o) : "acr");
  12
  13
  14int main(void)
  15{
  16        int x[3] = {0x55aa77ff, 0xccff2244, 0x88ccee19};
  17        int *p, *t = x + 1;
  18
  19        cris_tst_cc_init();
  20        asm volatile ("setf\tzvnc\n");
  21        cris_addoq(0, t);
  22        cris_tst_cc(1, 1, 1, 1);
  23        asm volatile ("move.d\t$acr, %0\n" : "=r" (p));
  24        if (*p != 0xccff2244)
  25                err();
  26
  27        cris_tst_cc_init();
  28        asm volatile ("setf\tzvnc\n");
  29        cris_addoq(4, t);
  30        cris_tst_cc(0, 0, 0, 0);
  31        asm volatile ("move.d\t$acr, %0\n" : "=r" (p));
  32        if (*p != 0x88ccee19)
  33                err();
  34
  35        cris_tst_cc_init();
  36        asm volatile ("clearf\tzvnc\n");
  37        cris_addoq(-8, t + 1);
  38        cris_tst_cc(0, 0, 0, 0);
  39        asm volatile ("move.d\t$acr, %0\n" : "=r" (p));
  40        if (*p != 0x55aa77ff)
  41                err();
  42        pass();
  43        return 0;
  44}
  45