Skip to content
Snippets Groups Projects
  1. Oct 21, 2024
    • Pan Li's avatar
      RISC-V: Add testcases for form 3 of vector signed SAT_TRUNC · efa1617b
      Pan Li authored
      
      Form 3:
        #define DEF_VEC_SAT_S_TRUNC_FMT_3(NT, WT, NT_MIN, NT_MAX)             \
        void __attribute__((noinline))                                        \
        vec_sat_s_trunc_##NT##_##WT##_fmt_3 (NT *out, WT *in, unsigned limit) \
        {                                                                     \
          unsigned i;                                                         \
          for (i = 0; i < limit; i++)                                         \
            {                                                                 \
              WT x = in[i];                                                   \
              NT trunc = (NT)x;                                               \
              out[i] = (WT)NT_MIN < x && x < (WT)NT_MAX                       \
      	  ? trunc                                                       \
      	  : x < 0 ? NT_MIN : NT_MAX;                                    \
            }                                                                 \
        }
      
      The below test are passed for this patch.
      * The rv64gcv fully regression test.
      
      It is test only patch and obvious up to a point, will commit it
      directly if no comments in next 48H.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/vec_sat_arith.h: Add test helper macros.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-3-i16-to-i8.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-3-i32-to-i16.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-3-i32-to-i8.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-3-i64-to-i16.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-3-i64-to-i32.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-3-i64-to-i8.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-3-i16-to-i8.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-3-i32-to-i16.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-3-i32-to-i8.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-3-i64-to-i16.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-3-i64-to-i32.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-3-i64-to-i8.c: New test.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      efa1617b
    • Pan Li's avatar
      RISC-V: Add testcases for form 2 of vector signed SAT_TRUNC · 033900fc
      Pan Li authored
      
      Form 2:
        #define DEF_VEC_SAT_S_TRUNC_FMT_2(NT, WT, NT_MIN, NT_MAX)             \
        void __attribute__((noinline))                                        \
        vec_sat_s_trunc_##NT##_##WT##_fmt_2 (NT *out, WT *in, unsigned limit) \
        {                                                                     \
          unsigned i;                                                         \
          for (i = 0; i < limit; i++)                                         \
            {                                                                 \
              WT x = in[i];                                                   \
              NT trunc = (NT)x;                                               \
              out[i] = (WT)NT_MIN < x && x < (WT)NT_MAX                       \
      	  ? trunc                                                       \
      	  : x < 0 ? NT_MIN : NT_MAX;                                    \
            }                                                                 \
        }
      
      The below test are passed for this patch.
      * The rv64gcv fully regression test.
      
      It is test only patch and obvious up to a point, will commit it
      directly if no comments in next 48H.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/vec_sat_arith.h: Add test helper macros.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-2-i16-to-i8.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-2-i32-to-i16.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-2-i32-to-i8.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-2-i64-to-i16.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-2-i64-to-i32.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-2-i64-to-i8.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-2-i16-to-i8.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-2-i32-to-i16.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-2-i32-to-i8.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-2-i64-to-i16.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-2-i64-to-i32.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-2-i64-to-i8.c: New test.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      033900fc
    • Pan Li's avatar
      RISC-V: Add testcases for form 1 of vector signed SAT_TRUNC · 1f3a9c08
      Pan Li authored
      
      Form 1:
        #define DEF_VEC_SAT_S_TRUNC_FMT_1(NT, WT, NT_MIN, NT_MAX)             \
        void __attribute__((noinline))                                        \
        vec_sat_s_trunc_##NT##_##WT##_fmt_1 (NT *out, WT *in, unsigned limit) \
        {                                                                     \
          unsigned i;                                                         \
          for (i = 0; i < limit; i++)                                         \
            {                                                                 \
              WT x = in[i];                                                   \
              NT trunc = (NT)x;                                               \
              out[i] = (WT)NT_MIN <= x && x <= (WT)NT_MAX                     \
       	  ? trunc                                                       \
      	  : x < 0 ? NT_MIN : NT_MAX;                                    \
            }                                                                 \
        }
      
      The below test are passed for this patch.
      * The rv64gcv fully regression test.
      
      It is test only patch and obvious up to a point, will commit it
      directly if no comments in next 48H.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_data.h: Add test data for
      	signed SAT_TRUNC.
      	* gcc.target/riscv/rvv/autovec/vec_sat_arith.h: Add test helper macros.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-1-i16-to-i8.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-1-i32-to-i16.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-1-i32-to-i8.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-1-i64-to-i16.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-1-i64-to-i32.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-1-i64-to-i8.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-1-i16-to-i8.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-1-i32-to-i16.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-1-i32-to-i8.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-1-i64-to-i16.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-1-i64-to-i32.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/vec_sat_s_trunc-run-1-i64-to-i8.c: New test.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      1f3a9c08
    • Pan Li's avatar
      RISC-V: Implement vector SAT_TRUNC for signed integer · b5a05815
      Pan Li authored
      
      This patch would like to implement the sstrunc for vector signed integer.
      
      Form 1:
        #define DEF_VEC_SAT_S_TRUNC_FMT_1(NT, WT, NT_MIN, NT_MAX)             \
        void __attribute__((noinline))                                        \
        vec_sat_s_trunc_##NT##_##WT##_fmt_1 (NT *out, WT *in, unsigned limit) \
        {                                                                     \
          unsigned i;                                                         \
          for (i = 0; i < limit; i++)                                         \
            {                                                                 \
              WT x = in[i];                                                   \
              NT trunc = (NT)x;                                               \
              out[i] = (WT)NT_MIN <= x && x <= (WT)NT_MAX                     \
      	  ? trunc                                                       \
      	  : x < 0 ? NT_MIN : NT_MAX;                                    \
            }                                                                 \
        }
      
      DEF_VEC_SAT_S_TRUNC_FMT_1(int32_t, int64_t, INT32_MIN, INT32_MAX)
      
      Before this patch:
        27   │     vsetvli a5,a2,e64,m1,ta,ma
        28   │     vle64.v v1,0(a1)
        29   │     slli    a3,a5,3
        30   │     slli    a4,a5,2
        31   │     sub a2,a2,a5
        32   │     add a1,a1,a3
        33   │     vadd.vv v0,v1,v5
        34   │     vsetvli zero,zero,e32,mf2,ta,ma
        35   │     vnsrl.wx    v2,v1,a6
        36   │     vncvt.x.x.w v1,v1
        37   │     vsetvli zero,zero,e64,m1,ta,ma
        38   │     vmsgtu.vv   v0,v0,v4
        39   │     vsetvli zero,zero,e32,mf2,ta,mu
        40   │     vneg.v  v2,v2
        41   │     vxor.vv v1,v2,v3,v0.t
        42   │     vse32.v v1,0(a0)
        43   │     add a0,a0,a4
        44   │     bne a2,zero,.L3
      
      After this patch:
        16   │     vsetvli a5,a2,e32,mf2,ta,ma
        17   │     vle64.v v1,0(a1)
        18   │     slli    a3,a5,3
        19   │     slli    a4,a5,2
        20   │     sub a2,a2,a5
        21   │     add a1,a1,a3
        22   │     vnclip.wi   v1,v1,0
        23   │     vse32.v v1,0(a0)
        24   │     add a0,a0,a4
        25   │     bne a2,zero,.L3
      
      The below test suites are passed for this patch.
      * The rv64gcv fully regression test.
      
      gcc/ChangeLog:
      
      	* config/riscv/autovec.md (sstrunc<mode><v_double_trunc>2): Add
      	new pattern sstrunc for double trunc.
      	(sstrunc<mode><v_quad_trunc>2): Ditto but for quad trunc.
      	(sstrunc<mode><v_oct_trunc>2): Ditto but for oct trunc.
      	* config/riscv/riscv-protos.h (expand_vec_double_sstrunc): Add
      	new func decl to expand double trunc.
      	(expand_vec_quad_sstrunc): Ditto but for quad trunc.
      	(expand_vec_oct_sstrunc): Ditto but for oct trunc.
      	* config/riscv/riscv-v.cc (expand_vec_double_sstrunc): Add new
      	func to expand double trunc.
      	(expand_vec_quad_sstrunc): Ditto but for quad trunc.
      	(expand_vec_oct_sstrunc): Ditto but for oct trunc.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      b5a05815
    • Pan Li's avatar
      Vect: Try the pattern of vector signed integer SAT_TRUNC · 2987ca61
      Pan Li authored
      
      Almost the same as vector unsigned integer SAT_TRUNC, try to match
      the signed version during the vector pattern matching.
      
      The below test suites are passed for this patch.
      * The rv64gcv fully regression test.
      * The x86 bootstrap test.
      * The x86 fully regression test.
      
      gcc/ChangeLog:
      
      	* tree-vect-patterns.cc (gimple_signed_integer_sat_trunc): Add
      	new func decl for signed SAT_TRUNC.
      	(vect_recog_sat_trunc_pattern): Try signed match pattern for
      	the SAT_TRUNC.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      2987ca61
    • Pan Li's avatar
      Match: Support form 1 for vector signed integer SAT_TRUNC · bdbb74e3
      Pan Li authored
      
      This patch would like to support the form 1 of the vector signed
      integer SAT_TRUNC.  Aka below example:
      
      Form 1:
        #define DEF_VEC_SAT_S_TRUNC_FMT_1(NT, WT, NT_MIN, NT_MAX)             \
        void __attribute__((noinline))                                        \
        vec_sat_s_trunc_##NT##_##WT##_fmt_1 (NT *out, WT *in, unsigned limit) \
        {                                                                     \
          unsigned i;                                                         \
          for (i = 0; i < limit; i++)                                         \
            {                                                                 \
              WT x = in[i];                                                   \
              NT trunc = (NT)x;                                               \
              out[i] = (WT)NT_MIN <= x && x <= (WT)NT_MAX                     \
      	  ? trunc                                                       \
      	  : x < 0 ? NT_MIN : NT_MAX;                                    \
            }                                                                 \
        }
      
      DEF_VEC_SAT_S_TRUNC_FMT_1(int32_t, int64_t, INT32_MIN, INT32_MAX)
      
      Before this patch:
        48   │   _87 = .SELECT_VL (ivtmp_85, POLY_INT_CST [2, 2]);
        49   │   ivtmp_64 = _87 * 8;
        50   │   vect_x_14.10_67 = .MASK_LEN_LOAD (vectp_in.8_65, 64B, { -1, ... }, _87, 0);
        51   │   vect_trunc_15.21_78 = (vector([2,2]) int) vect_x_14.10_67;
        52   │   _61 = VIEW_CONVERT_EXPR<vector([2,2]) unsigned long>(vect_x_14.10_67);
        53   │   _32 = _61 >> 63;
        54   │   vect_patt_52.16_73 = (vector([2,2]) int) _32;
        55   │   vect__46.17_74 = VIEW_CONVERT_EXPR<vector([2,2]) unsigned int>(vect_patt_52.16_73);
        56   │   vect__47.18_75 = -vect__46.17_74;
        57   │   vect__21.19_76 = VIEW_CONVERT_EXPR<vector([2,2]) int>(vect__47.18_75);
        58   │   vect_x.11_68 = VIEW_CONVERT_EXPR<vector([2,2]) unsigned long>(vect_x_14.10_67);
        59   │   vect__5.12_69 = vect_x.11_68 + { 2147483648, ... };
        60   │   mask__34.13_70 = vect__5.12_69 > { 4294967295, ... };
        61   │   _25 = .COND_XOR (mask__34.13_70, vect__21.19_76, { 2147483647, ... }, vect_trunc_15.21_78);
        62   │   ivtmp_80 = _87 * 4;
        63   │   .MASK_LEN_STORE (vectp_out.23_81, 32B, { -1, ... }, _87, 0, _25);
        64   │   vectp_in.8_66 = vectp_in.8_65 + ivtmp_64;
        65   │   vectp_out.23_82 = vectp_out.23_81 + ivtmp_80;
        66   │   ivtmp_86 = ivtmp_85 - _87;
      
      After this patch:
        38   │   _77 = .SELECT_VL (ivtmp_75, POLY_INT_CST [2, 2]);
        39   │   ivtmp_65 = _77 * 8;
        40   │   vect_x_14.10_68 = .MASK_LEN_LOAD (vectp_in.8_66, 64B, { -1, ... }, _77, 0);
        41   │   vect_patt_53.11_69 = .SAT_TRUNC (vect_x_14.10_68);
        42   │   ivtmp_70 = _77 * 4;
        43   │   .MASK_LEN_STORE (vectp_out.12_71, 32B, { -1, ... }, _77, 0, vect_patt_53.11_69);
        44   │   vectp_in.8_67 = vectp_in.8_66 + ivtmp_65;
        45   │   vectp_out.12_72 = vectp_out.12_71 + ivtmp_70;
        46   │   ivtmp_76 = ivtmp_75 - _77;
      
      The below test suites are passed for this patch.
      * The rv64gcv fully regression test.
      * The x86 bootstrap test.
      * The x86 fully regression test.
      
      gcc/ChangeLog:
      
      	* match.pd: Refine matching for vector signed SAT_TRUNC form 1.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      bdbb74e3
    • Andrew Carlotti's avatar
      aarch64: Fix costing of move to/from MOVEABLE_SYSREGS · 8193e71a
      Andrew Carlotti authored
      This is necessary to prevent reload assuming that a direct FP->FPMR move
      is valid.
      
      gcc/ChangeLog:
      
      	* config/aarch64/aarch64.cc (aarch64_register_move_cost):
      	Increase costs involving MOVEABLE_SYSREGS.
      8193e71a
    • Andrew Stubbs's avatar
      amdgcn: silence warning · 0b6d94ce
      Andrew Stubbs authored
      FIRST_SGPR_REG is register zero so the compiler always claims this comparison
      is redundant.  It's right, of course, but I'd have preferred to keep the
      comparison for completeness.  Probably the "correct" solution is to use an enum
      for these values.
      
      gcc/ChangeLog:
      
      	* config/gcn/gcn.h (SGPR_REGNO_P): Silence warning.
      0b6d94ce
    • Alex Coplan's avatar
      pair-fusion: Assume alias conflict if common address reg changes [PR116783] · c0e54ce1
      Alex Coplan authored
      As the PR shows, pair-fusion was tricking memory_modified_in_insn_p into
      returning false when a common base register (in this case, x1) was
      modified between the mem and the store insn.  This lead to wrong code as
      the accesses really did alias.
      
      To avoid this sort of problem, this patch avoids invoking RTL alias
      analysis altogether (and assume an alias conflict) if the two insns to
      be compared share a common address register R, and the insns see different
      definitions of R (i.e. it was modified in between).
      
      gcc/ChangeLog:
      
      	PR rtl-optimization/116783
      	* pair-fusion.cc (def_walker::cand_addr_uses): New.
      	(def_walker::def_walker): Add parameter for candidate address
      	uses.
      	(def_walker::alias_conflict_p): Declare.
      	(def_walker::addr_reg_conflict_p): New.
      	(def_walker::conflict_p): New.
      	(store_walker::store_walker): Add parameter for candidate
      	address uses and pass to base ctor.
      	(store_walker::conflict_p): Rename to ...
      	(store_walker::alias_conflict_p): ... this.
      	(load_walker::load_walker): Add parameter for candidate
      	address uses and pass to base ctor.
      	(load_walker::conflict_p): Rename to ...
      	(load_walker::alias_conflict_p): ... this.
      	(pair_fusion_bb_info::try_fuse_pair): Collect address register
      	uses for candidate insns and pass down to alias walkers.
      
      gcc/testsuite/ChangeLog:
      
      	PR rtl-optimization/116783
      	* g++.dg/torture/pr116783.C: New test.
      c0e54ce1
    • Jonathan Wakely's avatar
      libstdc++: Improve 26_numerics/headers/cmath/types_std_c++0x_neg.cc · d0d99fc6
      Jonathan Wakely authored
      This test checks that the special functions in <cmath> are not declared
      prior to C++17. But we can remove the target selector and allow it to be
      tested for C++17 and later, and add target selectors to the individual
      dg-error directives instead.
      
      Also rename the test to match what it actually tests.
      
      libstdc++-v3/ChangeLog:
      
      	* testsuite/26_numerics/headers/cmath/types_std_c++0x_neg.cc:
      	Move to ...
      	* testsuite/26_numerics/headers/cmath/specfun_c++17.cc: here and
      	adjust test to be valid for all -std dialects.
      d0d99fc6
    • Jonathan Wakely's avatar
      libstdc++: Simplify C++98 std::vector::_M_data_ptr overload set · 1003a428
      Jonathan Wakely authored
      We don't need separate overloads for returning a const or non-const
      pointer. We can make the member function const and return a non-const
      pointer, and let vector::data() const convert it to const as needed.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/stl_vector.h (vector::_M_data_ptr): Remove
      	non-const overloads. Always return non-const pointer.
      1003a428
    • Jonathan Wakely's avatar
      libstdc++: Fix order of [[...]] and __attribute__((...)) attrs [PR117220] · cba80691
      Jonathan Wakely authored
      GCC allows these in either order, but Clang doesn't like the C++11-style
      [[__nodiscard__]] coming after __attribute__((__always_inline__)).
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/117220
      	* include/bits/stl_iterator.h: Move _GLIBCXX_NODISCARD
      	annotations after __attribute__((__always_inline__)).
      cba80691
    • Jeevitha's avatar
      rs6000: Correct the function code for _AMO_LD_DEC_BOUNDED · 1a4c5643
      Jeevitha authored
      Corrected the function code for the Atomic Memory Operation "Fetch and Decrement
      Bounded", changing it from 0x1A to 0x1C.
      
      2024-10-11 Jeevitha Palanisamy <jeevitha@linux.ibm.com>
      
      gcc/
      
      	* config/rs6000/amo.h (enum _AMO_LD): Correct the function code for
      	_AMO_LD_DEC_BOUNDED.
      1a4c5643
    • Haochen Jiang's avatar
      i386: Refactor get_intel_cpu · f132c006
      Haochen Jiang authored
      From ISE, it shows that we will have family 0x13 for Diamond Rapids.
      Therefore, we need to refactor the get_intel_cpu to accept new families.
      Also I did some reorder in the switch for clearness by putting earlier
      added products on top for search convenience.
      
      gcc/ChangeLog:
      
      	* common/config/i386/cpuinfo.h (get_intel_cpu): Refactor the
      	function for future expansion on different family.
      f132c006
    • xuli's avatar
      RISC-V: Skip flag -flto for all saturated arithmetic test cases. · 61281225
      xuli authored
      
      Skip flat -flto to address UNRESOLVED cases as follows:
      
      gcc.target/riscv/sat_s_add-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects: output file does not exist
      UNRESOLVED: gcc.target/riscv/sat_s_add-1.c
      
      Change-Id: I7ff55197b6294cd473dfaa6cc350c5e2eb5960fe
      Signed-off-by: default avatarLi Xu <xuli1@eswincomputing.com>
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/sat_s_add-1.c: Skip flag -flto.
      	* gcc.target/riscv/sat_s_add-10.c: Ditto.
      	* gcc.target/riscv/sat_s_add-11.c: Ditto.
      	* gcc.target/riscv/sat_s_add-12.c: Ditto.
      	* gcc.target/riscv/sat_s_add-13.c: Ditto.
      	* gcc.target/riscv/sat_s_add-14.c: Ditto.
      	* gcc.target/riscv/sat_s_add-15.c: Ditto.
      	* gcc.target/riscv/sat_s_add-16.c: Ditto.
      	* gcc.target/riscv/sat_s_add-2.c: Ditto.
      	* gcc.target/riscv/sat_s_add-3.c: Ditto.
      	* gcc.target/riscv/sat_s_add-4.c: Ditto.
      	* gcc.target/riscv/sat_s_add-5.c: Ditto.
      	* gcc.target/riscv/sat_s_add-6.c: Ditto.
      	* gcc.target/riscv/sat_s_add-7.c: Ditto.
      	* gcc.target/riscv/sat_s_add-8.c: Ditto.
      	* gcc.target/riscv/sat_s_add-9.c: Ditto.
      	* gcc.target/riscv/sat_s_sub-1-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_sub-1-i32.c: Ditto.
      	* gcc.target/riscv/sat_s_sub-1-i64.c: Ditto.
      	* gcc.target/riscv/sat_s_sub-1-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_sub-2-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_sub-2-i32.c: Ditto.
      	* gcc.target/riscv/sat_s_sub-2-i64.c: Ditto.
      	* gcc.target/riscv/sat_s_sub-2-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_sub-3-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_sub-3-i32.c: Ditto.
      	* gcc.target/riscv/sat_s_sub-3-i64.c: Ditto.
      	* gcc.target/riscv/sat_s_sub-3-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_sub-4-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_sub-4-i32.c: Ditto.
      	* gcc.target/riscv/sat_s_sub-4-i64.c: Ditto.
      	* gcc.target/riscv/sat_s_sub-4-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-1-i16-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-1-i32-to-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-1-i32-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-1-i64-to-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-1-i64-to-i32.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-1-i64-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-2-i16-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-2-i32-to-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-2-i32-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-2-i64-to-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-2-i64-to-i32.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-2-i64-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-3-i16-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-3-i32-to-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-3-i32-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-3-i64-to-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-3-i64-to-i32.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-3-i64-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-4-i16-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-4-i32-to-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-4-i32-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-4-i64-to-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-4-i64-to-i32.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-4-i64-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-5-i16-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-5-i32-to-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-5-i32-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-5-i64-to-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-5-i64-to-i32.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-5-i64-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-6-i16-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-6-i32-to-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-6-i32-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-6-i64-to-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-6-i64-to-i32.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-6-i64-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-7-i16-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-7-i32-to-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-7-i32-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-7-i64-to-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-7-i64-to-i32.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-7-i64-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-8-i16-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-8-i32-to-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-8-i32-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-8-i64-to-i16.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-8-i64-to-i32.c: Ditto.
      	* gcc.target/riscv/sat_s_trunc-8-i64-to-i8.c: Ditto.
      	* gcc.target/riscv/sat_u_add-1.c: Ditto.
      	* gcc.target/riscv/sat_u_add-10.c: Ditto.
      	* gcc.target/riscv/sat_u_add-11.c: Ditto.
      	* gcc.target/riscv/sat_u_add-12.c: Ditto.
      	* gcc.target/riscv/sat_u_add-13.c: Ditto.
      	* gcc.target/riscv/sat_u_add-14.c: Ditto.
      	* gcc.target/riscv/sat_u_add-15.c: Ditto.
      	* gcc.target/riscv/sat_u_add-16.c: Ditto.
      	* gcc.target/riscv/sat_u_add-17.c: Ditto.
      	* gcc.target/riscv/sat_u_add-18.c: Ditto.
      	* gcc.target/riscv/sat_u_add-19.c: Ditto.
      	* gcc.target/riscv/sat_u_add-2.c: Ditto.
      	* gcc.target/riscv/sat_u_add-20.c: Ditto.
      	* gcc.target/riscv/sat_u_add-21.c: Ditto.
      	* gcc.target/riscv/sat_u_add-22.c: Ditto.
      	* gcc.target/riscv/sat_u_add-23.c: Ditto.
      	* gcc.target/riscv/sat_u_add-24.c: Ditto.
      	* gcc.target/riscv/sat_u_add-3.c: Ditto.
      	* gcc.target/riscv/sat_u_add-4.c: Ditto.
      	* gcc.target/riscv/sat_u_add-5.c: Ditto.
      	* gcc.target/riscv/sat_u_add-6.c: Ditto.
      	* gcc.target/riscv/sat_u_add-7.c: Ditto.
      	* gcc.target/riscv/sat_u_add-8.c: Ditto.
      	* gcc.target/riscv/sat_u_add-9.c: Ditto.
      	* gcc.target/riscv/sat_u_add_imm-1.c: Ditto.
      	* gcc.target/riscv/sat_u_add_imm-10.c: Ditto.
      	* gcc.target/riscv/sat_u_add_imm-11.c: Ditto.
      	* gcc.target/riscv/sat_u_add_imm-12.c: Ditto.
      	* gcc.target/riscv/sat_u_add_imm-13.c: Ditto.
      	* gcc.target/riscv/sat_u_add_imm-14.c: Ditto.
      	* gcc.target/riscv/sat_u_add_imm-15.c: Ditto.
      	* gcc.target/riscv/sat_u_add_imm-16.c: Ditto.
      	* gcc.target/riscv/sat_u_add_imm-2.c: Ditto.
      	* gcc.target/riscv/sat_u_add_imm-3.c: Ditto.
      	* gcc.target/riscv/sat_u_add_imm-4.c: Ditto.
      	* gcc.target/riscv/sat_u_add_imm-5.c: Ditto.
      	* gcc.target/riscv/sat_u_add_imm-6.c: Ditto.
      	* gcc.target/riscv/sat_u_add_imm-7.c: Ditto.
      	* gcc.target/riscv/sat_u_add_imm-8.c: Ditto.
      	* gcc.target/riscv/sat_u_add_imm-9.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-1.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-10.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-11.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-12.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-13.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-14.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-15.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-16.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-17.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-18.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-19.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-2.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-20.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-21.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-22.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-23.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-24.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-25.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-26.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-27.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-28.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-29.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-3.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-30.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-31.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-32.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-33.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-34.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-35.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-36.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-37.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-38.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-39.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-4.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-40.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-41.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-42.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-43.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-44.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-45.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-46.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-47.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-48.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-5.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-6.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-7.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-8.c: Ditto.
      	* gcc.target/riscv/sat_u_sub-9.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-1.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-10.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-10_1.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-10_2.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-11.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-11_1.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-11_2.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-12.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-13.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-13_1.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-13_2.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-14.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-14_1.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-14_2.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-15.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-15_1.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-15_2.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-16.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-1_1.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-1_2.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-2.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-2_1.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-2_2.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-3.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-3_1.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-3_2.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-4.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-5.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-5_1.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-5_2.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-6.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-6_1.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-6_2.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-7.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-7_1.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-7_2.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-8.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-9.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-9_1.c: Ditto.
      	* gcc.target/riscv/sat_u_sub_imm-9_2.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-1.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-10.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-11.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-12.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-13.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-14.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-15.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-16.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-17.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-18.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-19.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-2.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-20.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-21.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-22.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-23.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-24.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-3.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-4.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-5.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-6.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-7.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-8.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-9.c: Ditto.
      61281225
    • Alexandre Oliva's avatar
      [testsuite] [arm] add effective target and options for pacbti tests · 3ad0f67f
      Alexandre Oliva authored
      arm pac and bti tests that use -march=armv8.1-m.main get an implicit
      -mthumb, that is incompatible with vxworks kernel mode.  Declaring the
      requirement for a 8.1-m.main-compatible toolchain is enough to avoid
      those fails, because the toolchain feature test fails in kernel mode,
      but taking the -march options from the standardized arch tests, after
      testing for support for the corresponding effective target, makes it
      generally safer, and enables us to drop skip directives and extraneous
      option variants.
      
      
      for  gcc/testsuite/ChangeLog
      
      	* gcc.target/arm/bti-1.c: Require arch, use its opts, drop skip.
      	* gcc.target/arm/bti-2.c: Likewise.
      	* gcc.target/arm/acle/pacbti-m-predef-11.c: Likewise.
      	* gcc.target/arm/acle/pacbti-m-predef-12.c: Likewise.
      	* gcc.target/arm/acle/pacbti-m-predef-7.c: Likewise.
      	* g++.target/arm/pac-1.C: Likewise.  Drop +mve.
      3ad0f67f
    • liuhongt's avatar
      Refine splitters related to "combine vpcmpuw + zero_extend to vpcmpuw" · 5259d392
      liuhongt authored
      r12-6103-g1a7ce8570997eb combines vpcmpuw + zero_extend to vpcmpuw
      with the pre_reload splitter, but the splitter transforms the
      zero_extend into a subreg which make reload think the upper part is
      garbage, it's not correct.
      
      The patch adjusts the zero_extend define_insn_and_split to
      define_insn to keep zero_extend.
      
      gcc/ChangeLog:
      
      	PR target/117159
      	* config/i386/sse.md
      	(*<avx512>_cmp<V48H_AVX512VL:mode>3_zero_extend<SWI248x:mode>):
      	Change from define_insn_and_split to define_insn.
      	(*<avx512>_cmp<VI12_AVX512VL:mode>3_zero_extend<SWI248x:mode>):
      	Ditto.
      	(*<avx512>_ucmp<VI12_AVX512VL:mode>3_zero_extend<SWI248x:mode>):
      	Ditto.
      	(*<avx512>_ucmp<VI48_AVX512VL:mode>3_zero_extend<SWI248x:mode>):
      	Ditto.
      	(*<avx512>_cmp<V48H_AVX512VL:mode>3_zero_extend<SWI248x:mode>_2):
      	Split to the zero_extend pattern.
      	(*<avx512>_cmp<VI12_AVX512VL:mode>3_zero_extend<SWI248x:mode>_2):
      	Ditto.
      	(*<avx512>_ucmp<VI12_AVX512VL:mode>3_zero_extend<SWI248x:mode>_2):
      	Ditto.
      	(*<avx512>_ucmp<VI48_AVX512VL:mode>3_zero_extend<SWI248x:mode>_2):
      	Ditto.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/i386/pr117159.c: New test.
      	* gcc.target/i386/avx512bw-pr103750-1.c: Remove xfail.
      	* gcc.target/i386/avx512bw-pr103750-2.c: Remove xfail.
      5259d392
    • GCC Administrator's avatar
      Daily bump. · 0ceb5cc1
      GCC Administrator authored
      0ceb5cc1
  2. Oct 20, 2024
  3. Oct 19, 2024
    • Lewis Hyatt's avatar
      diagnostics: libcpp: Improve locations for _Pragma lexing diagnostics [PR114423] · 65c5bbe1
      Lewis Hyatt authored
      libcpp is not currently set up to be able to generate valid
      locations for tokens lexed from a _Pragma string. Instead, after obtaining
      the tokens, it sets their locations all to the location of the _Pragma
      operator itself. This makes things like _Pragma("GCC diagnostic") work well
      enough, but if any diagnostics are issued during lexing, prior to resetting
      the token locations, those diagnostics get issued at the invalid
      locations. Fix that up by adding a new field pfile->diagnostic_override_loc
      that instructs libcpp to issue diagnostics at the alternate location.
      
      libcpp/ChangeLog:
      
      	PR preprocessor/114423
      	* internal.h (struct cpp_reader): Add DIAGNOSTIC_OVERRIDE_LOC
      	field.
      	* directives.cc (destringize_and_run): Set the new field to the
      	location of the _Pragma operator.
      	* errors.cc (cpp_diagnostic_at): Support DIAGNOSTIC_OVERRIDE_LOC to
      	temporarily issue diagnostics at a different location.
      	(cpp_diagnostic_with_line): Likewise.
      
      gcc/testsuite/ChangeLog:
      
      	PR preprocessor/114423
      	* c-c++-common/cpp/pragma-diagnostic-loc.c: New test.
      	* c-c++-common/cpp/diagnostic-pragma-1.c: Adjust expected output.
      	* g++.dg/pch/operator-1.C: Likewise.
      65c5bbe1
    • Gaius Mulley's avatar
      modula2: Tidyup gm2-compiler/M2MetaError.mod · 7fa9fd47
      Gaius Mulley authored
      
      This patch is a tidyup for gm2-compiler/M2MetaError.mod.
      
      gcc/m2/ChangeLog:
      
      	* gm2-compiler/M2MetaError.mod (op): Alphabetically order
      	each case label and comment.
      
      Signed-off-by: default avatarGaius Mulley <gaiusmod2@gmail.com>
      7fa9fd47
    • Andrew Pinski's avatar
      phiopt: do factor_out_conditional_operation for all phis [PR112418] · 8d6d6d53
      Andrew Pinski authored
      
      Sometimes factor_out_conditional_operation can factor out
      an operation that causes a phi node to become the same element.
      Other times, we want to factor out a binary operator because
      it can improve code generation, an example is PR 110015 (openjpeg).
      
      Note this includes a heuristic to decide if factoring out the operation
      is profitable or not. It can be expanded to include a better live range
      extend detector. Right now it has a simple one where if it is live on a
      dominating path, it is considered a live or if there are a small # of
      assign statements (defaults to 5), then it does not extend the live range
      too much.
      
      Bootstrapped and tested on x86_64-linux-gnu.
      
      	PR tree-optimization/112418
      
      gcc/ChangeLog:
      
      	* tree-ssa-phiopt.cc (is_factor_profitable): New function.
      	(factor_out_conditional_operation): Add merge argument. Remove
      	arg0/arg1 arguments. Return bool instead of the new phi.
      	Early return for virtual ops. Call is_factor_profitable to
      	check if the factoring would be profitable.
      	(pass_phiopt::execute): Call factor_out_conditional_operation
      	on all phis instead of just singleton phi.
      	* doc/invoke.texi (--param phiopt-factor-max-stmts-live=): Document.
      	* params.opt (--param=phiopt-factor-max-stmts-live=): New opt.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/tree-ssa/factor_op_phi-1.c: New test.
      	* gcc.dg/tree-ssa/factor_op_phi-2.c: New test.
      	* gcc.dg/tree-ssa/factor_op_phi-3.c: New test.
      	* gcc.dg/tree-ssa/factor_op_phi-4.c: New test.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      8d6d6d53
    • Greg McGary's avatar
      [PATCH][v5] RISC-V: add option -m(no-)autovec-segment · f2989316
      Greg McGary authored
      Add option -m(no-)autovec-segment to enable/disable autovectorizer
      from emitting vector segment load/store instructions. This is useful for
      performance experiments.
      
      gcc/ChangeLog:
      	* config/riscv/autovec.md (vec_mask_len_load_lanes, vec_mask_len_store_lanes):
      	Predicate with TARGET_VECTOR_AUTOVEC_SEGMENT
      	* config/riscv/riscv-opts.h (TARGET_VECTOR_AUTOVEC_SEGMENT): New macro.
      	* config/riscv/riscv.opt (-m(no-)autovec-segment): New option.
      
      gcc/testsuite/ChangeLog:
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_load_noseg-1.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_load_noseg-2.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_load_noseg-3.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_load_noseg-4.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_load_noseg-5.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_load_noseg-6.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_load_noseg-7.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_load_noseg_run-1.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_load_noseg_run-2.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_load_noseg_run-3.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_load_noseg_run-4.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_load_noseg_run-5.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_load_noseg_run-6.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_load_noseg_run-7.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_store_noseg-1.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_store_noseg-2.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_store_noseg-3.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_store_noseg-4.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_store_noseg-5.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_store_noseg-6.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_store_noseg-7.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_store_noseg_run-1.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_store_noseg_run-2.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_store_noseg_run-3.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_store_noseg_run-4.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_store_noseg_run-5.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_store_noseg_run-6.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/struct/mask_struct_store_noseg_run-7.c:
      	New test.
      	* gcc.target/riscv/rvv/autovec/no-segment.c: New test.
      f2989316
    • Thomas Koenig's avatar
      Add missing dg-error to unsigned_38.f90. · a8f36de5
      Thomas Koenig authored
      gcc/testsuite/ChangeLog:
      
      	PR fortran/117225
      	* gfortran.dg/unsigned_38.f90: Add missing dg-error directive.
      a8f36de5
    • Craig Blackmore's avatar
      [PATCH 7/7] RISC-V: Disable by pieces for vector setmem length > UNITS_PER_WORD · 72ceddbf
      Craig Blackmore authored
      For fast unaligned access targets, by pieces uses up to UNITS_PER_WORD
      size pieces resulting in more store instructions than needed.  For
      example gcc.target/riscv/rvv/base/setmem-1.c:f1 built with
      `-O3 -march=rv64gcv -mtune=thead-c906`:
      ```
      f1:
              vsetivli        zero,8,e8,mf2,ta,ma
              vmv.v.x v1,a1
              vsetivli        zero,0,e32,mf2,ta,ma
              sb      a1,14(a0)
              vmv.x.s a4,v1
              vsetivli        zero,8,e16,m1,ta,ma
              vmv.x.s a5,v1
              vse8.v  v1,0(a0)
              sw      a4,8(a0)
              sh      a5,12(a0)
              ret
      ```
      
      The slow unaligned access version built with `-O3 -march=rv64gcv` used
      15 sb instructions:
      ```
      f1:
              sb      a1,0(a0)
              sb      a1,1(a0)
              sb      a1,2(a0)
              sb      a1,3(a0)
              sb      a1,4(a0)
              sb      a1,5(a0)
              sb      a1,6(a0)
              sb      a1,7(a0)
              sb      a1,8(a0)
              sb      a1,9(a0)
              sb      a1,10(a0)
              sb      a1,11(a0)
              sb      a1,12(a0)
              sb      a1,13(a0)
              sb      a1,14(a0)
              ret
      ```
      
      After this patch, the following is generated in both cases:
      ```
      f1:
              vsetivli        zero,15,e8,m1,ta,ma
              vmv.v.x v1,a1
              vse8.v  v1,0(a0)
              ret
      ```
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv.cc (riscv_use_by_pieces_infrastructure_p):
      	New function.
      	(TARGET_USE_BY_PIECES_INFRASTRUCTURE_P): Define.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/pr113469.c: Expect mf2 setmem.
      	* gcc.target/riscv/rvv/base/setmem-2.c: Update f1 to expect
      	straight-line vector memset.
      	* gcc.target/riscv/rvv/base/setmem-3.c: Likewise.
      72ceddbf
    • Craig Blackmore's avatar
      [PATCH 5/7] RISC-V: Move vector memcpy decision making to separate function [NFC] · 12deddeb
      Craig Blackmore authored
      This moves the code for deciding whether to generate a vectorized
      memcpy, what vector mode to use and whether a loop is needed out of
      riscv_vector::expand_block_move and into a new function
      riscv_vector::use_stringop_p so that it can be reused for other string
      operations.
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-string.cc (struct stringop_info): New.
      	(expand_block_move): Move decision making code to...
      	(use_vector_stringop_p): ...here.
      12deddeb
    • Craig Blackmore's avatar
      [PATCH 4/7] RISC-V: Honour -mrvv-max-lmul in riscv_vector::expand_block_move · b5aa63b1
      Craig Blackmore authored
      Unlike the other vector string ops, expand_block_move was using max LMUL
      m8 regardless of TARGET_MAX_LMUL.
      
      The check for whether to generate inline vector code for movmem has been
      moved from movmem<mode> to riscv_vector::expand_block_move to avoid
      maintaining multiple versions of similar logic.  They already differed
      on the minimum length for which they would generate vector code.  Now
      that the expand_block_move value is used, movmem will be generated for
      smaller lengths.
      
      Limiting memcpy to m1 caused some memcpy loops to be generated in
      the calling convention tests which makes it awkward to add suitable scan
      assembler tests checking the return value being set, so
      -mrvv-max-lmul=m8 has been added to these tests.  Other tests have been
      adjusted to expect the new memcpy m1 generation where reasonably
      straight-forward, otherwise -mrvv-max-lmul=m8 has been added.
      
      pr111720-[0-9].c regressed because a memcpy loop is generated instead
      of straight-line.  This reveals an existing issue where a redundant
      straight-line memcpy gets eliminated but a memcpy loop does not
      (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117205).
      
      For example, on pr111720-0.c after this patch:
      
      -mrvv-max-lmul=m8:
      
      test:
      	lui	a5,%hi(.LANCHOR0)
      	li	a4,32
      	addi	sp,sp,-32
      	addi	a5,a5,%lo(.LANCHOR0)
      	vsetvli	zero,a4,e8,m1,ta,ma
      	vle8.v	v8,0(a5)
      	addi	sp,sp,32
      	jr	ra
      
      -mrvv-max-lmul=m1:
      
      test:
      	addi	sp,sp,-32
      	lui	a5,%hi(.LANCHOR0)
      	addi	a5,a5,%lo(.LANCHOR0)
      	mv	a2,sp
      	li	a3,32
      .L2:
      	vsetvli	a4,a3,e8,m1,ta,ma
      	vle8.v	v8,0(a5)
      	sub	a3,a3,a4
      	add	a5,a5,a4
      	vse8.v	v8,0(a2)
      	add	a2,a2,a4
      	bne	a3,zero,.L2
      	li	a5,32
      	vsetvli	zero,a5,e8,m1,ta,ma
      	vle8.v	v8,0(sp)
      	addi	sp,sp,32
      	jr	ra
      
      I have added -mrvv-max-lmul=m8 to pr111720-[0-9].c so that we continue
      to test the elimination of straight-line memcpy.
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-protos.h (get_lmul_mode): New prototype.
      	(expand_block_move): Add bool parameter for movmem_p.
      	* config/riscv/riscv-string.cc (riscv_expand_block_move_scalar):
      	Pass movmem_p as false to riscv_vector::expand_block_move.
      	(expand_block_move): Add movmem_p parameter.  Return false if
      	loop needed and movmem_p is true.  Respect TARGET_MAX_LMUL.
      	* config/riscv/riscv-v.cc (get_lmul_mode): New function.
      	* config/riscv/riscv.md (movmem<mode>): Move checking for
      	whether to generate inline vector code to
      	riscv_vector::expand_block_move by passing movmem_p as true.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/pr113206-1.c: Add
      	-mrvv-max-lmul=m8.
      	* gcc.target/riscv/rvv/autovec/pr113206-2.c: Likewise.
      	* gcc.target/riscv/rvv/autovec/vls/calling-convention-1.c: Add
      	-mrvv-max-lmul=m8 and adjust assembly scans.
      	* gcc.target/riscv/rvv/autovec/vls/calling-convention-2.c:
      	Likewise.
      	* gcc.target/riscv/rvv/autovec/vls/calling-convention-3.c:
      	Likewise.
      	* gcc.target/riscv/rvv/autovec/vls/calling-convention-4.c:
      	Likewise.
      	* gcc.target/riscv/rvv/autovec/vls/calling-convention-5.c:
      	Likewise.
      	* gcc.target/riscv/rvv/autovec/vls/calling-convention-6.c:
      	Likewise.
      	* gcc.target/riscv/rvv/autovec/vls/calling-convention-7.c:
      	Likewise.
      	* gcc.target/riscv/rvv/autovec/vls/spill-4.c: Add
      	-mrvv-max-lmul=m8.
      	* gcc.target/riscv/rvv/autovec/vls/spill-7.c: Likewise.
      	* gcc.target/riscv/rvv/base/cpymem-1.c: Expect m1 in f1 and f2.
      	* gcc.target/riscv/rvv/base/cpymem-2.c: Add -mrvv-max-lmul=m8.
      	* gcc.target/riscv/rvv/base/movmem-1.c: Adjust f1 to a length
      	that will not get vectorized.
      	* gcc.target/riscv/rvv/base/pr111720-0.c: Add -mrvv-max-lmul=m8.
      	* gcc.target/riscv/rvv/base/pr111720-1.c: Likewise.
      	* gcc.target/riscv/rvv/base/pr111720-2.c: Likewise.
      	* gcc.target/riscv/rvv/base/pr111720-3.c: Likewise.
      	* gcc.target/riscv/rvv/base/pr111720-4.c: Likewise.
      	* gcc.target/riscv/rvv/base/pr111720-5.c: Likewise.
      	* gcc.target/riscv/rvv/base/pr111720-6.c: Likewise.
      	* gcc.target/riscv/rvv/base/pr111720-7.c: Likewise.
      	* gcc.target/riscv/rvv/base/pr111720-8.c: Likewise.
      	* gcc.target/riscv/rvv/base/pr111720-9.c: Likewise.
      	* gcc.target/riscv/rvv/vsetvl/pr112929-1.c: Expect memcpy m1
      	loops.
      	* gcc.target/riscv/rvv/vsetvl/pr112988-1.c: Likewise.
      b5aa63b1
    • Gaius Mulley's avatar
      PR modula2/115328 The FORWARD keyword is not implemented · e751639e
      Gaius Mulley authored
      
      This patch implements the FORWARD keyword found in the ISO standard.
      The patch checks incoming parameters against the prior declaration
      found in definition/forward sections and will issue an error based
      on virtual tokens highlighing the full parameter declaration.
      
      gcc/m2/ChangeLog:
      
      	PR modula2/115328
      	* gm2-compiler/M2MetaError.def: Extend comment documentating
      	new format specifiers.
      	* gm2-compiler/M2MetaError.mod (GetTokProcedure): New declaration.
      	(doErrorScopeModule): New procedure.
      	(doErrorScopeForward): Ditto.
      	(doErrorScopeMod): Reimplement.
      	(doErrorScopeFor): New procedure.
      	(declarationMod): Ditto.
      	(doErrorScopeDefinition): Ditto.
      	(doErrorScopeDef): Reimplement.
      	(declaredDef): New procedure.
      	(declaredFor): Ditto.
      	(doErrorScopeProc): Ditto.
      	(declaredVar): Ditto.
      	(declaredType): Ditto.
      	(declaredFull): Ditto.
      	* gm2-compiler/M2Options.mod (SetAutoInit): Add missing
      	return type.
      	(GetDumpGimple): Remove duplicate implementation.
      	* gm2-compiler/M2Quads.def (DupFrame): New procedure.
      	* gm2-compiler/M2Quads.mod (DupFrame): New procedure.
      	* gm2-compiler/M2Reserved.def (ForwardTok): New variable.
      	* gm2-compiler/M2Reserved.mod (ForwardTok): Initialize variable.
      	* gm2-compiler/M2Scaffold.mod (DeclareArgEnvParams): Add
      	tokno parameter for call to PutParam.
      	* gm2-compiler/P0SymBuild.def (EndForward): New procedure.
      	* gm2-compiler/P0SymBuild.mod (EndForward): New procedure.
      	* gm2-compiler/P0SyntaxCheck.bnf (BlockAssert): New procedure.
      	(ProcedureDeclaration): Reimplement rule.
      	(PostProcedureHeading): New rule.
      	(ForwardDeclaration): Ditto.
      	(ProperProcedure): Ditto.
      	* gm2-compiler/P1Build.bnf (ProcedureDeclaration): Reimplement rule.
      	(PostProcedureHeading): New rule.
      	(ForwardDeclaration): Ditto.
      	(ProperProcedure): Ditto.
      	* gm2-compiler/P1SymBuild.def (Export): Removed unnecessary
      	export.
      	(EndBuildForward): New procedure.
      	* gm2-compiler/P1SymBuild.mod (StartBuildProcedure): Reimplement.
      	(EndBuildProcedure): Ditto.
      	(EndBuildForward): Ditto.
      	* gm2-compiler/P2Build.bnf (ProcedureDeclaration): Reimplement rule.
      	(PostProcedureHeading): New rule.
      	(ForwardDeclaration): Ditto.
      	(ProperProcedure): Ditto.
      	* gm2-compiler/P2SymBuild.def (BuildProcedureDefinedByForward):
      	New procedure.
      	(BuildProcedureDefinedByProper): Ditto.
      	(CheckProcedure): Ditto.
      	(EndBuildForward): Ditto.
      	* gm2-compiler/P2SymBuild.mod (EndBuildProcedure): Reimplement.
      	(EndBuildForward): New procedure.
      	(BuildFPSection): Reimplement to allow forward declaration or
      	checking of parameters.
      	(BuildProcedureDefinedByProper): New procedure.
      	(BuildProcedureDefinedByForward): Ditto
      	(FailParameter): Remove.
      	(ParameterError): New procedure.
      	(ParameterMismatch): Ditto.
      	(EndBuildFormalParameters): Add parameter number check.
      	(GetComparison): New procedure function.
      	(GetSourceDesc): Ditto.
      	(GetCurSrcDesc): Ditto.
      	(GetDeclared): New procedure.
      	(ReturnTypeMismatch): Ditto.
      	(BuildFunction): Reimplement.
      	(CheckProcedure): New procedure.
      	(CheckFormalParameterSection): Reimplement using ParameterError.
      	* gm2-compiler/P3Build.bnf (ProcedureDeclaration): Reimplement rule.
      	(PostProcedureHeading): New rule.
      	(ForwardDeclaration): Ditto.
      	(ProperProcedure): Ditto.
      	* gm2-compiler/P3SymBuild.def (Export): Remove unnecessary export.
      	(EndBuildForward): New procedure.
      	* gm2-compiler/P3SymBuild.mod (EndBuildForward): New procedure.
      	* gm2-compiler/PCBuild.bnf (ProcedureDeclaration): Reimplement rule.
      	(PostProcedureHeading): New rule.
      	(ForwardDeclaration): Ditto.
      	(ProperProcedure): Ditto.
      	* gm2-compiler/PCSymBuild.def (EndBuildForward): New procedure.
      	* gm2-compiler/PCSymBuild.mod (EndBuildForward): Ditto.
      	* gm2-compiler/PHBuild.bnf (ProcedureDeclaration): Reimplement rule.
      	(PostProcedureHeading): New rule.
      	(ForwardDeclaration): Ditto.
      	(ProperProcedure): Ditto.
      	* gm2-compiler/SymbolTable.def (PutVarTok): New procedure.
      	(PutParam): Add typetok parameter.
      	(PutVarParam): Ditto.
      	(PutParamName): Ditto.
      	(GetDeclaredFor): New procedure function.
      	(AreParametersDefinedInDefinition): Ditto.
      	(PutParametersDefinedByForward): New procedure.
      	(GetParametersDefinedByForward): New procedure function.
      	(PutParametersDefinedByProper): New procedure.
      	(GetParametersDefinedByProper): New procedure function.
      	(GetProcedureDeclaredForward): Ditto.
      	(PutProcedureDeclaredForward): New procedure.
      	(GetProcedureDeclaredProper): New procedure function.
      	(PutProcedureDeclaredProper): New procedure.
      	(GetProcedureDeclaredDefinition): New procedure function.
      	(PutProcedureDeclaredDefinition): New procedure.
      	(GetVarDeclTypeTok): Ditto.
      	(PutVarDeclTypeTok): New procedure.
      	(GetVarDeclTok): Ditto.
      	(PutVarDeclTok): New procedure.
      	(GetVarDeclFullTok): Ditto.
      	* gm2-compiler/SymbolTable.mod (ProcedureDecl): New record type.
      	(VarDecl): Ditto.
      	(SymProcedure): Add new field Declared.
      	(SymVar): Add new field Declared.
      	(PutVarTok): New procedure.
      	(PutParam): Add typetok parameter.
      	(PutVarParam): Ditto.
      	(PutParamName): Ditto.
      	(GetDeclaredFor): New procedure function.
      	(AreParametersDefinedInDefinition): Ditto.
      	(PutParametersDefinedByForward): New procedure.
      	(GetParametersDefinedByForward): New procedure function.
      	(PutParametersDefinedByProper): New procedure.
      	(GetParametersDefinedByProper): New procedure function.
      	(GetProcedureDeclaredForward): Ditto.
      	(PutProcedureDeclaredForward): New procedure.
      	(GetProcedureDeclaredProper): New procedure function.
      	(PutProcedureDeclaredProper): New procedure.
      	(GetProcedureDeclaredDefinition): New procedure function.
      	(PutProcedureDeclaredDefinition): New procedure.
      	(GetVarDeclTypeTok): Ditto.
      	(PutVarDeclTypeTok): New procedure.
      	(GetVarDeclTok): Ditto.
      	(PutVarDeclTok): New procedure.
      	(GetVarDeclFullTok): Ditto.
      	(MakeProcedure): Initialize Declared field.
      	(MakeVar): Initialize Declared field.
      	* gm2-libs-log/FileSystem.def (FileNameChar): Add
      	missing return type.
      	* m2.flex: Add FORWARD keyword.
      
      gcc/testsuite/ChangeLog:
      
      	PR modula2/115328
      	* gm2/iso/fail/badparam.def: New test.
      	* gm2/iso/fail/badparam.mod: New test.
      	* gm2/iso/fail/badparam2.def: New test.
      	* gm2/iso/fail/badparam2.mod: New test.
      	* gm2/iso/fail/badparam3.def: New test.
      	* gm2/iso/fail/badparam3.mod: New test.
      	* gm2/iso/fail/badparamarray.def: New test.
      	* gm2/iso/fail/badparamarray.mod: New test.
      	* gm2/iso/fail/simpledef1.def: New test.
      	* gm2/iso/fail/simpledef1.mod: New test.
      	* gm2/iso/fail/simpleforward.mod: New test.
      	* gm2/iso/fail/simpleforward2.mod: New test.
      	* gm2/iso/fail/simpleforward3.mod: New test.
      	* gm2/iso/fail/simpleforward4.mod: New test.
      	* gm2/iso/fail/simpleforward5.mod: New test.
      	* gm2/iso/fail/simpleforward7.mod: New test.
      	* gm2/iso/pass/simpleforward.mod: New test.
      	* gm2/iso/pass/simpleforward6.mod: New test.
      
      Signed-off-by: default avatarGaius Mulley <gaiusmod2@gmail.com>
      e751639e
    • Tobias Burnus's avatar
      Fortran: Fix translatability of diagnostic strings · efae253b
      Tobias Burnus authored
      gcc/fortran/ChangeLog:
      
      	* check.cc (is_c_interoperable): Use _(...) around to mark strings
      	as translatable.
      	* data.cc (gfc_assign_data_value): Move string literal to gfc_error
      	to make it translatable.
      	* resolve.cc (resolve_fl_variable, resolve_equivalence): Use G_(...)
      	around string literals.
      	* scanner.cc (skip_fixed_omp_sentinel): Replace '...' by %<...%>.
      	* trans-openmp.cc (gfc_split_omp_clauses,
      	gfc_trans_omp_declare_variant): Likewise.
      efae253b
    • Tobias Burnus's avatar
      Fortran: Add range-based diagnostic · ffdfc5b0
      Tobias Burnus authored
      GCC's diagnostic engine gained a while ago support for ranges, i.e. instead
      of pointing at a single character '^', it can also have a '~~~~^~~~~~' range.
      
      This patch adds support for this and adds 9 users for it, which covers the
      most common cases. A single '^' can be still useful. Some location data in
      gfortran is rather bad - often the matching pattern includes whitespace such
      that the before or after location points to the beginning/end of the
      whitespace, which can be far of especially when comments and/or continuation
      lines are involed. Otherwise, often a '^' still sufficient, albeit wrong
      location data only becomes obvious once starting to use ranges.
      
      The 'locus' is extended to support two ways to store the data; hereby
      gfc_current_locus always contains the old format (at least during parsing)
      and gfc_current_locus shall not be used in trans*.cc. The latter permits
      a nice cleanup to just use input_location. Otherwise, the new format is
      only used when switching to ranges.
      The only reason to convert from location_t to locus occurs in trans*.cc
      for the gfc_error (etc.) diagnostic and for gfc_trans_runtime_check; there
      are 5 currently 5 such cases.  For gfc_* diagnostic, we could think of
      another letter besides %L or a modifier like '%lL', if deemed useful.
      
      In any case, the new format is just:
        locus->u.location = linemap_position_for_loc_and_offset (line_table,
                               loc->u.lb->location, loc->nextc - loc->u.lb->line);
        locus->nextc = (gfc_char_t *) -1;  /* Marker for new format. */
      i.e. using the existing location_t location in in the linebuffer (which
      points to column 0) and add as offset the actually used column number.
      
      As location_t handles ranges, we just use it also to store them via:
        location = make_location (caret, begin, end)
      There are a few convenience macros/functions but that's all.
      
      Alongside, a few minor fixes were done: linemap_location_before_p replaces
      a line-number based comparison, which does not handle multiple statements
      in the same line that ';' allows for.
      
      gcc/fortran/ChangeLog:
      
      	* data.cc (gfc_assign_data_value): Use linemap_location_before_p
      	and GFC_LOCUS_IS_SET.
      	* decl.cc (gfc_verify_c_interop_param): Make better translatable.
      	(build_sym, variable_decl, gfc_match_formal_arglist,
      	gfc_match_subroutine): Add range-based locations, use it in
      	diagnostic and gobble whitespace for better locations.
      	* error.cc (gfc_get_location_with_offset): Handle new format.
      	(gfc_get_location_range): New.
      	* expr.cc (gfc_check_assign): Use GFC_LOCUS_IS_SET.
      	* frontend-passes.cc (check_locus_code, check_locus_expr):
      	Likewise.
      	(runtime_error_ne): Use GFC_LOCUS_IS_SET.
      	* gfortran.h (locus): Change lb to union with lb and location.
      	(GFC_LOCUS_IS_SET): Define.
      	(gfc_get_location_range): New prototype.
      	(gfc_new_symbol, gfc_get_symbol, gfc_get_sym_tree,
      	gfc_get_ha_symbol, gfc_get_ha_sym_tree): Take optional locus
      	argument.
      	* io.cc (io_constraint): Use GFC_LOCUS_IS_SET.
      	* match.cc (gfc_match_sym_tree): Use range locus.
      	* openmp.cc (gfc_match_omp_variable_list,
      	gfc_match_omp_doacross_sink): Likewise.
      	* parse.cc (next_free): Update for locus struct change.
      	* primary.cc (gfc_match_varspec): Likewise.
      	(match_variable): Use range locus.
      	* resolve.cc (find_array_spec): Use GFC_LOCUS_IS_SET.
      	* scanner.cc (gfc_at_eof, gfc_at_bol, gfc_start_source_files,
      	gfc_advance_line, gfc_define_undef_line, skip_fixed_comments,
      	gfc_gobble_whitespace, include_stmt, gfc_new_file): Update
      	for locus struct change.
      	* symbol.cc (gfc_new_symbol, gfc_get_sym_tree, gfc_get_symbol,
      	gfc_get_ha_sym_tree, gfc_get_ha_symbol): Take optional locus.
      	* trans-array.cc (gfc_trans_array_constructor_value): Use %L not %C.
      	(gfc_trans_g77_array, gfc_trans_dummy_array_bias,
      	gfc_trans_class_array, gfc_trans_deferred_array): Replace
      	gfc_{save,set,restore}_backend_locus by directly using
      	input_location.
      	* trans-common.cc (build_equiv_decl, get_init_field): Likewise.
      	* trans-decl.cc (gfc_get_extern_function_decl, build_function_decl,
      	build_entry_thunks, gfc_null_and_pass_deferred_len,
      	gfc_trans_deferred_vars, gfc_trans_use_stmts, finish_oacc_declare,
      	gfc_generate_block_data): Likewise.
      	* trans-expr.cc (gfc_copy_class_to_class, gfc_conv_expr): Changes
      	to avoid gfc_current_locus.
      	* trans-io.cc (set_error_locus): Likewise.
      	* trans-openmp.cc (gfc_trans_omp_workshare): Use input_locus directly.
      	* trans-stmt.cc (gfc_trans_if_1): Likewise and use GFC_LOCUS_IS_SET.
      	* trans-types.cc (gfc_get_union_type, gfc_get_derived_type): Likewise.
      	* trans.cc (gfc_locus_from_location): New.
      	(trans_runtime_error_vararg, gfc_trans_runtime_check): Use location_t
      	for file + line data.
      	(gfc_current_backend_file, gfc_save_backend_locus,
      	gfc_set_backend_locus, gfc_restore_backend_locus): Remove.
      	(trans_code): Use input_location directly, don't set gfc_current_locus.
      	* trans.h (gfc_save_backend_locus, gfc_set_backend_locus,
      	gfc_restore_backend_locus): Remove prototypes.
      	(gfc_locus_from_location): Add prototype.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/bounds_check_25.f90: Update expected column
      	in the diagnostic.
      	* gfortran.dg/goacc/pr92793-1.f90: Likewise.
      	* gfortran.dg/gomp/allocate-14.f90: Likewise.
      	* gfortran.dg/gomp/polymorphic-mapping.f90: Likewise.
      	* gfortran.dg/gomp/reduction5.f90: Likewise.
      	* gfortran.dg/gomp/reduction6.f90: Likewise.
      ffdfc5b0
    • Thomas Koenig's avatar
      Fix an ICE with UNSIGNED in match_sym_complex_part. · 4f9b1735
      Thomas Koenig authored
      gcc/fortran/ChangeLog:
      
      	PR fortran/117225
      	* primary.cc (match_sym_complex_part): An UNSIGNED in
      	a complex part is an error.
      
      gcc/testsuite/ChangeLog:
      
      	PR fortran/117225
      	* gfortran.dg/unsigned_38.f90: New test.
      4f9b1735
    • Ian Lance Taylor's avatar
      runtime/testdata: fix for C23 nullptr keyword · 04b4a5e4
      Ian Lance Taylor authored
      Backport https://go.dev/cl/620955 from main repo.  Original description:
      
          src/runtime/testdata/testprogcgo/threadprof.go contains C code with a
          variable called nullptr.  This conflicts with the nullptr keyword in
          the C23 revision of the C standard (showing up as gccgo test build
          failures when updating GCC to use C23 by default when building C
          code).
      
          Rename that variable to nullpointer to avoid the clash with the
          keyword (any other name that's not a keyword would work just as well).
      
      Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/621059
      04b4a5e4
    • David Malcolm's avatar
      diagnostics: remove forward decl of json::value from diagnostic.h · 83abdb04
      David Malcolm authored
      
      I believe this hasn't been necessary since r15-1413-gd3878c85f331c7.
      
      gcc/ChangeLog:
      	* diagnostic.h (json::value): Remove forward decl.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      83abdb04
    • David Malcolm's avatar
      diagnostics: add debug dump functions · 2ca19d43
      David Malcolm authored
      
      This commit expands on r15-3973-g4c7a58ac2617e2, which added
      debug "dump" member functiosn to pretty_printer and output_buffer.
      
      This followup adds "dump" member functions to diagnostic_context and
      diagnostic_format, extends the existing dump functions and adds
      indentation to make it much easier to see the various relationships
      between context, format, printer, etc.
      
      Hence you can now do:
      
      (gdb) call global_dc->dump ()
      
      and get a useful summary of what the diagnostic subsystem is doing;
      for example:
      
      (gdb) call global_dc->dump()
      diagnostic_context:
        counts:
        output format:
          sarif_output_format
        printer:
          m_show_color: false
          m_url_format: bel
          m_buffer:
            m_formatted_obstack current object: length 0:
            m_chunk_obstack current object: length 0:
            pp_formatted_chunks: depth 0
              0: TEXT("Function ")]
              1: BEGIN_QUOTE, TEXT("program"), END_QUOTE]
              2: TEXT(" requires an argument list at ")]
              3: TEXT("(1)")]
      
      showing the counts of all diagnostic kind that are non-zero (none yet),
      that we have a sarif output format, and the printer is part-way through
      formatting a string.
      
      gcc/ChangeLog:
      	* diagnostic-format-json.cc (json_output_format::dump): New.
      	* diagnostic-format-sarif.cc (sarif_output_format::dump): New.
      	(sarif_file_output_format::dump): New.
      	* diagnostic-format-text.cc (diagnostic_text_output_format::dump):
      	New.
      	* diagnostic-format-text.h (diagnostic_text_output_format::dump):
      	New decl.
      	* diagnostic-format.h (diagnostic_output_format::dump): New decls.
      	* diagnostic.cc (diagnostic_context::dump): New.
      	(diagnostic_output_format::dump): New.
      	* diagnostic.h (diagnostic_context::dump): New decls.
      	* pretty-print-format-impl.h (pp_formatted_chunks::dump): Add
      	"indent" param.
      	* pretty-print.cc (bytes_per_hexdump_line): New constant.
      	(print_hexdump_line): New.
      	(print_hexdump): New.
      	(output_buffer::dump): Add "indent" param and use it.  Add
      	hexdump of current object in m_formatted_obstack and
      	m_chunk_obstack.
      	(pp_formatted_chunks::dump): Add "indent" param and use it.
      	(pretty_printer::dump): Likewise.  Add dumping of m_show_color
      	and m_url_format.
      	* pretty-print.h (output_buffer::dump): Add "indent" param.
      	(pretty_printer::dump): Likewise.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/plugin/diagnostic_plugin_xhtml_format.c
      	(xhtml_output_format::dump): New.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      2ca19d43
    • Joseph Myers's avatar
      c: Fix -std=gnu23 -Wtraditional for () in function definitions · d277ded2
      Joseph Myers authored
      We don't yet have clear agreement on removing -Wtraditional (although
      it seems there is little to no use for most of the warnings therein),
      so fix the bug in its interaction with -std=gnu23 to continue progress
      on making -std=gnu23 the default while -Wtraditional remains under
      discussion.
      
      The warning for ISO C function definitions with -Wtraditional properly
      covers (void), but also wrongly warned for () in C23 mode as that has
      the same semantics as (void) in that case.  Keep track in c_arg_info
      of when () was converted to (void) for C23 so that -Wtraditional can
      avoid warning in that case (with an appropriate comment on the
      definition of the new field to make clear it can be removed along with
      -Wtraditional).
      
      Bootstrapped with no regressions for x86_64-pc-linux-gnu.
      
      gcc/c/
      	* c-tree.h (c_arg_info): Add c23_empty_parens.
      	* c-decl.cc (grokparms): Set c23_empty_parens.
      	(build_arg_info): Clear c23_empty_parens.
      	(store_parm_decls_newstyle): Do not give -Wtraditional warning for
      	ISO C function definition if c23_empty_parens.
      
      gcc/testsuite/
      	* gcc.dg/wtr-gnu17-1.c, gcc.dg/wtr-gnu23-1.c: New tests.
      d277ded2
    • GCC Administrator's avatar
      Daily bump. · de14559e
      GCC Administrator authored
      de14559e
  4. Oct 18, 2024
    • Alejandro Colomar's avatar
      gcc/: Merge definitions of array_type_nelts_top · c886eb34
      Alejandro Colomar authored
      
      There were two identical definitions, and none of them are available
      where they are needed for implementing a number-of-elements-of
      operator.  Merge them, and provide the single definition in
      gcc/tree.{h,cc}, where it's available for that operator, which will be
      added in a following commit.
      
      gcc/ChangeLog:
      
      	* tree.h (array_type_nelts_top)
      	* tree.cc (array_type_nelts_top):
      	Define function (moved from gcc/cp/).
      
      gcc/cp/ChangeLog:
      
      	* cp-tree.h (array_type_nelts_top)
      	* tree.cc (array_type_nelts_top):
      	Remove function (move to gcc/).
      
      gcc/rust/ChangeLog:
      
      	* backend/rust-tree.h (array_type_nelts_top)
      	* backend/rust-tree.cc (array_type_nelts_top):
      	Remove function.
      
      Signed-off-by: default avatarAlejandro Colomar <alx@kernel.org>
      c886eb34
    • Alejandro Colomar's avatar
      gcc/: Rename array_type_nelts => array_type_nelts_minus_one · 11577659
      Alejandro Colomar authored
      The old name was misleading.
      
      While at it, also rename some temporary variables that are used with
      this function, for consistency.
      
      Link: <https://inbox.sourceware.org/gcc-patches/9fffd80-dca-2c7e-14b-6c9b509a7215@redhat.com/T/#m2f661c67c8f7b2c405c8c7fc3152dd85dc729120
      
      >
      
      gcc/ChangeLog:
      
      	* tree.cc (array_type_nelts, array_type_nelts_minus_one)
      	* tree.h (array_type_nelts, array_type_nelts_minus_one)
      	* expr.cc (count_type_elements)
      	* config/aarch64/aarch64.cc
      	(pure_scalable_type_info::analyze_array)
      	* config/i386/i386.cc (ix86_canonical_va_list_type):
      	Rename array_type_nelts => array_type_nelts_minus_one
      	The old name was misleading.
      
      gcc/c/ChangeLog:
      
      	* c-decl.cc (one_element_array_type_p, get_parm_array_spec)
      	* c-fold.cc (c_fold_array_ref):
      	Rename array_type_nelts => array_type_nelts_minus_one
      
      gcc/cp/ChangeLog:
      
      	* decl.cc (reshape_init_array)
      	* init.cc
      	(build_zero_init_1)
      	(build_value_init_noctor)
      	(build_vec_init)
      	(build_delete)
      	* lambda.cc (add_capture)
      	* tree.cc (array_type_nelts_top):
      	Rename array_type_nelts => array_type_nelts_minus_one
      
      gcc/fortran/ChangeLog:
      
      	* trans-array.cc (structure_alloc_comps)
      	* trans-openmp.cc
      	(gfc_walk_alloc_comps)
      	(gfc_omp_clause_linear_ctor):
      	Rename array_type_nelts => array_type_nelts_minus_one
      
      gcc/rust/ChangeLog:
      
      	* backend/rust-tree.cc (array_type_nelts_top):
      	Rename array_type_nelts => array_type_nelts_minus_one
      
      Suggested-by: default avatarRichard Biener <richard.guenther@gmail.com>
      Signed-off-by: default avatarAlejandro Colomar <alx@kernel.org>
      11577659
Loading