diff --git a/gcc/Makefile.in b/gcc/Makefile.in index aed321d27161418ff56f21608e72398ba6f6dcae..2f8382b5d498e0a7ef683a03f772c8b6b7dcc547 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1627,7 +1627,6 @@ OBJS = \ tree-streamer-out.o \ tree-tailcall.o \ tree-vect-generic.o \ - gimple-isel.o \ tree-vect-patterns.o \ tree-vect-data-refs.o \ tree-vect-stmts.o \ @@ -2596,7 +2595,6 @@ GTFILES = $(CPPLIB_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(srcdir)/dwarf2cfi.c \ $(srcdir)/dwarf2out.c \ $(srcdir)/tree-vect-generic.c \ - $(srcdir)/gimple-isel.cc \ $(srcdir)/dojump.c $(srcdir)/emit-rtl.h \ $(srcdir)/emit-rtl.c $(srcdir)/except.h $(srcdir)/explow.c $(srcdir)/expr.c \ $(srcdir)/expr.h \ diff --git a/gcc/builtin-types.def b/gcc/builtin-types.def index c46b1bc5cbd1fba03b033b8d44ba186570780c3f..c7aa691b243771c9768d524026600cb484115092 100644 --- a/gcc/builtin-types.def +++ b/gcc/builtin-types.def @@ -73,9 +73,6 @@ DEF_PRIMITIVE_TYPE (BT_UINT8, unsigned_char_type_node) DEF_PRIMITIVE_TYPE (BT_UINT16, uint16_type_node) DEF_PRIMITIVE_TYPE (BT_UINT32, uint32_type_node) DEF_PRIMITIVE_TYPE (BT_UINT64, uint64_type_node) -DEF_PRIMITIVE_TYPE (BT_UINT128, uint128_type_node - ? uint128_type_node - : error_mark_node) DEF_PRIMITIVE_TYPE (BT_WORD, (*lang_hooks.types.type_for_mode) (word_mode, 1)) DEF_PRIMITIVE_TYPE (BT_UNWINDWORD, (*lang_hooks.types.type_for_mode) (targetm.unwind_word_mode (), 1)) @@ -303,7 +300,6 @@ DEF_FUNCTION_TYPE_1 (BT_FN_UINT8_FLOAT, BT_UINT8, BT_FLOAT) DEF_FUNCTION_TYPE_1 (BT_FN_UINT16_UINT16, BT_UINT16, BT_UINT16) DEF_FUNCTION_TYPE_1 (BT_FN_UINT32_UINT32, BT_UINT32, BT_UINT32) DEF_FUNCTION_TYPE_1 (BT_FN_UINT64_UINT64, BT_UINT64, BT_UINT64) -DEF_FUNCTION_TYPE_1 (BT_FN_UINT128_UINT128, BT_UINT128, BT_UINT128) DEF_FUNCTION_TYPE_1 (BT_FN_UINT64_FLOAT, BT_UINT64, BT_FLOAT) DEF_FUNCTION_TYPE_1 (BT_FN_BOOL_INT, BT_BOOL, BT_INT) DEF_FUNCTION_TYPE_1 (BT_FN_BOOL_PTR, BT_BOOL, BT_PTR) diff --git a/gcc/builtins.c b/gcc/builtins.c index ffbb2cae9eeefc1ef119c6985f472ff6e0f2cf46..46e1fa1aea0b3d04e1aaf6eb05660745f40389c0 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -8094,7 +8094,6 @@ expand_builtin (tree exp, rtx target, rtx subtarget, machine_mode mode, case BUILT_IN_BSWAP16: case BUILT_IN_BSWAP32: case BUILT_IN_BSWAP64: - case BUILT_IN_BSWAP128: target = expand_builtin_bswap (target_mode, exp, target, subtarget); if (target) return target; @@ -11815,7 +11814,6 @@ is_inexpensive_builtin (tree decl) case BUILT_IN_BSWAP16: case BUILT_IN_BSWAP32: case BUILT_IN_BSWAP64: - case BUILT_IN_BSWAP128: case BUILT_IN_CLZ: case BUILT_IN_CLZIMAX: case BUILT_IN_CLZL: diff --git a/gcc/builtins.def b/gcc/builtins.def index b89cec11f097544dedf7c52031dd5047f621e99e..f5e9e854e27e5991e8043c0a509bcdc6f3ea3571 100644 --- a/gcc/builtins.def +++ b/gcc/builtins.def @@ -834,8 +834,6 @@ DEF_GCC_BUILTIN (BUILT_IN_APPLY_ARGS, "apply_args", BT_FN_PTR_VAR, ATTR_L DEF_GCC_BUILTIN (BUILT_IN_BSWAP16, "bswap16", BT_FN_UINT16_UINT16, ATTR_CONST_NOTHROW_LEAF_LIST) DEF_GCC_BUILTIN (BUILT_IN_BSWAP32, "bswap32", BT_FN_UINT32_UINT32, ATTR_CONST_NOTHROW_LEAF_LIST) DEF_GCC_BUILTIN (BUILT_IN_BSWAP64, "bswap64", BT_FN_UINT64_UINT64, ATTR_CONST_NOTHROW_LEAF_LIST) -DEF_GCC_BUILTIN (BUILT_IN_BSWAP128, "bswap128", BT_FN_UINT128_UINT128, ATTR_CONST_NOTHROW_LEAF_LIST) - DEF_EXT_LIB_BUILTIN (BUILT_IN_CLEAR_CACHE, "__clear_cache", BT_FN_VOID_PTR_PTR, ATTR_NOTHROW_LEAF_LIST) /* [trans-mem]: Adjust BUILT_IN_TM_CALLOC if BUILT_IN_CALLOC is changed. */ DEF_LIB_BUILTIN (BUILT_IN_CALLOC, "calloc", BT_FN_PTR_SIZE_SIZE, ATTR_MALLOC_WARN_UNUSED_RESULT_SIZE_1_2_NOTHROW_LEAF_LIST) diff --git a/gcc/common.opt b/gcc/common.opt index ea55355be2eb41b985575fd1bde4ed3d8992cb30..35f286291ba28fe6de88b5ca3a7965d99f886e0b 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -2114,10 +2114,6 @@ fmerge-debug-strings Common Report Var(flag_merge_debug_strings) Init(1) Attempt to merge identical debug strings across compilation units. -fmerge-mull -Common Report Var(flag_merge_mull) Init(0) Optimization -Attempt to merge series instructions into mul. - fmessage-length= Common RejectNegative Joined UInteger -fmessage-length= Limit diagnostics to characters per line. 0 suppresses line-wrapping. @@ -2842,10 +2838,6 @@ ftree-store-ccp Common Ignore Does nothing. Preserved for backward compatibility. -ftree-fold-phiopt -Common Report Var(flag_fold_phiopt) Init(0) Optimization -Attempt to simply the phi node with ssa form. - ftree-ch Common Report Var(flag_tree_ch) Optimization Enable loop header copying on trees. diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index c8388f902b8a3fdba0d5e455c38cc985fe65714a..4ee299fead47a67af5170badce27021905635d06 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -700,7 +700,6 @@ bool aarch64_legitimate_address_p (machine_mode, rtx, bool, aarch64_addr_query_type = ADDR_QUERY_M); machine_mode aarch64_select_cc_mode (RTX_CODE, rtx, rtx); rtx aarch64_gen_compare_reg (RTX_CODE, rtx, rtx); -bool aarch64_maxmin_plus_const (rtx_code, rtx *, bool); rtx aarch64_load_tp (rtx); void aarch64_expand_compare_and_swap (rtx op[]); diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 2117326baa1e8878a60c4824e63c2ad0dc392f46..f7afc3f8b15d08f639dcf7a3e94ec6c0276a8511 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -3211,110 +3211,6 @@ aarch64_gen_compare_reg_maybe_ze (RTX_CODE code, rtx x, rtx y, return aarch64_gen_compare_reg (code, x, y); } -/* Consider the operation: - - OPERANDS[0] = CODE (OPERANDS[1], OPERANDS[2]) + OPERANDS[3] - - where: - - - CODE is [SU]MAX or [SU]MIN - - OPERANDS[2] and OPERANDS[3] are constant integers - - OPERANDS[3] is a positive or negative shifted 12-bit immediate - - all operands have mode MODE - - Decide whether it is possible to implement the operation using: - - SUBS , OPERANDS[1], -OPERANDS[3] - or - ADDS , OPERANDS[1], OPERANDS[3] - - followed by: - - OPERANDS[0], , [wx]zr, - - where is one of CSEL, CSINV or CSINC. Return true if so. - If GENERATE_P is true, also update OPERANDS as follows: - - OPERANDS[4] = -OPERANDS[3] - OPERANDS[5] = the rtl condition representing - OPERANDS[6] = - OPERANDS[7] = 0 for CSEL, -1 for CSINV or 1 for CSINC. */ -bool -aarch64_maxmin_plus_const (rtx_code code, rtx *operands, bool generate_p) -{ - signop sgn = (code == UMAX || code == UMIN ? UNSIGNED : SIGNED); - rtx dst = operands[0]; - rtx maxmin_op = operands[2]; - rtx add_op = operands[3]; - machine_mode mode = GET_MODE (dst); - - /* max (x, y) - z == (x >= y + 1 ? x : y) - z - == (x >= y ? x : y) - z - == (x > y ? x : y) - z - == (x > y - 1 ? x : y) - z - - min (x, y) - z == (x <= y - 1 ? x : y) - z - == (x <= y ? x : y) - z - == (x < y ? x : y) - z - == (x < y + 1 ? x : y) - z - - Check whether z is in { y - 1, y, y + 1 } and pick the form(s) for - which x is compared with z. Set DIFF to y - z. Thus the supported - combinations are as follows, with DIFF being the value after the ":": - - max (x, y) - z == x >= y + 1 ? x - (y + 1) : -1 [z == y + 1] - == x >= y ? x - y : 0 [z == y] - == x > y ? x - y : 0 [z == y] - == x > y - 1 ? x - (y - 1) : 1 [z == y - 1] - - min (x, y) - z == x <= y - 1 ? x - (y - 1) : 1 [z == y - 1] - == x <= y ? x - y : 0 [z == y] - == x < y ? x - y : 0 [z == y] - == x < y + 1 ? x - (y + 1) : -1 [z == y + 1]. */ - rtx_mode_t maxmin_val = rtx_mode_t (maxmin_op, mode); - rtx_mode_t add_val = rtx_mode_t (add_op, mode); - wide_int sub_val = wi::neg (add_val); - wide_int diff = wi::sub (maxmin_val, sub_val); - if (!(diff == 0 - || (diff == 1 && wi::gt_p (maxmin_val, sub_val, sgn)) - || (diff == -1 && wi::lt_p (maxmin_val, sub_val, sgn)))) - return false; - - if (!generate_p) - return true; - - rtx_code cmp; - switch (code) - { - case SMAX: - cmp = diff == 1 ? GT : GE; - break; - case UMAX: - cmp = diff == 1 ? GTU : GEU; - break; - case SMIN: - cmp = diff == -1 ? LT : LE; - break; - case UMIN: - cmp = diff == -1 ? LTU : LEU; - break; - default: - gcc_unreachable (); - } - rtx cc = gen_rtx_REG (CCmode, CC_REGNUM); - - operands[4] = immed_wide_int_const (sub_val, mode); - operands[5] = gen_rtx_fmt_ee (cmp, VOIDmode, cc, const0_rtx); - if (can_create_pseudo_p ()) - operands[6] = gen_reg_rtx (mode); - else - operands[6] = dst; - operands[7] = immed_wide_int_const (diff, mode); - - return true; -} - - /* Build the SYMBOL_REF for __tls_get_addr. */ static GTY(()) rtx tls_get_addr_libfunc; diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 47bd53270d64175325865c6f114a144f83740fe6..9032e24e39bdccad2b6e6e06dd7b51b0538eeee7 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -4540,33 +4540,6 @@ } ) -;; Implement MAX/MIN (A, B) - C using SUBS/ADDS followed by CSEL/CSINV/CSINC. -;; See aarch64_maxmin_plus_const for details about the supported cases. -(define_insn_and_split "*aarch64_minmax_plus" - [(set (match_operand:GPI 0 "register_operand" "=r") - (plus:GPI - (MAXMIN:GPI - (match_operand:GPI 1 "register_operand" "r") - (match_operand:GPI 2 "const_int_operand")) - (match_operand:GPI 3 "aarch64_plus_immediate"))) - (clobber (reg:CC CC_REGNUM))] - "aarch64_maxmin_plus_const (, operands, false)" - "#" - "&& 1" - [(parallel - [(set (reg:CC CC_REGNUM) - (compare:CC (match_dup 1) (match_dup 4))) - (set (match_dup 6) - (plus:GPI (match_dup 1) (match_dup 3)))]) - (set (match_dup 0) - (if_then_else:GPI (match_dup 5) (match_dup 6) (match_dup 7)))] - { - if (!aarch64_maxmin_plus_const (, operands, true)) - gcc_unreachable (); - } - [(set_attr "length" "8")] -) - ;; ------------------------------------------------------------------- ;; Logical operations ;; ------------------------------------------------------------------- diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index a7bd772de4a593877babd245698ef901c2913519..9c7345959504a56eb397004bcc86e8c68f655fe9 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -13727,20 +13727,14 @@ exactly 8 bits. @deftypefn {Built-in Function} uint32_t __builtin_bswap32 (uint32_t x) Similar to @code{__builtin_bswap16}, except the argument and return types -are 32-bit. +are 32 bit. @end deftypefn @deftypefn {Built-in Function} uint64_t __builtin_bswap64 (uint64_t x) Similar to @code{__builtin_bswap32}, except the argument and return types -are 64-bit. +are 64 bit. @end deftypefn -@deftypefn {Built-in Function} uint128_t __builtin_bswap128 (uint128_t x) -Similar to @code{__builtin_bswap64}, except the argument and return types -are 128-bit. Only supported on targets when 128-bit types are supported. -@end deftypefn - - @deftypefn {Built-in Function} Pmode __builtin_extend_pointer (void * x) On targets where the user visible pointer size is smaller than the size of an actual hardware address this function returns the extended user diff --git a/gcc/expr.c b/gcc/expr.c index c468b5eb9f8a2bfa637a27f5e72182571c28ce9f..d66fdd4e93de0972742eca88b149c3c0337c7fd8 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -9286,8 +9286,17 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, if (temp != 0) return temp; + /* For vector MIN , expand it a VEC_COND_EXPR + and similarly for MAX . */ if (VECTOR_TYPE_P (type)) - gcc_unreachable (); + { + tree t0 = make_tree (type, op0); + tree t1 = make_tree (type, op1); + tree comparison = build2 (code == MIN_EXPR ? LE_EXPR : GE_EXPR, + type, t0, t1); + return expand_vec_cond_expr (type, comparison, t0, t1, + original_target); + } /* At this point, a MEM target is no longer useful; we will get better code without it. */ @@ -9876,6 +9885,10 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, return temp; } + case VEC_COND_EXPR: + target = expand_vec_cond_expr (type, treeop0, treeop1, treeop2, target); + return target; + case VEC_DUPLICATE_EXPR: op0 = expand_expr (treeop0, NULL_RTX, VOIDmode, modifier); target = expand_vector_broadcast (mode, op0); @@ -12209,7 +12222,8 @@ do_store_flag (sepops ops, rtx target, machine_mode mode) STRIP_NOPS (arg1); /* For vector typed comparisons emit code to generate the desired - all-ones or all-zeros mask. */ + all-ones or all-zeros mask. Conveniently use the VEC_COND_EXPR + expander for this. */ if (TREE_CODE (ops->type) == VECTOR_TYPE) { tree ifexp = build2 (ops->code, ops->type, arg0, arg1); @@ -12217,7 +12231,12 @@ do_store_flag (sepops ops, rtx target, machine_mode mode) && expand_vec_cmp_expr_p (TREE_TYPE (arg0), ops->type, ops->code)) return expand_vec_cmp_expr (ops->type, ifexp, target); else - gcc_unreachable (); + { + tree if_true = constant_boolean_node (true, ops->type); + tree if_false = constant_boolean_node (false, ops->type); + return expand_vec_cond_expr (ops->type, ifexp, if_true, + if_false, target); + } } /* Optimize (x % C1) == C2 or (x % C1) != C2 if it is beneficial diff --git a/gcc/fold-const-call.c b/gcc/fold-const-call.c index da01759d9c8e49048aab9fe40a10e9e0f4995bd4..6150d7adac5d3656523803d104babc4a70c879da 100644 --- a/gcc/fold-const-call.c +++ b/gcc/fold-const-call.c @@ -1032,7 +1032,6 @@ fold_const_call_ss (wide_int *result, combined_fn fn, const wide_int_ref &arg, case CFN_BUILT_IN_BSWAP16: case CFN_BUILT_IN_BSWAP32: case CFN_BUILT_IN_BSWAP64: - case CFN_BUILT_IN_BSWAP128: *result = wide_int::from (arg, precision, TYPE_SIGN (arg_type)).bswap (); return true; diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 78227a83d56a53463d5d0394b0f63dfe3203078b..6e635382fb405cd433adafd527f694c041155017 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -13889,10 +13889,8 @@ tree_call_nonnegative_warnv_p (tree type, combined_fn fn, tree arg0, tree arg1, CASE_CFN_POPCOUNT: CASE_CFN_CLZ: CASE_CFN_CLRSB: - case CFN_BUILT_IN_BSWAP16: case CFN_BUILT_IN_BSWAP32: case CFN_BUILT_IN_BSWAP64: - case CFN_BUILT_IN_BSWAP128: /* Always true. */ return true; diff --git a/gcc/gimple-isel.cc b/gcc/gimple-isel.cc deleted file mode 100644 index 97f9208050322a3bd874c7938e9226ac92991699..0000000000000000000000000000000000000000 --- a/gcc/gimple-isel.cc +++ /dev/null @@ -1,244 +0,0 @@ -/* Schedule GIMPLE vector statements. - Copyright (C) 2020 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3, or (at your option) any -later version. - -GCC is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING3. If not see -. */ - -#include "config.h" -#include "system.h" -#include "coretypes.h" -#include "backend.h" -#include "rtl.h" -#include "tree.h" -#include "gimple.h" -#include "tree-pass.h" -#include "ssa.h" -#include "expmed.h" -#include "optabs-tree.h" -#include "tree-eh.h" -#include "gimple-iterator.h" -#include "gimplify-me.h" -#include "gimplify.h" -#include "tree-cfg.h" - -/* Expand all VEC_COND_EXPR gimple assignments into calls to internal - function based on type of selected expansion. */ - -static gimple * -gimple_expand_vec_cond_expr (gimple_stmt_iterator *gsi, - hash_map *vec_cond_ssa_name_uses) -{ - tree lhs, op0a = NULL_TREE, op0b = NULL_TREE; - enum tree_code code; - enum tree_code tcode; - machine_mode cmp_op_mode; - bool unsignedp; - enum insn_code icode; - imm_use_iterator imm_iter; - - /* Only consider code == GIMPLE_ASSIGN. */ - gassign *stmt = dyn_cast (gsi_stmt (*gsi)); - if (!stmt) - return NULL; - - code = gimple_assign_rhs_code (stmt); - if (code != VEC_COND_EXPR) - return NULL; - - tree op0 = gimple_assign_rhs1 (stmt); - tree op1 = gimple_assign_rhs2 (stmt); - tree op2 = gimple_assign_rhs3 (stmt); - lhs = gimple_assign_lhs (stmt); - machine_mode mode = TYPE_MODE (TREE_TYPE (lhs)); - - gcc_assert (!COMPARISON_CLASS_P (op0)); - if (TREE_CODE (op0) == SSA_NAME) - { - unsigned int used_vec_cond_exprs = 0; - unsigned int *slot = vec_cond_ssa_name_uses->get (op0); - if (slot) - used_vec_cond_exprs = *slot; - else - { - gimple *use_stmt; - FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, op0) - { - gassign *assign = dyn_cast (use_stmt); - if (assign != NULL - && gimple_assign_rhs_code (assign) == VEC_COND_EXPR - && gimple_assign_rhs1 (assign) == op0) - used_vec_cond_exprs++; - } - vec_cond_ssa_name_uses->put (op0, used_vec_cond_exprs); - } - - gassign *def_stmt = dyn_cast (SSA_NAME_DEF_STMT (op0)); - if (def_stmt) - { - tcode = gimple_assign_rhs_code (def_stmt); - op0a = gimple_assign_rhs1 (def_stmt); - op0b = gimple_assign_rhs2 (def_stmt); - - tree op0a_type = TREE_TYPE (op0a); - if (used_vec_cond_exprs >= 2 - && (get_vcond_mask_icode (mode, TYPE_MODE (op0a_type)) - != CODE_FOR_nothing) - && expand_vec_cmp_expr_p (op0a_type, TREE_TYPE (lhs), tcode)) - { - /* Keep the SSA name and use vcond_mask. */ - tcode = TREE_CODE (op0); - } - } - else - tcode = TREE_CODE (op0); - } - else - tcode = TREE_CODE (op0); - - if (TREE_CODE_CLASS (tcode) != tcc_comparison) - { - gcc_assert (VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (op0))); - if (get_vcond_mask_icode (mode, TYPE_MODE (TREE_TYPE (op0))) - != CODE_FOR_nothing) - return gimple_build_call_internal (IFN_VCOND_MASK, 3, op0, op1, op2); - /* Fake op0 < 0. */ - else - { - gcc_assert (GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (op0))) - == MODE_VECTOR_INT); - op0a = op0; - op0b = build_zero_cst (TREE_TYPE (op0)); - tcode = LT_EXPR; - } - } - cmp_op_mode = TYPE_MODE (TREE_TYPE (op0a)); - unsignedp = TYPE_UNSIGNED (TREE_TYPE (op0a)); - - - gcc_assert (known_eq (GET_MODE_SIZE (mode), GET_MODE_SIZE (cmp_op_mode)) - && known_eq (GET_MODE_NUNITS (mode), - GET_MODE_NUNITS (cmp_op_mode))); - - icode = get_vcond_icode (mode, cmp_op_mode, unsignedp); - if (icode == CODE_FOR_nothing) - { - if (tcode == LT_EXPR - && op0a == op0 - && TREE_CODE (op0) == VECTOR_CST) - { - /* A VEC_COND_EXPR condition could be folded from EQ_EXPR/NE_EXPR - into a constant when only get_vcond_eq_icode is supported. - Verify < 0 and != 0 behave the same and change it to NE_EXPR. */ - unsigned HOST_WIDE_INT nelts; - if (!VECTOR_CST_NELTS (op0).is_constant (&nelts)) - { - if (VECTOR_CST_STEPPED_P (op0)) - gcc_unreachable (); - nelts = vector_cst_encoded_nelts (op0); - } - for (unsigned int i = 0; i < nelts; ++i) - if (tree_int_cst_sgn (vector_cst_elt (op0, i)) == 1) - gcc_unreachable (); - tcode = NE_EXPR; - } - if (tcode == EQ_EXPR || tcode == NE_EXPR) - { - tree tcode_tree = build_int_cst (integer_type_node, tcode); - return gimple_build_call_internal (IFN_VCONDEQ, 5, op0a, op0b, op1, - op2, tcode_tree); - } - } - - gcc_assert (icode != CODE_FOR_nothing); - tree tcode_tree = build_int_cst (integer_type_node, tcode); - return gimple_build_call_internal (unsignedp ? IFN_VCONDU : IFN_VCOND, - 5, op0a, op0b, op1, op2, tcode_tree); -} - - - -/* Iterate all gimple statements and try to expand - VEC_COND_EXPR assignments. */ - -static unsigned int -gimple_expand_vec_cond_exprs (void) -{ - gimple_stmt_iterator gsi; - basic_block bb; - bool cfg_changed = false; - hash_map vec_cond_ssa_name_uses; - - FOR_EACH_BB_FN (bb, cfun) - { - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - { - gimple *g = gimple_expand_vec_cond_expr (&gsi, - &vec_cond_ssa_name_uses); - if (g != NULL) - { - tree lhs = gimple_assign_lhs (gsi_stmt (gsi)); - gimple_set_lhs (g, lhs); - gsi_replace (&gsi, g, false); - } - } - } - - return cfg_changed ? TODO_cleanup_cfg : 0; -} - -namespace { - -const pass_data pass_data_gimple_isel = -{ - GIMPLE_PASS, /* type */ - "isel", /* name */ - OPTGROUP_VEC, /* optinfo_flags */ - TV_NONE, /* tv_id */ - PROP_cfg, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - TODO_update_ssa, /* todo_flags_finish */ -}; - -class pass_gimple_isel : public gimple_opt_pass -{ -public: - pass_gimple_isel (gcc::context *ctxt) - : gimple_opt_pass (pass_data_gimple_isel, ctxt) - {} - - /* opt_pass methods: */ - virtual bool gate (function *) - { - return true; - } - - virtual unsigned int execute (function *) - { - return gimple_expand_vec_cond_exprs (); - } - -}; // class pass_gimple_isel - -} // anon namespace - -gimple_opt_pass * -make_pass_gimple_isel (gcc::context *ctxt) -{ - return new pass_gimple_isel (ctxt); -} - diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c index 061aef39c2d5e984bb699c3ef3791f0edffb1cda..9b3e7298d87c81bfd38215df3aa4d0c958ebe3cc 100644 --- a/gcc/gimple-match-head.c +++ b/gcc/gimple-match-head.c @@ -884,20 +884,12 @@ try_conditional_simplification (internal_fn ifn, gimple_match_op *res_op, return true; } -/* Common subroutine of gimple_extract_op and gimple_simplify. Try to - describe STMT in RES_OP, returning true on success. Before recording - an operand, call: - - - VALUEIZE_CONDITION for a COND_EXPR condition - - VALUEIZE_OP for every other top-level operand - - Both routines take a tree argument and returns a tree. */ +/* The main STMT based simplification entry. It is used by the fold_stmt + and the fold_stmt_to_constant APIs. */ -template -inline bool -gimple_extract (gimple *stmt, gimple_match_op *res_op, - ValueizeOp valueize_op, - ValueizeCondition valueize_condition) +bool +gimple_simplify (gimple *stmt, gimple_match_op *res_op, gimple_seq *seq, + tree (*valueize)(tree), tree (*top_valueize)(tree)) { switch (gimple_code (stmt)) { @@ -913,50 +905,101 @@ gimple_extract (gimple *stmt, gimple_match_op *res_op, || code == VIEW_CONVERT_EXPR) { tree op0 = TREE_OPERAND (gimple_assign_rhs1 (stmt), 0); - res_op->set_op (code, type, valueize_op (op0)); - return true; + bool valueized = false; + op0 = do_valueize (op0, top_valueize, valueized); + res_op->set_op (code, type, op0); + return (gimple_resimplify1 (seq, res_op, valueize) + || valueized); } else if (code == BIT_FIELD_REF) { tree rhs1 = gimple_assign_rhs1 (stmt); - tree op0 = valueize_op (TREE_OPERAND (rhs1, 0)); + tree op0 = TREE_OPERAND (rhs1, 0); + bool valueized = false; + op0 = do_valueize (op0, top_valueize, valueized); res_op->set_op (code, type, op0, TREE_OPERAND (rhs1, 1), TREE_OPERAND (rhs1, 2), REF_REVERSE_STORAGE_ORDER (rhs1)); - return true; + if (res_op->reverse) + return valueized; + return (gimple_resimplify3 (seq, res_op, valueize) + || valueized); } - else if (code == SSA_NAME) + else if (code == SSA_NAME + && top_valueize) { tree op0 = gimple_assign_rhs1 (stmt); - res_op->set_op (TREE_CODE (op0), type, valueize_op (op0)); + tree valueized = top_valueize (op0); + if (!valueized || op0 == valueized) + return false; + res_op->set_op (TREE_CODE (op0), type, valueized); return true; } break; case GIMPLE_UNARY_RHS: { tree rhs1 = gimple_assign_rhs1 (stmt); - res_op->set_op (code, type, valueize_op (rhs1)); - return true; + bool valueized = false; + rhs1 = do_valueize (rhs1, top_valueize, valueized); + res_op->set_op (code, type, rhs1); + return (gimple_resimplify1 (seq, res_op, valueize) + || valueized); } case GIMPLE_BINARY_RHS: { - tree rhs1 = valueize_op (gimple_assign_rhs1 (stmt)); - tree rhs2 = valueize_op (gimple_assign_rhs2 (stmt)); + tree rhs1 = gimple_assign_rhs1 (stmt); + tree rhs2 = gimple_assign_rhs2 (stmt); + bool valueized = false; + rhs1 = do_valueize (rhs1, top_valueize, valueized); + rhs2 = do_valueize (rhs2, top_valueize, valueized); res_op->set_op (code, type, rhs1, rhs2); - return true; + return (gimple_resimplify2 (seq, res_op, valueize) + || valueized); } case GIMPLE_TERNARY_RHS: { + bool valueized = false; tree rhs1 = gimple_assign_rhs1 (stmt); - if (code == COND_EXPR && COMPARISON_CLASS_P (rhs1)) - rhs1 = valueize_condition (rhs1); - else - rhs1 = valueize_op (rhs1); - tree rhs2 = valueize_op (gimple_assign_rhs2 (stmt)); - tree rhs3 = valueize_op (gimple_assign_rhs3 (stmt)); + /* If this is a [VEC_]COND_EXPR first try to simplify an + embedded GENERIC condition. */ + if (code == COND_EXPR + || code == VEC_COND_EXPR) + { + if (COMPARISON_CLASS_P (rhs1)) + { + tree lhs = TREE_OPERAND (rhs1, 0); + tree rhs = TREE_OPERAND (rhs1, 1); + lhs = do_valueize (lhs, top_valueize, valueized); + rhs = do_valueize (rhs, top_valueize, valueized); + gimple_match_op res_op2 (res_op->cond, TREE_CODE (rhs1), + TREE_TYPE (rhs1), lhs, rhs); + if ((gimple_resimplify2 (seq, &res_op2, valueize) + || valueized) + && res_op2.code.is_tree_code ()) + { + valueized = true; + if (TREE_CODE_CLASS ((enum tree_code) res_op2.code) + == tcc_comparison) + rhs1 = build2 (res_op2.code, TREE_TYPE (rhs1), + res_op2.ops[0], res_op2.ops[1]); + else if (res_op2.code == SSA_NAME + || res_op2.code == INTEGER_CST + || res_op2.code == VECTOR_CST) + rhs1 = res_op2.ops[0]; + else + valueized = false; + } + } + } + tree rhs2 = gimple_assign_rhs2 (stmt); + tree rhs3 = gimple_assign_rhs3 (stmt); + rhs1 = do_valueize (rhs1, top_valueize, valueized); + rhs2 = do_valueize (rhs2, top_valueize, valueized); + rhs3 = do_valueize (rhs3, top_valueize, valueized); res_op->set_op (code, type, rhs1, rhs2, rhs3); - return true; + return (gimple_resimplify3 (seq, res_op, valueize) + || valueized); } default: gcc_unreachable (); @@ -970,6 +1013,7 @@ gimple_extract (gimple *stmt, gimple_match_op *res_op, && gimple_call_num_args (stmt) >= 1 && gimple_call_num_args (stmt) <= 5) { + bool valueized = false; combined_fn cfn; if (gimple_call_internal_p (stmt)) cfn = as_combined_fn (gimple_call_internal_fn (stmt)); @@ -979,7 +1023,7 @@ gimple_extract (gimple *stmt, gimple_match_op *res_op, if (!fn) return false; - fn = valueize_op (fn); + fn = do_valueize (fn, top_valueize, valueized); if (TREE_CODE (fn) != ADDR_EXPR || TREE_CODE (TREE_OPERAND (fn, 0)) != FUNCTION_DECL) return false; @@ -995,17 +1039,47 @@ gimple_extract (gimple *stmt, gimple_match_op *res_op, unsigned int num_args = gimple_call_num_args (stmt); res_op->set_op (cfn, TREE_TYPE (gimple_call_lhs (stmt)), num_args); for (unsigned i = 0; i < num_args; ++i) - res_op->ops[i] = valueize_op (gimple_call_arg (stmt, i)); - return true; + { + tree arg = gimple_call_arg (stmt, i); + res_op->ops[i] = do_valueize (arg, top_valueize, valueized); + } + if (internal_fn_p (cfn) + && try_conditional_simplification (as_internal_fn (cfn), + res_op, seq, valueize)) + return true; + switch (num_args) + { + case 1: + return (gimple_resimplify1 (seq, res_op, valueize) + || valueized); + case 2: + return (gimple_resimplify2 (seq, res_op, valueize) + || valueized); + case 3: + return (gimple_resimplify3 (seq, res_op, valueize) + || valueized); + case 4: + return (gimple_resimplify4 (seq, res_op, valueize) + || valueized); + case 5: + return (gimple_resimplify5 (seq, res_op, valueize) + || valueized); + default: + gcc_unreachable (); + } } break; case GIMPLE_COND: { - tree lhs = valueize_op (gimple_cond_lhs (stmt)); - tree rhs = valueize_op (gimple_cond_rhs (stmt)); + tree lhs = gimple_cond_lhs (stmt); + tree rhs = gimple_cond_rhs (stmt); + bool valueized = false; + lhs = do_valueize (lhs, top_valueize, valueized); + rhs = do_valueize (rhs, top_valueize, valueized); res_op->set_op (gimple_cond_code (stmt), boolean_type_node, lhs, rhs); - return true; + return (gimple_resimplify2 (seq, res_op, valueize) + || valueized); } default: @@ -1015,124 +1089,6 @@ gimple_extract (gimple *stmt, gimple_match_op *res_op, return false; } -/* Try to describe STMT in RES_OP, returning true on success. - For GIMPLE_CONDs, describe the condition that is being tested. - For GIMPLE_ASSIGNs, describe the rhs of the assignment. - For GIMPLE_CALLs, describe the call. */ - -bool -gimple_extract_op (gimple *stmt, gimple_match_op *res_op) -{ - /* This function is not called by other function now, so leave the - lambda to minimize modifiers. */ - tree (*nop)(tree) = [](tree op) - { - return op; - }; - return gimple_extract (stmt, res_op, nop, nop); -} - -/* The std=gnu++98 doesn't support c++ auto feature, and the origin - lambda capture some variables, so they can't be replaced with a - simple function pointer. */ -class __lambda_valueize -{ - typedef tree (*tree_op_func)(tree); - - public: - inline tree operator () (tree op) const - { - return do_valueize (op, top_valueize, valueized); - } - - private: - tree_op_func &top_valueize; - bool &valueized; - - public: - __lambda_valueize (tree_op_func &_top_valueize, bool &_valueized) - : top_valueize{_top_valueize}, valueized {_valueized} - {} -}; - -class __lambda_condition -{ - typedef tree (*tree_op_func)(tree); - - public: - inline tree operator () (tree op) const - { - bool cond_valueized = false; - tree lhs = do_valueize (TREE_OPERAND (op, 0), top_valueize, - cond_valueized); - tree rhs = do_valueize (TREE_OPERAND (op, 1), top_valueize, - cond_valueized); - gimple_match_op res_op2 (res_op->cond, TREE_CODE (op), - TREE_TYPE (op), lhs, rhs); - if ((gimple_resimplify2 (seq, &res_op2, valueize) || cond_valueized) - && res_op2.code.is_tree_code ()) - { - if (TREE_CODE_CLASS ((tree_code) res_op2.code) == tcc_comparison) - { - valueized = true; - return build2 (res_op2.code, TREE_TYPE (op), res_op2.ops[0], - res_op2.ops[1]); - } - else if (res_op2.code == SSA_NAME - || res_op2.code == INTEGER_CST - || res_op2.code == VECTOR_CST) - { - valueized = true; - return res_op2.ops[0]; - } - } - return do_valueize (op, top_valueize, valueized); - } - - private: - tree_op_func &top_valueize; - tree_op_func &valueize; - bool &valueized; - gimple_match_op *&res_op; - gimple_seq *&seq; - - public: - __lambda_condition (tree_op_func &_top_valueize, tree_op_func &_valueize, - bool &_valueized, gimple_match_op *&_res_op, gimple_seq *&_seq) - : top_valueize{_top_valueize}, valueize{_valueize}, valueized {_valueized}, - res_op {_res_op}, seq {_seq} - {} -}; - -/* The main STMT based simplification entry. It is used by the fold_stmt - and the fold_stmt_to_constant APIs. */ - -bool -gimple_simplify (gimple *stmt, gimple_match_op *res_op, gimple_seq *seq, - tree (*valueize)(tree), tree (*top_valueize)(tree)) -{ - bool valueized = false; - __lambda_valueize valueize_op = __lambda_valueize{top_valueize, valueized}; - __lambda_condition valueize_condition = __lambda_condition{top_valueize, - valueize, valueized, res_op, seq}; - - if (!gimple_extract (stmt, res_op, valueize_op, valueize_condition)) - return false; - - if (res_op->code.is_internal_fn ()) - { - internal_fn ifn = internal_fn (res_op->code); - if (try_conditional_simplification (ifn, res_op, seq, valueize)) - return true; - } - - if (!res_op->reverse - && res_op->num_ops - && res_op->resimplify (seq, valueize)) - return true; - - return valueized; -} /* Helper for the autogenerated code, valueize OP. */ diff --git a/gcc/gimple-match.h b/gcc/gimple-match.h index 39858c45f58ca610d0236f3e65e447d24cc1da11..097898aed1e0f385cf1fb49ed25ddc4ad43f27e6 100644 --- a/gcc/gimple-match.h +++ b/gcc/gimple-match.h @@ -33,39 +33,13 @@ public: code_helper (combined_fn fn) : rep (-(int) fn) {} operator tree_code () const { return (tree_code) rep; } operator combined_fn () const { return (combined_fn) -rep; } - explicit operator internal_fn () const; - explicit operator built_in_function () const; bool is_tree_code () const { return rep > 0; } bool is_fn_code () const { return rep < 0; } - bool is_internal_fn () const; - bool is_builtin_fn () const; int get_rep () const { return rep; } private: int rep; }; -inline code_helper::operator internal_fn () const -{ - return as_internal_fn (combined_fn (*this)); -} - -inline code_helper::operator built_in_function () const -{ - return as_builtin_fn (combined_fn (*this)); -} - -inline bool -code_helper::is_internal_fn () const -{ - return is_fn_code () && internal_fn_p (combined_fn (*this)); -} - -inline bool -code_helper::is_builtin_fn () const -{ - return is_fn_code () && builtin_fn_p (combined_fn (*this)); -} - /* Represents the condition under which an operation should happen, and the value to use otherwise. The condition applies elementwise (as for VEC_COND_EXPR) if the values are vectors. */ @@ -359,7 +333,6 @@ gimple_simplified_result_is_gimple_val (const gimple_match_op *op) extern tree (*mprts_hook) (gimple_match_op *); -bool gimple_extract_op (gimple *, gimple_match_op *); bool gimple_simplify (gimple *, gimple_match_op *, gimple_seq *, tree (*)(tree), tree (*)(tree)); tree maybe_push_res_to_seq (gimple_match_op *, gimple_seq *, diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 16b2f43285dbcdf4a6c9e0e7c7ecfcfc933634e7..89a4ae087ced8c86194e52734758b94735492887 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -14272,7 +14272,20 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, } case VEC_COND_EXPR: - goto expr_3; + { + enum gimplify_status r0, r1, r2; + + r0 = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, + post_p, is_gimple_condexpr, fb_rvalue); + r1 = gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, + post_p, is_gimple_val, fb_rvalue); + r2 = gimplify_expr (&TREE_OPERAND (*expr_p, 2), pre_p, + post_p, is_gimple_val, fb_rvalue); + + ret = MIN (MIN (r0, r1), r2); + recalculate_side_effects (*expr_p); + } + break; case VEC_PERM_EXPR: /* Classified as tcc_expression. */ diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c index e8a3bb6543b1644500172eea94c0e9eb98aeeac9..7bde23e616315665d4b4892ab0e66481218aa105 100644 --- a/gcc/internal-fn.c +++ b/gcc/internal-fn.c @@ -49,7 +49,6 @@ along with GCC; see the file COPYING3. If not see #include "gimple-ssa.h" #include "tree-phinodes.h" #include "ssa-iterators.h" -#include "explow.h" /* The names of each internal function, indexed by function number. */ const char *const internal_fn_name_array[] = { @@ -110,10 +109,6 @@ init_internal_fns () #define gather_prefetch_direct { 3, 1, false } #define store_lanes_direct { 0, 0, false } #define mask_store_lanes_direct { 0, 0, false } -#define vec_cond_mask_direct { 0, 0, false } -#define vec_cond_direct { 0, 0, false } -#define vec_condu_direct { 0, 0, false } -#define vec_condeq_direct { 0, 0, false } #define scatter_store_direct { 3, 1, false } #define unary_direct { 0, 0, true } #define binary_direct { 0, 0, true } @@ -2602,86 +2597,6 @@ expand_mask_store_optab_fn (internal_fn, gcall *stmt, convert_optab optab) #define expand_mask_store_lanes_optab_fn expand_mask_store_optab_fn -/* Expand VCOND, VCONDU and VCONDEQ optab internal functions. - The expansion of STMT happens based on OPTAB table associated. */ - -static void -expand_vect_cond_optab_fn (internal_fn, gcall *stmt, convert_optab optab) -{ - class expand_operand ops[6]; - insn_code icode; - tree lhs = gimple_call_lhs (stmt); - tree op0a = gimple_call_arg (stmt, 0); - tree op0b = gimple_call_arg (stmt, 1); - tree op1 = gimple_call_arg (stmt, 2); - tree op2 = gimple_call_arg (stmt, 3); - enum tree_code tcode = (tree_code) int_cst_value (gimple_call_arg (stmt, 4)); - - tree vec_cond_type = TREE_TYPE (lhs); - tree op_mode = TREE_TYPE (op0a); - bool unsignedp = TYPE_UNSIGNED (op_mode); - - machine_mode mode = TYPE_MODE (vec_cond_type); - machine_mode cmp_op_mode = TYPE_MODE (op_mode); - - icode = convert_optab_handler (optab, mode, cmp_op_mode); - rtx comparison - = vector_compare_rtx (VOIDmode, tcode, op0a, op0b, unsignedp, icode, 4); - rtx rtx_op1 = expand_normal (op1); - rtx rtx_op2 = expand_normal (op2); - - rtx target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE); - create_output_operand (&ops[0], target, mode); - create_input_operand (&ops[1], rtx_op1, mode); - create_input_operand (&ops[2], rtx_op2, mode); - create_fixed_operand (&ops[3], comparison); - create_fixed_operand (&ops[4], XEXP (comparison, 0)); - create_fixed_operand (&ops[5], XEXP (comparison, 1)); - expand_insn (icode, 6, ops); -} - -#define expand_vec_cond_optab_fn expand_vect_cond_optab_fn -#define expand_vec_condu_optab_fn expand_vect_cond_optab_fn -#define expand_vec_condeq_optab_fn expand_vect_cond_optab_fn - -/* Expand VCOND_MASK optab internal function. - The expansion of STMT happens based on OPTAB table associated. */ - -static void -expand_vect_cond_mask_optab_fn (internal_fn, gcall *stmt, convert_optab optab) -{ - class expand_operand ops[4]; - - tree lhs = gimple_call_lhs (stmt); - tree op0 = gimple_call_arg (stmt, 0); - tree op1 = gimple_call_arg (stmt, 1); - tree op2 = gimple_call_arg (stmt, 2); - tree vec_cond_type = TREE_TYPE (lhs); - - machine_mode mode = TYPE_MODE (vec_cond_type); - machine_mode mask_mode = TYPE_MODE (TREE_TYPE (op0)); - enum insn_code icode = convert_optab_handler (optab, mode, mask_mode); - rtx mask, rtx_op1, rtx_op2; - - gcc_assert (icode != CODE_FOR_nothing); - - mask = expand_normal (op0); - rtx_op1 = expand_normal (op1); - rtx_op2 = expand_normal (op2); - - mask = force_reg (mask_mode, mask); - rtx_op1 = force_reg (GET_MODE (rtx_op1), rtx_op1); - - rtx target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE); - create_output_operand (&ops[0], target, mode); - create_input_operand (&ops[1], rtx_op1, mode); - create_input_operand (&ops[2], rtx_op2, mode); - create_input_operand (&ops[3], mask, mask_mode); - expand_insn (icode, 4, ops); -} - -#define expand_vec_cond_mask_optab_fn expand_vect_cond_mask_optab_fn - static void expand_ABNORMAL_DISPATCHER (internal_fn, gcall *) { @@ -3331,10 +3246,6 @@ multi_vector_optab_supported_p (convert_optab optab, tree_pair types, #define direct_mask_store_optab_supported_p direct_optab_supported_p #define direct_store_lanes_optab_supported_p multi_vector_optab_supported_p #define direct_mask_store_lanes_optab_supported_p multi_vector_optab_supported_p -#define direct_vec_cond_mask_optab_supported_p multi_vector_optab_supported_p -#define direct_vec_cond_optab_supported_p multi_vector_optab_supported_p -#define direct_vec_condu_optab_supported_p multi_vector_optab_supported_p -#define direct_vec_condeq_optab_supported_p multi_vector_optab_supported_p #define direct_scatter_store_optab_supported_p convert_optab_supported_p #define direct_while_optab_supported_p convert_optab_supported_p #define direct_fold_extract_optab_supported_p direct_optab_supported_p diff --git a/gcc/internal-fn.def b/gcc/internal-fn.def index cc0f42b98c87e6a6f724991482c811b73c3f8119..04edbce2fcdf7fb814feaa5f6ee9bb01cfb95c12 100644 --- a/gcc/internal-fn.def +++ b/gcc/internal-fn.def @@ -140,11 +140,6 @@ DEF_INTERNAL_OPTAB_FN (STORE_LANES, ECF_CONST, vec_store_lanes, store_lanes) DEF_INTERNAL_OPTAB_FN (MASK_STORE_LANES, 0, vec_mask_store_lanes, mask_store_lanes) -DEF_INTERNAL_OPTAB_FN (VCOND, 0, vcond, vec_cond) -DEF_INTERNAL_OPTAB_FN (VCONDU, 0, vcondu, vec_condu) -DEF_INTERNAL_OPTAB_FN (VCONDEQ, 0, vcondeq, vec_condeq) -DEF_INTERNAL_OPTAB_FN (VCOND_MASK, 0, vcond_mask, vec_cond_mask) - DEF_INTERNAL_OPTAB_FN (WHILE_ULT, ECF_CONST | ECF_NOTHROW, while_ult, while) DEF_INTERNAL_OPTAB_FN (CHECK_RAW_PTRS, ECF_CONST | ECF_NOTHROW, check_raw_ptrs, check_ptrs) diff --git a/gcc/match.pd b/gcc/match.pd index 1097cd9268e0b41f11e93ee16797aff9d6e3b75d..8f70bc01a7cc623a4ae9fe90019d07f7a27d92fe 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -3380,75 +3380,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (if (types_match (@0, @1)) (vec_cond (bit_and (bit_not @0) @1) @2 @3))) -/* A few simplifications of "a ? CST1 : CST2". */ -/* NOTE: Only do this on gimple as the if-chain-to-switch - optimization depends on the gimple to have if statements in it. */ #if GIMPLE -(simplify - (cond @0 INTEGER_CST@1 INTEGER_CST@2) - (switch - (if (integer_zerop (@2)) - (switch - /* a ? 1 : 0 -> a if 0 and 1 are integral types. */ - (if (integer_onep (@1)) - (convert (convert:boolean_type_node @0))) - /* a ? powerof2cst : 0 -> a << (log2(powerof2cst)) */ - (if (INTEGRAL_TYPE_P (type) && TYPE_UNSIGNED (TREE_TYPE (@1)) - && integer_pow2p (@1)) - (with { - tree shift = build_int_cst (integer_type_node, tree_log2 (@1)); - } - (lshift (convert (convert:boolean_type_node @0)) { shift; }))) - /* a ? -1 : 0 -> -a. No need to check the TYPE_PRECISION not being 1 - here as the powerof2cst case above will handle that case correctly. */ - (if (INTEGRAL_TYPE_P (type) && integer_all_onesp (@1)) - (negate (convert (convert:boolean_type_node @0)))))) - (if (integer_zerop (@1)) - (with { - tree booltrue = constant_boolean_node (true, boolean_type_node); - } - (switch - /* a ? 0 : 1 -> !a. */ - (if (integer_onep (@2)) - (convert (bit_xor (convert:boolean_type_node @0) { booltrue; } ))) - /* a ? powerof2cst : 0 -> (!a) << (log2(powerof2cst)) */ - (if (INTEGRAL_TYPE_P (type) && integer_pow2p (@2)) - (with { - tree shift = build_int_cst (integer_type_node, tree_log2 (@2)); - } - (lshift (convert (bit_xor (convert:boolean_type_node @0) { booltrue; } )) - { shift; }))) - /* a ? -1 : 0 -> -(!a). No need to check the TYPE_PRECISION not being 1 - here as the powerof2cst case above will handle that case correctly. */ - (if (INTEGRAL_TYPE_P (type) && integer_all_onesp (@2)) - (negate (convert (bit_xor (convert:boolean_type_node @0) { booltrue; } )))) - ) - ) - ) - ) -) -#endif - -#if GIMPLE -(if (canonicalize_math_p ()) -/* These patterns are mostly used by PHIOPT to move some operations outside of - the if statements. They should be done late because it gives jump threading - and few other passes to reduce what is going on. */ -/* a ? x op C : x -> x op (a << log2(C)) when C is power of 2. */ - (for op (plus minus bit_ior bit_xor lshift rshift lrotate rrotate) - (simplify - (cond @0 (op:s @1 integer_pow2p@2) @1) - /* powerof2cst */ - (if (flag_merge_mull && INTEGRAL_TYPE_P (type)) - (with { - tree shift = build_int_cst (integer_type_node, tree_log2 (@2)); - } - (op @1 (lshift (convert (convert:boolean_type_node @0)) { shift; }))) - ) - ) - ) -) - (if (flag_if_conversion_gimple) (for simple_op (plus minus bit_and bit_ior bit_xor) (simplify @@ -3475,89 +3407,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) ) #endif -#if GIMPLE -/* These patterns are mostly used by FORWPROP4 to move some operations outside of - the if statements. They should be done late because it gives jump threading - and few other passes to reduce what is going on. */ -/* Mul64 is defined as a multiplication algorithm which compute two 64-bit - integers to one 128-bit integer. Try to match the high part of mul pattern - after the low part of mul pattern is simplified. The following scenario - should be matched: - (i64 ResLo, i64 ResHi) = Mul64(i64 In0, i64 In1) { - In0Lo = In0(D) & 4294967295; -- bit_and@4 SSA_NAME@0 @2 - In0Hi = In0(D) >> 32; -- rshift@5 SSA_NAME@0 @3 - In1Lo = In1(D) & 4294967295; -- bit_and@6 SSA_NAME@1 INTEGER_CST@2 - In1Hi = In1(D) >> 32; -- rshift@7 SSA_NAME@1 INTEGER_CST@3 - Mull_01 = In0Hi * In1Lo; -- mult@8 @5 @6 - Addc = In0Lo * In1Hi + Mull_01; -- plus@9 (mult (@4 @7) @8 - AddH = (Addc >> 32) + In0Hi * In1Hi -- (plus@11 (rshift @9 @3) (mult @5 @7)) - addc32 = Addc << 32; -- lshift@10 @9 @3 - ResLo = In0(D) * In1(D); -- mult @0 @1 - ResHi = ((long unsigned int) (addc32 > ResLo)) + - (((long unsigned int) (Mull_01 > Addc)) << 32) + AddH; - } */ -(simplify - (plus:c - (plus:c - (convert - (gt (lshift@10 @9 @3) - (mult:c @0 @1))) - (lshift - (convert - (gt @8 @9)) - @3)) - (plus:c@11 - (rshift - (plus:c@9 - (mult:c (bit_and@4 SSA_NAME@0 @2) @7) - (mult:c@8 @5 (bit_and@6 SSA_NAME@1 INTEGER_CST@2))) - @3) - (mult:c (rshift@5 SSA_NAME@0 @3) - (rshift@7 SSA_NAME@1 INTEGER_CST@3)) - ) - ) - (if (flag_merge_mull && INTEGRAL_TYPE_P (type) - && INTEGRAL_TYPE_P (TREE_TYPE (@0)) && types_match (@0, @1) - && TYPE_PRECISION (type) == 64) - (with { - tree i128_type = build_nonstandard_integer_type (128, TYPE_UNSIGNED (type)); - tree shift = build_int_cst (integer_type_node, 64); - } - (convert:type (rshift - (mult (convert:i128_type @0) - (convert:i128_type @1)) - { shift; }))) - ) -) -#endif - -#if GIMPLE -/* These patterns are mostly used by FORWPROP1 to fold some operations into more - simple IR. The following scenario should be matched: - In0Lo = In0(D) & 4294967295; - In0Hi = In0(D) >> 32; - In1Lo = In1(D) & 4294967295; - In1Hi = In1(D) >> 32; - Addc = In0Lo * In1Hi + In0Hi * In1Lo; - addc32 = Addc << 32; - ResLo = In0Lo * In1Lo + addc32 */ -(simplify - (plus:c (mult @4 @5) - (lshift - (plus:c - (mult (bit_and@4 SSA_NAME@0 @2) (rshift SSA_NAME@1 @3)) - (mult (rshift SSA_NAME@0 @3) (bit_and@5 SSA_NAME@1 INTEGER_CST@2))) - INTEGER_CST@3 - ) - ) - (if (flag_merge_mull && INTEGRAL_TYPE_P (type) - && INTEGRAL_TYPE_P (TREE_TYPE (@0)) && types_match (@0, @1) - && TYPE_PRECISION (type) == 64) - (mult (convert:type @0) (convert:type @1)) - ) -) -#endif - #if GIMPLE /* Try to match _4 = (int) _3; NOP_EXPR (SSA_NAME @2) @@ -4589,38 +4438,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (cmp (bit_and@2 @0 integer_pow2p@1) @1) (icmp @2 { build_zero_cst (TREE_TYPE (@0)); }))) -(for cmp (ge lt) -/* x < 0 ? ~y : y into (x >> (prec-1)) ^ y. */ -/* x >= 0 ? ~y : y into ~((x >> (prec-1)) ^ y). */ - (simplify - (cond (cmp @0 integer_zerop) (bit_not @1) @1) - (if (INTEGRAL_TYPE_P (type) - && INTEGRAL_TYPE_P (TREE_TYPE (@0)) - && !TYPE_UNSIGNED (TREE_TYPE (@0)) - && TYPE_PRECISION (TREE_TYPE (@0)) == TYPE_PRECISION (type)) - (with - { - tree shifter = build_int_cst (integer_type_node, TYPE_PRECISION (type) - 1); - } - (if (cmp == LT_EXPR) - (bit_xor (convert (rshift @0 {shifter;})) @1) - (bit_not (bit_xor (convert (rshift @0 {shifter;})) @1)))))) -/* x < 0 ? y : ~y into ~((x >> (prec-1)) ^ y). */ -/* x >= 0 ? y : ~y into (x >> (prec-1)) ^ y. */ - (simplify - (cond (cmp @0 integer_zerop) @1 (bit_not @1)) - (if (INTEGRAL_TYPE_P (type) - && INTEGRAL_TYPE_P (TREE_TYPE (@0)) - && !TYPE_UNSIGNED (TREE_TYPE (@0)) - && TYPE_PRECISION (TREE_TYPE (@0)) == TYPE_PRECISION (type)) - (with - { - tree shifter = build_int_cst (integer_type_node, TYPE_PRECISION (type) - 1); - } - (if (cmp == GE_EXPR) - (bit_xor (convert (rshift @0 {shifter;})) @1) - (bit_not (bit_xor (convert (rshift @0 {shifter;})) @1))))))) - /* If we have (A & C) != 0 ? D : 0 where C and D are powers of 2, convert this into a shift followed by ANDing with D. */ (simplify diff --git a/gcc/optabs.c b/gcc/optabs.c index 64a1a17686b7dfe11a40291703ac781458c53749..049a18ceb7c1d8e12cc1251fd48321e1c191a3a9 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -2896,11 +2896,8 @@ expand_unop (machine_mode mode, optab unoptab, rtx op0, rtx target, if (temp) return temp; - /* We do not provide a 128-bit bswap in libgcc so force the use of - a double bswap for 64-bit targets. */ if (GET_MODE_SIZE (int_mode) == 2 * UNITS_PER_WORD - && (UNITS_PER_WORD == 64 - || optab_handler (unoptab, word_mode) != CODE_FOR_nothing)) + && optab_handler (unoptab, word_mode) != CODE_FOR_nothing) { temp = expand_doubleword_bswap (mode, op0, target); if (temp) @@ -5454,7 +5451,7 @@ get_rtx_code (enum tree_code tcode, bool unsignedp) first comparison operand for insn ICODE. Do not generate the compare instruction itself. */ -rtx +static rtx vector_compare_rtx (machine_mode cmp_mode, enum tree_code tcode, tree t_op0, tree t_op1, bool unsignedp, enum insn_code icode, unsigned int opno) @@ -5821,6 +5818,128 @@ expand_vec_perm_var (machine_mode mode, rtx v0, rtx v1, rtx sel, rtx target) return tmp; } +/* Generate insns for a VEC_COND_EXPR with mask, given its TYPE and its + three operands. */ + +rtx +expand_vec_cond_mask_expr (tree vec_cond_type, tree op0, tree op1, tree op2, + rtx target) +{ + class expand_operand ops[4]; + machine_mode mode = TYPE_MODE (vec_cond_type); + machine_mode mask_mode = TYPE_MODE (TREE_TYPE (op0)); + enum insn_code icode = get_vcond_mask_icode (mode, mask_mode); + rtx mask, rtx_op1, rtx_op2; + + if (icode == CODE_FOR_nothing) + return 0; + + mask = expand_normal (op0); + rtx_op1 = expand_normal (op1); + rtx_op2 = expand_normal (op2); + + mask = force_reg (mask_mode, mask); + rtx_op1 = force_reg (GET_MODE (rtx_op1), rtx_op1); + + create_output_operand (&ops[0], target, mode); + create_input_operand (&ops[1], rtx_op1, mode); + create_input_operand (&ops[2], rtx_op2, mode); + create_input_operand (&ops[3], mask, mask_mode); + expand_insn (icode, 4, ops); + + return ops[0].value; +} + +/* Generate insns for a VEC_COND_EXPR, given its TYPE and its + three operands. */ + +rtx +expand_vec_cond_expr (tree vec_cond_type, tree op0, tree op1, tree op2, + rtx target) +{ + class expand_operand ops[6]; + enum insn_code icode; + rtx comparison, rtx_op1, rtx_op2; + machine_mode mode = TYPE_MODE (vec_cond_type); + machine_mode cmp_op_mode; + bool unsignedp; + tree op0a, op0b; + enum tree_code tcode; + + if (COMPARISON_CLASS_P (op0)) + { + op0a = TREE_OPERAND (op0, 0); + op0b = TREE_OPERAND (op0, 1); + tcode = TREE_CODE (op0); + } + else + { + gcc_assert (VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (op0))); + if (get_vcond_mask_icode (mode, TYPE_MODE (TREE_TYPE (op0))) + != CODE_FOR_nothing) + return expand_vec_cond_mask_expr (vec_cond_type, op0, op1, + op2, target); + /* Fake op0 < 0. */ + else + { + gcc_assert (GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (op0))) + == MODE_VECTOR_INT); + op0a = op0; + op0b = build_zero_cst (TREE_TYPE (op0)); + tcode = LT_EXPR; + } + } + cmp_op_mode = TYPE_MODE (TREE_TYPE (op0a)); + unsignedp = TYPE_UNSIGNED (TREE_TYPE (op0a)); + + + gcc_assert (known_eq (GET_MODE_SIZE (mode), GET_MODE_SIZE (cmp_op_mode)) + && known_eq (GET_MODE_NUNITS (mode), + GET_MODE_NUNITS (cmp_op_mode))); + + icode = get_vcond_icode (mode, cmp_op_mode, unsignedp); + if (icode == CODE_FOR_nothing) + { + if (tcode == LT_EXPR + && op0a == op0 + && TREE_CODE (op0) == VECTOR_CST) + { + /* A VEC_COND_EXPR condition could be folded from EQ_EXPR/NE_EXPR + into a constant when only get_vcond_eq_icode is supported. + Verify < 0 and != 0 behave the same and change it to NE_EXPR. */ + unsigned HOST_WIDE_INT nelts; + if (!VECTOR_CST_NELTS (op0).is_constant (&nelts)) + { + if (VECTOR_CST_STEPPED_P (op0)) + return 0; + nelts = vector_cst_encoded_nelts (op0); + } + for (unsigned int i = 0; i < nelts; ++i) + if (tree_int_cst_sgn (vector_cst_elt (op0, i)) == 1) + return 0; + tcode = NE_EXPR; + } + if (tcode == EQ_EXPR || tcode == NE_EXPR) + icode = get_vcond_eq_icode (mode, cmp_op_mode); + if (icode == CODE_FOR_nothing) + return 0; + } + + comparison = vector_compare_rtx (VOIDmode, tcode, op0a, op0b, unsignedp, + icode, 4); + rtx_op1 = expand_normal (op1); + rtx_op2 = expand_normal (op2); + + create_output_operand (&ops[0], target, mode); + create_input_operand (&ops[1], rtx_op1, mode); + create_input_operand (&ops[2], rtx_op2, mode); + create_fixed_operand (&ops[3], comparison); + create_fixed_operand (&ops[4], XEXP (comparison, 0)); + create_fixed_operand (&ops[5], XEXP (comparison, 1)); + expand_insn (icode, 6, ops); + return ops[0].value; +} + /* Generate VEC_SERIES_EXPR , returning a value of mode VMODE. Use TARGET for the result if nonnull and convenient. */ diff --git a/gcc/optabs.h b/gcc/optabs.h index 7c2ec257cb0d8c2433897b39bea2696f23a5c5ea..5bd19503a0ac0a3dbca322530cfb841a9e83cd2f 100644 --- a/gcc/optabs.h +++ b/gcc/optabs.h @@ -321,6 +321,9 @@ extern rtx expand_vec_perm_const (machine_mode, rtx, rtx, /* Generate code for vector comparison. */ extern rtx expand_vec_cmp_expr (tree, tree, rtx); +/* Generate code for VEC_COND_EXPR. */ +extern rtx expand_vec_cond_expr (tree, tree, tree, tree, rtx); + /* Generate code for VEC_SERIES_EXPR. */ extern rtx expand_vec_series_expr (machine_mode, rtx, rtx, rtx); @@ -361,9 +364,5 @@ extern void expand_jump_insn (enum insn_code icode, unsigned int nops, class expand_operand *ops); extern enum rtx_code get_rtx_code (enum tree_code tcode, bool unsignedp); -extern rtx vector_compare_rtx (machine_mode cmp_mode, enum tree_code tcode, - tree t_op0, tree t_op1, bool unsignedp, - enum insn_code icode, unsigned int opno); - #endif /* GCC_OPTABS_H */ diff --git a/gcc/passes.def b/gcc/passes.def index b6006de228895414b8cb9bf42584a37ef349be19..79f0e12c0e294512a3606e537193b018c85ab3c7 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -406,7 +406,6 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_cleanup_eh); NEXT_PASS (pass_lower_resx); NEXT_PASS (pass_nrv); - NEXT_PASS (pass_gimple_isel); NEXT_PASS (pass_cleanup_cfg_post_optimizing); NEXT_PASS (pass_warn_function_noreturn); NEXT_PASS (pass_gen_hsail); diff --git a/gcc/testsuite/c-c++-common/ubsan/pr85213.c b/gcc/testsuite/c-c++-common/ubsan/pr85213.c index 804c29da7667602b45a20db565334dc4f258643b..8a6be81d20fa5eb9f2a29e05316c732a5072d02a 100644 --- a/gcc/testsuite/c-c++-common/ubsan/pr85213.c +++ b/gcc/testsuite/c-c++-common/ubsan/pr85213.c @@ -1,6 +1,6 @@ /* PR sanitizer/85213 */ /* { dg-do compile } */ -/* { dg-options "-O1 -ftree-fold-phiopt -fsanitize=undefined -fcompare-debug" } */ +/* { dg-options "-O1 -fsanitize=undefined -fcompare-debug" } */ int foo (int x) diff --git a/gcc/testsuite/g++.dg/opt/pr94589-1.C b/gcc/testsuite/g++.dg/opt/pr94589-1.C deleted file mode 100644 index d1cc5050c2546b80a977f566856d2574d898bd6a..0000000000000000000000000000000000000000 --- a/gcc/testsuite/g++.dg/opt/pr94589-1.C +++ /dev/null @@ -1,33 +0,0 @@ -// PR tree-optimization/94589 -// { dg-do compile { target c++20 } } -// { dg-options "-O2 -g0 -fdump-tree-optimized" } -// { dg-final { scan-tree-dump-times "\[ij]_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[ij]_\[0-9]+\\(D\\)" 12 "optimized" } } -// { dg-final { scan-tree-dump-times "i_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[45]" 12 "optimized" } } - -#include - -#define A __attribute__((noipa)) -A bool f1 (int i, int j) { auto c = i <=> j; return c == 0; } -A bool f2 (int i, int j) { auto c = i <=> j; return c != 0; } -A bool f3 (int i, int j) { auto c = i <=> j; return c > 0; } -A bool f4 (int i, int j) { auto c = i <=> j; return c < 0; } -A bool f5 (int i, int j) { auto c = i <=> j; return c >= 0; } -A bool f6 (int i, int j) { auto c = i <=> j; return c <= 0; } -A bool f7 (int i, int j) { auto c = i <=> j; return c == std::strong_ordering::less; } -A bool f8 (int i, int j) { auto c = i <=> j; return c != std::strong_ordering::less; } -A bool f9 (int i, int j) { auto c = i <=> j; return c == std::strong_ordering::equal; } -A bool f10 (int i, int j) { auto c = i <=> j; return c != std::strong_ordering::equal; } -A bool f11 (int i, int j) { auto c = i <=> j; return c == std::strong_ordering::greater; } -A bool f12 (int i, int j) { auto c = i <=> j; return c != std::strong_ordering::greater; } -A bool f13 (int i) { auto c = i <=> 5; return c == 0; } -A bool f14 (int i) { auto c = i <=> 5; return c != 0; } -A bool f15 (int i) { auto c = i <=> 5; return c > 0; } -A bool f16 (int i) { auto c = i <=> 5; return c < 0; } -A bool f17 (int i) { auto c = i <=> 5; return c >= 0; } -A bool f18 (int i) { auto c = i <=> 5; return c <= 0; } -A bool f19 (int i) { auto c = i <=> 5; return c == std::strong_ordering::less; } -A bool f20 (int i) { auto c = i <=> 5; return c != std::strong_ordering::less; } -A bool f21 (int i) { auto c = i <=> 5; return c == std::strong_ordering::equal; } -A bool f22 (int i) { auto c = i <=> 5; return c != std::strong_ordering::equal; } -A bool f23 (int i) { auto c = i <=> 5; return c == std::strong_ordering::greater; } -A bool f24 (int i) { auto c = i <=> 5; return c != std::strong_ordering::greater; } diff --git a/gcc/testsuite/g++.dg/opt/pr94589-2.C b/gcc/testsuite/g++.dg/opt/pr94589-2.C deleted file mode 100644 index dda947e22b11db744f8a6ecde275b45006c2d985..0000000000000000000000000000000000000000 --- a/gcc/testsuite/g++.dg/opt/pr94589-2.C +++ /dev/null @@ -1,33 +0,0 @@ -// PR tree-optimization/94589 -// { dg-do compile { target c++20 } } -// { dg-options "-O2 -g0 -ffast-math -fdump-tree-optimized" } -// { dg-final { scan-tree-dump-times "\[ij]_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[ij]_\[0-9]+\\(D\\)" 14 "optimized" } } -// { dg-final { scan-tree-dump-times "i_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) 5\\.0" 14 "optimized" } } - -#include - -#define A __attribute__((noipa)) -A bool f1 (double i, double j) { auto c = i <=> j; return c == 0; } -A bool f2 (double i, double j) { auto c = i <=> j; return c != 0; } -A bool f3 (double i, double j) { auto c = i <=> j; return c > 0; } -A bool f4 (double i, double j) { auto c = i <=> j; return c < 0; } -A bool f5 (double i, double j) { auto c = i <=> j; return c >= 0; } -A bool f6 (double i, double j) { auto c = i <=> j; return c <= 0; } -A bool f7 (double i, double j) { auto c = i <=> j; return c == std::partial_ordering::less; } -A bool f8 (double i, double j) { auto c = i <=> j; return c != std::partial_ordering::less; } -A bool f9 (double i, double j) { auto c = i <=> j; return c == std::partial_ordering::equivalent; } -A bool f10 (double i, double j) { auto c = i <=> j; return c != std::partial_ordering::equivalent; } -A bool f11 (double i, double j) { auto c = i <=> j; return c == std::partial_ordering::greater; } -A bool f12 (double i, double j) { auto c = i <=> j; return c != std::partial_ordering::greater; } -A bool f13 (double i) { auto c = i <=> 5.0; return c == 0; } -A bool f14 (double i) { auto c = i <=> 5.0; return c != 0; } -A bool f15 (double i) { auto c = i <=> 5.0; return c > 0; } -A bool f16 (double i) { auto c = i <=> 5.0; return c < 0; } -A bool f17 (double i) { auto c = i <=> 5.0; return c >= 0; } -A bool f18 (double i) { auto c = i <=> 5.0; return c <= 0; } -A bool f19 (double i) { auto c = i <=> 5.0; return c == std::partial_ordering::less; } -A bool f20 (double i) { auto c = i <=> 5.0; return c != std::partial_ordering::less; } -A bool f21 (double i) { auto c = i <=> 5.0; return c == std::partial_ordering::equivalent; } -A bool f22 (double i) { auto c = i <=> 5.0; return c != std::partial_ordering::equivalent; } -A bool f23 (double i) { auto c = i <=> 5.0; return c == std::partial_ordering::greater; } -A bool f24 (double i) { auto c = i <=> 5.0; return c != std::partial_ordering::greater; } diff --git a/gcc/testsuite/g++.dg/opt/pr94589-3.C b/gcc/testsuite/g++.dg/opt/pr94589-3.C deleted file mode 100644 index 725b81f56b97cedfd7f67e150a8c700c3c7b216a..0000000000000000000000000000000000000000 --- a/gcc/testsuite/g++.dg/opt/pr94589-3.C +++ /dev/null @@ -1,84 +0,0 @@ -// { dg-do run { target c++20 } } -// { dg-options "-O2 -g" } - -#include "pr94589-1.C" - -#define C(fn, i, j, r) if (fn (i, j) != r) __builtin_abort () -#define D(fn, i, r) if (fn (i) != r) __builtin_abort () - -int -main () -{ - C (f1, 7, 8, false); - C (f1, 8, 8, true); - C (f1, 9, 8, false); - C (f2, 7, 8, true); - C (f2, 8, 8, false); - C (f2, 9, 8, true); - C (f3, 7, 8, false); - C (f3, 8, 8, false); - C (f3, 9, 8, true); - C (f4, 7, 8, true); - C (f4, 8, 8, false); - C (f4, 9, 8, false); - C (f5, 7, 8, false); - C (f5, 8, 8, true); - C (f5, 9, 8, true); - C (f6, 7, 8, true); - C (f6, 8, 8, true); - C (f6, 9, 8, false); - C (f7, 7, 8, true); - C (f7, 8, 8, false); - C (f7, 9, 8, false); - C (f8, 7, 8, false); - C (f8, 8, 8, true); - C (f8, 9, 8, true); - C (f9, 7, 8, false); - C (f9, 8, 8, true); - C (f9, 9, 8, false); - C (f10, 7, 8, true); - C (f10, 8, 8, false); - C (f10, 9, 8, true); - C (f11, 7, 8, false); - C (f11, 8, 8, false); - C (f11, 9, 8, true); - C (f12, 7, 8, true); - C (f12, 8, 8, true); - C (f12, 9, 8, false); - D (f13, 4, false); - D (f13, 5, true); - D (f13, 6, false); - D (f14, 4, true); - D (f14, 5, false); - D (f14, 6, true); - D (f15, 4, false); - D (f15, 5, false); - D (f15, 6, true); - D (f16, 4, true); - D (f16, 5, false); - D (f16, 6, false); - D (f17, 4, false); - D (f17, 5, true); - D (f17, 6, true); - D (f18, 4, true); - D (f18, 5, true); - D (f18, 6, false); - D (f19, 4, true); - D (f19, 5, false); - D (f19, 6, false); - D (f20, 4, false); - D (f20, 5, true); - D (f20, 6, true); - D (f21, 4, false); - D (f21, 5, true); - D (f21, 6, false); - D (f22, 4, true); - D (f22, 5, false); - D (f22, 6, true); - D (f23, 4, false); - D (f23, 5, false); - D (f23, 6, true); - D (f24, 4, true); - D (f24, 5, true); - D (f24, 6, false); -} diff --git a/gcc/testsuite/g++.dg/opt/pr94589-4.C b/gcc/testsuite/g++.dg/opt/pr94589-4.C deleted file mode 100644 index 256a455804ea8d218039a85572eea28e3c67d715..0000000000000000000000000000000000000000 --- a/gcc/testsuite/g++.dg/opt/pr94589-4.C +++ /dev/null @@ -1,84 +0,0 @@ -// { dg-do run { target c++20 } } -// { dg-options "-O2 -g -ffast-math" } - -#include "pr94589-2.C" - -#define C(fn, i, j, r) if (fn (i, j) != r) __builtin_abort () -#define D(fn, i, r) if (fn (i) != r) __builtin_abort () - -int -main () -{ - C (f1, 7.0, 8.0, false); - C (f1, 8.0, 8.0, true); - C (f1, 9.0, 8.0, false); - C (f2, 7.0, 8.0, true); - C (f2, 8.0, 8.0, false); - C (f2, 9.0, 8.0, true); - C (f3, 7.0, 8.0, false); - C (f3, 8.0, 8.0, false); - C (f3, 9.0, 8.0, true); - C (f4, 7.0, 8.0, true); - C (f4, 8.0, 8.0, false); - C (f4, 9.0, 8.0, false); - C (f5, 7.0, 8.0, false); - C (f5, 8.0, 8.0, true); - C (f5, 9.0, 8.0, true); - C (f6, 7.0, 8.0, true); - C (f6, 8.0, 8.0, true); - C (f6, 9.0, 8.0, false); - C (f7, 7.0, 8.0, true); - C (f7, 8.0, 8.0, false); - C (f7, 9.0, 8.0, false); - C (f8, 7.0, 8.0, false); - C (f8, 8.0, 8.0, true); - C (f8, 9.0, 8.0, true); - C (f9, 7.0, 8.0, false); - C (f9, 8.0, 8.0, true); - C (f9, 9.0, 8.0, false); - C (f10, 7.0, 8.0, true); - C (f10, 8.0, 8.0, false); - C (f10, 9.0, 8.0, true); - C (f11, 7.0, 8.0, false); - C (f11, 8.0, 8.0, false); - C (f11, 9.0, 8.0, true); - C (f12, 7.0, 8.0, true); - C (f12, 8.0, 8.0, true); - C (f12, 9.0, 8.0, false); - D (f13, 4.0, false); - D (f13, 5.0, true); - D (f13, 6.0, false); - D (f14, 4.0, true); - D (f14, 5.0, false); - D (f14, 6.0, true); - D (f15, 4.0, false); - D (f15, 5.0, false); - D (f15, 6.0, true); - D (f16, 4.0, true); - D (f16, 5.0, false); - D (f16, 6.0, false); - D (f17, 4.0, false); - D (f17, 5.0, true); - D (f17, 6.0, true); - D (f18, 4.0, true); - D (f18, 5.0, true); - D (f18, 6.0, false); - D (f19, 4.0, true); - D (f19, 5.0, false); - D (f19, 6.0, false); - D (f20, 4.0, false); - D (f20, 5.0, true); - D (f20, 6.0, true); - D (f21, 4.0, false); - D (f21, 5.0, true); - D (f21, 6.0, false); - D (f22, 4.0, true); - D (f22, 5.0, false); - D (f22, 6.0, true); - D (f23, 4.0, false); - D (f23, 5.0, false); - D (f23, 6.0, true); - D (f24, 4.0, true); - D (f24, 5.0, true); - D (f24, 6.0, false); -} diff --git a/gcc/testsuite/g++.dg/opt/pr99305.C b/gcc/testsuite/g++.dg/opt/pr99305.C index 06295116fe411dc3bf2f3346496dba45abe49170..6fcdef391fdb9f6dd9dee96acabcaccafb10c3e7 100644 --- a/gcc/testsuite/g++.dg/opt/pr99305.C +++ b/gcc/testsuite/g++.dg/opt/pr99305.C @@ -1,6 +1,6 @@ // PR tree-optimization/99305 // { dg-do compile } -// { dg-options "-O3 -ftree-fold-phiopt -fno-ipa-icf -fdump-tree-optimized" } +// { dg-options "-O3 -fno-ipa-icf -fdump-tree-optimized" } // { dg-final { scan-tree-dump-times " = \\\(unsigned char\\\) c_\[0-9]*\\\(D\\\);" 3 "optimized" { target { ! unsigned_char } } } } // { dg-final { scan-tree-dump-times " = \[^\n\r]* \\+ \[0-9]*;" 3 "optimized" } } // { dg-final { scan-tree-dump-times " = \[^\n\r]* <= 9;" 3 "optimized" } } diff --git a/gcc/testsuite/g++.dg/tree-ssa/mull64.C b/gcc/testsuite/g++.dg/tree-ssa/mull64.C deleted file mode 100644 index ec359f2bae45ee8e402401c082e9f387d4bb03ea..0000000000000000000000000000000000000000 --- a/gcc/testsuite/g++.dg/tree-ssa/mull64.C +++ /dev/null @@ -1,35 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-O2 -ftree-fold-phiopt -fmerge-mull -Wno-psabi -fdump-tree-forwprop1-details -fdump-tree-forwprop4-details" } */ - -# define BN_BITS4 32 -# define BN_MASK2 (0xffffffffffffffffL) -# define BN_MASK2l (0xffffffffL) -# define BN_MASK2h (0xffffffff00000000L) -# define BN_MASK2h1 (0xffffffff80000000L) -# define LBITS(a) ((a)&BN_MASK2l) -# define HBITS(a) (((a)>>BN_BITS4)&BN_MASK2l) -# define L2HBITS(a) (((a)< typedef unsigned __int128 uint128_t; diff --git a/gcc/testsuite/gcc.dg/double_sized_mul-2.c b/gcc/testsuite/gcc.dg/double_sized_mul-2.c index f9d58a2f6443807c4f8415dcf4904a2fdcdedbd1..cc6e5af25d82db2b80649b439cd89fcaf23ad480 100644 --- a/gcc/testsuite/gcc.dg/double_sized_mul-2.c +++ b/gcc/testsuite/gcc.dg/double_sized_mul-2.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* fif-conversion-gimple is required for proper overflow detection in some cases. */ -/* { dg-options "-O2 -fif-conversion-gimple -fuaddsub-overflow-match-all -ftree-fold-phiopt -fdump-tree-widening_mul-stats" } */ +/* { dg-options "-O2 -fif-conversion-gimple -fuaddsub-overflow-match-all -fdump-tree-widening_mul-stats" } */ #include typedef unsigned __int128 uint128_t; diff --git a/gcc/testsuite/gcc.dg/ifcvt-gimple.c b/gcc/testsuite/gcc.dg/ifcvt-gimple.c index 4dc0f92061afa1cb1091499cc060e73ba91792fd..0f7c87e5c5bed4c0ac81416a944e7c187391c90f 100644 --- a/gcc/testsuite/gcc.dg/ifcvt-gimple.c +++ b/gcc/testsuite/gcc.dg/ifcvt-gimple.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fif-conversion-gimple -fdump-tree-optimized -ftree-fold-phiopt" } */ +/* { dg-options "-O2 -fif-conversion-gimple -fdump-tree-optimized" } */ int test_int (int optimizable_int) { if (optimizable_int > 5) diff --git a/gcc/testsuite/gcc.dg/pr107190.c b/gcc/testsuite/gcc.dg/pr107190.c deleted file mode 100644 index d4e5fa0d0f51d04e88f5720320572a1990a1abf2..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.dg/pr107190.c +++ /dev/null @@ -1,27 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-O2 -ftree-fold-phiopt -fmerge-mull -fexpensive-optimizations -fdump-tree-phiopt2-details" } */ - -# define BN_BITS4 32 -# define BN_MASK2 (0xffffffffffffffffL) -# define BN_MASK2l (0xffffffffL) -# define BN_MASK2h (0xffffffff00000000L) -# define BN_MASK2h1 (0xffffffff80000000L) -# define LBITS(a) ((a)&BN_MASK2l) -# define HBITS(a) (((a)>>BN_BITS4)&BN_MASK2l) -# define L2HBITS(a) (((a)<|>=) \[ij]_\[0-9]+\\(D\\)" 14 "optimized" } } */ -/* { dg-final { scan-tree-dump-times "i_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[45]" 14 "optimized" } } */ - -#define A __attribute__((noipa)) -A int f1 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c == 0; } -A int f2 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c != 0; } -A int f3 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c > 0; } -A int f4 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c < 0; } -A int f5 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c >= 0; } -A int f6 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c <= 0; } -A int f7 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c == -1; } -A int f8 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c != -1; } -A int f9 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c > -1; } -A int f10 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c <= -1; } -A int f11 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c == 1; } -A int f12 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c != 1; } -A int f13 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c < 1; } -A int f14 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c >= 1; } -A int f15 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c == 0; } -A int f16 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c != 0; } -A int f17 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c > 0; } -A int f18 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c < 0; } -A int f19 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c >= 0; } -A int f20 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c <= 0; } -A int f21 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c == -1; } -A int f22 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c != -1; } -A int f23 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c > -1; } -A int f24 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c <= -1; } -A int f25 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c == 1; } -A int f26 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c != 1; } -A int f27 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c < 1; } -A int f28 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c >= 1; } diff --git a/gcc/testsuite/gcc.dg/pr94589-2.c b/gcc/testsuite/gcc.dg/pr94589-2.c deleted file mode 100644 index 9481b764dabf749aec7edf20ddb0938d23e26dcf..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.dg/pr94589-2.c +++ /dev/null @@ -1,35 +0,0 @@ -/* PR tree-optimization/94589 */ -/* { dg-do compile } */ -/* { dg-options "-O2 -g0 -ffast-math -fdump-tree-optimized" } */ -/* { dg-final { scan-tree-dump-times "\[ij]_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[ij]_\[0-9]+\\(D\\)" 14 "optimized" } } */ -/* { dg-final { scan-tree-dump-times "i_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) 5\\.0" 14 "optimized" } } */ - -#define A __attribute__((noipa)) -A int f1 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c == 0; } -A int f2 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c != 0; } -A int f3 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c > 0; } -A int f4 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c < 0; } -A int f5 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c >= 0; } -A int f6 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c <= 0; } -A int f7 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c == -1; } -A int f8 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c != -1; } -A int f9 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c > -1; } -A int f10 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c <= -1; } -A int f11 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c == 1; } -A int f12 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c != 1; } -A int f13 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c < 1; } -A int f14 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c >= 1; } -A int f15 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c == 0; } -A int f16 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c != 0; } -A int f17 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c > 0; } -A int f18 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c < 0; } -A int f19 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c >= 0; } -A int f20 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c <= 0; } -A int f21 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c == -1; } -A int f22 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c != -1; } -A int f23 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c > -1; } -A int f24 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c <= -1; } -A int f25 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c == 1; } -A int f26 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c != 1; } -A int f27 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c < 1; } -A int f28 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c >= 1; } diff --git a/gcc/testsuite/gcc.dg/pr94589-3.c b/gcc/testsuite/gcc.dg/pr94589-3.c deleted file mode 100644 index df82fab7334be0b2be5b086bf29cd0325baf5e39..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.dg/pr94589-3.c +++ /dev/null @@ -1,97 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 -g" } */ - -#include "pr94589-1.c" - -#define C(fn, i, j, r) if (fn (i, j) != r) __builtin_abort () -#define D(fn, i, r) if (fn (i) != r) __builtin_abort () - -int -main () -{ - C (f1, 7, 8, 0); - C (f1, 8, 8, 1); - C (f1, 9, 8, 0); - C (f2, 7, 8, 1); - C (f2, 8, 8, 0); - C (f2, 9, 8, 1); - C (f3, 7, 8, 0); - C (f3, 8, 8, 0); - C (f3, 9, 8, 1); - C (f4, 7, 8, 1); - C (f4, 8, 8, 0); - C (f4, 9, 8, 0); - C (f5, 7, 8, 0); - C (f5, 8, 8, 1); - C (f5, 9, 8, 1); - C (f6, 7, 8, 1); - C (f6, 8, 8, 1); - C (f6, 9, 8, 0); - C (f7, 7, 8, 1); - C (f7, 8, 8, 0); - C (f7, 9, 8, 0); - C (f8, 7, 8, 0); - C (f8, 8, 8, 1); - C (f8, 9, 8, 1); - C (f9, 7, 8, 0); - C (f9, 8, 8, 1); - C (f9, 9, 8, 1); - C (f10, 7, 8, 1); - C (f10, 8, 8, 0); - C (f10, 9, 8, 0); - C (f11, 7, 8, 0); - C (f11, 8, 8, 0); - C (f11, 9, 8, 1); - C (f12, 7, 8, 1); - C (f12, 8, 8, 1); - C (f12, 9, 8, 0); - C (f13, 7, 8, 1); - C (f13, 8, 8, 1); - C (f13, 9, 8, 0); - C (f14, 7, 8, 0); - C (f14, 8, 8, 0); - C (f14, 9, 8, 1); - D (f15, 4, 0); - D (f15, 5, 1); - D (f15, 6, 0); - D (f16, 4, 1); - D (f16, 5, 0); - D (f16, 6, 1); - D (f17, 4, 0); - D (f17, 5, 0); - D (f17, 6, 1); - D (f18, 4, 1); - D (f18, 5, 0); - D (f18, 6, 0); - D (f19, 4, 0); - D (f19, 5, 1); - D (f19, 6, 1); - D (f20, 4, 1); - D (f20, 5, 1); - D (f20, 6, 0); - D (f21, 4, 1); - D (f21, 5, 0); - D (f21, 6, 0); - D (f22, 4, 0); - D (f22, 5, 1); - D (f22, 6, 1); - D (f23, 4, 0); - D (f23, 5, 1); - D (f23, 6, 1); - D (f24, 4, 1); - D (f24, 5, 0); - D (f24, 6, 0); - D (f25, 4, 0); - D (f25, 5, 0); - D (f25, 6, 1); - D (f26, 4, 1); - D (f26, 5, 1); - D (f26, 6, 0); - D (f27, 4, 1); - D (f27, 5, 1); - D (f27, 6, 0); - D (f28, 4, 0); - D (f28, 5, 0); - D (f28, 6, 1); - return 0; -} diff --git a/gcc/testsuite/gcc.dg/pr94589-4.c b/gcc/testsuite/gcc.dg/pr94589-4.c deleted file mode 100644 index b2557fb07b0f48b4c31839969a3554c4ed7dcd5f..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.dg/pr94589-4.c +++ /dev/null @@ -1,97 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 -g -ffast-math" } */ - -#include "pr94589-2.c" - -#define C(fn, i, j, r) if (fn (i, j) != r) __builtin_abort () -#define D(fn, i, r) if (fn (i) != r) __builtin_abort () - -int -main () -{ - C (f1, 7.0, 8.0, 0); - C (f1, 8.0, 8.0, 1); - C (f1, 9.0, 8.0, 0); - C (f2, 7.0, 8.0, 1); - C (f2, 8.0, 8.0, 0); - C (f2, 9.0, 8.0, 1); - C (f3, 7.0, 8.0, 0); - C (f3, 8.0, 8.0, 0); - C (f3, 9.0, 8.0, 1); - C (f4, 7.0, 8.0, 1); - C (f4, 8.0, 8.0, 0); - C (f4, 9.0, 8.0, 0); - C (f5, 7.0, 8.0, 0); - C (f5, 8.0, 8.0, 1); - C (f5, 9.0, 8.0, 1); - C (f6, 7.0, 8.0, 1); - C (f6, 8.0, 8.0, 1); - C (f6, 9.0, 8.0, 0); - C (f7, 7.0, 8.0, 1); - C (f7, 8.0, 8.0, 0); - C (f7, 9.0, 8.0, 0); - C (f8, 7.0, 8.0, 0); - C (f8, 8.0, 8.0, 1); - C (f8, 9.0, 8.0, 1); - C (f9, 7.0, 8.0, 0); - C (f9, 8.0, 8.0, 1); - C (f9, 9.0, 8.0, 1); - C (f10, 7.0, 8.0, 1); - C (f10, 8.0, 8.0, 0); - C (f10, 9.0, 8.0, 0); - C (f11, 7.0, 8.0, 0); - C (f11, 8.0, 8.0, 0); - C (f11, 9.0, 8.0, 1); - C (f12, 7.0, 8.0, 1); - C (f12, 8.0, 8.0, 1); - C (f12, 9.0, 8.0, 0); - C (f13, 7.0, 8.0, 1); - C (f13, 8.0, 8.0, 1); - C (f13, 9.0, 8.0, 0); - C (f14, 7.0, 8.0, 0); - C (f14, 8.0, 8.0, 0); - C (f14, 9.0, 8.0, 1); - D (f15, 4.0, 0); - D (f15, 5.0, 1); - D (f15, 6.0, 0); - D (f16, 4.0, 1); - D (f16, 5.0, 0); - D (f16, 6.0, 1); - D (f17, 4.0, 0); - D (f17, 5.0, 0); - D (f17, 6.0, 1); - D (f18, 4.0, 1); - D (f18, 5.0, 0); - D (f18, 6.0, 0); - D (f19, 4.0, 0); - D (f19, 5.0, 1); - D (f19, 6.0, 1); - D (f20, 4.0, 1); - D (f20, 5.0, 1); - D (f20, 6.0, 0); - D (f21, 4.0, 1); - D (f21, 5.0, 0); - D (f21, 6.0, 0); - D (f22, 4.0, 0); - D (f22, 5.0, 1); - D (f22, 6.0, 1); - D (f23, 4.0, 0); - D (f23, 5.0, 1); - D (f23, 6.0, 1); - D (f24, 4.0, 1); - D (f24, 5.0, 0); - D (f24, 6.0, 0); - D (f25, 4.0, 0); - D (f25, 5.0, 0); - D (f25, 6.0, 1); - D (f26, 4.0, 1); - D (f26, 5.0, 1); - D (f26, 6.0, 0); - D (f27, 4.0, 1); - D (f27, 5.0, 1); - D (f27, 6.0, 0); - D (f28, 4.0, 0); - D (f28, 5.0, 0); - D (f28, 6.0, 1); - return 0; -} diff --git a/gcc/testsuite/gcc.dg/pr97238.c b/gcc/testsuite/gcc.dg/pr97238.c deleted file mode 100644 index 746e93a9750233a5295ebe62d3f4709cbd19134c..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.dg/pr97238.c +++ /dev/null @@ -1,12 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-O -Wno-psabi -w" } */ - -typedef int __attribute__ ((__vector_size__ (8))) V; -int b, c, e; -V d; - -V -foo (void) -{ - return (b || e) | c > d | ((b || e) | c > d); -} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040514-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040514-1.c index b04316d55c69a2c8d41cfc074a7de9736652a8b3..364ce6a6966a2602f6fa327aa890fb01cc29fdd4 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20040514-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20040514-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -ftree-fold-phiopt -fdump-tree-phiopt2-details" } */ +/* { dg-options "-O1 -fdump-tree-phiopt2-details" } */ int t( int i) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bool-1.c b/gcc/testsuite/gcc.dg/tree-ssa/bool-1.c index 89265410837e64505ca12efaccc369c617218a16..401357f2f2fa87e603fe217550b68bb12d257bcc 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/bool-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/bool-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -ftree-fold-phiopt -fdump-tree-optimized" } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ int f(_Bool x) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bool-2.c b/gcc/testsuite/gcc.dg/tree-ssa/bool-2.c index 5ead90f06c41c62c221a4d67681e5157fd8be89d..add9cca1e217d23084b0aa8dde429b58bba2a410 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/bool-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/bool-2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -ftree-fold-phiopt -fdump-tree-optimized" } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ int f(_Bool x) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c index 7b678fafcb508a64d5f14836ad27f544a5fc1c2d..4c190e6af7daa1c928db2f1d445c3905d2de97ae 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -ftree-fold-phiopt -fdump-tree-optimized" } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ int nem1_phi (unsigned long a) { return a ? -1 : 0; } int eqm1_phi (unsigned long a) { return a ? 0 : -1; } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-21.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-21.c deleted file mode 100644 index 9f3d5695728bb3d981a1552f410e6c45dec3a83f..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-21.c +++ /dev/null @@ -1,15 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-phiopt4-details" } */ - -int f(unsigned s) -{ - int i; - for (i = 0; i < s; ++i) - ; - - return i; -} - -/* { dg-final { scan-tree-dump "converted to straightline code" "phiopt4" } } */ -/* Make sure we fold the detected MAX. */ -/* { dg-final { scan-tree-dump-not "MAX" "phiopt4" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-22.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-22.c index 23b67964401d74d7483f351d8f3666c057436352..fd37066662bc9796fb3148fa329592920c3615a5 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-22.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-22.c @@ -1,6 +1,6 @@ /* PR tree-optimization/97690 */ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-fold-phiopt -fdump-tree-phiopt2" } */ +/* { dg-options "-O2 -fdump-tree-phiopt2" } */ int foo (_Bool d) { return d ? 2 : 0; } int bar (_Bool d) { return d ? 1 : 0; } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25.c deleted file mode 100644 index c52c92e1d4503fa71dc98669767aebad9ee45f4a..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25.c +++ /dev/null @@ -1,83 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-optimized" } */ - -unsigned short test_bswap16(unsigned short x) -{ - return x ? __builtin_bswap16(x) : 0; -} - -unsigned int test_bswap32(unsigned int x) -{ - return x ? __builtin_bswap32(x) : 0; -} - -unsigned long long test_bswap64(unsigned long long x) -{ - return x ? __builtin_bswap64(x) : 0; -} - -int test_clrsb(int x) -{ - return x ? __builtin_clrsb(x) : (__SIZEOF_INT__*8-1); -} - -int test_clrsbl(long x) -{ - return x ? __builtin_clrsbl(x) : (__SIZEOF_LONG__*8-1); -} - -int test_clrsbll(long long x) -{ - return x ? __builtin_clrsbll(x) : (__SIZEOF_LONG_LONG__*8-1); -} - -#if 0 -/* BUILT_IN_FFS is transformed by match.pd */ -int test_ffs(unsigned int x) -{ - return x ? __builtin_ffs(x) : 0; -} - -int test_ffsl(unsigned long x) -{ - return x ? __builtin_ffsl(x) : 0; -} - -int test_ffsll(unsigned long long x) -{ - return x ? __builtin_ffsll(x) : 0; -} -#endif - -int test_parity(int x) -{ - return x ? __builtin_parity(x) : 0; -} - -int test_parityl(long x) -{ - return x ? __builtin_parityl(x) : 0; -} - -int test_parityll(long long x) -{ - return x ? __builtin_parityll(x) : 0; -} - -int test_popcount(int x) -{ - return x ? __builtin_popcount(x) : 0; -} - -int test_popcountl(long x) -{ - return x ? __builtin_popcountl(x) : 0; -} - -int test_popcountll(long long x) -{ - return x ? __builtin_popcountll(x) : 0; -} - -/* { dg-final { scan-tree-dump-not "goto" "optimized" } } */ - diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-4.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-4.c index 4efd9afc4f4985958da086ed0a50046c7ac8e915..3bdb8560932b2a5e8a5494a9b17fcf274e29a938 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-4.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-4.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -ftree-fold-phiopt -fdump-tree-optimized" } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ _Bool t(); _Bool t1(); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c index 60dcc673319c8facb5d549d80f2f9618b47288e3..18ecbd52aa223adef40a802b324a8910458b7f77 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -ftree-fold-phiopt -fdump-tree-optimized" } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ int g(int,int); int f(int t, int c) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-8.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-8.c index aaa71a317bcab3a2ba463a50eb53f699a4e3b037..98c596b6aa4f6106f9b0bdf20679cd2522a244fc 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-8.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-8.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O -ftree-fold-phiopt -fdump-tree-optimized -fdump-tree-phiopt2" } */ +/* { dg-options "-O -fdump-tree-optimized -fdump-tree-phiopt2" } */ int g(int,int); int f(int t, int c) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr18134.c b/gcc/testsuite/gcc.dg/tree-ssa/pr18134.c index efb1907cf5365468a2901f4a2b4951b7eaeb343f..cd40ab2c162bd168b120d200f694e97bea89dbd4 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr18134.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr18134.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -ftree-fold-phiopt -fdump-tree-optimized" } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ int foo (int a) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21829.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21829.c index 8c8ada90523ad07bf777e210bc8fa476c063fa70..8f5ae5127e33729a9aa42f46a2154ec0a818e7c0 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr21829.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21829.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-fold-phiopt -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ int test(int v) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr88676-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr88676-2.c index ea88407b672b09b45c027540c7b2d101d8582174..0e616365b4f1359408035afde2c488ff28efc054 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr88676-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr88676-2.c @@ -1,7 +1,7 @@ /* PR tree-optimization/88676 */ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-phiopt2" } */ -/* { dg-final { scan-tree-dump-not " = PHI <" "phiopt2" { target le } } } */ +/* { dg-options "-O2 -fdump-tree-phiopt1" } */ +/* { dg-final { scan-tree-dump-not " = PHI <" "phiopt1" { target le } } } */ struct foo1 { int i:1; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr96232-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr96232-2.c deleted file mode 100644 index 9f51820edfffa35e7bccec012e452b61c3a51880..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr96232-2.c +++ /dev/null @@ -1,18 +0,0 @@ -/* PR tree-optimization/96232 */ -/* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-optimized" } */ -/* { dg-final { scan-tree-dump " 38 - " "optimized" } } */ -/* { dg-final { scan-tree-dump " \\+ 97;" "optimized" } } */ -/* { dg-final { scan-tree-dump-not "PHI <" "optimized" } } */ - -int -foo (_Bool x) -{ - return x ? 37 : 38; -} - -int -bar (_Bool x) -{ - return x ? 98 : 97; -} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr96928-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr96928-1.c deleted file mode 100644 index 88c13806aa56deefa1c38dcd4350ce3aab8d0e1c..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr96928-1.c +++ /dev/null @@ -1,48 +0,0 @@ -/* PR tree-optimization/96928 */ -/* { dg-do compile } */ -/* { dg-options "-O2 -ftree-fold-phiopt -fdump-tree-phiopt2 -fdump-tree-optimized" } */ -/* { dg-final { scan-tree-dump-times " = a_\[0-9]*\\\(D\\\) >> " 5 "phiopt2" } } */ -/* { dg-final { scan-tree-dump-times " = ~c_\[0-9]*\\\(D\\\);" 1 "phiopt2" } } */ -/* { dg-final { scan-tree-dump-times " = ~" 1 "optimized" } } */ -/* { dg-final { scan-tree-dump-times " = \[abc_0-9\\\(\\\)D]* \\\^ " 5 "phiopt2" } } */ -/* { dg-final { scan-tree-dump-not "a < 0" "phiopt2" } } */ - -int -foo (int a) -{ - if (a < 0) - return ~a; - return a; -} - -int -bar (int a, int b) -{ - if (a < 0) - return ~b; - return b; -} - -unsigned -baz (int a, unsigned int b) -{ - if (a < 0) - return ~b; - return b; -} - -unsigned -qux (int a, unsigned int c) -{ - if (a >= 0) - return ~c; - return c; -} - -int -corge (int a, int b) -{ - if (a >= 0) - return b; - return ~b; -} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr96928.c b/gcc/testsuite/gcc.dg/tree-ssa/pr96928.c deleted file mode 100644 index e8fd82fc26ed25d77cdae577cc4fa9b857962525..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr96928.c +++ /dev/null @@ -1,41 +0,0 @@ -/* PR tree-optimization/96928 */ -/* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-phiopt2 -fdump-tree-optimized" } */ -/* { dg-final { scan-tree-dump-times " = a_\[0-9]*\\\(D\\\) >> " 5 "phiopt2" } } */ -/* The following check is done at optimized because a ^ (~b) is rewritten as ~(a^b) - and in the case of match.pd optimizing these ?:, the ~ is moved out already - by the time we get to phiopt2. */ -/* { dg-final { scan-tree-dump-times "\\\^ c_\[0-9]*\\\(D\\\);" 1 "optimized" } } */ -/* { dg-final { scan-tree-dump-times " = ~" 1 "phiopt2" } } */ -/* { dg-final { scan-tree-dump-times " = \[abc_0-9\\\(\\\)D]* \\\^ " 5 "phiopt2" } } */ -/* { dg-final { scan-tree-dump-not "a < 0" "phiopt2" } } */ - -int -foo (int a) -{ - return a < 0 ? ~a : a; -} - -int -bar (int a, int b) -{ - return a < 0 ? ~b : b; -} - -unsigned -baz (int a, unsigned int b) -{ - return a < 0 ? ~b : b; -} - -unsigned -qux (int a, unsigned int c) -{ - return a >= 0 ? ~c : c; -} - -int -corge (int a, int b) -{ - return a >= 0 ? b : ~b; -} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr97503.c b/gcc/testsuite/gcc.dg/tree-ssa/pr97503.c deleted file mode 100644 index 3a3dae6c786feb91e0755c5aced2b28effe47067..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr97503.c +++ /dev/null @@ -1,19 +0,0 @@ -/* PR tree-optimization/97503 */ -/* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-optimized" } */ -/* { dg-additional-options "-mbmi -mlzcnt" { target i?86-*-* x86_64-*-* } } */ -/* { dg-final { scan-tree-dump-times "\.CLZ" 2 "optimized" { target { { i?86-*-* x86_64-*-* aarch64-*-* powerpc*-*-* } && lp64 } } } } */ -/* { dg-final { scan-tree-dump-not "__builtin_clz" "optimized" { target { { i?86-*-* x86_64-*-* aarch64-*-* powerpc*-*-*} && lp64 } } } } */ -/* { dg-final { scan-tree-dump-not "PHI <" "optimized" { target { { i?86-*-* x86_64-*-* aarch64-*-* powerpc*-*-*} && lp64 } } } } */ - -int -foo (int x) -{ - return x ? __builtin_clz (x) : 32; -} - -int -bar (unsigned long long x) -{ - return x ? __builtin_clzll (x) : 64; -} diff --git a/gcc/testsuite/gcc.dg/uninit-8.c b/gcc/testsuite/gcc.dg/uninit-8.c index e8fd942cf78ada94d18a9c7308a6dca323268593..98700f4aa1fd2c5b829c9a1a7acc30b5349c82bf 100644 --- a/gcc/testsuite/gcc.dg/uninit-8.c +++ b/gcc/testsuite/gcc.dg/uninit-8.c @@ -3,7 +3,7 @@ May be the same as uninit-1.c. */ /* { dg-do compile } */ -/* { dg-options "-O -ftree-fold-phiopt -Wuninitialized" } */ +/* { dg-options "-O -Wuninitialized" } */ #include diff --git a/gcc/testsuite/gcc.target/aarch64/bics_3.c b/gcc/testsuite/gcc.target/aarch64/bics_3.c index ab6f0210e6ef48a347a81fb0b6e110674fc9da97..3257df6228d2b84239140587119a10d48ddaa92f 100644 --- a/gcc/testsuite/gcc.target/aarch64/bics_3.c +++ b/gcc/testsuite/gcc.target/aarch64/bics_3.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O2 -ftree-fold-phiopt --save-temps" } */ +/* { dg-options "-O2 --save-temps" } */ extern void abort (void); diff --git a/gcc/testsuite/gcc.target/aarch64/max_plus_1.c b/gcc/testsuite/gcc.target/aarch64/max_plus_1.c deleted file mode 100644 index ef336aeec4f870a39a0fd3336c36ea868a7e575f..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.target/aarch64/max_plus_1.c +++ /dev/null @@ -1,149 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 --save-temps" } */ -/* { dg-final { check-function-bodies "**" "" "" } } */ - -/* -** f1: -** adds (w[0-9]+), w0, #4 -** csel w0, \1, wzr, g[te] -** ret -*/ -/* -** f2: -** adds (w[0-9]+), w0, #4 -** csel w0, \1, wzr, g[te] -** ret -*/ -/* -** f3: -** adds (w[0-9]+), w0, #5 -** csinc w0, \1, wzr, gt -** ret -*/ -/* -** f4: -** adds (w[0-9]+), w0, #3 -** csinv w0, \1, wzr, ge -** ret -*/ - -#ifndef TYPE -#define TYPE int32_t -#define TYPE_MIN INT32_MIN -#define TYPE_MAX INT32_MAX -#define VALUE -4 -#endif - -#include - -TYPE __attribute__((noipa)) -f1 (TYPE x) -{ - return (x > VALUE ? x - VALUE : 0); -} - -TYPE __attribute__((noipa)) -f2 (TYPE x) -{ - return (x > VALUE ? x : VALUE) - VALUE; -} - -TYPE __attribute__((noipa)) -f3 (TYPE x) -{ - return (x > VALUE ? x : VALUE) - (VALUE - 1); -} - -TYPE __attribute__((noipa)) -f4 (TYPE x) -{ - return (x > VALUE ? x : VALUE) - (VALUE + 1); -} - -TYPE __attribute__((noipa)) -f5 (TYPE x) -{ - return (x > VALUE ? x : VALUE) - (VALUE + 2); -} - -TYPE __attribute__((noipa)) -f6 (TYPE x) -{ - return (x > VALUE ? x : VALUE) - (VALUE - 2); -} - -int -main (void) -{ - TYPE max_test = TYPE_MAX; - if (TYPE_MIN < 0 && VALUE < 0) - max_test += VALUE; - - if (f1 (TYPE_MIN) != 0) - __builtin_abort (); - if (f1 (VALUE - 1) != 0) - __builtin_abort (); - if (f1 (VALUE) != 0) - __builtin_abort (); - if (f1 (VALUE + 1) != 1) - __builtin_abort (); - if (f1 (max_test) != max_test - VALUE) - __builtin_abort (); - - if (f2 (TYPE_MIN) != 0) - __builtin_abort (); - if (f2 (VALUE - 1) != 0) - __builtin_abort (); - if (f2 (VALUE) != 0) - __builtin_abort (); - if (f2 (VALUE + 1) != 1) - __builtin_abort (); - if (f2 (max_test) != max_test - VALUE) - __builtin_abort (); - - if (f3 (TYPE_MIN) != 1) - __builtin_abort (); - if (f3 (VALUE - 1) != 1) - __builtin_abort (); - if (f3 (VALUE) != 1) - __builtin_abort (); - if (f3 (VALUE + 1) != 2) - __builtin_abort (); - if (f3 (max_test - 1) != max_test - VALUE) - __builtin_abort (); - - if (f4 (TYPE_MIN) != -1) - __builtin_abort (); - if (f4 (VALUE - 1) != -1) - __builtin_abort (); - if (f4 (VALUE) != -1) - __builtin_abort (); - if (f4 (VALUE + 1) != 0) - __builtin_abort (); - if (f4 (max_test) != max_test - VALUE - 1) - __builtin_abort (); - - if (f5 (TYPE_MIN) != -2) - __builtin_abort (); - if (f5 (VALUE - 1) != -2) - __builtin_abort (); - if (f5 (VALUE) != -2) - __builtin_abort (); - if (f5 (VALUE + 1) != -1) - __builtin_abort (); - if (f5 (max_test) != max_test - VALUE - 2) - __builtin_abort (); - - if (f6 (TYPE_MIN) != 2) - __builtin_abort (); - if (f6 (VALUE - 1) != 2) - __builtin_abort (); - if (f6 (VALUE) != 2) - __builtin_abort (); - if (f6 (VALUE + 1) != 3) - __builtin_abort (); - if (VALUE <= max_test - 2 && f6 (max_test - 2) != max_test - VALUE) - __builtin_abort (); - - return 0; -} diff --git a/gcc/testsuite/gcc.target/aarch64/max_plus_2.c b/gcc/testsuite/gcc.target/aarch64/max_plus_2.c deleted file mode 100644 index a2a1295d91856d27043a613354d7a22dd42ff792..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.target/aarch64/max_plus_2.c +++ /dev/null @@ -1,35 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 --save-temps" } */ -/* { dg-final { check-function-bodies "**" "" "" } } */ - -/* -** f1: -** adds (x[0-9]+), x0, #4094 -** csel x0, \1, xzr, g[te] -** ret -*/ -/* -** f2: -** adds (x[0-9]+), x0, #4094 -** csel x0, \1, xzr, g[te] -** ret -*/ -/* -** f3: -** adds (x[0-9]+), x0, #4095 -** csinc x0, \1, xzr, gt -** ret -*/ -/* -** f4: -** adds (x[0-9]+), x0, #4093 -** csinv x0, \1, xzr, ge -** ret -*/ - -#define TYPE int64_t -#define TYPE_MIN INT64_MIN -#define TYPE_MAX INT64_MAX -#define VALUE -4094 - -#include "max_plus_1.c" diff --git a/gcc/testsuite/gcc.target/aarch64/max_plus_3.c b/gcc/testsuite/gcc.target/aarch64/max_plus_3.c deleted file mode 100644 index a9792ecc94d991513588618ed30889c733850ddd..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.target/aarch64/max_plus_3.c +++ /dev/null @@ -1,35 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 --save-temps" } */ -/* { dg-final { check-function-bodies "**" "" "" } } */ - -/* -** f1: -** adds (w[0-9]+), w0, #4095 -** csel w0, \1, wzr, g[te] -** ret -*/ -/* -** f2: -** adds (w[0-9]+), w0, #4095 -** csel w0, \1, wzr, g[te] -** ret -*/ -/* -** f3: -** adds (w[0-9]+), w0, #4096 -** csinc w0, \1, wzr, gt -** ret -*/ -/* -** f4: -** adds (w[0-9]+), w0, #4094 -** csinv w0, \1, wzr, ge -** ret -*/ - -#define TYPE int32_t -#define TYPE_MIN INT32_MIN -#define TYPE_MAX INT32_MAX -#define VALUE -4095 - -#include "max_plus_1.c" diff --git a/gcc/testsuite/gcc.target/aarch64/max_plus_4.c b/gcc/testsuite/gcc.target/aarch64/max_plus_4.c deleted file mode 100644 index 5090fa101921f2d2c717cb027c4e724552e4c376..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.target/aarch64/max_plus_4.c +++ /dev/null @@ -1,30 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 --save-temps" } */ -/* { dg-final { check-function-bodies "**" "" "" } } */ - -/* -** f1: -** adds (x[0-9]+), x0, #4096 -** csel x0, \1, xzr, g[te] -** ret -*/ -/* -** f2: -** adds (x[0-9]+), x0, #4096 -** csel x0, \1, xzr, g[te] -** ret -*/ -/* f3 out of range */ -/* -** f4: -** adds (x[0-9]+), x0, #4095 -** csinv x0, \1, xzr, ge -** ret -*/ - -#define TYPE int64_t -#define TYPE_MIN INT64_MIN -#define TYPE_MAX INT64_MAX -#define VALUE -4096 - -#include "max_plus_1.c" diff --git a/gcc/testsuite/gcc.target/aarch64/max_plus_5.c b/gcc/testsuite/gcc.target/aarch64/max_plus_5.c deleted file mode 100644 index 63f3b34424e378363ec0a5be7522babdd6169039..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.target/aarch64/max_plus_5.c +++ /dev/null @@ -1,35 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 --save-temps" } */ -/* { dg-final { check-function-bodies "**" "" "" } } */ - -/* -** f1: -** adds (w[0-9]+), w0, #4095 -** csel w0, \1, wzr, (cs|hi) -** ret -*/ -/* -** f2: -** adds (w[0-9]+), w0, #4095 -** csel w0, \1, wzr, (cs|hi) -** ret -*/ -/* -** f3: -** adds (w[0-9]+), w0, #4096 -** csinc w0, \1, wzr, hi -** ret -*/ -/* -** f4: -** adds (w[0-9]+), w0, #4094 -** csinv w0, \1, wzr, cs -** ret -*/ - -#define TYPE uint32_t -#define TYPE_MIN 0 -#define TYPE_MAX UINT32_MAX -#define VALUE (uint32_t)-4095 - -#include "max_plus_1.c" diff --git a/gcc/testsuite/gcc.target/aarch64/max_plus_6.c b/gcc/testsuite/gcc.target/aarch64/max_plus_6.c deleted file mode 100644 index ad592c69052f6d088cffb055c296ae5f6665ac14..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.target/aarch64/max_plus_6.c +++ /dev/null @@ -1,9 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 --save-temps" } */ - -#define TYPE uint64_t -#define TYPE_MIN 0 -#define TYPE_MAX UINT64_MAX -#define VALUE (uint64_t)-2 - -#include "max_plus_1.c" diff --git a/gcc/testsuite/gcc.target/aarch64/max_plus_7.c b/gcc/testsuite/gcc.target/aarch64/max_plus_7.c deleted file mode 100644 index ac9f27dec61c69d174dd55b41a79f33716c8b108..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.target/aarch64/max_plus_7.c +++ /dev/null @@ -1,35 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 --save-temps" } */ -/* { dg-final { check-function-bodies "**" "" "" } } */ - -/* -** f1: -** adds (x[0-9]+), x0, #3 -** csel x0, \1, xzr, (cs|hi) -** ret -*/ -/* -** f2: -** adds (x[0-9]+), x0, #3 -** csel x0, \1, xzr, (cs|hi) -** ret -*/ -/* -** f3: -** adds (x[0-9]+), x0, #4 -** csinc x0, \1, xzr, hi -** ret -*/ -/* -** f4: -** adds (x[0-9]+), x0, #2 -** csinv x0, \1, xzr, cs -** ret -*/ - -#define TYPE uint64_t -#define TYPE_MIN 0 -#define TYPE_MAX UINT64_MAX -#define VALUE (uint64_t)-3 - -#include "max_plus_1.c" diff --git a/gcc/testsuite/gcc.target/aarch64/min_plus_1.c b/gcc/testsuite/gcc.target/aarch64/min_plus_1.c deleted file mode 100644 index f4c9106dfcabf46b1f35d49cba2184f8cd80da9b..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.target/aarch64/min_plus_1.c +++ /dev/null @@ -1,149 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 --save-temps" } */ -/* { dg-final { check-function-bodies "**" "" "" } } */ - -/* -** f1: -** subs (w[0-9]+), w0, #?4 -** csel w0, \1, wzr, l[te] -** ret -*/ -/* -** f2: -** subs (w[0-9]+), w0, #?4 -** csel w0, \1, wzr, l[te] -** ret -*/ -/* -** f3: -** subs (w[0-9]+), w0, #?3 -** csinc w0, \1, wzr, le -** ret -*/ -/* -** f4: -** subs (w[0-9]+), w0, #?5 -** csinv w0, \1, wzr, lt -** ret -*/ - -#ifndef TYPE -#define TYPE int32_t -#define TYPE_MIN INT32_MIN -#define TYPE_MAX INT32_MAX -#define VALUE 4 -#endif - -#include - -TYPE __attribute__((noipa)) -f1 (TYPE x) -{ - return (x < VALUE ? x - VALUE : 0); -} - -TYPE __attribute__((noipa)) -f2 (TYPE x) -{ - return (x < VALUE ? x : VALUE) - VALUE; -} - -TYPE __attribute__((noipa)) -f3 (TYPE x) -{ - return (x < VALUE ? x : VALUE) - (VALUE - 1); -} - -TYPE __attribute__((noipa)) -f4 (TYPE x) -{ - return (x < VALUE ? x : VALUE) - (VALUE + 1); -} - -TYPE __attribute__((noipa)) -f5 (TYPE x) -{ - return (x < VALUE ? x : VALUE) - (VALUE + 2); -} - -TYPE __attribute__((noipa)) -f6 (TYPE x) -{ - return (x < VALUE ? x : VALUE) - (VALUE - 2); -} - -int -main (void) -{ - TYPE min_test = TYPE_MIN; - if (TYPE_MIN < 0 && VALUE > 0) - min_test += VALUE; - - if (f1 (min_test) != min_test - VALUE) - __builtin_abort (); - if (f1 (VALUE - 1) != -1) - __builtin_abort (); - if (f1 (VALUE) != 0) - __builtin_abort (); - if (f1 (VALUE + 1) != 0) - __builtin_abort (); - if (f1 (TYPE_MAX) != 0) - __builtin_abort (); - - if (f2 (min_test) != min_test - VALUE) - __builtin_abort (); - if (f2 (VALUE - 1) != -1) - __builtin_abort (); - if (f2 (VALUE) != 0) - __builtin_abort (); - if (f2 (VALUE + 1) != 0) - __builtin_abort (); - if (f2 (TYPE_MAX) != 0) - __builtin_abort (); - - if (f3 (min_test) != min_test - VALUE + 1) - __builtin_abort (); - if (f3 (VALUE - 1) != 0) - __builtin_abort (); - if (f3 (VALUE) != 1) - __builtin_abort (); - if (f3 (VALUE + 1) != 1) - __builtin_abort (); - if (f3 (TYPE_MAX) != 1) - __builtin_abort (); - - if (f4 (min_test + 1) != min_test - VALUE) - __builtin_abort (); - if (f4 (VALUE - 1) != -2) - __builtin_abort (); - if (f4 (VALUE) != -1) - __builtin_abort (); - if (f4 (VALUE + 1) != -1) - __builtin_abort (); - if (f4 (TYPE_MAX) != -1) - __builtin_abort (); - - if (VALUE >= min_test + 2 && f5 (min_test + 2) != min_test - VALUE) - __builtin_abort (); - if (f5 (VALUE - 1) != -3) - __builtin_abort (); - if (f5 (VALUE) != -2) - __builtin_abort (); - if (f5 (VALUE + 1) != -2) - __builtin_abort (); - if (f5 (TYPE_MAX) != -2) - __builtin_abort (); - - if (f6 (min_test) != min_test - VALUE + 2) - __builtin_abort (); - if (f6 (VALUE - 1) != 1) - __builtin_abort (); - if (f6 (VALUE) != 2) - __builtin_abort (); - if (f6 (VALUE + 1) != 2) - __builtin_abort (); - if (f6 (TYPE_MAX) != 2) - __builtin_abort (); - - return 0; -} diff --git a/gcc/testsuite/gcc.target/aarch64/min_plus_2.c b/gcc/testsuite/gcc.target/aarch64/min_plus_2.c deleted file mode 100644 index bc0141b726448ec245775a0555813c380053ebbe..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.target/aarch64/min_plus_2.c +++ /dev/null @@ -1,35 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 --save-temps" } */ -/* { dg-final { check-function-bodies "**" "" "" } } */ - -/* -** f1: -** subs (x[0-9]+), x0, #?4094 -** csel x0, \1, xzr, l[te] -** ret -*/ -/* -** f2: -** subs (x[0-9]+), x0, #?4094 -** csel x0, \1, xzr, l[te] -** ret -*/ -/* -** f3: -** subs (x[0-9]+), x0, #?4093 -** csinc x0, \1, xzr, le -** ret -*/ -/* -** f4: -** subs (x[0-9]+), x0, #?4095 -** csinv x0, \1, xzr, lt -** ret -*/ - -#define TYPE int64_t -#define TYPE_MIN INT64_MIN -#define TYPE_MAX INT64_MAX -#define VALUE 4094 - -#include "min_plus_1.c" diff --git a/gcc/testsuite/gcc.target/aarch64/min_plus_3.c b/gcc/testsuite/gcc.target/aarch64/min_plus_3.c deleted file mode 100644 index 1808e4b0cbf372c40f0354cd5bf9bb4d9fadbfc3..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.target/aarch64/min_plus_3.c +++ /dev/null @@ -1,35 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 --save-temps" } */ -/* { dg-final { check-function-bodies "**" "" "" } } */ - -/* -** f1: -** subs (w[0-9]+), w0, #?4095 -** csel w0, \1, wzr, l[te] -** ret -*/ -/* -** f2: -** subs (w[0-9]+), w0, #?4095 -** csel w0, \1, wzr, l[te] -** ret -*/ -/* -** f3: -** subs (w[0-9]+), w0, #?4094 -** csinc w0, \1, wzr, le -** ret -*/ -/* -** f4: -** subs (w[0-9]+), w0, #?4096 -** csinv w0, \1, wzr, lt -** ret -*/ - -#define TYPE int32_t -#define TYPE_MIN INT32_MIN -#define TYPE_MAX INT32_MAX -#define VALUE 4095 - -#include "min_plus_1.c" diff --git a/gcc/testsuite/gcc.target/aarch64/min_plus_4.c b/gcc/testsuite/gcc.target/aarch64/min_plus_4.c deleted file mode 100644 index 6c581fed61d7a67b72dde12609304f5b01c03f31..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.target/aarch64/min_plus_4.c +++ /dev/null @@ -1,30 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 --save-temps" } */ -/* { dg-final { check-function-bodies "**" "" "" } } */ - -/* -** f1: -** subs (x[0-9]+), x0, #?4096 -** csel x0, \1, xzr, l[te] -** ret -*/ -/* -** f2: -** subs (x[0-9]+), x0, #?4096 -** csel x0, \1, xzr, l[te] -** ret -*/ -/* -** f3: -** subs (x[0-9]+), x0, #?4095 -** csinc x0, \1, xzr, le -** ret -*/ -/* f4 out of range */ - -#define TYPE int64_t -#define TYPE_MIN INT64_MIN -#define TYPE_MAX INT64_MAX -#define VALUE 4096 - -#include "min_plus_1.c" diff --git a/gcc/testsuite/gcc.target/aarch64/min_plus_5.c b/gcc/testsuite/gcc.target/aarch64/min_plus_5.c deleted file mode 100644 index 97542d507658e0aaa885ba8e583eb049c358c4eb..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.target/aarch64/min_plus_5.c +++ /dev/null @@ -1,35 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 --save-temps" } */ -/* { dg-final { check-function-bodies "**" "" "" } } */ - -/* -** f1: -** subs (w[0-9]+), w0, #?4095 -** csel w0, \1, wzr, (cc|ls) -** ret -*/ -/* -** f2: -** subs (w[0-9]+), w0, #?4095 -** csel w0, \1, wzr, (cc|ls) -** ret -*/ -/* -** f3: -** subs (w[0-9]+), w0, #?4094 -** csinc w0, \1, wzr, ls -** ret -*/ -/* -** f4: -** subs (w[0-9]+), w0, #?4096 -** csinv w0, \1, wzr, cc -** ret -*/ - -#define TYPE uint32_t -#define TYPE_MIN 0 -#define TYPE_MAX UINT32_MAX -#define VALUE 4095 - -#include "min_plus_1.c" diff --git a/gcc/testsuite/gcc.target/aarch64/min_plus_6.c b/gcc/testsuite/gcc.target/aarch64/min_plus_6.c deleted file mode 100644 index 176533cb2e1f2bdff6d29eafa5cda0456964e381..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.target/aarch64/min_plus_6.c +++ /dev/null @@ -1,9 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 --save-temps" } */ - -#define TYPE uint64_t -#define TYPE_MIN 0 -#define TYPE_MAX UINT64_MAX -#define VALUE 1 - -#include "min_plus_1.c" diff --git a/gcc/testsuite/gcc.target/aarch64/min_plus_7.c b/gcc/testsuite/gcc.target/aarch64/min_plus_7.c deleted file mode 100644 index d6a217a51680bee88fb2902786b606d2b9af9dbb..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.target/aarch64/min_plus_7.c +++ /dev/null @@ -1,35 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 --save-temps" } */ -/* { dg-final { check-function-bodies "**" "" "" } } */ - -/* -** f1: -** subs (x[0-9]+), x0, #?2 -** csel x0, \1, xzr, (cc|ls) -** ret -*/ -/* -** f2: -** subs (x[0-9]+), x0, #?2 -** csel x0, \1, xzr, (cc|ls) -** ret -*/ -/* -** f3: -** subs (x[0-9]+), x0, #?1 -** csinc x0, \1, xzr, ls -** ret -*/ -/* -** f4: -** subs (x[0-9]+), x0, #?3 -** csinv x0, \1, xzr, cc -** ret -*/ - -#define TYPE uint64_t -#define TYPE_MIN 0 -#define TYPE_MAX UINT64_MAX -#define VALUE 2 - -#include "min_plus_1.c" diff --git a/gcc/testsuite/gcc.target/aarch64/scalar-vca.c b/gcc/testsuite/gcc.target/aarch64/scalar-vca.c index 58ce99328cc92bef34375bae7dafcb43bcedcc39..40a359725eb2c5125a1bef911084cf5249152df0 100644 --- a/gcc/testsuite/gcc.target/aarch64/scalar-vca.c +++ b/gcc/testsuite/gcc.target/aarch64/scalar-vca.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O3 -ftree-fold-phiopt --save-temps" } */ +/* { dg-options "-O3 --save-temps" } */ #include diff --git a/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c b/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c index bcd7e4c83cc3e68ba261c13b5e6f9de86e2b20f8..c2e13b651e96fdc9c5abeaf154905dce177d9e2f 100644 --- a/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c +++ b/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-fold-phiopt -dp" } */ +/* { dg-options "-O2 -dp" } */ #include diff --git a/gcc/testsuite/gcc.target/aarch64/simd/int_comparisons_1.c b/gcc/testsuite/gcc.target/aarch64/simd/int_comparisons_1.c index 3f989257bb39419368a7eb904a22cf653f60f298..f2c55922f18c0e6840c403f419fe4a98a15e5f97 100644 --- a/gcc/testsuite/gcc.target/aarch64/simd/int_comparisons_1.c +++ b/gcc/testsuite/gcc.target/aarch64/simd/int_comparisons_1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -ftree-fold-phiopt -fno-inline" } */ +/* { dg-options "-O3 -fno-inline" } */ /* Scan-assembler test, so, incorporate as little other code as possible. */ diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vcaled_f64.c b/gcc/testsuite/gcc.target/aarch64/simd/vcaled_f64.c index 357d0f61aed679153879eed1574c091eefa3ebe5..198b18b4ee52a1fe5d197e2b3fe927573cc2daf1 100644 --- a/gcc/testsuite/gcc.target/aarch64/simd/vcaled_f64.c +++ b/gcc/testsuite/gcc.target/aarch64/simd/vcaled_f64.c @@ -1,7 +1,7 @@ /* Test the vcaled_f64 AArch64 SIMD intrinsic. */ /* { dg-do run } */ -/* { dg-options "-save-temps -O3 -ftree-fold-phiopt" } */ +/* { dg-options "-save-temps -O3" } */ #include "arm_neon.h" diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vcales_f32.c b/gcc/testsuite/gcc.target/aarch64/simd/vcales_f32.c index a2b5a5f50dd4e8513cebb74a924c62e69e91d9c2..6b58501f33722922b2692ca6674ff4f8b3811b99 100644 --- a/gcc/testsuite/gcc.target/aarch64/simd/vcales_f32.c +++ b/gcc/testsuite/gcc.target/aarch64/simd/vcales_f32.c @@ -1,7 +1,7 @@ /* Test the vcales_f32 AArch64 SIMD intrinsic. */ /* { dg-do run } */ -/* { dg-options "-save-temps -O3 -ftree-fold-phiopt" } */ +/* { dg-options "-save-temps -O3" } */ #include "arm_neon.h" diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vcaltd_f64.c b/gcc/testsuite/gcc.target/aarch64/simd/vcaltd_f64.c index d77f68378a7854497047d356f163a42752e67d8c..50a3b27183850725769e9fce8e0642975dbd3114 100644 --- a/gcc/testsuite/gcc.target/aarch64/simd/vcaltd_f64.c +++ b/gcc/testsuite/gcc.target/aarch64/simd/vcaltd_f64.c @@ -1,7 +1,7 @@ /* Test the vcaltd_f64 AArch64 SIMD intrinsic. */ /* { dg-do run } */ -/* { dg-options "-save-temps -O3 -ftree-fold-phiopt" } */ +/* { dg-options "-save-temps -O3" } */ #include "arm_neon.h" diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vcalts_f32.c b/gcc/testsuite/gcc.target/aarch64/simd/vcalts_f32.c index d723b9ac5aebd1923c1853763117e2978c4c3741..1807e0b95048789c5e53f61303e1e70a32f0a7c5 100644 --- a/gcc/testsuite/gcc.target/aarch64/simd/vcalts_f32.c +++ b/gcc/testsuite/gcc.target/aarch64/simd/vcalts_f32.c @@ -1,7 +1,7 @@ /* Test the vcalts_f32 AArch64 SIMD intrinsic. */ /* { dg-do run } */ -/* { dg-options "-save-temps -O3 -ftree-fold-phiopt" } */ +/* { dg-options "-save-temps -O3" } */ #include "arm_neon.h" diff --git a/gcc/testsuite/gcc.target/i386/pr65871-3.c b/gcc/testsuite/gcc.target/i386/pr65871-3.c index 4fd3b48f8c2566bef645f8aedaf37396c5d569a9..c7d9bdd96f5f6014363477fbf75f7382b68d320f 100644 --- a/gcc/testsuite/gcc.target/i386/pr65871-3.c +++ b/gcc/testsuite/gcc.target/i386/pr65871-3.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-fold-phiopt -mbmi" } */ +/* { dg-options "-O2 -mbmi" } */ int foo (int x, int y) { diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 9eb173d69565ef6c1f01588331082c723f9b4602..75320c24f82af41aea8580aa609419e80bf4abec 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -4196,7 +4196,7 @@ verify_gimple_assign_ternary (gassign *stmt) return true; } - if ((rhs_code == COND_EXPR + if (((rhs_code == VEC_COND_EXPR || rhs_code == COND_EXPR) ? !is_gimple_condexpr (rhs1) : !is_gimple_val (rhs1)) || !is_gimple_val (rhs2) || !is_gimple_val (rhs3)) diff --git a/gcc/tree-core.h b/gcc/tree-core.h index 058e046aa167ff82d3f79d1dd9543f8db08b9eb4..eb01c2434cd0bd577937a23f6c0c0b9f71454545 100644 --- a/gcc/tree-core.h +++ b/gcc/tree-core.h @@ -600,7 +600,6 @@ enum tree_index { TI_UINT16_TYPE, TI_UINT32_TYPE, TI_UINT64_TYPE, - TI_UINT128_TYPE, TI_VOID, diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index 4d952884d83ecbf1b0f6caac4fb8d71cac7c89b0..91f96904e8a9befab8e7930ed8baac94d9647dec 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -636,7 +636,6 @@ extern gimple_opt_pass *make_pass_local_fn_summary (gcc::context *ctxt); extern gimple_opt_pass *make_pass_update_address_taken (gcc::context *ctxt); extern gimple_opt_pass *make_pass_convert_switch (gcc::context *ctxt); extern gimple_opt_pass *make_pass_lower_vaarg (gcc::context *ctxt); -extern gimple_opt_pass *make_pass_gimple_isel (gcc::context *ctxt); /* Current optimization pass. */ extern opt_pass *current_pass; diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index dcdf1036951a5e190b11d7a885babd8059a7297d..952fd9cd4bd0fbdab6febb55f2f46aff0d39dfae 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -2005,7 +2005,6 @@ evaluate_stmt (gimple *stmt) case BUILT_IN_BSWAP16: case BUILT_IN_BSWAP32: case BUILT_IN_BSWAP64: - case BUILT_IN_BSWAP128: val = get_value_for_expr (gimple_call_arg (stmt, 0), true); if (val.lattice_val == UNDEFINED) break; diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index d5e9ca9bbd8f7e79a507b2e923e0542413af6a91..278bce8312b615534b994f8e6818cb5f88f3a4e4 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -4032,7 +4032,8 @@ pass_forwprop::execute (function *fun) tree rhs1 = gimple_assign_rhs1 (stmt); enum tree_code code = gimple_assign_rhs_code (stmt); - if (code == COND_EXPR) + if (code == COND_EXPR + || code == VEC_COND_EXPR) { /* In this case the entire COND_EXPR is in rhs1. */ if (forward_propagate_into_cond (&gsi)) diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 535dfc70a486d1db72ba66577c068f5943940987..b9be28474d5e6c61e908e4fc4a2571facef503bf 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -28,7 +28,6 @@ along with GCC; see the file COPYING3. If not see #include "cfghooks.h" #include "tree-pass.h" #include "ssa.h" -#include "tree-ssa.h" #include "optabs-tree.h" #include "insn-config.h" #include "gimple-pretty-print.h" @@ -47,33 +46,27 @@ along with GCC; see the file COPYING3. If not see #include "tree-inline.h" #include "case-cfn-macros.h" #include "tree-eh.h" -#include "gimple-fold.h" -#include "internal-fn.h" -#include "gimple-match.h" static unsigned int tree_ssa_phiopt_worker (bool, bool, bool); static bool two_value_replacement (basic_block, basic_block, edge, gphi *, tree, tree); -static bool match_simplify_replacement (basic_block, basic_block, - edge, edge, gphi *, tree, tree, bool); +static bool conditional_replacement (basic_block, basic_block, + edge, edge, gphi *, tree, tree); static gphi *factor_out_conditional_conversion (edge, edge, gphi *, tree, tree, gimple *); static int value_replacement (basic_block, basic_block, - edge, edge, gphi *, tree, tree); + edge, edge, gimple *, tree, tree); static bool minmax_replacement (basic_block, basic_block, - edge, edge, gphi *, tree, tree); + edge, edge, gimple *, tree, tree); static bool abs_replacement (basic_block, basic_block, - edge, edge, gphi *, tree, tree); -static bool spaceship_replacement (basic_block, basic_block, - edge, edge, gphi *, tree, tree); -static bool cond_removal_in_builtin_zero_pattern (basic_block, basic_block, - edge, edge, gphi *, - tree, tree); + edge, edge, gimple *, tree, tree); +static bool cond_removal_in_popcount_pattern (basic_block, basic_block, + edge, edge, gimple *, tree, tree); static bool cond_store_replacement (basic_block, basic_block, edge, edge, hash_set *); static bool cond_if_else_store_replacement (basic_block, basic_block, basic_block); static hash_set * get_non_trapping (); -static void replace_phi_edge_with_variable (basic_block, edge, gphi *, tree); +static void replace_phi_edge_with_variable (basic_block, edge, gimple *, tree); static void hoist_adjacent_loads (basic_block, basic_block, basic_block, basic_block); static bool do_phiopt_pattern (basic_block, basic_block, basic_block); @@ -346,22 +339,20 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p) } /* Do the replacement of conditional if it can be done. */ - if (!early_p && two_value_replacement (bb, bb1, e2, phi, arg0, arg1)) + if (two_value_replacement (bb, bb1, e2, phi, arg0, arg1)) cfgchanged = true; - else if (match_simplify_replacement (bb, bb1, e1, e2, phi, - arg0, arg1, - early_p)) + else if (!early_p + && conditional_replacement (bb, bb1, e1, e2, phi, + arg0, arg1)) cfgchanged = true; else if (abs_replacement (bb, bb1, e1, e2, phi, arg0, arg1)) cfgchanged = true; else if (!early_p - && cond_removal_in_builtin_zero_pattern (bb, bb1, e1, e2, - phi, arg0, arg1)) + && cond_removal_in_popcount_pattern (bb, bb1, e1, e2, + phi, arg0, arg1)) cfgchanged = true; else if (minmax_replacement (bb, bb1, e1, e2, phi, arg0, arg1)) cfgchanged = true; - else if (spaceship_replacement (bb, bb1, e1, e2, phi, arg0, arg1)) - cfgchanged = true; } } @@ -388,7 +379,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p) static void replace_phi_edge_with_variable (basic_block cond_block, - edge e, gphi *phi, tree new_tree) + edge e, gimple *phi, tree new_tree) { basic_block bb = gimple_bb (phi); basic_block block_to_remove; @@ -645,6 +636,7 @@ two_value_replacement (basic_block cond_bb, basic_block middle_bb, if (TREE_CODE (lhs) != SSA_NAME || !INTEGRAL_TYPE_P (TREE_TYPE (lhs)) + || TREE_CODE (TREE_TYPE (lhs)) == BOOLEAN_TYPE || TREE_CODE (rhs) != INTEGER_CST) return false; @@ -657,25 +649,9 @@ two_value_replacement (basic_block cond_bb, basic_block middle_bb, return false; } - /* Defer boolean x ? 0 : {1,-1} or x ? {1,-1} : 0 to - match_simplify_replacement. */ - if (TREE_CODE (TREE_TYPE (lhs)) == BOOLEAN_TYPE - && (integer_zerop (arg0) - || integer_zerop (arg1) - || TREE_CODE (TREE_TYPE (arg0)) == BOOLEAN_TYPE - || (TYPE_PRECISION (TREE_TYPE (arg0)) - <= TYPE_PRECISION (TREE_TYPE (lhs))))) - return false; - wide_int min, max; - if (TREE_CODE (TREE_TYPE (lhs)) == BOOLEAN_TYPE) - { - min = wi::to_wide (boolean_false_node); - max = wi::to_wide (boolean_true_node); - } - else if (get_range_info (lhs, &min, &max) != VR_RANGE) - return false; - if (min + 1 != max + if (get_range_info (lhs, &min, &max) != VR_RANGE + || min + 1 != max || (wi::to_wide (rhs) != min && wi::to_wide (rhs) != max)) return false; @@ -759,171 +735,137 @@ two_value_replacement (basic_block cond_bb, basic_block middle_bb, return true; } -/* Return TRUE if CODE should be allowed during early phiopt. - Currently this is to allow MIN/MAX and ABS/NEGATE. */ -static bool -phiopt_early_allow (enum tree_code code) -{ - switch (code) - { - case MIN_EXPR: - case MAX_EXPR: - case ABS_EXPR: - case ABSU_EXPR: - case NEGATE_EXPR: - case SSA_NAME: - return true; - default: - return false; - } -} - -/* gimple_simplify_phiopt is like gimple_simplify but designed for PHIOPT. - Return NULL if nothing can be simplified or the resulting simplified value - with parts pushed if EARLY_P was true. Also rejects non allowed tree code - if EARLY_P is set. - Takes the comparison from COMP_STMT and two args, ARG0 and ARG1 and tries - to simplify CMP ? ARG0 : ARG1. */ -static tree -gimple_simplify_phiopt (bool early_p, tree type, gimple *comp_stmt, - tree arg0, tree arg1, - gimple_seq *seq) -{ - tree result; - enum tree_code comp_code = gimple_cond_code (comp_stmt); - location_t loc = gimple_location (comp_stmt); - tree cmp0 = gimple_cond_lhs (comp_stmt); - tree cmp1 = gimple_cond_rhs (comp_stmt); - /* To handle special cases like floating point comparison, it is easier and - less error-prone to build a tree and gimplify it on the fly though it is - less efficient. - Don't use fold_build2 here as that might create (bool)a instead of just - "a != 0". */ - tree cond = build2_loc (loc, comp_code, boolean_type_node, - cmp0, cmp1); - gimple_match_op op (gimple_match_cond::UNCOND, - COND_EXPR, type, cond, arg0, arg1); - - if (op.resimplify (early_p ? NULL : seq, follow_all_ssa_edges)) - { - /* Early we want only to allow some generated tree codes. */ - if (!early_p - || op.code.is_tree_code () - || phiopt_early_allow ((tree_code)op.code)) - { - result = maybe_push_res_to_seq (&op, seq); - if (result) - return result; - } - } - - return NULL; -} - -/* The function match_simplify_replacement does the main work of doing the - replacement using match and simplify. Return true if the replacement is done. +/* The function conditional_replacement does the main work of doing the + conditional replacement. Return true if the replacement is done. Otherwise return false. BB is the basic block where the replacement is going to be done on. ARG0 is argument 0 from PHI. Likewise for ARG1. */ static bool -match_simplify_replacement (basic_block cond_bb, basic_block middle_bb, - edge e0, edge e1, gphi *phi, - tree arg0, tree arg1, bool early_p) +conditional_replacement (basic_block cond_bb, basic_block middle_bb, + edge e0, edge e1, gphi *phi, + tree arg0, tree arg1) { + tree result; gimple *stmt; + gassign *new_stmt; + tree cond; gimple_stmt_iterator gsi; edge true_edge, false_edge; - gimple_seq seq = NULL; - tree result; - gimple *stmt_to_move = NULL; - - if (!flag_fold_phiopt) + tree new_var, new_var2; + bool neg = false; + int shift = 0; + tree nonzero_arg; + + /* FIXME: Gimplification of complex type is too hard for now. */ + /* We aren't prepared to handle vectors either (and it is a question + if it would be worthwhile anyway). */ + if (!(INTEGRAL_TYPE_P (TREE_TYPE (arg0)) + || POINTER_TYPE_P (TREE_TYPE (arg0))) + || !(INTEGRAL_TYPE_P (TREE_TYPE (arg1)) + || POINTER_TYPE_P (TREE_TYPE (arg1)))) return false; - /* Special case A ? B : B as this will always simplify to B. */ - if (operand_equal_for_phi_arg_p (arg0, arg1)) + /* The PHI arguments have the constants 0 and 1, or 0 and -1 or + 0 and (1 << cst), then convert it to the conditional. */ + if (integer_zerop (arg0)) + nonzero_arg = arg1; + else if (integer_zerop (arg1)) + nonzero_arg = arg0; + else return false; - - /* If the basic block only has a cheap preparation statement, - allow it and move it once the transformation is done. */ - if (!empty_block_p (middle_bb)) + if (integer_pow2p (nonzero_arg)) { - stmt_to_move = last_and_only_stmt (middle_bb); - if (!stmt_to_move) - return false; - - if (gimple_vuse (stmt_to_move)) - return false; - - if (gimple_could_trap_p (stmt_to_move) - || gimple_has_side_effects (stmt_to_move)) - return false; - - if (gimple_uses_undefined_value_p (stmt_to_move)) - return false; - - /* Allow assignments and not no calls. - As const calls don't match any of the above, yet they could - still have some side-effects - they could contain - gimple_could_trap_p statements, like floating point - exceptions or integer division by zero. See PR70586. - FIXME: perhaps gimple_has_side_effects or gimple_could_trap_p - should handle this. */ - if (!is_gimple_assign (stmt_to_move)) - return false; - - tree lhs = gimple_assign_lhs (stmt_to_move); - gimple *use_stmt; - use_operand_p use_p; - - /* Allow only a statement which feeds into the phi. */ - if (!lhs || TREE_CODE (lhs) != SSA_NAME - || !single_imm_use (lhs, &use_p, &use_stmt) - || use_stmt != phi) + shift = tree_log2 (nonzero_arg); + if (shift && POINTER_TYPE_P (TREE_TYPE (nonzero_arg))) return false; } + else if (integer_all_onesp (nonzero_arg)) + neg = true; + else + return false; - /* At this point we know we have a GIMPLE_COND with two successors. + if (!empty_block_p (middle_bb)) + return false; + + /* At this point we know we have a GIMPLE_COND with two successors. One successor is BB, the other successor is an empty block which falls through into BB. - There is a single PHI node at the join point (BB). + There is a single PHI node at the join point (BB) and its arguments + are constants (0, 1) or (0, -1) or (0, (1 << shift)). + + So, given the condition COND, and the two PHI arguments, we can + rewrite this PHI into non-branching code: - So, given the condition COND, and the two PHI arguments, match and simplify - can happen on (COND) ? arg0 : arg1. */ + dest = (COND) or dest = COND' or dest = (COND) << shift + + We use the condition as-is if the argument associated with the + true edge has the value one or the argument associated with the + false edge as the value zero. Note that those conditions are not + the same since only one of the outgoing edges from the GIMPLE_COND + will directly reach BB and thus be associated with an argument. */ stmt = last_stmt (cond_bb); + result = PHI_RESULT (phi); + + /* To handle special cases like floating point comparison, it is easier and + less error-prone to build a tree and gimplify it on the fly though it is + less efficient. */ + cond = fold_build2_loc (gimple_location (stmt), + gimple_cond_code (stmt), boolean_type_node, + gimple_cond_lhs (stmt), gimple_cond_rhs (stmt)); /* We need to know which is the true edge and which is the false edge so that we know when to invert the condition below. */ extract_true_false_edges_from_block (cond_bb, &true_edge, &false_edge); - if (e1 == true_edge || e0 == false_edge) - std::swap (arg0, arg1); + if ((e0 == true_edge && integer_zerop (arg0)) + || (e0 == false_edge && !integer_zerop (arg0)) + || (e1 == true_edge && integer_zerop (arg1)) + || (e1 == false_edge && !integer_zerop (arg1))) + cond = fold_build1_loc (gimple_location (stmt), + TRUTH_NOT_EXPR, TREE_TYPE (cond), cond); - tree type = TREE_TYPE (gimple_phi_result (phi)); - result = gimple_simplify_phiopt (early_p, type, stmt, - arg0, arg1, - &seq); - if (!result) - return false; + if (neg) + { + cond = fold_convert_loc (gimple_location (stmt), + TREE_TYPE (result), cond); + cond = fold_build1_loc (gimple_location (stmt), + NEGATE_EXPR, TREE_TYPE (cond), cond); + } + else if (shift) + { + cond = fold_convert_loc (gimple_location (stmt), + TREE_TYPE (result), cond); + cond = fold_build2_loc (gimple_location (stmt), + LSHIFT_EXPR, TREE_TYPE (cond), cond, + build_int_cst (integer_type_node, shift)); + } - gsi = gsi_last_bb (cond_bb); - if (stmt_to_move) + /* Insert our new statements at the end of conditional block before the + COND_STMT. */ + gsi = gsi_for_stmt (stmt); + new_var = force_gimple_operand_gsi (&gsi, cond, true, NULL, true, + GSI_SAME_STMT); + + if (!useless_type_conversion_p (TREE_TYPE (result), TREE_TYPE (new_var))) { - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, "statement un-sinked:\n"); - print_gimple_stmt (dump_file, stmt_to_move, 0, - TDF_VOPS|TDF_MEMSYMS); - } - gimple_stmt_iterator gsi1 = gsi_for_stmt (stmt_to_move); - gsi_move_before (&gsi1, &gsi); + location_t locus_0, locus_1; + + new_var2 = make_ssa_name (TREE_TYPE (result)); + new_stmt = gimple_build_assign (new_var2, CONVERT_EXPR, new_var); + gsi_insert_before (&gsi, new_stmt, GSI_SAME_STMT); + new_var = new_var2; + + /* Set the locus to the first argument, unless is doesn't have one. */ + locus_0 = gimple_phi_arg_location (phi, 0); + locus_1 = gimple_phi_arg_location (phi, 1); + if (locus_0 == UNKNOWN_LOCATION) + locus_0 = locus_1; + gimple_set_location (new_stmt, locus_0); } - if (seq) - gsi_insert_seq_before (&gsi, seq, GSI_SAME_STMT); - replace_phi_edge_with_variable (cond_bb, e1, phi, result); + replace_phi_edge_with_variable (cond_bb, e1, phi, new_var); /* Note that we optimized this PHI. */ return true; @@ -1131,7 +1073,8 @@ absorbing_element_p (tree_code code, tree arg, bool right, tree rval) static int value_replacement (basic_block cond_bb, basic_block middle_bb, - edge e0, edge e1, gphi *phi, tree arg0, tree arg1) + edge e0, edge e1, gimple *phi, + tree arg0, tree arg1) { gimple_stmt_iterator gsi; gimple *cond; @@ -1439,10 +1382,12 @@ value_replacement (basic_block cond_bb, basic_block middle_bb, static bool minmax_replacement (basic_block cond_bb, basic_block middle_bb, - edge e0, edge e1, gphi *phi, tree arg0, tree arg1) + edge e0, edge e1, gimple *phi, + tree arg0, tree arg1) { tree result, type, rhs; gcond *cond; + gassign *new_stmt; edge true_edge, false_edge; enum tree_code cmp, minmax, ass_code; tree smaller, alt_smaller, larger, alt_larger, arg_true, arg_false; @@ -1766,448 +1711,26 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb, gsi_move_before (&gsi_from, &gsi); } - /* Emit the statement to compute min/max. */ - gimple_seq stmts = NULL; - tree phi_result = PHI_RESULT (phi); - result = gimple_build (&stmts, minmax, TREE_TYPE (phi_result), arg0, arg1); - /* Duplicate range info if we're the only things setting the target PHI. */ - if (!gimple_seq_empty_p (stmts) - && EDGE_COUNT (gimple_bb (phi)->preds) == 2 - && !POINTER_TYPE_P (TREE_TYPE (phi_result)) - && SSA_NAME_RANGE_INFO (phi_result)) - duplicate_ssa_name_range_info (result, SSA_NAME_RANGE_TYPE (phi_result), - SSA_NAME_RANGE_INFO (phi_result)); + /* Create an SSA var to hold the min/max result. If we're the only + things setting the target PHI, then we can clone the PHI + variable. Otherwise we must create a new one. */ + result = PHI_RESULT (phi); + if (EDGE_COUNT (gimple_bb (phi)->preds) == 2) + result = duplicate_ssa_name (result, NULL); + else + result = make_ssa_name (TREE_TYPE (result)); + /* Emit the statement to compute min/max. */ + new_stmt = gimple_build_assign (result, minmax, arg0, arg1); gsi = gsi_last_bb (cond_bb); - gsi_insert_seq_before (&gsi, stmts, GSI_NEW_STMT); + gsi_insert_before (&gsi, new_stmt, GSI_NEW_STMT); replace_phi_edge_with_variable (cond_bb, e1, phi, result); return true; } -/* Return true if the only executable statement in BB is a GIMPLE_COND. */ - -static bool -cond_only_block_p (basic_block bb) -{ - /* BB must have no executable statements. */ - gimple_stmt_iterator gsi = gsi_after_labels (bb); - if (phi_nodes (bb)) - return false; - while (!gsi_end_p (gsi)) - { - gimple *stmt = gsi_stmt (gsi); - if (is_gimple_debug (stmt)) - ; - else if (gimple_code (stmt) == GIMPLE_NOP - || gimple_code (stmt) == GIMPLE_PREDICT - || gimple_code (stmt) == GIMPLE_COND) - ; - else - return false; - gsi_next (&gsi); - } - return true; -} - -/* Attempt to optimize (x <=> y) cmp 0 and similar comparisons. - For strong ordering <=> try to match something like: - : // cond3_bb (== cond2_bb) - if (x_4(D) != y_5(D)) - goto ; [INV] - else - goto ; [INV] - - : // cond_bb - if (x_4(D) < y_5(D)) - goto ; [INV] - else - goto ; [INV] - - : // middle_bb - - : // phi_bb - # iftmp.0_2 = PHI <1(4), 0(2), -1(3)> - _1 = iftmp.0_2 == 0; - - and for partial ordering <=> something like: - - : // cond3_bb - if (a_3(D) == b_5(D)) - goto ; [50.00%] - else - goto ; [50.00%] - - [local count: 536870913]: // cond2_bb - if (a_3(D) < b_5(D)) - goto ; [50.00%] - else - goto ; [50.00%] - - [local count: 268435456]: // cond_bb - if (a_3(D) > b_5(D)) - goto ; [50.00%] - else - goto ; [50.00%] - - [local count: 134217728]: // middle_bb - - [local count: 1073741824]: // phi_bb - # SR.27_4 = PHI <0(2), -1(3), 1(4), 2(5)> - _2 = SR.27_4 > 0; */ - -static bool -spaceship_replacement (basic_block cond_bb, basic_block middle_bb, - edge e0, edge e1, gphi *phi, - tree arg0, tree arg1) -{ - if (!INTEGRAL_TYPE_P (TREE_TYPE (PHI_RESULT (phi))) - || TYPE_UNSIGNED (TREE_TYPE (PHI_RESULT (phi))) - || !tree_fits_shwi_p (arg0) - || !tree_fits_shwi_p (arg1) - || !IN_RANGE (tree_to_shwi (arg0), -1, 2) - || !IN_RANGE (tree_to_shwi (arg1), -1, 2)) - return false; - - basic_block phi_bb = gimple_bb (phi); - gcc_assert (phi_bb == e0->dest && phi_bb == e1->dest); - if (!IN_RANGE (EDGE_COUNT (phi_bb->preds), 3, 4)) - return false; - - use_operand_p use_p; - gimple *use_stmt; - if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (PHI_RESULT (phi))) - return false; - if (!single_imm_use (PHI_RESULT (phi), &use_p, &use_stmt)) - return false; - enum tree_code cmp; - tree lhs, rhs; - if (gimple_code (use_stmt) == GIMPLE_COND) - { - cmp = gimple_cond_code (use_stmt); - lhs = gimple_cond_lhs (use_stmt); - rhs = gimple_cond_rhs (use_stmt); - } - else if (is_gimple_assign (use_stmt)) - { - if (gimple_assign_rhs_class (use_stmt) == GIMPLE_BINARY_RHS) - { - cmp = gimple_assign_rhs_code (use_stmt); - lhs = gimple_assign_rhs1 (use_stmt); - rhs = gimple_assign_rhs2 (use_stmt); - } - else if (gimple_assign_rhs_code (use_stmt) == COND_EXPR) - { - tree cond = gimple_assign_rhs1 (use_stmt); - if (!COMPARISON_CLASS_P (cond)) - return false; - cmp = TREE_CODE (cond); - lhs = TREE_OPERAND (cond, 0); - rhs = TREE_OPERAND (cond, 1); - } - else - return false; - } - else - return false; - switch (cmp) - { - case EQ_EXPR: - case NE_EXPR: - case LT_EXPR: - case GT_EXPR: - case LE_EXPR: - case GE_EXPR: - break; - default: - return false; - } - if (lhs != PHI_RESULT (phi) - || !tree_fits_shwi_p (rhs) - || !IN_RANGE (tree_to_shwi (rhs), -1, 1)) - return false; - - if (!empty_block_p (middle_bb)) - return false; - - gcond *cond1 = as_a (last_stmt (cond_bb)); - enum tree_code cmp1 = gimple_cond_code (cond1); - if (cmp1 != LT_EXPR && cmp1 != GT_EXPR) - return false; - tree lhs1 = gimple_cond_lhs (cond1); - tree rhs1 = gimple_cond_rhs (cond1); - /* The optimization may be unsafe due to NaNs. */ - if (HONOR_NANS (TREE_TYPE (lhs1))) - return false; - if (TREE_CODE (lhs1) == SSA_NAME && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs1)) - return false; - if (TREE_CODE (rhs1) == SSA_NAME && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs1)) - return false; - - if (!single_pred_p (cond_bb) || !cond_only_block_p (cond_bb)) - return false; - - basic_block cond2_bb = single_pred (cond_bb); - if (EDGE_COUNT (cond2_bb->succs) != 2) - return false; - edge cond2_phi_edge; - if (EDGE_SUCC (cond2_bb, 0)->dest == cond_bb) - { - if (EDGE_SUCC (cond2_bb, 1)->dest != phi_bb) - return false; - cond2_phi_edge = EDGE_SUCC (cond2_bb, 1); - } - else if (EDGE_SUCC (cond2_bb, 0)->dest != phi_bb) - return false; - else - cond2_phi_edge = EDGE_SUCC (cond2_bb, 0); - tree arg2 = gimple_phi_arg_def (phi, cond2_phi_edge->dest_idx); - if (!tree_fits_shwi_p (arg2)) - return false; - gimple *cond2 = last_stmt (cond2_bb); - if (cond2 == NULL || gimple_code (cond2) != GIMPLE_COND) - return false; - enum tree_code cmp2 = gimple_cond_code (cond2); - tree lhs2 = gimple_cond_lhs (cond2); - tree rhs2 = gimple_cond_rhs (cond2); - if (lhs2 == lhs1) - { - if (!operand_equal_p (rhs2, rhs1, 0)) - return false; - } - else if (lhs2 == rhs1) - { - if (rhs2 != lhs1) - return false; - } - else - return false; - - tree arg3 = arg2; - basic_block cond3_bb = cond2_bb; - edge cond3_phi_edge = cond2_phi_edge; - gimple *cond3 = cond2; - enum tree_code cmp3 = cmp2; - tree lhs3 = lhs2; - tree rhs3 = rhs2; - if (EDGE_COUNT (phi_bb->preds) == 4) - { - if (absu_hwi (tree_to_shwi (arg2)) != 1) - return false; - if (e1->flags & EDGE_TRUE_VALUE) - { - if (tree_to_shwi (arg0) != 2 - || absu_hwi (tree_to_shwi (arg1)) != 1 - || wi::to_widest (arg1) == wi::to_widest (arg2)) - return false; - } - else if (tree_to_shwi (arg1) != 2 - || absu_hwi (tree_to_shwi (arg0)) != 1 - || wi::to_widest (arg0) == wi::to_widest (arg1)) - return false; - if (cmp2 != LT_EXPR && cmp2 != GT_EXPR) - return false; - /* if (x < y) goto phi_bb; else fallthru; - if (x > y) goto phi_bb; else fallthru; - bbx:; - phi_bb:; - is ok, but if x and y are swapped in one of the comparisons, - or the comparisons are the same and operands not swapped, - or second goto phi_bb is not the true edge, it is not. */ - if ((lhs2 == lhs1) - ^ (cmp2 == cmp1) - ^ ((e1->flags & EDGE_TRUE_VALUE) != 0)) - return false; - if ((cond2_phi_edge->flags & EDGE_TRUE_VALUE) == 0) - return false; - if (!single_pred_p (cond2_bb) || !cond_only_block_p (cond2_bb)) - return false; - cond3_bb = single_pred (cond2_bb); - if (EDGE_COUNT (cond2_bb->succs) != 2) - return false; - if (EDGE_SUCC (cond3_bb, 0)->dest == cond2_bb) - { - if (EDGE_SUCC (cond3_bb, 1)->dest != phi_bb) - return false; - cond3_phi_edge = EDGE_SUCC (cond3_bb, 1); - } - else if (EDGE_SUCC (cond3_bb, 0)->dest != phi_bb) - return false; - else - cond3_phi_edge = EDGE_SUCC (cond3_bb, 0); - arg3 = gimple_phi_arg_def (phi, cond3_phi_edge->dest_idx); - cond3 = last_stmt (cond3_bb); - if (cond3 == NULL || gimple_code (cond3) != GIMPLE_COND) - return false; - cmp3 = gimple_cond_code (cond3); - lhs3 = gimple_cond_lhs (cond3); - rhs3 = gimple_cond_rhs (cond3); - if (lhs3 == lhs1) - { - if (!operand_equal_p (rhs3, rhs1, 0)) - return false; - } - else if (lhs3 == rhs1) - { - if (rhs3 != lhs1) - return false; - } - else - return false; - } - else if (absu_hwi (tree_to_shwi (arg0)) != 1 - || absu_hwi (tree_to_shwi (arg1)) != 1 - || wi::to_widest (arg0) == wi::to_widest (arg1)) - return false; - - if (!integer_zerop (arg3) || (cmp3 != EQ_EXPR && cmp3 != NE_EXPR)) - return false; - if ((cond3_phi_edge->flags & (cmp3 == EQ_EXPR - ? EDGE_TRUE_VALUE : EDGE_FALSE_VALUE)) == 0) - return false; - - /* lhs1 one_cmp rhs1 results in PHI_RESULT (phi) of 1. */ - enum tree_code one_cmp; - if ((cmp1 == LT_EXPR) - ^ (!integer_onep ((e1->flags & EDGE_TRUE_VALUE) ? arg1 : arg0))) - one_cmp = LT_EXPR; - else - one_cmp = GT_EXPR; - - enum tree_code res_cmp; - switch (cmp) - { - case EQ_EXPR: - if (integer_zerop (rhs)) - res_cmp = EQ_EXPR; - else if (integer_minus_onep (rhs)) - res_cmp = one_cmp == LT_EXPR ? GT_EXPR : LT_EXPR; - else if (integer_onep (rhs)) - res_cmp = one_cmp; - else - return false; - break; - case NE_EXPR: - if (integer_zerop (rhs)) - res_cmp = NE_EXPR; - else if (integer_minus_onep (rhs)) - res_cmp = one_cmp == LT_EXPR ? LE_EXPR : GE_EXPR; - else if (integer_onep (rhs)) - res_cmp = one_cmp == LT_EXPR ? GE_EXPR : LE_EXPR; - else - return false; - break; - case LT_EXPR: - if (integer_onep (rhs)) - res_cmp = one_cmp == LT_EXPR ? GE_EXPR : LE_EXPR; - else if (integer_zerop (rhs)) - res_cmp = one_cmp == LT_EXPR ? GT_EXPR : LT_EXPR; - else - return false; - break; - case LE_EXPR: - if (integer_zerop (rhs)) - res_cmp = one_cmp == LT_EXPR ? GE_EXPR : LE_EXPR; - else if (integer_minus_onep (rhs)) - res_cmp = one_cmp == LT_EXPR ? GT_EXPR : LT_EXPR; - else - return false; - break; - case GT_EXPR: - if (integer_minus_onep (rhs)) - res_cmp = one_cmp == LT_EXPR ? LE_EXPR : GE_EXPR; - else if (integer_zerop (rhs)) - res_cmp = one_cmp; - else - return false; - break; - case GE_EXPR: - if (integer_zerop (rhs)) - res_cmp = one_cmp == LT_EXPR ? LE_EXPR : GE_EXPR; - else if (integer_onep (rhs)) - res_cmp = one_cmp; - else - return false; - break; - default: - gcc_unreachable (); - } - - if (gimple_code (use_stmt) == GIMPLE_COND) - { - gcond *use_cond = as_a (use_stmt); - gimple_cond_set_code (use_cond, res_cmp); - gimple_cond_set_lhs (use_cond, lhs1); - gimple_cond_set_rhs (use_cond, rhs1); - } - else if (gimple_assign_rhs_class (use_stmt) == GIMPLE_BINARY_RHS) - { - gimple_assign_set_rhs_code (use_stmt, res_cmp); - gimple_assign_set_rhs1 (use_stmt, lhs1); - gimple_assign_set_rhs2 (use_stmt, rhs1); - } - else - { - tree cond = build2 (res_cmp, TREE_TYPE (gimple_assign_rhs1 (use_stmt)), - lhs1, rhs1); - gimple_assign_set_rhs1 (use_stmt, cond); - } - update_stmt (use_stmt); - - if (MAY_HAVE_DEBUG_BIND_STMTS) - { - use_operand_p use_p; - imm_use_iterator iter; - bool has_debug_uses = false; - FOR_EACH_IMM_USE_FAST (use_p, iter, PHI_RESULT (phi)) - { - gimple *use_stmt = USE_STMT (use_p); - gcc_assert (is_gimple_debug (use_stmt)); - has_debug_uses = true; - break; - } - - if (has_debug_uses) - { - /* If there are debug uses, emit something like: - # DEBUG D#1 => i_2(D) > j_3(D) ? 1 : -1 - # DEBUG D#2 => i_2(D) == j_3(D) ? 0 : D#1 - where > stands for the comparison that yielded 1 - and replace debug uses of phi result with that D#2. - Ignore the value of 2, because if NaNs aren't expected, - all floating point numbers should be comparable. */ - gimple_stmt_iterator gsi = gsi_after_labels (gimple_bb (phi)); - tree type = TREE_TYPE (PHI_RESULT (phi)); - tree temp1 = make_node (DEBUG_EXPR_DECL); - DECL_ARTIFICIAL (temp1) = 1; - TREE_TYPE (temp1) = type; - SET_DECL_MODE (temp1, TYPE_MODE (type)); - tree t = build2 (one_cmp, boolean_type_node, lhs1, rhs2); - t = build3 (COND_EXPR, type, t, build_one_cst (type), - build_int_cst (type, -1)); - gimple *g = gimple_build_debug_bind (temp1, t, phi); - gsi_insert_before (&gsi, g, GSI_SAME_STMT); - tree temp2 = make_node (DEBUG_EXPR_DECL); - DECL_ARTIFICIAL (temp2) = 1; - TREE_TYPE (temp2) = type; - SET_DECL_MODE (temp2, TYPE_MODE (type)); - t = build2 (EQ_EXPR, boolean_type_node, lhs1, rhs2); - t = build3 (COND_EXPR, type, t, build_zero_cst (type), temp1); - g = gimple_build_debug_bind (temp2, t, phi); - gsi_insert_before (&gsi, g, GSI_SAME_STMT); - replace_uses_by (PHI_RESULT (phi), temp2); - } - } - - gimple_stmt_iterator psi = gsi_for_stmt (phi); - remove_phi_node (&psi, true); - - return true; -} - -/* Optimize x ? __builtin_fun (x) : C, where C is __builtin_fun (0). - Convert +/* Convert if (b_4(D) != 0) @@ -2233,20 +1756,16 @@ spaceship_replacement (basic_block cond_bb, basic_block middle_bb, c_12 = PHI <_9(2)> - - Similarly for __builtin_clz or __builtin_ctz if - C?Z_DEFINED_VALUE_AT_ZERO is 2, optab is present and - instead of 0 above it uses the value from that macro. */ +*/ static bool -cond_removal_in_builtin_zero_pattern (basic_block cond_bb, - basic_block middle_bb, - edge e1, edge e2, gphi *phi, - tree arg0, tree arg1) +cond_removal_in_popcount_pattern (basic_block cond_bb, basic_block middle_bb, + edge e1, edge e2, + gimple *phi, tree arg0, tree arg1) { gimple *cond; gimple_stmt_iterator gsi, gsi_from; - gimple *call; + gimple *popcount; gimple *cast = NULL; tree lhs, arg; @@ -2264,82 +1783,35 @@ cond_removal_in_builtin_zero_pattern (basic_block cond_bb, gsi_next_nondebug (&gsi); if (!gsi_end_p (gsi)) { - call = gsi_stmt (gsi); + popcount = gsi_stmt (gsi); gsi_next_nondebug (&gsi); if (!gsi_end_p (gsi)) return false; } else { - call = cast; + popcount = cast; cast = NULL; } - /* Check that we have a popcount/clz/ctz builtin. */ - if (!is_gimple_call (call) || gimple_call_num_args (call) != 1) - return false; - - arg = gimple_call_arg (call, 0); - lhs = gimple_get_lhs (call); - - if (lhs == NULL_TREE) + /* Check that we have a popcount builtin. */ + if (!is_gimple_call (popcount)) return false; - - combined_fn cfn = gimple_call_combined_fn (call); - internal_fn ifn = IFN_LAST; - int val = 0; + combined_fn cfn = gimple_call_combined_fn (popcount); switch (cfn) { - case CFN_BUILT_IN_BSWAP16: - case CFN_BUILT_IN_BSWAP32: - case CFN_BUILT_IN_BSWAP64: - case CFN_BUILT_IN_BSWAP128: - CASE_CFN_FFS: - CASE_CFN_PARITY: CASE_CFN_POPCOUNT: break; - CASE_CFN_CLZ: - if (INTEGRAL_TYPE_P (TREE_TYPE (arg))) - { - tree type = TREE_TYPE (arg); - if (direct_internal_fn_supported_p (IFN_CLZ, type, OPTIMIZE_FOR_BOTH) - && CLZ_DEFINED_VALUE_AT_ZERO (SCALAR_INT_TYPE_MODE (type), - val) == 2) - { - ifn = IFN_CLZ; - break; - } - } - return false; - CASE_CFN_CTZ: - if (INTEGRAL_TYPE_P (TREE_TYPE (arg))) - { - tree type = TREE_TYPE (arg); - if (direct_internal_fn_supported_p (IFN_CTZ, type, OPTIMIZE_FOR_BOTH) - && CTZ_DEFINED_VALUE_AT_ZERO (SCALAR_INT_TYPE_MODE (type), - val) == 2) - { - ifn = IFN_CTZ; - break; - } - } - return false; - case BUILT_IN_CLRSB: - val = TYPE_PRECISION (integer_type_node) - 1; - break; - case BUILT_IN_CLRSBL: - val = TYPE_PRECISION (long_integer_type_node) - 1; - break; - case BUILT_IN_CLRSBLL: - val = TYPE_PRECISION (long_long_integer_type_node) - 1; - break; default: return false; } + arg = gimple_call_arg (popcount, 0); + lhs = gimple_get_lhs (popcount); + if (cast) { - /* We have a cast stmt feeding popcount/clz/ctz builtin. */ + /* We have a cast stmt feeding popcount builtin. */ /* Check that we have a cast prior to that. */ if (gimple_code (cast) != GIMPLE_ASSIGN || !CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (cast))) @@ -2352,7 +1824,7 @@ cond_removal_in_builtin_zero_pattern (basic_block cond_bb, cond = last_stmt (cond_bb); - /* Cond_bb has a check for b_4 [!=|==] 0 before calling the popcount/clz/ctz + /* Cond_bb has a check for b_4 [!=|==] 0 before calling the popcount builtin. */ if (gimple_code (cond) != GIMPLE_COND || (gimple_cond_code (cond) != NE_EXPR @@ -2372,13 +1844,10 @@ cond_removal_in_builtin_zero_pattern (basic_block cond_bb, } /* Check PHI arguments. */ - if (lhs != arg0 - || TREE_CODE (arg1) != INTEGER_CST - || wi::to_wide (arg1) != val) + if (lhs != arg0 || !integer_zerop (arg1)) return false; - /* And insert the popcount/clz/ctz builtin and cast stmt before the - cond_bb. */ + /* And insert the popcount builtin and cast stmt before the cond_bb. */ gsi = gsi_last_bb (cond_bb); if (cast) { @@ -2386,19 +1855,9 @@ cond_removal_in_builtin_zero_pattern (basic_block cond_bb, gsi_move_before (&gsi_from, &gsi); reset_flow_sensitive_info (gimple_get_lhs (cast)); } - gsi_from = gsi_for_stmt (call); - if (ifn == IFN_LAST || gimple_call_internal_p (call)) - gsi_move_before (&gsi_from, &gsi); - else - { - /* For __builtin_c[lt]z* force .C[LT]Z ifn, because only - the latter is well defined at zero. */ - call = gimple_build_call_internal (ifn, 1, gimple_call_arg (call, 0)); - gimple_call_set_lhs (call, lhs); - gsi_insert_before (&gsi, call, GSI_SAME_STMT); - gsi_remove (&gsi_from, true); - } - reset_flow_sensitive_info (lhs); + gsi_from = gsi_for_stmt (popcount); + gsi_move_before (&gsi_from, &gsi); + reset_flow_sensitive_info (gimple_get_lhs (popcount)); /* Now update the PHI and remove unneeded bbs. */ replace_phi_edge_with_variable (cond_bb, e2, phi, lhs); @@ -2414,7 +1873,7 @@ cond_removal_in_builtin_zero_pattern (basic_block cond_bb, static bool abs_replacement (basic_block cond_bb, basic_block middle_bb, edge e0 ATTRIBUTE_UNUSED, edge e1, - gphi *phi, tree arg0, tree arg1) + gimple *phi, tree arg0, tree arg1) { tree result; gassign *new_stmt; @@ -3846,7 +3305,7 @@ gate_hoist_loads (void) Conditional Replacement ----------------------- - This transformation, implemented in match_simplify_replacement, + This transformation, implemented in conditional_replacement, replaces bb0: diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 1ad43dba1c686fd5e0f008235893649ebff06bb0..af8df8563bcc1a35fcd32acd8725c7ecfe5319ca 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -3830,8 +3830,7 @@ optimize_range_tests (enum tree_code opcode, to type of comparison. */ static tree_code -ovce_extract_ops (tree var, gassign **rets, bool *reti, tree *type, - tree *lhs, tree *rhs, gassign **vcond) +ovce_extract_ops (tree var, gassign **rets, bool *reti, tree *type) { if (TREE_CODE (var) != SSA_NAME) return ERROR_MARK; @@ -3839,8 +3838,6 @@ ovce_extract_ops (tree var, gassign **rets, bool *reti, tree *type, gassign *stmt = dyn_cast (SSA_NAME_DEF_STMT (var)); if (stmt == NULL) return ERROR_MARK; - if (vcond) - *vcond = stmt; /* ??? If we start creating more COND_EXPR, we could perform this same optimization with them. For now, simplify. */ @@ -3849,20 +3846,9 @@ ovce_extract_ops (tree var, gassign **rets, bool *reti, tree *type, tree cond = gimple_assign_rhs1 (stmt); tree_code cmp = TREE_CODE (cond); - if (cmp != SSA_NAME) + if (TREE_CODE_CLASS (cmp) != tcc_comparison) return ERROR_MARK; - gassign *assign = dyn_cast (SSA_NAME_DEF_STMT (cond)); - if (assign == NULL - || TREE_CODE_CLASS (gimple_assign_rhs_code (assign)) != tcc_comparison) - return ERROR_MARK; - - cmp = gimple_assign_rhs_code (assign); - if (lhs) - *lhs = gimple_assign_rhs1 (assign); - if (rhs) - *rhs = gimple_assign_rhs2 (assign); - /* ??? For now, allow only canonical true and false result vectors. We could expand this to other constants should the need arise, but at the moment we don't create them. */ @@ -3883,7 +3869,7 @@ ovce_extract_ops (tree var, gassign **rets, bool *reti, tree *type, /* Success! */ if (rets) - *rets = assign; + *rets = stmt; if (reti) *reti = inv; if (type) @@ -3907,11 +3893,10 @@ optimize_vec_cond_expr (tree_code opcode, vec *ops) { tree elt0 = (*ops)[i]->op; - gassign *stmt0, *vcond0; + gassign *stmt0; bool invert; - tree type, lhs0, rhs0; - tree_code cmp0 = ovce_extract_ops (elt0, &stmt0, &invert, &type, &lhs0, - &rhs0, &vcond0); + tree type; + tree_code cmp0 = ovce_extract_ops (elt0, &stmt0, &invert, &type); if (cmp0 == ERROR_MARK) continue; @@ -3919,20 +3904,26 @@ optimize_vec_cond_expr (tree_code opcode, vec *ops) { tree &elt1 = (*ops)[j]->op; - gassign *stmt1, *vcond1; - tree lhs1, rhs1; - tree_code cmp1 = ovce_extract_ops (elt1, &stmt1, NULL, NULL, &lhs1, - &rhs1, &vcond1); + gassign *stmt1; + tree_code cmp1 = ovce_extract_ops (elt1, &stmt1, NULL, NULL); if (cmp1 == ERROR_MARK) continue; + tree cond0 = gimple_assign_rhs1 (stmt0); + tree x0 = TREE_OPERAND (cond0, 0); + tree y0 = TREE_OPERAND (cond0, 1); + + tree cond1 = gimple_assign_rhs1 (stmt1); + tree x1 = TREE_OPERAND (cond1, 0); + tree y1 = TREE_OPERAND (cond1, 1); + tree comb; if (opcode == BIT_AND_EXPR) - comb = maybe_fold_and_comparisons (type, cmp0, lhs0, rhs0, - cmp1, lhs1, rhs1); + comb = maybe_fold_and_comparisons (type, cmp0, x0, y0, cmp1, x1, + y1); else if (opcode == BIT_IOR_EXPR) - comb = maybe_fold_or_comparisons (type, cmp0, lhs0, rhs0, - cmp1, lhs1, rhs1); + comb = maybe_fold_or_comparisons (type, cmp0, x0, y0, cmp1, x1, + y1); else gcc_unreachable (); if (comb == NULL) @@ -3942,22 +3933,19 @@ optimize_vec_cond_expr (tree_code opcode, vec *ops) if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "Transforming "); - print_generic_expr (dump_file, gimple_assign_lhs (stmt0)); + print_generic_expr (dump_file, cond0); fprintf (dump_file, " %c ", opcode == BIT_AND_EXPR ? '&' : '|'); - print_generic_expr (dump_file, gimple_assign_lhs (stmt1)); + print_generic_expr (dump_file, cond1); fprintf (dump_file, " into "); print_generic_expr (dump_file, comb); fputc ('\n', dump_file); } - gimple_stmt_iterator gsi = gsi_for_stmt (vcond0); - tree exp = force_gimple_operand_gsi (&gsi, comb, true, NULL_TREE, - true, GSI_SAME_STMT); + gimple_assign_set_rhs1 (stmt0, comb); if (invert) - swap_ssa_operands (vcond0, gimple_assign_rhs2_ptr (vcond0), - gimple_assign_rhs3_ptr (vcond0)); - gimple_assign_set_rhs1 (vcond0, exp); - update_stmt (vcond0); + std::swap (*gimple_assign_rhs2_ptr (stmt0), + *gimple_assign_rhs3_ptr (stmt0)); + update_stmt (stmt0); elt1 = error_mark_node; any_changes = true; diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c index f6b8287e5cd98c966ecb5506f6c26965f588ad05..aebc30c086d59cd9bc61488891148885f5242157 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -694,14 +694,12 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, if (addend == NULL_TREE && expand_vec_cond_expr_p (type, type, LT_EXPR)) { - tree zero, cst, mask_type, mask; - gimple *stmt, *cond; + tree zero, cst, cond, mask_type; + gimple *stmt; mask_type = truth_type_for (type); zero = build_zero_cst (type); - mask = make_ssa_name (mask_type); - cond = gimple_build_assign (mask, LT_EXPR, op0, zero); - gsi_insert_before (gsi, cond, GSI_SAME_STMT); + cond = build2 (LT_EXPR, mask_type, op0, zero); tree_vector_builder vec (type, nunits, 1); for (i = 0; i < nunits; i++) vec.quick_push (build_int_cst (TREE_TYPE (type), @@ -709,8 +707,8 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, << shifts[i]) - 1)); cst = vec.build (); addend = make_ssa_name (type); - stmt - = gimple_build_assign (addend, VEC_COND_EXPR, mask, cst, zero); + stmt = gimple_build_assign (addend, VEC_COND_EXPR, cond, + cst, zero); gsi_insert_before (gsi, stmt, GSI_SAME_STMT); } } @@ -952,29 +950,21 @@ expand_vector_condition (gimple_stmt_iterator *gsi) tree index = bitsize_int (0); tree comp_width = width; tree comp_index = index; + int i; location_t loc = gimple_location (gsi_stmt (*gsi)); - tree_code code = TREE_CODE (a); - if (code == SSA_NAME) + if (!is_gimple_val (a)) { - gassign *assign = dyn_cast (SSA_NAME_DEF_STMT (a)); - if (assign != NULL - && TREE_CODE_CLASS (gimple_assign_rhs_code (assign)) == tcc_comparison) - { - a_is_comparison = true; - a1 = gimple_assign_rhs1 (assign); - a2 = gimple_assign_rhs2 (assign); - code = gimple_assign_rhs_code (assign); - comp_inner_type = TREE_TYPE (TREE_TYPE (a1)); - comp_width = vector_element_bits_tree (TREE_TYPE (a1)); - } + gcc_assert (COMPARISON_CLASS_P (a)); + a_is_comparison = true; + a1 = TREE_OPERAND (a, 0); + a2 = TREE_OPERAND (a, 1); + comp_inner_type = TREE_TYPE (TREE_TYPE (a1)); + comp_width = TYPE_SIZE (comp_inner_type); } - if (expand_vec_cond_expr_p (type, TREE_TYPE (a1), code)) - { - gcc_assert (TREE_CODE (a) == SSA_NAME || TREE_CODE (a) == VECTOR_CST); - return; - } + if (expand_vec_cond_expr_p (type, TREE_TYPE (a1), TREE_CODE (a))) + return; /* Handle vector boolean types with bitmasks. If there is a comparison and we can expand the comparison into the vector boolean bitmask, @@ -997,7 +987,7 @@ expand_vector_condition (gimple_stmt_iterator *gsi) : expand_vec_cmp_expr_p (TREE_TYPE (a1), type, TREE_CODE (a)))) { if (a_is_comparison) - a = gimplify_build2 (gsi, code, type, a1, a2); + a = gimplify_build2 (gsi, TREE_CODE (a), type, a1, a2); a1 = gimplify_build2 (gsi, BIT_AND_EXPR, type, a, b); a2 = gimplify_build1 (gsi, BIT_NOT_EXPR, type, a); a2 = gimplify_build2 (gsi, BIT_AND_EXPR, type, a2, c); @@ -1028,7 +1018,7 @@ expand_vector_condition (gimple_stmt_iterator *gsi) int nunits = nunits_for_known_piecewise_op (type); vec_alloc (v, nunits); - for (int i = 0; i < nunits; i++) + for (i = 0; i < nunits; i++) { tree aa, result; tree bb = tree_vec_extract (gsi, inner_type, b, width, index); @@ -1039,7 +1029,7 @@ expand_vector_condition (gimple_stmt_iterator *gsi) comp_width, comp_index); tree aa2 = tree_vec_extract (gsi, comp_inner_type, a2, comp_width, comp_index); - aa = fold_build2 (code, cond_type, aa1, aa2); + aa = fold_build2 (TREE_CODE (a), cond_type, aa1, aa2); } else if (a_is_scalar_bitmask) { diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 0e1c86af6d9d78d472680d78ecdb3573b558cb06..6447f74b180ff72e0cd0f522cfee94149b5ed65c 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -3266,7 +3266,7 @@ vect_get_data_ptr_increment (dr_vec_info *dr_info, tree aggr_type, return iv_step; } -/* Check and perform vectorization of BUILT_IN_BSWAP{16,32,64,128}. */ +/* Check and perform vectorization of BUILT_IN_BSWAP{16,32,64}. */ static bool vectorizable_bswap (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, @@ -3635,8 +3635,7 @@ vectorizable_call (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, else if (modifier == NONE && (gimple_call_builtin_p (stmt, BUILT_IN_BSWAP16) || gimple_call_builtin_p (stmt, BUILT_IN_BSWAP32) - || gimple_call_builtin_p (stmt, BUILT_IN_BSWAP64) - || gimple_call_builtin_p (stmt, BUILT_IN_BSWAP128))) + || gimple_call_builtin_p (stmt, BUILT_IN_BSWAP64))) return vectorizable_bswap (stmt_info, gsi, vec_stmt, slp_node, vectype_in, cost_vec); else @@ -11281,12 +11280,8 @@ vectorizable_condition (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, { vec_cond_rhs = vec_oprnds1[i]; if (bitop1 == NOP_EXPR) - { - gimple_seq stmts = NULL; - vec_compare = gimple_build (&stmts, cond_code, vec_cmp_type, - vec_cond_lhs, vec_cond_rhs); - gsi_insert_before (gsi, stmts, GSI_SAME_STMT); - } + vec_compare = build2 (cond_code, vec_cmp_type, + vec_cond_lhs, vec_cond_rhs); else { new_temp = make_ssa_name (vec_cmp_type); diff --git a/gcc/tree.c b/gcc/tree.c index a617886510db4e12586eff896a4f78dce2c61867..75a191f974c2310ca0784a098e99aa879bdd4fb1 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -10392,8 +10392,6 @@ build_common_tree_nodes (bool signed_char) uint16_type_node = make_or_reuse_type (16, 1); uint32_type_node = make_or_reuse_type (32, 1); uint64_type_node = make_or_reuse_type (64, 1); - if (targetm.scalar_mode_supported_p (TImode)) - uint128_type_node = make_or_reuse_type (128, 1); /* Decimal float types. */ if (targetm.decimal_float_supported_p ()) diff --git a/gcc/tree.h b/gcc/tree.h index c66207fa0cbe069e0d47f2c39a136664340eb308..792d9c864f88e9f5e17ef3db670327a9c4082ee7 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4037,7 +4037,6 @@ tree_strip_any_location_wrapper (tree exp) #define uint16_type_node global_trees[TI_UINT16_TYPE] #define uint32_type_node global_trees[TI_UINT32_TYPE] #define uint64_type_node global_trees[TI_UINT64_TYPE] -#define uint128_type_node global_trees[TI_UINT128_TYPE] #define void_node global_trees[TI_VOID]