diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-03-01 22:31:52 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-03-01 22:31:52 +0000 |
commit | 066c8e94378ff486ba956acf609a8af246f45de6 (patch) | |
tree | ce9623d9e599375c8a302640e503ebd518fd6185 /gcc | |
parent | d3b819add225171c856bc64f9a15da90cf4976b7 (diff) | |
download | gcc-066c8e94378ff486ba956acf609a8af246f45de6.tar.gz |
PR rtl-optimization/70007
* gcse.c (compute_ld_motion_mems): Tidy up and also invalidate memory
references present in REG_EQUAL notes attached to non-SET patterns.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233867 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/gcse.c | 27 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr70007.c | 29 |
4 files changed, 56 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c1f25572590..982a7c05284 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-03-01 Eric Botcazou <ebotcazou@adacore.com> + + PR rtl-optimization/70007 + * gcse.c (compute_ld_motion_mems): Tidy up and also invalidate memory + references present in REG_EQUAL notes attached to non-SET patterns. + 2016-03-01 Jeff Law <law@redhat.com> PR tree-optimization/69196 diff --git a/gcc/gcse.c b/gcc/gcse.c index 51277a1cb61..a3a7dc31353 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -3796,10 +3796,8 @@ compute_ld_motion_mems (void) { rtx src = SET_SRC (PATTERN (insn)); rtx dest = SET_DEST (PATTERN (insn)); - rtx note = find_reg_equal_equiv_note (insn); - rtx src_eq; - /* Check for a simple LOAD... */ + /* Check for a simple load. */ if (MEM_P (src) && simple_mem (src)) { ptr = ldst_entry (src); @@ -3814,12 +3812,11 @@ compute_ld_motion_mems (void) invalidate_any_buried_refs (src); } - if (note != 0 && REG_NOTE_KIND (note) == REG_EQUAL) - src_eq = XEXP (note, 0); - else - src_eq = NULL_RTX; - - if (src_eq != NULL_RTX + /* Check for a simple load through a REG_EQUAL note. */ + rtx note = find_reg_equal_equiv_note (insn), src_eq; + if (note + && REG_NOTE_KIND (note) == REG_EQUAL + && (src_eq = XEXP (note, 0)) && !(MEM_P (src_eq) && simple_mem (src_eq))) invalidate_any_buried_refs (src_eq); @@ -3843,7 +3840,17 @@ compute_ld_motion_mems (void) } } else - invalidate_any_buried_refs (PATTERN (insn)); + { + /* Invalidate all MEMs in the pattern and... */ + invalidate_any_buried_refs (PATTERN (insn)); + + /* ...in REG_EQUAL notes for PARALLELs with single SET. */ + rtx note = find_reg_equal_equiv_note (insn), src_eq; + if (note + && REG_NOTE_KIND (note) == REG_EQUAL + && (src_eq = XEXP (note, 0))) + invalidate_any_buried_refs (src_eq); + } } } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ef8a9875d40..bdc4b1166e6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-03-01 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.target/i386/pr70007.c: New test. + 2016-03-01 Jeff Law <law@redhat.com> PR tree-optimization/69196 diff --git a/gcc/testsuite/gcc.target/i386/pr70007.c b/gcc/testsuite/gcc.target/i386/pr70007.c new file mode 100644 index 00000000000..6b457eecb30 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr70007.c @@ -0,0 +1,29 @@ +/* PR rtl-optimization/70007 */ +/* { dg-do run } */ +/* { dg-options "-O -fgcse -mbmi2" } */ +/* { dg-require-effective-target bmi2 } */ + +typedef unsigned short v32u16 __attribute__ ((vector_size (32))); +typedef unsigned long long v32u64 __attribute__ ((vector_size (32))); +typedef unsigned __int128 u128; +typedef unsigned __int128 v32u128 __attribute__ ((vector_size (32))); + +u128 +foo (v32u16 v32u16_0, v32u64 v32u64_0, v32u64 v32u64_1) +{ + do { + v32u16_0[13] |= v32u64_1[3] = (v32u64_1[3] >> 19) | (v32u64_1[3] << 45); + v32u64_1 %= ~v32u64_1; + v32u64_0 *= (v32u64) v32u16_0; + } while (v32u64_0[0]); + return v32u64_1[3]; +} + +int +main (void) +{ + u128 x = foo((v32u16){~0xba31, 0x47c6}, (v32u64){64}, (v32u64){0, 0x8b217e2514d23242, 0xac569b6dff9f82, 0x9d4cffe03c139c}); + if (x != 0x3c74da5ca328d09) + __builtin_abort(); + return 0; +} |