On Mon, Jan 24, 2022 at 08:55:37AM -0600, Segher Boessenkool wrote: > Hi! > > On Thu, Jan 13, 2022 at 02:08:53PM -0300, Raoni Fassina Firmino wrote: > > Changes since v8[8]: > > - Refactored and expanded builtin-feclearexcept-feraiseexcept-2.c > > testcase: > > + Use a macro to avoid extended repetition of the core test code. > > + Expanded the test code to check builtins return code. > > + Added more tests to test all valid (standard) exceptions input > > This is okay for trunk (Jeff already approved the generic parts). > Thanks!
This breaks bootstrap with --enable-checking=rtl, e.g. while compiling libquadmath/math/llrintq.c #0 internal_error (gmsgid=0x131bb1e0 "RTL check: expected code '%s', have '%s' in %s, at %s:%d") at ../../gcc/diagnostic.cc:1938 #1 0x00000000113a0e94 in rtl_check_failed_code1 (r=0x3fffaf4a24a8, code=CONST_INT, file=0x13400018 "../../gcc/config/rs6000/rs6000.md", line=7010, func=0x13409298 <gen_feraiseexceptsi(rtx_def*, rtx_def*)::__FUNCTION__> "gen_feraiseexceptsi") at ../../gcc/rtl.cc:918 #2 0x00000000125154e8 in gen_feraiseexceptsi (operand0=0x3fffaf4a3720, operand1=0x3fffaf4a24a8) at ../../gcc/config/rs6000/rs6000.md:7010 #3 0x00000000108badf4 in insn_gen_fn::operator()<rtx_def*, rtx_def*> (this=0x138ee440 <insn_data+131776>) at ../../gcc/recog.h:407 #4 0x0000000010890b1c in expand_builtin_feclear_feraise_except (exp=0x3fffaf3041a0, target=0x3fffaf4a3720, target_mode=E_SImode, op_optab=feraiseexcept_optab) at ../../gcc/builtins.cc:2606 #5 0x00000000108a6f74 in expand_builtin (exp=0x3fffaf3041a0, target=0x3fffaf100490, subtarget=0x0, mode=E_VOIDmode, ignore=1) at ../../gcc/builtins.cc:7130 #6 0x0000000010c01770 in expand_expr_real_1 (exp=0x3fffaf3041a0, target=0x0, tmode=E_VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0, inner_reference_p=false) at ../../gcc/expr.cc:11536 #7 0x0000000010bf0604 in expand_expr_real (exp=0x3fffaf3041a0, target=0x3fffaf100490, tmode=E_VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0, inner_reference_p=false) at ../../gcc/expr.cc:8737 #8 0x00000000108ffa00 in expand_expr (exp=0x3fffaf3041a0, target=0x3fffaf100490, mode=E_VOIDmode, modifier=EXPAND_NORMAL) at ../../gcc/expr.h:301 #9 0x000000001090c934 in expand_call_stmt (stmt=0x3fffaf1314d0) at ../../gcc/cfgexpand.cc:2831 #10 0x0000000010911e18 in expand_gimple_stmt_1 (stmt=0x3fffaf1314d0) at ../../gcc/cfgexpand.cc:3864 #11 0x0000000010912730 in expand_gimple_stmt (stmt=0x3fffaf1314d0) at ../../gcc/cfgexpand.cc:4028 #12 0x000000001091ecb0 in expand_gimple_basic_block (bb=0x3fffaf190c98, disable_tail_calls=false) at ../../gcc/cfgexpand.cc:6069 #13 0x0000000010921be8 in (anonymous namespace)::pass_expand::execute (this=0x13ab0d40, fun=0x3fffaf0c0c38) at ../../gcc/cfgexpand.cc:6795 #14 0x0000000011216ea4 in execute_one_pass (pass=0x13ab0d40) at ../../gcc/passes.cc:2637 #15 0x00000000112173d8 in execute_pass_list_1 (pass=0x13ab0d40) at ../../gcc/passes.cc:2737 #16 0x00000000112174b0 in execute_pass_list (fn=0x3fffaf0c0c38, pass=0x13aac8c0) at ../../gcc/passes.cc:2748 #17 0x00000000109b4e4c in cgraph_node::expand (this=0x3fffaf151760) at ../../gcc/cgraphunit.cc:1834 #18 0x00000000109b5844 in expand_all_functions () at ../../gcc/cgraphunit.cc:1998 #19 0x00000000109b67d0 in symbol_table::compile (this=0x3fffaf0d0000) at ../../gcc/cgraphunit.cc:2348 #20 0x00000000109b6f40 in symbol_table::finalize_compilation_unit (this=0x3fffaf0d0000) at ../../gcc/cgraphunit.cc:2529 #21 0x00000000114f10f4 in compile_file () at ../../gcc/toplev.cc:479 #22 0x00000000114f6204 in do_compile (no_backend=false) at ../../gcc/toplev.cc:2158 #23 0x00000000114f68d0 in toplev::main (this=0x3fffffffeb64, argc=45, argv=0x3fffffffef98) at ../../gcc/toplev.cc:2310 #24 0x0000000012f97a6c in main (argc=45, argv=0x3fffffffef98) at ../../gcc/main.cc:39 expand_builtin_feclear_feraise_except doesn't check if op0 matches the predicate of operands[1], the backend requires const_int_operand, but because the call isn't done with a constant integer: feraiseexcept (t == LLONG_MIN ? FE_INEXACT : FE_INVALID); op0 is a REG. If CONST_INT is what is expected on all targets, then it should punt if op0 isn't one, otherwise it should the predicate. Jakub