This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[lto] PATCH: add CALL_EXPR abstractions to rs6000.c


Here's another set of changes similar to the ones for i386.c. Already committed as "obvious".

-Sandra

2006-08-08  Sandra Loosemore  <sandra@codesourcery.com>

	* gcc/config/rs6000/rs6000.c (rs6000_expand_unop_builtin: Pass entire
	CALL_EXPR instead of arglist; use new accessor macros to extract
	the arguments.  Changed callers.
	(altivec_expand_abs_builtin): Likewise.
	(rs6000_expand_binop_builtin): Likewise.
	(altivec_expand_predicate_builtin): Likewise.
	(altivec_expand_lv_builtin): Likewise.
	(spe_expand_stv_builtin): Likewise.
	(altivec_expand_stv_builtin): Likewise.
	(rs6000_expand_ternop_builtin): Likewise.
	(altivec_expand_ld_builtin): Use CALL_EXPR_FN.  Use argument accessor
	macros instead of constructing an arglist.
	(altivec_expand_st_builtin): Likewise.
	(altivec_expand_dst_builtin): Likewise.
	(altivec_expand_vec_init_builtin):  Pass entire
	CALL_EXPR instead of arglist; use new accessor macros to extract
	the arguments.  Changed callers.
	(altivec_expand_vec_set_builtin): Likewise.
	(altivec_expand_vec_ext_builtin): Likewise.
	(altivec_expand_builtin): Use CALL_EXPR_FN.  Use argument accessor
	macros instead of constructing an arglist.
	(spe_expand_builtin): Likewise.
	(spe_expand_predicate_builtin): Pass entire
	CALL_EXPR instead of arglist; use new accessor macros to extract
	the arguments.  Changed callers.
	(spe_expand_evsel_builtin): Likewise.
	(rs6000_expand_builtin): Use CALL_EXPR_FN.  Use argument accessor
	macros instead of constructing an arglist.
Index: gcc/config/rs6000/rs6000.c
===================================================================
*** gcc/config/rs6000/rs6000.c	(revision 115997)
--- gcc/config/rs6000/rs6000.c	(working copy)
*************** static struct builtin_description bdesc_
*** 6634,6643 ****
  };
  
  static rtx
! rs6000_expand_unop_builtin (enum insn_code icode, tree arglist, rtx target)
  {
    rtx pat;
!   tree arg0 = TREE_VALUE (arglist);
    rtx op0 = expand_normal (arg0);
    enum machine_mode tmode = insn_data[icode].operand[0].mode;
    enum machine_mode mode0 = insn_data[icode].operand[1].mode;
--- 6634,6643 ----
  };
  
  static rtx
! rs6000_expand_unop_builtin (enum insn_code icode, tree exp, rtx target)
  {
    rtx pat;
!   tree arg0 = CALL_EXPR_ARG0 (exp);
    rtx op0 = expand_normal (arg0);
    enum machine_mode tmode = insn_data[icode].operand[0].mode;
    enum machine_mode mode0 = insn_data[icode].operand[1].mode;
*************** rs6000_expand_unop_builtin (enum insn_co
*** 6683,6692 ****
  }
  
  static rtx
! altivec_expand_abs_builtin (enum insn_code icode, tree arglist, rtx target)
  {
    rtx pat, scratch1, scratch2;
!   tree arg0 = TREE_VALUE (arglist);
    rtx op0 = expand_normal (arg0);
    enum machine_mode tmode = insn_data[icode].operand[0].mode;
    enum machine_mode mode0 = insn_data[icode].operand[1].mode;
--- 6683,6692 ----
  }
  
  static rtx
! altivec_expand_abs_builtin (enum insn_code icode, tree exp, rtx target)
  {
    rtx pat, scratch1, scratch2;
!   tree arg0 = CALL_EXPR_ARG0 (exp);
    rtx op0 = expand_normal (arg0);
    enum machine_mode tmode = insn_data[icode].operand[0].mode;
    enum machine_mode mode0 = insn_data[icode].operand[1].mode;
*************** altivec_expand_abs_builtin (enum insn_co
*** 6715,6725 ****
  }
  
  static rtx
! rs6000_expand_binop_builtin (enum insn_code icode, tree arglist, rtx target)
  {
    rtx pat;
!   tree arg0 = TREE_VALUE (arglist);
!   tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
    rtx op0 = expand_normal (arg0);
    rtx op1 = expand_normal (arg1);
    enum machine_mode tmode = insn_data[icode].operand[0].mode;
--- 6715,6725 ----
  }
  
  static rtx
! rs6000_expand_binop_builtin (enum insn_code icode, tree exp, rtx target)
  {
    rtx pat;
!   tree arg0 = CALL_EXPR_ARG0 (exp);
!   tree arg1 = CALL_EXPR_ARG1 (exp);
    rtx op0 = expand_normal (arg0);
    rtx op1 = expand_normal (arg1);
    enum machine_mode tmode = insn_data[icode].operand[0].mode;
*************** rs6000_expand_binop_builtin (enum insn_c
*** 6789,6800 ****
  
  static rtx
  altivec_expand_predicate_builtin (enum insn_code icode, const char *opcode,
! 				  tree arglist, rtx target)
  {
    rtx pat, scratch;
!   tree cr6_form = TREE_VALUE (arglist);
!   tree arg0 = TREE_VALUE (TREE_CHAIN (arglist));
!   tree arg1 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
    rtx op0 = expand_normal (arg0);
    rtx op1 = expand_normal (arg1);
    enum machine_mode tmode = SImode;
--- 6789,6800 ----
  
  static rtx
  altivec_expand_predicate_builtin (enum insn_code icode, const char *opcode,
! 				  tree exp, rtx target)
  {
    rtx pat, scratch;
!   tree cr6_form = CALL_EXPR_ARG0 (exp);
!   tree arg0 = CALL_EXPR_ARG1 (exp);
!   tree arg1 = CALL_EXPR_ARG2 (exp);
    rtx op0 = expand_normal (arg0);
    rtx op1 = expand_normal (arg1);
    enum machine_mode tmode = SImode;
*************** altivec_expand_predicate_builtin (enum i
*** 6865,6875 ****
  }
  
  static rtx
! altivec_expand_lv_builtin (enum insn_code icode, tree arglist, rtx target)
  {
    rtx pat, addr;
!   tree arg0 = TREE_VALUE (arglist);
!   tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
    enum machine_mode tmode = insn_data[icode].operand[0].mode;
    enum machine_mode mode0 = Pmode;
    enum machine_mode mode1 = Pmode;
--- 6865,6875 ----
  }
  
  static rtx
! altivec_expand_lv_builtin (enum insn_code icode, tree exp, rtx target)
  {
    rtx pat, addr;
!   tree arg0 = CALL_EXPR_ARG0 (exp);
!   tree arg1 = CALL_EXPR_ARG1 (exp);
    enum machine_mode tmode = insn_data[icode].operand[0].mode;
    enum machine_mode mode0 = Pmode;
    enum machine_mode mode1 = Pmode;
*************** altivec_expand_lv_builtin (enum insn_cod
*** 6911,6921 ****
  }
  
  static rtx
! spe_expand_stv_builtin (enum insn_code icode, tree arglist)
  {
!   tree arg0 = TREE_VALUE (arglist);
!   tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
!   tree arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
    rtx op0 = expand_normal (arg0);
    rtx op1 = expand_normal (arg1);
    rtx op2 = expand_normal (arg2);
--- 6911,6921 ----
  }
  
  static rtx
! spe_expand_stv_builtin (enum insn_code icode, tree exp)
  {
!   tree arg0 = CALL_EXPR_ARG0 (exp);
!   tree arg1 = CALL_EXPR_ARG1 (exp);
!   tree arg2 = CALL_EXPR_ARG2 (exp);
    rtx op0 = expand_normal (arg0);
    rtx op1 = expand_normal (arg1);
    rtx op2 = expand_normal (arg2);
*************** spe_expand_stv_builtin (enum insn_code i
*** 6944,6954 ****
  }
  
  static rtx
! altivec_expand_stv_builtin (enum insn_code icode, tree arglist)
  {
!   tree arg0 = TREE_VALUE (arglist);
!   tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
!   tree arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
    rtx op0 = expand_normal (arg0);
    rtx op1 = expand_normal (arg1);
    rtx op2 = expand_normal (arg2);
--- 6944,6954 ----
  }
  
  static rtx
! altivec_expand_stv_builtin (enum insn_code icode, tree exp)
  {
!   tree arg0 = CALL_EXPR_ARG0 (exp);
!   tree arg1 = CALL_EXPR_ARG1 (exp);
!   tree arg2 = CALL_EXPR_ARG2 (exp);
    rtx op0 = expand_normal (arg0);
    rtx op1 = expand_normal (arg1);
    rtx op2 = expand_normal (arg2);
*************** altivec_expand_stv_builtin (enum insn_co
*** 6985,6996 ****
  }
  
  static rtx
! rs6000_expand_ternop_builtin (enum insn_code icode, tree arglist, rtx target)
  {
    rtx pat;
!   tree arg0 = TREE_VALUE (arglist);
!   tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
!   tree arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
    rtx op0 = expand_normal (arg0);
    rtx op1 = expand_normal (arg1);
    rtx op2 = expand_normal (arg2);
--- 6985,6996 ----
  }
  
  static rtx
! rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target)
  {
    rtx pat;
!   tree arg0 = CALL_EXPR_ARG0 (exp);
!   tree arg1 = CALL_EXPR_ARG1 (exp);
!   tree arg2 = CALL_EXPR_ARG2 (exp);
    rtx op0 = expand_normal (arg0);
    rtx op1 = expand_normal (arg1);
    rtx op2 = expand_normal (arg2);
*************** rs6000_expand_ternop_builtin (enum insn_
*** 7048,7055 ****
  static rtx
  altivec_expand_ld_builtin (tree exp, rtx target, bool *expandedp)
  {
!   tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
!   tree arglist = TREE_OPERAND (exp, 1);
    unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
    tree arg0;
    enum machine_mode tmode, mode0;
--- 7048,7054 ----
  static rtx
  altivec_expand_ld_builtin (tree exp, rtx target, bool *expandedp)
  {
!   tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
    unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
    tree arg0;
    enum machine_mode tmode, mode0;
*************** altivec_expand_ld_builtin (tree exp, rtx
*** 7077,7083 ****
  
    *expandedp = true;
  
!   arg0 = TREE_VALUE (arglist);
    op0 = expand_normal (arg0);
    tmode = insn_data[icode].operand[0].mode;
    mode0 = insn_data[icode].operand[1].mode;
--- 7076,7082 ----
  
    *expandedp = true;
  
!   arg0 = CALL_EXPR_ARG0 (exp);
    op0 = expand_normal (arg0);
    tmode = insn_data[icode].operand[0].mode;
    mode0 = insn_data[icode].operand[1].mode;
*************** static rtx
*** 7102,7109 ****
  altivec_expand_st_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
  			   bool *expandedp)
  {
!   tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
!   tree arglist = TREE_OPERAND (exp, 1);
    unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
    tree arg0, arg1;
    enum machine_mode mode0, mode1;
--- 7101,7107 ----
  altivec_expand_st_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
  			   bool *expandedp)
  {
!   tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
    unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
    tree arg0, arg1;
    enum machine_mode mode0, mode1;
*************** altivec_expand_st_builtin (tree exp, rtx
*** 7129,7136 ****
        return NULL_RTX;
      }
  
!   arg0 = TREE_VALUE (arglist);
!   arg1 = TREE_VALUE (TREE_CHAIN (arglist));
    op0 = expand_normal (arg0);
    op1 = expand_normal (arg1);
    mode0 = insn_data[icode].operand[0].mode;
--- 7127,7134 ----
        return NULL_RTX;
      }
  
!   arg0 = CALL_EXPR_ARG0 (exp);
!   arg1 = CALL_EXPR_ARG1 (exp);
    op0 = expand_normal (arg0);
    op1 = expand_normal (arg1);
    mode0 = insn_data[icode].operand[0].mode;
*************** static rtx
*** 7154,7161 ****
  altivec_expand_dst_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
  			    bool *expandedp)
  {
!   tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
!   tree arglist = TREE_OPERAND (exp, 1);
    unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
    tree arg0, arg1, arg2;
    enum machine_mode mode0, mode1, mode2;
--- 7152,7158 ----
  altivec_expand_dst_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
  			    bool *expandedp)
  {
!   tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
    unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
    tree arg0, arg1, arg2;
    enum machine_mode mode0, mode1, mode2;
*************** altivec_expand_dst_builtin (tree exp, rt
*** 7170,7178 ****
    for (i = 0; i < ARRAY_SIZE (bdesc_dst); i++, d++)
      if (d->code == fcode)
        {
! 	arg0 = TREE_VALUE (arglist);
! 	arg1 = TREE_VALUE (TREE_CHAIN (arglist));
! 	arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
  	op0 = expand_normal (arg0);
  	op1 = expand_normal (arg1);
  	op2 = expand_normal (arg2);
--- 7167,7175 ----
    for (i = 0; i < ARRAY_SIZE (bdesc_dst); i++, d++)
      if (d->code == fcode)
        {
! 	arg0 = CALL_EXPR_ARG0 (exp);
! 	arg1 = CALL_EXPR_ARG1 (exp);
! 	arg2 = CALL_EXPR_ARG2 (exp);
  	op0 = expand_normal (arg0);
  	op1 = expand_normal (arg1);
  	op2 = expand_normal (arg2);
*************** altivec_expand_dst_builtin (tree exp, rt
*** 7212,7218 ****
  
  /* Expand vec_init builtin.  */
  static rtx
! altivec_expand_vec_init_builtin (tree type, tree arglist, rtx target)
  {
    enum machine_mode tmode = TYPE_MODE (type);
    enum machine_mode inner_mode = GET_MODE_INNER (tmode);
--- 7209,7215 ----
  
  /* Expand vec_init builtin.  */
  static rtx
! altivec_expand_vec_init_builtin (tree type, tree exp, rtx target)
  {
    enum machine_mode tmode = TYPE_MODE (type);
    enum machine_mode inner_mode = GET_MODE_INNER (tmode);
*************** altivec_expand_vec_init_builtin (tree ty
*** 7220,7234 ****
    rtvec v = rtvec_alloc (n_elt);
  
    gcc_assert (VECTOR_MODE_P (tmode));
! 
!   for (i = 0; i < n_elt; ++i, arglist = TREE_CHAIN (arglist))
      {
!       rtx x = expand_normal (TREE_VALUE (arglist));
        RTVEC_ELT (v, i) = gen_lowpart (inner_mode, x);
      }
  
-   gcc_assert (arglist == NULL);
- 
    if (!target || !register_operand (target, tmode))
      target = gen_reg_rtx (tmode);
  
--- 7217,7230 ----
    rtvec v = rtvec_alloc (n_elt);
  
    gcc_assert (VECTOR_MODE_P (tmode));
!   gcc_assert (n_elt == call_expr_nargs (exp));
!   
!   for (i = 0; i < n_elt; ++i)
      {
!       rtx x = expand_normal (CALL_EXPR_ARG (exp, i));
        RTVEC_ELT (v, i) = gen_lowpart (inner_mode, x);
      }
  
    if (!target || !register_operand (target, tmode))
      target = gen_reg_rtx (tmode);
  
*************** get_element_number (tree vec_type, tree 
*** 7256,7271 ****
  
  /* Expand vec_set builtin.  */
  static rtx
! altivec_expand_vec_set_builtin (tree arglist)
  {
    enum machine_mode tmode, mode1;
    tree arg0, arg1, arg2;
    int elt;
    rtx op0, op1;
  
!   arg0 = TREE_VALUE (arglist);
!   arg1 = TREE_VALUE (TREE_CHAIN (arglist));
!   arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
  
    tmode = TYPE_MODE (TREE_TYPE (arg0));
    mode1 = TYPE_MODE (TREE_TYPE (TREE_TYPE (arg0)));
--- 7252,7267 ----
  
  /* Expand vec_set builtin.  */
  static rtx
! altivec_expand_vec_set_builtin (tree exp)
  {
    enum machine_mode tmode, mode1;
    tree arg0, arg1, arg2;
    int elt;
    rtx op0, op1;
  
!   arg0 = CALL_EXPR_ARG0 (exp);
!   arg1 = CALL_EXPR_ARG1 (exp);
!   arg2 = CALL_EXPR_ARG2 (exp);
  
    tmode = TYPE_MODE (TREE_TYPE (arg0));
    mode1 = TYPE_MODE (TREE_TYPE (TREE_TYPE (arg0)));
*************** altivec_expand_vec_set_builtin (tree arg
*** 7288,7302 ****
  
  /* Expand vec_ext builtin.  */
  static rtx
! altivec_expand_vec_ext_builtin (tree arglist, rtx target)
  {
    enum machine_mode tmode, mode0;
    tree arg0, arg1;
    int elt;
    rtx op0;
  
!   arg0 = TREE_VALUE (arglist);
!   arg1 = TREE_VALUE (TREE_CHAIN (arglist));
  
    op0 = expand_normal (arg0);
    elt = get_element_number (TREE_TYPE (arg0), arg1);
--- 7284,7298 ----
  
  /* Expand vec_ext builtin.  */
  static rtx
! altivec_expand_vec_ext_builtin (tree exp, rtx target)
  {
    enum machine_mode tmode, mode0;
    tree arg0, arg1;
    int elt;
    rtx op0;
  
!   arg0 = CALL_EXPR_ARG0 (exp);
!   arg1 = CALL_EXPR_ARG1 (exp);
  
    op0 = expand_normal (arg0);
    elt = get_element_number (TREE_TYPE (arg0), arg1);
*************** altivec_expand_builtin (tree exp, rtx ta
*** 7324,7331 ****
    struct builtin_description_predicates *dp;
    size_t i;
    enum insn_code icode;
!   tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
!   tree arglist = TREE_OPERAND (exp, 1);
    tree arg0;
    rtx op0, pat;
    enum machine_mode tmode, mode0;
--- 7320,7326 ----
    struct builtin_description_predicates *dp;
    size_t i;
    enum insn_code icode;
!   tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
    tree arg0;
    rtx op0, pat;
    enum machine_mode tmode, mode0;
*************** altivec_expand_builtin (tree exp, rtx ta
*** 7356,7370 ****
    switch (fcode)
      {
      case ALTIVEC_BUILTIN_STVX:
!       return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx, arglist);
      case ALTIVEC_BUILTIN_STVEBX:
!       return altivec_expand_stv_builtin (CODE_FOR_altivec_stvebx, arglist);
      case ALTIVEC_BUILTIN_STVEHX:
!       return altivec_expand_stv_builtin (CODE_FOR_altivec_stvehx, arglist);
      case ALTIVEC_BUILTIN_STVEWX:
!       return altivec_expand_stv_builtin (CODE_FOR_altivec_stvewx, arglist);
      case ALTIVEC_BUILTIN_STVXL:
!       return altivec_expand_stv_builtin (CODE_FOR_altivec_stvxl, arglist);
  
      case ALTIVEC_BUILTIN_MFVSCR:
        icode = CODE_FOR_altivec_mfvscr;
--- 7351,7365 ----
    switch (fcode)
      {
      case ALTIVEC_BUILTIN_STVX:
!       return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx, exp);
      case ALTIVEC_BUILTIN_STVEBX:
!       return altivec_expand_stv_builtin (CODE_FOR_altivec_stvebx, exp);
      case ALTIVEC_BUILTIN_STVEHX:
!       return altivec_expand_stv_builtin (CODE_FOR_altivec_stvehx, exp);
      case ALTIVEC_BUILTIN_STVEWX:
!       return altivec_expand_stv_builtin (CODE_FOR_altivec_stvewx, exp);
      case ALTIVEC_BUILTIN_STVXL:
!       return altivec_expand_stv_builtin (CODE_FOR_altivec_stvxl, exp);
  
      case ALTIVEC_BUILTIN_MFVSCR:
        icode = CODE_FOR_altivec_mfvscr;
*************** altivec_expand_builtin (tree exp, rtx ta
*** 7383,7389 ****
  
      case ALTIVEC_BUILTIN_MTVSCR:
        icode = CODE_FOR_altivec_mtvscr;
!       arg0 = TREE_VALUE (arglist);
        op0 = expand_normal (arg0);
        mode0 = insn_data[icode].operand[0].mode;
  
--- 7378,7384 ----
  
      case ALTIVEC_BUILTIN_MTVSCR:
        icode = CODE_FOR_altivec_mtvscr;
!       arg0 = CALL_EXPR_ARG0 (exp);
        op0 = expand_normal (arg0);
        mode0 = insn_data[icode].operand[0].mode;
  
*************** altivec_expand_builtin (tree exp, rtx ta
*** 7405,7411 ****
  
      case ALTIVEC_BUILTIN_DSS:
        icode = CODE_FOR_altivec_dss;
!       arg0 = TREE_VALUE (arglist);
        STRIP_NOPS (arg0);
        op0 = expand_normal (arg0);
        mode0 = insn_data[icode].operand[0].mode;
--- 7400,7406 ----
  
      case ALTIVEC_BUILTIN_DSS:
        icode = CODE_FOR_altivec_dss;
!       arg0 = CALL_EXPR_ARG0 (exp);
        STRIP_NOPS (arg0);
        op0 = expand_normal (arg0);
        mode0 = insn_data[icode].operand[0].mode;
*************** altivec_expand_builtin (tree exp, rtx ta
*** 7431,7449 ****
      case ALTIVEC_BUILTIN_VEC_INIT_V8HI:
      case ALTIVEC_BUILTIN_VEC_INIT_V16QI:
      case ALTIVEC_BUILTIN_VEC_INIT_V4SF:
!       return altivec_expand_vec_init_builtin (TREE_TYPE (exp), arglist, target);
  
      case ALTIVEC_BUILTIN_VEC_SET_V4SI:
      case ALTIVEC_BUILTIN_VEC_SET_V8HI:
      case ALTIVEC_BUILTIN_VEC_SET_V16QI:
      case ALTIVEC_BUILTIN_VEC_SET_V4SF:
!       return altivec_expand_vec_set_builtin (arglist);
  
      case ALTIVEC_BUILTIN_VEC_EXT_V4SI:
      case ALTIVEC_BUILTIN_VEC_EXT_V8HI:
      case ALTIVEC_BUILTIN_VEC_EXT_V16QI:
      case ALTIVEC_BUILTIN_VEC_EXT_V4SF:
!       return altivec_expand_vec_ext_builtin (arglist, target);
  
      default:
        break;
--- 7426,7444 ----
      case ALTIVEC_BUILTIN_VEC_INIT_V8HI:
      case ALTIVEC_BUILTIN_VEC_INIT_V16QI:
      case ALTIVEC_BUILTIN_VEC_INIT_V4SF:
!       return altivec_expand_vec_init_builtin (TREE_TYPE (exp), exp, target);
  
      case ALTIVEC_BUILTIN_VEC_SET_V4SI:
      case ALTIVEC_BUILTIN_VEC_SET_V8HI:
      case ALTIVEC_BUILTIN_VEC_SET_V16QI:
      case ALTIVEC_BUILTIN_VEC_SET_V4SF:
!       return altivec_expand_vec_set_builtin (exp);
  
      case ALTIVEC_BUILTIN_VEC_EXT_V4SI:
      case ALTIVEC_BUILTIN_VEC_EXT_V8HI:
      case ALTIVEC_BUILTIN_VEC_EXT_V16QI:
      case ALTIVEC_BUILTIN_VEC_EXT_V4SF:
!       return altivec_expand_vec_ext_builtin (exp, target);
  
      default:
        break;
*************** altivec_expand_builtin (tree exp, rtx ta
*** 7454,7492 ****
    d = (struct builtin_description *) bdesc_abs;
    for (i = 0; i < ARRAY_SIZE (bdesc_abs); i++, d++)
      if (d->code == fcode)
!       return altivec_expand_abs_builtin (d->icode, arglist, target);
  
    /* Expand the AltiVec predicates.  */
    dp = (struct builtin_description_predicates *) bdesc_altivec_preds;
    for (i = 0; i < ARRAY_SIZE (bdesc_altivec_preds); i++, dp++)
      if (dp->code == fcode)
        return altivec_expand_predicate_builtin (dp->icode, dp->opcode,
! 					       arglist, target);
  
    /* LV* are funky.  We initialized them differently.  */
    switch (fcode)
      {
      case ALTIVEC_BUILTIN_LVSL:
        return altivec_expand_lv_builtin (CODE_FOR_altivec_lvsl,
! 					arglist, target);
      case ALTIVEC_BUILTIN_LVSR:
        return altivec_expand_lv_builtin (CODE_FOR_altivec_lvsr,
! 					arglist, target);
      case ALTIVEC_BUILTIN_LVEBX:
        return altivec_expand_lv_builtin (CODE_FOR_altivec_lvebx,
! 					arglist, target);
      case ALTIVEC_BUILTIN_LVEHX:
        return altivec_expand_lv_builtin (CODE_FOR_altivec_lvehx,
! 					arglist, target);
      case ALTIVEC_BUILTIN_LVEWX:
        return altivec_expand_lv_builtin (CODE_FOR_altivec_lvewx,
! 					arglist, target);
      case ALTIVEC_BUILTIN_LVXL:
        return altivec_expand_lv_builtin (CODE_FOR_altivec_lvxl,
! 					arglist, target);
      case ALTIVEC_BUILTIN_LVX:
        return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx,
! 					arglist, target);
      default:
        break;
        /* Fall through.  */
--- 7449,7487 ----
    d = (struct builtin_description *) bdesc_abs;
    for (i = 0; i < ARRAY_SIZE (bdesc_abs); i++, d++)
      if (d->code == fcode)
!       return altivec_expand_abs_builtin (d->icode, exp, target);
  
    /* Expand the AltiVec predicates.  */
    dp = (struct builtin_description_predicates *) bdesc_altivec_preds;
    for (i = 0; i < ARRAY_SIZE (bdesc_altivec_preds); i++, dp++)
      if (dp->code == fcode)
        return altivec_expand_predicate_builtin (dp->icode, dp->opcode,
! 					       exp, target);
  
    /* LV* are funky.  We initialized them differently.  */
    switch (fcode)
      {
      case ALTIVEC_BUILTIN_LVSL:
        return altivec_expand_lv_builtin (CODE_FOR_altivec_lvsl,
! 					exp, target);
      case ALTIVEC_BUILTIN_LVSR:
        return altivec_expand_lv_builtin (CODE_FOR_altivec_lvsr,
! 					exp, target);
      case ALTIVEC_BUILTIN_LVEBX:
        return altivec_expand_lv_builtin (CODE_FOR_altivec_lvebx,
! 					exp, target);
      case ALTIVEC_BUILTIN_LVEHX:
        return altivec_expand_lv_builtin (CODE_FOR_altivec_lvehx,
! 					exp, target);
      case ALTIVEC_BUILTIN_LVEWX:
        return altivec_expand_lv_builtin (CODE_FOR_altivec_lvewx,
! 					exp, target);
      case ALTIVEC_BUILTIN_LVXL:
        return altivec_expand_lv_builtin (CODE_FOR_altivec_lvxl,
! 					exp, target);
      case ALTIVEC_BUILTIN_LVX:
        return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx,
! 					exp, target);
      default:
        break;
        /* Fall through.  */
*************** static struct builtin_description bdesc_
*** 7532,7539 ****
  static rtx
  spe_expand_builtin (tree exp, rtx target, bool *expandedp)
  {
!   tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
!   tree arglist = TREE_OPERAND (exp, 1);
    tree arg1, arg0;
    unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
    enum insn_code icode;
--- 7527,7533 ----
  static rtx
  spe_expand_builtin (tree exp, rtx target, bool *expandedp)
  {
!   tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
    tree arg1, arg0;
    unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
    enum insn_code icode;
*************** spe_expand_builtin (tree exp, rtx target
*** 7554,7560 ****
      case SPE_BUILTIN_EVSTWHO:
      case SPE_BUILTIN_EVSTWWE:
      case SPE_BUILTIN_EVSTWWO:
!       arg1 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
        if (TREE_CODE (arg1) != INTEGER_CST
  	  || TREE_INT_CST_LOW (arg1) & ~0x1f)
  	{
--- 7548,7554 ----
      case SPE_BUILTIN_EVSTWHO:
      case SPE_BUILTIN_EVSTWWE:
      case SPE_BUILTIN_EVSTWWO:
!       arg1 = CALL_EXPR_ARG2 (exp);
        if (TREE_CODE (arg1) != INTEGER_CST
  	  || TREE_INT_CST_LOW (arg1) & ~0x1f)
  	{
*************** spe_expand_builtin (tree exp, rtx target
*** 7571,7580 ****
      {
      case SPE_BUILTIN_EVSPLATFI:
        return rs6000_expand_unop_builtin (CODE_FOR_spe_evsplatfi,
! 					 arglist, target);
      case SPE_BUILTIN_EVSPLATI:
        return rs6000_expand_unop_builtin (CODE_FOR_spe_evsplati,
! 					 arglist, target);
      default:
        break;
      }
--- 7565,7574 ----
      {
      case SPE_BUILTIN_EVSPLATFI:
        return rs6000_expand_unop_builtin (CODE_FOR_spe_evsplatfi,
! 					 exp, target);
      case SPE_BUILTIN_EVSPLATI:
        return rs6000_expand_unop_builtin (CODE_FOR_spe_evsplati,
! 					 exp, target);
      default:
        break;
      }
*************** spe_expand_builtin (tree exp, rtx target
*** 7582,7629 ****
    d = (struct builtin_description *) bdesc_2arg_spe;
    for (i = 0; i < ARRAY_SIZE (bdesc_2arg_spe); ++i, ++d)
      if (d->code == fcode)
!       return rs6000_expand_binop_builtin (d->icode, arglist, target);
  
    d = (struct builtin_description *) bdesc_spe_predicates;
    for (i = 0; i < ARRAY_SIZE (bdesc_spe_predicates); ++i, ++d)
      if (d->code == fcode)
!       return spe_expand_predicate_builtin (d->icode, arglist, target);
  
    d = (struct builtin_description *) bdesc_spe_evsel;
    for (i = 0; i < ARRAY_SIZE (bdesc_spe_evsel); ++i, ++d)
      if (d->code == fcode)
!       return spe_expand_evsel_builtin (d->icode, arglist, target);
  
    switch (fcode)
      {
      case SPE_BUILTIN_EVSTDDX:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstddx, arglist);
      case SPE_BUILTIN_EVSTDHX:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstdhx, arglist);
      case SPE_BUILTIN_EVSTDWX:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstdwx, arglist);
      case SPE_BUILTIN_EVSTWHEX:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstwhex, arglist);
      case SPE_BUILTIN_EVSTWHOX:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstwhox, arglist);
      case SPE_BUILTIN_EVSTWWEX:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstwwex, arglist);
      case SPE_BUILTIN_EVSTWWOX:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstwwox, arglist);
      case SPE_BUILTIN_EVSTDD:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstdd, arglist);
      case SPE_BUILTIN_EVSTDH:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstdh, arglist);
      case SPE_BUILTIN_EVSTDW:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstdw, arglist);
      case SPE_BUILTIN_EVSTWHE:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstwhe, arglist);
      case SPE_BUILTIN_EVSTWHO:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstwho, arglist);
      case SPE_BUILTIN_EVSTWWE:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstwwe, arglist);
      case SPE_BUILTIN_EVSTWWO:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstwwo, arglist);
      case SPE_BUILTIN_MFSPEFSCR:
        icode = CODE_FOR_spe_mfspefscr;
        tmode = insn_data[icode].operand[0].mode;
--- 7576,7623 ----
    d = (struct builtin_description *) bdesc_2arg_spe;
    for (i = 0; i < ARRAY_SIZE (bdesc_2arg_spe); ++i, ++d)
      if (d->code == fcode)
!       return rs6000_expand_binop_builtin (d->icode, exp, target);
  
    d = (struct builtin_description *) bdesc_spe_predicates;
    for (i = 0; i < ARRAY_SIZE (bdesc_spe_predicates); ++i, ++d)
      if (d->code == fcode)
!       return spe_expand_predicate_builtin (d->icode, exp, target);
  
    d = (struct builtin_description *) bdesc_spe_evsel;
    for (i = 0; i < ARRAY_SIZE (bdesc_spe_evsel); ++i, ++d)
      if (d->code == fcode)
!       return spe_expand_evsel_builtin (d->icode, exp, target);
  
    switch (fcode)
      {
      case SPE_BUILTIN_EVSTDDX:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstddx, exp);
      case SPE_BUILTIN_EVSTDHX:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstdhx, exp);
      case SPE_BUILTIN_EVSTDWX:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstdwx, exp);
      case SPE_BUILTIN_EVSTWHEX:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstwhex, exp);
      case SPE_BUILTIN_EVSTWHOX:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstwhox, exp);
      case SPE_BUILTIN_EVSTWWEX:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstwwex, exp);
      case SPE_BUILTIN_EVSTWWOX:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstwwox, exp);
      case SPE_BUILTIN_EVSTDD:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstdd, exp);
      case SPE_BUILTIN_EVSTDH:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstdh, exp);
      case SPE_BUILTIN_EVSTDW:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstdw, exp);
      case SPE_BUILTIN_EVSTWHE:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstwhe, exp);
      case SPE_BUILTIN_EVSTWHO:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstwho, exp);
      case SPE_BUILTIN_EVSTWWE:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstwwe, exp);
      case SPE_BUILTIN_EVSTWWO:
!       return spe_expand_stv_builtin (CODE_FOR_spe_evstwwo, exp);
      case SPE_BUILTIN_MFSPEFSCR:
        icode = CODE_FOR_spe_mfspefscr;
        tmode = insn_data[icode].operand[0].mode;
*************** spe_expand_builtin (tree exp, rtx target
*** 7640,7646 ****
        return target;
      case SPE_BUILTIN_MTSPEFSCR:
        icode = CODE_FOR_spe_mtspefscr;
!       arg0 = TREE_VALUE (arglist);
        op0 = expand_normal (arg0);
        mode0 = insn_data[icode].operand[0].mode;
  
--- 7634,7640 ----
        return target;
      case SPE_BUILTIN_MTSPEFSCR:
        icode = CODE_FOR_spe_mtspefscr;
!       arg0 = CALL_EXPR_ARG0 (exp);
        op0 = expand_normal (arg0);
        mode0 = insn_data[icode].operand[0].mode;
  
*************** spe_expand_builtin (tree exp, rtx target
*** 7663,7674 ****
  }
  
  static rtx
! spe_expand_predicate_builtin (enum insn_code icode, tree arglist, rtx target)
  {
    rtx pat, scratch, tmp;
!   tree form = TREE_VALUE (arglist);
!   tree arg0 = TREE_VALUE (TREE_CHAIN (arglist));
!   tree arg1 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
    rtx op0 = expand_normal (arg0);
    rtx op1 = expand_normal (arg1);
    enum machine_mode mode0 = insn_data[icode].operand[1].mode;
--- 7657,7668 ----
  }
  
  static rtx
! spe_expand_predicate_builtin (enum insn_code icode, tree exp, rtx target)
  {
    rtx pat, scratch, tmp;
!   tree form = CALL_EXPR_ARG0 (exp);
!   tree arg0 = CALL_EXPR_ARG1 (exp);
!   tree arg1 = CALL_EXPR_ARG2 (exp);
    rtx op0 = expand_normal (arg0);
    rtx op1 = expand_normal (arg1);
    enum machine_mode mode0 = insn_data[icode].operand[1].mode;
*************** spe_expand_predicate_builtin (enum insn_
*** 7771,7783 ****
  */
  
  static rtx
! spe_expand_evsel_builtin (enum insn_code icode, tree arglist, rtx target)
  {
    rtx pat, scratch;
!   tree arg0 = TREE_VALUE (arglist);
!   tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
!   tree arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
!   tree arg3 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (arglist))));
    rtx op0 = expand_normal (arg0);
    rtx op1 = expand_normal (arg1);
    rtx op2 = expand_normal (arg2);
--- 7765,7777 ----
  */
  
  static rtx
! spe_expand_evsel_builtin (enum insn_code icode, tree exp, rtx target)
  {
    rtx pat, scratch;
!   tree arg0 = CALL_EXPR_ARG0 (exp);
!   tree arg1 = CALL_EXPR_ARG1 (exp);
!   tree arg2 = CALL_EXPR_ARG2 (exp);
!   tree arg3 = CALL_EXPR_ARG (exp, 3);
    rtx op0 = expand_normal (arg0);
    rtx op1 = expand_normal (arg1);
    rtx op2 = expand_normal (arg2);
*************** rs6000_expand_builtin (tree exp, rtx tar
*** 7831,7838 ****
  		       enum machine_mode mode ATTRIBUTE_UNUSED,
  		       int ignore ATTRIBUTE_UNUSED)
  {
!   tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
!   tree arglist = TREE_OPERAND (exp, 1);
    unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
    struct builtin_description *d;
    size_t i;
--- 7825,7831 ----
  		       enum machine_mode mode ATTRIBUTE_UNUSED,
  		       int ignore ATTRIBUTE_UNUSED)
  {
!   tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
    unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
    struct builtin_description *d;
    size_t i;
*************** rs6000_expand_builtin (tree exp, rtx tar
*** 7850,7856 ****
  
        gcc_assert (TARGET_ALTIVEC);
  
!       arg = TREE_VALUE (arglist);
        gcc_assert (TREE_CODE (TREE_TYPE (arg)) == POINTER_TYPE);
        op = expand_expr (arg, NULL_RTX, Pmode, EXPAND_NORMAL);
        addr = memory_address (mode, op);
--- 7843,7849 ----
  
        gcc_assert (TARGET_ALTIVEC);
  
!       arg = CALL_EXPR_ARG0 (exp);
        gcc_assert (TREE_CODE (TREE_TYPE (arg)) == POINTER_TYPE);
        op = expand_expr (arg, NULL_RTX, Pmode, EXPAND_NORMAL);
        addr = memory_address (mode, op);
*************** rs6000_expand_builtin (tree exp, rtx tar
*** 7900,7918 ****
    d = (struct builtin_description *) bdesc_1arg;
    for (i = 0; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
      if (d->code == fcode)
!       return rs6000_expand_unop_builtin (d->icode, arglist, target);
  
    /* Handle simple binary operations.  */
    d = (struct builtin_description *) bdesc_2arg;
    for (i = 0; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
      if (d->code == fcode)
!       return rs6000_expand_binop_builtin (d->icode, arglist, target);
  
    /* Handle simple ternary operations.  */
    d = (struct builtin_description *) bdesc_3arg;
    for (i = 0; i < ARRAY_SIZE  (bdesc_3arg); i++, d++)
      if (d->code == fcode)
!       return rs6000_expand_ternop_builtin (d->icode, arglist, target);
  
    gcc_unreachable ();
  }
--- 7893,7911 ----
    d = (struct builtin_description *) bdesc_1arg;
    for (i = 0; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
      if (d->code == fcode)
!       return rs6000_expand_unop_builtin (d->icode, exp, target);
  
    /* Handle simple binary operations.  */
    d = (struct builtin_description *) bdesc_2arg;
    for (i = 0; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
      if (d->code == fcode)
!       return rs6000_expand_binop_builtin (d->icode, exp, target);
  
    /* Handle simple ternary operations.  */
    d = (struct builtin_description *) bdesc_3arg;
    for (i = 0; i < ARRAY_SIZE  (bdesc_3arg); i++, d++)
      if (d->code == fcode)
!       return rs6000_expand_ternop_builtin (d->icode, exp, target);
  
    gcc_unreachable ();
  }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]