URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 297 |
Rev 338 |
/* Copyright (C) 2002 Free Software Foundation.
|
/* Copyright (C) 2002 Free Software Foundation.
|
|
|
Test for composite comparison always true/false optimization.
|
Test for composite comparison always true/false optimization.
|
|
|
Written by Roger Sayle, 7th June 2002. */
|
Written by Roger Sayle, 7th June 2002. */
|
|
|
extern void link_error0 ();
|
extern void link_error0 ();
|
extern void link_error1 ();
|
extern void link_error1 ();
|
|
|
void
|
void
|
test1 (int x, int y)
|
test1 (int x, int y)
|
{
|
{
|
if ((x==y) && (x!=y))
|
if ((x==y) && (x!=y))
|
link_error0();
|
link_error0();
|
}
|
}
|
|
|
void
|
void
|
test2 (int x, int y)
|
test2 (int x, int y)
|
{
|
{
|
if ((x<y) && (x>y))
|
if ((x<y) && (x>y))
|
link_error0();
|
link_error0();
|
}
|
}
|
|
|
void
|
void
|
test3 (int x, int y)
|
test3 (int x, int y)
|
{
|
{
|
if ((x<y) && (y<x))
|
if ((x<y) && (y<x))
|
link_error0();
|
link_error0();
|
}
|
}
|
|
|
void
|
void
|
test4 (int x, int y)
|
test4 (int x, int y)
|
{
|
{
|
if ((x==y) || (x!=y))
|
if ((x==y) || (x!=y))
|
{
|
{
|
}
|
}
|
else
|
else
|
link_error1 ();
|
link_error1 ();
|
}
|
}
|
|
|
void
|
void
|
test5 (int x, int y)
|
test5 (int x, int y)
|
{
|
{
|
if ((x>=y) || (x<y))
|
if ((x>=y) || (x<y))
|
{
|
{
|
}
|
}
|
else
|
else
|
link_error1 ();
|
link_error1 ();
|
}
|
}
|
|
|
void
|
void
|
test6 (int x, int y)
|
test6 (int x, int y)
|
{
|
{
|
if ((x<=y) || (y<x))
|
if ((x<=y) || (y<x))
|
{
|
{
|
}
|
}
|
else
|
else
|
link_error1 ();
|
link_error1 ();
|
}
|
}
|
|
|
void
|
void
|
all_tests (int x, int y)
|
all_tests (int x, int y)
|
{
|
{
|
test1 (x, y);
|
test1 (x, y);
|
test2 (x, y);
|
test2 (x, y);
|
test3 (x, y);
|
test3 (x, y);
|
test4 (x, y);
|
test4 (x, y);
|
test5 (x, y);
|
test5 (x, y);
|
test6 (x, y);
|
test6 (x, y);
|
}
|
}
|
|
|
int
|
int
|
main ()
|
main ()
|
{
|
{
|
all_tests (0, 0);
|
all_tests (0, 0);
|
all_tests (1, 2);
|
all_tests (1, 2);
|
all_tests (4, 3);
|
all_tests (4, 3);
|
|
|
return 0;
|
return 0;
|
}
|
}
|
|
|
#ifndef __OPTIMIZE__
|
#ifndef __OPTIMIZE__
|
void link_error0() {}
|
void link_error0() {}
|
void link_error1() {}
|
void link_error1() {}
|
#endif /* ! __OPTIMIZE__ */
|
#endif /* ! __OPTIMIZE__ */
|
|
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.