Commit 8c058905 by Henry Linjamäki Committed by Pekka Jääskeläinen

re PR hsa/81713 (BIT_FIELD_REF produced by Brig FE do not pass new verification)

Fix PR 81713
 * brigfrontend/brig-basic-inst-handler.cc: replace build_int_cst with
   bitsize_int in building BIT_FIELD_REF.
 * brigfrontend/brig-code-entry-handler.cc: likewise.

From-SVN: r250874
parent 8ffe2be8
2017-08-04 Henry Linjamäki <henry.linjamaki@parmance.com>
Fix PR 81713
* brigfrontend/brig-basic-inst-handler.cc: replace build_int_cst with
bitsize_int in building BIT_FIELD_REF.
* brigfrontend/brig-code-entry-handler.cc: likewise.
2017-07-05 Richard Sandiford <richard.sandiford@linaro.org> 2017-07-05 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com> Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com> David Sherwood <david.sherwood@arm.com>
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "stor-layout.h" #include "stor-layout.h"
#include "diagnostic-core.h" #include "diagnostic-core.h"
#include "brig-builtins.h" #include "brig-builtins.h"
#include "fold-const.h"
brig_basic_inst_handler::brig_basic_inst_handler (brig_to_generic &parent) brig_basic_inst_handler::brig_basic_inst_handler (brig_to_generic &parent)
: brig_code_entry_handler (parent) : brig_code_entry_handler (parent)
...@@ -112,10 +113,8 @@ brig_basic_inst_handler::build_shuffle (tree arith_type, ...@@ -112,10 +113,8 @@ brig_basic_inst_handler::build_shuffle (tree arith_type,
{ {
tree mask_element tree mask_element
= build3 (BIT_FIELD_REF, mask_element_type, mask_operand, = build3 (BIT_FIELD_REF, mask_element_type, mask_operand,
build_int_cst (unsigned_char_type_node, bitsize_int (input_mask_element_size),
input_mask_element_size), bitsize_int (i * input_mask_element_size));
build_int_cst (unsigned_char_type_node,
i * input_mask_element_size));
mask_element = convert (element_type, mask_element); mask_element = convert (element_type, mask_element);
......
...@@ -1423,9 +1423,8 @@ brig_code_entry_handler::build_output_assignment (const BrigInstBase &brig_inst, ...@@ -1423,9 +1423,8 @@ brig_code_entry_handler::build_output_assignment (const BrigInstBase &brig_inst,
tree element_ref tree element_ref
= build3 (BIT_FIELD_REF, element_type, input, = build3 (BIT_FIELD_REF, element_type, input,
TYPE_SIZE (element_type), TYPE_SIZE (element_type),
build_int_cst (uint32_type_node, bitsize_int (i * int_size_in_bytes (element_type)
i * int_size_in_bytes (element_type) * BITS_PER_UNIT));
* BITS_PER_UNIT));
last_assign last_assign
= build_output_assignment (brig_inst, element, element_ref); = build_output_assignment (brig_inst, element, element_ref);
...@@ -1488,7 +1487,7 @@ brig_code_entry_handler::unpack (tree value, tree_stl_vec &elements) ...@@ -1488,7 +1487,7 @@ brig_code_entry_handler::unpack (tree value, tree_stl_vec &elements)
tree element tree element
= build3 (BIT_FIELD_REF, input_element_type, value, = build3 (BIT_FIELD_REF, input_element_type, value,
TYPE_SIZE (input_element_type), TYPE_SIZE (input_element_type),
build_int_cst (unsigned_char_type_node, i * element_size)); bitsize_int(i * element_size));
element = add_temp_var ("scalar", element); element = add_temp_var ("scalar", element);
elements.push_back (element); elements.push_back (element);
...@@ -1543,9 +1542,8 @@ tree_element_unary_visitor::operator () (brig_code_entry_handler &handler, ...@@ -1543,9 +1542,8 @@ tree_element_unary_visitor::operator () (brig_code_entry_handler &handler,
{ {
tree element = build3 (BIT_FIELD_REF, input_element_type, operand, tree element = build3 (BIT_FIELD_REF, input_element_type, operand,
TYPE_SIZE (input_element_type), TYPE_SIZE (input_element_type),
build_int_cst (unsigned_char_type_node, bitsize_int (i * element_size
i * element_size * BITS_PER_UNIT));
* BITS_PER_UNIT));
tree output = visit_element (handler, element); tree output = visit_element (handler, element);
output_element_type = TREE_TYPE (output); output_element_type = TREE_TYPE (output);
...@@ -1594,15 +1592,13 @@ tree_element_binary_visitor::operator () (brig_code_entry_handler &handler, ...@@ -1594,15 +1592,13 @@ tree_element_binary_visitor::operator () (brig_code_entry_handler &handler,
tree element0 = build3 (BIT_FIELD_REF, input_element_type, operand0, tree element0 = build3 (BIT_FIELD_REF, input_element_type, operand0,
TYPE_SIZE (input_element_type), TYPE_SIZE (input_element_type),
build_int_cst (unsigned_char_type_node, bitsize_int (i * element_size
i * element_size * BITS_PER_UNIT));
* BITS_PER_UNIT));
tree element1 = build3 (BIT_FIELD_REF, input_element_type, operand1, tree element1 = build3 (BIT_FIELD_REF, input_element_type, operand1,
TYPE_SIZE (input_element_type), TYPE_SIZE (input_element_type),
build_int_cst (unsigned_char_type_node, bitsize_int (i * element_size
i * element_size * BITS_PER_UNIT));
* BITS_PER_UNIT));
tree output = visit_element (handler, element0, element1); tree output = visit_element (handler, element0, element1);
output_element_type = TREE_TYPE (output); output_element_type = TREE_TYPE (output);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment