1/* PR tree-optimization/47477 */
2/* { dg-do compile } */
3/* { dg-options "-O2 -fdump-tree-optimized -w" } */
4/* { dg-require-effective-target ilp32 } */
5
6typedef int int64_t __attribute__ ((__mode__ (__DI__)));
7typedef int * intptr_t;
8
9typedef struct toto_s *toto_t;
10toto_t add (toto_t a, toto_t b) {
11  int64_t tmp = (int64_t)(intptr_t)a + ((int64_t)(intptr_t)b&~1L);
12  return (toto_t)(intptr_t) tmp;
13}
14
15/* For an ILP32 target there'll be 6 casts when we start, but just 4
16   if the match.pd pattern is successfully matched.  */
17/* { dg-final { scan-tree-dump-times "= \\(int\\)" 1 "optimized" } } */
18/* { dg-final { scan-tree-dump-times "= \\(unsigned int\\)" 2 "optimized" } } */
19/* { dg-final { scan-tree-dump-times "= \\(struct toto_s \\*\\)" 1 "optimized" } } */
20/* { dg-final { cleanup-tree-dump "optimized" } } */
21
22
23