diff options
author | Vladimir N. Makarov <vmakarov@redhat.com> | 2020-10-09 10:01:13 -0400 |
---|---|---|
committer | Vladimir N. Makarov <vmakarov@redhat.com> | 2020-10-09 10:12:42 -0400 |
commit | bb37ad8cc0fc937c7afcdab471e5d65d176041c3 (patch) | |
tree | a126d0293338cc16ceaadee8a11520a37ca6c63e /gcc | |
parent | 98c37d3bacbb2f8bbbe56ed53a9547d3be01b66b (diff) | |
download | gcc-bb37ad8cc0fc937c7afcdab471e5d65d176041c3.zip gcc-bb37ad8cc0fc937c7afcdab471e5d65d176041c3.tar.gz gcc-bb37ad8cc0fc937c7afcdab471e5d65d176041c3.tar.bz2 |
Don't keep strict_low_part in reloads for non-registers. [PR97313]
gcc/ChangeLog:
2020-10-09 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/97313
* lra-constraints.c (match_reload): Don't keep strict_low_part in
reloads for non-registers.
gcc/testsuite/ChangeLog:
2020-10-09 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/97313
* gcc.target/i386/pr97313.c: New.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/lra-constraints.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr97313.c | 24 |
2 files changed, 30 insertions, 1 deletions
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index 301c912..f761d7d 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -1132,8 +1132,13 @@ match_reload (signed char out, signed char *ins, signed char *outs, narrow_reload_pseudo_class (out_rtx, goal_class); if (find_reg_note (curr_insn, REG_UNUSED, out_rtx) == NULL_RTX) { + reg = SUBREG_P (out_rtx) ? SUBREG_REG (out_rtx) : out_rtx; start_sequence (); - if (out >= 0 && curr_static_id->operand[out].strict_low) + /* If we had strict_low_part, use it also in reload to keep other + parts unchanged but do it only for regs as strict_low_part + has no sense for memory and probably there is no insn pattern + to match the reload insn in memory case. */ + if (out >= 0 && curr_static_id->operand[out].strict_low && REG_P (reg)) out_rtx = gen_rtx_STRICT_LOW_PART (VOIDmode, out_rtx); lra_emit_move (out_rtx, copy_rtx (new_out_reg)); emit_insn (*after); diff --git a/gcc/testsuite/gcc.target/i386/pr97313.c b/gcc/testsuite/gcc.target/i386/pr97313.c new file mode 100644 index 0000000..ef93cf1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr97313.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fPIE" } */ + +typedef struct { + int unspecified : 1; + int secure : 1; +} MemTxAttrs; + +enum { MSCAllowNonSecure } tz_msc_read_pdata; + +int tz_msc_read_s_0; +int tz_msc_check(); +int address_space_ldl_le(); + +void tz_msc_read(MemTxAttrs attrs) { + int as = tz_msc_read_s_0; + long long data; + switch (tz_msc_check()) { + case MSCAllowNonSecure: + attrs.secure = attrs.unspecified = 0; + data = address_space_ldl_le(as, attrs); + } + tz_msc_read_pdata = data; +} |