diff options
author | Roger Sayle <roger@nextmovesoftware.com> | 2022-07-09 09:07:18 +0100 |
---|---|---|
committer | Roger Sayle <roger@nextmovesoftware.com> | 2022-07-09 09:07:18 +0100 |
commit | b434c94bf7a5d4bb9ca8f0b5442ca85b43f32a9a (patch) | |
tree | 3d69b4f99a965587e364d51b132cb228c2d16cc4 | |
parent | 002d81affa8a4e625993d3c9c7840ca4aba9750c (diff) | |
download | gcc-b434c94bf7a5d4bb9ca8f0b5442ca85b43f32a9a.zip gcc-b434c94bf7a5d4bb9ca8f0b5442ca85b43f32a9a.tar.gz gcc-b434c94bf7a5d4bb9ca8f0b5442ca85b43f32a9a.tar.bz2 |
Improve preservation of FLAGS_REG mode in i386.md's peephole2s.
The patch tweaks several peephole2s in i386.md that propagate the flags
register, but take its mode from the SET_SRC rather than preserve the
mode of the original SET_DEST. This encounters problems when the
SET_SRC is a VOIDmode CONST_INT. Fixed by using match_operand with a
flags_reg_operand predicate.
2022-07-09 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* config/i386/i386.md (define_peephole2): Use match_operand of
flags_reg_operand to capture and preserve the mode of FLAGS_REG.
(define_peephole2): Likewise.
(define_peephole2): Likewise...
-rw-r--r-- | gcc/config/i386/i386.md | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index bdde577..3b02d0c 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -15220,7 +15220,7 @@ ;; Convert setcc + movzbl to xor + setcc if operands don't overlap. (define_peephole2 - [(set (reg FLAGS_REG) (match_operand 0)) + [(set (match_operand 4 "flags_reg_operand") (match_operand 0)) (set (match_operand:QI 1 "register_operand") (match_operator:QI 2 "ix86_comparison_operator" [(reg FLAGS_REG) (const_int 0)])) @@ -15234,13 +15234,12 @@ (set (strict_low_part (match_dup 5)) (match_dup 2))] { - operands[4] = gen_rtx_REG (GET_MODE (operands[0]), FLAGS_REG); operands[5] = gen_lowpart (QImode, operands[3]); ix86_expand_clear (operands[3]); }) (define_peephole2 - [(parallel [(set (reg FLAGS_REG) (match_operand 0)) + [(parallel [(set (match_operand 5 "flags_reg_operand") (match_operand 0)) (match_operand 4)]) (set (match_operand:QI 1 "register_operand") (match_operator:QI 2 "ix86_comparison_operator" @@ -15258,14 +15257,13 @@ (set (strict_low_part (match_dup 6)) (match_dup 2))] { - operands[5] = gen_rtx_REG (GET_MODE (operands[0]), FLAGS_REG); operands[6] = gen_lowpart (QImode, operands[3]); ix86_expand_clear (operands[3]); }) (define_peephole2 - [(set (reg FLAGS_REG) (match_operand 0)) - (parallel [(set (reg FLAGS_REG) (match_operand 1)) + [(set (match_operand 6 "flags_reg_operand") (match_operand 0)) + (parallel [(set (match_operand 7 "flags_reg_operand") (match_operand 1)) (match_operand 5)]) (set (match_operand:QI 2 "register_operand") (match_operator:QI 3 "ix86_comparison_operator" @@ -15286,8 +15284,6 @@ (set (strict_low_part (match_dup 8)) (match_dup 3))] { - operands[6] = gen_rtx_REG (GET_MODE (operands[0]), FLAGS_REG); - operands[7] = gen_rtx_REG (GET_MODE (operands[1]), FLAGS_REG); operands[8] = gen_lowpart (QImode, operands[4]); ix86_expand_clear (operands[4]); }) @@ -15295,7 +15291,7 @@ ;; Similar, but match zero extend with andsi3. (define_peephole2 - [(set (reg FLAGS_REG) (match_operand 0)) + [(set (match_operand 4 "flags_reg_operand") (match_operand 0)) (set (match_operand:QI 1 "register_operand") (match_operator:QI 2 "ix86_comparison_operator" [(reg FLAGS_REG) (const_int 0)])) @@ -15309,13 +15305,12 @@ (set (strict_low_part (match_dup 5)) (match_dup 2))] { - operands[4] = gen_rtx_REG (GET_MODE (operands[0]), FLAGS_REG); operands[5] = gen_lowpart (QImode, operands[3]); ix86_expand_clear (operands[3]); }) (define_peephole2 - [(parallel [(set (reg FLAGS_REG) (match_operand 0)) + [(parallel [(set (match_operand 5 "flags_reg_operand") (match_operand 0)) (match_operand 4)]) (set (match_operand:QI 1 "register_operand") (match_operator:QI 2 "ix86_comparison_operator" @@ -15334,14 +15329,13 @@ (set (strict_low_part (match_dup 6)) (match_dup 2))] { - operands[5] = gen_rtx_REG (GET_MODE (operands[0]), FLAGS_REG); operands[6] = gen_lowpart (QImode, operands[3]); ix86_expand_clear (operands[3]); }) (define_peephole2 - [(set (reg FLAGS_REG) (match_operand 0)) - (parallel [(set (reg FLAGS_REG) (match_operand 1)) + [(set (match_operand 6 "flags_reg_operand") (match_operand 0)) + (parallel [(set (match_operand 7 "flags_reg_operand") (match_operand 1)) (match_operand 5)]) (set (match_operand:QI 2 "register_operand") (match_operator:QI 3 "ix86_comparison_operator" @@ -15363,8 +15357,6 @@ (set (strict_low_part (match_dup 8)) (match_dup 3))] { - operands[6] = gen_rtx_REG (GET_MODE (operands[0]), FLAGS_REG); - operands[7] = gen_rtx_REG (GET_MODE (operands[1]), FLAGS_REG); operands[8] = gen_lowpart (QImode, operands[4]); ix86_expand_clear (operands[4]); }) |