https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61749
Bug ID: 61749 Summary: arm_neon.h "_lane" and "_n" intrinsics can cause ICEs Product: gcc Version: 4.8.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: jgreenhalgh at gcc dot gnu.org Given the following, all release branch and trunk AArch64 compilers will ICE trying to expand the intrinsic. #include "arm_neon.h" int32x4_t foo (int32x4_t a, int16x4_t b, int16x4_t c, int d) { return vqdmlal_lane_s16 (a, b, c, 0); } As so: /work/gcc-dev/build-aarch64-none-elf/install/lib/gcc/aarch64-none-elf/4.10.0/include/arm_neon.h: In function 'foo': /work/gcc-dev/build-aarch64-none-elf/install/lib/gcc/aarch64-none-elf/4.10.0/include/arm_neon.h:19294:10: internal compiler error: in aarch64_simd_lane_bounds, at config/aarch64/aarch64.c:7715 return __builtin_aarch64_sqdmlal_lanev4hi (__a, __b, __c, __d); ^ 0xc608d0 aarch64_simd_lane_bounds(rtx_def*, long, long) /work/gcc-dev/src/gcc/gcc/config/aarch64/aarch64.c:7715 0xcb0221 gen_aarch64_sqdmlal_lanev4hi(rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*) /work/gcc-dev/src/gcc/gcc/config/aarch64/aarch64-simd.md:3015 0xc65b7f insn_gen_fn::operator()(rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*) const /work/gcc-dev/src/gcc/gcc/recog.h:311 0xc65b7f aarch64_simd_expand_args /work/gcc-dev/src/gcc/gcc/config/aarch64/aarch64-builtins.c:888 0xc66318 aarch64_simd_expand_builtin(int, tree_node*, rtx_def*) /work/gcc-dev/src/gcc/gcc/config/aarch64/aarch64-builtins.c:990 0xc66968 aarch64_expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int) /work/gcc-dev/src/gcc/gcc/config/aarch64/aarch64-builtins.c:1071 0x6062a2 expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int) /work/gcc-dev/src/gcc/gcc/builtins.c:5756 0x6f897b expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) /work/gcc-dev/src/gcc/gcc/expr.c:10344 0x6f9e7c expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) /work/gcc-dev/src/gcc/gcc/expr.c:7922 0x70078f store_expr(tree_node*, rtx_def*, int, bool) /work/gcc-dev/src/gcc/gcc/expr.c:5312 0x7092b8 expand_assignment(tree_node*, tree_node*, bool) /work/gcc-dev/src/gcc/gcc/expr.c:5098 0x626493 expand_call_stmt /work/gcc-dev/src/gcc/gcc/cfgexpand.c:2305 0x626493 expand_gimple_stmt_1 /work/gcc-dev/src/gcc/gcc/cfgexpand.c:3202 0x626493 expand_gimple_stmt /work/gcc-dev/src/gcc/gcc/cfgexpand.c:3354 0x628d75 expand_gimple_basic_block /work/gcc-dev/src/gcc/gcc/cfgexpand.c:5192 0x62ad53 execute /work/gcc-dev/src/gcc/gcc/cfgexpand.c:5799 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. The bug is in the treatment in aarch64-simd-builtins.def of these lane intrinsics as "QUADOP"s. This allows their final parameter to *maybe* be an immediate. But subsequent code on the expand path assumes it to *always* be an immediate. The fix would to special case the handling of these intrinsics and enforce that the final parameter is *always* an immediate. For 4.10 and 4.9 that means adding a new set of types to "qualifiers". For 4.8, it means adding a new aarch64_simd_itype and handling it appropriately.