[Bug target/69567] PowerPC64: cstore optimisation produces bad code

2016-01-30 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69567

--- Comment #3 from Segher Boessenkool  ---
Confirmed.  It's a combine problem.  Mine.

[Bug target/69567] PowerPC64: cstore optimisation produces bad code

2016-01-30 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69567

Segher Boessenkool  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |segher at gcc dot 
gnu.org

[Bug target/69567] PowerPC64: cstore optimisation produces bad code

2016-01-30 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69567

Martin Sebor  changed:

   What|Removed |Added

 Target|powerpc64le-linux   |powerpc64*-linux
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-01-30
 CC||msebor at gcc dot gnu.org
  Known to work||5.3.0
 Ever confirmed|0   |1
  Known to fail||6.0

--- Comment #1 from Martin Sebor  ---
Confirmed on both big and little-endian powerpc64.  The following simplified
test case also reproduces it on trunk.  5.x works.

$ cat ~/testcases/gcc-69567.c && /build/gcc-trunk/gcc/xgcc -B
/build/gcc-trunk/gcc -O1 -Wall -Wextra -Wpedantic ~/testcases/gcc-69567.c &&
./a.out
typedef __INT16_TYPE__  int16_t;
typedef __UINT16_TYPE__ uint16_t;
typedef __INT32_TYPE__  int32_t;
typedef __UINT32_TYPE__ uint32_t;
typedef __INT64_TYPE__  int64_t; 
typedef __UINT64_TYPE__ uint64_t;

#define RSH(A, B) ((uint16_t)(A) >> (B))
#define LSH(A, B) ((uint16_t)(A) << (B))

static uint32_t a;
static uint32_t *aa = 

static int64_t b;
static int64_t *bb = 

static uint64_t c;

int main(void)
{
  c |= RSH (LSH (*aa, 0), 0) <= *bb;

  if (c != 1)
__builtin_abort ();
}
Aborted

[Bug target/69567] PowerPC64: cstore optimisation produces bad code

2016-01-30 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69567

--- Comment #2 from Martin Sebor  ---
In fact, the test case can be simplified even further to this:

typedef __UINT16_TYPE__ uint16_t;
typedef __UINT32_TYPE__ uint32_t;
typedef __INT64_TYPE__  int64_t;
typedef __UINT64_TYPE__ uint64_t;

static uint32_t a;
static uint32_t *aa = 

static int64_t b;
static int64_t *bb = 

static uint64_t c;

int main(void)
{
  c |= (uint16_t)*aa <= *bb;

  if (c != 1)
__builtin_abort ();
}