mirror of git://gcc.gnu.org/git/gcc.git
aarch64.c (aarch64_rtx_costs): Make sdiv more expensive than udiv.
2017-06-07 Tamar Christina <tamar.christina@arm.com> * config/aarch64/aarch64.c (aarch64_rtx_costs): Make sdiv more expensive than udiv. Remove floating point cases from mod. From-SVN: r248953
This commit is contained in:
parent
e059725b24
commit
cb9ac430cb
|
|
@ -1,3 +1,8 @@
|
|||
2017-06-07 Tamar Christina <tamar.christina@arm.com>
|
||||
|
||||
* config/aarch64/aarch64.c (aarch64_rtx_costs): Make sdiv more expensive than udiv.
|
||||
Remove floating point cases from mod.
|
||||
|
||||
2017-06-07 Tamar Christina <tamar.christina@arm.com>
|
||||
|
||||
* config/arm/aarch-cost-tables.h (cortexa53_extra_cost): Increase idiv cost.
|
||||
|
|
|
|||
|
|
@ -7544,17 +7544,13 @@ cost_plus:
|
|||
case UMOD:
|
||||
if (speed)
|
||||
{
|
||||
/* Slighly prefer UMOD over SMOD. */
|
||||
if (VECTOR_MODE_P (mode))
|
||||
*cost += extra_cost->vect.alu;
|
||||
else if (GET_MODE_CLASS (mode) == MODE_INT)
|
||||
*cost += (extra_cost->mult[mode == DImode].add
|
||||
+ extra_cost->mult[mode == DImode].idiv);
|
||||
else if (mode == DFmode)
|
||||
*cost += (extra_cost->fp[1].mult
|
||||
+ extra_cost->fp[1].div);
|
||||
else if (mode == SFmode)
|
||||
*cost += (extra_cost->fp[0].mult
|
||||
+ extra_cost->fp[0].div);
|
||||
+ extra_cost->mult[mode == DImode].idiv
|
||||
+ (code == MOD ? 1 : 0));
|
||||
}
|
||||
return false; /* All arguments need to be in registers. */
|
||||
|
||||
|
|
@ -7568,7 +7564,9 @@ cost_plus:
|
|||
else if (GET_MODE_CLASS (mode) == MODE_INT)
|
||||
/* There is no integer SQRT, so only DIV and UDIV can get
|
||||
here. */
|
||||
*cost += extra_cost->mult[mode == DImode].idiv;
|
||||
*cost += (extra_cost->mult[mode == DImode].idiv
|
||||
/* Slighly prefer UDIV over SDIV. */
|
||||
+ (code == DIV ? 1 : 0));
|
||||
else
|
||||
*cost += extra_cost->fp[mode == DFmode].div;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
2017-06-07 Tamar Christina <tamar.christina@arm.com>
|
||||
|
||||
* gcc.target/aarch64/sdiv_costs_1.c: New.
|
||||
|
||||
2017-06-07 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/80928
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O3" } */
|
||||
|
||||
/* Both sdiv and udiv can be used here, so prefer udiv. */
|
||||
int f1 (unsigned char *p)
|
||||
{
|
||||
return 100 / p[1];
|
||||
}
|
||||
|
||||
int f2 (unsigned char *p, unsigned short x)
|
||||
{
|
||||
return x / p[0];
|
||||
}
|
||||
|
||||
int f3 (unsigned char *p, int x)
|
||||
{
|
||||
x &= 0x7fffffff;
|
||||
return x / p[0];
|
||||
}
|
||||
|
||||
int f5 (unsigned char *p, unsigned short x)
|
||||
{
|
||||
return x % p[0];
|
||||
}
|
||||
|
||||
/* This should only generate signed divisions. */
|
||||
int f4 (unsigned char *p)
|
||||
{
|
||||
return -100 / p[1];
|
||||
}
|
||||
|
||||
int f6 (unsigned char *p, short x)
|
||||
{
|
||||
return x % p[0];
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-times "udiv\tw\[0-9\]+, w\[0-9\]+" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "sdiv\tw\[0-9\]+, w\[0-9\]+" 2 } } */
|
||||
Loading…
Reference in New Issue