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