This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: CALL_EXPR representation part 4/9 (back ends)
- From: Sandra Loosemore <sandra at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Brooks Moses <brooks dot moses at codesourcery dot com>, Lee Millward <lee dot millward at codesourcery dot com>
- Date: Sat, 10 Feb 2007 10:32:25 -0500
- Subject: PATCH: CALL_EXPR representation part 4/9 (back ends)
This is part 4 of the patch to the CALL_EXPR representation. This piece
contains the patches to propagate the new CALL_EXPR accessors to the various
back-end files in the gcc/config directory.
-Sandra
2007-02-09 Sandra Loosemore <sandra@codesourcery.com>
Brooks Moses <brooks.moses@codesourcery.com>
Lee Millward <lee.millward@codesourcery.com>
* config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR
accessors.
* config/frv/frv.c (frv_expand_builtin): Likewise.
* config/s390/s390.c (s390_expand_builtin): Likewise.
* config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr.
(sparc_expand_builtin): Use new CALL_EXPR accessors.
* config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise.
(ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter
instead of arglist. Use new CALL_EXPR accessors on it. Fix callers.
(ix86_expand_store_builtin): Likewise.
(ix86_expand_unop_builtin): Likewise.
(ix86_expand_unop1_builtin): Likewise.
(ix86_expand_sse_compare): Likewise.
(ix86_expand_sse_comi): Likewise.
(ix86_expand_vec_init_builtin): Likewise.
(ix86_expand_vec_ext_builtin): Likewise.
(ix86_expand_vec_set_builtin): Likewise.
(ix86_expand_builtin): Use new CALL_EXPR accessors.
* config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors.
* config/c4x/c4x.c (c4x_expand_builtin): Likewise.
* config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR
instead of arglist. Use new CALL_EXPR accessors. Fix callers.
(iq2000_expand_builtin): Use new CALL_EXPR accessors.
* config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use
build_call_expr.
* config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise.
(rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of
arglist. Use new CALL_EXPR accessors. Fix 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 new CALL_EXPR accessors.
(altivec_expand_st_builtin): Likewise.
(altivec_expand_dst_builtin): Likewise.
(altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of
arglist. Use new CALL_EXPR accessors. Fix callers.
(altivec_expand_vec_set_builtin): Likewise.
(altivec_expand_vec_ext_builtin): Likewise.
(altivec_expand_builtin): Use new CALL_EXPR accessors.
(spe_expand_builtin): Likewise.
(spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of
arglist. Use new CALL_EXPR accessors. Fix callers.
(spe_expand_evsel_builtin): Likewise.
(rs6000_expand_builtin): Use new CALL_EXPR accessors.
* config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR
instead of arglist. Use new CALL_EXPR accessors. Fix callers.
(arm_expand_unop_builtin): Likewise.
(arm_expand_builtin): Use new CALL_EXPR accessors.
* config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR
accessors.
* config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR
instead of arglist. Use new CALL_EXPR accessors. Fix callers.
(bfin_expand_unop_builtin): Likewise.
(bfin_expand_builtin): Use new CALL_EXPR accessors.
Index: gcc/config/alpha/alpha.c
===================================================================
*** gcc/config/alpha/alpha.c (revision 121705)
--- gcc/config/alpha/alpha.c (working copy)
*************** alpha_expand_builtin (tree exp, rtx targ
*** 6583,6591 ****
{
#define MAX_ARGS 2
! tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
! tree arglist = TREE_OPERAND (exp, 1);
enum insn_code icode;
rtx op[MAX_ARGS], pat;
int arity;
--- 6583,6592 ----
{
#define MAX_ARGS 2
! tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
! tree arg;
! call_expr_arg_iterator iter;
enum insn_code icode;
rtx op[MAX_ARGS], pat;
int arity;
*************** alpha_expand_builtin (tree exp, rtx targ
*** 6599,6611 ****
nonvoid = TREE_TYPE (TREE_TYPE (fndecl)) != void_type_node;
! for (arglist = TREE_OPERAND (exp, 1), arity = 0;
! arglist;
! arglist = TREE_CHAIN (arglist), arity++)
{
const struct insn_operand_data *insn_op;
- tree arg = TREE_VALUE (arglist);
if (arg == error_mark_node)
return NULL_RTX;
if (arity > MAX_ARGS)
--- 6600,6610 ----
nonvoid = TREE_TYPE (TREE_TYPE (fndecl)) != void_type_node;
! arity = 0;
! FOR_EACH_CALL_EXPR_ARG (arg, iter, exp)
{
const struct insn_operand_data *insn_op;
if (arg == error_mark_node)
return NULL_RTX;
if (arity > MAX_ARGS)
*************** alpha_expand_builtin (tree exp, rtx targ
*** 6617,6622 ****
--- 6616,6622 ----
if (!(*insn_op->predicate) (op[arity], insn_op->mode))
op[arity] = copy_to_mode_reg (insn_op->mode, op[arity]);
+ arity++;
}
if (nonvoid)
Index: gcc/config/frv/frv.c
===================================================================
*** gcc/config/frv/frv.c (revision 121705)
--- gcc/config/frv/frv.c (working copy)
*************** frv_expand_builtin (tree exp,
*** 9216,9223 ****
enum machine_mode mode ATTRIBUTE_UNUSED,
int ignore ATTRIBUTE_UNUSED)
{
! tree arglist = TREE_OPERAND (exp, 1);
! tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
unsigned fcode = (unsigned)DECL_FUNCTION_CODE (fndecl);
unsigned i;
struct builtin_description *d;
--- 9216,9224 ----
enum machine_mode mode ATTRIBUTE_UNUSED,
int ignore ATTRIBUTE_UNUSED)
{
! /* FIXME: Pass the CALL_EXPR directly instead of consing up an arglist. */
! tree arglist = CALL_EXPR_ARGS (exp);
! tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
unsigned fcode = (unsigned)DECL_FUNCTION_CODE (fndecl);
unsigned i;
struct builtin_description *d;
Index: gcc/config/s390/s390.c
===================================================================
*** gcc/config/s390/s390.c (revision 121705)
--- gcc/config/s390/s390.c (working copy)
*************** s390_expand_builtin (tree exp, rtx targe
*** 8210,8222 ****
unsigned int const *code_for_builtin =
TARGET_64BIT ? code_for_builtin_64 : code_for_builtin_31;
! tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
- tree arglist = TREE_OPERAND (exp, 1);
enum insn_code icode;
rtx op[MAX_ARGS], pat;
int arity;
bool nonvoid;
if (fcode >= S390_BUILTIN_max)
internal_error ("bad builtin fcode");
--- 8210,8223 ----
unsigned int const *code_for_builtin =
TARGET_64BIT ? code_for_builtin_64 : code_for_builtin_31;
! tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
enum insn_code icode;
rtx op[MAX_ARGS], pat;
int arity;
bool nonvoid;
+ tree arg;
+ call_expr_arg_iterator iter;
if (fcode >= S390_BUILTIN_max)
internal_error ("bad builtin fcode");
*************** s390_expand_builtin (tree exp, rtx targe
*** 8226,8238 ****
nonvoid = TREE_TYPE (TREE_TYPE (fndecl)) != void_type_node;
! for (arglist = TREE_OPERAND (exp, 1), arity = 0;
! arglist;
! arglist = TREE_CHAIN (arglist), arity++)
{
const struct insn_operand_data *insn_op;
- tree arg = TREE_VALUE (arglist);
if (arg == error_mark_node)
return NULL_RTX;
if (arity > MAX_ARGS)
--- 8227,8237 ----
nonvoid = TREE_TYPE (TREE_TYPE (fndecl)) != void_type_node;
! arity = 0;
! FOR_EACH_CALL_EXPR_ARG (arg, iter, exp)
{
const struct insn_operand_data *insn_op;
if (arg == error_mark_node)
return NULL_RTX;
if (arity > MAX_ARGS)
*************** s390_expand_builtin (tree exp, rtx targe
*** 8244,8249 ****
--- 8243,8249 ----
if (!(*insn_op->predicate) (op[arity], insn_op->mode))
op[arity] = copy_to_mode_reg (insn_op->mode, op[arity]);
+ arity++;
}
if (nonvoid)
Index: gcc/config/sparc/sparc.c
===================================================================
*** gcc/config/sparc/sparc.c (revision 121705)
--- gcc/config/sparc/sparc.c (working copy)
*************** sparc_gimplify_va_arg (tree valist, tree
*** 5701,5712 ****
tree tmp = create_tmp_var (type, "va_arg_tmp");
tree dest_addr = build_fold_addr_expr (tmp);
! tree copy = build_function_call_expr
! (implicit_built_in_decls[BUILT_IN_MEMCPY],
! tree_cons (NULL_TREE, dest_addr,
! tree_cons (NULL_TREE, addr,
! tree_cons (NULL_TREE, size_int (rsize),
! NULL_TREE))));
gimplify_and_add (copy, pre_p);
addr = dest_addr;
--- 5701,5710 ----
tree tmp = create_tmp_var (type, "va_arg_tmp");
tree dest_addr = build_fold_addr_expr (tmp);
! tree copy = build_call_expr (implicit_built_in_decls[BUILT_IN_MEMCPY], 3,
! dest_addr,
! addr,
! size_int (rsize));
gimplify_and_add (copy, pre_p);
addr = dest_addr;
*************** static rtx
*** 7985,7992 ****
sparc_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
enum machine_mode tmode, int ignore ATTRIBUTE_UNUSED)
{
! tree arglist;
! tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
unsigned int icode = DECL_FUNCTION_CODE (fndecl);
rtx pat, op[4];
enum machine_mode mode[4];
--- 7983,7991 ----
sparc_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
enum machine_mode tmode, int ignore ATTRIBUTE_UNUSED)
{
! tree arg;
! call_expr_arg_iterator iter;
! tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
unsigned int icode = DECL_FUNCTION_CODE (fndecl);
rtx pat, op[4];
enum machine_mode mode[4];
*************** sparc_expand_builtin (tree exp, rtx targ
*** 8001,8011 ****
else
op[arg_count] = target;
! for (arglist = TREE_OPERAND (exp, 1); arglist;
! arglist = TREE_CHAIN (arglist))
{
- tree arg = TREE_VALUE (arglist);
-
arg_count++;
mode[arg_count] = insn_data[icode].operand[arg_count].mode;
op[arg_count] = expand_normal (arg);
--- 8000,8007 ----
else
op[arg_count] = target;
! FOR_EACH_CALL_EXPR_ARG (arg, iter, exp)
{
arg_count++;
mode[arg_count] = insn_data[icode].operand[arg_count].mode;
op[arg_count] = expand_normal (arg);
Index: gcc/config/i386/i386.c
===================================================================
*** gcc/config/i386/i386.c (revision 121705)
--- gcc/config/i386/i386.c (working copy)
*************** ix86_function_ok_for_sibcall (tree decl,
*** 2691,2697 ****
func = decl;
else
{
! func = TREE_TYPE (TREE_OPERAND (exp, 0));
if (POINTER_TYPE_P (func))
func = TREE_TYPE (func);
}
--- 2691,2697 ----
func = decl;
else
{
! func = TREE_TYPE (CALL_EXPR_FN (exp));
if (POINTER_TYPE_P (func))
func = TREE_TYPE (func);
}
*************** ix86_function_ok_for_sibcall (tree decl,
*** 2726,2732 ****
tree type;
/* We're looking at the CALL_EXPR, we need the type of the function. */
! type = TREE_OPERAND (exp, 0); /* pointer expression */
type = TREE_TYPE (type); /* pointer type */
type = TREE_TYPE (type); /* function type */
--- 2726,2732 ----
tree type;
/* We're looking at the CALL_EXPR, we need the type of the function. */
! type = CALL_EXPR_FN (exp); /* pointer expression */
type = TREE_TYPE (type); /* pointer type */
type = TREE_TYPE (type); /* function type */
*************** safe_vector_operand (rtx x, enum machine
*** 17033,17043 ****
/* Subroutine of ix86_expand_builtin to take care of binop insns. */
static rtx
! ix86_expand_binop_builtin (enum insn_code icode, tree arglist, rtx target)
{
rtx pat, xops[3];
! 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;
--- 17033,17043 ----
/* Subroutine of ix86_expand_builtin to take care of binop insns. */
static rtx
! ix86_expand_binop_builtin (enum insn_code icode, tree exp, rtx target)
{
rtx pat, xops[3];
! 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;
*************** ix86_expand_binop_builtin (enum insn_cod
*** 17101,17111 ****
/* Subroutine of ix86_expand_builtin to take care of stores. */
static rtx
! ix86_expand_store_builtin (enum insn_code icode, tree arglist)
{
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 mode0 = insn_data[icode].operand[0].mode;
--- 17101,17111 ----
/* Subroutine of ix86_expand_builtin to take care of stores. */
static rtx
! ix86_expand_store_builtin (enum insn_code icode, tree exp)
{
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 mode0 = insn_data[icode].operand[0].mode;
*************** ix86_expand_store_builtin (enum insn_cod
*** 17126,17136 ****
/* Subroutine of ix86_expand_builtin to take care of unop insns. */
static rtx
! ix86_expand_unop_builtin (enum insn_code icode, tree arglist,
rtx target, int do_load)
{
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;
--- 17126,17136 ----
/* Subroutine of ix86_expand_builtin to take care of unop insns. */
static rtx
! ix86_expand_unop_builtin (enum insn_code icode, tree exp,
rtx target, int do_load)
{
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;
*************** ix86_expand_unop_builtin (enum insn_code
*** 17162,17171 ****
sqrtss, rsqrtss, rcpss. */
static rtx
! ix86_expand_unop1_builtin (enum insn_code icode, tree arglist, rtx target)
{
rtx pat;
! tree arg0 = TREE_VALUE (arglist);
rtx op1, op0 = expand_normal (arg0);
enum machine_mode tmode = insn_data[icode].operand[0].mode;
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
--- 17162,17171 ----
sqrtss, rsqrtss, rcpss. */
static rtx
! ix86_expand_unop1_builtin (enum insn_code icode, tree exp, rtx target)
{
rtx pat;
! tree arg0 = CALL_EXPR_ARG0 (exp);
rtx op1, op0 = expand_normal (arg0);
enum machine_mode tmode = insn_data[icode].operand[0].mode;
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
*************** ix86_expand_unop1_builtin (enum insn_cod
*** 17196,17207 ****
/* Subroutine of ix86_expand_builtin to take care of comparison insns. */
static rtx
! ix86_expand_sse_compare (const struct builtin_description *d, 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);
rtx op2;
--- 17196,17207 ----
/* Subroutine of ix86_expand_builtin to take care of comparison insns. */
static rtx
! ix86_expand_sse_compare (const struct builtin_description *d, 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);
rtx op2;
*************** ix86_expand_sse_compare (const struct bu
*** 17248,17259 ****
/* Subroutine of ix86_expand_builtin to take care of comi insns. */
static rtx
! ix86_expand_sse_comi (const struct builtin_description *d, 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);
rtx op2;
--- 17248,17259 ----
/* Subroutine of ix86_expand_builtin to take care of comi insns. */
static rtx
! ix86_expand_sse_comi (const struct builtin_description *d, 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);
rtx op2;
*************** get_element_number (tree vec_type, tree
*** 17328,17334 ****
these sorts of instructions. */
static rtx
! ix86_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);
--- 17328,17334 ----
these sorts of instructions. */
static rtx
! ix86_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);
*************** ix86_expand_vec_init_builtin (tree type,
*** 17336,17350 ****
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);
--- 17336,17349 ----
rtvec v = rtvec_alloc (n_elt);
gcc_assert (VECTOR_MODE_P (tmode));
+ gcc_assert (call_expr_nargs (exp) == n_elt);
! 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);
*************** ix86_expand_vec_init_builtin (tree type,
*** 17357,17371 ****
had a language-level syntax for referencing vector elements. */
static rtx
! ix86_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);
--- 17356,17370 ----
had a language-level syntax for referencing vector elements. */
static rtx
! ix86_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);
*************** ix86_expand_vec_ext_builtin (tree arglis
*** 17389,17404 ****
a language-level syntax for referencing vector elements. */
static rtx
! ix86_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)));
--- 17388,17403 ----
a language-level syntax for referencing vector elements. */
static rtx
! ix86_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)));
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17433,17440 ****
const struct builtin_description *d;
size_t i;
enum insn_code icode;
! tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
! tree arglist = TREE_OPERAND (exp, 1);
tree arg0, arg1, arg2, arg3;
rtx op0, op1, op2, op3, pat;
enum machine_mode tmode, mode0, mode1, mode2, mode3, mode4;
--- 17432,17438 ----
const struct builtin_description *d;
size_t i;
enum insn_code icode;
! tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
tree arg0, arg1, arg2, arg3;
rtx op0, op1, op2, op3, pat;
enum machine_mode tmode, mode0, mode1, mode2, mode3, mode4;
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17456,17464 ****
? CODE_FOR_mmx_maskmovq
: CODE_FOR_sse2_maskmovdqu);
/* Note the arg order is different from the operand order. */
! arg1 = TREE_VALUE (arglist);
! arg2 = TREE_VALUE (TREE_CHAIN (arglist));
! arg0 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
op2 = expand_normal (arg2);
--- 17454,17462 ----
? CODE_FOR_mmx_maskmovq
: CODE_FOR_sse2_maskmovdqu);
/* Note the arg order is different from the operand order. */
! arg1 = CALL_EXPR_ARG0 (exp);
! arg2 = CALL_EXPR_ARG1 (exp);
! arg0 = CALL_EXPR_ARG2 (exp);
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
op2 = expand_normal (arg2);
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17482,17498 ****
return 0;
case IX86_BUILTIN_SQRTSS:
! return ix86_expand_unop1_builtin (CODE_FOR_sse_vmsqrtv4sf2, arglist, target);
case IX86_BUILTIN_RSQRTSS:
! return ix86_expand_unop1_builtin (CODE_FOR_sse_vmrsqrtv4sf2, arglist, target);
case IX86_BUILTIN_RCPSS:
! return ix86_expand_unop1_builtin (CODE_FOR_sse_vmrcpv4sf2, arglist, target);
case IX86_BUILTIN_LOADUPS:
! return ix86_expand_unop_builtin (CODE_FOR_sse_movups, arglist, target, 1);
case IX86_BUILTIN_STOREUPS:
! return ix86_expand_store_builtin (CODE_FOR_sse_movups, arglist);
case IX86_BUILTIN_LOADHPS:
case IX86_BUILTIN_LOADLPS:
--- 17480,17496 ----
return 0;
case IX86_BUILTIN_SQRTSS:
! return ix86_expand_unop1_builtin (CODE_FOR_sse_vmsqrtv4sf2, exp, target);
case IX86_BUILTIN_RSQRTSS:
! return ix86_expand_unop1_builtin (CODE_FOR_sse_vmrsqrtv4sf2, exp, target);
case IX86_BUILTIN_RCPSS:
! return ix86_expand_unop1_builtin (CODE_FOR_sse_vmrcpv4sf2, exp, target);
case IX86_BUILTIN_LOADUPS:
! return ix86_expand_unop_builtin (CODE_FOR_sse_movups, exp, target, 1);
case IX86_BUILTIN_STOREUPS:
! return ix86_expand_store_builtin (CODE_FOR_sse_movups, exp);
case IX86_BUILTIN_LOADHPS:
case IX86_BUILTIN_LOADLPS:
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17502,17509 ****
: fcode == IX86_BUILTIN_LOADLPS ? CODE_FOR_sse_loadlps
: fcode == IX86_BUILTIN_LOADHPD ? CODE_FOR_sse2_loadhpd
: CODE_FOR_sse2_loadlpd);
! arg0 = TREE_VALUE (arglist);
! arg1 = TREE_VALUE (TREE_CHAIN (arglist));
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
tmode = insn_data[icode].operand[0].mode;
--- 17500,17507 ----
: fcode == IX86_BUILTIN_LOADLPS ? CODE_FOR_sse_loadlps
: fcode == IX86_BUILTIN_LOADHPD ? CODE_FOR_sse2_loadhpd
: CODE_FOR_sse2_loadlpd);
! arg0 = CALL_EXPR_ARG0 (exp);
! arg1 = CALL_EXPR_ARG1 (exp);
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
tmode = insn_data[icode].operand[0].mode;
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17526,17533 ****
case IX86_BUILTIN_STORELPS:
icode = (fcode == IX86_BUILTIN_STOREHPS ? CODE_FOR_sse_storehps
: CODE_FOR_sse_storelps);
! 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;
--- 17524,17531 ----
case IX86_BUILTIN_STORELPS:
icode = (fcode == IX86_BUILTIN_STOREHPS ? CODE_FOR_sse_storehps
: CODE_FOR_sse_storelps);
! 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;
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17543,17554 ****
return const0_rtx;
case IX86_BUILTIN_MOVNTPS:
! return ix86_expand_store_builtin (CODE_FOR_sse_movntv4sf, arglist);
case IX86_BUILTIN_MOVNTQ:
! return ix86_expand_store_builtin (CODE_FOR_sse_movntdi, arglist);
case IX86_BUILTIN_LDMXCSR:
! op0 = expand_normal (TREE_VALUE (arglist));
target = assign_386_stack_local (SImode, SLOT_TEMP);
emit_move_insn (target, op0);
emit_insn (gen_sse_ldmxcsr (target));
--- 17541,17552 ----
return const0_rtx;
case IX86_BUILTIN_MOVNTPS:
! return ix86_expand_store_builtin (CODE_FOR_sse_movntv4sf, exp);
case IX86_BUILTIN_MOVNTQ:
! return ix86_expand_store_builtin (CODE_FOR_sse_movntdi, exp);
case IX86_BUILTIN_LDMXCSR:
! op0 = expand_normal (CALL_EXPR_ARG0 (exp));
target = assign_386_stack_local (SImode, SLOT_TEMP);
emit_move_insn (target, op0);
emit_insn (gen_sse_ldmxcsr (target));
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17564,17572 ****
icode = (fcode == IX86_BUILTIN_SHUFPS
? CODE_FOR_sse_shufps
: CODE_FOR_sse2_shufpd);
! 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);
--- 17562,17570 ----
icode = (fcode == IX86_BUILTIN_SHUFPS
? CODE_FOR_sse_shufps
: CODE_FOR_sse2_shufpd);
! 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);
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17604,17611 ****
: fcode == IX86_BUILTIN_PSHUFLW ? CODE_FOR_sse2_pshuflw
: fcode == IX86_BUILTIN_PSHUFD ? CODE_FOR_sse2_pshufd
: CODE_FOR_mmx_pshufw);
! arg0 = TREE_VALUE (arglist);
! arg1 = TREE_VALUE (TREE_CHAIN (arglist));
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
tmode = insn_data[icode].operand[0].mode;
--- 17602,17609 ----
: fcode == IX86_BUILTIN_PSHUFLW ? CODE_FOR_sse2_pshuflw
: fcode == IX86_BUILTIN_PSHUFD ? CODE_FOR_sse2_pshufd
: CODE_FOR_mmx_pshufw);
! arg0 = CALL_EXPR_ARG0 (exp);
! arg1 = CALL_EXPR_ARG1 (exp);
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
tmode = insn_data[icode].operand[0].mode;
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17634,17641 ****
case IX86_BUILTIN_PSRLDQI128:
icode = ( fcode == IX86_BUILTIN_PSLLDQI128 ? CODE_FOR_sse2_ashlti3
: CODE_FOR_sse2_lshrti3);
! arg0 = TREE_VALUE (arglist);
! arg1 = TREE_VALUE (TREE_CHAIN (arglist));
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
tmode = insn_data[icode].operand[0].mode;
--- 17632,17639 ----
case IX86_BUILTIN_PSRLDQI128:
icode = ( fcode == IX86_BUILTIN_PSLLDQI128 ? CODE_FOR_sse2_ashlti3
: CODE_FOR_sse2_lshrti3);
! arg0 = CALL_EXPR_ARG0 (exp);
! arg1 = CALL_EXPR_ARG1 (exp);
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
tmode = insn_data[icode].operand[0].mode;
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17664,17749 ****
return NULL_RTX;
case IX86_BUILTIN_PAVGUSB:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_uavgv8qi3, arglist, target);
case IX86_BUILTIN_PF2ID:
! return ix86_expand_unop_builtin (CODE_FOR_mmx_pf2id, arglist, target, 0);
case IX86_BUILTIN_PFACC:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_haddv2sf3, arglist, target);
case IX86_BUILTIN_PFADD:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_addv2sf3, arglist, target);
case IX86_BUILTIN_PFCMPEQ:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_eqv2sf3, arglist, target);
case IX86_BUILTIN_PFCMPGE:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_gev2sf3, arglist, target);
case IX86_BUILTIN_PFCMPGT:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_gtv2sf3, arglist, target);
case IX86_BUILTIN_PFMAX:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_smaxv2sf3, arglist, target);
case IX86_BUILTIN_PFMIN:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_sminv2sf3, arglist, target);
case IX86_BUILTIN_PFMUL:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_mulv2sf3, arglist, target);
case IX86_BUILTIN_PFRCP:
! return ix86_expand_unop_builtin (CODE_FOR_mmx_rcpv2sf2, arglist, target, 0);
case IX86_BUILTIN_PFRCPIT1:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_rcpit1v2sf3, arglist, target);
case IX86_BUILTIN_PFRCPIT2:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_rcpit2v2sf3, arglist, target);
case IX86_BUILTIN_PFRSQIT1:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_rsqit1v2sf3, arglist, target);
case IX86_BUILTIN_PFRSQRT:
! return ix86_expand_unop_builtin (CODE_FOR_mmx_rsqrtv2sf2, arglist, target, 0);
case IX86_BUILTIN_PFSUB:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_subv2sf3, arglist, target);
case IX86_BUILTIN_PFSUBR:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_subrv2sf3, arglist, target);
case IX86_BUILTIN_PI2FD:
! return ix86_expand_unop_builtin (CODE_FOR_mmx_floatv2si2, arglist, target, 0);
case IX86_BUILTIN_PMULHRW:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_pmulhrwv4hi3, arglist, target);
case IX86_BUILTIN_PF2IW:
! return ix86_expand_unop_builtin (CODE_FOR_mmx_pf2iw, arglist, target, 0);
case IX86_BUILTIN_PFNACC:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_hsubv2sf3, arglist, target);
case IX86_BUILTIN_PFPNACC:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_addsubv2sf3, arglist, target);
case IX86_BUILTIN_PI2FW:
! return ix86_expand_unop_builtin (CODE_FOR_mmx_pi2fw, arglist, target, 0);
case IX86_BUILTIN_PSWAPDSI:
! return ix86_expand_unop_builtin (CODE_FOR_mmx_pswapdv2si2, arglist, target, 0);
case IX86_BUILTIN_PSWAPDSF:
! return ix86_expand_unop_builtin (CODE_FOR_mmx_pswapdv2sf2, arglist, target, 0);
case IX86_BUILTIN_SQRTSD:
! return ix86_expand_unop1_builtin (CODE_FOR_sse2_vmsqrtv2df2, arglist, target);
case IX86_BUILTIN_LOADUPD:
! return ix86_expand_unop_builtin (CODE_FOR_sse2_movupd, arglist, target, 1);
case IX86_BUILTIN_STOREUPD:
! return ix86_expand_store_builtin (CODE_FOR_sse2_movupd, arglist);
case IX86_BUILTIN_MFENCE:
emit_insn (gen_sse2_mfence ());
--- 17662,17747 ----
return NULL_RTX;
case IX86_BUILTIN_PAVGUSB:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_uavgv8qi3, exp, target);
case IX86_BUILTIN_PF2ID:
! return ix86_expand_unop_builtin (CODE_FOR_mmx_pf2id, exp, target, 0);
case IX86_BUILTIN_PFACC:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_haddv2sf3, exp, target);
case IX86_BUILTIN_PFADD:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_addv2sf3, exp, target);
case IX86_BUILTIN_PFCMPEQ:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_eqv2sf3, exp, target);
case IX86_BUILTIN_PFCMPGE:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_gev2sf3, exp, target);
case IX86_BUILTIN_PFCMPGT:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_gtv2sf3, exp, target);
case IX86_BUILTIN_PFMAX:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_smaxv2sf3, exp, target);
case IX86_BUILTIN_PFMIN:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_sminv2sf3, exp, target);
case IX86_BUILTIN_PFMUL:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_mulv2sf3, exp, target);
case IX86_BUILTIN_PFRCP:
! return ix86_expand_unop_builtin (CODE_FOR_mmx_rcpv2sf2, exp, target, 0);
case IX86_BUILTIN_PFRCPIT1:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_rcpit1v2sf3, exp, target);
case IX86_BUILTIN_PFRCPIT2:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_rcpit2v2sf3, exp, target);
case IX86_BUILTIN_PFRSQIT1:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_rsqit1v2sf3, exp, target);
case IX86_BUILTIN_PFRSQRT:
! return ix86_expand_unop_builtin (CODE_FOR_mmx_rsqrtv2sf2, exp, target, 0);
case IX86_BUILTIN_PFSUB:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_subv2sf3, exp, target);
case IX86_BUILTIN_PFSUBR:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_subrv2sf3, exp, target);
case IX86_BUILTIN_PI2FD:
! return ix86_expand_unop_builtin (CODE_FOR_mmx_floatv2si2, exp, target, 0);
case IX86_BUILTIN_PMULHRW:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_pmulhrwv4hi3, exp, target);
case IX86_BUILTIN_PF2IW:
! return ix86_expand_unop_builtin (CODE_FOR_mmx_pf2iw, exp, target, 0);
case IX86_BUILTIN_PFNACC:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_hsubv2sf3, exp, target);
case IX86_BUILTIN_PFPNACC:
! return ix86_expand_binop_builtin (CODE_FOR_mmx_addsubv2sf3, exp, target);
case IX86_BUILTIN_PI2FW:
! return ix86_expand_unop_builtin (CODE_FOR_mmx_pi2fw, exp, target, 0);
case IX86_BUILTIN_PSWAPDSI:
! return ix86_expand_unop_builtin (CODE_FOR_mmx_pswapdv2si2, exp, target, 0);
case IX86_BUILTIN_PSWAPDSF:
! return ix86_expand_unop_builtin (CODE_FOR_mmx_pswapdv2sf2, exp, target, 0);
case IX86_BUILTIN_SQRTSD:
! return ix86_expand_unop1_builtin (CODE_FOR_sse2_vmsqrtv2df2, exp, target);
case IX86_BUILTIN_LOADUPD:
! return ix86_expand_unop_builtin (CODE_FOR_sse2_movupd, exp, target, 1);
case IX86_BUILTIN_STOREUPD:
! return ix86_expand_store_builtin (CODE_FOR_sse2_movupd, exp);
case IX86_BUILTIN_MFENCE:
emit_insn (gen_sse2_mfence ());
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17753,17759 ****
return 0;
case IX86_BUILTIN_CLFLUSH:
! arg0 = TREE_VALUE (arglist);
op0 = expand_normal (arg0);
icode = CODE_FOR_sse2_clflush;
if (! (*insn_data[icode].operand[0].predicate) (op0, Pmode))
--- 17751,17757 ----
return 0;
case IX86_BUILTIN_CLFLUSH:
! arg0 = CALL_EXPR_ARG0 (exp);
op0 = expand_normal (arg0);
icode = CODE_FOR_sse2_clflush;
if (! (*insn_data[icode].operand[0].predicate) (op0, Pmode))
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17763,17783 ****
return 0;
case IX86_BUILTIN_MOVNTPD:
! return ix86_expand_store_builtin (CODE_FOR_sse2_movntv2df, arglist);
case IX86_BUILTIN_MOVNTDQ:
! return ix86_expand_store_builtin (CODE_FOR_sse2_movntv2di, arglist);
case IX86_BUILTIN_MOVNTI:
! return ix86_expand_store_builtin (CODE_FOR_sse2_movntsi, arglist);
case IX86_BUILTIN_LOADDQU:
! return ix86_expand_unop_builtin (CODE_FOR_sse2_movdqu, arglist, target, 1);
case IX86_BUILTIN_STOREDQU:
! return ix86_expand_store_builtin (CODE_FOR_sse2_movdqu, arglist);
case IX86_BUILTIN_MONITOR:
! 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);
--- 17761,17781 ----
return 0;
case IX86_BUILTIN_MOVNTPD:
! return ix86_expand_store_builtin (CODE_FOR_sse2_movntv2df, exp);
case IX86_BUILTIN_MOVNTDQ:
! return ix86_expand_store_builtin (CODE_FOR_sse2_movntv2di, exp);
case IX86_BUILTIN_MOVNTI:
! return ix86_expand_store_builtin (CODE_FOR_sse2_movntsi, exp);
case IX86_BUILTIN_LOADDQU:
! return ix86_expand_unop_builtin (CODE_FOR_sse2_movdqu, exp, target, 1);
case IX86_BUILTIN_STOREDQU:
! return ix86_expand_store_builtin (CODE_FOR_sse2_movdqu, exp);
case IX86_BUILTIN_MONITOR:
! 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);
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17794,17801 ****
return 0;
case IX86_BUILTIN_MWAIT:
! arg0 = TREE_VALUE (arglist);
! arg1 = TREE_VALUE (TREE_CHAIN (arglist));
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
if (!REG_P (op0))
--- 17792,17799 ----
return 0;
case IX86_BUILTIN_MWAIT:
! arg0 = CALL_EXPR_ARG0 (exp);
! arg1 = CALL_EXPR_ARG1 (exp);
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
if (!REG_P (op0))
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17806,17812 ****
return 0;
case IX86_BUILTIN_LDDQU:
! return ix86_expand_unop_builtin (CODE_FOR_sse3_lddqu, arglist,
target, 1);
case IX86_BUILTIN_PALIGNR:
--- 17804,17810 ----
return 0;
case IX86_BUILTIN_LDDQU:
! return ix86_expand_unop_builtin (CODE_FOR_sse3_lddqu, exp,
target, 1);
case IX86_BUILTIN_PALIGNR:
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17821,17829 ****
icode = CODE_FOR_ssse3_palignrti;
mode = V2DImode;
}
! arg0 = TREE_VALUE (arglist);
! arg1 = TREE_VALUE (TREE_CHAIN (arglist));
! arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
--- 17819,17827 ----
icode = CODE_FOR_ssse3_palignrti;
mode = V2DImode;
}
! arg0 = CALL_EXPR_ARG0 (exp);
! arg1 = CALL_EXPR_ARG1 (exp);
! arg2 = CALL_EXPR_ARG2 (exp);
op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17856,17873 ****
return target;
case IX86_BUILTIN_MOVNTSD:
! return ix86_expand_store_builtin (CODE_FOR_sse4a_vmmovntv2df, arglist);
case IX86_BUILTIN_MOVNTSS:
! return ix86_expand_store_builtin (CODE_FOR_sse4a_vmmovntv4sf, arglist);
case IX86_BUILTIN_INSERTQ:
case IX86_BUILTIN_EXTRQ:
icode = (fcode == IX86_BUILTIN_EXTRQ
? CODE_FOR_sse4a_extrq
: CODE_FOR_sse4a_insertq);
! arg0 = TREE_VALUE (arglist);
! arg1 = TREE_VALUE (TREE_CHAIN (arglist));
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
tmode = insn_data[icode].operand[0].mode;
--- 17854,17871 ----
return target;
case IX86_BUILTIN_MOVNTSD:
! return ix86_expand_store_builtin (CODE_FOR_sse4a_vmmovntv2df, exp);
case IX86_BUILTIN_MOVNTSS:
! return ix86_expand_store_builtin (CODE_FOR_sse4a_vmmovntv4sf, exp);
case IX86_BUILTIN_INSERTQ:
case IX86_BUILTIN_EXTRQ:
icode = (fcode == IX86_BUILTIN_EXTRQ
? CODE_FOR_sse4a_extrq
: CODE_FOR_sse4a_insertq);
! arg0 = CALL_EXPR_ARG0 (exp);
! arg1 = CALL_EXPR_ARG1 (exp);
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
tmode = insn_data[icode].operand[0].mode;
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17889,17897 ****
case IX86_BUILTIN_EXTRQI:
icode = CODE_FOR_sse4a_extrqi;
! 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);
--- 17887,17895 ----
case IX86_BUILTIN_EXTRQI:
icode = CODE_FOR_sse4a_extrqi;
! 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);
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17923,17932 ****
case IX86_BUILTIN_INSERTQI:
icode = CODE_FOR_sse4a_insertqi;
! arg0 = TREE_VALUE (arglist);
! arg1 = TREE_VALUE (TREE_CHAIN (arglist));
! arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
! arg3 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (arglist))));
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
op2 = expand_normal (arg2);
--- 17921,17930 ----
case IX86_BUILTIN_INSERTQI:
icode = CODE_FOR_sse4a_insertqi;
! arg0 = CALL_EXPR_ARG0 (exp);
! arg1 = CALL_EXPR_ARG1 (exp);
! arg2 = CALL_EXPR_ARG2 (exp);
! arg3 = CALL_EXPR_ARG (exp, 3);
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
op2 = expand_normal (arg2);
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17966,17972 ****
case IX86_BUILTIN_VEC_INIT_V2SI:
case IX86_BUILTIN_VEC_INIT_V4HI:
case IX86_BUILTIN_VEC_INIT_V8QI:
! return ix86_expand_vec_init_builtin (TREE_TYPE (exp), arglist, target);
case IX86_BUILTIN_VEC_EXT_V2DF:
case IX86_BUILTIN_VEC_EXT_V2DI:
--- 17964,17970 ----
case IX86_BUILTIN_VEC_INIT_V2SI:
case IX86_BUILTIN_VEC_INIT_V4HI:
case IX86_BUILTIN_VEC_INIT_V8QI:
! return ix86_expand_vec_init_builtin (TREE_TYPE (exp), exp, target);
case IX86_BUILTIN_VEC_EXT_V2DF:
case IX86_BUILTIN_VEC_EXT_V2DI:
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17975,17985 ****
case IX86_BUILTIN_VEC_EXT_V8HI:
case IX86_BUILTIN_VEC_EXT_V2SI:
case IX86_BUILTIN_VEC_EXT_V4HI:
! return ix86_expand_vec_ext_builtin (arglist, target);
case IX86_BUILTIN_VEC_SET_V8HI:
case IX86_BUILTIN_VEC_SET_V4HI:
! return ix86_expand_vec_set_builtin (arglist);
default:
break;
--- 17973,17983 ----
case IX86_BUILTIN_VEC_EXT_V8HI:
case IX86_BUILTIN_VEC_EXT_V2SI:
case IX86_BUILTIN_VEC_EXT_V4HI:
! return ix86_expand_vec_ext_builtin (exp, target);
case IX86_BUILTIN_VEC_SET_V8HI:
case IX86_BUILTIN_VEC_SET_V4HI:
! return ix86_expand_vec_set_builtin (exp);
default:
break;
*************** ix86_expand_builtin (tree exp, rtx targe
*** 17993,18010 ****
|| d->icode == CODE_FOR_sse_vmmaskcmpv4sf3
|| d->icode == CODE_FOR_sse2_maskcmpv2df3
|| d->icode == CODE_FOR_sse2_vmmaskcmpv2df3)
! return ix86_expand_sse_compare (d, arglist, target);
! return ix86_expand_binop_builtin (d->icode, arglist, target);
}
for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
if (d->code == fcode)
! return ix86_expand_unop_builtin (d->icode, arglist, target, 0);
for (i = 0, d = bdesc_comi; i < ARRAY_SIZE (bdesc_comi); i++, d++)
if (d->code == fcode)
! return ix86_expand_sse_comi (d, arglist, target);
gcc_unreachable ();
}
--- 17991,18008 ----
|| d->icode == CODE_FOR_sse_vmmaskcmpv4sf3
|| d->icode == CODE_FOR_sse2_maskcmpv2df3
|| d->icode == CODE_FOR_sse2_vmmaskcmpv2df3)
! return ix86_expand_sse_compare (d, exp, target);
! return ix86_expand_binop_builtin (d->icode, exp, target);
}
for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
if (d->code == fcode)
! return ix86_expand_unop_builtin (d->icode, exp, target, 0);
for (i = 0, d = bdesc_comi; i < ARRAY_SIZE (bdesc_comi); i++, d++)
if (d->code == fcode)
! return ix86_expand_sse_comi (d, exp, target);
gcc_unreachable ();
}
Index: gcc/config/sh/sh.c
===================================================================
*** gcc/config/sh/sh.c (revision 121705)
--- gcc/config/sh/sh.c (working copy)
*************** static rtx
*** 9904,9911 ****
sh_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED, int ignore)
{
! tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
! tree arglist = TREE_OPERAND (exp, 1);
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
const struct builtin_description *d = &bdesc[fcode];
enum insn_code icode = d->icode;
--- 9904,9910 ----
sh_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED, int ignore)
{
! tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
const struct builtin_description *d = &bdesc[fcode];
enum insn_code icode = d->icode;
*************** sh_expand_builtin (tree exp, rtx target,
*** 9938,9947 ****
if (! signature_args[signature][i])
break;
! arg = TREE_VALUE (arglist);
if (arg == error_mark_node)
return const0_rtx;
- arglist = TREE_CHAIN (arglist);
if (signature_args[signature][i] & 8)
{
opmode = ptr_mode;
--- 9937,9945 ----
if (! signature_args[signature][i])
break;
! arg = CALL_EXPR_ARG (exp, i-1);
if (arg == error_mark_node)
return const0_rtx;
if (signature_args[signature][i] & 8)
{
opmode = ptr_mode;
Index: gcc/config/c4x/c4x.c
===================================================================
*** gcc/config/c4x/c4x.c (revision 121705)
--- gcc/config/c4x/c4x.c (working copy)
*************** c4x_expand_builtin (tree exp, rtx target
*** 4395,4410 ****
enum machine_mode mode ATTRIBUTE_UNUSED,
int ignore ATTRIBUTE_UNUSED)
{
! tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
- tree arglist = TREE_OPERAND (exp, 1);
tree arg0, arg1;
rtx r0, r1;
switch (fcode)
{
case C4X_BUILTIN_FIX:
! arg0 = TREE_VALUE (arglist);
r0 = expand_expr (arg0, NULL_RTX, QFmode, 0);
if (! target || ! register_operand (target, QImode))
target = gen_reg_rtx (QImode);
--- 4395,4409 ----
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);
tree arg0, arg1;
rtx r0, r1;
switch (fcode)
{
case C4X_BUILTIN_FIX:
! arg0 = CALL_EXPR_ARG0 (exp);
r0 = expand_expr (arg0, NULL_RTX, QFmode, 0);
if (! target || ! register_operand (target, QImode))
target = gen_reg_rtx (QImode);
*************** c4x_expand_builtin (tree exp, rtx target
*** 4412,4418 ****
return target;
case C4X_BUILTIN_FIX_ANSI:
! arg0 = TREE_VALUE (arglist);
r0 = expand_expr (arg0, NULL_RTX, QFmode, 0);
if (! target || ! register_operand (target, QImode))
target = gen_reg_rtx (QImode);
--- 4411,4417 ----
return target;
case C4X_BUILTIN_FIX_ANSI:
! arg0 = CALL_EXPR_ARG0 (exp);
r0 = expand_expr (arg0, NULL_RTX, QFmode, 0);
if (! target || ! register_operand (target, QImode))
target = gen_reg_rtx (QImode);
*************** c4x_expand_builtin (tree exp, rtx target
*** 4422,4429 ****
case C4X_BUILTIN_MPYI:
if (! TARGET_C3X)
break;
! arg0 = TREE_VALUE (arglist);
! arg1 = TREE_VALUE (TREE_CHAIN (arglist));
r0 = expand_expr (arg0, NULL_RTX, QImode, 0);
r1 = expand_expr (arg1, NULL_RTX, QImode, 0);
if (! target || ! register_operand (target, QImode))
--- 4421,4428 ----
case C4X_BUILTIN_MPYI:
if (! TARGET_C3X)
break;
! arg0 = CALL_EXPR_ARG0 (exp);
! arg1 = CALL_EXPR_ARG1 (exp);
r0 = expand_expr (arg0, NULL_RTX, QImode, 0);
r1 = expand_expr (arg1, NULL_RTX, QImode, 0);
if (! target || ! register_operand (target, QImode))
*************** c4x_expand_builtin (tree exp, rtx target
*** 4434,4440 ****
case C4X_BUILTIN_TOIEEE:
if (TARGET_C3X)
break;
! arg0 = TREE_VALUE (arglist);
r0 = expand_expr (arg0, NULL_RTX, QFmode, 0);
if (! target || ! register_operand (target, QFmode))
target = gen_reg_rtx (QFmode);
--- 4433,4439 ----
case C4X_BUILTIN_TOIEEE:
if (TARGET_C3X)
break;
! arg0 = CALL_EXPR_ARG0 (exp);
r0 = expand_expr (arg0, NULL_RTX, QFmode, 0);
if (! target || ! register_operand (target, QFmode))
target = gen_reg_rtx (QFmode);
*************** c4x_expand_builtin (tree exp, rtx target
*** 4444,4450 ****
case C4X_BUILTIN_FRIEEE:
if (TARGET_C3X)
break;
! arg0 = TREE_VALUE (arglist);
r0 = expand_expr (arg0, NULL_RTX, QFmode, 0);
if (register_operand (r0, QFmode))
{
--- 4443,4449 ----
case C4X_BUILTIN_FRIEEE:
if (TARGET_C3X)
break;
! arg0 = CALL_EXPR_ARG0 (exp);
r0 = expand_expr (arg0, NULL_RTX, QFmode, 0);
if (register_operand (r0, QFmode))
{
*************** c4x_expand_builtin (tree exp, rtx target
*** 4460,4466 ****
case C4X_BUILTIN_RCPF:
if (TARGET_C3X)
break;
! arg0 = TREE_VALUE (arglist);
r0 = expand_expr (arg0, NULL_RTX, QFmode, 0);
if (! target || ! register_operand (target, QFmode))
target = gen_reg_rtx (QFmode);
--- 4459,4465 ----
case C4X_BUILTIN_RCPF:
if (TARGET_C3X)
break;
! arg0 = CALL_EXPR_ARG0 (exp);
r0 = expand_expr (arg0, NULL_RTX, QFmode, 0);
if (! target || ! register_operand (target, QFmode))
target = gen_reg_rtx (QFmode);
Index: gcc/config/iq2000/iq2000.c
===================================================================
*** gcc/config/iq2000/iq2000.c (revision 121705)
--- gcc/config/iq2000/iq2000.c (working copy)
*************** void_ftype_int_int_int
*** 2569,2579 ****
def_builtin ("__builtin_syscall", void_ftype, IQ2000_BUILTIN_SYSCALL);
}
! /* Builtin for ICODE having ARGCOUNT args in ARGLIST where each arg
has an rtx CODE. */
static rtx
! expand_one_builtin (enum insn_code icode, rtx target, tree arglist,
enum rtx_code *code, int argcount)
{
rtx pat;
--- 2569,2579 ----
def_builtin ("__builtin_syscall", void_ftype, IQ2000_BUILTIN_SYSCALL);
}
! /* Builtin for ICODE having ARGCOUNT args in EXP where each arg
has an rtx CODE. */
static rtx
! expand_one_builtin (enum insn_code icode, rtx target, tree exp,
enum rtx_code *code, int argcount)
{
rtx pat;
*************** expand_one_builtin (enum insn_code icode
*** 2585,2592 ****
mode[0] = insn_data[icode].operand[0].mode;
for (i = 0; i < argcount; i++)
{
! arg[i] = TREE_VALUE (arglist);
! arglist = TREE_CHAIN (arglist);
op[i] = expand_expr (arg[i], NULL_RTX, VOIDmode, 0);
mode[i] = insn_data[icode].operand[i].mode;
if (code[i] == CONST_INT && GET_CODE (op[i]) != CONST_INT)
--- 2585,2591 ----
mode[0] = insn_data[icode].operand[0].mode;
for (i = 0; i < argcount; i++)
{
! arg[i] = CALL_EXPR_ARG (exp, i);
op[i] = expand_expr (arg[i], NULL_RTX, VOIDmode, 0);
mode[i] = insn_data[icode].operand[i].mode;
if (code[i] == CONST_INT && GET_CODE (op[i]) != CONST_INT)
*************** iq2000_expand_builtin (tree exp, rtx tar
*** 2655,2662 ****
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);
int fcode = DECL_FUNCTION_CODE (fndecl);
enum rtx_code code [5];
--- 2654,2660 ----
enum machine_mode mode ATTRIBUTE_UNUSED,
int ignore ATTRIBUTE_UNUSED)
{
! tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
int fcode = DECL_FUNCTION_CODE (fndecl);
enum rtx_code code [5];
*************** iq2000_expand_builtin (tree exp, rtx tar
*** 2671,2832 ****
break;
case IQ2000_BUILTIN_ADO16:
! return expand_one_builtin (CODE_FOR_ado16, target, arglist, code, 2);
case IQ2000_BUILTIN_RAM:
code[1] = CONST_INT;
code[2] = CONST_INT;
code[3] = CONST_INT;
! return expand_one_builtin (CODE_FOR_ram, target, arglist, code, 4);
case IQ2000_BUILTIN_CHKHDR:
! return expand_one_builtin (CODE_FOR_chkhdr, target, arglist, code, 2);
case IQ2000_BUILTIN_PKRL:
! return expand_one_builtin (CODE_FOR_pkrl, target, arglist, code, 2);
case IQ2000_BUILTIN_CFC0:
code[0] = CONST_INT;
! return expand_one_builtin (CODE_FOR_cfc0, target, arglist, code, 1);
case IQ2000_BUILTIN_CFC1:
code[0] = CONST_INT;
! return expand_one_builtin (CODE_FOR_cfc1, target, arglist, code, 1);
case IQ2000_BUILTIN_CFC2:
code[0] = CONST_INT;
! return expand_one_builtin (CODE_FOR_cfc2, target, arglist, code, 1);
case IQ2000_BUILTIN_CFC3:
code[0] = CONST_INT;
! return expand_one_builtin (CODE_FOR_cfc3, target, arglist, code, 1);
case IQ2000_BUILTIN_CTC0:
code[1] = CONST_INT;
! return expand_one_builtin (CODE_FOR_ctc0, target, arglist, code, 2);
case IQ2000_BUILTIN_CTC1:
code[1] = CONST_INT;
! return expand_one_builtin (CODE_FOR_ctc1, target, arglist, code, 2);
case IQ2000_BUILTIN_CTC2:
code[1] = CONST_INT;
! return expand_one_builtin (CODE_FOR_ctc2, target, arglist, code, 2);
case IQ2000_BUILTIN_CTC3:
code[1] = CONST_INT;
! return expand_one_builtin (CODE_FOR_ctc3, target, arglist, code, 2);
case IQ2000_BUILTIN_MFC0:
code[0] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mfc0, target, arglist, code, 1);
case IQ2000_BUILTIN_MFC1:
code[0] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mfc1, target, arglist, code, 1);
case IQ2000_BUILTIN_MFC2:
code[0] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mfc2, target, arglist, code, 1);
case IQ2000_BUILTIN_MFC3:
code[0] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mfc3, target, arglist, code, 1);
case IQ2000_BUILTIN_MTC0:
code[1] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mtc0, target, arglist, code, 2);
case IQ2000_BUILTIN_MTC1:
code[1] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mtc1, target, arglist, code, 2);
case IQ2000_BUILTIN_MTC2:
code[1] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mtc2, target, arglist, code, 2);
case IQ2000_BUILTIN_MTC3:
code[1] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mtc3, target, arglist, code, 2);
case IQ2000_BUILTIN_LUR:
! return expand_one_builtin (CODE_FOR_lur, target, arglist, code, 2);
case IQ2000_BUILTIN_RB:
! return expand_one_builtin (CODE_FOR_rb, target, arglist, code, 2);
case IQ2000_BUILTIN_RX:
! return expand_one_builtin (CODE_FOR_rx, target, arglist, code, 2);
case IQ2000_BUILTIN_SRRD:
! return expand_one_builtin (CODE_FOR_srrd, target, arglist, code, 1);
case IQ2000_BUILTIN_SRWR:
! return expand_one_builtin (CODE_FOR_srwr, target, arglist, code, 2);
case IQ2000_BUILTIN_WB:
! return expand_one_builtin (CODE_FOR_wb, target, arglist, code, 2);
case IQ2000_BUILTIN_WX:
! return expand_one_builtin (CODE_FOR_wx, target, arglist, code, 2);
case IQ2000_BUILTIN_LUC32L:
! return expand_one_builtin (CODE_FOR_luc32l, target, arglist, code, 2);
case IQ2000_BUILTIN_LUC64:
! return expand_one_builtin (CODE_FOR_luc64, target, arglist, code, 2);
case IQ2000_BUILTIN_LUC64L:
! return expand_one_builtin (CODE_FOR_luc64l, target, arglist, code, 2);
case IQ2000_BUILTIN_LUK:
! return expand_one_builtin (CODE_FOR_luk, target, arglist, code, 2);
case IQ2000_BUILTIN_LULCK:
! return expand_one_builtin (CODE_FOR_lulck, target, arglist, code, 1);
case IQ2000_BUILTIN_LUM32:
! return expand_one_builtin (CODE_FOR_lum32, target, arglist, code, 2);
case IQ2000_BUILTIN_LUM32L:
! return expand_one_builtin (CODE_FOR_lum32l, target, arglist, code, 2);
case IQ2000_BUILTIN_LUM64:
! return expand_one_builtin (CODE_FOR_lum64, target, arglist, code, 2);
case IQ2000_BUILTIN_LUM64L:
! return expand_one_builtin (CODE_FOR_lum64l, target, arglist, code, 2);
case IQ2000_BUILTIN_LURL:
! return expand_one_builtin (CODE_FOR_lurl, target, arglist, code, 2);
case IQ2000_BUILTIN_MRGB:
code[2] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mrgb, target, arglist, code, 3);
case IQ2000_BUILTIN_SRRDL:
! return expand_one_builtin (CODE_FOR_srrdl, target, arglist, code, 1);
case IQ2000_BUILTIN_SRULCK:
! return expand_one_builtin (CODE_FOR_srulck, target, arglist, code, 1);
case IQ2000_BUILTIN_SRWRU:
! return expand_one_builtin (CODE_FOR_srwru, target, arglist, code, 2);
case IQ2000_BUILTIN_TRAPQFL:
! return expand_one_builtin (CODE_FOR_trapqfl, target, arglist, code, 0);
case IQ2000_BUILTIN_TRAPQNE:
! return expand_one_builtin (CODE_FOR_trapqne, target, arglist, code, 0);
case IQ2000_BUILTIN_TRAPREL:
! return expand_one_builtin (CODE_FOR_traprel, target, arglist, code, 1);
case IQ2000_BUILTIN_WBU:
! return expand_one_builtin (CODE_FOR_wbu, target, arglist, code, 3);
case IQ2000_BUILTIN_SYSCALL:
! return expand_one_builtin (CODE_FOR_syscall, target, arglist, code, 0);
}
return NULL_RTX;
--- 2669,2830 ----
break;
case IQ2000_BUILTIN_ADO16:
! return expand_one_builtin (CODE_FOR_ado16, target, exp, code, 2);
case IQ2000_BUILTIN_RAM:
code[1] = CONST_INT;
code[2] = CONST_INT;
code[3] = CONST_INT;
! return expand_one_builtin (CODE_FOR_ram, target, exp, code, 4);
case IQ2000_BUILTIN_CHKHDR:
! return expand_one_builtin (CODE_FOR_chkhdr, target, exp, code, 2);
case IQ2000_BUILTIN_PKRL:
! return expand_one_builtin (CODE_FOR_pkrl, target, exp, code, 2);
case IQ2000_BUILTIN_CFC0:
code[0] = CONST_INT;
! return expand_one_builtin (CODE_FOR_cfc0, target, exp, code, 1);
case IQ2000_BUILTIN_CFC1:
code[0] = CONST_INT;
! return expand_one_builtin (CODE_FOR_cfc1, target, exp, code, 1);
case IQ2000_BUILTIN_CFC2:
code[0] = CONST_INT;
! return expand_one_builtin (CODE_FOR_cfc2, target, exp, code, 1);
case IQ2000_BUILTIN_CFC3:
code[0] = CONST_INT;
! return expand_one_builtin (CODE_FOR_cfc3, target, exp, code, 1);
case IQ2000_BUILTIN_CTC0:
code[1] = CONST_INT;
! return expand_one_builtin (CODE_FOR_ctc0, target, exp, code, 2);
case IQ2000_BUILTIN_CTC1:
code[1] = CONST_INT;
! return expand_one_builtin (CODE_FOR_ctc1, target, exp, code, 2);
case IQ2000_BUILTIN_CTC2:
code[1] = CONST_INT;
! return expand_one_builtin (CODE_FOR_ctc2, target, exp, code, 2);
case IQ2000_BUILTIN_CTC3:
code[1] = CONST_INT;
! return expand_one_builtin (CODE_FOR_ctc3, target, exp, code, 2);
case IQ2000_BUILTIN_MFC0:
code[0] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mfc0, target, exp, code, 1);
case IQ2000_BUILTIN_MFC1:
code[0] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mfc1, target, exp, code, 1);
case IQ2000_BUILTIN_MFC2:
code[0] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mfc2, target, exp, code, 1);
case IQ2000_BUILTIN_MFC3:
code[0] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mfc3, target, exp, code, 1);
case IQ2000_BUILTIN_MTC0:
code[1] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mtc0, target, exp, code, 2);
case IQ2000_BUILTIN_MTC1:
code[1] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mtc1, target, exp, code, 2);
case IQ2000_BUILTIN_MTC2:
code[1] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mtc2, target, exp, code, 2);
case IQ2000_BUILTIN_MTC3:
code[1] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mtc3, target, exp, code, 2);
case IQ2000_BUILTIN_LUR:
! return expand_one_builtin (CODE_FOR_lur, target, exp, code, 2);
case IQ2000_BUILTIN_RB:
! return expand_one_builtin (CODE_FOR_rb, target, exp, code, 2);
case IQ2000_BUILTIN_RX:
! return expand_one_builtin (CODE_FOR_rx, target, exp, code, 2);
case IQ2000_BUILTIN_SRRD:
! return expand_one_builtin (CODE_FOR_srrd, target, exp, code, 1);
case IQ2000_BUILTIN_SRWR:
! return expand_one_builtin (CODE_FOR_srwr, target, exp, code, 2);
case IQ2000_BUILTIN_WB:
! return expand_one_builtin (CODE_FOR_wb, target, exp, code, 2);
case IQ2000_BUILTIN_WX:
! return expand_one_builtin (CODE_FOR_wx, target, exp, code, 2);
case IQ2000_BUILTIN_LUC32L:
! return expand_one_builtin (CODE_FOR_luc32l, target, exp, code, 2);
case IQ2000_BUILTIN_LUC64:
! return expand_one_builtin (CODE_FOR_luc64, target, exp, code, 2);
case IQ2000_BUILTIN_LUC64L:
! return expand_one_builtin (CODE_FOR_luc64l, target, exp, code, 2);
case IQ2000_BUILTIN_LUK:
! return expand_one_builtin (CODE_FOR_luk, target, exp, code, 2);
case IQ2000_BUILTIN_LULCK:
! return expand_one_builtin (CODE_FOR_lulck, target, exp, code, 1);
case IQ2000_BUILTIN_LUM32:
! return expand_one_builtin (CODE_FOR_lum32, target, exp, code, 2);
case IQ2000_BUILTIN_LUM32L:
! return expand_one_builtin (CODE_FOR_lum32l, target, exp, code, 2);
case IQ2000_BUILTIN_LUM64:
! return expand_one_builtin (CODE_FOR_lum64, target, exp, code, 2);
case IQ2000_BUILTIN_LUM64L:
! return expand_one_builtin (CODE_FOR_lum64l, target, exp, code, 2);
case IQ2000_BUILTIN_LURL:
! return expand_one_builtin (CODE_FOR_lurl, target, exp, code, 2);
case IQ2000_BUILTIN_MRGB:
code[2] = CONST_INT;
! return expand_one_builtin (CODE_FOR_mrgb, target, exp, code, 3);
case IQ2000_BUILTIN_SRRDL:
! return expand_one_builtin (CODE_FOR_srrdl, target, exp, code, 1);
case IQ2000_BUILTIN_SRULCK:
! return expand_one_builtin (CODE_FOR_srulck, target, exp, code, 1);
case IQ2000_BUILTIN_SRWRU:
! return expand_one_builtin (CODE_FOR_srwru, target, exp, code, 2);
case IQ2000_BUILTIN_TRAPQFL:
! return expand_one_builtin (CODE_FOR_trapqfl, target, exp, code, 0);
case IQ2000_BUILTIN_TRAPQNE:
! return expand_one_builtin (CODE_FOR_trapqne, target, exp, code, 0);
case IQ2000_BUILTIN_TRAPREL:
! return expand_one_builtin (CODE_FOR_traprel, target, exp, code, 1);
case IQ2000_BUILTIN_WBU:
! return expand_one_builtin (CODE_FOR_wbu, target, exp, code, 3);
case IQ2000_BUILTIN_SYSCALL:
! return expand_one_builtin (CODE_FOR_syscall, target, exp, code, 0);
}
return NULL_RTX;
Index: gcc/config/rs6000/rs6000-c.c
===================================================================
*** gcc/config/rs6000/rs6000-c.c (revision 121705)
--- gcc/config/rs6000/rs6000-c.c (working copy)
*************** altivec_build_resolved_builtin (tree *ar
*** 2436,2442 ****
tree impl_fndecl = rs6000_builtin_decls[desc->overloaded_code];
tree ret_type = rs6000_builtin_type (desc->ret_type);
tree argtypes = TYPE_ARG_TYPES (TREE_TYPE (impl_fndecl));
! tree arglist = NULL_TREE, arg_type[3];
int i;
for (i = 0; i < n; i++)
--- 2436,2443 ----
tree impl_fndecl = rs6000_builtin_decls[desc->overloaded_code];
tree ret_type = rs6000_builtin_type (desc->ret_type);
tree argtypes = TYPE_ARG_TYPES (TREE_TYPE (impl_fndecl));
! tree arg_type[3];
! tree call;
int i;
for (i = 0; i < n; i++)
*************** altivec_build_resolved_builtin (tree *ar
*** 2463,2475 ****
build_int_cst (NULL_TREE, 2));
}
! while (--n >= 0)
! arglist = tree_cons (NULL_TREE,
! fold_convert (arg_type[n], args[n]),
! arglist);
!
! return fold_convert (ret_type,
! build_function_call_expr (impl_fndecl, arglist));
}
/* Implementation of the resolve_overloaded_builtin target hook, to
--- 2464,2493 ----
build_int_cst (NULL_TREE, 2));
}
! switch (n)
! {
! case 0:
! call = build_call_expr (impl_fndecl, 0);
! break;
! case 1:
! call = build_call_expr (impl_fndecl, 1,
! fold_convert (arg_type[0], args[0]));
! break;
! case 2:
! call = build_call_expr (impl_fndecl, 2,
! fold_convert (arg_type[0], args[0]),
! fold_convert (arg_type[1], args[1]));
! break;
! case 3:
! call = build_call_expr (impl_fndecl, 3,
! fold_convert (arg_type[0], args[0]),
! fold_convert (arg_type[1], args[1]),
! fold_convert (arg_type[2], args[2]));
! break;
! default:
! gcc_unreachable ();
! }
! return fold_convert (ret_type, call);
}
/* Implementation of the resolve_overloaded_builtin target hook, to
Index: gcc/config/rs6000/rs6000.c
===================================================================
*** gcc/config/rs6000/rs6000.c (revision 121705)
--- gcc/config/rs6000/rs6000.c (working copy)
*************** rs6000_gimplify_va_arg (tree valist, tre
*** 6267,6278 ****
tree tmp = create_tmp_var (type, "va_arg_tmp");
tree dest_addr = build_fold_addr_expr (tmp);
! tree copy = build_function_call_expr
! (implicit_built_in_decls[BUILT_IN_MEMCPY],
! tree_cons (NULL_TREE, dest_addr,
! tree_cons (NULL_TREE, addr,
! tree_cons (NULL_TREE, size_int (rsize * 4),
! NULL_TREE))));
gimplify_and_add (copy, pre_p);
addr = dest_addr;
--- 6267,6274 ----
tree tmp = create_tmp_var (type, "va_arg_tmp");
tree dest_addr = build_fold_addr_expr (tmp);
! tree copy = build_call_expr (implicit_built_in_decls[BUILT_IN_MEMCPY],
! 3, dest_addr, addr, size_int (rsize * 4));
gimplify_and_add (copy, pre_p);
addr = dest_addr;
*************** static struct builtin_description bdesc_
*** 6907,6916 ****
};
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;
--- 6903,6912 ----
};
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
*** 6956,6965 ****
}
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;
--- 6952,6961 ----
}
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
*** 6988,6998 ****
}
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;
--- 6984,6994 ----
}
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
*** 7062,7073 ****
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;
--- 7058,7069 ----
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
*** 7138,7148 ****
}
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;
--- 7134,7144 ----
}
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
*** 7184,7194 ****
}
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);
--- 7180,7190 ----
}
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
*** 7217,7227 ****
}
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);
--- 7213,7223 ----
}
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
*** 7258,7269 ****
}
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);
--- 7254,7265 ----
}
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_
*** 7321,7328 ****
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;
--- 7317,7323 ----
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
*** 7350,7356 ****
*expandedp = true;
! arg0 = TREE_VALUE (arglist);
op0 = expand_normal (arg0);
tmode = insn_data[icode].operand[0].mode;
mode0 = insn_data[icode].operand[1].mode;
--- 7345,7351 ----
*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
*** 7375,7382 ****
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;
--- 7370,7376 ----
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
*** 7402,7409 ****
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;
--- 7396,7403 ----
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
*** 7427,7434 ****
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;
--- 7421,7427 ----
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
*** 7443,7451 ****
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);
--- 7436,7444 ----
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
*** 7485,7491 ****
/* 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);
--- 7478,7484 ----
/* 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
*** 7493,7507 ****
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);
--- 7486,7499 ----
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
*** 7529,7544 ****
/* 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)));
--- 7521,7536 ----
/* 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
*** 7561,7575 ****
/* 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);
--- 7553,7567 ----
/* 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
*** 7597,7604 ****
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;
--- 7589,7595 ----
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
*** 7629,7643 ****
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;
--- 7620,7634 ----
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
*** 7656,7662 ****
case ALTIVEC_BUILTIN_MTVSCR:
icode = CODE_FOR_altivec_mtvscr;
! arg0 = TREE_VALUE (arglist);
op0 = expand_normal (arg0);
mode0 = insn_data[icode].operand[0].mode;
--- 7647,7653 ----
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
*** 7678,7684 ****
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;
--- 7669,7675 ----
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
*** 7704,7722 ****
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;
--- 7695,7713 ----
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
*** 7727,7765 ****
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. */
--- 7718,7756 ----
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_
*** 7805,7812 ****
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;
--- 7796,7802 ----
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
*** 7827,7833 ****
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)
{
--- 7817,7823 ----
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
*** 7844,7853 ****
{
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;
}
--- 7834,7843 ----
{
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
*** 7855,7902 ****
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;
--- 7845,7892 ----
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
*** 7913,7919 ****
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;
--- 7903,7909 ----
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
*** 7936,7947 ****
}
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;
--- 7926,7937 ----
}
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_
*** 8044,8056 ****
*/
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);
--- 8034,8046 ----
*/
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
*** 8104,8111 ****
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;
--- 8094,8100 ----
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
*** 8123,8129 ****
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);
--- 8112,8118 ----
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
*** 8173,8191 ****
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 ();
}
--- 8162,8180 ----
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: gcc/config/arm/arm.c
===================================================================
*** gcc/config/arm/arm.c (revision 121705)
--- gcc/config/arm/arm.c (working copy)
*************** safe_vector_operand (rtx x, enum machine
*** 13341,13351 ****
static rtx
arm_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;
--- 13341,13351 ----
static rtx
arm_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;
*************** arm_expand_binop_builtin (enum insn_code
*** 13380,13389 ****
static rtx
arm_expand_unop_builtin (enum insn_code icode,
! tree arglist, rtx target, int do_load)
{
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;
--- 13380,13389 ----
static rtx
arm_expand_unop_builtin (enum insn_code icode,
! tree exp, rtx target, int do_load)
{
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;
*************** arm_expand_builtin (tree exp,
*** 13425,13432 ****
{
const struct builtin_description * d;
enum insn_code icode;
! tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
! tree arglist = TREE_OPERAND (exp, 1);
tree arg0;
tree arg1;
tree arg2;
--- 13425,13431 ----
{
const struct builtin_description * d;
enum insn_code icode;
! tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
tree arg0;
tree arg1;
tree arg2;
*************** arm_expand_builtin (tree exp,
*** 13455,13462 ****
: fcode == ARM_BUILTIN_TEXTRMUH ? CODE_FOR_iwmmxt_textrmuh
: CODE_FOR_iwmmxt_textrmw);
! arg0 = TREE_VALUE (arglist);
! arg1 = TREE_VALUE (TREE_CHAIN (arglist));
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
tmode = insn_data[icode].operand[0].mode;
--- 13454,13461 ----
: fcode == ARM_BUILTIN_TEXTRMUH ? CODE_FOR_iwmmxt_textrmuh
: CODE_FOR_iwmmxt_textrmw);
! arg0 = CALL_EXPR_ARG0 (exp);
! arg1 = CALL_EXPR_ARG1 (exp);
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
tmode = insn_data[icode].operand[0].mode;
*************** arm_expand_builtin (tree exp,
*** 13487,13495 ****
icode = (fcode == ARM_BUILTIN_TINSRB ? CODE_FOR_iwmmxt_tinsrb
: fcode == ARM_BUILTIN_TINSRH ? CODE_FOR_iwmmxt_tinsrh
: CODE_FOR_iwmmxt_tinsrw);
! 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);
--- 13486,13494 ----
icode = (fcode == ARM_BUILTIN_TINSRB ? CODE_FOR_iwmmxt_tinsrb
: fcode == ARM_BUILTIN_TINSRH ? CODE_FOR_iwmmxt_tinsrh
: CODE_FOR_iwmmxt_tinsrw);
! 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);
*************** arm_expand_builtin (tree exp,
*** 13519,13533 ****
return target;
case ARM_BUILTIN_SETWCX:
! arg0 = TREE_VALUE (arglist);
! arg1 = TREE_VALUE (TREE_CHAIN (arglist));
op0 = force_reg (SImode, expand_normal (arg0));
op1 = expand_normal (arg1);
emit_insn (gen_iwmmxt_tmcr (op1, op0));
return 0;
case ARM_BUILTIN_GETWCX:
! arg0 = TREE_VALUE (arglist);
op0 = expand_normal (arg0);
target = gen_reg_rtx (SImode);
emit_insn (gen_iwmmxt_tmrc (target, op0));
--- 13518,13532 ----
return target;
case ARM_BUILTIN_SETWCX:
! arg0 = CALL_EXPR_ARG0 (exp);
! arg1 = CALL_EXPR_ARG1 (exp);
op0 = force_reg (SImode, expand_normal (arg0));
op1 = expand_normal (arg1);
emit_insn (gen_iwmmxt_tmcr (op1, op0));
return 0;
case ARM_BUILTIN_GETWCX:
! arg0 = CALL_EXPR_ARG0 (exp);
op0 = expand_normal (arg0);
target = gen_reg_rtx (SImode);
emit_insn (gen_iwmmxt_tmrc (target, op0));
*************** arm_expand_builtin (tree exp,
*** 13535,13542 ****
case ARM_BUILTIN_WSHUFH:
icode = CODE_FOR_iwmmxt_wshufh;
! arg0 = TREE_VALUE (arglist);
! arg1 = TREE_VALUE (TREE_CHAIN (arglist));
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
tmode = insn_data[icode].operand[0].mode;
--- 13534,13541 ----
case ARM_BUILTIN_WSHUFH:
icode = CODE_FOR_iwmmxt_wshufh;
! arg0 = CALL_EXPR_ARG0 (exp);
! arg1 = CALL_EXPR_ARG1 (exp);
op0 = expand_normal (arg0);
op1 = expand_normal (arg1);
tmode = insn_data[icode].operand[0].mode;
*************** arm_expand_builtin (tree exp,
*** 13562,13574 ****
return target;
case ARM_BUILTIN_WSADB:
! return arm_expand_binop_builtin (CODE_FOR_iwmmxt_wsadb, arglist, target);
case ARM_BUILTIN_WSADH:
! return arm_expand_binop_builtin (CODE_FOR_iwmmxt_wsadh, arglist, target);
case ARM_BUILTIN_WSADBZ:
! return arm_expand_binop_builtin (CODE_FOR_iwmmxt_wsadbz, arglist, target);
case ARM_BUILTIN_WSADHZ:
! return arm_expand_binop_builtin (CODE_FOR_iwmmxt_wsadhz, arglist, target);
/* Several three-argument builtins. */
case ARM_BUILTIN_WMACS:
--- 13561,13573 ----
return target;
case ARM_BUILTIN_WSADB:
! return arm_expand_binop_builtin (CODE_FOR_iwmmxt_wsadb, exp, target);
case ARM_BUILTIN_WSADH:
! return arm_expand_binop_builtin (CODE_FOR_iwmmxt_wsadh, exp, target);
case ARM_BUILTIN_WSADBZ:
! return arm_expand_binop_builtin (CODE_FOR_iwmmxt_wsadbz, exp, target);
case ARM_BUILTIN_WSADHZ:
! return arm_expand_binop_builtin (CODE_FOR_iwmmxt_wsadhz, exp, target);
/* Several three-argument builtins. */
case ARM_BUILTIN_WMACS:
*************** arm_expand_builtin (tree exp,
*** 13589,13597 ****
: fcode == ARM_BUILTIN_TMIATB ? CODE_FOR_iwmmxt_tmiatb
: fcode == ARM_BUILTIN_TMIATT ? CODE_FOR_iwmmxt_tmiatt
: CODE_FOR_iwmmxt_walign);
! 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);
--- 13588,13596 ----
: fcode == ARM_BUILTIN_TMIATB ? CODE_FOR_iwmmxt_tmiatb
: fcode == ARM_BUILTIN_TMIATT ? CODE_FOR_iwmmxt_tmiatt
: CODE_FOR_iwmmxt_walign);
! 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);
*************** arm_expand_builtin (tree exp,
*** 13630,13640 ****
for (i = 0, d = bdesc_2arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
if (d->code == (const enum arm_builtins) fcode)
! return arm_expand_binop_builtin (d->icode, arglist, target);
for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
if (d->code == (const enum arm_builtins) fcode)
! return arm_expand_unop_builtin (d->icode, arglist, target, 0);
/* @@@ Should really do something sensible here. */
return NULL_RTX;
--- 13629,13639 ----
for (i = 0, d = bdesc_2arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
if (d->code == (const enum arm_builtins) fcode)
! return arm_expand_binop_builtin (d->icode, exp, target);
for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
if (d->code == (const enum arm_builtins) fcode)
! return arm_expand_unop_builtin (d->icode, exp, target, 0);
/* @@@ Should really do something sensible here. */
return NULL_RTX;
Index: gcc/config/mips/mips.c
===================================================================
*** gcc/config/mips/mips.c (revision 121705)
--- gcc/config/mips/mips.c (working copy)
*************** mips_expand_builtin (tree exp, rtx targe
*** 10336,10343 ****
const struct builtin_description *bdesc;
const struct bdesc_map *m;
! fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
! arglist = TREE_OPERAND (exp, 1);
fcode = DECL_FUNCTION_CODE (fndecl);
bdesc = NULL;
--- 10336,10345 ----
const struct builtin_description *bdesc;
const struct bdesc_map *m;
! fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
! /* FIXME: Rewrite this to use the CALL_EXPR directly instead of consing
! up an arglist. */
! arglist = CALL_EXPR_ARGS (exp);
fcode = DECL_FUNCTION_CODE (fndecl);
bdesc = NULL;
Index: gcc/config/bfin/bfin.c
===================================================================
*** gcc/config/bfin/bfin.c (revision 121705)
--- gcc/config/bfin/bfin.c (working copy)
*************** safe_vector_operand (rtx x, enum machine
*** 4617,4628 ****
if this is a normal binary op, or one of the MACFLAG_xxx constants. */
static rtx
! bfin_expand_binop_builtin (enum insn_code icode, tree arglist, rtx target,
int macflag)
{
rtx pat;
! tree arg0 = TREE_VALUE (arglist);
! tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
rtx op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
rtx op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
enum machine_mode op0mode = GET_MODE (op0);
--- 4617,4628 ----
if this is a normal binary op, or one of the MACFLAG_xxx constants. */
static rtx
! bfin_expand_binop_builtin (enum insn_code icode, tree exp, rtx target,
int macflag)
{
rtx pat;
! tree arg0 = CALL_EXPR_ARG0 (exp);
! tree arg1 = CALL_EXPR_ARG1 (exp);
rtx op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
rtx op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
enum machine_mode op0mode = GET_MODE (op0);
*************** bfin_expand_binop_builtin (enum insn_cod
*** 4675,4685 ****
/* Subroutine of bfin_expand_builtin to take care of unop insns. */
static rtx
! bfin_expand_unop_builtin (enum insn_code icode, tree arglist,
rtx target)
{
rtx pat;
! tree arg0 = TREE_VALUE (arglist);
rtx op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
enum machine_mode op0mode = GET_MODE (op0);
enum machine_mode tmode = insn_data[icode].operand[0].mode;
--- 4675,4685 ----
/* Subroutine of bfin_expand_builtin to take care of unop insns. */
static rtx
! bfin_expand_unop_builtin (enum insn_code icode, tree exp,
rtx target)
{
rtx pat;
! tree arg0 = CALL_EXPR_ARG0 (exp);
rtx op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
enum machine_mode op0mode = GET_MODE (op0);
enum machine_mode tmode = insn_data[icode].operand[0].mode;
*************** bfin_expand_builtin (tree exp, rtx targe
*** 4725,4732 ****
size_t i;
enum insn_code icode;
const struct builtin_description *d;
! 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;
rtx op0, op1, op2, accvec, pat, tmp1, tmp2;
--- 4725,4731 ----
size_t i;
enum insn_code icode;
const struct builtin_description *d;
! tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
tree arg0, arg1, arg2;
rtx op0, op1, op2, accvec, pat, tmp1, tmp2;
*************** bfin_expand_builtin (tree exp, rtx targe
*** 4743,4749 ****
case BFIN_BUILTIN_DIFFHL_2X16:
case BFIN_BUILTIN_DIFFLH_2X16:
! arg0 = TREE_VALUE (arglist);
op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
icode = (fcode == BFIN_BUILTIN_DIFFHL_2X16
? CODE_FOR_subhilov2hi3 : CODE_FOR_sublohiv2hi3);
--- 4742,4748 ----
case BFIN_BUILTIN_DIFFHL_2X16:
case BFIN_BUILTIN_DIFFLH_2X16:
! arg0 = CALL_EXPR_ARG0 (exp);
op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
icode = (fcode == BFIN_BUILTIN_DIFFHL_2X16
? CODE_FOR_subhilov2hi3 : CODE_FOR_sublohiv2hi3);
*************** bfin_expand_builtin (tree exp, rtx targe
*** 4768,4775 ****
return target;
case BFIN_BUILTIN_CPLX_MUL_16:
! arg0 = TREE_VALUE (arglist);
! arg1 = TREE_VALUE (TREE_CHAIN (arglist));
op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
accvec = gen_reg_rtx (V2PDImode);
--- 4767,4774 ----
return target;
case BFIN_BUILTIN_CPLX_MUL_16:
! arg0 = CALL_EXPR_ARG0 (exp);
! arg1 = CALL_EXPR_ARG1 (exp);
op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
accvec = gen_reg_rtx (V2PDImode);
*************** bfin_expand_builtin (tree exp, rtx targe
*** 4795,4803 ****
case BFIN_BUILTIN_CPLX_MAC_16:
case BFIN_BUILTIN_CPLX_MSU_16:
! arg0 = TREE_VALUE (arglist);
! arg1 = TREE_VALUE (TREE_CHAIN (arglist));
! arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
--- 4794,4802 ----
case BFIN_BUILTIN_CPLX_MAC_16:
case BFIN_BUILTIN_CPLX_MSU_16:
! arg0 = CALL_EXPR_ARG0 (exp);
! arg1 = CALL_EXPR_ARG1 (exp);
! arg2 = CALL_EXPR_ARG2 (exp);
op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
*************** bfin_expand_builtin (tree exp, rtx targe
*** 4838,4849 ****
for (i = 0, d = bdesc_2arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
if (d->code == fcode)
! return bfin_expand_binop_builtin (d->icode, arglist, target,
d->macflag);
for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
if (d->code == fcode)
! return bfin_expand_unop_builtin (d->icode, arglist, target);
gcc_unreachable ();
}
--- 4837,4848 ----
for (i = 0, d = bdesc_2arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
if (d->code == fcode)
! return bfin_expand_binop_builtin (d->icode, exp, target,
d->macflag);
for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
if (d->code == fcode)
! return bfin_expand_unop_builtin (d->icode, exp, target);
gcc_unreachable ();
}