Commit 0be3bad7 by Chung-Ju Wu Committed by Chung-Ju Wu

[NDS32] Implement bswapsi2 and bswaphi2 patterns.

gcc/
	* config/nds32/nds32.md (bswapsi2, bswaphi2): New patterns.

From-SVN: r260804
parent 54c537e6
2018-05-27 Chung-Ju Wu <jasonwucj@gmail.com>
* config/nds32/nds32.md (bswapsi2, bswaphi2): New patterns.
2018-05-27 Chung-Ju Wu <jasonwucj@gmail.com>
* config/nds32/nds32.c (nds32_attribute_table): Add "no_prologue".
(nds32_init_machine_status): Initialize machine->attr_naked_p and
machine->attr_no_prologue_p.
......
......@@ -2180,6 +2180,26 @@
[(set_attr "type" "alu")
(set_attr "length" "4")]
)
(define_expand "bswapsi2"
[(set (match_operand:SI 0 "register_operand" "=r")
(bswap:SI (match_operand:SI 1 "register_operand" "r")))]
""
{
emit_insn (gen_unspec_wsbh (operands[0], operands[1]));
emit_insn (gen_rotrsi3 (operands[0], operands[0], GEN_INT (16)));
DONE;
})
(define_insn "bswaphi2"
[(set (match_operand:HI 0 "register_operand" "=r")
(bswap:HI (match_operand:HI 1 "register_operand" "r")))]
""
"wsbh\t%0, %1"
[(set_attr "type" "alu")
(set_attr "length" "4")]
)
;; ----------------------------------------------------------------------------
;; Patterns for exception handling
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment