I believe after r242950 in combine we started seeing some ICEs in some __fp16 tests on aarch64: FAIL: gcc.target/aarch64/advsimd-intrinsics/vget_lane.c bad.c: In function 'fn1': bad.c:8:1: internal compiler error: in gen_rtx_SUBREG, at emit-rtl.c:908 } ^ 0x7fd144 gen_rtx_SUBREG(machine_mode, rtx_def*, int) $SRC/gcc/emit-rtl.c:908 0x7fd183 gen_lowpart_SUBREG(machine_mode, rtx_def*) $SRC/gcc/emit-rtl.c:924 0x10e46f5 change_zero_ext $SRC/gcc/combine.c:11259 0x10e4ca8 recog_for_combine $SRC/gcc/combine.c:11345 0x10f0764 try_combine $SRC/gcc/combine.c:3501 0x10f4c7f combine_instructions $SRC/gcc/combine.c:1265 0x10f4c7f rest_of_handle_combine $SRC/gcc/combine.c:14580 0x10f4c7f execute $SRC/gcc/combine.c:14625 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. A reduced reproducer is: int a; int fn2 (); void fn3 (); void fn1() { __fp16 b = fn2(); if (*(unsigned short *)&b != a) fn3(); } ICEs at -O1 on aarch64
In the call: x = gen_lowpart_SUBREG (mode, x); the x is: (float_truncate:HF (reg:DF 79)) and mode is SImode.
I suspect we want to extend the && !paradoxical_subreg_p (XEXP (x, 0)) check to also check REG_P (SUBREG_REG (XEXP (x, 0))). The pattern processed in this case is: (set (reg:SI 80) (zero_extend:SI (subreg:HI (float_truncate:HF (reg:DF 79)) 0)))
Author: segher Date: Wed Nov 30 08:24:59 2016 New Revision: 242999 URL: https://gcc.gnu.org/viewcvs?rev=242999&root=gcc&view=rev Log: combine: Don't mess with subregs of floating point (PR78590) PR78590 shows a problem in change_zero_ext, where we change a zero_extend of a subreg to a logical and. We should only do this if the thing we are taking the subreg of is a scalar integer, otherwise we will take a subreg of (e.g.) a float in a different size, which is nonsensical and hits an assert. PR rtl-optimization/78590 * combine.c (change_zero_ext): Transform zero_extend of subregs only if the subreg_reg is a scalar integer mode. Modified: trunk/gcc/ChangeLog trunk/gcc/combine.c
Fixed.