1 /* brig-inst-mod-handler.cc -- brig rounding moded instruction handling
2    Copyright (C) 2016-2018 Free Software Foundation, Inc.
3    Contributed by Pekka Jaaskelainen <pekka.jaaskelainen@parmance.com>
4    for General Processor Tech.
5 
6 This file is part of GCC.
7 
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12 
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21 
22 #include "brig-code-entry-handler.h"
23 
24 #include "gimple-expr.h"
25 #include "errors.h"
26 
27 size_t
generate(const BrigBase * base)28 brig_inst_mod_handler::generate (const BrigBase *base)
29 {
30   brig_basic_inst_handler basic_handler (m_parent);
31   return basic_handler (base);
32 }
33 
34 const BrigAluModifier8_t *
modifier(const BrigBase * base) const35 brig_inst_mod_handler::modifier (const BrigBase *base) const
36 {
37   const BrigInstMod *inst = (const BrigInstMod *) base;
38   return &inst->modifier;
39 }
40 
41 const BrigRound8_t *
round(const BrigBase * base) const42 brig_inst_mod_handler::round (const BrigBase *base) const
43 {
44   const BrigInstMod *inst = (const BrigInstMod *) base;
45   return &inst->round;
46 }
47 
48 /* This used to inject fesetround () calls to control the rounding mode of the
49    actual executed floating point operation.  It turned out that supporting
50    conversions using fesetround calls won't work in gcc due to it not being
51    able to restrict code motions across calls at the moment.  This
52    functionality is therefore disabled for now until a better solution is
53    found or if fesetround () is fixed in gcc.  */
54 size_t
operator ()(const BrigBase * base)55 brig_inst_mod_handler::operator () (const BrigBase *base)
56 {
57   return generate (base);
58 }
59