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

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2026-05-04

--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
combine forms:
(insn 8 7 9 2 (set (reg:CCZ 17 flags)
        (compare:CCZ (zero_extract:SI (mem/v:SI (reg/f:DI 102 [ regD.2959 ]) [1
*reg_5(D)+0 S4 A32])
                (const_int 1 [0x1])
                (const_int 0 [0]))
            (const_int 0 [0]))) "/app/example.cpp":6:8 723 {*testqi_ext_3}
     (expr_list:REG_DEAD (reg/f:DI 102 [ regD.2959 ])
        (nil)))

Which then goes to:
(insn 19 7 9 2 (set (reg:CCZ 17 flags)
        (compare:CCZ (and:SI (mem/v:SI (reg/f:DI 102 [ regD.2959 ]) [1
*reg_5(D)+0 S4 A32])
                (const_int 1 [0x1]))
            (const_int 0 [0]))) "/app/example.cpp":6:8 714 {*testsi_1}
     (expr_list:REG_DEAD (reg/f:DI 102 [ regD.2959 ])
        (nil)))


And then split2 does:
(insn 21 7 9 2 (set (reg:CCZ 17 flags)
        (compare:CCZ (and:QI (mem/v:QI (reg/f:DI 5 di [orig:102 regD.2959 ]
[102]) [1 *reg_5(D)+0 S1 A32])
                (const_int 1 [0x1]))
            (const_int 0 [0]))) "/app/example.cpp":6:8 711 {*testqi_1_maybe_si}
     (nil))
via:
Splitting with gen_split_288 (i386.md:12766)

And that define_split checks volatile flag on the mem:
(define_split
  [(set (match_operand 0 "flags_reg_operand")
        (match_operator 1 "compare_operator"
          [(and (match_operand 2 "nonimmediate_operand")
                (match_operand 3 "const_int_operand"))
           (const_int 0)]))]
   "reload_completed
    && GET_MODE (operands[2]) != QImode
    && (!REG_P (operands[2]) || ANY_QI_REG_P (operands[2]))
    && ((ix86_match_ccmode (insn, CCZmode)
         && !(INTVAL (operands[3]) & ~255))
        || (ix86_match_ccmode (insn, CCNOmode)
            && !(INTVAL (operands[3]) & ~127)))"
  [(set (match_dup 0)
        (match_op_dup 1 [(and:QI (match_dup 2) (match_dup 3))
                         (const_int 0)]))]
{
  operands[2] = gen_lowpart (QImode, operands[2]);
  operands[3] = gen_int_mode (INTVAL (operands[3]), QImode);
})

Reply via email to