From: Pekka Jääskeläinen Date: Fri, 4 May 2018 16:47:34 +0000 (+0000) Subject: [BRIGFE] The modulo in ID computation should not be needed. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f986735ac51029172a62e9e705a658cd0ee241e8;p=gcc.git [BRIGFE] The modulo in ID computation should not be needed. The case where a dim is greater than the grid size doesn't seem to be mentioned in the specs nor tested by PRM test suite. From-SVN: r259944 --- diff --git a/gcc/brig/ChangeLog b/gcc/brig/ChangeLog index 57d44b71e36..c68c8dd4757 100644 --- a/gcc/brig/ChangeLog +++ b/gcc/brig/ChangeLog @@ -1,3 +1,8 @@ +2018-05-04 Pekka Jääskeläinen + + * brig/brigfrontend/brig-code-entry-handler.cc: The modulo in + ID computation should not be needed. + 2018-05-04 Pekka Jääskeläinen * brig/brig-lang.c: Add support for whole program diff --git a/gcc/brig/brigfrontend/brig-code-entry-handler.cc b/gcc/brig/brigfrontend/brig-code-entry-handler.cc index 54b53fde291..36a8deb403d 100644 --- a/gcc/brig/brigfrontend/brig-code-entry-handler.cc +++ b/gcc/brig/brigfrontend/brig-code-entry-handler.cc @@ -1048,7 +1048,6 @@ brig_code_entry_handler::expand_builtin (BrigOpcode16_t brig_opcode, tree local_id_var = m_parent.m_cf->m_local_id_vars[dim]; tree wg_id_var = m_parent.m_cf->m_wg_id_vars[dim]; tree wg_size_var = m_parent.m_cf->m_wg_size_vars[dim]; - tree grid_size_var = m_parent.m_cf->m_grid_size_vars[dim]; tree wg_id_x_wg_size = build2 (MULT_EXPR, uint32_type_node, convert (uint32_type_node, wg_id_var), @@ -1056,15 +1055,8 @@ brig_code_entry_handler::expand_builtin (BrigOpcode16_t brig_opcode, tree sum = build2 (PLUS_EXPR, uint32_type_node, wg_id_x_wg_size, local_id_var); - /* We need a modulo here because of work-groups which have dimensions - larger than the grid size :( TO CHECK: is this really allowed in the - specs? */ - tree modulo - = build2 (TRUNC_MOD_EXPR, uint32_type_node, sum, grid_size_var); - return add_temp_var (std::string ("workitemabsid_") - + (char) ((int) 'x' + dim), - modulo); + + (char) ((int) 'x' + dim), sum); } else if (brig_opcode == BRIG_OPCODE_WORKITEMFLATID) {