1255185Sjmg/*-
2255185Sjmg * Copyright 2013 John-Mark Gurney
3255185Sjmg * All rights reserved.
4255185Sjmg *
5255185Sjmg * Redistribution and use in source and binary forms, with or without
6255185Sjmg * modification, are permitted provided that the following conditions
7255185Sjmg * are met:
8255185Sjmg * 1. Redistributions of source code must retain the above copyright
9255185Sjmg *    notice, this list of conditions and the following disclaimer.
10255185Sjmg * 2. Redistributions in binary form must reproduce the above copyright
11255185Sjmg *    notice, this list of conditions and the following disclaimer in the
12255185Sjmg *    documentation and/or other materials provided with the distribution.
13255185Sjmg *
14255185Sjmg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15255185Sjmg * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16255185Sjmg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17255185Sjmg * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18255185Sjmg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19255185Sjmg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20255185Sjmg * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21255185Sjmg * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22255185Sjmg * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23255185Sjmg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24255185Sjmg * SUCH DAMAGE.
25255185Sjmg *
26255185Sjmg * $FreeBSD$
27255185Sjmg *
28255185Sjmg */
29255185Sjmg
30255185Sjmg#ifndef _WMMINTRIN_AES_H_
31255185Sjmg#define _WMMINTRIN_AES_H_
32255185Sjmg
33255185Sjmg#include <emmintrin.h>
34255185Sjmg
35255185Sjmg#define MAKE_AES(name) \
36255185Sjmgstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) \
37255185Sjmg_mm_## name ##_si128(__m128i __V, __m128i __R) \
38255185Sjmg{ \
39255185Sjmg  __m128i v = __V; \
40255185Sjmg \
41255185Sjmg  __asm__ (#name " %2, %0": "=x" (v): "0" (v), "xm" (__R)); \
42255185Sjmg \
43255185Sjmg  return v; \
44255185Sjmg}
45255185Sjmg
46255185SjmgMAKE_AES(aesimc)
47255185SjmgMAKE_AES(aesenc)
48255185SjmgMAKE_AES(aesenclast)
49255185SjmgMAKE_AES(aesdec)
50255185SjmgMAKE_AES(aesdeclast)
51255185Sjmg
52255185Sjmg#undef MAKE_AES
53255185Sjmg
54255185Sjmg#endif  /* _WMMINTRIN_AES_H_ */
55