diff options
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/config/nds32/nds32.md | 20 |
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 73c5781..293856b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 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. diff --git a/gcc/config/nds32/nds32.md b/gcc/config/nds32/nds32.md index 63e4efe..66ef033 100644 --- a/gcc/config/nds32/nds32.md +++ b/gcc/config/nds32/nds32.md @@ -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 |