diff options
author | Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp> | 2023-01-12 13:25:58 +0900 |
---|---|---|
committer | Max Filippov <jcmvbkbc@gmail.com> | 2023-01-12 04:44:06 -0800 |
commit | bb65bd084a8739feb5b85f87135c531fc8b86572 (patch) | |
tree | bc4b89e951591dc80211252ad4198caca507066e /gcc | |
parent | dc22cf461278ace754042d9388a62afb002dfa0e (diff) | |
download | gcc-bb65bd084a8739feb5b85f87135c531fc8b86572.zip gcc-bb65bd084a8739feb5b85f87135c531fc8b86572.tar.gz gcc-bb65bd084a8739feb5b85f87135c531fc8b86572.tar.bz2 |
xtensa: Tune "*btrue" insn pattern
This branch instruction has short encoding if EQ/NE comparison against
immediate zero when the Code Density Option is enabled, but its "length"
attribute was only for normal encoding. This patch fixes it.
This patch also prevents undesireable replacement the comparison immediate
zero of the instruction (short encoding, as mentioned above) with a
register that has value of zero (normal encoding) by the postreload pass.
gcc/ChangeLog:
* config/xtensa/xtensa.md (*btrue):
Correct value of the attribute "length" that depends on
TARGET_DENSITY and operands, and add '?' character to the register
constraint of the compared operand.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/xtensa/xtensa.md | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index db1d68e..b498983 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -1679,7 +1679,7 @@ [(set (pc) (if_then_else (match_operator 3 "branch_operator" [(match_operand:SI 0 "register_operand" "r,r") - (match_operand:SI 1 "branch_operand" "K,r")]) + (match_operand:SI 1 "branch_operand" "K,?r")]) (label_ref (match_operand 2 "" "")) (pc)))] "" @@ -1688,7 +1688,14 @@ } [(set_attr "type" "jump,jump") (set_attr "mode" "none") - (set_attr "length" "3,3")]) + (set (attr "length") + (if_then_else (match_test "TARGET_DENSITY + && CONST_INT_P (operands[1]) + && INTVAL (operands[1]) == 0 + && (GET_CODE (operands[3]) == EQ + || GET_CODE (operands[3]) == NE)") + (const_int 2) + (const_int 3)))]) (define_insn "*ubtrue" [(set (pc) |