mirror of git://gcc.gnu.org/git/gcc.git
rs6000.c (const_load_sequence_p): Handle extra indirection for large and small code models.
[gcc] 2015-12-01 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/rs6000.c (const_load_sequence_p): Handle extra indirection for large and small code models. (adjust_vperm): Likewise. [gcc/testsuite] 2015-12-01 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * gcc.target/powerpc/swaps-p8-22.c: New. From-SVN: r231119
This commit is contained in:
parent
37d5ad46dd
commit
3b47f4cc10
|
|
@ -1,3 +1,9 @@
|
|||
2015-12-01 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
|
||||
|
||||
* config/rs6000/rs6000.c (const_load_sequence_p): Handle extra
|
||||
indirection for large and small code models.
|
||||
(adjust_vperm): Likewise.
|
||||
|
||||
2015-12-01 Julian Brown <julian@codesourcery.com>
|
||||
Cesar Philippidis <cesar@codesourcery.com>
|
||||
James Norris <James_Norris@mentor.com>
|
||||
|
|
|
|||
|
|
@ -36613,7 +36613,12 @@ const_load_sequence_p (swap_web_entry *insn_entry, rtx insn)
|
|||
rtx base, offset;
|
||||
if (GET_CODE (tocrel_body) != SET)
|
||||
return false;
|
||||
if (!toc_relative_expr_p (SET_SRC (tocrel_body), false))
|
||||
/* There is an extra level of indirection for small/large
|
||||
code models. */
|
||||
rtx tocrel_expr = SET_SRC (tocrel_body);
|
||||
if (GET_CODE (tocrel_expr) == MEM)
|
||||
tocrel_expr = XEXP (tocrel_expr, 0);
|
||||
if (!toc_relative_expr_p (tocrel_expr, false))
|
||||
return false;
|
||||
split_const (XVECEXP (tocrel_base, 0, 0), &base, &offset);
|
||||
if (GET_CODE (base) != SYMBOL_REF || !CONSTANT_POOL_ADDRESS_P (base))
|
||||
|
|
@ -37294,10 +37299,19 @@ adjust_vperm (rtx_insn *insn)
|
|||
to set tocrel_base; otherwise it would be unnecessary as we've
|
||||
already established it will return true. */
|
||||
rtx base, offset;
|
||||
if (!toc_relative_expr_p (SET_SRC (PATTERN (tocrel_insn)), false))
|
||||
rtx tocrel_expr = SET_SRC (PATTERN (tocrel_insn));
|
||||
/* There is an extra level of indirection for small/large code models. */
|
||||
if (GET_CODE (tocrel_expr) == MEM)
|
||||
tocrel_expr = XEXP (tocrel_expr, 0);
|
||||
if (!toc_relative_expr_p (tocrel_expr, false))
|
||||
gcc_unreachable ();
|
||||
split_const (XVECEXP (tocrel_base, 0, 0), &base, &offset);
|
||||
rtx const_vector = get_pool_constant (base);
|
||||
/* With the extra indirection, get_pool_constant will produce the
|
||||
real constant from the reg_equal expression, so get the real
|
||||
constant. */
|
||||
if (GET_CODE (const_vector) == SYMBOL_REF)
|
||||
const_vector = get_pool_constant (const_vector);
|
||||
gcc_assert (GET_CODE (const_vector) == CONST_VECTOR);
|
||||
|
||||
/* Create an adjusted mask from the initial mask. */
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
2015-12-01 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
|
||||
|
||||
* gcc.target/powerpc/swaps-p8-22.c: New.
|
||||
|
||||
2015-12-01 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR tree-optimization/67916
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
/* { dg-do compile { target { powerpc64le-*-* } } } */
|
||||
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } }
|
||||
/* { dg-options "-O2 -mcpu=power8 -maltivec -mcmodel=large" } */
|
||||
|
||||
/* The expansion for vector character multiply introduces a vperm operation.
|
||||
This tests that changing the vperm mask allows us to remove all swaps
|
||||
from the generated code. It is a duplicate of swaps-p8-21.c, except
|
||||
that it applies the large code model, which requires an extra indirection
|
||||
in the load of the constant mask. */
|
||||
|
||||
#include <altivec.h>
|
||||
|
||||
void abort ();
|
||||
|
||||
vector unsigned char r;
|
||||
vector unsigned char v =
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
|
||||
vector unsigned char i =
|
||||
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
|
||||
|
||||
int main ()
|
||||
{
|
||||
int j;
|
||||
r = v * i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-times "vperm" 1 } } */
|
||||
/* { dg-final { scan-assembler-not "xxpermdi" } } */
|
||||
Loading…
Reference in New Issue