This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, i386]: Fix PR target/39482
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 17 Mar 2009 19:55:45 +0100
- Subject: [PATCH, i386]: Fix PR target/39482
Hello!
According to the comment above inline_secondary_memory_needed:
<quote>
The macro can't work reliably when one of the CLASSES is class containing
registers from multiple units (SSE, MMX, integer). We avoid this by
never
combining those units in single alternative in the machine description.
Ensure that this constraint holds to avoid unexpected surprises.
</quote>
Several constraints in the insn patterns still violate this requirement.
Attached patch fixes this oversight.
2009-03-17 Uros Bizjak <ubizjak@gmail.com>
PR target/39482
* config/i386/i386.md (*truncdfsf_mixed): Avoid combining registers
from different units in a single alternative.
(*truncdfsf_i387): Ditto.
(*truncxfsf2_mixed): Ditto.
(*truncxfdf2_mixed): Ditto.
testsuite/ChangeLog:
PR target/39482
* gcc.target/i386/pr39482.c: New test.
Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu
{,-m32}. Patch is committed to mainline SVN and will be committed to
gcc-4.3 branch after some days.
Uros.
Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md (revision 144907)
+++ config/i386/i386.md (working copy)
@@ -4458,35 +4458,33 @@
(set_attr "mode" "SF")])
(define_insn "*truncdfsf_mixed"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?fx*r,Y2")
+ [(set (match_operand:SF 0 "nonimmediate_operand" "=m,Y2 ,?f,?x,?*r")
(float_truncate:SF
- (match_operand:DF 1 "nonimmediate_operand" "f ,f ,Y2m")))
- (clobber (match_operand:SF 2 "memory_operand" "=X,m ,X"))]
+ (match_operand:DF 1 "nonimmediate_operand" "f ,Y2m,f ,f ,f")))
+ (clobber (match_operand:SF 2 "memory_operand" "=X,X ,m ,m ,m"))]
"TARGET_MIX_SSE_I387"
{
switch (which_alternative)
{
case 0:
return output_387_reg_move (insn, operands);
-
case 1:
- return "#";
- case 2:
return "%vcvtsd2ss\t{%1, %d0|%d0, %1}";
+
default:
- gcc_unreachable ();
+ return "#";
}
}
- [(set_attr "type" "fmov,multi,ssecvt")
- (set_attr "unit" "*,i387,*")
- (set_attr "prefix" "orig,orig,maybe_vex")
+ [(set_attr "type" "fmov,ssecvt,multi,multi,multi")
+ (set_attr "unit" "*,*,i387,i387,i387")
+ (set_attr "prefix" "orig,maybe_vex,orig,orig,orig")
(set_attr "mode" "SF")])
(define_insn "*truncdfsf_i387"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?fx*r")
+ [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?f,?x,?*r")
(float_truncate:SF
- (match_operand:DF 1 "nonimmediate_operand" "f,f")))
- (clobber (match_operand:SF 2 "memory_operand" "=X,m"))]
+ (match_operand:DF 1 "nonimmediate_operand" "f ,f ,f ,f")))
+ (clobber (match_operand:SF 2 "memory_operand" "=X,m ,m ,m"))]
"TARGET_80387"
{
switch (which_alternative)
@@ -4494,14 +4492,12 @@
case 0:
return output_387_reg_move (insn, operands);
- case 1:
- return "#";
default:
- gcc_unreachable ();
+ return "#";
}
}
- [(set_attr "type" "fmov,multi")
- (set_attr "unit" "*,i387")
+ [(set_attr "type" "fmov,multi,multi,multi")
+ (set_attr "unit" "*,i387,i387,i387")
(set_attr "mode" "SF")])
(define_insn "*truncdfsf2_i387_1"
@@ -4552,31 +4548,31 @@
})
(define_insn "*truncxfsf2_mixed"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?fx*r")
+ [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?f,?x,?*r")
(float_truncate:SF
- (match_operand:XF 1 "register_operand" "f,f")))
- (clobber (match_operand:SF 2 "memory_operand" "=X,m"))]
+ (match_operand:XF 1 "register_operand" "f ,f ,f ,f")))
+ (clobber (match_operand:SF 2 "memory_operand" "=X,m ,m ,m"))]
"TARGET_80387"
{
gcc_assert (!which_alternative);
return output_387_reg_move (insn, operands);
}
- [(set_attr "type" "fmov,multi")
- (set_attr "unit" "*,i387")
+ [(set_attr "type" "fmov,multi,multi,multi")
+ (set_attr "unit" "*,i387,i387,i387")
(set_attr "mode" "SF")])
(define_insn "*truncxfdf2_mixed"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=m,?fY2*r")
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=m,?f,?Y2,?*r")
(float_truncate:DF
- (match_operand:XF 1 "register_operand" "f,f")))
- (clobber (match_operand:DF 2 "memory_operand" "=X,m"))]
+ (match_operand:XF 1 "register_operand" "f ,f ,f ,f")))
+ (clobber (match_operand:DF 2 "memory_operand" "=X,m ,m ,m"))]
"TARGET_80387"
{
gcc_assert (!which_alternative);
return output_387_reg_move (insn, operands);
}
- [(set_attr "type" "fmov,multi")
- (set_attr "unit" "*,i387")
+ [(set_attr "type" "fmov,multi,multi,multi")
+ (set_attr "unit" "*,i387,i387,i387")
(set_attr "mode" "DF")])
(define_insn "truncxf<mode>2_i387_noop"
Index: testsuite/gcc.target/i386/pr39482.c
===================================================================
--- testsuite/gcc.target/i386/pr39482.c (revision 0)
+++ testsuite/gcc.target/i386/pr39482.c (revision 0)
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-mno-sse2" } */
+
+extern double log (double __x);
+
+double foo (unsigned long int m_liOutputBufferLen)
+{
+ return log ((double) m_liOutputBufferLen);
+}