| 1 |
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
| 2 |
/* |
| 3 |
* Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License version 2 as |
| 7 |
* published by the Free Software Foundation. |
| 8 |
* |
| 9 |
* vineetg: May 2011 |
| 10 |
* -Support single cycle endian-swap insn in ARC700 4.10 |
| 11 |
* |
| 12 |
* vineetg: June 2009 |
| 13 |
* -Better htonl implementation (5 instead of 9 ALU instructions) |
| 14 |
* -Hardware assisted single cycle bswap (Use Case of ARC custom instrn) |
| 15 |
*/ |
| 16 |
|
| 17 |
#ifndef __ASM_ARC_SWAB_H |
| 18 |
#define __ASM_ARC_SWAB_H |
| 19 |
|
| 20 |
#include <linux/types.h> |
| 21 |
|
| 22 |
#define __arch_swab32(x) \ |
| 23 |
({ \ |
| 24 |
unsigned int tmp = x; \ |
| 25 |
__asm__( \ |
| 26 |
" swape %0, %1 \n" \ |
| 27 |
: "=r" (tmp) \ |
| 28 |
: "r" (tmp)); \ |
| 29 |
tmp; \ |
| 30 |
}) |
| 31 |
|
| 32 |
#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) |
| 33 |
#define __SWAB_64_THRU_32__ |
| 34 |
#endif |
| 35 |
|
| 36 |
#endif |