qemu-e2k/tests/tcg/cris/check_int64.c
Rabin Vincent 21ce148c7e tests: cris: force inlining
The CRIS tests expect that functions marked inline are always inline.
With newer versions of GCC, building them results warnings like the
following and spurious failures when they are run.

In file included from tests/tcg/cris/check_moveq.c:5:0:
tests/tcg/cris/crisutils.h:66:20: warning: inlining failed in call to
'cris_tst_cc.constprop.0': call is unlikely and code size would grow [-Winline]
tests/tcg/cris/check_moveq.c:28:13: warning: called from here [-Winline]

Use the always_inline attribute when building them to fix this.

Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Rabin Vincent <rabinv@axis.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
2016-09-28 10:45:44 +02:00

48 lines
598 B
C

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "sys.h"
#include "crisutils.h"
static always_inline int64_t add64(const int64_t a, const int64_t b)
{
return a + b;
}
static always_inline int64_t sub64(const int64_t a, const int64_t b)
{
return a - b;
}
int main(void)
{
int64_t a = 1;
int64_t b = 2;
/* FIXME: add some tests. */
a = add64(a, b);
if (a != 3)
err();
a = sub64(a, b);
if (a != 1)
err();
a = add64(a, -4);
if (a != -3)
err();
a = add64(a, 3);
if (a != 0)
err();
a = 0;
a = sub64(a, 1);
if (a != -1)
err();
pass();
return 0;
}