Remove unused variable
[official-gcc.git] / gcc / brig / brigfrontend / brig-queue-inst-handler.cc
blob8ef3a082a17b2724de40656a84774c9a12cae0df
1 /* brig-queue-inst-handler.cc -- brig user mode queue related instruction
2 handling
3 Copyright (C) 2016-2018 Free Software Foundation, Inc.
4 Contributed by Pekka Jaaskelainen <pekka.jaaskelainen@parmance.com>
5 for General Processor Tech.
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 3, or (at your option) any later
12 version.
14 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 for more details.
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
23 #include <sstream>
25 #include "brig-code-entry-handler.h"
26 #include "brig-util.h"
27 #include "convert.h"
28 #include "tree-pretty-print.h"
29 #include "errors.h"
30 #include "diagnostic-core.h"
31 #include "brig-builtins.h"
33 brig_queue_inst_handler::brig_queue_inst_handler (brig_to_generic &parent)
34 : brig_code_entry_handler (parent)
38 size_t
39 brig_queue_inst_handler::operator () (const BrigBase *base)
41 const BrigInstBase &inst_base = *(const BrigInstBase *) base;
43 tree_stl_vec operands = build_operands (inst_base);
45 if (inst_base.opcode == BRIG_OPCODE_LDQUEUEWRITEINDEX
46 || inst_base.opcode == BRIG_OPCODE_LDQUEUEREADINDEX)
48 tree builtin
49 = inst_base.opcode == BRIG_OPCODE_LDQUEUEWRITEINDEX
50 ? builtin_decl_explicit (BUILT_IN_HSAIL_LDQUEUEWRITEINDEX)
51 : builtin_decl_explicit (BUILT_IN_HSAIL_LDQUEUEREADINDEX);
53 tree expr
54 = call_builtin (builtin, 1, uint64_type_node,
55 uint64_type_node, operands[1]);
56 build_output_assignment (inst_base, operands[0], expr);
58 else if (inst_base.opcode == BRIG_OPCODE_STQUEUEWRITEINDEX
59 || inst_base.opcode == BRIG_OPCODE_STQUEUEREADINDEX)
61 tree builtin
62 = inst_base.opcode == BRIG_OPCODE_STQUEUEWRITEINDEX
63 ? builtin_decl_explicit (BUILT_IN_HSAIL_STQUEUEWRITEINDEX)
64 : builtin_decl_explicit (BUILT_IN_HSAIL_STQUEUEREADINDEX);
66 call_builtin (builtin, 2, void_type_node,
67 uint64_type_node, operands[0], uint64_type_node,
68 operands[1]);
70 else if (inst_base.opcode == BRIG_OPCODE_ADDQUEUEWRITEINDEX)
72 tree builtin = builtin_decl_explicit (BUILT_IN_HSAIL_ADDQUEUEWRITEINDEX);
74 tree expr = call_builtin (builtin, 2,
75 uint64_type_node, uint64_type_node, operands[1],
76 uint64_type_node, operands[2]);
77 build_output_assignment (inst_base, operands[0], expr);
79 else if (inst_base.opcode == BRIG_OPCODE_CASQUEUEWRITEINDEX)
81 tree builtin = builtin_decl_explicit (BUILT_IN_HSAIL_CASQUEUEWRITEINDEX);
83 tree expr
84 = call_builtin (builtin, 3, uint64_type_node,
85 uint64_type_node, operands[1], uint64_type_node,
86 operands[2], uint64_type_node, operands[3]);
87 build_output_assignment (inst_base, operands[0], expr);
89 else
90 gcc_unreachable ();
92 return base->byteCount;