OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libitm/] [config/] [x86/] [x86_avx.cc] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 737 jeremybenn
/* Copyright (C) 2009, 2011 Free Software Foundation, Inc.
2
   Contributed by Richard Henderson <rth@redhat.com>.
3
 
4
   This file is part of the GNU Transactional Memory Library (libitm).
5
 
6
   Libitm is free software; you can redistribute it and/or modify it
7
   under the terms of the GNU General Public License as published by
8
   the Free Software Foundation; either version 3 of the License, or
9
   (at your option) any later version.
10
 
11
   Libitm is distributed in the hope that it will be useful, but WITHOUT ANY
12
   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14
   more details.
15
 
16
   Under Section 7 of GPL version 3, you are granted additional
17
   permissions described in the GCC Runtime Library Exception, version
18
   3.1, as published by the Free Software Foundation.
19
 
20
   You should have received a copy of the GNU General Public License and
21
   a copy of the GCC Runtime Library Exception along with this program;
22
   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23
   <http://www.gnu.org/licenses/>.  */
24
 
25
#include "config.h"
26
 
27
#include "libitm_i.h"
28
#include "dispatch.h"
29
 
30
extern "C" {
31
 
32
#ifndef HAVE_AS_AVX
33
// If we don't have an AVX capable assembler, we didn't set -mavx on the
34
// command-line either, which means that libitm.h defined neither this type
35
// nor the functions in this file.  Define the type and unconditionally
36
// wrap the file in extern "C" to make up for the lack of pre-declaration.
37
typedef float _ITM_TYPE_M256 __attribute__((vector_size(32), may_alias));
38
#endif
39
 
40
// Re-define the memcpy implementations so that we can frob the
41
// interface to deal with possibly missing AVX instruction set support.
42
 
43
#ifdef HAVE_AS_AVX
44
#define RETURN(X)       return X
45
#define STORE(X,Y)      X = Y
46
#define OUTPUT(T)       _ITM_TYPE_##T
47
#define INPUT(T,X)      , _ITM_TYPE_##T X
48
#else
49
/* Emit vmovaps (%rax),%ymm0.  */
50
#define RETURN(X) \
51
  asm volatile(".byte 0xc5,0xfc,0x28,0x00" : "=m"(X) : "a"(&X))
52
/* Emit vmovaps %ymm0,(%rax); vzeroupper.  */
53
#define STORE(X,Y) \
54
  asm volatile(".byte 0xc5,0xfc,0x29,0x00,0xc5,0xf8,0x77" : "=m"(X) : "a"(&X))
55
#define OUTPUT(T)       void
56
#define INPUT(T,X)
57
#endif
58
 
59
#undef ITM_READ_MEMCPY
60
#define ITM_READ_MEMCPY(T, LSMOD, TARGET, M2)                           \
61
OUTPUT(T) ITM_REGPARM _ITM_##LSMOD##T (const _ITM_TYPE_##T *ptr)        \
62
{                                                                       \
63
  _ITM_TYPE_##T v;                                                      \
64
  TARGET memtransfer##M2(&v, ptr, sizeof(_ITM_TYPE_##T), false,         \
65
                         GTM::abi_dispatch::NONTXNAL,                   \
66
                         GTM::abi_dispatch::LSMOD);                     \
67
  RETURN(v);                                                            \
68
}
69
 
70
#undef ITM_WRITE_MEMCPY
71
#define ITM_WRITE_MEMCPY(T, LSMOD, TARGET, M2)                          \
72
void ITM_REGPARM _ITM_##LSMOD##T (_ITM_TYPE_##T *ptr INPUT(T,in))       \
73
{                                                                       \
74
  _ITM_TYPE_##T v;                                                      \
75
  STORE(v, in);                                                         \
76
  TARGET memtransfer##M2(ptr, &v, sizeof(_ITM_TYPE_##T), false,         \
77
                         GTM::abi_dispatch::LSMOD,                      \
78
                         GTM::abi_dispatch::NONTXNAL);                  \
79
}
80
 
81
// ??? Use memcpy for now, until we have figured out how to best instantiate
82
// these loads/stores.
83
CREATE_DISPATCH_FUNCTIONS_T_MEMCPY(M256, GTM::abi_disp()->, )
84
 
85
void ITM_REGPARM
86
_ITM_LM256 (const _ITM_TYPE_M256 *ptr)
87
{
88
  GTM::GTM_LB (ptr, sizeof (*ptr));
89
}
90
 
91
} // extern "C"

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.