[backport gcc-4.9/trunk r201599 ] List-Archive: Date: Thu, 08 Aug 2013 14:49:53 +0100 From: Richard Earnshaw Subject: [PATCH, ARM] Fix ICE when using Neon vld1_dup_[su]64() PR 57431 is an ICE when compiling for Neon intrinsics. For completeness vld1_dup_u64 is defined to fill a single element vector from a single element of data, but this is in reality degenerate. Unfortunately, by expanding this into a vec_duplicate operation we confuse the mid-end of the compiler, since it expects a vector mode to result from the duplicate operation. The fix is to special-case the expand into the appropriate direct load operation and to then simplify the logic for the remaining cases (which now really are all duplicate operations). gcc/ 2013-08-08 Richard Earnshaw PR target/57431 * arm/neon.md (neon_vld1_dupdi): New expand pattern. (neon_vld1_dup VD iterator): Iterate over VD not VDX. --- gcc-4.8.1/gcc/config/arm/neon.md.~1~ 2013-04-04 16:34:01.000000000 +0200 +++ gcc-4.8.1/gcc/config/arm/neon.md 2013-08-10 14:02:03.391547951 +0200 @@ -4636,19 +4636,20 @@ (define_insn "neon_vld1_lane" ) (define_insn "neon_vld1_dup" - [(set (match_operand:VDX 0 "s_register_operand" "=w") - (vec_duplicate:VDX (match_operand: 1 "neon_struct_operand" "Um")))] + [(set (match_operand:VD 0 "s_register_operand" "=w") + (vec_duplicate:VD (match_operand: 1 "neon_struct_operand" "Um")))] "TARGET_NEON" -{ - if (GET_MODE_NUNITS (mode) > 1) - return "vld1.\t{%P0[]}, %A1"; - else - return "vld1.\t%h0, %A1"; -} - [(set (attr "neon_type") - (if_then_else (gt (const_string "") (const_string "1")) - (const_string "neon_vld2_2_regs_vld1_vld2_all_lanes") - (const_string "neon_vld1_1_2_regs")))] + "vld1.\t{%P0[]}, %A1" + [(set_attr "neon_type" "neon_vld2_2_regs_vld1_vld2_all_lanes")] +) + +;; Special case for DImode. Treat it exactly like a simple load. +(define_expand "neon_vld1_dupdi" + [(set (match_operand:DI 0 "s_register_operand" "") + (unspec:DI [(match_operand:DI 1 "neon_struct_operand" "")] + UNSPEC_VLD1))] + "TARGET_NEON" + "" ) (define_insn "neon_vld1_dup"