/ src / arch / zen2 / 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', 'optmized')
31  
32  e = env.Clone()
33  
34  # These rearrangements are not value-safe:
35  #	 (a ⊕ b) ⊕ c ⇒ a ⊕ (b ⊕ c)
36  #	 a ⊗ (b ⊕ c) ⇒ (a ⊗ b) ⊕ (a ⊕ c)
37  # 
38  # To Disallow these changes in gcc remove -ffast-math
39  if '-ffast-math' in e['CFLAGS']:
40      e['CFLAGS'].remove('-ffast-math')
41  
42  incpaths = [
43      '#' + joinpath(Dir('.').srcnode().path),
44      '#' + joinpath(Dir('.').srcnode().path, 'include')
45  ]
46  
47  e.MergeFlags({
48      'CFLAGS'  : ['-march=znver2', '-O3', '-fPIC', '-flax-vector-conversions'],
49      'CPPPATH' : incpaths
50  })
51  
52  experimental_src = []
53  
54  source = Glob('*.c', exclude=experimental_src)
55  #source = Glob('*.c')
56  
57  objs = e.StaticObject(source)
58  
59  Return('objs')