https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122716

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tamar Christina <[email protected]>:

https://gcc.gnu.org/g:b1637e3f5aa0fe6ce39b24fac904e5f1d52e7581

commit r17-6831-gb1637e3f5aa0fe6ce39b24fac904e5f1d52e7581
Author: Tamar Christina <[email protected]>
Date:   Mon Nov 30 08:21:19 2026 +0000

    aarch64: use multi-character print operands for endian SIMD lanes
[PR122716]

    A number of Advanced SIMD patterns had C output blocks whose only job was
to
    convert an immediate lane number into architectural lane order before
printing
    it.  The actual assembler template was otherwise fixed.

    For example, a pattern could want to print a lane selected by operand 2,
but the
    printed lane depends on the number of lanes in the vector and on
endianness.
    Before this patch each pattern had to do that calculation itself before
    returning the asm string.

    This patch adds an internal named print operand for that operation:

      %[ENDIAN_LANE:1,2]

    Operand 1 supplies the register mode and operand 2 supplies the lane.  The
    AArch64 print hook gets the lane count from that mode, applies
ENDIAN_LANE_N in
    one place, and prints the adjusted lane number.

    That lets many patterns become plain output templates again, e.g.:

      dup\t%0.<Vtype>, %1.<Vetype>[%[ENDIAN_LANE:1,2]]

    The explicit-count forms, such as ENDIAN_LANE4, are still used where the
lane
    count does not match the register mode, such as the grouped lanes in FCMLA
and
    dot-product instructions.

    The tests check little- and big-endian output, including cases where the
source
    and destination vectors have different widths.

    The modifier is internal-only.  It is just a machine-description helper for
    printing the same lane numbers that the old C blocks printed.

    gcc/ChangeLog:

            PR target/122716
            * config/aarch64/aarch64-print-operands.def (endian_lane,
            ENDIAN_LANE, ENDIAN_LANE1, ENDIAN_LANE2, ENDIAN_LANE4,
ENDIAN_LANE8,
            ENDIAN_LANE16): New definitions.
            * config/aarch64/aarch64.cc (aarch64_print_operand): Print endian
lanes
            using the register mode or an explicit lane count.
            * config/aarch64/aarch64-simd.md
            (@aarch64_dup_lane<mode>): Use the ENDIAN_LANE modifiers.
            (@aarch64_dup_lane_<vswap_width_name><mode>): Likewise.
            (aarch64_fcmla_laneq<rot>v4hf<vczle><vczbe>): Likewise.
            (aarch64_<sur>dot_lane<vsi2qi><vczle><vczbe>): Likewise.
            (aarch64_<sur>dot_laneq<vsi2qi><vczle><vczbe>): Likewise.
           
(aarch64_<DOTPROD_I8MM:sur>dot_lane<VB:isquadop><VS:vsi2qi><vczle><vczbe>):
            Likewise.
            (sdot_lane<VF:isquadop><VDQSF:vsi2qi><vczle><vczbe>): Likewise.
            (mul_lane<mode>3): Likewise.
            (mul_laneq<mode>3): Likewise.
            (*aarch64_mul3_elt_to_64v2df): Likewise.
            (*aarch64_mla_elt<mode><vczle><vczbe>): Likewise.
            (*aarch64_mla_elt_<vswap_width_name><mode><vczle><vczbe>):
            Likewise.
            (*aarch64_mls_elt<mode><vczle><vczbe>): Likewise.
            (*aarch64_mls_elt_<vswap_width_name><mode><vczle><vczbe>):
            Likewise.
            (aarch64_vec_<su>mult_lane<Qlane>): Likewise.
            (aarch64_<su>mull_hi_lane<mode>_insn): Likewise.
            (aarch64_<su>mull_hi_laneq<mode>_insn): Likewise.
            (aarch64_vec_<su>mlal_lane<Qlane>): Likewise.
            (aarch64_<su>mlal_hi_lane<mode>_insn): Likewise.
            (aarch64_<su>mlal_hi_laneq<mode>_insn): Likewise.
            (aarch64_vec_<su>mlsl_lane<Qlane>): Likewise.
            (aarch64_<su>mlsl_hi_lane<mode>_insn): Likewise.
            (aarch64_<su>mlsl_hi_laneq<mode>_insn): Likewise.
            (*aarch64_fma4_elt<mode><vczle><vczbe>): Likewise.
            (*aarch64_fma4_elt_<vswap_width_name><mode><vczle><vczbe>):
            Likewise.
            (*aarch64_fma<mode>4_elt_to_scalar): Likewise.
            (*aarch64_fnma4_elt<mode><vczle><vczbe>): Likewise.
            (*aarch64_fnma4_elt<mode><vczle><vczbe>_alt): Likewise.
            (*aarch64_fnma4_elt_<vswap_width_name><mode><vczle><vczbe>):
            Likewise.
            (*aarch64_fnma4_elt_<vswap_width_name><mode><vczle><vczbe>_alt):
            Likewise.
            (*aarch64_fnma<mode>4_elt_to_scalar): Likewise.
            (*aarch64_fnma<mode>4_elt_to_scalar_alt): Likewise.
            (*aarch64_get_lane_extend<GPI:mode><VDQQH:mode>): Likewise.
            (*aarch64_get_lane_zero_extend<GPI:mode><VDQQH:mode>): Likewise.
            (@aarch64_get_lane<mode>): Likewise.
            (*aarch64_mulx_elt_<vswap_width_name><mode>): Likewise.
            (*aarch64_mulx_elt<mode>): Likewise.
            (*aarch64_vgetfmulx<mode>): Likewise.
            (aarch64_sq<r>dmulh_lane<mode><vczle><vczbe>): Likewise.
            (aarch64_sq<r>dmulh_laneq<mode><vczle><vczbe>): Likewise.
            (aarch64_sq<r>dmulh_lane<mode>): Likewise.
            (aarch64_sq<r>dmulh_laneq<mode>): Likewise.
            (aarch64_sqrdml<SQRDMLH_AS:rdma_as>h_lane<mode><vczle><vczbe>):
            Likewise in all definitions.
            (aarch64_sqrdml<SQRDMLH_AS:rdma_as>h_laneq<mode><vczle><vczbe>):
            Likewise in all definitions.
            (aarch64_sqdmlal_lane<mode>): Likewise in all definitions.
            (aarch64_sqdmlsl_lane<mode>): Likewise in all definitions.
            (aarch64_sqdmlsl_laneq<mode>): Likewise in all definitions.
            (aarch64_sqdmlal_laneq<mode>): Likewise in all definitions.
            (aarch64_sqdmlsl2_lane<mode>_internal): Likewise.
            (aarch64_sqdmlal2_lane<mode>_internal): Likewise.
            (aarch64_sqdmlsl2_laneq<mode>_internal): Likewise.
            (aarch64_sqdmlal2_laneq<mode>_internal): Likewise.
            (aarch64_sqdmull_lane<mode>): Likewise in all definitions.
            (aarch64_sqdmull_laneq<mode>): Likewise in all definitions.
            (aarch64_sqdmull2_lane<mode>_internal): Likewise.
            (aarch64_sqdmull2_laneq<mode>_internal): Likewise.
            (aarch64_vec_stl1_lanes<mode>_lane<Vel>): Likewise.
            (aarch64_vec_ldap1_lanes<mode>_lane<Vel>): Likewise.
            (aarch64_bfdot_lane<VBF:isquadop><VDQSF:mode>): Likewise.
            (aarch64_bfmlal<bt>_lane<q>v4sf): Likewise.
            (@aarch64_<insn>_lane<V8HF_ONLY:mode><VB:mode>): Likewise.
            (@aarch64_<insn>_lane<V4SF_ONLY:mode><VB:mode>): Likewise.
            * config/aarch64/iterators.md (vswap_width_nunits): New mode
attribute.
            (dot_lane_count): Likewise.

    gcc/testsuite/ChangeLog:

            PR target/122716
            * gcc.target/aarch64/asm-named-operand-modifier-invalid.c: Use
            ENDIAN_LANE.
            * gcc.target/aarch64/named-operand-lanes-be.c: New test.
            * gcc.target/aarch64/named-operand-lanes-le.c: Likewise.
            * gcc.target/aarch64/named-operand-lanes.h: New file.

Reply via email to