From 4101250d9ef042fd6a5f24228510162e1203dce9 Mon Sep 17 00:00:00 2001 From: Sebastian Perta Date: Mon, 22 Jan 2018 20:20:28 +0000 Subject: [PATCH] rl78-expand.md: New define_expand "bswaphi2" 2018-01-22 Sebastian Perta * config/rl78/rl78-expand.md: New define_expand "bswaphi2" * config/rl78/rl78-virt.md: New define_insn "*bswaphi2_virt" * config/rl78/rl78-real.md: New define_insn "*bswaphi2_real" From-SVN: r256961 --- gcc/ChangeLog | 6 ++++++ gcc/config/rl78/rl78-expand.md | 8 ++++++++ gcc/config/rl78/rl78-real.md | 9 +++++++++ gcc/config/rl78/rl78-virt.md | 8 ++++++++ 4 files changed, 31 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c5657585238..8ba03d6c19b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-01-22 Sebastian Perta + + * config/rl78/rl78-expand.md: New define_expand "bswaphi2" + * config/rl78/rl78-virt.md: New define_insn "*bswaphi2_virt" + * config/rl78/rl78-real.md: New define_insn "*bswaphi2_real" + 2018-01-22 Sebastian Perta * config/rl78/rl78-protos.h: New function declaration rl78_split_movdi diff --git a/gcc/config/rl78/rl78-expand.md b/gcc/config/rl78/rl78-expand.md index 71e271510a4..7b5033e72e8 100644 --- a/gcc/config/rl78/rl78-expand.md +++ b/gcc/config/rl78/rl78-expand.md @@ -105,6 +105,14 @@ [(set_attr "valloc" "op1")] ) +(define_expand "bswaphi2" + [(set (match_operand:HI 0 "nonimmediate_operand") + (bswap:HI (match_operand:HI 1 "general_operand")))] + "" + "if (rl78_force_nonfar_2 (operands, gen_bswaphi2)) + DONE;" +) + ;;---------- Conversions ------------------------ (define_expand "zero_extendqihi2" diff --git a/gcc/config/rl78/rl78-real.md b/gcc/config/rl78/rl78-real.md index 682fa61a70b..d1c3089fb8d 100644 --- a/gcc/config/rl78/rl78-real.md +++ b/gcc/config/rl78/rl78-real.md @@ -90,6 +90,15 @@ movw\t%0, %1" ) +(define_insn "*bswaphi2_real" + [(set (match_operand:HI 0 "rl78_nonfar_nonimm_operand" "=A,A") + (bswap:HI (match_operand:HI 1 "general_operand" "0,viU")))] + "rl78_real_insns_ok ()" + "@ + xch\ta, x + movw\tax, %1\n\txch\ta, x" +) + ;;---------- Conversions ------------------------ (define_insn "*zero_extendqihi2_real" diff --git a/gcc/config/rl78/rl78-virt.md b/gcc/config/rl78/rl78-virt.md index 05b201fc3b3..b9c8b831881 100644 --- a/gcc/config/rl78/rl78-virt.md +++ b/gcc/config/rl78/rl78-virt.md @@ -65,6 +65,14 @@ [(set_attr "valloc" "op1")] ) +(define_insn "*bswaphi2_virt" + [(set (match_operand:HI 0 "rl78_nonfar_nonimm_operand" "=vm") + (bswap:HI (match_operand:HI 1 "general_operand" "vim")))] + "rl78_virt_insns_ok ()" + "v.bswaphi\t%0, %1" + [(set_attr "valloc" "op1")] +) + ;;---------- Conversions ------------------------ (define_insn "*zero_extendqihi2_virt" -- 2.30.2