Commit 5fad9d33 by Robin Dapp Committed by Robin Dapp

S/390: Define shift_truncation_mask.

Define s390_shift_truncation_mask to allow the optabs optimization

    sh = (64 - sh)
 -> sh = -sh

for a rotation operation.

gcc/ChangeLog:

2019-07-08  Robin Dapp  <rdapp@linux.ibm.com>

	* config/s390/s390.c (s390_shift_truncation_mask): Define.
	(TARGET_SHIFT_TRUNCATION_MASK): Define.

gcc/testsuite/ChangeLog:

2019-07-08  Robin Dapp  <rdapp@linux.ibm.com>

	* gcc.target/s390/rotate-truncation-mask.c: New test.

From-SVN: r273237
parent e2839e47
2019-07-08 Robin Dapp <rdapp@linux.ibm.com>
* config/s390/s390.c (s390_shift_truncation_mask): Define.
(TARGET_SHIFT_TRUNCATION_MASK): Define.
2019-07-08 Robin Dapp <rdapp@linux.ibm.com>
* config/s390/constraints.md: Add new jsc constraint.
* config/s390/predicates.md: New predicates.
* config/s390/s390-protos.h (s390_valid_shift_count): New function.
......
......@@ -16412,7 +16412,13 @@ s390_sched_dependencies_evaluation (rtx_insn *head, rtx_insn *tail)
add_dependence (r11_restore, r15_restore, REG_DEP_ANTI);
}
/* Implement TARGET_SHIFT_TRUNCATION_MASK for integer shifts. */
static unsigned HOST_WIDE_INT
s390_shift_truncation_mask (machine_mode mode)
{
return mode == DImode || mode == SImode ? 63 : 0;
}
/* Initialize GCC target structure. */
......@@ -16709,6 +16715,8 @@ s390_sched_dependencies_evaluation (rtx_insn *head, rtx_insn *tail)
#define TARGET_SCHED_DEPENDENCIES_EVALUATION_HOOK \
s390_sched_dependencies_evaluation
#undef TARGET_SHIFT_TRUNCATION_MASK
#define TARGET_SHIFT_TRUNCATION_MASK s390_shift_truncation_mask
/* Use only short displacement, since long displacement is not available for
the floating point instructions. */
......
2019-07-08 Robin Dapp <rdapp@linux.ibm.com>
* gcc.target/s390/rotate-truncation-mask.c: New test.
2019-07-08 Robin Dapp <rdapp@linux.ibm.com>
* gcc.target/s390/combine-rotate-modulo.c: New test.
* gcc.target/s390/combine-shift-rotate-add-mod.c: New test.
* gcc.target/s390/vector/combine-shift-vec.c: New test.
......
/* Check that we do not use (64 - sh) for rotating. */
/* { dg-options "-O1 -m64" } */
/* { dg-final { scan-assembler "lcr\t%r.+,%r.+" } } */
/* { dg-final { scan-assembler-not "lhi\t%r.+,64" } } */
/* { dg-final { scan-assembler-not "sr\t%r.+,%r.+" } } */
unsigned long rotr (unsigned long in, unsigned long sh)
{
return (in >> sh) | (in << (64 - sh));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment