1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-reassoc1 -fno-ipa-icf" } */
/* We want to make sure that we reassociate in a way that has the
constant last. With the constant last, it's more likely to result
in a bitfield test on targets with such capabilities. */
extern void boo ();
int b2b_uc (unsigned char u, unsigned char w)
{
if ((u & w) & 0x20)
boo ();
}
int b2b_us (unsigned short u, unsigned short w)
{
if ((u & w) & 0x20)
boo ();
}
int b2b_ui (unsigned int u, unsigned int w)
{
if ((u & w) & 0x20)
boo ();
}
int b2b_ul (unsigned long u, unsigned long w)
{
if ((u & w) & 0x20)
boo ();
}
int b2b_ull (unsigned long long u, unsigned long long w)
{
if ((u & w) & 0x20)
boo ();
}
int b2b_sc (signed char u, signed char w)
{
if ((u & w) & 0x20)
boo ();
}
int b2b_ss (signed short u, signed short w)
{
if ((u & w) & 0x20)
boo ();
}
int b2b_si (signed int u, signed int w)
{
if ((u & w) & 0x20)
boo ();
}
int b2b_sl (signed long u, signed long w)
{
if ((u & w) & 0x20)
boo ();
}
int b2b_sll (signed long long u, signed long long w)
{
if ((u & w) & 0x20)
boo ();
}
/* The AND of U & W should go into a temporary, when is then ANDed
with the constant.
First verify that we have the right number of ANDs between U and W. */
/* { dg-final { scan-tree-dump-times "\[uw\]_\[0-9\]+.D. \& \[uw\]_\[0-9\]+.D.;" 10 "reassoc1"} } */
/* Then verify that we have the right number of ANDS between a temporary
and the constant. */
/* { dg-final { scan-tree-dump-times "_\[0-9]+ \& 32;" 10 "reassoc1"} } */
/* Each function has one AND. It will have either a second AND or TEST. So
we can count the number of AND and TEST instructions. They must be 2X
the number of test functions in this file. */
/* { dg-final { scan-assembler-times "and|test" 20 { target { i?86-*-* x86_64-*-*} } } } */
/* Similarly on the m68k. The code for the long long tests is suboptimal,
which catch via the second pattern and xfail. */
/* { dg-final { scan-assembler-times "and|btst" 20 { target { m68k-*-* } } } } */
/* { dg-final { scan-assembler-not "or" { target { m68k-*-* } xfail { *-*-* } } } } */
|