1  /* { dg-do compile { target { powerpc*-*-* } } } */
       2  /* { dg-skip-if "" { powerpc*-*-darwin* } } */
       3  /* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */
       4  
       5  #include <stdint.h>
       6  
       7  #define TEST(type) \
       8    struct t ## type { type x[128],a,b,c; };		\
       9    struct s ## type { struct t ## type *p; int d,e,f; uint64_t g,h,i; };	\
      10  int \
      11  t ## type (struct s ## type *p) \
      12  { \
      13    struct t ## type *tp = p->p; \
      14    if(!tp || tp->a > ((type)0)) { return p->d; }	\
      15    if(!tp || tp->b > ((type)1)) { return p->e; }	\
      16    if(!tp || ( ((type)(-1) < 0) && tp->c < ((type)-1))) { return p->f; }	\
      17    return 0; \
      18  } \
      19  type \
      20  t ## type ## _ret (struct s ## type *p) \
      21  { \
      22    struct t ## type *tp = p->p; \
      23    if(!tp || tp->a > ((type)0)) { return tp->a; }	\
      24    if(!tp || tp->b > ((type)1)) { return tp->b; }	\
      25    if(!tp || ( ((type)(-1) < 0) && tp->c < ((type)-1))) { return tp->c; }	\
      26    return 0; \
      27  }\
      28  int \
      29  t ## type ## _x (struct s ## type *p) \
      30  { \
      31    struct t ## type *tp = p->p; \
      32    if(!tp || tp->x[p->g] > ((type)0)) { return p->d; }	\
      33    if(!tp || tp->x[p->h] > ((type)1)) { return p->e; }	\
      34    if(!tp || ( ((type)(-1) < 0) && tp->x[p->i] < ((type)-1))) { return p->f; }	\
      35    return 0; \
      36  } \
      37  type \
      38  t ## type ## _x_ret (struct s ## type *p) \
      39  { \
      40    struct t ## type *tp = p->p; \
      41    if(!tp || tp->x[p->g] > ((type)0)) { return tp->x[p->g]; }	\
      42    if(!tp || tp->x[p->h] > ((type)1)) { return tp->x[p->h]; }	\
      43    if(!tp || ( ((type)(-1) < 0) && tp->x[p->i] < ((type)-1))) { return tp->x[p->i]; }	\
      44    return 0; \
      45  }
      46  
      47  TEST(uint64_t)
      48  TEST(int64_t)
      49  TEST(uint32_t)
      50  TEST(int32_t)
      51  TEST(uint16_t)
      52  TEST(int16_t)
      53  TEST(uint8_t)
      54  TEST(int8_t)
      55  
      56  /* { dg-final { scan-assembler-times "lbz_cmpldi_cr0_QI_clobber_CCUNS_zero"   4 { target lp64 } } } */
      57  /* { dg-final { scan-assembler-times "ld_cmpdi_cr0_DI_DI_CC_none"            24 { target lp64 } } } */
      58  /* { dg-final { scan-assembler-times "ld_cmpdi_cr0_DI_clobber_CC_none"        8 { target lp64 } } } */
      59  /* { dg-final { scan-assembler-times "ld_cmpldi_cr0_DI_DI_CCUNS_none"         2 { target lp64 } } } */
      60  /* { dg-final { scan-assembler-times "ld_cmpldi_cr0_DI_clobber_CCUNS_none"    2 { target lp64 } } } */
      61  /* { dg-final { scan-assembler-times "lha_cmpdi_cr0_HI_clobber_CC_sign"      16 { target lp64 } } } */
      62  /* { dg-final { scan-assembler-times "lhz_cmpldi_cr0_HI_clobber_CCUNS_zero"   4 { target lp64 } } } */
      63  /* { dg-final { scan-assembler-times "lwa_cmpdi_cr0_SI_EXTSI_CC_sign"         0 { target lp64 } } } */
      64  /* { dg-final { scan-assembler-times "lwz_cmpwi_cr0_SI_clobber_CC_none"       8 { target lp64 } } } */
      65  /* { dg-final { scan-assembler-times "lwz_cmpwi_cr0_SI_SI_CC_none"            8 { target lp64 } } } */
      66  /* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_EXTSI_CCUNS_zero"     0 { target lp64 } } } */
      67  /* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_SI_CCUNS_none"        2 { target lp64 } } } */
      68  /* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_clobber_CCUNS_none"   2 { target lp64 } } } */
      69  
      70  /* { dg-final { scan-assembler-times "lbz_cmpldi_cr0_QI_clobber_CCUNS_zero"   2 { target ilp32 } } } */
      71  /* { dg-final { scan-assembler-times "ld_cmpdi_cr0_DI_DI_CC_none"             0 { target ilp32 } } } */
      72  /* { dg-final { scan-assembler-times "ld_cmpdi_cr0_DI_clobber_CC_none"        0 { target ilp32 } } } */
      73  /* { dg-final { scan-assembler-times "ld_cmpldi_cr0_DI_DI_CCUNS_none"         0 { target ilp32 } } } */
      74  /* { dg-final { scan-assembler-times "ld_cmpldi_cr0_DI_clobber_CCUNS_none"    0 { target ilp32 } } } */
      75  /* { dg-final { scan-assembler-times "lha_cmpdi_cr0_HI_clobber_CC_sign"       8 { target ilp32 } } } */
      76  /* { dg-final { scan-assembler-times "lhz_cmpldi_cr0_HI_clobber_CCUNS_zero"   2 { target ilp32 } } } */
      77  /* { dg-final { scan-assembler-times "lwa_cmpdi_cr0_SI_EXTSI_CC_sign"         0 { target ilp32 } } } */
      78  /* { dg-final { scan-assembler-times "lwz_cmpwi_cr0_SI_SI_CC_none"           36 { target ilp32 } } } */
      79  /* { dg-final { scan-assembler-times "lwz_cmpwi_cr0_SI_clobber_CC_none"      16 { target ilp32 } } } */
      80  /* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_EXTSI_CCUNS_zero"     0 { target ilp32 } } } */
      81  /* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_clobber_CCUNS_none"   6 { target ilp32 } } } */
      82  /* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_SI_CCUNS_none"        2 { target ilp32 } } } */