tree-vect-data-refs.c (dr_group_sort_cmp): Do not use hash function in compare function for sorting.
2013-07-15 Cong Hou <congh@google.com> gcc/ * tree-vect-data-refs.c (dr_group_sort_cmp): Do not use hash function in compare function for sorting. gcc/testsuite/ * gcc.target/i386/l_fma_float_1.c: Update the instruction to be counted. * gcc.target/i386/l_fma_float_3.c: Likewise. * gcc.target/i386/l_fma_double_1.c: Likewise. * gcc.target/i386/l_fma_double_3.c: Likewise From-SVN: r200968
This commit is contained in:
parent
ab0e837971
commit
839c74bced
7 changed files with 109 additions and 25 deletions
|
@ -1,3 +1,8 @@
|
|||
2013-07-15 Cong Hou <congh@google.com>
|
||||
|
||||
* tree-vect-data-refs.c (dr_group_sort_cmp): Do not use hash function
|
||||
in compare function for sorting.
|
||||
|
||||
2013-07-15 Peter Bergner <bergner@vnet.ibm.com>
|
||||
|
||||
* config.gcc (powerpc*-*-*): Install htmintrin.h and htmxlintrin.h.
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
2013-07-15 Cong Hou <congh@google.com>
|
||||
|
||||
* gcc.target/i386/l_fma_float_1.c: Update the instruction to be
|
||||
counted.
|
||||
* gcc.target/i386/l_fma_float_3.c: Likewise.
|
||||
* gcc.target/i386/l_fma_double_1.c: Likewise.
|
||||
* gcc.target/i386/l_fma_double_3.c: Likewise.
|
||||
|
||||
2013-07-15 Peter Bergner <bergner@vnet.ibm.com>
|
||||
|
||||
* lib/target-supports.exp (check_effective_target_powerpc_htm_ok): New
|
||||
|
|
|
@ -10,9 +10,9 @@ typedef double adouble __attribute__((aligned(sizeof (double))));
|
|||
#include "l_fma_1.h"
|
||||
|
||||
/* { dg-final { scan-assembler-times "vfmadd132pd" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmadd213pd" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmadd231pd" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmsub132pd" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmsub213pd" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmsub231pd" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfnmadd132pd" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfnmadd231pd" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfnmsub132pd" 4 } } */
|
||||
|
|
|
@ -10,9 +10,9 @@ typedef double adouble __attribute__((aligned(sizeof (double))));
|
|||
#include "l_fma_3.h"
|
||||
|
||||
/* { dg-final { scan-assembler-times "vfmadd132pd" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmadd213pd" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmadd231pd" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmsub132pd" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmsub213pd" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmsub231pd" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfnmadd132pd" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfnmadd231pd" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfnmsub132pd" 4 } } */
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
#include "l_fma_1.h"
|
||||
|
||||
/* { dg-final { scan-assembler-times "vfmadd132ps" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmadd213ps" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmadd231ps" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmsub132ps" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmsub213ps" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmsub231ps" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfnmadd132ps" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfnmadd231ps" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfnmsub132ps" 4 } } */
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
#include "l_fma_3.h"
|
||||
|
||||
/* { dg-final { scan-assembler-times "vfmadd132ps" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmadd213ps" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmadd231ps" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmsub132ps" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmsub213ps" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfmsub231ps" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfnmadd132ps" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfnmadd231ps" 4 } } */
|
||||
/* { dg-final { scan-assembler-times "vfnmsub132ps" 4 } } */
|
||||
|
|
|
@ -2311,6 +2311,81 @@ vect_analyze_data_ref_access (struct data_reference *dr)
|
|||
return vect_analyze_group_access (dr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* A helper function used in the comparator function to sort data
|
||||
references. T1 and T2 are two data references to be compared.
|
||||
The function returns -1, 0, or 1. */
|
||||
|
||||
static int
|
||||
compare_tree (tree t1, tree t2)
|
||||
{
|
||||
int i, cmp;
|
||||
enum tree_code code;
|
||||
char tclass;
|
||||
|
||||
if (t1 == t2)
|
||||
return 0;
|
||||
if (t1 == NULL)
|
||||
return -1;
|
||||
if (t2 == NULL)
|
||||
return 1;
|
||||
|
||||
|
||||
if (TREE_CODE (t1) != TREE_CODE (t2))
|
||||
return TREE_CODE (t1) < TREE_CODE (t2) ? -1 : 1;
|
||||
|
||||
code = TREE_CODE (t1);
|
||||
switch (code)
|
||||
{
|
||||
/* For const values, we can just use hash values for comparisons. */
|
||||
case INTEGER_CST:
|
||||
case REAL_CST:
|
||||
case FIXED_CST:
|
||||
case STRING_CST:
|
||||
case COMPLEX_CST:
|
||||
case VECTOR_CST:
|
||||
{
|
||||
hashval_t h1 = iterative_hash_expr (t1, 0);
|
||||
hashval_t h2 = iterative_hash_expr (t2, 0);
|
||||
if (h1 != h2)
|
||||
return h1 < h2 ? -1 : 1;
|
||||
break;
|
||||
}
|
||||
|
||||
case SSA_NAME:
|
||||
cmp = compare_tree (SSA_NAME_VAR (t1), SSA_NAME_VAR (t2));
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
|
||||
if (SSA_NAME_VERSION (t1) != SSA_NAME_VERSION (t2))
|
||||
return SSA_NAME_VERSION (t1) < SSA_NAME_VERSION (t2) ? -1 : 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
tclass = TREE_CODE_CLASS (code);
|
||||
|
||||
/* For var-decl, we could compare their UIDs. */
|
||||
if (tclass == tcc_declaration)
|
||||
{
|
||||
if (DECL_UID (t1) != DECL_UID (t2))
|
||||
return DECL_UID (t1) < DECL_UID (t2) ? -1 : 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* For expressions with operands, compare their operands recursively. */
|
||||
for (i = TREE_OPERAND_LENGTH (t1) - 1; i >= 0; --i)
|
||||
{
|
||||
cmp = compare_tree (TREE_OPERAND (t1, i), TREE_OPERAND (t2, i));
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Compare two data-references DRA and DRB to group them into chunks
|
||||
suitable for grouping. */
|
||||
|
||||
|
@ -2319,7 +2394,6 @@ dr_group_sort_cmp (const void *dra_, const void *drb_)
|
|||
{
|
||||
data_reference_p dra = *(data_reference_p *)const_cast<void *>(dra_);
|
||||
data_reference_p drb = *(data_reference_p *)const_cast<void *>(drb_);
|
||||
hashval_t h1, h2;
|
||||
int cmp;
|
||||
|
||||
/* Stabilize sort. */
|
||||
|
@ -2329,19 +2403,17 @@ dr_group_sort_cmp (const void *dra_, const void *drb_)
|
|||
/* Ordering of DRs according to base. */
|
||||
if (!operand_equal_p (DR_BASE_ADDRESS (dra), DR_BASE_ADDRESS (drb), 0))
|
||||
{
|
||||
h1 = iterative_hash_expr (DR_BASE_ADDRESS (dra), 0);
|
||||
h2 = iterative_hash_expr (DR_BASE_ADDRESS (drb), 0);
|
||||
if (h1 != h2)
|
||||
return h1 < h2 ? -1 : 1;
|
||||
cmp = compare_tree (DR_BASE_ADDRESS (dra), DR_BASE_ADDRESS (drb));
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
}
|
||||
|
||||
/* And according to DR_OFFSET. */
|
||||
if (!dr_equal_offsets_p (dra, drb))
|
||||
{
|
||||
h1 = iterative_hash_expr (DR_OFFSET (dra), 0);
|
||||
h2 = iterative_hash_expr (DR_OFFSET (drb), 0);
|
||||
if (h1 != h2)
|
||||
return h1 < h2 ? -1 : 1;
|
||||
cmp = compare_tree (DR_OFFSET (dra), DR_OFFSET (drb));
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
}
|
||||
|
||||
/* Put reads before writes. */
|
||||
|
@ -2352,19 +2424,18 @@ dr_group_sort_cmp (const void *dra_, const void *drb_)
|
|||
if (!operand_equal_p (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dra))),
|
||||
TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (drb))), 0))
|
||||
{
|
||||
h1 = iterative_hash_expr (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dra))), 0);
|
||||
h2 = iterative_hash_expr (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (drb))), 0);
|
||||
if (h1 != h2)
|
||||
return h1 < h2 ? -1 : 1;
|
||||
cmp = compare_tree (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dra))),
|
||||
TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (drb))));
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
}
|
||||
|
||||
/* And after step. */
|
||||
if (!operand_equal_p (DR_STEP (dra), DR_STEP (drb), 0))
|
||||
{
|
||||
h1 = iterative_hash_expr (DR_STEP (dra), 0);
|
||||
h2 = iterative_hash_expr (DR_STEP (drb), 0);
|
||||
if (h1 != h2)
|
||||
return h1 < h2 ? -1 : 1;
|
||||
cmp = compare_tree (DR_STEP (dra), DR_STEP (drb));
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
}
|
||||
|
||||
/* Then sort after DR_INIT. In case of identical DRs sort after stmt UID. */
|
||||
|
|
Loading…
Add table
Reference in a new issue