Ping^2 [PATCH, rs6000] Fix ICE on expand bcd__ [PR100736]
Hi, Gentle ping this: https://gcc.gnu.org/pipermail/gcc-patches/2021-December/587253.html Thanks On 10/1/2022 上午 11:14, HAO CHEN GUI wrote: > Hi, > > Gentle ping this: > > https://gcc.gnu.org/pipermail/gcc-patches/2021-December/587253.html > > Thanks > > On 21/12/2021 下午 4:19, HAO CHEN GUI wrote: >> Hi, >> This patch fixes the ICE in PR100736. It adds a reverse condition >> comparison when the >> condition code can be reversed and finite-math-only is set. >> >> Bootstrapped and tested on powerpc64-linux BE and LE with no regressions. >> Is this okay for trunk? >> Any recommendations? Thanks a lot. >> >> ChangeLog >> 2021-12-20 Haochen Gui >> >> gcc/ >> * config/rs6000/altivec.md (bcd_test_): Named. >> (bcd__): Reverse compare condition if >> finite-math-only is set. >> * config/rs6000/rs6000-protos.c (rs6000_reverse_compare): Defined. >> * config/rs6000/rs6000.c (rs6000_emit_sCOND): Refactored. Call >> rs6000_reverse_compare if the condition code can be reversed. >> (rs6000_reverse_compare): Implemented. >> >> gcc/testsuite/ >> * gcc.target/powerpc/pr100736.h: New. >> * gcc.target/powerpc/pr100736.finite.c: New. >> * gcc.target/powerpc/pr100736.infinite.c: New. >> >> >> patch.diff >> diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md >> index ef432112333..cc40edc5381 100644 >> --- a/gcc/config/rs6000/altivec.md >> +++ b/gcc/config/rs6000/altivec.md >> @@ -4412,7 +4412,7 @@ (define_insn "bcd_" >> ;; UNORDERED test on an integer type (like V1TImode) is not defined. The >> type >> ;; probably should be one that can go in the VMX (Altivec) registers, so we >> ;; can't use DDmode or DFmode. >> -(define_insn "*bcd_test_" >> +(define_insn "bcd_test_" >>[(set (reg:CCFP CR6_REGNO) >> (compare:CCFP >> (unspec:V2DF [(match_operand:VBCD 1 "register_operand" "v") >> @@ -4539,6 +4539,18 @@ (define_expand "bcd__" >>"TARGET_P8_VECTOR" >> { >>operands[4] = CONST0_RTX (V2DFmode); >> + emit_insn (gen_bcd_test_ (operands[0], operands[1], >> + operands[2], operands[3], >> + operands[4])); >> + rtx cr6 = gen_rtx_REG (CCFPmode, CR6_REGNO); >> + rtx condition_rtx = gen_rtx_ (SImode, cr6, const0_rtx); >> + if (flag_finite_math_only) >> +{ >> + condition_rtx = rs6000_reverse_compare (condition_rtx); >> + PUT_MODE (condition_rtx, SImode); >> +} >> + emit_insn (gen_rtx_SET (operands[0], condition_rtx)); >> + DONE; >> }) >> >> (define_insn "*bcdinvalid_" >> diff --git a/gcc/config/rs6000/rs6000-protos.h >> b/gcc/config/rs6000/rs6000-protos.h >> index 14f6b313105..9b93e26bec2 100644 >> --- a/gcc/config/rs6000/rs6000-protos.h >> +++ b/gcc/config/rs6000/rs6000-protos.h >> @@ -114,6 +114,7 @@ extern enum rtx_code rs6000_reverse_condition >> (machine_mode, >> extern rtx rs6000_emit_eqne (machine_mode, rtx, rtx, rtx); >> extern rtx rs6000_emit_fp_cror (rtx_code, machine_mode, rtx); >> extern void rs6000_emit_sCOND (machine_mode, rtx[]); >> +extern rtx rs6000_reverse_compare (rtx); >> extern void rs6000_emit_cbranch (machine_mode, rtx[]); >> extern char * output_cbranch (rtx, const char *, int, rtx_insn *); >> extern const char * output_probe_stack_range (rtx, rtx, rtx); >> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c >> index 5e129986516..2f3dd311396 100644 >> --- a/gcc/config/rs6000/rs6000.c >> +++ b/gcc/config/rs6000/rs6000.c >> @@ -15653,19 +15653,14 @@ rs6000_emit_fp_cror (rtx_code code, machine_mode >> mode, rtx x) >>return cc; >> } >> >> -void >> -rs6000_emit_sCOND (machine_mode mode, rtx operands[]) >> +rtx >> +rs6000_reverse_compare (rtx condition_rtx) >> { >> - rtx condition_rtx = rs6000_generate_compare (operands[1], mode); >>rtx_code cond_code = GET_CODE (condition_rtx); >> - >> - if (FLOAT_MODE_P (mode) && HONOR_NANS (mode) >> - && !(FLOAT128_VECTOR_P (mode) && !TARGET_FLOAT128_HW)) >> -; >> - else if (cond_code == NE >> - || cond_code == GE || cond_code == LE >> - || cond_code == GEU || cond_code == LEU >> - || cond_code == ORDERED || cond_code == UNGE || cond_code == UNLE) >> + if (cond_code == NE >> + || cond_code == GE || cond_code == LE >> + || cond_code == GEU || cond_code == LEU >> + || cond_code == ORDERED || cond_code == UNGE || cond_code == UNLE) >> { >>rtx not_result = gen_reg_rtx (CCEQmode); >>rtx not_op, rev_cond_rtx; >> @@ -15679,6 +15674,19 @@ rs6000_emit_sCOND (machine_mode mode, rtx >> operands[]) >>emit_insn (gen_rtx_SET (not_result, not_op)); >>condition_rtx = gen_rtx_EQ (VOIDmode, not_result, const0_rtx); >> } >> + return condition_rtx; >> +} >> + >> +void >> +rs6000_emit_sCOND (machine_mode mode, rtx operands[]) >> +{ >> + rtx condition_rtx = rs6000_generate_compare (operands[1], mode); >> + >> + if (FLOAT_MODE_P (mode) && HONOR_NANS (mode) >>
Ping^1 [PATCH v3, rs6000] Add a combine pattern for CA minus one [PR95737]
Hi, Gentle ping this: https://gcc.gnu.org/pipermail/gcc-patches/2022-January/589006.html Thanks On 21/1/2022 下午 5:28, HAO CHEN GUI wrote: > Hi, >This patch adds a combine pattern for "CA minus one". As CA only has two > values (0 or 1), we could convert following pattern > (sign_extend:DI (plus:SI (reg:SI 98 ca) > (const_int -1 [0x] > to >(plus:DI (reg:DI 98 ca) > (const_int -1 [0x]))) >With this patch, one unnecessary sign extend is eliminated. > >Bootstrapped and tested on powerpc64-linux BE and LE with no regressions. > Is this okay for trunk? Any recommendations? Thanks a lot. > > ChangeLog > 2022-01-20 Haochen Gui > > gcc/ > * config/rs6000/rs6000.md (extenddi_ca_minus_one): Define. > > gcc/testsuite/ > * gcc.target/powerpc/pr95737.c: New. > > > patch.diff > diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md > index 6ecb0bd6142..1d8b212962f 100644 > --- a/gcc/config/rs6000/rs6000.md > +++ b/gcc/config/rs6000/rs6000.md > @@ -2358,6 +2358,19 @@ (define_insn "subf3_carry_in_xx" >"subfe %0,%0,%0" >[(set_attr "type" "add")]) > > +(define_insn_and_split "*extenddi_ca_minus_one" > + [(set (match_operand:DI 0 "gpc_reg_operand" "=r") > + (sign_extend:DI (plus:SI (reg:SI CA_REGNO) > + (const_int -1] > + "" > + "#" > + "" > + [(parallel [(set (match_dup 0) > +(plus:DI (reg:DI CA_REGNO) > + (const_int -1))) > + (clobber (reg:DI CA_REGNO))])] > + "" > +) > > (define_insn "@neg2" >[(set (match_operand:GPR 0 "gpc_reg_operand" "=r") > diff --git a/gcc/testsuite/gcc.target/powerpc/pr95737.c > b/gcc/testsuite/gcc.target/powerpc/pr95737.c > new file mode 100644 > index 000..d4d6a4198cf > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/pr95737.c > @@ -0,0 +1,10 @@ > +/* PR target/95737 */ > +/* { dg-do compile { target lp64 } } */ > +/* { dg-options "-O2 -mno-isel" } */ > +/* { dg-final { scan-assembler-not {\mextsw\M} } } */ > + > + > +unsigned long negativeLessThan (unsigned long a, unsigned long b) > +{ > + return -(a < b); > +}
Ping^1 [PATCH, rs6000] Remove TImode from mode iterator BOOL_128 [PR100694, PR93123]
Hi, Gentle ping this: https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590057.html Thanks On 9/2/2022 上午 10:43, HAO CHEN GUI wrote: > Hi, > This patch removes TImode from mode iterator BOOL_128. Thus, bool > operations (AND, IOR, XOR, NOT) > on TImode will be split to the relevant operations on word mode during expand > (in optabs.c). Potential > optimizations can be implemented after the split. The former practice splits > it after the reload > pass which is too later for some optimizations. The new test case illustrates > it. > > Bootstrapped and tested on powerpc64-linux BE and LE with no regressions. > Is this okay for trunk? > Any recommendations? Thanks a lot. > > ChangeLog > 2022-02-08 Haochen Gui > > gcc/ > PR target/100694 > * config/rs6000/rs6000.md (BOOL_128): Remove TI. > > gcc/testsuite/ > PR target/100694 > * gcc.target/powerpc/pr100694.c: New. > * gcc.target/powerpc/pr92398.c: New. > * gcc.target/powerpc/pr92398.h: Remove. > * gcc.target/powerpc/pr92398.p9-.c: Remove. > * gcc.target/powerpc/pr92398.p9+.c: Remove. > > patch.diff > diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md > index 6f74075f58d..2bc1b8f497a 100644 > --- a/gcc/config/rs6000/rs6000.md > +++ b/gcc/config/rs6000/rs6000.md > @@ -750,8 +750,7 @@ (define_mode_attr SI_CONVERT_FP [(SF "TARGET_FCFIDS") >(DF "TARGET_FCFID")]) > > ;; Mode iterator for logical operations on 128-bit types > -(define_mode_iterator BOOL_128 [TI > - PTI > +(define_mode_iterator BOOL_128 [PTI >(V16QI "TARGET_ALTIVEC") >(V8HI "TARGET_ALTIVEC") >(V4SI "TARGET_ALTIVEC") > diff --git a/gcc/testsuite/gcc.target/powerpc/pr100694.c > b/gcc/testsuite/gcc.target/powerpc/pr100694.c > new file mode 100644 > index 000..7b41d920140 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/pr100694.c > @@ -0,0 +1,15 @@ > +/* { dg-do compile } */ > +/* { dg-require-effective-target int128 } */ > +/* { dg-options "-O2" } */ > +/* { dg-final { scan-assembler-times {\mstd\M} 2 } } */ > +/* { dg-final { scan-assembler-not {\mli\M} } } */ > +/* { dg-final { scan-assembler-not {\mor\M} } } */ > + > +/* It just needs two std. */ > +void foo (unsigned __int128* res, unsigned long long hi, unsigned long long > lo) > +{ > + unsigned __int128 i = hi; > + i <<= 64; > + i |= lo; > + *res = i; > +} > diff --git a/gcc/testsuite/gcc.target/powerpc/pr92398.c > b/gcc/testsuite/gcc.target/powerpc/pr92398.c > new file mode 100644 > index 000..7d6201cc5bb > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/pr92398.c > @@ -0,0 +1,12 @@ > +/* { dg-do compile } */ > +/* { dg-require-effective-target int128 } */ > +/* { dg-options "-O2" } */ > +/* { dg-final { scan-assembler-times {\mnot\M} 2 } } */ > +/* { dg-final { scan-assembler-times {\mstd\M} 2 } } */ > + > +/* All platforms should generate the same instructions: not;not;std;std. */ > +void bar (__int128_t *dst, __int128_t src) > +{ > + *dst = ~src; > +} > + > diff --git a/gcc/testsuite/gcc.target/powerpc/pr92398.h > b/gcc/testsuite/gcc.target/powerpc/pr92398.h > deleted file mode 100644 > index 5a4a8bcab80..000 > --- a/gcc/testsuite/gcc.target/powerpc/pr92398.h > +++ /dev/null > @@ -1,17 +0,0 @@ > -/* This test code is included into pr92398.p9-.c and pr92398.p9+.c. > - The two files have the tests for the number of instructions generated for > - P9- versus P9+. > - > - store generates difference instructions as below: > - P9+: mtvsrdd;xxlnot;stxv. > - P8/P7/P6 LE: not;not;std;std. > - P8 BE: mtvsrd;mtvsrd;xxpermdi;xxlnor;stxvd2x. > - P7/P6 BE: std;std;addi;lxvd2x;xxlnor;stxvd2x. > - P9+ and P9- LE are expected, P6/P7/P8 BE are unexpected. */ > - > -void > -bar (__int128_t *dst, __int128_t src) > -{ > - *dst = ~src; > -} > - > diff --git a/gcc/testsuite/gcc.target/powerpc/pr92398.p9+.c > b/gcc/testsuite/gcc.target/powerpc/pr92398.p9+.c > deleted file mode 100644 > index 72dd1d9a274..000 > --- a/gcc/testsuite/gcc.target/powerpc/pr92398.p9+.c > +++ /dev/null > @@ -1,12 +0,0 @@ > -/* { dg-do compile { target { lp64 && has_arch_pwr9 } } } */ > -/* { dg-require-effective-target powerpc_vsx_ok } */ > -/* { dg-options "-O2 -mvsx" } */ > - > -/* { dg-final { scan-assembler-times {\mmtvsrdd\M} 1 } } */ > -/* { dg-final { scan-assembler-times {\mxxlnor\M} 1 } } */ > -/* { dg-final { scan-assembler-times {\mstxv\M} 1 } } */ > -/* { dg-final { scan-assembler-not {\mld\M} } } */ > -/* { dg-final { scan-assembler-not {\mnot\M} } } */ > - > -/* Source code for the test in pr92398.h */ > -#include "pr92398.h" > diff --git a/gcc/testsuite/gcc.target/powerpc/pr92398.p9-.c > b/gcc/testsuite/gcc.target/powerpc/pr92398.p9-.c > deleted file mode 100644 > index bd7fa98af51..0
[PATCH] RISC-V:Add support for ZMMUL extension
From: LiaoShihua ZMMUL extension is Multiply only extension for RISC-V.It implements the multiplication subset of the M extension. The encodings are identical to those of the corresponding M-extension instructions. When You both use M extension add ZMMUL extension, it will warning "-mdiv cannot use when the ZMMUL extension is present" gcc\ChangeLog: * common/config/riscv/riscv-common.cc:Add support for ZMMUL extension * config/riscv/riscv-opts.h (MASK_ZMMUL):Likewise (TARGET_ZMMUL):Likewise * config/riscv/riscv.cc (riscv_option_override):Likewise * config/riscv/riscv.md:Likewise * config/riscv/riscv.opt:Likewise --- gcc/common/config/riscv/riscv-common.cc | 3 +++ gcc/config/riscv/riscv-opts.h | 3 +++ gcc/config/riscv/riscv.cc | 4 +++- gcc/config/riscv/riscv.md | 28 - gcc/config/riscv/riscv.opt | 3 +++ 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index a904893b9ed..fec6c25eb04 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -185,6 +185,8 @@ static const struct riscv_ext_version riscv_ext_version_table[] = {"zvl32768b", ISA_SPEC_CLASS_NONE, 1, 0}, {"zvl65536b", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zmmul", ISA_SPEC_CLASS_NONE, 0, 1}, + /* Terminate the list. */ {NULL, ISA_SPEC_CLASS_NONE, 0, 0} }; @@ -1080,6 +1082,7 @@ static const riscv_ext_flag_table_t riscv_ext_flag_table[] = {"zvl32768b", &gcc_options::x_riscv_zvl_flags, MASK_ZVL32768B}, {"zvl65536b", &gcc_options::x_riscv_zvl_flags, MASK_ZVL65536B}, + {"zmmul",&gcc_options::x_riscv_zmmul_subext, MASK_ZMMUL}, {NULL, NULL, 0} }; diff --git a/gcc/config/riscv/riscv-opts.h b/gcc/config/riscv/riscv-opts.h index 929e4e3a7c5..47e25628635 100644 --- a/gcc/config/riscv/riscv-opts.h +++ b/gcc/config/riscv/riscv-opts.h @@ -136,4 +136,7 @@ enum stack_protector_guard { #define TARGET_ZVL32768B ((riscv_zvl_flags & MASK_ZVL32768B) != 0) #define TARGET_ZVL65536B ((riscv_zvl_flags & MASK_ZVL65536B) != 0) +#define MASK_ZMMUL (1 << 0) +#define TARGET_ZMMUL((riscv_zmmul_subext & MASK_ZMMUL) != 0) + #endif /* ! GCC_RISCV_OPTS_H */ diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 6885b4bbad2..bbd5c288da9 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -4974,8 +4974,10 @@ riscv_option_override (void) /* The presence of the M extension implies that division instructions are present, so include them unless explicitly disabled. */ - if (TARGET_MUL && (target_flags_explicit & MASK_DIV) == 0) + if (!TARGET_ZMMUL && TARGET_MUL && (target_flags_explicit & MASK_DIV) == 0) target_flags |= MASK_DIV; + else if(TARGET_ZMMUL && TARGET_MUL && (target_flags_explicit & MASK_DIV) == 0) +warning (0, "%<-mdiv%> cannot use when the % extension is present"); else if (!TARGET_MUL && TARGET_DIV) error ("%<-mdiv%> requires %<-march%> to subsume the % extension"); diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index b3c5bce842a..6dee2fb681a 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -756,7 +756,7 @@ [(set (match_operand:SI 0 "register_operand" "=r") (mult:SI (match_operand:SI 1 "register_operand" " r") (match_operand:SI 2 "register_operand" " r")))] - "TARGET_MUL" + "TARGET_ZMMUL || TARGET_MUL" { return TARGET_64BIT ? "mulw\t%0,%1,%2" : "mul\t%0,%1,%2"; } [(set_attr "type" "imul") (set_attr "mode" "SI")]) @@ -765,7 +765,7 @@ [(set (match_operand:DI 0 "register_operand" "=r") (mult:DI (match_operand:DI 1 "register_operand" " r") (match_operand:DI 2 "register_operand" " r")))] - "TARGET_MUL && TARGET_64BIT" + "(TARGET_ZMMUL || TARGET_MUL) && TARGET_64BIT" "mul\t%0,%1,%2" [(set_attr "type" "imul") (set_attr "mode" "DI")]) @@ -775,7 +775,7 @@ (mult:GPR (match_operand:GPR 1 "register_operand" " r") (match_operand:GPR 2 "register_operand" " r"))) (label_ref (match_operand 3 "" ""))] - "TARGET_MUL" + "TARGET_ZMMUL || TARGET_MUL" { if (TARGET_64BIT && mode == SImode) { @@ -820,7 +820,7 @@ (mult:GPR (match_operand:GPR 1 "register_operand" " r") (match_operand:GPR 2 "register_operand" " r"))) (label_ref (match_operand 3 "" ""))] - "TARGET_MUL" + "TARGET_ZMMUL || TARGET_MUL" { if (TARGET_64BIT && mode == SImode) { @@ -866,7 +866,7 @@ (sign_extend:DI (mult:SI (match_operand:SI 1 "register_operand" " r") (match_operand:SI 2 "register_operand" " r"] - "TARGET_MUL && TARGET_64BIT" + "(TARGET_ZMMUL || TARGET_MUL) && TARGET_64BIT" "mulw\t%0,%1,%2" [(set_attr "type" "imul") (set_attr "mode" "SI")
Re: [PATCH] [Ada] PR ada/98724: Alpha/Linux/libada: Use wraplf for Aux_Long_Long_Float
On Sun, 13 Feb 2022, Arnaud Charlet wrote: > > gcc/ada/ > > PR ada/98724 > > PR ada/97504 > > * Makefile.rtl (LIBGNAT_TARGET_PAIRS) : Use > > wraplf version of Aux_Long_Long_Float. > > --- > > Hi, > > > > OK for trunk and GCC 11? > > OK, thanks. Committed and backported, and the PR closed. Thank you for your review! Maciej
Re: [committed] libstdc++: Fix test failures at -O0
On Sun, 13 Feb 2022, 21:21 Hans-Peter Nilsson, wrote: > On Fri, 11 Feb 2022, Jonathan Wakely via Gcc-patches wrote: > > diff --git > a/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc > b/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc > > index c81344a20e4..25e5ce63b58 100644 > > --- > a/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc > > +++ > b/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc > > @@ -281,10 +281,13 @@ test07() > >std::pmr::unsynchronized_pool_resource upr(&cr); > >try > >{ > > +#pragma GCC diagnostic push > > +#pragma GCC diagnostic ignored "-Walloc-size-larger-than=" > > // Try to allocate a ridiculous size (and use a large extended > alignment > > // so that careful_resource::do_allocate can distinguish this > allocation > > // from any required for the pool resource's internal data > structures): > > void* p = upr.allocate(std::size_t(-2), 1024); > > +#pragma GCC distinguish pop > > Isn't it a bug that you (presumably) didn't get an error for > that misspelling? Or a diagnostic to distinguish it? 8-} > Oh! I guess I typed di then ctrl-p to complete it (a vim shortcut). I think it should warn with -Wunknown-pragma or whatever the option is, but we probably don't use that for the libstdc++ tests. I'll fix that in the morning, thanks for spotting it.
Re: [committed] libstdc++: Fix test failures at -O0
On Fri, 11 Feb 2022, Jonathan Wakely via Gcc-patches wrote: > diff --git > a/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc > b/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc > index c81344a20e4..25e5ce63b58 100644 > --- a/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc > +++ b/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc > @@ -281,10 +281,13 @@ test07() >std::pmr::unsynchronized_pool_resource upr(&cr); >try >{ > +#pragma GCC diagnostic push > +#pragma GCC diagnostic ignored "-Walloc-size-larger-than=" > // Try to allocate a ridiculous size (and use a large extended alignment > // so that careful_resource::do_allocate can distinguish this allocation > // from any required for the pool resource's internal data structures): > void* p = upr.allocate(std::size_t(-2), 1024); > +#pragma GCC distinguish pop Isn't it a bug that you (presumably) didn't get an error for that misspelling? Or a diagnostic to distinguish it? 8-} brgds, H-P
Re: Merge from trunk to gccgo branch
I merged trunk revision 58aeb75d4097010ad9bb72b964265b18ab284f93 to the gccgo branch. Ian
Go patch committed: Call timer function via syscall.
It turns out to be painful to require linking against -lrt on GNU/Linux, as that makes it harder to link Go code into C programs. Instead just call the timer syscalls directly. That is what the upstream library does anyhow. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian gcc/go/ * gospec.cc: Revert 2022-02-09 change: (RTLIB, RT_LIBRARY): Don't define. (lang_specific_driver): Don't add -lrt if linking statically on GNU/Linux. gotools/ * configure.ac: Revert 2022-02-09 change: (RT_LIBS): Don't define. * Makefile.am (check-runtime): Don't set GOLIBS to $(RT_LIBS). * configure, Makefile.in: Regenerate. 2bb0e6232ac1dbfb0a93b5bbd0144b80f9d76cd3 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 02a6e1d661d..745132a3d9d 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -7f8fee099d6de4a5a857765e0ddfae356ead554c +0af68c0552341a44f1fb12301f9eff954b9dde88 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gospec.cc b/gcc/go/gospec.cc index ba7ba4ea09d..df92b62d8e6 100644 --- a/gcc/go/gospec.cc +++ b/gcc/go/gospec.cc @@ -29,12 +29,10 @@ along with GCC; see the file COPYING3. If not see #define MATHLIB(1<<2) /* This bit is set if they did `-lpthread'. */ #define THREADLIB (1<<3) -/* This bit is set if they did `-lrt'. */ -#define RTLIB (1<<4) /* This bit is set if they did `-lc'. */ -#define WITHLIBC (1<<5) +#define WITHLIBC (1<<4) /* Skip this option. */ -#define SKIPOPT(1<<6) +#define SKIPOPT(1<<5) #ifndef MATH_LIBRARY #define MATH_LIBRARY "m" @@ -46,8 +44,6 @@ along with GCC; see the file COPYING3. If not see #define THREAD_LIBRARY "pthread" #define THREAD_LIBRARY_PROFILE THREAD_LIBRARY -#define RT_LIBRARY "rt" - #define LIBGO "go" #define LIBGO_PROFILE LIBGO #define LIBGOBEGIN "gobegin" @@ -78,9 +74,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, /* "-lpthread" if it appears on the command line. */ const struct cl_decoded_option *saw_thread = 0; - /* "-lrt" if it appears on the command line. */ - const struct cl_decoded_option *saw_rt = 0; - /* "-lc" if it appears on the command line. */ const struct cl_decoded_option *saw_libc = 0; @@ -91,9 +84,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, /* Whether we need the thread library. */ int need_thread = 0; - /* Whether we need the rt library. */ - int need_rt = 0; - /* By default, we throw on the math library if we have one. */ int need_math = (MATH_LIBRARY[0] != '\0'); @@ -166,8 +156,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, } else if (strcmp (arg, THREAD_LIBRARY) == 0) args[i] |= THREADLIB; - else if (strcmp (arg, RT_LIBRARY) == 0) - args[i] |= RTLIB; else if (strcmp (arg, "c") == 0) args[i] |= WITHLIBC; else @@ -272,7 +260,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, #endif /* Make sure to have room for the trailing NULL argument. */ - num_args = argc + need_math + shared_libgcc + (library > 0) * 6 + 10; + num_args = argc + need_math + shared_libgcc + (library > 0) * 5 + 10; new_decoded_options = XNEWVEC (struct cl_decoded_option, num_args); i = 0; @@ -326,12 +314,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, saw_thread = &decoded_options[i]; } - if (!saw_rt && (args[i] & RTLIB) && library > 0) - { - --j; - saw_rt = &decoded_options[i]; - } - if (!saw_libc && (args[i] & WITHLIBC) && library > 0) { --j; @@ -413,23 +395,9 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, #endif /* When linking libgo statically we also need to link with the -pthread and (on GNU/Linux) the rt library. */ +pthread library. */ if (library > 1 || static_link) - { - need_thread = 1; - if (strstr (DEFAULT_TARGET_MACHINE, "linux") != NULL) - need_rt = 1; - } -} - - if (saw_rt) -new_decoded_options[j++] = *saw_rt; - else if (library > 0 && need_rt) -{ - generate_option (OPT_l, RT_LIBRARY, 1, CL_DRIVER, - &new_decoded_options[j]); - added_libraries++; - j++; + need_thread = 1; } if (saw_thread) diff --git a/gotools/Makefile.am b/gotools/Makefile.am index 46481cb5173..7b5302990f8 100644 --- a/gotools/Makefile.am +++ b/gotools/Makefile.am @@ -248,14 +248,12 @@ check-runtime: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc GOARCH=`$(abs_builddir)/go$(EXEEXT) env GOARCH`; \
Go patch committed: Don't set ptrmask bit for pointer to notinheap type
This patch fixes the Go frontend to not set a bit in the garbage-collection ptrmask bit for a pointer to notinheap type. This is a follow-up to https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590150.html. The test case for this is https://go.dev/cl/385454. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 14d5dc6e03cff4ecf46cd29dbceb32eea76467ef diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 4e6bac7b7d5..02a6e1d661d 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -47380f733ca932384e59492d2f04374edd8ec95e +7f8fee099d6de4a5a857765e0ddfae356ead554c The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index ee3467666d8..8267f1565ce 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -2816,6 +2816,9 @@ class Ptrmask void Ptrmask::set_from(Gogo* gogo, Type* type, int64_t ptrsize, int64_t offset) { + if (!type->has_pointer()) +return; + switch (type->base()->classification()) { default: @@ -2858,9 +2861,6 @@ Ptrmask::set_from(Gogo* gogo, Type* type, int64_t ptrsize, int64_t offset) case Type::TYPE_STRUCT: { - if (!type->has_pointer()) - return; - const Struct_field_list* fields = type->struct_type()->fields(); int64_t soffset = 0; for (Struct_field_list::const_iterator pf = fields->begin(); @@ -2898,9 +2898,6 @@ Ptrmask::set_from(Gogo* gogo, Type* type, int64_t ptrsize, int64_t offset) } else { - if (!type->has_pointer()) - return; - int64_t len; if (!type->array_type()->int_length(&len)) {
Re: [PATCH] [Ada] PR ada/98724: Alpha/Linux/libada: Use wraplf for Aux_Long_Long_Float
> Use the Long Long Float wrapper in terms of Long Float for Alpha/Linux > targets as well, fixing gnatlib compilation errors: > > a-nallfl.ads:48:13: warning: intrinsic binding type mismatch on result > [enabledby default] > a-nallfl.ads:48:13: warning: intrinsic binding type mismatch on parameter 1 > [enabled by default] > a-nallfl.ads:48:13: warning: profile of "Sin" doesn't match the builtin it > binds [enabled by default] > > etc. with the `alpha-linux-gnu' target. > > gcc/ada/ > PR ada/98724 > PR ada/97504 > * Makefile.rtl (LIBGNAT_TARGET_PAIRS) : Use > wraplf version of Aux_Long_Long_Float. > --- > Hi, > > OK for trunk and GCC 11? OK, thanks.
[PATCH] [Ada] PR ada/98724: Alpha/Linux/libada: Use wraplf for Aux_Long_Long_Float
Use the Long Long Float wrapper in terms of Long Float for Alpha/Linux targets as well, fixing gnatlib compilation errors: a-nallfl.ads:48:13: warning: intrinsic binding type mismatch on result [enabledby default] a-nallfl.ads:48:13: warning: intrinsic binding type mismatch on parameter 1 [enabled by default] a-nallfl.ads:48:13: warning: profile of "Sin" doesn't match the builtin it binds [enabled by default] etc. with the `alpha-linux-gnu' target. gcc/ada/ PR ada/98724 PR ada/97504 * Makefile.rtl (LIBGNAT_TARGET_PAIRS) : Use wraplf version of Aux_Long_Long_Float. --- Hi, OK for trunk and GCC 11? Maciej --- gcc/ada/Makefile.rtl |1 + 1 file changed, 1 insertion(+) gcc-alpha-libgnat-nallfl-wraplf.diff Index: gcc/gcc/ada/Makefile.rtl === --- gcc.orig/gcc/ada/Makefile.rtl +++ gcc/gcc/ada/Makefile.rtl @@ -2559,6 +2559,7 @@ endif ifeq ($(strip $(filter-out alpha% linux%,$(target_cpu) $(target_os))),) LIBGNAT_TARGET_PAIRS = \ a-intnam.ads