diff options
author | Andrew Stubbs <ams@codesourcery.com> | 2022-07-19 11:16:09 +0100 |
---|---|---|
committer | Andrew Stubbs <ams@codesourcery.com> | 2022-08-01 17:08:27 +0100 |
commit | b64e937ccde286278743e8fdffea494faa46c214 (patch) | |
tree | bdd623886329834497e6e08dba2fbc3c79f2cc96 /gcc/omp-simd-clone.cc | |
parent | 388fbbd895e72669909173c3003ae65c6483a3c2 (diff) | |
download | gcc-b64e937ccde286278743e8fdffea494faa46c214.zip gcc-b64e937ccde286278743e8fdffea494faa46c214.tar.gz gcc-b64e937ccde286278743e8fdffea494faa46c214.tar.bz2 |
openmp-simd-clone: Match shift types
Ensure that both parameters to vector shifts use the same mode. This is most
important for amdgcn where the masks are DImode.
gcc/ChangeLog:
* omp-simd-clone.cc (simd_clone_adjust): Convert shift_cnt to match
the mask type.
Co-authored-by: Jakub Jelinek <jakub@redhat.com>
Diffstat (limited to 'gcc/omp-simd-clone.cc')
-rw-r--r-- | gcc/omp-simd-clone.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/omp-simd-clone.cc b/gcc/omp-simd-clone.cc index 32649bc..58bd68b 100644 --- a/gcc/omp-simd-clone.cc +++ b/gcc/omp-simd-clone.cc @@ -1305,8 +1305,16 @@ simd_clone_adjust (struct cgraph_node *node) build_int_cst (TREE_TYPE (iter1), c)); gsi_insert_after (&gsi, g, GSI_CONTINUE_LINKING); } + tree shift_cnt_conv = shift_cnt; + if (!useless_type_conversion_p (TREE_TYPE (mask), + TREE_TYPE (shift_cnt))) + { + shift_cnt_conv = make_ssa_name (TREE_TYPE (mask)); + g = gimple_build_assign (shift_cnt_conv, NOP_EXPR, shift_cnt); + gsi_insert_after (&gsi, g, GSI_CONTINUE_LINKING); + } g = gimple_build_assign (make_ssa_name (TREE_TYPE (mask)), - RSHIFT_EXPR, mask, shift_cnt); + RSHIFT_EXPR, mask, shift_cnt_conv); gsi_insert_after (&gsi, g, GSI_CONTINUE_LINKING); mask = gimple_assign_lhs (g); g = gimple_build_assign (make_ssa_name (TREE_TYPE (mask)), |