Hi, We (Cavium) has had these VRP testcases in our testsuite for a while and I found they pass without any patches.
Committed as obvious after a test on x86_64-linux-gnu with no regressions. Thanks, Andrew Pinski 2012-07-21 Andrew Pinski <apin...@cavium.com> * gcc.dg/tree-ssa/vrp72.c: New test. * gcc.dg/tree-ssa/vrp73.c: New test. * gcc.dg/tree-ssa/vrp74.c: New test. * gcc.dg/tree-ssa/vrp75.c: New test.
Index: gcc.dg/tree-ssa/vrp72.c =================================================================== --- gcc.dg/tree-ssa/vrp72.c (revision 0) +++ gcc.dg/tree-ssa/vrp72.c (revision 0) @@ -0,0 +1,30 @@ +/* { dg-options "-O2" } */ + +typedef unsigned long long uint64_t; + +static inline void cvmx_write64_uint64(uint64_t addr, uint64_t val) +{ + *(volatile uint64_t *)(long)addr = val; +}; +static inline uint64_t cvmx_read64_uint64(uint64_t addr) +{ + return *(volatile uint64_t *)(long)addr; +}; + +static inline void cvmx_write_csr(uint64_t csr_addr, uint64_t val) +{ + cvmx_write64_uint64 (csr_addr, val); + if ((csr_addr >> 40) != 0x800118) + linker_error (); +} + +int uart; + +int +main () +{ + cvmx_write_csr (((((uint64_t) 2LL) << 62) + | (0x0001180000000808ull+((uart&0xff)*1024))), + 0xfff); + return 0; +} Index: gcc.dg/tree-ssa/vrp73.c =================================================================== --- gcc.dg/tree-ssa/vrp73.c (revision 0) +++ gcc.dg/tree-ssa/vrp73.c (revision 0) @@ -0,0 +1,30 @@ +/* { dg-options "-O2" } */ + +typedef unsigned long long uint64_t; + +static inline void cvmx_write64_uint64(uint64_t addr, uint64_t val) +{ + *(volatile uint64_t *)(long)addr = val; +}; +static inline uint64_t cvmx_read64_uint64(uint64_t addr) +{ + return *(volatile uint64_t *)(long)addr; +}; + +static inline void cvmx_write_csr(uint64_t csr_addr, uint64_t val) +{ + cvmx_write64_uint64 (csr_addr, val); + if ((csr_addr >> 40) == 0x800118) + linker_error (); +} + +int dest_core, src_core; + +int +main () +{ + cvmx_write_csr ((((((uint64_t)2LL) << 62) + | ((0x0001070000000600ull+((dest_core&0xff)*8))))), + 1ull << src_core); + return 0; +} Index: gcc.dg/tree-ssa/vrp74.c =================================================================== --- gcc.dg/tree-ssa/vrp74.c (revision 0) +++ gcc.dg/tree-ssa/vrp74.c (revision 0) @@ -0,0 +1,23 @@ +/* { dg-options "-O2" } */ + +void abort (void); +void exit (int); + +__attribute__ ((noinline)) void +f (unsigned long long i) +{ + if (i <= 0x1000000000000000ull) + { + unsigned long long j = i | 0x1000000000000000ull; + if (j == 0x1100000000000000ull) + exit (0); + } +} + +int +main () +{ + f (0x0100000000000000ull); + abort (); +} + Index: gcc.dg/tree-ssa/vrp75.c =================================================================== --- gcc.dg/tree-ssa/vrp75.c (revision 0) +++ gcc.dg/tree-ssa/vrp75.c (revision 0) @@ -0,0 +1,31 @@ +/* { dg-options "-O2" } */ + +typedef unsigned long long uint64_t; + +static inline void cvmx_write64_uint64(uint64_t addr, uint64_t val) +{ + *(volatile uint64_t *)(long)addr = val; +}; +static inline uint64_t cvmx_read64_uint64(uint64_t addr) +{ + return *(volatile uint64_t *)(long)addr; +}; +static inline void cvmx_write_csr(uint64_t csr_addr, uint64_t val) +{ + cvmx_write64_uint64 (csr_addr, val); + if ((csr_addr >> 40) != 0x800118) + linker_error (); +} + +int interface; +int idx; + +int +main () +{ + cvmx_write_csr((((((uint64_t) 2LL) << 62) + | ((0x0001180008000208ull + + (((idx)&3)*2048) + + (((interface)&1)*0x8000000ull))))), 1); + return 0; +}