qemu/tests/tcg/cris/crisutils.h
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

77 lines
1.6 KiB
C

#ifndef CRISUTILS_H
#define CRISUTILS_H 1
static char *tst_cc_loc = NULL;
#define cris_tst_cc_init() \
do { tst_cc_loc = "test_cc failed at " CURRENT_LOCATION; } while(0)
/* We need a real symbol to signal error. */
void _err(void) {
if (!tst_cc_loc)
tst_cc_loc = "tst_cc_failed\n";
_fail(tst_cc_loc);
}
static always_inline void cris_tst_cc_n1(void)
{
asm volatile ("bpl _err\n"
"nop\n");
}
static always_inline void cris_tst_cc_n0(void)
{
asm volatile ("bmi _err\n"
"nop\n");
}
static always_inline void cris_tst_cc_z1(void)
{
asm volatile ("bne _err\n"
"nop\n");
}
static always_inline void cris_tst_cc_z0(void)
{
asm volatile ("beq _err\n"
"nop\n");
}
static always_inline void cris_tst_cc_v1(void)
{
asm volatile ("bvc _err\n"
"nop\n");
}
static always_inline void cris_tst_cc_v0(void)
{
asm volatile ("bvs _err\n"
"nop\n");
}
static always_inline void cris_tst_cc_c1(void)
{
asm volatile ("bcc _err\n"
"nop\n");
}
static always_inline void cris_tst_cc_c0(void)
{
asm volatile ("bcs _err\n"
"nop\n");
}
static always_inline void cris_tst_mov_cc(int n, int z)
{
if (n) cris_tst_cc_n1(); else cris_tst_cc_n0();
if (z) cris_tst_cc_z1(); else cris_tst_cc_z0();
asm volatile ("" : : "g" (_err));
}
static always_inline void cris_tst_cc(const int n, const int z,
const int v, const int c)
{
if (n) cris_tst_cc_n1(); else cris_tst_cc_n0();
if (z) cris_tst_cc_z1(); else cris_tst_cc_z0();
if (v) cris_tst_cc_v1(); else cris_tst_cc_v0();
if (c) cris_tst_cc_c1(); else cris_tst_cc_c0();
asm volatile ("" : : "g" (_err));
}
#endif