Bug 19307 - [4.0 Regression] ICE with -msse2 -mno-80387
Summary: [4.0 Regression] ICE with -msse2 -mno-80387
Status: RESOLVED WORKSFORME
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code, ssemmx
Depends on:
Blocks: 19379
  Show dependency treegraph
 
Reported: 2005-01-07 09:53 UTC by Uroš Bizjak
Modified: 2005-01-12 12:43 UTC (History)
1 user (show)

See Also:
Host: pentium4-pc-linux-gnu
Target: pentium4-pc-linux-gnu
Build: pentium4-pc-linux-gnu
Known to work: 3.4.0
Known to fail: 4.0.0
Last reconfirmed: 2005-01-07 14:05:02


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Uroš Bizjak 2005-01-07 09:53:18 UTC
This testcase:

double test (double a, double b) {
  double x;

  x = (a < b) ? a : 1.0;
  return x;
}

will ICE with '-O2 -mno-80387 -msse2':

cmove.c: In function âtestâ:
cmove.c:6: error: unrecognizable insn:
(insn 64 55 52 (parallel [
            (set (reg:XF 9 st(1))
                (reg:XF 8 st))
            (set (reg:XF 8 st)
                (reg:XF 9 st(1)))
        ]) -1 (nil)
    (nil))
cmove.c:6: internal compiler error: in insn_default_length, at insn-attrtab.c:408
Please submit a full bug report,

Without -msse2, there is no ICE, but code still uses FP regs.

test:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $24, %esp
        fldl    16(%ebp)
        fstpl   8(%esp)
        fldl    8(%ebp)
        fstpl   (%esp)
        call    __ltdf2
        fldl    8(%ebp)
        testl   %eax, %eax
        jns     .L8
        leave
        ret
        .p2align 4,,7
.L8:
        fstp    %st(0)
        leave
        fld1
        .p2align 4,,2
        ret
Comment 1 Andrew Pinski 2005-01-07 14:05:02 UTC
Confirmed, it had worked with 4.0.0 20041124 and 3.4.0 so this is a regression.
Comment 2 Andrew Pinski 2005-01-10 00:52:49 UTC
It also worked with 2004-12-11.
Comment 3 Richard Henderson 2005-01-12 00:19:56 UTC
And it works with today's compiler too.

As for the use of the 80387 move instructions, even with -mno-80387,
this isn't a regression.  At least 3.2 did this as well.  One could
argue that -msoft-float should imply -mno-fp-ret-in-387, but it doesn't.
Changing it now would be an ABI change that I'm not interested in making,
considering the lack of use this option gets.
Comment 4 Uroš Bizjak 2005-01-12 12:43:10 UTC
(In reply to comment #3)
> And it works with today's compiler too.

It works with '-O2 -mno-80387 -msse2 -mno-fp-ret-in-387', but without
-mno-fp-ret-in-387 it still fails. I think that the problem here is again SSE FP
compare that gets splitted to x87 compare, when the output value is returned in
x87 reg.