return target;
}
-/* Return the integer constant in ARG. Constrain it to be in the range
- of the subparts of VEC_TYPE; issue an error if not. */
-
-static int
-get_element_number (tree vec_type, tree arg)
-{
- unsigned HOST_WIDE_INT elt, max = TYPE_VECTOR_SUBPARTS (vec_type) - 1;
-
- if (!tree_fits_uhwi_p (arg)
- || (elt = tree_to_uhwi (arg), elt > max))
- {
- error ("selector must be an integer constant in the range [0, %wi]", max);
- return 0;
- }
-
- return elt;
-}
-
-/* Expand vec_set builtin. */
-static rtx
-altivec_expand_vec_set_builtin (tree exp)
-{
- machine_mode tmode, mode1;
- tree arg0, arg1, arg2;
- int elt;
- rtx op0, op1;
-
- arg0 = CALL_EXPR_ARG (exp, 0);
- arg1 = CALL_EXPR_ARG (exp, 1);
- arg2 = CALL_EXPR_ARG (exp, 2);
-
- tmode = TYPE_MODE (TREE_TYPE (arg0));
- mode1 = TYPE_MODE (TREE_TYPE (TREE_TYPE (arg0)));
- gcc_assert (VECTOR_MODE_P (tmode));
-
- op0 = expand_expr (arg0, NULL_RTX, tmode, EXPAND_NORMAL);
- op1 = expand_expr (arg1, NULL_RTX, mode1, EXPAND_NORMAL);
- elt = get_element_number (TREE_TYPE (arg0), arg2);
-
- if (GET_MODE (op1) != mode1 && GET_MODE (op1) != VOIDmode)
- op1 = convert_modes (mode1, GET_MODE (op1), op1, true);
-
- op0 = force_reg (tmode, op0);
- op1 = force_reg (mode1, op1);
-
- rs6000_expand_vector_set (op0, op1, GEN_INT (elt));
-
- return op0;
-}
-
/* Expand vec_ext builtin. */
static rtx
altivec_expand_vec_ext_builtin (tree exp, rtx target)
if (bif_is_cpu (*bifaddr))
return cpu_expand_builtin (fcode, exp, target);
- if (bif_is_set (*bifaddr))
- return altivec_expand_vec_set_builtin (exp);
-
if (bif_is_extract (*bifaddr))
return altivec_expand_vec_ext_builtin (exp, target);
;
; Attributes are strings, and the allowed ones are listed below.
;
-; set Process as a vec_set function
; extract Process as a vec_extract function
; nosoft Not valid with -msoft-float
; ldvec Needs special handling for vec_ld semantics
const vsll __builtin_vsx_mul_2di (vsll, vsll);
MUL_V2DI vsx_mul_v2di {}
- const vsq __builtin_vsx_set_1ti (vsq, signed __int128, const int<0,0>);
- SET_1TI vsx_set_v1ti {set}
-
- const vd __builtin_vsx_set_2df (vd, double, const int<0,1>);
- SET_2DF vsx_set_v2df {set}
-
- const vsll __builtin_vsx_set_2di (vsll, signed long long, const int<0,1>);
- SET_2DI vsx_set_v2di {set}
-
const vd __builtin_vsx_splat_2df (double);
SPLAT_2DF vsx_splat_v2df {}
/* Attributes of a builtin function. */
struct attrinfo
{
- bool isset;
bool isextract;
bool isnosoft;
bool isldvec;
attrname = match_identifier ();
if (attrname)
{
- if (!strcmp (attrname, "set"))
- attrptr->isset = 1;
- else if (!strcmp (attrname, "extract"))
+ if (!strcmp (attrname, "extract"))
attrptr->isextract = 1;
else if (!strcmp (attrname, "nosoft"))
attrptr->isnosoft = 1;
#ifdef DEBUG
diag (0,
- "attribute set: set = %d, extract = %d, nosoft = %d, "
- "ldvec = %d, stvec = %d, reve = %d, pred = %d, htm = %d, "
- "htmspr = %d, htmcr = %d, mma = %d, quad = %d, pair = %d, "
- "mmaint = %d, no32bit = %d, 32bit = %d, cpu = %d, ldstmask = %d, "
- "lxvrse = %d, lxvrze = %d, endian = %d, ibmdld = %d, ibm128 = %d.\n",
- attrptr->isset, attrptr->isextract, attrptr->isnosoft,
- attrptr->isldvec, attrptr->isstvec, attrptr->isreve, attrptr->ispred,
- attrptr->ishtm, attrptr->ishtmspr, attrptr->ishtmcr, attrptr->ismma,
+ "extract = %d, nosoft = %d, ldvec = %d, stvec = %d, reve = %d, "
+ "pred = %d, htm = %d, htmspr = %d, htmcr = %d, mma = %d, "
+ "quad = %d, pair = %d, mmaint = %d, no32bit = %d, 32bit = %d, "
+ "cpu = %d, ldstmask = %d, lxvrse = %d, lxvrze = %d, endian = %d, "
+ "ibmdld = %d, ibm128 = %d.\n",
+ attrptr->isextract, attrptr->isnosoft,attrptr->isldvec,
+ attrptr->isstvec, attrptr->isreve, attrptr->ispred, attrptr->ishtm,
+ attrptr->ishtmspr, attrptr->ishtmcr, attrptr->ismma,
attrptr->isquad, attrptr->ispair, attrptr->ismmaint,
attrptr->isno32bit, attrptr->is32bit, attrptr->iscpu,
attrptr->isldstmask, attrptr->islxvrse, attrptr->islxvrze,
fprintf (header_file, " rs6000_gen_builtins assoc_bif;\n");
fprintf (header_file, "};\n\n");
- /* Bit pattern 0x00000001 is available. */
- fprintf (header_file, "#define bif_set_bit\t\t(0x00000002)\n");
+ /* Bit patterns 0x00000001 and 0x00000002 are available. */
fprintf (header_file, "#define bif_extract_bit\t\t(0x00000004)\n");
fprintf (header_file, "#define bif_nosoft_bit\t\t(0x00000008)\n");
fprintf (header_file, "#define bif_ldvec_bit\t\t(0x00000010)\n");
fprintf (header_file, "#define bif_ibmld_bit\t\t(0x00400000)\n");
fprintf (header_file, "#define bif_ibm128_bit\t\t(0x00800000)\n");
fprintf (header_file, "\n");
- fprintf (header_file,
- "#define bif_is_set(x)\t\t((x).bifattrs & bif_set_bit)\n");
fprintf (header_file,
"#define bif_is_extract(x)\t((x).bifattrs & bif_extract_bit)\n");
fprintf (header_file,
fprintf (init_file, " /* nargs */\t%d,\n",
bifp->proto.nargs);
fprintf (init_file, " /* bifattrs */\t0");
- if (bifp->attrs.isset)
- fprintf (init_file, " | bif_set_bit");
if (bifp->attrs.isextract)
fprintf (init_file, " | bif_extract_bit");
if (bifp->attrs.isnosoft)