1eeb84df6SPhil Edworthy/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2eeb84df6SPhil Edworthy 2004, 2005, 2006 3eeb84df6SPhil Edworthy Free Software Foundation, Inc. 4eeb84df6SPhil Edworthy 5*1a459660SWolfgang Denk * SPDX-License-Identifier: GPL-2.0+ 6*1a459660SWolfgang Denk */ 7eeb84df6SPhil Edworthy 8eeb84df6SPhil Edworthy!! libgcc routines for the Renesas / SuperH SH CPUs. 9eeb84df6SPhil Edworthy!! Contributed by Steve Chamberlain. 10eeb84df6SPhil Edworthy!! sac@cygnus.com 11eeb84df6SPhil Edworthy 12eeb84df6SPhil Edworthy!! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines 13eeb84df6SPhil Edworthy!! recoded in assembly by Toshiyasu Morita 14eeb84df6SPhil Edworthy!! tm@netcom.com 15eeb84df6SPhil Edworthy 16eeb84df6SPhil Edworthy/* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and 17eeb84df6SPhil Edworthy ELF local label prefixes by J"orn Rennecke 18eeb84df6SPhil Edworthy amylaar@cygnus.com */ 19eeb84df6SPhil Edworthy 20eeb84df6SPhil Edworthy .text 21eeb84df6SPhil Edworthy .balign 4 22eeb84df6SPhil Edworthy .global __movmem 23eeb84df6SPhil Edworthy .global __movstr 24eeb84df6SPhil Edworthy .set __movstr, __movmem 25eeb84df6SPhil Edworthy /* This would be a lot simpler if r6 contained the byte count 26eeb84df6SPhil Edworthy minus 64, and we wouldn't be called here for a byte count of 64. */ 27eeb84df6SPhil Edworthy__movmem: 28eeb84df6SPhil Edworthy sts.l pr,@-r15 29eeb84df6SPhil Edworthy shll2 r6 30eeb84df6SPhil Edworthy bsr __movmemSI52+2 31eeb84df6SPhil Edworthy mov.l @(48,r5),r0 32eeb84df6SPhil Edworthy .balign 4 33eeb84df6SPhil Edworthymovmem_loop: /* Reached with rts */ 34eeb84df6SPhil Edworthy mov.l @(60,r5),r0 35eeb84df6SPhil Edworthy add #-64,r6 36eeb84df6SPhil Edworthy mov.l r0,@(60,r4) 37eeb84df6SPhil Edworthy tst r6,r6 38eeb84df6SPhil Edworthy mov.l @(56,r5),r0 39eeb84df6SPhil Edworthy bt movmem_done 40eeb84df6SPhil Edworthy mov.l r0,@(56,r4) 41eeb84df6SPhil Edworthy cmp/pl r6 42eeb84df6SPhil Edworthy mov.l @(52,r5),r0 43eeb84df6SPhil Edworthy add #64,r5 44eeb84df6SPhil Edworthy mov.l r0,@(52,r4) 45eeb84df6SPhil Edworthy add #64,r4 46eeb84df6SPhil Edworthy bt __movmemSI52 47eeb84df6SPhil Edworthy! done all the large groups, do the remainder 48eeb84df6SPhil Edworthy! jump to movmem+ 49eeb84df6SPhil Edworthy mova __movmemSI4+4,r0 50eeb84df6SPhil Edworthy add r6,r0 51eeb84df6SPhil Edworthy jmp @r0 52eeb84df6SPhil Edworthymovmem_done: ! share slot insn, works out aligned. 53eeb84df6SPhil Edworthy lds.l @r15+,pr 54eeb84df6SPhil Edworthy mov.l r0,@(56,r4) 55eeb84df6SPhil Edworthy mov.l @(52,r5),r0 56eeb84df6SPhil Edworthy rts 57eeb84df6SPhil Edworthy mov.l r0,@(52,r4) 58eeb84df6SPhil Edworthy .balign 4 59eeb84df6SPhil Edworthy 60eeb84df6SPhil Edworthy .global __movmemSI64 61eeb84df6SPhil Edworthy .global __movstrSI64 62eeb84df6SPhil Edworthy .set __movstrSI64, __movmemSI64 63eeb84df6SPhil Edworthy__movmemSI64: 64eeb84df6SPhil Edworthy mov.l @(60,r5),r0 65eeb84df6SPhil Edworthy mov.l r0,@(60,r4) 66eeb84df6SPhil Edworthy .global __movmemSI60 67eeb84df6SPhil Edworthy .global __movstrSI60 68eeb84df6SPhil Edworthy .set __movstrSI60, __movmemSI60 69eeb84df6SPhil Edworthy__movmemSI60: 70eeb84df6SPhil Edworthy mov.l @(56,r5),r0 71eeb84df6SPhil Edworthy mov.l r0,@(56,r4) 72eeb84df6SPhil Edworthy .global __movmemSI56 73eeb84df6SPhil Edworthy .global __movstrSI56 74eeb84df6SPhil Edworthy .set __movstrSI56, __movmemSI56 75eeb84df6SPhil Edworthy__movmemSI56: 76eeb84df6SPhil Edworthy mov.l @(52,r5),r0 77eeb84df6SPhil Edworthy mov.l r0,@(52,r4) 78eeb84df6SPhil Edworthy .global __movmemSI52 79eeb84df6SPhil Edworthy .global __movstrSI52 80eeb84df6SPhil Edworthy .set __movstrSI52, __movmemSI52 81eeb84df6SPhil Edworthy__movmemSI52: 82eeb84df6SPhil Edworthy mov.l @(48,r5),r0 83eeb84df6SPhil Edworthy mov.l r0,@(48,r4) 84eeb84df6SPhil Edworthy .global __movmemSI48 85eeb84df6SPhil Edworthy .global __movstrSI48 86eeb84df6SPhil Edworthy .set __movstrSI48, __movmemSI48 87eeb84df6SPhil Edworthy__movmemSI48: 88eeb84df6SPhil Edworthy mov.l @(44,r5),r0 89eeb84df6SPhil Edworthy mov.l r0,@(44,r4) 90eeb84df6SPhil Edworthy .global __movmemSI44 91eeb84df6SPhil Edworthy .global __movstrSI44 92eeb84df6SPhil Edworthy .set __movstrSI44, __movmemSI44 93eeb84df6SPhil Edworthy__movmemSI44: 94eeb84df6SPhil Edworthy mov.l @(40,r5),r0 95eeb84df6SPhil Edworthy mov.l r0,@(40,r4) 96eeb84df6SPhil Edworthy .global __movmemSI40 97eeb84df6SPhil Edworthy .global __movstrSI40 98eeb84df6SPhil Edworthy .set __movstrSI40, __movmemSI40 99eeb84df6SPhil Edworthy__movmemSI40: 100eeb84df6SPhil Edworthy mov.l @(36,r5),r0 101eeb84df6SPhil Edworthy mov.l r0,@(36,r4) 102eeb84df6SPhil Edworthy .global __movmemSI36 103eeb84df6SPhil Edworthy .global __movstrSI36 104eeb84df6SPhil Edworthy .set __movstrSI36, __movmemSI36 105eeb84df6SPhil Edworthy__movmemSI36: 106eeb84df6SPhil Edworthy mov.l @(32,r5),r0 107eeb84df6SPhil Edworthy mov.l r0,@(32,r4) 108eeb84df6SPhil Edworthy .global __movmemSI32 109eeb84df6SPhil Edworthy .global __movstrSI32 110eeb84df6SPhil Edworthy .set __movstrSI32, __movmemSI32 111eeb84df6SPhil Edworthy__movmemSI32: 112eeb84df6SPhil Edworthy mov.l @(28,r5),r0 113eeb84df6SPhil Edworthy mov.l r0,@(28,r4) 114eeb84df6SPhil Edworthy .global __movmemSI28 115eeb84df6SPhil Edworthy .global __movstrSI28 116eeb84df6SPhil Edworthy .set __movstrSI28, __movmemSI28 117eeb84df6SPhil Edworthy__movmemSI28: 118eeb84df6SPhil Edworthy mov.l @(24,r5),r0 119eeb84df6SPhil Edworthy mov.l r0,@(24,r4) 120eeb84df6SPhil Edworthy .global __movmemSI24 121eeb84df6SPhil Edworthy .global __movstrSI24 122eeb84df6SPhil Edworthy .set __movstrSI24, __movmemSI24 123eeb84df6SPhil Edworthy__movmemSI24: 124eeb84df6SPhil Edworthy mov.l @(20,r5),r0 125eeb84df6SPhil Edworthy mov.l r0,@(20,r4) 126eeb84df6SPhil Edworthy .global __movmemSI20 127eeb84df6SPhil Edworthy .global __movstrSI20 128eeb84df6SPhil Edworthy .set __movstrSI20, __movmemSI20 129eeb84df6SPhil Edworthy__movmemSI20: 130eeb84df6SPhil Edworthy mov.l @(16,r5),r0 131eeb84df6SPhil Edworthy mov.l r0,@(16,r4) 132eeb84df6SPhil Edworthy .global __movmemSI16 133eeb84df6SPhil Edworthy .global __movstrSI16 134eeb84df6SPhil Edworthy .set __movstrSI16, __movmemSI16 135eeb84df6SPhil Edworthy__movmemSI16: 136eeb84df6SPhil Edworthy mov.l @(12,r5),r0 137eeb84df6SPhil Edworthy mov.l r0,@(12,r4) 138eeb84df6SPhil Edworthy .global __movmemSI12 139eeb84df6SPhil Edworthy .global __movstrSI12 140eeb84df6SPhil Edworthy .set __movstrSI12, __movmemSI12 141eeb84df6SPhil Edworthy__movmemSI12: 142eeb84df6SPhil Edworthy mov.l @(8,r5),r0 143eeb84df6SPhil Edworthy mov.l r0,@(8,r4) 144eeb84df6SPhil Edworthy .global __movmemSI8 145eeb84df6SPhil Edworthy .global __movstrSI8 146eeb84df6SPhil Edworthy .set __movstrSI8, __movmemSI8 147eeb84df6SPhil Edworthy__movmemSI8: 148eeb84df6SPhil Edworthy mov.l @(4,r5),r0 149eeb84df6SPhil Edworthy mov.l r0,@(4,r4) 150eeb84df6SPhil Edworthy .global __movmemSI4 151eeb84df6SPhil Edworthy .global __movstrSI4 152eeb84df6SPhil Edworthy .set __movstrSI4, __movmemSI4 153eeb84df6SPhil Edworthy__movmemSI4: 154eeb84df6SPhil Edworthy mov.l @(0,r5),r0 155eeb84df6SPhil Edworthy rts 156eeb84df6SPhil Edworthy mov.l r0,@(0,r4) 157eeb84df6SPhil Edworthy 158eeb84df6SPhil Edworthy .global __movmem_i4_even 159eeb84df6SPhil Edworthy .global __movstr_i4_even 160eeb84df6SPhil Edworthy .set __movstr_i4_even, __movmem_i4_even 161eeb84df6SPhil Edworthy 162eeb84df6SPhil Edworthy .global __movmem_i4_odd 163eeb84df6SPhil Edworthy .global __movstr_i4_odd 164eeb84df6SPhil Edworthy .set __movstr_i4_odd, __movmem_i4_odd 165eeb84df6SPhil Edworthy 166eeb84df6SPhil Edworthy .global __movmemSI12_i4 167eeb84df6SPhil Edworthy .global __movstrSI12_i4 168eeb84df6SPhil Edworthy .set __movstrSI12_i4, __movmemSI12_i4 169eeb84df6SPhil Edworthy 170eeb84df6SPhil Edworthy .p2align 5 171eeb84df6SPhil EdworthyL_movmem_2mod4_end: 172eeb84df6SPhil Edworthy mov.l r0,@(16,r4) 173eeb84df6SPhil Edworthy rts 174eeb84df6SPhil Edworthy mov.l r1,@(20,r4) 175eeb84df6SPhil Edworthy 176eeb84df6SPhil Edworthy .p2align 2 177eeb84df6SPhil Edworthy 178eeb84df6SPhil Edworthy__movmem_i4_even: 179eeb84df6SPhil Edworthy mov.l @r5+,r0 180eeb84df6SPhil Edworthy bra L_movmem_start_even 181eeb84df6SPhil Edworthy mov.l @r5+,r1 182eeb84df6SPhil Edworthy 183eeb84df6SPhil Edworthy__movmem_i4_odd: 184eeb84df6SPhil Edworthy mov.l @r5+,r1 185eeb84df6SPhil Edworthy add #-4,r4 186eeb84df6SPhil Edworthy mov.l @r5+,r2 187eeb84df6SPhil Edworthy mov.l @r5+,r3 188eeb84df6SPhil Edworthy mov.l r1,@(4,r4) 189eeb84df6SPhil Edworthy mov.l r2,@(8,r4) 190eeb84df6SPhil Edworthy 191eeb84df6SPhil EdworthyL_movmem_loop: 192eeb84df6SPhil Edworthy mov.l r3,@(12,r4) 193eeb84df6SPhil Edworthy dt r6 194eeb84df6SPhil Edworthy mov.l @r5+,r0 195eeb84df6SPhil Edworthy bt/s L_movmem_2mod4_end 196eeb84df6SPhil Edworthy mov.l @r5+,r1 197eeb84df6SPhil Edworthy add #16,r4 198eeb84df6SPhil EdworthyL_movmem_start_even: 199eeb84df6SPhil Edworthy mov.l @r5+,r2 200eeb84df6SPhil Edworthy mov.l @r5+,r3 201eeb84df6SPhil Edworthy mov.l r0,@r4 202eeb84df6SPhil Edworthy dt r6 203eeb84df6SPhil Edworthy mov.l r1,@(4,r4) 204eeb84df6SPhil Edworthy bf/s L_movmem_loop 205eeb84df6SPhil Edworthy mov.l r2,@(8,r4) 206eeb84df6SPhil Edworthy rts 207eeb84df6SPhil Edworthy mov.l r3,@(12,r4) 208eeb84df6SPhil Edworthy 209eeb84df6SPhil Edworthy .p2align 4 210eeb84df6SPhil Edworthy__movmemSI12_i4: 211eeb84df6SPhil Edworthy mov.l @r5,r0 212eeb84df6SPhil Edworthy mov.l @(4,r5),r1 213eeb84df6SPhil Edworthy mov.l @(8,r5),r2 214eeb84df6SPhil Edworthy mov.l r0,@r4 215eeb84df6SPhil Edworthy mov.l r1,@(4,r4) 216eeb84df6SPhil Edworthy rts 217eeb84df6SPhil Edworthy mov.l r2,@(8,r4) 218