One more fix for PR 91333 - suboptimal register allocation for inline asm

2020-02-02  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/91333
	* ira-color.c (struct allocno_color_data): Add member
	hard_reg_prefs.
	(init_allocno_threads): Set the member up.
	(bucket_allocno_compare_func): Add compare hard reg
	prefs.

2020-02-02  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/91333
	* gcc.target/i386/pr91333.c: Add vmovsd to regexp.  Set up count
	to 3.
This commit is contained in:
Vladimir N. Makarov 2020-02-02 11:23:25 -05:00
parent 0303907ea5
commit 897a73086b
4 changed files with 27 additions and 1 deletions

View File

@ -1,3 +1,12 @@
2020-02-02 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/91333
* ira-color.c (struct allocno_color_data): Add member
hard_reg_prefs.
(init_allocno_threads): Set the member up.
(bucket_allocno_compare_func): Add compare hard reg
prefs.
2020-01-31 Sandra Loosemore <sandra@codesourcery.com>
nios2: Support for GOT-relative DW_EH_PE_datarel encoding.

View File

@ -151,6 +151,8 @@ struct allocno_color_data
ira_allocno_t next_thread_allocno;
/* All thread frequency. Defined only for first thread allocno. */
int thread_freq;
/* Sum of frequencies of hard register preferences of the allocno. */
int hard_reg_prefs;
};
/* See above. */
@ -2173,6 +2175,7 @@ init_allocno_threads (void)
ira_allocno_t a;
unsigned int j;
bitmap_iterator bi;
ira_pref_t pref;
EXECUTE_IF_SET_IN_BITMAP (consideration_allocno_bitmap, 0, j, bi)
{
@ -2181,6 +2184,9 @@ init_allocno_threads (void)
ALLOCNO_COLOR_DATA (a)->first_thread_allocno
= ALLOCNO_COLOR_DATA (a)->next_thread_allocno = a;
ALLOCNO_COLOR_DATA (a)->thread_freq = ALLOCNO_FREQ (a);
ALLOCNO_COLOR_DATA (a)->hard_reg_prefs = 0;
for (pref = ALLOCNO_PREFS (a); pref != NULL; pref = pref->next_pref)
ALLOCNO_COLOR_DATA (a)->hard_reg_prefs += pref->freq;
}
}
@ -2251,6 +2257,11 @@ bucket_allocno_compare_func (const void *v1p, const void *v2p)
ira_allocno_t t2 = ALLOCNO_COLOR_DATA (a2)->first_thread_allocno;
int cl1 = ALLOCNO_CLASS (a1), cl2 = ALLOCNO_CLASS (a2);
/* Push allocnos with minimal hard_reg_prefs first. */
pref1 = ALLOCNO_COLOR_DATA (a1)->hard_reg_prefs;
pref2 = ALLOCNO_COLOR_DATA (a2)->hard_reg_prefs;
if ((diff = pref1 - pref2) != 0)
return diff;
/* Push allocnos with minimal conflict_allocno_hard_prefs first. */
pref1 = ALLOCNO_COLOR_DATA (a1)->conflict_allocno_hard_prefs;
pref2 = ALLOCNO_COLOR_DATA (a2)->conflict_allocno_hard_prefs;

View File

@ -1,3 +1,9 @@
2020-02-02 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/91333
* gcc.target/i386/pr91333.c: Add vmovsd to regexp. Set up count
to 3.
2020-01-31 Sandra Loosemore <sandra@codesourcery.com>
nios2: Support for GOT-relative DW_EH_PE_datarel encoding.

View File

@ -1,6 +1,6 @@
/* { dg-do compile { target x86_64-*-* } } */
/* { dg-options "-O2 -mavx" } */
/* { dg-final { scan-assembler-times "vmovapd" 2 } } */
/* { dg-final { scan-assembler-times "vmovapd|vmovsd" 3 } } */
static inline double g (double x){
asm volatile ("" : "+x" (x));