URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 305 |
Rev 338 |
// { dg-do run }
|
// { dg-do run }
|
//980324 bkoz
|
//980324 bkoz
|
//test for bool and bitwise ands
|
//test for bool and bitwise ands
|
|
|
#include
|
#include
|
|
|
|
|
void bar ( bool x ) {}
|
void bar ( bool x ) {}
|
void bars ( short x ) {}
|
void bars ( short x ) {}
|
|
|
#if 0
|
#if 0
|
int andb(){
|
int andb(){
|
bool y;
|
bool y;
|
bar ( y );
|
bar ( y );
|
int blob = ( 27 & int (y) );
|
int blob = ( 27 & int (y) );
|
return blob; //expect 1 or 0
|
return blob; //expect 1 or 0
|
}
|
}
|
#endif
|
#endif
|
|
|
int andbtrue(){
|
int andbtrue(){
|
bool y = true;
|
bool y = true;
|
bar ( y );
|
bar ( y );
|
int blob = ( 27 & int (y) );
|
int blob = ( 27 & int (y) );
|
return blob; //expect 1
|
return blob; //expect 1
|
}
|
}
|
|
|
int andbfalse(){
|
int andbfalse(){
|
bool y = false;
|
bool y = false;
|
bar ( y );
|
bar ( y );
|
int blob = ( 27 & int (y) );
|
int blob = ( 27 & int (y) );
|
return blob; //expect 0
|
return blob; //expect 0
|
}
|
}
|
|
|
int andbfalse2(){
|
int andbfalse2(){
|
bool y = 0;
|
bool y = 0;
|
bar ( y );
|
bar ( y );
|
int blob = ( 27 & int (y) );
|
int blob = ( 27 & int (y) );
|
return blob; //expect 0
|
return blob; //expect 0
|
}
|
}
|
|
|
int ands(){
|
int ands(){
|
short y = 1;
|
short y = 1;
|
bars ( y );
|
bars ( y );
|
int blob = ( 27 & int (y) );
|
int blob = ( 27 & int (y) );
|
return blob; //expect 1
|
return blob; //expect 1
|
}
|
}
|
|
|
|
|
int main() {
|
int main() {
|
int tmp;
|
int tmp;
|
#if 0
|
#if 0
|
tmp = andb();
|
tmp = andb();
|
assert (tmp == 1 || tmp == 0);
|
assert (tmp == 1 || tmp == 0);
|
#endif
|
#endif
|
tmp = andbtrue();
|
tmp = andbtrue();
|
assert (tmp == 1);
|
assert (tmp == 1);
|
tmp = andbfalse();
|
tmp = andbfalse();
|
assert (tmp == 0);
|
assert (tmp == 0);
|
tmp = andbfalse2();
|
tmp = andbfalse2();
|
assert (tmp == 0);
|
assert (tmp == 0);
|
tmp = ands();
|
tmp = ands();
|
assert (tmp == 1);
|
assert (tmp == 1);
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.