+2018-11-29 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/predicates.md (easy_fp_constant): Remove code
+ dealing with integers in const_double. Assert on unexpected
+ modes. Delete superfluous ABI_V4 test.
+ * config/rs6000/rs6000.c (rs6000_emit_move): Comment fixes.
+ Don't call easy_fp_constant for Pmode.
+ (rs6000_hash_constant): Remove code dealing with integers in
+ const_double.
+ (rs6000_legitimate_constant_p): Likewise.
+ (output_toc): Formatting, use CONST_DOUBLE_P.
+
2018-11-29 Alan Modra <amodra@gmail.com>
* config/rs6000/constraints.md (G, H): Comment on purpose of
(define_predicate "easy_fp_constant"
(match_code "const_double")
{
- if (GET_MODE (op) != mode
- || (!SCALAR_FLOAT_MODE_P (mode) && mode != DImode))
- return 0;
+ gcc_assert (GET_MODE (op) == mode && SCALAR_FLOAT_MODE_P (mode));
/* Consider all constants with -msoft-float to be easy. */
- if (TARGET_SOFT_FLOAT && mode != DImode)
+ if (TARGET_SOFT_FLOAT)
return 1;
/* 0.0D is not all zero bits. */
return 0;
/* The constant 0.0 is easy under VSX. */
- if (TARGET_VSX && SCALAR_FLOAT_MODE_P (mode) && op == CONST0_RTX (mode))
+ if (TARGET_VSX && op == CONST0_RTX (mode))
return 1;
- /* If we are using V.4 style PIC, consider all constants to be hard. */
- if (flag_pic && DEFAULT_ABI == ABI_V4)
- return 0;
-
- /* If we have real FPRs, consider floating point constants hard (other than
- 0.0 under VSX), so that the constant gets pushed to memory during the
- early RTL phases. This has the advantage that double precision constants
- that can be represented in single precision without a loss of precision
- will use single precision loads. */
-
- switch (mode)
- {
- case E_KFmode:
- case E_IFmode:
- case E_TFmode:
- case E_DFmode:
- case E_SFmode:
- return 0;
-
- case E_DImode:
- return (num_insns_constant (op, DImode) <= 2);
-
- case E_SImode:
- return 1;
-
- default:
- gcc_unreachable ();
- }
+ /* Otherwise consider floating point constants hard, so that the
+ constant gets pushed to memory during the early RTL phases. This
+ has the advantage that double precision constants that can be
+ represented in single precision without a loss of precision will
+ use single precision loads. */
+ return 0;
})
;; Return 1 if the operand is a constant that can loaded with a XXSPLTIB
debug_rtx (source);
}
- /* Sanity checks. Check that we get CONST_DOUBLE only when we should. */
+ /* Check that we get CONST_WIDE_INT only when we should. */
if (CONST_WIDE_INT_P (operands[1])
&& GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
- {
- /* This should be fixed with the introduction of CONST_WIDE_INT. */
- gcc_unreachable ();
- }
+ gcc_unreachable ();
#ifdef HAVE_AS_GNU_ATTRIBUTE
/* If we use a long double type, set the flags in .gnu_attribute that say
else if (mode == Pmode
&& CONSTANT_P (operands[1])
&& GET_CODE (operands[1]) != HIGH
- && ((GET_CODE (operands[1]) != CONST_INT
- && ! easy_fp_constant (operands[1], mode))
- || (GET_CODE (operands[1]) == CONST_INT
- && (num_insns_constant (operands[1], mode)
- > (TARGET_CMODEL != CMODEL_SMALL ? 3 : 2)))
- || (GET_CODE (operands[0]) == REG
- && FP_REGNO_P (REGNO (operands[0]))))
+ && ((REG_P (operands[0])
+ && FP_REGNO_P (REGNO (operands[0])))
+ || !CONST_INT_P (operands[1])
+ || (num_insns_constant (operands[1], mode)
+ > (TARGET_CMODEL != CMODEL_SMALL ? 3 : 2)))
&& !toc_relative_expr_p (operands[1], false, NULL, NULL)
&& (TARGET_CMODEL == CMODEL_SMALL
|| can_create_pseudo_p ()
}
case CONST_DOUBLE:
- if (mode != VOIDmode)
- return real_hash (CONST_DOUBLE_REAL_VALUE (k)) * result;
- flen = 2;
- break;
+ return real_hash (CONST_DOUBLE_REAL_VALUE (k)) * result;
case CODE_LABEL:
fidx = 3;
/* Handle FP constants specially. Note that if we have a minimal
TOC, things we put here aren't actually in the TOC, so we can allow
FP constants. */
- if (GET_CODE (x) == CONST_DOUBLE &&
- (GET_MODE (x) == TFmode || GET_MODE (x) == TDmode
- || GET_MODE (x) == IFmode || GET_MODE (x) == KFmode))
+ if (CONST_DOUBLE_P (x)
+ && (GET_MODE (x) == TFmode || GET_MODE (x) == TDmode
+ || GET_MODE (x) == IFmode || GET_MODE (x) == KFmode))
{
long k[4];
return;
}
}
- else if (GET_CODE (x) == CONST_DOUBLE &&
- (GET_MODE (x) == DFmode || GET_MODE (x) == DDmode))
+ else if (CONST_DOUBLE_P (x)
+ && (GET_MODE (x) == DFmode || GET_MODE (x) == DDmode))
{
long k[2];
return;
}
}
- else if (GET_CODE (x) == CONST_DOUBLE &&
- (GET_MODE (x) == SFmode || GET_MODE (x) == SDmode))
+ else if (CONST_DOUBLE_P (x)
+ && (GET_MODE (x) == SFmode || GET_MODE (x) == SDmode))
{
long l;
if (TARGET_ELF && tls_referenced_p (x))
return false;
- return ((GET_CODE (x) != CONST_DOUBLE && GET_CODE (x) != CONST_VECTOR)
- || GET_MODE (x) == VOIDmode
- || (TARGET_POWERPC64 && mode == DImode)
- || easy_fp_constant (x, mode)
- || easy_vector_constant (x, mode));
+ if (CONST_DOUBLE_P (x))
+ return easy_fp_constant (x, mode);
+
+ if (GET_CODE (x) == CONST_VECTOR)
+ return easy_vector_constant (x, mode);
+
+ return true;
}
\f