From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1725) id BDBD7388A412; Wed, 16 Dec 2020 18:09:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BDBD7388A412 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: William Schmidt To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/wschmidt/heads/builtins4)] rs6000: Reflect MMA changes and finish BCD cleanup X-Act-Checkin: gcc X-Git-Author: Bill Schmidt X-Git-Refname: refs/users/wschmidt/heads/builtins4 X-Git-Oldrev: 1b21e3951d5bf7bd195c54c304fdf2049010754a X-Git-Newrev: 84698357f901734feeb42bcd23d634297cc8418a Message-Id: <20201216180927.BDBD7388A412@sourceware.org> Date: Wed, 16 Dec 2020 18:09:27 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2020 18:09:27 -0000 https://gcc.gnu.org/g:84698357f901734feeb42bcd23d634297cc8418a commit 84698357f901734feeb42bcd23d634297cc8418a Author: Bill Schmidt Date: Wed Dec 2 12:14:31 2020 -0600 rs6000: Reflect MMA changes and finish BCD cleanup 2020-12-02 Bill Schmidt gcc/ * config/rs6000/rs6000-builtin-new.def: BCD adjustments. * config/rs6000/rs6000-call.c (rs6000_gimple_fold_new_mma_builtin): Reflect recent changes. (rs6000_expand_new_builtin): Likewise. Diff: --- gcc/config/rs6000/rs6000-builtin-new.def | 6 +-- gcc/config/rs6000/rs6000-call.c | 69 +++++++++++++++++++++----------- 2 files changed, 48 insertions(+), 27 deletions(-) diff --git a/gcc/config/rs6000/rs6000-builtin-new.def b/gcc/config/rs6000/rs6000-builtin-new.def index 09cee286a3d..ba49ebf5365 100644 --- a/gcc/config/rs6000/rs6000-builtin-new.def +++ b/gcc/config/rs6000/rs6000-builtin-new.def @@ -2437,9 +2437,6 @@ const vus __builtin_crypto_vpermxor_v8hi (vus, vus, vus); VPERMXOR_V8HI crypto_vpermxor_v8hi {} - const _Decimal128 __builtin_denb2dfp_v16qi (vuc); - DENB2DFP_V16QI dfp_denbcd_v16qi {} - ; Note: these four have incorrect return types per the way the ; instructions work, but this matches the old signatures that ; have been around for too long. @@ -2930,6 +2927,9 @@ const _Decimal128 __builtin_denbcdq (const int<1>, _Decimal128); DENBCDQ dfp_denbcd_td {} + const _Decimal128 __builtin_denb2dfp_v16qi (const int<1>, vuc); + DENB2DFP_V16QI dfp_denbcd_v16qi {} + const _Decimal64 __builtin_diex (signed long long, _Decimal64); DIEX dfp_diex_dd {} diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c index 41559a08de0..2c5948ee93c 100644 --- a/gcc/config/rs6000/rs6000-call.c +++ b/gcc/config/rs6000/rs6000-call.c @@ -14261,24 +14261,24 @@ rs6000_gimple_fold_new_mma_builtin (gimple_stmt_iterator *gsi, gimple *new_call; tree new_decl; - /* #### Get rid of the adjacency dependency. */ - if (rs6000_builtin_info_x[fncode + 1].icode == CODE_FOR_nothing) + if (fncode == RS6000_BIF_DISASSEMBLE_ACC + || fncode == RS6000_BIF_DISASSEMBLE_PAIR) { /* This is an MMA disassemble built-in function. */ - gcc_assert (fncode == RS6000_BIF_DISASSEMBLE_ACC - || fncode == RS6000_BIF_DISASSEMBLE_PAIR); - push_gimplify_context (true); + unsigned nvec = (fncode == MMA_BUILTIN_DISASSEMBLE_ACC) ? 4 : 2; tree dst_ptr = gimple_call_arg (stmt, 0); tree src_ptr = gimple_call_arg (stmt, 1); tree src_type = TREE_TYPE (src_ptr); tree src = make_ssa_name (TREE_TYPE (src_type)); gimplify_assign (src, build_simple_mem_ref (src_ptr), &new_seq); - /* If we are not disassembling an accumulator or our destination is - another accumulator, then just copy the entire thing as is. */ - if (fncode != RS6000_BIF_DISASSEMBLE_ACC - || TREE_TYPE (TREE_TYPE (dst_ptr)) == vector_quad_type_node) + /* If we are not disassembling an accumulator/pair or our destination is + another accumulator/pair, then just copy the entire thing as is. */ + if ((fncode == RS6000_BIF_DISASSEMBLE_ACC + && TREE_TYPE (TREE_TYPE (dst_ptr)) == vector_quad_type_node) + || (fncode == RS6000_BIF_DISASSEMBLE_PAIR + && TREE_TYPE (TREE_TYPE (dst_ptr)) == vector_pair_type_node)) { tree dst = build_simple_mem_ref (build1 (VIEW_CONVERT_EXPR, src_type, dst_ptr)); @@ -14288,29 +14288,34 @@ rs6000_gimple_fold_new_mma_builtin (gimple_stmt_iterator *gsi, return true; } - /* We're disassembling an accumulator into a different type, so we need + /* If we're disassembling an accumulator into a different type, we need to emit a xxmfacc instruction now, since we cannot do it later. */ - new_decl = rs6000_builtin_decls_x[RS6000_BIF_XXMFACC_INTERNAL]; - new_call = gimple_build_call (new_decl, 1, src); - src = make_ssa_name (vector_quad_type_node); - gimple_call_set_lhs (new_call, src); - gimple_seq_add_stmt (&new_seq, new_call); + if (fncode == RS6000_BIF_DISASSEMBLE_ACC) + { + new_decl = rs6000_builtin_decls[RS6000_BIF_XXMFACC_INTERNAL]; + new_call = gimple_build_call (new_decl, 1, src); + src = make_ssa_name (vector_quad_type_node); + gimple_call_set_lhs (new_call, src); + gimple_seq_add_stmt (&new_seq, new_call); + } - /* Copy the accumulator vector by vector. */ + /* Copy the accumulator/pair vector by vector. */ + /* #### TODO: Break the adjacency dependency. */ + new_decl = rs6000_builtin_decls[fncode + 1]; tree dst_type = build_pointer_type_for_mode (unsigned_V16QI_type_node, ptr_mode, true); tree dst_base = build1 (VIEW_CONVERT_EXPR, dst_type, dst_ptr); - tree array_type = build_array_type_nelts (unsigned_V16QI_type_node, 4); - tree src_array = build1 (VIEW_CONVERT_EXPR, array_type, src); - for (unsigned i = 0; i < 4; i++) + for (unsigned i = 0; i < nvec; i++) { - unsigned index = WORDS_BIG_ENDIAN ? i : 3 - i; - tree ref = build4 (ARRAY_REF, unsigned_V16QI_type_node, src_array, - build_int_cst (size_type_node, i), - NULL_TREE, NULL_TREE); + unsigned index = WORDS_BIG_ENDIAN ? i : nvec - 1 - i; tree dst = build2 (MEM_REF, unsigned_V16QI_type_node, dst_base, build_int_cst (dst_type, index * 16)); - gimplify_assign (dst, ref, &new_seq); + tree dstssa = make_ssa_name (unsigned_V16QI_type_node); + new_call = gimple_build_call (new_decl, 2, src, + build_int_cstu (uint16_type_node, i)); + gimple_call_set_lhs (new_call, dstssa); + gimple_seq_add_stmt (&new_seq, new_call); + gimplify_assign (dst, dstssa, &new_seq); } pop_gimplify_context (NULL); gsi_replace_with_seq (gsi, new_seq, true); @@ -15383,6 +15388,22 @@ rs6000_expand_new_builtin (tree exp, rtx target, case CODE_FOR_xsiexpqp_kf: icode = CODE_FOR_xsiexpqp_tf; break; case CODE_FOR_xsiexpqpf_kf: icode = CODE_FOR_xsiexpqpf_tf; break; case CODE_FOR_xststdcqp_kf: icode = CODE_FOR_xststdcqp_tf; break; + + case CODE_FOR_xscmpexpqp_eq_kf: + icode = CODE_FOR_xscmpexpqp_eq_tf; + break; + + case CODE_FOR_xscmpexpqp_lt_kf: + icode = CODE_FOR_xscmpexpqp_lt_tf; + break; + + case CODE_FOR_xscmpexpqp_gt_kf: + icode = CODE_FOR_xscmpexpqp_gt_tf; + break; + + case CODE_FOR_xscmpexpqp_unordered_kf: + icode = CODE_FOR_xscmpexpqp_unordered_tf; + break; } bifdata *bifaddr = &rs6000_builtin_info_x[uns_fcode];