This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[basic-improvements] Fix i386-sse-*.c testsuite failures
- From: Zack Weinberg <zack at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 5 Nov 2002 11:52:57 -0800
- Subject: [basic-improvements] Fix i386-sse-*.c testsuite failures
i386-sse-[123].c are failing on the basic-improvements branch with an
ICE in final.c:
In file included from i386-sse-1.c:12:
xmmintrin.h: In function `_mm_load_ss':
xmmintrin.h:768: internal compiler error: in final, at final.c:1615
The comment above that abort() reads:
/* This can be triggered by bugs elsewhere in the compiler if
new insns are created after init_insn_lengths is called. */
The failure can be narrowed down to any use of __builtin_ia32_loadss(),
which translates directly to the sse_loadss insn. The definition of
that insn is ... bizarre:
(define_insn "sse_loadss"
[(match_operand:V4SF 0 "register_operand" "=x")
(match_operand:SF 1 "memory_operand" "m")]
"TARGET_SSE"
{
emit_insn (gen_sse_loadss_1 (operands[0], operands[1],
CONST0_RTX (V4SFmode)));
})
Calling emit_insn from the output template of a define_insn (which
executes at final() time) will definitely create new insns after
init_insn_lengths is called. Further, the insn pattern is nonsensical -
a parallel containing nothing but two operands? To my unpracticed
eye this looks like it was intended to be a define_expand. Indeed,
changing it to read instead
(define_expand "sse_loadss"
[(match_operand:V4SF 0 "register_operand" "=x")
(match_operand:SF 1 "memory_operand" "m")]
"TARGET_SSE"
{
emit_insn (gen_sse_loadss_1 (operands[0], operands[1],
CONST0_RTX (V4SFmode)));
DONE;
})
fixes the bug.
On the mainline, sse_loadss is implemented differently, and does not
suffer from this bug.
I am running a full bootstrap, and will apply the appended patch as an
obvious fix if successful.
zw
* config/i386/i386.md (sse_loadss): Make it a define_expand.
Add missing DONE; to template.
===================================================================
Index: config/i386/i386.md
--- config/i386/i386.md 5 Nov 2002 19:12:02 -0000 1.380.4.20
+++ config/i386/i386.md 5 Nov 2002 19:50:51 -0000
@@ -18902,13 +18902,14 @@
[(set_attr "type" "ssecvt")
(set_attr "mode" "V4SF")])
-(define_insn "sse_loadss"
+(define_expand "sse_loadss"
[(match_operand:V4SF 0 "register_operand" "=x")
(match_operand:SF 1 "memory_operand" "m")]
"TARGET_SSE"
{
emit_insn (gen_sse_loadss_1 (operands[0], operands[1],
CONST0_RTX (V4SFmode)));
+ DONE;
})
(define_insn "sse_loadss_1"