diff --git a/gcc/config/riscv/bitmanip.md b/gcc/config/riscv/bitmanip.md index 6d537b0d3227..481978867e14 100644 --- a/gcc/config/riscv/bitmanip.md +++ b/gcc/config/riscv/bitmanip.md @@ -467,3 +467,16 @@ [(set_attr "type" "bitmanip")]) ;; ??? bfxp + +;; sext + +(define_insn "*extend2_bitmanip" + [(set (match_operand:SUPERQI 0 "register_operand" "=r,r") + (sign_extend:SUPERQI + (match_operand:SHORT 1 "nonimmediate_operand" " r,m")))] + "TARGET_ZBB" + "@ + sext.\t%0,%1 + l\t%0,%1" + [(set_attr "type" "bitmanip") + (set_attr "length" "4")]) diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index d7304618a975..a3296a2d29bd 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -1134,11 +1134,16 @@ [(set_attr "move_type" "move,load") (set_attr "mode" "DI")]) -(define_insn_and_split "extend2" +(define_expand "extend2" + [(set (match_operand:SUPERQI 0 "register_operand" "") + (sign_extend:SUPERQI + (match_operand:SHORT 1 "nonimmediate_operand" "")))]) + +(define_insn_and_split "*extend2" [(set (match_operand:SUPERQI 0 "register_operand" "=r,r") (sign_extend:SUPERQI (match_operand:SHORT 1 "nonimmediate_operand" " r,m")))] - "" + "!TARGET_ZBB" "@ # l\t%0,%1"