[PATCH][PPC] Fix ICE using power9 with soft-float
Andrew Stubbs
ams@codesourcery.com
Mon Nov 14 16:58:00 GMT 2016
The testcase powerpc/fusion3.c causes an ICE when compiled with
-msoft-float.
The key line in the testcase looks fairly harmless:
void fusion_float_write (float *p, float f){ p[LARGE] = f; }
The error message look like this:
.../gcc.target/powerpc/fusion3.c: In function 'fusion_float_write':^M
.../gcc.target/powerpc/fusion3.c:12:1: error: unrecognizable insn:^M
(insn 18 4 14 2 (parallel [^M
(set (mem:SF (plus:SI (plus:SI (reg:SI 3 3 [ p ])^M
(const_int 327680 [0x50000]))^M
(const_int -29420 [0xffffffffffff8d14])) [1
MEM[(float *)p_1(D) + 298260B]+0 S4 A32])^M
(unspec:SF [^M
(reg:SF 4 4 [ f ])^M
] UNSPEC_FUSION_P9))^M
(clobber (reg/f:SI 3 3 [157]))^M
])
"/scratch/astubbs/fsf/src/gcc-mainline/gcc/testsuite/gcc.target/powerpc/fusion3.c":12
-1^M
(nil))^M
Basically, the problem is that the peephole optimization tries to create
a Power9 Fusion instruction, but those do not support SF values in
integer registers (AFAICT).
So, presumably, I need to adjust either the predicate or the condition
of the peephole rules.
The predicate used is "toc_fusion_or_p9_reg_operand", and this might be
the root cause, but I don't know the architecture well enough to be
sure. The predicate code seems to suggest that "toc_fusion", whatever
that is, should be able to do this, but the insn produced by the
peephole uses only UNSPEC_FUSION_P9, which does not. Perhaps this
predicate is inappropriate for the P9 Fusion peephole, or perhaps it
needs to be taught about this corner case?
In any case, I don't want to change the predicate without being sure
what it does (here and elsewhere), so the attached patch solves the
problem by changing the condition.
Is this OK, or do I need to do something less blunt?
Thanks
Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ppc-p9-fusion-soft-float.patch
Type: text/x-patch
Size: 2567 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161114/6ba23670/attachment.bin>
More information about the Gcc-patches
mailing list