On 7/21/2026 8:21 AM, Richard Sandiford wrote:
Richard Biener <[email protected]> writes:
The following adds simplification of a scalar mode vec_select wrapping
a vec_concat.  combine sees

(insn 7 4 8 2 (set (reg:V2DF 106)
         (vec_concat:V2DF (plus:DF (vec_select:DF (reg/v:V2DF 101 [ p ])
                     (parallel [
                             (const_int 0 [0])
                         ]))
                 (vec_select:DF (reg/v:V2DF 101 [ p ])
                     (parallel [
                             (const_int 1 [0x1])
                         ])))
             (plus:DF (vec_select:DF (reg/v:V2DF 101 [ p ])
                     (parallel [
                             (const_int 0 [0])
                         ]))
                 (vec_select:DF (reg/v:V2DF 101 [ p ])
                     (parallel [
                             (const_int 1 [0x1])
                         ]))))) "t.c":5:11 3234 {*sse3_haddv2df3}
      (expr_list:REG_DEAD (reg/v:V2DF 101 [ p ])
         (nil)))
(insn 8 7 9 2 (set (reg:DF 105)
         (vec_select:DF (reg:V2DF 106)
             (parallel [
                     (const_int 0 [0])
                 ]))) "t.c":5:11 7297 {sse2_storelpd}
      (expr_list:REG_DEAD (reg:V2DF 106)
         (nil)))

and this should simplify and combine to

(set (reg:DF 105)
     (plus:DF (vec_select:DF (reg:V2DF 109 [ p ])
             (parallel [
                     (const_int 0 [0])
                 ]))
         (vec_select:DF (reg:V2DF 109 [ p ])
             (parallel [
                     (const_int 1 [0x1])
                 ]))))

which x86 can recognize (but rejects due to consting, see PR126328).
There'll be test coverage in gcc.target/i386/pr54400.c

Bootstrapped and tested on x86_64-unknown-linux-gnu.

OK?
LGTM FWIW.
Likewise.

jeff

Reply via email to