/ src / isa / SConscript
SConscript
 1  #
 2  # Copyright (C) 2008-2020 Advanced Micro Devices, Inc. All rights reserved.
 3  #
 4  # Redistribution and use in source and binary forms, with or without modification,
 5  # are permitted provided that the following conditions are met:
 6  # 1. Redistributions of source code must retain the above copyright notice,
 7  #    this list of conditions and the following disclaimer.
 8  # 2. Redistributions in binary form must reproduce the above copyright notice,
 9  #    this list of conditions and the following disclaimer in the documentation
10  #    and/or other materials provided with the distribution.
11  # 3. Neither the name of the copyright holder nor the names of its contributors
12  #    may be used to endorse or promote products derived from this software without
13  #    specific prior written permission.
14  #
15  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16  # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
19  # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20  # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
21  # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22  # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24  # POSSIBILITY OF SUCH DAMAGE.
25  
26  # Inherit global environment
27  Import('env')
28  from os.path import join as joinpath
29  
30  builddir = joinpath(env['BUILDROOT'], 'src')
31  
32  p = joinpath(Dir('.').srcnode().path)
33  incpaths = [
34      '#' + p,
35      '#' + joinpath(p, 'include')
36  ]
37  
38  e = env.Clone()
39  e.Append(
40      ASFLAGS = ['-Wall', '-W', '-fPIC' ],
41   
42      CPPPATH = incpaths,
43  
44      CPPDEFINES = ['AVX_XOP_FMA4_FMA3' ],
45  )
46  
47  # The set of source files associated with this SConscript file.
48  source = Glob('*.[cS]', exclude=['map.S'])	+ \
49      Glob('avx/gas/*.[cS]')    			+ \
50      Glob('avx2/gas/*.[cS]')   			+ \
51      Glob('fma4/gas/*.[cS]')   			+ \
52      Glob('avx512/gas/*.[cS]')
53  
54  asm_list = ['avx/gas', 'fma4/gas', 'avx512/gas']
55  asm_objs = []
56  
57  for asm_path in asm_list:
58      new_env = e.Clone()
59      srcs = Glob(joinpath(asm_path, '*.[cS]'))
60      #print(joinpath(Dir('.').srcnode().path, asm_path, 'include'))
61      incpath = '#' + joinpath(Dir('.').srcnode().path, asm_path, 'include')
62      new_env.Append(
63          CPPPATH = incpath,
64      )
65      asm_objs += new_env.StaticObject(srcs)
66  
67  avx2_objs = SConscript('avx2/SConscript',
68                             exports = {'env' : e},
69                             duplicate = 0,
70                             src_dir = '#src/isa/avx2',
71                             variant_dir = joinpath(builddir, 'optmized'))
72  
73  
74  objs = asm_objs + avx2_objs
75  
76  #print('asm sources', list(asm_objs))
77  Return('objs')
78