diff mbox

i386/sse.md:round<mode>2 skips operands[2] -> -O0 warning

Message ID or4lv8tk84.fsf@lxoliva.fsfla.org
State New
Headers show

Commit Message

Alexandre Oliva June 22, 2017, 10 a.m. UTC
[adding the list]

On Jun  8, 2017, Uros Bizjak <ubizjak@gmail.com> wrote:

> On Thu, Jun 8, 2017 at 9:22 PM, Alexandre Oliva <aoliva@redhat.com> wrote:
>> I was playing with bootstrap STAGE2_C{,XX}FLAGS='-O0 -fcompare-debug' to
>> test some changes I'm working on, and -Werror in stage2 prevented
>> compilation of one of the insn-*.c files.  That's because round<mode>2
>> doesn't have an operand 2.  The generated code for round<mode>2_sfix
>> calls the corresponding gen_round<mode>2, and then something in there
>> attempts to access the uninitialized operand, which the stage1 GCC warns
>> about and errors out because of -Werror.
>> 
>> I'll be glad to test and submit a patch for this, but I thought I'd ask
>> whether you'd prefer to leave this alone, to have it fixed it with a
>> minimal diff as below, or with a renumbering of all operands >=3 to >=2?

> These operands are already pretty weirdly numbered, so the below looks
> appropriate as well.

> The proposed patch is OK.

Thanks, I'm checking this in.  Regstrapped on x86_64-linux-gnu.

[i386] renumber operands to avoid gap

i386's round<mode>2 had a gap at operand 2, and so gen_round<mode>2
attempted to read from the uninitialized operand.  Building stage2
with -O0 errored out, though at higher optimization levels it compiled
successfully.  Fixed by renumbering the last operand into the gap.

for  gcc/ChangeLog

	* config/i386/sse.md (round<mode>2): Renumber operand into gap.
---
 gcc/config/i386/sse.md |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jakub Jelinek June 22, 2017, 10:06 a.m. UTC | #1
On Thu, Jun 22, 2017 at 07:00:59AM -0300, Alexandre Oliva wrote:
> [adding the list]
> 
> On Jun  8, 2017, Uros Bizjak <ubizjak@gmail.com> wrote:
> 
> > On Thu, Jun 8, 2017 at 9:22 PM, Alexandre Oliva <aoliva@redhat.com> wrote:
> >> I was playing with bootstrap STAGE2_C{,XX}FLAGS='-O0 -fcompare-debug' to
> >> test some changes I'm working on, and -Werror in stage2 prevented
> >> compilation of one of the insn-*.c files.  That's because round<mode>2
> >> doesn't have an operand 2.  The generated code for round<mode>2_sfix
> >> calls the corresponding gen_round<mode>2, and then something in there
> >> attempts to access the uninitialized operand, which the stage1 GCC warns
> >> about and errors out because of -Werror.
> >> 
> >> I'll be glad to test and submit a patch for this, but I thought I'd ask
> >> whether you'd prefer to leave this alone, to have it fixed it with a
> >> minimal diff as below, or with a renumbering of all operands >=3 to >=2?
> 
> > These operands are already pretty weirdly numbered, so the below looks
> > appropriate as well.
> 
> > The proposed patch is OK.
> 
> Thanks, I'm checking this in.  Regstrapped on x86_64-linux-gnu.

I bet it won't apply, I didn't know you were looking at this;
Martin Liska filed PR81151 recently and I've fixed it yesterday.

	Jakub
Alexandre Oliva June 22, 2017, 1:16 p.m. UTC | #2
On Jun 22, 2017, Jakub Jelinek <jakub@redhat.com> wrote:

> On Thu, Jun 22, 2017 at 07:00:59AM -0300, Alexandre Oliva wrote:
>> [adding the list]

>> Thanks, I'm checking this in.  Regstrapped on x86_64-linux-gnu.

> I bet it won't apply, I didn't know you were looking at this;
> Martin Liska filed PR81151 recently and I've fixed it yesterday.

Heh.  I'm surprised anyone else ran into this in the few weeks since I
did, in spite of the problem lingering there for much longer.  Sorry I
didn't post it sooner, it didn't look like a high priority.  The only
reason I posted it today was that I wanted to merge trunk into
lxoliva/SFN, where I hit the problem during some -O0 tests, and I
figured I'd put the patch in before the merge.  Indeed, when I updated
the tree for the merge, the patch would no longer apply.  What a
coincidence!  Thanks for fixing it!
diff mbox

Patch

diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 29a039d..68c4bbe 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -15644,7 +15644,7 @@ 
 	  (match_dup 3)))
    (set (match_operand:VF 0 "register_operand")
 	(unspec:VF
-	  [(match_dup 4) (match_dup 5)]
+	  [(match_dup 4) (match_dup 2)]
 	  UNSPEC_ROUND))]
   "TARGET_ROUND && !flag_trapping_math"
 {
@@ -15668,7 +15668,7 @@ 
   emit_insn (gen_copysign<mode>3 (operands[3], vec_half, operands[1]));
 
   operands[4] = gen_reg_rtx (<MODE>mode);
-  operands[5] = GEN_INT (ROUND_TRUNC);
+  operands[2] = GEN_INT (ROUND_TRUNC);
 })
 
 (define_expand "round<mode>2_sfix"