From: Jonathan Wright Date: Thu, 4 Mar 2021 12:36:09 +0000 (+0000) Subject: aarch64: Relax aarch64_qshrn2_n RTL pattern X-Git-Tag: upstream/12.2.0~7782 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e26303e0b90038473e3d7490dc0369a74866b1b;p=platform%2Fupstream%2Fgcc.git aarch64: Relax aarch64_qshrn2_n RTL pattern Implement saturating right-shift and narrow high Neon intrinsic RTL patterns using a vec_concat of a register_operand and a VQSHRN_N unspec - instead of just a VQSHRN_N unspec. This more relaxed pattern allows for more aggressive combinations and ultimately better code generation. gcc/ChangeLog: 2021-03-04 Jonathan Wright * config/aarch64/aarch64-simd.md (aarch64_qshrn2_n): Implement as an expand emitting a big/little endian instruction pattern. (aarch64_qshrn2_n_insn_le): Define. (aarch64_qshrn2_n_insn_be): Define. --- diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 1efc854..5473d61 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -6054,17 +6054,54 @@ [(set_attr "type" "neon_sat_shift_imm_narrow_q")] ) -(define_insn "aarch64_qshrn2_n" +(define_insn "aarch64_qshrn2_n_insn_le" [(set (match_operand: 0 "register_operand" "=w") - (unspec: [(match_operand: 1 "register_operand" "0") - (match_operand:VQN 2 "register_operand" "w") - (match_operand:SI 3 "aarch64_simd_shift_imm_offset_" "i")] - VQSHRN_N))] - "TARGET_SIMD" + (vec_concat: + (match_operand: 1 "register_operand" "0") + (unspec: [(match_operand:VQN 2 "register_operand" "w") + (match_operand:VQN 3 + "aarch64_simd_shift_imm_vec_")] + VQSHRN_N)))] + "TARGET_SIMD && !BYTES_BIG_ENDIAN" "qshrn2\\t%0., %2., %3" [(set_attr "type" "neon_sat_shift_imm_narrow_q")] ) +(define_insn "aarch64_qshrn2_n_insn_be" + [(set (match_operand: 0 "register_operand" "=w") + (vec_concat: + (unspec: [(match_operand:VQN 2 "register_operand" "w") + (match_operand:VQN 3 + "aarch64_simd_shift_imm_vec_")] + VQSHRN_N) + (match_operand: 1 "register_operand" "0")))] + "TARGET_SIMD && BYTES_BIG_ENDIAN" + "qshrn2\\t%0., %2., %3" + [(set_attr "type" "neon_sat_shift_imm_narrow_q")] +) + +(define_expand "aarch64_qshrn2_n" + [(match_operand: 0 "register_operand") + (match_operand: 1 "register_operand") + (unspec: + [(match_operand:VQN 2 "register_operand") + (match_operand:SI 3 "aarch64_simd_shift_imm_offset_")] + VQSHRN_N)] + "TARGET_SIMD" + { + operands[3] = aarch64_simd_gen_const_vector_dup (mode, + INTVAL (operands[3])); + + if (BYTES_BIG_ENDIAN) + emit_insn (gen_aarch64_qshrn2_n_insn_be (operands[0], + operands[1], operands[2], operands[3])); + else + emit_insn (gen_aarch64_qshrn2_n_insn_le (operands[0], + operands[1], operands[2], operands[3])); + DONE; + } +) + ;; cm(eq|ge|gt|lt|le) ;; Note, we have constraints for Dz and Z as different expanders