Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
Generate sext.[bh] for sign-extension under ZBB
Browse files Browse the repository at this point in the history
Signed-off-by: Romain Dolbeau <[email protected]>
  • Loading branch information
rdolbeau committed Jun 7, 2021
1 parent e6ccabf commit be58a66
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
13 changes: 13 additions & 0 deletions gcc/config/riscv/bitmanip.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,3 +467,16 @@
[(set_attr "type" "bitmanip")])

;; ??? bfxp

;; sext

(define_insn "*extend<SHORT:mode><SUPERQI:mode>2_bitmanip"
[(set (match_operand:SUPERQI 0 "register_operand" "=r,r")
(sign_extend:SUPERQI
(match_operand:SHORT 1 "nonimmediate_operand" " r,m")))]
"TARGET_ZBB"
"@
sext.<SHORT:size>\t%0,%1
l<SHORT:size>\t%0,%1"
[(set_attr "type" "bitmanip")
(set_attr "length" "4")])
9 changes: 7 additions & 2 deletions gcc/config/riscv/riscv.md
Original file line number Diff line number Diff line change
Expand Up @@ -1134,11 +1134,16 @@
[(set_attr "move_type" "move,load")
(set_attr "mode" "DI")])

(define_insn_and_split "extend<SHORT:mode><SUPERQI:mode>2"
(define_expand "extend<SHORT:mode><SUPERQI:mode>2"
[(set (match_operand:SUPERQI 0 "register_operand" "")
(sign_extend:SUPERQI
(match_operand:SHORT 1 "nonimmediate_operand" "")))])

(define_insn_and_split "*extend<SHORT:mode><SUPERQI:mode>2"
[(set (match_operand:SUPERQI 0 "register_operand" "=r,r")
(sign_extend:SUPERQI
(match_operand:SHORT 1 "nonimmediate_operand" " r,m")))]
""
"!TARGET_ZBB"
"@
#
l<SHORT:size>\t%0,%1"
Expand Down

0 comments on commit be58a66

Please sign in to comment.