From 0541fa4275ab1088bfa6c491ec29c8f69b9cf313 Mon Sep 17 00:00:00 2001 From: nickc Date: Fri, 18 Aug 2000 21:11:23 +0000 Subject: [PATCH] Only allow allow rotations by a constant amount. Do not generate ROTL instruction. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35797 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/config/mcore/mcore.md | 26 ++++++++++++++++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2b97062c8dd..53183a03616 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2000-08-18 Ray Essick & Nick Clifton + + * config/mcore/mcore.md (rotlsi3): Allow allow rotations by a + constant amount. Do not generate ROTL instruction. + Fri Aug 18 16:22:20 2000 Alexandre Oliva * config/sh/elf.h: Do not include sh/sh.h. diff --git a/gcc/config/mcore/mcore.md b/gcc/config/mcore/mcore.md index 6c64561cfe4..fa659a30498 100644 --- a/gcc/config/mcore/mcore.md +++ b/gcc/config/mcore/mcore.md @@ -505,15 +505,25 @@ ;; Shifts and rotates ;; ------------------------------------------------------------------------- -;;; ??? The reg case may never match. -(define_insn "rotlsi3" - [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r") - (rotate:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0,0") - (match_operand:SI 2 "mcore_arith_K_operand_not_0" "r,K")))] +;; Only allow these if the shift count is a convenient constant. +(define_expand "rotlsi3" + [(set (match_operand:SI 0 "mcore_arith_reg_operand" "") + (rotate:SI (match_operand:SI 1 "mcore_arith_reg_operand" "") + (match_operand:SI 2 "nonmemory_operand" "")))] + "" + "if (! mcore_literal_K_operand (operands[2], SImode)) + FAIL; + ") + +;; We can only do constant rotates, which is what this pattern provides. +;; The combiner will put it together for us when we do: +;; (x << N) | (x >> (32 - N)) +(define_insn "" + [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r") + (rotate:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0") + (match_operand:SI 2 "mcore_literal_K_operand" "K")))] "" - "@ - rotl %0,%2 - rotli %0,%2" + "rotli %0,%2" [(set_attr "type" "shift")]) (define_insn "ashlsi3" -- 2.11.4.GIT