+2002-05-03 Aldy Hernandez <aldyh@redhat.com>
+
+ * config/rs6000/rs6000.c (altivec_expand_binop_builtin): Error out
+ when we get an out of range literal.
+ (altivec_expand_ternop_builtin): Same.
+ (altivec_expand_unop_builtin): Same.
+ (altivec_expand_builtin): Same, for dss.
+ (altivec_expand_builtin): Use trees instead of rtl when
+ determining literal argument validity.
+
2002-05-03 David S. Miller <davem@redhat.com>
Delete cycle display scheduling hook.
if (arg0 == error_mark_node)
return NULL_RTX;
+ switch (icode)
+ {
+ /* Only allow 5-bit *signed* literals. */
+ case CODE_FOR_altivec_vspltisb:
+ case CODE_FOR_altivec_vspltish:
+ case CODE_FOR_altivec_vspltisw:
+ if (GET_CODE (op0) != CONST_INT
+ || INTVAL (op0) > 0x1f
+ || INTVAL (op0) < -0x1f)
+ {
+ error ("argument 1 must be a 5-bit signed literal");
+ return NULL_RTX;
+ }
+ break;
+ }
+
if (target == 0
|| GET_MODE (target) != tmode
|| ! (*insn_data[icode].operand[0].predicate) (target, tmode))
if (arg0 == error_mark_node || arg1 == error_mark_node)
return NULL_RTX;
+ switch (icode)
+ {
+ /* Only allow 5-bit unsigned literals. */
+ case CODE_FOR_altivec_vcfux:
+ case CODE_FOR_altivec_vcfsx:
+ case CODE_FOR_altivec_vctsxs:
+ case CODE_FOR_altivec_vctuxs:
+ case CODE_FOR_altivec_vspltb:
+ case CODE_FOR_altivec_vsplth:
+ case CODE_FOR_altivec_vspltw:
+ if (TREE_CODE (arg1) != INTEGER_CST
+ || TREE_INT_CST_LOW (arg1) & ~0x1f)
+ {
+ error ("argument 2 must be a 5-bit unsigned literal");
+ return NULL_RTX;
+ }
+ break;
+ }
+
if (target == 0
|| GET_MODE (target) != tmode
|| ! (*insn_data[icode].operand[0].predicate) (target, tmode))
|| arg2 == error_mark_node)
return NULL_RTX;
+ switch (icode)
+ {
+ /* Only allow 4-bit unsigned literals. */
+ case CODE_FOR_altivec_vsldoi_4sf:
+ case CODE_FOR_altivec_vsldoi_4si:
+ case CODE_FOR_altivec_vsldoi_8hi:
+ case CODE_FOR_altivec_vsldoi_16qi:
+ if (TREE_CODE (arg2) != INTEGER_CST
+ || TREE_INT_CST_LOW (arg2) & ~0xf)
+ {
+ error ("argument 3 must be a 4-bit unsigned literal");
+ return NULL_RTX;
+ }
+ break;
+ }
+
if (target == 0
|| GET_MODE (target) != tmode
|| ! (*insn_data[icode].operand[0].predicate) (target, tmode))
if (arg0 == error_mark_node)
return NULL_RTX;
+ if (TREE_CODE (arg0) != INTEGER_CST
+ || TREE_INT_CST_LOW (arg0) & ~0x3)
+ {
+ error ("argument to dss must be a 2-bit unsigned literal");
+ return NULL_RTX;
+ }
+
if (! (*insn_data[icode].operand[0].predicate) (op0, mode0))
op0 = copy_to_mode_reg (mode0, op0);
|| arg2 == error_mark_node)
return NULL_RTX;
+ if (TREE_CODE (arg2) != INTEGER_CST
+ || TREE_INT_CST_LOW (arg2) & ~0x3)
+ {
+ error ("argument to `%s' must be a 2-bit unsigned literal", d->name);
+ return NULL_RTX;
+ }
+
if (! (*insn_data[d->icode].operand[0].predicate) (op0, mode0))
op0 = copy_to_mode_reg (mode0, op0);
if (! (*insn_data[d->icode].operand[1].predicate) (op1, mode1))
op1 = copy_to_mode_reg (mode1, op1);
- if (GET_CODE (op2) != CONST_INT || INTVAL (op2) > 3)
- {
- error ("argument 3 of `%s' must be a 2-bit literal", d->name);
- return NULL_RTX;
- }
-
pat = GEN_FCN (d->icode) (op0, op1, op2);
if (pat != 0)
emit_insn (pat);