From 101c16b8fb1f1a995a2debf798747480396b3dc3 Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Mon, 16 Jan 2023 11:33:25 +0000 Subject: Update gcc/m2/mc/mcOptions.mod copyright and dates Annual update of dates. Also change the GPL boilerplate emitted to GPL v3. gcc/m2/ChangeLog: * mc/mcOptions.mod (displayVersion): Change GPLv2 to GPLv3. (YEAR) set to 2023. Signed-off-by: Gaius Mulley --- gcc/m2/mc/mcOptions.mod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/m2/mc/mcOptions.mod b/gcc/m2/mc/mcOptions.mod index 104edd3..d84ce2b 100644 --- a/gcc/m2/mc/mcOptions.mod +++ b/gcc/m2/mc/mcOptions.mod @@ -34,7 +34,7 @@ IMPORT FIO ; IMPORT SFIO ; CONST - YEAR = '2021' ; + YEAR = '2023' ; VAR langC, @@ -72,7 +72,7 @@ VAR PROCEDURE displayVersion (mustExit: BOOLEAN) ; BEGIN printf0 ('Copyright (C) ' + YEAR + ' Free Software Foundation, Inc.\n') ; - printf0 ('License GPLv2: GNU GPL version 2 or later \n') ; + printf0 ('License GPLv3: GNU GPL version 3 or later \n') ; printf0 ('This is free software: you are free to change and redistribute it.\n') ; printf0 ('There is NO WARRANTY, to the extent permitted by law.\n') ; IF mustExit -- cgit v1.1 From 2f81164255bf0d7605cd0651ede0063d10ec72c1 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 16 Jan 2023 12:43:21 +0100 Subject: Bump BASE-VER to 13.0.1 now that we are in stage4. * BASE-VER: Bump to 13.0.1. --- gcc/BASE-VER | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/BASE-VER b/gcc/BASE-VER index 02161ca..5cb7d85 100644 --- a/gcc/BASE-VER +++ b/gcc/BASE-VER @@ -1 +1 @@ -13.0.0 +13.0.1 -- cgit v1.1 From 8a1360e72d6c6056606aa5edd8c906c50f26de59 Mon Sep 17 00:00:00 2001 From: Stam Markianos-Wright Date: Mon, 16 Jan 2023 11:40:40 +0000 Subject: arm: Split up MVE _Generic associations to prevent type clashes [PR107515] With these previous patches: https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606586.html https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606587.html we enabled the MVE overloaded _Generic associations to handle more scalar types, however at PR 107515 we found a new regression that wasn't detected in our testing: With glibc's posix/types.h: ``` typedef signed int __int32_t; ... typedef __int32_t int32_t; ``` We would get a `error: '_Generic' specifies two compatible types` from `__ARM_mve_coerce3` because of `type: param`, when `type` is `int` and `int32_t: param` both being the same under the hood. The same did not happen with Newlib's header sys/_stdint.h: ``` typedef long int __int32_t; ... typedef __int32_t int32_t ; ``` which worked fine, because it uses `long int`. The same could feasibly happen in `__ARM_mve_coerce2` between `__fp16` and `float16_t`. The solution here is to break the _Generic down so that the similar types don't appear at the same level, as is done in `__ARM_mve_typeid` gcc/ChangeLog: PR target/96795 PR target/107515 * config/arm/arm_mve.h (__ARM_mve_coerce2): Split types. (__ARM_mve_coerce3): Likewise. gcc/testsuite/ChangeLog: PR target/96795 PR target/107515 * gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-fp.c: New test. * gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c: New test. --- gcc/config/arm/arm_mve.h | 4 +- .../intrinsics/mve_intrinsic_type_overloads-fp.c | 65 ++++++++++++++++++++++ .../intrinsics/mve_intrinsic_type_overloads-int.c | 45 +++++++++++++++ 3 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-fp.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c (limited to 'gcc') diff --git a/gcc/config/arm/arm_mve.h b/gcc/config/arm/arm_mve.h index 00fb42a..13bdb60 100644 --- a/gcc/config/arm/arm_mve.h +++ b/gcc/config/arm/arm_mve.h @@ -35659,9 +35659,9 @@ extern void *__ARM_undef; #define __ARM_mve_coerce1(param, type) \ _Generic(param, type: param, const type: param, default: *(type *)__ARM_undef) #define __ARM_mve_coerce2(param, type) \ - _Generic(param, type: param, float16_t: param, float32_t: param, default: *(type *)__ARM_undef) + _Generic(param, type: param, __fp16: param, default: _Generic (param, _Float16: param, float16_t: param, float32_t: param, default: *(type *)__ARM_undef)) #define __ARM_mve_coerce3(param, type) \ - _Generic(param, type: param, int8_t: param, int16_t: param, int32_t: param, int64_t: param, uint8_t: param, uint16_t: param, uint32_t: param, uint64_t: param, default: *(type *)__ARM_undef) + _Generic(param, type: param, default: _Generic (param, int8_t: param, int16_t: param, int32_t: param, int64_t: param, uint8_t: param, uint16_t: param, uint32_t: param, uint64_t: param, default: *(type *)__ARM_undef)) #if (__ARM_FEATURE_MVE & 2) /* MVE Floating point. */ diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-fp.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-fp.c new file mode 100644 index 0000000..7492e9b --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-fp.c @@ -0,0 +1,65 @@ +/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ +/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-additional-options "-O2 -Wno-pedantic -Wno-long-long" } */ +#include "arm_mve.h" + +float f1; +double f2; +float16_t f3; +float32_t f4; +__fp16 f5; +_Float16 f6; + +int i1; +short i2; +long i3; +long long i4; +int8_t i5; +int16_t i6; +int32_t i7; +int64_t i8; + +const int ci1; +const short ci2; +const long ci3; +const long long ci4; +const int8_t ci5; +const int16_t ci6; +const int32_t ci7; +const int64_t ci8; + +float16x8_t floatvec; +int16x8_t intvec; + +void test(void) +{ + /* Test a few different supported ways of passing an int value. The + intrinsic vmulq was chosen arbitrarily, but it is representative of + all intrinsics that take a non-const scalar value. */ + intvec = vmulq(intvec, 2); + intvec = vmulq(intvec, (int32_t) 2); + intvec = vmulq(intvec, (short) 2); + intvec = vmulq(intvec, i1); + intvec = vmulq(intvec, i2); + intvec = vmulq(intvec, i3); + intvec = vmulq(intvec, i4); + intvec = vmulq(intvec, i5); + intvec = vmulq(intvec, i6); + intvec = vmulq(intvec, i7); + intvec = vmulq(intvec, i8); + + /* Test a few different supported ways of passing a float value. */ + floatvec = vmulq(floatvec, 0.5); + floatvec = vmulq(floatvec, 0.5f); + floatvec = vmulq(floatvec, (__fp16) 0.5); + floatvec = vmulq(floatvec, f1); + floatvec = vmulq(floatvec, f2); + floatvec = vmulq(floatvec, f3); + floatvec = vmulq(floatvec, f4); + floatvec = vmulq(floatvec, f5); + floatvec = vmulq(floatvec, f6); + floatvec = vmulq(floatvec, 0.15f16); + floatvec = vmulq(floatvec, (_Float16) 0.15); +} + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c new file mode 100644 index 0000000..9a921bf --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c @@ -0,0 +1,45 @@ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-additional-options "-O2 -Wno-pedantic -Wno-long-long" } */ + +#include "arm_mve.h" + +int i1; +short i2; +long i3; +long long i4; +int8_t i5; +int16_t i6; +int32_t i7; +int64_t i8; + +const int ci1; +const short ci2; +const long ci3; +const long long ci4; +const int8_t ci5; +const int16_t ci6; +const int32_t ci7; +const int64_t ci8; + +int16x8_t intvec; + +void test(void) +{ + /* Test a few different supported ways of passing an int value. The + intrinsic vmulq was chosen arbitrarily, but it is representative of + all intrinsics that take a non-const scalar value. */ + intvec = vmulq(intvec, 2); + intvec = vmulq(intvec, (int32_t) 2); + intvec = vmulq(intvec, (short) 2); + intvec = vmulq(intvec, i1); + intvec = vmulq(intvec, i2); + intvec = vmulq(intvec, i3); + intvec = vmulq(intvec, i4); + intvec = vmulq(intvec, i5); + intvec = vmulq(intvec, i6); + intvec = vmulq(intvec, i7); + intvec = vmulq(intvec, i8); +} + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ -- cgit v1.1 From 6347bbec3efb625dfc8592fbb3099dc0364c5317 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 13 Jan 2023 08:56:28 +0100 Subject: solaris2: Don't add crtfastmath.o for -shared Don't add crtfastmath.o for -shared to avoid altering the FP environment when loading a shared library. PR target/55522 * config/sol2.h (ENDFILE_SPEC): Don't add crtfastmath.o for -shared. --- gcc/config/sol2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h index 05dbaff..616f9b9 100644 --- a/gcc/config/sol2.h +++ b/gcc/config/sol2.h @@ -295,7 +295,7 @@ along with GCC; see the file COPYING3. If not see #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \ %(endfile_arch) %(endfile_vtv) %(endfile_crtend) crtn.o%s" #undef LINK_ARCH32_SPEC_BASE -- cgit v1.1 From 967592488c64a86f37bef3dabebb56364f14acdd Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Mon, 16 Jan 2023 15:40:45 +0100 Subject: Disable gather/scatter for zen4 this patch adds more tunes for zen4: - new tunes for avx512 scater instructions. In micro benchmarks these seems consistent loss compared to open-coded coe - disable use of gather for zen4 While these are win for a micro benchmarks (based on TSVC), enabling gather is a loss for parest. So for now it seems safe to keep it off. - disable pass to avoid FMA chains for znver4 since fmadd was optimized and does not seem to cause regressions. * config/i386/i386.cc (ix86_vectorize_builtin_scatter): Guard scatter by TARGET_USE_SCATTER. * config/i386/i386.h (TARGET_USE_SCATTER_2PARTS, TARGET_USE_SCATTER_4PARTS, TARGET_USE_SCATTER): New macros. * config/i386/x86-tune.def (TARGET_USE_SCATTER_2PARTS, TARGET_USE_SCATTER_4PARTS, TARGET_USE_SCATTER): New tunes. (X86_TUNE_AVOID_256FMA_CHAINS, X86_TUNE_AVOID_512FMA_CHAINS): Disable for znver4. (X86_TUNE_USE_GATHER): Disable for zen4. --- gcc/config/i386/i386.cc | 7 +++++++ gcc/config/i386/i386.h | 6 ++++++ gcc/config/i386/x86-tune.def | 23 +++++++++++++++++++---- 3 files changed, 32 insertions(+), 4 deletions(-) (limited to 'gcc') diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index d80164f..19fb03c 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -19051,6 +19051,13 @@ ix86_vectorize_builtin_scatter (const_tree vectype, if (!TARGET_AVX512F) return NULL_TREE; + if (known_eq (TYPE_VECTOR_SUBPARTS (vectype), 2u) + ? !TARGET_USE_SCATTER_2PARTS + : (known_eq (TYPE_VECTOR_SUBPARTS (vectype), 4u) + ? !TARGET_USE_SCATTER_4PARTS + : !TARGET_USE_SCATTER)) + return NULL_TREE; + if ((TREE_CODE (index_type) != INTEGER_TYPE && !POINTER_TYPE_P (index_type)) || (TYPE_MODE (index_type) != SImode diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 0ee6450..dd9391c 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -397,10 +397,16 @@ extern unsigned char ix86_tune_features[X86_TUNE_LAST]; ix86_tune_features[X86_TUNE_AVOID_4BYTE_PREFIXES] #define TARGET_USE_GATHER_2PARTS \ ix86_tune_features[X86_TUNE_USE_GATHER_2PARTS] +#define TARGET_USE_SCATTER_2PARTS \ + ix86_tune_features[X86_TUNE_USE_SCATTER_2PARTS] #define TARGET_USE_GATHER_4PARTS \ ix86_tune_features[X86_TUNE_USE_GATHER_4PARTS] +#define TARGET_USE_SCATTER_4PARTS \ + ix86_tune_features[X86_TUNE_USE_SCATTER_4PARTS] #define TARGET_USE_GATHER \ ix86_tune_features[X86_TUNE_USE_GATHER] +#define TARGET_USE_SCATTER \ + ix86_tune_features[X86_TUNE_USE_SCATTER] #define TARGET_FUSE_CMP_AND_BRANCH_32 \ ix86_tune_features[X86_TUNE_FUSE_CMP_AND_BRANCH_32] #define TARGET_FUSE_CMP_AND_BRANCH_64 \ diff --git a/gcc/config/i386/x86-tune.def b/gcc/config/i386/x86-tune.def index 1b754d5..c78dad0 100644 --- a/gcc/config/i386/x86-tune.def +++ b/gcc/config/i386/x86-tune.def @@ -483,28 +483,43 @@ DEF_TUNE (X86_TUNE_AVOID_4BYTE_PREFIXES, "avoid_4byte_prefixes", DEF_TUNE (X86_TUNE_USE_GATHER_2PARTS, "use_gather_2parts", ~(m_ZNVER1 | m_ZNVER2 | m_ZNVER3 | m_ZNVER4 | m_ALDERLAKE | m_CORE_ATOM | m_GENERIC)) +/* X86_TUNE_USE_SCATTER_2PARTS: Use scater instructions for vectors with 2 + elements. */ +DEF_TUNE (X86_TUNE_USE_SCATTER_2PARTS, "use_scatter_2parts", + ~(m_ZNVER4 | m_GENERIC)) + /* X86_TUNE_USE_GATHER_4PARTS: Use gather instructions for vectors with 4 elements. */ DEF_TUNE (X86_TUNE_USE_GATHER_4PARTS, "use_gather_4parts", ~(m_ZNVER1 | m_ZNVER2 | m_ZNVER3 | m_ZNVER4 | m_ALDERLAKE | m_CORE_ATOM | m_GENERIC)) +/* X86_TUNE_USE_SCATTER_4PARTS: Use scater instructions for vectors with 4 + elements. */ +DEF_TUNE (X86_TUNE_USE_SCATTER_4PARTS, "use_scatter_4parts", + ~(m_ZNVER4 | m_GENERIC)) + /* X86_TUNE_USE_GATHER: Use gather instructions for vectors with 8 or more elements. */ DEF_TUNE (X86_TUNE_USE_GATHER, "use_gather", - ~(m_ZNVER1 | m_ZNVER2 | m_ALDERLAKE | m_CORE_ATOM | m_GENERIC)) + ~(m_ZNVER1 | m_ZNVER2 | m_ZNVER4 | m_ALDERLAKE | m_CORE_ATOM | m_GENERIC)) + +/* X86_TUNE_USE_SCATTER: Use scater instructions for vectors with 8 or more + elements. */ +DEF_TUNE (X86_TUNE_USE_SCATTER, "use_scatter", + ~(m_ZNVER4 | m_GENERIC)) /* X86_TUNE_AVOID_128FMA_CHAINS: Avoid creating loops with tight 128bit or smaller FMA chain. */ -DEF_TUNE (X86_TUNE_AVOID_128FMA_CHAINS, "avoid_fma_chains", m_ZNVER) +DEF_TUNE (X86_TUNE_AVOID_128FMA_CHAINS, "avoid_fma_chains", m_ZNVER1 | m_ZNVER2 | m_ZNVER3) /* X86_TUNE_AVOID_256FMA_CHAINS: Avoid creating loops with tight 256bit or smaller FMA chain. */ -DEF_TUNE (X86_TUNE_AVOID_256FMA_CHAINS, "avoid_fma256_chains", m_ZNVER2 | m_ZNVER3 | m_ZNVER4 +DEF_TUNE (X86_TUNE_AVOID_256FMA_CHAINS, "avoid_fma256_chains", m_ZNVER2 | m_ZNVER3 | m_ALDERLAKE | m_SAPPHIRERAPIDS | m_CORE_ATOM) /* X86_TUNE_AVOID_512FMA_CHAINS: Avoid creating loops with tight 512bit or smaller FMA chain. */ -DEF_TUNE (X86_TUNE_AVOID_512FMA_CHAINS, "avoid_fma512_chains", m_ZNVER4) +DEF_TUNE (X86_TUNE_AVOID_512FMA_CHAINS, "avoid_fma512_chains", m_NONE) /* X86_TUNE_V2DF_REDUCTION_PREFER_PHADDPD: Prefer haddpd for v2df vector reduction. */ -- cgit v1.1 From 8daf80ff0ecd2aee50bf8e4f0f0dda906aeb190d Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 28 Dec 2022 17:36:32 +0100 Subject: ada: Optimize interface objects initialized with function calls This optimizes the implementation of (class-wide) interface objects that are initialized with function calls, by avoiding an unnecessary copy operation. This also removes useless access checks generated by the expansion of return statements involving class-wide types. gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration): Factor out conditions needed for an initializating expression that is a function call to be renamable into the Is_Renamable_Function_Call predicate. Use it to implement the renaming in the case of class-wide interface objects. Remove an interface conversion on all paths, separate and optimize the renaming path in the special expansion for interfaces. (Is_Renamable_Function_Call): New predicate. (Make_Allocator_For_Return): Put back an interface conversion. * exp_ch6.adb (Apply_CW_Accessibility_Check): Remove useless access checks on RE_Tag_Ptr. --- gcc/ada/exp_ch3.adb | 283 +++++++++++++++++++++++++++++++--------------------- gcc/ada/exp_ch6.adb | 30 +++--- 2 files changed, 187 insertions(+), 126 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index f107b7e..536ae0c 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -6306,6 +6306,38 @@ package body Exp_Ch3 is -- Generate all initialization actions for return object Def_Id. Any -- new code is inserted after node After. + function Is_Renamable_Function_Call (Expr : Node_Id) return Boolean; + -- If we are not at library level and the object declaration originally + -- appears in the form: + + -- Obj : Typ := Func (...); + + -- and has been rewritten as the dereference of a captured reference + -- to the function result built either on the primary or the secondary + -- stack, then the declaration can be rewritten as the renaming of this + -- dereference: + + -- type Ann is access all Typ; + -- Rnn : constant Axx := Func (...)'reference; + -- Obj : Typ renames Rnn.all; + + -- This will avoid making an extra copy and, in the case where Typ needs + -- finalization, a pair of calls to the Adjust and Finalize primitives, + -- or Deep_Adjust and Deep_Finalize routines, depending on whether Typ + -- has components that themselves need finalization. + + -- However, in the case of a special return object, we need to make sure + -- that the object Rnn is recognized by the Is_Related_To_Func_Return + -- predicate; otherwise, if it is of a type that needs finalization, + -- then Requires_Cleanup_Actions would return true because of this and + -- Build_Finalizer would finalize it prematurely because of this (see + -- also Expand_Simple_Function_Return for the same test in the case of + -- a simple return). + + -- Finally, in the case of a special return object, we also need to make + -- sure that the two functions return on the same stack, otherwise we + -- would create a dangling reference. + function Make_Allocator_For_Return (Expr : Node_Id) return Node_Id; -- Make an allocator for a return object initialized with Expr @@ -7100,12 +7132,28 @@ package body Exp_Ch3 is end if; end Initialize_Return_Object; + -------------------------------- + -- Is_Renamable_Function_Call -- + -------------------------------- + + function Is_Renamable_Function_Call (Expr : Node_Id) return Boolean is + begin + return not Is_Library_Level_Entity (Def_Id) + and then Is_Captured_Function_Call (Expr) + and then (not Special_Ret_Obj + or else + (Is_Related_To_Func_Return (Entity (Prefix (Expr))) + and then Needs_Secondary_Stack (Etype (Expr)) = + Needs_Secondary_Stack (Etype (Func_Id)))); + end Is_Renamable_Function_Call; + ------------------------------- -- Make_Allocator_For_Return -- ------------------------------- function Make_Allocator_For_Return (Expr : Node_Id) return Node_Id is - Alloc : Node_Id; + Alloc : Node_Id; + Alloc_Expr : Entity_Id; begin -- If the return object's declaration includes an expression and the @@ -7131,6 +7179,18 @@ package body Exp_Ch3 is Apply_CW_Accessibility_Check (Expr, Func_Id); end if; + Alloc_Expr := New_Copy_Tree (Expr); + + -- In the interface case, put back a conversion that we may have + -- remove earlier in the processing. + + if Is_Interface (Typ) + and then Is_Interface (Etype (Alloc_Expr)) + and then Typ /= Etype (Alloc_Expr) + then + Alloc_Expr := Convert_To (Typ, Alloc_Expr); + end if; + -- We always use the type of the expression for the qualified -- expression, rather than the return object's type. We cannot -- always use the return object's type because the expression @@ -7141,8 +7201,8 @@ package body Exp_Ch3 is Expression => Make_Qualified_Expression (Loc, Subtype_Mark => - New_Occurrence_Of (Etype (Expr), Loc), - Expression => New_Copy_Tree (Expr))); + New_Occurrence_Of (Etype (Alloc_Expr), Loc), + Expression => Alloc_Expr)); else Alloc := @@ -7479,12 +7539,42 @@ package body Exp_Ch3 is then pragma Assert (Is_Class_Wide_Type (Typ)); + -- If the original node of the expression was a conversion + -- to this specific class-wide interface type then restore + -- the original node because we must copy the object before + -- displacing the pointer to reference the secondary tag + -- component. This code must be kept synchronized with the + -- expansion done by routine Expand_Interface_Conversion + + if not Comes_From_Source (Expr) + and then Nkind (Expr) = N_Explicit_Dereference + and then Nkind (Original_Node (Expr)) = N_Type_Conversion + and then Etype (Original_Node (Expr)) = Typ + then + Rewrite (Expr, Original_Node (Expression (N))); + end if; + + -- Avoid expansion of redundant interface conversion + + if Nkind (Expr) = N_Type_Conversion + and then Etype (Expr) = Typ + then + Expr_Q := Expression (Expr); + else + Expr_Q := Expr; + end if; + + -- We may use a renaming if the initializing expression is a + -- captured function call that meets a few conditions. + + Rewrite_As_Renaming := Is_Renamable_Function_Call (Expr_Q); + -- If the object is a special return object, then bypass special -- treatment of class-wide interface initialization below. In this - -- case, the expansion of the return statement will take care of - -- creating the object (via allocator) and initializing it. + -- case, the expansion of the return object will take care of this + -- initialization via the expansion of the allocator. - if Special_Ret_Obj then + if Special_Ret_Obj and then not Rewrite_As_Renaming then -- If the type needs finalization and is not inherently -- limited, then the target is adjusted after the copy @@ -7511,45 +7601,25 @@ package body Exp_Ch3 is Tag_Comp : Node_Id; begin - -- If the original node of the expression was a conversion - -- to this specific class-wide interface type then restore - -- the original node because we must copy the object before - -- displacing the pointer to reference the secondary tag - -- component. This code must be kept synchronized with the - -- expansion done by routine Expand_Interface_Conversion - - if not Comes_From_Source (Expr) - and then Nkind (Expr) = N_Explicit_Dereference - and then Nkind (Original_Node (Expr)) = N_Type_Conversion - and then Etype (Original_Node (Expr)) = Typ - then - Rewrite (Expr, Original_Node (Expression (N))); + Expr_Typ := Base_Type (Etype (Expr_Q)); + if Is_Class_Wide_Type (Expr_Typ) then + Expr_Typ := Root_Type (Expr_Typ); end if; - -- Avoid expansion of redundant interface conversion + -- Rename limited objects since they cannot be copied - if Is_Interface (Etype (Expr)) - and then Nkind (Expr) = N_Type_Conversion - and then Etype (Expr) = Typ - then - Expr_Q := Expression (Expr); - else - Expr_Q := Expr; + if Is_Limited_Record (Expr_Typ) then + Rewrite_As_Renaming := True; end if; - Obj_Id := Make_Temporary (Loc, 'D', Expr_Q); - Expr_Typ := Base_Type (Etype (Expr_Q)); - - if Is_Class_Wide_Type (Expr_Typ) then - Expr_Typ := Root_Type (Expr_Typ); - end if; + Obj_Id := Make_Temporary (Loc, 'D', Expr_Q); -- Replace -- CW : I'Class := Obj; -- by - -- Tmp : Typ := Obj; + -- Dnn : Typ := Obj; -- type Ityp is not null access I'Class; - -- Rnn : constant Ityp := Ityp (Tmp.I_Tag'Address); + -- Rnn : constant Ityp := Ityp (Dnn.I_Tag'Address); -- CW : I'Class renames Rnn.all; if Comes_From_Source (Expr_Q) @@ -7580,14 +7650,55 @@ package body Exp_Ch3 is (Find_Interface_Tag (Expr_Typ, Iface), Loc)); -- Replace - -- IW : I'Class := Obj; + -- IW : I'Class := Expr; + -- by + -- Dnn : Tag renames Tag_Ptr!(Expr'Address).all; + -- type Ityp is not null access I'Class; + -- Rnn : constant Ityp := + -- Ityp!(Displace (Dnn'Address, I'Tag)); + -- IW : I'Class renames Rnn.all; + + elsif Rewrite_As_Renaming then + New_Expr := + Make_Explicit_Dereference (Loc, + Unchecked_Convert_To (RTE (RE_Tag_Ptr), + Make_Attribute_Reference (Loc, + Prefix => Relocate_Node (Expr_Q), + Attribute_Name => Name_Address))); + + -- Suppress junk access checks on RE_Tag_Ptr + + Insert_Action (N, + Make_Object_Renaming_Declaration (Loc, + Defining_Identifier => Obj_Id, + Subtype_Mark => + New_Occurrence_Of (RTE (RE_Tag), Loc), + Name => New_Expr), + Suppress => Access_Check); + + -- Dynamically reference the tag associated with the + -- interface. + + Tag_Comp := + Make_Function_Call (Loc, + Name => New_Occurrence_Of (RTE (RE_Displace), Loc), + Parameter_Associations => New_List ( + Make_Attribute_Reference (Loc, + Prefix => New_Occurrence_Of (Obj_Id, Loc), + Attribute_Name => Name_Address), + New_Occurrence_Of + (Node (First_Elmt (Access_Disp_Table (Iface))), + Loc))); + + -- Replace + -- IW : I'Class := Expr; -- by -- type Equiv_Record is record ... end record; -- implicit subtype CW is ; - -- Tmp : CW := CW!(Obj); + -- Dnn : CW := CW!(Expr); -- type Ityp is not null access I'Class; -- Rnn : constant Ityp := - -- Ityp!(Displace (Tmp'Address, I'Tag)); + -- Ityp!(Displace (Dnn'Address, I'Tag)); -- IW : I'Class renames Rnn.all; else @@ -7600,13 +7711,10 @@ package body Exp_Ch3 is Subtype_Indic => Obj_Def, Exp => Expr_Q); - if not Is_Interface (Etype (Expr_Q)) then - New_Expr := Relocate_Node (Expr_Q); - -- For interface types we use 'Address which displaces - -- the pointer to the base of the object (if required) + -- the pointer to the base of the object (if required). - else + if Is_Interface (Etype (Expr_Q)) then New_Expr := Unchecked_Convert_To (Etype (Obj_Def), Make_Explicit_Dereference (Loc, @@ -7614,33 +7722,23 @@ package body Exp_Ch3 is Make_Attribute_Reference (Loc, Prefix => Relocate_Node (Expr_Q), Attribute_Name => Name_Address)))); - end if; - - -- Copy the object - if not Is_Limited_Record (Expr_Typ) then - Insert_Action (N, - Make_Object_Declaration (Loc, - Defining_Identifier => Obj_Id, - Object_Definition => - New_Occurrence_Of (Etype (Obj_Def), Loc), - Expression => New_Expr)); - - -- Rename limited type object since they cannot be copied - -- This case occurs when the initialization expression - -- has been previously expanded into a temporary object. + -- For other types, no displacement is needed else - Insert_Action (N, - Make_Object_Renaming_Declaration (Loc, - Defining_Identifier => Obj_Id, - Subtype_Mark => - New_Occurrence_Of (Etype (Obj_Def), Loc), - Name => - Unchecked_Convert_To - (Etype (Obj_Def), New_Expr))); + New_Expr := Relocate_Node (Expr_Q); end if; + -- Suppress junk access checks on RE_Tag_Ptr + + Insert_Action (N, + Make_Object_Declaration (Loc, + Defining_Identifier => Obj_Id, + Object_Definition => + New_Occurrence_Of (Etype (Obj_Def), Loc), + Expression => New_Expr), + Suppress => Access_Check); + -- Dynamically reference the tag associated with the -- interface. @@ -7684,6 +7782,7 @@ package body Exp_Ch3 is Set_Prefix (Tag_Comp, New_Occurrence_Of (Ptr_Obj_Id, Loc)); Expr_Q := Tag_Comp; Set_Etype (Expr_Q, Typ); + Set_Parent (Expr_Q, N); Rewrite_As_Renaming := True; end; @@ -7863,7 +7962,6 @@ package body Exp_Ch3 is Rewrite_As_Renaming := -- The declaration cannot be rewritten if it has got constraints - -- in other words the nominal subtype must be unconstrained. Is_Entity_Name (Original_Node (Obj_Def)) @@ -7872,57 +7970,18 @@ package body Exp_Ch3 is and then not Aliased_Present (N) - -- If the object declaration originally appears in the form - - -- Obj : Typ := Func (...); - - -- and has been rewritten as the dereference of a reference - -- to the function result built either on the primary or the - -- secondary stack, then the declaration can be rewritten as - -- the renaming of this dereference: - - -- type Ann is access all Typ; - -- Rnn : constant Axx := Func (...)'reference; - -- Obj : Typ renames Rnn.all; - - -- This avoids an extra copy and, in the case where Typ needs - -- finalization, a pair of Adjust/Finalize calls (see below). - - -- However, in the case of a special return object, we need to - -- make sure that the object Rnn is properly recognized by the - -- Is_Related_To_Func_Return predicate; otherwise, if it is of - -- a type that needs finalization, Requires_Cleanup_Actions - -- would return true because of this and Build_Finalizer would - -- finalize it prematurely (see Expand_Simple_Function_Return - -- for the same test in the case of a simple return). - - -- Moreover, in the case of a special return object, we also - -- need to make sure that the two functions return on the same - -- stack, otherwise we would create a dangling reference. + -- We may use a renaming if the initializing expression is a + -- captured function call that meets a few conditions. and then - ((not Is_Library_Level_Entity (Def_Id) - and then Is_Captured_Function_Call (Expr_Q) - and then - (not Special_Ret_Obj - or else - (Is_Related_To_Func_Return (Entity (Prefix (Expr_Q))) - and then Needs_Secondary_Stack (Etype (Expr_Q)) = - Needs_Secondary_Stack (Etype (Func_Id))))) - - -- If the initializing expression is a variable with the - -- flag OK_To_Rename set, then transform: - - -- Obj : Typ := Expr; - - -- into + (Is_Renamable_Function_Call (Expr_Q) - -- Obj : Typ renames Expr; + -- Or else if it is a variable with OK_To_Rename set or else (OK_To_Rename_Ref (Expr_Q) and then not Special_Ret_Obj) - -- Likewise if it is a slice of such a variable + -- Or else if it is a slice of such a variable or else (Nkind (Expr_Q) = N_Slice and then OK_To_Rename_Ref (Prefix (Expr_Q)) @@ -8117,8 +8176,8 @@ package body Exp_Ch3 is if Is_Build_In_Place_Return_Object (Def_Id) then declare - Init_Stmt : Node_Id; - Obj_Acc_Formal : Entity_Id; + Init_Stmt : Node_Id; + Obj_Acc_Formal : Entity_Id; begin -- Retrieve the implicit access parameter passed by the caller diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 7a309e8..503fdc1 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -687,7 +687,11 @@ package body Exp_Ch6 is Loc : constant Source_Ptr := Sloc (Exp); begin + -- CodePeer does not do anything useful on Ada.Tags.Type_Specific_Data + -- components. + if Ada_Version >= Ada_2005 + and then not CodePeer_Mode and then Tagged_Type_Expansion and then not Scope_Suppress.Suppress (Accessibility_Check) and then @@ -770,20 +774,18 @@ package body Exp_Ch6 is Attribute_Name => Name_Tag); end if; - -- CodePeer does not do anything useful with - -- Ada.Tags.Type_Specific_Data components. - - if not CodePeer_Mode then - Insert_Action (Exp, - Make_Raise_Program_Error (Loc, - Condition => - Make_Op_Gt (Loc, - Left_Opnd => Build_Get_Access_Level (Loc, Tag_Node), - Right_Opnd => - Make_Integer_Literal (Loc, - Scope_Depth (Enclosing_Dynamic_Scope (Func)))), - Reason => PE_Accessibility_Check_Failed)); - end if; + -- Suppress junk access chacks on RE_Tag_Ptr + + Insert_Action (Exp, + Make_Raise_Program_Error (Loc, + Condition => + Make_Op_Gt (Loc, + Left_Opnd => Build_Get_Access_Level (Loc, Tag_Node), + Right_Opnd => + Make_Integer_Literal (Loc, + Scope_Depth (Enclosing_Dynamic_Scope (Func)))), + Reason => PE_Accessibility_Check_Failed), + Suppress => Access_Check); end; end if; end Apply_CW_Accessibility_Check; -- cgit v1.1 From 24993939b7e405cdb8fa7ab6b388913a5d9fb6ce Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 2 Jan 2023 23:11:21 +0100 Subject: ada: Lift restriction on optimization of aliased objects It turns out that the only blocking case is an aliased object whose nominal subtype is an unconstrained array because the bounds must be allocated. gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration): Also optimize aliased objects if their nominal subtype is not an unconstrained array. --- gcc/ada/exp_ch3.adb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 536ae0c..c866a9c 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -7965,10 +7965,10 @@ package body Exp_Ch3 is Is_Entity_Name (Original_Node (Obj_Def)) - -- The aliased case has to be excluded because the expression - -- will not be aliased in the general case. + -- Nor if it is effectively an unconstrained declaration - and then not Aliased_Present (N) + and then not (Is_Array_Type (Typ) + and then Is_Constr_Subt_For_UN_Aliased (Typ)) -- We may use a renaming if the initializing expression is a -- captured function call that meets a few conditions. -- cgit v1.1 From e59cd0db822e325868128281a81ee356a6914f52 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 3 Jan 2023 08:20:30 +0100 Subject: ada: Put back conversion to interface in more cases This needs to be done for all expressions with class-wide type. gcc/ada/ * exp_ch3.adb (Make_Allocator_For_Return): Put back an interface conversion for expressions with non-interface class-wide type. --- gcc/ada/exp_ch3.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index c866a9c..84594ed 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -7185,7 +7185,7 @@ package body Exp_Ch3 is -- remove earlier in the processing. if Is_Interface (Typ) - and then Is_Interface (Etype (Alloc_Expr)) + and then Is_Class_Wide_Type (Etype (Alloc_Expr)) and then Typ /= Etype (Alloc_Expr) then Alloc_Expr := Convert_To (Typ, Alloc_Expr); -- cgit v1.1 From 1f038e845bbdeae9dddf1810fb3e6c9ad1b79f13 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 4 Jan 2023 08:41:52 +0100 Subject: ada: Further optimize interface objects initialized with function calls This further optimizes the usual case of (class-wide) interface objects that are initialized with calls to functions whose result type is the type of the objects (this is not necessary as any result type implementing the interface would do) by avoiding a back-and-forth displacement of the objects' address. This exposed a latent issue whereby the displacement was missing in the case of a simple return statement whose expression is a call to a function whose result type is a specific tagged type that needs finalization. And, in order to avoid pessimizing the expanded code, this in turn required avoiding to create temporaries for allocators by calling Remove_Side_Effects up front, in the common cases when they are not necessary. gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration): Do not generate a back- and-forth displacement of the object's address when using a renaming for an interface object with an expression of the same type. * exp_ch4.adb (Expand_Allocator_Expression): Do not remove the side effects of the expression up front for the simple allocators. Do not call the Adjust primitive if the expression is a function call. * exp_ch6.adb (Expand_Ctrl_Function_Call): Do not expand the call unnecessarily for a special return object. (Expand_Simple_Function_Return): Restore the displacement of the return object's address in the case where the expression is the call to a function whose result type is a type that needs finalization. * exp_util.adb (Expand_Subtype_From_Expr): Do not remove the side effects of the expression before calling Make_Subtype_From_Expr. (Make_CW_Equivalent_Type): If the expression has the tag of its type and this type has a uniform size, use 'Object_Size of this type in lieu of 'Size of the expression to compute the expression's size. --- gcc/ada/exp_ch3.adb | 7 +++++++ gcc/ada/exp_ch4.adb | 18 +++++++++++------- gcc/ada/exp_ch6.adb | 22 ++++++++++------------ gcc/ada/exp_util.adb | 36 +++++++++++++++++++++++------------- 4 files changed, 51 insertions(+), 32 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 84594ed..bbb53fc 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -7589,6 +7589,13 @@ package body Exp_Ch3 is Typ => Base_Typ); end if; + -- Renaming an expression of the object's type is immediate + + elsif Rewrite_As_Renaming + and then Base_Type (Etype (Expr_Q)) = Base_Type (Typ) + then + null; + elsif Tagged_Type_Expansion then declare Iface : constant Entity_Id := Root_Type (Typ); diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index d3a4f57..31823ea 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -698,11 +698,14 @@ package body Exp_Ch4 is -- recursion and inappropriate call to Initialize. -- We don't want to remove side effects when the expression must be - -- built in place. In the case of a build-in-place function call, - -- that could lead to a duplication of the call, which was already - -- substituted for the allocator. + -- built in place and we don't need it when there is no storage pool + -- or this is a return/secondary stack allocation. - if not Aggr_In_Place then + if not Aggr_In_Place + and then Present (Storage_Pool (N)) + and then not Is_RTE (Storage_Pool (N), RE_RS_Pool) + and then not Is_RTE (Storage_Pool (N), RE_SS_Pool) + then Remove_Side_Effects (Exp); end if; @@ -747,7 +750,7 @@ package body Exp_Ch4 is -- Processing for allocators returning non-interface types - if not Is_Interface (Directly_Designated_Type (PtrT)) then + if not Is_Interface (DesigT) then if Aggr_In_Place then Temp_Decl := Make_Object_Declaration (Loc, @@ -960,8 +963,9 @@ package body Exp_Ch4 is if Needs_Finalization (DesigT) and then Needs_Finalization (T) - and then not Aggr_In_Place and then not Is_Limited_View (T) + and then not Aggr_In_Place + and then Nkind (Exp) /= N_Function_Call and then not For_Special_Return_Object (N) then -- An unchecked conversion is needed in the classwide case because @@ -993,7 +997,7 @@ package body Exp_Ch4 is -- component containing the secondary dispatch table of the interface -- type. - if Is_Interface (Directly_Designated_Type (PtrT)) then + if Is_Interface (DesigT) then Displace_Allocator_Pointer (N); end if; diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 503fdc1..7abf25e 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -5133,14 +5133,11 @@ package body Exp_Ch6 is -- Another optimization: if the returned value is used to initialize an -- object, then no need to copy/readjust/finalize, we can initialize it - -- in place. However, if the call returns on the secondary stack or this - -- is a special return object, then we need the expansion because we'll - -- be renaming the temporary as the (permanent) object. + -- in place. However, if the call returns on the secondary stack, then + -- we need the expansion because we'll be renaming the temporary as the + -- (permanent) object. - if Nkind (Par) = N_Object_Declaration - and then not Use_Sec_Stack - and then not Is_Special_Return_Object (Defining_Entity (Par)) - then + if Nkind (Par) = N_Object_Declaration and then not Use_Sec_Stack then return; end if; @@ -6745,7 +6742,7 @@ package body Exp_Ch6 is null; -- Optimize the case where the result is a function call that also - -- returns on the secondary stack. In this case the result is already + -- returns on the secondary stack; in this case the result is already -- on the secondary stack and no further processing is required. elsif Exp_Is_Function_Call @@ -6781,13 +6778,14 @@ package body Exp_Ch6 is -- gigi is not able to properly allocate class-wide types. -- But optimize the case where the result is a function call that - -- also needs finalization. In this case the result can directly be + -- also needs finalization; in this case the result can directly be -- allocated on the secondary stack and no further processing is - -- required. + -- required, unless the returned object is an interface. elsif CW_Or_Needs_Finalization (Utyp) - and then not (Exp_Is_Function_Call - and then Needs_Finalization (Exp_Typ)) + and then (Is_Interface (R_Type) + or else not (Exp_Is_Function_Call + and then Needs_Finalization (Exp_Typ))) then declare Acc_Typ : constant Entity_Id := Make_Temporary (Loc, 'A'); diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index cac0d84..f86b938 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -5820,7 +5820,6 @@ package body Exp_Util is -- discriminants. else - Remove_Side_Effects (Exp); Rewrite (Subtype_Indic, Make_Subtype_From_Expr (Exp, Underlying_Record_View (Unc_Type))); end if; @@ -5885,7 +5884,6 @@ package body Exp_Util is end if; else - Remove_Side_Effects (Exp); Rewrite (Subtype_Indic, Make_Subtype_From_Expr (Exp, Unc_Type, Related_Id)); end if; @@ -9496,12 +9494,13 @@ package body Exp_Util is Root_Utyp : constant Entity_Id := Underlying_Type (Root_Typ); List_Def : constant List_Id := Empty_List; Comp_List : constant List_Id := New_List; + Equiv_Type : Entity_Id; Range_Type : Entity_Id; Str_Type : Entity_Id; Constr_Root : Entity_Id; + Size_Attr : Node_Id; Size_Expr : Node_Id; - Size_Pref : Node_Id; function Has_Tag_Of_Type (Exp : Node_Id) return Boolean; -- Return True if expression Exp of a tagged type is known to statically @@ -9597,9 +9596,26 @@ package body Exp_Util is -- the _Size primitive operation. if Has_Tag_Of_Type (E) then - Size_Pref := Duplicate_Subexpr_No_Checks (E); + if not Has_Discriminants (Etype (E)) + or else Is_Constrained (Etype (E)) + then + Size_Attr := + Make_Attribute_Reference (Loc, + Prefix => New_Occurrence_Of (Etype (E), Loc), + Attribute_Name => Name_Object_Size); + + else + Size_Attr := + Make_Attribute_Reference (Loc, + Prefix => Duplicate_Subexpr_No_Checks (E), + Attribute_Name => Name_Size); + end if; + else - Size_Pref := OK_Convert_To (T, Duplicate_Subexpr_No_Checks (E)); + Size_Attr := + Make_Attribute_Reference (Loc, + Prefix => OK_Convert_To (T, Duplicate_Subexpr_No_Checks (E)), + Attribute_Name => Name_Size); end if; if not Is_Interface (Root_Typ) then @@ -9610,10 +9626,7 @@ package body Exp_Util is Size_Expr := Make_Op_Subtract (Loc, - Left_Opnd => - Make_Attribute_Reference (Loc, - Prefix => Size_Pref, - Attribute_Name => Name_Size), + Left_Opnd => Size_Attr, Right_Opnd => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Constr_Root, Loc), @@ -9625,10 +9638,7 @@ package body Exp_Util is Size_Expr := Make_Op_Subtract (Loc, - Left_Opnd => - Make_Attribute_Reference (Loc, - Prefix => Size_Pref, - Attribute_Name => Name_Size), + Left_Opnd => Size_Attr, Right_Opnd => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Tag), Loc), -- cgit v1.1 From 00fdfe9de2e2205330f312364b3b60fca3005b61 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 6 Jan 2023 13:24:18 +0100 Subject: ada: Fix premature finalization of temporaries for interface objects This restores the proper finalization of temporaries for interface objects in the case where the initializing expression is not of an interface type. It turns out that neither Is_Temporary_For_Interface_Object nor its previous incarnation are sufficient to catch all the various cases, so it is replaced by a small enhancement to Is_Aliased, which is more robust. gcc/ada/ * exp_util.adb (Is_Temporary_For_Interface_Object): Delete. (Is_Finalizable_Transient.Is_Aliased): Deal with the specific case of temporaries generated for interface objects. --- gcc/ada/exp_util.adb | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index f86b938..da5e849 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -168,11 +168,6 @@ package body Exp_Util is -- Force evaluation of bounds of a slice, which may be given by a range -- or by a subtype indication with or without a constraint. - function Is_Temporary_For_Interface_Object - (Obj_Id : Entity_Id) return Boolean; - -- Determine whether Obj_Id is a temporary created for the handling of a - -- (class-wide) interface object. - function Is_Uninitialized_Aggregate (Exp : Node_Id; T : Entity_Id) return Boolean; @@ -8397,6 +8392,23 @@ package body Exp_Util is Search (Name (Ren_Decl)); end if; + -- For renamings generated by Expand_N_Object_Declaration to deal + -- with (class-wide) interface objects, there is an intermediate + -- temporary of an anonymous access type used to hold the result + -- of the displacement of the address of the renamed object. + + if Present (Ren_Obj) + and then Ekind (Ren_Obj) = E_Constant + and then Is_Itype (Etype (Ren_Obj)) + and then Ekind (Etype (Ren_Obj)) = E_Anonymous_Access_Type + and then + Is_Class_Wide_Type (Directly_Designated_Type (Etype (Ren_Obj))) + and then + Is_Interface (Directly_Designated_Type (Etype (Ren_Obj))) + then + Search (Constant_Value (Ren_Obj)); + end if; + return Ren_Obj; end Find_Renamed_Object; @@ -8638,11 +8650,6 @@ package body Exp_Util is and then not Initialized_By_Aliased_BIP_Func_Call (Obj_Id) - -- Do not consider temporaries created for (class-wide) interface - -- objects because they must exist as long as the object is around. - - and then not Is_Temporary_For_Interface_Object (Obj_Id) - -- Do not consider iterators because those are treated as normal -- controlled objects and are processed by the usual finalization -- machinery. This avoids the double finalization of an iterator. @@ -9150,24 +9157,6 @@ package body Exp_Util is and then Has_Controlling_Result (Id); end Is_Secondary_Stack_Thunk; - --------------------------------------- - -- Is_Temporary_For_Interface_Object -- - --------------------------------------- - - function Is_Temporary_For_Interface_Object - (Obj_Id : Entity_Id) return Boolean - is - Expr : constant Node_Id := Expression (Declaration_Node (Obj_Id)); - - begin - -- This must be kept synchronized with Expand_N_Object_Declaration - - return Is_Class_Wide_Type (Etype (Obj_Id)) - and then Present (Expr) - and then Nkind (Expr) = N_Unchecked_Type_Conversion - and then Is_RTE (Etype (Expression (Expr)), RE_Tag); - end Is_Temporary_For_Interface_Object; - -------------------------------- -- Is_Uninitialized_Aggregate -- -------------------------------- -- cgit v1.1 From b7ed6c43a80e06082baad5336be0fa943a878d40 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 7 Jan 2023 14:39:19 +0100 Subject: ada: Fix benign pasto in new predicate gcc/ada/ * exp_util.adb (Make_CW_Equivalent_Type.Has_Tag_Of_Type): Fix pasto. --- gcc/ada/exp_util.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index da5e849..f6d91ca 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -9521,7 +9521,7 @@ package body Exp_Util is return True; else - case Nkind (E) is + case Nkind (Exp) is -- The tag of a component or an aggregate of a specific tagged -- type T identifies T. -- cgit v1.1 From 39a7b603380c6f4383357a6ae1d6c516dc677f29 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 7 Jan 2023 22:05:58 +0100 Subject: ada: Use static references to tag in more cases for interface objects This extends the use of static references to the interface tag in more cases for (class-wide) interface objects, e.g. for initialization expressions that are qualified aggregates or nondispatching calls returning a specific tagged type implementing the interface. gcc/ada/ * exp_util.ads (Has_Tag_Of_Type): Declare. * exp_util.adb (Has_Tag_Of_Type): Move to package level. Recurse on qualified expressions. * exp_ch3.adb (Expand_N_Object_Declaration): Use a static reference to the interface tag in more cases for class-wide interface objects. --- gcc/ada/exp_ch3.adb | 72 ++++++++++++++++----------------- gcc/ada/exp_util.adb | 112 ++++++++++++++++++++++++++------------------------- gcc/ada/exp_util.ads | 4 ++ 3 files changed, 95 insertions(+), 93 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index bbb53fc..6bc76ae 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -7564,7 +7564,7 @@ package body Exp_Ch3 is Expr_Q := Expr; end if; - -- We may use a renaming if the initializing expression is a + -- We may use a renaming if the initialization expression is a -- captured function call that meets a few conditions. Rewrite_As_Renaming := Is_Renamable_Function_Call (Expr_Q); @@ -7622,41 +7622,6 @@ package body Exp_Ch3 is Obj_Id := Make_Temporary (Loc, 'D', Expr_Q); -- Replace - -- CW : I'Class := Obj; - -- by - -- Dnn : Typ := Obj; - -- type Ityp is not null access I'Class; - -- Rnn : constant Ityp := Ityp (Dnn.I_Tag'Address); - -- CW : I'Class renames Rnn.all; - - if Comes_From_Source (Expr_Q) - and then Is_Entity_Name (Expr_Q) - and then not Is_Interface (Expr_Typ) - and then Interface_Present_In_Ancestor (Expr_Typ, Typ) - and then (Expr_Typ = Etype (Expr_Typ) - or else not - Is_Variable_Size_Record (Etype (Expr_Typ))) - then - -- Copy the object - - Insert_Action (N, - Make_Object_Declaration (Loc, - Defining_Identifier => Obj_Id, - Object_Definition => - New_Occurrence_Of (Expr_Typ, Loc), - Expression => Relocate_Node (Expr_Q))); - - -- Statically reference the tag associated with the - -- interface - - Tag_Comp := - Make_Selected_Component (Loc, - Prefix => New_Occurrence_Of (Obj_Id, Loc), - Selector_Name => - New_Occurrence_Of - (Find_Interface_Tag (Expr_Typ, Iface), Loc)); - - -- Replace -- IW : I'Class := Expr; -- by -- Dnn : Tag renames Tag_Ptr!(Expr'Address).all; @@ -7665,7 +7630,7 @@ package body Exp_Ch3 is -- Ityp!(Displace (Dnn'Address, I'Tag)); -- IW : I'Class renames Rnn.all; - elsif Rewrite_As_Renaming then + if Rewrite_As_Renaming then New_Expr := Make_Explicit_Dereference (Loc, Unchecked_Convert_To (RTE (RE_Tag_Ptr), @@ -7700,6 +7665,37 @@ package body Exp_Ch3 is -- Replace -- IW : I'Class := Expr; -- by + -- Dnn : Typ := Expr; + -- type Ityp is not null access I'Class; + -- Rnn : constant Ityp := Ityp (Dnn.I_Tag'Address); + -- IW : I'Class renames Rnn.all; + + elsif Has_Tag_Of_Type (Expr_Q) + and then Interface_Present_In_Ancestor (Expr_Typ, Typ) + and then (Expr_Typ = Etype (Expr_Typ) + or else not + Is_Variable_Size_Record (Etype (Expr_Typ))) + then + Insert_Action (N, + Make_Object_Declaration (Loc, + Defining_Identifier => Obj_Id, + Object_Definition => + New_Occurrence_Of (Expr_Typ, Loc), + Expression => Relocate_Node (Expr_Q))); + + -- Statically reference the tag associated with the + -- interface + + Tag_Comp := + Make_Selected_Component (Loc, + Prefix => New_Occurrence_Of (Obj_Id, Loc), + Selector_Name => + New_Occurrence_Of + (Find_Interface_Tag (Expr_Typ, Iface), Loc)); + + -- Replace + -- IW : I'Class := Expr; + -- by -- type Equiv_Record is record ... end record; -- implicit subtype CW is ; -- Dnn : CW := CW!(Expr); @@ -7977,7 +7973,7 @@ package body Exp_Ch3 is and then not (Is_Array_Type (Typ) and then Is_Constr_Subt_For_UN_Aliased (Typ)) - -- We may use a renaming if the initializing expression is a + -- We may use a renaming if the initialization expression is a -- captured function call that meets a few conditions. and then diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index f6d91ca..80c01bf 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -7186,6 +7186,63 @@ package body Exp_Util is end if; end Has_Access_Constraint; + --------------------- + -- Has_Tag_Of_Type -- + --------------------- + + function Has_Tag_Of_Type (Exp : Node_Id) return Boolean is + Typ : constant Entity_Id := Etype (Exp); + + begin + pragma Assert (Is_Tagged_Type (Typ)); + + -- The tag of an object of a class-wide type is that of its + -- initialization expression. + + if Is_Class_Wide_Type (Typ) then + return False; + end if; + + -- The tag of a stand-alone object of a specific tagged type T + -- identifies T. + + if Is_Entity_Name (Exp) + and then Ekind (Entity (Exp)) in E_Constant | E_Variable + then + return True; + + else + case Nkind (Exp) is + -- The tag of a component or an aggregate of a specific tagged + -- type T identifies T. + + when N_Indexed_Component + | N_Selected_Component + | N_Aggregate + => + return True; + + -- The tag of the result returned by a function whose result + -- type is a specific tagged type T identifies T. + + when N_Function_Call => + return True; + + when N_Explicit_Dereference => + return Is_Captured_Function_Call (Exp); + + -- For a tagged type, the operand of a qualified expression + -- shall resolve to be of the type of the expression. + + when N_Qualified_Expression => + return Has_Tag_Of_Type (Expression (Exp)); + + when others => + return False; + end case; + end if; + end Has_Tag_Of_Type; + -------------------- -- Homonym_Number -- -------------------- @@ -9491,61 +9548,6 @@ package body Exp_Util is Size_Attr : Node_Id; Size_Expr : Node_Id; - function Has_Tag_Of_Type (Exp : Node_Id) return Boolean; - -- Return True if expression Exp of a tagged type is known to statically - -- have the tag of this tagged type as specified by RM 3.9(19-25). - - --------------------- - -- Has_Tag_Of_Type -- - --------------------- - - function Has_Tag_Of_Type (Exp : Node_Id) return Boolean is - Typ : constant Entity_Id := Etype (Exp); - - begin - pragma Assert (Is_Tagged_Type (Typ)); - - -- The tag of an object of a class-wide type is that of its - -- initialization expression. - - if Is_Class_Wide_Type (Typ) then - return False; - end if; - - -- The tag of a stand-alone object of a specific tagged type T - -- identifies T. - - if Is_Entity_Name (Exp) - and then Ekind (Entity (Exp)) in E_Constant | E_Variable - then - return True; - - else - case Nkind (Exp) is - -- The tag of a component or an aggregate of a specific tagged - -- type T identifies T. - - when N_Indexed_Component - | N_Selected_Component - | N_Aggregate - => - return True; - - -- The tag of the result returned by a function whose result - -- type is a specific tagged type T identifies T. - - when N_Function_Call => - return True; - - when N_Explicit_Dereference => - return Is_Captured_Function_Call (Exp); - - when others => - return False; - end case; - end if; - end Has_Tag_Of_Type; - begin -- If the root type is already constrained, there are no discriminants -- in the expression. diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads index 32f9c24..3dd10d7 100644 --- a/gcc/ada/exp_util.ads +++ b/gcc/ada/exp_util.ads @@ -732,6 +732,10 @@ package Exp_Util is function Has_Access_Constraint (E : Entity_Id) return Boolean; -- Given object or type E, determine if a discriminant is of an access type + function Has_Tag_Of_Type (Exp : Node_Id) return Boolean; + -- Return True if expression Exp of a tagged type is known to statically + -- have the tag of this tagged type as specified by RM 3.9(19-25). + function Homonym_Number (Subp : Entity_Id) return Pos; -- Here subp is the entity for a subprogram. This routine returns the -- homonym number used to disambiguate overloaded subprograms in the same -- cgit v1.1 From 3b4c6e67710b09beccb7d0acf7f7257564d8a6f5 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 10 Jan 2023 16:09:44 +0100 Subject: ada: Fix pessimization of some CW objects initialized with function call The recent removal of the unconditional call to Remove_Side_Effects on the expression of an object declaration or an allocator with a class-wide type has introduced a pessimization in the former case for function calls that return a specific tagged type, because the object ultimately created on the primary stack has changed from being of a specific tagged type to being of the class-wide type, the latter type always formally requiring finalization. With the current finalization machinery, this means that a dispatching call to the Deep_Finalize routine is generated, which is unnecessary. Although this is a generic finalization issue with class-wide objects, this restores the previous behavior in this case to fix the pessimization for now. gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration): For a class-wide non- interface stand-alone object initialized by a function call, call Remove_Side_Effects on the expression to capture the result. --- gcc/ada/exp_ch3.adb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'gcc') diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 6bc76ae..6886bde 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -7797,6 +7797,25 @@ package body Exp_Ch3 is -- Common case of explicit object initialization else + -- Small optimization: if the expression is a function call and + -- the object is stand-alone, not declared at library level and of + -- a class-wide type, then we capture the result of the call into + -- a temporary, with the benefit that, if the result's type does + -- not need finalization, nothing will be finalized and, if it + -- does, the temporary only will be finalized by means of a direct + -- call to the Finalize primitive if the result's type is not a + -- class-wide type; whereas, in both cases, the stand-alone object + -- itself would be finalized by means of a dispatching call to the + -- Deep_Finalize routine. + + if Nkind (Expr_Q) = N_Function_Call + and then not Special_Ret_Obj + and then not Is_Library_Level_Entity (Def_Id) + and then Is_Class_Wide_Type (Typ) + then + Remove_Side_Effects (Expr_Q); + end if; + -- In most cases, we must check that the initial value meets any -- constraint imposed by the declared type. However, there is one -- very important exception to this rule. If the entity has an -- cgit v1.1 From 9cfa7d7e3c3d7144a7b6079e7dc65a38a5327e70 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 13 Jan 2023 00:55:51 +0100 Subject: ada: Fix latent bug exposed by recent work on extended return statements When the type of the return object is a constrained array, there may be an implicit sliding that needs to be preserved during the expansion. gcc/ada/ * exp_ch3.adb (Make_Allocator_For_Return): Convert the expression to the return object's type in the constrained array case as well. --- gcc/ada/exp_ch3.adb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 6886bde..daa96df 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -7181,11 +7181,13 @@ package body Exp_Ch3 is Alloc_Expr := New_Copy_Tree (Expr); + -- In the constrained array case, deal with a potential sliding. -- In the interface case, put back a conversion that we may have - -- remove earlier in the processing. + -- removed earlier in the processing. - if Is_Interface (Typ) - and then Is_Class_Wide_Type (Etype (Alloc_Expr)) + if (Ekind (Typ) = E_Array_Subtype + or else (Is_Interface (Typ) + and then Is_Class_Wide_Type (Etype (Alloc_Expr)))) and then Typ /= Etype (Alloc_Expr) then Alloc_Expr := Convert_To (Typ, Alloc_Expr); -- cgit v1.1 From fe67b75f59c64a9b7cd3b997d406b986c2095cf6 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 13 Jan 2023 08:53:06 +0100 Subject: ada: Fix typo in comment gcc/ada/ * exp_ch3.adb (Make_Allocator_For_Return): Fix typo in comment. --- gcc/ada/exp_ch3.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index daa96df..abe71b2 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -7196,7 +7196,7 @@ package body Exp_Ch3 is -- We always use the type of the expression for the qualified -- expression, rather than the return object's type. We cannot -- always use the return object's type because the expression - -- might be of a specific type and the result object mignt not. + -- might be of a specific type and the return object mignt not. Alloc := Make_Allocator (Loc, -- cgit v1.1 From b22634281fff352fcf71dd4fbbf6e6fcbc9a46cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Date: Thu, 5 Jan 2023 11:38:43 +0100 Subject: ada: Update copyright years. gcc/ada/ * gcc-interface/Make-lang.in: Update copyright years. * gcc-interface/Makefile.in: Likewise. * gcc-interface/ada-builtin-types.def: Likewise. * gcc-interface/ada-builtins.def: Likewise. * gcc-interface/ada-tree.def: Likewise. * gcc-interface/ada-tree.h: Likewise. * gcc-interface/ada.h: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/cuintp.cc: Likewise. * gcc-interface/decl.cc: Likewise. * gcc-interface/gadaint.h: Likewise. * gcc-interface/gigi.h: Likewise. * gcc-interface/lang-specs.h: Likewise. * gcc-interface/lang.opt: Likewise. * gcc-interface/misc.cc: Likewise. * gcc-interface/system.ads: Likewise. * gcc-interface/targtyps.cc: Likewise. * gcc-interface/trans.cc: Likewise. * gcc-interface/utils.cc: Likewise. * gcc-interface/utils2.cc: Likewise. --- gcc/ada/gcc-interface/Make-lang.in | 4 +--- gcc/ada/gcc-interface/Makefile.in | 2 +- gcc/ada/gcc-interface/ada-builtin-types.def | 2 +- gcc/ada/gcc-interface/ada-builtins.def | 2 +- gcc/ada/gcc-interface/ada-tree.def | 2 +- gcc/ada/gcc-interface/ada-tree.h | 2 +- gcc/ada/gcc-interface/ada.h | 2 +- gcc/ada/gcc-interface/config-lang.in | 2 +- gcc/ada/gcc-interface/cuintp.cc | 2 +- gcc/ada/gcc-interface/decl.cc | 2 +- gcc/ada/gcc-interface/gadaint.h | 2 +- gcc/ada/gcc-interface/gigi.h | 2 +- gcc/ada/gcc-interface/lang-specs.h | 2 +- gcc/ada/gcc-interface/lang.opt | 2 +- gcc/ada/gcc-interface/misc.cc | 2 +- gcc/ada/gcc-interface/system.ads | 2 +- gcc/ada/gcc-interface/targtyps.cc | 2 +- gcc/ada/gcc-interface/trans.cc | 2 +- gcc/ada/gcc-interface/utils.cc | 2 +- gcc/ada/gcc-interface/utils2.cc | 2 +- 20 files changed, 20 insertions(+), 22 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index c81daae..9507f2f 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -1,7 +1,5 @@ # Top level -*- makefile -*- fragment for GNU Ada (GNAT). -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 -# Free Software Foundation, Inc. +# Copyright (C) 2009-2023 Free Software Foundation, Inc. #This file is part of GCC. diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in index 5137eba..da6a56f 100644 --- a/gcc/ada/gcc-interface/Makefile.in +++ b/gcc/ada/gcc-interface/Makefile.in @@ -1,5 +1,5 @@ # Makefile for GNU Ada Compiler (GNAT). -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2023 Free Software Foundation, Inc. #This file is part of GCC. diff --git a/gcc/ada/gcc-interface/ada-builtin-types.def b/gcc/ada/gcc-interface/ada-builtin-types.def index 000d429..b8925f5 100644 --- a/gcc/ada/gcc-interface/ada-builtin-types.def +++ b/gcc/ada/gcc-interface/ada-builtin-types.def @@ -1,7 +1,7 @@ /* This file contains the type definitions for the builtins exclusively used in the GNU Ada compiler. - Copyright (C) 2019-2022 Free Software Foundation, Inc. + Copyright (C) 2019-2023 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/ada/gcc-interface/ada-builtins.def b/gcc/ada/gcc-interface/ada-builtins.def index 8ba89a8..cf3d6a1 100644 --- a/gcc/ada/gcc-interface/ada-builtins.def +++ b/gcc/ada/gcc-interface/ada-builtins.def @@ -1,7 +1,7 @@ /* This file contains the definitions for the builtins exclusively used in the GNU Ada compiler. - Copyright (C) 2019-2022 Free Software Foundation, Inc. + Copyright (C) 2019-2023 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/ada/gcc-interface/ada-tree.def b/gcc/ada/gcc-interface/ada-tree.def index 7fc95cb..ff88e54 100644 --- a/gcc/ada/gcc-interface/ada-tree.def +++ b/gcc/ada/gcc-interface/ada-tree.def @@ -6,7 +6,7 @@ * * * Specification * * * - * Copyright (C) 1992-2009, Free Software Foundation, Inc. * + * Copyright (C) 1992-2023, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * diff --git a/gcc/ada/gcc-interface/ada-tree.h b/gcc/ada/gcc-interface/ada-tree.h index 6d9639d..d0acf1d 100644 --- a/gcc/ada/gcc-interface/ada-tree.h +++ b/gcc/ada/gcc-interface/ada-tree.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 1992-2022, Free Software Foundation, Inc. * + * Copyright (C) 1992-2023, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * diff --git a/gcc/ada/gcc-interface/ada.h b/gcc/ada/gcc-interface/ada.h index d9efb63..45b5bd9 100644 --- a/gcc/ada/gcc-interface/ada.h +++ b/gcc/ada/gcc-interface/ada.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 1992-2022, Free Software Foundation, Inc. * + * Copyright (C) 1992-2023, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * diff --git a/gcc/ada/gcc-interface/config-lang.in b/gcc/ada/gcc-interface/config-lang.in index 5f72977..85c1f42 100644 --- a/gcc/ada/gcc-interface/config-lang.in +++ b/gcc/ada/gcc-interface/config-lang.in @@ -1,5 +1,5 @@ # Top level configure fragment for GNU Ada (GNAT). -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2023 Free Software Foundation, Inc. #This file is part of GCC. diff --git a/gcc/ada/gcc-interface/cuintp.cc b/gcc/ada/gcc-interface/cuintp.cc index abf8d46..117d417 100644 --- a/gcc/ada/gcc-interface/cuintp.cc +++ b/gcc/ada/gcc-interface/cuintp.cc @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2021, Free Software Foundation, Inc. * + * Copyright (C) 1992-2023, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index c383f9b..d24adf3 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2022, Free Software Foundation, Inc. * + * Copyright (C) 1992-2023, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * diff --git a/gcc/ada/gcc-interface/gadaint.h b/gcc/ada/gcc-interface/gadaint.h index ac80eeb..5dccab6 100644 --- a/gcc/ada/gcc-interface/gadaint.h +++ b/gcc/ada/gcc-interface/gadaint.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 2010-2022, Free Software Foundation, Inc. * + * Copyright (C) 2010-2023, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h index 82e2403..fee0450 100644 --- a/gcc/ada/gcc-interface/gigi.h +++ b/gcc/ada/gcc-interface/gigi.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 1992-2022, Free Software Foundation, Inc. * + * Copyright (C) 1992-2023, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * diff --git a/gcc/ada/gcc-interface/lang-specs.h b/gcc/ada/gcc-interface/lang-specs.h index 6c260a0..92d311a 100644 --- a/gcc/ada/gcc-interface/lang-specs.h +++ b/gcc/ada/gcc-interface/lang-specs.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 1992-2022, Free Software Foundation, Inc. * + * Copyright (C) 1992-2023, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * diff --git a/gcc/ada/gcc-interface/lang.opt b/gcc/ada/gcc-interface/lang.opt index 379157c..248bb4c 100644 --- a/gcc/ada/gcc-interface/lang.opt +++ b/gcc/ada/gcc-interface/lang.opt @@ -1,5 +1,5 @@ ; Options for the Ada front end. -; Copyright (C) 2003-2015 Free Software Foundation, Inc. +; Copyright (C) 2003-2023 Free Software Foundation, Inc. ; ; This file is part of GCC. ; diff --git a/gcc/ada/gcc-interface/misc.cc b/gcc/ada/gcc-interface/misc.cc index e1b5a43..b18ca8c 100644 --- a/gcc/ada/gcc-interface/misc.cc +++ b/gcc/ada/gcc-interface/misc.cc @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2021, Free Software Foundation, Inc. * + * Copyright (C) 1992-2023, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * diff --git a/gcc/ada/gcc-interface/system.ads b/gcc/ada/gcc-interface/system.ads index cfd9bb9..5fc8e86 100644 --- a/gcc/ada/gcc-interface/system.ads +++ b/gcc/ada/gcc-interface/system.ads @@ -7,7 +7,7 @@ -- S p e c -- -- (Compiler Version) -- -- -- --- Copyright (C) 1992-2021, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2023, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- diff --git a/gcc/ada/gcc-interface/targtyps.cc b/gcc/ada/gcc-interface/targtyps.cc index 84949e3..c3f91c4 100644 --- a/gcc/ada/gcc-interface/targtyps.cc +++ b/gcc/ada/gcc-interface/targtyps.cc @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2021, Free Software Foundation, Inc. * + * Copyright (C) 1992-2023, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index 6579ad1..28e3867 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2022, Free Software Foundation, Inc. * + * Copyright (C) 1992-2023, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc index 5942de1..392ec0b 100644 --- a/gcc/ada/gcc-interface/utils.cc +++ b/gcc/ada/gcc-interface/utils.cc @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2022, Free Software Foundation, Inc. * + * Copyright (C) 1992-2023, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc index 80d550c..6c17675 100644 --- a/gcc/ada/gcc-interface/utils2.cc +++ b/gcc/ada/gcc-interface/utils2.cc @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2022, Free Software Foundation, Inc. * + * Copyright (C) 1992-2023, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * -- cgit v1.1 From b1f30bf42d8d47228e52de998f3172b2f5dd7265 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Mon, 16 Jan 2023 18:14:45 +0100 Subject: Fix wrong code issues with ipa-sra Fix wrong code issues in ipa-sra where we are trying to prove that on every execution of a given function a call to other function will happen. The code uses post dominators and makes a wrong query (which passes only for first BB in function). Hoever post-dominators are only valid if fake edges for every possible reason for fuction execution to terminate are added. Fixing this using postdominators is somewhat costy since one needs to walk whole body and add a lot of fake edges. I ended up implementing a special purpose function for this which is also useful in ipa-modref and other places that does similar analysis. One does not need to modify CFG to use it and moreover for complex functions it usually stops on first unanalyzed function call and ends up being relatively cheap. Bootstrapped/regtested x86_64-linux, plan to commit it shortly. gcc/ChangeLog: 2023-01-16 Jan Hubicka PR ipa/106077 * ipa-modref.cc (modref_access_analysis::analyze): Use find_always_executed_bbs. * ipa-sra.cc (process_scan_results): Likewise. * ipa-utils.cc (stmt_may_terminate_function_p): New function. (find_always_executed_bbs): New function. * ipa-utils.h (stmt_may_terminate_function_p): Declare. (find_always_executed_bbs): Declare. gcc/testsuite/ChangeLog: 2023-01-16 Jan Hubicka * g++.dg/tree-ssa/pr106077.C: New test. --- gcc/ipa-modref.cc | 5 +- gcc/ipa-sra.cc | 52 +++++--- gcc/ipa-utils.cc | 222 +++++++++++++++++++++++++++++++ gcc/ipa-utils.h | 2 + gcc/testsuite/g++.dg/tree-ssa/pr106077.C | 22 +++ 5 files changed, 285 insertions(+), 18 deletions(-) create mode 100644 gcc/testsuite/g++.dg/tree-ssa/pr106077.C (limited to 'gcc') diff --git a/gcc/ipa-modref.cc b/gcc/ipa-modref.cc index 16e8bfb..e3196df 100644 --- a/gcc/ipa-modref.cc +++ b/gcc/ipa-modref.cc @@ -1875,11 +1875,11 @@ modref_access_analysis::analyze () statement cannot be analyzed (for any reason), the entire function cannot be analyzed by modref. */ basic_block bb; + bitmap always_executed_bbs = find_always_executed_bbs (cfun, true); FOR_EACH_BB_FN (bb, cfun) { gimple_stmt_iterator si; - bool always_executed - = bb == single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun))->dest; + bool always_executed = bitmap_bit_p (always_executed_bbs, bb->index); for (si = gsi_start_nondebug_after_labels_bb (bb); !gsi_end_p (si); gsi_next_nondebug (&si)) @@ -1926,6 +1926,7 @@ modref_access_analysis::analyze () && !finite_function_p ()) m_summary_lto->side_effects = true; } + BITMAP_FREE (always_executed_bbs); } /* Return true if OP accesses memory pointed to by SSA_NAME. */ diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc index 4d7c25c..81b7591 100644 --- a/gcc/ipa-sra.cc +++ b/gcc/ipa-sra.cc @@ -2529,7 +2529,8 @@ process_scan_results (cgraph_node *node, struct function *fun, TODO: Measure the overhead and the effect of just being pessimistic. Maybe this is only -O3 material? */ - bool pdoms_calculated = false; + hash_map analyzed_stmts; + bitmap always_executed_bbs = NULL; if (check_pass_throughs) for (cgraph_edge *cs = node->callees; cs; cs = cs->next_callee) { @@ -2566,27 +2567,46 @@ process_scan_results (cgraph_node *node, struct function *fun, continue; } - /* Post-dominator check placed last, hoping that it usually won't - be needed. */ - if (!pdoms_calculated) + /* Walk basic block and see if its execution can terminate earlier. + Keep the info for later re-use to avoid quadratic behavoiur here. */ + gimple_stmt_iterator gsi = gsi_for_stmt (call_stmt); + bool safe = true; + int n = 0; + for (gsi_prev (&gsi); !gsi_end_p (gsi); gsi_prev (&gsi)) { - gcc_checking_assert (cfun); - connect_infinite_loops_to_exit (); - calculate_dominance_info (CDI_POST_DOMINATORS); - pdoms_calculated = true; + bool *b = analyzed_stmts.get (gsi_stmt (gsi)); + if (b) + { + safe = *b; + gsi_next (&gsi); + break; + } + n++; + if (stmt_may_terminate_function_p (fun, gsi_stmt (gsi), false)) + { + safe = false; + break; + } } - if (dominated_by_p (CDI_POST_DOMINATORS, - gimple_bb (call_stmt), - single_succ (ENTRY_BLOCK_PTR_FOR_FN (fun)))) + if (n) + { + if (gsi_end_p (gsi)) + gsi = gsi_start_bb (gimple_bb (call_stmt)); + for (; gsi_stmt (gsi) != call_stmt; gsi_next (&gsi)) + analyzed_stmts.get_or_insert (gsi_stmt (gsi)) = safe; + } + + if (safe && !always_executed_bbs) + { + mark_dfs_back_edges (); + always_executed_bbs = find_always_executed_bbs (fun, false); + } + if (safe && bitmap_bit_p (always_executed_bbs, gimple_bb (call_stmt)->index)) csum->m_arg_flow[argidx].safe_to_import_accesses = true; } } - if (pdoms_calculated) - { - free_dominance_info (CDI_POST_DOMINATORS); - remove_fake_exit_edges (); - } + BITMAP_FREE (always_executed_bbs); /* TODO: Add early exit if we disqualified everything. This also requires that we either relax the restriction that diff --git a/gcc/ipa-utils.cc b/gcc/ipa-utils.cc index 163899a..3d56333 100644 --- a/gcc/ipa-utils.cc +++ b/gcc/ipa-utils.cc @@ -35,6 +35,11 @@ along with GCC; see the file COPYING3. If not see #include "tree-vrp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" +#include "tree-eh.h" +#include "gimple-iterator.h" +#include "ipa-modref-tree.h" +#include "ipa-modref.h" +#include "tree-ssa-loop-niter.h" /* Debugging function for postorder and inorder code. NOTE is a string that is printed before the nodes are printed. ORDER is an array of @@ -781,3 +786,220 @@ recursive_call_p (tree func, tree dest) return false; return true; } + +/* Return true if stmt may terminate execution of function. + If assume_return_or_eh we can further assume that the function ends + either by retrn statement or EH (no trapping or infinite loops). */ + +bool +stmt_may_terminate_function_p (function *fun, gimple *stmt, bool assume_return_or_eh) +{ + if (stmt_can_throw_external (fun, stmt)) + return true; + gasm *astmt = dyn_cast (stmt); + if (astmt && gimple_asm_volatile_p (astmt)) + return true; + if (assume_return_or_eh) + return false; + if (gimple_could_trap_p (stmt)) + return true; + if (gcall *call = dyn_cast (stmt)) + { + int flags = gimple_call_flags (call); + if (flags & (ECF_PURE | ECF_CONST) && ! (flags & ECF_LOOPING_CONST_OR_PURE)) + return false; + modref_summary *s = get_modref_function_summary (call, NULL); + if (s && !s->side_effects) + return false; + return true; + } + return false; +} + +/* Return bitmap of all basic blocks whose first statements are known to + execute on every invocation of the function. + + If assume_return_or_eh we can further assume that the function ends + either by retrn statement or EH (no trapping or infinite loops). + This is useful when sumarizing function in passes like ipa-modref. + + Seeing assume_return_or_eh to false is used to prove that given + statmeent will be executed even if the function gets into infinite + loop or trap. */ +bitmap +find_always_executed_bbs (function *fun, bool assume_return_or_eh) +{ + auto_vec stack; + auto_vec terminating_bbs; + hash_set visited; + edge e; + edge_iterator ei; + + /* First walk all BBs reachable from entry stopping on statements that may + terminate execution. Everything past this statement is not going to be executed + each invocation. */ + stack.safe_push (ENTRY_BLOCK_PTR_FOR_FN (fun)); + while (!stack.is_empty ()) + { + basic_block bb = stack.pop (); + bool found = false, found_exit = false; + if (!assume_return_or_eh + && (EDGE_COUNT (bb->succs) == 0 || (bb->flags & BB_IRREDUCIBLE_LOOP))) + found = true; + FOR_EACH_EDGE (e, ei, bb->succs) + { + if (e->dest == EXIT_BLOCK_PTR_FOR_FN (fun)) + { + found_exit = true; + break; + } + /* Watch for infinite loops. */ + if (!found && (assume_return_or_eh & EDGE_DFS_BACK) + && !finite_loop_p (e->src->loop_father)) + found = true; + } + for (gimple_stmt_iterator si = gsi_start_nondebug_after_labels_bb (bb); + !gsi_end_p (si) && !found; gsi_next_nondebug (&si)) + if (stmt_may_terminate_function_p (fun, gsi_stmt (si), assume_return_or_eh)) + { + found = true; + break; + } + if (found) + { + visited.add (EXIT_BLOCK_PTR_FOR_FN (fun)); + if (!found_exit) + terminating_bbs.safe_push (bb); + } + else + FOR_EACH_EDGE (e, ei, bb->succs) + if (!visited.add (e->dest)) + stack.safe_push (e->dest); + } + + /* Next walk from exit block and find all articulations in the CFG. + Add all terminating basic blocks as "fake" predecessors of the + exit block. */ + + bitmap ret = BITMAP_ALLOC (NULL); + /* A degenerated case when there is no path to exit. */ + if (!visited.contains (EXIT_BLOCK_PTR_FOR_FN (fun)) + && terminating_bbs.is_empty ()) + { + bitmap_set_bit (ret, + single_succ_edge + (ENTRY_BLOCK_PTR_FOR_FN (fun))->dest->index); + return ret; + } + + struct astate + { + unsigned int dfs_preorder; + unsigned int dfs_postorder; + + unsigned int low, high; + }; + + struct worklist + { + basic_block bb; + astate *cstate; + }; + + struct obstack state_obstack; + gcc_obstack_init (&state_obstack); + hash_map state; + auto_vec worklist_vec; + unsigned int next_dfs_num = 1; + + /* Always executed blocks are blocks that are on every path from entry to exit. + We proceed in two steps. First we do backward DFS walk (so we know that entry + is always reached) and record preorder and postorder visiting times. + + In second step we proceed in postorder and for every block A we compute + minimal preorder (A.low) and maximal postorder (A.high) of block reachable + from the BBs in DFS subtree of A. If A is always executed there are no + edges out of this subtree. This can be tested by checking that A.low == A.preorder + and B.high == A.postorder. + + This is first step. Do backward DFS walk and record preorder, postorder + and predecessor info. Initialize stack in postorder. */ + worklist we = {EXIT_BLOCK_PTR_FOR_FN (fun), NULL}; + worklist_vec.safe_push (we); + while (!worklist_vec.is_empty ()) + { + worklist &w = worklist_vec.last (); + basic_block bb = w.bb; + astate *cstate = w.cstate; + + if (!cstate) + { + astate **slot = &state.get_or_insert (bb); + + cstate = *slot; + /* Already processed by DFS? */ + if (cstate) + { + worklist_vec.pop (); + continue; + } + /* DFS is visiting BB for first time. */ + *slot = cstate = XOBNEW (&state_obstack, struct astate); + cstate->low = cstate->dfs_preorder = next_dfs_num++; + w.cstate = cstate; + /* Exit block is special; process all fake edges we identified. */ + if (bb == EXIT_BLOCK_PTR_FOR_FN (fun)) + for (basic_block bb2 : terminating_bbs) + { + worklist we = {bb2, NULL}; + worklist_vec.safe_push (we); + } + FOR_EACH_EDGE (e, ei, bb->preds) + if (visited.contains (e->src)) + { + worklist we = {e->src, NULL}; + worklist_vec.safe_push (we); + } + /* Keep BB on worklist so we process it last time. */ + continue; + } + /* We are finished with processing reachable BBs, see if we have articulation. */ + worklist_vec.pop (); + cstate->high = cstate->dfs_postorder = next_dfs_num++; + stack.safe_push (bb); + } + /* This is the final postorder walk. Determine low and high values and mark + always executed blocks. */ + for (basic_block bb : stack) + { + astate *cstate = *state.get (bb); + FOR_EACH_EDGE (e, ei, bb->preds) + { + astate **cstate2 = state.get (e->src); + /* We skip walking part of CFG reached only after first edge to exit. + No BB reachable from the skipped part is always executed */ + if (!cstate2) + { + if (e->src != ENTRY_BLOCK_PTR_FOR_FN (fun)) + cstate->low = 0; + continue; + } + cstate->low = MIN (cstate->low, (*cstate2)->low); + cstate->high = MAX (cstate->high, (*cstate2)->high); + } + if (cstate->low == cstate->dfs_preorder && cstate->high == cstate->dfs_postorder + && bb != EXIT_BLOCK_PTR_FOR_FN (fun)) + bitmap_set_bit (ret, bb->index); + FOR_EACH_EDGE (e, ei, bb->succs) + { + astate **cstate2 = state.get (e->dest); + if (!cstate2) + continue; + cstate->low = MIN (cstate->low, (*cstate2)->low); + cstate->high = MAX (cstate->high, (*cstate2)->high); + } + } + obstack_free (&state_obstack, NULL); + + return ret; +} diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h index e7322e1..0eefcf4 100644 --- a/gcc/ipa-utils.h +++ b/gcc/ipa-utils.h @@ -46,6 +46,8 @@ tree get_base_var (tree); void ipa_merge_profiles (struct cgraph_node *dst, struct cgraph_node *src, bool preserve_body = false); bool recursive_call_p (tree, tree); +bool stmt_may_terminate_function_p (function *fun, gimple *stmt, bool assume_return_or_eh); +bitmap find_always_executed_bbs (function *fun, bool assume_return_or_eh); /* In ipa-pure-const.cc */ bool finite_function_p (); diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr106077.C b/gcc/testsuite/g++.dg/tree-ssa/pr106077.C new file mode 100644 index 0000000..2c2f729 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr106077.C @@ -0,0 +1,22 @@ +// { dg-do compile } +// { dg-options "-O2 -fno-ipa-cp -fdump-tree-optimized" } +short e,f; +static __attribute__ ((noinline)) +int a(int *b) +{ + return *b; +} +static __attribute__ ((noinline)) +__attribute__ ((optimize("non-call-exceptions"))) +int wrap(int *b,int e, int f) +{ + e/=f; + return a(b)+e; +} + +int +t() +{ + return wrap(0,1,0); +} +// { dg-final { scan-tree-dump-not "builtin_trap" "optimized" } } -- cgit v1.1 From a0c595386fa322e1874d33742fc56c6a0c13c4a5 Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Mon, 16 Jan 2023 18:09:04 +0000 Subject: Detect errors when dereferencing an undeclared variable. Attempting to dereference an undeclared variable will cause an ICE. Also attempting to pass an undeclared variable as an array of type will also cause an ICE. This patch detects both conditions and generates an appropriate error. gcc/m2/ChangeLog: * gm2-compiler/M2Quads.mod (AssignUnboundedVar): Check Type against NulSym and call MetaErrorT1 if necessary. (AssignUnboundedNonVar): Check Type against NulSym and call MetaErrorT1 if necessary. (BuildDesignatorPointer): Check Type1 against NulSym and call MetaErrorT1 if necessary. Signed-off-by: Gaius Mulley --- gcc/m2/gm2-compiler/M2Quads.mod | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/m2/gm2-compiler/M2Quads.mod b/gcc/m2/gm2-compiler/M2Quads.mod index 263fb7c..a58de93 100644 --- a/gcc/m2/gm2-compiler/M2Quads.mod +++ b/gcc/m2/gm2-compiler/M2Quads.mod @@ -6327,7 +6327,10 @@ BEGIN ELSIF IsVar(Sym) THEN Type := GetDType(Sym) ; - IF IsUnbounded(Type) + IF Type = NulSym + THEN + MetaErrorT1 (tok, '{%1ad} has no type and cannot be passed to a VAR formal parameter', Sym) + ELSIF IsUnbounded(Type) THEN IF Type = GetSType (UnboundedSym) THEN @@ -6382,7 +6385,10 @@ BEGIN ELSIF IsVar (Sym) THEN Type := GetDType (Sym) ; - IF IsUnbounded (Type) + IF Type = NulSym + THEN + MetaErrorT1 (tok, '{%1ad} has no type and cannot be passed to a non VAR formal parameter', Sym) + ELSIF IsUnbounded (Type) THEN UnboundedNonVarLinkToArray (tok, Sym, ArraySym, UnboundedSym, ParamType, dim) ELSIF IsArray (Type) OR IsGenericSystemType (ParamType) @@ -11386,7 +11392,10 @@ VAR BEGIN PopTFrwtok (Sym1, Type1, rw, exprtok) ; Type1 := SkipType (Type1) ; - IF IsUnknown (Sym1) + IF Type1 = NulSym + THEN + MetaErrorT1 (ptrtok, '{%1ad} has no type and therefore cannot be dereferenced by ^', Sym1) + ELSIF IsUnknown (Sym1) THEN MetaError1 ('{%1EMad} is undefined and therefore {%1ad}^ cannot be resolved', Sym1) ELSIF IsPointer (Type1) -- cgit v1.1 From 2bf9bbfe5b377003a29d6560d69baa605382b895 Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Mon, 16 Jan 2023 18:45:52 +0000 Subject: Remove YEAR const from mcOptions.mod and use result from time This patch removes the hard coded constant YEAR and replaces its use by a call to a new procedure function getYear. It also emits a GPL v3 boilerplate. gcc/m2/ChangeLog: * mc-boot-ch/Glibc.c (libc_time): New function. (libc_localtime): New function. * mc-boot/GDynamicStrings.c: Regenerate. * mc-boot/GFIO.c: Regenerate. * mc-boot/GFormatStrings.c: Regenerate. * mc-boot/GIndexing.c: Regenerate. * mc-boot/GM2Dependent.c: Regenerate. * mc-boot/GM2EXCEPTION.c: Regenerate. * mc-boot/GPushBackInput.c: Regenerate. * mc-boot/GRTExceptions.c: Regenerate. * mc-boot/GRTint.c: Regenerate. * mc-boot/GStdIO.c: Regenerate. * mc-boot/GStringConvert.c: Regenerate. * mc-boot/GSysStorage.c: Regenerate. * mc-boot/Gdecl.c: Regenerate. * mc-boot/GmcComment.c: Regenerate. * mc-boot/GmcComp.c: Regenerate. * mc-boot/GmcDebug.c: Regenerate. * mc-boot/GmcMetaError.c: Regenerate. * mc-boot/GmcOptions.c: Regenerate. * mc-boot/GmcStack.c: Regenerate. * mc-boot/GnameKey.c: Regenerate. * mc-boot/GsymbolKey.c: Regenerate. * mc-boot/Gkeyc.c: Regenerate. * mc/decl.mod (putFieldRecord): Change NulName to NulKey and fix type comparision. * mc/mcOptions.mod (YEAR): Remove. (getYear): New procedure function. (displayVersion): Use result from getYear instead of YEAR. Emit boilerplate for GPL v3. (gplBody): Use result from getYear instead of YEAR. (glplBody): Use result from getYear instead of YEAR. Signed-off-by: Gaius Mulley --- gcc/m2/mc-boot-ch/Glibc.c | 14 ++++ gcc/m2/mc-boot/GDynamicStrings.c | 32 ++++----- gcc/m2/mc-boot/GFIO.c | 14 ++-- gcc/m2/mc-boot/GFormatStrings.c | 2 +- gcc/m2/mc-boot/GIndexing.c | 6 +- gcc/m2/mc-boot/GM2Dependent.c | 47 +++++++++++- gcc/m2/mc-boot/GM2EXCEPTION.c | 4 +- gcc/m2/mc-boot/GPushBackInput.c | 6 +- gcc/m2/mc-boot/GRTExceptions.c | 34 ++++----- gcc/m2/mc-boot/GRTint.c | 20 +++--- gcc/m2/mc-boot/GStdIO.c | 4 +- gcc/m2/mc-boot/GStringConvert.c | 4 +- gcc/m2/mc-boot/GSysStorage.c | 6 +- gcc/m2/mc-boot/Gdecl.c | 152 +++++++++++++++++++-------------------- gcc/m2/mc-boot/Gkeyc.c | 2 +- gcc/m2/mc-boot/GmcComment.c | 2 +- gcc/m2/mc-boot/GmcComp.c | 4 +- gcc/m2/mc-boot/GmcDebug.c | 2 +- gcc/m2/mc-boot/GmcMetaError.c | 8 +-- gcc/m2/mc-boot/GmcOptions.c | 41 +++++++++-- gcc/m2/mc-boot/GmcStack.c | 4 +- gcc/m2/mc-boot/GnameKey.c | 4 +- gcc/m2/mc-boot/GsymbolKey.c | 6 +- gcc/m2/mc/decl.mod | 4 +- gcc/m2/mc/mcOptions.mod | 38 +++++++--- 25 files changed, 286 insertions(+), 174 deletions(-) (limited to 'gcc') diff --git a/gcc/m2/mc-boot-ch/Glibc.c b/gcc/m2/mc-boot-ch/Glibc.c index 3e9b486..7a37fef 100644 --- a/gcc/m2/mc-boot-ch/Glibc.c +++ b/gcc/m2/mc-boot-ch/Glibc.c @@ -78,6 +78,20 @@ libc_strlen (char *s) } EXTERN +time_t +libc_time (time_t *buf) +{ + return time (buf); +} + +EXTERN +void * +libc_localtime (time_t *epochtime) +{ + return localtime (epochtime); +} + +EXTERN int libc_printf (char *_format, unsigned int _format_high, ...) { diff --git a/gcc/m2/mc-boot/GDynamicStrings.c b/gcc/m2/mc-boot/GDynamicStrings.c index 372bbb5..6907b80 100644 --- a/gcc/m2/mc-boot/GDynamicStrings.c +++ b/gcc/m2/mc-boot/GDynamicStrings.c @@ -1214,7 +1214,7 @@ static void ConcatContents (DynamicStrings_Contents *c, const char *a_, unsigned (*c).next->contents.next = NULL; ConcatContents (&(*c).next->contents, (const char *) a, _a_high, h, o); AddDebugInfo ((*c).next); - (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 722, (const char *) "ConcatContents", 14); + (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 722, (const char *) "ConcatContents", 14); } else { @@ -1312,7 +1312,7 @@ static void ConcatContentsAddress (DynamicStrings_Contents *c, void * a, unsigne AddDebugInfo ((*c).next); if (TraceOn) { - (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 917, (const char *) "ConcatContentsAddress", 21); + (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 917, (const char *) "ConcatContentsAddress", 21); } } else @@ -1537,7 +1537,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitString (const char *a_, unsi AddDebugInfo (s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 758, (const char *) "InitString", 10); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 758, (const char *) "InitString", 10); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1640,7 +1640,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringCharStar (void * a) AddDebugInfo (s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 957, (const char *) "InitStringCharStar", 18); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 957, (const char *) "InitStringCharStar", 18); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1665,7 +1665,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringChar (char ch) s = DynamicStrings_InitString ((const char *) &a.array[0], 1); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 977, (const char *) "InitStringChar", 14); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 977, (const char *) "InitStringChar", 14); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1823,7 +1823,7 @@ extern "C" DynamicStrings_String DynamicStrings_Dup (DynamicStrings_String s) s = DynamicStrings_Assign (DynamicStrings_InitString ((const char *) "", 0), s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1173, (const char *) "Dup", 3); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1173, (const char *) "Dup", 3); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1845,7 +1845,7 @@ extern "C" DynamicStrings_String DynamicStrings_Add (DynamicStrings_String a, Dy a = DynamicStrings_ConCat (DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) "", 0), a), b); if (TraceOn) { - a = AssignDebug (a, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1193, (const char *) "Add", 3); + a = AssignDebug (a, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1193, (const char *) "Add", 3); } return a; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1920,7 +1920,7 @@ extern "C" unsigned int DynamicStrings_EqualCharStar (DynamicStrings_String s, v t = DynamicStrings_InitStringCharStar (a); if (TraceOn) { - t = AssignDebug (t, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1258, (const char *) "EqualCharStar", 13); + t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1258, (const char *) "EqualCharStar", 13); } t = AddToGarbage (t, s); if (DynamicStrings_Equal (t, s)) @@ -1958,7 +1958,7 @@ extern "C" unsigned int DynamicStrings_EqualArray (DynamicStrings_String s, cons t = DynamicStrings_InitString ((const char *) a, _a_high); if (TraceOn) { - t = AssignDebug (t, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1288, (const char *) "EqualArray", 10); + t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1288, (const char *) "EqualArray", 10); } t = AddToGarbage (t, s); if (DynamicStrings_Equal (t, s)) @@ -1996,7 +1996,7 @@ extern "C" DynamicStrings_String DynamicStrings_Mult (DynamicStrings_String s, u } if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1320, (const char *) "Mult", 4); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1320, (const char *) "Mult", 4); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2075,7 +2075,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s, AddDebugInfo (t->contents.next); if (TraceOn) { - t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1388, (const char *) "Slice", 5); + t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1388, (const char *) "Slice", 5); } } t = t->contents.next; @@ -2093,7 +2093,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s, } if (TraceOn) { - d = AssignDebug (d, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1405, (const char *) "Slice", 5); + d = AssignDebug (d, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1405, (const char *) "Slice", 5); } return d; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2221,7 +2221,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveComment (DynamicStrings_St } if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1517, (const char *) "RemoveComment", 13); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1517, (const char *) "RemoveComment", 13); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2246,7 +2246,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePrefix (DynamicString s = DynamicStrings_Slice (s, (int ) (i), 0); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1629, (const char *) "RemoveWhitePrefix", 17); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1629, (const char *) "RemoveWhitePrefix", 17); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2271,7 +2271,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePostfix (DynamicStrin s = DynamicStrings_Slice (s, 0, i+1); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1651, (const char *) "RemoveWhitePostfix", 18); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1651, (const char *) "RemoveWhitePostfix", 18); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2640,7 +2640,7 @@ extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (unsigned { stop (); /* writeString ("mismatched number of PopAllocation's compared to PushAllocation's") */ - M2RTS_Halt ((const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 176, (const char *) "PopAllocationExemption", 22, (const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65); + M2RTS_Halt ((const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 176, (const char *) "PopAllocationExemption", 22, (const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65); } else { diff --git a/gcc/m2/mc-boot/GFIO.c b/gcc/m2/mc-boot/GFIO.c index e4c2ce0..74cd858 100644 --- a/gcc/m2/mc-boot/GFIO.c +++ b/gcc/m2/mc-boot/GFIO.c @@ -555,7 +555,7 @@ static FIO_File GetNextFreeDescriptor (void) return f; /* create new slot */ } } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/FIO.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/FIO.def", 25, 1); __builtin_unreachable (); } @@ -1703,7 +1703,7 @@ extern "C" unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void * extern "C" void FIO_ReadAny (FIO_File f, unsigned char *a, unsigned int _a_high) { CheckAccess (f, FIO_openedforread, FALSE); - if ((BufferedRead (f, _a_high, a)) == _a_high) + if ((BufferedRead (f, _a_high, a)) == ((int ) (_a_high))) { SetEndOfLine (f, static_cast (a[_a_high])); } @@ -1762,7 +1762,7 @@ extern "C" unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void * extern "C" void FIO_WriteAny (FIO_File f, unsigned char *a, unsigned int _a_high) { CheckAccess (f, FIO_openedforwrite, TRUE); - if ((BufferedWrite (f, _a_high, a)) == _a_high) + if ((BufferedWrite (f, _a_high, a)) == ((int ) (_a_high))) {} /* empty. */ } @@ -1774,7 +1774,7 @@ extern "C" void FIO_WriteAny (FIO_File f, unsigned char *a, unsigned int _a_high extern "C" void FIO_WriteChar (FIO_File f, char ch) { CheckAccess (f, FIO_openedforwrite, TRUE); - if ((BufferedWrite (f, sizeof (ch), &ch)) == sizeof (ch)) + if ((BufferedWrite (f, sizeof (ch), &ch)) == ((int ) (sizeof (ch)))) {} /* empty. */ } @@ -1873,7 +1873,7 @@ extern "C" char FIO_ReadChar (FIO_File f) char ch; CheckAccess (f, FIO_openedforread, FALSE); - if ((BufferedRead (f, sizeof (ch), &ch)) == sizeof (ch)) + if ((BufferedRead (f, sizeof (ch), &ch)) == ((int ) (sizeof (ch)))) { SetEndOfLine (f, ch); return ch; @@ -2266,7 +2266,7 @@ extern "C" void * FIO_getFileName (FIO_File f) return fd->name.address; } } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/FIO.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/FIO.def", 25, 1); __builtin_unreachable (); } @@ -2293,7 +2293,7 @@ extern "C" unsigned int FIO_getFileNameLength (FIO_File f) return fd->name.size; } } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/FIO.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/FIO.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GFormatStrings.c b/gcc/m2/mc-boot/GFormatStrings.c index a0b91e2..7710c8a 100644 --- a/gcc/m2/mc-boot/GFormatStrings.c +++ b/gcc/m2/mc-boot/GFormatStrings.c @@ -545,7 +545,7 @@ static DynamicStrings_String HandlePercent (DynamicStrings_String fmt, DynamicSt int prevpos; DynamicStrings_String result; - if ((startpos == (DynamicStrings_Length (fmt))) || (startpos < 0)) + if ((startpos == ((int ) (DynamicStrings_Length (fmt)))) || (startpos < 0)) { return s; } diff --git a/gcc/m2/mc-boot/GIndexing.c b/gcc/m2/mc-boot/GIndexing.c index 1c31581..c809e4b 100644 --- a/gcc/m2/mc-boot/GIndexing.c +++ b/gcc/m2/mc-boot/GIndexing.c @@ -222,7 +222,7 @@ extern "C" unsigned int Indexing_InBounds (Indexing_Index i, unsigned int n) { return (n >= i->Low) && (n <= i->High); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/Indexing.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/Indexing.def", 20, 1); __builtin_unreachable (); } @@ -242,7 +242,7 @@ extern "C" unsigned int Indexing_HighIndice (Indexing_Index i) { return i->High; } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/Indexing.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/Indexing.def", 20, 1); __builtin_unreachable (); } @@ -262,7 +262,7 @@ extern "C" unsigned int Indexing_LowIndice (Indexing_Index i) { return i->Low; } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/Indexing.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/Indexing.def", 20, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GM2Dependent.c b/gcc/m2/mc-boot/GM2Dependent.c index 389da6a..b9c59cc 100644 --- a/gcc/m2/mc-boot/GM2Dependent.c +++ b/gcc/m2/mc-boot/GM2Dependent.c @@ -263,6 +263,13 @@ static void combine (M2Dependent_DependencyState src, M2Dependent_DependencyStat static void ForceDependencies (void); /* + CheckApplication - check to see that the application is the last entry in the list. + This might happen if the application only imports FOR C modules. +*/ + +static void CheckApplication (void); + +/* equal - return TRUE if C string cstr is equal to str. */ @@ -730,6 +737,7 @@ static void ResolveDependencies (void * currentmodule) static void DisplayModuleInfo (M2Dependent_DependencyState state, const char *name_, unsigned int _name_high) { M2Dependent_ModuleChain mptr; + unsigned int count; char name[_name_high+1]; /* make a local copy of each unbounded array. */ @@ -739,8 +747,10 @@ static void DisplayModuleInfo (M2Dependent_DependencyState state, const char *na { libc_printf ((const char *) "%s modules\\n", 12, &name); mptr = Modules.array[state-M2Dependent_unregistered]; + count = 0; do { - libc_printf ((const char *) " %s", 4, mptr->name); + libc_printf ((const char *) " %d %s", 8, count, mptr->name); + count += 1; if (mptr->dependency.appl) { libc_printf ((const char *) " application", 12); @@ -852,6 +862,38 @@ static void ForceDependencies (void) /* + CheckApplication - check to see that the application is the last entry in the list. + This might happen if the application only imports FOR C modules. +*/ + +static void CheckApplication (void) +{ + M2Dependent_ModuleChain mptr; + M2Dependent_ModuleChain appl; + + mptr = Modules.array[M2Dependent_ordered-M2Dependent_unregistered]; + if (mptr != NULL) + { + appl = NULL; + do { + if (mptr->dependency.appl) + { + appl = mptr; + } + else + { + mptr = mptr->next; + } + } while (! ((appl != NULL) || (mptr == Modules.array[M2Dependent_ordered-M2Dependent_unregistered]))); + if (appl != NULL) + { + Modules.array[M2Dependent_ordered-M2Dependent_unregistered] = appl->next; + } + } +} + + +/* equal - return TRUE if C string cstr is equal to str. */ @@ -1006,6 +1048,9 @@ extern "C" void M2Dependent_ConstructModules (void * applicationmodule, int argc ForceDependencies (); traceprintf (ForceTrace, (const char *) "After user forcing ordering\\n", 29); DumpModuleData (ForceTrace); + CheckApplication (); + traceprintf (ForceTrace, (const char *) "After runtime forces application to the end\\n", 45); + DumpModuleData (ForceTrace); if (Modules.array[M2Dependent_ordered-M2Dependent_unregistered] == NULL) { traceprintf2 (ModuleTrace, (const char *) " module: %s has not registered itself using a global constructor\\n", 67, applicationmodule); diff --git a/gcc/m2/mc-boot/GM2EXCEPTION.c b/gcc/m2/mc-boot/GM2EXCEPTION.c index 1339096..7915442 100644 --- a/gcc/m2/mc-boot/GM2EXCEPTION.c +++ b/gcc/m2/mc-boot/GM2EXCEPTION.c @@ -57,13 +57,13 @@ extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void) n = RTExceptions_GetNumber (e); if (n == (UINT_MAX)) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast (reinterpret_cast("M2Exception")), const_cast (reinterpret_cast("current coroutine is not in the exceptional execution state"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast (reinterpret_cast("M2Exception")), const_cast (reinterpret_cast("current coroutine is not in the exceptional execution state"))); } else { return (M2EXCEPTION_M2Exceptions) (n); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GPushBackInput.c b/gcc/m2/mc-boot/GPushBackInput.c index 1e75ede..6812343 100644 --- a/gcc/m2/mc-boot/GPushBackInput.c +++ b/gcc/m2/mc-boot/GPushBackInput.c @@ -274,7 +274,7 @@ extern "C" char PushBackInput_PutCh (char ch) } else { - Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, 150, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/PushBackInput.mod", 61); + Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, 150, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54); } return ch; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -300,7 +300,7 @@ extern "C" void PushBackInput_PutString (const char *a_, unsigned int _a_high) l -= 1; if ((PushBackInput_PutCh (a[l])) != a[l]) { - Debug_Halt ((const char *) "assert failed", 13, 132, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/PushBackInput.mod", 61); + Debug_Halt ((const char *) "assert failed", 13, 132, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54); } } } @@ -321,7 +321,7 @@ extern "C" void PushBackInput_PutStr (DynamicStrings_String s) i -= 1; if ((PushBackInput_PutCh (DynamicStrings_char (s, static_cast (i)))) != (DynamicStrings_char (s, static_cast (i)))) { - Debug_Halt ((const char *) "assert failed", 13, 113, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/PushBackInput.mod", 61); + Debug_Halt ((const char *) "assert failed", 13, 113, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54); } } } diff --git a/gcc/m2/mc-boot/GRTExceptions.c b/gcc/m2/mc-boot/GRTExceptions.c index 0ca1a18..a6aa806 100644 --- a/gcc/m2/mc-boot/GRTExceptions.c +++ b/gcc/m2/mc-boot/GRTExceptions.c @@ -719,7 +719,7 @@ static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h) static void indexf (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 612, 9, const_cast (reinterpret_cast("indexf")), const_cast (reinterpret_cast("array index out of bounds"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 612, 9, const_cast (reinterpret_cast("indexf")), const_cast (reinterpret_cast("array index out of bounds"))); } @@ -729,7 +729,7 @@ static void indexf (void * a) static void range (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 624, 9, const_cast (reinterpret_cast("range")), const_cast (reinterpret_cast("assignment out of range"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 624, 9, const_cast (reinterpret_cast("range")), const_cast (reinterpret_cast("assignment out of range"))); } @@ -739,7 +739,7 @@ static void range (void * a) static void casef (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 636, 9, const_cast (reinterpret_cast("casef")), const_cast (reinterpret_cast("case selector out of range"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 636, 9, const_cast (reinterpret_cast("casef")), const_cast (reinterpret_cast("case selector out of range"))); } @@ -749,7 +749,7 @@ static void casef (void * a) static void invalidloc (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 648, 9, const_cast (reinterpret_cast("invalidloc")), const_cast (reinterpret_cast("invalid address referenced"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 648, 9, const_cast (reinterpret_cast("invalidloc")), const_cast (reinterpret_cast("invalid address referenced"))); } @@ -759,7 +759,7 @@ static void invalidloc (void * a) static void function (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 660, 9, const_cast (reinterpret_cast("function")), const_cast (reinterpret_cast("... function ... "))); /* --fixme-- what has happened ? */ + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 660, 9, const_cast (reinterpret_cast("function")), const_cast (reinterpret_cast("... function ... "))); /* --fixme-- what has happened ? */ } @@ -769,7 +769,7 @@ static void function (void * a) static void wholevalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 672, 9, const_cast (reinterpret_cast("wholevalue")), const_cast (reinterpret_cast("illegal whole value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 672, 9, const_cast (reinterpret_cast("wholevalue")), const_cast (reinterpret_cast("illegal whole value exception"))); } @@ -779,7 +779,7 @@ static void wholevalue (void * a) static void wholediv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 684, 9, const_cast (reinterpret_cast("wholediv")), const_cast (reinterpret_cast("illegal whole value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 684, 9, const_cast (reinterpret_cast("wholediv")), const_cast (reinterpret_cast("illegal whole value exception"))); } @@ -789,7 +789,7 @@ static void wholediv (void * a) static void realvalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 696, 9, const_cast (reinterpret_cast("realvalue")), const_cast (reinterpret_cast("illegal real value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 696, 9, const_cast (reinterpret_cast("realvalue")), const_cast (reinterpret_cast("illegal real value exception"))); } @@ -799,7 +799,7 @@ static void realvalue (void * a) static void realdiv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 708, 9, const_cast (reinterpret_cast("realdiv")), const_cast (reinterpret_cast("real number division by zero exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 708, 9, const_cast (reinterpret_cast("realdiv")), const_cast (reinterpret_cast("real number division by zero exception"))); } @@ -809,7 +809,7 @@ static void realdiv (void * a) static void complexvalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 720, 9, const_cast (reinterpret_cast("complexvalue")), const_cast (reinterpret_cast("illegal complex value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 720, 9, const_cast (reinterpret_cast("complexvalue")), const_cast (reinterpret_cast("illegal complex value exception"))); } @@ -819,7 +819,7 @@ static void complexvalue (void * a) static void complexdiv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 732, 9, const_cast (reinterpret_cast("complexdiv")), const_cast (reinterpret_cast("complex number division by zero exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 732, 9, const_cast (reinterpret_cast("complexdiv")), const_cast (reinterpret_cast("complex number division by zero exception"))); } @@ -829,7 +829,7 @@ static void complexdiv (void * a) static void protection (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 744, 9, const_cast (reinterpret_cast("protection")), const_cast (reinterpret_cast("protection exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 744, 9, const_cast (reinterpret_cast("protection")), const_cast (reinterpret_cast("protection exception"))); } @@ -839,7 +839,7 @@ static void protection (void * a) static void systemf (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 756, 9, const_cast (reinterpret_cast("systemf")), const_cast (reinterpret_cast("system exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 756, 9, const_cast (reinterpret_cast("systemf")), const_cast (reinterpret_cast("system exception"))); } @@ -849,7 +849,7 @@ static void systemf (void * a) static void coroutine (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 768, 9, const_cast (reinterpret_cast("coroutine")), const_cast (reinterpret_cast("coroutine exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 768, 9, const_cast (reinterpret_cast("coroutine")), const_cast (reinterpret_cast("coroutine exception"))); } @@ -859,7 +859,7 @@ static void coroutine (void * a) static void exception (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 780, 9, const_cast (reinterpret_cast("exception")), const_cast (reinterpret_cast("exception exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 780, 9, const_cast (reinterpret_cast("exception")), const_cast (reinterpret_cast("exception exception"))); } @@ -1178,13 +1178,13 @@ extern "C" RTExceptions_EHBlock RTExceptions_GetBaseExceptionBlock (void) { if (currentEHB == NULL) { - M2RTS_Halt ((const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod", 60, 598, (const char *) "GetBaseExceptionBlock", 21, (const char *) "currentEHB has not been initialized yet", 39); + M2RTS_Halt ((const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod", 53, 598, (const char *) "GetBaseExceptionBlock", 21, (const char *) "currentEHB has not been initialized yet", 39); } else { return currentEHB; } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GRTint.c b/gcc/m2/mc-boot/GRTint.c index 00b0e6b..d8cac27 100644 --- a/gcc/m2/mc-boot/GRTint.c +++ b/gcc/m2/mc-boot/GRTint.c @@ -595,7 +595,7 @@ static unsigned int activatePending (unsigned int untilInterrupt, RTint_Dispatch default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTint.def", 25, 1); + CaseException ("../../gcc-read-write/gcc/m2/gm2-libs/RTint.def", 25, 1); __builtin_unreachable (); } v = v->pending; @@ -708,7 +708,7 @@ extern "C" unsigned int RTint_InitOutputVector (int fd, unsigned int pri) RTco_signal (lock); return v->no; } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTint.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/RTint.def", 25, 1); __builtin_unreachable (); } @@ -765,7 +765,7 @@ extern "C" void RTint_ReArmTimeVector (unsigned int vec, unsigned int micro, uns v = FindVectorNo (vec); if (v == NULL) { - M2RTS_Halt ((const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTint.mod", 53, 286, (const char *) "ReArmTimeVector", 15, (const char *) "cannot find vector supplied", 27); + M2RTS_Halt ((const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, 286, (const char *) "ReArmTimeVector", 15, (const char *) "cannot find vector supplied", 27); } else { @@ -790,7 +790,7 @@ extern "C" void RTint_GetTimeVector (unsigned int vec, unsigned int *micro, unsi v = FindVectorNo (vec); if (v == NULL) { - M2RTS_Halt ((const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTint.mod", 53, 312, (const char *) "GetTimeVector", 13, (const char *) "cannot find vector supplied", 27); + M2RTS_Halt ((const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, 312, (const char *) "GetTimeVector", 13, (const char *) "cannot find vector supplied", 27); } else { @@ -816,7 +816,7 @@ extern "C" void * RTint_AttachVector (unsigned int vec, void * p) v = FindVectorNo (vec); if (v == NULL) { - M2RTS_Halt ((const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTint.mod", 53, 339, (const char *) "AttachVector", 12, (const char *) "cannot find vector supplied", 27); + M2RTS_Halt ((const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, 339, (const char *) "AttachVector", 12, (const char *) "cannot find vector supplied", 27); } else { @@ -830,7 +830,7 @@ extern "C" void * RTint_AttachVector (unsigned int vec, void * p) RTco_signal (lock); return l; } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTint.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/RTint.def", 25, 1); __builtin_unreachable (); } @@ -855,7 +855,7 @@ extern "C" void RTint_IncludeVector (unsigned int vec) v = FindVectorNo (vec); if (v == NULL) { - M2RTS_Halt ((const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTint.mod", 53, 372, (const char *) "IncludeVector", 13, (const char *) "cannot find vector supplied", 27); + M2RTS_Halt ((const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, 372, (const char *) "IncludeVector", 13, (const char *) "cannot find vector supplied", 27); } else { @@ -902,7 +902,7 @@ extern "C" void RTint_ExcludeVector (unsigned int vec) v = FindPendingVector (vec); if (v == NULL) { - M2RTS_Halt ((const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTint.mod", 53, 415, (const char *) "ExcludeVector", 13, (const char *) "cannot find pending vector supplied", 35); + M2RTS_Halt ((const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, 415, (const char *) "ExcludeVector", 13, (const char *) "cannot find pending vector supplied", 35); } else { @@ -1003,7 +1003,7 @@ extern "C" void RTint_Listen (unsigned int untilInterrupt, RTint_DispatchVector default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTint.def", 25, 1); + CaseException ("../../gcc-read-write/gcc/m2/gm2-libs/RTint.def", 25, 1); __builtin_unreachable (); } v = v->pending; @@ -1016,7 +1016,7 @@ extern "C" void RTint_Listen (unsigned int untilInterrupt, RTint_DispatchVector } if (((untilInterrupt && (i == NULL)) && (o == NULL)) && ! found) { - M2RTS_Halt ((const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTint.mod", 53, 731, (const char *) "Listen", 6, (const char *) "deadlock found, no more processes to run and no interrupts active", 65); + M2RTS_Halt ((const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, 731, (const char *) "Listen", 6, (const char *) "deadlock found, no more processes to run and no interrupts active", 65); } /* printf('} ') ; */ diff --git a/gcc/m2/mc-boot/GStdIO.c b/gcc/m2/mc-boot/GStdIO.c index d3891c2..8bb03af 100644 --- a/gcc/m2/mc-boot/GStdIO.c +++ b/gcc/m2/mc-boot/GStdIO.c @@ -193,7 +193,7 @@ extern "C" StdIO_ProcWrite StdIO_GetCurrentOutput (void) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/StdIO.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/StdIO.def", 25, 1); __builtin_unreachable (); } @@ -252,7 +252,7 @@ extern "C" StdIO_ProcRead StdIO_GetCurrentInput (void) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/StdIO.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/StdIO.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GStringConvert.c b/gcc/m2/mc-boot/GStringConvert.c index 03b780e..8b87e0b 100644 --- a/gcc/m2/mc-boot/GStringConvert.c +++ b/gcc/m2/mc-boot/GStringConvert.c @@ -1916,7 +1916,7 @@ extern "C" DynamicStrings_String StringConvert_ToSigFig (DynamicStrings_String s int point; unsigned int poTen; - Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/StringConvert.mod", 61, 1222, (const char *) "ToSigFig", 8); + Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/StringConvert.mod", 54, 1222, (const char *) "ToSigFig", 8); point = DynamicStrings_Index (s, '.', 0); if (point < 0) { @@ -1968,7 +1968,7 @@ extern "C" DynamicStrings_String StringConvert_ToDecimalPlaces (DynamicStrings_S { int point; - Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/StringConvert.mod", 61, 1069, (const char *) "ToDecimalPlaces", 15); + Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/StringConvert.mod", 54, 1069, (const char *) "ToDecimalPlaces", 15); point = DynamicStrings_Index (s, '.', 0); if (point < 0) { diff --git a/gcc/m2/mc-boot/GSysStorage.c b/gcc/m2/mc-boot/GSysStorage.c index db79dd7..d5218fb 100644 --- a/gcc/m2/mc-boot/GSysStorage.c +++ b/gcc/m2/mc-boot/GSysStorage.c @@ -93,7 +93,7 @@ extern "C" void SysStorage_ALLOCATE (void * *a, unsigned int size) (*a) = libc_malloc (static_cast (size)); if ((*a) == NULL) { - Debug_Halt ((const char *) "out of memory error", 19, 50, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/SysStorage.mod", 58); + Debug_Halt ((const char *) "out of memory error", 19, 50, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51); } if (enableTrace && trace) { @@ -118,7 +118,7 @@ extern "C" void SysStorage_DEALLOCATE (void * *a, unsigned int size) } if ((libc_memset ((*a), 0, static_cast (size))) != (*a)) { - Debug_Halt ((const char *) "memset should have returned the first parameter", 47, 76, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/SysStorage.mod", 58); + Debug_Halt ((const char *) "memset should have returned the first parameter", 47, 76, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51); } } if (enableDeallocation) @@ -163,7 +163,7 @@ extern "C" void SysStorage_REALLOCATE (void * *a, unsigned int size) (*a) = libc_realloc ((*a), static_cast (size)); if ((*a) == NULL) { - Debug_Halt ((const char *) "out of memory error", 19, 119, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/SysStorage.mod", 58); + Debug_Halt ((const char *) "out of memory error", 19, 119, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51); } if (enableTrace && trace) { diff --git a/gcc/m2/mc-boot/Gdecl.c b/gcc/m2/mc-boot/Gdecl.c index 985444a..5a92e9a 100644 --- a/gcc/m2/mc-boot/Gdecl.c +++ b/gcc/m2/mc-boot/Gdecl.c @@ -56,6 +56,7 @@ typedef struct mcPretty_writeLnProc_p mcPretty_writeLnProc; typedef unsigned int FIO_File; extern FIO_File FIO_StdOut; +# define symbolKey_NulKey NULL typedef struct symbolKey_performOperation_p symbolKey_performOperation; # define ASCII_tab ASCII_ht @@ -76,7 +77,6 @@ typedef struct decl_isNodeF_p decl_isNodeF; # define SYSTEM_BYTESPERWORD 4 typedef struct M2RTS_ArgCVEnvP_p M2RTS_ArgCVEnvP; -# define symbolKey_NulKey NULL typedef struct symbolKey_isSymbol_p symbolKey_isSymbol; # define ASCII_nul (char) 000 @@ -295,12 +295,12 @@ typedef struct DynamicStrings_stringRecord_r DynamicStrings_stringRecord; typedef struct wlists__T9_r wlists__T9; -typedef struct mcPretty__T12_r mcPretty__T12; - typedef struct DynamicStrings_Contents_r DynamicStrings_Contents; typedef struct DynamicStrings__T7_a DynamicStrings__T7; +typedef struct mcPretty__T12_r mcPretty__T12; + typedef struct wlists__T10_a wlists__T10; typedef Indexing__T5 *Indexing_Index; @@ -836,6 +836,12 @@ struct wlists__T9_r { wlists_wlist next; }; +struct DynamicStrings_Contents_r { + DynamicStrings__T7 buf; + unsigned int len; + DynamicStrings_String next; + }; + struct mcPretty__T12_r { mcPretty_writeProc write_; mcPretty_writeLnProc writeln; @@ -848,12 +854,6 @@ struct mcPretty__T12_r { mcPretty_pretty stacked; }; -struct DynamicStrings_Contents_r { - DynamicStrings__T7 buf; - unsigned int len; - DynamicStrings_String next; - }; - typedef struct DynamicStrings_descriptor_r DynamicStrings_descriptor; typedef DynamicStrings_descriptor *DynamicStrings_Descriptor; @@ -6678,7 +6678,7 @@ static decl_node newNode (decl_nodeT k) d->at.firstUsed = 0; return d; } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -7038,7 +7038,7 @@ static decl_node addToScope (decl_node n) } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -7116,7 +7116,7 @@ static void setUnary (decl_node u, decl_nodeT k, decl_node a, decl_node t) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -7399,7 +7399,7 @@ static void putFieldVarient (decl_node f, decl_node v) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } switch (f->kind) @@ -7410,7 +7410,7 @@ static void putFieldVarient (decl_node f, decl_node v) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -7437,7 +7437,7 @@ static decl_node putFieldRecord (decl_node r, nameKey_Name tag, decl_node type, if (tag != nameKey_NulName) { /* avoid gcc warning by using compound statement even if not strictly necessary. */ - if ((symbolKey_getSymKey (r->recordF.localSymbols, tag)) == nameKey_NulName) + if ((symbolKey_getSymKey (r->recordF.localSymbols, tag)) == symbolKey_NulKey) { symbolKey_putSymKey (r->recordF.localSymbols, tag, reinterpret_cast (n)); } @@ -7461,7 +7461,7 @@ static decl_node putFieldRecord (decl_node r, nameKey_Name tag, decl_node type, default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* fill in, n. */ @@ -7519,7 +7519,7 @@ static void putVarientTag (decl_node v, decl_node tag) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -7543,7 +7543,7 @@ static decl_node getParent (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -7571,7 +7571,7 @@ static decl_node getRecord (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -7751,7 +7751,7 @@ static unsigned int getConstExpComplete (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -7856,7 +7856,7 @@ static decl_node makeVal (decl_node params) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -7877,7 +7877,7 @@ static decl_node makeCast (decl_node c, decl_node p) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -8387,7 +8387,7 @@ static decl_node makeUnary (decl_nodeT k, decl_node e, decl_node res) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -8481,7 +8481,7 @@ static DynamicStrings_String getStringContents (decl_node n) } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -8617,7 +8617,7 @@ static decl_node doMakeBinary (decl_nodeT k, decl_node l, decl_node r, decl_node default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } return n; @@ -9217,12 +9217,12 @@ static decl_node doGetExprType (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -9361,12 +9361,12 @@ static decl_node getSymScope (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -9678,7 +9678,7 @@ static unsigned int needsParen (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } return TRUE; @@ -9787,7 +9787,7 @@ static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -9813,7 +9813,7 @@ static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -10091,7 +10091,7 @@ static decl_node doGetLastOp (decl_node a, decl_node b) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -10731,7 +10731,7 @@ static void doExprC (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -10936,7 +10936,7 @@ static void doExprM2 (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -11108,7 +11108,7 @@ static DynamicStrings_String replaceChar (DynamicStrings_String s, char ch, cons return s; } } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -11168,7 +11168,7 @@ static unsigned int countChar (DynamicStrings_String s, char ch) return c; } } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -12227,7 +12227,7 @@ static decl_node doMin (decl_node n) M2RTS_HALT (-1); /* finish the cacading elsif statement. */ __builtin_unreachable (); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -12308,7 +12308,7 @@ static decl_node doMax (decl_node n) M2RTS_HALT (-1); /* finish the cacading elsif statement. */ __builtin_unreachable (); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -12597,7 +12597,7 @@ static void doBaseC (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } mcPretty_setNeedSpace (p); @@ -12687,7 +12687,7 @@ static void doSystemC (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -16041,7 +16041,7 @@ static void doCreal (mcPretty_pretty p, decl_node t) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -16072,7 +16072,7 @@ static void doCimag (mcPretty_pretty p, decl_node t) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -16203,7 +16203,7 @@ static void doIntrinsicC (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } outText (p, (const char *) ";", 1); @@ -17365,7 +17365,7 @@ static void dbs (decl_dependentState s, decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } if (n != NULL) @@ -18258,10 +18258,10 @@ static decl_dependentState doDependants (alists_alist l, decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -18358,7 +18358,7 @@ static void visitIntrinsicFunction (alists_alist v, decl_node n, decl_nodeProced default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -19357,7 +19357,7 @@ static void visitDependants (alists_alist v, decl_node n, decl_nodeProcedure p) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -19704,12 +19704,12 @@ static DynamicStrings_String genKind (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -20884,7 +20884,7 @@ static void doBaseM2 (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } mcPretty_setNeedSpace (p); @@ -20910,7 +20910,7 @@ static void doSystemM2 (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -22121,10 +22121,10 @@ static decl_node doDupExpr (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -22454,7 +22454,7 @@ extern "C" unsigned int decl_isVisited (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -22484,7 +22484,7 @@ extern "C" void decl_unsetVisited (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -22512,7 +22512,7 @@ extern "C" void decl_setVisited (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -22540,7 +22540,7 @@ extern "C" void decl_setEnumsComplete (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -22568,7 +22568,7 @@ extern "C" unsigned int decl_getEnumsComplete (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -22789,7 +22789,7 @@ extern "C" decl_node decl_lookupInScope (decl_node scope, nameKey_Name n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -23164,12 +23164,12 @@ extern "C" decl_node decl_getType (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -23563,7 +23563,7 @@ extern "C" decl_node decl_getScope (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -24218,7 +24218,7 @@ extern "C" decl_node decl_makeVarient (decl_node r) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } return n; @@ -24685,7 +24685,7 @@ extern "C" nameKey_Name decl_getSymName (decl_node n) __builtin_unreachable (); break; } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -24723,7 +24723,7 @@ extern "C" decl_node decl_import (decl_node m, decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } importEnumFields (m, n); @@ -24852,7 +24852,7 @@ extern "C" void decl_setSource (decl_node n, nameKey_Name s) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -24880,7 +24880,7 @@ extern "C" nameKey_Name decl_getSource (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -25323,7 +25323,7 @@ extern "C" void decl_addParameter (decl_node proc, decl_node param) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -25416,7 +25416,7 @@ extern "C" decl_node decl_makeBinaryTok (mcReserved_toktype op, decl_node l, dec M2RTS_HALT (-1); /* most likely op needs a clause as above. */ __builtin_unreachable (); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -25448,7 +25448,7 @@ extern "C" decl_node decl_makeUnaryTok (mcReserved_toktype op, decl_node e) M2RTS_HALT (-1); /* most likely op needs a clause as above. */ __builtin_unreachable (); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -25886,7 +25886,7 @@ extern "C" void decl_setConstExpComplete (decl_node n) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -26251,7 +26251,7 @@ extern "C" void decl_putBegin (decl_node b, decl_node s) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -26278,7 +26278,7 @@ extern "C" void decl_putFinally (decl_node b, decl_node s) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -26906,7 +26906,7 @@ extern "C" void decl_out (void) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } closeOutput (); diff --git a/gcc/m2/mc-boot/Gkeyc.c b/gcc/m2/mc-boot/Gkeyc.c index 1b2fb97..6f17ca5 100644 --- a/gcc/m2/mc-boot/Gkeyc.c +++ b/gcc/m2/mc-boot/Gkeyc.c @@ -908,7 +908,7 @@ static unsigned int mangleN (nameKey_Name n, DynamicStrings_String *m, unsigned return TRUE; } } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/keyc.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/keyc.def", 20, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GmcComment.c b/gcc/m2/mc-boot/GmcComment.c index 88f5de0..4dfad51 100644 --- a/gcc/m2/mc-boot/GmcComment.c +++ b/gcc/m2/mc-boot/GmcComment.c @@ -257,7 +257,7 @@ static void dumpComment (mcComment_commentDesc cd) default: - CaseException ("../../gcc-git-devel-modula2/gcc/m2/mc/mcComment.def", 20, 1); + CaseException ("../../gcc-read-write/gcc/m2/mc/mcComment.def", 20, 1); __builtin_unreachable (); } if (cd->used) diff --git a/gcc/m2/mc-boot/GmcComp.c b/gcc/m2/mc-boot/GmcComp.c index d633e79..e6b4e35 100644 --- a/gcc/m2/mc-boot/GmcComp.c +++ b/gcc/m2/mc-boot/GmcComp.c @@ -294,7 +294,7 @@ static decl_node examineCompilationUnit (void) } mcflex_mcError (DynamicStrings_string (DynamicStrings_InitString ((const char *) "failed to find module name", 26))); libc_exit (1); - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/mcComp.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/mcComp.def", 20, 1); __builtin_unreachable (); } @@ -324,7 +324,7 @@ static decl_node peepInto (DynamicStrings_String s) mcPrintf_fprintf1 (FIO_StdErr, (const char *) "failed to open %s\\n", 19, (const unsigned char *) &s, (sizeof (s)-1)); libc_exit (1); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/mcComp.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/mcComp.def", 20, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GmcDebug.c b/gcc/m2/mc-boot/GmcDebug.c index 3c47196..8cac40e 100644 --- a/gcc/m2/mc-boot/GmcDebug.c +++ b/gcc/m2/mc-boot/GmcDebug.c @@ -54,7 +54,7 @@ extern "C" void mcDebug_assert (unsigned int q) { if (! q) { - mcError_internalError ((const char *) "assert failed", 13, (const char *) "../../gcc-git-devel-modula2/gcc/m2/mc/mcDebug.mod", 49, 35); + mcError_internalError ((const char *) "assert failed", 13, (const char *) "../../gcc-read-write/gcc/m2/mc/mcDebug.mod", 42, 35); } } diff --git a/gcc/m2/mc-boot/GmcMetaError.c b/gcc/m2/mc-boot/GmcMetaError.c index 0c4aaf9..3073e62 100644 --- a/gcc/m2/mc-boot/GmcMetaError.c +++ b/gcc/m2/mc-boot/GmcMetaError.c @@ -408,7 +408,7 @@ static void internalFormat (DynamicStrings_String s, int i, const char *m_, unsi s = DynamicStrings_ConCatChar (s, '^'); s = SFIO_WriteS (FIO_StdOut, s); FIO_WriteLine (FIO_StdOut); - mcError_internalError ((const char *) m, _m_high, (const char *) "../../gcc-git-devel-modula2/gcc/m2/mc/mcMetaError.mod", 53, 97); + mcError_internalError ((const char *) m, _m_high, (const char *) "../../gcc-read-write/gcc/m2/mc/mcMetaError.mod", 46, 97); } @@ -420,7 +420,7 @@ static DynamicStrings_String x (DynamicStrings_String a, DynamicStrings_String b { if (a != b) { - mcError_internalError ((const char *) "different string returned", 25, (const char *) "../../gcc-git-devel-modula2/gcc/m2/mc/mcMetaError.mod", 53, 109); + mcError_internalError ((const char *) "different string returned", 25, (const char *) "../../gcc-read-write/gcc/m2/mc/mcMetaError.mod", 46, 109); } return a; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -734,7 +734,7 @@ static mcError_error doError (mcError_error e, mcMetaError_errorType t, unsigned case mcMetaError_chained: if (e == NULL) { - mcError_internalError ((const char *) "should not be chaining an error onto an empty error note", 56, (const char *) "../../gcc-git-devel-modula2/gcc/m2/mc/mcMetaError.mod", 53, 355); + mcError_internalError ((const char *) "should not be chaining an error onto an empty error note", 56, (const char *) "../../gcc-read-write/gcc/m2/mc/mcMetaError.mod", 46, 355); } else { @@ -758,7 +758,7 @@ static mcError_error doError (mcError_error e, mcMetaError_errorType t, unsigned default: - mcError_internalError ((const char *) "unexpected enumeration value", 28, (const char *) "../../gcc-git-devel-modula2/gcc/m2/mc/mcMetaError.mod", 53, 369); + mcError_internalError ((const char *) "unexpected enumeration value", 28, (const char *) "../../gcc-read-write/gcc/m2/mc/mcMetaError.mod", 46, 369); break; } return e; diff --git a/gcc/m2/mc-boot/GmcOptions.c b/gcc/m2/mc-boot/GmcOptions.c index 42717cf..3088ba4 100644 --- a/gcc/m2/mc-boot/GmcOptions.c +++ b/gcc/m2/mc-boot/GmcOptions.c @@ -50,7 +50,6 @@ Boston, MA 02110-1301, USA. */ # include "GFIO.h" # include "GSFIO.h" -# define YEAR "2021" static unsigned int langC; static unsigned int langCPP; static unsigned int langM2; @@ -172,6 +171,12 @@ extern "C" unsigned int mcOptions_getScaffoldMain (void); extern "C" void mcOptions_writeGPLheader (FIO_File f); /* + getYear - return the year. +*/ + +static unsigned int getYear (void); + +/* displayVersion - displays the version of the compiler. */ @@ -294,13 +299,33 @@ static void handleOption (DynamicStrings_String arg); /* + getYear - return the year. +*/ + +static unsigned int getYear (void) +{ + libc_time_t epoch; + libc_ptrToTM localTime; + + epoch = libc_time (NULL); + localTime = static_cast (libc_localtime (&epoch)); + return localTime->tm_year+1900; + /* static analysis guarentees a RETURN statement will be used before here. */ + __builtin_unreachable (); +} + + +/* displayVersion - displays the version of the compiler. */ static void displayVersion (unsigned int mustExit) { - mcPrintf_printf0 ((const char *) "Copyright (C) ''2021'' Free Software Foundation, Inc.\\n", 55); - mcPrintf_printf0 ((const char *) "License GPLv2: GNU GPL version 2 or later \\n", 78); + unsigned int year; + + year = getYear (); + mcPrintf_printf1 ((const char *) "Copyright (C) %d Free Software Foundation, Inc.\\n", 49, (const unsigned char *) &year, (sizeof (year)-1)); + mcPrintf_printf0 ((const char *) "License GPLv3: GNU GPL version 3 or later \\n", 78); mcPrintf_printf0 ((const char *) "This is free software: you are free to change and redistribute it.\\n", 68); mcPrintf_printf0 ((const char *) "There is NO WARRANTY, to the extent permitted by law.\\n", 55); if (mustExit) @@ -424,7 +449,10 @@ static void commentS (FIO_File f, DynamicStrings_String s) static void gplBody (FIO_File f) { - comment (f, (const char *) "Copyright (C) ''2021'' Free Software Foundation, Inc.", 53); + unsigned int year; + + year = getYear (); + mcPrintf_printf1 ((const char *) "Copyright (C) %d Free Software Foundation, Inc.\\n", 49, (const unsigned char *) &year, (sizeof (year)-1)); if (contributed) { FIO_WriteString (f, (const char *) "Contributed by ", 15); @@ -464,7 +492,10 @@ static void gplBody (FIO_File f) static void glplBody (FIO_File f) { - comment (f, (const char *) "Copyright (C) ''2021'' Free Software Foundation, Inc.", 53); + unsigned int year; + + year = getYear (); + mcPrintf_printf1 ((const char *) "Copyright (C) %d Free Software Foundation, Inc.\\n", 49, (const unsigned char *) &year, (sizeof (year)-1)); if (contributed) { FIO_WriteString (f, (const char *) "Contributed by ", 15); diff --git a/gcc/m2/mc-boot/GmcStack.c b/gcc/m2/mc-boot/GmcStack.c index 83fecda..a1f13d8 100644 --- a/gcc/m2/mc-boot/GmcStack.c +++ b/gcc/m2/mc-boot/GmcStack.c @@ -165,7 +165,7 @@ extern "C" void * mcStack_pop (mcStack_stack s) Indexing_DeleteIndice (s->list, Indexing_HighIndice (s->list)); return a; } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/mcStack.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/mcStack.def", 20, 1); __builtin_unreachable (); } @@ -215,7 +215,7 @@ extern "C" void * mcStack_access (mcStack_stack s, unsigned int i) { return Indexing_GetIndice (s->list, i); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/mcStack.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/mcStack.def", 20, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GnameKey.c b/gcc/m2/mc-boot/GnameKey.c index 22eac97..11cb6fa 100644 --- a/gcc/m2/mc-boot/GnameKey.c +++ b/gcc/m2/mc-boot/GnameKey.c @@ -323,7 +323,7 @@ extern "C" nameKey_Name nameKey_makeKey (const char *a_, unsigned int _a_high) (*p) = ASCII_nul; return doMakeKey (n, higha); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/nameKey.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/nameKey.def", 20, 1); __builtin_unreachable (); } @@ -373,7 +373,7 @@ extern "C" nameKey_Name nameKey_makekey (void * a) return doMakeKey (n, higha); } } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/mc/nameKey.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/mc/nameKey.def", 20, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GsymbolKey.c b/gcc/m2/mc-boot/GsymbolKey.c index 2f3295b..e72133e 100644 --- a/gcc/m2/mc-boot/GsymbolKey.c +++ b/gcc/m2/mc-boot/GsymbolKey.c @@ -142,7 +142,7 @@ static void findNodeAndParentInTree (symbolKey_symbolTree t, nameKey_Name n, sym (*father) = t; if (t == NULL) { - Debug_Halt ((const char *) "parameter t should never be NIL", 31, 203, (const char *) "../../gcc-git-devel-modula2/gcc/m2/mc/symbolKey.mod", 51); + Debug_Halt ((const char *) "parameter t should never be NIL", 31, 203, (const char *) "../../gcc-read-write/gcc/m2/mc/symbolKey.mod", 44); } (*child) = t->left; if ((*child) != NULL) @@ -285,7 +285,7 @@ extern "C" void symbolKey_putSymKey (symbolKey_symbolTree t, nameKey_Name name, } else { - Debug_Halt ((const char *) "symbol already stored", 21, 119, (const char *) "../../gcc-git-devel-modula2/gcc/m2/mc/symbolKey.mod", 51); + Debug_Halt ((const char *) "symbol already stored", 21, 119, (const char *) "../../gcc-read-write/gcc/m2/mc/symbolKey.mod", 44); } } @@ -352,7 +352,7 @@ extern "C" void symbolKey_delSymKey (symbolKey_symbolTree t, nameKey_Name name) } else { - Debug_Halt ((const char *) "trying to delete a symbol that is not in the tree - the compiler never expects this to occur", 92, 186, (const char *) "../../gcc-git-devel-modula2/gcc/m2/mc/symbolKey.mod", 51); + Debug_Halt ((const char *) "trying to delete a symbol that is not in the tree - the compiler never expects this to occur", 92, 186, (const char *) "../../gcc-read-write/gcc/m2/mc/symbolKey.mod", 44); } } diff --git a/gcc/m2/mc/decl.mod b/gcc/m2/mc/decl.mod index 738f66f..f6afd66 100644 --- a/gcc/m2/mc/decl.mod +++ b/gcc/m2/mc/decl.mod @@ -22,7 +22,7 @@ along with GNU Modula-2; see the file COPYING3. If not see IMPLEMENTATION MODULE decl ; (*!m2pim*) FROM ASCII IMPORT lf, tab ; -FROM symbolKey IMPORT symbolTree, initTree, getSymKey, putSymKey, foreachNodeDo ; +FROM symbolKey IMPORT NulKey, symbolTree, initTree, getSymKey, putSymKey, foreachNodeDo ; FROM mcDebug IMPORT assert ; FROM Storage IMPORT ALLOCATE, DEALLOCATE ; FROM nameKey IMPORT NulName, makeKey, lengthKey, makekey, keyToCharStar ; @@ -2936,7 +2936,7 @@ BEGIN (* ensure that field, n, is in the parents Local Symbols. *) IF tag#NulName THEN - IF getSymKey (recordF.localSymbols, tag) = NulName + IF getSymKey (recordF.localSymbols, tag) = NulKey THEN putSymKey (recordF.localSymbols, tag, n) ELSE diff --git a/gcc/m2/mc/mcOptions.mod b/gcc/m2/mc/mcOptions.mod index d84ce2b..3204b68 100644 --- a/gcc/m2/mc/mcOptions.mod +++ b/gcc/m2/mc/mcOptions.mod @@ -20,8 +20,8 @@ IMPLEMENTATION MODULE mcOptions ; FROM SArgs IMPORT GetArg, Narg ; FROM mcSearch IMPORT prependSearchPath ; -FROM libc IMPORT exit, printf ; -FROM mcPrintf IMPORT printf0 ; +FROM libc IMPORT exit, printf, time, localtime, time_t, ptrToTM ; +FROM mcPrintf IMPORT printf0, printf1 ; FROM Debug IMPORT Halt ; FROM StrLib IMPORT StrLen ; FROM decl IMPORT setLangC, setLangCP, setLangM2 ; @@ -33,9 +33,6 @@ FROM DynamicStrings IMPORT String, Length, InitString, Mark, Slice, EqualArray, IMPORT FIO ; IMPORT SFIO ; -CONST - YEAR = '2023' ; - VAR langC, langCPP, @@ -65,13 +62,32 @@ VAR cppProgram : String ; + +(* + getYear - return the year. +*) + +PROCEDURE getYear () : CARDINAL ; +VAR + epoch : time_t ; + localTime: ptrToTM ; +BEGIN + epoch := time (NIL) ; + localTime := localtime (epoch) ; + RETURN localTime^.tm_year + 1900 +END getYear ; + + (* displayVersion - displays the version of the compiler. *) PROCEDURE displayVersion (mustExit: BOOLEAN) ; +VAR + year: CARDINAL ; BEGIN - printf0 ('Copyright (C) ' + YEAR + ' Free Software Foundation, Inc.\n') ; + year := getYear () ; + printf1 ('Copyright (C) %d Free Software Foundation, Inc.\n', year) ; printf0 ('License GPLv3: GNU GPL version 3 or later \n') ; printf0 ('This is free software: you are free to change and redistribute it.\n') ; printf0 ('There is NO WARRANTY, to the extent permitted by law.\n') ; @@ -183,8 +199,11 @@ END commentS ; *) PROCEDURE gplBody (f: File) ; +VAR + year: CARDINAL ; BEGIN - comment (f, 'Copyright (C) ' + YEAR + ' Free Software Foundation, Inc.') ; + year := getYear () ; + printf1 ('Copyright (C) %d Free Software Foundation, Inc.\n', year) ; IF contributed THEN FIO.WriteString (f, "Contributed by ") ; @@ -222,8 +241,11 @@ END gplBody ; *) PROCEDURE glplBody (f: File) ; +VAR + year: CARDINAL ; BEGIN - comment (f, 'Copyright (C) ' + YEAR + ' Free Software Foundation, Inc.') ; + year := getYear () ; + printf1 ('Copyright (C) %d Free Software Foundation, Inc.\n', year) ; IF contributed THEN FIO.WriteString (f, "Contributed by ") ; -- cgit v1.1 From a396a123596d82d4a2f14dc43a382cb17826411c Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 16 Jan 2023 10:45:41 -0800 Subject: x86: Disable -mforce-indirect-call for PIC in 32-bit mode -mforce-indirect-call generates invalid instruction in 32-bit MI thunk since there are no available scratch registers in 32-bit PIC mode. Disable -mforce-indirect-call for PIC in 32-bit mode when generating MI thunk. gcc/ PR target/105980 * config/i386/i386.cc (x86_output_mi_thunk): Disable -mforce-indirect-call for PIC in 32-bit mode. gcc/testsuite/ PR target/105980 * g++.target/i386/pr105980.C: New test. --- gcc/config/i386/i386.cc | 6 ++++++ gcc/testsuite/g++.target/i386/pr105980.C | 8 ++++++++ 2 files changed, 14 insertions(+) create mode 100644 gcc/testsuite/g++.target/i386/pr105980.C (limited to 'gcc') diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 19fb03c..3cacf73 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -21480,6 +21480,7 @@ x86_output_mi_thunk (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta, rtx this_reg, tmp, fnaddr; unsigned int tmp_regno; rtx_insn *insn; + int saved_flag_force_indirect_call = flag_force_indirect_call; if (TARGET_64BIT) tmp_regno = R10_REG; @@ -21492,6 +21493,9 @@ x86_output_mi_thunk (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta, tmp_regno = DX_REG; else tmp_regno = CX_REG; + + if (flag_pic) + flag_force_indirect_call = 0; } emit_note (NOTE_INSN_PROLOGUE_END); @@ -21659,6 +21663,8 @@ x86_output_mi_thunk (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta, final (insn, file, 1); final_end_function (); assemble_end_function (thunk_fndecl, fnname); + + flag_force_indirect_call = saved_flag_force_indirect_call; } static void diff --git a/gcc/testsuite/g++.target/i386/pr105980.C b/gcc/testsuite/g++.target/i386/pr105980.C new file mode 100644 index 0000000..d8dbc33 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr105980.C @@ -0,0 +1,8 @@ +// { dg-do assemble { target { fpic } } } +// { dg-options "-O0 -fpic -mforce-indirect-call" } + +struct A { + virtual ~A(); +}; +struct B : virtual A {}; +void bar() { B(); } -- cgit v1.1 From 35627c5fb6a51e31ae651a0c79f0775f4290a86e Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Mon, 16 Jan 2023 23:53:33 +0000 Subject: Remove reference to Solaris 9 in comment of add_options_for_tls Since r5-172-gd9f069ab4f6450, the code no longer matches the comment as the code for Solaris 9 support was removed. This just updates the comment to reference AIX only as the code does. Committed as obvious. gcc/testsuite/ChangeLog: * lib/target-supports.exp (add_options_for_tls): Remove reference to Solaris 9 in comments. --- gcc/testsuite/lib/target-supports.exp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index b906d40..38b9514 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -869,8 +869,8 @@ proc check_effective_target_pcc_bitfield_type_matters { } { # Add to FLAGS all the target-specific flags needed to use thread-local storage. proc add_options_for_tls { flags } { - # On Solaris 9, __tls_get_addr/___tls_get_addr only lives in - # libthread, so always pass -pthread for native TLS. Same for AIX. + # On AIX, __tls_get_addr/___tls_get_addr only lives in + # libthread, so always pass -pthread for native TLS. # Need to duplicate native TLS check from # check_effective_target_tls_native to avoid recursion. if { ([istarget powerpc-ibm-aix*]) && -- cgit v1.1 From f457a62e63a86d5e5342eda16538a26355199856 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 17 Jan 2023 00:18:06 +0000 Subject: Daily bump. --- gcc/ChangeLog | 95 +++++++++++++++++++++++++++++++++++++++++++++++ gcc/DATESTAMP | 2 +- gcc/ada/ChangeLog | 98 +++++++++++++++++++++++++++++++++++++++++++++++++ gcc/c/ChangeLog | 7 ++++ gcc/cp/ChangeLog | 7 ++++ gcc/m2/ChangeLog | 49 +++++++++++++++++++++++++ gcc/testsuite/ChangeLog | 80 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 337 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e32d115..daddbdf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,98 @@ +2023-01-16 H.J. Lu + + PR target/105980 + * config/i386/i386.cc (x86_output_mi_thunk): Disable + -mforce-indirect-call for PIC in 32-bit mode. + +2023-01-16 Jan Hubicka + + PR ipa/106077 + * ipa-modref.cc (modref_access_analysis::analyze): Use + find_always_executed_bbs. + * ipa-sra.cc (process_scan_results): Likewise. + * ipa-utils.cc (stmt_may_terminate_function_p): New function. + (find_always_executed_bbs): New function. + * ipa-utils.h (stmt_may_terminate_function_p): Declare. + (find_always_executed_bbs): Declare. + +2023-01-16 Jan Hubicka + + * config/i386/i386.cc (ix86_vectorize_builtin_scatter): Guard scatter + by TARGET_USE_SCATTER. + * config/i386/i386.h (TARGET_USE_SCATTER_2PARTS, + TARGET_USE_SCATTER_4PARTS, TARGET_USE_SCATTER): New macros. + * config/i386/x86-tune.def (TARGET_USE_SCATTER_2PARTS, + TARGET_USE_SCATTER_4PARTS, TARGET_USE_SCATTER): New tunes. + (X86_TUNE_AVOID_256FMA_CHAINS, X86_TUNE_AVOID_512FMA_CHAINS): Disable + for znver4. (X86_TUNE_USE_GATHER): Disable for zen4. + +2023-01-16 Richard Biener + + PR target/55522 + * config/sol2.h (ENDFILE_SPEC): Don't add crtfastmath.o for -shared. + +2023-01-16 Stam Markianos-Wright + + PR target/96795 + PR target/107515 + * config/arm/arm_mve.h (__ARM_mve_coerce2): Split types. + (__ARM_mve_coerce3): Likewise. + +2023-01-16 Andrew Carlotti + + * tree-ssa-loop-niter.cc (build_popcount_expr): Add IFN support. + +2023-01-16 Andrew Carlotti + + * tree-ssa-loop-niter.cc (number_of_iterations_cltz): New. + (number_of_iterations_bitcount): Add call to the above. + (number_of_iterations_exit_assumptions): Add EQ_EXPR case for + c[lt]z idiom recognition. + +2023-01-16 Andrew Carlotti + + * doc/sourcebuild.texi: Add missing target attributes. + +2023-01-16 Andrew Carlotti + + PR tree-optimization/94793 + * tree-scalar-evolution.cc (expression_expensive_p): Add checks + for c[lt]z optabs. + * tree-ssa-loop-niter.cc (build_cltz_expr): New. + (number_of_iterations_cltz_complement): New. + (number_of_iterations_bitcount): Add call to the above. + +2023-01-16 Jonathan Wakely + + * doc/extend.texi (Common Function Attributes): Fix grammar. + +2023-01-16 Jakub Jelinek + + PR other/108413 + * config/riscv/riscv-vsetvl.h: Add space in between Copyright and (C). + * config/riscv/riscv-vsetvl.cc: Likewise. + +2023-01-16 Jakub Jelinek + + PR c++/105593 + * config/i386/xmmintrin.h (_mm_undefined_ps): Temporarily + disable -Winit-self using pragma GCC diagnostic ignored. + * config/i386/emmintrin.h (_mm_undefined_pd, _mm_undefined_si128): + Likewise. + * config/i386/avxintrin.h (_mm256_undefined_pd, _mm256_undefined_ps, + _mm256_undefined_si256): Likewise. + * config/i386/avx512fintrin.h (_mm512_undefined_pd, + _mm512_undefined_ps, _mm512_undefined_epi32): Likewise. + * config/i386/avx512fp16intrin.h (_mm_undefined_ph, + _mm256_undefined_ph, _mm512_undefined_ph): Likewise. + +2023-01-16 Kewen Lin + + PR target/108272 + * config/rs6000/rs6000.cc (rs6000_opaque_type_invalid_use_p): Add the + support for invalid uses in inline asm, factor out the checking and + erroring to lambda function check_and_error_invalid_use. + 2023-01-15 Aldy Hernandez PR tree-optimization/107608 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 748a3e0..9081c2e 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20230116 +20230117 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 11501640..cebcb42 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,101 @@ +2023-01-16 Marc Poulhiès + + * gcc-interface/Make-lang.in: Update copyright years. + * gcc-interface/Makefile.in: Likewise. + * gcc-interface/ada-builtin-types.def: Likewise. + * gcc-interface/ada-builtins.def: Likewise. + * gcc-interface/ada-tree.def: Likewise. + * gcc-interface/ada-tree.h: Likewise. + * gcc-interface/ada.h: Likewise. + * gcc-interface/config-lang.in: Likewise. + * gcc-interface/cuintp.cc: Likewise. + * gcc-interface/decl.cc: Likewise. + * gcc-interface/gadaint.h: Likewise. + * gcc-interface/gigi.h: Likewise. + * gcc-interface/lang-specs.h: Likewise. + * gcc-interface/lang.opt: Likewise. + * gcc-interface/misc.cc: Likewise. + * gcc-interface/system.ads: Likewise. + * gcc-interface/targtyps.cc: Likewise. + * gcc-interface/trans.cc: Likewise. + * gcc-interface/utils.cc: Likewise. + * gcc-interface/utils2.cc: Likewise. + +2023-01-16 Eric Botcazou + + * exp_ch3.adb (Make_Allocator_For_Return): Fix typo in comment. + +2023-01-16 Eric Botcazou + + * exp_ch3.adb (Make_Allocator_For_Return): Convert the expression + to the return object's type in the constrained array case as well. + +2023-01-16 Eric Botcazou + + * exp_ch3.adb (Expand_N_Object_Declaration): For a class-wide non- + interface stand-alone object initialized by a function call, call + Remove_Side_Effects on the expression to capture the result. + +2023-01-16 Eric Botcazou + + * exp_util.ads (Has_Tag_Of_Type): Declare. + * exp_util.adb (Has_Tag_Of_Type): Move to package level. Recurse on + qualified expressions. + * exp_ch3.adb (Expand_N_Object_Declaration): Use a static reference + to the interface tag in more cases for class-wide interface objects. + +2023-01-16 Eric Botcazou + + * exp_util.adb (Make_CW_Equivalent_Type.Has_Tag_Of_Type): Fix pasto. + +2023-01-16 Eric Botcazou + + * exp_util.adb (Is_Temporary_For_Interface_Object): Delete. + (Is_Finalizable_Transient.Is_Aliased): Deal with the specific case + of temporaries generated for interface objects. + +2023-01-16 Eric Botcazou + + * exp_ch3.adb (Expand_N_Object_Declaration): Do not generate a back- + and-forth displacement of the object's address when using a renaming + for an interface object with an expression of the same type. + * exp_ch4.adb (Expand_Allocator_Expression): Do not remove the side + effects of the expression up front for the simple allocators. Do not + call the Adjust primitive if the expression is a function call. + * exp_ch6.adb (Expand_Ctrl_Function_Call): Do not expand the call + unnecessarily for a special return object. + (Expand_Simple_Function_Return): Restore the displacement of the + return object's address in the case where the expression is the call + to a function whose result type is a type that needs finalization. + * exp_util.adb (Expand_Subtype_From_Expr): Do not remove the side + effects of the expression before calling Make_Subtype_From_Expr. + (Make_CW_Equivalent_Type): If the expression has the tag of its type + and this type has a uniform size, use 'Object_Size of this type in + lieu of 'Size of the expression to compute the expression's size. + +2023-01-16 Eric Botcazou + + * exp_ch3.adb (Make_Allocator_For_Return): Put back an interface + conversion for expressions with non-interface class-wide type. + +2023-01-16 Eric Botcazou + + * exp_ch3.adb (Expand_N_Object_Declaration): Also optimize aliased + objects if their nominal subtype is not an unconstrained array. + +2023-01-16 Eric Botcazou + + * exp_ch3.adb (Expand_N_Object_Declaration): Factor out conditions + needed for an initializating expression that is a function call to + be renamable into the Is_Renamable_Function_Call predicate. + Use it to implement the renaming in the case of class-wide interface + objects. Remove an interface conversion on all paths, separate and + optimize the renaming path in the special expansion for interfaces. + (Is_Renamable_Function_Call): New predicate. + (Make_Allocator_For_Return): Put back an interface conversion. + * exp_ch6.adb (Apply_CW_Accessibility_Check): Remove useless access + checks on RE_Tag_Ptr. + 2023-01-09 Arnaud Charlet * accessibility.adb, accessibility.ads, ada_get_targ.adb: Update copyright year. diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 0a10d16..a905499 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,10 @@ +2023-01-16 Jakub Jelinek + + PR c++/105593 + * c-parser.cc (c_parser_initializer): Check warning_enabled_at + at the DECL_SOURCE_LOCATION (decl) for OPT_Winit_self instead + of warn_init_self. + 2023-01-14 Jakub Jelinek PR c++/108365 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5c91d4b..4ed513b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2023-01-16 Jakub Jelinek + + PR c++/105593 + * decl.cc (cp_finish_decl): Check warning_enabled_at + at the DECL_SOURCE_LOCATION (decl) for OPT_Winit_self instead + of warn_init_self. + 2023-01-14 Jakub Jelinek PR c++/108365 diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog index ab0f6dd..7364f1c 100644 --- a/gcc/m2/ChangeLog +++ b/gcc/m2/ChangeLog @@ -1,3 +1,52 @@ +2023-01-16 Gaius Mulley + + * mc-boot-ch/Glibc.c (libc_time): New function. + (libc_localtime): New function. + * mc-boot/GDynamicStrings.c: Regenerate. + * mc-boot/GFIO.c: Regenerate. + * mc-boot/GFormatStrings.c: Regenerate. + * mc-boot/GIndexing.c: Regenerate. + * mc-boot/GM2Dependent.c: Regenerate. + * mc-boot/GM2EXCEPTION.c: Regenerate. + * mc-boot/GPushBackInput.c: Regenerate. + * mc-boot/GRTExceptions.c: Regenerate. + * mc-boot/GRTint.c: Regenerate. + * mc-boot/GStdIO.c: Regenerate. + * mc-boot/GStringConvert.c: Regenerate. + * mc-boot/GSysStorage.c: Regenerate. + * mc-boot/Gdecl.c: Regenerate. + * mc-boot/GmcComment.c: Regenerate. + * mc-boot/GmcComp.c: Regenerate. + * mc-boot/GmcDebug.c: Regenerate. + * mc-boot/GmcMetaError.c: Regenerate. + * mc-boot/GmcOptions.c: Regenerate. + * mc-boot/GmcStack.c: Regenerate. + * mc-boot/GnameKey.c: Regenerate. + * mc-boot/GsymbolKey.c: Regenerate. + * mc-boot/Gkeyc.c: Regenerate. + * mc/decl.mod (putFieldRecord): Change NulName to NulKey + and fix type comparision. + * mc/mcOptions.mod (YEAR): Remove. + (getYear): New procedure function. + (displayVersion): Use result from getYear instead of YEAR. + Emit boilerplate for GPL v3. + (gplBody): Use result from getYear instead of YEAR. + (glplBody): Use result from getYear instead of YEAR. + +2023-01-16 Gaius Mulley + + * gm2-compiler/M2Quads.mod (AssignUnboundedVar): Check Type + against NulSym and call MetaErrorT1 if necessary. + (AssignUnboundedNonVar): Check Type against NulSym and + call MetaErrorT1 if necessary. + (BuildDesignatorPointer): Check Type1 against NulSym and + call MetaErrorT1 if necessary. + +2023-01-16 Gaius Mulley + + * mc/mcOptions.mod (displayVersion): Change GPLv2 to GPLv3. + (YEAR) set to 2023. + 2023-01-15 Gaius Mulley * gm2-compiler/M2LexBuf.mod (isSrcToken): Add block comment. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a57ad0d..f96175e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,83 @@ +2023-01-16 Andrew Pinski + + * lib/target-supports.exp (add_options_for_tls): Remove + reference to Solaris 9 in comments. + +2023-01-16 H.J. Lu + + PR target/105980 + * g++.target/i386/pr105980.C: New test. + +2023-01-16 Jan Hubicka + + * g++.dg/tree-ssa/pr106077.C: New test. + +2023-01-16 Stam Markianos-Wright + + PR target/96795 + PR target/107515 + * gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-fp.c: New test. + * gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c: New test. + +2023-01-16 Andrew Carlotti + + * g++.dg/tree-ssa/pr86544.C: Add .POPCOUNT to tree scan regex. + * gcc.dg/tree-ssa/popcount.c: Likewise. + * gcc.dg/tree-ssa/popcount2.c: Likewise. + * gcc.dg/tree-ssa/popcount3.c: Likewise. + * gcc.target/aarch64/popcount4.c: Likewise. + * gcc.target/i386/pr95771.c: Likewise, and... + * gcc.target/i386/pr95771-2.c: ...split int128 test from above, + since this would emit just a single IFN if a TI optab is added. + +2023-01-16 Andrew Carlotti + + * gcc.dg/tree-ssa/cltz-max.c: New test. + * gcc.dg/tree-ssa/clz-char.c: New test. + * gcc.dg/tree-ssa/clz-int.c: New test. + * gcc.dg/tree-ssa/clz-long-long.c: New test. + * gcc.dg/tree-ssa/clz-long.c: New test. + * gcc.dg/tree-ssa/ctz-char.c: New test. + * gcc.dg/tree-ssa/ctz-int.c: New test. + * gcc.dg/tree-ssa/ctz-long-long.c: New test. + * gcc.dg/tree-ssa/ctz-long.c: New test. + +2023-01-16 Andrew Carlotti + + * lib/target-supports.exp (check_effective_target_clz) + (check_effective_target_clzl, check_effective_target_clzll) + (check_effective_target_ctz, check_effective_target_clzl) + (check_effective_target_ctzll): New. + * gcc.dg/tree-ssa/cltz-complement-max.c: New test. + * gcc.dg/tree-ssa/clz-complement-char.c: New test. + * gcc.dg/tree-ssa/clz-complement-int.c: New test. + * gcc.dg/tree-ssa/clz-complement-long-long.c: New test. + * gcc.dg/tree-ssa/clz-complement-long.c: New test. + * gcc.dg/tree-ssa/ctz-complement-char.c: New test. + * gcc.dg/tree-ssa/ctz-complement-int.c: New test. + * gcc.dg/tree-ssa/ctz-complement-long-long.c: New test. + * gcc.dg/tree-ssa/ctz-complement-long.c: New test. + +2023-01-16 Jakub Jelinek + + PR c++/105593 + * g++.target/i386/pr105593.C: New test. + +2023-01-16 Jakub Jelinek + + PR c++/105593 + * c-c++-common/Winit-self3.c: New test. + * c-c++-common/Winit-self4.c: New test. + * c-c++-common/Winit-self5.c: New test. + +2023-01-16 Kewen Lin + + PR target/108272 + * gcc.target/powerpc/pr108272-1.c: New test. + * gcc.target/powerpc/pr108272-2.c: New test. + * gcc.target/powerpc/pr108272-3.c: New test. + * gcc.target/powerpc/pr108272-4.c: New test. + 2023-01-14 Prathamesh Kulkarni * gcc.target/aarch64/sve/acle/general/pr96463-2.c: Adjust. -- cgit v1.1 From 001121e8921d5d1a439ce0e64ab04c5959b0bfd8 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 17 Jan 2023 12:14:25 +0100 Subject: forwprop: Fix up rotate pattern matching [PR106523] The comment above simplify_rotate roughly describes what patterns are matched into what: We are looking for X with unsigned type T with bitsize B, OP being +, | or ^, some type T2 wider than T. For: (X << CNT1) OP (X >> CNT2) iff CNT1 + CNT2 == B ((T) ((T2) X << CNT1)) OP ((T) ((T2) X >> CNT2)) iff CNT1 + CNT2 == B transform these into: X r<< CNT1 Or for: (X << Y) OP (X >> (B - Y)) (X << (int) Y) OP (X >> (int) (B - Y)) ((T) ((T2) X << Y)) OP ((T) ((T2) X >> (B - Y))) ((T) ((T2) X << (int) Y)) OP ((T) ((T2) X >> (int) (B - Y))) (X << Y) | (X >> ((-Y) & (B - 1))) (X << (int) Y) | (X >> (int) ((-Y) & (B - 1))) ((T) ((T2) X << Y)) | ((T) ((T2) X >> ((-Y) & (B - 1)))) ((T) ((T2) X << (int) Y)) | ((T) ((T2) X >> (int) ((-Y) & (B - 1)))) transform these into (last 2 only if ranger can prove Y < B): X r<< Y Or for: (X << (Y & (B - 1))) | (X >> ((-Y) & (B - 1))) (X << (int) (Y & (B - 1))) | (X >> (int) ((-Y) & (B - 1))) ((T) ((T2) X << (Y & (B - 1)))) | ((T) ((T2) X >> ((-Y) & (B - 1)))) ((T) ((T2) X << (int) (Y & (B - 1)))) \ | ((T) ((T2) X >> (int) ((-Y) & (B - 1)))) transform these into: X r<< (Y & (B - 1)) The following testcase shows that 2 of these are problematic. If T2 is wider than T, then the 2 which yse (-Y) & (B - 1) on one of the shift counts but Y on the can do something different from rotate. E.g.: __attribute__((noipa)) unsigned char f7 (unsigned char x, unsigned int y) { unsigned int t = x; return (t << y) | (t >> ((-y) & 7)); } if y is [0, 7], then it is a normal rotate, and if y is in [32, ~0U] then it is UB, but for y in [9, 31] the left shift in this case will never leave any bits in the result, while in a rotate they are left there. Say for y 5 and x 0xaa the expression gives 0x55 which is the same thing as rotate, while for y 19 and x 0xaa 0x5, which is different. Now, I believe the ((T) ((T2) X << Y)) OP ((T) ((T2) X >> (B - Y))) ((T) ((T2) X << (int) Y)) OP ((T) ((T2) X >> (int) (B - Y))) forms are ok, because B - Y still needs to be a valid shift count, and if Y > B then B - Y should be either negative or very large positive (for unsigned types). And similarly the last 2 cases above which use & (B - 1) on both shift operands are definitely ok. The following patch disables the ((T) ((T2) X << Y)) | ((T) ((T2) X >> ((-Y) & (B - 1)))) ((T) ((T2) X << (int) Y)) | ((T) ((T2) X >> (int) ((-Y) & (B - 1)))) unless ranger says Y is not in [B, B2 - 1] range. And, looking at it again this morning, actually the Y equal to B case is still fine, if Y is equal to 0, then it is (T) (((T2) X << 0) | ((T2) X >> 0)) and so X, for Y == B it is (T) (((T2) X << B) | ((T2) X >> 0)) which is the same as (T) (0 | ((T2) X >> 0)) which is also X. So instead of the [B, B2 - 1] range we could use [B + 1, B2 - 1]. And, if we wanted to go further, even multiplies of B are ok if they are smaller than B2, so we could construct a detailed int_range_max if we wanted. 2023-01-17 Jakub Jelinek PR tree-optimization/106523 * tree-ssa-forwprop.cc (simplify_rotate): For the patterns with (-Y) & (B - 1) in one operand's shift count and Y in another, if T2 has wider precision than T, punt if Y could have a value in [B, B2 - 1] range. * c-c++-common/rotate-2.c (f5, f6, f7, f8, f13, f14, f15, f16, f37, f38, f39, f40, f45, f46, f47, f48): Add assertions using __builtin_unreachable about shift count. * c-c++-common/rotate-2b.c: New test. * c-c++-common/rotate-4.c (f5, f6, f7, f8, f13, f14, f15, f16, f37, f38, f39, f40, f45, f46, f47, f48): Add assertions using __builtin_unreachable about shift count. * c-c++-common/rotate-4b.c: New test. * gcc.c-torture/execute/pr106523.c: New test. --- gcc/testsuite/c-c++-common/rotate-2.c | 32 ++++++++ gcc/testsuite/c-c++-common/rotate-2b.c | 100 +++++++++++++++++++++++++ gcc/testsuite/c-c++-common/rotate-4.c | 32 ++++++++ gcc/testsuite/c-c++-common/rotate-4b.c | 100 +++++++++++++++++++++++++ gcc/testsuite/gcc.c-torture/execute/pr106523.c | 22 ++++++ gcc/tree-ssa-forwprop.cc | 53 ++++++++++++- 6 files changed, 335 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/rotate-2b.c create mode 100644 gcc/testsuite/c-c++-common/rotate-4b.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr106523.c (limited to 'gcc') diff --git a/gcc/testsuite/c-c++-common/rotate-2.c b/gcc/testsuite/c-c++-common/rotate-2.c index c8359cd..544a7ca 100644 --- a/gcc/testsuite/c-c++-common/rotate-2.c +++ b/gcc/testsuite/c-c++-common/rotate-2.c @@ -32,24 +32,32 @@ f4 (unsigned int x, int y __attribute__((unused))) unsigned short int f5 (unsigned short int x, unsigned int y) { + if (y >= __CHAR_BIT__ * __SIZEOF_SHORT__) + __builtin_unreachable (); return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); } unsigned short int f6 (unsigned short int x, unsigned long int y) { + if (y >= __CHAR_BIT__ * __SIZEOF_SHORT__) + __builtin_unreachable (); return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); } unsigned char f7 (unsigned char x, unsigned int y) { + if (y >= __CHAR_BIT__) + __builtin_unreachable (); return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); } unsigned char f8 (unsigned char x, unsigned long int y) { + if (y >= __CHAR_BIT__) + __builtin_unreachable (); return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); } @@ -80,24 +88,32 @@ f12 (unsigned int x, int y __attribute__((unused))) unsigned short int f13 (unsigned short int x, unsigned int y) { + if (y >= __CHAR_BIT__ * __SIZEOF_SHORT__) + __builtin_unreachable (); return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); } unsigned short int f14 (unsigned short int x, unsigned long int y) { + if (y >= __CHAR_BIT__ * __SIZEOF_SHORT__) + __builtin_unreachable (); return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); } unsigned char f15 (unsigned char x, unsigned int y) { + if (y >= __CHAR_BIT__) + __builtin_unreachable (); return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); } unsigned char f16 (unsigned char x, unsigned long int y) { + if (y >= __CHAR_BIT__) + __builtin_unreachable (); return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); } @@ -224,24 +240,32 @@ f36 (unsigned int x, int y __attribute__((unused))) unsigned short int f37 (unsigned short int x, unsigned int y) { + if (y >= __CHAR_BIT__ * __SIZEOF_SHORT__) + __builtin_unreachable (); return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); } unsigned short int f38 (unsigned short int x, unsigned long int y) { + if (y >= __CHAR_BIT__ * __SIZEOF_SHORT__) + __builtin_unreachable (); return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); } unsigned char f39 (unsigned char x, unsigned int y) { + if (y >= __CHAR_BIT__) + __builtin_unreachable (); return (x >> y) | (x << ((-y) & (__CHAR_BIT__ - 1))); } unsigned char f40 (unsigned char x, unsigned long int y) { + if (y >= __CHAR_BIT__) + __builtin_unreachable (); return (x >> y) | (x << ((-y) & (__CHAR_BIT__ - 1))); } @@ -272,24 +296,32 @@ f44 (unsigned int x, int y __attribute__((unused))) unsigned short int f45 (unsigned short int x, unsigned int y) { + if (y >= __CHAR_BIT__ * __SIZEOF_SHORT__) + __builtin_unreachable (); return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); } unsigned short int f46 (unsigned short int x, unsigned long int y) { + if (y >= __CHAR_BIT__ * __SIZEOF_SHORT__) + __builtin_unreachable (); return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); } unsigned char f47 (unsigned char x, unsigned int y) { + if (y >= __CHAR_BIT__) + __builtin_unreachable (); return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); } unsigned char f48 (unsigned char x, unsigned long int y) { + if (y >= __CHAR_BIT__) + __builtin_unreachable (); return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); } diff --git a/gcc/testsuite/c-c++-common/rotate-2b.c b/gcc/testsuite/c-c++-common/rotate-2b.c new file mode 100644 index 0000000..2a6bf90 --- /dev/null +++ b/gcc/testsuite/c-c++-common/rotate-2b.c @@ -0,0 +1,100 @@ +/* Check rotate pattern detection. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-ipa-icf -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-not "r\[<>]\[<>]" "optimized" } } */ + +unsigned short int +f5 (unsigned short int x, unsigned int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned short int +f6 (unsigned short int x, unsigned long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned char +f7 (unsigned char x, unsigned int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +f8 (unsigned char x, unsigned long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned short int +f13 (unsigned short int x, unsigned int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned short int +f14 (unsigned short int x, unsigned long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned char +f15 (unsigned char x, unsigned int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} + +unsigned char +f16 (unsigned char x, unsigned long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} + +unsigned short int +f37 (unsigned short int x, unsigned int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned short int +f38 (unsigned short int x, unsigned long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned char +f39 (unsigned char x, unsigned int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +f40 (unsigned char x, unsigned long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned short int +f45 (unsigned short int x, unsigned int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned short int +f46 (unsigned short int x, unsigned long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned char +f47 (unsigned char x, unsigned int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} + +unsigned char +f48 (unsigned char x, unsigned long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} diff --git a/gcc/testsuite/c-c++-common/rotate-4.c b/gcc/testsuite/c-c++-common/rotate-4.c index 44fd1d0..f852362 100644 --- a/gcc/testsuite/c-c++-common/rotate-4.c +++ b/gcc/testsuite/c-c++-common/rotate-4.c @@ -32,24 +32,32 @@ f4 (unsigned int x, int y __attribute__((unused))) unsigned short int f5 (unsigned short int x, int y) { + if (y >= __CHAR_BIT__ * __SIZEOF_SHORT__) + __builtin_unreachable (); return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); } unsigned short int f6 (unsigned short int x, long int y) { + if (y >= 0UL + __CHAR_BIT__ * __SIZEOF_SHORT__) + __builtin_unreachable (); return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); } unsigned char f7 (unsigned char x, int y) { + if (y >= __CHAR_BIT__) + __builtin_unreachable (); return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); } unsigned char f8 (unsigned char x, long int y) { + if (y >= 0UL + __CHAR_BIT__) + __builtin_unreachable (); return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); } @@ -80,24 +88,32 @@ f12 (unsigned int x, int y __attribute__((unused))) unsigned short int f13 (unsigned short int x, int y) { + if (y >= __CHAR_BIT__ * __SIZEOF_SHORT__) + __builtin_unreachable (); return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); } unsigned short int f14 (unsigned short int x, long int y) { + if (y >= 0UL + __CHAR_BIT__ * __SIZEOF_SHORT__) + __builtin_unreachable (); return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); } unsigned char f15 (unsigned char x, int y) { + if (y >= __CHAR_BIT__) + __builtin_unreachable (); return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); } unsigned char f16 (unsigned char x, long int y) { + if (y >= 0UL + __CHAR_BIT__) + __builtin_unreachable (); return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); } @@ -224,24 +240,32 @@ f36 (unsigned int x, int y __attribute__((unused))) unsigned short int f37 (unsigned short int x, int y) { + if (y >= __CHAR_BIT__ * __SIZEOF_SHORT__) + __builtin_unreachable (); return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); } unsigned short int f38 (unsigned short int x, long int y) { + if (y >= 0UL + __CHAR_BIT__ * __SIZEOF_SHORT__) + __builtin_unreachable (); return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); } unsigned char f39 (unsigned char x, int y) { + if (y >= __CHAR_BIT__) + __builtin_unreachable (); return (x >> y) | (x << ((-y) & (__CHAR_BIT__ - 1))); } unsigned char f40 (unsigned char x, long int y) { + if (y >= 0UL + __CHAR_BIT__) + __builtin_unreachable (); return (x >> y) | (x << ((-y) & (__CHAR_BIT__ - 1))); } @@ -272,24 +296,32 @@ f44 (unsigned int x, int y __attribute__((unused))) unsigned short int f45 (unsigned short int x, int y) { + if (y >= __CHAR_BIT__ * __SIZEOF_SHORT__) + __builtin_unreachable (); return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); } unsigned short int f46 (unsigned short int x, long int y) { + if (y >= 0UL + __CHAR_BIT__ * __SIZEOF_SHORT__) + __builtin_unreachable (); return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); } unsigned char f47 (unsigned char x, int y) { + if (y >= __CHAR_BIT__) + __builtin_unreachable (); return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); } unsigned char f48 (unsigned char x, long int y) { + if (y >= 0UL + __CHAR_BIT__) + __builtin_unreachable (); return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); } diff --git a/gcc/testsuite/c-c++-common/rotate-4b.c b/gcc/testsuite/c-c++-common/rotate-4b.c new file mode 100644 index 0000000..a382475 --- /dev/null +++ b/gcc/testsuite/c-c++-common/rotate-4b.c @@ -0,0 +1,100 @@ +/* Check rotate pattern detection. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-ipa-icf -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-not "r\[<>]\[<>]" "optimized" } } */ + +unsigned short int +f5 (unsigned short int x, int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned short int +f6 (unsigned short int x, long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned char +f7 (unsigned char x, int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +f8 (unsigned char x, long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned short int +f13 (unsigned short int x, int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned short int +f14 (unsigned short int x, long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned char +f15 (unsigned char x, int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} + +unsigned char +f16 (unsigned char x, long int y) +{ + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} + +unsigned short int +f37 (unsigned short int x, int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned short int +f38 (unsigned short int x, long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))); +} + +unsigned char +f39 (unsigned char x, int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +f40 (unsigned char x, long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned short int +f45 (unsigned short int x, int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned short int +f46 (unsigned short int x, long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))); +} + +unsigned char +f47 (unsigned char x, int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} + +unsigned char +f48 (unsigned char x, long int y) +{ + return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr106523.c b/gcc/testsuite/gcc.c-torture/execute/pr106523.c new file mode 100644 index 0000000..abd78f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr106523.c @@ -0,0 +1,22 @@ +/* PR tree-optimization/106523 */ + +__attribute__((noipa)) unsigned char +f7 (unsigned char x, unsigned int y) +{ + unsigned int t = x; + return (t << y) | (t >> ((-y) & 7)); +} + +int +main () +{ + if (__CHAR_BIT__ != 8 || __SIZEOF_INT__ != 4) + return 0; + + volatile unsigned char x = 152; + volatile unsigned int y = 19; + if (f7 (x, y) != 4) + __builtin_abort (); + + return 0; +} diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc index 0a7e956..458d9c8 100644 --- a/gcc/tree-ssa-forwprop.cc +++ b/gcc/tree-ssa-forwprop.cc @@ -1837,7 +1837,7 @@ defcodefor_name (tree name, enum tree_code *code, tree *arg1, tree *arg2) ((T) ((T2) X << Y)) | ((T) ((T2) X >> ((-Y) & (B - 1)))) ((T) ((T2) X << (int) Y)) | ((T) ((T2) X >> (int) ((-Y) & (B - 1)))) - transform these into: + transform these into (last 2 only if ranger can prove Y < B): X r<< Y Or for: @@ -1866,6 +1866,8 @@ simplify_rotate (gimple_stmt_iterator *gsi) int i; bool swapped_p = false; gimple *g; + gimple *def_arg_stmt[2] = { NULL, NULL }; + int wider_prec = 0; arg[0] = gimple_assign_rhs1 (stmt); arg[1] = gimple_assign_rhs2 (stmt); @@ -1878,7 +1880,11 @@ simplify_rotate (gimple_stmt_iterator *gsi) return false; for (i = 0; i < 2; i++) - defcodefor_name (arg[i], &def_code[i], &def_arg1[i], &def_arg2[i]); + { + defcodefor_name (arg[i], &def_code[i], &def_arg1[i], &def_arg2[i]); + if (TREE_CODE (arg[i]) == SSA_NAME) + def_arg_stmt[i] = SSA_NAME_DEF_STMT (arg[i]); + } /* Look through narrowing (or same precision) conversions. */ if (CONVERT_EXPR_CODE_P (def_code[0]) @@ -1891,10 +1897,13 @@ simplify_rotate (gimple_stmt_iterator *gsi) && has_single_use (arg[0]) && has_single_use (arg[1])) { + wider_prec = TYPE_PRECISION (TREE_TYPE (def_arg1[0])); for (i = 0; i < 2; i++) { arg[i] = def_arg1[i]; defcodefor_name (arg[i], &def_code[i], &def_arg1[i], &def_arg2[i]); + if (TREE_CODE (arg[i]) == SSA_NAME) + def_arg_stmt[i] = SSA_NAME_DEF_STMT (arg[i]); } } else @@ -1910,6 +1919,8 @@ simplify_rotate (gimple_stmt_iterator *gsi) { arg[i] = def_arg1[i]; defcodefor_name (arg[i], &def_code[i], &def_arg1[i], &def_arg2[i]); + if (TREE_CODE (arg[i]) == SSA_NAME) + def_arg_stmt[i] = SSA_NAME_DEF_STMT (arg[i]); } } @@ -1983,6 +1994,9 @@ simplify_rotate (gimple_stmt_iterator *gsi) { tree cdef_arg1[2], cdef_arg2[2], def_arg2_alt[2]; enum tree_code cdef_code[2]; + gimple *def_arg_alt_stmt[2] = { NULL, NULL }; + bool check_range = false; + gimple *check_range_stmt = NULL; /* Look through conversion of the shift count argument. The C/C++ FE cast any shift count argument to integer_type_node. The only problem might be if the shift count type maximum value @@ -1999,9 +2013,13 @@ simplify_rotate (gimple_stmt_iterator *gsi) && type_has_mode_precision_p (TREE_TYPE (cdef_arg1[i]))) { def_arg2_alt[i] = cdef_arg1[i]; + if (TREE_CODE (def_arg2[i]) == SSA_NAME) + def_arg_alt_stmt[i] = SSA_NAME_DEF_STMT (def_arg2[i]); defcodefor_name (def_arg2_alt[i], &cdef_code[i], &cdef_arg1[i], &cdef_arg2[i]); } + else + def_arg_alt_stmt[i] = def_arg_stmt[i]; } for (i = 0; i < 2; i++) /* Check for one shift count being Y and the other B - Y, @@ -2024,7 +2042,7 @@ simplify_rotate (gimple_stmt_iterator *gsi) if (CONVERT_EXPR_CODE_P (code) && INTEGRAL_TYPE_P (TREE_TYPE (tem)) && TYPE_PRECISION (TREE_TYPE (tem)) - > floor_log2 (TYPE_PRECISION (rtype)) + > floor_log2 (TYPE_PRECISION (rtype)) && type_has_mode_precision_p (TREE_TYPE (tem)) && (tem == def_arg2[1 - i] || tem == def_arg2_alt[1 - i])) @@ -2053,7 +2071,7 @@ simplify_rotate (gimple_stmt_iterator *gsi) if (CONVERT_EXPR_CODE_P (code) && INTEGRAL_TYPE_P (TREE_TYPE (tem)) && TYPE_PRECISION (TREE_TYPE (tem)) - > floor_log2 (TYPE_PRECISION (rtype)) + > floor_log2 (TYPE_PRECISION (rtype)) && type_has_mode_precision_p (TREE_TYPE (tem))) defcodefor_name (tem, &code, &tem, NULL); @@ -2062,6 +2080,11 @@ simplify_rotate (gimple_stmt_iterator *gsi) if (tem == def_arg2[1 - i] || tem == def_arg2_alt[1 - i]) { rotcnt = tem; + check_range = true; + if (tem == def_arg2[1 - i]) + check_range_stmt = def_arg_stmt[1 - i]; + else + check_range_stmt = def_arg_alt_stmt[1 - i]; break; } tree tem2; @@ -2076,6 +2099,11 @@ simplify_rotate (gimple_stmt_iterator *gsi) || tem2 == def_arg2_alt[1 - i]) { rotcnt = tem2; + check_range = true; + if (tem2 == def_arg2[1 - i]) + check_range_stmt = def_arg_stmt[1 - i]; + else + check_range_stmt = def_arg_alt_stmt[1 - i]; break; } } @@ -2111,6 +2139,23 @@ simplify_rotate (gimple_stmt_iterator *gsi) } } } + if (check_range && wider_prec > TYPE_PRECISION (rtype)) + { + if (TREE_CODE (rotcnt) != SSA_NAME) + return false; + int_range_max r; + if (!get_global_range_query ()->range_of_expr (r, rotcnt, + check_range_stmt)) + return false; + int prec = TYPE_PRECISION (TREE_TYPE (rotcnt)); + signop sign = TYPE_SIGN (TREE_TYPE (rotcnt)); + wide_int min = wide_int::from (TYPE_PRECISION (rtype), prec, sign); + wide_int max = wide_int::from (wider_prec - 1, prec, sign); + int_range<2> r2 (TREE_TYPE (rotcnt), min, max); + r.intersect (r2); + if (!r.undefined_p ()) + return false; + } if (rotcnt == NULL_TREE) return false; swapped_p = i != 1; -- cgit v1.1 From 3a121c06f3cff8206883dea526bec4569876b059 Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Tue, 17 Jan 2023 13:27:42 +0000 Subject: PR-108404 M2RTS_Halt fails with a segv PR-108404 occurs because the C prototype does not match the Modula-2 procedure M2RTS_Halt. This patch provides a new procedure M2RTS_HaltC which avoids the C/C++ code from having to fabricate a Modula-2 string. gcc/m2/ChangeLog: * gm2-libs-iso/M2RTS.def (Halt): Parameter file renamed to filename. (HaltC): New procedure declaration. (ErrorMessage): Parameter file renamed to filename. * gm2-libs-iso/M2RTS.mod (Halt): Parameter file renamed to filename. (HaltC): New procedure implementation. (ErrorStringC): New procedure implementation. (ErrorMessageC): New procedure implementation. * gm2-libs/M2RTS.def (Halt): Parameter file renamed to filename. (HaltC): New procedure declaration. (ErrorMessage): Parameter file renamed to filename. * gm2-libs/M2RTS.mod (Halt): Parameter file renamed to filename. (HaltC): New procedure implementation. (ErrorStringC): New procedure implementation. (ErrorMessageC): New procedure implementation. libgm2/ChangeLog: * libm2iso/RTco.cc (_M2_RTco_fini): Call M2RTS_HaltC. (newSem): Call M2RTS_HaltC. (currentThread): Call M2RTS_HaltC. (never): Call M2RTS_HaltC. (defined): Call M2RTS_HaltC. (initThread): Call M2RTS_HaltC. (RTco_transfer): Call M2RTS_HaltC. * libm2iso/m2rts.h (M2RTS_Halt): Provide parameter names. (M2RTS_HaltC): New procedure declaration. Signed-off-by: Gaius Mulley --- gcc/m2/gm2-libs-iso/M2RTS.def | 17 +++++++-- gcc/m2/gm2-libs-iso/M2RTS.mod | 80 ++++++++++++++++++++++++++++++++++++------- gcc/m2/gm2-libs/M2RTS.def | 19 +++++++--- gcc/m2/gm2-libs/M2RTS.mod | 80 ++++++++++++++++++++++++++++++++++++------- 4 files changed, 163 insertions(+), 33 deletions(-) (limited to 'gcc') diff --git a/gcc/m2/gm2-libs-iso/M2RTS.def b/gcc/m2/gm2-libs-iso/M2RTS.def index ce9c6ab..6958fd4 100644 --- a/gcc/m2/gm2-libs-iso/M2RTS.def +++ b/gcc/m2/gm2-libs-iso/M2RTS.def @@ -111,14 +111,25 @@ PROCEDURE HALT ([exitcode: INTEGER = -1]) ; (* Halt - provides a more user friendly version of HALT, which takes - four parameters to aid debugging. + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). *) -PROCEDURE Halt (file: ARRAY OF CHAR; line: CARDINAL; +PROCEDURE Halt (filename: ARRAY OF CHAR; line: CARDINAL; function: ARRAY OF CHAR; description: ARRAY OF CHAR) ; (* + HaltC - provides a more user friendly version of HALT, which takes + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). +*) + +PROCEDURE HaltC (filename: ADDRESS; line: CARDINAL; + function, description: ADDRESS) ; + + +(* ExitOnHalt - if HALT is executed then call exit with the exit code, e. *) @@ -130,7 +141,7 @@ PROCEDURE ExitOnHalt (e: INTEGER) ; *) PROCEDURE ErrorMessage (message: ARRAY OF CHAR; - file: ARRAY OF CHAR; + filename: ARRAY OF CHAR; line: CARDINAL; function: ARRAY OF CHAR) ; diff --git a/gcc/m2/gm2-libs-iso/M2RTS.mod b/gcc/m2/gm2-libs-iso/M2RTS.mod index 2448c26..cbe70a9 100644 --- a/gcc/m2/gm2-libs-iso/M2RTS.mod +++ b/gcc/m2/gm2-libs-iso/M2RTS.mod @@ -27,7 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see IMPLEMENTATION MODULE M2RTS ; -FROM libc IMPORT abort, exit, write, getenv, printf ; +FROM libc IMPORT abort, exit, write, getenv, printf, strlen ; (* FROM Builtins IMPORT strncmp, strcmp ; not available during bootstrap. *) FROM NumberIO IMPORT CardToStr ; FROM StrLib IMPORT StrCopy, StrLen, StrEqual ; @@ -39,6 +39,9 @@ IMPORT RTExceptions ; IMPORT M2EXCEPTION ; IMPORT M2Dependent ; +CONST + stderrFd = 2 ; + TYPE PtrToChar = POINTER TO CHAR ; @@ -255,24 +258,36 @@ PROCEDURE ErrorString (a: ARRAY OF CHAR) ; VAR n: INTEGER ; BEGIN - n := write (2, ADR (a), StrLen (a)) + n := write (stderrFd, ADR (a), StrLen (a)) END ErrorString ; (* + ErrorStringC - writes a string to stderr. +*) + +PROCEDURE ErrorStringC (str: ADDRESS) ; +VAR + len: INTEGER ; +BEGIN + len := write (stderrFd, str, strlen (str)) +END ErrorStringC ; + + +(* ErrorMessage - emits an error message to stderr and then calls exit (1). *) PROCEDURE ErrorMessage (message: ARRAY OF CHAR; - file: ARRAY OF CHAR; + filename: ARRAY OF CHAR; line: CARDINAL; function: ARRAY OF CHAR) <* noreturn *> ; VAR - LineNo: ARRAY [0..10] OF CHAR ; + buffer: ARRAY [0..10] OF CHAR ; BEGIN - ErrorString (file) ; ErrorString(':') ; - CardToStr (line, 0, LineNo) ; - ErrorString (LineNo) ; ErrorString(':') ; + ErrorString (filename) ; ErrorString(':') ; + CardToStr (line, 0, buffer) ; + ErrorString (buffer) ; ErrorString(':') ; IF NOT StrEqual (function, '') THEN ErrorString ('in ') ; @@ -280,22 +295,61 @@ BEGIN ErrorString (' has caused ') ; END ; ErrorString (message) ; - LineNo[0] := nl ; LineNo[1] := nul ; - ErrorString (LineNo) ; + buffer[0] := nl ; buffer[1] := nul ; + ErrorString (buffer) ; exit (1) END ErrorMessage ; (* + ErrorMessageC - emits an error message to stderr and then calls exit (1). +*) + +PROCEDURE ErrorMessageC (message, filename: ADDRESS; + line: CARDINAL; + function: ADDRESS) <* noreturn *> ; +VAR + buffer: ARRAY [0..10] OF CHAR ; +BEGIN + ErrorStringC (filename) ; ErrorString (':') ; + CardToStr (line, 0, buffer) ; + ErrorString (buffer) ; ErrorString(':') ; + IF strlen (function) > 0 + THEN + ErrorString ('in ') ; + ErrorStringC (function) ; + ErrorString (' has caused ') ; + END ; + ErrorStringC (message) ; + buffer[0] := nl ; buffer[1] := nul ; + ErrorString (buffer) ; + exit (1) +END ErrorMessageC ; + + +(* + HaltC - provides a more user friendly version of HALT, which takes + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). +*) + +PROCEDURE HaltC (filename: ADDRESS; line: CARDINAL; + function, description: ADDRESS) ; +BEGIN + ErrorMessageC (description, filename, line, function) +END HaltC ; + + +(* Halt - provides a more user friendly version of HALT, which takes - four parameters to aid debugging. + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). *) -PROCEDURE Halt (file: ARRAY OF CHAR; line: CARDINAL; +PROCEDURE Halt (filename: ARRAY OF CHAR; line: CARDINAL; function: ARRAY OF CHAR; description: ARRAY OF CHAR) ; BEGIN - ErrorMessage (description, file, line, function) ; - HALT + ErrorMessage (description, filename, line, function) END Halt ; diff --git a/gcc/m2/gm2-libs/M2RTS.def b/gcc/m2/gm2-libs/M2RTS.def index 94ed2d0..b551725 100644 --- a/gcc/m2/gm2-libs/M2RTS.def +++ b/gcc/m2/gm2-libs/M2RTS.def @@ -120,12 +120,23 @@ PROCEDURE HALT ([exitcode: INTEGER = -1]) <* noreturn *> ; (* Halt - provides a more user friendly version of HALT, which takes - four parameters to aid debugging. + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). *) -PROCEDURE Halt (file: ARRAY OF CHAR; line: CARDINAL; +PROCEDURE Halt (filename: ARRAY OF CHAR; line: CARDINAL; function: ARRAY OF CHAR; description: ARRAY OF CHAR) - <* noreturn *> ; + <* noreturn *> ; + + +(* + HaltC - provides a more user friendly version of HALT, which takes + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). +*) + +PROCEDURE HaltC (filename: ADDRESS; line: CARDINAL; + function, description: ADDRESS) ; (* @@ -140,7 +151,7 @@ PROCEDURE ExitOnHalt (e: INTEGER) ; *) PROCEDURE ErrorMessage (message: ARRAY OF CHAR; - file: ARRAY OF CHAR; + filename: ARRAY OF CHAR; line: CARDINAL; function: ARRAY OF CHAR) <* noreturn *> ; diff --git a/gcc/m2/gm2-libs/M2RTS.mod b/gcc/m2/gm2-libs/M2RTS.mod index 0534c5d..4280fec 100644 --- a/gcc/m2/gm2-libs/M2RTS.mod +++ b/gcc/m2/gm2-libs/M2RTS.mod @@ -27,7 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see IMPLEMENTATION MODULE M2RTS ; -FROM libc IMPORT abort, exit, write, getenv, printf ; +FROM libc IMPORT abort, exit, write, getenv, printf, strlen ; (* FROM Builtins IMPORT strncmp, strcmp ; not available during bootstrap. *) FROM NumberIO IMPORT CardToStr ; FROM StrLib IMPORT StrCopy, StrLen, StrEqual ; @@ -39,6 +39,9 @@ IMPORT RTExceptions ; IMPORT M2EXCEPTION ; IMPORT M2Dependent ; +CONST + stderrFd = 2 ; + TYPE PtrToChar = POINTER TO CHAR ; @@ -254,24 +257,36 @@ PROCEDURE ErrorString (a: ARRAY OF CHAR) ; VAR n: INTEGER ; BEGIN - n := write (2, ADR (a), StrLen (a)) + n := write (stderrFd, ADR (a), StrLen (a)) END ErrorString ; (* + ErrorStringC - writes a string to stderr. +*) + +PROCEDURE ErrorStringC (str: ADDRESS) ; +VAR + len: INTEGER ; +BEGIN + len := write (stderrFd, str, strlen (str)) +END ErrorStringC ; + + +(* ErrorMessage - emits an error message to stderr and then calls exit (1). *) PROCEDURE ErrorMessage (message: ARRAY OF CHAR; - file: ARRAY OF CHAR; + filename: ARRAY OF CHAR; line: CARDINAL; function: ARRAY OF CHAR) <* noreturn *> ; VAR - LineNo: ARRAY [0..10] OF CHAR ; + buffer: ARRAY [0..10] OF CHAR ; BEGIN - ErrorString (file) ; ErrorString(':') ; - CardToStr (line, 0, LineNo) ; - ErrorString (LineNo) ; ErrorString(':') ; + ErrorString (filename) ; ErrorString(':') ; + CardToStr (line, 0, buffer) ; + ErrorString (buffer) ; ErrorString(':') ; IF NOT StrEqual (function, '') THEN ErrorString ('in ') ; @@ -279,22 +294,61 @@ BEGIN ErrorString (' has caused ') ; END ; ErrorString (message) ; - LineNo[0] := nl ; LineNo[1] := nul ; - ErrorString (LineNo) ; + buffer[0] := nl ; buffer[1] := nul ; + ErrorString (buffer) ; exit (1) END ErrorMessage ; (* + ErrorMessageC - emits an error message to stderr and then calls exit (1). +*) + +PROCEDURE ErrorMessageC (message, filename: ADDRESS; + line: CARDINAL; + function: ADDRESS) <* noreturn *> ; +VAR + buffer: ARRAY [0..10] OF CHAR ; +BEGIN + ErrorStringC (filename) ; ErrorString (':') ; + CardToStr (line, 0, buffer) ; + ErrorString (buffer) ; ErrorString(':') ; + IF strlen (function) > 0 + THEN + ErrorString ('in ') ; + ErrorStringC (function) ; + ErrorString (' has caused ') ; + END ; + ErrorStringC (message) ; + buffer[0] := nl ; buffer[1] := nul ; + ErrorString (buffer) ; + exit (1) +END ErrorMessageC ; + + +(* + HaltC - provides a more user friendly version of HALT, which takes + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). +*) + +PROCEDURE HaltC (filename: ADDRESS; line: CARDINAL; + function, description: ADDRESS) ; +BEGIN + ErrorMessageC (description, filename, line, function) +END HaltC ; + + +(* Halt - provides a more user friendly version of HALT, which takes - four parameters to aid debugging. + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). *) -PROCEDURE Halt (file: ARRAY OF CHAR; line: CARDINAL; +PROCEDURE Halt (filename: ARRAY OF CHAR; line: CARDINAL; function: ARRAY OF CHAR; description: ARRAY OF CHAR) ; BEGIN - ErrorMessage (description, file, line, function) ; - HALT + ErrorMessage (description, filename, line, function) END Halt ; -- cgit v1.1 From 1fce7d29ebb47c805ad4d38b68e00f7b1178f467 Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Tue, 17 Jan 2023 15:39:59 +0000 Subject: Obfuscate the copyright text in gcc/m2/mc/mcOptions.mod Obfuscate the copyright text in gcc/m2/mc/mcOptions.mod so that the year change script does not attempt to modify the text. The year is determined at runtime and therefore the text requires no modification. The middle printf (C) can be replaced by a unicode character in the future. gcc/m2/ChangeLog: * mc-boot/GM2RTS.c: Rebuilt. * mc-boot/GM2RTS.h: Rebuilt. * mc-boot/Gdecl.c: Rebuilt. * mc-boot/GmcOptions.c: Rebuilt. * mc/mcOptions.mod (displayVersion): Split first printf into three components Signed-off-by: Gaius Mulley --- gcc/m2/mc-boot/GM2RTS.c | 121 +++++++++++++++++++++++++++++++++++--------- gcc/m2/mc-boot/GM2RTS.h | 15 ++++-- gcc/m2/mc-boot/Gdecl.c | 25 ++++----- gcc/m2/mc-boot/GmcOptions.c | 5 +- gcc/m2/mc/mcOptions.mod | 5 +- 5 files changed, 131 insertions(+), 40 deletions(-) (limited to 'gcc') diff --git a/gcc/m2/mc-boot/GM2RTS.c b/gcc/m2/mc-boot/GM2RTS.c index 590656e..1b08741 100644 --- a/gcc/m2/mc-boot/GM2RTS.c +++ b/gcc/m2/mc-boot/GM2RTS.c @@ -61,6 +61,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see typedef struct M2RTS_ArgCVEnvP_p M2RTS_ArgCVEnvP; +# define stderrFd 2 typedef struct M2RTS_ProcedureList_r M2RTS_ProcedureList; typedef char *M2RTS_PtrToChar; @@ -175,10 +176,19 @@ extern "C" void M2RTS_HALT (int exitcode) __attribute__ ((noreturn)); /* Halt - provides a more user friendly version of HALT, which takes - four parameters to aid debugging. + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). */ -extern "C" void M2RTS_Halt (const char *file_, unsigned int _file_high, unsigned int line, const char *function_, unsigned int _function_high, const char *description_, unsigned int _description_high) __attribute__ ((noreturn)); +extern "C" void M2RTS_Halt (const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high, const char *description_, unsigned int _description_high) __attribute__ ((noreturn)); + +/* + HaltC - provides a more user friendly version of HALT, which takes + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). +*/ + +extern "C" void M2RTS_HaltC (void * filename, unsigned int line, void * function, void * description); /* ExitOnHalt - if HALT is executed then call exit with the exit code, e. @@ -190,7 +200,7 @@ extern "C" void M2RTS_ExitOnHalt (int e); ErrorMessage - emits an error message to stderr and then calls exit (1). */ -extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *file_, unsigned int _file_high, unsigned int line, const char *function_, unsigned int _function_high) __attribute__ ((noreturn)); +extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high) __attribute__ ((noreturn)); /* Length - returns the length of a string, a. This is called whenever @@ -246,6 +256,18 @@ static unsigned int AppendProc (M2RTS_ProcedureList *proclist, PROC proc); static void ErrorString (const char *a_, unsigned int _a_high); /* + ErrorStringC - writes a string to stderr. +*/ + +static void ErrorStringC (void * str); + +/* + ErrorMessageC - emits an error message to stderr and then calls exit (1). +*/ + +static void ErrorMessageC (void * message, void * filename, unsigned int line, void * function) __attribute__ ((noreturn)); + +/* InitProcList - initialize the head and tail pointers to NIL. */ @@ -319,7 +341,49 @@ static void ErrorString (const char *a_, unsigned int _a_high) /* make a local copy of each unbounded array. */ memcpy (a, a_, _a_high+1); - n = static_cast (libc_write (2, &a, static_cast (StrLib_StrLen ((const char *) a, _a_high)))); + n = static_cast (libc_write (stderrFd, &a, static_cast (StrLib_StrLen ((const char *) a, _a_high)))); +} + + +/* + ErrorStringC - writes a string to stderr. +*/ + +static void ErrorStringC (void * str) +{ + int len; + + len = static_cast (libc_write (stderrFd, str, libc_strlen (str))); +} + + +/* + ErrorMessageC - emits an error message to stderr and then calls exit (1). +*/ + +static void ErrorMessageC (void * message, void * filename, unsigned int line, void * function) +{ + typedef struct ErrorMessageC__T2_a ErrorMessageC__T2; + + struct ErrorMessageC__T2_a { char array[10+1]; }; + ErrorMessageC__T2 buffer; + + ErrorStringC (filename); + ErrorString ((const char *) ":", 1); + NumberIO_CardToStr (line, 0, (char *) &buffer.array[0], 10); + ErrorString ((const char *) &buffer.array[0], 10); + ErrorString ((const char *) ":", 1); + if ((libc_strlen (function)) > 0) + { + ErrorString ((const char *) "in ", 3); + ErrorStringC (function); + ErrorString ((const char *) " has caused ", 12); + } + ErrorStringC (message); + buffer.array[0] = ASCII_nl; + buffer.array[1] = ASCII_nul; + ErrorString ((const char *) &buffer.array[0], 10); + libc_exit (1); } @@ -516,23 +580,34 @@ extern "C" void M2RTS_HALT (int exitcode) /* Halt - provides a more user friendly version of HALT, which takes - four parameters to aid debugging. + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). */ -extern "C" void M2RTS_Halt (const char *file_, unsigned int _file_high, unsigned int line, const char *function_, unsigned int _function_high, const char *description_, unsigned int _description_high) +extern "C" void M2RTS_Halt (const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high, const char *description_, unsigned int _description_high) { - char file[_file_high+1]; + char filename[_filename_high+1]; char function[_function_high+1]; char description[_description_high+1]; /* make a local copy of each unbounded array. */ - memcpy (file, file_, _file_high+1); + memcpy (filename, filename_, _filename_high+1); memcpy (function, function_, _function_high+1); memcpy (description, description_, _description_high+1); - M2RTS_ErrorMessage ((const char *) description, _description_high, (const char *) file, _file_high, line, (const char *) function, _function_high); - M2RTS_HALT (-1); - __builtin_unreachable (); + M2RTS_ErrorMessage ((const char *) description, _description_high, (const char *) filename, _filename_high, line, (const char *) function, _function_high); +} + + +/* + HaltC - provides a more user friendly version of HALT, which takes + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). +*/ + +extern "C" void M2RTS_HaltC (void * filename, unsigned int line, void * function, void * description) +{ + ErrorMessageC (description, filename, line, function); } @@ -551,25 +626,25 @@ extern "C" void M2RTS_ExitOnHalt (int e) ErrorMessage - emits an error message to stderr and then calls exit (1). */ -extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *file_, unsigned int _file_high, unsigned int line, const char *function_, unsigned int _function_high) +extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high) { - typedef struct ErrorMessage__T2_a ErrorMessage__T2; + typedef struct ErrorMessage__T3_a ErrorMessage__T3; - struct ErrorMessage__T2_a { char array[10+1]; }; - ErrorMessage__T2 LineNo; + struct ErrorMessage__T3_a { char array[10+1]; }; + ErrorMessage__T3 buffer; char message[_message_high+1]; - char file[_file_high+1]; + char filename[_filename_high+1]; char function[_function_high+1]; /* make a local copy of each unbounded array. */ memcpy (message, message_, _message_high+1); - memcpy (file, file_, _file_high+1); + memcpy (filename, filename_, _filename_high+1); memcpy (function, function_, _function_high+1); - ErrorString ((const char *) file, _file_high); + ErrorString ((const char *) filename, _filename_high); ErrorString ((const char *) ":", 1); - NumberIO_CardToStr (line, 0, (char *) &LineNo.array[0], 10); - ErrorString ((const char *) &LineNo.array[0], 10); + NumberIO_CardToStr (line, 0, (char *) &buffer.array[0], 10); + ErrorString ((const char *) &buffer.array[0], 10); ErrorString ((const char *) ":", 1); if (! (StrLib_StrEqual ((const char *) function, _function_high, (const char *) "", 0))) { @@ -578,9 +653,9 @@ extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_ ErrorString ((const char *) " has caused ", 12); } ErrorString ((const char *) message, _message_high); - LineNo.array[0] = ASCII_nl; - LineNo.array[1] = ASCII_nul; - ErrorString ((const char *) &LineNo.array[0], 10); + buffer.array[0] = ASCII_nl; + buffer.array[1] = ASCII_nul; + ErrorString ((const char *) &buffer.array[0], 10); libc_exit (1); } diff --git a/gcc/m2/mc-boot/GM2RTS.h b/gcc/m2/mc-boot/GM2RTS.h index 698f142..5db589e 100644 --- a/gcc/m2/mc-boot/GM2RTS.h +++ b/gcc/m2/mc-boot/GM2RTS.h @@ -126,10 +126,19 @@ EXTERN void M2RTS_HALT (int exitcode) __attribute__ ((noreturn)); /* Halt - provides a more user friendly version of HALT, which takes - four parameters to aid debugging. + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). */ -EXTERN void M2RTS_Halt (const char *file_, unsigned int _file_high, unsigned int line, const char *function_, unsigned int _function_high, const char *description_, unsigned int _description_high) __attribute__ ((noreturn)); +EXTERN void M2RTS_Halt (const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high, const char *description_, unsigned int _description_high) __attribute__ ((noreturn)); + +/* + HaltC - provides a more user friendly version of HALT, which takes + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). +*/ + +EXTERN void M2RTS_HaltC (void * filename, unsigned int line, void * function, void * description); /* ExitOnHalt - if HALT is executed then call exit with the exit code, e. @@ -141,7 +150,7 @@ EXTERN void M2RTS_ExitOnHalt (int e); ErrorMessage - emits an error message to stderr and then calls exit (1). */ -EXTERN void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *file_, unsigned int _file_high, unsigned int line, const char *function_, unsigned int _function_high) __attribute__ ((noreturn)); +EXTERN void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high) __attribute__ ((noreturn)); /* Length - returns the length of a string, a. This is called whenever diff --git a/gcc/m2/mc-boot/Gdecl.c b/gcc/m2/mc-boot/Gdecl.c index 5a92e9a..6511cbb 100644 --- a/gcc/m2/mc-boot/Gdecl.c +++ b/gcc/m2/mc-boot/Gdecl.c @@ -293,16 +293,16 @@ typedef enum {mcComment_unknown, mcComment_procedureHeading, mcComment_inBody, m typedef struct DynamicStrings_stringRecord_r DynamicStrings_stringRecord; -typedef struct wlists__T9_r wlists__T9; - typedef struct DynamicStrings_Contents_r DynamicStrings_Contents; -typedef struct DynamicStrings__T7_a DynamicStrings__T7; +typedef struct wlists__T9_r wlists__T9; typedef struct mcPretty__T12_r mcPretty__T12; typedef struct wlists__T10_a wlists__T10; +typedef struct DynamicStrings__T7_a DynamicStrings__T7; + typedef Indexing__T5 *Indexing_Index; typedef mcComment__T6 *mcComment_commentDesc; @@ -665,8 +665,8 @@ struct mcComment__T6_r { unsigned int used; }; -struct DynamicStrings__T7_a { char array[(MaxBuf-1)+1]; }; struct wlists__T10_a { unsigned int array[maxNoOfElements-1+1]; }; +struct DynamicStrings__T7_a { char array[(MaxBuf-1)+1]; }; struct alists__T13_r { unsigned int noOfelements; alists__T14 elements; @@ -830,18 +830,18 @@ struct decl_impT_r { decl_commentPair com; }; -struct wlists__T9_r { - unsigned int noOfElements; - wlists__T10 elements; - wlists_wlist next; - }; - struct DynamicStrings_Contents_r { DynamicStrings__T7 buf; unsigned int len; DynamicStrings_String next; }; +struct wlists__T9_r { + unsigned int noOfElements; + wlists__T10 elements; + wlists_wlist next; + }; + struct mcPretty__T12_r { mcPretty_writeProc write_; mcPretty_writeLnProc writeln; @@ -1037,9 +1037,10 @@ extern "C" unsigned int M2RTS_InstallInitialProcedure (PROC p); extern "C" void M2RTS_ExecuteTerminationProcedures (void); extern "C" void M2RTS_Terminate (void) __attribute__ ((noreturn)); extern "C" void M2RTS_HALT (int exitcode) __attribute__ ((noreturn)); -extern "C" void M2RTS_Halt (const char *file_, unsigned int _file_high, unsigned int line, const char *function_, unsigned int _function_high, const char *description_, unsigned int _description_high) __attribute__ ((noreturn)); +extern "C" void M2RTS_Halt (const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high, const char *description_, unsigned int _description_high) __attribute__ ((noreturn)); +extern "C" void M2RTS_HaltC (void * filename, unsigned int line, void * function, void * description); extern "C" void M2RTS_ExitOnHalt (int e); -extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *file_, unsigned int _file_high, unsigned int line, const char *function_, unsigned int _function_high) __attribute__ ((noreturn)); +extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high) __attribute__ ((noreturn)); extern "C" unsigned int M2RTS_Length (const char *a_, unsigned int _a_high); extern "C" void M2RTS_AssignmentException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); extern "C" void M2RTS_ReturnException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); diff --git a/gcc/m2/mc-boot/GmcOptions.c b/gcc/m2/mc-boot/GmcOptions.c index 3088ba4..77801c0 100644 --- a/gcc/m2/mc-boot/GmcOptions.c +++ b/gcc/m2/mc-boot/GmcOptions.c @@ -324,7 +324,10 @@ static void displayVersion (unsigned int mustExit) unsigned int year; year = getYear (); - mcPrintf_printf1 ((const char *) "Copyright (C) %d Free Software Foundation, Inc.\\n", 49, (const unsigned char *) &year, (sizeof (year)-1)); + /* These first three calls to printf hide the first line of text away from the year change script. */ + mcPrintf_printf0 ((const char *) "Copyright ", 10); + mcPrintf_printf0 ((const char *) "(C)", 3); /* A unicode char here would be good. */ + mcPrintf_printf1 ((const char *) " %d Free Software Foundation, Inc.\\n", 36, (const unsigned char *) &year, (sizeof (year)-1)); /* A unicode char here would be good. */ mcPrintf_printf0 ((const char *) "License GPLv3: GNU GPL version 3 or later \\n", 78); mcPrintf_printf0 ((const char *) "This is free software: you are free to change and redistribute it.\\n", 68); mcPrintf_printf0 ((const char *) "There is NO WARRANTY, to the extent permitted by law.\\n", 55); diff --git a/gcc/m2/mc/mcOptions.mod b/gcc/m2/mc/mcOptions.mod index 3204b68..909d798 100644 --- a/gcc/m2/mc/mcOptions.mod +++ b/gcc/m2/mc/mcOptions.mod @@ -87,7 +87,10 @@ VAR year: CARDINAL ; BEGIN year := getYear () ; - printf1 ('Copyright (C) %d Free Software Foundation, Inc.\n', year) ; + (* These first three calls to printf hide the first line of text away from the year change script. *) + printf0 ('Copyright ') ; + printf0 ('(C)') ; (* A unicode char here would be good. *) + printf1 (' %d Free Software Foundation, Inc.\n', year) ; printf0 ('License GPLv3: GNU GPL version 3 or later \n') ; printf0 ('This is free software: you are free to change and redistribute it.\n') ; printf0 ('There is NO WARRANTY, to the extent permitted by law.\n') ; -- cgit v1.1 From 3b81f5c4d8e0d79cbd6927d004185707c14e54b2 Mon Sep 17 00:00:00 2001 From: "Jose E. Marchesi" Date: Tue, 17 Jan 2023 17:16:32 +0100 Subject: bpf: disable -fstack-protector in BPF The stack protector is not supported in BPF. This patch disables -fstack-protector in bpf-* targets, along with the emission of a note indicating that the feature is not supported in this platform. Regtested in bpf-unknown-none. gcc/ChangeLog: * config/bpf/bpf.cc (bpf_option_override): Disable -fstack-protector. --- gcc/config/bpf/bpf.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc') diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc index 576a1fe8..b268801 100644 --- a/gcc/config/bpf/bpf.cc +++ b/gcc/config/bpf/bpf.cc @@ -253,6 +253,14 @@ bpf_option_override (void) if (bpf_has_jmp32 == -1) bpf_has_jmp32 = (bpf_isa >= ISA_V3); + /* Disable -fstack-protector as it is not supported in BPF. */ + if (flag_stack_protect) + { + inform (input_location, + "%<-fstack-protector%> does not work " + " on this architecture"); + flag_stack_protect = 0; + } } #undef TARGET_OPTION_OVERRIDE -- cgit v1.1 From 6d80690132a2f00fae1f619d4ffd950ce8cfdbc7 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 17 Jan 2023 09:02:49 -0800 Subject: go: define two builtin functions used by middle-end PR go/108426 * go-gcc.cc (Gcc_backend::Gcc_backend): Define __builtin_ctzl and __builtin_clzl. Patch by Andrew Pinski. --- gcc/go/go-gcc.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gcc') diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index a4a0e5d..07c34a5 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -627,6 +627,11 @@ Gcc_backend::Gcc_backend() unsigned_type_node, NULL_TREE), builtin_const); + this->define_builtin(BUILT_IN_CTZL, "__builtin_ctzl", "ctzl", + build_function_type_list(integer_type_node, + long_unsigned_type_node, + NULL_TREE), + builtin_const); this->define_builtin(BUILT_IN_CTZLL, "__builtin_ctzll", "ctzll", build_function_type_list(integer_type_node, long_long_unsigned_type_node, @@ -637,6 +642,11 @@ Gcc_backend::Gcc_backend() unsigned_type_node, NULL_TREE), builtin_const); + this->define_builtin(BUILT_IN_CLZL, "__builtin_clzl", "clzl", + build_function_type_list(integer_type_node, + long_unsigned_type_node, + NULL_TREE), + builtin_const); this->define_builtin(BUILT_IN_CLZLL, "__builtin_clzll", "clzll", build_function_type_list(integer_type_node, long_long_unsigned_type_node, -- cgit v1.1 From a75760374ee54768e5fd6a27080698bfbbd041ab Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Mon, 16 Jan 2023 21:30:56 +0100 Subject: Fortran: fix ICE in get_expr_storage_size [PR108421] gcc/fortran/ChangeLog: PR fortran/108421 * interface.cc (get_expr_storage_size): Check that we actually have an integer value before trying to extract it with mpz_get_si. gcc/testsuite/ChangeLog: PR fortran/108421 * gfortran.dg/pr108421.f90: New test. --- gcc/fortran/interface.cc | 3 ++- gcc/testsuite/gfortran.dg/pr108421.f90 | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr108421.f90 (limited to 'gcc') diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc index c4f7faa..9593fa8 100644 --- a/gcc/fortran/interface.cc +++ b/gcc/fortran/interface.cc @@ -2858,7 +2858,8 @@ get_expr_storage_size (gfc_expr *e) if (e->ts.type == BT_CHARACTER) { if (e->ts.u.cl && e->ts.u.cl->length - && e->ts.u.cl->length->expr_type == EXPR_CONSTANT) + && e->ts.u.cl->length->expr_type == EXPR_CONSTANT + && e->ts.u.cl->length->ts.type == BT_INTEGER) strlen = mpz_get_si (e->ts.u.cl->length->value.integer); else if (e->expr_type == EXPR_CONSTANT && (e->ts.u.cl == NULL || e->ts.u.cl->length == NULL)) diff --git a/gcc/testsuite/gfortran.dg/pr108421.f90 b/gcc/testsuite/gfortran.dg/pr108421.f90 new file mode 100644 index 0000000..89439bc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr108421.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! PR fortran/108421 +! Contributed by G.Steinmetz + +program p + character(real(3)) :: c ! { dg-error "must be of INTEGER type" } + call s(c) +end +subroutine s(x) + character(*) :: x +end -- cgit v1.1 From 8d07b193d7df9523215120bb20bf06181be795b6 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 18 Jan 2023 00:17:21 +0000 Subject: Daily bump. --- gcc/ChangeLog | 13 +++++++++++++ gcc/DATESTAMP | 2 +- gcc/fortran/ChangeLog | 6 ++++++ gcc/go/ChangeLog | 6 ++++++ gcc/m2/ChangeLog | 27 +++++++++++++++++++++++++++ gcc/testsuite/ChangeLog | 18 ++++++++++++++++++ 6 files changed, 71 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index daddbdf..a8da615 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2023-01-17 Jose E. Marchesi + + * config/bpf/bpf.cc (bpf_option_override): Disable + -fstack-protector. + +2023-01-17 Jakub Jelinek + + PR tree-optimization/106523 + * tree-ssa-forwprop.cc (simplify_rotate): For the + patterns with (-Y) & (B - 1) in one operand's shift + count and Y in another, if T2 has wider precision than T, + punt if Y could have a value in [B, B2 - 1] range. + 2023-01-16 H.J. Lu PR target/105980 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9081c2e..5943f2b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20230117 +20230118 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5e6feea..3f3e03c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2023-01-17 Harald Anlauf + + PR fortran/108421 + * interface.cc (get_expr_storage_size): Check that we actually have + an integer value before trying to extract it with mpz_get_si. + 2023-01-12 Tobias Burnus PR fortran/107706 diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index bd03955..a4173f4 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,9 @@ +2023-01-17 Ian Lance Taylor + + PR go/108426 + * go-gcc.cc (Gcc_backend::Gcc_backend): Define __builtin_ctzl and + __builtin_clzl. Patch by Andrew Pinski. + 2023-01-02 Jakub Jelinek * gccgo.texi: Bump @copyrights-go year. diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog index 7364f1c..75acef3 100644 --- a/gcc/m2/ChangeLog +++ b/gcc/m2/ChangeLog @@ -1,3 +1,30 @@ +2023-01-17 Gaius Mulley + + * mc-boot/GM2RTS.c: Rebuilt. + * mc-boot/GM2RTS.h: Rebuilt. + * mc-boot/Gdecl.c: Rebuilt. + * mc-boot/GmcOptions.c: Rebuilt. + * mc/mcOptions.mod (displayVersion): + Split first printf into three components + +2023-01-17 Gaius Mulley + + * gm2-libs-iso/M2RTS.def (Halt): Parameter file renamed to filename. + (HaltC): New procedure declaration. + (ErrorMessage): Parameter file renamed to filename. + * gm2-libs-iso/M2RTS.mod (Halt): Parameter file renamed to + filename. + (HaltC): New procedure implementation. + (ErrorStringC): New procedure implementation. + (ErrorMessageC): New procedure implementation. + * gm2-libs/M2RTS.def (Halt): Parameter file renamed to filename. + (HaltC): New procedure declaration. + (ErrorMessage): Parameter file renamed to filename. + * gm2-libs/M2RTS.mod (Halt): Parameter file renamed to filename. + (HaltC): New procedure implementation. + (ErrorStringC): New procedure implementation. + (ErrorMessageC): New procedure implementation. + 2023-01-16 Gaius Mulley * mc-boot-ch/Glibc.c (libc_time): New function. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f96175e..0cb635b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,21 @@ +2023-01-17 Harald Anlauf + + PR fortran/108421 + * gfortran.dg/pr108421.f90: New test. + +2023-01-17 Jakub Jelinek + + PR tree-optimization/106523 + * c-c++-common/rotate-2.c (f5, f6, f7, f8, f13, f14, f15, f16, + f37, f38, f39, f40, f45, f46, f47, f48): Add assertions using + __builtin_unreachable about shift count. + * c-c++-common/rotate-2b.c: New test. + * c-c++-common/rotate-4.c (f5, f6, f7, f8, f13, f14, f15, f16, + f37, f38, f39, f40, f45, f46, f47, f48): Add assertions using + __builtin_unreachable about shift count. + * c-c++-common/rotate-4b.c: New test. + * gcc.c-torture/execute/pr106523.c: New test. + 2023-01-16 Andrew Pinski * lib/target-supports.exp (add_options_for_tls): Remove -- cgit v1.1 From 04d7cc165387d19e1433a4b2157d2bde7b95305b Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Tue, 17 Jan 2023 17:30:49 -0800 Subject: Fix bug number reference in Changelogs --- gcc/fortran/ChangeLog-2022 | 2 +- gcc/testsuite/ChangeLog-2022 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/fortran/ChangeLog-2022 b/gcc/fortran/ChangeLog-2022 index 71e551d..253af76 100644 --- a/gcc/fortran/ChangeLog-2022 +++ b/gcc/fortran/ChangeLog-2022 @@ -1,6 +1,6 @@ 2022-12-30 Steve Kargl - PR fortran/102595 + PR fortran/102331 * decl.cc (attr_decl1): Guard against NULL pointer. * parse.cc (match_deferred_characteristics): Include BT_CLASS in check for derived being undefined. diff --git a/gcc/testsuite/ChangeLog-2022 b/gcc/testsuite/ChangeLog-2022 index d9fafcc..9782784 100644 --- a/gcc/testsuite/ChangeLog-2022 +++ b/gcc/testsuite/ChangeLog-2022 @@ -11,7 +11,7 @@ 2022-12-30 Steve Kargl - PR fortran/102595 + PR fortran/102331 * gfortran.dg/class_result_4.f90: Update error message check. * gfortran.dg/pr85779_3.f90: Update error message check. -- cgit v1.1 From 159b0f41adc4c8ead45e12a523470381ce716ff2 Mon Sep 17 00:00:00 2001 From: liuhongt Date: Fri, 13 Jan 2023 16:19:47 +0800 Subject: Don't add crtfastmath.o for -shared. Patches [1] and [2] fixed PR55522 for x86-linux but left all other x86 targets unfixed (x86-cygwin, x86-darwin and x86-mingw32). This patch applies a similar change to other specs using crtfastmath.o. [1] https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608528.html [2] https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608529.html gcc/ChangeLog: PR target/55522 * config/i386/cygwin.h (ENDFILE_SPEC): Link crtfastmath.o whenever -mdaz-ftz is specified. Don't link crtfastmath.o when -share or -mno-daz-ftz is specified. * config/i386/darwin.h (ENDFILE_SPEC): Ditto. * config/i386/mingw32.h (ENDFILE_SPEC): Ditto. --- gcc/config/i386/cygwin.h | 2 +- gcc/config/i386/darwin.h | 2 +- gcc/config/i386/mingw32.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h index 4f219fb..b2c45ab 100644 --- a/gcc/config/i386/cygwin.h +++ b/gcc/config/i386/cygwin.h @@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}\ + "%{mdaz-ftz:crtfastmath.o%s;Ofast|ffast-math|funsafe-math-optimizations:%{!shared:%{!mno-daz-ftz:crtfastmath.o%s}}} \ %{!shared:%:if-exists(default-manifest.o%s)}\ %{fvtable-verify=none:%s; \ fvtable-verify=preinit:vtv_end.o%s; \ diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index 074a648..588bd66 100644 --- a/gcc/config/i386/darwin.h +++ b/gcc/config/i386/darwin.h @@ -110,7 +110,7 @@ along with GCC; see the file COPYING3. If not see #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{mdaz-ftz:crtfastmath.o%s;Ofast|ffast-math|funsafe-math-optimizations:%{!shared:%{!mno-daz-ftz:crtfastmath.o%s}}} \ %{mpc32:crtprec32.o%s} \ %{mpc64:crtprec64.o%s} \ %{mpc80:crtprec80.o%s}" TM_DESTRUCTOR diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h index f7379de..6a55baa 100644 --- a/gcc/config/i386/mingw32.h +++ b/gcc/config/i386/mingw32.h @@ -196,7 +196,7 @@ along with GCC; see the file COPYING3. If not see #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{mdaz-ftz:crtfastmath.o%s;Ofast|ffast-math|funsafe-math-optimizations:%{!shared:%{!mno-daz-ftz:crtfastmath.o%s}}} \ %{!shared:%:if-exists(default-manifest.o%s)}\ %{fvtable-verify=none:%s; \ fvtable-verify=preinit:vtv_end.o%s; \ -- cgit v1.1 From 5d9529687deb9ed009361a16c02a7f6c3e2ebbf3 Mon Sep 17 00:00:00 2001 From: Kewen Lin Date: Wed, 18 Jan 2023 02:34:19 -0600 Subject: rs6000: Teach rs6000_opaque_type_invalid_use_p about gcall [PR108348] PR108348 shows one special case that MMA opaque types are used in function arguments and treated as pass by reference, it results in one copying from argument to a temp variable, since this copying happens before rs6000_function_arg check, it can cause ICE without MMA support then. This patch is to teach function rs6000_opaque_type_invalid_use_p to check if any function argument in a gcall stmt has the invalid use of MMA opaque types. btw, I checked the handling on return value, it doesn't have this kind of issue as its checking and error emission is quite early, so this doesn't handle function return value. PR target/108348 gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_opaque_type_invalid_use_p): Add the support for invalid uses of MMA opaque type in function arguments. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr108348-1.c: New test. * gcc.target/powerpc/pr108348-2.c: New test. --- gcc/config/rs6000/rs6000.cc | 19 +++++++++++++++---- gcc/testsuite/gcc.target/powerpc/pr108348-1.c | 23 +++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/pr108348-2.c | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr108348-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/pr108348-2.c (limited to 'gcc') diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 1b8ed7a..16ca3a3 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -28928,9 +28928,9 @@ constant_generates_xxspltidp (vec_const_128bit_type *vsx_const) __vector_pair built-in types. They are target specific and only available when MMA is supported. With MMA supported, it simply returns true, otherwise it checks if the given gimple - STMT is an assignment or asm stmt and uses either of these two - opaque types unexpectedly, if yes, it would raise an error - message and returns true, otherwise it returns false. */ + STMT is an assignment, asm or call stmt and uses either of + these two opaque types unexpectedly, if yes, it would raise + an error message and returns true, otherwise it returns false. */ bool rs6000_opaque_type_invalid_use_p (gimple *stmt) @@ -28959,7 +28959,7 @@ rs6000_opaque_type_invalid_use_p (gimple *stmt) if (stmt) { /* The usage of MMA opaque types is very limited for now, - to check with gassign and gasm is enough so far. */ + to check with gassign, gasm and gcall is enough so far. */ if (gassign *ga = dyn_cast (stmt)) { tree lhs = gimple_assign_lhs (ga); @@ -28988,6 +28988,17 @@ rs6000_opaque_type_invalid_use_p (gimple *stmt) return true; } } + else if (gcall *gc = dyn_cast (stmt)) + { + unsigned nargs = gimple_call_num_args (gc); + for (unsigned i = 0; i < nargs; i++) + { + tree arg = gimple_call_arg (gc, i); + tree type = TREE_TYPE (arg); + if (check_and_error_invalid_use (type)) + return true; + } + } } return false; diff --git a/gcc/testsuite/gcc.target/powerpc/pr108348-1.c b/gcc/testsuite/gcc.target/powerpc/pr108348-1.c new file mode 100644 index 0000000..29cbe7a --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr108348-1.c @@ -0,0 +1,23 @@ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* If the default cpu type is power10 or later, type __vector_quad is + supported. To keep the test point available all the time, this case + specifies -mdejagnu-cpu=power9 here. This needs -mabi=no-altivec + to do the copying for pass-by-reference function argument on 32 bit + environment. */ +/* { dg-options "-mdejagnu-cpu=power9 -mabi=no-altivec" } */ + +/* Verify there is no ICE on 32 bit and don't check the error messages + on unsupported type since they could be fragile and are not test + points of this case. */ + +/* { dg-excess-errors "pr108348-1" } */ + +extern void bar (__vector_quad v); + +void +foo (void) +{ + __vector_quad v; + bar (v); +} + diff --git a/gcc/testsuite/gcc.target/powerpc/pr108348-2.c b/gcc/testsuite/gcc.target/powerpc/pr108348-2.c new file mode 100644 index 0000000..9aa8939 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr108348-2.c @@ -0,0 +1,23 @@ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* If the default cpu type is power10 or later, type __vector_pair is + supported. To keep the test point available all the time, this case + specifies -mdejagnu-cpu=power9 here. This needs -mabi=no-altivec + to do the copying for pass-by-reference function argument on 32 bit + environment. */ +/* { dg-options "-mdejagnu-cpu=power9 -mabi=no-altivec" } */ + +/* Verify there is no ICE on 32 bit and don't check the error messages + on unsupported type since they could be fragile and are not test + points of this case. */ + +/* { dg-excess-errors "pr108348-2" } */ + +extern void bar (__vector_pair v); + +void +foo (void) +{ + __vector_pair v; + bar (v); +} + -- cgit v1.1 From aaf29ae6cdbaad58b709a77784375d15138174b3 Mon Sep 17 00:00:00 2001 From: Kewen Lin Date: Wed, 18 Jan 2023 02:34:25 -0600 Subject: rs6000: Fix typo on vec_vsubcuq in rs6000-overload.def [PR108396] As Andrew pointed out in PR108396, there is one typo in rs6000-overload.def on built-in function vec_vsubcuq: [VEC_VSUBCUQ, vec_vsubcuqP, __builtin_vec_vsubcuq] "vec_vsubcuqP" should be "vec_vsubcuq", this typo caused us to define vec_vsubcuqP in rs6000-vecdefines.h instead of vec_vsubcuq, so that compiler is not able to realize the built-in function name vec_vsubcuq any more. Co-authored-By: Andrew Pinski PR target/108396 gcc/ChangeLog: * config/rs6000/rs6000-overload.def (VEC_VSUBCUQ): Fix typo vec_vsubcuqP with vec_vsubcuq. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr108396.c: New test. --- gcc/config/rs6000/rs6000-overload.def | 2 +- gcc/testsuite/gcc.target/powerpc/pr108396.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr108396.c (limited to 'gcc') diff --git a/gcc/config/rs6000/rs6000-overload.def b/gcc/config/rs6000/rs6000-overload.def index 20cc031..c582490 100644 --- a/gcc/config/rs6000/rs6000-overload.def +++ b/gcc/config/rs6000/rs6000-overload.def @@ -5930,7 +5930,7 @@ unsigned int __builtin_vec_scalar_test_data_class_sp (float, const int); VSTDCSP VSTDCSP_DEPR1 -[VEC_VSUBCUQ, vec_vsubcuqP, __builtin_vec_vsubcuq] +[VEC_VSUBCUQ, vec_vsubcuq, __builtin_vec_vsubcuq] vsq __builtin_vec_vsubcuq (vsq, vsq); VSUBCUQ VSUBCUQ_DEPR1 vuq __builtin_vec_vsubcuq (vuq, vuq); diff --git a/gcc/testsuite/gcc.target/powerpc/pr108396.c b/gcc/testsuite/gcc.target/powerpc/pr108396.c new file mode 100644 index 0000000..a783f08 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr108396.c @@ -0,0 +1,14 @@ +/* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-require-effective-target int128 } */ +/* { dg-options "-mdejagnu-cpu=power8" } */ + +/* Verify there is no error message. */ + +#include + +vector unsigned __int128 +vsubcuq (vector unsigned __int128 a, vector unsigned __int128 b) +{ + return vec_vsubcuq (a, b); +} + -- cgit v1.1 From a4b05944b7d409682197a9f50759a4ed97145e23 Mon Sep 17 00:00:00 2001 From: Takayuki 'January June' Suwa Date: Wed, 18 Jan 2023 14:43:13 +0900 Subject: xtensa: Optimize inversion of the MSB Such operation can be done either bitwise-XOR or addition with -2147483648, but the latter is one byte less if TARGET_DENSITY. gcc/ChangeLog: * config/xtensa/xtensa.md (xorsi3_internal): Rename from the original of "xorsi3". (xorsi3): New expansion pattern that emits addition rather than bitwise-XOR when the second source is a constant of -2147483648 if TARGET_DENSITY. --- gcc/config/xtensa/xtensa.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 98f3c46..dd3fc37 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -736,7 +736,31 @@ (set_attr "mode" "SI") (set_attr "length" "3")]) -(define_insn "xorsi3" +(define_expand "xorsi3" + [(set (match_operand:SI 0 "register_operand") + (xor:SI (match_operand:SI 1 "register_operand") + (match_operand:SI 2 "nonmemory_operand")))] + "" +{ + if (register_operand (operands[2], SImode)) + emit_insn (gen_xorsi3_internal (operands[0], operands[1], + operands[2])); + else + { + rtx (*gen_op)(rtx, rtx, rtx); + if (TARGET_DENSITY + && CONST_INT_P (operands[2]) + && INTVAL (operands[2]) == -2147483648L) + gen_op = gen_addsi3; + else + gen_op = gen_xorsi3_internal; + emit_insn (gen_op (operands[0], operands[1], + force_reg (SImode, operands[2]))); + } + DONE; +}) + +(define_insn "xorsi3_internal" [(set (match_operand:SI 0 "register_operand" "=a") (xor:SI (match_operand:SI 1 "register_operand" "%r") (match_operand:SI 2 "register_operand" "r")))] -- cgit v1.1 From f54e31ddefe3ea7146624eabcb75b1c90dc59f1a Mon Sep 17 00:00:00 2001 From: Murray Steele Date: Wed, 22 Dec 2021 15:55:58 +0000 Subject: arm: fix __arm_vld1q_z* and __arm_vst1q_p* intrinsics [PR108442] The MVE ACLE allows for __ARM_MVE_PRESERVE_USER_NAMESPACE to be defined, which removes definitions for intrinsic functions without the __arm_ prefix. __arm_vld1q_z* and __arm_vst1q_p* are currently implemented via calls to vldr* and vstr*, which results in several compile-time errors when __ARM_MVE_PRESERVE_USER_NAMESPACE is defined. This patch replaces these with calls to their prefixed counterparts, __arm_vldr* and __arm_str*, and adds a test covering the definition of __ARM_MVE_PRESERVE_USER_NAMESPACE. gcc/ChangeLog: PR target/108442 * config/arm/arm_mve.h (__arm_vst1q_p_u8): Use prefixed intrinsic function. (__arm_vst1q_p_s8): Likewise. (__arm_vld1q_z_u8): Likewise. (__arm_vld1q_z_s8): Likewise. (__arm_vst1q_p_u16): Likewise. (__arm_vst1q_p_s16): Likewise. (__arm_vld1q_z_u16): Likewise. (__arm_vld1q_z_s16): Likewise. (__arm_vst1q_p_u32): Likewise. (__arm_vst1q_p_s32): Likewise. (__arm_vld1q_z_u32): Likewise. (__arm_vld1q_z_s32): Likewise. (__arm_vld1q_z_f16): Likewise. (__arm_vst1q_p_f16): Likewise. (__arm_vld1q_z_f32): Likewise. (__arm_vst1q_p_f32): Likewise. gcc/testsuite/ChangeLog: * gcc.target/arm/mve/general/preserve_user_namespace_1.c: New test. --- gcc/config/arm/arm_mve.h | 32 +++++++++++----------- .../arm/mve/general/preserve_user_namespace_1.c | 6 ++++ 2 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/mve/general/preserve_user_namespace_1.c (limited to 'gcc') diff --git a/gcc/config/arm/arm_mve.h b/gcc/config/arm/arm_mve.h index 13bdb60..bfbe1cd 100644 --- a/gcc/config/arm/arm_mve.h +++ b/gcc/config/arm/arm_mve.h @@ -16171,14 +16171,14 @@ __extension__ extern __inline void __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vst1q_p_u8 (uint8_t * __addr, uint8x16_t __value, mve_pred16_t __p) { - return vstrbq_p_u8 (__addr, __value, __p); + return __arm_vstrbq_p_u8 (__addr, __value, __p); } __extension__ extern __inline void __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vst1q_p_s8 (int8_t * __addr, int8x16_t __value, mve_pred16_t __p) { - return vstrbq_p_s8 (__addr, __value, __p); + return __arm_vstrbq_p_s8 (__addr, __value, __p); } __extension__ extern __inline void @@ -16203,14 +16203,14 @@ __extension__ extern __inline uint8x16_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vld1q_z_u8 (uint8_t const *__base, mve_pred16_t __p) { - return vldrbq_z_u8 ( __base, __p); + return __arm_vldrbq_z_u8 ( __base, __p); } __extension__ extern __inline int8x16_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vld1q_z_s8 (int8_t const *__base, mve_pred16_t __p) { - return vldrbq_z_s8 ( __base, __p); + return __arm_vldrbq_z_s8 ( __base, __p); } __extension__ extern __inline int8x16x2_t @@ -16253,14 +16253,14 @@ __extension__ extern __inline void __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vst1q_p_u16 (uint16_t * __addr, uint16x8_t __value, mve_pred16_t __p) { - return vstrhq_p_u16 (__addr, __value, __p); + return __arm_vstrhq_p_u16 (__addr, __value, __p); } __extension__ extern __inline void __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vst1q_p_s16 (int16_t * __addr, int16x8_t __value, mve_pred16_t __p) { - return vstrhq_p_s16 (__addr, __value, __p); + return __arm_vstrhq_p_s16 (__addr, __value, __p); } __extension__ extern __inline void @@ -16285,14 +16285,14 @@ __extension__ extern __inline uint16x8_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vld1q_z_u16 (uint16_t const *__base, mve_pred16_t __p) { - return vldrhq_z_u16 ( __base, __p); + return __arm_vldrhq_z_u16 ( __base, __p); } __extension__ extern __inline int16x8_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vld1q_z_s16 (int16_t const *__base, mve_pred16_t __p) { - return vldrhq_z_s16 ( __base, __p); + return __arm_vldrhq_z_s16 ( __base, __p); } __extension__ extern __inline int16x8x2_t @@ -16335,14 +16335,14 @@ __extension__ extern __inline void __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vst1q_p_u32 (uint32_t * __addr, uint32x4_t __value, mve_pred16_t __p) { - return vstrwq_p_u32 (__addr, __value, __p); + return __arm_vstrwq_p_u32 (__addr, __value, __p); } __extension__ extern __inline void __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vst1q_p_s32 (int32_t * __addr, int32x4_t __value, mve_pred16_t __p) { - return vstrwq_p_s32 (__addr, __value, __p); + return __arm_vstrwq_p_s32 (__addr, __value, __p); } __extension__ extern __inline void @@ -16367,14 +16367,14 @@ __extension__ extern __inline uint32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vld1q_z_u32 (uint32_t const *__base, mve_pred16_t __p) { - return vldrwq_z_u32 ( __base, __p); + return __arm_vldrwq_z_u32 ( __base, __p); } __extension__ extern __inline int32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vld1q_z_s32 (int32_t const *__base, mve_pred16_t __p) { - return vldrwq_z_s32 ( __base, __p); + return __arm_vldrwq_z_s32 ( __base, __p); } __extension__ extern __inline int32x4x2_t @@ -19837,7 +19837,7 @@ __extension__ extern __inline float16x8_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vld1q_z_f16 (float16_t const *__base, mve_pred16_t __p) { - return vldrhq_z_f16 (__base, __p); + return __arm_vldrhq_z_f16 (__base, __p); } __extension__ extern __inline void @@ -19853,7 +19853,7 @@ __extension__ extern __inline void __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vst1q_p_f16 (float16_t * __addr, float16x8_t __value, mve_pred16_t __p) { - return vstrhq_p_f16 (__addr, __value, __p); + return __arm_vstrhq_p_f16 (__addr, __value, __p); } __extension__ extern __inline float32x4x4_t @@ -19878,7 +19878,7 @@ __extension__ extern __inline float32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vld1q_z_f32 (float32_t const *__base, mve_pred16_t __p) { - return vldrwq_z_f32 (__base, __p); + return __arm_vldrwq_z_f32 (__base, __p); } __extension__ extern __inline void @@ -19894,7 +19894,7 @@ __extension__ extern __inline void __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vst1q_p_f32 (float32_t * __addr, float32x4_t __value, mve_pred16_t __p) { - return vstrwq_p_f32 (__addr, __value, __p); + return __arm_vstrwq_p_f32 (__addr, __value, __p); } __extension__ extern __inline float16x8_t diff --git a/gcc/testsuite/gcc.target/arm/mve/general/preserve_user_namespace_1.c b/gcc/testsuite/gcc.target/arm/mve/general/preserve_user_namespace_1.c new file mode 100644 index 0000000..f107ac4 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/general/preserve_user_namespace_1.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ + +#define __ARM_MVE_PRESERVE_USER_NAMESPACE +#include -- cgit v1.1 From ddbe758b1742699481886fffa2afe17c28ec5315 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 18 Jan 2023 14:54:06 +0100 Subject: Revert "middle-end/108086 - avoid unshare_expr when remapping SSA names" This reverts commit da85bfc75024a92b97e60e4436863dd5789786ec. --- gcc/tree-inline.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc index 6cb2981..7fd0831 100644 --- a/gcc/tree-inline.cc +++ b/gcc/tree-inline.cc @@ -183,7 +183,7 @@ remap_ssa_name (tree name, copy_body_data *id) return name; } - return *n; + return unshare_expr (*n); } if (processing_debug_stmt) -- cgit v1.1 From d4abe5c456a3023f61c3e053255b7dd72ca0d7ec Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 18 Jan 2023 14:54:33 +0100 Subject: lto/108445 - avoid LTO decl wrapping being confused by tree sharing r13-4743 exposed more tree sharing which runs into a latent issue with LTO decl wrapping during streaming. The following adds a testcase triggering the issue. PR lto/108445 * gcc.dg/lto/pr108445_0.c: New testcase. * gcc.dg/lto/pr108445_1.c: Likewise. --- gcc/testsuite/gcc.dg/lto/pr108445_0.c | 4 ++++ gcc/testsuite/gcc.dg/lto/pr108445_1.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/lto/pr108445_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/pr108445_1.c (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/lto/pr108445_0.c b/gcc/testsuite/gcc.dg/lto/pr108445_0.c new file mode 100644 index 0000000..06dac69 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr108445_0.c @@ -0,0 +1,4 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options { "-g -O2 -flto" } } */ + +int gArray[16]; diff --git a/gcc/testsuite/gcc.dg/lto/pr108445_1.c b/gcc/testsuite/gcc.dg/lto/pr108445_1.c new file mode 100644 index 0000000..50db9fe --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr108445_1.c @@ -0,0 +1,19 @@ +extern int gArray[]; + +int foo(int *a) +{ + int *p = a; + + return *p; +} + +int main(int argc, char *argv[]) +{ + if (argc & 1) + gArray[argc - 1] = 1; + + if (argc > 1) + return foo(gArray); + + return 0; +} -- cgit v1.1 From db959e250077ae6b4fc08f53fb322719582c5de6 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Wed, 18 Jan 2023 15:29:54 +0100 Subject: ipa: Release body more carefully when removing nodes (PR 107944) The code removing function bodies when the last call graph clone of a node is removed is too aggressive when there are nodes up the clone_of chain which still need them. Fixed by expanding the check. gcc/ChangeLog: 2023-01-18 Martin Jambor PR ipa/107944 * cgraph.cc (cgraph_node::remove): Check whether nodes up the lcone_of chain also do not need the body. --- gcc/cgraph.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc index 5e60c2b..5f72ace 100644 --- a/gcc/cgraph.cc +++ b/gcc/cgraph.cc @@ -1893,8 +1893,18 @@ cgraph_node::remove (void) else if (clone_of) { clone_of->clones = next_sibling_clone; - if (!clone_of->analyzed && !clone_of->clones && !clones) - clone_of->release_body (); + if (!clones) + { + bool need_body = false; + for (cgraph_node *n = clone_of; n; n = n->clone_of) + if (n->analyzed || n->clones) + { + need_body = true; + break; + } + if (!need_body) + clone_of->release_body (); + } } if (next_sibling_clone) next_sibling_clone->prev_sibling_clone = prev_sibling_clone; -- cgit v1.1 From c6a011119bfa038ccbfc9f123ede14a3d6237fab Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 18 Jan 2023 11:41:47 -0500 Subject: analyzer: add SARD testsuite 81 A 2013 paper [1] proposed 5 simple tests for evaluating the effectiveness of static analysis tools at detecting CWE-121 ("Stack-based Buffer Overflow"). The tests can be found in: https://samate.nist.gov/SARD/test-suites/81 This patch adds theses 5 tests to -fanalyzer's testsuite, lightly modified to add DejaGnu directives. This is for unit-testing; for broader testing of -fanalyzer I'm working on a separate integration testing suite that builds various real-world C projects with -fanalyzer, currently here: https://github.com/davidmalcolm/gcc-analyzer-integration-tests [1] Black, P. , Koo, H. and Irish, T. (2013), A Basic CWE-121 Buffer Overflow Effectiveness Test Suite, Proc. 6th Latin-American Symposium on Dependable Computing, Rio de Janeiro, -1, [online], https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=913117 (Accessed January 17, 2023) gcc/testsuite/ChangeLog: * gcc.dg/analyzer/SARD-tc117-basic-00001-min.c: New test, adapted from https://samate.nist.gov/SARD/test-suites/81. * gcc.dg/analyzer/SARD-tc1909-stack_overflow_loop.c: Likewise. * gcc.dg/analyzer/SARD-tc249-basic-00034-min.c: Likewise. * gcc.dg/analyzer/SARD-tc293-basic-00045-min.c: Likewise. * gcc.dg/analyzer/SARD-tc841-basic-00182-min.c: Likewise. Signed-off-by: David Malcolm --- .../gcc.dg/analyzer/SARD-tc117-basic-00001-min.c | 67 ++++++++++++++++++++ .../analyzer/SARD-tc1909-stack_overflow_loop.c | 29 +++++++++ .../gcc.dg/analyzer/SARD-tc249-basic-00034-min.c | 67 ++++++++++++++++++++ .../gcc.dg/analyzer/SARD-tc293-basic-00045-min.c | 69 ++++++++++++++++++++ .../gcc.dg/analyzer/SARD-tc841-basic-00182-min.c | 73 ++++++++++++++++++++++ 5 files changed, 305 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/analyzer/SARD-tc117-basic-00001-min.c create mode 100644 gcc/testsuite/gcc.dg/analyzer/SARD-tc1909-stack_overflow_loop.c create mode 100644 gcc/testsuite/gcc.dg/analyzer/SARD-tc249-basic-00034-min.c create mode 100644 gcc/testsuite/gcc.dg/analyzer/SARD-tc293-basic-00045-min.c create mode 100644 gcc/testsuite/gcc.dg/analyzer/SARD-tc841-basic-00182-min.c (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/analyzer/SARD-tc117-basic-00001-min.c b/gcc/testsuite/gcc.dg/analyzer/SARD-tc117-basic-00001-min.c new file mode 100644 index 0000000..e1ce195 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/SARD-tc117-basic-00001-min.c @@ -0,0 +1,67 @@ +/* Adapted from https://samate.nist.gov/SARD/test-cases/117/versions/1.0.0 + Part of https://samate.nist.gov/SARD/test-suites/81 + See: + Black, P. , Koo, H. and Irish, T. (2013), A Basic CWE-121 Buffer Overflow Effectiveness Test Suite, Proc. 6th Latin-American Symposium on Dependable Computing, Rio de Janeiro, -1, [online], https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=913117 (Accessed January 17, 2023) +*/ + +/* Taxonomy Classification: 0000000000000000000100 */ + +/* + * WRITE/READ 0 write + * WHICH BOUND 0 upper + * DATA TYPE 0 char + * MEMORY LOCATION 0 stack + * SCOPE 0 same + * CONTAINER 0 no + * POINTER 0 no + * INDEX COMPLEXITY 0 constant + * ADDRESS COMPLEXITY 0 constant + * LENGTH COMPLEXITY 0 N/A + * ADDRESS ALIAS 0 none + * INDEX ALIAS 0 none + * LOCAL CONTROL FLOW 0 none + * SECONDARY CONTROL FLOW 0 none + * LOOP STRUCTURE 0 no + * LOOP COMPLEXITY 0 N/A + * ASYNCHRONY 0 no + * TAINT 0 no + * RUNTIME ENV. DEPENDENCE 0 no + * MAGNITUDE 1 1 byte + * CONTINUOUS/DISCRETE 0 discrete + * SIGNEDNESS 0 no + */ + +/* +Copyright 2004 M.I.T. + +Permission is hereby granted, without written agreement or royalty fee, to use, +copy, modify, and distribute this software and its documentation for any +purpose, provided that the above copyright notice and the following three +paragraphs appear in all copies of this software. + +IN NO EVENT SHALL M.I.T. BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, +INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE +AND ITS DOCUMENTATION, EVEN IF M.I.T. HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMANGE. + +M.I.T. SPECIFICALLY DISCLAIMS ANY WARRANTIES INCLUDING, BUT NOT LIMITED TO +THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +AND NON-INFRINGEMENT. + +THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND M.I.T. HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +*/ + + +int main(int argc, char *argv[]) +{ + char buf[10]; + + + /* BAD */ + buf[10] = 'A'; /* { dg-warning "stack-based buffer overflow" } */ + /* { dg-message "write of 1 byte to beyond the end of 'buf'" "note" { target *-*-* } .-1 } */ + + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/analyzer/SARD-tc1909-stack_overflow_loop.c b/gcc/testsuite/gcc.dg/analyzer/SARD-tc1909-stack_overflow_loop.c new file mode 100644 index 0000000..2a7612a --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/SARD-tc1909-stack_overflow_loop.c @@ -0,0 +1,29 @@ +/* Adapted from + https://samate.nist.gov/SARD/downloads/test-suites/2013-02-07-basic-cwe-effectiveness-cwe-121-stack-based-buffer-overflow-for-c.zip + Part of https://samate.nist.gov/SARD/test-suites/81: + See: + Black, P. , Koo, H. and Irish, T. (2013), A Basic CWE-121 Buffer Overflow Effectiveness Test Suite, Proc. 6th Latin-American Symposium on Dependable Computing, Rio de Janeiro, -1, [online], https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=913117 (Accessed January 17, 2023) +*/ + +/* This software was developed at the National Institute of Standards and + * Technology by employees of the Federal Government in the course of their + * official duties. Pursuant to title 17 Section 105 of the United States + * Code this software is not subject to copyright protection and is in the + * public domain. NIST assumes no responsibility whatsoever for its use by + * other parties, and makes no guarantees, expressed or implied, about its + * quality, reliability, or any other characteristic. + + * We would appreciate acknowledgement if the software is used. + * The SAMATE project website is: http://samate.nist.gov +*/ + +#include + +int main(int argc, char *argv[]) +{ + char bStr[10]; + for (unsigned i=1;i<=10;++i) { + bStr[i] = (char)i + 'a'; /* { dg-warning "stack-based buffer overflow" "PR analyzer/108432" { xfail *-*-* } } */ + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/analyzer/SARD-tc249-basic-00034-min.c b/gcc/testsuite/gcc.dg/analyzer/SARD-tc249-basic-00034-min.c new file mode 100644 index 0000000..4031e6d --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/SARD-tc249-basic-00034-min.c @@ -0,0 +1,67 @@ +/* Adapted from https://samate.nist.gov/SARD/test-cases/249/versions/1.0.0 + Part of https://samate.nist.gov/SARD/test-suites/81 + See: + Black, P. , Koo, H. and Irish, T. (2013), A Basic CWE-121 Buffer Overflow Effectiveness Test Suite, Proc. 6th Latin-American Symposium on Dependable Computing, Rio de Janeiro, -1, [online], https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=913117 (Accessed January 17, 2023) +*/ + +/* Taxonomy Classification: 0000001600030000000100 */ + +/* + * WRITE/READ 0 write + * WHICH BOUND 0 upper + * DATA TYPE 0 char + * MEMORY LOCATION 0 stack + * SCOPE 0 same + * CONTAINER 0 no + * POINTER 1 yes + * INDEX COMPLEXITY 6 N/A + * ADDRESS COMPLEXITY 0 constant + * LENGTH COMPLEXITY 0 N/A + * ADDRESS ALIAS 0 none + * INDEX ALIAS 3 N/A + * LOCAL CONTROL FLOW 0 none + * SECONDARY CONTROL FLOW 0 none + * LOOP STRUCTURE 0 no + * LOOP COMPLEXITY 0 N/A + * ASYNCHRONY 0 no + * TAINT 0 no + * RUNTIME ENV. DEPENDENCE 0 no + * MAGNITUDE 1 1 byte + * CONTINUOUS/DISCRETE 0 discrete + * SIGNEDNESS 0 no + */ + +/* +Copyright 2004 M.I.T. + +Permission is hereby granted, without written agreement or royalty fee, to use, +copy, modify, and distribute this software and its documentation for any +purpose, provided that the above copyright notice and the following three +paragraphs appear in all copies of this software. + +IN NO EVENT SHALL M.I.T. BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, +INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE +AND ITS DOCUMENTATION, EVEN IF M.I.T. HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMANGE. + +M.I.T. SPECIFICALLY DISCLAIMS ANY WARRANTIES INCLUDING, BUT NOT LIMITED TO +THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +AND NON-INFRINGEMENT. + +THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND M.I.T. HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +*/ + + +int main(int argc, char *argv[]) +{ + char buf[10]; + + + /* BAD */ + *(buf + 10) = 'A'; /* { dg-warning "stack-based buffer overflow" } */ + /* { dg-message "write of 1 byte to beyond the end of 'buf'" "note" { target *-*-* } .-1 } */ + + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/analyzer/SARD-tc293-basic-00045-min.c b/gcc/testsuite/gcc.dg/analyzer/SARD-tc293-basic-00045-min.c new file mode 100644 index 0000000..36c1946 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/SARD-tc293-basic-00045-min.c @@ -0,0 +1,69 @@ +/* Adapted from https://samate.nist.gov/SARD/test-cases/293/versions/1.0.0 + Part of https://samate.nist.gov/SARD/test-suites/81 + See: + Black, P. , Koo, H. and Irish, T. (2013), A Basic CWE-121 Buffer Overflow Effectiveness Test Suite, Proc. 6th Latin-American Symposium on Dependable Computing, Rio de Janeiro, -1, [online], https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=913117 (Accessed January 17, 2023) +*/ + +/* Taxonomy Classification: 0000300601130000000110 */ + +/* + * WRITE/READ 0 write + * WHICH BOUND 0 upper + * DATA TYPE 0 char + * MEMORY LOCATION 0 stack + * SCOPE 3 inter-file/inter-proc + * CONTAINER 0 no + * POINTER 0 no + * INDEX COMPLEXITY 6 N/A + * ADDRESS COMPLEXITY 0 constant + * LENGTH COMPLEXITY 1 none + * ADDRESS ALIAS 1 yes, one level + * INDEX ALIAS 3 N/A + * LOCAL CONTROL FLOW 0 none + * SECONDARY CONTROL FLOW 0 none + * LOOP STRUCTURE 0 no + * LOOP COMPLEXITY 0 N/A + * ASYNCHRONY 0 no + * TAINT 0 no + * RUNTIME ENV. DEPENDENCE 0 no + * MAGNITUDE 1 1 byte + * CONTINUOUS/DISCRETE 1 continuous + * SIGNEDNESS 0 no + */ + +/* +Copyright 2004 M.I.T. + +Permission is hereby granted, without written agreement or royalty fee, to use, +copy, modify, and distribute this software and its documentation for any +purpose, provided that the above copyright notice and the following three +paragraphs appear in all copies of this software. + +IN NO EVENT SHALL M.I.T. BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, +INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE +AND ITS DOCUMENTATION, EVEN IF M.I.T. HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMANGE. + +M.I.T. SPECIFICALLY DISCLAIMS ANY WARRANTIES INCLUDING, BUT NOT LIMITED TO +THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +AND NON-INFRINGEMENT. + +THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND M.I.T. HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +*/ + +#include + +int main(int argc, char *argv[]) +{ + char buf[10]; + + + /* BAD */ + strcpy(buf, "AAAAAAAAAA"); /* { dg-warning "stack-based buffer overflow" "analyzer warning" } */ + /* { dg-message "write of 1 byte to beyond the end of 'buf'" "analyzer note" { target *-*-* } .-1 } */ + /* { dg-warning "'__builtin_memcpy' writing 11 bytes into a region of size 10 overflows the destination" "Wstringop-overflow" { target *-*-* } .-2 } */ + + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/analyzer/SARD-tc841-basic-00182-min.c b/gcc/testsuite/gcc.dg/analyzer/SARD-tc841-basic-00182-min.c new file mode 100644 index 0000000..577dce1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/SARD-tc841-basic-00182-min.c @@ -0,0 +1,73 @@ +/* Adapted from https://samate.nist.gov/SARD/test-cases/841/versions/1.0.0 + Part of https://samate.nist.gov/SARD/test-suites/81 + See: + Black, P. , Koo, H. and Irish, T. (2013), A Basic CWE-121 Buffer Overflow Effectiveness Test Suite, Proc. 6th Latin-American Symposium on Dependable Computing, Rio de Janeiro, -1, [online], https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=913117 (Accessed January 17, 2023) +*/ + +/* Taxonomy Classification: 0000300602130000031110 */ + +/* + * WRITE/READ 0 write + * WHICH BOUND 0 upper + * DATA TYPE 0 char + * MEMORY LOCATION 0 stack + * SCOPE 3 inter-file/inter-proc + * CONTAINER 0 no + * POINTER 0 no + * INDEX COMPLEXITY 6 N/A + * ADDRESS COMPLEXITY 0 constant + * LENGTH COMPLEXITY 2 constant + * ADDRESS ALIAS 1 yes, one level + * INDEX ALIAS 3 N/A + * LOCAL CONTROL FLOW 0 none + * SECONDARY CONTROL FLOW 0 none + * LOOP STRUCTURE 0 no + * LOOP COMPLEXITY 0 N/A + * ASYNCHRONY 0 no + * TAINT 3 file read + * RUNTIME ENV. DEPENDENCE 1 yes + * MAGNITUDE 1 1 byte + * CONTINUOUS/DISCRETE 1 continuous + * SIGNEDNESS 0 no + */ + +/* +Copyright 2004 M.I.T. + +Permission is hereby granted, without written agreement or royalty fee, to use, +copy, modify, and distribute this software and its documentation for any +purpose, provided that the above copyright notice and the following three +paragraphs appear in all copies of this software. + +IN NO EVENT SHALL M.I.T. BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, +INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE +AND ITS DOCUMENTATION, EVEN IF M.I.T. HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMANGE. + +M.I.T. SPECIFICALLY DISCLAIMS ANY WARRANTIES INCLUDING, BUT NOT LIMITED TO +THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +AND NON-INFRINGEMENT. + +THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND M.I.T. HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +*/ + +#include +#include + +int main(int argc, char *argv[]) +{ + FILE * f; + char buf[10]; + + f = fopen("TestInputFile1", "r"); + assert(f != NULL); + + /* BAD */ + fgets(buf, 11, f); /* { dg-warning "stack-based buffer overflow" "PR analyzer/105895" { xfail *-*-* } } */ + + fclose(f); + + + return 0; +} -- cgit v1.1 From 0f85ae6591c92b161693073c0931c7ca1d5d0c5a Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 18 Jan 2023 14:51:59 -0500 Subject: c: ICE with nullptr as case expression [PR108424] In this ICE-on-invalid, we crash on gcc_assert (INTEGRAL_TYPE_P (type)); in perform_integral_promotions, because a nullptr is an INTEGER_CST, but not INTEGRAL_TYPE_P, and check_case_value is only checking the former. In the test I'm testing other "shall be an integral constant expression" contexts as well. PR c/108424 gcc/c-family/ChangeLog: * c-common.cc (check_case_value): Check INTEGRAL_TYPE_P. gcc/testsuite/ChangeLog: * gcc.dg/c2x-nullptr-6.c: New test. --- gcc/c-family/c-common.cc | 3 ++- gcc/testsuite/gcc.dg/c2x-nullptr-6.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/c2x-nullptr-6.c (limited to 'gcc') diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc index 76c8abe..ae92cd5 100644 --- a/gcc/c-family/c-common.cc +++ b/gcc/c-family/c-common.cc @@ -2238,7 +2238,8 @@ check_case_value (location_t loc, tree value) if (value == NULL_TREE) return value; - if (TREE_CODE (value) == INTEGER_CST) + if (INTEGRAL_TYPE_P (TREE_TYPE (value)) + && TREE_CODE (value) == INTEGER_CST) /* Promote char or short to int. */ value = perform_integral_promotions (value); else if (value != error_mark_node) diff --git a/gcc/testsuite/gcc.dg/c2x-nullptr-6.c b/gcc/testsuite/gcc.dg/c2x-nullptr-6.c new file mode 100644 index 0000000..24e14fa --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-nullptr-6.c @@ -0,0 +1,33 @@ +/* PR c/108424 */ +/* { dg-options "-std=c2x" } */ + +struct S { + int i; + int : nullptr; /* { dg-error "not an integer constant" } */ +}; + +enum E { X = nullptr }; /* { dg-error "not an integer constant" } */ + +alignas(nullptr) int g; /* { dg-error "not an integer constant" } */ + +int arr[10] = { [nullptr] = 1 }; /* { dg-error "not of integer type" } */ + +_Static_assert (nullptr, "nullptr"); /* { dg-error "not an integer" } */ + +void f (int n) +{ + switch (n) { + case nullptr: /* { dg-error "an integer constant" } */ + default: + } + + switch (n) { + case 1 ... nullptr: /* { dg-error "an integer constant" } */ + default: + } + + switch (n) { + case nullptr ... 2: /* { dg-error "an integer constant" } */ + default: + } +} -- cgit v1.1 From 9f98cfa51b416a2b40884b7d5202eb4daa801ec0 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 19 Jan 2023 00:17:35 +0000 Subject: Daily bump. --- gcc/ChangeLog | 66 +++++++++++++++++++++++++++++++++++++++++++++++++ gcc/DATESTAMP | 2 +- gcc/c-family/ChangeLog | 5 ++++ gcc/testsuite/ChangeLog | 36 +++++++++++++++++++++++++++ 4 files changed, 108 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a8da615..ffca6da 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,69 @@ +2023-01-18 Martin Jambor + + PR ipa/107944 + * cgraph.cc (cgraph_node::remove): Check whether nodes up the + lcone_of chain also do not need the body. + +2023-01-18 Richard Biener + + Revert: + 2022-12-16 Richard Biener + + PR middle-end/108086 + * tree-inline.cc (remap_ssa_name): Do not unshare the + result from the decl_map. + +2023-01-18 Murray Steele + + PR target/108442 + * config/arm/arm_mve.h (__arm_vst1q_p_u8): Use prefixed intrinsic + function. + (__arm_vst1q_p_s8): Likewise. + (__arm_vld1q_z_u8): Likewise. + (__arm_vld1q_z_s8): Likewise. + (__arm_vst1q_p_u16): Likewise. + (__arm_vst1q_p_s16): Likewise. + (__arm_vld1q_z_u16): Likewise. + (__arm_vld1q_z_s16): Likewise. + (__arm_vst1q_p_u32): Likewise. + (__arm_vst1q_p_s32): Likewise. + (__arm_vld1q_z_u32): Likewise. + (__arm_vld1q_z_s32): Likewise. + (__arm_vld1q_z_f16): Likewise. + (__arm_vst1q_p_f16): Likewise. + (__arm_vld1q_z_f32): Likewise. + (__arm_vst1q_p_f32): Likewise. + +2023-01-18 Takayuki 'January June' Suwa + + * config/xtensa/xtensa.md (xorsi3_internal): + Rename from the original of "xorsi3". + (xorsi3): New expansion pattern that emits addition rather than + bitwise-XOR when the second source is a constant of -2147483648 + if TARGET_DENSITY. + +2023-01-18 Kewen Lin + Andrew Pinski + + PR target/108396 + * config/rs6000/rs6000-overload.def (VEC_VSUBCUQ): Fix typo + vec_vsubcuqP with vec_vsubcuq. + +2023-01-18 Kewen Lin + + PR target/108348 + * config/rs6000/rs6000.cc (rs6000_opaque_type_invalid_use_p): Add the + support for invalid uses of MMA opaque type in function arguments. + +2023-01-18 liuhongt + + PR target/55522 + * config/i386/cygwin.h (ENDFILE_SPEC): Link crtfastmath.o + whenever -mdaz-ftz is specified. Don't link crtfastmath.o when + -share or -mno-daz-ftz is specified. + * config/i386/darwin.h (ENDFILE_SPEC): Ditto. + * config/i386/mingw32.h (ENDFILE_SPEC): Ditto. + 2023-01-17 Jose E. Marchesi * config/bpf/bpf.cc (bpf_option_override): Disable diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 5943f2b..847dee1 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20230118 +20230119 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 2e8804a..2658758 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2023-01-18 Marek Polacek + + PR c/108424 + * c-common.cc (check_case_value): Check INTEGRAL_TYPE_P. + 2023-01-14 Jakub Jelinek PR c++/108365 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0cb635b..5723c8c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,39 @@ +2023-01-18 Marek Polacek + + PR c/108424 + * gcc.dg/c2x-nullptr-6.c: New test. + +2023-01-18 David Malcolm + + * gcc.dg/analyzer/SARD-tc117-basic-00001-min.c: New test, adapted + from https://samate.nist.gov/SARD/test-suites/81. + * gcc.dg/analyzer/SARD-tc1909-stack_overflow_loop.c: Likewise. + * gcc.dg/analyzer/SARD-tc249-basic-00034-min.c: Likewise. + * gcc.dg/analyzer/SARD-tc293-basic-00045-min.c: Likewise. + * gcc.dg/analyzer/SARD-tc841-basic-00182-min.c: Likewise. + +2023-01-18 Richard Biener + + PR lto/108445 + * gcc.dg/lto/pr108445_0.c: New testcase. + * gcc.dg/lto/pr108445_1.c: Likewise. + +2023-01-18 Murray Steele + + * gcc.target/arm/mve/general/preserve_user_namespace_1.c: New test. + +2023-01-18 Kewen Lin + Andrew Pinski + + PR target/108396 + * gcc.target/powerpc/pr108396.c: New test. + +2023-01-18 Kewen Lin + + PR target/108348 + * gcc.target/powerpc/pr108348-1.c: New test. + * gcc.target/powerpc/pr108348-2.c: New test. + 2023-01-17 Harald Anlauf PR fortran/108421 -- cgit v1.1 From 3c99493bf39a7fef9213e6f5af94b78bb15fcfdc Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Thu, 19 Jan 2023 01:09:15 -0300 Subject: [PR106746] drop cselib addr lookup in debug insn mem The testcase used to get scheduled differently depending on the presence of debug insns with MEMs. It's not clear to me why those MEMs affected scheduling, but the cselib pre-canonicalization of the MEM address is not used at all when analyzing debug insns, so the memory allocation and lookup are pure waste. Somehow, avoiding that waste fixes the problem, or makes it go latent. for gcc/ChangeLog PR debug/106746 * sched-deps.cc (sched_analyze_2): Skip cselib address lookup within debug insns. for gcc/testsuite/ChangeLog PR debug/106746 * gcc.target/i386/pr106746.c: New. --- gcc/sched-deps.cc | 36 ++++++++++++++++---------------- gcc/testsuite/gcc.target/i386/pr106746.c | 29 +++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 18 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr106746.c (limited to 'gcc') diff --git a/gcc/sched-deps.cc b/gcc/sched-deps.cc index f9371b8..a9214f6 100644 --- a/gcc/sched-deps.cc +++ b/gcc/sched-deps.cc @@ -2605,26 +2605,26 @@ sched_analyze_2 (class deps_desc *deps, rtx x, rtx_insn *insn) case MEM: { - /* Reading memory. */ - rtx_insn_list *u; - rtx_insn_list *pending; - rtx_expr_list *pending_mem; - rtx t = x; - - if (sched_deps_info->use_cselib) - { - machine_mode address_mode = get_address_mode (t); - - t = shallow_copy_rtx (t); - cselib_lookup_from_insn (XEXP (t, 0), address_mode, 1, - GET_MODE (t), insn); - XEXP (t, 0) - = cselib_subst_to_values_from_insn (XEXP (t, 0), GET_MODE (t), - insn); - } - if (!DEBUG_INSN_P (insn)) { + /* Reading memory. */ + rtx_insn_list *u; + rtx_insn_list *pending; + rtx_expr_list *pending_mem; + rtx t = x; + + if (sched_deps_info->use_cselib) + { + machine_mode address_mode = get_address_mode (t); + + t = shallow_copy_rtx (t); + cselib_lookup_from_insn (XEXP (t, 0), address_mode, 1, + GET_MODE (t), insn); + XEXP (t, 0) + = cselib_subst_to_values_from_insn (XEXP (t, 0), GET_MODE (t), + insn); + } + t = canon_rtx (t); pending = deps->pending_read_insns; pending_mem = deps->pending_read_mems; diff --git a/gcc/testsuite/gcc.target/i386/pr106746.c b/gcc/testsuite/gcc.target/i386/pr106746.c new file mode 100644 index 0000000..14f7dab --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr106746.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fsched2-use-superblocks -fcompare-debug -Wno-psabi" } */ + +typedef char __attribute__((__vector_size__ (64))) U; +typedef short __attribute__((__vector_size__ (64))) V; +typedef int __attribute__((__vector_size__ (64))) W; + +char c; +U a; +U *r; +W foo0_v512u32_0; + +void +foo (W) +{ + U u; + V v; + W w = __builtin_shuffle (foo0_v512u32_0, foo0_v512u32_0); + u = + __builtin_shufflevector (a, u, 3, 0, 4, 9, 9, 6, 7, 8, 5, + 0, 6, 1, 8, 1, 2, 8, 6, + 1, 8, 4, 9, 3, 8, 4, 6, 0, 9, 0, 1, 8, 2, 3, 3, + 0, 4, 9, 9, 6, 7, 8, 5, + 0, 6, 1, 8, 1, 2, 8, 6, + 1, 8, 4, 9, 3, 8, 4, 6, 0, 9, 0, 1, 8, 2, 3); + v *= c; + w &= c; + *r = (U) v + (U) w; +} -- cgit v1.1 From 22c75b4ed94bd731cb6e37c507de1d91954a17cf Mon Sep 17 00:00:00 2001 From: Prathamesh Kulkarni Date: Thu, 19 Jan 2023 12:43:55 +0530 Subject: [aarch64] Use exact_log2 (INTVAL (operands[2])) >= 0 to gate for vec_merge patterns. gcc/ChangeLog: * config/aarch64/aarch64-simd.md (aarch64_simd_vec_set): Use exact_log2 (INTVAL (operands[2])) >= 0 as condition for gating the pattern. (aarch64_simd_vec_copy_lane): Likewise. (aarch64_simd_vec_copy_lane_): Likewise. --- gcc/config/aarch64/aarch64-simd.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 31d9e89..7f212bf 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -1064,7 +1064,7 @@ (match_operand: 1 "aarch64_simd_nonimmediate_operand" "w,?r,Utv")) (match_operand:VALL_F16 3 "register_operand" "0,0,0") (match_operand:SI 2 "immediate_operand" "i,i,i")))] - "TARGET_SIMD" + "TARGET_SIMD && exact_log2 (INTVAL (operands[2])) >= 0" { int elt = ENDIAN_LANE_N (, exact_log2 (INTVAL (operands[2]))); operands[2] = GEN_INT ((HOST_WIDE_INT) 1 << elt); @@ -1093,7 +1093,7 @@ [(match_operand:SI 4 "immediate_operand" "i")]))) (match_operand:VALL_F16 1 "register_operand" "0") (match_operand:SI 2 "immediate_operand" "i")))] - "TARGET_SIMD" + "TARGET_SIMD && exact_log2 (INTVAL (operands[2])) >= 0" { int elt = ENDIAN_LANE_N (, exact_log2 (INTVAL (operands[2]))); operands[2] = GEN_INT (HOST_WIDE_INT_1 << elt); @@ -1114,7 +1114,7 @@ [(match_operand:SI 4 "immediate_operand" "i")]))) (match_operand:VALL_F16_NO_V2Q 1 "register_operand" "0") (match_operand:SI 2 "immediate_operand" "i")))] - "TARGET_SIMD" + "TARGET_SIMD && exact_log2 (INTVAL (operands[2])) >= 0" { int elt = ENDIAN_LANE_N (, exact_log2 (INTVAL (operands[2]))); operands[2] = GEN_INT (HOST_WIDE_INT_1 << elt); -- cgit v1.1 From 05b9868b182bb9ed2013b39a0bc6297354a0db49 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 19 Jan 2023 10:00:51 +0100 Subject: forwprop: Further fixes for simplify_rotate [PR108440] As mentioned in the simplify_rotate comment, for e.g. ((T) ((T2) X << (Y & (B - 1)))) | ((T) ((T2) X >> ((-Y) & (B - 1)))) we already emit X r<< (Y & (B - 1)) as replacement. This PR is about the ((T) ((T2) X << Y)) OP ((T) ((T2) X >> (B - Y))) ((T) ((T2) X << (int) Y)) OP ((T) ((T2) X >> (int) (B - Y))) forms if T2 is wider than T. Unlike e.g. (X << Y) OP (X >> (B - Y)) which is valid just for Y in [1, B - 1], the above 2 forms are actually valid and do the rotates for Y in [0, B] - for Y 0 the X value is preserved by the left shift and right logical shift by B adds just zeros (but because the shift is in wider precision B is still valid shift count), while for Y equal to B X is preserved through the latter shift and the former adds just zeros. Now, it is unclear if we in the middle-end treat rotates with rotate count equal or larger than precision as UB or not, unlike shifts there are less reasons to do so, but e.g. expansion of X r<< Y if there is no rotate optab for the mode is emitted as (X << Y) | (((unsigned) X) >> ((-Y) & (B - 1))) and so with UB on Y == B. The following patch does multiple things: 1) for the above 2, asks the ranger if Y could be equal to B and if so, instead of using X r<< Y uses X r<< (Y & (B - 1)) 2) for the ((T) ((T2) X << Y)) | ((T) ((T2) X >> ((-Y) & (B - 1)))) ((T) ((T2) X << (int) Y)) | ((T) ((T2) X >> (int) ((-Y) & (B - 1)))) forms that were fixed 2 days ago it only punts if Y might be in the [B,B2-1] range but isn't known to be in the [0,B][2*B,2*B][3*B,3*B]... range. Because for Y which is a multiple of B but smaller than B2 it acts as a rotate too, left shift provides 0 and (-Y) & (B - 1) is 0 and so preserves X. Though, for the cases where Y is not known to be in [0,B-1] the patch also uses X r<< (Y & (B - 1)) rather than X r<< Y 3) as discussed with Aldy, instead of using global ranger it uses a pass specific copy but lazily created on first simplify_rotate that needs it; this e.g. handles rotate inside of if body where the guarding condition limits the shift count to some range which will not work with the global ranger (unless there is some SSA_NAME to attach the range to). Note, e.g. on x86 X r<< (Y & (B - 1)) and X r<< Y actually emit the same assembly because rotates work the same even for larger rotate counts, but that is handled only during combine. 2023-01-19 Jakub Jelinek PR tree-optimization/108440 * tree-ssa-forwprop.cc: Include gimple-range.h. (simplify_rotate): For the forms with T2 wider than T and shift counts of Y and B - Y add & (B - 1) masking for the rotate count if Y could be equal to B. For the forms with T2 wider than T and shift counts of Y and (-Y) & (B - 1), don't punt if range could be [B, B2], but only if range doesn't guarantee Y < B or Y = N * B. If range doesn't guarantee Y < B, also add & (B - 1) masking for the rotate count. Use lazily created pass specific ranger instead of get_global_range_query. (pass_forwprop::execute): Disable that ranger at the end of pass if it has been created. * c-c++-common/rotate-10.c: New test. * c-c++-common/rotate-11.c: New test. --- gcc/testsuite/c-c++-common/rotate-10.c | 53 ++++++++++++++++++++++++ gcc/testsuite/c-c++-common/rotate-11.c | 53 ++++++++++++++++++++++++ gcc/tree-ssa-forwprop.cc | 73 +++++++++++++++++++++++++++++----- 3 files changed, 170 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/rotate-10.c create mode 100644 gcc/testsuite/c-c++-common/rotate-11.c (limited to 'gcc') diff --git a/gcc/testsuite/c-c++-common/rotate-10.c b/gcc/testsuite/c-c++-common/rotate-10.c new file mode 100644 index 0000000..683d2cb --- /dev/null +++ b/gcc/testsuite/c-c++-common/rotate-10.c @@ -0,0 +1,53 @@ +/* PR tree-optimization/108440 */ +/* { dg-do compile { target { { ilp32 || lp64 } || llp64 } } } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-times " r<< " 5 "optimized" } } */ +/* { dg-final { scan-tree-dump-times " \\\& 7;" 4 "optimized" } } */ + +unsigned char +foo (unsigned char x, unsigned int y) +{ + if (y > __CHAR_BIT__) + __builtin_unreachable (); + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +bar (unsigned char x, unsigned int y) +{ + if (y >= __CHAR_BIT__) + __builtin_unreachable (); + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +baz (unsigned char x, unsigned int y) +{ + if (y > __CHAR_BIT__ && y != 2 * __CHAR_BIT__) + __builtin_unreachable (); + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +qux (unsigned char x, unsigned int y) +{ + if (y > __CHAR_BIT__ && y != 2 * __CHAR_BIT__ && y != __CHAR_BIT__ + 2) + __builtin_unreachable (); + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +quux (unsigned char x, unsigned int y) +{ + if (y > __CHAR_BIT__) + __builtin_unreachable (); + return (x << y) | (x >> (__CHAR_BIT__ - y)); +} + +unsigned char +corge (unsigned char x, unsigned int y) +{ + if (y >= __CHAR_BIT__) + __builtin_unreachable (); + return (x << y) | (x >> (__CHAR_BIT__ - y)); +} diff --git a/gcc/testsuite/c-c++-common/rotate-11.c b/gcc/testsuite/c-c++-common/rotate-11.c new file mode 100644 index 0000000..e57db19 --- /dev/null +++ b/gcc/testsuite/c-c++-common/rotate-11.c @@ -0,0 +1,53 @@ +/* PR tree-optimization/108440 */ +/* { dg-do compile { target { { ilp32 || lp64 } || llp64 } } } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-times " r<< " 5 "optimized" } } */ +/* { dg-final { scan-tree-dump-times " \\\& 7;" 4 "optimized" } } */ + +unsigned char +foo (unsigned char x, unsigned int y) +{ + if (y > __CHAR_BIT__) + return 42; + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +bar (unsigned char x, unsigned int y) +{ + if (y >= __CHAR_BIT__) + return 42; + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +baz (unsigned char x, unsigned int y) +{ + if (y > __CHAR_BIT__ && y != 2 * __CHAR_BIT__) + return 42; + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +qux (unsigned char x, unsigned int y) +{ + if (y > __CHAR_BIT__ && y != 2 * __CHAR_BIT__ && y != __CHAR_BIT__ + 2) + return 42; + return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1))); +} + +unsigned char +quux (unsigned char x, unsigned int y) +{ + if (y > __CHAR_BIT__) + return 42; + return (x << y) | (x >> (__CHAR_BIT__ - y)); +} + +unsigned char +corge (unsigned char x, unsigned int y) +{ + if (y >= __CHAR_BIT__) + return 42; + return (x << y) | (x >> (__CHAR_BIT__ - y)); +} diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc index 458d9c8..0841a73 100644 --- a/gcc/tree-ssa-forwprop.cc +++ b/gcc/tree-ssa-forwprop.cc @@ -52,6 +52,7 @@ along with GCC; see the file COPYING3. If not see #include "internal-fn.h" #include "cgraph.h" #include "tree-ssa.h" +#include "gimple-range.h" /* This pass propagates the RHS of assignment statements into use sites of the LHS of the assignment. It's basically a specialized @@ -1837,8 +1838,12 @@ defcodefor_name (tree name, enum tree_code *code, tree *arg1, tree *arg2) ((T) ((T2) X << Y)) | ((T) ((T2) X >> ((-Y) & (B - 1)))) ((T) ((T2) X << (int) Y)) | ((T) ((T2) X >> (int) ((-Y) & (B - 1)))) - transform these into (last 2 only if ranger can prove Y < B): + transform these into (last 2 only if ranger can prove Y < B + or Y = N * B): X r<< Y + or + X r<< (& & (B - 1)) + The latter for the forms with T2 wider than T if ranger can't prove Y < B. Or for: (X << (Y & (B - 1))) | (X >> ((-Y) & (B - 1))) @@ -1868,6 +1873,7 @@ simplify_rotate (gimple_stmt_iterator *gsi) gimple *g; gimple *def_arg_stmt[2] = { NULL, NULL }; int wider_prec = 0; + bool add_masking = false; arg[0] = gimple_assign_rhs1 (stmt); arg[1] = gimple_assign_rhs2 (stmt); @@ -1995,7 +2001,7 @@ simplify_rotate (gimple_stmt_iterator *gsi) tree cdef_arg1[2], cdef_arg2[2], def_arg2_alt[2]; enum tree_code cdef_code[2]; gimple *def_arg_alt_stmt[2] = { NULL, NULL }; - bool check_range = false; + int check_range = 0; gimple *check_range_stmt = NULL; /* Look through conversion of the shift count argument. The C/C++ FE cast any shift count argument to integer_type_node. @@ -2036,6 +2042,11 @@ simplify_rotate (gimple_stmt_iterator *gsi) || cdef_arg2[i] == def_arg2_alt[1 - i]) { rotcnt = cdef_arg2[i]; + check_range = -1; + if (cdef_arg2[i] == def_arg2[1 - i]) + check_range_stmt = def_arg_stmt[1 - i]; + else + check_range_stmt = def_arg_alt_stmt[1 - i]; break; } defcodefor_name (cdef_arg2[i], &code, &tem, NULL); @@ -2048,6 +2059,11 @@ simplify_rotate (gimple_stmt_iterator *gsi) || tem == def_arg2_alt[1 - i])) { rotcnt = tem; + check_range = -1; + if (tem == def_arg2[1 - i]) + check_range_stmt = def_arg_stmt[1 - i]; + else + check_range_stmt = def_arg_alt_stmt[1 - i]; break; } } @@ -2080,7 +2096,7 @@ simplify_rotate (gimple_stmt_iterator *gsi) if (tem == def_arg2[1 - i] || tem == def_arg2_alt[1 - i]) { rotcnt = tem; - check_range = true; + check_range = 1; if (tem == def_arg2[1 - i]) check_range_stmt = def_arg_stmt[1 - i]; else @@ -2099,7 +2115,7 @@ simplify_rotate (gimple_stmt_iterator *gsi) || tem2 == def_arg2_alt[1 - i]) { rotcnt = tem2; - check_range = true; + check_range = 1; if (tem2 == def_arg2[1 - i]) check_range_stmt = def_arg_stmt[1 - i]; else @@ -2144,17 +2160,44 @@ simplify_rotate (gimple_stmt_iterator *gsi) if (TREE_CODE (rotcnt) != SSA_NAME) return false; int_range_max r; - if (!get_global_range_query ()->range_of_expr (r, rotcnt, - check_range_stmt)) - return false; + range_query *q = get_range_query (cfun); + if (q == get_global_range_query ()) + q = enable_ranger (cfun); + if (!q->range_of_expr (r, rotcnt, check_range_stmt)) + { + if (check_range > 0) + return false; + r.set_varying (TREE_TYPE (rotcnt)); + } int prec = TYPE_PRECISION (TREE_TYPE (rotcnt)); signop sign = TYPE_SIGN (TREE_TYPE (rotcnt)); wide_int min = wide_int::from (TYPE_PRECISION (rtype), prec, sign); wide_int max = wide_int::from (wider_prec - 1, prec, sign); - int_range<2> r2 (TREE_TYPE (rotcnt), min, max); + if (check_range < 0) + max = min; + int_range<1> r2 (TREE_TYPE (rotcnt), min, max); r.intersect (r2); if (!r.undefined_p ()) - return false; + { + if (check_range > 0) + { + int_range_max r3; + for (int i = TYPE_PRECISION (rtype) + 1; i < wider_prec; + i += TYPE_PRECISION (rtype)) + { + int j = i + TYPE_PRECISION (rtype) - 2; + min = wide_int::from (i, prec, sign); + max = wide_int::from (MIN (j, wider_prec - 1), + prec, sign); + int_range<1> r4 (TREE_TYPE (rotcnt), min, max); + r3.union_ (r4); + } + r.intersect (r3); + if (!r.undefined_p ()) + return false; + } + add_masking = true; + } } if (rotcnt == NULL_TREE) return false; @@ -2169,6 +2212,15 @@ simplify_rotate (gimple_stmt_iterator *gsi) gsi_insert_before (gsi, g, GSI_SAME_STMT); rotcnt = gimple_assign_lhs (g); } + if (add_masking) + { + g = gimple_build_assign (make_ssa_name (TREE_TYPE (rotcnt)), + BIT_AND_EXPR, rotcnt, + build_int_cst (TREE_TYPE (rotcnt), + TYPE_PRECISION (rtype) - 1)); + gsi_insert_before (gsi, g, GSI_SAME_STMT); + rotcnt = gimple_assign_lhs (g); + } lhs = gimple_assign_lhs (stmt); if (!useless_type_conversion_p (rtype, TREE_TYPE (def_arg1[0]))) lhs = make_ssa_name (TREE_TYPE (def_arg1[0])); @@ -3958,6 +4010,9 @@ pass_forwprop::execute (function *fun) BITMAP_FREE (to_purge); BITMAP_FREE (need_ab_cleanup); + if (get_range_query (cfun) != get_global_range_query ()) + disable_ranger (cfun); + if (cfg_changed) todoflags |= TODO_cleanup_cfg; -- cgit v1.1 From a38c079248411ea9dc0610873b3366192315bfee Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 16 Jan 2023 17:48:25 +0000 Subject: aarch64: fix ICE in aarch64_layout_arg [PR108411] The previous patch added an assert which should not be applied to PST types (Pure Scalable Types) because alignment does not matter in this case. This patch moves the assert after the PST case is handled to avoid the ICE. PR target/108411 gcc/ * config/aarch64/aarch64.cc (aarch64_layout_arg): Improve comment. Move assert about alignment a bit later. --- gcc/config/aarch64/aarch64.cc | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'gcc') diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index d36b573..d55c250 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -7659,7 +7659,18 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) && (currently_expanding_function_start || currently_expanding_gimple_stmt)); - /* There are several things to note here: + /* HFAs and HVAs can have an alignment greater than 16 bytes. For example: + + typedef struct foo { + __Int8x16_t foo[2] __attribute__((aligned(32))); + } foo; + + is still a HVA despite its larger-than-normal alignment. + However, such over-aligned HFAs and HVAs are guaranteed to have + no padding. + + If we exclude HFAs and HVAs from the discussion below, then there + are several things to note: - Both the C and AAPCS64 interpretations of a type's alignment should give a value that is no greater than the type's size. @@ -7704,12 +7715,6 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) would treat the alignment as though it was *equal to* 16 bytes. Both behaviors were wrong, but in different cases. */ - unsigned int alignment - = aarch64_function_arg_alignment (mode, type, &abi_break, - &abi_break_packed); - gcc_assert (alignment <= 16 * BITS_PER_UNIT - && (!alignment || abi_break < alignment) - && (!abi_break_packed || alignment < abi_break_packed)); pcum->aapcs_arg_processed = true; @@ -7780,6 +7785,14 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) &nregs); gcc_assert (!sve_p || !allocate_nvrn); + unsigned int alignment + = aarch64_function_arg_alignment (mode, type, &abi_break, + &abi_break_packed); + + gcc_assert ((allocate_nvrn || alignment <= 16 * BITS_PER_UNIT) + && (!alignment || abi_break < alignment) + && (!abi_break_packed || alignment < abi_break_packed)); + /* allocate_ncrn may be false-positive, but allocate_nvrn is quite reliable. The following code thus handles passing by SIMD/FP registers first. */ -- cgit v1.1 From 74833b3165865a9373506f447720cf20f29c20c8 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Tue, 17 Jan 2023 13:10:10 +0000 Subject: aarch64: add -fno-stack-protector to some tests [PR108411] As discussed in the PR, these recently added tests fail when the testsuite is executed with -fstack-protector-strong. To avoid this, this patch adds -fno-stack-protector to dg-options. PR target/108411 gcc/testsuite * g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C: Add -fno-stack-protector. * g++.target/aarch64/bitfield-abi-warning-align16-O2.C: Likewise. * g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C: Likewise. * g++.target/aarch64/bitfield-abi-warning-align32-O2.C: Likewise. * g++.target/aarch64/bitfield-abi-warning-align8-O2.C: Likewise. * gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c: Likewise. * gcc.target/aarch64/bitfield-abi-warning-align16-O2.c: Likewise. * gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c: Likewise. * gcc.target/aarch64/bitfield-abi-warning-align32-O2.c: Likewise. * gcc.target/aarch64/bitfield-abi-warning-align8-O2.c: Likewise. --- .../g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C | 2 +- gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2.C | 2 +- .../g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C | 2 +- gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2.C | 2 +- gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align8-O2.C | 2 +- .../gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c | 2 +- gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2.c | 2 +- .../gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c | 2 +- gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2.c | 2 +- gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align8-O2.c | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C index 443cd45..52f9cdd 100644 --- a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C +++ b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -save-temps -Wno-narrowing" } */ +/* { dg-options "-O2 -fno-stack-protector -save-temps -Wno-narrowing" } */ #define ALIGN 16 //#define EXTRA diff --git a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2.C b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2.C index 76a7e3d..9ff4e46 100644 --- a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2.C +++ b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -save-temps -Wno-narrowing" } */ +/* { dg-options "-O2 -fno-stack-protector -save-temps -Wno-narrowing" } */ #define ALIGN 16 #define EXTRA diff --git a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C index 6f8f54f..55dcbfe 100644 --- a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C +++ b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -save-temps -Wno-narrowing" } */ +/* { dg-options "-O2 -fno-stack-protector -save-temps -Wno-narrowing" } */ #define ALIGN 32 //#define EXTRA diff --git a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2.C b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2.C index 6b8ad5f..6bb8778 100644 --- a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2.C +++ b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -save-temps -Wno-narrowing" } */ +/* { dg-options "-O2 -fno-stack-protector -save-temps -Wno-narrowing" } */ #define ALIGN 32 #define EXTRA diff --git a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align8-O2.C b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align8-O2.C index b1764d9..41bcc89 100644 --- a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align8-O2.C +++ b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align8-O2.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -save-temps -Wno-narrowing" } */ +/* { dg-options "-O2 -fno-stack-protector -save-temps -Wno-narrowing" } */ #define ALIGN 8 #define EXTRA diff --git a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c index f248a12..3b2c932 100644 --- a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c +++ b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -save-temps" } */ +/* { dg-options "-O2 -fno-stack-protector -save-temps" } */ #define ALIGN 16 //#define EXTRA diff --git a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2.c b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2.c index 22ee5ec..ee5d6fa 100644 --- a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2.c +++ b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -save-temps" } */ +/* { dg-options "-O2 -fno-stack-protector -save-temps" } */ #define ALIGN 16 #define EXTRA diff --git a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c index a8a50b3..6d4a883 100644 --- a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c +++ b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -save-temps" } */ +/* { dg-options "-O2 -fno-stack-protector -save-temps" } */ #define ALIGN 32 //#define EXTRA diff --git a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2.c b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2.c index e872de3..331daba 100644 --- a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2.c +++ b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -save-temps" } */ +/* { dg-options "-O2 -fno-stack-protector -save-temps" } */ #define ALIGN 32 #define EXTRA diff --git a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align8-O2.c b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align8-O2.c index cb2a945..e6d45f5 100644 --- a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align8-O2.c +++ b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align8-O2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -save-temps" } */ +/* { dg-options "-O2 -fno-stack-protector -save-temps" } */ #define ALIGN 8 #define EXTRA -- cgit v1.1 From f8cb07a7a445c61a704476746b971ddd967627aa Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Sat, 14 Jan 2023 19:33:52 +0000 Subject: modula-2, testsuite: Make libs and interfaces consistent. In some case the libraries list was being set before gm2_init_xxx was called. In some cases it was omitted - this could lead to a difference between the link libs and the interfaces (the effect of this would be dependent on the order in which the .exps were run, which makes it also depend on the -j and the system). To avoid a mismatch between the module include paths and the added libs we now make sure that they are both added in the gm_init_xxxx functions (if finer control over granularity is needed, then we should as a TODO add a generic gm_init_xxx that takes a library list and ensures that the imports and libs are matched in the same order). Also we cannot use a default variable in tcl if the source for that variable could be absent, but something else follows, there is no way to put an empty placeholder in. Signed-off-by: Iain Sandoe gcc/testsuite/ChangeLog: * gm2/complex/run/pass/complex-run-pass.exp: Remove gm2_link_lib. * gm2/iso/run/pass/iso-run-pass.exp: Likewise. * gm2/link/externalscaffold/pass/link-externalscaffold-pass.exp: * gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp: Likewise. * gm2/pimlib/run/pass/pimlib-run-pass.exp: Likewise. * gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp: Likewise. * gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp: Likewise. * gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp: Likewise. * gm2/sets/run/pass/sets-run-pass.exp: Likewise. * gm2/switches/none/run/pass/gm2-none.exp: Likewise. * gm2/switches/pic/run/pass/switches-pic-run-pass.exp: Likewise. * gm2/projects/pim/run/pass/random/projects-pim-run-pass-random.exp: Likewise, and also ensure that the -g option is appended to avoid it being taken as a path. * lib/gm2.exp: Ensure for each gm2_init_xxxx function that the set of libraries added matches the set of -I and -L options. --- .../gm2/complex/run/pass/complex-run-pass.exp | 1 - gcc/testsuite/gm2/iso/run/pass/iso-run-pass.exp | 1 - .../pass/link-externalscaffold-pass.exp | 1 - .../logitech/run/pass/pimlib-logitech-run-pass.exp | 2 -- .../gm2/pimlib/run/pass/pimlib-run-pass.exp | 2 -- .../run/pass/halma/projects-iso-run-pass-halma.exp | 1 - .../run/pass/hello/projects-iso-run-pass-hello.exp | 1 - .../run/pass/hello/projects-pim-run-pass-hello.exp | 1 - .../pass/random/projects-pim-run-pass-random.exp | 29 +++++++++++----------- gcc/testsuite/gm2/sets/run/pass/sets-run-pass.exp | 1 - .../gm2/switches/none/run/pass/gm2-none.exp | 1 - .../pic/run/pass/switches-pic-run-pass.exp | 2 -- gcc/testsuite/lib/gm2.exp | 20 +++++++++------ 13 files changed, 26 insertions(+), 37 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gm2/complex/run/pass/complex-run-pass.exp b/gcc/testsuite/gm2/complex/run/pass/complex-run-pass.exp index a715ec2..399f30b 100644 --- a/gcc/testsuite/gm2/complex/run/pass/complex-run-pass.exp +++ b/gcc/testsuite/gm2/complex/run/pass/complex-run-pass.exp @@ -27,7 +27,6 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../gm2 -gm2_link_lib "m2iso m2pim" gm2_init_iso "${srcdir}/gm2/complex/run/pass" diff --git a/gcc/testsuite/gm2/iso/run/pass/iso-run-pass.exp b/gcc/testsuite/gm2/iso/run/pass/iso-run-pass.exp index 95b1303..09d04ee 100644 --- a/gcc/testsuite/gm2/iso/run/pass/iso-run-pass.exp +++ b/gcc/testsuite/gm2/iso/run/pass/iso-run-pass.exp @@ -24,7 +24,6 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -gm2_link_lib "m2iso m2pim" gm2_init_iso "${srcdir}/gm2/iso/run/pass" -fsoft-check-all gm2_link_obj fileio.o diff --git a/gcc/testsuite/gm2/link/externalscaffold/pass/link-externalscaffold-pass.exp b/gcc/testsuite/gm2/link/externalscaffold/pass/link-externalscaffold-pass.exp index 26c9155..32d4315 100644 --- a/gcc/testsuite/gm2/link/externalscaffold/pass/link-externalscaffold-pass.exp +++ b/gcc/testsuite/gm2/link/externalscaffold/pass/link-externalscaffold-pass.exp @@ -25,7 +25,6 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -gm2_link_lib "m2pim" gm2_init_pim "${srcdir}/gm2/pim/pass" -fscaffold-main -fno-scaffold-dynamic gm2_link_obj scaffold.o set output [target_compile $srcdir/$subdir/scaffold.c scaffold.o object "-g"] diff --git a/gcc/testsuite/gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp b/gcc/testsuite/gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp index 912c457..cfe9ff8 100644 --- a/gcc/testsuite/gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp +++ b/gcc/testsuite/gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp @@ -27,10 +27,8 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 -gm2_link_lib "m2log m2pim m2iso" gm2_init_log - foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. if ![runtest_file_p $runtests $testcase] then { diff --git a/gcc/testsuite/gm2/pimlib/run/pass/pimlib-run-pass.exp b/gcc/testsuite/gm2/pimlib/run/pass/pimlib-run-pass.exp index 99fdb71..cfe9ff8 100644 --- a/gcc/testsuite/gm2/pimlib/run/pass/pimlib-run-pass.exp +++ b/gcc/testsuite/gm2/pimlib/run/pass/pimlib-run-pass.exp @@ -27,10 +27,8 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 -gm2_link_lib "m2pim m2log m2iso" gm2_init_log - foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. if ![runtest_file_p $runtests $testcase] then { diff --git a/gcc/testsuite/gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp b/gcc/testsuite/gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp index 8cb19a1..b943798 100644 --- a/gcc/testsuite/gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp +++ b/gcc/testsuite/gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp @@ -27,7 +27,6 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 -gm2_link_lib "m2iso m2pim" gm2_init_iso foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { diff --git a/gcc/testsuite/gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp b/gcc/testsuite/gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp index 8cb19a1..b943798 100644 --- a/gcc/testsuite/gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp +++ b/gcc/testsuite/gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp @@ -27,7 +27,6 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 -gm2_link_lib "m2iso m2pim" gm2_init_iso foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { diff --git a/gcc/testsuite/gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp b/gcc/testsuite/gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp index 1c46f81..0737b90 100644 --- a/gcc/testsuite/gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp +++ b/gcc/testsuite/gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp @@ -27,7 +27,6 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 -gm2_link_lib "m2pim m2log m2iso" gm2_init_pim foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { diff --git a/gcc/testsuite/gm2/projects/pim/run/pass/random/projects-pim-run-pass-random.exp b/gcc/testsuite/gm2/projects/pim/run/pass/random/projects-pim-run-pass-random.exp index 5ae14ec..012caa6 100644 --- a/gcc/testsuite/gm2/projects/pim/run/pass/random/projects-pim-run-pass-random.exp +++ b/gcc/testsuite/gm2/projects/pim/run/pass/random/projects-pim-run-pass-random.exp @@ -25,27 +25,26 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -set gm2src ${srcdir}/../m2 - -gm2_link_lib "m2pim m2log m2iso" -gm2_init_pim "-g -I$srcdir/$subdir" +gm2_init_pim "$srcdir/$subdir" -g gm2_link_obj "WriteMap.o AdvMap.o BoxMap.o Chance.o Geometry.o MakeBoxes.o MapOptions.o Options.o RoomMap.o StoreCoords.o" +# If we want these to be re-built for each torture option we need some different +# logic. +gm2_target_compile $srcdir/$subdir/AdvMap.mod AdvMap.o object "-g -I$srcdir/$subdir/" +gm2_target_compile $srcdir/$subdir/BoxMap.mod BoxMap.o object "-g -I$srcdir/$subdir/" +gm2_target_compile $srcdir/$subdir/Chance.mod Chance.o object "-g -I$srcdir/$subdir/" +gm2_target_compile $srcdir/$subdir/Geometry.mod Geometry.o object "-g -I$srcdir/$subdir/" +gm2_target_compile $srcdir/$subdir/MakeBoxes.mod MakeBoxes.o object "-g -I$srcdir/$subdir/" +gm2_target_compile $srcdir/$subdir/MapOptions.mod MapOptions.o object "-g -I$srcdir/$subdir/" +gm2_target_compile $srcdir/$subdir/Options.mod Options.o object "-g -I$srcdir/$subdir/" +gm2_target_compile $srcdir/$subdir/RoomMap.mod RoomMap.o object "-g -I$srcdir/$subdir/" +gm2_target_compile $srcdir/$subdir/StoreCoords.mod StoreCoords.o object "-g -I$srcdir/$subdir/" +gm2_target_compile $srcdir/$subdir/WriteMap.mod WriteMap.o object "-g -I$srcdir/$subdir/" + foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/Map.mod]] { # If we're only testing specific files and this isn't one of them, skip it. if ![runtest_file_p $runtests $testcase] then { continue } - - gm2_target_compile $srcdir/$subdir/AdvMap.mod AdvMap.o object "-g -I$srcdir/$subdir/" - gm2_target_compile $srcdir/$subdir/BoxMap.mod BoxMap.o object "-g -I$srcdir/$subdir/" - gm2_target_compile $srcdir/$subdir/Chance.mod Chance.o object "-g -I$srcdir/$subdir/" - gm2_target_compile $srcdir/$subdir/Geometry.mod Geometry.o object "-g -I$srcdir/$subdir/" - gm2_target_compile $srcdir/$subdir/MakeBoxes.mod MakeBoxes.o object "-g -I$srcdir/$subdir/" - gm2_target_compile $srcdir/$subdir/MapOptions.mod MapOptions.o object "-g -I$srcdir/$subdir/" - gm2_target_compile $srcdir/$subdir/Options.mod Options.o object "-g -I$srcdir/$subdir/" - gm2_target_compile $srcdir/$subdir/RoomMap.mod RoomMap.o object "-g -I$srcdir/$subdir/" - gm2_target_compile $srcdir/$subdir/StoreCoords.mod StoreCoords.o object "-g -I$srcdir/$subdir/" - gm2_target_compile $srcdir/$subdir/WriteMap.mod WriteMap.o object "-g -I$srcdir/$subdir/" gm2-torture-execute $testcase "" "pass" } diff --git a/gcc/testsuite/gm2/sets/run/pass/sets-run-pass.exp b/gcc/testsuite/gm2/sets/run/pass/sets-run-pass.exp index d0cb7b0..a439526 100644 --- a/gcc/testsuite/gm2/sets/run/pass/sets-run-pass.exp +++ b/gcc/testsuite/gm2/sets/run/pass/sets-run-pass.exp @@ -27,7 +27,6 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 -gm2_link_lib "m2iso m2pim" gm2_init_iso "${srcdir}/gm2/sets/run/pass/" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { diff --git a/gcc/testsuite/gm2/switches/none/run/pass/gm2-none.exp b/gcc/testsuite/gm2/switches/none/run/pass/gm2-none.exp index 747c474..cf77d5a 100644 --- a/gcc/testsuite/gm2/switches/none/run/pass/gm2-none.exp +++ b/gcc/testsuite/gm2/switches/none/run/pass/gm2-none.exp @@ -26,7 +26,6 @@ load_lib gm2-simple.exp set gm2src ${srcdir}/../m2 -gm2_link_lib "m2pim m2iso" gm2_init_pim foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { diff --git a/gcc/testsuite/gm2/switches/pic/run/pass/switches-pic-run-pass.exp b/gcc/testsuite/gm2/switches/pic/run/pass/switches-pic-run-pass.exp index a2af765..67ee502 100644 --- a/gcc/testsuite/gm2/switches/pic/run/pass/switches-pic-run-pass.exp +++ b/gcc/testsuite/gm2/switches/pic/run/pass/switches-pic-run-pass.exp @@ -26,10 +26,8 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 -gm2_link_lib "m2pim m2iso" gm2_init_pim "${srcdir}/gm2/switches/pic/run/pass" -fPIC - foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. if ![runtest_file_p $runtests $testcase] then { diff --git a/gcc/testsuite/lib/gm2.exp b/gcc/testsuite/lib/gm2.exp index 1e93d6a..41a2fa0 100644 --- a/gcc/testsuite/lib/gm2.exp +++ b/gcc/testsuite/lib/gm2.exp @@ -352,6 +352,7 @@ proc gm2_init_pimx { dialect {path ""} args } { append theIpath " -I" append theIpath ${path} } + gm2_link_lib "m2pim m2iso" gm2_init {*}${theIpath} {*}${dialect} {*}${theLpath} {*}${args}; } @@ -422,6 +423,7 @@ proc gm2_init_iso { {path ""} args } { append theIpath ${path} } + gm2_link_lib "m2iso m2pim m2cor" gm2_init {*}${theIpath} -fiso {*}${theLpath} {*}${args}; } @@ -450,6 +452,7 @@ proc gm2_init_ulm { {path ""} args } { append theIpath ${path} } + gm2_link_lib "m2ulm m2pim" gm2_init {*}${theIpath} -fpim {*}${theLpath} {*}${args}; } @@ -540,24 +543,26 @@ proc gm2_init_cor { {path ""} args } { proc gm2_init_minx { dialect {path ""} args } { global srcdir; global gccpath; - set gm2src ${srcdir}/../m2; send_log "srcdir is $srcdir\n" send_log "gccpath is $gccpath\n" send_log "gm2src is $gm2src\n" - set minIpath "${gccpath}/libgm2/libm2min"; - set minLpath "${gccpath}/libgm2/libm2min/.libs"; + set theIpath " -I${gccpath}/libgm2/libm2min" + append theIpath " -I${gm2src}/gm2-libs-min" - set theIpath "-I${minIpath}"; - set theLpath "-L${minLpath}"; + set theLpath " -L${gccpath}/libgm2/libm2min/.libs"; if { $path != "" } then { append theIpath " -I" append theIpath ${path} } - gm2_init {*}${theIpath} {*}${dialect} {*}${theLpath} {*}${args}; + + gm2_link_lib "m2min" + append args " -fno-exceptions " + append args " -fno-libs=- " + gm2_init {*}${theIpath} {*}${dialect} {*}${theLpath} {*}${args} } # @@ -566,6 +571,5 @@ proc gm2_init_minx { dialect {path ""} args } { # proc gm2_init_min { {path ""} args } { - append args " -fno-exceptions" - gm2_init_minx -fpim {*}${path} {*}${args}; + gm2_init_minx -fpim {*}${path} {*}${args} } -- cgit v1.1 From 117848f425a3c0eda85517b4bdaf2ebe3bc705c2 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Wed, 18 Jan 2023 22:13:29 +0100 Subject: Fortran: error recovery for invalid CLASS component [PR108434] gcc/fortran/ChangeLog: PR fortran/108434 * expr.cc (class_allocatable): Prevent NULL pointer dereference or invalid read. (class_pointer): Likewise. gcc/testsuite/ChangeLog: PR fortran/108434 * gfortran.dg/pr108434.f90: New test. --- gcc/fortran/expr.cc | 4 ++-- gcc/testsuite/gfortran.dg/pr108434.f90 | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr108434.f90 (limited to 'gcc') diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc index 5ec369c..3036b1b 100644 --- a/gcc/fortran/expr.cc +++ b/gcc/fortran/expr.cc @@ -4996,14 +4996,14 @@ get_union_initializer (gfc_symbol *union_type, gfc_component **map_p) static bool class_allocatable (gfc_component *comp) { - return comp->ts.type == BT_CLASS && CLASS_DATA (comp) + return comp->ts.type == BT_CLASS && comp->attr.class_ok && CLASS_DATA (comp) && CLASS_DATA (comp)->attr.allocatable; } static bool class_pointer (gfc_component *comp) { - return comp->ts.type == BT_CLASS && CLASS_DATA (comp) + return comp->ts.type == BT_CLASS && comp->attr.class_ok && CLASS_DATA (comp) && CLASS_DATA (comp)->attr.pointer; } diff --git a/gcc/testsuite/gfortran.dg/pr108434.f90 b/gcc/testsuite/gfortran.dg/pr108434.f90 new file mode 100644 index 0000000..e1768a5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr108434.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! PR fortran/108434 - ICE in class_allocatable +! Contributed by G.Steinmetz + +program p + type t + class(c), pointer :: a(2) ! { dg-error "must have a deferred shape" } + end type t + class(t), allocatable :: x + class(t), pointer :: y +end -- cgit v1.1 From 0d6f7b1dd62e9c9dccb0b9b673f9cc3238b7ea6d Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 19 Jan 2023 13:51:16 -0500 Subject: analyzer: use dominator info in -Wanalyzer-deref-before-check [PR108455] My integration testing [1] of -fanalyzer in GCC 13 is showing a lot of diagnostics from the new -Wanalyzer-deref-before-check warning on real-world C projects, and most of these seem to be false positives. This patch updates the warning to make it much less likely to fire: - only intraprocedural cases are now reported - reject cases in which there are control flow paths to the check that didn't come through the dereference, by looking at BB dominator information. This fixes a false positive seen in git-2.39.0's pack-revindex.c: load_revindex_from_disk (PR analyzer/108455), in which a shared "cleanup:" section checks "data" for NULL, and depending on how much of the function is executed "data" might or might not have already been dereferenced. The counts of -Wanalyzer-deref-before-check diagnostics in [1] before/after this patch show this improvement: Known false positives: 6 -> 0 (-6) Known true positives: 1 -> 1 Unclassified positives: 123 -> 63 (-60) [1] https://github.com/davidmalcolm/gcc-analyzer-integration-tests gcc/analyzer/ChangeLog: PR analyzer/108455 * analyzer.h (class checker_event): New forward decl. (class state_change_event): Indent. (class warning_event): New forward decl. * checker-event.cc (state_change_event::state_change_event): Add "enode" param. (warning_event::get_desc): Update for new param of evdesc::final_event ctor. * checker-event.h (state_change_event::state_change_event): Add "enode" param. (state_change_event::get_exploded_node): New accessor. (state_change_event::m_enode): New field. (warning_event::warning_event): New "enode" param. (warning_event::get_exploded_node): New accessor. (warning_event::m_enode): New field. * diagnostic-manager.cc (state_change_event_creator::on_global_state_change): Pass src_node to state_change_event ctor. (state_change_event_creator::on_state_change): Likewise. (null_assignment_sm_context::set_next_state): Pass NULL for new param of state_change_event ctor. * infinite-recursion.cc (infinite_recursion_diagnostic::add_final_event): Update for new param of warning_event ctor. * pending-diagnostic.cc (pending_diagnostic::add_final_event): Pass enode to warning_event ctor. * pending-diagnostic.h (evdesc::final_event): Add reference to warning_event. * sm-malloc.cc: Include "analyzer/checker-event.h" and "analyzer/exploded-graph.h". (deref_before_check::deref_before_check): Initialize new fields. (deref_before_check::emit): Reject warnings in which we were unable to determine the enodes of the dereference and the check. Reject warnings interprocedural warnings. Reject warnings in which the dereference doesn't dominate the check. (deref_before_check::describe_state_change): Set m_deref_enode. (deref_before_check::describe_final_event): Set m_check_enode. (deref_before_check::m_deref_enode): New field. (deref_before_check::m_check_enode): New field. gcc/testsuite/ChangeLog: PR analyzer/108455 * gcc.dg/analyzer/deref-before-check-1.c: Add test coverage involving dominance. * gcc.dg/analyzer/deref-before-check-pr108455-1.c: New test. * gcc.dg/analyzer/deref-before-check-pr108455-git-pack-revindex.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/analyzer.h | 4 +- gcc/analyzer/checker-event.cc | 8 +- gcc/analyzer/checker-event.h | 11 +- gcc/analyzer/diagnostic-manager.cc | 12 +- gcc/analyzer/infinite-recursion.cc | 3 +- gcc/analyzer/pending-diagnostic.cc | 1 + gcc/analyzer/pending-diagnostic.h | 6 +- gcc/analyzer/sm-malloc.cc | 35 +++++- .../gcc.dg/analyzer/deref-before-check-1.c | 36 ++++++ .../analyzer/deref-before-check-pr108455-1.c | 36 ++++++ ...deref-before-check-pr108455-git-pack-revindex.c | 133 +++++++++++++++++++++ 11 files changed, 272 insertions(+), 13 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr108455-1.c create mode 100644 gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr108455-git-pack-revindex.c (limited to 'gcc') diff --git a/gcc/analyzer/analyzer.h b/gcc/analyzer/analyzer.h index bfd098b..8f79e4b 100644 --- a/gcc/analyzer/analyzer.h +++ b/gcc/analyzer/analyzer.h @@ -93,7 +93,9 @@ class bounded_ranges_manager; class pending_diagnostic; class pending_note; struct event_loc_info; -class state_change_event; +class checker_event; + class state_change_event; + class warning_event; class checker_path; class extrinsic_state; class sm_state_map; diff --git a/gcc/analyzer/checker-event.cc b/gcc/analyzer/checker-event.cc index b0128e5..3612df7 100644 --- a/gcc/analyzer/checker-event.cc +++ b/gcc/analyzer/checker-event.cc @@ -410,7 +410,8 @@ state_change_event::state_change_event (const supernode *node, state_machine::state_t from, state_machine::state_t to, const svalue *origin, - const program_state &dst_state) + const program_state &dst_state, + const exploded_node *enode) : checker_event (EK_STATE_CHANGE, event_loc_info (stmt->location, node->m_fun->decl, @@ -418,7 +419,8 @@ state_change_event::state_change_event (const supernode *node, m_node (node), m_stmt (stmt), m_sm (sm), m_sval (sval), m_from (from), m_to (to), m_origin (origin), - m_dst_state (dst_state) + m_dst_state (dst_state), + m_enode (enode) { } @@ -1159,7 +1161,7 @@ warning_event::get_desc (bool can_colorize) const tree var = fixup_tree_for_diagnostic (m_var); label_text ev_desc = m_pending_diagnostic->describe_final_event - (evdesc::final_event (can_colorize, var, m_state)); + (evdesc::final_event (can_colorize, var, m_state, *this)); if (ev_desc.get ()) { if (m_sm && flag_analyzer_verbose_state_changes) diff --git a/gcc/analyzer/checker-event.h b/gcc/analyzer/checker-event.h index 429d4cb..5dd25cb 100644 --- a/gcc/analyzer/checker-event.h +++ b/gcc/analyzer/checker-event.h @@ -357,7 +357,8 @@ public: state_machine::state_t from, state_machine::state_t to, const svalue *origin, - const program_state &dst_state); + const program_state &dst_state, + const exploded_node *enode); label_text get_desc (bool can_colorize) const final override; meaning get_meaning () const override; @@ -367,6 +368,8 @@ public: return m_dst_state.get_current_function (); } + const exploded_node *get_exploded_node () const { return m_enode; } + const supernode *m_node; const gimple *m_stmt; const state_machine &m_sm; @@ -375,6 +378,7 @@ public: state_machine::state_t m_to; const svalue *m_origin; program_state m_dst_state; + const exploded_node *m_enode; }; /* Subclass of checker_event; parent class for subclasses that relate to @@ -668,9 +672,11 @@ class warning_event : public checker_event { public: warning_event (const event_loc_info &loc_info, + const exploded_node *enode, const state_machine *sm, tree var, state_machine::state_t state) : checker_event (EK_WARNING, loc_info), + m_enode (enode), m_sm (sm), m_var (var), m_state (state) { } @@ -678,7 +684,10 @@ public: label_text get_desc (bool can_colorize) const final override; meaning get_meaning () const override; + const exploded_node *get_exploded_node () const { return m_enode; } + private: + const exploded_node *m_enode; const state_machine *m_sm; tree m_var; state_machine::state_t m_state; diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc index f4d3561..1227d6c 100644 --- a/gcc/analyzer/diagnostic-manager.cc +++ b/gcc/analyzer/diagnostic-manager.cc @@ -1572,7 +1572,8 @@ public: src_sm_val, dst_sm_val, NULL, - dst_state)); + dst_state, + src_node)); return false; } @@ -1616,7 +1617,8 @@ public: src_sm_val, dst_sm_val, dst_origin_sval, - dst_state)); + dst_state, + src_node)); return false; } @@ -1760,7 +1762,8 @@ struct null_assignment_sm_context : public sm_context var_new_sval, from, to, NULL, - *m_new_state)); + *m_new_state, + NULL)); } void set_next_state (const gimple *stmt, @@ -1785,7 +1788,8 @@ struct null_assignment_sm_context : public sm_context sval, from, to, NULL, - *m_new_state)); + *m_new_state, + NULL)); } void warn (const supernode *, const gimple *, diff --git a/gcc/analyzer/infinite-recursion.cc b/gcc/analyzer/infinite-recursion.cc index a49ad2d..c4e85bf 100644 --- a/gcc/analyzer/infinite-recursion.cc +++ b/gcc/analyzer/infinite-recursion.cc @@ -182,7 +182,7 @@ public: /* Customize the location where the warning_event appears, putting it at the topmost entrypoint to the function. */ void add_final_event (const state_machine *, - const exploded_node *, + const exploded_node *enode, const gimple *, tree, state_machine::state_t, @@ -195,6 +195,7 @@ public: ()->get_start_location (), m_callee_fndecl, m_new_entry_enode->get_stack_depth ()), + enode, NULL, NULL, NULL)); } diff --git a/gcc/analyzer/pending-diagnostic.cc b/gcc/analyzer/pending-diagnostic.cc index c5a0e9c..79e6c55 100644 --- a/gcc/analyzer/pending-diagnostic.cc +++ b/gcc/analyzer/pending-diagnostic.cc @@ -232,6 +232,7 @@ pending_diagnostic::add_final_event (const state_machine *sm, (event_loc_info (get_stmt_location (stmt, enode->get_function ()), enode->get_function ()->decl, enode->get_stack_depth ()), + enode, sm, var, state)); } diff --git a/gcc/analyzer/pending-diagnostic.h b/gcc/analyzer/pending-diagnostic.h index 6016bf6..de79890 100644 --- a/gcc/analyzer/pending-diagnostic.h +++ b/gcc/analyzer/pending-diagnostic.h @@ -131,13 +131,15 @@ struct return_of_state : public event_desc struct final_event : public event_desc { final_event (bool colorize, - tree expr, state_machine::state_t state) + tree expr, state_machine::state_t state, + const warning_event &event) : event_desc (colorize), - m_expr (expr), m_state (state) + m_expr (expr), m_state (state), m_event (event) {} tree m_expr; state_machine::state_t m_state; + const warning_event &m_event; }; } /* end of namespace evdesc */ diff --git a/gcc/analyzer/sm-malloc.cc b/gcc/analyzer/sm-malloc.cc index 212e9c2..9aee810 100644 --- a/gcc/analyzer/sm-malloc.cc +++ b/gcc/analyzer/sm-malloc.cc @@ -45,6 +45,8 @@ along with GCC; see the file COPYING3. If not see #include "attribs.h" #include "analyzer/function-set.h" #include "analyzer/program-state.h" +#include "analyzer/checker-event.h" +#include "analyzer/exploded-graph.h" #if ENABLE_ANALYZER @@ -1490,7 +1492,9 @@ class deref_before_check : public malloc_diagnostic { public: deref_before_check (const malloc_state_machine &sm, tree arg) - : malloc_diagnostic (sm, arg) + : malloc_diagnostic (sm, arg), + m_deref_enode (NULL), + m_check_enode (NULL) {} const char *get_kind () const final override { return "deref_before_check"; } @@ -1502,6 +1506,31 @@ public: bool emit (rich_location *rich_loc) final override { + /* Don't emit the warning if we can't show where the deref + and the check occur. */ + if (!m_deref_enode) + return false; + if (!m_check_enode) + return false; + /* Only emit the warning for intraprocedural cases. */ + if (m_deref_enode->get_function () != m_check_enode->get_function ()) + return false; + if (&m_deref_enode->get_point ().get_call_string () + != &m_check_enode->get_point ().get_call_string ()) + return false; + + /* Reject the warning if the deref's BB doesn't dominate that + of the check, so that we don't warn e.g. for shared cleanup + code that checks a pointer for NULL, when that code is sometimes + used before a deref and sometimes after. + Using the dominance code requires setting cfun. */ + auto_cfun sentinel (m_deref_enode->get_function ()); + calculate_dominance_info (CDI_DOMINATORS); + if (!dominated_by_p (CDI_DOMINATORS, + m_check_enode->get_supernode ()->m_bb, + m_deref_enode->get_supernode ()->m_bb)) + return false; + if (m_arg) return warning_at (rich_loc, get_controlling_option (), "check of %qE for NULL after already" @@ -1520,6 +1549,7 @@ public: && assumed_non_null_p (change.m_new_state)) { m_first_deref_event = change.m_event_id; + m_deref_enode = change.m_event.get_exploded_node (); if (m_arg) return change.formatted_print ("pointer %qE is dereferenced here", m_arg); @@ -1531,6 +1561,7 @@ public: label_text describe_final_event (const evdesc::final_event &ev) final override { + m_check_enode = ev.m_event.get_exploded_node (); if (m_first_deref_event.known_p ()) { if (m_arg) @@ -1556,6 +1587,8 @@ public: private: diagnostic_event_id_t m_first_deref_event; + const exploded_node *m_deref_enode; + const exploded_node *m_check_enode; }; /* struct allocation_state : public state_machine::state. */ diff --git a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-1.c b/gcc/testsuite/gcc.dg/analyzer/deref-before-check-1.c index e1c7a00..1b11da5 100644 --- a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-1.c +++ b/gcc/testsuite/gcc.dg/analyzer/deref-before-check-1.c @@ -167,3 +167,39 @@ int test_checking_ptr_after_calling_deref (int *q) return 0; return v; } + +extern void foo (); +extern void bar (); +extern void baz (); + +int test_cfg_diamond_1 (int *p, int flag) +{ + int x; + x = *p; /* { dg-message "pointer 'p' is dereferenced here" } */ + if (flag) + foo (); + else + bar (); + if (p) /* { dg-warning "check of 'p' for NULL after already dereferencing it" } */ + { + baz (); + } + return x; +} + +int test_cfg_diamond_2 (int *p, int flag) +{ + int x = 0; + if (flag) + foo (); + else + { + x = *p; + bar (); + } + if (p) /* { dg-bogus "check of 'p' for NULL after already dereferencing it" } */ + { + baz (); + } + return x; +} diff --git a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr108455-1.c b/gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr108455-1.c new file mode 100644 index 0000000..d7d873e --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr108455-1.c @@ -0,0 +1,36 @@ +extern int could_fail_1 (void); +extern void *could_fail_2 (int); +extern void cleanup (void *); + +struct header { + int signature; +}; + +int test_1 (void) { + int fd, ret = 0; + void *data = ((void *)0); + struct header *hdr; + + fd = could_fail_1 (); + + if (fd < 0) { + ret = -1; + goto cleanup; + } + + data = could_fail_2 (fd); + hdr = data; + + if (hdr->signature != 42) { + ret = -2; + goto cleanup; + } + +cleanup: + if (ret) { + if (data) /* { dg-bogus "check of 'data' for NULL after already dereferencing it" } */ + cleanup (data); + } + + return ret; +} diff --git a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr108455-git-pack-revindex.c b/gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr108455-git-pack-revindex.c new file mode 100644 index 0000000..7553f86 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr108455-git-pack-revindex.c @@ -0,0 +1,133 @@ +/* Reduced from git-2.39.0's pack-revindex.c */ + +typedef unsigned int __uint32_t; +typedef unsigned long int __uintmax_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef __SIZE_TYPE__ size_t; +typedef __off64_t off_t; +typedef __uint32_t uint32_t; +typedef __uintmax_t uintmax_t; + +struct stat { + /* [...snip...] */ + __off_t st_size; + /* [...snip...] */ +}; + +extern int close(int __fd); +extern int fstat(int __fd, struct stat *__buf) + __attribute__((__nothrow__, __leaf__)) __attribute__((__nonnull__(2))); +extern uint32_t default_swab32(uint32_t val); +extern uint32_t git_bswap32(uint32_t x); +__attribute__((__noreturn__)) void die(const char *err, ...) + __attribute__((format(printf, 1, 2))); +int error(const char *err, ...) __attribute__((format(printf, 1, 2))); +int error_errno(const char *err, ...) __attribute__((format(printf, 1, 2))); +static inline int const_error(void) { return -1; } +extern int munmap(void *__addr, size_t __len) + __attribute__((__nothrow__, __leaf__)); +extern size_t st_mult(size_t a, size_t b); +extern void *xmmap(void *start, size_t length, int prot, int flags, int fd, + off_t offset); +extern size_t xsize_t(off_t len); + +extern char *gettext(const char *__msgid) __attribute__((__nothrow__, __leaf__)) +__attribute__((__format_arg__(1))); +static inline __attribute__((format_arg(1))) const char *_(const char *msgid) { + if (!*msgid) + return ""; + return gettext(msgid); +} + +struct repository { + /* [...snip...] */ + const struct git_hash_algo *hash_algo; + /* [...snip...] */ +}; +extern struct repository *the_repository; +struct git_hash_algo { + /* [...snip...] */ + size_t rawsz; + /* [...snip...] */ +}; + +int git_open_cloexec(const char *name, int flags); + +struct revindex_header { + uint32_t signature; + uint32_t version; + uint32_t hash_id; +}; + +int load_revindex_from_disk(char *revindex_name, uint32_t num_objects, + const uint32_t **data_p, size_t *len_p) { + int fd, ret = 0; + struct stat st; + void *data = ((void *)0); + size_t revindex_size; + struct revindex_header *hdr; + + fd = git_open_cloexec(revindex_name, 00); + + if (fd < 0) { + ret = -1; + goto cleanup; + } + if (fstat(fd, &st)) { + ret = (error_errno(_("failed to read %s"), revindex_name), const_error()); + goto cleanup; + } + + revindex_size = xsize_t(st.st_size); + + if (revindex_size < ((12) + (2 * the_repository->hash_algo->rawsz))) { + ret = (error(_("reverse-index file %s is too small"), revindex_name), + const_error()); + goto cleanup; + } + + if (revindex_size - ((12) + (2 * the_repository->hash_algo->rawsz)) != + st_mult(sizeof(uint32_t), num_objects)) { + ret = (error(_("reverse-index file %s is corrupt"), revindex_name), + const_error()); + goto cleanup; + } + + data = xmmap(((void *)0), revindex_size, 0x1, 0x02, fd, 0); + hdr = data; + + if (git_bswap32(hdr->signature) != 0x52494458) { + ret = + (error(_("reverse-index file %s has unknown signature"), revindex_name), + const_error()); + goto cleanup; + } + if (git_bswap32(hdr->version) != 1) { + ret = (error(_("reverse-index file %s has unsupported version %" + "u"), + revindex_name, git_bswap32(hdr->version)), + const_error()); + goto cleanup; + } + if (!(git_bswap32(hdr->hash_id) == 1 || git_bswap32(hdr->hash_id) == 2)) { + ret = (error(_("reverse-index file %s has unsupported hash id %" + "u"), + revindex_name, git_bswap32(hdr->hash_id)), + const_error()); + goto cleanup; + } + +cleanup: + if (ret) { + if (data) /* { dg-bogus "check of 'data' for NULL after already dereferencing it" } */ + munmap(data, revindex_size); + } else { + *len_p = revindex_size; + *data_p = (const uint32_t *)data; + } + + if (fd >= 0) + close(fd); + return ret; +} -- cgit v1.1 From 46644ec99cb355845b23bb1d02775c057ed8ee88 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 19 Jan 2023 21:00:08 +0100 Subject: openmp: Fix up OpenMP expansion of non-rectangular loops [PR108459] expand_omp_for_init_counts was using for the case where collapse(2) inner loop has init expression dependent on non-constant multiple of the outer iterator and the condition upper bound expression doesn't depend on the outer iterator fold_unary (NEGATE_EXPR, ...). This will just return NULL if it can't be folded, we need fold_build1 instead. 2023-01-19 Jakub Jelinek PR middle-end/108459 * omp-expand.cc (expand_omp_for_init_counts): Use fold_build1 rather than fold_unary for NEGATE_EXPR. * testsuite/libgomp.c/pr108459.c: New test. --- gcc/omp-expand.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/omp-expand.cc b/gcc/omp-expand.cc index c7ef419..940454b 100644 --- a/gcc/omp-expand.cc +++ b/gcc/omp-expand.cc @@ -2003,8 +2003,8 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi, t = fold_build2 (MINUS_EXPR, itype, unshare_expr (fd->loops[i].m2), unshare_expr (fd->loops[i].m1)); else if (fd->loops[i].m1) - t = fold_unary (NEGATE_EXPR, itype, - unshare_expr (fd->loops[i].m1)); + t = fold_build1 (NEGATE_EXPR, itype, + unshare_expr (fd->loops[i].m1)); else t = unshare_expr (fd->loops[i].m2); tree m2minusm1 -- cgit v1.1 From 77a67e3a9294c825ac1a2b205fbb266e7c29e82b Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 18 Jan 2023 11:08:14 -0800 Subject: x86: Check invalid third argument to __builtin_ia32_prefetch Check invalid third argument to __builtin_ia32_prefetch when expaning __builtin_ia32_prefetch to avoid ICE later. gcc/ PR target/108436 * config/i386/i386-expand.cc (ix86_expand_builtin): Check invalid third argument to __builtin_ia32_prefetch. gcc/testsuite/ * gcc.target/i386/pr108436.c: New test. --- gcc/config/i386/i386-expand.cc | 12 ++++++++++++ gcc/testsuite/gcc.target/i386/pr108436.c | 15 +++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr108436.c (limited to 'gcc') diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index 54f700c..e2e2d28 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -13175,6 +13175,12 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, if (INTVAL (op3) == 1) { + if (INTVAL (op2) < 2 || INTVAL (op2) > 3) + { + error ("invalid third argument"); + return const0_rtx; + } + if (TARGET_64BIT && TARGET_PREFETCHI && local_func_symbolic_operand (op0, GET_MODE (op0))) emit_insn (gen_prefetchi (op0, op2)); @@ -13195,6 +13201,12 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, op0 = copy_addr_to_reg (op0); } + if (INTVAL (op2) < 0 || INTVAL (op2) > 3) + { + warning (0, "invalid third argument to %<__builtin_ia32_prefetch%>; using zero"); + op2 = const0_rtx; + } + if (TARGET_3DNOW || TARGET_PREFETCH_SSE || TARGET_PRFCHW || TARGET_PREFETCHWT1) emit_insn (gen_prefetch (op0, op1, op2)); diff --git a/gcc/testsuite/gcc.target/i386/pr108436.c b/gcc/testsuite/gcc.target/i386/pr108436.c new file mode 100644 index 0000000..d51f258 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr108436.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-mprefetchi" } */ + +int +foo (int a) +{ + return a + 1; +} + +void +bad (int *p) +{ + __builtin_ia32_prefetch (p, 0, 4, 0); /* { dg-warning "invalid third argument to '__builtin_ia32_prefetch'; using zero" } */ + __builtin_ia32_prefetch (foo, 0, 4, 1); /* { dg-error "invalid third argument" } */ +} -- cgit v1.1 From c81e68a9cdbb5411dce1f1da3b35854212305c7c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 19 Jan 2023 23:26:35 +0100 Subject: value-relation: Fix up relation_union [PR108447] While looking at the PR, I've noticed one row in rr_union_table is wrong. relation_union should be commutative, but due to that bug is not. The following patch adds a self-test for that property (fails without the first hunk) and fixes that line. The actual floating point relation problem isn't fixed by this patch though. 2023-01-19 Jakub Jelinek PR tree-optimization/108447 * value-relation.cc (rr_union_table): Fix VREL_UNDEFINED row order. (relation_tests): Add self-tests for relation_{intersect,union} commutativity. * selftest.h (relation_tests): Declare. * function-tests.cc (test_ranges): Call it. --- gcc/function-tests.cc | 1 + gcc/selftest.h | 1 + gcc/value-relation.cc | 25 ++++++++++++++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/function-tests.cc b/gcc/function-tests.cc index 846226d..39970b2 100644 --- a/gcc/function-tests.cc +++ b/gcc/function-tests.cc @@ -583,6 +583,7 @@ test_ranges () push_cfun (fun); range_tests (); range_op_tests (); + relation_tests (); build_cfg (fndecl); convert_to_ssa (fndecl); diff --git a/gcc/selftest.h b/gcc/selftest.h index 1abec2d..20d522a 100644 --- a/gcc/selftest.h +++ b/gcc/selftest.h @@ -244,6 +244,7 @@ extern void predict_cc_tests (); extern void pretty_print_cc_tests (); extern void range_tests (); extern void range_op_tests (); +extern void relation_tests (); extern void gimple_range_tests (); extern void read_rtl_function_cc_tests (); extern void rtl_tests_cc_tests (); diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc index b8fa765..6f8a1b7 100644 --- a/gcc/value-relation.cc +++ b/gcc/value-relation.cc @@ -115,7 +115,7 @@ relation_kind rr_union_table[VREL_LAST][VREL_LAST] = { { VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING }, // VREL_UNDEFINED - { VREL_VARYING, VREL_LT, VREL_LE, VREL_GT, VREL_GE, VREL_UNDEFINED, + { VREL_VARYING, VREL_UNDEFINED, VREL_LT, VREL_LE, VREL_GT, VREL_GE, VREL_EQ, VREL_NE }, // VREL_LT { VREL_VARYING, VREL_LT, VREL_LT, VREL_LE, VREL_NE, VREL_VARYING, VREL_LE, @@ -1718,3 +1718,26 @@ equiv_relation_iterator::get_name (relation_kind *rel) } return NULL_TREE; } + +#if CHECKING_P +#include "selftest.h" + +namespace selftest +{ +void +relation_tests () +{ + // Verify commutativity of relation_intersect and relation_union. + for (relation_kind r1 = VREL_VARYING; r1 < VREL_PE8; + r1 = relation_kind (r1 + 1)) + for (relation_kind r2 = VREL_VARYING; r2 < VREL_PE8; + r2 = relation_kind (r2 + 1)) + { + ASSERT_EQ (relation_intersect (r1, r2), relation_intersect (r2, r1)); + ASSERT_EQ (relation_union (r1, r2), relation_union (r2, r1)); + } +} + +} // namespace selftest + +#endif // CHECKING_P -- cgit v1.1 From 9b9a989adc042b304572fd6d4ade46b47be6ccb8 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 19 Jan 2023 23:27:34 +0100 Subject: c++: Fix up handling of references to anon union members in initializers [PR53932] For anonymous union members we create artificial VAR_DECLs which have DECL_VALUE_EXPR for the actual COMPONENT_REF. That works just fine inside of functions (including global dynamic constructors), because during gimplification such VAR_DECLs are gimplified as their DECL_VALUE_EXPR. This is also done during regimplification. But references to these artificial vars in DECL_INITIAL expressions aren't ever replaced by the DECL_VALUE_EXPRs, so we end up either with link failures like on the testcase below, or worse ICEs with LTO. The following patch fixes those during cp_fully_fold_init where we already walk all the trees (!data->genericize means that function rather than cp_fold_function). 2023-01-19 Jakub Jelinek PR c++/53932 * cp-gimplify.cc (cp_fold_r): During cp_fully_fold_init replace DECL_ANON_UNION_VAR_P VAR_DECLs with their corresponding DECL_VALUE_EXPR. * g++.dg/init/pr53932.C: New test. --- gcc/cp/cp-gimplify.cc | 10 ++++++++++ gcc/testsuite/g++.dg/init/pr53932.C | 25 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 gcc/testsuite/g++.dg/init/pr53932.C (limited to 'gcc') diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc index a282156..340b464 100644 --- a/gcc/cp/cp-gimplify.cc +++ b/gcc/cp/cp-gimplify.cc @@ -1010,6 +1010,16 @@ cp_fold_r (tree *stmt_p, int *walk_subtrees, void *data_) } break; + case VAR_DECL: + /* In initializers replace anon union artificial VAR_DECLs + with their DECL_VALUE_EXPRs, as nothing will do it later. */ + if (DECL_ANON_UNION_VAR_P (stmt) && !data->genericize) + { + *stmt_p = stmt = unshare_expr (DECL_VALUE_EXPR (stmt)); + break; + } + break; + default: break; } diff --git a/gcc/testsuite/g++.dg/init/pr53932.C b/gcc/testsuite/g++.dg/init/pr53932.C new file mode 100644 index 0000000..3b129e7 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/pr53932.C @@ -0,0 +1,25 @@ +// PR c++/53932 +// { dg-do link } + +static union { int i; }; +int &r = i; +int s = i; +int *t = &i; + +void +foo (int **p, int *q) +{ + static int &u = i; + static int v = i; + static int *w = &i; + int &x = i; + int y = i; + int *z = &i; + *p = &i; + *q = i; +} + +int +main () +{ +} -- cgit v1.1 From 86caab6c5d1e26e1c54c3dceacc873d6e27bfc09 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 19 Jan 2023 23:31:15 +0100 Subject: c++: Fix up handling of non-dependent subscript with static operator[] [PR108437] As the following testcases shows, when adding static operator[] support I've missed that the 2 build_min_non_dep_op_overload functions need to be adjusted. The first one we only use for the single index case, but as cp_tree_code_length (ARRAY_REF) is 2, we were running into an assertion there which compared nargs and expected_nargs. For ARRAY_REF, the operator[] is either a non-static member or newly static member, never out of class and for the static member case if user uses single index the operator[] needs to have a single argument as well, but the function is called with 2 - the object it is invoked on and the index. We need to evaluate side-effects of the object and use just a single argument in the call - the index. The other build_min_non_dep_op_overload overload has been added solely for ARRAY_REF - CALL_EXPR is the other operator that accepts variable number of operands but that one goes through different routines. There we asserted it is a METHOD_TYPE, so again we shouldn't assert that but handle the case when it is not one by making sure object's side-effects are evaluated if needed and passing all the index arguments to the static operator[]. 2023-01-19 Jakub Jelinek PR c++/108437 * cp-tree.h (keep_unused_object_arg): Declare. * call.cc (keep_unused_object_arg): No longer static. * tree.cc (build_min_non_dep_op_overload): Handle ARRAY_REF with overload being static member function. * g++.dg/cpp23/subscript12.C: New test. * g++.dg/cpp23/subscript13.C: New test. --- gcc/cp/call.cc | 2 +- gcc/cp/cp-tree.h | 1 + gcc/cp/tree.cc | 30 ++++++++++++++++------ gcc/testsuite/g++.dg/cpp23/subscript12.C | 34 +++++++++++++++++++++++++ gcc/testsuite/g++.dg/cpp23/subscript13.C | 43 ++++++++++++++++++++++++++++++++ 5 files changed, 102 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp23/subscript12.C create mode 100644 gcc/testsuite/g++.dg/cpp23/subscript13.C (limited to 'gcc') diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index 0780b58..9917307 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -5187,7 +5187,7 @@ build_operator_new_call (tree fnname, vec **args, or static operator(), in which cases the source expression would be `obj[...]' or `obj(...)'. */ -static tree +tree keep_unused_object_arg (tree result, tree obj, tree fn) { if (result == NULL_TREE diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index d3058c0..9f18872 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -6599,6 +6599,7 @@ inline tree build_new_op (const op_location_t &loc, enum tree_code code, return build_new_op (loc, code, flags, arg1, arg2, NULL_TREE, NULL_TREE, NULL, complain); } +extern tree keep_unused_object_arg (tree, tree, tree); extern tree build_op_call (tree, vec **, tsubst_flags_t); extern tree build_op_subscript (const op_location_t &, tree, diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc index 8060d39..c1da868 100644 --- a/gcc/cp/tree.cc +++ b/gcc/cp/tree.cc @@ -3693,14 +3693,20 @@ build_min_non_dep_op_overload (enum tree_code op, { va_list p; int nargs, expected_nargs; - tree fn, call; + tree fn, call, obj = NULL_TREE; non_dep = extract_call_expr (non_dep); nargs = call_expr_nargs (non_dep); expected_nargs = cp_tree_code_length (op); - if (TREE_CODE (TREE_TYPE (overload)) == METHOD_TYPE) + if (TREE_CODE (TREE_TYPE (overload)) == METHOD_TYPE + /* For ARRAY_REF, operator[] is either a non-static member or newly + static member, never out of class and for the static member case + if user uses single index the operator[] needs to have a single + argument as well, but the function is called with 2 - the object + it is invoked on and the index. */ + || op == ARRAY_REF) expected_nargs -= 1; if ((op == POSTINCREMENT_EXPR || op == POSTDECREMENT_EXPR) @@ -3715,6 +3721,8 @@ build_min_non_dep_op_overload (enum tree_code op, if (TREE_CODE (TREE_TYPE (overload)) == FUNCTION_TYPE) { fn = overload; + if (op == ARRAY_REF) + obj = va_arg (p, tree); for (int i = 0; i < nargs; i++) { tree arg = va_arg (p, tree); @@ -3746,6 +3754,8 @@ build_min_non_dep_op_overload (enum tree_code op, CALL_EXPR_ORDERED_ARGS (call_expr) = CALL_EXPR_ORDERED_ARGS (non_dep); CALL_EXPR_REVERSE_ARGS (call_expr) = CALL_EXPR_REVERSE_ARGS (non_dep); + if (obj) + return keep_unused_object_arg (call, obj, overload); return call; } @@ -3759,11 +3769,15 @@ build_min_non_dep_op_overload (tree non_dep, tree overload, tree object, non_dep = extract_call_expr (non_dep); unsigned int nargs = call_expr_nargs (non_dep); - gcc_assert (TREE_CODE (TREE_TYPE (overload)) == METHOD_TYPE); - tree binfo = TYPE_BINFO (TREE_TYPE (object)); - tree method = build_baselink (binfo, binfo, overload, NULL_TREE); - tree fn = build_min (COMPONENT_REF, TREE_TYPE (overload), - object, method, NULL_TREE); + tree fn = overload; + if (TREE_CODE (TREE_TYPE (overload)) == METHOD_TYPE) + { + tree binfo = TYPE_BINFO (TREE_TYPE (object)); + tree method = build_baselink (binfo, binfo, overload, NULL_TREE); + fn = build_min (COMPONENT_REF, TREE_TYPE (overload), + object, method, NULL_TREE); + object = NULL_TREE; + } gcc_assert (vec_safe_length (args) == nargs); tree call = build_min_non_dep_call_vec (non_dep, fn, args); @@ -3774,6 +3788,8 @@ build_min_non_dep_op_overload (tree non_dep, tree overload, tree object, CALL_EXPR_ORDERED_ARGS (call_expr) = CALL_EXPR_ORDERED_ARGS (non_dep); CALL_EXPR_REVERSE_ARGS (call_expr) = CALL_EXPR_REVERSE_ARGS (non_dep); + if (object) + return keep_unused_object_arg (call, object, overload); return call; } diff --git a/gcc/testsuite/g++.dg/cpp23/subscript12.C b/gcc/testsuite/g++.dg/cpp23/subscript12.C new file mode 100644 index 0000000..49cd8a6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/subscript12.C @@ -0,0 +1,34 @@ +// PR c++/108437 +// { dg-do run { target c++23 } } + +struct S { static int &operator[] (int x) { static int a[2]; return a[x]; } }; +struct U { static int &operator[] (int x, int y, int z) { static int a[2]; return a[x + y + z]; } }; +struct V { static int &operator[] () { static int a; return a; } }; + +template void +foo () +{ + S s; + s[0]++; + T t; + t[0]++; + U u; + u[0, 0, 0]++; + V v; + v[]++; + W w; + w[0, 0, 0]++; + X x; + x[]++; +} + +int +main () +{ + S::operator[] (0) = 1; + U::operator[] (0, 0, 0) = 2; + V::operator[] () = 3; + foo (); + if (S::operator[] (0) != 3 || U::operator[] (0, 0, 0) != 4 || V::operator[] () != 5) + __builtin_abort (); +} diff --git a/gcc/testsuite/g++.dg/cpp23/subscript13.C b/gcc/testsuite/g++.dg/cpp23/subscript13.C new file mode 100644 index 0000000..3fb3b49 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/subscript13.C @@ -0,0 +1,43 @@ +// PR c++/108437 +// { dg-do run { target c++23 } } + +struct S { static int &operator[] (int x) { static int a[2]; return a[x]; } }; +struct U { static int &operator[] (int x, int y, int z) { static int a[2]; return a[x + y + z]; } }; +struct V { static int &operator[] () { static int a; return a; } }; +int cnt; + +template +T & +bar (T &x) +{ + ++cnt; + return x; +} + +template void +foo () +{ + S s; + bar (s)[0]++; + T t; + bar (t)[0]++; + U u; + bar (u)[0, 0, 0]++; + V v; + bar (v)[]++; + W w; + bar (w)[0, 0, 0]++; + X x; + bar (x)[]++; +} + +int +main () +{ + S::operator[] (0) = 1; + U::operator[] (0, 0, 0) = 2; + V::operator[] () = 3; + foo (); + if (S::operator[] (0) != 3 || U::operator[] (0, 0, 0) != 4 || V::operator[] () != 5 || cnt != 6) + __builtin_abort (); +} -- cgit v1.1 From 0846336de56119777861e02bf68f92a6af466000 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 20 Jan 2023 00:17:40 +0000 Subject: Daily bump. --- gcc/ChangeLog | 55 +++++++++++++++++++++++++++++++++++ gcc/DATESTAMP | 2 +- gcc/analyzer/ChangeLog | 42 +++++++++++++++++++++++++++ gcc/cp/ChangeLog | 15 ++++++++++ gcc/fortran/ChangeLog | 7 +++++ gcc/testsuite/ChangeLog | 77 +++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 197 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ffca6da..707456b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,58 @@ +2023-01-19 Jakub Jelinek + + PR tree-optimization/108447 + * value-relation.cc (rr_union_table): Fix VREL_UNDEFINED row order. + (relation_tests): Add self-tests for relation_{intersect,union} + commutativity. + * selftest.h (relation_tests): Declare. + * function-tests.cc (test_ranges): Call it. + +2023-01-19 H.J. Lu + + PR target/108436 + * config/i386/i386-expand.cc (ix86_expand_builtin): Check + invalid third argument to __builtin_ia32_prefetch. + +2023-01-19 Jakub Jelinek + + PR middle-end/108459 + * omp-expand.cc (expand_omp_for_init_counts): Use fold_build1 rather + than fold_unary for NEGATE_EXPR. + +2023-01-19 Christophe Lyon + + PR target/108411 + * config/aarch64/aarch64.cc (aarch64_layout_arg): Improve + comment. Move assert about alignment a bit later. + +2023-01-19 Jakub Jelinek + + PR tree-optimization/108440 + * tree-ssa-forwprop.cc: Include gimple-range.h. + (simplify_rotate): For the forms with T2 wider than T and shift counts of + Y and B - Y add & (B - 1) masking for the rotate count if Y could be equal + to B. For the forms with T2 wider than T and shift counts of + Y and (-Y) & (B - 1), don't punt if range could be [B, B2], but only if + range doesn't guarantee Y < B or Y = N * B. If range doesn't guarantee + Y < B, also add & (B - 1) masking for the rotate count. Use lazily created + pass specific ranger instead of get_global_range_query. + (pass_forwprop::execute): Disable that ranger at the end of pass if it has + been created. + +2023-01-19 Prathamesh Kulkarni + + * config/aarch64/aarch64-simd.md (aarch64_simd_vec_set): Use + exact_log2 (INTVAL (operands[2])) >= 0 as condition for gating + the pattern. + (aarch64_simd_vec_copy_lane): Likewise. + (aarch64_simd_vec_copy_lane_): Likewise. + +2023-01-19 Alexandre Oliva + + PR debug/106746 + * sched-deps.cc (sched_analyze_2): Skip cselib address lookup + within debug insns. + 2023-01-18 Martin Jambor PR ipa/107944 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 847dee1..c8519a7 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20230119 +20230120 diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog index 959464a..c489ee8 100644 --- a/gcc/analyzer/ChangeLog +++ b/gcc/analyzer/ChangeLog @@ -1,3 +1,45 @@ +2023-01-19 David Malcolm + + PR analyzer/108455 + * analyzer.h (class checker_event): New forward decl. + (class state_change_event): Indent. + (class warning_event): New forward decl. + * checker-event.cc (state_change_event::state_change_event): Add + "enode" param. + (warning_event::get_desc): Update for new param of + evdesc::final_event ctor. + * checker-event.h (state_change_event::state_change_event): Add + "enode" param. + (state_change_event::get_exploded_node): New accessor. + (state_change_event::m_enode): New field. + (warning_event::warning_event): New "enode" param. + (warning_event::get_exploded_node): New accessor. + (warning_event::m_enode): New field. + * diagnostic-manager.cc + (state_change_event_creator::on_global_state_change): Pass + src_node to state_change_event ctor. + (state_change_event_creator::on_state_change): Likewise. + (null_assignment_sm_context::set_next_state): Pass NULL for + new param of state_change_event ctor. + * infinite-recursion.cc + (infinite_recursion_diagnostic::add_final_event): Update for new + param of warning_event ctor. + * pending-diagnostic.cc (pending_diagnostic::add_final_event): + Pass enode to warning_event ctor. + * pending-diagnostic.h (evdesc::final_event): Add reference to + warning_event. + * sm-malloc.cc: Include "analyzer/checker-event.h" and + "analyzer/exploded-graph.h". + (deref_before_check::deref_before_check): Initialize new fields. + (deref_before_check::emit): Reject warnings in which we were + unable to determine the enodes of the dereference and the check. + Reject warnings interprocedural warnings. Reject warnings in which + the dereference doesn't dominate the check. + (deref_before_check::describe_state_change): Set m_deref_enode. + (deref_before_check::describe_final_event): Set m_check_enode. + (deref_before_check::m_deref_enode): New field. + (deref_before_check::m_check_enode): New field. + 2023-01-13 David Malcolm PR analyzer/105273 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4ed513b..e377041 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,18 @@ +2023-01-19 Jakub Jelinek + + PR c++/108437 + * cp-tree.h (keep_unused_object_arg): Declare. + * call.cc (keep_unused_object_arg): No longer static. + * tree.cc (build_min_non_dep_op_overload): Handle ARRAY_REF + with overload being static member function. + +2023-01-19 Jakub Jelinek + + PR c++/53932 + * cp-gimplify.cc (cp_fold_r): During cp_fully_fold_init replace + DECL_ANON_UNION_VAR_P VAR_DECLs with their corresponding + DECL_VALUE_EXPR. + 2023-01-16 Jakub Jelinek PR c++/105593 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3f3e03c..e30b9d5 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2023-01-19 Harald Anlauf + + PR fortran/108434 + * expr.cc (class_allocatable): Prevent NULL pointer dereference + or invalid read. + (class_pointer): Likewise. + 2023-01-17 Harald Anlauf PR fortran/108421 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5723c8c..c26a59f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,80 @@ +2023-01-19 Jakub Jelinek + + PR c++/108437 + * g++.dg/cpp23/subscript12.C: New test. + * g++.dg/cpp23/subscript13.C: New test. + +2023-01-19 Jakub Jelinek + + PR c++/53932 + * g++.dg/init/pr53932.C: New test. + +2023-01-19 H.J. Lu + + * gcc.target/i386/pr108436.c: New test. + +2023-01-19 David Malcolm + + PR analyzer/108455 + * gcc.dg/analyzer/deref-before-check-1.c: Add test coverage + involving dominance. + * gcc.dg/analyzer/deref-before-check-pr108455-1.c: New test. + * gcc.dg/analyzer/deref-before-check-pr108455-git-pack-revindex.c: + New test. + +2023-01-19 Harald Anlauf + + PR fortran/108434 + * gfortran.dg/pr108434.f90: New test. + +2023-01-19 Iain Sandoe + + * gm2/complex/run/pass/complex-run-pass.exp: Remove gm2_link_lib. + * gm2/iso/run/pass/iso-run-pass.exp: Likewise. + * gm2/link/externalscaffold/pass/link-externalscaffold-pass.exp: + * gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp: Likewise. + * gm2/pimlib/run/pass/pimlib-run-pass.exp: Likewise. + * gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp: + Likewise. + * gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp: + Likewise. + * gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp: + Likewise. + * gm2/sets/run/pass/sets-run-pass.exp: Likewise. + * gm2/switches/none/run/pass/gm2-none.exp: Likewise. + * gm2/switches/pic/run/pass/switches-pic-run-pass.exp: Likewise. + * gm2/projects/pim/run/pass/random/projects-pim-run-pass-random.exp: + Likewise, and also ensure that the -g option is appended to avoid it + being taken as a path. + * lib/gm2.exp: Ensure for each gm2_init_xxxx function that the set of + libraries added matches the set of -I and -L options. + +2023-01-19 Christophe Lyon + + PR target/108411 + * g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C: Add + -fno-stack-protector. + * g++.target/aarch64/bitfield-abi-warning-align16-O2.C: Likewise. + * g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C: Likewise. + * g++.target/aarch64/bitfield-abi-warning-align32-O2.C: Likewise. + * g++.target/aarch64/bitfield-abi-warning-align8-O2.C: Likewise. + * gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c: Likewise. + * gcc.target/aarch64/bitfield-abi-warning-align16-O2.c: Likewise. + * gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c: Likewise. + * gcc.target/aarch64/bitfield-abi-warning-align32-O2.c: Likewise. + * gcc.target/aarch64/bitfield-abi-warning-align8-O2.c: Likewise. + +2023-01-19 Jakub Jelinek + + PR tree-optimization/108440 + * c-c++-common/rotate-10.c: New test. + * c-c++-common/rotate-11.c: New test. + +2023-01-19 Alexandre Oliva + + PR debug/106746 + * gcc.target/i386/pr106746.c: New. + 2023-01-18 Marek Polacek PR c/108424 -- cgit v1.1 From 16bd9e14f226e07bf0ffb9d68084c9ad69bf7b45 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 20 Jan 2023 10:23:49 +0100 Subject: niter: Fix up unused var warning [PR108457] tree-ssa-loop-niter.cc (build_cltz_expr) gets unused variable mode warning on some architectures where C[LT]Z_DEFINED_VALUE_AT_ZERO macro(s) don't use the first argument (which includes the defaults.h definitions of: #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) 0 #define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) 0 Other uses of this macro avoid this problem by avoiding temporaries which are only used as argument to those macros, the following patch does it the same way for consistency. Plus some formatting fixes while at it. 2023-01-20 Jakub Jelinek PR tree-optimization/108457 * tree-ssa-loop-niter.cc (build_cltz_expr): Use SCALAR_INT_TYPE_MODE (utype) directly as C[LT]Z_DEFINED_VALUE_AT_ZERO argument instead of a temporary. Formatting fixes. --- gcc/tree-ssa-loop-niter.cc | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'gcc') diff --git a/gcc/tree-ssa-loop-niter.cc b/gcc/tree-ssa-loop-niter.cc index 65b9604..581bf5d 100644 --- a/gcc/tree-ssa-loop-niter.cc +++ b/gcc/tree-ssa-loop-niter.cc @@ -2252,16 +2252,16 @@ build_cltz_expr (tree src, bool leading, bool define_at_zero) call = build_call_expr_internal_loc (UNKNOWN_LOCATION, ifn, integer_type_node, 1, src); int val; - scalar_int_mode mode = SCALAR_INT_TYPE_MODE (utype); int optab_defined_at_zero - = leading ? CLZ_DEFINED_VALUE_AT_ZERO (mode, val) - : CTZ_DEFINED_VALUE_AT_ZERO (mode, val); + = (leading + ? CLZ_DEFINED_VALUE_AT_ZERO (SCALAR_INT_TYPE_MODE (utype), val) + : CTZ_DEFINED_VALUE_AT_ZERO (SCALAR_INT_TYPE_MODE (utype), val)); if (define_at_zero && !(optab_defined_at_zero == 2 && val == prec)) { tree is_zero = fold_build2 (NE_EXPR, boolean_type_node, src, build_zero_cst (TREE_TYPE (src))); - call = fold_build3(COND_EXPR, integer_type_node, is_zero, call, - build_int_cst (integer_type_node, prec)); + call = fold_build3 (COND_EXPR, integer_type_node, is_zero, call, + build_int_cst (integer_type_node, prec)); } } else if (prec == 2 * lli_prec) @@ -2275,22 +2275,22 @@ build_cltz_expr (tree src, bool leading, bool define_at_zero) /* We count the zeroes in src1, and add the number in src2 when src1 is 0. */ if (!leading) - std::swap(src1, src2); + std::swap (src1, src2); tree call1 = build_call_expr (fn, 1, src1); tree call2 = build_call_expr (fn, 1, src2); if (define_at_zero) { tree is_zero2 = fold_build2 (NE_EXPR, boolean_type_node, src2, build_zero_cst (TREE_TYPE (src2))); - call2 = fold_build3(COND_EXPR, integer_type_node, is_zero2, call2, - build_int_cst (integer_type_node, lli_prec)); + call2 = fold_build3 (COND_EXPR, integer_type_node, is_zero2, call2, + build_int_cst (integer_type_node, lli_prec)); } tree is_zero1 = fold_build2 (NE_EXPR, boolean_type_node, src1, build_zero_cst (TREE_TYPE (src1))); - call = fold_build3(COND_EXPR, integer_type_node, is_zero1, call1, - fold_build2 (PLUS_EXPR, integer_type_node, call2, - build_int_cst (integer_type_node, - lli_prec))); + call = fold_build3 (COND_EXPR, integer_type_node, is_zero1, call1, + fold_build2 (PLUS_EXPR, integer_type_node, call2, + build_int_cst (integer_type_node, + lli_prec))); } else { @@ -2302,14 +2302,13 @@ build_cltz_expr (tree src, bool leading, bool define_at_zero) { tree is_zero = fold_build2 (NE_EXPR, boolean_type_node, src, build_zero_cst (TREE_TYPE (src))); - call = fold_build3(COND_EXPR, integer_type_node, is_zero, call, - build_int_cst (integer_type_node, prec)); + call = fold_build3 (COND_EXPR, integer_type_node, is_zero, call, + build_int_cst (integer_type_node, prec)); } if (leading && prec < i_prec) - call = fold_build2(MINUS_EXPR, integer_type_node, call, - build_int_cst (integer_type_node, - i_prec - prec)); + call = fold_build2 (MINUS_EXPR, integer_type_node, call, + build_int_cst (integer_type_node, i_prec - prec)); } return call; -- cgit v1.1 From 99ea0d7611605d2d1a67a6021cb78f0bdd5c609b Mon Sep 17 00:00:00 2001 From: Tejas Belagod Date: Thu, 15 Dec 2022 07:57:50 +0000 Subject: AArch64: Gate various crypto intrinsics availability based on features The 64-bit variant of PMULL{2} and AES instructions are available if FEAT_AES is implemented according to the Arm ARM [1]. Similarly FEAT_SHA1 and FEAT_SHA256 enable the use of SHA1 and SHA256 instruction variants. This patch fixes arm_neon.h to correctly reflect the feature availability based on '+aes' and '+sha2' as opposed to the ambiguous catch-all '+crypto'. [1] Section D17.2.61, C7.2.215 2022-01-11 Tejas Belagod gcc/ChangeLog: * config/aarch64/arm_neon.h (vmull_p64, vmull_high_p64, vaeseq_u8, vaesdq_u8, vaesmcq_u8, vaesimcq_u8): Gate under "nothing+aes". (vsha1*_u32, vsha256*_u32): Gate under "nothing+sha2". gcc/testsuite/ChangeLog: * gcc.target/aarch64/acle/pmull64.c: New. * gcc.target/aarch64/aes-fuse-1.c: Replace '+crypto' with corresponding feature flag based on the intrinsic. * gcc.target/aarch64/aes-fuse-2.c: Likewise. * gcc.target/aarch64/aes_1.c: Likewise. * gcc.target/aarch64/aes_2.c: Likewise. * gcc.target/aarch64/aes_xor_combine.c: Likewise. * gcc.target/aarch64/sha1_1.c: Likewise. * gcc.target/aarch64/sha256_1.c: Likewise. * gcc.target/aarch64/target_attr_crypto_ice_1.c: Likewise. --- gcc/config/aarch64/arm_neon.h | 35 +++++++++++----------- gcc/testsuite/gcc.target/aarch64/acle/pmull64.c | 14 +++++++++ gcc/testsuite/gcc.target/aarch64/aes-fuse-1.c | 4 +-- gcc/testsuite/gcc.target/aarch64/aes-fuse-2.c | 4 +-- gcc/testsuite/gcc.target/aarch64/aes_1.c | 2 +- gcc/testsuite/gcc.target/aarch64/aes_2.c | 4 ++- gcc/testsuite/gcc.target/aarch64/aes_xor_combine.c | 2 +- gcc/testsuite/gcc.target/aarch64/sha1_1.c | 2 +- gcc/testsuite/gcc.target/aarch64/sha256_1.c | 2 +- .../gcc.target/aarch64/target_attr_crypto_ice_1.c | 2 +- 10 files changed, 44 insertions(+), 27 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/acle/pmull64.c (limited to 'gcc') diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index cdc2b63..eeec9f1 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -7496,7 +7496,7 @@ vqrdmlshs_laneq_s32 (int32_t __a, int32_t __b, int32x4_t __c, const int __d) #pragma GCC pop_options #pragma GCC push_options -#pragma GCC target ("+nothing+crypto") +#pragma GCC target ("+nothing+aes") /* vaes */ __extension__ extern __inline uint8x16_t @@ -7526,6 +7526,22 @@ vaesimcq_u8 (uint8x16_t data) { return __builtin_aarch64_crypto_aesimcv16qi_uu (data); } + +__extension__ extern __inline poly128_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vmull_p64 (poly64_t __a, poly64_t __b) +{ + return + __builtin_aarch64_crypto_pmulldi_ppp (__a, __b); +} + +__extension__ extern __inline poly128_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vmull_high_p64 (poly64x2_t __a, poly64x2_t __b) +{ + return __builtin_aarch64_crypto_pmullv2di_ppp (__a, __b); +} + #pragma GCC pop_options /* vcage */ @@ -20772,7 +20788,7 @@ vrsrad_n_u64 (uint64_t __a, uint64_t __b, const int __c) } #pragma GCC push_options -#pragma GCC target ("+nothing+crypto") +#pragma GCC target ("+nothing+sha2") /* vsha1 */ @@ -20849,21 +20865,6 @@ vsha256su1q_u32 (uint32x4_t __tw0_3, uint32x4_t __w8_11, uint32x4_t __w12_15) __w12_15); } -__extension__ extern __inline poly128_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmull_p64 (poly64_t __a, poly64_t __b) -{ - return - __builtin_aarch64_crypto_pmulldi_ppp (__a, __b); -} - -__extension__ extern __inline poly128_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmull_high_p64 (poly64x2_t __a, poly64x2_t __b) -{ - return __builtin_aarch64_crypto_pmullv2di_ppp (__a, __b); -} - #pragma GCC pop_options /* vshl */ diff --git a/gcc/testsuite/gcc.target/aarch64/acle/pmull64.c b/gcc/testsuite/gcc.target/aarch64/acle/pmull64.c new file mode 100644 index 0000000..6a1e99e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/acle/pmull64.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=armv8.2-a" } */ + +#pragma push_options +#pragma GCC target ("+aes") + +#include "arm_neon.h" + +int foo (poly64_t a, poly64_t b) +{ + return vgetq_lane_s32 (vreinterpretq_s32_p128 (vmull_p64 (a, b)), 0); +} + +/* { dg-final { scan-assembler "\tpmull\tv" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/aes-fuse-1.c b/gcc/testsuite/gcc.target/aarch64/aes-fuse-1.c index d7b4f89..1b4e10f 100644 --- a/gcc/testsuite/gcc.target/aarch64/aes-fuse-1.c +++ b/gcc/testsuite/gcc.target/aarch64/aes-fuse-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -mcpu=cortex-a72+crypto -dp" } */ -/* { dg-additional-options "-march=armv8-a+crypto" { target { aarch64*-*-* } } }*/ +/* { dg-options "-O3 -mcpu=cortex-a72+aes -dp" } */ +/* { dg-additional-options "-march=armv8-a+aes" { target { aarch64*-*-* } } }*/ #include diff --git a/gcc/testsuite/gcc.target/aarch64/aes-fuse-2.c b/gcc/testsuite/gcc.target/aarch64/aes-fuse-2.c index dfe01b0..4c028b3 100644 --- a/gcc/testsuite/gcc.target/aarch64/aes-fuse-2.c +++ b/gcc/testsuite/gcc.target/aarch64/aes-fuse-2.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -mcpu=cortex-a72+crypto -dp" } */ -/* { dg-additional-options "-march=armv8-a+crypto" { target { aarch64*-*-* } } }*/ +/* { dg-options "-O3 -mcpu=cortex-a72+aes -dp" } */ +/* { dg-additional-options "-march=armv8-a+aes" { target { aarch64*-*-* } } }*/ #include diff --git a/gcc/testsuite/gcc.target/aarch64/aes_1.c b/gcc/testsuite/gcc.target/aarch64/aes_1.c index 5578e85..754c4ab 100644 --- a/gcc/testsuite/gcc.target/aarch64/aes_1.c +++ b/gcc/testsuite/gcc.target/aarch64/aes_1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-march=armv8-a+crypto" } */ +/* { dg-options "-march=armv8-a+aes" } */ #include "arm_neon.h" diff --git a/gcc/testsuite/gcc.target/aarch64/aes_2.c b/gcc/testsuite/gcc.target/aarch64/aes_2.c index 70f113f..442c100 100644 --- a/gcc/testsuite/gcc.target/aarch64/aes_2.c +++ b/gcc/testsuite/gcc.target/aarch64/aes_2.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -march=armv8-a+crypto" } */ +/* { dg-options "-O3 -march=armv8-a+aes" } */ #include "arm_neon.h" @@ -76,4 +76,6 @@ test7 (uint8x16_t a, uint8x16_t b) return result; } /* { dg-final { scan-assembler-not "mov" } } */ +/* { dg-final { scan-assembler "aesd\tv" } } */ +/* { dg-final { scan-assembler "aese\tv" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/aes_xor_combine.c b/gcc/testsuite/gcc.target/aarch64/aes_xor_combine.c index 833e9b3..ee0f0e9 100644 --- a/gcc/testsuite/gcc.target/aarch64/aes_xor_combine.c +++ b/gcc/testsuite/gcc.target/aarch64/aes_xor_combine.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -mcpu=cortex-a55+crypto" } */ +/* { dg-options "-O3 -mcpu=cortex-a55+aes" } */ #include #define AESE(r, v, key) (r = vaeseq_u8 ((v), (key))); diff --git a/gcc/testsuite/gcc.target/aarch64/sha1_1.c b/gcc/testsuite/gcc.target/aarch64/sha1_1.c index e208fe7..ba56c04 100644 --- a/gcc/testsuite/gcc.target/aarch64/sha1_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sha1_1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-march=armv8-a+crypto" } */ +/* { dg-options "-march=armv8-a+sha2" } */ #include "arm_neon.h" diff --git a/gcc/testsuite/gcc.target/aarch64/sha256_1.c b/gcc/testsuite/gcc.target/aarch64/sha256_1.c index 2102daf..c3860c6 100644 --- a/gcc/testsuite/gcc.target/aarch64/sha256_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sha256_1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-march=armv8-a+crypto" } */ +/* { dg-options "-march=armv8-a+sha2" } */ #include "arm_neon.h" diff --git a/gcc/testsuite/gcc.target/aarch64/target_attr_crypto_ice_1.c b/gcc/testsuite/gcc.target/aarch64/target_attr_crypto_ice_1.c index c74cc90..3b354c0 100644 --- a/gcc/testsuite/gcc.target/aarch64/target_attr_crypto_ice_1.c +++ b/gcc/testsuite/gcc.target/aarch64/target_attr_crypto_ice_1.c @@ -6,7 +6,7 @@ /* Unless we do something about re-laying out the SIMD builtin types this testcase ICEs during expansion of the crypto builtin. */ -__attribute__ ((target ("cpu=cortex-a57+crypto"))) +__attribute__ ((target ("cpu=cortex-a57+sha2"))) uint32x4_t test_vsha1cq_u32 (uint32x4_t hash_abcd, uint32_t hash_e, uint32x4_t wk) { -- cgit v1.1 From f71354f7b99716c47e885851280376574920da92 Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Fri, 20 Jan 2023 17:51:52 +0000 Subject: PR-108135 Modula2 meets clang (remove dead code and bugfix m2.flex) These patches fix warnings (and a bug) discovered by clang. The patch set looks longer than the changes as pge and mc needed to be rebuilt (due to a change in the gcc/m2/gm2-libs/DynamicString.mod library). gcc/m2/ChangeLog: * gm2-gcc/m2statement.cc (gm2_gimplify_function_node): Remove. * gm2-libs/DynamicStrings.mod (Equal): Remove dead code. * m2.flex ("<*"): Add {} for else statement. * m2pp.cc (hextree): Add conditional #ifdef DEBUGGING. * mc-boot/GDynamicStrings.c: Rebuild. * pge-boot/GDynamicStrings.c: Rebuild. * pge-boot/GFIO.c: Rebuild. * pge-boot/GIndexing.c: Rebuild. * pge-boot/GM2EXCEPTION.c: Rebuild. * pge-boot/GM2RTS.c: Rebuild. * pge-boot/GNameKey.c: Rebuild. * pge-boot/GPushBackInput.c: Rebuild. * pge-boot/GRTExceptions.c: Rebuild. * pge-boot/GStdIO.c: Rebuild. * pge-boot/GSymbolKey.c: Rebuild. * pge-boot/GSysStorage.c: Rebuild. Signed-off-by: Gaius Mulley --- gcc/m2/gm2-gcc/m2statement.cc | 17 ------ gcc/m2/gm2-libs/DynamicStrings.mod | 8 --- gcc/m2/m2.flex | 3 +- gcc/m2/m2pp.cc | 2 + gcc/m2/mc-boot/GDynamicStrings.c | 26 +++----- gcc/m2/pge-boot/GDynamicStrings.c | 42 +++++-------- gcc/m2/pge-boot/GFIO.c | 6 +- gcc/m2/pge-boot/GIndexing.c | 6 +- gcc/m2/pge-boot/GM2EXCEPTION.c | 4 +- gcc/m2/pge-boot/GM2RTS.c | 121 ++++++++++++++++++++++++++++++------- gcc/m2/pge-boot/GNameKey.c | 4 +- gcc/m2/pge-boot/GPushBackInput.c | 6 +- gcc/m2/pge-boot/GRTExceptions.c | 34 +++++------ gcc/m2/pge-boot/GStdIO.c | 4 +- gcc/m2/pge-boot/GSymbolKey.c | 6 +- gcc/m2/pge-boot/GSysStorage.c | 6 +- 16 files changed, 164 insertions(+), 131 deletions(-) (limited to 'gcc') diff --git a/gcc/m2/gm2-gcc/m2statement.cc b/gcc/m2/gm2-gcc/m2statement.cc index 74956da..c3307db 100644 --- a/gcc/m2/gm2-gcc/m2statement.cc +++ b/gcc/m2/gm2-gcc/m2statement.cc @@ -84,23 +84,6 @@ m2statement_BuildStartFunctionCode (location_t location, tree fndecl, DECL_DECLARED_INLINE_P (fndecl) = 0; /* isinline; */ } -static void -gm2_gimplify_function_node (tree fndecl) -{ - /* Convert all nested functions to GIMPLE now. We do things in this - order so that items like VLA sizes are expanded properly in the - context of the correct function. */ - struct cgraph_node *cgn; - - dump_function (TDI_original, fndecl); - gimplify_function_tree (fndecl); - - cgn = cgraph_node::get_create (fndecl); - for (cgn = first_nested_function (cgn); - cgn != NULL; cgn = next_nested_function (cgn)) - gm2_gimplify_function_node (cgn->decl); -} - /* BuildEndFunctionCode - generates the function epilogue. */ void diff --git a/gcc/m2/gm2-libs/DynamicStrings.mod b/gcc/m2/gm2-libs/DynamicStrings.mod index 9839e43..a109e7a 100644 --- a/gcc/m2/gm2-libs/DynamicStrings.mod +++ b/gcc/m2/gm2-libs/DynamicStrings.mod @@ -1215,14 +1215,6 @@ BEGIN i := 0 ; Assert (a^.contents.len = b^.contents.len) ; WHILE i\n.* { consumeLine(); } . { updatepos(); skippos(); } diff --git a/gcc/m2/m2pp.cc b/gcc/m2/m2pp.cc index 2f49227..3f45180 100644 --- a/gcc/m2/m2pp.cc +++ b/gcc/m2/m2pp.cc @@ -547,6 +547,7 @@ m2pp_types (pretty *s) } } +#ifdef DEBUGGING /* hextree displays the critical fields for function, block and bind_expr trees in raw hex. */ @@ -607,6 +608,7 @@ hextree (tree t) killPretty (state); } } +#endif /* translation produce a pseudo implementation module from the tree t. */ diff --git a/gcc/m2/mc-boot/GDynamicStrings.c b/gcc/m2/mc-boot/GDynamicStrings.c index 6907b80..a28b641 100644 --- a/gcc/m2/mc-boot/GDynamicStrings.c +++ b/gcc/m2/mc-boot/GDynamicStrings.c @@ -1874,16 +1874,6 @@ extern "C" unsigned int DynamicStrings_Equal (DynamicStrings_String a, DynamicSt Assertion_Assert (a->contents.len == b->contents.len); while (i < a->contents.len) { - if (a->contents.buf.array[i] != a->contents.buf.array[i]) - { - M2RTS_HALT (-1); - __builtin_unreachable (); - } - if (b->contents.buf.array[i] != b->contents.buf.array[i]) - { - M2RTS_HALT (-1); - __builtin_unreachable (); - } if (a->contents.buf.array[i] != b->contents.buf.array[i]) { return FALSE; @@ -1920,7 +1910,7 @@ extern "C" unsigned int DynamicStrings_EqualCharStar (DynamicStrings_String s, v t = DynamicStrings_InitStringCharStar (a); if (TraceOn) { - t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1258, (const char *) "EqualCharStar", 13); + t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1250, (const char *) "EqualCharStar", 13); } t = AddToGarbage (t, s); if (DynamicStrings_Equal (t, s)) @@ -1958,7 +1948,7 @@ extern "C" unsigned int DynamicStrings_EqualArray (DynamicStrings_String s, cons t = DynamicStrings_InitString ((const char *) a, _a_high); if (TraceOn) { - t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1288, (const char *) "EqualArray", 10); + t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1280, (const char *) "EqualArray", 10); } t = AddToGarbage (t, s); if (DynamicStrings_Equal (t, s)) @@ -1996,7 +1986,7 @@ extern "C" DynamicStrings_String DynamicStrings_Mult (DynamicStrings_String s, u } if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1320, (const char *) "Mult", 4); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1312, (const char *) "Mult", 4); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2075,7 +2065,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s, AddDebugInfo (t->contents.next); if (TraceOn) { - t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1388, (const char *) "Slice", 5); + t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1380, (const char *) "Slice", 5); } } t = t->contents.next; @@ -2093,7 +2083,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s, } if (TraceOn) { - d = AssignDebug (d, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1405, (const char *) "Slice", 5); + d = AssignDebug (d, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1397, (const char *) "Slice", 5); } return d; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2221,7 +2211,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveComment (DynamicStrings_St } if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1517, (const char *) "RemoveComment", 13); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1509, (const char *) "RemoveComment", 13); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2246,7 +2236,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePrefix (DynamicString s = DynamicStrings_Slice (s, (int ) (i), 0); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1629, (const char *) "RemoveWhitePrefix", 17); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1621, (const char *) "RemoveWhitePrefix", 17); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2271,7 +2261,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePostfix (DynamicStrin s = DynamicStrings_Slice (s, 0, i+1); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1651, (const char *) "RemoveWhitePostfix", 18); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1643, (const char *) "RemoveWhitePostfix", 18); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ diff --git a/gcc/m2/pge-boot/GDynamicStrings.c b/gcc/m2/pge-boot/GDynamicStrings.c index e6dea00..7507eca 100644 --- a/gcc/m2/pge-boot/GDynamicStrings.c +++ b/gcc/m2/pge-boot/GDynamicStrings.c @@ -1217,7 +1217,7 @@ static void ConcatContents (DynamicStrings_Contents *c, const char *a_, unsigned (*c).next->contents.next = NULL; ConcatContents (&(*c).next->contents, (const char *) a, _a_high, h, o); AddDebugInfo ((*c).next); - (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 722, (const char *) "ConcatContents", 14); + (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 722, (const char *) "ConcatContents", 14); } else { @@ -1315,7 +1315,7 @@ static void ConcatContentsAddress (DynamicStrings_Contents *c, void * a, unsigne AddDebugInfo ((*c).next); if (TraceOn) { - (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 917, (const char *) "ConcatContentsAddress", 21); + (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 917, (const char *) "ConcatContentsAddress", 21); } } else @@ -1540,7 +1540,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitString (const char *a_, unsi AddDebugInfo (s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 758, (const char *) "InitString", 10); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 758, (const char *) "InitString", 10); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1643,7 +1643,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringCharStar (void * a) AddDebugInfo (s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 957, (const char *) "InitStringCharStar", 18); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 957, (const char *) "InitStringCharStar", 18); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1668,7 +1668,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringChar (char ch) s = DynamicStrings_InitString ((const char *) &a.array[0], 1); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 977, (const char *) "InitStringChar", 14); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 977, (const char *) "InitStringChar", 14); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1826,7 +1826,7 @@ extern "C" DynamicStrings_String DynamicStrings_Dup (DynamicStrings_String s) s = DynamicStrings_Assign (DynamicStrings_InitString ((const char *) "", 0), s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1173, (const char *) "Dup", 3); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1173, (const char *) "Dup", 3); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1848,7 +1848,7 @@ extern "C" DynamicStrings_String DynamicStrings_Add (DynamicStrings_String a, Dy a = DynamicStrings_ConCat (DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) "", 0), a), b); if (TraceOn) { - a = AssignDebug (a, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1193, (const char *) "Add", 3); + a = AssignDebug (a, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1193, (const char *) "Add", 3); } return a; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1877,16 +1877,6 @@ extern "C" unsigned int DynamicStrings_Equal (DynamicStrings_String a, DynamicSt Assertion_Assert (a->contents.len == b->contents.len); while (i < a->contents.len) { - if (a->contents.buf.array[i] != a->contents.buf.array[i]) - { - M2RTS_HALT (-1); - __builtin_unreachable (); - } - if (b->contents.buf.array[i] != b->contents.buf.array[i]) - { - M2RTS_HALT (-1); - __builtin_unreachable (); - } if (a->contents.buf.array[i] != b->contents.buf.array[i]) { return FALSE; @@ -1923,7 +1913,7 @@ extern "C" unsigned int DynamicStrings_EqualCharStar (DynamicStrings_String s, v t = DynamicStrings_InitStringCharStar (a); if (TraceOn) { - t = AssignDebug (t, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1258, (const char *) "EqualCharStar", 13); + t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1250, (const char *) "EqualCharStar", 13); } t = AddToGarbage (t, s); if (DynamicStrings_Equal (t, s)) @@ -1961,7 +1951,7 @@ extern "C" unsigned int DynamicStrings_EqualArray (DynamicStrings_String s, cons t = DynamicStrings_InitString ((const char *) a, _a_high); if (TraceOn) { - t = AssignDebug (t, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1288, (const char *) "EqualArray", 10); + t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1280, (const char *) "EqualArray", 10); } t = AddToGarbage (t, s); if (DynamicStrings_Equal (t, s)) @@ -1999,7 +1989,7 @@ extern "C" DynamicStrings_String DynamicStrings_Mult (DynamicStrings_String s, u } if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1320, (const char *) "Mult", 4); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1312, (const char *) "Mult", 4); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2078,7 +2068,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s, AddDebugInfo (t->contents.next); if (TraceOn) { - t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1388, (const char *) "Slice", 5); + t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1380, (const char *) "Slice", 5); } } t = t->contents.next; @@ -2096,7 +2086,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s, } if (TraceOn) { - d = AssignDebug (d, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1405, (const char *) "Slice", 5); + d = AssignDebug (d, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1397, (const char *) "Slice", 5); } return d; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2224,7 +2214,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveComment (DynamicStrings_St } if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1517, (const char *) "RemoveComment", 13); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1509, (const char *) "RemoveComment", 13); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2249,7 +2239,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePrefix (DynamicString s = DynamicStrings_Slice (s, (int ) (i), 0); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1629, (const char *) "RemoveWhitePrefix", 17); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1621, (const char *) "RemoveWhitePrefix", 17); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2274,7 +2264,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePostfix (DynamicStrin s = DynamicStrings_Slice (s, 0, i+1); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 1651, (const char *) "RemoveWhitePostfix", 18); + s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1643, (const char *) "RemoveWhitePostfix", 18); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2643,7 +2633,7 @@ extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (unsigned { stop (); /* writeString ("mismatched number of PopAllocation's compared to PushAllocation's") */ - M2RTS_Halt ((const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/DynamicStrings.mod", 62, 176, (const char *) "PopAllocationExemption", 22, (const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65); + M2RTS_Halt ((const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 176, (const char *) "PopAllocationExemption", 22, (const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65); } else { diff --git a/gcc/m2/pge-boot/GFIO.c b/gcc/m2/pge-boot/GFIO.c index 7c2164e..adcbae3 100644 --- a/gcc/m2/pge-boot/GFIO.c +++ b/gcc/m2/pge-boot/GFIO.c @@ -558,7 +558,7 @@ static FIO_File GetNextFreeDescriptor (void) return f; /* create new slot */ } } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/FIO.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/FIO.def", 25, 1); __builtin_unreachable (); } @@ -2269,7 +2269,7 @@ extern "C" void * FIO_getFileName (FIO_File f) return fd->name.address; } } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/FIO.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/FIO.def", 25, 1); __builtin_unreachable (); } @@ -2296,7 +2296,7 @@ extern "C" unsigned int FIO_getFileNameLength (FIO_File f) return fd->name.size; } } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/FIO.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/FIO.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/pge-boot/GIndexing.c b/gcc/m2/pge-boot/GIndexing.c index 71d3432..81c66fc 100644 --- a/gcc/m2/pge-boot/GIndexing.c +++ b/gcc/m2/pge-boot/GIndexing.c @@ -227,7 +227,7 @@ extern "C" unsigned int Indexing_InBounds (Indexing_Index i, unsigned int n) { return (n >= i->Low) && (n <= i->High); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/Indexing.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/Indexing.def", 25, 1); __builtin_unreachable (); } @@ -247,7 +247,7 @@ extern "C" unsigned int Indexing_HighIndice (Indexing_Index i) { return i->High; } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/Indexing.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/Indexing.def", 25, 1); __builtin_unreachable (); } @@ -267,7 +267,7 @@ extern "C" unsigned int Indexing_LowIndice (Indexing_Index i) { return i->Low; } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/Indexing.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/Indexing.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/pge-boot/GM2EXCEPTION.c b/gcc/m2/pge-boot/GM2EXCEPTION.c index ce54442..5a3ba4c 100644 --- a/gcc/m2/pge-boot/GM2EXCEPTION.c +++ b/gcc/m2/pge-boot/GM2EXCEPTION.c @@ -56,13 +56,13 @@ extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void) n = RTExceptions_GetNumber (e); if (n == (UINT_MAX)) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast (reinterpret_cast("M2Exception")), const_cast (reinterpret_cast("current coroutine is not in the exceptional execution state"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast (reinterpret_cast("M2Exception")), const_cast (reinterpret_cast("current coroutine is not in the exceptional execution state"))); } else { return (M2EXCEPTION_M2Exceptions) (n); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/pge-boot/GM2RTS.c b/gcc/m2/pge-boot/GM2RTS.c index 99f75ad..1fdd5eb 100644 --- a/gcc/m2/pge-boot/GM2RTS.c +++ b/gcc/m2/pge-boot/GM2RTS.c @@ -64,6 +64,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see typedef struct M2RTS_ArgCVEnvP_p M2RTS_ArgCVEnvP; +# define stderrFd 2 typedef struct M2RTS_ProcedureList_r M2RTS_ProcedureList; typedef char *M2RTS_PtrToChar; @@ -178,10 +179,19 @@ extern "C" void M2RTS_HALT (int exitcode) __attribute__ ((noreturn)); /* Halt - provides a more user friendly version of HALT, which takes - four parameters to aid debugging. + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). */ -extern "C" void M2RTS_Halt (const char *file_, unsigned int _file_high, unsigned int line, const char *function_, unsigned int _function_high, const char *description_, unsigned int _description_high) __attribute__ ((noreturn)); +extern "C" void M2RTS_Halt (const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high, const char *description_, unsigned int _description_high) __attribute__ ((noreturn)); + +/* + HaltC - provides a more user friendly version of HALT, which takes + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). +*/ + +extern "C" void M2RTS_HaltC (void * filename, unsigned int line, void * function, void * description); /* ExitOnHalt - if HALT is executed then call exit with the exit code, e. @@ -193,7 +203,7 @@ extern "C" void M2RTS_ExitOnHalt (int e); ErrorMessage - emits an error message to stderr and then calls exit (1). */ -extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *file_, unsigned int _file_high, unsigned int line, const char *function_, unsigned int _function_high) __attribute__ ((noreturn)); +extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high) __attribute__ ((noreturn)); /* Length - returns the length of a string, a. This is called whenever @@ -249,6 +259,18 @@ static unsigned int AppendProc (M2RTS_ProcedureList *proclist, PROC proc); static void ErrorString (const char *a_, unsigned int _a_high); /* + ErrorStringC - writes a string to stderr. +*/ + +static void ErrorStringC (void * str); + +/* + ErrorMessageC - emits an error message to stderr and then calls exit (1). +*/ + +static void ErrorMessageC (void * message, void * filename, unsigned int line, void * function) __attribute__ ((noreturn)); + +/* InitProcList - initialize the head and tail pointers to NIL. */ @@ -322,7 +344,49 @@ static void ErrorString (const char *a_, unsigned int _a_high) /* make a local copy of each unbounded array. */ memcpy (a, a_, _a_high+1); - n = static_cast (libc_write (2, &a, static_cast (StrLib_StrLen ((const char *) a, _a_high)))); + n = static_cast (libc_write (stderrFd, &a, static_cast (StrLib_StrLen ((const char *) a, _a_high)))); +} + + +/* + ErrorStringC - writes a string to stderr. +*/ + +static void ErrorStringC (void * str) +{ + int len; + + len = static_cast (libc_write (stderrFd, str, libc_strlen (str))); +} + + +/* + ErrorMessageC - emits an error message to stderr and then calls exit (1). +*/ + +static void ErrorMessageC (void * message, void * filename, unsigned int line, void * function) +{ + typedef struct ErrorMessageC__T2_a ErrorMessageC__T2; + + struct ErrorMessageC__T2_a { char array[10+1]; }; + ErrorMessageC__T2 buffer; + + ErrorStringC (filename); + ErrorString ((const char *) ":", 1); + NumberIO_CardToStr (line, 0, (char *) &buffer.array[0], 10); + ErrorString ((const char *) &buffer.array[0], 10); + ErrorString ((const char *) ":", 1); + if ((libc_strlen (function)) > 0) + { + ErrorString ((const char *) "in ", 3); + ErrorStringC (function); + ErrorString ((const char *) " has caused ", 12); + } + ErrorStringC (message); + buffer.array[0] = ASCII_nl; + buffer.array[1] = ASCII_nul; + ErrorString ((const char *) &buffer.array[0], 10); + libc_exit (1); } @@ -519,23 +583,34 @@ extern "C" void M2RTS_HALT (int exitcode) /* Halt - provides a more user friendly version of HALT, which takes - four parameters to aid debugging. + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). */ -extern "C" void M2RTS_Halt (const char *file_, unsigned int _file_high, unsigned int line, const char *function_, unsigned int _function_high, const char *description_, unsigned int _description_high) +extern "C" void M2RTS_Halt (const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high, const char *description_, unsigned int _description_high) { - char file[_file_high+1]; + char filename[_filename_high+1]; char function[_function_high+1]; char description[_description_high+1]; /* make a local copy of each unbounded array. */ - memcpy (file, file_, _file_high+1); + memcpy (filename, filename_, _filename_high+1); memcpy (function, function_, _function_high+1); memcpy (description, description_, _description_high+1); - M2RTS_ErrorMessage ((const char *) description, _description_high, (const char *) file, _file_high, line, (const char *) function, _function_high); - M2RTS_HALT (-1); - __builtin_unreachable (); + M2RTS_ErrorMessage ((const char *) description, _description_high, (const char *) filename, _filename_high, line, (const char *) function, _function_high); +} + + +/* + HaltC - provides a more user friendly version of HALT, which takes + four parameters to aid debugging. It writes an error message + to stderr and calls exit (1). +*/ + +extern "C" void M2RTS_HaltC (void * filename, unsigned int line, void * function, void * description) +{ + ErrorMessageC (description, filename, line, function); } @@ -554,25 +629,25 @@ extern "C" void M2RTS_ExitOnHalt (int e) ErrorMessage - emits an error message to stderr and then calls exit (1). */ -extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *file_, unsigned int _file_high, unsigned int line, const char *function_, unsigned int _function_high) +extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high) { - typedef struct ErrorMessage__T2_a ErrorMessage__T2; + typedef struct ErrorMessage__T3_a ErrorMessage__T3; - struct ErrorMessage__T2_a { char array[10+1]; }; - ErrorMessage__T2 LineNo; + struct ErrorMessage__T3_a { char array[10+1]; }; + ErrorMessage__T3 buffer; char message[_message_high+1]; - char file[_file_high+1]; + char filename[_filename_high+1]; char function[_function_high+1]; /* make a local copy of each unbounded array. */ memcpy (message, message_, _message_high+1); - memcpy (file, file_, _file_high+1); + memcpy (filename, filename_, _filename_high+1); memcpy (function, function_, _function_high+1); - ErrorString ((const char *) file, _file_high); + ErrorString ((const char *) filename, _filename_high); ErrorString ((const char *) ":", 1); - NumberIO_CardToStr (line, 0, (char *) &LineNo.array[0], 10); - ErrorString ((const char *) &LineNo.array[0], 10); + NumberIO_CardToStr (line, 0, (char *) &buffer.array[0], 10); + ErrorString ((const char *) &buffer.array[0], 10); ErrorString ((const char *) ":", 1); if (! (StrLib_StrEqual ((const char *) function, _function_high, (const char *) "", 0))) { @@ -581,9 +656,9 @@ extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_ ErrorString ((const char *) " has caused ", 12); } ErrorString ((const char *) message, _message_high); - LineNo.array[0] = ASCII_nl; - LineNo.array[1] = ASCII_nul; - ErrorString ((const char *) &LineNo.array[0], 10); + buffer.array[0] = ASCII_nl; + buffer.array[1] = ASCII_nul; + ErrorString ((const char *) &buffer.array[0], 10); libc_exit (1); } diff --git a/gcc/m2/pge-boot/GNameKey.c b/gcc/m2/pge-boot/GNameKey.c index ad5b3b7..13511cb 100644 --- a/gcc/m2/pge-boot/GNameKey.c +++ b/gcc/m2/pge-boot/GNameKey.c @@ -330,7 +330,7 @@ extern "C" NameKey_Name NameKey_MakeKey (const char *a_, unsigned int _a_high) (*p) = ASCII_nul; return DoMakeKey (n, higha); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-compiler/NameKey.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-compiler/NameKey.def", 20, 1); __builtin_unreachable (); } @@ -380,7 +380,7 @@ extern "C" NameKey_Name NameKey_makekey (void * a) return DoMakeKey (n, higha); } } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-compiler/NameKey.def", 20, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-compiler/NameKey.def", 20, 1); __builtin_unreachable (); } diff --git a/gcc/m2/pge-boot/GPushBackInput.c b/gcc/m2/pge-boot/GPushBackInput.c index 57a39d5..70cb272 100644 --- a/gcc/m2/pge-boot/GPushBackInput.c +++ b/gcc/m2/pge-boot/GPushBackInput.c @@ -275,7 +275,7 @@ extern "C" char PushBackInput_PutCh (char ch) } else { - Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, 150, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/PushBackInput.mod", 61); + Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, 150, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54); } return ch; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -301,7 +301,7 @@ extern "C" void PushBackInput_PutString (const char *a_, unsigned int _a_high) l -= 1; if ((PushBackInput_PutCh (a[l])) != a[l]) { - Debug_Halt ((const char *) "assert failed", 13, 132, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/PushBackInput.mod", 61); + Debug_Halt ((const char *) "assert failed", 13, 132, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54); } } } @@ -322,7 +322,7 @@ extern "C" void PushBackInput_PutStr (DynamicStrings_String s) i -= 1; if ((PushBackInput_PutCh (DynamicStrings_char (s, static_cast (i)))) != (DynamicStrings_char (s, static_cast (i)))) { - Debug_Halt ((const char *) "assert failed", 13, 113, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/PushBackInput.mod", 61); + Debug_Halt ((const char *) "assert failed", 13, 113, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54); } } } diff --git a/gcc/m2/pge-boot/GRTExceptions.c b/gcc/m2/pge-boot/GRTExceptions.c index d43ab45..84f6cca 100644 --- a/gcc/m2/pge-boot/GRTExceptions.c +++ b/gcc/m2/pge-boot/GRTExceptions.c @@ -722,7 +722,7 @@ static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h) static void indexf (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 612, 9, const_cast (reinterpret_cast("indexf")), const_cast (reinterpret_cast("array index out of bounds"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 612, 9, const_cast (reinterpret_cast("indexf")), const_cast (reinterpret_cast("array index out of bounds"))); } @@ -732,7 +732,7 @@ static void indexf (void * a) static void range (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 624, 9, const_cast (reinterpret_cast("range")), const_cast (reinterpret_cast("assignment out of range"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 624, 9, const_cast (reinterpret_cast("range")), const_cast (reinterpret_cast("assignment out of range"))); } @@ -742,7 +742,7 @@ static void range (void * a) static void casef (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 636, 9, const_cast (reinterpret_cast("casef")), const_cast (reinterpret_cast("case selector out of range"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 636, 9, const_cast (reinterpret_cast("casef")), const_cast (reinterpret_cast("case selector out of range"))); } @@ -752,7 +752,7 @@ static void casef (void * a) static void invalidloc (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 648, 9, const_cast (reinterpret_cast("invalidloc")), const_cast (reinterpret_cast("invalid address referenced"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 648, 9, const_cast (reinterpret_cast("invalidloc")), const_cast (reinterpret_cast("invalid address referenced"))); } @@ -762,7 +762,7 @@ static void invalidloc (void * a) static void function (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 660, 9, const_cast (reinterpret_cast("function")), const_cast (reinterpret_cast("... function ... "))); /* --fixme-- what has happened ? */ + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 660, 9, const_cast (reinterpret_cast("function")), const_cast (reinterpret_cast("... function ... "))); /* --fixme-- what has happened ? */ } @@ -772,7 +772,7 @@ static void function (void * a) static void wholevalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 672, 9, const_cast (reinterpret_cast("wholevalue")), const_cast (reinterpret_cast("illegal whole value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 672, 9, const_cast (reinterpret_cast("wholevalue")), const_cast (reinterpret_cast("illegal whole value exception"))); } @@ -782,7 +782,7 @@ static void wholevalue (void * a) static void wholediv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 684, 9, const_cast (reinterpret_cast("wholediv")), const_cast (reinterpret_cast("illegal whole value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 684, 9, const_cast (reinterpret_cast("wholediv")), const_cast (reinterpret_cast("illegal whole value exception"))); } @@ -792,7 +792,7 @@ static void wholediv (void * a) static void realvalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 696, 9, const_cast (reinterpret_cast("realvalue")), const_cast (reinterpret_cast("illegal real value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 696, 9, const_cast (reinterpret_cast("realvalue")), const_cast (reinterpret_cast("illegal real value exception"))); } @@ -802,7 +802,7 @@ static void realvalue (void * a) static void realdiv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 708, 9, const_cast (reinterpret_cast("realdiv")), const_cast (reinterpret_cast("real number division by zero exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 708, 9, const_cast (reinterpret_cast("realdiv")), const_cast (reinterpret_cast("real number division by zero exception"))); } @@ -812,7 +812,7 @@ static void realdiv (void * a) static void complexvalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 720, 9, const_cast (reinterpret_cast("complexvalue")), const_cast (reinterpret_cast("illegal complex value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 720, 9, const_cast (reinterpret_cast("complexvalue")), const_cast (reinterpret_cast("illegal complex value exception"))); } @@ -822,7 +822,7 @@ static void complexvalue (void * a) static void complexdiv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 732, 9, const_cast (reinterpret_cast("complexdiv")), const_cast (reinterpret_cast("complex number division by zero exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 732, 9, const_cast (reinterpret_cast("complexdiv")), const_cast (reinterpret_cast("complex number division by zero exception"))); } @@ -832,7 +832,7 @@ static void complexdiv (void * a) static void protection (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 744, 9, const_cast (reinterpret_cast("protection")), const_cast (reinterpret_cast("protection exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 744, 9, const_cast (reinterpret_cast("protection")), const_cast (reinterpret_cast("protection exception"))); } @@ -842,7 +842,7 @@ static void protection (void * a) static void systemf (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 756, 9, const_cast (reinterpret_cast("systemf")), const_cast (reinterpret_cast("system exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 756, 9, const_cast (reinterpret_cast("systemf")), const_cast (reinterpret_cast("system exception"))); } @@ -852,7 +852,7 @@ static void systemf (void * a) static void coroutine (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 768, 9, const_cast (reinterpret_cast("coroutine")), const_cast (reinterpret_cast("coroutine exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 768, 9, const_cast (reinterpret_cast("coroutine")), const_cast (reinterpret_cast("coroutine exception"))); } @@ -862,7 +862,7 @@ static void coroutine (void * a) static void exception (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod")), 780, 9, const_cast (reinterpret_cast("exception")), const_cast (reinterpret_cast("exception exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 780, 9, const_cast (reinterpret_cast("exception")), const_cast (reinterpret_cast("exception exception"))); } @@ -1181,13 +1181,13 @@ extern "C" RTExceptions_EHBlock RTExceptions_GetBaseExceptionBlock (void) { if (currentEHB == NULL) { - M2RTS_Halt ((const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.mod", 60, 598, (const char *) "GetBaseExceptionBlock", 21, (const char *) "currentEHB has not been initialized yet", 39); + M2RTS_Halt ((const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod", 53, 598, (const char *) "GetBaseExceptionBlock", 21, (const char *) "currentEHB has not been initialized yet", 39); } else { return currentEHB; } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/RTExceptions.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/pge-boot/GStdIO.c b/gcc/m2/pge-boot/GStdIO.c index 2343bf3..04af632 100644 --- a/gcc/m2/pge-boot/GStdIO.c +++ b/gcc/m2/pge-boot/GStdIO.c @@ -191,7 +191,7 @@ extern "C" StdIO_ProcWrite StdIO_GetCurrentOutput (void) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/StdIO.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/StdIO.def", 25, 1); __builtin_unreachable (); } @@ -250,7 +250,7 @@ extern "C" StdIO_ProcRead StdIO_GetCurrentInput (void) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/StdIO.def", 25, 1); + ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/StdIO.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/pge-boot/GSymbolKey.c b/gcc/m2/pge-boot/GSymbolKey.c index 9121d87..61c599e 100644 --- a/gcc/m2/pge-boot/GSymbolKey.c +++ b/gcc/m2/pge-boot/GSymbolKey.c @@ -183,7 +183,7 @@ static void FindNodeParentInTree (SymbolKey_SymbolTree t, NameKey_Name n, Symbol (*parent) = t; if (t == NULL) { - Debug_Halt ((const char *) "parameter t should never be NIL", 31, 240, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-compiler/SymbolKey.mod", 61); + Debug_Halt ((const char *) "parameter t should never be NIL", 31, 240, (const char *) "../../gcc-read-write/gcc/m2/gm2-compiler/SymbolKey.mod", 54); } Assertion_Assert (t->Right == NULL); (*child) = t->Left; @@ -392,7 +392,7 @@ extern "C" void SymbolKey_PutSymKey (SymbolKey_SymbolTree t, NameKey_Name NameKe } else { - Debug_Halt ((const char *) "symbol already stored", 21, 156, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-compiler/SymbolKey.mod", 61); + Debug_Halt ((const char *) "symbol already stored", 21, 156, (const char *) "../../gcc-read-write/gcc/m2/gm2-compiler/SymbolKey.mod", 54); } } @@ -459,7 +459,7 @@ extern "C" void SymbolKey_DelSymKey (SymbolKey_SymbolTree t, NameKey_Name NameKe } else { - Debug_Halt ((const char *) "trying to delete a symbol that is not in the tree - the compiler never expects this to occur", 92, 223, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-compiler/SymbolKey.mod", 61); + Debug_Halt ((const char *) "trying to delete a symbol that is not in the tree - the compiler never expects this to occur", 92, 223, (const char *) "../../gcc-read-write/gcc/m2/gm2-compiler/SymbolKey.mod", 54); } } diff --git a/gcc/m2/pge-boot/GSysStorage.c b/gcc/m2/pge-boot/GSysStorage.c index 40a464e..f2a7038 100644 --- a/gcc/m2/pge-boot/GSysStorage.c +++ b/gcc/m2/pge-boot/GSysStorage.c @@ -93,7 +93,7 @@ extern "C" void SysStorage_ALLOCATE (void * *a, unsigned int size) (*a) = libc_malloc (static_cast (size)); if ((*a) == NULL) { - Debug_Halt ((const char *) "out of memory error", 19, 50, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/SysStorage.mod", 58); + Debug_Halt ((const char *) "out of memory error", 19, 50, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51); } if (enableTrace && trace) { @@ -118,7 +118,7 @@ extern "C" void SysStorage_DEALLOCATE (void * *a, unsigned int size) } if ((libc_memset ((*a), 0, static_cast (size))) != (*a)) { - Debug_Halt ((const char *) "memset should have returned the first parameter", 47, 76, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/SysStorage.mod", 58); + Debug_Halt ((const char *) "memset should have returned the first parameter", 47, 76, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51); } } if (enableDeallocation) @@ -163,7 +163,7 @@ extern "C" void SysStorage_REALLOCATE (void * *a, unsigned int size) (*a) = libc_realloc ((*a), static_cast (size)); if ((*a) == NULL) { - Debug_Halt ((const char *) "out of memory error", 19, 119, (const char *) "../../gcc-git-devel-modula2/gcc/m2/gm2-libs/SysStorage.mod", 58); + Debug_Halt ((const char *) "out of memory error", 19, 119, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51); } if (enableTrace && trace) { -- cgit v1.1 From 5c4122be854c135a1f66f2db68ec9cde6d5993dc Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Fri, 20 Jan 2023 23:39:35 +0000 Subject: PR-108136 modula-2 meets cppcheck part 2 R-108136 modula-2 meets cppcheck part 2 This patch addresses the style warnings mentioned in the PR. The array high style fixes to mc/keyc.mod and gm2-libs/M2Dependent.mod provoke a rebuild of pge and mc. gcc/m2/ChangeLog: * gm2-libs/Args.mod (GetArg): Check index before accessing array. * gm2-libs/M2Dependent.mod (toCString): Check index before accessing array. * mc-boot/GArgs.c: Rebuilt. * mc-boot/GM2Dependent.c: Rebuilt. * mc-boot/Gkeyc.c: Rebuilt. * mc/keyc.mod (seenUIntMin): Initialize once. (seenUIntMax): Initialize once. (checkLimits): Only test seenUIntMin and seenUIntMax once. * pge-boot/GArgs.c: Rebuilt. * pge-boot/GM2Dependent.c: Rebuilt. Signed-off-by: Gaius Mulley --- gcc/m2/gm2-libs/Args.mod | 2 +- gcc/m2/gm2-libs/M2Dependent.mod | 2 +- gcc/m2/mc-boot/GArgs.c | 2 +- gcc/m2/mc-boot/GM2Dependent.c | 2 +- gcc/m2/mc-boot/Gkeyc.c | 4 +--- gcc/m2/mc/keyc.mod | 6 ++---- gcc/m2/pge-boot/GArgs.c | 2 +- gcc/m2/pge-boot/GM2Dependent.c | 2 +- 8 files changed, 9 insertions(+), 13 deletions(-) (limited to 'gcc') diff --git a/gcc/m2/gm2-libs/Args.mod b/gcc/m2/gm2-libs/Args.mod index 30f76c6..fa14f8c 100644 --- a/gcc/m2/gm2-libs/Args.mod +++ b/gcc/m2/gm2-libs/Args.mod @@ -62,7 +62,7 @@ BEGIN IF i < GetArgC () THEN Source := GetArgV () ; - WHILE (Source^[i]^[j]#nul) AND (j (UnixArgs_GetArgV ()); - while (((*(*Source).array[i]).array[j] != ASCII_nul) && (j < High)) + while ((j < High) && ((*(*Source).array[i]).array[j] != ASCII_nul)) { a[j] = (*(*Source).array[i]).array[j]; j += 1; diff --git a/gcc/m2/mc-boot/GM2Dependent.c b/gcc/m2/mc-boot/GM2Dependent.c index b9c59cc..fb22f1b 100644 --- a/gcc/m2/mc-boot/GM2Dependent.c +++ b/gcc/m2/mc-boot/GM2Dependent.c @@ -457,7 +457,7 @@ static void toCString (char *str, unsigned int _str_high) high = _str_high; while (i < high) { - if ((str[i] == '\\') && (i < high)) + if ((i < high) && (str[i] == '\\')) { if (str[i+1] == 'n') { diff --git a/gcc/m2/mc-boot/Gkeyc.c b/gcc/m2/mc-boot/Gkeyc.c index 6f17ca5..e000bfe 100644 --- a/gcc/m2/mc-boot/Gkeyc.c +++ b/gcc/m2/mc-boot/Gkeyc.c @@ -600,7 +600,7 @@ static void checkAbs (mcPretty_pretty p) static void checkLimits (mcPretty_pretty p) { - if ((((((((((((((seenMemcpy || seenIntMin) || seenUIntMin) || seenLongMin) || seenULongMin) || seenCharMin) || seenUCharMin) || seenUIntMin) || seenIntMax) || seenUIntMax) || seenLongMax) || seenULongMax) || seenCharMax) || seenUCharMax) || seenUIntMax) + if ((((((((((((seenMemcpy || seenIntMin) || seenUIntMin) || seenLongMin) || seenULongMin) || seenCharMin) || seenUCharMin) || seenIntMax) || seenUIntMax) || seenLongMax) || seenULongMax) || seenCharMax) || seenUCharMax) /* OR seenUIntMax */ { checkGccConfigSystem (p); if (! (mcOptions_getGccConfigSystem ())) @@ -1067,14 +1067,12 @@ static void init (void) seenULongMin = FALSE; seenCharMin = FALSE; seenUCharMin = FALSE; - seenUIntMin = FALSE; seenIntMax = FALSE; seenUIntMax = FALSE; seenLongMax = FALSE; seenULongMax = FALSE; seenCharMax = FALSE; seenUCharMax = FALSE; - seenUIntMax = FALSE; seenLabs = FALSE; seenAbs = FALSE; seenFabs = FALSE; diff --git a/gcc/m2/mc/keyc.mod b/gcc/m2/mc/keyc.mod index 5e1016d..a57103b 100644 --- a/gcc/m2/mc/keyc.mod +++ b/gcc/m2/mc/keyc.mod @@ -457,9 +457,9 @@ PROCEDURE checkLimits (p: pretty) ; BEGIN IF seenMemcpy OR seenIntMin OR seenUIntMin OR seenLongMin OR seenULongMin OR seenCharMin OR - seenUCharMin OR seenUIntMin OR seenIntMax OR + seenUCharMin OR (* seenUIntMin OR *) seenIntMax OR seenUIntMax OR seenLongMax OR seenULongMax OR - seenCharMax OR seenUCharMax OR seenUIntMax + seenCharMax OR seenUCharMax (* OR seenUIntMax *) THEN checkGccConfigSystem (p); IF NOT getGccConfigSystem () @@ -1118,14 +1118,12 @@ BEGIN seenULongMin := FALSE ; seenCharMin := FALSE ; seenUCharMin := FALSE ; - seenUIntMin := FALSE ; seenIntMax := FALSE ; seenUIntMax := FALSE ; seenLongMax := FALSE ; seenULongMax := FALSE ; seenCharMax := FALSE ; seenUCharMax := FALSE ; - seenUIntMax := FALSE ; seenLabs := FALSE ; seenAbs := FALSE ; seenFabs := FALSE ; diff --git a/gcc/m2/pge-boot/GArgs.c b/gcc/m2/pge-boot/GArgs.c index 3c3f95b..69fbdd0 100644 --- a/gcc/m2/pge-boot/GArgs.c +++ b/gcc/m2/pge-boot/GArgs.c @@ -81,7 +81,7 @@ extern "C" unsigned int Args_GetArg (char *a, unsigned int _a_high, unsigned int if (i < (UnixArgs_GetArgC ())) { Source = static_cast (UnixArgs_GetArgV ()); - while (((*(*Source).array[i]).array[j] != ASCII_nul) && (j < High)) + while ((j < High) && ((*(*Source).array[i]).array[j] != ASCII_nul)) { a[j] = (*(*Source).array[i]).array[j]; j += 1; diff --git a/gcc/m2/pge-boot/GM2Dependent.c b/gcc/m2/pge-boot/GM2Dependent.c index 368cf33..32c777c 100644 --- a/gcc/m2/pge-boot/GM2Dependent.c +++ b/gcc/m2/pge-boot/GM2Dependent.c @@ -458,7 +458,7 @@ static void toCString (char *str, unsigned int _str_high) high = _str_high; while (i < high) { - if ((str[i] == '\\') && (i < high)) + if ((i < high) && (str[i] == '\\')) { if (str[i+1] == 'n') { -- cgit v1.1 From 1bdb1768bf7d83ae87ba7c12bd9566830a1ac772 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 21 Jan 2023 00:16:20 +0000 Subject: Daily bump. --- gcc/ChangeLog | 13 +++++++++++++ gcc/DATESTAMP | 2 +- gcc/m2/ChangeLog | 36 ++++++++++++++++++++++++++++++++++++ gcc/testsuite/ChangeLog | 13 +++++++++++++ 4 files changed, 63 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 707456b..bc09889 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2023-01-20 Tejas Belagod + + * config/aarch64/arm_neon.h (vmull_p64, vmull_high_p64, vaeseq_u8, + vaesdq_u8, vaesmcq_u8, vaesimcq_u8): Gate under "nothing+aes". + (vsha1*_u32, vsha256*_u32): Gate under "nothing+sha2". + +2023-01-20 Jakub Jelinek + + PR tree-optimization/108457 + * tree-ssa-loop-niter.cc (build_cltz_expr): Use + SCALAR_INT_TYPE_MODE (utype) directly as C[LT]Z_DEFINED_VALUE_AT_ZERO + argument instead of a temporary. Formatting fixes. + 2023-01-19 Jakub Jelinek PR tree-optimization/108447 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c8519a7..583ce61 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20230120 +20230121 diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog index 75acef3..4880f9e 100644 --- a/gcc/m2/ChangeLog +++ b/gcc/m2/ChangeLog @@ -1,3 +1,39 @@ +2023-01-20 Gaius Mulley + + * gm2-libs/Args.mod (GetArg): Check index before + accessing array. + * gm2-libs/M2Dependent.mod (toCString): Check index + before accessing array. + * mc-boot/GArgs.c: Rebuilt. + * mc-boot/GM2Dependent.c: Rebuilt. + * mc-boot/Gkeyc.c: Rebuilt. + * mc/keyc.mod (seenUIntMin): Initialize once. + (seenUIntMax): Initialize once. + (checkLimits): Only test seenUIntMin and seenUIntMax + once. + * pge-boot/GArgs.c: Rebuilt. + * pge-boot/GM2Dependent.c: Rebuilt. + +2023-01-20 Gaius Mulley + + * gm2-gcc/m2statement.cc (gm2_gimplify_function_node): + Remove. + * gm2-libs/DynamicStrings.mod (Equal): Remove dead code. + * m2.flex ("<*"): Add {} for else statement. + * m2pp.cc (hextree): Add conditional #ifdef DEBUGGING. + * mc-boot/GDynamicStrings.c: Rebuild. + * pge-boot/GDynamicStrings.c: Rebuild. + * pge-boot/GFIO.c: Rebuild. + * pge-boot/GIndexing.c: Rebuild. + * pge-boot/GM2EXCEPTION.c: Rebuild. + * pge-boot/GM2RTS.c: Rebuild. + * pge-boot/GNameKey.c: Rebuild. + * pge-boot/GPushBackInput.c: Rebuild. + * pge-boot/GRTExceptions.c: Rebuild. + * pge-boot/GStdIO.c: Rebuild. + * pge-boot/GSymbolKey.c: Rebuild. + * pge-boot/GSysStorage.c: Rebuild. + 2023-01-17 Gaius Mulley * mc-boot/GM2RTS.c: Rebuilt. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c26a59f..ffe432f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2023-01-20 Tejas Belagod + + * gcc.target/aarch64/acle/pmull64.c: New. + * gcc.target/aarch64/aes-fuse-1.c: Replace '+crypto' with corresponding + feature flag based on the intrinsic. + * gcc.target/aarch64/aes-fuse-2.c: Likewise. + * gcc.target/aarch64/aes_1.c: Likewise. + * gcc.target/aarch64/aes_2.c: Likewise. + * gcc.target/aarch64/aes_xor_combine.c: Likewise. + * gcc.target/aarch64/sha1_1.c: Likewise. + * gcc.target/aarch64/sha256_1.c: Likewise. + * gcc.target/aarch64/target_attr_crypto_ice_1.c: Likewise. + 2023-01-19 Jakub Jelinek PR c++/108437 -- cgit v1.1 From 48f544ad5c98b668d8d345eaafcf09cc0bd44635 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Sat, 21 Jan 2023 15:19:57 -0800 Subject: fortran: [PR102595] PR fortran/102595 gcc/fortran/ChangeLog: * data.cc (gfc_assign_data_value): Remove check for PARAMETER in DATA. * primary.cc (match_variable): Add check for PARAMETER in DATA. gcc/testsuite/ChangeLog: * gfortran.dg/pr88048.f90: Adjust for changed error message. * gfortran.dg/parameter_data0.f90: New test. --- gcc/fortran/data.cc | 7 ------- gcc/fortran/primary.cc | 10 ++++++++-- gcc/testsuite/gfortran.dg/parameter_data0.f90 | 6 ++++++ gcc/testsuite/gfortran.dg/pr88048.f90 | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/parameter_data0.f90 (limited to 'gcc') diff --git a/gcc/fortran/data.cc b/gcc/fortran/data.cc index 443d35d..d29eb12 100644 --- a/gcc/fortran/data.cc +++ b/gcc/fortran/data.cc @@ -244,13 +244,6 @@ gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue, mpz_t index, "array-element nor a scalar-structure-component"; symbol = lvalue->symtree->n.sym; - if (symbol->attr.flavor == FL_PARAMETER) - { - gfc_error ("PARAMETER %qs shall not appear in a DATA statement at %L", - symbol->name, &lvalue->where); - return false; - } - init = symbol->value; last_ts = &symbol->ts; last_con = NULL; diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc index 543d9cc..28ce5fe 100644 --- a/gcc/fortran/primary.cc +++ b/gcc/fortran/primary.cc @@ -4076,8 +4076,14 @@ match_variable (gfc_expr **result, int equiv_flag, int host_flag) gfc_error ("Named constant at %C in an EQUIVALENCE"); return MATCH_ERROR; } - /* Otherwise this is checked for and an error given in the - variable definition context checks. */ + if (gfc_in_match_data()) + { + gfc_error ("PARAMETER %qs shall not appear in a DATA statement at %C", + sym->name); + return MATCH_ERROR; + } + /* Otherwise this is checked for an error given in the + variable definition context checks. */ break; case FL_PROCEDURE: diff --git a/gcc/testsuite/gfortran.dg/parameter_data0.f90 b/gcc/testsuite/gfortran.dg/parameter_data0.f90 new file mode 100644 index 0000000..4f1da9e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/parameter_data0.f90 @@ -0,0 +1,6 @@ +! { dg-do compile } +! PR fortran/102595 Similar to 88048 with a zero sized array +program p + complex, parameter:: x(0) = 2 + data x%im /3.0/ ! { dg-error "shall not appear in a DATA statement" } +end diff --git a/gcc/testsuite/gfortran.dg/pr88048.f90 b/gcc/testsuite/gfortran.dg/pr88048.f90 index 1129393..ad82d45 100644 --- a/gcc/testsuite/gfortran.dg/pr88048.f90 +++ b/gcc/testsuite/gfortran.dg/pr88048.f90 @@ -2,6 +2,6 @@ ! PR fortran/88048 program p integer, parameter :: a(2) = 1 - data a(2) /a(1)/ ! { dg-error "definable entity" } + data a(2) /a(1)/ ! { dg-error "shall not appear in a DATA statement" } print *, a end -- cgit v1.1 From d5717e7f6fd5a13356ebc46c3b54e081a99dd826 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 22 Jan 2023 00:17:27 +0000 Subject: Daily bump. --- gcc/DATESTAMP | 2 +- gcc/fortran/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 583ce61..39523e2 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20230121 +20230122 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index e30b9d5..e5b75ed 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2023-01-21 Jerry DeLisle + + PR fortran/102595 + * data.cc (gfc_assign_data_value): Remove check for PARAMETER in DATA. + * primary.cc (match_variable): Add check for PARAMETER in DATA. + 2023-01-19 Harald Anlauf PR fortran/108434 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ffe432f..88561ff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2023-01-21 Jerry DeLisle + + PR fortran/102595 + * gfortran.dg/pr88048.f90: Adjust for changed error message. + * gfortran.dg/parameter_data0.f90: New test. + 2023-01-20 Tejas Belagod * gcc.target/aarch64/acle/pmull64.c: New. -- cgit v1.1 From 011c0c29a2452e588f255673238460da4167c4c0 Mon Sep 17 00:00:00 2001 From: Cupertino Miranda Date: Sun, 22 Jan 2023 11:51:20 -0700 Subject: [PATCH 1/2] select .rodata for const volatile variables. gcc/ * config/v850/v850.cc (v850_select_section): Put const volatile objects into read-only sections. --- gcc/config/v850/v850.cc | 1 - 1 file changed, 1 deletion(-) (limited to 'gcc') diff --git a/gcc/config/v850/v850.cc b/gcc/config/v850/v850.cc index 7143a2e..367ba03 100644 --- a/gcc/config/v850/v850.cc +++ b/gcc/config/v850/v850.cc @@ -2865,7 +2865,6 @@ v850_select_section (tree exp, { int is_const; if (!TREE_READONLY (exp) - || TREE_SIDE_EFFECTS (exp) || !DECL_INITIAL (exp) || (DECL_INITIAL (exp) != error_mark_node && !TREE_CONSTANT (DECL_INITIAL (exp)))) -- cgit v1.1 From c517295940a23db8ca165dfd5d0edea4457eda49 Mon Sep 17 00:00:00 2001 From: Dimitar Dimitrov Date: Sat, 21 Jan 2023 18:10:59 +0200 Subject: pru: Fix CLZ expansion for QI and HI modes The recent gcc.dg/tree-ssa/clz-char.c test case failed for PRU target, exposing a wrong code generation bug in the PRU backend. The "clz" pattern did not produce correct output for QI and HI input operand modes. SI mode is ok. The "clz" pattern is expanded to an LMBD instruction to get the left-most bit position having value "1". In turn, to get the correct "clz" value, that bit position must be subtracted from the MSB bit position of the input operand. The old behaviour of hard-coding 31 for MSB bit position is wrong. The LMBD instruction returns 32 if input operand is zero, irrespective of its register mode. This maps nicely for SI mode, where the "clz" pattern outputs -1. It also leads to peculiar (but valid!) output values from the "clz" pattern for QI and HI zero-valued inputs. gcc/ChangeLog: * config/pru/pru.h (CLZ_DEFINED_VALUE_AT_ZERO): Fix value for QI and HI input modes. * config/pru/pru.md (clz): Fix generated code for QI and HI input modes. gcc/testsuite/ChangeLog: * gcc.target/pru/clz-hi-2.c: New test. * gcc.target/pru/clz-hi.c: New test. Signed-off-by: Dimitar Dimitrov --- gcc/config/pru/pru.h | 5 +++-- gcc/config/pru/pru.md | 15 +++++++++++--- gcc/testsuite/gcc.target/pru/clz-hi-2.c | 24 ++++++++++++++++++++++ gcc/testsuite/gcc.target/pru/clz-hi.c | 35 +++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.target/pru/clz-hi-2.c create mode 100644 gcc/testsuite/gcc.target/pru/clz-hi.c (limited to 'gcc') diff --git a/gcc/config/pru/pru.h b/gcc/config/pru/pru.h index 3658036..1b5e874 100644 --- a/gcc/config/pru/pru.h +++ b/gcc/config/pru/pru.h @@ -566,8 +566,9 @@ do { \ #define CASE_VECTOR_MODE Pmode -/* See definition of clz pattern for rationale of value -1. */ -#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = -1, 2) +/* See definition of clz pattern for rationale of the value. */ +#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \ + ((VALUE) = GET_MODE_BITSIZE (MODE) - 1 - 32, 2) /* Jumps are cheap on PRU. */ #define LOGICAL_OP_NON_SHORT_CIRCUIT 0 diff --git a/gcc/config/pru/pru.md b/gcc/config/pru/pru.md index dfe0807..6deb5ec 100644 --- a/gcc/config/pru/pru.md +++ b/gcc/config/pru/pru.md @@ -1723,8 +1723,16 @@ [(set_attr "type" "control")]) ;; Count Leading Zeros implemented using LMBD. -;; LMBD returns 32 if bit value is not present, and we subtract 31 to get CLZ. -;; Hence we get a defined value -1 for CLZ_DEFINED_VALUE_AT_ZERO. +;; +;; LMBD returns 32 if bit value is not present, for any kind of input MODE. +;; The LMBD's search result for a "1" bit is subtracted from the +;; mode bit size minus one, in order to get CLZ. +;; +;; Hence for SImode we get a defined value -1 for CLZ_DEFINED_VALUE_AT_ZERO. +;; +;; The QImode and HImode defined values for zero inputs end up to be +;; non-standard (-25 and -17). But this is considered acceptable in +;; order to keep the CLZ expansion to only two instructions. (define_expand "clz2" [(set (match_operand:QISI 0 "register_operand") (clz:QISI (match_operand:QISI 1 "register_operand")))] @@ -1735,7 +1743,8 @@ rtx tmpval = gen_reg_rtx (mode); emit_insn (gen_pru_lmbd (mode, tmpval, src, const1_rtx)); - emit_insn (gen_sub3_insn (dst, GEN_INT (31), tmpval)); + int msb_bitn = GET_MODE_BITSIZE (mode) - 1; + emit_insn (gen_sub3_insn (dst, GEN_INT (msb_bitn), tmpval)); DONE; }) diff --git a/gcc/testsuite/gcc.target/pru/clz-hi-2.c b/gcc/testsuite/gcc.target/pru/clz-hi-2.c new file mode 100644 index 0000000..af877c7 --- /dev/null +++ b/gcc/testsuite/gcc.target/pru/clz-hi-2.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-ch" } */ + +/* This test case is based on gcc.dg/tree-ssa/clz-char.c. */ + +#define PREC (sizeof(short) * 8) + +int +__attribute__ ((noinline, noclone)) +foo (unsigned short b) { + int c = 0; + + if (b == 0) + return PREC; + + while (!(b & (1 << (PREC - 1)))) { + b <<= 1; + c++; + } + + return c; +} + +/* { dg-final { scan-assembler "lmbd\\tr\[012\]\[0-9\]?.w\[0-2\], r\[012\]\[0-9\]?.w\[0-2\], 1" } } */ diff --git a/gcc/testsuite/gcc.target/pru/clz-hi.c b/gcc/testsuite/gcc.target/pru/clz-hi.c new file mode 100644 index 0000000..9350913 --- /dev/null +++ b/gcc/testsuite/gcc.target/pru/clz-hi.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */ + +/* This test case is based on gcc.dg/tree-ssa/clz-char.c. */ + +#define PREC (sizeof(short) * 8) + +int +__attribute__ ((noinline, noclone)) +foo (unsigned short b) { + int c = 0; + + if (b == 0) + return PREC; + + while (!(b & (1 << (PREC - 1)))) { + b <<= 1; + c++; + } + + return c; +} + +int main() +{ + if (foo(0) != PREC) + __builtin_abort (); + if (foo(1 << (PREC - 1)) != 0) + __builtin_abort (); + if (foo(35) != PREC - 6) + __builtin_abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "__builtin_clz|\\.CLZ" 1 "optimized" } } */ -- cgit v1.1 From 844eab81da3f49da88e8bb02e2b1255ba88d02b0 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Sun, 22 Jan 2023 15:17:13 +0000 Subject: Modula-2, testsuite: Remove use of concatenated paths. The original implementation for Modula-2 search paths allows things like '-I/path/a:/path/b'. Such paths are not compatible with the rest of the compiler (in particular, the preprocessor, which Modula-2 uses). In preparation for removing that idiom, this patch rewrites the cases in the testsuite and removes string processing where possible from lists of paths. TODO: There are some apparent discrepancies and/or extraneous insertions of partial include paths (especially in gm2_init_log, gm2_init_iso and gm2_init_pim) - to be handled in some future patch. Signed-off-by: Iain Sandoe gcc/testsuite/ChangeLog: * gm2/case/pass/case-pass.exp: Update for removal of concatenated paths. * gm2/complex/pass/complex-pass.exp: Likewise. * gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp: Likewise. * gm2/iso/analysis/fail/iso-analysis-fail.exp: Likewise. * gm2/iso/check/fail/iso-check-fail.exp: Likewise. * gm2/iso/fail/iso-fail.exp: Likewise. * gm2/iso/pass/iso-pass.exp: Likewise. * gm2/isolib/run/pass/isolib-run-pass.exp: Likewise. * gm2/pim/fail/pim-fail.exp: Likewise. * gm2/pim/pass/pim-pass.exp: Likewise. * gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp: Likewise. * gm2/pimlib/pass/pimlib-pass.exp: Likewise. * gm2/pimlib/run/pass/pimlib-run-pass.exp: Likewise. * gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp: Likewise. * gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp: Likewise. * gm2/projects/log/run/pass/hello/projects-log-run-pass-hello.exp: Likewise. * gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp: Likewise. * gm2/recover/pass/recover-pass.exp: Likewise. * gm2/switches/makeall/fail/switches-makeall-fail.exp: Likewise. * gm2/switches/makeall/pass/switches-makeall-pass.exp: Likewise. * gm2/switches/none/run/pass/gm2-none.exp: Likewise. * gm2/switches/pim2/run/pass/switches-pim2-run-pass.exp: Likewise. * gm2/ulmlib/pass/ulmlib-pass.exp: Likewise. * gm2/ulmlib/std/pass/ulmlib-std-pass.exp: Likewise. * gm2/ulmlib/sys/pass/ulmlib-sys-pass.exp: Likewise. * lib/gm2.exp: Make the paths list a mandatory entry for each gm2_init_xxx function. Remove the use of concatenated include and library paths. Remove string processing where possible. --- gcc/testsuite/gm2/case/pass/case-pass.exp | 2 +- gcc/testsuite/gm2/complex/pass/complex-pass.exp | 2 +- .../pim/run/pass/coroutines-pim-run-pass.exp | 2 +- .../gm2/iso/analysis/fail/iso-analysis-fail.exp | 2 +- .../gm2/iso/check/fail/iso-check-fail.exp | 2 +- gcc/testsuite/gm2/iso/fail/iso-fail.exp | 2 +- gcc/testsuite/gm2/iso/pass/iso-pass.exp | 2 +- .../gm2/isolib/run/pass/isolib-run-pass.exp | 2 +- gcc/testsuite/gm2/pim/fail/pim-fail.exp | 2 +- gcc/testsuite/gm2/pim/pass/pim-pass.exp | 2 +- .../logitech/run/pass/pimlib-logitech-run-pass.exp | 2 +- gcc/testsuite/gm2/pimlib/pass/pimlib-pass.exp | 2 +- .../gm2/pimlib/run/pass/pimlib-run-pass.exp | 2 +- .../run/pass/halma/projects-iso-run-pass-halma.exp | 2 +- .../run/pass/hello/projects-iso-run-pass-hello.exp | 2 +- .../run/pass/hello/projects-log-run-pass-hello.exp | 3 +- .../run/pass/hello/projects-pim-run-pass-hello.exp | 2 +- gcc/testsuite/gm2/recover/pass/recover-pass.exp | 2 +- .../makeall/fail/switches-makeall-fail.exp | 2 +- .../makeall/pass/switches-makeall-pass.exp | 2 +- .../gm2/switches/none/run/pass/gm2-none.exp | 2 +- .../pim2/run/pass/switches-pim2-run-pass.exp | 2 +- gcc/testsuite/gm2/ulmlib/pass/ulmlib-pass.exp | 2 +- .../gm2/ulmlib/std/pass/ulmlib-std-pass.exp | 2 +- .../gm2/ulmlib/sys/pass/ulmlib-sys-pass.exp | 2 +- gcc/testsuite/lib/gm2.exp | 325 +++++++++++---------- 26 files changed, 200 insertions(+), 176 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gm2/case/pass/case-pass.exp b/gcc/testsuite/gm2/case/pass/case-pass.exp index 9c7211b..e73e4b4 100644 --- a/gcc/testsuite/gm2/case/pass/case-pass.exp +++ b/gcc/testsuite/gm2/case/pass/case-pass.exp @@ -25,7 +25,7 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -gm2_init_pim ${srcdir}/gm2/case/pass; +gm2_init_pim "${srcdir}/gm2/case/pass" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/complex/pass/complex-pass.exp b/gcc/testsuite/gm2/complex/pass/complex-pass.exp index 91d8323..a661be1 100644 --- a/gcc/testsuite/gm2/complex/pass/complex-pass.exp +++ b/gcc/testsuite/gm2/complex/pass/complex-pass.exp @@ -25,7 +25,7 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -gm2_init_iso +gm2_init_iso "" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp b/gcc/testsuite/gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp index 81580ce..92ed8d8 100644 --- a/gcc/testsuite/gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp +++ b/gcc/testsuite/gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp @@ -28,7 +28,7 @@ load_lib timeout-dg.exp set gm2src ${srcdir}/../gm2 -gm2_init_cor +gm2_init_cor "" # We should be able to compile, link or run in 15 seconds. gm2_push_timeout 15 diff --git a/gcc/testsuite/gm2/iso/analysis/fail/iso-analysis-fail.exp b/gcc/testsuite/gm2/iso/analysis/fail/iso-analysis-fail.exp index 7a68c80..a6c050f 100644 --- a/gcc/testsuite/gm2/iso/analysis/fail/iso-analysis-fail.exp +++ b/gcc/testsuite/gm2/iso/analysis/fail/iso-analysis-fail.exp @@ -24,7 +24,7 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -gm2_init_iso ${srcdir}/gm2/iso/fail:${srcdir}/gm2/iso/pass "-fsoft-check-all -O2" +gm2_init_iso "${srcdir}/gm2/iso/fail:${srcdir}/gm2/iso/pass" "-fsoft-check-all -O2" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/iso/check/fail/iso-check-fail.exp b/gcc/testsuite/gm2/iso/check/fail/iso-check-fail.exp index cca7ef2..69a1fef 100644 --- a/gcc/testsuite/gm2/iso/check/fail/iso-check-fail.exp +++ b/gcc/testsuite/gm2/iso/check/fail/iso-check-fail.exp @@ -44,7 +44,7 @@ set TORTURE_OPTIONS [list \ { -O3 -fsoft-check-all } \ { -O3 -g -fsoft-check-all } ] -gm2_init_iso ${srcdir}/gm2/iso/check/fail +gm2_init_iso "${srcdir}/gm2/iso/check/fail" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/iso/fail/iso-fail.exp b/gcc/testsuite/gm2/iso/fail/iso-fail.exp index 19dcf31..5e442d6 100644 --- a/gcc/testsuite/gm2/iso/fail/iso-fail.exp +++ b/gcc/testsuite/gm2/iso/fail/iso-fail.exp @@ -24,7 +24,7 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -gm2_init_iso ${srcdir}/gm2/iso/fail:${srcdir}/gm2/iso/pass +gm2_init_iso "${srcdir}/gm2/iso/fail ${srcdir}/gm2/iso/pass" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/iso/pass/iso-pass.exp b/gcc/testsuite/gm2/iso/pass/iso-pass.exp index 657e88a..24c7cd3 100644 --- a/gcc/testsuite/gm2/iso/pass/iso-pass.exp +++ b/gcc/testsuite/gm2/iso/pass/iso-pass.exp @@ -24,7 +24,7 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -gm2_init_iso ${srcdir}/gm2/iso/pass -fcpp; +gm2_init_iso "${srcdir}/gm2/iso/pass" -fcpp foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/isolib/run/pass/isolib-run-pass.exp b/gcc/testsuite/gm2/isolib/run/pass/isolib-run-pass.exp index 5575c50..46ab2fe 100644 --- a/gcc/testsuite/gm2/isolib/run/pass/isolib-run-pass.exp +++ b/gcc/testsuite/gm2/isolib/run/pass/isolib-run-pass.exp @@ -27,7 +27,7 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../gm2 -gm2_init_iso "-I${srcdir}/gm2/iso/run/pass" +gm2_init_iso "${srcdir}/gm2/iso/run/pass" set cmd [exec cp $srcdir/$subdir/testinput .] set cmd [exec cp $srcdir/$subdir/testnumber .] diff --git a/gcc/testsuite/gm2/pim/fail/pim-fail.exp b/gcc/testsuite/gm2/pim/fail/pim-fail.exp index 92e82cb..febf7a3 100644 --- a/gcc/testsuite/gm2/pim/fail/pim-fail.exp +++ b/gcc/testsuite/gm2/pim/fail/pim-fail.exp @@ -24,7 +24,7 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -gm2_init_pim "${srcdir}/gm2/pim/fail:${srcdir}/gm2/pim/pass" +gm2_init_pim "${srcdir}/gm2/pim/fail ${srcdir}/gm2/pim/pass" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/pim/pass/pim-pass.exp b/gcc/testsuite/gm2/pim/pass/pim-pass.exp index e63297e..6325edf 100644 --- a/gcc/testsuite/gm2/pim/pass/pim-pass.exp +++ b/gcc/testsuite/gm2/pim/pass/pim-pass.exp @@ -26,7 +26,7 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 -gm2_init_log "${srcdir}/gm2/pim/pass:${gm2src}/gm2-compiler:${gm2src}/gm2-gcc" +gm2_init_log "${srcdir}/gm2/pim/pass ${gm2src}/gm2-compiler ${gm2src}/gm2-gcc" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp b/gcc/testsuite/gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp index cfe9ff8..2b530a5 100644 --- a/gcc/testsuite/gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp +++ b/gcc/testsuite/gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp @@ -27,7 +27,7 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 -gm2_init_log +gm2_init_log "" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/pimlib/pass/pimlib-pass.exp b/gcc/testsuite/gm2/pimlib/pass/pimlib-pass.exp index 22a679f..3c11646 100644 --- a/gcc/testsuite/gm2/pimlib/pass/pimlib-pass.exp +++ b/gcc/testsuite/gm2/pimlib/pass/pimlib-pass.exp @@ -25,7 +25,7 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -gm2_init_log +gm2_init_log "" foreach testcase [lsort [glob -nocomplain $srcdir/../gm2/gm2-libs-pim/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/pimlib/run/pass/pimlib-run-pass.exp b/gcc/testsuite/gm2/pimlib/run/pass/pimlib-run-pass.exp index cfe9ff8..2b530a5 100644 --- a/gcc/testsuite/gm2/pimlib/run/pass/pimlib-run-pass.exp +++ b/gcc/testsuite/gm2/pimlib/run/pass/pimlib-run-pass.exp @@ -27,7 +27,7 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 -gm2_init_log +gm2_init_log "" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp b/gcc/testsuite/gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp index b943798..faec3f9 100644 --- a/gcc/testsuite/gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp +++ b/gcc/testsuite/gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp @@ -27,7 +27,7 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 -gm2_init_iso +gm2_init_iso "" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp b/gcc/testsuite/gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp index b943798..faec3f9 100644 --- a/gcc/testsuite/gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp +++ b/gcc/testsuite/gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp @@ -27,7 +27,7 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 -gm2_init_iso +gm2_init_iso "" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/projects/log/run/pass/hello/projects-log-run-pass-hello.exp b/gcc/testsuite/gm2/projects/log/run/pass/hello/projects-log-run-pass-hello.exp index 36e402d..375af70 100644 --- a/gcc/testsuite/gm2/projects/log/run/pass/hello/projects-log-run-pass-hello.exp +++ b/gcc/testsuite/gm2/projects/log/run/pass/hello/projects-log-run-pass-hello.exp @@ -27,8 +27,7 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 -# gm2_link_lib "m2log m2pim m2iso" -gm2_init_log +gm2_init_log "" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp b/gcc/testsuite/gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp index 0737b90..3e8db47 100644 --- a/gcc/testsuite/gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp +++ b/gcc/testsuite/gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp @@ -27,7 +27,7 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 -gm2_init_pim +gm2_init_pim "" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/recover/pass/recover-pass.exp b/gcc/testsuite/gm2/recover/pass/recover-pass.exp index 22a679f..3c11646 100644 --- a/gcc/testsuite/gm2/recover/pass/recover-pass.exp +++ b/gcc/testsuite/gm2/recover/pass/recover-pass.exp @@ -25,7 +25,7 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -gm2_init_log +gm2_init_log "" foreach testcase [lsort [glob -nocomplain $srcdir/../gm2/gm2-libs-pim/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/switches/makeall/fail/switches-makeall-fail.exp b/gcc/testsuite/gm2/switches/makeall/fail/switches-makeall-fail.exp index 91787df..32da0ec 100644 --- a/gcc/testsuite/gm2/switches/makeall/fail/switches-makeall-fail.exp +++ b/gcc/testsuite/gm2/switches/makeall/fail/switches-makeall-fail.exp @@ -29,7 +29,7 @@ load_lib gm2-torture.exp # attempts to use gm2 -fmakeall to build a syntactally incorrect program. # -gm2_init "-I$srcdir/../gm2/gm2-libs:$srcdir/gm2/switches/makeall/fail -fmakeall" +gm2_init "$srcdir/../gm2/gm2-libs $srcdir/gm2/switches/makeall/fail" -fmakeall foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { diff --git a/gcc/testsuite/gm2/switches/makeall/pass/switches-makeall-pass.exp b/gcc/testsuite/gm2/switches/makeall/pass/switches-makeall-pass.exp index 7b6d82f..41308af 100644 --- a/gcc/testsuite/gm2/switches/makeall/pass/switches-makeall-pass.exp +++ b/gcc/testsuite/gm2/switches/makeall/pass/switches-makeall-pass.exp @@ -24,7 +24,7 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -gm2_init "-I${srcdir}/gm2/switches/makeall/pass" -fmakeall +gm2_init "${srcdir}/gm2/switches/makeall/pass" -fmakeall gm2_init_pim4 "${srcdir}/gm2/switches/makeall/pass" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { diff --git a/gcc/testsuite/gm2/switches/none/run/pass/gm2-none.exp b/gcc/testsuite/gm2/switches/none/run/pass/gm2-none.exp index cf77d5a..86dab20 100644 --- a/gcc/testsuite/gm2/switches/none/run/pass/gm2-none.exp +++ b/gcc/testsuite/gm2/switches/none/run/pass/gm2-none.exp @@ -26,7 +26,7 @@ load_lib gm2-simple.exp set gm2src ${srcdir}/../m2 -gm2_init_pim +gm2_init_pim "" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/switches/pim2/run/pass/switches-pim2-run-pass.exp b/gcc/testsuite/gm2/switches/pim2/run/pass/switches-pim2-run-pass.exp index 135a3d6..04a32c6 100644 --- a/gcc/testsuite/gm2/switches/pim2/run/pass/switches-pim2-run-pass.exp +++ b/gcc/testsuite/gm2/switches/pim2/run/pass/switches-pim2-run-pass.exp @@ -27,7 +27,7 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 -gm2_init_pim2 +gm2_init_pim2 "" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/ulmlib/pass/ulmlib-pass.exp b/gcc/testsuite/gm2/ulmlib/pass/ulmlib-pass.exp index 0bda866..0e17dde 100644 --- a/gcc/testsuite/gm2/ulmlib/pass/ulmlib-pass.exp +++ b/gcc/testsuite/gm2/ulmlib/pass/ulmlib-pass.exp @@ -25,7 +25,7 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -gm2_init_ulm +gm2_init_ulm "" foreach testcase [lsort [glob -nocomplain $srcdir/../gm2/ulm-lib-gm2/sys/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/ulmlib/std/pass/ulmlib-std-pass.exp b/gcc/testsuite/gm2/ulmlib/std/pass/ulmlib-std-pass.exp index be01029..8aea107 100644 --- a/gcc/testsuite/gm2/ulmlib/std/pass/ulmlib-std-pass.exp +++ b/gcc/testsuite/gm2/ulmlib/std/pass/ulmlib-std-pass.exp @@ -25,7 +25,7 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -gm2_init_ulm +gm2_init_ulm "" foreach testcase [lsort [glob -nocomplain $srcdir/../gm2/ulm-lib-gm2/std/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/ulmlib/sys/pass/ulmlib-sys-pass.exp b/gcc/testsuite/gm2/ulmlib/sys/pass/ulmlib-sys-pass.exp index 0bda866..0e17dde 100644 --- a/gcc/testsuite/gm2/ulmlib/sys/pass/ulmlib-sys-pass.exp +++ b/gcc/testsuite/gm2/ulmlib/sys/pass/ulmlib-sys-pass.exp @@ -25,7 +25,7 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -gm2_init_ulm +gm2_init_ulm "" foreach testcase [lsort [glob -nocomplain $srcdir/../gm2/ulm-lib-gm2/sys/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/lib/gm2.exp b/gcc/testsuite/lib/gm2.exp index 41a2fa0..15e3729 100644 --- a/gcc/testsuite/lib/gm2.exp +++ b/gcc/testsuite/lib/gm2.exp @@ -65,22 +65,22 @@ proc gm2_pop_timeout { } { proc default_gcc_version { } { global GCC_UNDER_TEST - gm2_init; + gm2_init # ignore any arguments after the command set compiler [lindex $GCC_UNDER_TEST 0] if ![is_remote host] { - set compiler_name [which $compiler]; + set compiler_name [which $compiler] } else { - set compiler_name $compiler; + set compiler_name $compiler } # verify that the compiler exists if { $compiler_name != 0 } then { set tmp [remote_exec host "$compiler --version"] - set status [lindex $tmp 0]; - set output [lindex $tmp 1]; + set status [lindex $tmp 0] + set output [lindex $tmp 1] regexp "version.*$" $output version if { $status == 0 && [info exists version] } then { clone_output "$compiler_name $version\n" @@ -98,7 +98,7 @@ proc default_gcc_version { } { # proc gcc_version { } { - default_gcc_version; + default_gcc_version } # @@ -108,64 +108,64 @@ proc gcc_version { } { # make some enhancements without having to go back and rewrite the scripts. # -set gm2_initialized 0; -set gm2_compile_method "default"; -set gm2_link_path ""; -set gm2_link_libraries "m2pim m2iso"; -set gm2_link_objects ""; +set gm2_initialized 0 +set gm2_compile_method "default" +set gm2_link_path "" +set gm2_link_libraries "m2pim m2iso" +set gm2_link_objects "" proc gm2_set_compile_method { arg } { - global gm2_compile_method; + global gm2_compile_method send_log "********************************************\n" send_log "**** setting gm2_compile_method to $arg ****\n" send_log "********************************************\n" - set gm2_compile_method $arg; + set gm2_compile_method $arg } proc gm2_init { args } { - global tmpdir; - global objdir; - global rootme; - global base_dir; - global tool_root_dir; - global gluefile wrap_flags; - global gm2_initialized; - global GCC_UNDER_TEST; - global TOOL_EXECUTABLE; - global gm2_link_libraries; - global gm2_link_objects; - global gm2_link_path; - global HAVE_LIBSTDCXX_V3; - - if { $gm2_initialized == 1 } { return; } - - set gm2_link_objects ""; - set GCC_UNDER_TEST [lookfor_file $rootme gm2]; - append GCC_UNDER_TEST " " -B[file dirname $rootme]/gcc " " ${args}; + global tmpdir + global objdir + global rootme + global base_dir + global tool_root_dir + global gluefile wrap_flags + global gm2_initialized + global GCC_UNDER_TEST + global TOOL_EXECUTABLE + global gm2_link_libraries + global gm2_link_objects + global gm2_link_path + global HAVE_LIBSTDCXX_V3 + + if { $gm2_initialized == 1 } { return } + + set gm2_link_objects "" + set GCC_UNDER_TEST [lookfor_file $rootme gm2] + append GCC_UNDER_TEST " " -B[file dirname $rootme]/gcc " " ${args} append GCC_UNDER_TEST " " -fno-diagnostics-show-caret append GCC_UNDER_TEST " " -fno-diagnostics-show-line-numbers append GCC_UNDER_TEST " " -fdiagnostics-color=never send_log "GCC_UNDER_TEST is ${GCC_UNDER_TEST}\n" if ![info exists tmpdir] then { - set tmpdir /tmp; + set tmpdir /tmp } if {[target_info needs_status_wrapper] != "" && \ [target_info needs_status_wrapper] != "0" && \ ![info exists gluefile]} { - set gluefile ${tmpdir}/gcc-testglue.o; - set result [build_wrapper $gluefile]; + set gluefile ${tmpdir}/gcc-testglue.o + set result [build_wrapper $gluefile] if { $result != "" } { - set gluefile [lindex $result 0]; - set wrap_flags [lindex $result 1]; + set gluefile [lindex $result 0] + set wrap_flags [lindex $result 1] } else { unset gluefile } } - set gm2_link_path "[gm2_link_flags [get_multilibs]]"; + set gm2_link_path "[gm2_link_flags [get_multilibs]]" verbose $gm2_link_path 1 # Set the default timeout value, larger tests can override @@ -231,7 +231,7 @@ proc gm2_target_compile_default { source dest type options } { # proc gm2_target_compile { source dest type options } { - global gm2_compile_method; + global gm2_compile_method return [gm2_target_compile_${gm2_compile_method} $source $dest $type $options] } @@ -242,9 +242,9 @@ proc gm2_target_compile { source dest type options } { # proc gm2_link_lib { libraries } { - global gm2_link_libraries; + global gm2_link_libraries - set gm2_link_libraries $libraries; + set gm2_link_libraries $libraries } @@ -253,9 +253,9 @@ proc gm2_link_lib { libraries } { # proc gm2_link_obj { objects } { - global gm2_link_objects; + global gm2_link_objects - set gm2_link_objects $objects; + set gm2_link_objects $objects } @@ -264,10 +264,10 @@ proc gm2_link_obj { objects } { # proc gm2_link_flags { paths } { - global srcdir; - global ld_library_path; - global gccpath; - global gm2_link_libraries; + global srcdir + global ld_library_path + global gccpath + global gm2_link_libraries set gccpath ${paths} set libio_dir "" @@ -329,31 +329,37 @@ proc gm2_link_flags { paths } { # # -proc gm2_init_pimx { dialect {path ""} args } { - global srcdir; - global gccpath; +proc gm2_init_pimx { dialect paths args } { + global srcdir + global gccpath - set gm2src ${srcdir}/../m2; + set gm2src ${srcdir}/../m2 + send_log "srcdir is $srcdir\n" send_log "gccpath is $gccpath\n" send_log "gm2src is $gm2src\n" - set pimIpath "${gccpath}/libgm2/libm2pim:${gm2src}/gm2-libs"; - set pimLpath "${gccpath}/libgm2/libm2pim/.libs"; + set theIpath -I${gccpath}/libgm2/libm2pim + lappend theIpath -I${gm2src}/gm2-libs-pim - set isoIpath "${gccpath}/libgm2/libm2iso:${gm2src}/gm2-libs-iso"; - set isoLpath "${gccpath}/libgm2/libm2iso/.libs"; + # NOTE: + lappend theIpath -I${gm2src}/gm2-libs + + set theLpath -L${gccpath}/libgm2/libm2pim/.libs - set theIpath "-I${pimIpath} -I${isoIpath}"; - set theLpath "-L${pimLpath} -L${isoLpath}"; + lappend theIpath -I${gccpath}/libgm2/libm2iso + lappend theIpath -I${gm2src}/gm2-libs-iso - if { $path != "" } then { - append theIpath " -I" - append theIpath ${path} + lappend theLpath -L${gccpath}/libgm2/libm2iso/.libs + + foreach p $paths { + lappend theIpath -I$p } + gm2_link_lib "m2pim m2iso" - gm2_init {*}${theIpath} {*}${dialect} {*}${theLpath} {*}${args}; + lappend args -fno-libs=- + gm2_init {*}${theIpath} {*}${dialect} {*}${theLpath} {*}${args} } # @@ -361,8 +367,8 @@ proc gm2_init_pimx { dialect {path ""} args } { # # -proc gm2_init_pim { {path ""} args } { - gm2_init_pimx -fpim {*}${path} {*}${args}; +proc gm2_init_pim { paths args } { + gm2_init_pimx -fpim $paths {*}${args} } @@ -371,8 +377,8 @@ proc gm2_init_pim { {path ""} args } { # It uses the PIM2 dialect. # -proc gm2_init_pim2 { {path ""} args } { - gm2_init_pimx -fpim2 {*}${path} {*}${args}; +proc gm2_init_pim2 { paths args } { + gm2_init_pimx -fpim2 $paths {*}${args} } @@ -381,8 +387,8 @@ proc gm2_init_pim2 { {path ""} args } { # It uses the PIM3 dialect. # -proc gm2_init_pim3 { {path ""} args } { - gm2_init_pimx -fpim3 {*}${path} {*}${args}; +proc gm2_init_pim3 { paths args } { + gm2_init_pimx -fpim3 $paths {*}${args} } @@ -391,8 +397,8 @@ proc gm2_init_pim3 { {path ""} args } { # It uses the PIM4 dialect. # -proc gm2_init_pim4 { {path ""} args } { - gm2_init_pimx -fpim4 {*}${path} {*}${args}; +proc gm2_init_pim4 { paths args } { + gm2_init_pimx -fpim4 $paths {*}${args} } @@ -400,60 +406,70 @@ proc gm2_init_pim4 { {path ""} args } { # gm2_init_iso - set the default libraries to choose ISO and then PIM. # -proc gm2_init_iso { {path ""} args } { - global srcdir; - global gccpath; +proc gm2_init_iso { paths args } { + global srcdir + global gccpath - set gm2src ${srcdir}/../m2; + set gm2src ${srcdir}/../m2 - set isoIpath "${gccpath}/libgm2/libm2iso:${gm2src}/gm2-libs-iso"; - set pimIpath "${gccpath}/libgm2/libm2pim:${gm2src}/gm2-libs"; + set theIpath -I${gccpath}/libgm2/libm2iso + lappend theIpath -I${gm2src}/gm2-libs-iso - set isoLpath "${gccpath}/libgm2/libm2iso/.libs"; - set pimLpath "${gccpath}/libgm2/libm2pim/.libs"; + set theLpath -L${gccpath}/libgm2/libm2iso/.libs - set corIpath "${gccpath}/libgm2/libm2cor:${gm2src}/gm2-libs-coroutines"; - set corLpath "${gccpath}/libgm2/libm2cor/.libs"; + lappend theIpath -I${gccpath}/libgm2/libm2pim + lappend theIpath -I${gm2src}/gm2-libs-pim - set theIpath "-I${isoIpath} -I${corIpath} -I${pimIpath}"; - set theLpath "-L${isoLpath} -L${corLpath} -L${pimLpath}"; + # NOTE: + lappend theIpath -I${gm2src}/gm2-libs - if { $path != "" } then { - append theIpath " -I" - append theIpath ${path} + lappend theLpath -L${gccpath}/libgm2/libm2pim/.libs + + lappend theIpath -I${gccpath}/libgm2/libm2cor + lappend theIpath -I${gm2src}/gm2-libs-coroutines + + lappend theLpath -L${gccpath}/libgm2/libm2cor/.libs + + foreach p $paths { + lappend theIpath -I$p } gm2_link_lib "m2iso m2pim m2cor" - gm2_init {*}${theIpath} -fiso {*}${theLpath} {*}${args}; + lappend args -fno-libs=- + gm2_init {*}${theIpath} -fiso {*}${theLpath} {*}${args} } - # # gm2_init_ulm - set the default libraries to choose the ULM and PIM libraries. # -proc gm2_init_ulm { {path ""} args } { - global srcdir; - global gccpath; +proc gm2_init_ulm { paths args } { + global srcdir + global gccpath - set gm2src ${srcdir}/../m2; + set gm2src ${srcdir}/../m2 - set ulmIpath "${gccpath}/libgm2/libm2ulm:${gm2src}/ulm-lib-gm2/std:${gm2src}/ulm-lib-gm2/sys"; - set ulmLpath "${gccpath}/libgm2/libm2ulm/.libs"; + set theIpath -I${gccpath}/libgm2/libm2ulm + lappend theIpath -I${gm2src}/ulm-lib-gm2/std + lappend theIpath -I${gm2src}/ulm-lib-gm2/sys - set pimIpath "${gccpath}/libgm2/libm2pim:${gm2src}/gm2-libs"; - set pimLpath "${gccpath}/libgm2/libm2pim/.libs"; + set theLpath -L${gccpath}/libgm2/libm2ulm/.libs - set theIpath "-I${ulmIpath} -I${pimIpath}"; - set theLpath "-L${ulmLpath} -L${pimLpath}"; + lappend theIpath -I${gccpath}/libgm2/libm2pim + lappend theIpath -I${gm2src}/gm2-libs-pim - if { $path != "" } then { - append theIpath " -I" - append theIpath ${path} + # NOTE: + lappend theIpath -I${gm2src}/gm2-libs + + lappend theLpath -L${gccpath}/libgm2/libm2pim/.libs + + foreach p $paths { + lappend theIpath -I$p } gm2_link_lib "m2ulm m2pim" - gm2_init {*}${theIpath} -fpim {*}${theLpath} {*}${args}; + lappend args -fno-libs=- + gm2_init {*}${theIpath} -fpim {*}${theLpath} {*}${args} } @@ -462,35 +478,40 @@ proc gm2_init_ulm { {path ""} args } { # # -proc gm2_init_log { {path ""} args } { - global srcdir; - global gccpath; +proc gm2_init_log { paths args } { + global srcdir + global gccpath - set gm2src ${srcdir}/../m2; + set gm2src ${srcdir}/../m2 send_log "srcdir is $srcdir\n" send_log "gccpath is $gccpath\n" send_log "gm2src is $gm2src\n" - set logIpath "${gccpath}/libgm2/libm2log:${gm2src}/gm2-libs-pim"; - set logLpath "${gccpath}/libgm2/libm2log/.libs"; + # FIXME: this seems to interleave the library defs. + set theIpath -I${gccpath}/libgm2/libm2log + lappend theIpath -I${gm2src}/gm2-libs-pim + + set theLpath -L${gccpath}/libgm2/libm2log/.libs + + lappend theIpath -I${gccpath}/libgm2/libm2pim + lappend theIpath -I${gm2src}/gm2-libs - set pimIpath "${gccpath}/libgm2/libm2pim:${gm2src}/gm2-libs"; - set pimLpath "${gccpath}/libgm2/libm2pim/.libs"; + lappend theLpath -L${gccpath}/libgm2/libm2pim/.libs - set isoIpath "${gccpath}/libgm2/libm2iso:${gm2src}/gm2-libs-iso"; - set pimIpath "${gccpath}/libgm2/libm2pim:${gm2src}/gm2-libs"; + lappend theIpath -I${gccpath}/libgm2/libm2iso + lappend theIpath -I${gm2src}/gm2-libs-iso + # ??? lappend theIpath -I${gm2src}/gm2-libs - set theIpath "-I${logIpath} -I${pimIpath} -I${isoIpath}"; - set theLpath "-L${logLpath} -L${pimLpath}"; + lappend theLpath -L${gccpath}/libgm2/libm2iso/.libs - if { $path != "" } then { - append theIpath " -I" - append theIpath ${path} + foreach p $paths { + lappend theIpath -I$p } gm2_link_lib "m2log m2pim m2iso" - gm2_init {*}${theIpath} -fpim {*}${theLpath} {*}${args}; + lappend args -fno-libs=- + gm2_init {*}${theIpath} -fpim {*}${theLpath} {*}${args} } # @@ -498,39 +519,44 @@ proc gm2_init_log { {path ""} args } { # # -proc gm2_init_cor { {path ""} args } { - global srcdir; - global gccpath; - global gm2_link_libraries; +proc gm2_init_cor { paths args } { + global srcdir + global gccpath + global gm2_link_libraries - set gm2src ${srcdir}/../m2; + set gm2src ${srcdir}/../m2 send_log "srcdir is $srcdir\n" send_log "gccpath is $gccpath\n" send_log "gm2src is $gm2src\n" - set corIpath "${gccpath}/libgm2/libm2cor:${gm2src}/gm2-libs-coroutines"; - set corLpath "${gccpath}/libgm2/libm2cor/.libs"; + set theIpath -I${gccpath}/libgm2/libm2cor + lappend theIpath -I${gm2src}/gm2-libs-coroutines + + set theLpath -L${gccpath}/libgm2/libm2cor/.libs + + lappend theIpath -I${gccpath}/libgm2/libm2pim + lappend theIpath -I${gm2src}/gm2-libs-pim - set pimIpath "${gccpath}/libgm2/libm2pim:${gm2src}/gm2-libs"; - set pimLpath "${gccpath}/libgm2/libm2pim/.libs"; + lappend theLpath -L${gccpath}/libgm2/libm2pim/.libs - set isoIpath "${gccpath}/libgm2/libm2iso:${gm2src}/gm2-libs-iso"; - set isoLpath "${gccpath}/libgm2/libm2iso/.libs"; + lappend theIpath -I${gccpath}/libgm2/libm2log + lappend theIpath -I${gm2src}/gm2-libs - set logIpath "${gccpath}/libgm2/libm2log:${gm2src}/gm2-libs-pim"; - set logLpath "${gccpath}/libgm2/libm2log/.libs"; + lappend theLpath -L${gccpath}/libgm2/libm2log/.libs - set theIpath "-I${corIpath} -I${pimIpath} -I${logIpath} -I${isoIpath}"; - set theLpath "-L${corLpath} -L${pimLpath} -L${logLpath} -L${isoLpath}"; + lappend theIpath -I${gccpath}/libgm2/libm2iso + lappend theIpath -I${gm2src}/gm2-libs-iso - if { $path != "" } then { - append theIpath " -I" - append theIpath ${path} + lappend theLpath -L${gccpath}/libgm2/libm2iso/.libs + + foreach p $paths { + lappend theIpath -I$p } - gm2_link_lib "m2cor m2pim m2iso" - gm2_init {*}${theIpath} -fpim {*}${theLpath} {*}${args}; + gm2_link_lib "m2cor m2pim m2log m2iso" + append args " -fno-libs=- " + gm2_init {*}${theIpath} -fpim {*}${theLpath} {*}${args} } @@ -540,28 +566,27 @@ proc gm2_init_cor { {path ""} args } { # # -proc gm2_init_minx { dialect {path ""} args } { - global srcdir; - global gccpath; - set gm2src ${srcdir}/../m2; +proc gm2_init_minx { dialect paths args } { + global srcdir + global gccpath + set gm2src ${srcdir}/../m2 send_log "srcdir is $srcdir\n" send_log "gccpath is $gccpath\n" send_log "gm2src is $gm2src\n" - set theIpath " -I${gccpath}/libgm2/libm2min" - append theIpath " -I${gm2src}/gm2-libs-min" + set theIpath -I${gccpath}/libgm2/libm2min + lappend theIpath -I${gm2src}/gm2-libs-min - set theLpath " -L${gccpath}/libgm2/libm2min/.libs"; + set theLpath -L${gccpath}/libgm2/libm2min/.libs - if { $path != "" } then { - append theIpath " -I" - append theIpath ${path} + foreach p $paths { + lappend theIpath -I$p } gm2_link_lib "m2min" - append args " -fno-exceptions " - append args " -fno-libs=- " + lappend args -fno-exceptions + lappend args -fno-libs=- gm2_init {*}${theIpath} {*}${dialect} {*}${theLpath} {*}${args} } @@ -570,6 +595,6 @@ proc gm2_init_minx { dialect {path ""} args } { # and pim dialect. # -proc gm2_init_min { {path ""} args } { - gm2_init_minx -fpim {*}${path} {*}${args} +proc gm2_init_min { paths args } { + gm2_init_minx -fpim $paths {*}${args} } -- cgit v1.1 From 7823285a7ae8c516d2dfa96d426692bf2aef571e Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 23 Jan 2023 00:16:34 +0000 Subject: Daily bump. --- gcc/ChangeLog | 12 ++++++++++++ gcc/DATESTAMP | 2 +- gcc/testsuite/ChangeLog | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bc09889..5ac20c5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2023-01-22 Dimitar Dimitrov + + * config/pru/pru.h (CLZ_DEFINED_VALUE_AT_ZERO): Fix value for QI + and HI input modes. + * config/pru/pru.md (clz): Fix generated code for QI and HI + input modes. + +2023-01-22 Cupertino Miranda + + * config/v850/v850.cc (v850_select_section): Put const volatile + objects into read-only sections. + 2023-01-20 Tejas Belagod * config/aarch64/arm_neon.h (vmull_p64, vmull_high_p64, vaeseq_u8, diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 39523e2..3426cc8 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20230122 +20230123 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 88561ff..5bf9136 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,40 @@ +2023-01-22 Iain Sandoe + + * gm2/case/pass/case-pass.exp: Update for removal of concatenated + paths. + * gm2/complex/pass/complex-pass.exp: Likewise. + * gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp: Likewise. + * gm2/iso/analysis/fail/iso-analysis-fail.exp: Likewise. + * gm2/iso/check/fail/iso-check-fail.exp: Likewise. + * gm2/iso/fail/iso-fail.exp: Likewise. + * gm2/iso/pass/iso-pass.exp: Likewise. + * gm2/isolib/run/pass/isolib-run-pass.exp: Likewise. + * gm2/pim/fail/pim-fail.exp: Likewise. + * gm2/pim/pass/pim-pass.exp: Likewise. + * gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp: Likewise. + * gm2/pimlib/pass/pimlib-pass.exp: Likewise. + * gm2/pimlib/run/pass/pimlib-run-pass.exp: Likewise. + * gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp: Likewise. + * gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp: Likewise. + * gm2/projects/log/run/pass/hello/projects-log-run-pass-hello.exp: Likewise. + * gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp: Likewise. + * gm2/recover/pass/recover-pass.exp: Likewise. + * gm2/switches/makeall/fail/switches-makeall-fail.exp: Likewise. + * gm2/switches/makeall/pass/switches-makeall-pass.exp: Likewise. + * gm2/switches/none/run/pass/gm2-none.exp: Likewise. + * gm2/switches/pim2/run/pass/switches-pim2-run-pass.exp: Likewise. + * gm2/ulmlib/pass/ulmlib-pass.exp: Likewise. + * gm2/ulmlib/std/pass/ulmlib-std-pass.exp: Likewise. + * gm2/ulmlib/sys/pass/ulmlib-sys-pass.exp: Likewise. + * lib/gm2.exp: Make the paths list a mandatory entry for each gm2_init_xxx + function. Remove the use of concatenated include and library paths. + Remove string processing where possible. + +2023-01-22 Dimitar Dimitrov + + * gcc.target/pru/clz-hi-2.c: New test. + * gcc.target/pru/clz-hi.c: New test. + 2023-01-21 Jerry DeLisle PR fortran/102595 -- cgit v1.1 From 208c6678c25bd9a11e6c5911a4c123cb6b7f3d6e Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 20 Dec 2022 16:27:43 -0500 Subject: c++: lifetime extension with .* expression [PR53288] This PR points out a case where we are not extending the lifetime of a temporary when the subobject is denoted by a pointer-to-member operation. These rules were clarified in C++20 by CWG1299. There are other cases that also need to be handled under CWG1299, but are not fixed by this patch. PR c++/53288 DR 1299 gcc/cp/ChangeLog: * call.cc (extend_ref_init_temps_1): Handle ptrmem expression. gcc/testsuite/ChangeLog: * g++.dg/init/lifetime4.C: New test. --- gcc/cp/call.cc | 38 ++++++++++++++++++++++++++++++++++ gcc/testsuite/g++.dg/init/lifetime4.C | 39 +++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 gcc/testsuite/g++.dg/init/lifetime4.C (limited to 'gcc') diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index 9917307..a7de0e8 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -13952,6 +13952,34 @@ static tree extend_ref_init_temps_1 (tree decl, tree init, vec **cleanups, tree *cond_guard) { + /* CWG1299 (C++20): The temporary object to which the reference is bound or + the temporary object that is the complete object of a subobject to which + the reference is bound persists for the lifetime of the reference if the + glvalue to which the reference is bound was obtained through one of the + following: + - a temporary materialization conversion ([conv.rval]), + - ( expression ), where expression is one of these expressions, + - subscripting ([expr.sub]) of an array operand, where that operand is one + of these expressions, + - a class member access ([expr.ref]) using the . operator where the left + operand is one of these expressions and the right operand designates a + non-static data member of non-reference type, + - a pointer-to-member operation ([expr.mptr.oper]) using the .* operator + where the left operand is one of these expressions and the right operand + is a pointer to data member of non-reference type, + - a const_cast ([expr.const.cast]), static_cast ([expr.static.cast]), + dynamic_cast ([expr.dynamic.cast]), or reinterpret_cast + ([expr.reinterpret.cast]) converting, without a user-defined conversion, + a glvalue operand that is one of these expressions to a glvalue that + refers to the object designated by the operand, or to its complete + object or a subobject thereof, + - a conditional expression ([expr.cond]) that is a glvalue where the + second or third operand is one of these expressions, or + - a comma expression ([expr.comma]) that is a glvalue where the right + operand is one of these expressions. */ + + /* FIXME several cases are still handled wrong (101572, 81420). */ + tree sub = init; tree *p; STRIP_NOPS (sub); @@ -13962,6 +13990,16 @@ extend_ref_init_temps_1 (tree decl, tree init, vec **cleanups, cond_guard); return init; } + if (TREE_CODE (sub) == POINTER_PLUS_EXPR + && TYPE_PTRDATAMEM_P (TREE_TYPE (tree_strip_nop_conversions + (TREE_OPERAND (sub, 1))))) + { + /* A pointer-to-member operation. */ + TREE_OPERAND (sub, 0) + = extend_ref_init_temps_1 (decl, TREE_OPERAND (sub, 0), cleanups, + cond_guard); + return init; + } if (TREE_CODE (sub) == COND_EXPR) { tree cur_cond_guard = NULL_TREE; diff --git a/gcc/testsuite/g++.dg/init/lifetime4.C b/gcc/testsuite/g++.dg/init/lifetime4.C new file mode 100644 index 0000000..4106af7 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/lifetime4.C @@ -0,0 +1,39 @@ +// PR c++/53288 +// { dg-do compile { target c++11 } } + +struct B { + B(int data) : _data(data) { } + ~B() { } + + int _data; + +private: + B() = delete; + B(const B &) = delete; + B(B &&) = delete; +}; + +int c,d; +struct A { + B b; + A(int data) : b(data) { ++c; } + ~A() { ++d; } + +private: + A() = delete; + A(const A &) = delete; + A(A &&) = delete; +}; + +template +void f(T t) { + const B &b = A(1).*t; + if (d) __builtin_abort (); +} + +int main() { + const B &b = A(1).*(&A::b); + if (d) __builtin_abort (); + + f(&A::b); +} -- cgit v1.1 From 106f99406312d7ed47434de53c180718225ffa5e Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 19 Jan 2023 08:44:25 +0100 Subject: tree-optimization/108449 - keep maybe_special_function_p behavior When we have a static declaration without definition we diagnose that and turn it into an extern declaration. That can alter the outcome of maybe_special_function_p here and there's really no point in doing that, so don't. PR tree-optimization/108449 * cgraphunit.cc (check_global_declaration): Do not turn undefined statics into externs. * gcc.dg/pr108449.c: New testcase. --- gcc/cgraphunit.cc | 2 -- gcc/testsuite/gcc.dg/pr108449.c | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr108449.c (limited to 'gcc') diff --git a/gcc/cgraphunit.cc b/gcc/cgraphunit.cc index 59ce270..832818d 100644 --- a/gcc/cgraphunit.cc +++ b/gcc/cgraphunit.cc @@ -1087,8 +1087,6 @@ check_global_declaration (symtab_node *snode) else warning (OPT_Wunused_function, "%q+F declared % but never " "defined", decl); - /* This symbol is effectively an "extern" declaration now. */ - TREE_PUBLIC (decl) = 1; } /* Warn about static fns or vars defined but not used. */ diff --git a/gcc/testsuite/gcc.dg/pr108449.c b/gcc/testsuite/gcc.dg/pr108449.c new file mode 100644 index 0000000..4a3ae5b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr108449.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +static int vfork(); /* { dg-warning "used but never defined" } */ +void f() { vfork(); } -- cgit v1.1 From e94e9944f59b00de455bb719fd0c5281c5509be6 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Mon, 23 Jan 2023 09:31:11 +0100 Subject: install.texi: Bump newlib version for nvptx + gcn Before, newlib 3.2 was required for amdgcn and 3.1 for nvptx. Now recommended is 4.3.0 which was just released on 2023-01-20. While currently the old versions would work fine, upcoming GCC changes depend on a newer newlib. Thus, the minimal version is bumped instead of just recommending the new version. For GCN, the bump is in preparation for permitting non-threadlocal stack variables and vectorized math functions - both scheduled for GCC 13 and added to newlib in 4.3.0. For nvptx, this includes an emulated clock (commit 6bb96d13a), a calloc fix (5fca4e0f1) and changes to permit libgfortran to be compiled with I/O support instead of only in minimal mode. (Patch approved for GCC 13 but pending on a nvtpx patch, which for which review is pending.) gcc/ChangeLog: * doc/install.texi (amdgcn, nvptx): Require newlib 4.3.0. --- gcc/doc/install.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index ccc8d15..b1861a6 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -3855,7 +3855,7 @@ Instead of GNU Binutils, you will need to install LLVM 13.0.1, or later, and cop @file{bin/llvm-ar} to both @file{bin/amdgcn-amdhsa-ar} and @file{bin/amdgcn-amdhsa-ranlib}. -Use Newlib (3.2.0, or newer). +Use Newlib (4.3.0 or newer). To run the binaries, install the HSA Runtime from the @uref{https://rocm.github.io,,ROCm Platform}, and use @@ -4672,7 +4672,7 @@ Instead of GNU binutils, you will need to install Tell GCC where to find it: @option{--with-build-time-tools=[install-nvptx-tools]/nvptx-none/bin}. -You will need newlib 3.1.0 or later. It can be +You will need newlib 4.3.0 or later. It can be automatically built together with GCC@. For this, add a symbolic link to nvptx-newlib's @file{newlib} directory to the directory containing the GCC sources. -- cgit v1.1 From d8dadbc9a5199bf7bac1ab7376b0f84f45e94350 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 6 Dec 2021 11:34:35 +0100 Subject: [PATCH 1/15] arm: Make mbranch-protection opts parsing common to AArch32/64 Hi all, This change refactors all the mbranch-protection option parsing code and types to make it common to both AArch32 and AArch64 backends. This change also pulls in some supporting types from AArch64 to make it common (aarch_parse_opt_result). The significant changes in this patch are the movement of all branch protection parsing routines from aarch64.c to aarch-common.c and supporting data types and static data structures. This patch also pre-declares variables and types required in the aarch32 back-end for moved variables for function sign scope and key to prepare for the impending series of patches that support parsing the feature mbranch-protection in the aarch32 back-end. gcc/ChangeLog: * common/config/aarch64/aarch64-common.cc: Include aarch-common.h. (all_architectures): Fix comment. (aarch64_parse_extension): Rename return type, enum value names. * config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Rename factored out aarch_ra_sign_scope and aarch_ra_sign_key variables. Also rename corresponding enum values. * config/aarch64/aarch64-opts.h (aarch64_function_type): Factor out aarch64_function_type and move it to common code as aarch_function_type in aarch-common.h. * config/aarch64/aarch64-protos.h: Include common types header, move out types aarch64_parse_opt_result and aarch64_key_type to aarch-common.h * config/aarch64/aarch64.cc: Move mbranch-protection parsing types and functions out into aarch-common.h and aarch-common.cc. Fix up all the name changes resulting from the move. * config/aarch64/aarch64.md: Fix up aarch64_ra_sign_key type name change and enum value. * config/aarch64/aarch64.opt: Include aarch-common.h to import type move. Fix up name changes from factoring out common code and data. * config/arm/aarch-common-protos.h: Export factored out routines to both backends. * config/arm/aarch-common.cc: Include newly factored out types. Move all mbranch-protection code and data structures from aarch64.cc. * config/arm/aarch-common.h: New header that declares types shared between aarch32 and aarch64 backends. * config/arm/arm-protos.h: Declare types and variables that are made common to aarch64 and aarch32 backends - aarch_ra_sign_key, aarch_ra_sign_scope and aarch_enable_bti. * config/arm/arm.opt (config/arm/aarch-common.h): Include header. (aarch_ra_sign_scope, aarch_enable_bti): Declare variable. * config/arm/arm.cc: Add missing includes. Co-Authored-By: Tejas Belagod --- gcc/common/config/aarch64/aarch64-common.cc | 13 +- gcc/config/aarch64/aarch64-c.cc | 8 +- gcc/config/aarch64/aarch64-opts.h | 10 - gcc/config/aarch64/aarch64-protos.h | 21 +- gcc/config/aarch64/aarch64.cc | 360 +++++++--------------------- gcc/config/aarch64/aarch64.md | 2 +- gcc/config/aarch64/aarch64.opt | 15 +- gcc/config/arm/aarch-common-protos.h | 6 + gcc/config/arm/aarch-common.cc | 185 ++++++++++++++ gcc/config/arm/aarch-common.h | 73 ++++++ gcc/config/arm/arm-protos.h | 2 + gcc/config/arm/arm.cc | 7 + gcc/config/arm/arm.opt | 9 + 13 files changed, 390 insertions(+), 321 deletions(-) create mode 100644 gcc/config/arm/aarch-common.h (limited to 'gcc') diff --git a/gcc/common/config/aarch64/aarch64-common.cc b/gcc/common/config/aarch64/aarch64-common.cc index a9695d6..5fb9e9d 100644 --- a/gcc/common/config/aarch64/aarch64-common.cc +++ b/gcc/common/config/aarch64/aarch64-common.cc @@ -31,6 +31,7 @@ #include "flags.h" #include "diagnostic.h" #include "config/aarch64/aarch64-feature-deps.h" +#include "config/arm/aarch-common.h" #ifdef TARGET_BIG_ENDIAN_DEFAULT #undef TARGET_DEFAULT_TARGET_FLAGS @@ -191,13 +192,13 @@ static constexpr arch_to_arch_name all_architectures[] = /* Parse the architecture extension string STR and update ISA_FLAGS with the architecture features turned on or off. Return a - aarch64_parse_opt_result describing the result. + aarch_parse_opt_result describing the result. When the STR string contains an invalid extension, a copy of the string is created and stored to INVALID_EXTENSION. */ -enum aarch64_parse_opt_result +enum aarch_parse_opt_result aarch64_parse_extension (const char *str, aarch64_feature_flags *isa_flags, - std::string *invalid_extension) + std::string *invalid_extension) { /* The extension string is parsed left to right. */ const struct aarch64_option_extension *opt = NULL; @@ -228,7 +229,7 @@ aarch64_parse_extension (const char *str, aarch64_feature_flags *isa_flags, adding_ext = 1; if (len == 0) - return AARCH64_PARSE_MISSING_ARG; + return AARCH_PARSE_MISSING_ARG; /* Scan over the extensions table trying to find an exact match. */ @@ -250,13 +251,13 @@ aarch64_parse_extension (const char *str, aarch64_feature_flags *isa_flags, /* Extension not found in list. */ if (invalid_extension) *invalid_extension = std::string (str, len); - return AARCH64_PARSE_INVALID_FEATURE; + return AARCH_PARSE_INVALID_FEATURE; } str = ext; }; - return AARCH64_PARSE_OK; + return AARCH_PARSE_OK; } /* Append all architecture extension candidates to the CANDIDATES vector. */ diff --git a/gcc/config/aarch64/aarch64-c.cc b/gcc/config/aarch64/aarch64-c.cc index 4df6cc6..a016ee0 100644 --- a/gcc/config/aarch64/aarch64-c.cc +++ b/gcc/config/aarch64/aarch64-c.cc @@ -183,14 +183,14 @@ aarch64_update_cpp_builtins (cpp_reader *pfile) "__ARM_FEATURE_BTI_DEFAULT", pfile); cpp_undef (pfile, "__ARM_FEATURE_PAC_DEFAULT"); - if (aarch64_ra_sign_scope != AARCH64_FUNCTION_NONE) + if (aarch_ra_sign_scope != AARCH_FUNCTION_NONE) { int v = 0; - if (aarch64_ra_sign_key == AARCH64_KEY_A) + if (aarch_ra_sign_key == AARCH_KEY_A) v |= 1; - if (aarch64_ra_sign_key == AARCH64_KEY_B) + if (aarch_ra_sign_key == AARCH_KEY_B) v |= 2; - if (aarch64_ra_sign_scope == AARCH64_FUNCTION_ALL) + if (aarch_ra_sign_scope == AARCH_FUNCTION_ALL) v |= 4; builtin_define_with_int_value ("__ARM_FEATURE_PAC_DEFAULT", v); } diff --git a/gcc/config/aarch64/aarch64-opts.h b/gcc/config/aarch64/aarch64-opts.h index c4431e7..a9f3e27 100644 --- a/gcc/config/aarch64/aarch64-opts.h +++ b/gcc/config/aarch64/aarch64-opts.h @@ -75,16 +75,6 @@ enum aarch64_code_model { AARCH64_CMODEL_LARGE }; -/* Function types -msign-return-address should sign. */ -enum aarch64_function_type { - /* Don't sign any function. */ - AARCH64_FUNCTION_NONE, - /* Non-leaf functions. */ - AARCH64_FUNCTION_NON_LEAF, - /* All functions. */ - AARCH64_FUNCTION_ALL -}; - /* SVE vector register sizes. */ enum aarch64_sve_vector_bits_enum { SVE_SCALABLE, diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index b57e7a9..9bd8bfe 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -23,6 +23,7 @@ #define GCC_AARCH64_PROTOS_H #include "input.h" +#include "config/arm/aarch-common.h" /* SYMBOL_SMALL_ABSOLUTE: Generate symbol accesses through high and lo relocs that calculate the base address using a PC @@ -651,18 +652,6 @@ enum aarch64_extra_tuning_flags AARCH64_EXTRA_TUNE_ALL = (1u << AARCH64_EXTRA_TUNE_index_END) - 1 }; -/* Enum describing the various ways that the - aarch64_parse_{arch,tune,cpu,extension} functions can fail. - This way their callers can choose what kind of error to give. */ - -enum aarch64_parse_opt_result -{ - AARCH64_PARSE_OK, /* Parsing was successful. */ - AARCH64_PARSE_MISSING_ARG, /* Missing argument. */ - AARCH64_PARSE_INVALID_FEATURE, /* Invalid feature modifier. */ - AARCH64_PARSE_INVALID_ARG /* Invalid arch, tune, cpu arg. */ -}; - /* Enum to distinguish which type of check is to be done in aarch64_simd_valid_immediate. This is used as a bitmask where AARCH64_CHECK_MOV has both bits set. Thus AARCH64_CHECK_MOV will @@ -673,6 +662,8 @@ enum simd_immediate_check { AARCH64_CHECK_MOV = AARCH64_CHECK_ORR | AARCH64_CHECK_BIC }; +extern enum aarch_key_type aarch_ra_sign_key; + extern struct tune_params aarch64_tune_params; /* The available SVE predicate patterns, known in the ACLE as "svpattern". */ @@ -1038,9 +1029,9 @@ void aarch64_set_asm_isa_flags (gcc_options *, aarch64_feature_flags); bool aarch64_handle_option (struct gcc_options *, struct gcc_options *, const struct cl_decoded_option *, location_t); const char *aarch64_rewrite_selected_cpu (const char *name); -enum aarch64_parse_opt_result aarch64_parse_extension (const char *, - aarch64_feature_flags *, - std::string *); +enum aarch_parse_opt_result aarch64_parse_extension (const char *, + aarch64_feature_flags *, + std::string *); void aarch64_get_all_extension_candidates (auto_vec *candidates); std::string aarch64_get_extension_string_for_isa_flags (aarch64_feature_flags, aarch64_feature_flags); diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index d55c250..a482d93 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -82,6 +82,8 @@ #include "tree-dfa.h" #include "asan.h" #include "aarch64-feature-deps.h" +#include "config/arm/aarch-common.h" +#include "config/arm/aarch-common-protos.h" /* This file should be included last. */ #include "target-def.h" @@ -318,12 +320,8 @@ bool aarch64_pcrelative_literal_loads; /* Global flag for whether frame pointer is enabled. */ bool aarch64_use_frame_pointer; -#define BRANCH_PROTECT_STR_MAX 255 char *accepted_branch_protection_string = NULL; -static enum aarch64_parse_opt_result -aarch64_parse_branch_protection (const char*, char**); - /* Support for command line parsing of boolean flags in the tuning structures. */ struct aarch64_flag_desc @@ -2761,6 +2759,8 @@ static const struct processor all_cores[] = {NULL, aarch64_none, aarch64_none, aarch64_no_arch, 0, NULL} }; +enum aarch_key_type aarch_ra_sign_key = AARCH_KEY_A; + /* The current tuning set. */ struct tune_params aarch64_tune_params = generic_tunings; @@ -2826,100 +2826,6 @@ aarch64_cc; #define AARCH64_INVERSE_CONDITION_CODE(X) ((aarch64_cc) (((int) X) ^ 1)) -struct aarch64_branch_protect_type -{ - /* The type's name that the user passes to the branch-protection option - string. */ - const char* name; - /* Function to handle the protection type and set global variables. - First argument is the string token corresponding with this type and the - second argument is the next token in the option string. - Return values: - * AARCH64_PARSE_OK: Handling was sucessful. - * AARCH64_INVALID_ARG: The type is invalid in this context and the caller - should print an error. - * AARCH64_INVALID_FEATURE: The type is invalid and the handler prints its - own error. */ - enum aarch64_parse_opt_result (*handler)(char*, char*); - /* A list of types that can follow this type in the option string. */ - const aarch64_branch_protect_type* subtypes; - unsigned int num_subtypes; -}; - -static enum aarch64_parse_opt_result -aarch64_handle_no_branch_protection (char* str, char* rest) -{ - aarch64_ra_sign_scope = AARCH64_FUNCTION_NONE; - aarch64_enable_bti = 0; - if (rest) - { - error ("unexpected %<%s%> after %<%s%>", rest, str); - return AARCH64_PARSE_INVALID_FEATURE; - } - return AARCH64_PARSE_OK; -} - -static enum aarch64_parse_opt_result -aarch64_handle_standard_branch_protection (char* str, char* rest) -{ - aarch64_ra_sign_scope = AARCH64_FUNCTION_NON_LEAF; - aarch64_ra_sign_key = AARCH64_KEY_A; - aarch64_enable_bti = 1; - if (rest) - { - error ("unexpected %<%s%> after %<%s%>", rest, str); - return AARCH64_PARSE_INVALID_FEATURE; - } - return AARCH64_PARSE_OK; -} - -static enum aarch64_parse_opt_result -aarch64_handle_pac_ret_protection (char* str ATTRIBUTE_UNUSED, - char* rest ATTRIBUTE_UNUSED) -{ - aarch64_ra_sign_scope = AARCH64_FUNCTION_NON_LEAF; - aarch64_ra_sign_key = AARCH64_KEY_A; - return AARCH64_PARSE_OK; -} - -static enum aarch64_parse_opt_result -aarch64_handle_pac_ret_leaf (char* str ATTRIBUTE_UNUSED, - char* rest ATTRIBUTE_UNUSED) -{ - aarch64_ra_sign_scope = AARCH64_FUNCTION_ALL; - return AARCH64_PARSE_OK; -} - -static enum aarch64_parse_opt_result -aarch64_handle_pac_ret_b_key (char* str ATTRIBUTE_UNUSED, - char* rest ATTRIBUTE_UNUSED) -{ - aarch64_ra_sign_key = AARCH64_KEY_B; - return AARCH64_PARSE_OK; -} - -static enum aarch64_parse_opt_result -aarch64_handle_bti_protection (char* str ATTRIBUTE_UNUSED, - char* rest ATTRIBUTE_UNUSED) -{ - aarch64_enable_bti = 1; - return AARCH64_PARSE_OK; -} - -static const struct aarch64_branch_protect_type aarch64_pac_ret_subtypes[] = { - { "leaf", aarch64_handle_pac_ret_leaf, NULL, 0 }, - { "b-key", aarch64_handle_pac_ret_b_key, NULL, 0 }, - { NULL, NULL, NULL, 0 } -}; - -static const struct aarch64_branch_protect_type aarch64_branch_protect_types[] = { - { "none", aarch64_handle_no_branch_protection, NULL, 0 }, - { "standard", aarch64_handle_standard_branch_protection, NULL, 0 }, - { "pac-ret", aarch64_handle_pac_ret_protection, aarch64_pac_ret_subtypes, - ARRAY_SIZE (aarch64_pac_ret_subtypes) }, - { "bti", aarch64_handle_bti_protection, NULL, 0 }, - { NULL, NULL, NULL, 0 } -}; /* The condition codes of the processor, and the inverse function. */ static const char * const aarch64_condition_codes[] = @@ -9020,10 +8926,10 @@ aarch64_return_address_signing_enabled (void) if (crtl->calls_eh_return) return false; - /* If signing scope is AARCH64_FUNCTION_NON_LEAF, we only sign a leaf function + /* If signing scope is AARCH_FUNCTION_NON_LEAF, we only sign a leaf function if its LR is pushed onto stack. */ - return (aarch64_ra_sign_scope == AARCH64_FUNCTION_ALL - || (aarch64_ra_sign_scope == AARCH64_FUNCTION_NON_LEAF + return (aarch_ra_sign_scope == AARCH_FUNCTION_ALL + || (aarch_ra_sign_scope == AARCH_FUNCTION_NON_LEAF && known_ge (cfun->machine->frame.reg_offset[LR_REGNUM], 0))); } @@ -9031,7 +8937,7 @@ aarch64_return_address_signing_enabled (void) bool aarch64_bti_enabled (void) { - return (aarch64_enable_bti == 1); + return (aarch_enable_bti == 1); } /* The caller is going to use ST1D or LD1D to save or restore an SVE @@ -10023,12 +9929,12 @@ aarch64_expand_prologue (void) /* Sign return address for functions. */ if (aarch64_return_address_signing_enabled ()) { - switch (aarch64_ra_sign_key) + switch (aarch_ra_sign_key) { - case AARCH64_KEY_A: + case AARCH_KEY_A: insn = emit_insn (gen_paciasp ()); break; - case AARCH64_KEY_B: + case AARCH_KEY_B: insn = emit_insn (gen_pacibsp ()); break; default: @@ -10329,12 +10235,12 @@ aarch64_expand_epilogue (bool for_sibcall) if (aarch64_return_address_signing_enabled () && (for_sibcall || !TARGET_ARMV8_3)) { - switch (aarch64_ra_sign_key) + switch (aarch_ra_sign_key) { - case AARCH64_KEY_A: + case AARCH_KEY_A: insn = emit_insn (gen_autiasp ()); break; - case AARCH64_KEY_B: + case AARCH_KEY_B: insn = emit_insn (gen_autibsp ()); break; default: @@ -17359,12 +17265,12 @@ static void initialize_aarch64_code_model (struct gcc_options *); /* Parse the TO_PARSE string and put the architecture struct that it selects into RES and the architectural features into ISA_FLAGS. - Return an aarch64_parse_opt_result describing the parse result. + Return an aarch_parse_opt_result describing the parse result. If there is an error parsing, RES and ISA_FLAGS are left unchanged. When the TO_PARSE string contains an invalid extension, a copy of the string is created and stored to INVALID_EXTENSION. */ -static enum aarch64_parse_opt_result +static enum aarch_parse_opt_result aarch64_parse_arch (const char *to_parse, const struct processor **res, aarch64_feature_flags *isa_flags, std::string *invalid_extension) @@ -17381,7 +17287,7 @@ aarch64_parse_arch (const char *to_parse, const struct processor **res, len = strlen (to_parse); if (len == 0) - return AARCH64_PARSE_MISSING_ARG; + return AARCH_PARSE_MISSING_ARG; /* Loop through the list of supported ARCHes to find a match. */ @@ -17395,32 +17301,32 @@ aarch64_parse_arch (const char *to_parse, const struct processor **res, if (ext != NULL) { /* TO_PARSE string contains at least one extension. */ - enum aarch64_parse_opt_result ext_res + enum aarch_parse_opt_result ext_res = aarch64_parse_extension (ext, &isa_temp, invalid_extension); - if (ext_res != AARCH64_PARSE_OK) + if (ext_res != AARCH_PARSE_OK) return ext_res; } /* Extension parsing was successful. Confirm the result arch and ISA flags. */ *res = arch; *isa_flags = isa_temp; - return AARCH64_PARSE_OK; + return AARCH_PARSE_OK; } } /* ARCH name not found in list. */ - return AARCH64_PARSE_INVALID_ARG; + return AARCH_PARSE_INVALID_ARG; } /* Parse the TO_PARSE string and put the result tuning in RES and the - architecture flags in ISA_FLAGS. Return an aarch64_parse_opt_result + architecture flags in ISA_FLAGS. Return an aarch_parse_opt_result describing the parse result. If there is an error parsing, RES and ISA_FLAGS are left unchanged. When the TO_PARSE string contains an invalid extension, a copy of the string is created and stored to INVALID_EXTENSION. */ -static enum aarch64_parse_opt_result +static enum aarch_parse_opt_result aarch64_parse_cpu (const char *to_parse, const struct processor **res, aarch64_feature_flags *isa_flags, std::string *invalid_extension) @@ -17437,7 +17343,7 @@ aarch64_parse_cpu (const char *to_parse, const struct processor **res, len = strlen (to_parse); if (len == 0) - return AARCH64_PARSE_MISSING_ARG; + return AARCH_PARSE_MISSING_ARG; /* Loop through the list of supported CPUs to find a match. */ @@ -17450,29 +17356,29 @@ aarch64_parse_cpu (const char *to_parse, const struct processor **res, if (ext != NULL) { /* TO_PARSE string contains at least one extension. */ - enum aarch64_parse_opt_result ext_res + enum aarch_parse_opt_result ext_res = aarch64_parse_extension (ext, &isa_temp, invalid_extension); - if (ext_res != AARCH64_PARSE_OK) + if (ext_res != AARCH_PARSE_OK) return ext_res; } /* Extension parsing was successfull. Confirm the result cpu and ISA flags. */ *res = cpu; *isa_flags = isa_temp; - return AARCH64_PARSE_OK; + return AARCH_PARSE_OK; } } /* CPU name not found in list. */ - return AARCH64_PARSE_INVALID_ARG; + return AARCH_PARSE_INVALID_ARG; } /* Parse the TO_PARSE string and put the cpu it selects into RES. - Return an aarch64_parse_opt_result describing the parse result. + Return an aarch_parse_opt_result describing the parse result. If the parsing fails the RES does not change. */ -static enum aarch64_parse_opt_result +static enum aarch_parse_opt_result aarch64_parse_tune (const char *to_parse, const struct processor **res) { const struct processor *cpu; @@ -17483,12 +17389,12 @@ aarch64_parse_tune (const char *to_parse, const struct processor **res) if (strcmp (cpu->name, to_parse) == 0) { *res = cpu; - return AARCH64_PARSE_OK; + return AARCH_PARSE_OK; } } /* CPU name not found in list. */ - return AARCH64_PARSE_INVALID_ARG; + return AARCH_PARSE_INVALID_ARG; } /* Parse TOKEN, which has length LENGTH to see if it is an option @@ -18079,22 +17985,22 @@ aarch64_validate_mcpu (const char *str, const struct processor **res, aarch64_feature_flags *isa_flags) { std::string invalid_extension; - enum aarch64_parse_opt_result parse_res + enum aarch_parse_opt_result parse_res = aarch64_parse_cpu (str, res, isa_flags, &invalid_extension); - if (parse_res == AARCH64_PARSE_OK) + if (parse_res == AARCH_PARSE_OK) return true; switch (parse_res) { - case AARCH64_PARSE_MISSING_ARG: + case AARCH_PARSE_MISSING_ARG: error ("missing cpu name in %<-mcpu=%s%>", str); break; - case AARCH64_PARSE_INVALID_ARG: + case AARCH_PARSE_INVALID_ARG: error ("unknown value %qs for %<-mcpu%>", str); aarch64_print_hint_for_core (str); break; - case AARCH64_PARSE_INVALID_FEATURE: + case AARCH_PARSE_INVALID_FEATURE: error ("invalid feature modifier %qs in %<-mcpu=%s%>", invalid_extension.c_str (), str); aarch64_print_hint_for_extensions (invalid_extension); @@ -18179,110 +18085,6 @@ aarch64_validate_sls_mitigation (const char *const_str) free (str_root); } -/* Parses CONST_STR for branch protection features specified in - aarch64_branch_protect_types, and set any global variables required. Returns - the parsing result and assigns LAST_STR to the last processed token from - CONST_STR so that it can be used for error reporting. */ - -static enum -aarch64_parse_opt_result aarch64_parse_branch_protection (const char *const_str, - char** last_str) -{ - char *str_root = xstrdup (const_str); - char* token_save = NULL; - char *str = strtok_r (str_root, "+", &token_save); - enum aarch64_parse_opt_result res = AARCH64_PARSE_OK; - if (!str) - res = AARCH64_PARSE_MISSING_ARG; - else - { - char *next_str = strtok_r (NULL, "+", &token_save); - /* Reset the branch protection features to their defaults. */ - aarch64_handle_no_branch_protection (NULL, NULL); - - while (str && res == AARCH64_PARSE_OK) - { - const aarch64_branch_protect_type* type = aarch64_branch_protect_types; - bool found = false; - /* Search for this type. */ - while (type && type->name && !found && res == AARCH64_PARSE_OK) - { - if (strcmp (str, type->name) == 0) - { - found = true; - res = type->handler (str, next_str); - str = next_str; - next_str = strtok_r (NULL, "+", &token_save); - } - else - type++; - } - if (found && res == AARCH64_PARSE_OK) - { - bool found_subtype = true; - /* Loop through each token until we find one that isn't a - subtype. */ - while (found_subtype) - { - found_subtype = false; - const aarch64_branch_protect_type *subtype = type->subtypes; - /* Search for the subtype. */ - while (str && subtype && subtype->name && !found_subtype - && res == AARCH64_PARSE_OK) - { - if (strcmp (str, subtype->name) == 0) - { - found_subtype = true; - res = subtype->handler (str, next_str); - str = next_str; - next_str = strtok_r (NULL, "+", &token_save); - } - else - subtype++; - } - } - } - else if (!found) - res = AARCH64_PARSE_INVALID_ARG; - } - } - /* Copy the last processed token into the argument to pass it back. - Used by option and attribute validation to print the offending token. */ - if (last_str) - { - if (str) strcpy (*last_str, str); - else *last_str = NULL; - } - if (res == AARCH64_PARSE_OK) - { - /* If needed, alloc the accepted string then copy in const_str. - Used by override_option_after_change_1. */ - if (!accepted_branch_protection_string) - accepted_branch_protection_string = (char *) xmalloc ( - BRANCH_PROTECT_STR_MAX - + 1); - strncpy (accepted_branch_protection_string, const_str, - BRANCH_PROTECT_STR_MAX + 1); - /* Forcibly null-terminate. */ - accepted_branch_protection_string[BRANCH_PROTECT_STR_MAX] = '\0'; - } - return res; -} - -static bool -aarch64_validate_mbranch_protection (const char *const_str) -{ - char *str = (char *) xmalloc (strlen (const_str)); - enum aarch64_parse_opt_result res = - aarch64_parse_branch_protection (const_str, &str); - if (res == AARCH64_PARSE_INVALID_ARG) - error ("invalid argument %<%s%> for %<-mbranch-protection=%>", str); - else if (res == AARCH64_PARSE_MISSING_ARG) - error ("missing argument for %<-mbranch-protection=%>"); - free (str); - return res == AARCH64_PARSE_OK; -} - /* Validate a command-line -march option. Parse the arch and extensions (if any) specified in STR and throw errors if appropriate. Put the results, if they are valid, in RES and ISA_FLAGS. Return whether the @@ -18293,27 +18095,27 @@ aarch64_validate_march (const char *str, const struct processor **res, aarch64_feature_flags *isa_flags) { std::string invalid_extension; - enum aarch64_parse_opt_result parse_res + enum aarch_parse_opt_result parse_res = aarch64_parse_arch (str, res, isa_flags, &invalid_extension); - if (parse_res == AARCH64_PARSE_OK) + if (parse_res == AARCH_PARSE_OK) return true; switch (parse_res) { - case AARCH64_PARSE_MISSING_ARG: + case AARCH_PARSE_MISSING_ARG: error ("missing arch name in %<-march=%s%>", str); break; - case AARCH64_PARSE_INVALID_ARG: + case AARCH_PARSE_INVALID_ARG: error ("unknown value %qs for %<-march%>", str); aarch64_print_hint_for_arch (str); /* A common user error is confusing -march and -mcpu. If the -march string matches a known CPU suggest -mcpu. */ parse_res = aarch64_parse_cpu (str, res, isa_flags, &invalid_extension); - if (parse_res == AARCH64_PARSE_OK) + if (parse_res == AARCH_PARSE_OK) inform (input_location, "did you mean %<-mcpu=%s%>?", str); break; - case AARCH64_PARSE_INVALID_FEATURE: + case AARCH_PARSE_INVALID_FEATURE: error ("invalid feature modifier %qs in %<-march=%s%>", invalid_extension.c_str (), str); aarch64_print_hint_for_extensions (invalid_extension); @@ -18333,18 +18135,18 @@ aarch64_validate_march (const char *str, const struct processor **res, static bool aarch64_validate_mtune (const char *str, const struct processor **res) { - enum aarch64_parse_opt_result parse_res + enum aarch_parse_opt_result parse_res = aarch64_parse_tune (str, res); - if (parse_res == AARCH64_PARSE_OK) + if (parse_res == AARCH_PARSE_OK) return true; switch (parse_res) { - case AARCH64_PARSE_MISSING_ARG: + case AARCH_PARSE_MISSING_ARG: error ("missing cpu name in %<-mtune=%s%>", str); break; - case AARCH64_PARSE_INVALID_ARG: + case AARCH_PARSE_INVALID_ARG: error ("unknown value %qs for %<-mtune%>", str); aarch64_print_hint_for_core (str); break; @@ -18406,7 +18208,7 @@ aarch64_override_options (void) aarch64_validate_sls_mitigation (aarch64_harden_sls_string); if (aarch64_branch_protection_string) - aarch64_validate_mbranch_protection (aarch64_branch_protection_string); + aarch_validate_mbranch_protection (aarch64_branch_protection_string); /* -mcpu=CPU is shorthand for -march=ARCH_FOR_CPU, -mtune=CPU. If either of -march or -mtune is given, they override their @@ -18459,12 +18261,12 @@ aarch64_override_options (void) selected_tune = tune ? tune->ident : cpu->ident; - if (aarch64_enable_bti == 2) + if (aarch_enable_bti == 2) { #ifdef TARGET_ENABLE_BTI - aarch64_enable_bti = 1; + aarch_enable_bti = 1; #else - aarch64_enable_bti = 0; + aarch_enable_bti = 0; #endif } @@ -18474,9 +18276,9 @@ aarch64_override_options (void) if (!TARGET_ILP32 && accepted_branch_protection_string == NULL) { #ifdef TARGET_ENABLE_PAC_RET - aarch64_ra_sign_scope = AARCH64_FUNCTION_NON_LEAF; + aarch_ra_sign_scope = AARCH_FUNCTION_NON_LEAF; #else - aarch64_ra_sign_scope = AARCH64_FUNCTION_NONE; + aarch_ra_sign_scope = AARCH_FUNCTION_NONE; #endif } @@ -18490,7 +18292,7 @@ aarch64_override_options (void) /* Convert -msve-vector-bits to a VG count. */ aarch64_sve_vg = aarch64_convert_sve_vector_bits (aarch64_sve_vector_bits); - if (aarch64_ra_sign_scope != AARCH64_FUNCTION_NONE && TARGET_ILP32) + if (aarch_ra_sign_scope != AARCH_FUNCTION_NONE && TARGET_ILP32) sorry ("return address signing is only supported for %<-mabi=lp64%>"); /* The pass to insert speculation tracking runs before @@ -18705,10 +18507,10 @@ aarch64_handle_attr_arch (const char *str) const struct processor *tmp_arch = NULL; std::string invalid_extension; aarch64_feature_flags tmp_flags; - enum aarch64_parse_opt_result parse_res + enum aarch_parse_opt_result parse_res = aarch64_parse_arch (str, &tmp_arch, &tmp_flags, &invalid_extension); - if (parse_res == AARCH64_PARSE_OK) + if (parse_res == AARCH_PARSE_OK) { gcc_assert (tmp_arch); selected_arch = tmp_arch->arch; @@ -18718,14 +18520,14 @@ aarch64_handle_attr_arch (const char *str) switch (parse_res) { - case AARCH64_PARSE_MISSING_ARG: + case AARCH_PARSE_MISSING_ARG: error ("missing name in % pragma or attribute"); break; - case AARCH64_PARSE_INVALID_ARG: + case AARCH_PARSE_INVALID_ARG: error ("invalid name %qs in % pragma or attribute", str); aarch64_print_hint_for_arch (str); break; - case AARCH64_PARSE_INVALID_FEATURE: + case AARCH_PARSE_INVALID_FEATURE: error ("invalid feature modifier %s of value %qs in " "% pragma or attribute", invalid_extension.c_str (), str); aarch64_print_hint_for_extensions (invalid_extension); @@ -18745,10 +18547,10 @@ aarch64_handle_attr_cpu (const char *str) const struct processor *tmp_cpu = NULL; std::string invalid_extension; aarch64_feature_flags tmp_flags; - enum aarch64_parse_opt_result parse_res + enum aarch_parse_opt_result parse_res = aarch64_parse_cpu (str, &tmp_cpu, &tmp_flags, &invalid_extension); - if (parse_res == AARCH64_PARSE_OK) + if (parse_res == AARCH_PARSE_OK) { gcc_assert (tmp_cpu); selected_tune = tmp_cpu->ident; @@ -18759,14 +18561,14 @@ aarch64_handle_attr_cpu (const char *str) switch (parse_res) { - case AARCH64_PARSE_MISSING_ARG: + case AARCH_PARSE_MISSING_ARG: error ("missing name in % pragma or attribute"); break; - case AARCH64_PARSE_INVALID_ARG: + case AARCH_PARSE_INVALID_ARG: error ("invalid name %qs in % pragma or attribute", str); aarch64_print_hint_for_core (str); break; - case AARCH64_PARSE_INVALID_FEATURE: + case AARCH_PARSE_INVALID_FEATURE: error ("invalid feature modifier %qs of value %qs in " "% pragma or attribute", invalid_extension.c_str (), str); aarch64_print_hint_for_extensions (invalid_extension); @@ -18784,23 +18586,23 @@ aarch64_handle_attr_cpu (const char *str) aarch64_handle_attr_branch_protection (const char* str) { char *err_str = (char *) xmalloc (strlen (str) + 1); - enum aarch64_parse_opt_result res = aarch64_parse_branch_protection (str, - &err_str); + enum aarch_parse_opt_result res = aarch_parse_branch_protection (str, + &err_str); bool success = false; switch (res) { - case AARCH64_PARSE_MISSING_ARG: + case AARCH_PARSE_MISSING_ARG: error ("missing argument to % pragma or" " attribute"); break; - case AARCH64_PARSE_INVALID_ARG: + case AARCH_PARSE_INVALID_ARG: error ("invalid protection type %qs in % pragma or attribute", err_str); break; - case AARCH64_PARSE_OK: + case AARCH_PARSE_OK: success = true; /* Fall through. */ - case AARCH64_PARSE_INVALID_FEATURE: + case AARCH_PARSE_INVALID_FEATURE: break; default: gcc_unreachable (); @@ -18815,10 +18617,10 @@ static bool aarch64_handle_attr_tune (const char *str) { const struct processor *tmp_tune = NULL; - enum aarch64_parse_opt_result parse_res + enum aarch_parse_opt_result parse_res = aarch64_parse_tune (str, &tmp_tune); - if (parse_res == AARCH64_PARSE_OK) + if (parse_res == AARCH_PARSE_OK) { gcc_assert (tmp_tune); selected_tune = tmp_tune->ident; @@ -18827,7 +18629,7 @@ aarch64_handle_attr_tune (const char *str) switch (parse_res) { - case AARCH64_PARSE_INVALID_ARG: + case AARCH_PARSE_INVALID_ARG: error ("invalid name %qs in % pragma or attribute", str); aarch64_print_hint_for_core (str); break; @@ -18846,7 +18648,7 @@ aarch64_handle_attr_tune (const char *str) static bool aarch64_handle_attr_isa_flags (char *str) { - enum aarch64_parse_opt_result parse_res; + enum aarch_parse_opt_result parse_res; auto isa_flags = aarch64_asm_isa_flags; /* We allow "+nothing" in the beginning to clear out all architectural @@ -18860,7 +18662,7 @@ aarch64_handle_attr_isa_flags (char *str) std::string invalid_extension; parse_res = aarch64_parse_extension (str, &isa_flags, &invalid_extension); - if (parse_res == AARCH64_PARSE_OK) + if (parse_res == AARCH_PARSE_OK) { aarch64_set_asm_isa_flags (isa_flags); return true; @@ -18868,11 +18670,11 @@ aarch64_handle_attr_isa_flags (char *str) switch (parse_res) { - case AARCH64_PARSE_MISSING_ARG: + case AARCH_PARSE_MISSING_ARG: error ("missing value in % pragma or attribute"); break; - case AARCH64_PARSE_INVALID_FEATURE: + case AARCH_PARSE_INVALID_FEATURE: error ("invalid feature modifier %qs of value %qs in " "% pragma or attribute", invalid_extension.c_str (), str); break; @@ -19121,10 +18923,10 @@ aarch64_process_target_attr (tree args) leading '+'. */ aarch64_feature_flags isa_temp = 0; auto with_plus = std::string ("+") + token; - enum aarch64_parse_opt_result ext_res + enum aarch_parse_opt_result ext_res = aarch64_parse_extension (with_plus.c_str (), &isa_temp, nullptr); - if (ext_res == AARCH64_PARSE_OK) + if (ext_res == AARCH_PARSE_OK) error ("arch extension %<%s%> should be prefixed by %<+%>", token); else @@ -22896,7 +22698,7 @@ void aarch64_post_cfi_startproc (FILE *f, tree ignored ATTRIBUTE_UNUSED) { if (cfun->machine->frame.laid_out && aarch64_return_address_signing_enabled () - && aarch64_ra_sign_key == AARCH64_KEY_B) + && aarch_ra_sign_key == AARCH_KEY_B) asm_fprintf (f, "\t.cfi_b_key_frame\n"); } @@ -27308,7 +27110,7 @@ aarch64_file_end_indicate_exec_stack () if (aarch64_bti_enabled ()) feature_1_and |= GNU_PROPERTY_AARCH64_FEATURE_1_BTI; - if (aarch64_ra_sign_scope != AARCH64_FUNCTION_NONE) + if (aarch_ra_sign_scope != AARCH_FUNCTION_NONE) feature_1_and |= GNU_PROPERTY_AARCH64_FEATURE_1_PAC; if (feature_1_and) diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 2c13679..e4d7587 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -891,7 +891,7 @@ if (aarch64_return_address_signing_enabled () && (TARGET_PAUTH)) { - if (aarch64_ra_sign_key == AARCH64_KEY_B) + if (aarch_ra_sign_key == AARCH_KEY_B) ret = "retab"; else ret = "retaa"; diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt index 070d7f1..137e506 100644 --- a/gcc/config/aarch64/aarch64.opt +++ b/gcc/config/aarch64/aarch64.opt @@ -21,6 +21,9 @@ HeaderInclude config/aarch64/aarch64-opts.h +HeaderInclude +config/arm/aarch-common.h + TargetVariable enum aarch64_processor selected_tune = aarch64_none @@ -34,7 +37,7 @@ TargetVariable aarch64_feature_flags aarch64_isa_flags = 0 TargetVariable -unsigned aarch64_enable_bti = 2 +unsigned aarch_enable_bti = 2 TargetVariable enum aarch64_key_type aarch64_ra_sign_key = AARCH64_KEY_A @@ -164,21 +167,21 @@ Target RejectNegative Joined Var(aarch64_branch_protection_string) Save Use branch-protection features. msign-return-address= -Target WarnRemoved RejectNegative Joined Enum(aarch64_ra_sign_scope_t) Var(aarch64_ra_sign_scope) Init(AARCH64_FUNCTION_NONE) Save +Target WarnRemoved RejectNegative Joined Enum(aarch_ra_sign_scope_t) Var(aarch_ra_sign_scope) Init(AARCH_FUNCTION_NONE) Save Select return address signing scope. Enum -Name(aarch64_ra_sign_scope_t) Type(enum aarch64_function_type) +Name(aarch_ra_sign_scope_t) Type(enum aarch_function_type) Supported AArch64 return address signing scope (for use with -msign-return-address= option): EnumValue -Enum(aarch64_ra_sign_scope_t) String(none) Value(AARCH64_FUNCTION_NONE) +Enum(aarch_ra_sign_scope_t) String(none) Value(AARCH_FUNCTION_NONE) EnumValue -Enum(aarch64_ra_sign_scope_t) String(non-leaf) Value(AARCH64_FUNCTION_NON_LEAF) +Enum(aarch_ra_sign_scope_t) String(non-leaf) Value(AARCH_FUNCTION_NON_LEAF) EnumValue -Enum(aarch64_ra_sign_scope_t) String(all) Value(AARCH64_FUNCTION_ALL) +Enum(aarch_ra_sign_scope_t) String(all) Value(AARCH_FUNCTION_ALL) mlow-precision-recip-sqrt Target Var(flag_mrecip_low_precision_sqrt) Optimization diff --git a/gcc/config/arm/aarch-common-protos.h b/gcc/config/arm/aarch-common-protos.h index 5ea0ad2..f3d28f8 100644 --- a/gcc/config/arm/aarch-common-protos.h +++ b/gcc/config/arm/aarch-common-protos.h @@ -153,4 +153,10 @@ rtx_insn *arm_md_asm_adjust (vec &outputs, vec & /*inputs*/, vec &clobbers, HARD_REG_SET &clobbered_regs, location_t loc); +/* Parsing routine for branch-protection common to AArch64 and Arm. */ +enum aarch_parse_opt_result aarch_parse_branch_protection (const char*, char**); + +/* Validation routine for branch-protection common to AArch64 and Arm. */ +bool aarch_validate_mbranch_protection (const char *); + #endif /* GCC_AARCH_COMMON_PROTOS_H */ diff --git a/gcc/config/arm/aarch-common.cc b/gcc/config/arm/aarch-common.cc index 40bb28b..27e6c8f 100644 --- a/gcc/config/arm/aarch-common.cc +++ b/gcc/config/arm/aarch-common.cc @@ -36,6 +36,7 @@ #include "expr.h" #include "function.h" #include "emit-rtl.h" +#include "aarch-common.h" /* Return TRUE if X is either an arithmetic shift left, or is a multiplication by a power of two. */ @@ -657,3 +658,187 @@ arm_md_asm_adjust (vec &outputs, vec & /*inputs*/, return saw_asm_flag ? seq : NULL; } + +#define BRANCH_PROTECT_STR_MAX 255 +extern char *accepted_branch_protection_string; +extern enum aarch_key_type aarch_ra_sign_key; + +static enum aarch_parse_opt_result +aarch_handle_no_branch_protection (char* str, char* rest) +{ + aarch_ra_sign_scope = AARCH_FUNCTION_NONE; + aarch_enable_bti = 0; + if (rest) + { + error ("unexpected %<%s%> after %<%s%>", rest, str); + return AARCH_PARSE_INVALID_FEATURE; + } + return AARCH_PARSE_OK; +} + +static enum aarch_parse_opt_result +aarch_handle_standard_branch_protection (char* str, char* rest) +{ + aarch_ra_sign_scope = AARCH_FUNCTION_NON_LEAF; + aarch_ra_sign_key = AARCH_KEY_A; + aarch_enable_bti = 1; + if (rest) + { + error ("unexpected %<%s%> after %<%s%>", rest, str); + return AARCH_PARSE_INVALID_FEATURE; + } + return AARCH_PARSE_OK; +} + +static enum aarch_parse_opt_result +aarch_handle_pac_ret_protection (char* str ATTRIBUTE_UNUSED, + char* rest ATTRIBUTE_UNUSED) +{ + aarch_ra_sign_scope = AARCH_FUNCTION_NON_LEAF; + aarch_ra_sign_key = AARCH_KEY_A; + return AARCH_PARSE_OK; +} + +static enum aarch_parse_opt_result +aarch_handle_pac_ret_leaf (char* str ATTRIBUTE_UNUSED, + char* rest ATTRIBUTE_UNUSED) +{ + aarch_ra_sign_scope = AARCH_FUNCTION_ALL; + return AARCH_PARSE_OK; +} + +static enum aarch_parse_opt_result +aarch_handle_pac_ret_b_key (char* str ATTRIBUTE_UNUSED, + char* rest ATTRIBUTE_UNUSED) +{ + aarch_ra_sign_key = AARCH_KEY_B; + return AARCH_PARSE_OK; +} + +static enum aarch_parse_opt_result +aarch_handle_bti_protection (char* str ATTRIBUTE_UNUSED, + char* rest ATTRIBUTE_UNUSED) +{ + aarch_enable_bti = 1; + return AARCH_PARSE_OK; +} + +static const struct aarch_branch_protect_type aarch_pac_ret_subtypes[] = { + { "leaf", aarch_handle_pac_ret_leaf, NULL, 0 }, + { "b-key", aarch_handle_pac_ret_b_key, NULL, 0 }, + { NULL, NULL, NULL, 0 } +}; + +static const struct aarch_branch_protect_type aarch_branch_protect_types[] = { + { "none", aarch_handle_no_branch_protection, NULL, 0 }, + { "standard", aarch_handle_standard_branch_protection, NULL, 0 }, + { "pac-ret", aarch_handle_pac_ret_protection, aarch_pac_ret_subtypes, + ARRAY_SIZE (aarch_pac_ret_subtypes) }, + { "bti", aarch_handle_bti_protection, NULL, 0 }, + { NULL, NULL, NULL, 0 } +}; + +/* Parses CONST_STR for branch protection features specified in + aarch64_branch_protect_types, and set any global variables required. Returns + the parsing result and assigns LAST_STR to the last processed token from + CONST_STR so that it can be used for error reporting. */ + +enum aarch_parse_opt_result +aarch_parse_branch_protection (const char *const_str, char** last_str) +{ + char *str_root = xstrdup (const_str); + char* token_save = NULL; + char *str = strtok_r (str_root, "+", &token_save); + enum aarch_parse_opt_result res = AARCH_PARSE_OK; + if (!str) + res = AARCH_PARSE_MISSING_ARG; + else + { + char *next_str = strtok_r (NULL, "+", &token_save); + /* Reset the branch protection features to their defaults. */ + aarch_handle_no_branch_protection (NULL, NULL); + + while (str && res == AARCH_PARSE_OK) + { + const aarch_branch_protect_type* type = aarch_branch_protect_types; + bool found = false; + /* Search for this type. */ + while (type && type->name && !found && res == AARCH_PARSE_OK) + { + if (strcmp (str, type->name) == 0) + { + found = true; + res = type->handler (str, next_str); + str = next_str; + next_str = strtok_r (NULL, "+", &token_save); + } + else + type++; + } + if (found && res == AARCH_PARSE_OK) + { + bool found_subtype = true; + /* Loop through each token until we find one that isn't a + subtype. */ + while (found_subtype) + { + found_subtype = false; + const aarch_branch_protect_type *subtype = type->subtypes; + /* Search for the subtype. */ + while (str && subtype && subtype->name && !found_subtype + && res == AARCH_PARSE_OK) + { + if (strcmp (str, subtype->name) == 0) + { + found_subtype = true; + res = subtype->handler (str, next_str); + str = next_str; + next_str = strtok_r (NULL, "+", &token_save); + } + else + subtype++; + } + } + } + else if (!found) + res = AARCH_PARSE_INVALID_ARG; + } + } + /* Copy the last processed token into the argument to pass it back. + Used by option and attribute validation to print the offending token. */ + if (last_str) + { + if (str) + strcpy (*last_str, str); + else + *last_str = NULL; + } + + if (res == AARCH_PARSE_OK) + { + /* If needed, alloc the accepted string then copy in const_str. + Used by override_option_after_change_1. */ + if (!accepted_branch_protection_string) + accepted_branch_protection_string + = (char *) xmalloc (BRANCH_PROTECT_STR_MAX + 1); + strncpy (accepted_branch_protection_string, const_str, + BRANCH_PROTECT_STR_MAX + 1); + /* Forcibly null-terminate. */ + accepted_branch_protection_string[BRANCH_PROTECT_STR_MAX] = '\0'; + } + return res; +} + +bool +aarch_validate_mbranch_protection (const char *const_str) +{ + char *str = (char *) xmalloc (strlen (const_str)); + enum aarch_parse_opt_result res = + aarch_parse_branch_protection (const_str, &str); + if (res == AARCH_PARSE_INVALID_ARG) + error ("invalid argument %<%s%> for %<-mbranch-protection=%>", str); + else if (res == AARCH_PARSE_MISSING_ARG) + error ("missing argument for %<-mbranch-protection=%>"); + free (str); + return res == AARCH_PARSE_OK; +} diff --git a/gcc/config/arm/aarch-common.h b/gcc/config/arm/aarch-common.h new file mode 100644 index 0000000..c6a67f0 --- /dev/null +++ b/gcc/config/arm/aarch-common.h @@ -0,0 +1,73 @@ +/* Types shared between arm and aarch64. + + Copyright (C) 2009-2021 Free Software Foundation, Inc. + Contributed by Arm Ltd. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_AARCH_COMMON_H +#define GCC_AARCH_COMMON_H + +/* Enum describing the various ways that the + aarch*_parse_{arch,tune,cpu,extension} functions can fail. + This way their callers can choose what kind of error to give. */ + +enum aarch_parse_opt_result +{ + AARCH_PARSE_OK, /* Parsing was successful. */ + AARCH_PARSE_MISSING_ARG, /* Missing argument. */ + AARCH_PARSE_INVALID_FEATURE, /* Invalid feature modifier. */ + AARCH_PARSE_INVALID_ARG /* Invalid arch, tune, cpu arg. */ +}; + +/* Function types -msign-return-address should sign. */ +enum aarch_function_type { + /* Don't sign any function. */ + AARCH_FUNCTION_NONE, + /* Non-leaf functions. */ + AARCH_FUNCTION_NON_LEAF, + /* All functions. */ + AARCH_FUNCTION_ALL +}; + +/* The key type that -msign-return-address should use. */ +enum aarch_key_type { + AARCH_KEY_A, + AARCH_KEY_B +}; + +struct aarch_branch_protect_type +{ + /* The type's name that the user passes to the branch-protection option + string. */ + const char* name; + /* Function to handle the protection type and set global variables. + First argument is the string token corresponding with this type and the + second argument is the next token in the option string. + Return values: + * AARCH_PARSE_OK: Handling was sucessful. + * AARCH_INVALID_ARG: The type is invalid in this context and the caller + should print an error. + * AARCH_INVALID_FEATURE: The type is invalid and the handler prints its + own error. */ + enum aarch_parse_opt_result (*handler)(char*, char*); + /* A list of types that can follow this type in the option string. */ + const struct aarch_branch_protect_type* subtypes; + unsigned int num_subtypes; +}; + +#endif /* GCC_AARCH_COMMON_H */ diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index 95918dd..4c0376e 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -582,6 +582,8 @@ struct cpu_option extern const arch_option all_architectures[]; extern const cpu_option all_cores[]; +extern enum aarch_key_type aarch_ra_sign_key; + const cpu_option *arm_parse_cpu_option_name (const cpu_option *, const char *, const char *, bool = true); const arch_option *arm_parse_arch_option_name (const arch_option *, diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc index 3f17118..da84ba5 100644 --- a/gcc/config/arm/arm.cc +++ b/gcc/config/arm/arm.cc @@ -72,6 +72,8 @@ #include "selftest.h" #include "tree-vectorizer.h" #include "opts.h" +#include "aarch-common.h" +#include "aarch-common-protos.h" /* This file should be included last. */ #include "target-def.h" @@ -2413,6 +2415,11 @@ const struct tune_params arm_fa726te_tune = tune_params::SCHED_AUTOPREF_OFF }; +/* Key type for Pointer Authentication extension. */ +enum aarch_key_type aarch_ra_sign_key = AARCH_KEY_A; + +char *accepted_branch_protection_string = NULL; + /* Auto-generated CPU, FPU and architecture tables. */ #include "arm-cpu-data.h" diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt index 007d993..16d8df8 100644 --- a/gcc/config/arm/arm.opt +++ b/gcc/config/arm/arm.opt @@ -21,6 +21,15 @@ HeaderInclude config/arm/arm-opts.h +HeaderInclude +config/arm/aarch-common.h + +TargetVariable +enum aarch_function_type aarch_ra_sign_scope = AARCH_FUNCTION_NONE + +TargetVariable +unsigned aarch_enable_bti = 0 + Enum Name(tls_type) Type(enum arm_tls_type) TLS dialect to use: -- cgit v1.1 From c91bb7b9fc87284f5382d9fb04db0cb10f6c1fe9 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 6 Dec 2021 11:38:32 +0100 Subject: [PATCH 2/15] arm: Add Armv8.1-M Mainline target feature +pacbti This patch adds the -march feature +pacbti to Armv8.1-M Mainline. This feature enables pointer signing and authentication instructions on M-class architectures. Pre-approved here . gcc/Changelog: * config/arm/arm.h (TARGET_HAVE_PACBTI): New macro. * config/arm/arm-cpus.in (pacbti): New feature. * doc/invoke.texi (Arm Options): Document it. Co-Authored-By: Tejas Belagod --- gcc/config/arm/arm-cpus.in | 5 +++++ gcc/config/arm/arm.h | 6 ++++++ gcc/doc/invoke.texi | 3 +++ 3 files changed, 14 insertions(+) (limited to 'gcc') diff --git a/gcc/config/arm/arm-cpus.in b/gcc/config/arm/arm-cpus.in index 579cf35..4685599 100644 --- a/gcc/config/arm/arm-cpus.in +++ b/gcc/config/arm/arm-cpus.in @@ -229,6 +229,10 @@ define feature cdecp5 define feature cdecp6 define feature cdecp7 +# M-profile control flow integrity extensions (PAC/AUT/BTI). +# Optional from Armv8.1-M Mainline. +define feature pacbti + # Feature groups. Conventionally all (or mostly) upper case. # ALL_FPU lists all the feature bits associated with the floating-point # unit; these will all be removed if the floating-point unit is disabled @@ -743,6 +747,7 @@ begin arch armv8.1-m.main isa ARMv8_1m_main # fp => FPv5-sp-d16; fp.dp => FPv5-d16 option dsp add armv7em + option pacbti add pacbti option fp add FPv5 fp16 option fp.dp add FPv5 FP_DBL fp16 option nofp remove ALL_FP diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 6f7ecf9..79b9f44 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -331,6 +331,12 @@ emission of floating point pcs attributes. */ isa_bit_mve_float) \ && !TARGET_GENERAL_REGS_ONLY) +/* Non-zero if this target supports Armv8.1-M Mainline pointer-signing + extension. */ +#define TARGET_HAVE_PACBTI (arm_arch8_1m_main \ + && bitmap_bit_p (arm_active_target.isa, \ + isa_bit_pacbti)) + /* MVE have few common instructions as VFP, like VLDM alias VPOP, VLDR, VSTM alia VPUSH, VSTR and VMOV, VMSR and VMRS. In the same manner it updates few registers such as FPCAR, FPCCR, FPDSCR, FPSCR, MVFR0, MVFR1 and MVFR2. All diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 631c005..e37e92f 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -22020,6 +22020,9 @@ Disable the floating-point extension. @item +cdecp0, +cdecp1, ... , +cdecp7 Enable the Custom Datapath Extension (CDE) on selected coprocessors according to the numbers given in the options in the range 0 to 7. + +@item +pacbti +Enable the Pointer Authentication and Branch Target Identification Extension. @end table @item armv8-m.main -- cgit v1.1 From 14fab5fb9aa6432ca59fb02b7b82ac17093f4de2 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 6 Dec 2021 11:39:03 +0100 Subject: [PATCH 3/15] arm: Add option -mbranch-protection Add -mbranch-protection option. This option enables the code-generation of pointer signing and authentication instructions in function prologues and epilogues. gcc/ChangeLog: * config/arm/arm.cc (arm_configure_build_target): Parse and validate -mbranch-protection option and initialize appropriate data structures. * config/arm/arm.opt (-mbranch-protection): New option. * doc/invoke.texi (Arm Options): Document it. Co-Authored-By: Tejas Belagod Co-Authored-By: Richard Earnshaw --- gcc/config/arm/arm.cc | 11 +++++++++++ gcc/config/arm/arm.opt | 4 ++++ gcc/doc/invoke.texi | 38 +++++++++++++++++++++++++++++++++++++- 3 files changed, 52 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc index da84ba5..76c6f94 100644 --- a/gcc/config/arm/arm.cc +++ b/gcc/config/arm/arm.cc @@ -3259,6 +3259,17 @@ arm_configure_build_target (struct arm_build_target *target, tune_opts = strchr (opts->x_arm_tune_string, '+'); } + if (opts->x_arm_branch_protection_string) + { + aarch_validate_mbranch_protection (opts->x_arm_branch_protection_string); + + if (aarch_ra_sign_key != AARCH_KEY_A) + { + warning (0, "invalid key type for %<-mbranch-protection=%>"); + aarch_ra_sign_key = AARCH_KEY_A; + } + } + if (arm_selected_arch) { arm_initialize_isa (target->isa, arm_selected_arch->common.isa_bits); diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt index 16d8df8..260700f 100644 --- a/gcc/config/arm/arm.opt +++ b/gcc/config/arm/arm.opt @@ -323,6 +323,10 @@ mbranch-cost= Target RejectNegative Joined UInteger Var(arm_branch_cost) Init(-1) Cost to assume for a branch insn. +mbranch-protection= +Target RejectNegative Joined Var(arm_branch_protection_string) Save +Use branch-protection features. + mgeneral-regs-only Target RejectNegative Mask(GENERAL_REGS_ONLY) Save Generate code which uses the core registers only (r0-r14). diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index e37e92f..b4a271d 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -850,7 +850,9 @@ Objective-C and Objective-C++ Dialects}. -mcmse @gol -mfix-cmse-cve-2021-35465 @gol -mstack-protector-guard=@var{guard} -mstack-protector-guard-offset=@var{offset} @gol --mfdpic} +-mfdpic @gol +-mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}] +[+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]} @emph{AVR Options} @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol @@ -22556,6 +22558,40 @@ The opposite @option{-mno-fdpic} option is useful (and required) to build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi}) toolchain as the one used to build the userland programs. +@item +-mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}][+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]] +@opindex mbranch-protection +Enable branch protection features (armv8.1-m.main only). +@samp{none} generate code without branch protection or return address +signing. +@samp{standard[+@var{leaf}]} generate code with all branch protection +features enabled at their standard level. +@samp{pac-ret[+@var{leaf}]} generate code with return address signing +set to its standard level, which is to sign all functions that save +the return address to memory. +@samp{leaf} When return address signing is enabled, also sign leaf +functions even if they do not write the return address to memory. ++@samp{bti} Add landing-pad instructions at the permitted targets of +indirect branch instructions. + +If the @samp{+pacbti} architecture extension is not enabled, then all +branch protection and return address signing operations are +constrained to use only the instructions defined in the +architectural-NOP space. The generated code will remain +backwards-compatible with earlier versions of the architecture, but +the additional security can be enabled at run time on processors that +support the @samp{PACBTI} extension. + +Branch target enforcement using BTI can only be enabled at runtime if +all code in the application has been compiled with at least +@samp{-mbranch-protection=bti}. + +Any setting other than @samp{none} is supported only on armv8-m.main +or later. + +The default is to generate code without branch protection or return +address signing. + @end table @node AVR Options -- cgit v1.1 From 8ce721cd96ac2ec0c9194df35daa5aeae8541b7a Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 6 Dec 2021 11:39:35 +0100 Subject: [PATCH 4/15] arm: Add testsuite library support for PACBTI target Add targeting-checking entities for PACBTI in testsuite framework. Pre-approved with the requested changes here . gcc/testsuite/ChangeLog * lib/target-supports.exp: (check_effective_target_arm_pacbti_hw): New. gcc/ChangeLog: * doc/sourcebuild.texi: Document arm_pacbti_hw. Co-Authored-By: Tejas Belagod --- gcc/doc/sourcebuild.texi | 10 ++++++++++ gcc/testsuite/lib/target-supports.exp | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'gcc') diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index e605707..be43182 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -2195,6 +2195,10 @@ ARM target supports options to generate instructions from ARMv8.1-M with the Custom Datapath Extension (CDE) and M-Profile Vector Extension (MVE). Some multilibs may be incompatible with these options. +@item arm_pacbti_hw +Test system supports executing Pointer Authentication and Branch Target +Identification instructions. + @item arm_prefer_ldrd_strd ARM target prefers @code{LDRD} and @code{STRD} instructions over @code{LDM} and @code{STM} instructions. @@ -2284,6 +2288,12 @@ ARM target generates Thumb-2 code for @code{-mthumb} but does not support executing the Armv8.1-M Mainline Low Overhead Loop instructions @code{DLS} and @code{LE}. +@item mbranch_protection_ok +ARM target supporting @code{-mbranch-protection=standard}. + +@item arm_pacbti_hw +Test system supports for executing non nop pacbti instructions. + @end table @subsubsection AArch64-specific attributes diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 38b9514..a9ee288 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -5218,6 +5218,22 @@ proc check_effective_target_arm_cmse_clear_ok {} { } "-mcmse"]; } +# Return 1 if the target supports executing PACBTI instructions, 0 +# otherwise. + +proc check_effective_target_arm_pacbti_hw {} { + return [check_runtime arm_pacbti_hw_available { + __attribute__ ((naked)) int + main (void) + { + asm ("pac r12, lr, sp"); + asm ("mov r0, #0"); + asm ("autg r12, lr, sp"); + asm ("bx lr"); + } + } "-march=armv8.1-m.main+pacbti+fp -mbranch-protection=standard -mthumb -mfloat-abi=hard"] +} + # Return 1 if this compilation turns on string_ops_prefer_neon on. proc check_effective_target_arm_tune_string_ops_prefer_neon { } { -- cgit v1.1 From dffcafd88ced273fb0b2e8b754b44472d73458f7 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 6 Dec 2021 11:39:59 +0100 Subject: [PATCH 5/15] arm: Implement target feature macros for PACBTI This patch implements target feature macros when PACBTI is enabled through the -march option or -mbranch-protection. The target feature macros __ARM_FEATURE_PAC_DEFAULT and __ARM_FEATURE_BTI_DEFAULT are specified in ARM ACLE __ARM_FEATURE_PAUTH and __ARM_FEATURE_BTI are specified in the pull-request . Approved here . gcc/ * config/arm/arm-c.cc (arm_cpu_builtins): Define __ARM_FEATURE_BTI_DEFAULT, __ARM_FEATURE_PAC_DEFAULT, __ARM_FEATURE_PAUTH and __ARM_FEATURE_BTI. gcc/testsuite/ * lib/target-supports.exp (check_effective_target_mbranch_protection_ok): New function. * gcc.target/arm/acle/pacbti-m-predef-2.c: New test. * gcc.target/arm/acle/pacbti-m-predef-4.c: Likewise. * gcc.target/arm/acle/pacbti-m-predef-5.c: Likewise. * gcc.target/arm/acle/pacbti-m-predef-8.c: Likewise. * gcc.target/arm/acle/pacbti-m-predef-9.c: Likewise. * gcc.target/arm/acle/pacbti-m-predef-10.c: Likewise. * gcc.target/arm/acle/pacbti-m-predef-11.c: Likewise. * gcc.target/arm/acle/pacbti-m-predef-12.c: Likewise. Co-Authored-By: Tejas Belagod --- gcc/config/arm/arm-c.cc | 18 ++++++++++++++++ .../gcc.target/arm/acle/pacbti-m-predef-10.c | 11 ++++++++++ .../gcc.target/arm/acle/pacbti-m-predef-11.c | 11 ++++++++++ .../gcc.target/arm/acle/pacbti-m-predef-12.c | 11 ++++++++++ .../gcc.target/arm/acle/pacbti-m-predef-2.c | 24 +++++++++++++++++++++ .../gcc.target/arm/acle/pacbti-m-predef-4.c | 20 +++++++++++++++++ .../gcc.target/arm/acle/pacbti-m-predef-5.c | 25 ++++++++++++++++++++++ .../gcc.target/arm/acle/pacbti-m-predef-8.c | 12 +++++++++++ .../gcc.target/arm/acle/pacbti-m-predef-9.c | 11 ++++++++++ gcc/testsuite/lib/target-supports.exp | 10 +++++++++ 10 files changed, 153 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-10.c create mode 100644 gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-11.c create mode 100644 gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-12.c create mode 100644 gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-2.c create mode 100644 gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-4.c create mode 100644 gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-5.c create mode 100644 gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-8.c create mode 100644 gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-9.c (limited to 'gcc') diff --git a/gcc/config/arm/arm-c.cc b/gcc/config/arm/arm-c.cc index df86342..59c0d8c 100644 --- a/gcc/config/arm/arm-c.cc +++ b/gcc/config/arm/arm-c.cc @@ -214,6 +214,24 @@ arm_cpu_builtins (struct cpp_reader* pfile) def_or_undef_macro (pfile, "__ARM_FEATURE_COMPLEX", TARGET_COMPLEX); def_or_undef_macro (pfile, "__ARM_32BIT_STATE", TARGET_32BIT); + def_or_undef_macro (pfile, "__ARM_FEATURE_PAUTH", TARGET_HAVE_PACBTI); + def_or_undef_macro (pfile, "__ARM_FEATURE_BTI", TARGET_HAVE_PACBTI); + def_or_undef_macro (pfile, "__ARM_FEATURE_BTI_DEFAULT", + aarch_enable_bti == 1); + + cpp_undef (pfile, "__ARM_FEATURE_PAC_DEFAULT"); + if (aarch_ra_sign_scope != AARCH_FUNCTION_NONE) + { + unsigned int pac = 1; + + gcc_assert (aarch_ra_sign_key == AARCH_KEY_A); + + if (aarch_ra_sign_scope == AARCH_FUNCTION_ALL) + pac |= 0x4; + + builtin_define_with_int_value ("__ARM_FEATURE_PAC_DEFAULT", pac); + } + cpp_undef (pfile, "__ARM_FEATURE_MVE"); if (TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT) { diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-10.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-10.c new file mode 100644 index 0000000..52d1823 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-10.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-additional-options "-march=armv8.1-m.main+fp -mbranch-protection=bti+pac-ret -mfloat-abi=hard" } */ + +#if (__ARM_FEATURE_BTI_DEFAULT != 1) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be defined to 1." +#endif + +#if !defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be defined." +#endif diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-11.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-11.c new file mode 100644 index 0000000..9f27110 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-11.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" "-mfloat-abi=*" } } */ +/* { dg-options "-march=armv8.1-m.main+pacbti" } */ + +#if (__ARM_FEATURE_BTI != 1) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be defined to 1." +#endif + +#if (__ARM_FEATURE_PAUTH != 1) +#error "Feature test macro __ARM_FEATURE__PAUTH should be defined to 1." +#endif diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-12.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-12.c new file mode 100644 index 0000000..db40b17 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-12.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */ +/* { dg-options "-march=armv8-m.main+fp -mfloat-abi=softfp" } */ + +#if defined (__ARM_FEATURE_BTI) +#error "Feature test macro __ARM_FEATURE_BTI should not be defined." +#endif + +#if defined (__ARM_FEATURE_PAUTH) +#error "Feature test macro __ARM_FEATURE_PAUTH should not be defined." +#endif diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-2.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-2.c new file mode 100644 index 0000000..cd418ce --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-2.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-options "-march=armv8.1-m.main+pacbti+fp -mbranch-protection=bti+pac-ret+leaf -mthumb -mfloat-abi=hard" } */ + +#if !defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be defined." +#endif + +#if !defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be defined." +#endif + +int +main() +{ + if (__ARM_FEATURE_BTI_DEFAULT != 1) + __builtin_abort (); + + if (__ARM_FEATURE_PAC_DEFAULT != 5) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-4.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-4.c new file mode 100644 index 0000000..ce4b45a --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-4.c @@ -0,0 +1,20 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-options "-march=armv8.1-m.main+pacbti+fp -mbranch-protection=pac-ret -mthumb -mfloat-abi=hard" } */ + +#if !defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be defined." +#endif + +#if defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be undefined." +#endif + +int +main() +{ + if (__ARM_FEATURE_PAC_DEFAULT != 1) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-5.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-5.c new file mode 100644 index 0000000..6d48b7c --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-5.c @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-skip-if "do not override march" { *-*-* } { "-march=*" } { "-march=armv8.1-m.main" } } */ +/* { dg-additional-options "-march=armv8.1-m.main -mbranch-protection=bti+pac-ret" } */ + +#if !defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be defined." +#endif + +#if !defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be defined." +#endif + +int +main() +{ + if (__ARM_FEATURE_BTI_DEFAULT != 1) + __builtin_abort (); + + if (__ARM_FEATURE_PAC_DEFAULT != 1) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-8.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-8.c new file mode 100644 index 0000000..3538c18 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-8.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-additional-options "-march=armv8.1-m.main+fp -mbranch-protection=bti+pac-ret+leaf -mfloat-abi=hard" } */ + +#if (__ARM_FEATURE_BTI_DEFAULT != 1) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be defined to 1." +#endif + +#if (__ARM_FEATURE_PAC_DEFAULT != 5) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be defined to 5." +#endif + diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-9.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-9.c new file mode 100644 index 0000000..27c1c8f --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-9.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-additional-options "-march=armv8.1-m.main+fp -mbranch-protection=pac-ret -mfloat-abi=hard" } */ + +#if (__ARM_FEATURE_PAC_DEFAULT != 1) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be defined to 1." +#endif + +#if defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be undefined." +#endif diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index a9ee288..c0694af 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -5218,6 +5218,16 @@ proc check_effective_target_arm_cmse_clear_ok {} { } "-mcmse"]; } +# Return 1 if this is an ARM target supporting +# -mbranch-protection=standard, 0 otherwise. + +proc check_effective_target_mbranch_protection_ok {} { + + return [check_no_compiler_messages mbranch_protection_ok object { + int main (void) { return 0; } + } "-mbranch-protection=standard"] +} + # Return 1 if the target supports executing PACBTI instructions, 0 # otherwise. -- cgit v1.1 From 7161afc778699b90edafbcd750b2e185a1de00a6 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 6 Dec 2021 11:42:11 +0100 Subject: [PATCH 6/15] arm: Add pointer authentication for stack-unwinding runtime This patch adds authentication for when the stack is unwound when an exception is taken. All the changes here are done to the runtime code in libgcc's unwinder code for Arm target. All the changes are guarded under defined (__ARM_FEATURE_PAC_DEFAULT) and activated only if the +pacbti feature is switched on for the architecture. This means that switching on the target feature via -march or -mcpu is sufficient and -mbranch-protection need not be enabled. This ensures that the unwinder is authenticated only if the PACBTI instructions are available in the non-NOP space as it uses AUTG. Just generating PAC/AUT instructions using -mbranch-protection will not enable authentication on the unwinder. Pre-approved with the requested changes here . gcc/ChangeLog: * ginclude/unwind-arm-common.h (_Unwind_VRS_RegClass): Introduce new pseudo register class _UVRSC_PAC. libgcc/ChangeLog: * config/arm/pr-support.c (__gnu_unwind_execute): Decode exception opcode (0xb4) for saving RA_AUTH_CODE and authenticate with AUTG if found. * config/arm/unwind-arm.c (struct pseudo_regs): New. (phase1_vrs): Introduce new field to store pseudo-reg state. (phase2_vrs): Likewise. (_Unwind_VRS_Get): Load pseudo register state from virtual reg set. (_Unwind_VRS_Set): Store pseudo register state to virtual reg set. (_Unwind_VRS_Pop): Load pseudo register value from stack into VRS. Co-Authored-By: Tejas Belagod Co-Authored-By: Srinath Parvathaneni --- gcc/ginclude/unwind-arm-common.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ginclude/unwind-arm-common.h b/gcc/ginclude/unwind-arm-common.h index a2ef868..3ee0a6b 100644 --- a/gcc/ginclude/unwind-arm-common.h +++ b/gcc/ginclude/unwind-arm-common.h @@ -127,7 +127,8 @@ extern "C" { _UVRSC_VFP = 1, /* vfp */ _UVRSC_FPA = 2, /* fpa */ _UVRSC_WMMXD = 3, /* Intel WMMX data register */ - _UVRSC_WMMXC = 4 /* Intel WMMX control register */ + _UVRSC_WMMXC = 4, /* Intel WMMX control register */ + _UVRSC_PAC = 5 /* Armv8.1-M Mainline PAC/AUTH pseudo-register */ } _Unwind_VRS_RegClass; -- cgit v1.1 From 616c1d02bcea9ff24ff2873c6d2efc84c7be4192 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 6 Dec 2021 11:42:24 +0100 Subject: [PATCH 7/15] arm: Emit build attributes for PACBTI target feature This patch emits assembler directives for PACBTI build attributes as defined by the ABI. gcc/ChangeLog: * config/arm/arm.cc (arm_file_start): Emit EABI attributes for Tag_PAC_extension, Tag_BTI_extension, TAG_BTI_use, TAG_PACRET_use. gcc/testsuite/ChangeLog: * gcc.target/arm/acle/pacbti-m-predef-1.c: New test. * gcc.target/arm/acle/pacbti-m-predef-3.c: Likewise. * gcc.target/arm/acle/pacbti-m-predef-6.c: Likewise. * gcc.target/arm/acle/pacbti-m-predef-7.c: Likewise. Co-Authored-By: Tejas Belagod --- gcc/config/arm/arm.cc | 18 ++++++++++++++++++ gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-1.c | 17 +++++++++++++++++ gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-3.c | 17 +++++++++++++++++ gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-6.c | 16 ++++++++++++++++ gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-7.c | 17 +++++++++++++++++ 5 files changed, 85 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-1.c create mode 100644 gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-3.c create mode 100644 gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-6.c create mode 100644 gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-7.c (limited to 'gcc') diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc index 76c6f94..358b813 100644 --- a/gcc/config/arm/arm.cc +++ b/gcc/config/arm/arm.cc @@ -28478,6 +28478,8 @@ static void arm_file_start (void) { int val; + bool pac = (aarch_ra_sign_scope != AARCH_FUNCTION_NONE); + bool bti = (aarch_enable_bti == 1); arm_print_asm_arch_directives (asm_out_file, TREE_TARGET_OPTION (target_option_default_node)); @@ -28548,6 +28550,22 @@ arm_file_start (void) arm_emit_eabi_attribute ("Tag_ABI_FP_16bit_format", 38, (int) arm_fp16_format); + if (TARGET_HAVE_PACBTI) + { + arm_emit_eabi_attribute ("Tag_PAC_extension", 50, 2); + arm_emit_eabi_attribute ("Tag_BTI_extension", 52, 2); + } + else if (pac || bti) + { + arm_emit_eabi_attribute ("Tag_PAC_extension", 50, 1); + arm_emit_eabi_attribute ("Tag_BTI_extension", 52, 1); + } + + if (bti) + arm_emit_eabi_attribute ("TAG_BTI_use", 74, 1); + if (pac) + arm_emit_eabi_attribute ("TAG_PACRET_use", 76, 1); + if (arm_lang_output_object_attributes_hook) arm_lang_output_object_attributes_hook(); } diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-1.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-1.c new file mode 100644 index 0000000..122f7a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-options "-march=armv8.1-m.main+fp -mbranch-protection=pac-ret+bti -mfloat-abi=hard --save-temps" } */ + +#if !defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be defined." +#endif + +#if !defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be defined." +#endif + +/* { dg-final { scan-assembler-not "\.arch_extension pacbti" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 50, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 52, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 74, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 76, 1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-3.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-3.c new file mode 100644 index 0000000..b94f344 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-3.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-options "-march=armv8.1-m.main+fp -mbranch-protection=pac-ret+leaf -mfloat-abi=hard --save-temps" } */ + +#if defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be undefined." +#endif + +#if !defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be defined." +#endif + +/* { dg-final { scan-assembler-not "\.arch_extension pacbti" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 50, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 52, 1" } } */ +/* { dg-final { scan-assembler-not "\.eabi_attribute 74" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 76, 1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-6.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-6.c new file mode 100644 index 0000000..ed52afc --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-6.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-additional-options "-march=armv8.1-m.main+fp -mbranch-protection=bti -mfloat-abi=hard --save-temps" } */ + +#if !defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be defined." +#endif + +#if defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be undefined." +#endif +/* { dg-final { scan-assembler-not "\.arch_extension pacbti" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 50, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 52, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 74, 1" } } */ +/* { dg-final { scan-assembler-not "\.eabi_attribute 76" } } */ diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-7.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-7.c new file mode 100644 index 0000000..1b25907 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-7.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */ +/* { dg-additional-options "-march=armv8.1-m.main+pacbti+fp --save-temps -mfloat-abi=hard" } */ + +#if defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be undefined." +#endif + +#if defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be undefined." +#endif + +/* { dg-final { scan-assembler "\.arch_extension pacbti" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 50, 2" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 52, 2" } } */ +/* { dg-final { scan-assembler-not "\.eabi_attribute 74" } } */ +/* { dg-final { scan-assembler-not "\.eabi_attribute 76" } } */ -- cgit v1.1 From cea85c669704332baacfe8a50f18d8498a025309 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 6 Dec 2021 11:42:59 +0100 Subject: [PATCH 8/15] arm: Introduce multilibs for PACBTI target feature This patch add the following new multilibs. thumb/v8.1-m.main+pacbti/mbranch-protection/nofp thumb/v8.1-m.main+pacbti+dp/mbranch-protection/soft thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard thumb/v8.1-m.main+pacbti+fp/mbranch-protection/soft thumb/v8.1-m.main+pacbti+fp/mbranch-protection/hard thumb/v8.1-m.main+pacbti+mve/mbranch-protection/hard Triggering the following compiler flags: -mthumb -march=armv8.1-m.main+pacbti -mbranch-protection=standard -mfloat-abi=soft -mthumb -march=armv8.1-m.main+pacbti+fp -mbranch-protection=standard -mfloat-abi=softfp -mthumb -march=armv8.1-m.main+pacbti+fp -mbranch-protection=standard -mfloat-abi=hard -mthumb -march=armv8.1-m.main+pacbti+fp.dp -mbranch-protection=standard -mfloat-abi=softfp -mthumb -march=armv8.1-m.main+pacbti+fp.dp -mbranch-protection=standard -mfloat-abi=hard -mthumb -march=armv8.1-m.main+pacbti+mve -mbranch-protection=standard -mfloat-abi=hard gcc/ * config/arm/t-rmprofile: Add multilib rules for march +pacbti and mbranch-protection. gcc/testsuite/ * gcc.target/arm/multilib.exp: Add pacbti related entries. --- gcc/config/arm/t-rmprofile | 28 ++++++++++++++++++++++++++-- gcc/testsuite/gcc.target/arm/multilib.exp | 6 ++++++ 2 files changed, 32 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/config/arm/t-rmprofile b/gcc/config/arm/t-rmprofile index 472ed94..ecfdc98 100644 --- a/gcc/config/arm/t-rmprofile +++ b/gcc/config/arm/t-rmprofile @@ -27,8 +27,11 @@ # Arch and FPU variants to build libraries with -MULTI_ARCH_OPTS_RM = march=armv6s-m/march=armv7-m/march=armv7e-m/march=armv7e-m+fp/march=armv7e-m+fp.dp/march=armv8-m.base/march=armv8-m.main/march=armv8-m.main+fp/march=armv8-m.main+fp.dp/march=armv8.1-m.main+mve -MULTI_ARCH_DIRS_RM = v6-m v7-m v7e-m v7e-m+fp v7e-m+dp v8-m.base v8-m.main v8-m.main+fp v8-m.main+dp v8.1-m.main+mve +MULTI_ARCH_OPTS_RM = march=armv6s-m/march=armv7-m/march=armv7e-m/march=armv7e-m+fp/march=armv7e-m+fp.dp/march=armv8-m.base/march=armv8-m.main/march=armv8-m.main+fp/march=armv8-m.main+fp.dp/march=armv8.1-m.main+mve/march=armv8.1-m.main+pacbti/march=armv8.1-m.main+pacbti+fp/march=armv8.1-m.main+pacbti+fp.dp/march=armv8.1-m.main+pacbti+mve +MULTI_ARCH_DIRS_RM = v6-m v7-m v7e-m v7e-m+fp v7e-m+dp v8-m.base v8-m.main v8-m.main+fp v8-m.main+dp v8.1-m.main+mve v8.1-m.main+pacbti v8.1-m.main+pacbti+fp v8.1-m.main+pacbti+dp v8.1-m.main+pacbti+mve + +MULTI_ARCH_OPTS_RM += mbranch-protection=standard +MULTI_ARCH_DIRS_RM += mbranch-protection # Base M-profile (no fp) MULTILIB_REQUIRED += mthumb/march=armv6s-m/mfloat-abi=soft @@ -50,6 +53,13 @@ MULTILIB_REQUIRED += mthumb/march=armv8-m.main+fp.dp/mfloat-abi=hard MULTILIB_REQUIRED += mthumb/march=armv8-m.main+fp.dp/mfloat-abi=softfp MULTILIB_REQUIRED += mthumb/march=armv8.1-m.main+mve/mfloat-abi=hard +MULTILIB_REQUIRED += mthumb/march=armv8.1-m.main+pacbti/mbranch-protection=standard/mfloat-abi=soft +MULTILIB_REQUIRED += mthumb/march=armv8.1-m.main+pacbti+fp/mbranch-protection=standard/mfloat-abi=softfp +MULTILIB_REQUIRED += mthumb/march=armv8.1-m.main+pacbti+fp/mbranch-protection=standard/mfloat-abi=hard +MULTILIB_REQUIRED += mthumb/march=armv8.1-m.main+pacbti+fp.dp/mbranch-protection=standard/mfloat-abi=softfp +MULTILIB_REQUIRED += mthumb/march=armv8.1-m.main+pacbti+fp.dp/mbranch-protection=standard/mfloat-abi=hard +MULTILIB_REQUIRED += mthumb/march=armv8.1-m.main+pacbti+mve/mbranch-protection=standard/mfloat-abi=hard + # Arch Matches MULTILIB_MATCHES += march?armv6s-m=march?armv6-m @@ -87,9 +97,23 @@ MULTILIB_MATCHES += $(foreach FP, $(v8_1m_sp_variants), \ MULTILIB_MATCHES += $(foreach FP, $(v8_1m_dp_variants), \ march?armv8-m.main+fp.dp=mlibarch?armv8.1-m.main$(FP)) +# Map all mbranch-protection values other than 'none' to 'standard'. +MULTILIB_MATCHES += mbranch-protection?standard=mbranch-protection?bti +MULTILIB_MATCHES += mbranch-protection?standard=mbranch-protection?pac-ret +MULTILIB_MATCHES += mbranch-protection?standard=mbranch-protection?pac-ret+leaf +MULTILIB_MATCHES += mbranch-protection?standard=mbranch-protection?pac-ret+bti +MULTILIB_MATCHES += mbranch-protection?standard=mbranch-protection?pac-ret+leaf+bti +MULTILIB_MATCHES += mbranch-protection?standard=mbranch-protection?bti+pac-ret +MULTILIB_MATCHES += mbranch-protection?standard=mbranch-protection?bti+pac-ret+leaf +MULTILIB_MATCHES += mbranch-protection?standard=mbranch-protection?standard+leaf + # For all the MULTILIB_REQUIRED for v8-m and above, add MULTILIB_MATCHES which # maps mlibarch with march for multilib linking. MULTILIB_MATCHES += march?armv8-m.main=mlibarch?armv8-m.main MULTILIB_MATCHES += march?armv8-m.main+fp=mlibarch?armv8-m.main+fp MULTILIB_MATCHES += march?armv8-m.main+fp.dp=mlibarch?armv8-m.main+fp.dp MULTILIB_MATCHES += march?armv8.1-m.main+mve=mlibarch?armv8.1-m.main+mve +MULTILIB_MATCHES += march?armv8.1-m.main+pacbti=mlibarch?armv8.1-m.main+pacbti +MULTILIB_MATCHES += march?armv8.1-m.main+pacbti+fp=mlibarch?armv8.1-m.main+pacbti+fp +MULTILIB_MATCHES += march?armv8.1-m.main+pacbti+fp.dp=mlibarch?armv8.1-m.main+pacbti+fp.dp +MULTILIB_MATCHES += march?armv8.1-m.main+pacbti+mve=mlibarch?armv8.1-m.main+pacbti+mve diff --git a/gcc/testsuite/gcc.target/arm/multilib.exp b/gcc/testsuite/gcc.target/arm/multilib.exp index f9bb0d9..4f0a0a1 100644 --- a/gcc/testsuite/gcc.target/arm/multilib.exp +++ b/gcc/testsuite/gcc.target/arm/multilib.exp @@ -838,6 +838,12 @@ if {[multilib_config "rmprofile"] } { {-march=armv8.1-m.main+mve.fp+fp.dp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" {-march=armv8.1-m.main+mve+fp.dp -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" {-march=armv8.1-m.main+mve.fp+fp.dp -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" + {-march=armv8.1-m.main+pacbti -mbranch-protection=standard -mfloat-abi=soft} "thumb/v8.1-m.main+pacbti/mbranch-protection/nofp" + {-march=armv8.1-m.main+pacbti+fp -mbranch-protection=standard -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+fp/mbranch-protection/soft" + {-march=armv8.1-m.main+pacbti+fp -mbranch-protection=standard -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+fp/mbranch-protection/hard" + {-march=armv8.1-m.main+pacbti+fp.dp -mbranch-protection=standard -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/soft" + {-march=armv8.1-m.main+pacbti+fp.dp -mbranch-protection=standard -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard" + {-march=armv8.1-m.main+pacbti+mve -mbranch-protection=standard -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+mve/mbranch-protection/hard" {-mcpu=cortex-m55+nomve -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" {-mcpu=cortex-m55+nomve -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" {-mcpu=cortex-m55+nomve -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" -- cgit v1.1 From 651460b452d752058e38620bf64541822e25c69c Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Thu, 20 Jan 2022 15:36:23 +0100 Subject: [PATCH 10/15] arm: Implement cortex-M return signing address codegen Hi all, this patch enables address return signature and verification based on Armv8.1-M Pointer Authentication [1]. To sign the return address, we use the PAC R12, LR, SP instruction upon function entry. This is signing LR using SP and storing the result in R12. R12 will be pushed into the stack. During function epilogue R12 will be popped and AUT R12, LR, SP will be used to verify that the content of LR is still valid before return. Here an example of PAC instrumented function prologue and epilogue: void foo (void); int main() { foo (); return 0; } Compiled with '-march=armv8.1-m.main -mbranch-protection=pac-ret -mthumb' translates into: main: pac ip, lr, sp push {r3, r7, ip, lr} add r7, sp, #0 bl foo movs r3, #0 mov r0, r3 pop {r3, r7, ip, lr} aut ip, lr, sp bx lr The patch also takes care of generating a PACBTI instruction in place of the sequence BTI+PAC when Branch Target Identification is enabled contextually. Ex. the previous example compiled with '-march=armv8.1-m.main -mbranch-protection=pac-ret+bti -mthumb' translates into: main: pacbti ip, lr, sp push {r3, r7, ip, lr} add r7, sp, #0 bl foo movs r3, #0 mov r0, r3 pop {r3, r7, ip, lr} aut ip, lr, sp bx lr As part of previous upstream suggestions a test for varargs has been added and '-mtpcs-frame' is deemed being incompatible with this return signing address feature being introduced. [1] gcc/ * config/arm/arm.h (arm_arch8m_main): Declare it. * config/arm/arm-protos.h (arm_current_function_pac_enabled_p): Declare it. * config/arm/arm.cc (arm_arch8m_main): Define it. (arm_option_reconfigure_globals): Set arm_arch8m_main. (arm_compute_frame_layout, arm_expand_prologue) (thumb2_expand_return, arm_expand_epilogue) (arm_conditional_register_usage): Update for pac codegen. (arm_current_function_pac_enabled_p): New function. (aarch_bti_enabled) New function. (use_return_insn): Return zero when pac is enabled. * config/arm/arm.md (pac_ip_lr_sp, pacbti_ip_lr_sp, aut_ip_lr_sp): Add new patterns. * config/arm/unspecs.md (UNSPEC_PAC_NOP) (VUNSPEC_PACBTI_NOP, VUNSPEC_AUT_NOP): Add unspecs. gcc/testsuite/ * gcc.target/arm/pac.h : New file. * gcc.target/arm/pac-1.c : New test case. * gcc.target/arm/pac-2.c : Likewise. * gcc.target/arm/pac-3.c : Likewise. * gcc.target/arm/pac-4.c : Likewise. * gcc.target/arm/pac-5.c : Likewise. * gcc.target/arm/pac-6.c : Likewise. * gcc.target/arm/pac-7.c : Likewise. * gcc.target/arm/pac-8.c : Likewise. * gcc.target/arm/pac-9.c : Likewise. * gcc.target/arm/pac-10.c : Likewise. * gcc.target/arm/pac-11.c : Likewise. --- gcc/config/arm/arm-protos.h | 1 + gcc/config/arm/arm.cc | 80 +++++++++++++++++++++++++++++++---- gcc/config/arm/arm.h | 4 ++ gcc/config/arm/arm.md | 23 ++++++++++ gcc/config/arm/unspecs.md | 3 ++ gcc/testsuite/gcc.target/arm/pac-1.c | 11 +++++ gcc/testsuite/gcc.target/arm/pac-10.c | 10 +++++ gcc/testsuite/gcc.target/arm/pac-11.c | 10 +++++ gcc/testsuite/gcc.target/arm/pac-2.c | 11 +++++ gcc/testsuite/gcc.target/arm/pac-3.c | 11 +++++ gcc/testsuite/gcc.target/arm/pac-4.c | 10 +++++ gcc/testsuite/gcc.target/arm/pac-5.c | 28 ++++++++++++ gcc/testsuite/gcc.target/arm/pac-6.c | 18 ++++++++ gcc/testsuite/gcc.target/arm/pac-7.c | 32 ++++++++++++++ gcc/testsuite/gcc.target/arm/pac-8.c | 34 +++++++++++++++ gcc/testsuite/gcc.target/arm/pac-9.c | 11 +++++ gcc/testsuite/gcc.target/arm/pac.h | 17 ++++++++ 17 files changed, 305 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/pac-1.c create mode 100644 gcc/testsuite/gcc.target/arm/pac-10.c create mode 100644 gcc/testsuite/gcc.target/arm/pac-11.c create mode 100644 gcc/testsuite/gcc.target/arm/pac-2.c create mode 100644 gcc/testsuite/gcc.target/arm/pac-3.c create mode 100644 gcc/testsuite/gcc.target/arm/pac-4.c create mode 100644 gcc/testsuite/gcc.target/arm/pac-5.c create mode 100644 gcc/testsuite/gcc.target/arm/pac-6.c create mode 100644 gcc/testsuite/gcc.target/arm/pac-7.c create mode 100644 gcc/testsuite/gcc.target/arm/pac-8.c create mode 100644 gcc/testsuite/gcc.target/arm/pac-9.c create mode 100644 gcc/testsuite/gcc.target/arm/pac.h (limited to 'gcc') diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index 4c0376e..29a4ce5 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -379,6 +379,7 @@ extern int vfp3_const_double_for_bits (rtx); extern void arm_emit_coreregs_64bit_shift (enum rtx_code, rtx, rtx, rtx, rtx, rtx); extern bool arm_fusion_enabled_p (tune_params::fuse_ops); +extern bool arm_current_function_pac_enabled_p (void); extern bool arm_valid_symbolic_address_p (rtx); extern bool arm_validize_comparison (rtx *, rtx *, rtx *); extern bool arm_expand_vector_compare (rtx, rtx_code, rtx, rtx, bool); diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc index 358b813..33ec15c 100644 --- a/gcc/config/arm/arm.cc +++ b/gcc/config/arm/arm.cc @@ -923,6 +923,11 @@ int arm_arch8_3 = 0; /* Nonzero if this chip supports the ARM Architecture 8.4 extensions. */ int arm_arch8_4 = 0; + +/* Nonzero if this chip supports the ARM Architecture 8-M Mainline + extensions. */ +int arm_arch8m_main = 0; + /* Nonzero if this chip supports the ARM Architecture 8.1-M Mainline extensions. */ int arm_arch8_1m_main = 0; @@ -3205,6 +3210,15 @@ arm_option_override_internal (struct gcc_options *opts, arm_stack_protector_guard_offset = offs; } + if (arm_current_function_pac_enabled_p ()) + { + if (!arm_arch8m_main) + error ("This architecture does not support branch protection " + "instructions"); + if (TARGET_TPCS_FRAME) + sorry ("Return address signing is not supported with %<-mtpcs-frame%>."); + } + #ifdef SUBTARGET_OVERRIDE_INTERNAL_OPTIONS SUBTARGET_OVERRIDE_INTERNAL_OPTIONS; #endif @@ -3851,6 +3865,7 @@ arm_option_reconfigure_globals (void) arm_arch_arm_hwdiv = bitmap_bit_p (arm_active_target.isa, isa_bit_adiv); arm_arch_crc = bitmap_bit_p (arm_active_target.isa, isa_bit_crc32); arm_arch_cmse = bitmap_bit_p (arm_active_target.isa, isa_bit_cmse); + arm_arch8m_main = arm_arch7 && arm_arch_cmse; arm_arch_lpae = bitmap_bit_p (arm_active_target.isa, isa_bit_lpae); arm_arch_i8mm = bitmap_bit_p (arm_active_target.isa, isa_bit_i8mm); arm_arch_bf16 = bitmap_bit_p (arm_active_target.isa, isa_bit_bf16); @@ -4350,6 +4365,12 @@ use_return_insn (int iscond, rtx sibling) if (!reload_completed) return 0; + /* Never use a return instruction when return address signing + mechanism is enabled as it requires more than one + instruction. */ + if (arm_current_function_pac_enabled_p ()) + return 0; + func_type = arm_current_func_type (); /* Naked, volatile and stack alignment functions need special @@ -21245,6 +21266,9 @@ arm_compute_save_core_reg_mask (void) save_reg_mask |= arm_compute_save_reg0_reg12_mask (); + if (arm_current_function_pac_enabled_p ()) + save_reg_mask |= 1 << IP_REGNUM; + /* Decide if we need to save the link register. Interrupt routines have their own banked link register, so they never need to save it. @@ -23536,12 +23560,13 @@ arm_expand_prologue (void) /* The static chain register is the same as the IP register. If it is clobbered when creating the frame, we need to save and restore it. */ - clobber_ip = IS_NESTED (func_type) - && ((TARGET_APCS_FRAME && frame_pointer_needed && TARGET_ARM) - || ((flag_stack_check == STATIC_BUILTIN_STACK_CHECK - || flag_stack_clash_protection) - && !df_regs_ever_live_p (LR_REGNUM) - && arm_r3_live_at_start_p ())); + clobber_ip = (IS_NESTED (func_type) + && (((TARGET_APCS_FRAME && frame_pointer_needed && TARGET_ARM) + || ((flag_stack_check == STATIC_BUILTIN_STACK_CHECK + || flag_stack_clash_protection) + && !df_regs_ever_live_p (LR_REGNUM) + && arm_r3_live_at_start_p ())) + || arm_current_function_pac_enabled_p ())); /* Find somewhere to store IP whilst the frame is being created. We try the following places in order: @@ -23566,7 +23591,6 @@ arm_expand_prologue (void) { rtx addr, dwarf; - gcc_assert(arm_compute_static_chain_stack_bytes() == 4); saved_regs += 4; addr = gen_rtx_PRE_DEC (Pmode, stack_pointer_rtx); @@ -23617,6 +23641,17 @@ arm_expand_prologue (void) } } + if (arm_current_function_pac_enabled_p ()) + { + /* If IP was clobbered we only emit a PAC instruction as the BTI + one will be added before the push of the clobbered IP (if + necessary) by the bti pass. */ + if (aarch_bti_enabled () && !clobber_ip) + emit_insn (gen_pacbti_nop ()); + else + emit_insn (gen_pac_nop ()); + } + if (TARGET_APCS_FRAME && frame_pointer_needed && TARGET_ARM) { if (IS_INTERRUPT (func_type)) @@ -27428,7 +27463,14 @@ thumb2_expand_return (bool simple_return) to assert it for now to ensure that future code changes do not silently change this behavior. */ gcc_assert (!IS_CMSE_ENTRY (arm_current_func_type ())); - if (num_regs == 1) + if (arm_current_function_pac_enabled_p ()) + { + gcc_assert (!(saved_regs_mask & (1 << PC_REGNUM))); + arm_emit_multi_reg_pop (saved_regs_mask); + emit_insn (gen_aut_nop ()); + emit_jump_insn (simple_return_rtx); + } + else if (num_regs == 1) { rtx par = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (2)); rtx reg = gen_rtx_REG (SImode, PC_REGNUM); @@ -27852,7 +27894,8 @@ arm_expand_epilogue (bool really_return) && really_return && crtl->args.pretend_args_size == 0 && saved_regs_mask & (1 << LR_REGNUM) - && !crtl->calls_eh_return) + && !crtl->calls_eh_return + && !arm_current_function_pac_enabled_p ()) { saved_regs_mask &= ~(1 << LR_REGNUM); saved_regs_mask |= (1 << PC_REGNUM); @@ -27966,6 +28009,9 @@ arm_expand_epilogue (bool really_return) } } + if (arm_current_function_pac_enabled_p ()) + emit_insn (gen_aut_nop ()); + if (!really_return) return; @@ -33067,6 +33113,22 @@ arm_fusion_enabled_p (tune_params::fuse_ops op) return current_tune->fusible_ops & op; } +/* Return TRUE if return address signing mechanism is enabled. */ +bool +arm_current_function_pac_enabled_p (void) +{ + return (aarch_ra_sign_scope == AARCH_FUNCTION_ALL + || (aarch_ra_sign_scope == AARCH_FUNCTION_NON_LEAF + && !crtl->is_leaf)); +} + +/* Return TRUE if Branch Target Identification Mechanism is enabled. */ +static bool +aarch_bti_enabled () +{ + return false; +} + /* Implement TARGET_SCHED_CAN_SPECULATE_INSN. Return true if INSN can be scheduled for speculative execution. Reject the long-running division and square-root instructions. */ diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 79b9f44..97e2fda 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -506,6 +506,10 @@ extern int arm_arch8_3; /* Nonzero if this chip supports the ARM Architecture 8.4 extensions. */ extern int arm_arch8_4; +/* Nonzero if this chip supports the ARM Architecture 8-M Mainline + extensions. */ +extern int arm_arch8m_main; + /* Nonzero if this chip supports the ARM Architecture 8.1-M Mainline extensions. */ extern int arm_arch8_1m_main; diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 3710c5c..2695d0b 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -12986,6 +12986,29 @@ (set_attr "length" "8")] ) +(define_insn "pac_nop" + [(set (reg:SI IP_REGNUM) + (unspec:SI [(reg:SI SP_REGNUM) (reg:SI LR_REGNUM)] + UNSPEC_PAC_NOP))] + "arm_arch8m_main" + "pac\t%|ip, %|lr, %|sp" + [(set_attr "conds" "unconditional")]) + +(define_insn "pacbti_nop" + [(set (reg:SI IP_REGNUM) + (unspec_volatile:SI [(reg:SI SP_REGNUM) (reg:SI LR_REGNUM)] + VUNSPEC_PACBTI_NOP))] + "arm_arch8m_main" + "pacbti\t%|ip, %|lr, %|sp" + [(set_attr "conds" "unconditional")]) + +(define_insn "aut_nop" + [(unspec_volatile:SI [(reg:SI IP_REGNUM) (reg:SI SP_REGNUM) (reg:SI LR_REGNUM)] + VUNSPEC_AUT_NOP)] + "arm_arch8m_main" + "aut\t%|ip, %|lr, %|sp" + [(set_attr "conds" "unconditional")]) + ;; Vector bits common to IWMMXT, Neon and MVE (include "vec-common.md") ;; Load the Intel Wireless Multimedia Extension patterns diff --git a/gcc/config/arm/unspecs.md b/gcc/config/arm/unspecs.md index 2ef6a0f..5e964e6 100644 --- a/gcc/config/arm/unspecs.md +++ b/gcc/config/arm/unspecs.md @@ -159,6 +159,7 @@ UNSPEC_VCDE ; Custom Datapath Extension instruction. UNSPEC_VCDEA ; Custom Datapath Extension instruction. UNSPEC_DLS ; Used for DLS (Do Loop Start), Armv8.1-M Mainline instruction + UNSPEC_PAC_NOP ; Represents PAC signing LR ]) @@ -254,6 +255,8 @@ ; instruction. VUNSPEC_VLLDM ; Represent the lazy load multiple with vlldm ; instruction. + VUNSPEC_PACBTI_NOP ; Represents PAC signing LR + valid landing pad + VUNSPEC_AUT_NOP ; Represents PAC verifying LR ]) ;; Enumerators for NEON unspecs. diff --git a/gcc/testsuite/gcc.target/arm/pac-1.c b/gcc/testsuite/gcc.target/arm/pac-1.c new file mode 100644 index 0000000..9b26f62 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-1.c @@ -0,0 +1,11 @@ +/* Testing return address signing. */ +/* { dg-do run } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-options "-march=armv8.1-m.main+pacbti+fp -mbranch-protection=pac-ret+leaf -mthumb -mfloat-abi=hard --save-temps -O0" } */ + +#include "pac.h" + +/* { dg-final { scan-assembler-times "pac\tip, lr, sp" 2 } } */ +/* { dg-final { scan-assembler-times "aut\tip, lr, sp" 2 } } */ +/* { dg-final { scan-assembler-not "\tbti" } } */ diff --git a/gcc/testsuite/gcc.target/arm/pac-10.c b/gcc/testsuite/gcc.target/arm/pac-10.c new file mode 100644 index 0000000..a794195 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-10.c @@ -0,0 +1,10 @@ +/* Testing return address signing. */ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-options "-march=armv8.1-m.main+pacbti+fp -mbranch-protection=pac-ret -mthumb -mfloat-abi=hard --save-temps -O0" } */ + +#include "pac.h" + +/* { dg-final { scan-assembler "pac\tip, lr, sp" } } */ +/* { dg-final { scan-assembler "aut\tip, lr, sp" } } */ +/* { dg-final { scan-assembler-not "\tbti" } } */ diff --git a/gcc/testsuite/gcc.target/arm/pac-11.c b/gcc/testsuite/gcc.target/arm/pac-11.c new file mode 100644 index 0000000..37ffc93 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-11.c @@ -0,0 +1,10 @@ +/* Testing return address signing. */ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-options "-march=armv8.1-m.main+pacbti+fp -mbranch-protection=bti+pac-ret+leaf -mthumb -mfloat-abi=hard --save-temps -O2" } */ + +#include "pac.h" + +/* { dg-final { scan-assembler-times "pacbti\tip, lr, sp" 2 } } */ +/* { dg-final { scan-assembler-times "aut\tip, lr, sp" 2 } } */ +/* { dg-final { scan-assembler-not "\tbti" } } */ diff --git a/gcc/testsuite/gcc.target/arm/pac-2.c b/gcc/testsuite/gcc.target/arm/pac-2.c new file mode 100644 index 0000000..945ce93 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-2.c @@ -0,0 +1,11 @@ +/* Testing return address signing. */ +/* { dg-do run } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-options "-march=armv8.1-m.main+pacbti+fp -mbranch-protection=pac-ret -mthumb -mfloat-abi=hard --save-temps -O0" } */ + +#include "pac.h" + +/* { dg-final { scan-assembler "pac\tip, lr, sp" } } */ +/* { dg-final { scan-assembler "aut\tip, lr, sp" } } */ +/* { dg-final { scan-assembler-not "\tbti" } } */ diff --git a/gcc/testsuite/gcc.target/arm/pac-3.c b/gcc/testsuite/gcc.target/arm/pac-3.c new file mode 100644 index 0000000..47e290a --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-3.c @@ -0,0 +1,11 @@ +/* Testing return address signing. */ +/* { dg-do run } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-options "-march=armv8.1-m.main+pacbti+fp -mbranch-protection=bti+pac-ret+leaf -mthumb -mfloat-abi=hard --save-temps -O2" } */ + +#include "pac.h" + +/* { dg-final { scan-assembler-times "pacbti\tip, lr, sp" 2 } } */ +/* { dg-final { scan-assembler-times "aut\tip, lr, sp" 2 } } */ +/* { dg-final { scan-assembler-not "\tbti" } } */ diff --git a/gcc/testsuite/gcc.target/arm/pac-4.c b/gcc/testsuite/gcc.target/arm/pac-4.c new file mode 100644 index 0000000..cf915cd --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-4.c @@ -0,0 +1,10 @@ +/* Testing return address signing. */ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-options "-march=armv8.1-m.main+pacbti+fp -mthumb -mfloat-abi=hard --save-temps -O2" } */ + +#include "pac.h" + +/* { dg-final { scan-assembler-not "\tbti\t" } } */ +/* { dg-final { scan-assembler-not "\tpac\t" } } */ +/* { dg-final { scan-assembler-not "\tpacbti\t" } } */ diff --git a/gcc/testsuite/gcc.target/arm/pac-5.c b/gcc/testsuite/gcc.target/arm/pac-5.c new file mode 100644 index 0000000..c70087e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-5.c @@ -0,0 +1,28 @@ +/* Testing return address signing. */ +/* { dg-do run } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-options "-march=armv8.1-m.main+pacbti+fp -mbranch-protection=pac-ret+leaf -mthumb -mfloat-abi=hard --save-temps -O0" } */ + +#include + +int +__attribute__((noinline)) +foo1 (int a, int b) +{ + int square (int z) { return z * z; } + return square (a) + square (b); +} + +int +main (void) +{ + if (foo1 (1, 2) != 5) + abort (); + + return 0; +} + +/* { dg-final { scan-assembler-times "pac\tip, lr, sp" 3 } } */ +/* { dg-final { scan-assembler-times "aut\tip, lr, sp" 3 } } */ +/* { dg-final { scan-assembler-not "\tbti" } } */ diff --git a/gcc/testsuite/gcc.target/arm/pac-6.c b/gcc/testsuite/gcc.target/arm/pac-6.c new file mode 100644 index 0000000..c5329f0 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-6.c @@ -0,0 +1,18 @@ +/* Check that GCC does .save and .cfi_offset directives with RA_AUTH_CODE pseudo hard-register. */ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-options "-march=armv8.1-m.main+fp -mbranch-protection=pac-ret+leaf -mthumb --save-temps -O0 -g" } */ + +int i; + +void foo (int); + +int bar() +{ + foo (i); + return 0; +} + +/* { dg-final { scan-assembler "pac\tip, lr, sp" } } */ +/* { dg-final { scan-assembler "aut\tip, lr, sp" } } */ +/* { dg-final { scan-assembler-not "bti" } } */ diff --git a/gcc/testsuite/gcc.target/arm/pac-7.c b/gcc/testsuite/gcc.target/arm/pac-7.c new file mode 100644 index 0000000..cdaebca --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-7.c @@ -0,0 +1,32 @@ +/* Testing return address signing. */ +/* { dg-do run } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-options "-march=armv8.1-m.main+pacbti+fp -mbranch-protection=pac-ret+leaf -mthumb -mfloat-abi=hard --save-temps -O0" } */ + +#include + +int +__attribute__((noinline)) +foo1 (int a, int b) +{ + int x = 4; + int foo2 (int a, int b) + { + return a + b + x; + } + return foo2 (a, b); +} + +int +main (void) +{ + if (foo1 (1, 2) != 7) + abort (); + + return 0; +} + +/* { dg-final { scan-assembler-times "pac\tip, lr, sp" 3 } } */ +/* { dg-final { scan-assembler-times "aut\tip, lr, sp" 3 } } */ +/* { dg-final { scan-assembler-not "\tbti" } } */ diff --git a/gcc/testsuite/gcc.target/arm/pac-8.c b/gcc/testsuite/gcc.target/arm/pac-8.c new file mode 100644 index 0000000..3f37dcf --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-8.c @@ -0,0 +1,34 @@ +/* Testing return address signing. */ +/* { dg-do run } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-options "-march=armv8.1-m.main+pacbti+fp -mbranch-protection=pac-ret+leaf -mthumb -mfloat-abi=hard --save-temps -O0" } */ + +#include +#include + +int acc (int n, ...) +{ + int sum = 0; + va_list ptr; + + va_start (ptr, n); + + for (int i = 0; i < n; i++) + sum += va_arg (ptr, int); + va_end (ptr); + + return sum; +} + +int main() +{ + if (acc (3, 1, 2, 3) != 6) + abort (); + + return 0; +} + +/* { dg-final { scan-assembler-times "pac\tip, lr, sp" 2 } } */ +/* { dg-final { scan-assembler-times "aut\tip, lr, sp" 2 } } */ +/* { dg-final { scan-assembler-not "\tbti" } } */ diff --git a/gcc/testsuite/gcc.target/arm/pac-9.c b/gcc/testsuite/gcc.target/arm/pac-9.c new file mode 100644 index 0000000..ee2fad2 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-9.c @@ -0,0 +1,11 @@ +/* Testing return address signing. */ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-options "-march=armv8.1-m.main+pacbti+fp -mbranch-protection=pac-ret+leaf -mthumb -mfloat-abi=hard --save-temps -O0" } */ + +#include "pac.h" + +/* { dg-final { scan-assembler-times "pac\tip, lr, sp" 2 } } */ +/* { dg-final { scan-assembler-times "aut\tip, lr, sp" 2 } } */ +/* { dg-final { scan-assembler-not "\tbti" } } */ + diff --git a/gcc/testsuite/gcc.target/arm/pac.h b/gcc/testsuite/gcc.target/arm/pac.h new file mode 100644 index 0000000..7355e6b --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac.h @@ -0,0 +1,17 @@ +#include + +int +__attribute__((noinline)) +foo1 (int a, int b) +{ + return a + b; +} + +int +main (void) +{ + if (foo1 (1, 2) != 3) + abort (); + + return 0; +} -- cgit v1.1 From f7ad35a3ff369e10a6db6098439ca346b9e668de Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Thu, 7 Apr 2022 11:50:03 +0200 Subject: [PATCH 11/15] aarch64: Make bti pass generic so it can be used by the arm backend Hi all, this patch splits and restructures the aarch64 bti pass code in order to have it usable by the arm backend as well. These changes have no functional impact. Best Regards Andrea gcc/Changelog * config.gcc (aarch64*-*-*): Rename 'aarch64-bti-insert.o' into 'aarch-bti-insert.o'. * config/aarch64/aarch64-protos.h: Remove 'aarch64_bti_enabled' proto. * config/aarch64/aarch64.cc (aarch_bti_enabled): Rename. (aarch_bti_j_insn_p, aarch_pac_insn_p): New functions. (aarch64_output_mi_thunk) (aarch64_print_patchable_function_entry) (aarch64_file_end_indicate_exec_stack): Update renamed function calls to renamed functions. * config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Likewise. * config/aarch64/t-aarch64 (aarch-bti-insert.o): Update target. * config/aarch64/aarch64-bti-insert.cc: Delete. * config/arm/aarch-bti-insert.cc: New file including and generalizing code from aarch64-bti-insert.cc. * config/arm/aarch-common-protos.h: Update. --- gcc/config.gcc | 2 +- gcc/config/aarch64/aarch64-bti-insert.cc | 248 ------------------------------- gcc/config/aarch64/aarch64-c.cc | 2 +- gcc/config/aarch64/aarch64-protos.h | 1 - gcc/config/aarch64/aarch64.cc | 58 +++++++- gcc/config/aarch64/t-aarch64 | 4 +- gcc/config/arm/aarch-bti-insert.cc | 209 ++++++++++++++++++++++++++ gcc/config/arm/aarch-common-protos.h | 5 + 8 files changed, 272 insertions(+), 257 deletions(-) delete mode 100644 gcc/config/aarch64/aarch64-bti-insert.cc create mode 100644 gcc/config/arm/aarch-bti-insert.cc (limited to 'gcc') diff --git a/gcc/config.gcc b/gcc/config.gcc index f89a071..0d5a5ee 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -338,7 +338,7 @@ aarch64*-*-*) c_target_objs="aarch64-c.o" cxx_target_objs="aarch64-c.o" d_target_objs="aarch64-d.o" - extra_objs="aarch64-builtins.o aarch-common.o aarch64-sve-builtins.o aarch64-sve-builtins-shapes.o aarch64-sve-builtins-base.o aarch64-sve-builtins-sve2.o cortex-a57-fma-steering.o aarch64-speculation.o falkor-tag-collision-avoidance.o aarch64-bti-insert.o aarch64-cc-fusion.o" + extra_objs="aarch64-builtins.o aarch-common.o aarch64-sve-builtins.o aarch64-sve-builtins-shapes.o aarch64-sve-builtins-base.o aarch64-sve-builtins-sve2.o cortex-a57-fma-steering.o aarch64-speculation.o falkor-tag-collision-avoidance.o aarch-bti-insert.o aarch64-cc-fusion.o" target_gtfiles="\$(srcdir)/config/aarch64/aarch64-builtins.cc \$(srcdir)/config/aarch64/aarch64-sve-builtins.h \$(srcdir)/config/aarch64/aarch64-sve-builtins.cc" target_has_targetm_common=yes ;; diff --git a/gcc/config/aarch64/aarch64-bti-insert.cc b/gcc/config/aarch64/aarch64-bti-insert.cc deleted file mode 100644 index f34201d..0000000 --- a/gcc/config/aarch64/aarch64-bti-insert.cc +++ /dev/null @@ -1,248 +0,0 @@ -/* Branch Target Identification for AArch64 architecture. - Copyright (C) 2019-2023 Free Software Foundation, Inc. - Contributed by Arm Ltd. - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - GCC is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING3. If not see - . */ - -#define IN_TARGET_CODE 1 - -#include "config.h" -#define INCLUDE_STRING -#include "system.h" -#include "coretypes.h" -#include "backend.h" -#include "target.h" -#include "rtl.h" -#include "tree.h" -#include "memmodel.h" -#include "gimple.h" -#include "tm_p.h" -#include "stringpool.h" -#include "attribs.h" -#include "emit-rtl.h" -#include "gimplify.h" -#include "gimple-iterator.h" -#include "dumpfile.h" -#include "rtl-iter.h" -#include "cfgrtl.h" -#include "tree-pass.h" -#include "cgraph.h" - -/* This pass enables the support for Branch Target Identification Mechanism - for AArch64. This is a new security feature introduced in ARMv8.5-A - archtitecture. A BTI instruction is used to guard against the execution - of instructions which are not the intended target of an indirect branch. - - Outside of a guarded memory region, a BTI instruction executes as a NOP. - Within a guarded memory region any target of an indirect branch must be - a compatible BTI or BRK, HLT, PACIASP, PACIBASP instruction (even if the - branch is triggered in a non-guarded memory region). An incompatibility - generates a Branch Target Exception. - - The compatibility of the BTI instruction is as follows: - BTI j : Can be a target of any indirect jump (BR Xn). - BTI c : Can be a target of any indirect call (BLR Xn and BR X16/X17). - BTI jc: Can be a target of any indirect call or indirect jump. - BTI : Can not be a target of any indirect call or indirect jump. - - In order to enable this mechanism, this pass iterates through the - control flow of the code and adds appropriate BTI instructions : - * Add a new "BTI C" at the beginning of a function, unless its already - protected by a "PACIASP/PACIBSP". We exempt the functions that are only - called directly. - * Add a new "BTI J" for every target of an indirect jump, jump table targets, - non-local goto targets or labels that might be referenced by variables, - constant pools, etc (NOTE_INSN_DELETED_LABEL) - - Since we have already changed the use of indirect tail calls to only x16 - and x17, we do not have to use "BTI JC". - - This pass is triggered by the command line option -mbranch-protection=bti or - -mbranch-protection=standard. Since all the BTI instructions are in the HINT - space, this pass does not require any minimum architecture version. */ - -namespace { - -const pass_data pass_data_insert_bti = -{ - RTL_PASS, /* type. */ - "bti", /* name. */ - OPTGROUP_NONE, /* optinfo_flags. */ - TV_MACH_DEP, /* tv_id. */ - 0, /* properties_required. */ - 0, /* properties_provided. */ - 0, /* properties_destroyed. */ - 0, /* todo_flags_start. */ - 0, /* todo_flags_finish. */ -}; - -/* Check if X (or any sub-rtx of X) is a PACIASP/PACIBSP instruction. */ -static bool -aarch64_pac_insn_p (rtx x) -{ - if (!INSN_P (x)) - return false; - - subrtx_var_iterator::array_type array; - FOR_EACH_SUBRTX_VAR (iter, array, PATTERN (x), ALL) - { - rtx sub = *iter; - if (sub && GET_CODE (sub) == UNSPEC) - { - int unspec_val = XINT (sub, 1); - switch (unspec_val) - { - case UNSPEC_PACIASP: - /* fall-through. */ - case UNSPEC_PACIBSP: - return true; - - default: - return false; - } - iter.skip_subrtxes (); - } - } - return false; -} - -/* Check if INSN is a BTI J insn. */ -static bool -aarch64_bti_j_insn_p (rtx_insn *insn) -{ - if (!insn || !INSN_P (insn)) - return false; - - rtx pat = PATTERN (insn); - return GET_CODE (pat) == UNSPEC_VOLATILE && XINT (pat, 1) == UNSPECV_BTI_J; -} - -/* Insert the BTI instruction. */ -/* This is implemented as a late RTL pass that runs before branch - shortening and does the following. */ -static unsigned int -rest_of_insert_bti (void) -{ - timevar_push (TV_MACH_DEP); - - rtx bti_insn; - rtx_insn *insn; - basic_block bb; - - bb = 0; - FOR_EACH_BB_FN (bb, cfun) - { - for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb)); - insn = NEXT_INSN (insn)) - { - /* If a label is marked to be preserved or can be a non-local goto - target, it must be protected with a BTI J. */ - if (LABEL_P (insn) - && (LABEL_PRESERVE_P (insn) - || bb->flags & BB_NON_LOCAL_GOTO_TARGET)) - { - bti_insn = gen_bti_j (); - emit_insn_after (bti_insn, insn); - continue; - } - - /* There could still be more labels that are valid targets of a - BTI J instuction. To find them we start looking through the - JUMP_INSN. If it jumps to a jump table, then we find all labels - of the jump table to protect with a BTI J. */ - if (JUMP_P (insn)) - { - rtx_jump_table_data *table; - if (tablejump_p (insn, NULL, &table)) - { - rtvec vec = table->get_labels (); - int j; - rtx_insn *label; - - for (j = GET_NUM_ELEM (vec) - 1; j >= 0; --j) - { - label = as_a (XEXP (RTVEC_ELT (vec, j), 0)); - rtx_insn *next = next_nonnote_nondebug_insn (label); - if (aarch64_bti_j_insn_p (next)) - continue; - - bti_insn = gen_bti_j (); - emit_insn_after (bti_insn, label); - } - } - } - - /* Also look for calls to setjmp () which would be marked with - REG_SETJMP note and put a BTI J after. This is where longjump () - will return. */ - if (CALL_P (insn) && (find_reg_note (insn, REG_SETJMP, NULL))) - { - bti_insn = gen_bti_j (); - emit_insn_after (bti_insn, insn); - continue; - } - } - } - - /* Since a Branch Target Exception can only be triggered by an indirect call, - we exempt function that are only called directly. We also exempt - functions that are already protected by Return Address Signing (PACIASP/ - PACIBSP). For all other cases insert a BTI C at the beginning of the - function. */ - if (!cgraph_node::get (cfun->decl)->only_called_directly_p ()) - { - bb = ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb; - insn = BB_HEAD (bb); - if (!aarch64_pac_insn_p (get_first_nonnote_insn ())) - { - bti_insn = gen_bti_c (); - emit_insn_before (bti_insn, insn); - } - } - - timevar_pop (TV_MACH_DEP); - return 0; -} - - -class pass_insert_bti : public rtl_opt_pass -{ -public: - pass_insert_bti (gcc::context *ctxt) - : rtl_opt_pass (pass_data_insert_bti, ctxt) - {} - - /* opt_pass methods: */ - virtual bool gate (function *) - { - return aarch64_bti_enabled (); - } - - virtual unsigned int execute (function *) - { - return rest_of_insert_bti (); - } - -}; // class pass_insert_bti - -} // anon namespace - -rtl_opt_pass * -make_pass_insert_bti (gcc::context *ctxt) -{ - return new pass_insert_bti (ctxt); -} diff --git a/gcc/config/aarch64/aarch64-c.cc b/gcc/config/aarch64/aarch64-c.cc index a016ee0..578ec6f 100644 --- a/gcc/config/aarch64/aarch64-c.cc +++ b/gcc/config/aarch64/aarch64-c.cc @@ -179,7 +179,7 @@ aarch64_update_cpp_builtins (cpp_reader *pfile) aarch64_def_or_undef (TARGET_RNG, "__ARM_FEATURE_RNG", pfile); aarch64_def_or_undef (TARGET_MEMTAG, "__ARM_FEATURE_MEMORY_TAGGING", pfile); - aarch64_def_or_undef (aarch64_bti_enabled (), + aarch64_def_or_undef (aarch_bti_enabled (), "__ARM_FEATURE_BTI_DEFAULT", pfile); cpp_undef (pfile, "__ARM_FEATURE_PAC_DEFAULT"); diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 9bd8bfe..6ab6d49 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -905,7 +905,6 @@ void aarch64_register_pragmas (void); void aarch64_relayout_simd_types (void); void aarch64_reset_previous_fndecl (void); bool aarch64_return_address_signing_enabled (void); -bool aarch64_bti_enabled (void); void aarch64_save_restore_target_globals (tree); void aarch64_addti_scratch_regs (rtx, rtx, rtx *, rtx *, rtx *, diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index a482d93..3105eb0 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -8935,11 +8935,61 @@ aarch64_return_address_signing_enabled (void) /* Return TRUE if Branch Target Identification Mechanism is enabled. */ bool -aarch64_bti_enabled (void) +aarch_bti_enabled (void) { return (aarch_enable_bti == 1); } +/* Check if INSN is a BTI J insn. */ +bool +aarch_bti_j_insn_p (rtx_insn *insn) +{ + if (!insn || !INSN_P (insn)) + return false; + + rtx pat = PATTERN (insn); + return GET_CODE (pat) == UNSPEC_VOLATILE && XINT (pat, 1) == UNSPECV_BTI_J; +} + +/* Check if X (or any sub-rtx of X) is a PACIASP/PACIBSP instruction. */ +bool +aarch_pac_insn_p (rtx x) +{ + if (!INSN_P (x)) + return false; + + subrtx_var_iterator::array_type array; + FOR_EACH_SUBRTX_VAR (iter, array, PATTERN (x), ALL) + { + rtx sub = *iter; + if (sub && GET_CODE (sub) == UNSPEC) + { + int unspec_val = XINT (sub, 1); + switch (unspec_val) + { + case UNSPEC_PACIASP: + case UNSPEC_PACIBSP: + return true; + + default: + return false; + } + iter.skip_subrtxes (); + } + } + return false; +} + +rtx aarch_gen_bti_c (void) +{ + return gen_bti_c (); +} + +rtx aarch_gen_bti_j (void) +{ + return gen_bti_j (); +} + /* The caller is going to use ST1D or LD1D to save or restore an SVE register in mode MODE at BASE_RTX + OFFSET, where OFFSET is in the range [1, 16] * GET_MODE_SIZE (MODE). Prepare for this by: @@ -10319,7 +10369,7 @@ aarch64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, rtx_insn *insn; const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk)); - if (aarch64_bti_enabled ()) + if (aarch_bti_enabled ()) emit_insn (gen_bti_c()); reload_completed = 1; @@ -22636,7 +22686,7 @@ aarch64_print_patchable_function_entry (FILE *file, GEN_INT (record_p)); basic_block bb = ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb; - if (!aarch64_bti_enabled () + if (!aarch_bti_enabled () || cgraph_node::get (cfun->decl)->only_called_directly_p ()) { /* Emit the patchable_area at the beginning of the function. */ @@ -27107,7 +27157,7 @@ aarch64_file_end_indicate_exec_stack () file_end_indicate_exec_stack (); unsigned feature_1_and = 0; - if (aarch64_bti_enabled ()) + if (aarch_bti_enabled ()) feature_1_and |= GNU_PROPERTY_AARCH64_FEATURE_1_BTI; if (aarch_ra_sign_scope != AARCH_FUNCTION_NONE) diff --git a/gcc/config/aarch64/t-aarch64 b/gcc/config/aarch64/t-aarch64 index dccf101..a9a244a 100644 --- a/gcc/config/aarch64/t-aarch64 +++ b/gcc/config/aarch64/t-aarch64 @@ -161,14 +161,14 @@ falkor-tag-collision-avoidance.o: \ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(srcdir)/config/aarch64/falkor-tag-collision-avoidance.cc -aarch64-bti-insert.o: $(srcdir)/config/aarch64/aarch64-bti-insert.cc \ +aarch-bti-insert.o: $(srcdir)/config/arm/aarch-bti-insert.cc \ $(CONFIG_H) $(SYSTEM_H) $(TM_H) $(REGS_H) insn-config.h $(RTL_BASE_H) \ dominance.h cfg.h cfganal.h $(BASIC_BLOCK_H) $(INSN_ATTR_H) $(RECOG_H) \ output.h hash-map.h $(DF_H) $(OBSTACK_H) $(TARGET_H) $(RTL_H) \ $(CONTEXT_H) $(TREE_PASS_H) regrename.h \ $(srcdir)/config/aarch64/aarch64-protos.h $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ - $(srcdir)/config/aarch64/aarch64-bti-insert.cc + $(srcdir)/config/arm/aarch-bti-insert.cc aarch64-cc-fusion.o: $(srcdir)/config/aarch64/aarch64-cc-fusion.cc \ $(CONFIG_H) $(SYSTEM_H) $(CORETYPES_H) $(BACKEND_H) $(RTL_H) $(DF_H) \ diff --git a/gcc/config/arm/aarch-bti-insert.cc b/gcc/config/arm/aarch-bti-insert.cc new file mode 100644 index 0000000..880f0de --- /dev/null +++ b/gcc/config/arm/aarch-bti-insert.cc @@ -0,0 +1,209 @@ +/* Branch Target Identification for AArch64 architecture. + Copyright (C) 2019-2023 Free Software Foundation, Inc. + Contributed by Arm Ltd. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#define IN_TARGET_CODE 1 + +#include "config.h" +#define INCLUDE_STRING +#include "system.h" +#include "coretypes.h" +#include "backend.h" +#include "target.h" +#include "rtl.h" +#include "tree.h" +#include "memmodel.h" +#include "gimple.h" +#include "tm_p.h" +#include "stringpool.h" +#include "attribs.h" +#include "emit-rtl.h" +#include "gimplify.h" +#include "gimple-iterator.h" +#include "dumpfile.h" +#include "rtl-iter.h" +#include "cfgrtl.h" +#include "tree-pass.h" +#include "cgraph.h" + +/* This pass enables the support for Branch Target Identification Mechanism for + Arm/AArch64. This is a security feature introduced in ARMv8.5-A + architecture and ARMv8.1-M. A BTI instruction is used to guard against the + execution of instructions which are not the intended target of an indirect + branch. + + Outside of a guarded memory region, a BTI instruction executes as a NOP. + Within a guarded memory region any target of an indirect branch must be + a compatible BTI or BRK, HLT, PACIASP, PACIBASP instruction (even if the + branch is triggered in a non-guarded memory region). An incompatibility + generates a Branch Target Exception. + + The compatibility of the BTI instruction is as follows (AArch64 + examples): + BTI j : Can be a target of any indirect jump (BR Xn). + BTI c : Can be a target of any indirect call (BLR Xn and BR X16/X17). + BTI jc: Can be a target of any indirect call or indirect jump. + BTI : Can not be a target of any indirect call or indirect jump. + + In order to enable this mechanism, this pass iterates through the + control flow of the code and adds appropriate BTI instructions : + * Add a new "BTI C" at the beginning of a function, unless its already + protected by a "PACIASP/PACIBSP". We exempt the functions that are only + called directly. + * Add a new "BTI J" for every target of an indirect jump, jump table targets, + non-local goto targets or labels that might be referenced by variables, + constant pools, etc (NOTE_INSN_DELETED_LABEL) + + Since we have already changed the use of indirect tail calls to only x16 + and x17, we do not have to use "BTI JC". + + This pass is triggered by the command line option -mbranch-protection=bti or + -mbranch-protection=standard. Since all the BTI instructions are in the HINT + space, this pass does not require any minimum architecture version. */ + +namespace { + +const pass_data pass_data_insert_bti = +{ + RTL_PASS, /* type. */ + "bti", /* name. */ + OPTGROUP_NONE, /* optinfo_flags. */ + TV_MACH_DEP, /* tv_id. */ + 0, /* properties_required. */ + 0, /* properties_provided. */ + 0, /* properties_destroyed. */ + 0, /* todo_flags_start. */ + 0, /* todo_flags_finish. */ +}; + +/* Insert the BTI instruction. */ +/* This is implemented as a late RTL pass that runs before branch + shortening and does the following. */ +static unsigned int +rest_of_insert_bti (void) +{ + timevar_push (TV_MACH_DEP); + + rtx bti_insn; + rtx_insn *insn; + basic_block bb; + + bb = 0; + FOR_EACH_BB_FN (bb, cfun) + { + for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb)); + insn = NEXT_INSN (insn)) + { + /* If a label is marked to be preserved or can be a non-local goto + target, it must be protected with a BTI J. */ + if (LABEL_P (insn) + && (LABEL_PRESERVE_P (insn) + || bb->flags & BB_NON_LOCAL_GOTO_TARGET)) + { + bti_insn = aarch_gen_bti_j (); + emit_insn_after (bti_insn, insn); + continue; + } + + /* There could still be more labels that are valid targets of a + BTI J instuction. To find them we start looking through the + JUMP_INSN. If it jumps to a jump table, then we find all labels + of the jump table to protect with a BTI J. */ + if (JUMP_P (insn)) + { + rtx_jump_table_data *table; + if (tablejump_p (insn, NULL, &table)) + { + rtvec vec = table->get_labels (); + int j; + rtx_insn *label; + + for (j = GET_NUM_ELEM (vec) - 1; j >= 0; --j) + { + label = as_a (XEXP (RTVEC_ELT (vec, j), 0)); + rtx_insn *next = next_nonnote_nondebug_insn (label); + if (aarch_bti_j_insn_p (next)) + continue; + + bti_insn = aarch_gen_bti_j (); + emit_insn_after (bti_insn, label); + } + } + } + + /* Also look for calls to setjmp () which would be marked with + REG_SETJMP note and put a BTI J after. This is where longjump () + will return. */ + if (CALL_P (insn) && (find_reg_note (insn, REG_SETJMP, NULL))) + { + bti_insn = aarch_gen_bti_j (); + emit_insn_after (bti_insn, insn); + continue; + } + } + } + + /* Since a Branch Target Exception can only be triggered by an indirect call, + we exempt function that are only called directly. We also exempt + functions that are already protected by Return Address Signing (PACIASP/ + PACIBSP). For all other cases insert a BTI C at the beginning of the + function. */ + if (!cgraph_node::get (cfun->decl)->only_called_directly_p ()) + { + bb = ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb; + insn = BB_HEAD (bb); + if (!aarch_pac_insn_p (get_first_nonnote_insn ())) + { + bti_insn = aarch_gen_bti_c (); + emit_insn_before (bti_insn, insn); + } + } + + timevar_pop (TV_MACH_DEP); + return 0; +} + + +class pass_insert_bti : public rtl_opt_pass +{ +public: + pass_insert_bti (gcc::context *ctxt) + : rtl_opt_pass (pass_data_insert_bti, ctxt) + {} + + /* opt_pass methods: */ + virtual bool gate (function *) + { + return aarch_bti_enabled (); + } + + virtual unsigned int execute (function *) + { + return rest_of_insert_bti (); + } + +}; // class pass_insert_bti + +} // anon namespace + +rtl_opt_pass * +make_pass_insert_bti (gcc::context *ctxt) +{ + return new pass_insert_bti (ctxt); +} diff --git a/gcc/config/arm/aarch-common-protos.h b/gcc/config/arm/aarch-common-protos.h index f3d28f8..15c8198 100644 --- a/gcc/config/arm/aarch-common-protos.h +++ b/gcc/config/arm/aarch-common-protos.h @@ -42,6 +42,11 @@ extern int arm_no_early_alu_shift_value_dep (rtx, rtx); extern int arm_no_early_mul_dep (rtx, rtx); extern int arm_no_early_store_addr_dep (rtx, rtx); extern bool arm_rtx_shift_left_p (rtx); +extern bool aarch_bti_enabled (void); +extern bool aarch_bti_j_insn_p (rtx_insn *); +extern bool aarch_pac_insn_p (rtx); +extern rtx aarch_gen_bti_c (void); +extern rtx aarch_gen_bti_j (void); /* RTX cost table definitions. These are used when tuning for speed rather than for size and should reflect the _additional_ cost over the cost -- cgit v1.1 From db6b9a9ddb7855f348ea978c392d8ebc258199af Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Thu, 7 Apr 2022 11:51:56 +0200 Subject: [PATCH 12/15] arm: implement bti injection Hi all, this patch enables Branch Target Identification Armv8.1-M Mechanism [1]. This is achieved by using the bti pass made common with Aarch64. The pass iterates through the instructions and adds the necessary BTI instructions at the beginning of every function and at every landing pads targeted by indirect jumps. Best Regards Andrea [1] gcc/ChangeLog 2022-04-07 Andrea Corallo * config.gcc (arm*-*-*): Add 'aarch-bti-insert.o' object. * config/arm/arm-protos.h: Update. * config/arm/aarch-common-protos.h: Declare 'aarch_bti_arch_check'. * config/arm/arm.cc (aarch_bti_enabled) Update. (aarch_bti_j_insn_p, aarch_pac_insn_p, aarch_gen_bti_c) (aarch_gen_bti_j, aarch_bti_arch_check): New functions. * config/arm/arm.md (bti_nop): New insn. * config/arm/t-arm (PASSES_EXTRA): Add 'arm-passes.def'. (aarch-bti-insert.o): New target. * config/arm/unspecs.md (VUNSPEC_BTI_NOP): New unspec. * config/arm/aarch-bti-insert.cc (rest_of_insert_bti): Verify arch compatibility. (gate): Make use of 'aarch_bti_arch_check'. * config/arm/arm-passes.def: New file. * config/aarch64/aarch64.cc (aarch_bti_arch_check): New function. gcc/testsuite/ChangeLog 2022-04-07 Andrea Corallo * gcc.target/arm/bti-1.c: New testcase. * gcc.target/arm/bti-2.c: Likewise. --- gcc/config.gcc | 2 +- gcc/config/aarch64/aarch64.cc | 4 +++ gcc/config/arm/aarch-bti-insert.cc | 7 ++++- gcc/config/arm/aarch-common-protos.h | 1 + gcc/config/arm/arm-passes.def | 21 +++++++++++++ gcc/config/arm/arm-protos.h | 2 ++ gcc/config/arm/arm.cc | 60 ++++++++++++++++++++++++++++++++++-- gcc/config/arm/arm.md | 7 +++++ gcc/config/arm/t-arm | 10 ++++++ gcc/config/arm/unspecs.md | 1 + gcc/testsuite/gcc.target/arm/bti-1.c | 12 ++++++++ gcc/testsuite/gcc.target/arm/bti-2.c | 58 ++++++++++++++++++++++++++++++++++ 12 files changed, 181 insertions(+), 4 deletions(-) create mode 100644 gcc/config/arm/arm-passes.def create mode 100644 gcc/testsuite/gcc.target/arm/bti-1.c create mode 100644 gcc/testsuite/gcc.target/arm/bti-2.c (limited to 'gcc') diff --git a/gcc/config.gcc b/gcc/config.gcc index 0d5a5ee..a5b0cbc 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -362,7 +362,7 @@ arc*-*-*) ;; arm*-*-*) cpu_type=arm - extra_objs="arm-builtins.o arm-mve-builtins.o aarch-common.o" + extra_objs="arm-builtins.o arm-mve-builtins.o aarch-common.o aarch-bti-insert.o" extra_headers="mmintrin.h arm_neon.h arm_acle.h arm_fp16.h arm_cmse.h arm_bf16.h arm_mve_types.h arm_mve.h arm_cde.h" target_type_format_char='%' c_target_objs="arm-c.o" diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 3105eb0..089c1c8 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -8933,6 +8933,10 @@ aarch64_return_address_signing_enabled (void) && known_ge (cfun->machine->frame.reg_offset[LR_REGNUM], 0))); } +/* Only used by the arm backend. */ +void aarch_bti_arch_check (void) +{} + /* Return TRUE if Branch Target Identification Mechanism is enabled. */ bool aarch_bti_enabled (void) diff --git a/gcc/config/arm/aarch-bti-insert.cc b/gcc/config/arm/aarch-bti-insert.cc index 880f0de..71a77e2 100644 --- a/gcc/config/arm/aarch-bti-insert.cc +++ b/gcc/config/arm/aarch-bti-insert.cc @@ -190,7 +190,12 @@ public: /* opt_pass methods: */ virtual bool gate (function *) { - return aarch_bti_enabled (); + if (aarch_bti_enabled ()) + { + aarch_bti_arch_check (); + return true; + } + return false; } virtual unsigned int execute (function *) diff --git a/gcc/config/arm/aarch-common-protos.h b/gcc/config/arm/aarch-common-protos.h index 15c8198..f8cb656 100644 --- a/gcc/config/arm/aarch-common-protos.h +++ b/gcc/config/arm/aarch-common-protos.h @@ -42,6 +42,7 @@ extern int arm_no_early_alu_shift_value_dep (rtx, rtx); extern int arm_no_early_mul_dep (rtx, rtx); extern int arm_no_early_store_addr_dep (rtx, rtx); extern bool arm_rtx_shift_left_p (rtx); +extern void aarch_bti_arch_check (void); extern bool aarch_bti_enabled (void); extern bool aarch_bti_j_insn_p (rtx_insn *); extern bool aarch_pac_insn_p (rtx); diff --git a/gcc/config/arm/arm-passes.def b/gcc/config/arm/arm-passes.def new file mode 100644 index 0000000..71d6b56 --- /dev/null +++ b/gcc/config/arm/arm-passes.def @@ -0,0 +1,21 @@ +/* Arm-specific passes declarations. + Copyright (C) 2022 Free Software Foundation, Inc. + Contributed by Arm Ltd. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +INSERT_PASS_BEFORE (pass_shorten_branches, 1, pass_insert_bti); diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index 29a4ce5..aea472b 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -24,6 +24,8 @@ #include "sbitmap.h" +rtl_opt_pass *make_pass_insert_bti (gcc::context *ctxt); + extern enum unwind_info_type arm_except_unwind_info (struct gcc_options *); extern int use_return_insn (int, rtx); extern bool use_simple_return_p (void); diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc index 33ec15c..fb52048 100644 --- a/gcc/config/arm/arm.cc +++ b/gcc/config/arm/arm.cc @@ -33122,13 +33122,69 @@ arm_current_function_pac_enabled_p (void) && !crtl->is_leaf)); } +/* Raise an error if the current target arch is not bti compatible. */ +void aarch_bti_arch_check (void) +{ + if (!arm_arch8m_main) + error ("This architecture does not support branch protection instructions"); +} + /* Return TRUE if Branch Target Identification Mechanism is enabled. */ -static bool -aarch_bti_enabled () +bool +aarch_bti_enabled (void) +{ + return aarch_enable_bti != 0; +} + +/* Check if INSN is a BTI J insn. */ +bool +aarch_bti_j_insn_p (rtx_insn *insn) +{ + if (!insn || !INSN_P (insn)) + return false; + + rtx pat = PATTERN (insn); + return GET_CODE (pat) == UNSPEC_VOLATILE && XINT (pat, 1) == VUNSPEC_BTI_NOP; +} + +/* Check if X (or any sub-rtx of X) is a PACIASP/PACIBSP instruction. */ +bool +aarch_pac_insn_p (rtx x) { + if (!x || !INSN_P (x)) + return false; + + rtx pat = PATTERN (x); + + if (GET_CODE (pat) == SET) + { + rtx tmp = XEXP (pat, 1); + if (tmp + && ((GET_CODE (tmp) == UNSPEC + && XINT (tmp, 1) == UNSPEC_PAC_NOP) + || (GET_CODE (tmp) == UNSPEC_VOLATILE + && XINT (tmp, 1) == VUNSPEC_PACBTI_NOP))) + return true; + } + return false; } + /* Target specific mapping for aarch_gen_bti_c and aarch_gen_bti_j. + For Arm, both of these map to a simple BTI instruction. */ + +rtx +aarch_gen_bti_c (void) +{ + return gen_bti_nop (); +} + +rtx +aarch_gen_bti_j (void) +{ + return gen_bti_nop (); +} + /* Implement TARGET_SCHED_CAN_SPECULATE_INSN. Return true if INSN can be scheduled for speculative execution. Reject the long-running division and square-root instructions. */ diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 2695d0b..3b95f47 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -13009,6 +13009,13 @@ "aut\t%|ip, %|lr, %|sp" [(set_attr "conds" "unconditional")]) +(define_insn "bti_nop" + [(unspec_volatile [(const_int 0)] VUNSPEC_BTI_NOP)] + "arm_arch8m_main" + "bti" + [(set_attr "conds" "unconditional") + (set_attr "type" "nop")]) + ;; Vector bits common to IWMMXT, Neon and MVE (include "vec-common.md") ;; Load the Intel Wireless Multimedia Extension patterns diff --git a/gcc/config/arm/t-arm b/gcc/config/arm/t-arm index b4d5d94..637e72a 100644 --- a/gcc/config/arm/t-arm +++ b/gcc/config/arm/t-arm @@ -175,3 +175,13 @@ arm-d.o: $(srcdir)/config/arm/arm-d.cc arm-common.o: arm-cpu-cdata.h driver-arm.o: arm-native.h + +PASSES_EXTRA += $(srcdir)/config/arm/arm-passes.def + +aarch-bti-insert.o: $(srcdir)/config/arm/aarch-bti-insert.cc \ + $(CONFIG_H) $(SYSTEM_H) $(TM_H) $(REGS_H) insn-config.h $(RTL_BASE_H) \ + dominance.h cfg.h cfganal.h $(BASIC_BLOCK_H) $(INSN_ATTR_H) $(RECOG_H) \ + output.h hash-map.h $(DF_H) $(OBSTACK_H) $(TARGET_H) $(RTL_H) \ + $(CONTEXT_H) $(TREE_PASS_H) regrename.h + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + $(srcdir)/config/arm/aarch-bti-insert.cc diff --git a/gcc/config/arm/unspecs.md b/gcc/config/arm/unspecs.md index 5e964e6..50e1ac7 100644 --- a/gcc/config/arm/unspecs.md +++ b/gcc/config/arm/unspecs.md @@ -257,6 +257,7 @@ ; instruction. VUNSPEC_PACBTI_NOP ; Represents PAC signing LR + valid landing pad VUNSPEC_AUT_NOP ; Represents PAC verifying LR + VUNSPEC_BTI_NOP ; Represent BTI ]) ;; Enumerators for NEON unspecs. diff --git a/gcc/testsuite/gcc.target/arm/bti-1.c b/gcc/testsuite/gcc.target/arm/bti-1.c new file mode 100644 index 0000000..79dd801 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/bti-1.c @@ -0,0 +1,12 @@ +/* Check that GCC does bti instruction. */ +/* { dg-do compile } */ +/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */ +/* { dg-options "-march=armv8.1-m.main -mthumb -mfloat-abi=softfp -mbranch-protection=bti --save-temps" } */ + +int +main (void) +{ + return 0; +} + +/* { dg-final { scan-assembler "bti" } } */ diff --git a/gcc/testsuite/gcc.target/arm/bti-2.c b/gcc/testsuite/gcc.target/arm/bti-2.c new file mode 100644 index 0000000..3391056 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/bti-2.c @@ -0,0 +1,58 @@ +/* { dg-do compile } */ +/* -Os to create jump table. */ +/* { dg-options "-Os" } */ +/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */ +/* { dg-options "-march=armv8.1-m.main -mthumb -mfloat-abi=softfp -mbranch-protection=bti --save-temps" } */ + +extern int f1 (void); +extern int f2 (void); +extern int f3 (void); +extern int f4 (void); +extern int f5 (void); +extern int f6 (void); +extern int f7 (void); +extern int f8 (void); +extern int f9 (void); +extern int f10 (void); + +int (*ptr) (void); + +int +f_jump_table (int y, int n) +{ + int i; + for (i = 0; i < n ;i ++) + { + switch (y) + { + case 0 : ptr = f1; break; + case 1 : ptr = f2; break; + case 2 : ptr = f3; break; + case 3 : ptr = f4; break; + case 4 : ptr = f5; break; + case 5 : ptr = f6; break; + case 6 : ptr = f7; break; + case 7 : ptr = f8; break; + case 8 : ptr = f9; break; + case 9 : ptr = f10; break; + default: break; + } + y += ptr (); + } + return (y == 0)? y+1:4; +} + +int +f_label_address () +{ + static void * addr = &&lab1; + goto *addr; +lab1: + addr = &&lab2; + return 1; +lab2: + addr = &&lab1; + return 2; +} + +/* { dg-final { scan-assembler-times "bti" 15 } } */ -- cgit v1.1 From ad4f8c4e375dd7603382ed3ff95bd184e1959918 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 23 Jan 2023 10:22:38 +0100 Subject: tree-optimization/108482 - remove stray .LOOP_DIST_ALIAS calls The following deals with .LOOP_DIST_ALIAS surviving vectorization because any of the loops involved were elided between loop distribution and vectorization. As opposed to .LOOP_VECTORIZED which exists only between if-conversion and vectorization with no intermediate passes this is more difficult to deal with in advance and thus cleaning up after vectorization looks better. There's the unconditional vector lowering pass which looks like a good place for this (for SIMD uid we have pass_simduid_cleanup). PR tree-optimization/108482 * tree-vect-generic.cc (expand_vector_operations): Fold remaining .LOOP_DIST_ALIAS calls. * gcc.dg/torture/pr108482.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr108482.c | 18 ++++++++++++++++++ gcc/tree-vect-generic.cc | 8 ++++++++ 2 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr108482.c (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/torture/pr108482.c b/gcc/testsuite/gcc.dg/torture/pr108482.c new file mode 100644 index 0000000..8dc1169 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr108482.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ + +int g_30, g_261, g_263, func_1___trans_tmp_17; +int **g_120; +int *g_530; +void func_1() { + int *l_29 = &g_30; + *l_29 = 1; + g_263 = 0; + for (; g_263 <= 1; g_263 += 1) { + g_530 = 0; + if (*l_29) { + char *l_1694 = (char *)&g_261; + *l_1694 &= **g_120; + } else + *l_29 ^= func_1___trans_tmp_17; + } +} diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc index 2e2d756..166a248 100644 --- a/gcc/tree-vect-generic.cc +++ b/gcc/tree-vect-generic.cc @@ -2398,6 +2398,14 @@ expand_vector_operations (void) if (maybe_clean_eh_stmt (gsi_stmt (gsi)) && gimple_purge_dead_eh_edges (bb)) cfg_changed = true; + /* If a .LOOP_DIST_ALIAS call prevailed loops got elided + before vectorization got a chance to get at them. Simply + fold as if loop distribution wasn't performed. */ + if (gimple_call_internal_p (gsi_stmt (gsi), IFN_LOOP_DIST_ALIAS)) + { + fold_loop_internal_call (gsi_stmt (gsi), boolean_false_node); + cfg_changed = true; + } } } -- cgit v1.1 From ccfd1e7f0d9686aa931e65a04845a7436f85d71c Mon Sep 17 00:00:00 2001 From: Srinath Parvathaneni Date: Mon, 23 Jan 2023 11:00:26 +0000 Subject: arm: Add support for Arm Cortex-M85 CPU. This patch adds the -mcpu support for the Arm Cortex-M85 CPU which is an Armv8.1-M Mainline CPU supporting MVE and PACBTI by default. -mpcu=cortex-m85 switch by default matches to -march=armv8.1-m.main+pacbti+mve.fp+fp.dp. Also following options are provided to disable default features. +nomve.fp (disables MVE Floating point) +nomve (disables MVE Integer and MVE Floating point) +nodsp (disables dsp, MVE Integer and MVE Floating point) +nopacbti (disables pacbti) +nofp (disables floating point and MVE floating point) gcc/ChangeLog: 2022-08-12 Srinath Parvathaneni * config/arm/arm-cpus.in (cortex-m85): Define new CPU. * config/arm/arm-tables.opt: Regenerate. * config/arm/arm-tune.md: Likewise. * doc/invoke.texi (Arm Options): Document -mcpu=cortex-m85. * (-mfix-cmse-cve-2021-35465): Likewise. gcc/testsuite/ChangeLog: 2022-08-12 Srinath Parvathaneni * gcc.target/arm/multilib.exp: Add tests for cortex-m85. --- gcc/config/arm/arm-cpus.in | 15 +++++++++++++++ gcc/config/arm/arm-tables.opt | 3 +++ gcc/config/arm/arm-tune.md | 11 ++++++----- gcc/doc/invoke.texi | 28 +++++++++++++++++----------- gcc/testsuite/gcc.target/arm/multilib.exp | 23 +++++++++++++++++++++++ 5 files changed, 64 insertions(+), 16 deletions(-) (limited to 'gcc') diff --git a/gcc/config/arm/arm-cpus.in b/gcc/config/arm/arm-cpus.in index 4685599..f1fa3fa 100644 --- a/gcc/config/arm/arm-cpus.in +++ b/gcc/config/arm/arm-cpus.in @@ -1672,6 +1672,21 @@ begin cpu star-mc1 costs v7m end cpu star-mc1 +begin cpu cortex-m85 + cname cortexm85 + tune flags LDSCHED + architecture armv8.1-m.main+pacbti+mve.fp+fp.dp + option nopacbti remove pacbti + option nomve.fp remove mve_float + option nomve remove mve mve_float + option nofp remove ALL_FP mve_float + option nodsp remove MVE mve_float + isa quirk_no_asmcpu quirk_vlldm + costs v7m + part 0xd23 + vendor 41 +end cpu cortex-m85 + # V8 R-profile implementations. begin cpu cortex-r52 cname cortexr52 diff --git a/gcc/config/arm/arm-tables.opt b/gcc/config/arm/arm-tables.opt index b3ab72f..88909c2 100644 --- a/gcc/config/arm/arm-tables.opt +++ b/gcc/config/arm/arm-tables.opt @@ -289,6 +289,9 @@ EnumValue Enum(processor_type) String(star-mc1) Value( TARGET_CPU_starmc1) EnumValue +Enum(processor_type) String(cortex-m85) Value( TARGET_CPU_cortexm85) + +EnumValue Enum(processor_type) String(cortex-r52) Value( TARGET_CPU_cortexr52) EnumValue diff --git a/gcc/config/arm/arm-tune.md b/gcc/config/arm/arm-tune.md index 29ca2b4..5e95e82 100644 --- a/gcc/config/arm/arm-tune.md +++ b/gcc/config/arm/arm-tune.md @@ -46,9 +46,10 @@ cortexa73cortexa53,cortexa55,cortexa75, cortexa76,cortexa76ae,cortexa77, cortexa78,cortexa78ae,cortexa78c, - cortexa710,cortexx1,cortexx1c,neoversen1, - cortexa75cortexa55,cortexa76cortexa55,neoversev1, - neoversen2,cortexm23,cortexm33, - cortexm35p,cortexm55,starmc1, - cortexr52,cortexr52plus" + cortexa710,cortexx1,cortexx1c, + neoversen1,cortexa75cortexa55,cortexa76cortexa55, + neoversev1,neoversen2,cortexm23, + cortexm33,cortexm35p,cortexm55, + starmc1,cortexm85,cortexr52, + cortexr52plus" (const (symbol_ref "((enum attr_tune) arm_tune)"))) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index b4a271d..f1c0b52 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -22097,8 +22097,8 @@ Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus}, @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3}, @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33}, -@samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-x1}, @samp{cortex-x1c}, -@samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply}, +@samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-m85}, @samp{cortex-x1}, +@samp{cortex-x1c}, @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply}, @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4}, @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626}, @@ -22162,17 +22162,22 @@ The following extension options are common to the listed CPUs: @table @samp @item +nodsp -Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p} -and @samp{cortex-m55}. Also disable the M-Profile Vector Extension (MVE) -integer and single precision floating-point instructions on @samp{cortex-m55}. +Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}, +@samp{cortex-m55} and @samp{cortex-m85}. Also disable the M-Profile Vector +Extension (MVE) integer and single precision floating-point instructions on +@samp{cortex-m55} and @samp{cortex-m85}. + +@item +nopacbti +Disable the Pointer Authentication and Branch Target Identification Extension +on @samp{cortex-m85}. @item +nomve Disable the M-Profile Vector Extension (MVE) integer and single precision -floating-point instructions on @samp{cortex-m55}. +floating-point instructions on @samp{cortex-m55} and @samp{cortex-m85}. @item +nomve.fp Disable the M-Profile Vector Extension (MVE) single precision floating-point -instructions on @samp{cortex-m55}. +instructions on @samp{cortex-m55} and @samp{cortex-m85}. @item +cdecp0, +cdecp1, ... , +cdecp7 Enable the Custom Datapath Extension (CDE) on selected coprocessors according @@ -22184,7 +22189,8 @@ Disables the floating-point instructions on @samp{arm9e}, @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s}, @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p} -and @samp{cortex-m55}. +@samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p}, +@samp{cortex-m55} and @samp{cortex-m85}. Disables the floating-point and SIMD instructions on @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12}, @@ -22524,9 +22530,9 @@ Development Tools Engineering Specification", which can be found on Mitigate against a potential security issue with the @code{VLLDM} instruction in some M-profile devices when using CMSE (CVE-2021-365465). This option is enabled by default when the option @option{-mcpu=} is used with -@code{cortex-m33}, @code{cortex-m35p}, @code{cortex-m55} or @code{star-mc1}. -The option @option{-mno-fix-cmse-cve-2021-35465} can be used to disable -the mitigation. +@code{cortex-m33}, @code{cortex-m35p}, @code{cortex-m55}, @code{cortex-m85} +or @code{star-mc1}. The option @option{-mno-fix-cmse-cve-2021-35465} can be used +to disable the mitigation. @item -mstack-protector-guard=@var{guard} @itemx -mstack-protector-guard-offset=@var{offset} diff --git a/gcc/testsuite/gcc.target/arm/multilib.exp b/gcc/testsuite/gcc.target/arm/multilib.exp index 4f0a0a1..8442f45 100644 --- a/gcc/testsuite/gcc.target/arm/multilib.exp +++ b/gcc/testsuite/gcc.target/arm/multilib.exp @@ -524,6 +524,11 @@ if {[multilib_config "rmprofile"] } { {-mcpu=cortex-m23 -mfpu=fpv5-d16 -mfloat-abi=soft} "thumb/v8-m.base/nofp" {-mcpu=cortex-m33 -mfpu=fpv5-d16 -mfloat-abi=soft} "thumb/v8-m.main/nofp" {-mcpu=cortex-m7+nofp.dp -mfpu=fpv5-d16 -mfloat-abi=soft} "thumb/v7e-m/nofp" + {-mcpu=cortex-m85+nopacbti -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" + {-mcpu=cortex-m85+nopacbti+nofp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" + {-mcpu=cortex-m85+nopacbti+nomve -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" + {-mcpu=cortex-m85+nopacbti+nodsp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" + {-mcpu=cortex-m85+nopacbti+nomve.fp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" {-mcpu=cortex-m4 -mfpu=auto -mfloat-abi=hard} "thumb/v7e-m+fp/hard" {-mcpu=cortex-m7 -mfpu=auto -mfloat-abi=hard} "thumb/v7e-m+dp/hard" {-mcpu=cortex-m33 -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+fp/hard" @@ -549,6 +554,15 @@ if {[multilib_config "rmprofile"] } { {-mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard} "thumb/v7e-m+dp/hard" {-mcpu=cortex-m33 -mfpu=fpv5-d16 -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" {-mcpu=cortex-m7+nofp.dp -mfpu=fpv5-d16 -mfloat-abi=hard} "thumb/v7e-m+dp/hard" + {-mcpu=cortex-m85+nopacbti -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" + {-mcpu=cortex-m85+nopacbti+nomve -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" + {-mcpu=cortex-m85+nopacbti+nodsp -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" + {-mcpu=cortex-m85+nopacbti+nofp -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+mve/hard" + {-mcpu=cortex-m85+nopacbti+nomve.fp -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" + {-mcpu=cortex-m85 -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard" + {-mcpu=cortex-m85+nomve.fp -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard" + {-mcpu=cortex-m85+nomve -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard" + {-mcpu=cortex-m85+nodsp -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard" {-mcpu=cortex-m0 -mfpu=auto -mfloat-abi=softfp} "thumb/v6-m/nofp" {-mcpu=cortex-m1 -mfpu=auto -mfloat-abi=softfp} "thumb/v6-m/nofp" {-mcpu=cortex-m3 -mfpu=auto -mfloat-abi=softfp} "thumb/v7-m/nofp" @@ -598,6 +612,15 @@ if {[multilib_config "rmprofile"] } { {-mcpu=cortex-m23 -mfpu=fpv5-d16 -mfloat-abi=softfp} "thumb/v8-m.base/nofp" {-mcpu=cortex-m33 -mfpu=fpv5-d16 -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" {-mcpu=cortex-m7+nofp.dp -mfpu=fpv5-d16 -mfloat-abi=softfp} "thumb/v7e-m+dp/softfp" + {-mcpu=cortex-m85+nopacbti+nofp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main/nofp" + {-mcpu=cortex-m85+nopacbti -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" + {-mcpu=cortex-m85+nopacbti+nomve -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" + {-mcpu=cortex-m85+nopacbti+nodsp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" + {-mcpu=cortex-m85+nopacbti+nomve.fp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" + {-mcpu=cortex-m85 -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/softfp" + {-mcpu=cortex-m85+nomve.fp -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/softfp" + {-mcpu=cortex-m85+nomve -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/softfp" + {-mcpu=cortex-m85+nodsp -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/softfp" {-march=armv6-m -mfpu=auto -mfloat-abi=soft} "thumb/v6-m/nofp" {-march=armv7-m -mfpu=auto -mfloat-abi=soft} "thumb/v7-m/nofp" {-march=armv7e-m -mfpu=auto -mfloat-abi=soft} "thumb/v7e-m/nofp" -- cgit v1.1 From 3a0dd2cc28ee2833dc5bf1d4fb6d746a8c55ca4d Mon Sep 17 00:00:00 2001 From: Srinath Parvathaneni Date: Mon, 23 Jan 2023 11:04:19 +0000 Subject: arm: Add pacbti related multilib support for armv8.1-m.main. This patch adds the support for pacbti multlilib linking by making "-mbranch-protection=none" as default multilib option for arm-none-eabi target. Eg 1. If the passed command line flags are (without mbranch-protection): a) -march=armv8.1-m.main+mve -mfloat-abi=hard -mfpu=auto "-mbranch-protection=none" will be used in the multilib matching. Eg 2. If the passed command line flags are (with mbranch-protection): a) -march=armv8.1-m.main+mve+pacbti -mfloat-abi=hard -mfpu=auto -mbranch-protection=pac-ret "-mbranch-protection=standard" will be used in the multilib matching. gcc/ChangeLog: 2023-01-11 Srinath Parvathaneni * config.gcc ($tm_file): Update variable. * config/arm/arm-mlib.h: Create new header file. * config/arm/t-rmprofile (MULTI_ARCH_DIRS_RM): Rename mbranch-protection multilib arch directory. (MULTILIB_REUSE): Add multilib reuse rules. (MULTILIB_MATCHES): Add multilib match rules. gcc/testsuite/ChangeLog: 2023-01-11 Srinath Parvathaneni * gcc.target/arm/multilib.exp (multilib_config "rmprofile"): Update tests. * gcc.target/arm/pac-12.c: New test. * gcc.target/arm/pac-13.c: Likewise. * gcc.target/arm/pac-14.c: Likewise. --- gcc/config.gcc | 1 + gcc/config/arm/arm-mlib.h | 22 +++++++++++++++ gcc/config/arm/t-rmprofile | 46 +++++++++++++++++++++++++++++-- gcc/testsuite/gcc.target/arm/multilib.exp | 34 +++++++++++++---------- gcc/testsuite/gcc.target/arm/pac-12.c | 7 +++++ gcc/testsuite/gcc.target/arm/pac-13.c | 7 +++++ gcc/testsuite/gcc.target/arm/pac-14.c | 7 +++++ 7 files changed, 106 insertions(+), 18 deletions(-) create mode 100644 gcc/config/arm/arm-mlib.h create mode 100644 gcc/testsuite/gcc.target/arm/pac-12.c create mode 100644 gcc/testsuite/gcc.target/arm/pac-13.c create mode 100644 gcc/testsuite/gcc.target/arm/pac-14.c (limited to 'gcc') diff --git a/gcc/config.gcc b/gcc/config.gcc index a5b0cbc..771bd35 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -4350,6 +4350,7 @@ case "${target}" in case ${arm_multilib} in aprofile|rmprofile) tmake_profile_file="arm/t-multilib" + tm_file="$tm_file arm/arm-mlib.h" ;; @*) ml=`echo "X$arm_multilib" | sed '1s,^X@,,'` diff --git a/gcc/config/arm/arm-mlib.h b/gcc/config/arm/arm-mlib.h new file mode 100644 index 0000000..02cfba0 --- /dev/null +++ b/gcc/config/arm/arm-mlib.h @@ -0,0 +1,22 @@ +/* Arm multilib default option include file. + + Copyright (C) 2023 Free Software Foundation, Inc. + Contributed by Arm. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#define MULTILIB_DEFAULTS { "mbranch-protection=none" } diff --git a/gcc/config/arm/t-rmprofile b/gcc/config/arm/t-rmprofile index ecfdc98..4d8e6ce 100644 --- a/gcc/config/arm/t-rmprofile +++ b/gcc/config/arm/t-rmprofile @@ -31,7 +31,7 @@ MULTI_ARCH_OPTS_RM = march=armv6s-m/march=armv7-m/march=armv7e-m/march=armv7e-m+ MULTI_ARCH_DIRS_RM = v6-m v7-m v7e-m v7e-m+fp v7e-m+dp v8-m.base v8-m.main v8-m.main+fp v8-m.main+dp v8.1-m.main+mve v8.1-m.main+pacbti v8.1-m.main+pacbti+fp v8.1-m.main+pacbti+dp v8.1-m.main+pacbti+mve MULTI_ARCH_OPTS_RM += mbranch-protection=standard -MULTI_ARCH_DIRS_RM += mbranch-protection +MULTI_ARCH_DIRS_RM += bp # Base M-profile (no fp) MULTILIB_REQUIRED += mthumb/march=armv6s-m/mfloat-abi=soft @@ -113,7 +113,47 @@ MULTILIB_MATCHES += march?armv8-m.main=mlibarch?armv8-m.main MULTILIB_MATCHES += march?armv8-m.main+fp=mlibarch?armv8-m.main+fp MULTILIB_MATCHES += march?armv8-m.main+fp.dp=mlibarch?armv8-m.main+fp.dp MULTILIB_MATCHES += march?armv8.1-m.main+mve=mlibarch?armv8.1-m.main+mve + +# For -mbranch-protection=none and +pacbti reuses the existing non pacbti +# multilibs. +MULTILIB_REUSE += $(foreach OPT, fp fp\.dp, \ + mthumb/march.armv8-m\.main+$(OPT)/mfloat-abi.softfp=mthumb/march.armv8\.1-m\.main+pacbti+$(OPT)/mfloat-abi.softfp) +MULTILIB_REUSE += $(foreach OPT, fp fp\.dp, \ + mthumb/march.armv8-m\.main+$(OPT)/mfloat-abi.hard=mthumb/march.armv8\.1-m\.main+pacbti+$(OPT)/mfloat-abi.hard) + +MULTILIB_REUSE += $(foreach OPT, pacbti pacbti+mve, \ + mthumb/march.armv8-m\.main/mfloat-abi.soft=mthumb/march.armv8\.1-m\.main+$(OPT)/mfloat-abi.soft) +MULTILIB_REUSE += $(foreach OPT, pacbti pacbti+mve, \ + mthumb/march.armv8-m\.main/mfloat-abi.soft=mthumb/march.armv8\.1-m\.main+$(OPT)/mfloat-abi.softfp) + +MULTILIB_REUSE += mthumb/march.armv8\.1-m\.main+mve/mfloat-abi.hard=mthumb/march.armv8\.1-m\.main+pacbti+mve/mfloat-abi.hard + +pacbti_fp_variants = fp fp+mve mve.fp fp+mve.fp +pacbti_dp_variants = fp.dp fp.dp+mve fp.dp+mve.fp + +# For -mbranch-protection=standard and +pacbti linking to existing pacbti +# multlibs. MULTILIB_MATCHES += march?armv8.1-m.main+pacbti=mlibarch?armv8.1-m.main+pacbti -MULTILIB_MATCHES += march?armv8.1-m.main+pacbti+fp=mlibarch?armv8.1-m.main+pacbti+fp -MULTILIB_MATCHES += march?armv8.1-m.main+pacbti+fp.dp=mlibarch?armv8.1-m.main+pacbti+fp.dp +MULTILIB_MATCHES += march?armv8.1-m.main+pacbti=mlibarch?armv8.1-m.main+pacbti+dsp +MULTILIB_MATCHES += march?armv8.1-m.main+pacbti=mlibarch?armv8.1-m.main+dsp+pacbti MULTILIB_MATCHES += march?armv8.1-m.main+pacbti+mve=mlibarch?armv8.1-m.main+pacbti+mve +MULTILIB_MATCHES += march?armv8.1-m.main+pacbti+mve=mlibarch?armv8.1-m.main+pacbti+dsp+mve +MULTILIB_MATCHES += march?armv8.1-m.main+pacbti+mve=mlibarch?armv8.1-m.main+dsp+pacbti+mve + +MULTILIB_MATCHES += $(foreach OPT, $(pacbti_fp_variants), \ + march?armv8.1-m.main+pacbti+fp=mlibarch?armv8.1-m.main+pacbti+$(OPT)) + +MULTILIB_MATCHES += $(foreach OPT, $(pacbti_fp_variants), \ + march?armv8.1-m.main+pacbti+fp=mlibarch?armv8.1-m.main+pacbti+dsp+$(OPT)) + +MULTILIB_MATCHES += $(foreach OPT, $(pacbti_dp_variants), \ + march?armv8.1-m.main+pacbti+fp.dp=mlibarch?armv8.1-m.main+pacbti+$(OPT)) + +MULTILIB_MATCHES += $(foreach OPT, $(pacbti_dp_variants), \ + march?armv8.1-m.main+pacbti+fp.dp=mlibarch?armv8.1-m.main+pacbti+dsp+$(OPT)) + +MULTILIB_MATCHES += $(foreach OPT, $(pacbti_fp_variants), \ + march?armv8.1-m.main+pacbti+fp=mlibarch?armv8.1-m.main+dsp+pacbti+$(OPT)) + +MULTILIB_MATCHES += $(foreach OPT, $(pacbti_dp_variants), \ + march?armv8.1-m.main+pacbti+fp.dp=mlibarch?armv8.1-m.main+dsp+pacbti+$(OPT)) diff --git a/gcc/testsuite/gcc.target/arm/multilib.exp b/gcc/testsuite/gcc.target/arm/multilib.exp index 8442f45..d365711 100644 --- a/gcc/testsuite/gcc.target/arm/multilib.exp +++ b/gcc/testsuite/gcc.target/arm/multilib.exp @@ -529,6 +529,10 @@ if {[multilib_config "rmprofile"] } { {-mcpu=cortex-m85+nopacbti+nomve -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" {-mcpu=cortex-m85+nopacbti+nodsp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" {-mcpu=cortex-m85+nopacbti+nomve.fp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" + {-mcpu=cortex-m85 -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" + {-mcpu=cortex-m85+nomve.fp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" + {-mcpu=cortex-m85+nomve -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" + {-mcpu=cortex-m85+nodsp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" {-mcpu=cortex-m4 -mfpu=auto -mfloat-abi=hard} "thumb/v7e-m+fp/hard" {-mcpu=cortex-m7 -mfpu=auto -mfloat-abi=hard} "thumb/v7e-m+dp/hard" {-mcpu=cortex-m33 -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+fp/hard" @@ -559,10 +563,10 @@ if {[multilib_config "rmprofile"] } { {-mcpu=cortex-m85+nopacbti+nodsp -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" {-mcpu=cortex-m85+nopacbti+nofp -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+mve/hard" {-mcpu=cortex-m85+nopacbti+nomve.fp -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" - {-mcpu=cortex-m85 -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard" - {-mcpu=cortex-m85+nomve.fp -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard" - {-mcpu=cortex-m85+nomve -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard" - {-mcpu=cortex-m85+nodsp -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard" + {-mcpu=cortex-m85 -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/bp/hard" + {-mcpu=cortex-m85+nomve -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/bp/hard" + {-mcpu=cortex-m85+nomve.fp -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/bp/hard" + {-mcpu=cortex-m85+nodsp -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/bp/hard" {-mcpu=cortex-m0 -mfpu=auto -mfloat-abi=softfp} "thumb/v6-m/nofp" {-mcpu=cortex-m1 -mfpu=auto -mfloat-abi=softfp} "thumb/v6-m/nofp" {-mcpu=cortex-m3 -mfpu=auto -mfloat-abi=softfp} "thumb/v7-m/nofp" @@ -613,14 +617,14 @@ if {[multilib_config "rmprofile"] } { {-mcpu=cortex-m33 -mfpu=fpv5-d16 -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" {-mcpu=cortex-m7+nofp.dp -mfpu=fpv5-d16 -mfloat-abi=softfp} "thumb/v7e-m+dp/softfp" {-mcpu=cortex-m85+nopacbti+nofp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main/nofp" - {-mcpu=cortex-m85+nopacbti -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" + {-mcpu=cortex-m85+nopacbti -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" {-mcpu=cortex-m85+nopacbti+nomve -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" {-mcpu=cortex-m85+nopacbti+nodsp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" {-mcpu=cortex-m85+nopacbti+nomve.fp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" - {-mcpu=cortex-m85 -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/softfp" - {-mcpu=cortex-m85+nomve.fp -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/softfp" - {-mcpu=cortex-m85+nomve -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/softfp" - {-mcpu=cortex-m85+nodsp -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/softfp" + {-mcpu=cortex-m85 -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/bp/softfp" + {-mcpu=cortex-m85+nomve -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/bp/softfp" + {-mcpu=cortex-m85+nomve.fp -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/bp/softfp" + {-mcpu=cortex-m85+nodsp -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/bp/softfp" {-march=armv6-m -mfpu=auto -mfloat-abi=soft} "thumb/v6-m/nofp" {-march=armv7-m -mfpu=auto -mfloat-abi=soft} "thumb/v7-m/nofp" {-march=armv7e-m -mfpu=auto -mfloat-abi=soft} "thumb/v7e-m/nofp" @@ -861,12 +865,12 @@ if {[multilib_config "rmprofile"] } { {-march=armv8.1-m.main+mve.fp+fp.dp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" {-march=armv8.1-m.main+mve+fp.dp -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" {-march=armv8.1-m.main+mve.fp+fp.dp -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" - {-march=armv8.1-m.main+pacbti -mbranch-protection=standard -mfloat-abi=soft} "thumb/v8.1-m.main+pacbti/mbranch-protection/nofp" - {-march=armv8.1-m.main+pacbti+fp -mbranch-protection=standard -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+fp/mbranch-protection/soft" - {-march=armv8.1-m.main+pacbti+fp -mbranch-protection=standard -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+fp/mbranch-protection/hard" - {-march=armv8.1-m.main+pacbti+fp.dp -mbranch-protection=standard -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/soft" - {-march=armv8.1-m.main+pacbti+fp.dp -mbranch-protection=standard -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard" - {-march=armv8.1-m.main+pacbti+mve -mbranch-protection=standard -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+mve/mbranch-protection/hard" + {-march=armv8.1-m.main+pacbti -mbranch-protection=standard -mfloat-abi=soft} "thumb/v8.1-m.main+pacbti/bp/nofp" + {-march=armv8.1-m.main+pacbti+fp -mbranch-protection=standard -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+fp/bp/softfp" + {-march=armv8.1-m.main+pacbti+fp -mbranch-protection=standard -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+fp/bp/hard" + {-march=armv8.1-m.main+pacbti+fp.dp -mbranch-protection=standard -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/bp/softfp" + {-march=armv8.1-m.main+pacbti+fp.dp -mbranch-protection=standard -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/bp/hard" + {-march=armv8.1-m.main+pacbti+mve -mbranch-protection=standard -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+mve/bp/hard" {-mcpu=cortex-m55+nomve -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" {-mcpu=cortex-m55+nomve -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" {-mcpu=cortex-m55+nomve -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" diff --git a/gcc/testsuite/gcc.target/arm/pac-12.c b/gcc/testsuite/gcc.target/arm/pac-12.c new file mode 100644 index 0000000..6e1295c --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-12.c @@ -0,0 +1,7 @@ +/* Testing PACBTI multilibs matches without mve. */ +/* { dg-do run } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-skip-if "need fp instructions" { *-*-* } { "" } { "-mfloat-abi=hard" } } */ +/* { dg-options "-march=armv8.1-m.main+dsp+fp.dp+pacbti -mbranch-protection=standard -mthumb -mfloat-abi=hard" } */ + +#include "pac.h" diff --git a/gcc/testsuite/gcc.target/arm/pac-13.c b/gcc/testsuite/gcc.target/arm/pac-13.c new file mode 100644 index 0000000..faf836b --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-13.c @@ -0,0 +1,7 @@ +/* Testing PACBTI multilib matches. */ +/* { dg-do run } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-skip-if "need fp instructions" { *-*-* } { "" } { "-mfloat-abi=hard" } } */ +/* { dg-options "-march=armv8.1-m.main+mve.fp+fp.dp+pacbti -mbranch-protection=standard -mthumb -mfloat-abi=hard" } */ + +#include "pac.h" diff --git a/gcc/testsuite/gcc.target/arm/pac-14.c b/gcc/testsuite/gcc.target/arm/pac-14.c new file mode 100644 index 0000000..51609b6 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-14.c @@ -0,0 +1,7 @@ +/* Testing PACBTI multilibs matches without mve float. */ +/* { dg-do run } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-skip-if "need fp instructions" { *-*-* } { "" } { "-mfloat-abi=hard" } } */ +/* { dg-options "-march=armv8.1-m.main+mve+fp.dp+pacbti -mbranch-protection=standard -mthumb -mfloat-abi=hard" } */ + +#include "pac.h" -- cgit v1.1 From 273874e925a544d96b8a9999d4c870c1f5191eeb Mon Sep 17 00:00:00 2001 From: Srinath Parvathaneni Date: Mon, 23 Jan 2023 11:07:29 +0000 Subject: arm: Add support for dwarf debug directives and pseudo hard-register for PAC feature. This patch teaches the DWARF support in gcc about RA_AUTH_CODE pseudo hard-register and also updates the ".save", ".cfi_register", ".cfi_offset", ".cfi_restore" directives accordingly. This patch also adds support to emit ".pacspval" directive when "pac ip, lr, sp" instruction in generated in the assembly. RA_AUTH_CODE register number is 107 and it's dwarf register number is 143. Applying this patch on top of PACBTI series posted here https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599658.html and when compiling the following test.c with "-march=armv8.1-m.main+mve+pacbti -mbranch-protection=pac-ret -mthumb -mfloat-abi=hard fasynchronous-unwind-tables -g -O0 -S" command line options, the assembly output after this patch looks like below: $cat test.c void fun1(int a); void fun(int a,...) { fun1(a); } int main() { fun (10); return 0; } $ arm-none-eabi-gcc -march=armv8.1-m.main+mve+pacbti -mbranch-protection=pac-ret -mthumb -mfloat-abi=hard -fasynchronous-unwind-tables -g -O0 -S test.s Assembly output: ... fun: ... .pacspval pac ip, lr, sp .cfi_register 143, 12 push {r3, r7, ip, lr} .save {r3, r7, ra_auth_code, lr} ... .cfi_offset 143, -24 ... .cfi_restore 143 ... aut ip, lr, sp bx lr ... main: ... .pacspval pac ip, lr, sp .cfi_register 143, 12 push {r3, r7, ip, lr} .save {r3, r7, ra_auth_code, lr} ... .cfi_offset 143, -8 ... .cfi_restore 143 ... aut ip, lr, sp bx lr ... gcc/ChangeLog: 2023-01-11 Srinath Parvathaneni * config/arm/aout.h (ra_auth_code): Add entry in enum. * config/arm/arm.cc (emit_multi_reg_push): Add RA_AUTH_CODE register to dwarf frame expression. (arm_emit_multi_reg_pop): Restore RA_AUTH_CODE register. (arm_expand_prologue): Update frame related information and reg notes for pac/pacbit insn. (arm_regno_class): Check for pac pseudo reigster. (arm_dbx_register_number): Assign ra_auth_code register number in dwarf. (arm_init_machine_status): Set pacspval_needed to zero. (arm_debugger_regno): Check for PAC register. (arm_unwind_emit_sequence): Print .save directive with ra_auth_code register. (arm_unwind_emit_set): Add entry for IP_REGNUM in switch case. (arm_unwind_emit): Update REG_CFA_REGISTER case._ * config/arm/arm.h (FIRST_PSEUDO_REGISTER): Modify. (DWARF_PAC_REGNUM): Define. (IS_PAC_REGNUM): Likewise. (enum reg_class): Add PAC_REG entry. (machine_function): Add pacbti_needed state to structure. * config/arm/arm.md (RA_AUTH_CODE): Define. gcc/testsuite/ChangeLog: 2023-01-11 Srinath Parvathaneni * g++.target/arm/pac-1.C: New test. * gcc.target/arm/pac-15.c: Likewise. --- gcc/config/arm/aout.h | 3 +- gcc/config/arm/arm.cc | 86 +++++++++++++++++++++++++++++------ gcc/config/arm/arm.h | 24 +++++++--- gcc/config/arm/arm.md | 1 + gcc/testsuite/g++.target/arm/pac-1.C | 35 ++++++++++++++ gcc/testsuite/gcc.target/arm/pac-15.c | 32 +++++++++++++ 6 files changed, 160 insertions(+), 21 deletions(-) create mode 100644 gcc/testsuite/g++.target/arm/pac-1.C create mode 100644 gcc/testsuite/gcc.target/arm/pac-15.c (limited to 'gcc') diff --git a/gcc/config/arm/aout.h b/gcc/config/arm/aout.h index b8f8eb0..57c3b9b 100644 --- a/gcc/config/arm/aout.h +++ b/gcc/config/arm/aout.h @@ -74,7 +74,8 @@ "wr8", "wr9", "wr10", "wr11", \ "wr12", "wr13", "wr14", "wr15", \ "wcgr0", "wcgr1", "wcgr2", "wcgr3", \ - "cc", "vfpcc", "sfp", "afp", "apsrq", "apsrge", "p0" \ + "cc", "vfpcc", "sfp", "afp", "apsrq", "apsrge", "p0", \ + "ra_auth_code" \ } #endif diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc index fb52048..efc4834 100644 --- a/gcc/config/arm/arm.cc +++ b/gcc/config/arm/arm.cc @@ -22272,7 +22272,33 @@ emit_multi_reg_push (unsigned long mask, unsigned long dwarf_regs_mask) { if (mask & (1 << i)) { - reg = gen_rtx_REG (SImode, i); + /* NOTE: Dwarf code emitter handle reg-reg copies correctly and in the + following example reg-reg copy of SP to IP register is handled + through .cfi_def_cfa_register directive and the .cfi_offset + directive for IP register is skipped by dwarf code emitter. + Example: + mov ip, sp + .cfi_def_cfa_register 12 + push {fp, ip, lr, pc} + .cfi_offset 11, -16 + .cfi_offset 13, -12 + .cfi_offset 14, -8 + + Where as Arm-specific .save directive handling is different to that + of dwarf code emitter and it doesn't consider reg-reg copies while + updating the register list. When PACBTI is enabled we manually + updated the .save directive register list to use "ra_auth_code" + (pseduo register 143) instead of IP register as shown in following + pseduo code. + Example: + pacbti ip, lr, sp + .cfi_register 143, 12 + push {r3, r7, ip, lr} + .save {r3, r7, ra_auth_code, lr} + */ + rtx dwarf_reg = reg = gen_rtx_REG (SImode, i); + if (arm_current_function_pac_enabled_p () && i == IP_REGNUM) + dwarf_reg = gen_rtx_REG (SImode, RA_AUTH_CODE); XVECEXP (par, 0, 0) = gen_rtx_SET (gen_frame_mem @@ -22290,7 +22316,7 @@ emit_multi_reg_push (unsigned long mask, unsigned long dwarf_regs_mask) if (dwarf_regs_mask & (1 << i)) { tmp = gen_rtx_SET (gen_frame_mem (SImode, stack_pointer_rtx), - reg); + dwarf_reg); RTX_FRAME_RELATED_P (tmp) = 1; XVECEXP (dwarf, 0, dwarf_par_index++) = tmp; } @@ -22303,7 +22329,9 @@ emit_multi_reg_push (unsigned long mask, unsigned long dwarf_regs_mask) { if (mask & (1 << i)) { - reg = gen_rtx_REG (SImode, i); + rtx dwarf_reg = reg = gen_rtx_REG (SImode, i); + if (arm_current_function_pac_enabled_p () && i == IP_REGNUM) + dwarf_reg = gen_rtx_REG (SImode, RA_AUTH_CODE); XVECEXP (par, 0, j) = gen_rtx_USE (VOIDmode, reg); @@ -22314,7 +22342,7 @@ emit_multi_reg_push (unsigned long mask, unsigned long dwarf_regs_mask) (SImode, plus_constant (Pmode, stack_pointer_rtx, 4 * j)), - reg); + dwarf_reg); RTX_FRAME_RELATED_P (tmp) = 1; XVECEXP (dwarf, 0, dwarf_par_index++) = tmp; } @@ -22399,7 +22427,9 @@ arm_emit_multi_reg_pop (unsigned long saved_regs_mask) for (j = 0, i = 0; j < num_regs; i++) if (saved_regs_mask & (1 << i)) { - reg = gen_rtx_REG (SImode, i); + rtx dwarf_reg = reg = gen_rtx_REG (SImode, i); + if (arm_current_function_pac_enabled_p () && i == IP_REGNUM) + dwarf_reg = gen_rtx_REG (SImode, RA_AUTH_CODE); if ((num_regs == 1) && emit_update && !return_in_pc) { /* Emit single load with writeback. */ @@ -22407,7 +22437,8 @@ arm_emit_multi_reg_pop (unsigned long saved_regs_mask) gen_rtx_POST_INC (Pmode, stack_pointer_rtx)); tmp = emit_insn (gen_rtx_SET (reg, tmp)); - REG_NOTES (tmp) = alloc_reg_note (REG_CFA_RESTORE, reg, dwarf); + REG_NOTES (tmp) = alloc_reg_note (REG_CFA_RESTORE, dwarf_reg, + dwarf); return; } @@ -22421,7 +22452,7 @@ arm_emit_multi_reg_pop (unsigned long saved_regs_mask) /* We need to maintain a sequence for DWARF info too. As dwarf info should not have PC, skip PC. */ if (i != PC_REGNUM) - dwarf = alloc_reg_note (REG_CFA_RESTORE, reg, dwarf); + dwarf = alloc_reg_note (REG_CFA_RESTORE, dwarf_reg, dwarf); j++; } @@ -23603,6 +23634,8 @@ arm_expand_prologue (void) -fp_offset)); RTX_FRAME_RELATED_P (insn) = 1; add_reg_note (insn, REG_FRAME_RELATED_EXPR, dwarf); + if (arm_current_function_pac_enabled_p ()) + cfun->machine->pacspval_needed = 1; } else { @@ -23638,6 +23671,8 @@ arm_expand_prologue (void) RTX_FRAME_RELATED_P (insn) = 1; fp_offset = args_to_push; args_to_push = 0; + if (arm_current_function_pac_enabled_p ()) + cfun->machine->pacspval_needed = 1; } } @@ -23647,9 +23682,13 @@ arm_expand_prologue (void) one will be added before the push of the clobbered IP (if necessary) by the bti pass. */ if (aarch_bti_enabled () && !clobber_ip) - emit_insn (gen_pacbti_nop ()); + insn = emit_insn (gen_pacbti_nop ()); else - emit_insn (gen_pac_nop ()); + insn = emit_insn (gen_pac_nop ()); + + rtx dwarf = gen_rtx_SET (ip_rtx, gen_rtx_REG (SImode, RA_AUTH_CODE)); + RTX_FRAME_RELATED_P (insn) = 1; + add_reg_note (insn, REG_CFA_REGISTER, dwarf); } if (TARGET_APCS_FRAME && frame_pointer_needed && TARGET_ARM) @@ -25731,6 +25770,9 @@ arm_regno_class (int regno) if (IS_VPR_REGNUM (regno)) return VPR_REG; + if (IS_PAC_REGNUM (regno)) + return PAC_REG; + if (TARGET_THUMB1) { if (regno == STACK_POINTER_REGNUM) @@ -26891,6 +26933,7 @@ arm_init_machine_status (void) machine->func_type = ARM_FT_UNKNOWN; #endif machine->static_chain_stack_bytes = -1; + machine->pacspval_needed = 0; return machine; } @@ -29700,6 +29743,9 @@ arm_debugger_regno (unsigned int regno) if (IS_IWMMXT_REGNUM (regno)) return 112 + regno - FIRST_IWMMXT_REGNUM; + if (IS_PAC_REGNUM (regno)) + return DWARF_PAC_REGNUM; + return DWARF_FRAME_REGISTERS; } @@ -29793,7 +29839,7 @@ arm_unwind_emit_sequence (FILE * out_file, rtx p) gcc_assert (nregs); reg = REGNO (SET_SRC (XVECEXP (p, 0, 1))); - if (reg < 16) + if (reg < 16 || IS_PAC_REGNUM (reg)) { /* For -Os dummy registers can be pushed at the beginning to avoid separate stack pointer adjustment. */ @@ -29850,6 +29896,8 @@ arm_unwind_emit_sequence (FILE * out_file, rtx p) double precision register names. */ if (IS_VFP_REGNUM (reg)) asm_fprintf (out_file, "d%d", (reg - FIRST_VFP_REGNUM) / 2); + else if (IS_PAC_REGNUM (reg)) + asm_fprintf (asm_out_file, "ra_auth_code"); else asm_fprintf (out_file, "%r", reg); @@ -29944,7 +29992,7 @@ arm_unwind_emit_set (FILE * out_file, rtx p) /* Move from sp to reg. */ asm_fprintf (out_file, "\t.movsp %r\n", REGNO (e0)); } - else if (GET_CODE (e1) == PLUS + else if (GET_CODE (e1) == PLUS && REG_P (XEXP (e1, 0)) && REGNO (XEXP (e1, 0)) == SP_REGNUM && CONST_INT_P (XEXP (e1, 1))) @@ -29953,6 +30001,11 @@ arm_unwind_emit_set (FILE * out_file, rtx p) asm_fprintf (out_file, "\t.movsp %r, #%d\n", REGNO (e0), (int)INTVAL(XEXP (e1, 1))); } + else if (REGNO (e0) == IP_REGNUM && arm_current_function_pac_enabled_p ()) + { + if (cfun->machine->pacspval_needed) + asm_fprintf (out_file, "\t.pacspval\n"); + } else abort (); break; @@ -30007,10 +30060,15 @@ arm_unwind_emit (FILE * out_file, rtx_insn *insn) src = SET_SRC (pat); dest = SET_DEST (pat); - gcc_assert (src == stack_pointer_rtx); + gcc_assert (src == stack_pointer_rtx + || IS_PAC_REGNUM (REGNO (src))); reg = REGNO (dest); - asm_fprintf (out_file, "\t.unwind_raw 0, 0x%x @ vsp = r%d\n", - reg + 0x90, reg); + + if (IS_PAC_REGNUM (REGNO (src))) + arm_unwind_emit_set (out_file, PATTERN (insn)); + else + asm_fprintf (out_file, "\t.unwind_raw 0, 0x%x @ vsp = r%d\n", + reg + 0x90, reg); } handled_one = true; break; diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 97e2fda..6327283 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -816,7 +816,8 @@ extern const int arm_arch_cde_coproc_bits[]; s16-s31 S VFP variable (aka d8-d15). vfpcc Not a real register. Represents the VFP condition code flags. - vpr Used to represent MVE VPR predication. */ + vpr Used to represent MVE VPR predication. + ra_auth_code Pseudo register to save PAC. */ /* The stack backtrace structure is as follows: fp points to here: | save code pointer | [fp] @@ -857,7 +858,7 @@ extern const int arm_arch_cde_coproc_bits[]; 1,1,1,1,1,1,1,1, \ 1,1,1,1, \ /* Specials. */ \ - 1,1,1,1,1,1,1 \ + 1,1,1,1,1,1,1,1 \ } /* 1 for registers not available across function calls. @@ -887,7 +888,7 @@ extern const int arm_arch_cde_coproc_bits[]; 1,1,1,1,1,1,1,1, \ 1,1,1,1, \ /* Specials. */ \ - 1,1,1,1,1,1,1 \ + 1,1,1,1,1,1,1,1 \ } #ifndef SUBTARGET_CONDITIONAL_REGISTER_USAGE @@ -1063,10 +1064,12 @@ extern const int arm_arch_cde_coproc_bits[]; && (LAST_VFP_REGNUM - (REGNUM) >= 2 * (N) - 1)) /* The number of hard registers is 16 ARM + 1 CC + 1 SFP + 1 AFP - + 1 APSRQ + 1 APSRGE + 1 VPR. */ + + 1 APSRQ + 1 APSRGE + 1 VPR + 1 Pseudo register to save PAC. */ /* Intel Wireless MMX Technology registers add 16 + 4 more. */ /* VFP (VFP3) adds 32 (64) + 1 VFPCC. */ -#define FIRST_PSEUDO_REGISTER 107 +#define FIRST_PSEUDO_REGISTER 108 + +#define DWARF_PAC_REGNUM 143 #define DEBUGGER_REGNO(REGNO) arm_debugger_regno (REGNO) @@ -1253,12 +1256,15 @@ extern int arm_regs_in_sequence[]; CC_REGNUM, VFPCC_REGNUM, \ FRAME_POINTER_REGNUM, ARG_POINTER_REGNUM, \ SP_REGNUM, PC_REGNUM, APSRQ_REGNUM, \ - APSRGE_REGNUM, VPR_REGNUM \ + APSRGE_REGNUM, VPR_REGNUM, RA_AUTH_CODE \ } #define IS_VPR_REGNUM(REGNUM) \ ((REGNUM) == VPR_REGNUM) +#define IS_PAC_REGNUM(REGNUM) \ + ((REGNUM) == RA_AUTH_CODE) + /* Use different register alloc ordering for Thumb. */ #define ADJUST_REG_ALLOC_ORDER arm_order_regs_for_local_alloc () @@ -1297,6 +1303,7 @@ enum reg_class SFP_REG, AFP_REG, VPR_REG, + PAC_REG, GENERAL_AND_VPR_REGS, ALL_REGS, LIM_REG_CLASSES @@ -1327,6 +1334,7 @@ enum reg_class "SFP_REG", \ "AFP_REG", \ "VPR_REG", \ + "PAC_REG", \ "GENERAL_AND_VPR_REGS", \ "ALL_REGS" \ } @@ -1356,6 +1364,7 @@ enum reg_class { 0x00000000, 0x00000000, 0x00000000, 0x00000040 }, /* SFP_REG */ \ { 0x00000000, 0x00000000, 0x00000000, 0x00000080 }, /* AFP_REG */ \ { 0x00000000, 0x00000000, 0x00000000, 0x00000400 }, /* VPR_REG. */ \ + { 0x00000000, 0x00000000, 0x00000000, 0x00000800 }, /* PAC_REG. */ \ { 0x00005FFF, 0x00000000, 0x00000000, 0x00000400 }, /* GENERAL_AND_VPR_REGS. */ \ { 0xFFFF7FFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000040F } /* ALL_REGS. */ \ } @@ -1621,6 +1630,9 @@ typedef struct GTY(()) machine_function /* The number of bytes used to store the static chain register on the stack, above the stack frame. */ int static_chain_stack_bytes; + /* Set to 1 when pointer authentication operation uses value of SP other + than the incoming stack pointer value. */ + int pacspval_needed; } machine_function; #endif diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 3b95f47..cbfc454 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -42,6 +42,7 @@ (APSRQ_REGNUM 104) ; Q bit pseudo register (APSRGE_REGNUM 105) ; GE bits pseudo register (VPR_REGNUM 106) ; Vector Predication Register - MVE register. + (RA_AUTH_CODE 107) ; Pseudo register to save PAC. ] ) ;; 3rd operand to select_dominance_cc_mode diff --git a/gcc/testsuite/g++.target/arm/pac-1.C b/gcc/testsuite/g++.target/arm/pac-1.C new file mode 100644 index 0000000..f671a27 --- /dev/null +++ b/gcc/testsuite/g++.target/arm/pac-1.C @@ -0,0 +1,35 @@ +/* Check that GCC does .save and .cfi_offset directives with RA_AUTH_CODE pseudo hard-register. */ +/* { dg-do compile } */ +/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */ +/* { dg-options "-march=armv8.1-m.main+mve+pacbti -mbranch-protection=pac-ret -mthumb -mfloat-abi=hard -g -O0" } */ + +__attribute__((noinline)) void +fn1 (int a, int b, int c) +{ + if (a != b + c) + __builtin_abort (); + else + throw b+c; +} + +int main () +{ + int a = 120; + try + { + fn1 (a, 40, 80); + } + catch (int x) + { + if (x != a) + __builtin_abort (); + else + return 0; + } +} + +/* { dg-final { scan-assembler-times "pac ip, lr, sp" 2 } } */ +/* { dg-final { scan-assembler-times "\.cfi_register 143, 12" 2 } } */ +/* { dg-final { scan-assembler-times "\.save {r7, ra_auth_code, lr}" 1 } } */ +/* { dg-final { scan-assembler-times "\.cfi_offset 143, -8" 2 } } */ +/* { dg-final { scan-assembler-times "\.save {r4, r7, ra_auth_code, lr}" 1 } } */ diff --git a/gcc/testsuite/gcc.target/arm/pac-15.c b/gcc/testsuite/gcc.target/arm/pac-15.c new file mode 100644 index 0000000..e105490 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-15.c @@ -0,0 +1,32 @@ +/* Check that GCC does .save and .cfi_offset directives with RA_AUTH_CODE pseudo hard-register. */ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */ +/* { dg-options "-march=armv8.1-m.main+mve+pacbti -mbranch-protection=pac-ret -mthumb -mfloat-abi=hard -fasynchronous-unwind-tables -g -O0" } */ + +#include "stdio.h" + +__attribute__((noinline)) int +fn1 (int a) +{ + const char *fmt = "branch-protection"; + int fun1(int x,const char *fmt,int c,int d) + { + printf("string = %s\n",fmt); + return x+c+d; + } + return fun1(a,fmt,10,10); +} + +int main (void) +{ + return fn1 (40); +} + +/* { dg-final { scan-assembler-times "\.pacspval" 1 } } */ +/* { dg-final { scan-assembler-times "pac ip, lr, sp" 3 } } */ +/* { dg-final { scan-assembler-times "\.cfi_register 143, 12" 3 } } */ +/* { dg-final { scan-assembler-times "\.save {r7, ra_auth_code, lr}" 2 } } */ +/* { dg-final { scan-assembler-times "\.cfi_offset 143, -8" 2 } } */ +/* { dg-final { scan-assembler-times "\.save {r3, r7, ra_auth_code, lr}" 1 } } */ +/* { dg-final { scan-assembler-times "\.cfi_offset 143, -12" 1 } } */ -- cgit v1.1 From 054e407b7f68f714c024d8a9c983fdd53ceead2b Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 13 Jan 2023 08:54:33 +0100 Subject: sparc: Don't add crtfastmath.o for -shared Don't add crtfastmath.o for -shared to avoid altering the FP environment when loading a shared library. PR target/55522 * config/sparc/freebsd.h (ENDFILE_SPEC): Don't add crtfastmath.o for -shared. * config/sparc/linux.h (ENDFILE_SPEC): Likewise. * config/sparc/linux64.h (ENDFILE_SPEC): Likewise. * config/sparc/sp-elf.h (ENDFILE_SPEC): Likewise. * config/sparc/sp64-elf.h (ENDFILE_SPEC): Likewise. --- gcc/config/sparc/freebsd.h | 2 +- gcc/config/sparc/linux.h | 2 +- gcc/config/sparc/linux64.h | 2 +- gcc/config/sparc/sp-elf.h | 2 +- gcc/config/sparc/sp64-elf.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'gcc') diff --git a/gcc/config/sparc/freebsd.h b/gcc/config/sparc/freebsd.h index b1ae4ba..f77203c 100644 --- a/gcc/config/sparc/freebsd.h +++ b/gcc/config/sparc/freebsd.h @@ -127,7 +127,7 @@ along with GCC; see the file COPYING3. If not see #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \ + "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} " \ FBSD_ENDFILE_SPEC /* We use GNU ld so undefine this so that attribute((init_priority)) works. */ diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h index a1144da..0e33b3c 100644 --- a/gcc/config/sparc/linux.h +++ b/gcc/config/sparc/linux.h @@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see #undef ENDFILE_SPEC #define ENDFILE_SPEC \ GNU_USER_TARGET_ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" + "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" /* -mcpu=native handling only makes sense with compiler running on a SPARC chip. */ diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h index 80aa703..f1cc0a1 100644 --- a/gcc/config/sparc/linux64.h +++ b/gcc/config/sparc/linux64.h @@ -47,7 +47,7 @@ along with GCC; see the file COPYING3. If not see #undef ENDFILE_SPEC #define ENDFILE_SPEC \ GNU_USER_TARGET_ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" + "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" /* The default code model. */ #undef SPARC_DEFAULT_CMODEL diff --git a/gcc/config/sparc/sp-elf.h b/gcc/config/sparc/sp-elf.h index fdd5c57..0d6a9af 100644 --- a/gcc/config/sparc/sp-elf.h +++ b/gcc/config/sparc/sp-elf.h @@ -32,7 +32,7 @@ along with GCC; see the file COPYING3. If not see #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \ crtend.o%s crtn.o%s" /* Don't set the target flags, this is done by the linker script */ diff --git a/gcc/config/sparc/sp64-elf.h b/gcc/config/sparc/sp64-elf.h index 1f476cd..11c9504 100644 --- a/gcc/config/sparc/sp64-elf.h +++ b/gcc/config/sparc/sp64-elf.h @@ -44,7 +44,7 @@ along with GCC; see the file COPYING3. If not see #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \ crtend.o%s crtn.o%s" /* Use the default (for now). */ -- cgit v1.1 From b457cab64038cd9b7a8481594ff673f1822681f6 Mon Sep 17 00:00:00 2001 From: Srinath Parvathaneni Date: Mon, 23 Jan 2023 13:37:07 +0000 Subject: arm: Documentation fix for -mbranch-protection option. This patch fixes the documentation for -mbranch-protection command line option. gcc/ChangeLog: 2023-01-23 Srinath Parvathaneni * doc/invoke.texi (-mbranch-protection): Update documentation. --- gcc/doc/invoke.texi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index f1c0b52..06d7798 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -22564,8 +22564,7 @@ The opposite @option{-mno-fdpic} option is useful (and required) to build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi}) toolchain as the one used to build the userland programs. -@item --mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}][+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]] +@item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}][+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]] @opindex mbranch-protection Enable branch protection features (armv8.1-m.main only). @samp{none} generate code without branch protection or return address -- cgit v1.1 From bcc023e2b4dd0dc1fd1fca3ea12664d5bdade4dc Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Sat, 14 Jan 2023 10:20:47 +0000 Subject: modula-2: Fix stack size request in initPreemptive [PR108405] As noted in the PR, the problem is that we make a request for additional stack that violates the constraints on some systems. This patch chooses a value that is divisible by common OS page sizes. TODO: the user value should be checked and then an exception thrown if it is not suitable. Signed-off-by: Iain Sandoe PR modula2/108405 gcc/m2/ChangeLog: * gm2-libs-iso/Preemptive.mod (initPreemptive): Use a value for extra space that is divisible by common OS pagesizes. --- gcc/m2/gm2-libs-iso/Preemptive.mod | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/m2/gm2-libs-iso/Preemptive.mod b/gcc/m2/gm2-libs-iso/Preemptive.mod index 53952e1..44aa62b 100644 --- a/gcc/m2/gm2-libs-iso/Preemptive.mod +++ b/gcc/m2/gm2-libs-iso/Preemptive.mod @@ -33,6 +33,9 @@ FROM libc IMPORT printf ; CONST debugging = FALSE ; + (* The space we request becomes part of a stack request, which generally + has constraints on size and alignment. *) + extraWorkSpace = 10 * 1024 * 1024 ; (* timer - the timer process which runs at maximum scheduling priority with @@ -107,7 +110,7 @@ BEGIN IF NOT init THEN init := TRUE ; - Create (timer, 10000000, MAX (Urgency), NIL, timerId) ; + Create (timer, extraWorkSpace, MAX (Urgency), NIL, timerId) ; Activate (timerId) END END initPreemptive ; -- cgit v1.1 From 47b269caf87904fd0112e8c9e96884dd0313ed15 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Wed, 11 Jan 2023 10:22:34 +0000 Subject: modula-2, driver, Front end: Revise handling of I and L paths [PR108182]. The adds the includes in the FE as done in other GCC languages. It also revises the library handling to avoid additional -L options from hiding LIBDIR. For the include/import paths as presented to the front end initialisation, we capture them and then arrange to emit the 'standard library' paths in the same order as specified for C. The specs are tidied up. The use of the internal prefix also fixes searching in a relocated compiler. Signed-off-by: Iain Sandoe PR modula2/108182 PR modula2/108480 gcc/m2/ChangeLog: * Make-lang.in: Pass libsubdir to the language init build. * gm2-lang.cc (INCLUDE_VECTOR): Define. (add_one_import_path): New. (add_m2_import_paths): New. (gm2_langhook_post_options): Arrange to add the include paths (and add the system ones) in the same order as C uses. * gm2spec.cc (build_archive_path): Remove. (add_default_combination): Remove. (add_default_archives): Remove. (add_default_libs): We no longer need a '-L' option, just emit the -l and each library in use. (build_include_path): Remove. (add_include): Remove. (add_default_includes): Remove. (library_installed): Remove. (check_valid_library): Remove. (check_valid_list): Remove. (convert_abbreviation): Diagnose unhandled cases. (lang_specific_driver): Skip options where we will add back a validated version. * lang-specs.h (M2CPP): Reformat, append %I when -fcpp is not in use. Revise the cc1gm2 spec to omit mentioning options that are handled in the c pre-processor line. * lang.opt: Allow preprocessing and path options as input to the cc1gm2 invocation, so that they can be passed to the preprocessor invocation. --- gcc/m2/Make-lang.in | 1 + gcc/m2/gm2-lang.cc | 168 ++++++++++++++++++++++--- gcc/m2/gm2spec.cc | 344 +++++++++++++++------------------------------------- gcc/m2/lang-specs.h | 13 +- gcc/m2/lang.opt | 48 ++++++++ 5 files changed, 304 insertions(+), 270 deletions(-) (limited to 'gcc') diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in index 367be8e..00cca7d 100644 --- a/gcc/m2/Make-lang.in +++ b/gcc/m2/Make-lang.in @@ -543,6 +543,7 @@ m2/gm2-gcc/m2configure.o: $(srcdir)/m2/gm2-gcc/m2configure.cc \ m2/gm2-lang.o: $(srcdir)/m2/gm2-lang.cc gt-m2-gm2-lang.h $(GCC_HEADER_DEPENDENCIES_FOR_M2) $(COMPILER) -c -g $(GM2GCC) $(ALL_COMPILERFLAGS) \ + -DLIBSUBDIR=\"$(libsubdir)\" \ $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) m2/stor-layout.o: $(srcdir)/stor-layout.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2) diff --git a/gcc/m2/gm2-lang.cc b/gcc/m2/gm2-lang.cc index b812327..9870743 100644 --- a/gcc/m2/gm2-lang.cc +++ b/gcc/m2/gm2-lang.cc @@ -20,6 +20,7 @@ along with GNU Modula-2; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#define INCLUDE_VECTOR #include "gm2-gcc/gcc-consolidation.h" #include "langhooks-def.h" /* FIXME: for lhd_set_decl_assembler_name. */ @@ -45,6 +46,18 @@ static void write_globals (void); static int insideCppArgs = FALSE; +/* We default to pim in the absence of fiso. */ +static bool iso = false; + +/* The language include paths are based on the libraries in use. */ +static bool allow_libraries = true; +static const char *flibs = nullptr; +static const char *iprefix = nullptr; +static const char *imultilib = nullptr; +static std::vectorIpaths; +static std::vectorisystem; +static std::vectoriquote; + #define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0) /* start of new stuff. */ @@ -198,34 +211,41 @@ gm2_langhook_handle_option ( return 1; case OPT_I: if (insideCppArgs) - { - const struct cl_option *option = &cl_options[scode]; - const char *opt = (const char *)option->opt_text; - M2Options_CppArg (opt, arg, TRUE); - } + { + const struct cl_option *option = &cl_options[scode]; + const char *opt = (const char *)option->opt_text; + M2Options_CppArg (opt, arg, (option->flags & CL_JOINED) + && !(option->flags & CL_SEPARATE)); + } else - M2Options_SetSearchPath (arg); + Ipaths.push_back (arg); return 1; case OPT_fiso: M2Options_SetISO (value); + iso = value; return 1; case OPT_fpim: M2Options_SetPIM (value); + iso = value ? false : iso; return 1; case OPT_fpim2: M2Options_SetPIM2 (value); + iso = value ? false : iso; return 1; case OPT_fpim3: M2Options_SetPIM3 (value); + iso = value ? false : iso; return 1; case OPT_fpim4: M2Options_SetPIM4 (value); + iso = value ? false : iso; return 1; case OPT_fpositive_mod_floor_div: M2Options_SetPositiveModFloor (value); return 1; case OPT_flibs_: - /* handled in the gm2 driver. */ + allow_libraries = value; + flibs = arg; return 1; case OPT_fgen_module_list_: M2Options_SetGenModuleList (value, arg); @@ -374,6 +394,30 @@ gm2_langhook_handle_option ( case OPT_fm2_g: M2Options_SetM2g (value); return 1; + break; + case OPT_iprefix: + case OPT_imultilib: + case OPT_isystem: + case OPT_iquote: + case OPT_isysroot: + if (insideCppArgs) + { + const struct cl_option *option = &cl_options[scode]; + const char *opt = (const char *)option->opt_text; + M2Options_CppArg (opt, arg, (option->flags & CL_JOINED) + && !(option->flags & CL_SEPARATE)); + } + if (code == OPT_iprefix) + iprefix = arg; + else if (code == OPT_imultilib) + imultilib = arg; + else if (code == OPT_iquote) + iquote.push_back (arg); + else if (code == OPT_isystem) + isystem.push_back (arg); + /* Otherwise, ignored, at least for now. */ + return 1; + break; case OPT_O: M2Options_SetOptimizing (value); return 1; @@ -412,18 +456,77 @@ gm2_langhook_handle_option ( return 1; default: if (insideCppArgs) - { - const struct cl_option *option = &cl_options[scode]; - const char *opt = (const char *)option->opt_text; - - M2Options_CppArg (opt, arg, TRUE); - return 1; - } + { + const struct cl_option *option = &cl_options[scode]; + const char *opt = (const char *)option->opt_text; + M2Options_CppArg (opt, arg, (option->flags & CL_JOINED) + && !(option->flags & CL_SEPARATE)); + return 1; + } return 0; } return 0; } +/* This prefixes LIBNAME with the current compiler prefix (if it has been + relocated) or the LIBSUBDIR, if not. */ +static void +add_one_import_path (const char *libname) +{ + const char *libpath = iprefix ? iprefix : LIBSUBDIR; + const char dir_sep[] = {DIR_SEPARATOR, (char)0}; + size_t dir_sep_size = strlen (dir_sep); + unsigned int mlib_len = 0; + + if (imultilib) + { + mlib_len = strlen (imultilib); + mlib_len += strlen (dir_sep); + } + + char *lib = (char *)alloca (strlen (libpath) + dir_sep_size + + strlen ("m2") + dir_sep_size + + strlen (libname) + 1 + + mlib_len + 1); + strcpy (lib, libpath); + /* iprefix has a trailing dir separator, LIBSUBDIR does not. */ + if (!iprefix) + strcat (lib, dir_sep); + + if (imultilib) + { + strcat (lib, imultilib); + strcat (lib, dir_sep); + } + strcat (lib, "m2"); + strcat (lib, dir_sep); + strcat (lib, libname); + M2Options_SetSearchPath (lib); +} + +/* For each comma-separated standard library name in LIBLIST, add the + corresponding include path. */ +static void +add_m2_import_paths (const char *liblist) +{ + while (*liblist != 0 && *liblist != '-') + { + const char *comma = strstr (liblist, ","); + size_t len; + if (comma) + len = comma - liblist; + else + len = strlen (liblist); + char *libname = (char *) alloca (len+1); + strncpy (libname, liblist, len); + libname[len] = 0; + add_one_import_path (libname); + liblist += len; + if (*liblist == ',') + liblist++; + } +} + /* Run after parsing options. */ static bool @@ -435,7 +538,42 @@ gm2_langhook_post_options (const char **pfilename) M2Options_FinaliseOptions (); main_input_filename = filename; - /* Returning false means that the backend should be used. */ + /* Add the include paths as per the libraries specified. + NOTE: This assumes that the driver has validated the input and makes + no attempt to be defensive of nonsense input in flibs=. */ + if (allow_libraries) + { + if (!flibs) + { + if (iso) + flibs = "m2iso,m2cor,m2pim,m2log"; + else + flibs = "m2pim,m2iso,m2cor,m2log"; + } + } + + /* Add search paths. + We are not handling all of the cases yet (e.g idirafter). + This (barring the missing cases) is intended to follow the directory + search rules used for c-family. It would be less confusing if the + presence of absence of these search paths was not dependent on the + flibs= option. */ + + for (auto *s : iquote) + M2Options_SetSearchPath (s); + iquote.clear(); + for (auto *s : Ipaths) + M2Options_SetSearchPath (s); + Ipaths.clear(); + for (auto *s : isystem) + M2Options_SetSearchPath (s); + isystem.clear(); + /* FIXME: this is not a good way to suppress the addition of the import + paths. */ + if (allow_libraries) + add_m2_import_paths (flibs); + + /* Returning false means that the backend should be used. */ return false; } diff --git a/gcc/m2/gm2spec.cc b/gcc/m2/gm2spec.cc index f964ecc..c248d1b 100644 --- a/gcc/m2/gm2spec.cc +++ b/gcc/m2/gm2spec.cc @@ -103,6 +103,7 @@ enum stdcxxlib_kind }; #define DEFAULT_DIALECT "pim" + #undef DEBUG_ARG typedef enum { iso, pim, min, logitech, pimcoroutine, maxlib } libs; @@ -132,14 +133,13 @@ static const char *add_include (const char *libpath, const char *library); static bool seen_scaffold_static = false; static bool seen_scaffold_dynamic = false; +static bool scaffold_dynamic = true; // Default uses -fscaffold-dynamic. static bool scaffold_static = false; -static bool scaffold_dynamic = true; // Default uses -fscaffold-dynamic. static bool seen_gen_module_list = false; static bool seen_uselist = false; static bool uselist = false; static bool gen_module_list = true; // Default uses -fgen-module-list=-. static const char *gen_module_filename = "-"; -static const char *multilib_dir = NULL; /* The original argument list and related info is copied here. */ static unsigned int gm2_xargc; static const struct cl_decoded_option *gm2_x_decoded_options; @@ -148,6 +148,8 @@ static void append_arg (const struct cl_decoded_option *); /* The new argument list will be built here. */ static unsigned int gm2_newargc; static struct cl_decoded_option *gm2_new_decoded_options; +static const char *full_libraries = NULL; +static const char *libraries = NULL; /* Abbreviated libraries. */ /* Return whether strings S1 and S2 are both NULL or both the same @@ -227,50 +229,6 @@ append_option (size_t opt_index, const char *arg, int value) append_arg (&decoded); } -/* build_archive_path returns a string containing the path to the - archive defined by libpath and dialectLib. */ - -static const char * -build_archive_path (const char *libpath, const char *library) -{ - if (library != NULL) - { - const char *libdir = (const char *)library; - - if (libdir != NULL) - { - int machine_length = 0; - char dir_sep[2]; - - dir_sep[0] = DIR_SEPARATOR; - dir_sep[1] = (char)0; - - if (multilib_dir != NULL) - { - machine_length = strlen (multilib_dir); - machine_length += strlen (dir_sep); - } - - int l = strlen (libpath) + 1 + strlen ("m2") + 1 - + strlen (libdir) + 1 + machine_length + 1; - char *s = (char *)xmalloc (l); - - strcpy (s, libpath); - strcat (s, dir_sep); - if (machine_length > 0) - { - strcat (s, multilib_dir); - strcat (s, dir_sep); - } - strcat (s, "m2"); - strcat (s, dir_sep); - strcat (s, libdir); - return s; - } - } - return NULL; -} - /* safe_strdup safely duplicates a string. */ static char * @@ -281,205 +239,65 @@ safe_strdup (const char *s) return NULL; } -/* add_default_combination adds the correct link path and then the - library name. */ - -static bool -add_default_combination (const char *libpath, const char *library) +static char * +concat_option (char *dest, const char *pre, const char *path, const char *post) { - if (library != NULL) + if (dest == NULL) { - append_option (OPT_L, build_archive_path (libpath, library), 1); - append_option (OPT_l, safe_strdup (library), 1); - return true; + dest = (char *) xmalloc (strlen (pre) + strlen (path) + strlen (post) + 1); + strcpy (dest, pre); + strcat (dest, path); + strcat (dest, post); + return dest; + } + else + { + char *result = (char *) xmalloc (strlen (dest) + strlen (pre) + + strlen (path) + strlen (post) + 1 + 1); + strcpy (result, dest); + strcat (result, " "); + strcat (result, pre); + strcat (result, path); + strcat (result, post); + free (dest); + return result; } - return false; } -/* add_default_archives adds the default archives to the end of the - current command line. */ +/* add_default_libs adds the -l option which is derived from the + libraries. */ static int -add_default_archives (const char *libpath, const char *libraries) +add_default_libs (const char *libraries) { const char *l = libraries; const char *e; char *libname; unsigned int libcount = 0; - do + while ((l != NULL) && (l[0] != (char)0)) { e = index (l, ','); if (e == NULL) { libname = xstrdup (l); l = NULL; - if (add_default_combination (libpath, libname)) - libcount++; + append_option (OPT_l, safe_strdup (libname), 1); + libcount++; free (libname); } else { libname = xstrndup (l, e - l); l = e + 1; - if (add_default_combination (libpath, libname)) - libcount++; + append_option (OPT_l, safe_strdup (libname), 1); + libcount++; free (libname); } } - while ((l != NULL) && (l[0] != (char)0)); return libcount; } -/* build_include_path builds the component of the include path - referenced by the library. */ - -static const char * -build_include_path (const char *libpath, const char *library) -{ - char dir_sep[2]; - char *gm2libs; - unsigned int machine_length = 0; - - dir_sep[0] = DIR_SEPARATOR; - dir_sep[1] = (char)0; - - if (multilib_dir != NULL) - { - machine_length = strlen (multilib_dir); - machine_length += strlen (dir_sep); - } - - gm2libs = (char *)alloca (strlen (libpath) + strlen (dir_sep) + strlen ("m2") - + strlen (dir_sep) + strlen (library) + 1 - + machine_length + 1); - strcpy (gm2libs, libpath); - strcat (gm2libs, dir_sep); - if (machine_length > 0) - { - strcat (gm2libs, multilib_dir); - strcat (gm2libs, dir_sep); - } - strcat (gm2libs, "m2"); - strcat (gm2libs, dir_sep); - strcat (gm2libs, library); - - return xstrdup (gm2libs); -} - -/* add_include add the correct include path given the libpath and - library. The new path is returned. */ - -static const char * -add_include (const char *libpath, const char *library) -{ - if (library == NULL) - return NULL; - else - return build_include_path (libpath, library); -} - -/* add_default_includes add the appropriate default include paths - depending upon the style of libraries chosen. */ - -static void -add_default_includes (const char *libpath, const char *libraries) -{ - const char *l = libraries; - const char *e; - const char *c; - const char *path; - - do - { - e = index (l, ','); - if (e == NULL) - { - c = xstrdup (l); - l = NULL; - } - else - { - c = xstrndup (l, e - l); - l = e + 1; - } - path = add_include (libpath, c); - append_option (OPT_I, path, 1); - } - while ((l != NULL) && (l[0] != (char)0)); -} - -/* library_installed returns true if directory library is found under - libpath. */ - -static bool -library_installed (const char *libpath, const char *library) -{ -#if defined(HAVE_OPENDIR) && defined(HAVE_DIRENT_H) - const char *complete = build_archive_path (libpath, library); - DIR *directory = opendir (complete); - - if (directory == NULL || (errno == ENOENT)) - return false; - /* Directory exists and therefore the library also exists. */ - closedir (directory); - return true; -#else - return false; -#endif -} - -/* check_valid check to see that the library is valid. - It check the library against the default library set in gm2 and - also against any additional libraries installed in the prefix tree. */ - -static bool -check_valid_library (const char *libpath, const char *library) -{ - /* Firstly check against the default libraries (which might not be - installed yet). */ - for (int i = 0; i < maxlib; i++) - if (strcmp (library, library_name[i]) == 0) - return true; - /* Secondly check whether it is installed (a third party library). */ - return library_installed (libpath, library); -} - -/* check_valid_list check to see that the libraries specified are valid. - It checks against the default library set in gm2 and also against - any additional libraries installed in the libpath tree. */ - -static bool -check_valid_list (const char *libpath, const char *libraries) -{ - const char *start = libraries; - const char *end; - const char *copy; - - do - { - end = index (start, ','); - if (end == NULL) - { - copy = xstrdup (start); - start = NULL; - } - else - { - copy = xstrndup (start, end - start); - start = end + 1; - } - if (! check_valid_library (libpath, copy)) - { - error ("library specified %sq is either not installed or does not exist", - copy); - return false; - } - } - while ((start != NULL) && (start[0] != (char)0)); - return true; -} - /* add_word returns a new string which has the contents of lib appended to list. If list is NULL then lib is duplicated and returned otherwise the list is appended by "," and the contents of @@ -509,8 +327,14 @@ convert_abbreviation (const char *full_libraries, const char *abbreviation) for (int i = 0; i < maxlib; i++) if (strcmp (abbreviation, library_abbrev[i]) == 0) return add_word (full_libraries, library_name[i]); - /* No abbreviation found therefore assume user specified full library name. */ - return add_word (full_libraries, abbreviation); + /* Perhaps the user typed in the whole lib name rather than an abbrev. */ + for (int i = 0; i < maxlib; i++) + if (strcmp (abbreviation, library_name[i]) == 0) + return add_word (full_libraries, abbreviation); + /* Not found, probably a user typo. */ + error ("%qs is not a valid Modula-2 system library name or abbreviation", + abbreviation); + return full_libraries; } /* convert_abbreviations checks each element in the library list to @@ -535,7 +359,8 @@ convert_abbreviations (const char *libraries) } else { - full_libraries = convert_abbreviation (full_libraries, xstrndup (start, end - start)); + full_libraries = convert_abbreviation (full_libraries, + xstrndup (start, end - start)); start = end + 1; } } @@ -572,9 +397,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, /* Which c++ runtime library to link. */ stdcxxlib_kind which_library = USE_LIBSTDCXX; - const char *libraries = NULL; const char *dialect = DEFAULT_DIALECT; - const char *libpath = LIBSUBDIR; /* An array used to flag each argument that needs a bit set for LANGSPEC, MATHLIB, or WITHLIBC. */ @@ -673,12 +496,15 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, case OPT_flibs_: libraries = xstrdup (arg); allow_libraries = decoded_options[i].value; + args[i] |= SKIPOPT; /* We will add the option if it is needed. */ break; case OPT_fmod_: seen_module_extension = true; + args[i] |= SKIPOPT; /* We will add the option if it is needed. */ break; case OPT_fpthread: need_pthread = decoded_options[i].value; + args[i] |= SKIPOPT; /* We will add the option if it is needed. */ break; case OPT_fm2_plugin: need_plugin = decoded_options[i].value; @@ -687,24 +513,29 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, error ("plugin support is disabled; configure with " "%<--enable-plugin%>"); #endif + args[i] |= SKIPOPT; /* We will add the option if it is needed. */ break; case OPT_fscaffold_dynamic: seen_scaffold_dynamic = true; scaffold_dynamic = decoded_options[i].value; + args[i] |= SKIPOPT; /* We will add the option if it is needed. */ break; case OPT_fscaffold_static: seen_scaffold_static = true; scaffold_static = decoded_options[i].value; + args[i] |= SKIPOPT; /* We will add the option if it is needed. */ break; case OPT_fgen_module_list_: seen_gen_module_list = true; gen_module_list = decoded_options[i].value; if (gen_module_list) gen_module_filename = decoded_options[i].arg; + args[i] |= SKIPOPT; /* We will add the option if it is needed. */ break; case OPT_fuse_list_: seen_uselist = true; uselist = decoded_options[i].value; + args[i] |= SKIPOPT; /* We will add the option if it is needed. */ break; case OPT_nostdlib: @@ -794,24 +625,23 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, break; default: - if ((decoded_options[i].orig_option_with_args_text != NULL) - && (strncmp (decoded_options[i].orig_option_with_args_text, - "-m", 2) == 0)) - multilib_dir = xstrdup (decoded_options[i].orig_option_with_args_text - + 2); + break; } } if (language != NULL && (strcmp (language, "modula-2") != 0)) return; - if (scaffold_static && scaffold_dynamic) - { - if (! seen_scaffold_dynamic) - scaffold_dynamic = false; - if (scaffold_dynamic && scaffold_static) - error ("%qs and %qs cannot both be enabled", - "-fscaffold-dynamic", "-fscaffold-static"); - } + /* Override the default when the user specifies it. */ + if (seen_scaffold_static && scaffold_static && !seen_scaffold_dynamic) + scaffold_dynamic = false; + + /* If both options have been seen and both are true, that means the user + tried to set both. */ + if (seen_scaffold_dynamic && scaffold_dynamic + && seen_scaffold_static && scaffold_static) + error ("%qs and %qs cannot both be enabled", + "-fscaffold-dynamic", "-fscaffold-static"); + if (uselist && gen_module_list) { if (! seen_gen_module_list) @@ -855,32 +685,44 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, #endif } - /* We now add in extra arguments to facilitate a successful - compile or link. For example include paths for dialect of Modula-2, - library paths and default scaffold linking options. */ + /* We now add in extra arguments to facilitate a successful link. + Note that the libraries are added to the end of the link here + and also placed earlier into the link by lang-specs.h. Possibly + this is needed because the m2pim,m2iso libraries are cross linked + (--fixme-- combine all the m2 libraries into a single archive). + + We also add default scaffold linking options. */ /* If we have not seen either uselist or gen_module_list and we need to link then we turn on -fgen_module_list=- as the default. */ if ((! (seen_uselist || seen_gen_module_list)) && linking) append_option (OPT_fgen_module_list_, "-", 1); + /* We checked that they were not both enabled above, if there was a set + value (even iff that is 'off'), pass that to the FE. */ + if (seen_scaffold_dynamic || scaffold_dynamic) + append_option (OPT_fscaffold_dynamic, NULL, scaffold_dynamic); + if (seen_scaffold_static) + append_option (OPT_fscaffold_static, NULL, scaffold_static); + if (allow_libraries) { - /* If the libraries have not been specified by the user but the - dialect has been specified then select the appropriate libraries. */ + /* If the libraries have not been specified by the user, select the + appropriate libraries for the active dialect. */ if (libraries == NULL) { if (strcmp (dialect, "iso") == 0) - libraries = xstrdup ("m2iso,m2pim"); + libraries = xstrdup ("m2iso,m2cor,m2pim,m2log"); else - /* Default to pim libraries if none specified. */ - libraries = xstrdup ("m2pim,m2log,m2iso"); + /* Default to pim libraries otherwise. */ + libraries = xstrdup ("m2pim,m2iso,m2cor,m2log"); } libraries = convert_abbreviations (libraries); - if (! check_valid_list (libpath, libraries)) - return; - add_default_includes (libpath, libraries); + append_option (OPT_flibs_, xstrdup (libraries), 1); } + else + append_option (OPT_flibs_, xstrdup ("-"), 0); /* no system libs. */ + if ((! seen_x_flag) && seen_module_extension) append_option (OPT_x, "modula-2", 1); @@ -889,16 +731,19 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, if (linking) { + if (allow_libraries) + { #ifdef HAVE_LD_STATIC_DYNAMIC - if (allow_libraries && !shared_libgm2) - append_option (OPT_Wl_, LD_STATIC_OPTION, 1); + if (!shared_libgm2) + append_option (OPT_Wl_, LD_STATIC_OPTION, 1); #endif - if (allow_libraries) - add_default_archives (libpath, libraries); + added_libraries += add_default_libs (libraries); #ifdef HAVE_LD_STATIC_DYNAMIC - if (allow_libraries && !shared_libgm2) - append_option (OPT_Wl_, LD_DYNAMIC_OPTION, 1); + if (!shared_libgm2) + append_option (OPT_Wl_, LD_DYNAMIC_OPTION, 1); #endif + } + /* Add `-lstdc++' if we haven't already done so. */ #ifdef HAVE_LD_STATIC_DYNAMIC if (library > 1 && !static_link) @@ -962,6 +807,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, *in_added_libraries = added_libraries; } + /* Called before linking. Returns 0 on success and -1 on failure. */ int lang_specific_pre_link (void) /* Not used for M2. */ diff --git a/gcc/m2/lang-specs.h b/gcc/m2/lang-specs.h index 92dc20f..bf88264 100644 --- a/gcc/m2/lang-specs.h +++ b/gcc/m2/lang-specs.h @@ -24,15 +24,16 @@ along with GCC; see the file COPYING3. If not see /* Pass the preprocessor options on the command line together with the exec prefix. */ -#define M2CPP "%{fcpp:-fcpp-begin " \ - " -E -lang-asm -traditional-cpp " \ - " %(cpp_unique_options) -fcpp-end}" +#define M2CPP \ + "%{fcpp:-fcpp-begin " \ + " -E -lang-asm -traditional-cpp " \ + " %(cpp_unique_options) -fcpp-end; \ + : %I } " {".mod", "@modula-2", 0, 0, 0}, {"@modula-2", "cc1gm2 " M2CPP - " %(cc1_options) %{B*} %{c*} %{f*} %{+e*} %{I*} " - " %{MD} %{MMD} %{M} %{MM} %{MA} %{MT*} %{MF*} %V" - " %{save-temps*} %{v} " + " %(cc1_options) %{B*} %{c*} %{+e*} %{I*} " + " %{i*} %{save-temps*} %{v} " " %i %{!fsyntax-only:%(invoke_as)}", 0, 0, 0}, diff --git a/gcc/m2/lang.opt b/gcc/m2/lang.opt index 6586fd6..7a19adc 100644 --- a/gcc/m2/lang.opt +++ b/gcc/m2/lang.opt @@ -50,6 +50,50 @@ M Modula-2 ; Documented in c.opt +MD +Modula-2 +; Documented in c.opt + +MF +Modula-2 +; Documented in c.opt + +MG +Modula-2 +; Documented in c.opt + +MM +Modula-2 +; Documented in c.opt + +MMD +Modula-2 +; Documented in c.opt + +Mmodules +Modula-2 +; Documented in c.opt + +Mno-modules +Modula-2 +; Documented in c.opt + +MP +Modula-2 +; Documented in c.opt + +MQ +Modula-2 +; Documented in c.opt + +MT +Modula-2 +; Documented in c.opt + +P +Modula-2 +; Documented in c.opt + O Modula-2 ; Documented in c.opt @@ -310,6 +354,10 @@ iprefix Modula-2 ; Documented in c.opt +iquote +Modula-2 +; Documented in c.opt + isystem Modula-2 ; Documented in c.opt -- cgit v1.1 From 4b125d01a5d5e601961419396332b74eea2219bb Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 23 Jan 2023 13:33:07 -0500 Subject: c++: result location and explicit inst [PR108496] In r13-4469 we started to build the RESULT_DECL in grokdeclarator, while we still know the location of the return type. But in this testcase, we hit that code again when parsing the explicit instantiation, and clobber the DECL_RESULT that was previously used in parsing the function. So, only set DECL_RESULT if it isn't already set. PR c++/108496 gcc/cp/ChangeLog: * decl.cc (grokdeclarator): Check whether DECL_RESULT is already set. gcc/testsuite/ChangeLog: * g++.dg/template/explicit-instantiation5.C: New test. --- gcc/cp/decl.cc | 6 +++++- gcc/testsuite/g++.dg/template/explicit-instantiation5.C | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/template/explicit-instantiation5.C (limited to 'gcc') diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 75ddf80..d606b31 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -14776,7 +14776,9 @@ grokdeclarator (const cp_declarator *declarator, { /* If we saw a return type, record its location. */ location_t loc = declspecs->locations[ds_type_spec]; - if (loc != UNKNOWN_LOCATION) + if (loc == UNKNOWN_LOCATION) + /* Build DECL_RESULT in start_preparsed_function. */; + else if (!DECL_RESULT (decl)) { tree restype = TREE_TYPE (TREE_TYPE (decl)); tree resdecl = build_decl (loc, RESULT_DECL, 0, restype); @@ -14784,6 +14786,8 @@ grokdeclarator (const cp_declarator *declarator, DECL_IGNORED_P (resdecl) = 1; DECL_RESULT (decl) = resdecl; } + else if (funcdef_flag) + DECL_SOURCE_LOCATION (DECL_RESULT (decl)) = loc; } /* Record constancy and volatility on the DECL itself . There's diff --git a/gcc/testsuite/g++.dg/template/explicit-instantiation5.C b/gcc/testsuite/g++.dg/template/explicit-instantiation5.C new file mode 100644 index 0000000..7bc007c --- /dev/null +++ b/gcc/testsuite/g++.dg/template/explicit-instantiation5.C @@ -0,0 +1,15 @@ +// PR c++/108496 + +struct S { long a, b, c; } s; + +template +S foo (S); + +template <> +S +foo <0, long> (S) +{ + return s; +} + +template S foo <0, long> (S); -- cgit v1.1 From e6669c0a50ed8aee9e5997d61e6271668d149218 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Mon, 16 Jan 2023 21:41:09 +0100 Subject: Fortran: fix ICE in check_charlen_present [PR108420] gcc/fortran/ChangeLog: PR fortran/108420 * iresolve.cc (check_charlen_present): Preserve character length if there is no array constructor. gcc/testsuite/ChangeLog: PR fortran/108420 * gfortran.dg/pr108420.f90: New test. --- gcc/fortran/iresolve.cc | 9 ++++++--- gcc/testsuite/gfortran.dg/pr108420.f90 | 10 ++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr108420.f90 (limited to 'gcc') diff --git a/gcc/fortran/iresolve.cc b/gcc/fortran/iresolve.cc index 711e917..33794f0 100644 --- a/gcc/fortran/iresolve.cc +++ b/gcc/fortran/iresolve.cc @@ -94,9 +94,12 @@ check_charlen_present (gfc_expr *source) else if (source->expr_type == EXPR_ARRAY) { gfc_constructor *c = gfc_constructor_first (source->value.constructor); - source->ts.u.cl->length - = gfc_get_int_expr (gfc_charlen_int_kind, NULL, - c->expr->value.character.length); + if (c) + source->ts.u.cl->length + = gfc_get_int_expr (gfc_charlen_int_kind, NULL, + c->expr->value.character.length); + if (source->ts.u.cl->length == NULL) + gfc_internal_error ("check_charlen_present(): length not set"); } } diff --git a/gcc/testsuite/gfortran.dg/pr108420.f90 b/gcc/testsuite/gfortran.dg/pr108420.f90 new file mode 100644 index 0000000..985c0b3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr108420.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! PR fortran/108420 +! Contributed by G.Steinmetz + +program p + character :: c = 'c' + logical :: m = .true. + print *, merge(transfer('a', 'b', 0), c, .true.) + print *, merge(transfer('a', 'b', 0), c, m) +end -- cgit v1.1 From 771d793df1622a476e1cf8d05f0a6aee350fa56b Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Mon, 23 Jan 2023 21:19:03 +0100 Subject: Fortran: avoid ICE on invalid array subscript triplets [PR108501] gcc/fortran/ChangeLog: PR fortran/108501 * interface.cc (get_expr_storage_size): Check array subscript triplets that we actually have integer values before trying to extract with mpz_get_si. gcc/testsuite/ChangeLog: PR fortran/108501 * gfortran.dg/pr108501.f90: New test. --- gcc/fortran/interface.cc | 23 ++++++++++++++++------- gcc/testsuite/gfortran.dg/pr108501.f90 | 14 ++++++++++++++ 2 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr108501.f90 (limited to 'gcc') diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc index 9593fa8..dafe417 100644 --- a/gcc/fortran/interface.cc +++ b/gcc/fortran/interface.cc @@ -2910,7 +2910,8 @@ get_expr_storage_size (gfc_expr *e) if (ref->u.ar.stride[i]) { - if (ref->u.ar.stride[i]->expr_type == EXPR_CONSTANT) + if (ref->u.ar.stride[i]->expr_type == EXPR_CONSTANT + && ref->u.ar.stride[i]->ts.type == BT_INTEGER) stride = mpz_get_si (ref->u.ar.stride[i]->value.integer); else return 0; @@ -2918,26 +2919,30 @@ get_expr_storage_size (gfc_expr *e) if (ref->u.ar.start[i]) { - if (ref->u.ar.start[i]->expr_type == EXPR_CONSTANT) + if (ref->u.ar.start[i]->expr_type == EXPR_CONSTANT + && ref->u.ar.start[i]->ts.type == BT_INTEGER) start = mpz_get_si (ref->u.ar.start[i]->value.integer); else return 0; } else if (ref->u.ar.as->lower[i] - && ref->u.ar.as->lower[i]->expr_type == EXPR_CONSTANT) + && ref->u.ar.as->lower[i]->expr_type == EXPR_CONSTANT + && ref->u.ar.as->lower[i]->ts.type == BT_INTEGER) start = mpz_get_si (ref->u.ar.as->lower[i]->value.integer); else return 0; if (ref->u.ar.end[i]) { - if (ref->u.ar.end[i]->expr_type == EXPR_CONSTANT) + if (ref->u.ar.end[i]->expr_type == EXPR_CONSTANT + && ref->u.ar.end[i]->ts.type == BT_INTEGER) end = mpz_get_si (ref->u.ar.end[i]->value.integer); else return 0; } else if (ref->u.ar.as->upper[i] - && ref->u.ar.as->upper[i]->expr_type == EXPR_CONSTANT) + && ref->u.ar.as->upper[i]->expr_type == EXPR_CONSTANT + && ref->u.ar.as->upper[i]->ts.type == BT_INTEGER) end = mpz_get_si (ref->u.ar.as->upper[i]->value.integer); else return 0; @@ -2978,7 +2983,9 @@ get_expr_storage_size (gfc_expr *e) || ref->u.ar.as->upper[i] == NULL || ref->u.ar.as->lower[i] == NULL || ref->u.ar.as->upper[i]->expr_type != EXPR_CONSTANT - || ref->u.ar.as->lower[i]->expr_type != EXPR_CONSTANT) + || ref->u.ar.as->lower[i]->expr_type != EXPR_CONSTANT + || ref->u.ar.as->upper[i]->ts.type != BT_INTEGER + || ref->u.ar.as->lower[i]->ts.type != BT_INTEGER) return 0; elements @@ -3000,7 +3007,9 @@ get_expr_storage_size (gfc_expr *e) { if (!as->upper[i] || !as->lower[i] || as->upper[i]->expr_type != EXPR_CONSTANT - || as->lower[i]->expr_type != EXPR_CONSTANT) + || as->lower[i]->expr_type != EXPR_CONSTANT + || as->upper[i]->ts.type != BT_INTEGER + || as->lower[i]->ts.type != BT_INTEGER) return 0; elements = elements diff --git a/gcc/testsuite/gfortran.dg/pr108501.f90 b/gcc/testsuite/gfortran.dg/pr108501.f90 new file mode 100644 index 0000000..09ab8c9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr108501.f90 @@ -0,0 +1,14 @@ +! { dg-do compile } +! PR fortran/108501 - ICE in get_expr_storage_size +! Contributed by G.Steinmetz + +program p + real, parameter :: n = 2 + real :: a(1,(n),2) ! { dg-error "must be of INTEGER type" } + call s(a(:,:,1)) +end +subroutine s(x) + real :: x(2) +end + +! { dg-prune-output "must have constant shape" } -- cgit v1.1 From 72e46b3c7ad5e3d2c69868a510c00707c356106a Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 23 Jan 2023 15:03:47 -0500 Subject: c++: vector of class with bool ctor [PR108195] The transformation done by r13-4564 to use the iterator constructor instead of the initializer-list constructor breaks if the iterator pointers are themselves treated as elements of an initializer-list, so check for that. PR c++/108195 gcc/cp/ChangeLog: * call.cc (build_user_type_conversion_1): Check whether the iterators also find a list ctor. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/initlist-vect2.C: New test. --- gcc/cp/call.cc | 2 +- gcc/testsuite/g++.dg/cpp0x/initlist-vect2.C | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist-vect2.C (limited to 'gcc') diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index a7de0e8..5715a7c 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -4581,7 +4581,7 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags, if (tree iters = maybe_init_list_as_range (cand->fn, expr)) if (z_candidate *cand2 = build_user_type_conversion_1 (totype, iters, flags, tf_none)) - if (cand2->viable == 1) + if (cand2->viable == 1 && !is_list_ctor (cand2->fn)) { cand = cand2; expr = iters; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-vect2.C b/gcc/testsuite/g++.dg/cpp0x/initlist-vect2.C new file mode 100644 index 0000000..eec7d34 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-vect2.C @@ -0,0 +1,16 @@ +// PR c++/108195 +// { dg-do run { target c++11 } } + +#include + +struct S +{ + S(bool) {} +}; + +int main() +{ + std::vector v = { true, false, true }; + if (v.size() != 3) + __builtin_abort (); +} -- cgit v1.1 From e3585e6acdfd5c1793f877476647d2521620c95c Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 19 Jan 2023 17:12:34 -0500 Subject: c++: Quash bogus -Wunused-value with new [PR107797] We shouldn't emit "right operand of comma operator has no effect" when that comma operator was created by the compiler for "new int{}". convert_to_void/COMPOUND_EXPR already checks warning_suppressed_p so we can just suppress -Wunused-value. PR c++/107797 gcc/cp/ChangeLog: * cvt.cc (ocp_convert): copy_warning when creating a new COMPOUND_EXPR. * init.cc (build_new_1): Suppress -Wunused-value on compiler-generated COMPOUND_EXPRs. gcc/testsuite/ChangeLog: * g++.dg/warn/Wunused-value-1.C: New test. --- gcc/cp/cvt.cc | 6 ++++-- gcc/cp/init.cc | 2 ++ gcc/testsuite/g++.dg/warn/Wunused-value-1.C | 12 ++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/warn/Wunused-value-1.C (limited to 'gcc') diff --git a/gcc/cp/cvt.cc b/gcc/cp/cvt.cc index 0cbfd80..17827d0 100644 --- a/gcc/cp/cvt.cc +++ b/gcc/cp/cvt.cc @@ -711,8 +711,10 @@ ocp_convert (tree type, tree expr, int convtype, int flags, return error_mark_node; if (e == TREE_OPERAND (expr, 1)) return expr; - return build2_loc (EXPR_LOCATION (expr), COMPOUND_EXPR, TREE_TYPE (e), - TREE_OPERAND (expr, 0), e); + e = build2_loc (EXPR_LOCATION (expr), COMPOUND_EXPR, TREE_TYPE (e), + TREE_OPERAND (expr, 0), e); + copy_warning (e, expr); + return e; } complete_type (type); diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc index f816c47..52e96fb 100644 --- a/gcc/cp/init.cc +++ b/gcc/cp/init.cc @@ -3800,6 +3800,8 @@ build_new_1 (vec **placement, tree type, tree nelts, if (cookie_expr) rval = build2 (COMPOUND_EXPR, TREE_TYPE (rval), cookie_expr, rval); + suppress_warning (rval, OPT_Wunused_value); + if (rval == data_addr && TREE_CODE (alloc_expr) == TARGET_EXPR) /* If we don't have an initializer or a cookie, strip the TARGET_EXPR and return the call (which doesn't need to be adjusted). */ diff --git a/gcc/testsuite/g++.dg/warn/Wunused-value-1.C b/gcc/testsuite/g++.dg/warn/Wunused-value-1.C new file mode 100644 index 0000000..2ba5587 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wunused-value-1.C @@ -0,0 +1,12 @@ +// PR c++/107797 +// { dg-do compile { target c++11 } } +// { dg-options "-Wunused" } + +void +g () +{ + (long) new int{}; + long(new int{}); + (long) new int(); + long(new int()); +} -- cgit v1.1 From 51767f31878a95161142254dca7119b409699670 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Mon, 23 Jan 2023 22:13:44 +0100 Subject: Fortran: fix NULL pointer dereference in gfc_check_dependency [PR108502] gcc/fortran/ChangeLog: PR fortran/108502 * dependency.cc (gfc_check_dependency): Prevent NULL pointer dereference while recursively checking expressions. gcc/testsuite/ChangeLog: PR fortran/108502 * gfortran.dg/pr108502.f90: New test. --- gcc/fortran/dependency.cc | 5 +++++ gcc/testsuite/gfortran.dg/pr108502.f90 | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr108502.f90 (limited to 'gcc') diff --git a/gcc/fortran/dependency.cc b/gcc/fortran/dependency.cc index 43417a6..9117825 100644 --- a/gcc/fortran/dependency.cc +++ b/gcc/fortran/dependency.cc @@ -1292,6 +1292,11 @@ gfc_check_dependency (gfc_expr *expr1, gfc_expr *expr2, bool identical) if (expr1->expr_type != EXPR_VARIABLE) gfc_internal_error ("gfc_check_dependency: expecting an EXPR_VARIABLE"); + /* Prevent NULL pointer dereference while recursively analyzing invalid + expressions. */ + if (expr2 == NULL) + return 0; + switch (expr2->expr_type) { case EXPR_OP: diff --git a/gcc/testsuite/gfortran.dg/pr108502.f90 b/gcc/testsuite/gfortran.dg/pr108502.f90 new file mode 100644 index 0000000..45f7384 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr108502.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! { dg-options "-O2 -ffrontend-optimize" } +! PR fortran/108502 - ICE in gfc_check_dependency +! Contributed by G.Steinmetz + +integer function n() + integer :: a(1) + a = [1] / 0 +end +program p + integer :: b = n() ! { dg-error "must be an intrinsic function" } +end -- cgit v1.1 From 4cbc71691e47b1ca6b64feb0af678606705d2f92 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 23 Jan 2023 17:14:11 -0500 Subject: c++: TARGET_EXPR_ELIDING_P and std::move [PR107267] With -ffold-simple-inlines, we turn calls to std::move into the static_cast equivalent. In this testcase, this exposes the FindResult temporary to copy elision which is not specified by the standard, through an optimization in gimplify_modify_expr_rhs. Since the type is not TREE_ADDRESSABLE, this is not detectable by the user, so we just need to soften the assert. PR c++/107267 gcc/cp/ChangeLog: * cp-gimplify.cc (cp_gimplify_init_expr): Allow unexpected elision of trivial types. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/move2.C: New test. --- gcc/cp/cp-gimplify.cc | 5 ++++- gcc/testsuite/g++.dg/cpp0x/move2.C | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/move2.C (limited to 'gcc') diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc index 340b464..83ba128 100644 --- a/gcc/cp/cp-gimplify.cc +++ b/gcc/cp/cp-gimplify.cc @@ -250,7 +250,10 @@ cp_gimplify_init_expr (tree *expr_p) if (TREE_CODE (from) == TARGET_EXPR) if (tree init = TARGET_EXPR_INITIAL (from)) { - gcc_checking_assert (TARGET_EXPR_ELIDING_P (from)); + /* Make sure that we expected to elide this temporary. But also allow + gimplify_modify_expr_rhs to elide temporaries of trivial type. */ + gcc_checking_assert (TARGET_EXPR_ELIDING_P (from) + || !TREE_ADDRESSABLE (TREE_TYPE (from))); if (target_expr_needs_replace (from)) { /* If this was changed by cp_genericize_target_expr, we need to diff --git a/gcc/testsuite/g++.dg/cpp0x/move2.C b/gcc/testsuite/g++.dg/cpp0x/move2.C new file mode 100644 index 0000000..b8c8683 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/move2.C @@ -0,0 +1,14 @@ +// PR c++/107267 +// { dg-do compile { target c++11 } } +// { dg-additional-options -ffold-simple-inlines } + +namespace std { + template _Tp &&move(_Tp &&); +} + +struct FindResult { + FindResult(); + int result; +}; + +FindResult pop_ret = std::move(FindResult()); -- cgit v1.1 From 607f278a3546fe6b91a881318db85d7a0dfdacd9 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 24 Jan 2023 00:17:23 +0000 Subject: Daily bump. --- gcc/ChangeLog | 210 ++++++++++++++++++++++++++++++++++++++++++++++++ gcc/DATESTAMP | 2 +- gcc/cp/ChangeLog | 32 ++++++++ gcc/fortran/ChangeLog | 19 +++++ gcc/m2/ChangeLog | 39 +++++++++ gcc/testsuite/ChangeLog | 120 +++++++++++++++++++++++++++ 6 files changed, 421 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5ac20c5..c5d6570 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,213 @@ +2023-01-23 Srinath Parvathaneni + + * doc/invoke.texi (-mbranch-protection): Update documentation. + +2023-01-23 Richard Biener + + PR target/55522 + * config/sparc/freebsd.h (ENDFILE_SPEC): Don't add crtfastmath.o + for -shared. + * config/sparc/linux.h (ENDFILE_SPEC): Likewise. + * config/sparc/linux64.h (ENDFILE_SPEC): Likewise. + * config/sparc/sp-elf.h (ENDFILE_SPEC): Likewise. + * config/sparc/sp64-elf.h (ENDFILE_SPEC): Likewise. + +2023-01-23 Srinath Parvathaneni + + * config/arm/aout.h (ra_auth_code): Add entry in enum. + * config/arm/arm.cc (emit_multi_reg_push): Add RA_AUTH_CODE register + to dwarf frame expression. + (arm_emit_multi_reg_pop): Restore RA_AUTH_CODE register. + (arm_expand_prologue): Update frame related information and reg notes + for pac/pacbit insn. + (arm_regno_class): Check for pac pseudo reigster. + (arm_dbx_register_number): Assign ra_auth_code register number in dwarf. + (arm_init_machine_status): Set pacspval_needed to zero. + (arm_debugger_regno): Check for PAC register. + (arm_unwind_emit_sequence): Print .save directive with ra_auth_code + register. + (arm_unwind_emit_set): Add entry for IP_REGNUM in switch case. + (arm_unwind_emit): Update REG_CFA_REGISTER case._ + * config/arm/arm.h (FIRST_PSEUDO_REGISTER): Modify. + (DWARF_PAC_REGNUM): Define. + (IS_PAC_REGNUM): Likewise. + (enum reg_class): Add PAC_REG entry. + (machine_function): Add pacbti_needed state to structure. + * config/arm/arm.md (RA_AUTH_CODE): Define. + +2023-01-23 Srinath Parvathaneni + + * config.gcc ($tm_file): Update variable. + * config/arm/arm-mlib.h: Create new header file. + * config/arm/t-rmprofile (MULTI_ARCH_DIRS_RM): Rename mbranch-protection + multilib arch directory. + (MULTILIB_REUSE): Add multilib reuse rules. + (MULTILIB_MATCHES): Add multilib match rules. + +2023-01-23 Srinath Parvathaneni + + * config/arm/arm-cpus.in (cortex-m85): Define new CPU. + * config/arm/arm-tables.opt: Regenerate. + * config/arm/arm-tune.md: Likewise. + * doc/invoke.texi (Arm Options): Document -mcpu=cortex-m85. + * (-mfix-cmse-cve-2021-35465): Likewise. + +2023-01-23 Richard Biener + + PR tree-optimization/108482 + * tree-vect-generic.cc (expand_vector_operations): Fold remaining + .LOOP_DIST_ALIAS calls. + +2023-01-23 Andrea Corallo + + * config.gcc (arm*-*-*): Add 'aarch-bti-insert.o' object. + * config/arm/arm-protos.h: Update. + * config/arm/aarch-common-protos.h: Declare + 'aarch_bti_arch_check'. + * config/arm/arm.cc (aarch_bti_enabled) Update. + (aarch_bti_j_insn_p, aarch_pac_insn_p, aarch_gen_bti_c) + (aarch_gen_bti_j, aarch_bti_arch_check): New functions. + * config/arm/arm.md (bti_nop): New insn. + * config/arm/t-arm (PASSES_EXTRA): Add 'arm-passes.def'. + (aarch-bti-insert.o): New target. + * config/arm/unspecs.md (VUNSPEC_BTI_NOP): New unspec. + * config/arm/aarch-bti-insert.cc (rest_of_insert_bti): Verify arch + compatibility. + (gate): Make use of 'aarch_bti_arch_check'. + * config/arm/arm-passes.def: New file. + * config/aarch64/aarch64.cc (aarch_bti_arch_check): New function. + +2023-01-23 Andrea Corallo + + * config.gcc (aarch64*-*-*): Rename 'aarch64-bti-insert.o' into + 'aarch-bti-insert.o'. + * config/aarch64/aarch64-protos.h: Remove 'aarch64_bti_enabled' + proto. + * config/aarch64/aarch64.cc (aarch_bti_enabled): Rename. + (aarch_bti_j_insn_p, aarch_pac_insn_p): New functions. + (aarch64_output_mi_thunk) + (aarch64_print_patchable_function_entry) + (aarch64_file_end_indicate_exec_stack): Update renamed function + calls to renamed functions. + * config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Likewise. + * config/aarch64/t-aarch64 (aarch-bti-insert.o): Update + target. + * config/aarch64/aarch64-bti-insert.cc: Delete. + * config/arm/aarch-bti-insert.cc: New file including and + generalizing code from aarch64-bti-insert.cc. + * config/arm/aarch-common-protos.h: Update. + +2023-01-23 Andrea Corallo + + * config/arm/arm.h (arm_arch8m_main): Declare it. + * config/arm/arm-protos.h (arm_current_function_pac_enabled_p): + Declare it. + * config/arm/arm.cc (arm_arch8m_main): Define it. + (arm_option_reconfigure_globals): Set arm_arch8m_main. + (arm_compute_frame_layout, arm_expand_prologue) + (thumb2_expand_return, arm_expand_epilogue) + (arm_conditional_register_usage): Update for pac codegen. + (arm_current_function_pac_enabled_p): New function. + (aarch_bti_enabled) New function. + (use_return_insn): Return zero when pac is enabled. + * config/arm/arm.md (pac_ip_lr_sp, pacbti_ip_lr_sp, aut_ip_lr_sp): + Add new patterns. + * config/arm/unspecs.md (UNSPEC_PAC_NOP) + (VUNSPEC_PACBTI_NOP, VUNSPEC_AUT_NOP): Add unspecs. + +2023-01-23 Andrea Corallo + + * config/arm/t-rmprofile: Add multilib rules for march +pacbti and + mbranch-protection. + +2023-01-23 Andrea Corallo + Tejas Belagod + + * config/arm/arm.cc (arm_file_start): Emit EABI attributes for + Tag_PAC_extension, Tag_BTI_extension, TAG_BTI_use, TAG_PACRET_use. + +2023-01-23 Andrea Corallo + Tejas Belagod + Srinath Parvathaneni + + * ginclude/unwind-arm-common.h (_Unwind_VRS_RegClass): Introduce + new pseudo register class _UVRSC_PAC. + +2023-01-23 Andrea Corallo + Tejas Belagod + + * config/arm/arm-c.cc (arm_cpu_builtins): Define + __ARM_FEATURE_BTI_DEFAULT, __ARM_FEATURE_PAC_DEFAULT, + __ARM_FEATURE_PAUTH and __ARM_FEATURE_BTI. + +2023-01-23 Andrea Corallo + Tejas Belagod + + * doc/sourcebuild.texi: Document arm_pacbti_hw. + +2023-01-23 Andrea Corallo + Tejas Belagod + Richard Earnshaw + + * config/arm/arm.cc (arm_configure_build_target): Parse and validate + -mbranch-protection option and initialize appropriate data structures. + * config/arm/arm.opt (-mbranch-protection): New option. + * doc/invoke.texi (Arm Options): Document it. + +2023-01-23 Andrea Corallo + Tejas Belagod + + * config/arm/arm.h (TARGET_HAVE_PACBTI): New macro. + * config/arm/arm-cpus.in (pacbti): New feature. + * doc/invoke.texi (Arm Options): Document it. + +2023-01-23 Andrea Corallo + Tejas Belagod + + * common/config/aarch64/aarch64-common.cc: Include aarch-common.h. + (all_architectures): Fix comment. + (aarch64_parse_extension): Rename return type, enum value names. + * config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Rename + factored out aarch_ra_sign_scope and aarch_ra_sign_key variables. + Also rename corresponding enum values. + * config/aarch64/aarch64-opts.h (aarch64_function_type): Factor + out aarch64_function_type and move it to common code as + aarch_function_type in aarch-common.h. + * config/aarch64/aarch64-protos.h: Include common types header, + move out types aarch64_parse_opt_result and aarch64_key_type to + aarch-common.h + * config/aarch64/aarch64.cc: Move mbranch-protection parsing types + and functions out into aarch-common.h and aarch-common.cc. Fix up + all the name changes resulting from the move. + * config/aarch64/aarch64.md: Fix up aarch64_ra_sign_key type name change + and enum value. + * config/aarch64/aarch64.opt: Include aarch-common.h to import + type move. Fix up name changes from factoring out common code and + data. + * config/arm/aarch-common-protos.h: Export factored out routines to both + backends. + * config/arm/aarch-common.cc: Include newly factored out types. + Move all mbranch-protection code and data structures from + aarch64.cc. + * config/arm/aarch-common.h: New header that declares types shared + between aarch32 and aarch64 backends. + * config/arm/arm-protos.h: Declare types and variables that are + made common to aarch64 and aarch32 backends - aarch_ra_sign_key, + aarch_ra_sign_scope and aarch_enable_bti. + * config/arm/arm.opt (config/arm/aarch-common.h): Include header. + (aarch_ra_sign_scope, aarch_enable_bti): Declare variable. + * config/arm/arm.cc: Add missing includes. + +2023-01-23 Tobias Burnus + + * doc/install.texi (amdgcn, nvptx): Require newlib 4.3.0. + +2023-01-23 Richard Biener + + PR tree-optimization/108449 + * cgraphunit.cc (check_global_declaration): Do not turn + undefined statics into externs. + 2023-01-22 Dimitar Dimitrov * config/pru/pru.h (CLZ_DEFINED_VALUE_AT_ZERO): Fix value for QI diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3426cc8..9ed1bcf 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20230123 +20230124 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e377041..05d4252 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,35 @@ +2023-01-23 Jason Merrill + + PR c++/107267 + * cp-gimplify.cc (cp_gimplify_init_expr): Allow unexpected elision + of trivial types. + +2023-01-23 Marek Polacek + + PR c++/107797 + * cvt.cc (ocp_convert): copy_warning when creating a new + COMPOUND_EXPR. + * init.cc (build_new_1): Suppress -Wunused-value on + compiler-generated COMPOUND_EXPRs. + +2023-01-23 Jason Merrill + + PR c++/108195 + * call.cc (build_user_type_conversion_1): Check whether the + iterators also find a list ctor. + +2023-01-23 Jason Merrill + + PR c++/108496 + * decl.cc (grokdeclarator): Check whether DECL_RESULT is already + set. + +2023-01-23 Jason Merrill + + PR c++/53288 + DR 1299 + * call.cc (extend_ref_init_temps_1): Handle ptrmem expression. + 2023-01-19 Jakub Jelinek PR c++/108437 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index e5b75ed..a2f8ec7 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,22 @@ +2023-01-23 Harald Anlauf + + PR fortran/108502 + * dependency.cc (gfc_check_dependency): Prevent NULL pointer + dereference while recursively checking expressions. + +2023-01-23 Harald Anlauf + + PR fortran/108501 + * interface.cc (get_expr_storage_size): Check array subscript triplets + that we actually have integer values before trying to extract with + mpz_get_si. + +2023-01-23 Harald Anlauf + + PR fortran/108420 + * iresolve.cc (check_charlen_present): Preserve character length if + there is no array constructor. + 2023-01-21 Jerry DeLisle PR fortran/102595 diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog index 4880f9e..1fad9e1 100644 --- a/gcc/m2/ChangeLog +++ b/gcc/m2/ChangeLog @@ -1,3 +1,42 @@ +2023-01-23 Iain Sandoe + + PR modula2/108182 + PR modula2/108480 + * Make-lang.in: Pass libsubdir to the language init + build. + * gm2-lang.cc (INCLUDE_VECTOR): Define. + (add_one_import_path): New. + (add_m2_import_paths): New. + (gm2_langhook_post_options): Arrange to add the include + paths (and add the system ones) in the same order as C + uses. + * gm2spec.cc (build_archive_path): Remove. + (add_default_combination): Remove. + (add_default_archives): Remove. + (add_default_libs): We no longer need a '-L' option, just + emit the -l and each library in use. + (build_include_path): Remove. + (add_include): Remove. + (add_default_includes): Remove. + (library_installed): Remove. + (check_valid_library): Remove. + (check_valid_list): Remove. + (convert_abbreviation): Diagnose unhandled cases. + (lang_specific_driver): Skip options where we will add back + a validated version. + * lang-specs.h (M2CPP): Reformat, append %I when -fcpp is not + in use. Revise the cc1gm2 spec to omit mentioning options that + are handled in the c pre-processor line. + * lang.opt: Allow preprocessing and path options as input to the + cc1gm2 invocation, so that they can be passed to the preprocessor + invocation. + +2023-01-23 Iain Sandoe + + PR modula2/108405 + * gm2-libs-iso/Preemptive.mod (initPreemptive): Use a value for + extra space that is divisible by common OS pagesizes. + 2023-01-20 Gaius Mulley * gm2-libs/Args.mod (GetArg): Check index before diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5bf9136..c9d2bc3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,123 @@ +2023-01-23 Jason Merrill + + PR c++/107267 + * g++.dg/cpp0x/move2.C: New test. + +2023-01-23 Harald Anlauf + + PR fortran/108502 + * gfortran.dg/pr108502.f90: New test. + +2023-01-23 Marek Polacek + + PR c++/107797 + * g++.dg/warn/Wunused-value-1.C: New test. + +2023-01-23 Jason Merrill + + PR c++/108195 + * g++.dg/cpp0x/initlist-vect2.C: New test. + +2023-01-23 Harald Anlauf + + PR fortran/108501 + * gfortran.dg/pr108501.f90: New test. + +2023-01-23 Harald Anlauf + + PR fortran/108420 + * gfortran.dg/pr108420.f90: New test. + +2023-01-23 Jason Merrill + + PR c++/108496 + * g++.dg/template/explicit-instantiation5.C: New test. + +2023-01-23 Srinath Parvathaneni + + * g++.target/arm/pac-1.C: New test. + * gcc.target/arm/pac-15.c: Likewise. + +2023-01-23 Srinath Parvathaneni + + * gcc.target/arm/multilib.exp (multilib_config "rmprofile"): Update + tests. + * gcc.target/arm/pac-12.c: New test. + * gcc.target/arm/pac-13.c: Likewise. + * gcc.target/arm/pac-14.c: Likewise. + +2023-01-23 Srinath Parvathaneni + + * gcc.target/arm/multilib.exp: Add tests for cortex-m85. + +2023-01-23 Richard Biener + + PR tree-optimization/108482 + * gcc.dg/torture/pr108482.c: New testcase. + +2023-01-23 Andrea Corallo + + * gcc.target/arm/bti-1.c: New testcase. + * gcc.target/arm/bti-2.c: Likewise. + +2023-01-23 Andrea Corallo + + * gcc.target/arm/pac.h : New file. + * gcc.target/arm/pac-1.c : New test case. + * gcc.target/arm/pac-2.c : Likewise. + * gcc.target/arm/pac-3.c : Likewise. + * gcc.target/arm/pac-4.c : Likewise. + * gcc.target/arm/pac-5.c : Likewise. + * gcc.target/arm/pac-6.c : Likewise. + * gcc.target/arm/pac-7.c : Likewise. + * gcc.target/arm/pac-8.c : Likewise. + * gcc.target/arm/pac-9.c : Likewise. + * gcc.target/arm/pac-10.c : Likewise. + * gcc.target/arm/pac-11.c : Likewise. + +2023-01-23 Andrea Corallo + + * gcc.target/arm/multilib.exp: Add pacbti related entries. + +2023-01-23 Andrea Corallo + Tejas Belagod + + * gcc.target/arm/acle/pacbti-m-predef-1.c: New test. + * gcc.target/arm/acle/pacbti-m-predef-3.c: Likewise. + * gcc.target/arm/acle/pacbti-m-predef-6.c: Likewise. + * gcc.target/arm/acle/pacbti-m-predef-7.c: Likewise. + +2023-01-23 Andrea Corallo + Tejas Belagod + + * lib/target-supports.exp + (check_effective_target_mbranch_protection_ok): New function. + * gcc.target/arm/acle/pacbti-m-predef-2.c: New test. + * gcc.target/arm/acle/pacbti-m-predef-4.c: Likewise. + * gcc.target/arm/acle/pacbti-m-predef-5.c: Likewise. + * gcc.target/arm/acle/pacbti-m-predef-8.c: Likewise. + * gcc.target/arm/acle/pacbti-m-predef-9.c: Likewise. + * gcc.target/arm/acle/pacbti-m-predef-10.c: Likewise. + * gcc.target/arm/acle/pacbti-m-predef-11.c: Likewise. + * gcc.target/arm/acle/pacbti-m-predef-12.c: Likewise. + +2023-01-23 Andrea Corallo + Tejas Belagod + + * lib/target-supports.exp: + (check_effective_target_arm_pacbti_hw): New. + +2023-01-23 Richard Biener + + PR tree-optimization/108449 + * gcc.dg/pr108449.c: New testcase. + +2023-01-23 Jason Merrill + + PR c++/53288 + DR 1299 + * g++.dg/init/lifetime4.C: New test. + 2023-01-22 Iain Sandoe * gm2/case/pass/case-pass.exp: Update for removal of concatenated -- cgit v1.1 From 049a52909075117f5112971cc83952af2a818bc1 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 23 Jan 2023 16:25:07 -0500 Subject: c++: TARGET_EXPR collapsing [PR107303] In r13-2978 I tried to eliminate TARGET_EXPR around TARGET_EXPR by discarding the outer one, but as in this testcase that breaks if the TARGET_EXPR_SLOT of the outer one is used elsewhere. But it should always be safe to strip the inner one; if its slot were reused, there would be a COMPOUND_EXPR around the TARGET_EXPR. For 107329, if we're setting *walk_subtrees, we also need to fold TARGET_EXPR_CLEANUP. PR c++/107303 PR c++/107329 gcc/cp/ChangeLog: * cp-gimplify.cc (cp_fold_r) [TARGET_EXPR]: In case of double TARGET_EXPR, keep the outer one instead of the inner one. (maybe_replace_decl): New. gcc/testsuite/ChangeLog: * g++.dg/ext/builtin-shufflevector-5.C: New test. * g++.dg/init/new51.C: New test. --- gcc/cp/cp-gimplify.cc | 31 +++++++++++++++++++--- gcc/testsuite/g++.dg/ext/builtin-shufflevector-5.C | 14 ++++++++++ gcc/testsuite/g++.dg/init/new51.C | 10 +++++++ 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ext/builtin-shufflevector-5.C create mode 100644 gcc/testsuite/g++.dg/init/new51.C (limited to 'gcc') diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc index 83ba128..92cd309 100644 --- a/gcc/cp/cp-gimplify.cc +++ b/gcc/cp/cp-gimplify.cc @@ -952,6 +952,28 @@ cp_genericize_target_expr (tree *stmt_p) gcc_assert (!DECL_INITIAL (slot)); } +/* Similar to if (target_expr_needs_replace) replace_decl, but TP is the + TARGET_EXPR_INITIAL, and this also updates *_SLOT. We need this extra + replacement when cp_folding TARGET_EXPR to preserve the invariant that + AGGR_INIT_EXPR_SLOT agrees with the enclosing TARGET_EXPR_SLOT. */ + +bool +maybe_replace_decl (tree *tp, tree decl, tree replacement) +{ + if (!*tp || !VOID_TYPE_P (TREE_TYPE (*tp))) + return false; + tree t = *tp; + while (TREE_CODE (t) == COMPOUND_EXPR) + t = TREE_OPERAND (t, 1); + if (TREE_CODE (t) == AGGR_INIT_EXPR) + replace_decl (&AGGR_INIT_EXPR_SLOT (t), decl, replacement); + else if (TREE_CODE (t) == VEC_INIT_EXPR) + replace_decl (&VEC_INIT_EXPR_SLOT (t), decl, replacement); + else + replace_decl (tp, decl, replacement); + return true; +} + /* Genericization context. */ struct cp_genericize_data @@ -1116,15 +1138,18 @@ cp_fold_r (tree *stmt_p, int *walk_subtrees, void *data_) cp_genericize_target_expr (stmt_p); /* Folding might replace e.g. a COND_EXPR with a TARGET_EXPR; in - that case, use it in place of this one. */ + that case, strip it in favor of this one. */ if (tree &init = TARGET_EXPR_INITIAL (stmt)) { cp_walk_tree (&init, cp_fold_r, data, NULL); + cp_walk_tree (&TARGET_EXPR_CLEANUP (stmt), cp_fold_r, data, NULL); *walk_subtrees = 0; if (TREE_CODE (init) == TARGET_EXPR) { - TARGET_EXPR_ELIDING_P (init) = TARGET_EXPR_ELIDING_P (stmt); - *stmt_p = init; + tree sub = TARGET_EXPR_INITIAL (init); + maybe_replace_decl (&sub, TARGET_EXPR_SLOT (init), + TARGET_EXPR_SLOT (stmt)); + init = sub; } } break; diff --git a/gcc/testsuite/g++.dg/ext/builtin-shufflevector-5.C b/gcc/testsuite/g++.dg/ext/builtin-shufflevector-5.C new file mode 100644 index 0000000..06472b8 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/builtin-shufflevector-5.C @@ -0,0 +1,14 @@ +// PR c++/107303 +// { dg-options "-Wno-psabi" } + +typedef __attribute__((__vector_size__ (2))) unsigned short U; +typedef __attribute__((__vector_size__ (8))) unsigned short V; + +U u0, u1, u2; +V v; + +void +foo (void) +{ + u0 *= +__builtin_shufflevector (__builtin_shufflevector (u1, v, 3, 1), u2, 0); +} diff --git a/gcc/testsuite/g++.dg/init/new51.C b/gcc/testsuite/g++.dg/init/new51.C new file mode 100644 index 0000000..d8b3364 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/new51.C @@ -0,0 +1,10 @@ +// PR c++/107329 + +struct RexxClass { + void *operator new(unsigned long, unsigned long, const char *, RexxClass *, + RexxClass *); + void operator delete(void *, unsigned long, const char *, RexxClass *, + RexxClass *); + RexxClass(); +}; +void createInstance() { new (sizeof(RexxClass), "", 0, 0) RexxClass; } -- cgit v1.1 From b5ea0f071aca505c82cc8c062e57bf9892900277 Mon Sep 17 00:00:00 2001 From: Lulu Cheng Date: Wed, 18 Jan 2023 11:06:56 +0800 Subject: LoongArch: Fixed a compilation failure with '%c' in inline assembly [PR107731]. Co-authored-by: Yang Yujie PR target/107731 gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_classify_address): Add precessint for CONST_INT. (loongarch_print_operand_reloc): Operand modifier 'c' is supported. (loongarch_print_operand): Increase the processing of '%c'. * doc/extend.texi: Adds documents for LoongArch operand modifiers. And port the public operand modifiers information to this document. gcc/testsuite/ChangeLog: * gcc.target/loongarch/tst-asm-const.c: Moved to... * gcc.target/loongarch/pr107731.c: ...here. --- gcc/config/loongarch/loongarch.cc | 14 ++++++ gcc/doc/extend.texi | 51 ++++++++++++++++++++-- gcc/testsuite/gcc.target/loongarch/pr107731.c | 16 +++++++ gcc/testsuite/gcc.target/loongarch/tst-asm-const.c | 16 ------- 4 files changed, 77 insertions(+), 20 deletions(-) create mode 100644 gcc/testsuite/gcc.target/loongarch/pr107731.c delete mode 100644 gcc/testsuite/gcc.target/loongarch/tst-asm-const.c (limited to 'gcc') diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index 2443966..6927bdc 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -2075,6 +2075,11 @@ loongarch_classify_address (struct loongarch_address_info *info, rtx x, return (loongarch_valid_base_register_p (info->reg, mode, strict_p) && loongarch_valid_lo_sum_p (info->symbol_type, mode, info->offset)); + case CONST_INT: + /* Small-integer addresses don't occur very often, but they + are legitimate if $r0 is a valid base register. */ + info->type = ADDRESS_CONST_INT; + return IMM12_OPERAND (INTVAL (x)); default: return false; @@ -4933,6 +4938,7 @@ loongarch_print_operand_reloc (FILE *file, rtx op, bool hi64_part, 'A' Print a _DB suffix if the memory model requires a release. 'b' Print the address of a memory operand, without offset. + 'c' Print an integer. 'C' Print the integer branch condition for comparison OP. 'd' Print CONST_INT OP in decimal. 'F' Print the FPU branch condition for comparison OP. @@ -4979,6 +4985,14 @@ loongarch_print_operand (FILE *file, rtx op, int letter) fputs ("_db", file); break; + case 'c': + if (CONST_INT_P (op)) + fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (op)); + else + output_operand_lossage ("unsupported operand for code '%c'", letter); + + break; + case 'C': loongarch_print_int_branch_condition (file, code, letter); break; diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 0e2abe5..4a89a3e 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -10402,8 +10402,10 @@ ensures that modifying @var{a} does not affect the address referenced by is undefined if @var{a} is modified before using @var{b}. @code{asm} supports operand modifiers on operands (for example @samp{%k2} -instead of simply @samp{%2}). Typically these qualifiers are hardware -dependent. The list of supported modifiers for x86 is found at +instead of simply @samp{%2}). @ref{GenericOperandmodifiers, +Generic Operand modifiers} lists the modifiers that are available +on all targets. Other modifiers are hardware dependent. +For example, the list of supported modifiers for x86 is found at @ref{x86Operandmodifiers,x86 Operand modifiers}. If the C code that follows the @code{asm} makes no use of any of the output @@ -10671,8 +10673,10 @@ optimizers may discard the @code{asm} statement as unneeded (see @ref{Volatile}). @code{asm} supports operand modifiers on operands (for example @samp{%k2} -instead of simply @samp{%2}). Typically these qualifiers are hardware -dependent. The list of supported modifiers for x86 is found at +instead of simply @samp{%2}). @ref{GenericOperandmodifiers, +Generic Operand modifiers} lists the modifiers that are available +on all targets. Other modifiers are hardware dependent. +For example, the list of supported modifiers for x86 is found at @ref{x86Operandmodifiers,x86 Operand modifiers}. In this example using the fictitious @code{combine} instruction, the @@ -11024,6 +11028,30 @@ lab: @} @end example +@anchor{GenericOperandmodifiers} +@subsubsection Generic Operand Modifiers +@noindent +The following table shows the modifiers supported by all targets and their effects: + +@multitable {Modifier} {Description} {Example} +@headitem Modifier @tab Description @tab Example +@item @code{c} +@tab Require a constant operand and print the constant expression with no punctuation. +@tab @code{%c0} +@item @code{n} +@tab Like @samp{%c} except that the value of the constant is negated before printing. +@tab @code{%n0} +@item @code{a} +@tab Substitute a memory reference, with the actual operand treated as the address. +This may be useful when outputting a ``load address'' instruction, because +often the assembler syntax for such an instruction requires you to write the +operand as if it were a memory reference. +@tab @code{%a0} +@item @code{l} +@tab Print the label name with no punctuation. +@tab @code{%l0} +@end multitable + @anchor{x86Operandmodifiers} @subsubsection x86 Operand Modifiers @@ -11374,6 +11402,21 @@ constant. Used to select the specified bit position. @item @code{x} @tab Equivialent to @code{X}, but only for pointers. @end multitable +@anchor{loongarchOperandmodifiers} +@subsubsection LoongArch Operand Modifiers + +The list below describes the supported modifiers and their effects for LoongArch. + +@multitable @columnfractions .10 .90 +@headitem Modifier @tab Description +@item @code{d} @tab Same as @code{c}. +@item @code{i} @tab Print the character ''@code{i}'' if the operand is not a register. +@item @code{m} @tab Same as @code{c}, but the printed value is @code{operand - 1}. +@item @code{X} @tab Print a constant integer operand in hexadecimal. +@item @code{z} @tab Print the operand in its unmodified form, followed by a comma. +@end multitable + + @lowersections @include md.texi @raisesections diff --git a/gcc/testsuite/gcc.target/loongarch/pr107731.c b/gcc/testsuite/gcc.target/loongarch/pr107731.c new file mode 100644 index 0000000..80d84c4 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/pr107731.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-final { scan-assembler-times "foo:.*\\.long 1061109567.*\\.long 52" 1 } } */ + +int foo () +{ + __asm__ volatile ( + "foo:" + "\n\t" + ".long %c0\n\t" + ".long %c1\n\t" + : + :"i"(0x3f3f3f3f), "i"(52) + : + ); +} + diff --git a/gcc/testsuite/gcc.target/loongarch/tst-asm-const.c b/gcc/testsuite/gcc.target/loongarch/tst-asm-const.c deleted file mode 100644 index 2e04b99..0000000 --- a/gcc/testsuite/gcc.target/loongarch/tst-asm-const.c +++ /dev/null @@ -1,16 +0,0 @@ -/* Test asm const. */ -/* { dg-do compile } */ -/* { dg-final { scan-assembler-times "foo:.*\\.long 1061109567.*\\.long 52" 1 } } */ -int foo () -{ - __asm__ volatile ( - "foo:" - "\n\t" - ".long %a0\n\t" - ".long %a1\n\t" - : - :"i"(0x3f3f3f3f), "i"(52) - : - ); -} - -- cgit v1.1 From 7b8f4c85051501e9c804df2de1a08f11aa187e9d Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Tue, 24 Jan 2023 08:48:11 +0100 Subject: testsuite: Fix gcc.dg/vect/vect-fmax-1.c etc. on SPARC [PR104756] The gcc.dg/vect/vect-fmax-?.c etc. tests FAIL on 32 and 64-bit SPARC: FAIL: gcc.dg/vect/vect-fmax-1.c -flto -ffat-lto-objects scan-tree-dump vect "Detected reduction" FAIL: gcc.dg/vect/vect-fmax-1.c scan-tree-dump vect "Detected reduction" FAIL: gcc.dg/vect/vect-fmax-2.c -flto -ffat-lto-objects scan-tree-dump vect "Detected reduction" FAIL: gcc.dg/vect/vect-fmax-2.c scan-tree-dump vect "Detected reduction" FAIL: gcc.dg/vect/vect-fmax-3.c -flto -ffat-lto-objects scan-tree-dump vect "Detected reduction" FAIL: gcc.dg/vect/vect-fmax-3.c scan-tree-dump vect "Detected reduction" FAIL: gcc.dg/vect/vect-fmin-1.c -flto -ffat-lto-objects scan-tree-dump vect "Detected reduction" FAIL: gcc.dg/vect/vect-fmin-1.c -flto -ffat-lto-objects scan-tree-dump vect "Detected reduction" FAIL: gcc.dg/vect/vect-fmin-1.c scan-tree-dump vect "Detected reduction" FAIL: gcc.dg/vect/vect-fmin-1.c scan-tree-dump vect "Detected reduction" FAIL: gcc.dg/vect/vect-fmin-2.c -flto -ffat-lto-objects scan-tree-dump vect "Detected reduction" FAIL: gcc.dg/vect/vect-fmin-2.c scan-tree-dump vect "Detected reduction" FAIL: gcc.dg/vect/vect-fmin-3.c -flto -ffat-lto-objects scan-tree-dump vect "Detected reduction" FAIL: gcc.dg/vect/vect-fmin-3.c scan-tree-dump vect "Detected reduction" As discussed in the PR, they require vect_float support, but the tests don't declare it. This patch fixes this. Tested on sparc-sun-solaris2.11 and i386-pc-solaris2.11. 2023-01-20 Rainer Orth gcc/testsuite: PR testsuite/104756 * gcc.dg/vect/vect-fmax-1.c: Require vect_float. * gcc.dg/vect/vect-fmax-2.c: Likewise. * gcc.dg/vect/vect-fmax-3.c: Likewise. * gcc.dg/vect/vect-fmin-1.c: Likewise. * gcc.dg/vect/vect-fmin-2.c: Likewise. * gcc.dg/vect/vect-fmin-3.c: Likewise. --- gcc/testsuite/gcc.dg/vect/vect-fmax-1.c | 2 ++ gcc/testsuite/gcc.dg/vect/vect-fmax-2.c | 2 ++ gcc/testsuite/gcc.dg/vect/vect-fmax-3.c | 2 ++ gcc/testsuite/gcc.dg/vect/vect-fmin-1.c | 2 ++ gcc/testsuite/gcc.dg/vect/vect-fmin-2.c | 2 ++ gcc/testsuite/gcc.dg/vect/vect-fmin-3.c | 2 ++ 6 files changed, 12 insertions(+) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/vect/vect-fmax-1.c b/gcc/testsuite/gcc.dg/vect/vect-fmax-1.c index 841ffab..d3aa5b0 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-fmax-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-fmax-1.c @@ -1,3 +1,5 @@ +/* { dg-require-effective-target vect_float } */ + #include "tree-vect.h" #ifndef TYPE diff --git a/gcc/testsuite/gcc.dg/vect/vect-fmax-2.c b/gcc/testsuite/gcc.dg/vect/vect-fmax-2.c index 3d1f644..d455dd4 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-fmax-2.c +++ b/gcc/testsuite/gcc.dg/vect/vect-fmax-2.c @@ -1,3 +1,5 @@ +/* { dg-require-effective-target vect_float } */ + #define TYPE double #define FN __builtin_fmax diff --git a/gcc/testsuite/gcc.dg/vect/vect-fmax-3.c b/gcc/testsuite/gcc.dg/vect/vect-fmax-3.c index f711ed0..58e74e2 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-fmax-3.c +++ b/gcc/testsuite/gcc.dg/vect/vect-fmax-3.c @@ -1,3 +1,5 @@ +/* { dg-require-effective-target vect_float } */ + #include "tree-vect.h" void __attribute__((noipa)) diff --git a/gcc/testsuite/gcc.dg/vect/vect-fmin-1.c b/gcc/testsuite/gcc.dg/vect/vect-fmin-1.c index 3d5f843..281fdf2 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-fmin-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-fmin-1.c @@ -1,3 +1,5 @@ +/* { dg-require-effective-target vect_float } */ + #include "tree-vect.h" #ifndef TYPE diff --git a/gcc/testsuite/gcc.dg/vect/vect-fmin-2.c b/gcc/testsuite/gcc.dg/vect/vect-fmin-2.c index 21e45cc..ee9e134 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-fmin-2.c +++ b/gcc/testsuite/gcc.dg/vect/vect-fmin-2.c @@ -1,3 +1,5 @@ +/* { dg-require-effective-target vect_float } */ + #ifndef TYPE #define TYPE double #define FN __builtin_fmin diff --git a/gcc/testsuite/gcc.dg/vect/vect-fmin-3.c b/gcc/testsuite/gcc.dg/vect/vect-fmin-3.c index cc38bf4..2e282ba 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-fmin-3.c +++ b/gcc/testsuite/gcc.dg/vect/vect-fmin-3.c @@ -1,3 +1,5 @@ +/* { dg-require-effective-target vect_float } */ + #include "tree-vect.h" void __attribute__((noipa)) -- cgit v1.1 From e304e9283a97e28dc0074d8d30715d3f626b4e87 Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Tue, 24 Jan 2023 08:49:44 +0100 Subject: testsuite: Fix gcc.dg/vect/vect-bitfield-write-[23].c on SPARC [PR107808] The gcc.dg/vect/vect-bitfield-write-[23].c tests FAIL on 32 and 64-bit SPARC: FAIL: gcc.dg/vect/vect-bitfield-write-2.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 1 loops" 1 FAIL: gcc.dg/vect/vect-bitfield-write-2.c scan-tree-dump-times vect "vectorized 1 loops" 1 FAIL: gcc.dg/vect/vect-bitfield-write-3.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 1 loops" 1 FAIL: gcc.dg/vect/vect-bitfield-write-3.c scan-tree-dump-times vect "vectorized 1 loops" 1 As discussed in the PR, they require vect_long_long support, but fail to require that. This patch fixes this. Tested on sparc-sun-solaris2.11 and i386-pc-solaris2.11. 2023-01-20 Rainer Orth gcc/testsuite: PR testsuite/107808 * gcc.dg/vect/vect-bitfield-write-2.c: Require vect_long_long. * gcc.dg/vect/vect-bitfield-write-3.c: Likewise. --- gcc/testsuite/gcc.dg/vect/vect-bitfield-write-2.c | 1 + gcc/testsuite/gcc.dg/vect/vect-bitfield-write-3.c | 1 + 2 files changed, 2 insertions(+) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/vect/vect-bitfield-write-2.c b/gcc/testsuite/gcc.dg/vect/vect-bitfield-write-2.c index d550dd3..1a10135 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-bitfield-write-2.c +++ b/gcc/testsuite/gcc.dg/vect/vect-bitfield-write-2.c @@ -1,4 +1,5 @@ /* { dg-require-effective-target vect_int } */ +/* { dg-require-effective-target vect_long_long } */ #include #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/vect-bitfield-write-3.c b/gcc/testsuite/gcc.dg/vect/vect-bitfield-write-3.c index 3303d26..5dc6796 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-bitfield-write-3.c +++ b/gcc/testsuite/gcc.dg/vect/vect-bitfield-write-3.c @@ -1,4 +1,5 @@ /* { dg-require-effective-target vect_int } */ +/* { dg-require-effective-target vect_long_long } */ #include #include "tree-vect.h" -- cgit v1.1 From 275820c09e5f397040cbff69c90012dc1e220faf Mon Sep 17 00:00:00 2001 From: Srinath Parvathaneni Date: Tue, 24 Jan 2023 09:57:52 +0000 Subject: arm: Fix inclusion of arm-mlib.h header more than once (pr108505). The patch fixes the build issue for arm-none-eabi target configured with --with-multilib-list=aprofile,rmprofile, in which case the header file arm/arm-mlib.h is being included more than once and the toolchain build is failing (PR108505). gcc/ChangeLog: 2023-01-24 Srinath Parvathaneni PR target/108505 * config.gcc (tm_file): Move the variable out of loop. --- gcc/config.gcc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/config.gcc b/gcc/config.gcc index 771bd35..d828223 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -4350,7 +4350,6 @@ case "${target}" in case ${arm_multilib} in aprofile|rmprofile) tmake_profile_file="arm/t-multilib" - tm_file="$tm_file arm/arm-mlib.h" ;; @*) ml=`echo "X$arm_multilib" | sed '1s,^X@,,'` @@ -4389,6 +4388,7 @@ case "${target}" in # through to the multilib selector with_float="soft" tmake_file="${tmake_file} ${tmake_profile_file}" + tm_file="$tm_file arm/arm-mlib.h" TM_MULTILIB_CONFIG="$with_multilib_list" fi fi -- cgit v1.1 From b84e21115700523b4d0ac44275443f7b9c670344 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 24 Jan 2023 11:28:00 +0100 Subject: c++: Handle structured bindings like anon unions in initializers [PR108474] As reported by Andrew Pinski, structured bindings (with the exception of the ones using std::tuple_{size,element} and get which are really standalone variables in addition to the binding one) also use DECL_VALUE_EXPR and needs the same treatment in static initializers. On Sun, Jan 22, 2023 at 07:19:07PM -0500, Jason Merrill wrote: > Though, actually, why not instead fix expand_expr_real_1 (and staticp) to > look through DECL_VALUE_EXPR? Doing it when emitting the initializers seems to be too late to me, we in various spots try to put parts of the static var DECL_INITIAL expressions into the IL, or e.g. for varpool purposes remember which vars are referenced there. This patch moves it to record_reference, which is called from varpool_node::analyze and so about the same time as gimplification of the bodies which also replaces DECL_VALUE_EXPRs. 2023-01-24 Jakub Jelinek PR c++/108474 * cgraphbuild.cc: Include gimplify.h. (record_reference): Replace VAR_DECLs with DECL_HAS_VALUE_EXPR_P with their corresponding DECL_VALUE_EXPR expressions after unsharing. * cp-gimplify.cc (cp_fold_r): Revert 2023-01-19 changes. * g++.dg/cpp1z/decomp57.C: New test. * g++.dg/cpp1z/decomp58.C: New test. --- gcc/cgraphbuild.cc | 12 +++++++++++ gcc/cp/cp-gimplify.cc | 10 --------- gcc/testsuite/g++.dg/cpp1z/decomp57.C | 27 ++++++++++++++++++++++++ gcc/testsuite/g++.dg/cpp1z/decomp58.C | 39 +++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/decomp57.C create mode 100644 gcc/testsuite/g++.dg/cpp1z/decomp58.C (limited to 'gcc') diff --git a/gcc/cgraphbuild.cc b/gcc/cgraphbuild.cc index f13abca..597831e 100644 --- a/gcc/cgraphbuild.cc +++ b/gcc/cgraphbuild.cc @@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-walk.h" #include "ipa-utils.h" #include "except.h" +#include "gimplify.h" /* Context of record_reference. */ struct record_reference_ctx @@ -79,6 +80,17 @@ record_reference (tree *tp, int *walk_subtrees, void *data) if (VAR_P (decl)) { + /* Replace vars with their DECL_VALUE_EXPR if any. + This is normally done during gimplification, but + static var initializers are never gimplified. */ + if (DECL_HAS_VALUE_EXPR_P (decl)) + { + tree *p; + for (p = tp; *p != decl; p = &TREE_OPERAND (*p, 0)) + ; + *p = unshare_expr (DECL_VALUE_EXPR (decl)); + return record_reference (tp, walk_subtrees, data); + } varpool_node *vnode = varpool_node::get_create (decl); ctx->varpool_node->create_reference (vnode, IPA_REF_ADDR); } diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc index 92cd309..a35cedd 100644 --- a/gcc/cp/cp-gimplify.cc +++ b/gcc/cp/cp-gimplify.cc @@ -1035,16 +1035,6 @@ cp_fold_r (tree *stmt_p, int *walk_subtrees, void *data_) } break; - case VAR_DECL: - /* In initializers replace anon union artificial VAR_DECLs - with their DECL_VALUE_EXPRs, as nothing will do it later. */ - if (DECL_ANON_UNION_VAR_P (stmt) && !data->genericize) - { - *stmt_p = stmt = unshare_expr (DECL_VALUE_EXPR (stmt)); - break; - } - break; - default: break; } diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp57.C b/gcc/testsuite/g++.dg/cpp1z/decomp57.C new file mode 100644 index 0000000..923862e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/decomp57.C @@ -0,0 +1,27 @@ +// PR c++/108474 +// { dg-do link { target c++17 } } + +struct T { int i, j; }; +T h; +auto [i, j] = h; +int &r = i; +int s = i; +int *t = &i; + +void +foo (int **p, int *q) +{ + static int &u = i; + static int v = i; + static int *w = &i; + int &x = i; + int y = i; + int *z = &i; + *p = &i; + *q = i; +} + +int +main () +{ +} diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp58.C b/gcc/testsuite/g++.dg/cpp1z/decomp58.C new file mode 100644 index 0000000..b260437 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/decomp58.C @@ -0,0 +1,39 @@ +// PR c++/108474 +// { dg-do link { target c++17 } } + +namespace std { + template struct tuple_size; + template struct tuple_element; +} + +struct A { + int i; + template int& get() { return i; } +}; + +template <> struct std::tuple_size { static const int value = 2; }; +template struct std::tuple_element { using type = int; }; + +struct A a; +auto [i, j] = a; +int &r = i; +int s = i; +int *t = &i; + +void +foo (int **p, int *q) +{ + static int &u = i; + static int v = i; + static int *w = &i; + int &x = i; + int y = i; + int *z = &i; + *p = &i; + *q = i; +} + +int +main () +{ +} -- cgit v1.1 From 9f0cb3368af735e95776769c4f28fa9cbb60eaf8 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 24 Jan 2023 11:54:41 +0100 Subject: options: fix cl_target_option_print_diff() with strings Fix an obvious copy-and-paste error where ptr1 was used instead of ptr2. This bug caused the dump file produced by -fdump-ipa-inline-details to not correctly show the difference in target options when a function could not be inlined due to a target option mismatch. gcc/ChangeLog: PR bootstrap/90543 * optc-save-gen.awk: Fix copy-and-paste error. Signed-off-by: Eric Biggers --- gcc/optc-save-gen.awk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/optc-save-gen.awk b/gcc/optc-save-gen.awk index e91adf7..d2cb53c 100644 --- a/gcc/optc-save-gen.awk +++ b/gcc/optc-save-gen.awk @@ -1013,7 +1013,7 @@ for (i = 0; i < n_target_string; i++) { print " indent, \"\","; print " \"" name "\","; print " ptr1->x_" name " ? ptr1->x_" name " : \"(null)\","; - print " ptr2->x_" name " ? ptr1->x_" name " : \"(null)\");"; + print " ptr2->x_" name " ? ptr2->x_" name " : \"(null)\");"; print ""; } -- cgit v1.1 From f31fa9ea35ebcf221a2abaacba5511225f5d036e Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 24 Jan 2023 10:49:18 +0100 Subject: tree-optimization/108500 - avoid useless fast-query compute in CFG cleanup CFG cleanup computes dominators before the loop over blocks looking for merging opportunities. That computes also the fast-query DFS numbers but that's a bit pointless since any CFG cleanup will invalidate them immediately (they are re-computed before fixing up loops). The following avoids this and fixes the SIGSEGV due to the deep recursion in assign_dfs_numbers after inlining very many small functions. PR tree-optimization/108500 * dominance.h (calculate_dominance_info): Add parameter to indicate fast-query compute, defaulted to true. * dominance.cc (calculate_dominance_info): Honor fast-query compute parameter. * tree-cfgcleanup.cc (cleanup_tree_cfg_noloop): Do not compute the dominator fast-query DFS numbers. --- gcc/dominance.cc | 9 ++++++--- gcc/dominance.h | 2 +- gcc/tree-cfgcleanup.cc | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'gcc') diff --git a/gcc/dominance.cc b/gcc/dominance.cc index 13d5498..099b8fd 100644 --- a/gcc/dominance.cc +++ b/gcc/dominance.cc @@ -705,10 +705,12 @@ compute_dom_fast_query_in_region (enum cdi_direction dir, } /* The main entry point into this module. DIR is set depending on whether - we want to compute dominators or postdominators. */ + we want to compute dominators or postdominators. If COMPUTE_FAST_QUERY + is false then the DFS numbers allowing for a O(1) dominance query + are not computed. */ void -calculate_dominance_info (cdi_direction dir) +calculate_dominance_info (cdi_direction dir, bool compute_fast_query) { unsigned int dir_index = dom_convert_dir_to_idx (dir); @@ -745,7 +747,8 @@ calculate_dominance_info (cdi_direction dir) else checking_verify_dominators (dir); - compute_dom_fast_query (dir); + if (compute_fast_query) + compute_dom_fast_query (dir); timevar_pop (TV_DOMINANCE); } diff --git a/gcc/dominance.h b/gcc/dominance.h index abdcf76..3c5a345 100644 --- a/gcc/dominance.h +++ b/gcc/dominance.h @@ -35,7 +35,7 @@ enum dom_state DOM_OK /* Everything is ok. */ }; -extern void calculate_dominance_info (enum cdi_direction); +extern void calculate_dominance_info (enum cdi_direction, bool = true); extern void calculate_dominance_info_for_region (enum cdi_direction, vec); extern void free_dominance_info (function *, enum cdi_direction); diff --git a/gcc/tree-cfgcleanup.cc b/gcc/tree-cfgcleanup.cc index ca0cb63..64ff16f 100644 --- a/gcc/tree-cfgcleanup.cc +++ b/gcc/tree-cfgcleanup.cc @@ -1106,9 +1106,11 @@ cleanup_tree_cfg_noloop (unsigned ssa_update_flags) timevar_push (TV_TREE_CLEANUP_CFG); } - /* Compute dominator info which we need for the iterative process below. */ + /* Compute dominator info which we need for the iterative process below. + Avoid computing the fast query DFS numbers since any block merging + done will invalidate them anyway. */ if (!dom_info_available_p (CDI_DOMINATORS)) - calculate_dominance_info (CDI_DOMINATORS); + calculate_dominance_info (CDI_DOMINATORS, false); else checking_verify_dominators (CDI_DOMINATORS); -- cgit v1.1 From 4d518ed1c0edbfff5208e09616f98ea412b55c52 Mon Sep 17 00:00:00 2001 From: Xianmiao Qu Date: Wed, 25 Jan 2023 00:14:46 +0800 Subject: C-SKY: Fix wrong sysroot suffix when disable multilib. The SYSROOT_SUFFIX_SPEC works even when multilib is disabled. So when build no-multilib glibc toolchain and the options are not same as MULTILIB_DEFAULTS, the sysroot will specify wrong because the libc will not be installed as such. This bug causes glibc regression test error: https://sourceware.org/pipermail/libc-testresults/2023q1/010706.html The error is: /scratch/jmyers/glibc-bot/install/compilers/csky-linux-gnuabiv2/csky-glibc-linux-gnuabiv2/bin/ld: cannot find -lc: No such file or directory gcc/ * config.gcc(csky-*-linux*): Define CSKY_ENABLE_MULTILIB and only include 'csky/t-csky-linux' when enable multilib. * config/csky/csky-linux-elf.h(SYSROOT_SUFFIX_SPEC): Don't define it when disable multilib. --- gcc/config.gcc | 7 ++++++- gcc/config/csky/csky-linux-elf.h | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/config.gcc b/gcc/config.gcc index d828223..89f5604 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1642,7 +1642,12 @@ csky-*-*) ;; csky-*-linux*) tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} csky/csky-linux-elf.h" - tmake_file="${tmake_file} csky/t-csky csky/t-csky-linux" + tmake_file="${tmake_file} csky/t-csky" + + if test "x${enable_multilib}" = xyes ; then + tm_defines="$tm_defines CSKY_ENABLE_MULTILIB" + tmake_file="${tmake_file} csky/t-csky-linux" + fi case ${target} in csky-*-linux-gnu*) diff --git a/gcc/config/csky/csky-linux-elf.h b/gcc/config/csky/csky-linux-elf.h index 3f67af6..117c2a1 100644 --- a/gcc/config/csky/csky-linux-elf.h +++ b/gcc/config/csky/csky-linux-elf.h @@ -65,6 +65,8 @@ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-cskyv2%{mfloat-abi=hard:-hf}%{mbig-endian:-be}.so.1" +#ifdef CSKY_ENABLE_MULTILIB +#undef SYSROOT_SUFFIX_SPEC #define SYSROOT_SUFFIX_SPEC \ "%{mbig-endian:/big}" \ "%{mcpu=ck807*:/ck807}" \ @@ -72,6 +74,7 @@ "%{mcpu=ck800*:/ck800}" \ "%{mfloat-abi=softfp:/soft-fp}" \ "%{mfloat-abi=hard:/hard-fp}" +#endif #define LINUX_TARGET_LINK_SPEC "%{h*} %{version:-v} \ %{b} \ -- cgit v1.1 From c1093923733a1072a237f112e3239b5ebd88eadd Mon Sep 17 00:00:00 2001 From: Andre Vieira Date: Tue, 24 Jan 2023 16:59:23 +0000 Subject: arm: Make MVE masked stores read memory operand [PR 108177] This patch adds the memory operand of MVE masked stores as input operands to mimic the 'partial' writes, to prevent erroneous write-after-write optimizations as described in the PR. gcc/ChangeLog: PR target/108177 * config/arm/mve.md (mve_vstrbq_p_, mve_vstrhq_p_fv8hf, mve_vstrhq_p_, mve_vstrwq_p_v4si): Add memory operand as input operand. gcc/testsuite/ChangeLog: * gcc.target/arm/mve/pr108177-1-run.c: New test. * gcc.target/arm/mve/pr108177-1.c: New test. * gcc.target/arm/mve/pr108177-10-run.c: New test. * gcc.target/arm/mve/pr108177-10.c: New test. * gcc.target/arm/mve/pr108177-11-run.c: New test. * gcc.target/arm/mve/pr108177-11.c: New test. * gcc.target/arm/mve/pr108177-12-run.c: New test. * gcc.target/arm/mve/pr108177-12.c: New test. * gcc.target/arm/mve/pr108177-13-run.c: New test. * gcc.target/arm/mve/pr108177-13.c: New test. * gcc.target/arm/mve/pr108177-14-run.c: New test. * gcc.target/arm/mve/pr108177-14.c: New test. * gcc.target/arm/mve/pr108177-2-run.c: New test. * gcc.target/arm/mve/pr108177-2.c: New test. * gcc.target/arm/mve/pr108177-3-run.c: New test. * gcc.target/arm/mve/pr108177-3.c: New test. * gcc.target/arm/mve/pr108177-4-run.c: New test. * gcc.target/arm/mve/pr108177-4.c: New test. * gcc.target/arm/mve/pr108177-5-run.c: New test. * gcc.target/arm/mve/pr108177-5.c: New test. * gcc.target/arm/mve/pr108177-6-run.c: New test. * gcc.target/arm/mve/pr108177-6.c: New test. * gcc.target/arm/mve/pr108177-7-run.c: New test. * gcc.target/arm/mve/pr108177-7.c: New test. * gcc.target/arm/mve/pr108177-8-run.c: New test. * gcc.target/arm/mve/pr108177-8.c: New test. * gcc.target/arm/mve/pr108177-9-run.c: New test. * gcc.target/arm/mve/pr108177-9.c: New test. * gcc.target/arm/mve/pr108177-main.x: New test include. * gcc.target/arm/mve/pr108177.x: New test include. --- gcc/config/arm/mve.md | 45 ++++++++++++---------- gcc/testsuite/gcc.target/arm/mve/pr108177-1-run.c | 6 +++ gcc/testsuite/gcc.target/arm/mve/pr108177-1.c | 20 ++++++++++ gcc/testsuite/gcc.target/arm/mve/pr108177-10-run.c | 6 +++ gcc/testsuite/gcc.target/arm/mve/pr108177-10.c | 20 ++++++++++ gcc/testsuite/gcc.target/arm/mve/pr108177-11-run.c | 6 +++ gcc/testsuite/gcc.target/arm/mve/pr108177-11.c | 20 ++++++++++ gcc/testsuite/gcc.target/arm/mve/pr108177-12-run.c | 6 +++ gcc/testsuite/gcc.target/arm/mve/pr108177-12.c | 20 ++++++++++ gcc/testsuite/gcc.target/arm/mve/pr108177-13-run.c | 6 +++ gcc/testsuite/gcc.target/arm/mve/pr108177-13.c | 20 ++++++++++ gcc/testsuite/gcc.target/arm/mve/pr108177-14-run.c | 6 +++ gcc/testsuite/gcc.target/arm/mve/pr108177-14.c | 20 ++++++++++ gcc/testsuite/gcc.target/arm/mve/pr108177-2-run.c | 6 +++ gcc/testsuite/gcc.target/arm/mve/pr108177-2.c | 20 ++++++++++ gcc/testsuite/gcc.target/arm/mve/pr108177-3-run.c | 6 +++ gcc/testsuite/gcc.target/arm/mve/pr108177-3.c | 20 ++++++++++ gcc/testsuite/gcc.target/arm/mve/pr108177-4-run.c | 6 +++ gcc/testsuite/gcc.target/arm/mve/pr108177-4.c | 20 ++++++++++ gcc/testsuite/gcc.target/arm/mve/pr108177-5-run.c | 6 +++ gcc/testsuite/gcc.target/arm/mve/pr108177-5.c | 20 ++++++++++ gcc/testsuite/gcc.target/arm/mve/pr108177-6-run.c | 6 +++ gcc/testsuite/gcc.target/arm/mve/pr108177-6.c | 20 ++++++++++ gcc/testsuite/gcc.target/arm/mve/pr108177-7-run.c | 6 +++ gcc/testsuite/gcc.target/arm/mve/pr108177-7.c | 20 ++++++++++ gcc/testsuite/gcc.target/arm/mve/pr108177-8-run.c | 6 +++ gcc/testsuite/gcc.target/arm/mve/pr108177-8.c | 20 ++++++++++ gcc/testsuite/gcc.target/arm/mve/pr108177-9-run.c | 6 +++ gcc/testsuite/gcc.target/arm/mve/pr108177-9.c | 20 ++++++++++ gcc/testsuite/gcc.target/arm/mve/pr108177-main.x | 31 +++++++++++++++ gcc/testsuite/gcc.target/arm/mve/pr108177.x | 9 +++++ 31 files changed, 428 insertions(+), 21 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-1-run.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-1.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-10-run.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-10.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-11-run.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-11.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-12-run.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-12.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-13-run.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-13.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-14-run.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-14.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-2-run.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-2.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-3-run.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-3.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-4-run.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-4.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-5-run.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-5.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-6-run.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-6.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-7-run.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-7.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-8-run.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-8.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-9-run.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-9.c create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177-main.x create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr108177.x (limited to 'gcc') diff --git a/gcc/config/arm/mve.md b/gcc/config/arm/mve.md index f123edc..2e58ad1 100644 --- a/gcc/config/arm/mve.md +++ b/gcc/config/arm/mve.md @@ -7272,15 +7272,13 @@ } [(set_attr "length" "8")]) -;; -;; [vstrbq_p_s vstrbq_p_u] -;; (define_insn "mve_vstrbq_p_" [(set (match_operand: 0 "mve_memory_operand" "=Ux") - (unspec: [(match_operand:MVE_2 1 "s_register_operand" "w") - (match_operand: 2 "vpr_register_operand" "Up")] - VSTRBQ)) - ] + (unspec: + [(match_operand:MVE_2 1 "s_register_operand" "w") + (match_operand: 2 "vpr_register_operand" "Up") + (match_dup 0)] + VSTRBQ))] "TARGET_HAVE_MVE" { rtx ops[2]; @@ -8079,10 +8077,11 @@ ;; (define_insn "mve_vstrhq_p_fv8hf" [(set (match_operand:V8HI 0 "mve_memory_operand" "=Ux") - (unspec:V8HI [(match_operand:V8HF 1 "s_register_operand" "w") - (match_operand:V8BI 2 "vpr_register_operand" "Up")] - VSTRHQ_F)) - ] + (unspec:V8HI + [(match_operand:V8HF 1 "s_register_operand" "w") + (match_operand:V8BI 2 "vpr_register_operand" "Up") + (match_dup 0)] + VSTRHQ_F))] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" { rtx ops[2]; @@ -8099,8 +8098,10 @@ ;; (define_insn "mve_vstrhq_p_" [(set (match_operand: 0 "mve_memory_operand" "=Ux") - (unspec: [(match_operand:MVE_6 1 "s_register_operand" "w") - (match_operand: 2 "vpr_register_operand" "Up")] + (unspec: + [(match_operand:MVE_6 1 "s_register_operand" "w") + (match_operand: 2 "vpr_register_operand" "Up") + (match_dup 0)] VSTRHQ)) ] "TARGET_HAVE_MVE" @@ -8278,10 +8279,11 @@ ;; (define_insn "mve_vstrwq_p_fv4sf" [(set (match_operand:V4SI 0 "mve_memory_operand" "=Ux") - (unspec:V4SI [(match_operand:V4SF 1 "s_register_operand" "w") - (match_operand: 2 "vpr_register_operand" "Up")] - VSTRWQ_F)) - ] + (unspec:V4SI + [(match_operand:V4SF 1 "s_register_operand" "w") + (match_operand: 2 "vpr_register_operand" "Up") + (match_dup 0)] + VSTRWQ_F))] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" { rtx ops[2]; @@ -8298,10 +8300,11 @@ ;; (define_insn "mve_vstrwq_p_v4si" [(set (match_operand:V4SI 0 "mve_memory_operand" "=Ux") - (unspec:V4SI [(match_operand:V4SI 1 "s_register_operand" "w") - (match_operand:V4BI 2 "vpr_register_operand" "Up")] - VSTRWQ)) - ] + (unspec:V4SI + [(match_operand:V4SI 1 "s_register_operand" "w") + (match_operand:V4BI 2 "vpr_register_operand" "Up") + (match_dup 0)] + VSTRWQ))] "TARGET_HAVE_MVE" { rtx ops[2]; diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-1-run.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-1-run.c new file mode 100644 index 0000000..ca092df --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-1-run.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_mve_hw } */ +/* { dg-options "-O2 --save-temps" } */ +/* { dg-add-options arm_v8_1m_mve } */ + +#include "pr108177-1.c" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-1.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-1.c new file mode 100644 index 0000000..2d42062 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-1.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* +** test: +**... +** vstrbt.8 q0, \[r0\] +**... +** vstrbt.8 q0, \[r0\] +**... +*/ + +#define TYPE uint8x16_t +#define INTRINSIC vstrbq_u8 +#define INTRINSIC_P vstrbq_p_u8 + +#include "pr108177.x" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-10-run.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-10-run.c new file mode 100644 index 0000000..0a58b8f --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-10-run.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_mve_hw } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ + +#include "pr108177-10.c" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-10.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-10.c new file mode 100644 index 0000000..4db594f --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-10.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* +** test: +**... +** vstrht.32 q0, \[r0\] +**... +** vstrht.32 q0, \[r0\] +**... +*/ + +#define TYPE int32x4_t +#define INTRINSIC vstrhq_s32 +#define INTRINSIC_P vstrhq_p_s32 + +#include "pr108177.x" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-11-run.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-11-run.c new file mode 100644 index 0000000..9f568ea --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-11-run.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_mve_hw } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ + +#include "pr108177-11.c" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-11.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-11.c new file mode 100644 index 0000000..329fcb3 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-11.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* +** test: +**... +** vstrwt.32 q0, \[r0\] +**... +** vstrwt.32 q0, \[r0\] +**... +*/ + +#define TYPE uint32x4_t +#define INTRINSIC vstrwq_u32 +#define INTRINSIC_P vstrwq_p_u32 + +#include "pr108177.x" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-12-run.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-12-run.c new file mode 100644 index 0000000..8e946a2 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-12-run.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_mve_hw } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ + +#include "pr108177-12.c" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-12.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-12.c new file mode 100644 index 0000000..3f7c5b2 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-12.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* +** test: +**... +** vstrwt.32 q0, \[r0\] +**... +** vstrwt.32 q0, \[r0\] +**... +*/ + +#define TYPE int32x4_t +#define INTRINSIC vstrwq_s32 +#define INTRINSIC_P vstrwq_p_s32 + +#include "pr108177.x" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-13-run.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-13-run.c new file mode 100644 index 0000000..2e731ee --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-13-run.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_mve_hw } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ + +#include "pr108177-13.c" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-13.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-13.c new file mode 100644 index 0000000..2f82228 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-13.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* +** test: +**... +** vstrht.16 q0, \[r0\] +**... +** vstrht.16 q0, \[r0\] +**... +*/ + +#define TYPE float16x8_t +#define INTRINSIC vstrhq_f16 +#define INTRINSIC_P vstrhq_p_f16 + +#include "pr108177.x" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-14-run.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-14-run.c new file mode 100644 index 0000000..3cebcf5 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-14-run.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_mve_hw } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ + +#include "pr108177-14.c" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-14.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-14.c new file mode 100644 index 0000000..ba6196b --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-14.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* +** test: +**... +** vstrwt.32 q0, \[r0\] +**... +** vstrwt.32 q0, \[r0\] +**... +*/ + +#define TYPE float32x4_t +#define INTRINSIC vstrwq_f32 +#define INTRINSIC_P vstrwq_p_f32 + +#include "pr108177.x" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-2-run.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-2-run.c new file mode 100644 index 0000000..03750c9 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-2-run.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_mve_hw } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ + +#include "pr108177-2.c" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-2.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-2.c new file mode 100644 index 0000000..52c8d87 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-2.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* +** test: +**... +** vstrbt.8 q0, \[r0\] +**... +** vstrbt.8 q0, \[r0\] +**... +*/ + +#define TYPE int8x16_t +#define INTRINSIC vstrbq_s8 +#define INTRINSIC_P vstrbq_p_s8 + +#include "pr108177.x" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-3-run.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-3-run.c new file mode 100644 index 0000000..bab08e0 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-3-run.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_mve_hw } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ + +#include "pr108177-3.c" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-3.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-3.c new file mode 100644 index 0000000..ac89e7e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-3.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* +** test: +**... +** vstrbt.16 q0, \[r0\] +**... +** vstrbt.16 q0, \[r0\] +**... +*/ + +#define TYPE uint16x8_t +#define INTRINSIC vstrbq_u16 +#define INTRINSIC_P vstrbq_p_u16 + +#include "pr108177.x" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-4-run.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-4-run.c new file mode 100644 index 0000000..cff62c7 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-4-run.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_mve_hw } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ + +#include "pr108177-4.c" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-4.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-4.c new file mode 100644 index 0000000..dc4f7dd --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-4.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* +** test: +**... +** vstrbt.16 q0, \[r0\] +**... +** vstrbt.16 q0, \[r0\] +**... +*/ + +#define TYPE int16x8_t +#define INTRINSIC vstrbq_s16 +#define INTRINSIC_P vstrbq_p_s16 + +#include "pr108177.x" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-5-run.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-5-run.c new file mode 100644 index 0000000..7211828 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-5-run.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_mve_hw } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ + +#include "pr108177-5.c" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-5.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-5.c new file mode 100644 index 0000000..d1dfd32 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-5.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* +** test: +**... +** vstrbt.32 q0, \[r0\] +**... +** vstrbt.32 q0, \[r0\] +**... +*/ + +#define TYPE uint32x4_t +#define INTRINSIC vstrbq_u32 +#define INTRINSIC_P vstrbq_p_u32 + +#include "pr108177.x" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-6-run.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-6-run.c new file mode 100644 index 0000000..4e7d108 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-6-run.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_mve_hw } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ + +#include "pr108177-6.c" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-6.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-6.c new file mode 100644 index 0000000..fa70dde --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-6.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* +** test: +**... +** vstrbt.32 q0, \[r0\] +**... +** vstrbt.32 q0, \[r0\] +**... +*/ + +#define TYPE int32x4_t +#define INTRINSIC vstrbq_s32 +#define INTRINSIC_P vstrbq_p_s32 + +#include "pr108177.x" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-7-run.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-7-run.c new file mode 100644 index 0000000..94c492e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-7-run.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_mve_hw } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ + +#include "pr108177-7.c" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-7.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-7.c new file mode 100644 index 0000000..73cd860 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-7.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* +** test: +**... +** vstrht.16 q0, \[r0\] +**... +** vstrht.16 q0, \[r0\] +**... +*/ + +#define TYPE uint16x8_t +#define INTRINSIC vstrhq_u16 +#define INTRINSIC_P vstrhq_p_u16 + +#include "pr108177.x" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-8-run.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-8-run.c new file mode 100644 index 0000000..3c34045 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-8-run.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_mve_hw } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ + +#include "pr108177-8.c" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-8.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-8.c new file mode 100644 index 0000000..187c2b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-8.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* +** test: +**... +** vstrht.16 q0, \[r0\] +**... +** vstrht.16 q0, \[r0\] +**... +*/ + +#define TYPE int16x8_t +#define INTRINSIC vstrhq_s16 +#define INTRINSIC_P vstrhq_p_s16 + +#include "pr108177.x" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-9-run.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-9-run.c new file mode 100644 index 0000000..967cf7f --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-9-run.c @@ -0,0 +1,6 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_mve_hw } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ + +#include "pr108177-9.c" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-9.c b/gcc/testsuite/gcc.target/arm/mve/pr108177-9.c new file mode 100644 index 0000000..caecd18 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-9.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* +** test: +**... +** vstrht.32 q0, \[r0\] +**... +** vstrht.32 q0, \[r0\] +**... +*/ + +#define TYPE uint32x4_t +#define INTRINSIC vstrhq_u32 +#define INTRINSIC_P vstrhq_p_u32 + +#include "pr108177.x" diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177-main.x b/gcc/testsuite/gcc.target/arm/mve/pr108177-main.x new file mode 100644 index 0000000..f5f965f --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177-main.x @@ -0,0 +1,31 @@ +#include +extern void abort (void); + +__attribute__ ((noipa)) void +write_expected (uint32x4_t v, void *a) +{ + TYPE _v = (TYPE) v; + INTRINSIC (a, _v); +} + +void test (uint32x4_t, void *, mve_pred16_t, mve_pred16_t); + +int main(void) +{ + uint32x4_t v = {0, 1, 2, 3}; + uint32_t actual[] = {0, 0, 0, 0}; + uint32_t expected[] = {0, 0, 0, 0}; + + write_expected (v, &(expected[0])); + + mve_pred16_t p1 = 0xff00; + mve_pred16_t p2 = 0x00ff; + + test (v, (void *)&actual[0], p1, p2); + + if (__builtin_memcmp (&actual[0], &expected[0], 16) != 0) + abort (); + + return 0; +} + diff --git a/gcc/testsuite/gcc.target/arm/mve/pr108177.x b/gcc/testsuite/gcc.target/arm/mve/pr108177.x new file mode 100644 index 0000000..019ef54 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/pr108177.x @@ -0,0 +1,9 @@ +#include "pr108177-main.x" + +__attribute__ ((noipa)) void +test (uint32x4_t v, void *a, mve_pred16_t p1, mve_pred16_t p2) +{ + TYPE _v = (TYPE) v; + INTRINSIC_P (a, _v, p1); + INTRINSIC_P (a, _v, p2); +} -- cgit v1.1 From b061fc94d70dc82f554eeb94434cf03cd5af03f7 Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Tue, 24 Jan 2023 17:33:18 +0000 Subject: Bugfix ensure RTentity is a dependent of RTco.cc RTco is a definition for C module and therefore there is no RTco.mod. The RTco.cc uses RTentity and the import in RTco.def ensures that cc1gm2 can build a graph of all dependencies should -fscaffold-static be used. gcc/m2/ChangeLog: * gm2-libs-iso/RTco.def: Import RTentity. Declare RTco as a definition for C module. Signed-off-by: Gaius Mulley --- gcc/m2/gm2-libs-iso/RTco.def | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/m2/gm2-libs-iso/RTco.def b/gcc/m2/gm2-libs-iso/RTco.def index 33452ba..5285a7d 100644 --- a/gcc/m2/gm2-libs-iso/RTco.def +++ b/gcc/m2/gm2-libs-iso/RTco.def @@ -24,10 +24,12 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . *) -DEFINITION MODULE RTco ; +DEFINITION MODULE FOR "C" RTco ; FROM SYSTEM IMPORT ADDRESS ; +IMPORT RTentity ; (* Imported so the initialization call graph + understands that RTco.cc depends upon RTentity. *) (* init initializes the module and allows the application to lazily invoke threads. *) -- cgit v1.1 From 96fd01679011379d6da0777e435078212c6bb325 Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Tue, 24 Jan 2023 19:21:20 +0000 Subject: Change m2 lexical analysis to optionally consume C comments. This patch allows a subsequent patch to turn on/off the consuming of C comments. gcc/m2/ChangeLog: * m2.flex (cpreprocessor): Add temporary variable which is initialized to 0. (commentCLevel): New variable. (endOfCComment): New function. (splitSlashStar): New function to split /* into / and * tokens. (COMMENTC): New flex state. ("/*"): New rule to test whether we should treat /* as a single token or as two tokens. (.): New rule to skip a character. (\n.*): New rule to consume the line. ("*/"): New rule to call endOfCComment. Signed-off-by: Gaius Mulley --- gcc/m2/m2.flex | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/m2/m2.flex b/gcc/m2/m2.flex index 15f3caf..7b8f4f1 100644 --- a/gcc/m2/m2.flex +++ b/gcc/m2/m2.flex @@ -27,6 +27,7 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "input.h" #include "m2options.h" +static int cpreprocessor = 0; /* Replace this with correct getter. */ #if defined(GM2USEGGC) # include "ggc.h" @@ -70,6 +71,7 @@ along with GNU Modula-2; see the file COPYING3. If not see static int lineno =1; /* a running count of the file line number */ static char *filename =NULL; static int commentLevel=0; + static int commentCLevel=0; static struct lineInfo *currentLine=NULL; static struct functionInfo *currentFunction=NULL; static int seenFunctionStart=FALSE; @@ -87,6 +89,8 @@ static void updatepos (void); static void skippos (void); static void poperrorskip (const char *); static void endOfComment (void); +static void endOfCComment (void); +static void splitSlashStar (void); static void handleDate (void); static void handleLine (void); static void handleFile (void); @@ -117,7 +121,7 @@ extern void yylex (void); %} %option nounput -%x COMMENT COMMENT1 LINE0 LINE1 LINE2 +%x COMMENT COMMENT1 COMMENTC LINE0 LINE1 LINE2 %% @@ -145,6 +149,24 @@ extern void yylex (void); <> { poperrorskip("unterminated source code directive, missing *>"); BEGIN COMMENT; } <> { poperrorskip("unterminated comment found at the end of the file, missing *)"); BEGIN INITIAL; } +"/*" { /* Possibly handle C preprocessor comment. */ + if (cpreprocessor) + { + updatepos (); + commentCLevel++; + if (commentCLevel == 1) + { + pushLine (); + skippos (); + } + BEGIN COMMENTC; + } + else + splitSlashStar (); + } +. { updatepos(); skippos(); } +\n.* { consumeLine(); } +"*/" { endOfCComment(); } ^\#.* { consumeLine(); /* printf("found: %s\n", currentLine->linebuf); */ BEGIN LINE0; } \n\#.* { consumeLine(); /* printf("found: %s\n", currentLine->linebuf); */ BEGIN LINE0; } \#[ \t]* { updatepos(); } @@ -437,6 +459,19 @@ static void endOfComment (void) } /* + * endOfCComment - handles the end of C comment. + */ + +static void endOfCComment (void) +{ + commentCLevel = 0; + updatepos(); + skippos(); + BEGIN INITIAL; + finishedLine(); +} + +/* * m2flex_M2Error - displays the error message, s, after the code line and pointer * to the erroneous token. */ @@ -505,6 +540,39 @@ static void assert_location (location_t location ATTRIBUTE_UNUSED) } /* + * splitSlashStar - called if we are not tokenizing source code after it + * has been preprocessed by cpp. It is only called + * if the current token was /* and therefore it will + * be split into two m2 tokens: / and *. + */ + +static void splitSlashStar (void) +{ + seenFunctionStart = FALSE; + seenEnd = FALSE; + seenModuleStart = FALSE; + currentLine->nextpos = currentLine->tokenpos+1; /* "/". */ + currentLine->toklen = 1; + currentLine->column = currentLine->tokenpos+1; + currentLine->location = + M2Options_OverrideLocation (GET_LOCATION (currentLine->column, + currentLine->column+currentLine->toklen-1)); + assert_location (GET_LOCATION (currentLine->column, + currentLine->column+currentLine->toklen-1)); + M2LexBuf_AddTok (M2Reserved_dividetok); + currentLine->nextpos = currentLine->tokenpos+1; /* "*". */ + currentLine->toklen = 1; + currentLine->column = currentLine->tokenpos+1; + currentLine->location = + M2Options_OverrideLocation (GET_LOCATION (currentLine->column, + currentLine->column+currentLine->toklen-1)); + assert_location (GET_LOCATION (currentLine->column, + currentLine->column+currentLine->toklen-1)); + M2LexBuf_AddTok (M2Reserved_timestok); +} + + +/* * updatepos - updates the current token position. * Should be used when a rule matches a token. */ -- cgit v1.1 From a4e725a10baf02c004c982772e22905fe99c1670 Mon Sep 17 00:00:00 2001 From: Stefan Schulze Frielinghaus Date: Tue, 24 Jan 2023 20:23:07 +0100 Subject: IBM zSystems: Fix TARGET_D_CPU_VERSIONS In the context of D the interpretation of S390, S390X, and SystemZ is a bit fuzzy. The wording S390X was wrongly deprecated in favour of SystemZ by commit https://github.com/dlang/dlang.org/commit/3b50a4c3faf01c32234d0ef8be5f82915a61c23f Thus, SystemZ is used for 64-bit targets, now, and S390 for 31-bit targets. However, in TARGET_D_CPU_VERSIONS depending on TARGET_ZARCH we set the CPU version to SystemZ. This is also the case if compiled for 31-bit targets leading to the following error: libphobos/libdruntime/core/sys/posix/sys/stat.d:967:13: error: static assert: '96u == 144u' is false 967 | static assert(stat_t.sizeof == 144); | ^ Thus in order to keep this patch simple I went for keeping SystemZ for 64-bit targets and S390, as usual, for 31-bit targets and dropped the distinction between ESA and z/Architecture. gcc/ChangeLog: * config/s390/s390-d.cc (s390_d_target_versions): Fix detection of CPU version. --- gcc/config/s390/s390-d.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'gcc') diff --git a/gcc/config/s390/s390-d.cc b/gcc/config/s390/s390-d.cc index d10b45f..6e9c80f 100644 --- a/gcc/config/s390/s390-d.cc +++ b/gcc/config/s390/s390-d.cc @@ -30,10 +30,11 @@ along with GCC; see the file COPYING3. If not see void s390_d_target_versions (void) { - if (TARGET_ZARCH) - d_add_builtin_version ("SystemZ"); - else if (TARGET_64BIT) - d_add_builtin_version ("S390X"); + if (TARGET_64BIT) + { + d_add_builtin_version ("S390X"); + d_add_builtin_version ("SystemZ"); + } else d_add_builtin_version ("S390"); -- cgit v1.1 From 6c96382eed96a9285611f2e3e2e59557094172b8 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Tue, 24 Jan 2023 21:39:43 +0100 Subject: Fortran: ICE in transformational_result [PR108529] gcc/fortran/ChangeLog: PR fortran/108529 * simplify.cc (simplify_transformation): Do not try to simplify transformational intrinsic when the ARRAY argument has a NULL shape. gcc/testsuite/ChangeLog: PR fortran/108529 * gfortran.dg/pr108529.f90: New test. --- gcc/fortran/simplify.cc | 1 + gcc/testsuite/gfortran.dg/pr108529.f90 | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr108529.f90 (limited to 'gcc') diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc index f413f13..20ea38e 100644 --- a/gcc/fortran/simplify.cc +++ b/gcc/fortran/simplify.cc @@ -720,6 +720,7 @@ simplify_transformation (gfc_expr *array, gfc_expr *dim, gfc_expr *mask, size_zero = gfc_is_size_zero_array (array); if (!(is_constant_array_expr (array) || size_zero) + || array->shape == NULL || !gfc_is_constant_expr (dim)) return NULL; diff --git a/gcc/testsuite/gfortran.dg/pr108529.f90 b/gcc/testsuite/gfortran.dg/pr108529.f90 new file mode 100644 index 0000000..34c9691 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr108529.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! PR fortran/108529 - ICE in transformational_result +! Contributed by G.Steinmetz + +program p + integer, parameter :: a(*,*) = reshape([1, 2, 3, 4], [2, 2]) + logical, parameter :: b(2,*) = a > 2 ! { dg-error "Assumed size" } + logical, parameter :: c(*) = all(b, 1) ! { dg-error "Bad shape" } +end -- cgit v1.1 From 265a749f290f7c6adc9a3aaa9c585b498a8a38ea Mon Sep 17 00:00:00 2001 From: "Vladimir N. Makarov" Date: Tue, 24 Jan 2023 16:10:59 -0500 Subject: LRA: Always do elimination and only for hard register to check insn constraints LRA does elimination but not always checks insn constraints in this case. This results in LRA failure for PDP11 target whose addition is only 2-op insn. The same might happen for other analogous targets. The patch fixes this problem. PR rtl-optimization/108388 gcc/ChangeLog: * lra-constraints.cc (get_hard_regno): Remove final_p arg. Always do elimination but only for hard register. (operands_match_p, uses_hard_regs_p, process_alt_operands): Adjust calls of get_hard_regno. gcc/testsuite/ChangeLog: * gcc.target/pdp11/pdp11.exp: New. * gcc.target/pdp11/pr108388.c: New. --- gcc/lra-constraints.cc | 20 +++---- gcc/testsuite/gcc.target/pdp11/pdp11.exp | 41 ++++++++++++++ gcc/testsuite/gcc.target/pdp11/pr108388.c | 90 +++++++++++++++++++++++++++++++ 3 files changed, 141 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gcc.target/pdp11/pdp11.exp create mode 100644 gcc/testsuite/gcc.target/pdp11/pr108388.c (limited to 'gcc') diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc index b0b3c5b..7bffbc0 100644 --- a/gcc/lra-constraints.cc +++ b/gcc/lra-constraints.cc @@ -184,12 +184,12 @@ get_try_hard_regno (int regno) return ira_class_hard_regs[rclass][0]; } -/* Return the hard regno of X after removing its subreg. If X is not - a register or a subreg of a register, return -1. If X is a pseudo, - use its assignment. If FINAL_P return the final hard regno which will - be after elimination. */ +/* Return the hard regno of X after removing its subreg. If X is not a + register or a subreg of a register, return -1. If X is a pseudo, use its + assignment. If X is a hard regno, return the final hard regno which will be + after elimination. */ static int -get_hard_regno (rtx x, bool final_p) +get_hard_regno (rtx x) { rtx reg; int hard_regno; @@ -203,7 +203,7 @@ get_hard_regno (rtx x, bool final_p) hard_regno = lra_get_regno_hard_regno (hard_regno); if (hard_regno < 0) return -1; - if (final_p) + if (HARD_REGISTER_NUM_P (REGNO (reg))) hard_regno = lra_get_elimination_hard_regno (hard_regno); if (SUBREG_P (x)) hard_regno += subreg_regno_offset (hard_regno, GET_MODE (reg), @@ -782,7 +782,7 @@ operands_match_p (rtx x, rtx y, int y_hard_regno) { int j; - i = get_hard_regno (x, false); + i = get_hard_regno (x); if (i < 0) goto slow; @@ -1920,7 +1920,7 @@ uses_hard_regs_p (rtx x, HARD_REG_SET set) if (REG_P (x) || SUBREG_P (x)) { - x_hard_regno = get_hard_regno (x, true); + x_hard_regno = get_hard_regno (x); return (x_hard_regno >= 0 && overlaps_hard_reg_set_p (set, mode, x_hard_regno)); } @@ -2078,7 +2078,7 @@ process_alt_operands (int only_alternative) op = no_subreg_reg_operand[nop] = *curr_id->operand_loc[nop]; /* The real hard regno of the operand after the allocation. */ - hard_regno[nop] = get_hard_regno (op, true); + hard_regno[nop] = get_hard_regno (op); operand_reg[nop] = reg = op; biggest_mode[nop] = GET_MODE (op); @@ -2258,7 +2258,7 @@ process_alt_operands (int only_alternative) && curr_operand_mode[m] != curr_operand_mode[nop]) break; - m_hregno = get_hard_regno (*curr_id->operand_loc[m], false); + m_hregno = get_hard_regno (*curr_id->operand_loc[m]); /* We are supposed to match a previous operand. If we do, we win if that one did. If we do not, count both of the operands as losers. diff --git a/gcc/testsuite/gcc.target/pdp11/pdp11.exp b/gcc/testsuite/gcc.target/pdp11/pdp11.exp new file mode 100644 index 0000000..89b1f25 --- /dev/null +++ b/gcc/testsuite/gcc.target/pdp11/pdp11.exp @@ -0,0 +1,41 @@ +# Copyright (C) 2023 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# GCC testsuite that uses the `dg.exp' driver. + +# Exit immediately if this isn't an pdp11 target. +if ![istarget pdp11*-*-*] then { + return +} + +# Load support procs. +load_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ + "" $DEFAULT_CFLAGS + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.target/pdp11/pr108388.c b/gcc/testsuite/gcc.target/pdp11/pr108388.c new file mode 100644 index 0000000..0d54b91 --- /dev/null +++ b/gcc/testsuite/gcc.target/pdp11/pr108388.c @@ -0,0 +1,90 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mlra" } */ + +typedef int SItype __attribute__ ((mode (SI))); +typedef unsigned int USItype __attribute__ ((mode (SI))); +typedef int DItype __attribute__ ((mode (DI))); +typedef unsigned int UDItype __attribute__ ((mode (DI))); +extern DItype __mulvdi3 (DItype, DItype); +struct DWstruct {SItype high, low;}; + +typedef union { + struct DWstruct s; + DItype ll; +} DWunion; + +DItype __mulvdi3 (DItype u, DItype v) { + const DWunion uu = {.ll = u}; + const DWunion vv = {.ll = v}; + + if (__builtin_expect (uu.s.high == uu.s.low >> ((4 * 8) - 1), 1)) { + if (__builtin_expect (vv.s.high == vv.s.low >> ((4 * 8) - 1), 1)) { + return (DItype) uu.s.low * (DItype) vv.s.low; + } else { + DWunion w0 = {.ll = (UDItype) (USItype) uu.s.low * (UDItype) (USItype) vv.s.low}; + DWunion w1 = {.ll = (UDItype) (USItype) uu.s.low * (UDItype) (USItype) vv.s.high}; + + if (vv.s.high < 0) + w1.s.high -= uu.s.low; + if (uu.s.low < 0) + w1.ll -= vv.ll; + w1.ll += (USItype) w0.s.high; + if (__builtin_expect (w1.s.high == w1.s.low >> ((4 * 8) - 1), 1)) { + w0.s.high = w1.s.low; + return w0.ll; + } + } + } else { + if (__builtin_expect (vv.s.high == vv.s.low >> ((4 * 8) - 1), 1)) { + DWunion w0 = {.ll = (UDItype) (USItype) uu.s.low * (UDItype) (USItype) vv.s.low}; + DWunion w1 = {.ll = (UDItype) (USItype) uu.s.high * (UDItype) (USItype) vv.s.low}; + + if (uu.s.high < 0) + w1.s.high -= vv.s.low; + if (vv.s.low < 0) + w1.ll -= uu.ll; + w1.ll += (USItype) w0.s.high; + if (__builtin_expect (w1.s.high == w1.s.low >> ((4 * 8) - 1), 1)) { + w0.s.high = w1.s.low; + return w0.ll; + } + } else { + if (uu.s.high >= 0) { + if (vv.s.high >= 0) { + if (uu.s.high == 0 && vv.s.high == 0) { + const DItype w = (UDItype) (USItype) uu.s.low * (UDItype) (USItype) vv.s.low; + if (__builtin_expect (w >= 0, 1)) + return w; + } + } else { + if (uu.s.high == 0 && vv.s.high == (SItype) -1) { + DWunion ww = {.ll = (UDItype) (USItype) uu.s.low * (UDItype) (USItype) vv.s.low}; + ww.s.high -= uu.s.low; + if (__builtin_expect (ww.s.high < 0, 1)) + return ww.ll; + } + } + } else { + if (vv.s.high >= 0) { + if (uu.s.high == (SItype) -1 && vv.s.high == 0) { + DWunion ww = {.ll = (UDItype) (USItype) uu.s.low * (UDItype) (USItype) vv.s.low}; + + ww.s.high -= vv.s.low; + if (__builtin_expect (ww.s.high < 0, 1)) + return ww.ll; + } + } else { + if ((uu.s.high & vv.s.high) == (SItype) -1 && (uu.s.low | vv.s.low) != 0) { + DWunion ww = {.ll = (UDItype) (USItype) uu.s.low * (UDItype) (USItype) vv.s.low}; + + ww.s.high -= uu.s.low; + ww.s.high -= vv.s.low; + if (__builtin_expect (ww.s.high >= 0, 1)) + return ww.ll; + } + } + } + } + } + __builtin_trap (); +} -- cgit v1.1 From 1c407dc088231ba5f2cc63d9278f4b797db48de1 Mon Sep 17 00:00:00 2001 From: Takayuki 'January June' Suwa Date: Fri, 20 Jan 2023 12:33:37 +0900 Subject: xtensa: Revise complex hard register clobber elimination In the previously posted patch "xtensa: Make complex hard register clobber elimination more robust and accurate", the check code for insns that refer to the [DS]Cmode hard register before it is overwritten after it is clobbered is incomplete. Fortunately such insns are seldom emitted, so it didn't matter. This patch fixes that for the sake of completeness. gcc/ChangeLog: * config/xtensa/xtensa.md: Fix exit from loops detecting references before overwriting in the split pattern. --- gcc/config/xtensa/xtensa.md | 72 +++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 35 deletions(-) (limited to 'gcc') diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index dd3fc37..d3996b2 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -2973,45 +2973,47 @@ { auto_sbitmap bmp (FIRST_PSEUDO_REGISTER); rtx_insn *insn; - rtx reg = gen_rtx_REG (SImode, 0); + rtx reg = gen_rtx_REG (SImode, 0), dest; + unsigned int regno; + sbitmap_iterator iter; bitmap_set_range (bmp, REGNO (operands[0]), REG_NREGS (operands[0])); for (insn = next_nonnote_nondebug_insn_bb (curr_insn); insn; insn = next_nonnote_nondebug_insn_bb (insn)) - { - sbitmap_iterator iter; - unsigned int regno; - if (NONJUMP_INSN_P (insn)) - { - EXECUTE_IF_SET_IN_BITMAP (bmp, 2, regno, iter) - { - set_regno_raw (reg, regno, REG_NREGS (reg)); - if (reg_overlap_mentioned_p (reg, PATTERN (insn))) - break; - } - if (GET_CODE (PATTERN (insn)) == SET) - { - rtx x = SET_DEST (PATTERN (insn)); - if (REG_P (x) && HARD_REGISTER_P (x)) - bitmap_clear_range (bmp, REGNO (x), REG_NREGS (x)); - else if (SUBREG_P (x) && HARD_REGISTER_P (SUBREG_REG (x))) - { - struct subreg_info info; - subreg_get_info (regno = REGNO (SUBREG_REG (x)), - GET_MODE (SUBREG_REG (x)), - SUBREG_BYTE (x), GET_MODE (x), &info); - if (!info.representable_p) - break; - bitmap_clear_range (bmp, regno + info.offset, info.nregs); - } - } - if (bitmap_empty_p (bmp)) - goto FALLTHRU; - } - else if (CALL_P (insn)) + if (NONJUMP_INSN_P (insn)) + { EXECUTE_IF_SET_IN_BITMAP (bmp, 2, regno, iter) - if (call_used_or_fixed_reg_p (regno)) - break; - } + { + set_regno_raw (reg, regno, REG_NREGS (reg)); + if (reg_referenced_p (reg, PATTERN (insn))) + goto ABORT; + } + if (GET_CODE (PATTERN (insn)) == SET + || GET_CODE (PATTERN (insn)) == CLOBBER) + { + dest = SET_DEST (PATTERN (insn)); + if (REG_P (dest) && HARD_REGISTER_P (dest)) + bitmap_clear_range (bmp, REGNO (dest), REG_NREGS (dest)); + else if (SUBREG_P (dest) + && HARD_REGISTER_P (SUBREG_REG (dest))) + { + struct subreg_info info; + subreg_get_info (regno = REGNO (SUBREG_REG (dest)), + GET_MODE (SUBREG_REG (dest)), + SUBREG_BYTE (dest), GET_MODE (dest), + &info); + if (!info.representable_p) + break; + bitmap_clear_range (bmp, regno + info.offset, info.nregs); + } + } + if (bitmap_empty_p (bmp)) + goto FALLTHRU; + } + else if (CALL_P (insn)) + EXECUTE_IF_SET_IN_BITMAP (bmp, 2, regno, iter) + if (call_used_or_fixed_reg_p (regno)) + goto ABORT; +ABORT: FAIL; FALLTHRU:; }) -- cgit v1.1 From 39ade88fa1632c659c5c4ed065fa2b62d16a8670 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 24 Jan 2023 15:29:35 -0500 Subject: c++: static lambda in template [PR108526] tsubst_lambda_expr uses build_memfn_type to build a METHOD_TYPE for the new lamba op(). This is not what we want for a C++23 static op(), but since we also use that METHOD_TYPE to communicate the closure type down to tsubst_function_decl, let's wait and turn it back at that point. PR c++/108526 gcc/cp/ChangeLog: * pt.cc (tsubst_function_decl): Handle static lambda. gcc/testsuite/ChangeLog: * g++.dg/cpp23/static-operator-call5.C: New test. --- gcc/cp/pt.cc | 5 +++++ gcc/testsuite/g++.dg/cpp23/static-operator-call5.C | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp23/static-operator-call5.C (limited to 'gcc') diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 2a4d03c..51fc246 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -14306,6 +14306,11 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain, tree ctx = closure ? closure : DECL_CONTEXT (t); bool member = ctx && TYPE_P (ctx); + /* If this is a static lambda, remove the 'this' pointer added in + tsubst_lambda_expr now that we know the closure type. */ + if (lambda_fntype && DECL_STATIC_FUNCTION_P (t)) + lambda_fntype = static_fn_type (lambda_fntype); + if (member && !closure) ctx = tsubst_aggr_type (ctx, args, complain, t, /*entering_scope=*/1); diff --git a/gcc/testsuite/g++.dg/cpp23/static-operator-call5.C b/gcc/testsuite/g++.dg/cpp23/static-operator-call5.C new file mode 100644 index 0000000..ae022d0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/static-operator-call5.C @@ -0,0 +1,8 @@ +// PR c++/108526 +// { dg-do compile { target c++23 } } + +template void f() +{ + auto a = [] (auto x) static { return x; }; +} +template void f(); -- cgit v1.1 From 327d45c57ebd2655a7599df0f01b8b5e2f82eda7 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 24 Jan 2023 16:26:50 -0500 Subject: c++: "" #pragma at BOF [PR108504] Since r11-2095 we pass flags to cp_lexer_get_preprocessor_token, and cp_lexer_new_main passes C_LEX_STRING_NO_JOIN when lexing most of the translation unit, but doesn't do that for the very first token; as a result, if the first token is a string literal, we try to join strings and get confused if that encounters a pragma. PR c++/108504 gcc/cp/ChangeLog: * parser.cc (cp_lexer_new_main): Pass C_LEX_STRING_NO_JOIN for first token, too. gcc/testsuite/ChangeLog: * g++.dg/ext/pragma1.C: New test. --- gcc/cp/parser.cc | 2 +- gcc/testsuite/g++.dg/ext/pragma1.C | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/ext/pragma1.C (limited to 'gcc') diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index b38c22e..07ec0e1 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -705,7 +705,7 @@ cp_lexer_new_main (void) /* It's possible that parsing the first pragma will load a PCH file, which is a GC collection point. So we have to do that before allocating any memory. */ - cp_lexer_get_preprocessor_token (0, &token); + cp_lexer_get_preprocessor_token (C_LEX_STRING_NO_JOIN, &token); cp_parser_initial_pragma (&token); c_common_no_more_pch (); diff --git a/gcc/testsuite/g++.dg/ext/pragma1.C b/gcc/testsuite/g++.dg/ext/pragma1.C new file mode 100644 index 0000000..bb258da --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/pragma1.C @@ -0,0 +1,4 @@ +// PR c++/108504 + +"1" // { dg-error "" } +#pragma GCC diagnostic push -- cgit v1.1 From f235d695729cc745cf15a00fb8b2cfaded80fd1e Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Tue, 24 Jan 2023 22:41:45 +0000 Subject: Introduce new module to create search paths of dynamic strings. Introduce a simple DynamicStringPath module to allow the front end to create and modify a search path from dynamic strings. gcc/m2/ChangeLog: * Make-lang.in (GM2-COMP-BOOT-DEFS): Add DynamicStringPath.def. (GM2-COMP-BOOT-MODS): Add DynamicStringPath.mod. (GM2-COMP-DEFS): Add DynamicStringPath.def. (GM2-COMP-MODS): Add DynamicStringPath.mod. ($(objdir)/m2/gm2-libs-min/SYSTEM.def): Split path into multiple -I components. ($(objdir)/m2/gm2-libs/SYSTEM.def): Ditto. ($(objdir)/m2/gm2-libs-coroutines/SYSTEM.def): Ditto. * gm2-compiler/M2Options.mod: Import DynamicStringPath. (SetSearchPath): Reimplement using DynamicStringPath procedures. * gm2-compiler/M2Search.def (InitSearchPath): Remove. (PrependSearchPath): Remove. * gm2-compiler/M2Search.mod (SFIO): Remove import. (DynamicStringPath): Add import. (Directory): Remove. (UserPath): Remove. (InitialPath): Remove. (InitSearchPath): Remove. (PrependSearchPath): Remove. (FindSourceFile): Re-implement. (FindSourceDefFile): Re-implement. (FindSourceModFile): Re-implement. * gm2-gcc/init.cc (_M2_DynamicStringPath_init): New prototype. (init_FrontEndInit): Call _M2_DynamicStringPath_init. * tools-src/makeSystem: Allow multiple -I paths. * gm2-compiler/DynamicStringPath.def: New file. * gm2-compiler/DynamicStringPath.mod: New file. * gm2-gcc/m2options.h (M2Options_SetMakeIncludePath): Add prototype. Co-Authored by: Iain Sandoe libgm2/ChangeLog: * libm2cor/Makefile.am (SYSTEM.def): Split path into multiple -I components. * libm2cor/Makefile.in: Rebuild. * libm2min/Makefile.am (SYSTEM.def): Split path into multiple -I components. * libm2min/Makefile.in: Rebuild. * libm2iso/Makefile.am (SYSTEM.def): Split path into multiple -I components. * libm2iso/Makefile.in: Rebuild. Co-Authored by: Iain Sandoe Signed-off-by: Gaius Mulley --- gcc/m2/Make-lang.in | 10 +- gcc/m2/gm2-compiler/DynamicStringPath.def | 113 +++++++++++++ gcc/m2/gm2-compiler/DynamicStringPath.mod | 265 ++++++++++++++++++++++++++++++ gcc/m2/gm2-compiler/M2Options.mod | 12 +- gcc/m2/gm2-compiler/M2Search.def | 25 --- gcc/m2/gm2-compiler/M2Search.mod | 131 +++------------ gcc/m2/gm2-gcc/init.cc | 2 + gcc/m2/gm2-gcc/m2options.h | 1 - gcc/m2/tools-src/makeSystem | 17 +- 9 files changed, 429 insertions(+), 147 deletions(-) create mode 100644 gcc/m2/gm2-compiler/DynamicStringPath.def create mode 100644 gcc/m2/gm2-compiler/DynamicStringPath.mod (limited to 'gcc') diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in index 00cca7d..0d3ff23 100644 --- a/gcc/m2/Make-lang.in +++ b/gcc/m2/Make-lang.in @@ -690,6 +690,7 @@ GM2-COMP-BOOT-DEFS = \ M2DebugStack.def \ M2Defaults.def \ M2DriverOptions.def \ + DynamicStringPath.def \ M2Emit.def \ M2Error.def \ M2EvalSym.def \ @@ -761,6 +762,7 @@ GM2-COMP-BOOT-MODS = \ M2DebugStack.mod \ M2Defaults.mod \ M2DriverOptions.mod \ + DynamicStringPath.mod \ M2Emit.mod \ M2Error.mod \ M2FileName.mod \ @@ -965,6 +967,7 @@ GM2-COMP-DEFS = \ M2DebugStack.def \ M2Defaults.def \ M2DriverOptions.def \ + DynamicStringPath.def \ M2Emit.def \ M2Error.def \ M2FileName.def \ @@ -1032,6 +1035,7 @@ GM2-COMP-MODS = \ M2DebugStack.mod \ M2Defaults.mod \ M2DriverOptions.mod \ + DynamicStringPath.mod \ M2Emit.mod \ M2Error.mod \ M2FileName.mod \ @@ -1522,7 +1526,7 @@ $(objdir)/m2/gm2-libs-min/SYSTEM.def: $(GM2_PROG_DEP) $(SHELL) $(srcdir)/m2/tools-src/makeSystem -fpim \ $(srcdir)/m2/gm2-libs-min/SYSTEM.def \ $(srcdir)/m2/gm2-libs-min/SYSTEM.mod \ - -I$(srcdir)/m2/gm2-libs-min:$(srcdir)/m2/gm2-libs \ + -I$(srcdir)/m2/gm2-libs-min -I$(srcdir)/m2/gm2-libs \ "$(GM2_FOR_TARGET)" $@ $(objdir)/m2/gm2-libs/SYSTEM.def: $(GM2_PROG_DEP) @@ -1540,7 +1544,7 @@ $(objdir)/m2/gm2-libs-iso/SYSTEM.def: $(GM2_PROG_DEP) $(SHELL) $(srcdir)/m2/tools-src/makeSystem -fiso \ $(srcdir)/m2/gm2-libs-iso/SYSTEM.def \ $(srcdir)/m2/gm2-libs-iso/SYSTEM.mod \ - -I$(srcdir)/m2/gm2-libs-iso:$(srcdir)/m2/gm2-libs \ + -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs \ "$(GM2_FOR_TARGET)" $@ $(objdir)/m2/gm2-libs-coroutines/SYSTEM.def: $(GM2_PROG_DEP) @@ -1548,7 +1552,7 @@ $(objdir)/m2/gm2-libs-coroutines/SYSTEM.def: $(GM2_PROG_DEP) $(SHELL) $(srcdir)/m2/tools-src/makeSystem -fpim \ $(srcdir)/m2/gm2-libs-coroutines/SYSTEM.def \ $(srcdir)/m2/gm2-libs-coroutines/SYSTEM.mod \ - -I$(srcdir)/m2/gm2-libs-coroutines:$(srcdir)/m2/gm2-libs-iso:$(srcdir)/m2/gm2-libs \ + -I$(srcdir)/m2/gm2-libs-coroutines -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs \ "$(GM2_FOR_TARGET)" $@ build-compiler: $(GM2-COMP-MODS:%.mod=m2/gm2-compiler/%.o) \ diff --git a/gcc/m2/gm2-compiler/DynamicStringPath.def b/gcc/m2/gm2-compiler/DynamicStringPath.def new file mode 100644 index 0000000..e9fdff7 --- /dev/null +++ b/gcc/m2/gm2-compiler/DynamicStringPath.def @@ -0,0 +1,113 @@ +(* DynamicStringPath.def implements a path for DynamicStrings. + +Copyright (C) 2001-2023 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. *) + +DEFINITION MODULE DynamicStringPath ; (*!m2iso+gm2*) + +FROM DynamicStrings IMPORT String ; + +TYPE + PathList ; + + +(* + GetUserPath - returns the current UserPath. +*) + +PROCEDURE GetUserPath () : PathList ; + + +(* + GetSystemPath - returns the current SystemPath. +*) + +PROCEDURE GetSystemPath () : PathList ; + + +(* + SetUserPath - assigns UserPath to pl. +*) + +PROCEDURE SetUserPath (pl: PathList) ; + + +(* + SetSystemPath - assigns SystemPath to pl. +*) + +PROCEDURE SetSystemPath (pl: PathList) ; + + +(* + InitPathList - creates a new empty path list. +*) + +PROCEDURE InitPathList (str: String) : PathList ; + + +(* + KillPathList - places list pl onto the freelist. + Postcondition: pl will be NIL. +*) + +PROCEDURE KillPathList (VAR pl: PathList) ; + + +(* + Cons - appends str to the end of a path list. + If pl is NIL a new list is created and returned + containing str. +*) + +PROCEDURE Cons (pl: PathList; str: String) : PathList ; + + +(* + ConsList - concatenates path list left and right together. + It always returns NIL which should be assigned + to the callers right parameter after ConsList + has been completed signifying that right should + no longer be accessed. +*) + +PROCEDURE ConsList (left, right: PathList) : PathList ; + + +(* + Stash - returns pl before setting pl to NIL. +*) + +PROCEDURE Stash (VAR pl: PathList) : PathList ; + + +(* + FindFileName - returns NIL if a file cannot be found otherwise + it returns the path including the filename. +*) + +PROCEDURE FindFileName (filename: String; pl: PathList) : String ; + + +END DynamicStringPath. diff --git a/gcc/m2/gm2-compiler/DynamicStringPath.mod b/gcc/m2/gm2-compiler/DynamicStringPath.mod new file mode 100644 index 0000000..601456e --- /dev/null +++ b/gcc/m2/gm2-compiler/DynamicStringPath.mod @@ -0,0 +1,265 @@ +(* DynamicStringPath.def implements a path for DynamicStrings. + +Copyright (C) 2001-2023 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. *) + +IMPLEMENTATION MODULE DynamicStringPath ; (*!m2iso+gm2*) + +FROM Storage IMPORT ALLOCATE, DEALLOCATE ; +FROM DynamicStrings IMPORT InitString, ConCat, ConCatChar, char, Dup, + KillString, Length ; +FROM SFIO IMPORT Exists ; +FROM FIO IMPORT StdErr ; +FROM M2Printf IMPORT fprintf0, fprintf1 ; + +CONST + Directory = '/' ; + Debugging = FALSE ; + +TYPE + PathList = POINTER TO RECORD + tail, + next : PathList ; + entry: String ; + END ; + + +VAR + FreeList, + DefaultUserPath, + DefaultSystemPath: PathList ; + + +(* + GetUserPath - returns the current UserPath. +*) + +PROCEDURE GetUserPath () : PathList ; +BEGIN + RETURN DefaultUserPath +END GetUserPath ; + + +(* + GetSystemPath - returns the current SystemPath. +*) + +PROCEDURE GetSystemPath () : PathList ; +BEGIN + RETURN DefaultSystemPath +END GetSystemPath ; + + +(* + SetUserPath - assigns UserPath to pl. +*) + +PROCEDURE SetUserPath (pl: PathList) ; +BEGIN + DefaultUserPath := pl ; + DumpPath ('DefaultUserPath', DefaultUserPath) +END SetUserPath ; + + +(* + SetSystemPath - assigns SystemPath to pl. +*) + +PROCEDURE SetSystemPath (pl: PathList) ; +BEGIN + DefaultSystemPath := pl ; + DumpPath ('DefaultSystemPath', DefaultSystemPath) +END SetSystemPath ; + + +(* + KillPathList - places list pl onto the freelist. + Postcondition: pl will be NIL. +*) + +PROCEDURE KillPathList (VAR pl: PathList) ; +BEGIN + IF pl # NIL + THEN + pl^.tail^.next := FreeList ; + FreeList := pl ; + pl := NIL + END +END KillPathList ; + + +(* + InitPathList - creates a new empty path list. + It takes a copy of the string. +*) + +PROCEDURE InitPathList (str: String) : PathList ; +VAR + pl: PathList ; +BEGIN + NEW (pl) ; + WITH pl^ DO + tail := pl ; + next := NIL ; + entry := Dup (str) + END ; + RETURN pl +END InitPathList ; + + +(* + Cons - appends str to the end of a path list. + If pl is NIL a new list is created and returned + containing str. +*) + +PROCEDURE Cons (pl: PathList; str: String) : PathList ; +BEGIN + IF pl = NIL + THEN + pl := InitPathList (str) + ELSE + pl := ConsList (pl, InitPathList (str)) + END ; + RETURN pl +END Cons ; + + +(* + ConsList - concatenates path list left and right together. + It always returns NIL which should be assigned + to the callers right parameter after ConsList + has been completed signifying that right should + no longer be accessed. +*) + +PROCEDURE ConsList (left, right: PathList) : PathList ; +BEGIN + IF right # NIL + THEN + left^.tail^.next := right ; + left^.tail := right^.tail + END ; + RETURN left +END ConsList ; + + +(* + Stash - returns pl before setting pl to NIL. +*) + +PROCEDURE Stash (VAR pl: PathList) : PathList ; +VAR + old: PathList ; +BEGIN + old := pl ; + pl := NIL ; + RETURN old +END Stash ; + + +(* + AddDir - if str is not empty and does not end with / then add + a directory. + Postcondition: str is returned (with a '/' at the end) + or is empty. +*) + +PROCEDURE AddDir (str: String) : String ; +BEGIN + IF Length (str) > 0 + THEN + IF char (str, -1) # Directory + THEN + str := ConCatChar (str, Directory) + END + END ; + RETURN str +END AddDir ; + + +(* + FindFileName - returns NIL if a file cannot be found otherwise + it returns the path including the filename. +*) + +PROCEDURE FindFileName (filename: String; pl: PathList) : String ; +VAR + s: String ; +BEGIN + WHILE pl # NIL DO + s := ConCat (AddDir (Dup (pl^.entry)), Dup (filename)) ; + IF Debugging + THEN + fprintf1 (StdErr, "testing for %s: ", s) + END ; + IF Exists (s) + THEN + IF Debugging + THEN + fprintf0 (StdErr, "yes\n") + END ; + RETURN s + END ; + IF Debugging + THEN + fprintf0 (StdErr, "no\n") + END ; + s := KillString (s) ; + pl := pl^.next + END ; + IF Debugging + THEN + fprintf1 (StdErr, "FindFileName did not find: %s in path\n", filename) + END ; + RETURN NIL +END FindFileName ; + + +(* + DumpPath - debugging dump of the pathlist. +*) + +PROCEDURE DumpPath (name: ARRAY OF CHAR; pl: PathList) ; +BEGIN + IF Debugging + THEN + fprintf0 (StdErr, name) ; + fprintf0 (StdErr, ":") ; + WHILE pl # NIL DO + fprintf0 (StdErr, " {") ; + fprintf1 (StdErr, "%s", pl^.entry) ; + fprintf0 (StdErr, "}") ; + pl := pl^.next + END ; + fprintf0 (StdErr, "\n") + END +END DumpPath ; + + +BEGIN + DefaultSystemPath := NIL ; + DefaultUserPath := NIL ; + FreeList := NIL +END DynamicStringPath. diff --git a/gcc/m2/gm2-compiler/M2Options.mod b/gcc/m2/gm2-compiler/M2Options.mod index f046e29..14e978a 100644 --- a/gcc/m2/gm2-compiler/M2Options.mod +++ b/gcc/m2/gm2-compiler/M2Options.mod @@ -24,8 +24,10 @@ IMPLEMENTATION MODULE M2Options ; IMPORT CmdArgs ; FROM SArgs IMPORT GetArg, Narg ; -FROM M2Search IMPORT PrependSearchPath, SetDefExtension, SetModExtension ; -FROM M2Printf IMPORT printf0, printf1 ; +FROM M2Search IMPORT SetDefExtension, SetModExtension ; +FROM DynamicStringPath IMPORT Cons, GetUserPath, SetUserPath, Cons ; +FROM M2Printf IMPORT printf0, printf1, fprintf1 ; +FROM FIO IMPORT StdErr ; FROM libc IMPORT exit ; FROM Debug IMPORT Halt ; FROM m2linemap IMPORT location_t ; @@ -789,10 +791,10 @@ BEGIN s := InitStringCharStar(arg) ; IF Debugging THEN - printf1("setting search path to: %s\n", s) + fprintf1 (StdErr, "M2Search.SetSearchPath setting search path to: %s\n", s) END ; - PrependSearchPath(s) ; - s := KillString(s) + SetUserPath (Cons (GetUserPath (), s)) ; + s := KillString (s) END SetSearchPath ; diff --git a/gcc/m2/gm2-compiler/M2Search.def b/gcc/m2/gm2-compiler/M2Search.def index 9bed7eb..3d17237 100644 --- a/gcc/m2/gm2-compiler/M2Search.def +++ b/gcc/m2/gm2-compiler/M2Search.def @@ -31,31 +31,6 @@ DEFINITION MODULE M2Search ; *) FROM DynamicStrings IMPORT String ; -EXPORT QUALIFIED InitSearchPath, PrependSearchPath, FindSourceFile, - FindSourceDefFile, FindSourceModFile, - SetDefExtension, SetModExtension ; - - -(* - InitSearchPath - assigns the search path to Path. - The string Path may take the form: - - Path ::= IndividualPath { ":" IndividualPath } - IndividualPath ::= "." | DirectoryPath - DirectoryPath ::= [ "/" ] Name { "/" Name } - Name ::= Letter { (Letter | Number) } - Letter ::= A..Z | a..z - Number ::= 0..9 -*) - -PROCEDURE InitSearchPath (Path: String) ; - - -(* - PrependSearchPath - prepends a new path to the initial search path. -*) - -PROCEDURE PrependSearchPath (path: String) ; (* diff --git a/gcc/m2/gm2-compiler/M2Search.mod b/gcc/m2/gm2-compiler/M2Search.mod index e2dd82d..cc61ebf 100644 --- a/gcc/m2/gm2-compiler/M2Search.mod +++ b/gcc/m2/gm2-compiler/M2Search.mod @@ -22,9 +22,9 @@ along with GNU Modula-2; see the file COPYING3. If not see IMPLEMENTATION MODULE M2Search ; -FROM SFIO IMPORT Exists ; FROM M2FileName IMPORT CalculateFileName ; FROM Assertion IMPORT Assert ; +FROM DynamicStringPath IMPORT GetUserPath, GetSystemPath, FindFileName ; FROM DynamicStrings IMPORT InitString, InitStringChar, KillString, ConCat, ConCatChar, Index, Slice, @@ -35,13 +35,10 @@ FROM DynamicStrings IMPORT InitString, InitStringChar, CONST - Directory = '/' ; GarbageDebugging = FALSE ; VAR - Def, Mod, - UserPath, - InitialPath: String ; + Def, Mod: String ; (* Internal garbage collection debugging routines. *) @@ -110,24 +107,6 @@ END DSdbExit ; (* - PrependSearchPath - prepends a new path to the initial search path. -*) - -PROCEDURE PrependSearchPath (path: String) ; -BEGIN - DSdbEnter ; - IF EqualArray(UserPath, '') - THEN - UserPath := KillString(UserPath) ; - UserPath := Dup(path) - ELSE - UserPath := ConCat(ConCatChar(UserPath, ':'), path) - END ; - DSdbExit (UserPath) -END PrependSearchPath ; - - -(* FindSourceFile - attempts to locate the source file FileName. If a file is found then TRUE is returned otherwise FALSE is returned. @@ -143,55 +122,13 @@ END PrependSearchPath ; PROCEDURE FindSourceFile (FileName: String; VAR FullPath: String) : BOOLEAN ; -VAR - CompleteSearchPath: String ; - start, end : INTEGER ; - newpath : String ; BEGIN - IF EqualArray(UserPath, '') + FullPath := FindFileName (FileName, GetUserPath ()) ; + IF FullPath = NIL THEN - IF EqualArray(InitialPath, '') - THEN - CompleteSearchPath := InitString('.') - ELSE - CompleteSearchPath := Dup(InitialPath) - END - ELSE - CompleteSearchPath := ConCat(ConCatChar(Dup(UserPath), ':'), InitialPath) + FullPath := FindFileName (FileName, GetSystemPath ()) END ; - start := 0 ; - end := Index(CompleteSearchPath, ':', CARDINAL(start)) ; - REPEAT - IF end=-1 - THEN - end := 0 - END ; - newpath := Slice(CompleteSearchPath, start, end) ; - IF EqualArray(newpath, '.') - THEN - newpath := KillString(newpath) ; - newpath := Dup(FileName) - ELSE - newpath := ConCat(ConCatChar(newpath, Directory), FileName) - END ; - IF Exists(newpath) - THEN - FullPath := newpath ; - CompleteSearchPath := KillString(CompleteSearchPath) ; - RETURN( TRUE ) - END ; - newpath := KillString(newpath) ; - IF end#0 - THEN - start := end+1 ; - end := Index(CompleteSearchPath, ':', CARDINAL(start)) - END - UNTIL end=0 ; - - FullPath := NIL ; - newpath := KillString(newpath) ; - CompleteSearchPath := KillString(CompleteSearchPath) ; - RETURN( FALSE ) + RETURN FullPath # NIL END FindSourceFile ; @@ -206,18 +143,18 @@ PROCEDURE FindSourceDefFile (Stem: String; VAR FullPath: String) : BOOLEAN ; VAR f: String ; BEGIN - IF Def#NIL + IF Def # NIL THEN - f := CalculateFileName(Stem, Def) ; - IF FindSourceFile(f, FullPath) + f := CalculateFileName (Stem, Def) ; + IF FindSourceFile (f, FullPath) THEN - RETURN( TRUE ) + RETURN TRUE END ; - f := KillString(f) + f := KillString (f) END ; - (* and try the GNU Modula-2 default extension *) - f := CalculateFileName(Stem, Mark(InitString('def'))) ; - RETURN( FindSourceFile(f, FullPath) ) + (* Try the GNU Modula-2 default extension. *) + f := CalculateFileName (Stem, Mark(InitString ('def'))) ; + RETURN FindSourceFile (f, FullPath) END FindSourceDefFile ; @@ -234,16 +171,16 @@ VAR BEGIN IF Mod#NIL THEN - f := CalculateFileName(Stem, Mod) ; - IF FindSourceFile(f, FullPath) + f := CalculateFileName (Stem, Mod) ; + IF FindSourceFile (f, FullPath) THEN - RETURN( TRUE ) + RETURN TRUE END ; - f := KillString(f) + f := KillString (f) END ; - (* and try the GNU Modula-2 default extension *) - f := CalculateFileName(Stem, Mark(InitString('mod'))) ; - RETURN( FindSourceFile(f, FullPath) ) + (* Try the GNU Modula-2 default extension. *) + f := CalculateFileName (Stem, Mark(InitString ('mod'))) ; + RETURN FindSourceFile (f, FullPath) END FindSourceModFile ; @@ -274,35 +211,11 @@ END SetModExtension ; (* - InitSearchPath - assigns the search path to Path. - The string Path may take the form: - - Path ::= IndividualPath { ":" IndividualPath } - IndividualPath ::= "." | DirectoryPath - DirectoryPath ::= [ "/" ] Name { "/" Name } - Name ::= Letter { (Letter | Number) } - Letter ::= A..Z | a..z - Number ::= 0..9 -*) - -PROCEDURE InitSearchPath (Path: String) ; -BEGIN - IF InitialPath#NIL - THEN - InitialPath := KillString(InitialPath) - END ; - InitialPath := Path -END InitSearchPath ; - - -(* - Init - initializes the search path. + Init - initializes the def and mod default string names to NIL. *) PROCEDURE Init ; BEGIN - UserPath := InitString('') ; - InitialPath := InitStringChar('.') ; Def := NIL ; Mod := NIL END Init ; diff --git a/gcc/m2/gm2-gcc/init.cc b/gcc/m2/gm2-gcc/init.cc index 42d8151..a9dfcc7 100644 --- a/gcc/m2/gm2-gcc/init.cc +++ b/gcc/m2/gm2-gcc/init.cc @@ -55,6 +55,7 @@ EXTERN void _M2_CmdArgs_init (int argc, char *argv[], char *envp[]); EXTERN void _M2_M2Preprocess_init (int argc, char *argv[], char *envp[]); EXTERN void _M2_M2Error_init (int argc, char *argv[], char *envp[]); EXTERN void _M2_M2Search_init (int argc, char *argv[], char *envp[]); +EXTERN void _M2_DynamicStringPath_init (int argc, char *argv[], char *envp[]); EXTERN void _M2_Indexing_init (int argc, char *argv[], char *envp[]); EXTERN void _M2_NameKey_init (int argc, char *argv[], char *envp[]); EXTERN void _M2_NumberIO_init (int argc, char *argv[], char *envp[]); @@ -141,6 +142,7 @@ init_FrontEndInit (void) _M2_StrLib_init (0, NULL, NULL); _M2_dtoa_init (0, NULL, NULL); _M2_ldtoa_init (0, NULL, NULL); + _M2_DynamicStringPath_init (0, NULL, NULL); _M2_M2Search_init (0, NULL, NULL); _M2_M2Options_init (0, NULL, NULL); } diff --git a/gcc/m2/gm2-gcc/m2options.h b/gcc/m2/gm2-gcc/m2options.h index 80c7968..9cccb37 100644 --- a/gcc/m2/gm2-gcc/m2options.h +++ b/gcc/m2/gm2-gcc/m2options.h @@ -38,7 +38,6 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "input.h" -EXTERN void M2Options_SetMakeIncludePath (const char *arg); EXTERN void M2Options_SetSearchPath (const char *arg); EXTERN void M2Options_setdefextension (const char *arg); EXTERN void M2Options_setmodextension (const char *arg); diff --git a/gcc/m2/tools-src/makeSystem b/gcc/m2/tools-src/makeSystem index 49b58a2..b1156b5 100644 --- a/gcc/m2/tools-src/makeSystem +++ b/gcc/m2/tools-src/makeSystem @@ -23,7 +23,7 @@ Usage () { - echo "Usage: makesystem dialectflag SYSTEM.def SYSTEM.mod librarypath compiler" + echo "Usage: makesystem dialectflag SYSTEM.def SYSTEM.mod { librarypath } compiler" } if [ $# -lt 6 ] ; then @@ -34,9 +34,18 @@ fi DIALECT=$1 SYSTEMDEF=$2 SYSTEMMOD=$3 -LIBRARY=$4 -COMPILER=$5 -OUTPUTFILE=$6 +shift 3 +LIBRARY="" +while [ $# -gt 2 ] ; do + if [ "$LIBRARY" = "" ] ; then + LIBRARY=$1 + else + LIBRARY="${LIBRARY} $1" + fi + shift +done +COMPILER=$1 +OUTPUTFILE=$2 if [ "$COMPILER" = "" ] ; then echo "parameter 5 of makeSystem is incorrect, GM2_FOR_TARGET was unset" -- cgit v1.1 From aba6416e95ab4138a0ecab0fd51e7e9329d74a45 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 25 Jan 2023 00:12:46 +0100 Subject: testsuite: Fix up new51.C test on various targets [PR108533] The test fails on targets where size_t is not unsigned long due to extra diagnostics. As the testcase is tested in C++98 too, I'm not using decltype (sizeof 0) but __SIZE_TYPE__. 2023-01-25 Jakub Jelinek PR c++/107329 PR testsuite/108533 * g++.dg/init/new51.C (size_t): New typedef. (RexxClass::operator new, RexxClass::operator delete): Use size_t instead of unsigned long. --- gcc/testsuite/g++.dg/init/new51.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/g++.dg/init/new51.C b/gcc/testsuite/g++.dg/init/new51.C index d8b3364..89c0f87 100644 --- a/gcc/testsuite/g++.dg/init/new51.C +++ b/gcc/testsuite/g++.dg/init/new51.C @@ -1,9 +1,10 @@ // PR c++/107329 +typedef __SIZE_TYPE__ size_t; struct RexxClass { - void *operator new(unsigned long, unsigned long, const char *, RexxClass *, + void *operator new(size_t, size_t, const char *, RexxClass *, RexxClass *); - void operator delete(void *, unsigned long, const char *, RexxClass *, + void operator delete(void *, size_t, const char *, RexxClass *, RexxClass *); RexxClass(); }; -- cgit v1.1 From 0fa221685a36ef98cb20a6d435a150b5992e99e0 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 25 Jan 2023 00:17:57 +0000 Subject: Daily bump. --- gcc/ChangeLog | 70 +++++++++++++++++++++++++++++++++++ gcc/DATESTAMP | 2 +- gcc/cp/ChangeLog | 24 ++++++++++++ gcc/fortran/ChangeLog | 6 +++ gcc/m2/ChangeLog | 55 ++++++++++++++++++++++++++++ gcc/testsuite/ChangeLog | 97 +++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 253 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c5d6570..8fd7335 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,73 @@ +2023-01-24 Takayuki 'January June' Suwa + + * config/xtensa/xtensa.md: + Fix exit from loops detecting references before overwriting in the + split pattern. + +2023-01-24 Vladimir N. Makarov + + * lra-constraints.cc (get_hard_regno): Remove final_p arg. Always + do elimination but only for hard register. + (operands_match_p, uses_hard_regs_p, process_alt_operands): Adjust + calls of get_hard_regno. + +2023-01-24 Stefan Schulze Frielinghaus + + * config/s390/s390-d.cc (s390_d_target_versions): Fix detection + of CPU version. + +2023-01-24 Andre Vieira + + PR target/108177 + * config/arm/mve.md (mve_vstrbq_p_, mve_vstrhq_p_fv8hf, + mve_vstrhq_p_, mve_vstrwq_p_v4si): Add memory operand + as input operand. + +2023-01-24 Xianmiao Qu + + * config.gcc(csky-*-linux*): Define CSKY_ENABLE_MULTILIB + and only include 'csky/t-csky-linux' when enable multilib. + * config/csky/csky-linux-elf.h(SYSROOT_SUFFIX_SPEC): Don't + define it when disable multilib. + +2023-01-24 Richard Biener + + PR tree-optimization/108500 + * dominance.h (calculate_dominance_info): Add parameter + to indicate fast-query compute, defaulted to true. + * dominance.cc (calculate_dominance_info): Honor + fast-query compute parameter. + * tree-cfgcleanup.cc (cleanup_tree_cfg_noloop): Do + not compute the dominator fast-query DFS numbers. + +2023-01-24 Eric Biggers + + PR bootstrap/90543 + * optc-save-gen.awk: Fix copy-and-paste error. + +2023-01-24 Jakub Jelinek + + PR c++/108474 + * cgraphbuild.cc: Include gimplify.h. + (record_reference): Replace VAR_DECLs with DECL_HAS_VALUE_EXPR_P with + their corresponding DECL_VALUE_EXPR expressions after unsharing. + +2023-01-24 Srinath Parvathaneni + + PR target/108505 + * config.gcc (tm_file): Move the variable out of loop. + +2023-01-24 Lulu Cheng + Yang Yujie + + PR target/107731 + * config/loongarch/loongarch.cc (loongarch_classify_address): + Add precessint for CONST_INT. + (loongarch_print_operand_reloc): Operand modifier 'c' is supported. + (loongarch_print_operand): Increase the processing of '%c'. + * doc/extend.texi: Adds documents for LoongArch operand modifiers. + And port the public operand modifiers information to this document. + 2023-01-23 Srinath Parvathaneni * doc/invoke.texi (-mbranch-protection): Update documentation. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9ed1bcf..e26ffa6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20230124 +20230125 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 05d4252..53e9949 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,27 @@ +2023-01-24 Jason Merrill + + PR c++/108504 + * parser.cc (cp_lexer_new_main): Pass C_LEX_STRING_NO_JOIN for first + token, too. + +2023-01-24 Jason Merrill + + PR c++/108526 + * pt.cc (tsubst_function_decl): Handle static lambda. + +2023-01-24 Jakub Jelinek + + PR c++/108474 + * cp-gimplify.cc (cp_fold_r): Revert 2023-01-19 changes. + +2023-01-24 Jason Merrill + + PR c++/107303 + PR c++/107329 + * cp-gimplify.cc (cp_fold_r) [TARGET_EXPR]: In case of double + TARGET_EXPR, keep the outer one instead of the inner one. + (maybe_replace_decl): New. + 2023-01-23 Jason Merrill PR c++/107267 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a2f8ec7..bd9ecfd 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2023-01-24 Harald Anlauf + + PR fortran/108529 + * simplify.cc (simplify_transformation): Do not try to simplify + transformational intrinsic when the ARRAY argument has a NULL shape. + 2023-01-23 Harald Anlauf PR fortran/108502 diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog index 1fad9e1..07ab75d 100644 --- a/gcc/m2/ChangeLog +++ b/gcc/m2/ChangeLog @@ -1,3 +1,58 @@ +2023-01-24 Co-Authored by: Iain Sandoe + + * Make-lang.in (GM2-COMP-BOOT-DEFS): Add + DynamicStringPath.def. + (GM2-COMP-BOOT-MODS): Add DynamicStringPath.mod. + (GM2-COMP-DEFS): Add DynamicStringPath.def. + (GM2-COMP-MODS): Add DynamicStringPath.mod. + ($(objdir)/m2/gm2-libs-min/SYSTEM.def): Split path into + multiple -I components. + ($(objdir)/m2/gm2-libs/SYSTEM.def): Ditto. + ($(objdir)/m2/gm2-libs-coroutines/SYSTEM.def): Ditto. + * gm2-compiler/M2Options.mod: Import DynamicStringPath. + (SetSearchPath): Reimplement using DynamicStringPath + procedures. + * gm2-compiler/M2Search.def (InitSearchPath): Remove. + (PrependSearchPath): Remove. + * gm2-compiler/M2Search.mod (SFIO): Remove import. + (DynamicStringPath): Add import. + (Directory): Remove. + (UserPath): Remove. + (InitialPath): Remove. + (InitSearchPath): Remove. + (PrependSearchPath): Remove. + (FindSourceFile): Re-implement. + (FindSourceDefFile): Re-implement. + (FindSourceModFile): Re-implement. + * gm2-gcc/init.cc (_M2_DynamicStringPath_init): + New prototype. + (init_FrontEndInit): Call _M2_DynamicStringPath_init. + * tools-src/makeSystem: Allow multiple -I paths. + * gm2-compiler/DynamicStringPath.def: New file. + * gm2-compiler/DynamicStringPath.mod: New file. + * gm2-gcc/m2options.h (M2Options_SetMakeIncludePath): Add + prototype. + +2023-01-24 Gaius Mulley + + * m2.flex (cpreprocessor): Add temporary variable + which is initialized to 0. + (commentCLevel): New variable. + (endOfCComment): New function. + (splitSlashStar): New function to split /* into / and * + tokens. + (COMMENTC): New flex state. + ("/*"): New rule to test whether we should treat /* + as a single token or as two tokens. + (.): New rule to skip a character. + (\n.*): New rule to consume the line. + ("*/"): New rule to call endOfCComment. + +2023-01-24 Gaius Mulley + + * gm2-libs-iso/RTco.def: Import RTentity. + Declare RTco as a definition for C module. + 2023-01-23 Iain Sandoe PR modula2/108182 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c9d2bc3..dd07af3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,100 @@ +2023-01-24 Jakub Jelinek + + PR c++/107329 + PR testsuite/108533 + * g++.dg/init/new51.C (size_t): New typedef. + (RexxClass::operator new, RexxClass::operator delete): Use size_t + instead of unsigned long. + +2023-01-24 Jason Merrill + + PR c++/108504 + * g++.dg/ext/pragma1.C: New test. + +2023-01-24 Jason Merrill + + PR c++/108526 + * g++.dg/cpp23/static-operator-call5.C: New test. + +2023-01-24 Vladimir N. Makarov + + * gcc.target/pdp11/pdp11.exp: New. + * gcc.target/pdp11/pr108388.c: New. + +2023-01-24 Harald Anlauf + + PR fortran/108529 + * gfortran.dg/pr108529.f90: New test. + +2023-01-24 Andre Vieira + + * gcc.target/arm/mve/pr108177-1-run.c: New test. + * gcc.target/arm/mve/pr108177-1.c: New test. + * gcc.target/arm/mve/pr108177-10-run.c: New test. + * gcc.target/arm/mve/pr108177-10.c: New test. + * gcc.target/arm/mve/pr108177-11-run.c: New test. + * gcc.target/arm/mve/pr108177-11.c: New test. + * gcc.target/arm/mve/pr108177-12-run.c: New test. + * gcc.target/arm/mve/pr108177-12.c: New test. + * gcc.target/arm/mve/pr108177-13-run.c: New test. + * gcc.target/arm/mve/pr108177-13.c: New test. + * gcc.target/arm/mve/pr108177-14-run.c: New test. + * gcc.target/arm/mve/pr108177-14.c: New test. + * gcc.target/arm/mve/pr108177-2-run.c: New test. + * gcc.target/arm/mve/pr108177-2.c: New test. + * gcc.target/arm/mve/pr108177-3-run.c: New test. + * gcc.target/arm/mve/pr108177-3.c: New test. + * gcc.target/arm/mve/pr108177-4-run.c: New test. + * gcc.target/arm/mve/pr108177-4.c: New test. + * gcc.target/arm/mve/pr108177-5-run.c: New test. + * gcc.target/arm/mve/pr108177-5.c: New test. + * gcc.target/arm/mve/pr108177-6-run.c: New test. + * gcc.target/arm/mve/pr108177-6.c: New test. + * gcc.target/arm/mve/pr108177-7-run.c: New test. + * gcc.target/arm/mve/pr108177-7.c: New test. + * gcc.target/arm/mve/pr108177-8-run.c: New test. + * gcc.target/arm/mve/pr108177-8.c: New test. + * gcc.target/arm/mve/pr108177-9-run.c: New test. + * gcc.target/arm/mve/pr108177-9.c: New test. + * gcc.target/arm/mve/pr108177-main.x: New test include. + * gcc.target/arm/mve/pr108177.x: New test include. + +2023-01-24 Jakub Jelinek + + PR c++/108474 + * g++.dg/cpp1z/decomp57.C: New test. + * g++.dg/cpp1z/decomp58.C: New test. + +2023-01-24 Rainer Orth + + PR testsuite/107808 + * gcc.dg/vect/vect-bitfield-write-2.c: Require vect_long_long. + * gcc.dg/vect/vect-bitfield-write-3.c: Likewise. + +2023-01-24 Rainer Orth + + PR testsuite/104756 + * gcc.dg/vect/vect-fmax-1.c: Require vect_float. + * gcc.dg/vect/vect-fmax-2.c: Likewise. + * gcc.dg/vect/vect-fmax-3.c: Likewise. + * gcc.dg/vect/vect-fmin-1.c: Likewise. + * gcc.dg/vect/vect-fmin-2.c: Likewise. + * gcc.dg/vect/vect-fmin-3.c: Likewise. + +2023-01-24 Lulu Cheng + Yang Yujie + + PR target/107731 + * gcc.target/loongarch/tst-asm-const.c: Moved to... + * gcc.target/loongarch/pr107731.c: ...here. + +2023-01-24 Jason Merrill + + PR c++/107303 + PR c++/107329 + * g++.dg/ext/builtin-shufflevector-5.C: New test. + * g++.dg/init/new51.C: New test. + 2023-01-23 Jason Merrill PR c++/107267 -- cgit v1.1 From b851ee9fdf0f3023635f0cb1f7c607b2d6801053 Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Tue, 24 Jan 2023 19:47:05 -0500 Subject: tree-optimization/108522 Use COMPONENT_REF offset when available Use the offset in TREE_OPERAND(component_ref, 2) when available instead of DECL_FIELD_OFFSET when trying to compute offset for a COMPONENT_REF. Co-authored-by: Jakub Jelinek gcc/ChangeLog: PR tree-optimization/108522 * tree-object-size.cc (compute_object_offset): Use TREE_OPERAND(ref, 2) for COMPONENT_REF when available. gcc/testsuite/ChangeLog: PR tree-optimization/108522 * gcc.dg/builtin-dynamic-object-size-0.c (test_dynarray_struct_member): New test. (main): Call it. Signed-off-by: Siddhesh Poyarekar --- gcc/testsuite/gcc.dg/builtin-dynamic-object-size-0.c | 16 ++++++++++++++++ gcc/tree-object-size.cc | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/builtin-dynamic-object-size-0.c b/gcc/testsuite/gcc.dg/builtin-dynamic-object-size-0.c index f9047a0..569c0a8 100644 --- a/gcc/testsuite/gcc.dg/builtin-dynamic-object-size-0.c +++ b/gcc/testsuite/gcc.dg/builtin-dynamic-object-size-0.c @@ -314,6 +314,20 @@ test_dynarray_struct_subobj2 (size_t sz, size_t off, size_t *objsz) return __builtin_dynamic_object_size (&bin.c[off], 1); } +/* See pr #108522. */ +size_t +__attribute__ ((noinline)) +test_dynarray_struct_member (size_t sz) +{ + struct + { + char a[sz]; + char b; + } s; + + return __builtin_dynamic_object_size (&s.b, 0); +} + size_t __attribute__ ((noinline)) test_substring (size_t sz, size_t off) @@ -619,6 +633,8 @@ main (int argc, char **argv) if (test_dynarray_struct_subobj2 (42, 4, &objsz) != objsz - 4 - sizeof (long) - sizeof (int)) FAIL (); + if (test_dynarray_struct_member (42) != sizeof (char)) + FAIL (); if (test_substring_ptrplus (128, 4) != (128 - 4) * sizeof (int)) FAIL (); if (test_substring_ptrplus (128, 142) != 0) diff --git a/gcc/tree-object-size.cc b/gcc/tree-object-size.cc index 356591c..de93ffa 100644 --- a/gcc/tree-object-size.cc +++ b/gcc/tree-object-size.cc @@ -412,7 +412,9 @@ compute_object_offset (const_tree expr, const_tree var) return base; t = TREE_OPERAND (expr, 1); - off = size_binop (PLUS_EXPR, DECL_FIELD_OFFSET (t), + off = size_binop (PLUS_EXPR, + (TREE_OPERAND (expr, 2) ? TREE_OPERAND (expr, 2) + : DECL_FIELD_OFFSET (t)), size_int (tree_to_uhwi (DECL_FIELD_BIT_OFFSET (t)) / BITS_PER_UNIT)); break; -- cgit v1.1 From 617be7ba436bcbf9d7b883968c6b3c011206b56c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 25 Jan 2023 10:50:27 +0100 Subject: store-merging: Disable string_concatenate mode if start or end aren't byte aligned [PR108498] The first of the following testcases is miscompiled on powerpc64-linux -O2 -m64 at least, the latter at least on x86_64-linux -m32/-m64. Since GCC 11 store-merging has a separate string_concatenation mode which turns stores into setting a MEM_REF from a STRING_CST. This mode is triggered if at least one of the to be merged stores is a STRING_CST store and either the first store (to earliest address) is that STRING_CST store or the first store is 8-bit INTEGER_CST store and then there are some rules when to turn that mode off or not merge further stores into it. The problem with these 2 testcases is that the actual implementation relies on start/width of the store to be at byte boundaries, as it simply creates a char array, MEM_REF can be only on byte boundaries and the char array too, plus obviously STRING_CST as well. But as can be easily seen in the second testcase, nothing verifies this, while the first store has to be a STRING_CST (which will be aligned) or 8-bit INTEGER_CST, that 8-bit INTEGER_CST store could be a bitfield store, nothing verifies any stores in between whether they actually are 8-bit and aligned, the only major requirement is that all the stores are consecutive. For GCC 14 I think we should reconsider this, simply treat STRING_CST stores during the merging like INTEGER_CST stores and deal with it only during split_group where we can create multiple parts, this part would be a normal store, this part would be STRING_CST store, this part another normal store etc. But that is quite a lot of work, the following patch just disables the string_concatenate mode if boundaries aren't byte aligned in the spot where we disable it if it is too short too. If that happens, we'll just try to do the merging using normal 1/2/4/8 etc. byte stores as usually with RMW masking for any bits that shouldn't be touched or punt if we end up with too many stores compared to the original. Note, an original STRING_CST store will count as one store in that case, something we might want to reconsider later too (but, after all, CONSTRUCTOR stores (aka zeroing) already have the same problem, they can be large and expensive and we still count them as one store). 2023-01-25 Jakub Jelinek PR tree-optimization/108498 * gimple-ssa-store-merging.cc (class store_operand_info): End coment with full stop rather than comma. (split_group): Likewise. (merged_store_group::apply_stores): Clear string_concatenation if start or end aren't on a byte boundary. * gcc.c-torture/execute/pr108498-1.c: New test. * gcc.c-torture/execute/pr108498-2.c: New test. --- gcc/gimple-ssa-store-merging.cc | 8 ++- gcc/testsuite/gcc.c-torture/execute/pr108498-1.c | 82 +++++++++++++++++++++ gcc/testsuite/gcc.c-torture/execute/pr108498-2.c | 91 ++++++++++++++++++++++++ 3 files changed, 179 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr108498-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr108498-2.c (limited to 'gcc') diff --git a/gcc/gimple-ssa-store-merging.cc b/gcc/gimple-ssa-store-merging.cc index 5a477c4..df7afd2 100644 --- a/gcc/gimple-ssa-store-merging.cc +++ b/gcc/gimple-ssa-store-merging.cc @@ -1614,7 +1614,7 @@ namespace { then VAL represents the constant and all the other fields are zero, or a memory load, then VAL represents the reference, BASE_ADDR is non-NULL and the other fields also reflect the memory load, or an SSA name, then - VAL represents the SSA name and all the other fields are zero, */ + VAL represents the SSA name and all the other fields are zero. */ class store_operand_info { @@ -2309,6 +2309,10 @@ merged_store_group::apply_stores () if (buf_size <= MOVE_MAX) string_concatenation = false; + /* String concatenation only works for byte aligned start and end. */ + if (start % BITS_PER_UNIT != 0 || width % BITS_PER_UNIT != 0) + string_concatenation = false; + /* Create a power-of-2-sized buffer for native_encode_expr. */ if (!string_concatenation) buf_size = 1 << ceil_log2 (buf_size); @@ -3631,7 +3635,7 @@ split_group (merged_store_group *group, bool allow_unaligned_store, /* For bswap framework using sets of stores, all the checking has been done earlier in try_coalesce_bswap and the result always needs to be emitted - as a single store. Likewise for string concatenation, */ + as a single store. Likewise for string concatenation. */ if (group->stores[0]->rhs_code == LROTATE_EXPR || group->stores[0]->rhs_code == NOP_EXPR || group->string_concatenation) diff --git a/gcc/testsuite/gcc.c-torture/execute/pr108498-1.c b/gcc/testsuite/gcc.c-torture/execute/pr108498-1.c new file mode 100644 index 0000000..217c1e4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr108498-1.c @@ -0,0 +1,82 @@ +/* PR tree-optimization/108498 */ + +struct A +{ + signed char a1; + int a2; +}; + +struct B +{ + struct A b1; + unsigned char b2:1, b3:1, b4:2, b5:1, b6:1, b7[4]; +}; + +struct C +{ + unsigned char c1; + char c2; + signed char c3; + unsigned char c4, c5[4], c6:1, c7:1, c8:1, c9:3, c10:1; + struct A c11; + struct B c12[3]; +}; + +static inline struct C +foo (unsigned char a, unsigned b, int c, struct A d, + unsigned e, struct B f, struct B g, struct B h) +{ + struct C x + = { .c1 = b, .c2 = 0, .c3 = c, .c6 = a, .c4 = e, .c7 = 0, + .c8 = 0, .c9 = 7, .c10 = 0, .c5 = {0, 1, 2, 3}, .c11 = d, + .c12 = {f, g, h} }; + return x; +} + +static inline struct A +bar (int a, int b) +{ + struct A x = { .a1 = a, .a2 = b }; + return x; +} + +static inline struct B +baz (struct A b1) +{ + struct B x = { .b1 = b1, .b6 = 0, .b5 = 0, .b7 = {0, 1, 2, 3}, .b2 = 0 }; + return x; +} + +struct C +qux (void) +{ + const struct B a = baz (bar (0, 0)); + struct C b; + struct B c[2]; + struct A d = { 0, 1 }; + c[0].b1.a1 = 0; + c[0].b1.a2 = 2; + c[1].b1.a1 = 4; + c[1].b1.a2 = 8; + return foo (0, 2, -1, d, 3, c[0], c[1], a); +} + +__attribute__((noipa)) void +corge (struct C *x) +{ + char buf[1024]; + __builtin_memset (buf, 0xaa, sizeof (buf)); + asm volatile ("" : : "r" (buf)); + __builtin_memset (x, 0x55, sizeof (struct C)); + asm volatile ("" : : "r" (x)); +} + +int +main () +{ + struct C x; + corge (&x); + x = qux (); + if (x.c6 || x.c9 != 7) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr108498-2.c b/gcc/testsuite/gcc.c-torture/execute/pr108498-2.c new file mode 100644 index 0000000..ad93048 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr108498-2.c @@ -0,0 +1,91 @@ +/* PR tree-optimization/108498 */ + +struct U { char c[16]; }; +struct V { char c[16]; }; +struct S { unsigned int a : 3, b : 8, c : 21; struct U d; unsigned int e; struct V f; unsigned int g : 5, h : 27; }; +struct T { unsigned int a : 16, b : 8, c : 8; struct U d; unsigned int e; struct V f; unsigned int g : 5, h : 27; }; + +__attribute__((noipa)) void +foo (struct S *p) +{ + p->b = 231; + p->c = 42; + p->d = (struct U) { "abcdefghijklmno" }; + p->e = 0xdeadbeef; + p->f = (struct V) { "ABCDEFGHIJKLMNO" }; +} + +__attribute__((noipa)) void +bar (struct S *p) +{ + p->b = 231; + p->c = 42; + p->d = (struct U) { "abcdefghijklmno" }; + p->e = 0xdeadbeef; + p->f = (struct V) { "ABCDEFGHIJKLMNO" }; + p->g = 12; +} + +__attribute__((noipa)) void +baz (struct T *p) +{ + p->c = 42; + p->d = (struct U) { "abcdefghijklmno" }; + p->e = 0xdeadbeef; + p->f = (struct V) { "ABCDEFGHIJKLMNO" }; + p->g = 12; +} + +int +main () +{ + if (__CHAR_BIT__ != 8 || __SIZEOF_INT__ != 4) + return 0; + struct S s = {}; + struct T t = {}; + foo (&s); + if (s.a != 0 || s.b != 231 || s.c != 42 + || __builtin_memcmp (&s.d.c, "abcdefghijklmno", 16) || s.e != 0xdeadbeef + || __builtin_memcmp (&s.f.c, "ABCDEFGHIJKLMNO", 16) || s.g != 0 || s.h != 0) + __builtin_abort (); + __builtin_memset (&s, 0, sizeof (s)); + s.a = 7; + s.g = 31; + s.h = (1U << 27) - 1; + foo (&s); + if (s.a != 7 || s.b != 231 || s.c != 42 + || __builtin_memcmp (&s.d.c, "abcdefghijklmno", 16) || s.e != 0xdeadbeef + || __builtin_memcmp (&s.f.c, "ABCDEFGHIJKLMNO", 16) || s.g != 31 || s.h != (1U << 27) - 1) + __builtin_abort (); + __builtin_memset (&s, 0, sizeof (s)); + bar (&s); + if (s.a != 0 || s.b != 231 || s.c != 42 + || __builtin_memcmp (&s.d.c, "abcdefghijklmno", 16) || s.e != 0xdeadbeef + || __builtin_memcmp (&s.f.c, "ABCDEFGHIJKLMNO", 16) || s.g != 12 || s.h != 0) + __builtin_abort (); + __builtin_memset (&s, 0, sizeof (s)); + s.a = 7; + s.g = 31; + s.h = (1U << 27) - 1; + bar (&s); + if (s.a != 7 || s.b != 231 || s.c != 42 + || __builtin_memcmp (&s.d.c, "abcdefghijklmno", 16) || s.e != 0xdeadbeef + || __builtin_memcmp (&s.f.c, "ABCDEFGHIJKLMNO", 16) || s.g != 12 || s.h != (1U << 27) - 1) + __builtin_abort (); + baz (&t); + if (t.a != 0 || t.b != 0 || t.c != 42 + || __builtin_memcmp (&t.d.c, "abcdefghijklmno", 16) || t.e != 0xdeadbeef + || __builtin_memcmp (&t.f.c, "ABCDEFGHIJKLMNO", 16) || t.g != 12 || t.h != 0) + __builtin_abort (); + __builtin_memset (&s, 0, sizeof (s)); + t.a = 7; + t.b = 255; + t.g = 31; + t.h = (1U << 27) - 1; + baz (&t); + if (t.a != 7 || t.b != 255 || t.c != 42 + || __builtin_memcmp (&t.d.c, "abcdefghijklmno", 16) || t.e != 0xdeadbeef + || __builtin_memcmp (&t.f.c, "ABCDEFGHIJKLMNO", 16) || t.g != 12 || t.h != (1U << 27) - 1) + __builtin_abort (); + return 0; +} -- cgit v1.1 From d9a83904b1da255164ddccbb91cae512b2f99587 Mon Sep 17 00:00:00 2001 From: Andre Vieira Date: Wed, 25 Jan 2023 10:01:02 +0000 Subject: aarch64: Add aarch64*-*-* to the list of vect_long_long targets This patch adds aarch64 to the list of vect_long_long targets. Regression tested on aarch64-none-linux-gnu. gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_effective_target_vect_long_long): Add aarch64 to list of targets supporting long long vectorization. --- gcc/testsuite/lib/target-supports.exp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index c0694af..227e300 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -7125,7 +7125,8 @@ proc check_effective_target_vect_long_long { } { && [check_effective_target_s390_vx]) || ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*] - && [check_effective_target_has_arch_pwr8]) }}] + && [check_effective_target_has_arch_pwr8]) + || [istarget aarch64*-*-*] }}] } -- cgit v1.1 From 27b2eb6b35bb1cc28fd67e0437ff2e8422df2ab0 Mon Sep 17 00:00:00 2001 From: Gerald Pfeifer Date: Wed, 25 Jan 2023 11:33:58 +0100 Subject: doc/contrib.texi: Add Jose E. Marchesi gcc/ChangeLog: * doc/contrib.texi: Add Jose E. Marchesi. --- gcc/doc/contrib.texi | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc') diff --git a/gcc/doc/contrib.texi b/gcc/doc/contrib.texi index 7e9c16f..758805d 100644 --- a/gcc/doc/contrib.texi +++ b/gcc/doc/contrib.texi @@ -635,6 +635,10 @@ and unit testing. Bob Manson for his behind the scenes work on dejagnu. @item +Jose E. Marchesi for contributing the eBPF backend and his ongoing +work maintaining it. + +@item John Marino for contributing the DragonFly BSD port. @item -- cgit v1.1 From 7c47a3bea6f270a6e0a778eb1acd5f76e863213f Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 25 Jan 2023 11:24:32 +0000 Subject: aarch64: Update sizeless tests The sizeless-*.c tests contained (deliberately) invalid constructors that had two errors. The first error now suppresses the second error, but the second error was the main focus of the test. This patch therefore rewrites it into a different form. gcc/testsuite/ * gcc.target/aarch64/sve/acle/general-c/sizeless-1.c: Avoid "initializer element is not constant" error. * gcc.target/aarch64/sve/acle/general-c/sizeless-2.c: Likewise. --- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-1.c | 3 +-- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-1.c index 4b34a71..01cfd14 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-1.c @@ -30,8 +30,7 @@ union union1 { /* Pointers to sizeless types. */ svint8_t *global_sve_sc_ptr; -svint8_t *invalid_sve_sc_ptr = &(svint8_t) { *global_sve_sc_ptr }; /* { dg-error {initializer element is not constant} } */ - /* { dg-error {SVE type 'svint8_t' does not have a fixed size} "2nd line" { target *-*-* } .-1 } */ +svint8_t *invalid_sve_sc_ptr = &(svint8_t) {}; /* { dg-error {SVE type 'svint8_t' does not have a fixed size} } */ /* Sizeless arguments and return values. */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c index 34dfd59..613b9c4 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c @@ -30,8 +30,7 @@ union union1 { /* Pointers to sizeless types. */ svint8_t *global_sve_sc_ptr; -svint8_t *invalid_sve_sc_ptr = &(svint8_t) { *global_sve_sc_ptr }; /* { dg-error {initializer element is not constant} } */ - /* { dg-error {SVE type 'svint8_t' does not have a fixed size} "2nd line" { target *-*-* } .-1 } */ +svint8_t *invalid_sve_sc_ptr = &(svint8_t) {}; /* { dg-error {SVE type 'svint8_t' does not have a fixed size} } */ /* Sizeless arguments and return values. */ -- cgit v1.1 From da43e287d1917a25594f95c7c519ded637c7ea50 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 25 Jan 2023 11:24:32 +0000 Subject: aarch64: Restore generation of SVE UQDEC instructions The addition of TARGET_CSSC meant that we wouldn't generate SVE UQDEC instructions unless +cssc was also enabled. Fixes: - gcc.target/aarch64/sve/slp_4.c - gcc.target/aarch64/sve/slp_10.c - gcc.target/aarch64/sve/while_4.c gcc/ * config/aarch64/aarch64.md (umax3): Separate the CNT and CSSC tests. --- gcc/config/aarch64/aarch64.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index e4d7587..0b326d4 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -4457,8 +4457,9 @@ { if (aarch64_sve_cnt_immediate (operands[1], mode)) std::swap (operands[1], operands[2]); - else if (!aarch64_sve_cnt_immediate (operands[2], mode) - && TARGET_CSSC) + else if (aarch64_sve_cnt_immediate (operands[2], mode)) + ; + else if (TARGET_CSSC) { if (aarch64_uminmax_immediate (operands[1], mode)) std::swap (operands[1], operands[2]); -- cgit v1.1 From 64f66385086e6a957c337eef97aec01cf30c162d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 25 Jan 2023 13:28:01 +0100 Subject: Fixup LTO internal docs for option processing Andreas noticed that when I removed lto_read_all_file_options I failed to update the internals manual which refers to it. The following attempts to reflect the current situation. * doc/lto.texi (Command line options): Reword and update reference to removed lto_read_all_file_options. --- gcc/doc/lto.texi | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'gcc') diff --git a/gcc/doc/lto.texi b/gcc/doc/lto.texi index e591e8d..eb5f54b 100644 --- a/gcc/doc/lto.texi +++ b/gcc/doc/lto.texi @@ -170,13 +170,11 @@ object files. This is used at link time to determine the optimization level and other settings when they are not explicitly specified at the linker command line. -Currently, GCC does not support combining LTO object files compiled -with different set of the command line options into a single binary. -At link time, the options given on the command line and the options -saved on all the files in a link-time set are applied globally. No -attempt is made at validating the combination of flags (other than the -usual validation done by option processing). This is implemented in -@file{lto/lto.cc}:@code{lto_read_all_file_options}. +Most options are recorded at a per function level and their setting +restored when processing the functions at link time. Global options +are composed from options specified at compile time and link time. +How exactly they are combined or mismatches diagnosed is implemented in +@file{lto-wrapper.cc}:@code{find_and_merge_options}. @item Symbol table (@code{.gnu.lto_.symtab}) -- cgit v1.1 From c29d85359add807200a1a851026b4e4a9d6b714c Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 25 Jan 2023 13:31:46 +0100 Subject: tree-optimization/108523 - fix endless iteration in VN The following fixes not converging iteration in value-numbering of PHI nodes when we use an equivalence to prove the PHI node is degenerate. We have to avoid the situation where we oscillate between the two equivalent values because the result is fed back via a backedge. PR tree-optimization/108523 * tree-ssa-sccvn.cc (visit_phi): Avoid using the exclusive backedge value for the result when using predication to prove equivalence. --- gcc/tree-ssa-sccvn.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc index 0dba3f3..edb553b 100644 --- a/gcc/tree-ssa-sccvn.cc +++ b/gcc/tree-ssa-sccvn.cc @@ -5826,7 +5826,7 @@ visit_phi (gimple *phi, bool *inserted, bool backedges_varying_p) poly_int64 soff, doff; unsigned n_executable = 0; edge_iterator ei; - edge e; + edge e, sameval_e = NULL; /* TODO: We could check for this in initialization, and replace this with a gcc_assert. */ @@ -5867,7 +5867,10 @@ visit_phi (gimple *phi, bool *inserted, bool backedges_varying_p) && ssa_undefined_value_p (def, false)) seen_undef = def; else if (sameval == VN_TOP) - sameval = def; + { + sameval = def; + sameval_e = e; + } else if (!expressions_equal_p (def, sameval)) { /* We know we're arriving only with invariant addresses here, @@ -5916,6 +5919,8 @@ visit_phi (gimple *phi, bool *inserted, bool backedges_varying_p) fprintf (dump_file, " are equal on edge %d -> %d\n", e->src->index, e->dest->index); } + if (sameval_e && (sameval_e->flags & EDGE_DFS_BACK)) + sameval = def; continue; } /* If on all previous edges the value was equal to def @@ -5935,7 +5940,8 @@ visit_phi (gimple *phi, bool *inserted, bool backedges_varying_p) EDGE_PRED (bb, 0)->src->index, EDGE_PRED (bb, 0)->dest->index); } - sameval = def; + if (!(e->flags & EDGE_DFS_BACK)) + sameval = def; continue; } } @@ -5943,6 +5949,8 @@ visit_phi (gimple *phi, bool *inserted, bool backedges_varying_p) sameval = NULL_TREE; break; } + else + sameval_e = NULL; } /* If the value we want to use is flowing over the backedge and we -- cgit v1.1 From dd4424ef898608321b60610c4f3c98737ace3680 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:01:26 +0100 Subject: arm: improve tests and fix vclsq* gcc/ChangeLog: * config/arm/mve.md (mve_vclsq_s): Fix spacing. gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vclsq_m_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vclsq_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vclsq_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vclsq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vclsq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vclsq_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vclsq_x_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vclsq_x_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vclsq_x_s8.c: Likewise. --- gcc/config/arm/mve.md | 2 +- .../gcc.target/arm/mve/intrinsics/vclsq_m_s16.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclsq_m_s32.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclsq_m_s8.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclsq_s16.c | 28 +++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vclsq_s32.c | 28 +++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vclsq_s8.c | 24 ++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclsq_x_s16.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclsq_x_s32.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclsq_x_s8.c | 33 ++++++++++++++++++++-- 10 files changed, 251 insertions(+), 29 deletions(-) (limited to 'gcc') diff --git a/gcc/config/arm/mve.md b/gcc/config/arm/mve.md index 2e58ad1..d4f5a90 100644 --- a/gcc/config/arm/mve.md +++ b/gcc/config/arm/mve.md @@ -469,7 +469,7 @@ VCLSQ_S)) ] "TARGET_HAVE_MVE" - "vcls.s%# %q0, %q1" + "vcls.s%#\t%q0, %q1" [(set_attr "type" "mve_move") ]) diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_m_s16.c index d0eb700..1996ac8 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_m_s16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclst.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, mve_pred16_t p) { return vclsq_m_s16 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclst.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclst.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, mve_pred16_t p) { return vclsq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_m_s32.c index b6d7088..f51841d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_m_s32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclst.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, mve_pred16_t p) { return vclsq_m_s32 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclst.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclst.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, mve_pred16_t p) { return vclsq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_m_s8.c index 28d4d96..2975c4c 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_m_s8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclst.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, mve_pred16_t p) { return vclsq_m_s8 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclst.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclst.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, mve_pred16_t p) { return vclsq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_s16.c index e57fbb9..ed1b5c7 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_s16.c @@ -1,21 +1,41 @@ -/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ -/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcls.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t a) { return vclsq_s16 (a); } -/* { dg-final { scan-assembler "vcls.s16" } } */ +/* +**foo1: +** ... +** vcls.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t a) { return vclsq (a); } -/* { dg-final { scan-assembler "vcls.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_s32.c index 7fa3038..9e5369e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_s32.c @@ -1,21 +1,41 @@ -/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ -/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcls.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t a) { return vclsq_s32 (a); } -/* { dg-final { scan-assembler "vcls.s32" } } */ +/* +**foo1: +** ... +** vcls.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t a) { return vclsq (a); } -/* { dg-final { scan-assembler "vcls.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_s8.c index b098548..c4a9468 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcls.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t a) { return vclsq_s8 (a); } -/* { dg-final { scan-assembler "vcls.s8" } } */ +/* +**foo1: +** ... +** vcls.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t a) { return vclsq (a); } -/* { dg-final { scan-assembler "vcls.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_x_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_x_s16.c index ab09c99..ea11ece 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_x_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_x_s16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclst.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t a, mve_pred16_t p) { return vclsq_x_s16 (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclst.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclst.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t a, mve_pred16_t p) { return vclsq_x (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_x_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_x_s32.c index 09a8dab..1737c56 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_x_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_x_s32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclst.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t a, mve_pred16_t p) { return vclsq_x_s32 (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclst.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclst.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t a, mve_pred16_t p) { return vclsq_x (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_x_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_x_s8.c index af40f7f..a7cdb61 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_x_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclsq_x_s8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclst.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t a, mve_pred16_t p) { return vclsq_x_s8 (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclst.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclst.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t a, mve_pred16_t p) { return vclsq_x (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From 16452c63e10f7a44c70bec0216358ac405abfcf6 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:04:41 +0100 Subject: arm: improve tests and fix vclzq* gcc/ChangeLog: * config/arm/mve.md (@mve_vclzq_s): Fix spacing. gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vclzq_m_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vclzq_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vclzq_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vclzq_m_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vclzq_m_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vclzq_m_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vclzq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vclzq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vclzq_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vclzq_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vclzq_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vclzq_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vclzq_x_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vclzq_x_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vclzq_x_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vclzq_x_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vclzq_x_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vclzq_x_u8.c: Likewise. * gcc.target/arm/simd/mve-vclz.c: Update test. --- gcc/config/arm/mve.md | 2 +- .../gcc.target/arm/mve/intrinsics/vclzq_m_s16.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclzq_m_s32.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclzq_m_s8.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclzq_m_u16.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclzq_m_u32.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclzq_m_u8.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclzq_s16.c | 28 +++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vclzq_s32.c | 28 +++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vclzq_s8.c | 24 ++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclzq_u16.c | 28 +++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vclzq_u32.c | 28 +++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vclzq_u8.c | 28 +++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vclzq_x_s16.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclzq_x_s32.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclzq_x_s8.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclzq_x_u16.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclzq_x_u32.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vclzq_x_u8.c | 33 ++++++++++++++++++++-- gcc/testsuite/gcc.target/arm/simd/mve-vclz.c | 6 ++-- 20 files changed, 506 insertions(+), 62 deletions(-) (limited to 'gcc') diff --git a/gcc/config/arm/mve.md b/gcc/config/arm/mve.md index d4f5a90..2728537 100644 --- a/gcc/config/arm/mve.md +++ b/gcc/config/arm/mve.md @@ -448,7 +448,7 @@ (clz:MVE_2 (match_operand:MVE_2 1 "s_register_operand" "w"))) ] "TARGET_HAVE_MVE" - "vclz.i%# %q0, %q1" + "vclz.i%#\t%q0, %q1" [(set_attr "type" "mve_move") ]) (define_expand "mve_vclzq_u" diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_s16.c index 9670f8f..620314e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_s16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, mve_pred16_t p) { return vclzq_m_s16 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclzt.i16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, mve_pred16_t p) { return vclzq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_s32.c index 1842735..dfda1e67 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_s32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, mve_pred16_t p) { return vclzq_m_s32 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclzt.i32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, mve_pred16_t p) { return vclzq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_s8.c index 2697d03..1300fe6 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_s8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, mve_pred16_t p) { return vclzq_m_s8 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclzt.i8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, mve_pred16_t p) { return vclzq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_u16.c index 8405b16..922819d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_u16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint16x8_t inactive, uint16x8_t a, mve_pred16_t p) { return vclzq_m_u16 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclzt.i16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint16x8_t inactive, uint16x8_t a, mve_pred16_t p) { return vclzq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_u32.c index 350e6e7..6e75a04 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_u32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint32x4_t inactive, uint32x4_t a, mve_pred16_t p) { return vclzq_m_u32 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclzt.i32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint32x4_t inactive, uint32x4_t a, mve_pred16_t p) { return vclzq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_u8.c index d455526..3c450e8 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_m_u8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint8x16_t foo (uint8x16_t inactive, uint8x16_t a, mve_pred16_t p) { return vclzq_m_u8 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclzt.i8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint8x16_t foo1 (uint8x16_t inactive, uint8x16_t a, mve_pred16_t p) { return vclzq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_s16.c index f71a0a4..17be53f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_s16.c @@ -1,21 +1,41 @@ -/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ -/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vclz.i16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t a) { return vclzq_s16 (a); } -/* { dg-final { scan-assembler "vclz.i16" } } */ +/* +**foo1: +** ... +** vclz.i16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t a) { return vclzq (a); } -/* { dg-final { scan-assembler "vclz.i16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_s32.c index 46a002b..5e440fe 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_s32.c @@ -1,21 +1,41 @@ -/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ -/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vclz.i32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t a) { return vclzq_s32 (a); } -/* { dg-final { scan-assembler "vclz.i32" } } */ +/* +**foo1: +** ... +** vclz.i32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t a) { return vclzq (a); } -/* { dg-final { scan-assembler "vclz.i32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_s8.c index 3cab6f3..9eaa9a4 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vclz.i8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t a) { return vclzq_s8 (a); } -/* { dg-final { scan-assembler "vclz.i8" } } */ +/* +**foo1: +** ... +** vclz.i8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t a) { return vclzq (a); } -/* { dg-final { scan-assembler "vclz.i8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_u16.c index cada68b..37179b2 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_u16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vclz.i16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint16x8_t a) { - return vclzq_u16 (a); + return vclzq_u16 (a); } -/* { dg-final { scan-assembler "vclz.i16" } } */ +/* +**foo1: +** ... +** vclz.i16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint16x8_t a) { - return vclzq (a); + return vclzq (a); +} + +#ifdef __cplusplus } +#endif -/* { dg-final { scan-assembler "vclz.i16" } } */ +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_u32.c index 0291b0c..65ee44d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_u32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vclz.i32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint32x4_t a) { - return vclzq_u32 (a); + return vclzq_u32 (a); } -/* { dg-final { scan-assembler "vclz.i32" } } */ +/* +**foo1: +** ... +** vclz.i32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint32x4_t a) { - return vclzq (a); + return vclzq (a); +} + +#ifdef __cplusplus } +#endif -/* { dg-final { scan-assembler "vclz.i32" } } */ +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_u8.c index 5eb7bab..bed4ab1 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_u8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vclz.i8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint8x16_t foo (uint8x16_t a) { - return vclzq_u8 (a); + return vclzq_u8 (a); } -/* { dg-final { scan-assembler "vclz.i8" } } */ +/* +**foo1: +** ... +** vclz.i8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint8x16_t foo1 (uint8x16_t a) { - return vclzq (a); + return vclzq (a); +} + +#ifdef __cplusplus } +#endif -/* { dg-final { scan-assembler "vclz.i8" } } */ +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_s16.c index daddd1b..ea78bf2 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_s16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t a, mve_pred16_t p) { return vclzq_x_s16 (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclzt.i16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t a, mve_pred16_t p) { return vclzq_x (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_s32.c index d4f443f..cc85d4d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_s32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t a, mve_pred16_t p) { return vclzq_x_s32 (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclzt.i32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t a, mve_pred16_t p) { return vclzq_x (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_s8.c index b33d2c5..0f80916 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_s8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t a, mve_pred16_t p) { return vclzq_x_s8 (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclzt.i8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t a, mve_pred16_t p) { return vclzq_x (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_u16.c index 6d9bc79..a9b662d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_u16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint16x8_t a, mve_pred16_t p) { return vclzq_x_u16 (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclzt.i16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint16x8_t a, mve_pred16_t p) { return vclzq_x (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_u32.c index c3b053b..5446938 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_u32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint32x4_t a, mve_pred16_t p) { return vclzq_x_u32 (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclzt.i32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint32x4_t a, mve_pred16_t p) { return vclzq_x (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_u8.c index 678b2eb..548a74e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vclzq_x_u8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint8x16_t foo (uint8x16_t a, mve_pred16_t p) { return vclzq_x_u8 (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vclzt.i8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vclzt.i8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint8x16_t foo1 (uint8x16_t a, mve_pred16_t p) { return vclzq_x (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vclz.c b/gcc/testsuite/gcc.target/arm/simd/mve-vclz.c index 7068736..38e91fc 100644 --- a/gcc/testsuite/gcc.target/arm/simd/mve-vclz.c +++ b/gcc/testsuite/gcc.target/arm/simd/mve-vclz.c @@ -23,6 +23,6 @@ FUNC(u, uint, 8, clz) /* 16 and 8-bit versions are not vectorized because they need pack/unpack patterns since __builtin_clz uses 32-bit parameter and return value. */ -/* { dg-final { scan-assembler-times {vclz\.i32 q[0-9]+, q[0-9]+} 2 } } */ -/* { dg-final { scan-assembler-times {vclz\.i16 q[0-9]+, q[0-9]+} 2 { xfail *-*-* } } } */ -/* { dg-final { scan-assembler-times {vclz\.i8 q[0-9]+, q[0-9]+} 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times {vclz\.i32\tq[0-9]+, q[0-9]+} 2 } } */ +/* { dg-final { scan-assembler-times {vclz\.i16\tq[0-9]+, q[0-9]+} 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times {vclz\.i8\tq[0-9]+, q[0-9]+} 2 { xfail *-*-* } } } */ -- cgit v1.1 From c8cb7e062664e5db5969de4239be513dfd6ab1d1 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:09:16 +0100 Subject: arm: improve tests and fix vnegq* gcc/ChangeLog: * config/arm/mve.md (mve_vnegq_f, mve_vnegq_s): Fix spacing. gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vnegq_f16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vnegq_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vnegq_m_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vnegq_m_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vnegq_m_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vnegq_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vnegq_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vnegq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vnegq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vnegq_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vnegq_x_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vnegq_x_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vnegq_x_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vnegq_x_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vnegq_x_s8.c: Likewise. * gcc.target/arm/simd/mve-vneg.c: Update test. * gcc.target/arm/simd/mve-vshr.c: Likewise --- gcc/config/arm/mve.md | 4 +-- .../gcc.target/arm/mve/intrinsics/vnegq_f16.c | 30 +++++++++++++++++++- .../gcc.target/arm/mve/intrinsics/vnegq_f32.c | 30 +++++++++++++++++++- .../gcc.target/arm/mve/intrinsics/vnegq_m_f16.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vnegq_m_f32.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vnegq_m_s16.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vnegq_m_s32.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vnegq_m_s8.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vnegq_s16.c | 28 +++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vnegq_s32.c | 28 +++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vnegq_s8.c | 24 ++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vnegq_x_f16.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vnegq_x_f32.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vnegq_x_s16.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vnegq_x_s32.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vnegq_x_s8.c | 33 ++++++++++++++++++++-- gcc/testsuite/gcc.target/arm/simd/mve-vneg.c | 4 +-- gcc/testsuite/gcc.target/arm/simd/mve-vshr.c | 2 +- 18 files changed, 433 insertions(+), 47 deletions(-) (limited to 'gcc') diff --git a/gcc/config/arm/mve.md b/gcc/config/arm/mve.md index 2728537..7767f94 100644 --- a/gcc/config/arm/mve.md +++ b/gcc/config/arm/mve.md @@ -252,7 +252,7 @@ (neg:MVE_0 (match_operand:MVE_0 1 "s_register_operand" "w"))) ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" - "vneg.f%# %q0, %q1" + "vneg.f%#\t%q0, %q1" [(set_attr "type" "mve_move") ]) @@ -401,7 +401,7 @@ (neg:MVE_2 (match_operand:MVE_2 1 "s_register_operand" "w"))) ] "TARGET_HAVE_MVE" - "vneg.s%# %q0, %q1" + "vneg.s%#\t%q0, %q1" [(set_attr "type" "mve_move") ]) diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_f16.c index 9572c14..9853cf6 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_f16.c @@ -1,13 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vneg.f16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a) { return vnegq_f16 (a); } -/* { dg-final { scan-assembler "vneg.f16" } } */ + +/* +**foo1: +** ... +** vneg.f16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ +float16x8_t +foo1 (float16x8_t a) +{ + return vnegq (a); +} + +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_f32.c index be73cc0..489cfc7 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_f32.c @@ -1,13 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vneg.f32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a) { return vnegq_f32 (a); } -/* { dg-final { scan-assembler "vneg.f32" } } */ + +/* +**foo1: +** ... +** vneg.f32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ +float32x4_t +foo1 (float32x4_t a) +{ + return vnegq (a); +} + +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_f16.c index 0d917b8..c8b307e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_f16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.f16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t inactive, float16x8_t a, mve_pred16_t p) { return vnegq_m_f16 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vnegt.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.f16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t inactive, float16x8_t a, mve_pred16_t p) { return vnegq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_f32.c index f1c0e9a..a530a05 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_f32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.f32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t inactive, float32x4_t a, mve_pred16_t p) { return vnegq_m_f32 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vnegt.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.f32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t inactive, float32x4_t a, mve_pred16_t p) { return vnegq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_s16.c index 9a945ee..46d6e79 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_s16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, mve_pred16_t p) { return vnegq_m_s16 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vnegt.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, mve_pred16_t p) { return vnegq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_s32.c index 811f1df..5fb1f5c 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_s32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, mve_pred16_t p) { return vnegq_m_s32 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vnegt.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, mve_pred16_t p) { return vnegq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_s8.c index 430ebc7..868a968 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_m_s8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, mve_pred16_t p) { return vnegq_m_s8 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vnegt.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, mve_pred16_t p) { return vnegq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_s16.c index a47f9b3..3b518c8 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_s16.c @@ -1,21 +1,41 @@ -/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ -/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vneg.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t a) { return vnegq_s16 (a); } -/* { dg-final { scan-assembler "vneg.s16" } } */ +/* +**foo1: +** ... +** vneg.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t a) { return vnegq (a); } -/* { dg-final { scan-assembler "vneg.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_s32.c index 50401f5..f868257 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_s32.c @@ -1,21 +1,41 @@ -/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ -/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vneg.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t a) { return vnegq_s32 (a); } -/* { dg-final { scan-assembler "vneg.s32" } } */ +/* +**foo1: +** ... +** vneg.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t a) { return vnegq (a); } -/* { dg-final { scan-assembler "vneg.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_s8.c index fd5de3d..1be5901 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vneg.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t a) { return vnegq_s8 (a); } -/* { dg-final { scan-assembler "vneg.s8" } } */ +/* +**foo1: +** ... +** vneg.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t a) { return vnegq (a); } -/* { dg-final { scan-assembler "vneg.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_f16.c index e7af366..c10d6d2 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_f16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.f16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, mve_pred16_t p) { return vnegq_x_f16 (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vnegt.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.f16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, mve_pred16_t p) { return vnegq_x (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_f32.c index d9c3818..0ee5ecc 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_f32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.f32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, mve_pred16_t p) { return vnegq_x_f32 (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vnegt.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.f32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, mve_pred16_t p) { return vnegq_x (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_s16.c index 16f1fa4..d774a05 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_s16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t a, mve_pred16_t p) { return vnegq_x_s16 (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vnegt.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t a, mve_pred16_t p) { return vnegq_x (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_s32.c index d74683c..77bf1a6 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_s32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t a, mve_pred16_t p) { return vnegq_x_s32 (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vnegt.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t a, mve_pred16_t p) { return vnegq_x (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_s8.c index eda4c7f..ca44512 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vnegq_x_s8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t a, mve_pred16_t p) { return vnegq_x_s8 (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vnegt.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vnegt.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t a, mve_pred16_t p) { return vnegq_x (a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vneg.c b/gcc/testsuite/gcc.target/arm/simd/mve-vneg.c index 7945a06..1379cae 100644 --- a/gcc/testsuite/gcc.target/arm/simd/mve-vneg.c +++ b/gcc/testsuite/gcc.target/arm/simd/mve-vneg.c @@ -45,8 +45,8 @@ FUNC(f, float, 16, 8, -, vneg) /* MVE has only 128-bit vectors, so we can vectorize only half of the functions above. */ -/* { dg-final { scan-assembler-times {vneg.s[0-9]+ q[0-9]+, q[0-9]+} 6 } } */ -/* { dg-final { scan-assembler-times {vneg.f[0-9]+ q[0-9]+, q[0-9]+} 2 } } */ +/* { dg-final { scan-assembler-times {vneg.s[0-9]+\tq[0-9]+, q[0-9]+} 6 } } */ +/* { dg-final { scan-assembler-times {vneg.f[0-9]+\tq[0-9]+, q[0-9]+} 2 } } */ /* { dg-final { scan-assembler-times {vldr[bhw].[0-9]+\tq[0-9]+} 8 } } */ /* { dg-final { scan-assembler-times {vstr[bhw].[0-9]+\tq[0-9]+} 8 } } */ /* { dg-final { scan-assembler-not {orr\tr[0-9]+, r[0-9]+, r[0-9]+} } } */ diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c b/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c index d4258e9..8c7adef 100644 --- a/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c +++ b/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c @@ -58,7 +58,7 @@ FUNC_IMM(u, uint, 8, 16, >>, vshrimm) /* Vector right shifts use vneg and left shifts. */ /* { dg-final { scan-assembler-times {vshl.s[0-9]+\tq[0-9]+, q[0-9]+} 3 } } */ /* { dg-final { scan-assembler-times {vshl.u[0-9]+\tq[0-9]+, q[0-9]+} 3 } } */ -/* { dg-final { scan-assembler-times {vneg.s[0-9]+ q[0-9]+, q[0-9]+} 6 } } */ +/* { dg-final { scan-assembler-times {vneg.s[0-9]+\tq[0-9]+, q[0-9]+} 6 } } */ /* Shift by immediate. */ -- cgit v1.1 From 6c61fac9016891c5444be859b080872ce96b63cf Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:11:01 +0100 Subject: arm: improve tests for vmulhq* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vmulhq_m_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vmulhq_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulhq_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulhq_m_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulhq_m_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulhq_m_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulhq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulhq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulhq_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulhq_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulhq_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulhq_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulhq_x_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulhq_x_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulhq_x_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulhq_x_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulhq_x_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulhq_x_u8.c: Likewise. --- .../gcc.target/arm/mve/intrinsics/vmulhq_m_s16.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vmulhq_m_s32.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vmulhq_m_s8.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vmulhq_m_u16.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vmulhq_m_u32.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vmulhq_m_u8.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vmulhq_s16.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vmulhq_s32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vmulhq_s8.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vmulhq_u16.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vmulhq_u32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vmulhq_u8.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vmulhq_x_s16.c | 33 +++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vmulhq_x_s32.c | 33 +++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vmulhq_x_s8.c | 33 +++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vmulhq_x_u16.c | 33 +++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vmulhq_x_u32.c | 33 +++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vmulhq_x_u8.c | 33 +++++++++++++++++++-- 18 files changed, 492 insertions(+), 54 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_s16.c index 4971869..a7d8460 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_s16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vmulhq_m_s16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vmulhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_s32.c index 3006de7..997fdbe 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_s32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vmulhq_m_s32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vmulhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_s8.c index fbcef24..567461f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_s8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vmulhq_m_s8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vmulhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_u16.c index 7059fec..9b81382 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_u16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint16x8_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmulhq_m_u16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.u16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint16x8_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmulhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.u16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_u32.c index 1c2de708..248432a 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_u32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint32x4_t inactive, uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vmulhq_m_u32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.u32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint32x4_t inactive, uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vmulhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.u32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_u8.c index 5eed85f..464180c 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_m_u8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint8x16_t foo (uint8x16_t inactive, uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmulhq_m_u8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.u8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint8x16_t foo1 (uint8x16_t inactive, uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmulhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.u8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_s16.c index a7260df..0950c06 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_s16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmulh.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t a, int16x8_t b) { return vmulhq_s16 (a, b); } -/* { dg-final { scan-assembler "vmulh.s16" } } */ +/* +**foo1: +** ... +** vmulh.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t a, int16x8_t b) { return vmulhq (a, b); } -/* { dg-final { scan-assembler "vmulh.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_s32.c index 4fe46e6..db2ab42 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmulh.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t a, int32x4_t b) { return vmulhq_s32 (a, b); } -/* { dg-final { scan-assembler "vmulh.s32" } } */ +/* +**foo1: +** ... +** vmulh.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t a, int32x4_t b) { return vmulhq (a, b); } -/* { dg-final { scan-assembler "vmulh.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_s8.c index acc0803..8bb2239 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmulh.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t a, int8x16_t b) { return vmulhq_s8 (a, b); } -/* { dg-final { scan-assembler "vmulh.s8" } } */ +/* +**foo1: +** ... +** vmulh.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t a, int8x16_t b) { return vmulhq (a, b); } -/* { dg-final { scan-assembler "vmulh.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_u16.c index 37e40f0..bb88136 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_u16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmulh.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint16x8_t a, uint16x8_t b) { return vmulhq_u16 (a, b); } -/* { dg-final { scan-assembler "vmulh.u16" } } */ +/* +**foo1: +** ... +** vmulh.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint16x8_t a, uint16x8_t b) { return vmulhq (a, b); } -/* { dg-final { scan-assembler "vmulh.u16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_u32.c index 5673d91..d42c41a 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_u32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmulh.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint32x4_t a, uint32x4_t b) { return vmulhq_u32 (a, b); } -/* { dg-final { scan-assembler "vmulh.u32" } } */ +/* +**foo1: +** ... +** vmulh.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint32x4_t a, uint32x4_t b) { return vmulhq (a, b); } -/* { dg-final { scan-assembler "vmulh.u32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_u8.c index 29c6312..c666a96 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_u8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmulh.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint8x16_t foo (uint8x16_t a, uint8x16_t b) { return vmulhq_u8 (a, b); } -/* { dg-final { scan-assembler "vmulh.u8" } } */ +/* +**foo1: +** ... +** vmulh.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint8x16_t foo1 (uint8x16_t a, uint8x16_t b) { return vmulhq (a, b); } -/* { dg-final { scan-assembler "vmulh.u8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_s16.c index b783570..a323c96 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_s16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t a, int16x8_t b, mve_pred16_t p) { return vmulhq_x_s16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t a, int16x8_t b, mve_pred16_t p) { return vmulhq_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_s32.c index 003485b..98168b1 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_s32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t a, int32x4_t b, mve_pred16_t p) { return vmulhq_x_s32 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t a, int32x4_t b, mve_pred16_t p) { return vmulhq_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_s8.c index d2359cd..b50f59b 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_s8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t a, int8x16_t b, mve_pred16_t p) { return vmulhq_x_s8 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t a, int8x16_t b, mve_pred16_t p) { return vmulhq_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_u16.c index c052c4a..afa803c 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_u16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmulhq_x_u16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.u16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmulhq_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_u32.c index 7eeba8b..22179547 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_u32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vmulhq_x_u32 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.u32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vmulhq_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_u8.c index ff2a53f..4383e2e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulhq_x_u8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint8x16_t foo (uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmulhq_x_u8 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulht.u8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulht.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint8x16_t foo1 (uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmulhq_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From e6f52130d0db50ca3f59e45676db9431fa44457c Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:12:08 +0100 Subject: arm: improve tests for vmullbq* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vmullbq_int_m_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vmullbq_int_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_int_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_int_m_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_int_m_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_int_m_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_int_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_int_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_int_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_int_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_int_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_int_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_int_x_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_int_x_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_int_x_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_int_x_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_int_x_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_int_x_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_poly_m_p16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_poly_m_p8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_poly_p16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_poly_p8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_poly_x_p16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmullbq_poly_x_p8.c: Likewise. --- .../arm/mve/intrinsics/vmullbq_int_m_s16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vmullbq_int_m_s32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vmullbq_int_m_s8.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vmullbq_int_m_u16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vmullbq_int_m_u32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vmullbq_int_m_u8.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vmullbq_int_s16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vmullbq_int_s32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vmullbq_int_s8.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vmullbq_int_u16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vmullbq_int_u32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vmullbq_int_u8.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vmullbq_int_x_s16.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vmullbq_int_x_s32.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vmullbq_int_x_s8.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vmullbq_int_x_u16.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vmullbq_int_x_u32.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vmullbq_int_x_u8.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vmullbq_poly_m_p16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vmullbq_poly_m_p8.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vmullbq_poly_p16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vmullbq_poly_p8.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vmullbq_poly_x_p16.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vmullbq_poly_x_p8.c | 33 +++++++++++++++++++-- 24 files changed, 656 insertions(+), 72 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_s16.c index be93327..a4cc5e5 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_s16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vmullbq_int_m_s16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vmullbq_int_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_s32.c index 3dfc267..a195884 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_s32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int64x2_t foo (int64x2_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vmullbq_int_m_s32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int64x2_t foo1 (int64x2_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vmullbq_int_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_s8.c index f8c449b..3a5d770 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_s8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vmullbq_int_m_s8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vmullbq_int_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_u16.c index dd6ed6b..5e327d2 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_u16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint32x4_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmullbq_int_m_u16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.u16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint32x4_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmullbq_int_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.u16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_u32.c index 85ce75e..fb2de99 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_u32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint64x2_t foo (uint64x2_t inactive, uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vmullbq_int_m_u32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.u32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint64x2_t foo1 (uint64x2_t inactive, uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vmullbq_int_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.u32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_u8.c index d131a5d..4cc06c4 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_m_u8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint16x8_t inactive, uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmullbq_int_m_u8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.u8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint16x8_t inactive, uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmullbq_int_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.u8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_s16.c index 22f4d27..16c0982 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_s16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmullb.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int16x8_t a, int16x8_t b) { return vmullbq_int_s16 (a, b); } -/* { dg-final { scan-assembler "vmullb.s16" } } */ +/* +**foo1: +** ... +** vmullb.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int16x8_t a, int16x8_t b) { return vmullbq_int (a, b); } -/* { dg-final { scan-assembler "vmullb.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_s32.c index 6e677f2..e0a82d6 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmullb.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int64x2_t foo (int32x4_t a, int32x4_t b) { return vmullbq_int_s32 (a, b); } -/* { dg-final { scan-assembler "vmullb.s32" } } */ +/* +**foo1: +** ... +** vmullb.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int64x2_t foo1 (int32x4_t a, int32x4_t b) { return vmullbq_int (a, b); } -/* { dg-final { scan-assembler "vmullb.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_s8.c index f40b8a6..031a433 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmullb.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int8x16_t a, int8x16_t b) { return vmullbq_int_s8 (a, b); } -/* { dg-final { scan-assembler "vmullb.s8" } } */ +/* +**foo1: +** ... +** vmullb.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int8x16_t a, int8x16_t b) { return vmullbq_int (a, b); } -/* { dg-final { scan-assembler "vmullb.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_u16.c index 3529ab2..4bb19bf 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_u16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmullb.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint16x8_t a, uint16x8_t b) { return vmullbq_int_u16 (a, b); } -/* { dg-final { scan-assembler "vmullb.u16" } } */ +/* +**foo1: +** ... +** vmullb.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint16x8_t a, uint16x8_t b) { return vmullbq_int (a, b); } -/* { dg-final { scan-assembler "vmullb.u16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_u32.c index d843d2bf..d461ed9 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_u32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmullb.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint64x2_t foo (uint32x4_t a, uint32x4_t b) { return vmullbq_int_u32 (a, b); } -/* { dg-final { scan-assembler "vmullb.u32" } } */ +/* +**foo1: +** ... +** vmullb.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint64x2_t foo1 (uint32x4_t a, uint32x4_t b) { return vmullbq_int (a, b); } -/* { dg-final { scan-assembler "vmullb.u32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_u8.c index 6268c46..c079077 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_u8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmullb.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint8x16_t a, uint8x16_t b) { return vmullbq_int_u8 (a, b); } -/* { dg-final { scan-assembler "vmullb.u8" } } */ +/* +**foo1: +** ... +** vmullb.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint8x16_t a, uint8x16_t b) { return vmullbq_int (a, b); } -/* { dg-final { scan-assembler "vmullb.u8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_s16.c index 87f8e21..ee83ca6 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_s16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int16x8_t a, int16x8_t b, mve_pred16_t p) { return vmullbq_int_x_s16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int16x8_t a, int16x8_t b, mve_pred16_t p) { return vmullbq_int_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_s32.c index 5e56372..42ae332 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_s32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int64x2_t foo (int32x4_t a, int32x4_t b, mve_pred16_t p) { return vmullbq_int_x_s32 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int64x2_t foo1 (int32x4_t a, int32x4_t b, mve_pred16_t p) { return vmullbq_int_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_s8.c index b2ca413..8dcf9b7 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_s8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int8x16_t a, int8x16_t b, mve_pred16_t p) { return vmullbq_int_x_s8 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int8x16_t a, int8x16_t b, mve_pred16_t p) { return vmullbq_int_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_u16.c index 1526910..31330da 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_u16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmullbq_int_x_u16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.u16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmullbq_int_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_u32.c index 7a78363..b882d64 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_u32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint64x2_t foo (uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vmullbq_int_x_u32 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.u32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint64x2_t foo1 (uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vmullbq_int_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_u8.c index f422a3c..4b40237 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_int_x_u8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmullbq_int_x_u8 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.u8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmullbq_int_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_m_p16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_m_p16.c index 527acb7..2efb87d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_m_p16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_m_p16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.p16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint32x4_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmullbq_poly_m_p16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.p16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.p16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint32x4_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmullbq_poly_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.p16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_m_p8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_m_p8.c index 5403394..b435f44 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_m_p8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_m_p8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.p8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint16x8_t inactive, uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmullbq_poly_m_p8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.p8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.p8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint16x8_t inactive, uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmullbq_poly_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.p8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_p16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_p16.c index d01d599..bfd0522 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_p16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_p16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmullb.p16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint16x8_t a, uint16x8_t b) { return vmullbq_poly_p16 (a, b); } -/* { dg-final { scan-assembler "vmullb.p16" } } */ +/* +**foo1: +** ... +** vmullb.p16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint16x8_t a, uint16x8_t b) { return vmullbq_poly (a, b); } -/* { dg-final { scan-assembler "vmullb.p16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_p8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_p8.c index de97134..a2a53e8 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_p8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_p8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmullb.p8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint8x16_t a, uint8x16_t b) { return vmullbq_poly_p8 (a, b); } -/* { dg-final { scan-assembler "vmullb.p8" } } */ +/* +**foo1: +** ... +** vmullb.p8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint8x16_t a, uint8x16_t b) { return vmullbq_poly (a, b); } -/* { dg-final { scan-assembler "vmullb.p8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_x_p16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_x_p16.c index f94d905..bee45f9 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_x_p16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_x_p16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.p16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmullbq_poly_x_p16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.p16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.p16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmullbq_poly_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_x_p8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_x_p8.c index 6fdc944..7cd15f3a 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_x_p8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmullbq_poly_x_p8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.p8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmullbq_poly_x_p8 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmullbt.p8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmullbt.p8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmullbq_poly_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From 59d46d5ba0bf81a7431c0bae1ad8d1024249be47 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:14:13 +0100 Subject: arm: improve tests for vmulltq* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vmulltq_int_m_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vmulltq_int_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_int_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_int_m_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_int_m_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_int_m_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_int_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_int_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_int_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_int_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_int_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_int_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_int_x_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_int_x_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_int_x_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_int_x_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_int_x_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_int_x_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_poly_m_p16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_poly_m_p8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_poly_p16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_poly_p8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_poly_x_p16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmulltq_poly_x_p8.c: Likewise. --- .../arm/mve/intrinsics/vmulltq_int_m_s16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vmulltq_int_m_s32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vmulltq_int_m_s8.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vmulltq_int_m_u16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vmulltq_int_m_u32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vmulltq_int_m_u8.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vmulltq_int_s16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vmulltq_int_s32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vmulltq_int_s8.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vmulltq_int_u16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vmulltq_int_u32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vmulltq_int_u8.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vmulltq_int_x_s16.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vmulltq_int_x_s32.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vmulltq_int_x_s8.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vmulltq_int_x_u16.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vmulltq_int_x_u32.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vmulltq_int_x_u8.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vmulltq_poly_m_p16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vmulltq_poly_m_p8.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vmulltq_poly_p16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vmulltq_poly_p8.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vmulltq_poly_x_p16.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vmulltq_poly_x_p8.c | 33 +++++++++++++++++++-- 24 files changed, 656 insertions(+), 72 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_s16.c index 25ecf7a..7f573e9 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_s16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vmulltq_int_m_s16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vmulltq_int_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_s32.c index f8d0288..da440dd 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_s32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int64x2_t foo (int64x2_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vmulltq_int_m_s32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int64x2_t foo1 (int64x2_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vmulltq_int_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_s8.c index 3f2fc33..ceb8e1d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_s8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vmulltq_int_m_s8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vmulltq_int_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_u16.c index b7ab408..a751546 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_u16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint32x4_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmulltq_int_m_u16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.u16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint32x4_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmulltq_int_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.u16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_u32.c index e43ad98..a6c4d27 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_u32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint64x2_t foo (uint64x2_t inactive, uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vmulltq_int_m_u32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.u32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint64x2_t foo1 (uint64x2_t inactive, uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vmulltq_int_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.u32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_u8.c index 7f4b90b..1a7466b 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_m_u8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint16x8_t inactive, uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmulltq_int_m_u8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.u8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint16x8_t inactive, uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmulltq_int_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.u8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_s16.c index 34b75d4..cd907f6 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_s16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmullt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int16x8_t a, int16x8_t b) { return vmulltq_int_s16 (a, b); } -/* { dg-final { scan-assembler "vmullt.s16" } } */ +/* +**foo1: +** ... +** vmullt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int16x8_t a, int16x8_t b) { return vmulltq_int (a, b); } -/* { dg-final { scan-assembler "vmullt.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_s32.c index 7e09bf9..dbc4c80 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmullt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int64x2_t foo (int32x4_t a, int32x4_t b) { return vmulltq_int_s32 (a, b); } -/* { dg-final { scan-assembler "vmullt.s32" } } */ +/* +**foo1: +** ... +** vmullt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int64x2_t foo1 (int32x4_t a, int32x4_t b) { return vmulltq_int (a, b); } -/* { dg-final { scan-assembler "vmullt.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_s8.c index b6eb1f5..0fef6a2 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmullt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int8x16_t a, int8x16_t b) { return vmulltq_int_s8 (a, b); } -/* { dg-final { scan-assembler "vmullt.s8" } } */ +/* +**foo1: +** ... +** vmullt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int8x16_t a, int8x16_t b) { return vmulltq_int (a, b); } -/* { dg-final { scan-assembler "vmullt.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_u16.c index f4fc9c0..91b6fb4 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_u16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmullt.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint16x8_t a, uint16x8_t b) { return vmulltq_int_u16 (a, b); } -/* { dg-final { scan-assembler "vmullt.u16" } } */ +/* +**foo1: +** ... +** vmullt.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint16x8_t a, uint16x8_t b) { return vmulltq_int (a, b); } -/* { dg-final { scan-assembler "vmullt.u16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_u32.c index d1bc3a8..71c62a1 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_u32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmullt.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint64x2_t foo (uint32x4_t a, uint32x4_t b) { return vmulltq_int_u32 (a, b); } -/* { dg-final { scan-assembler "vmullt.u32" } } */ +/* +**foo1: +** ... +** vmullt.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint64x2_t foo1 (uint32x4_t a, uint32x4_t b) { return vmulltq_int (a, b); } -/* { dg-final { scan-assembler "vmullt.u32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_u8.c index 87f3c4e..7506adc 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_u8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmullt.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint8x16_t a, uint8x16_t b) { return vmulltq_int_u8 (a, b); } -/* { dg-final { scan-assembler "vmullt.u8" } } */ +/* +**foo1: +** ... +** vmullt.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint8x16_t a, uint8x16_t b) { return vmulltq_int (a, b); } -/* { dg-final { scan-assembler "vmullt.u8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_s16.c index c13ef50..c2376ab 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_s16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int16x8_t a, int16x8_t b, mve_pred16_t p) { return vmulltq_int_x_s16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int16x8_t a, int16x8_t b, mve_pred16_t p) { return vmulltq_int_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_s32.c index e82321e..788789d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_s32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int64x2_t foo (int32x4_t a, int32x4_t b, mve_pred16_t p) { return vmulltq_int_x_s32 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int64x2_t foo1 (int32x4_t a, int32x4_t b, mve_pred16_t p) { return vmulltq_int_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_s8.c index 7f093c2..3935741 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_s8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int8x16_t a, int8x16_t b, mve_pred16_t p) { return vmulltq_int_x_s8 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int8x16_t a, int8x16_t b, mve_pred16_t p) { return vmulltq_int_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_u16.c index d0f6461..32ee5b2 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_u16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmulltq_int_x_u16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.u16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.u16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmulltq_int_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_u32.c index 55e19cb..cc31056 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_u32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint64x2_t foo (uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vmulltq_int_x_u32 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.u32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.u32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint64x2_t foo1 (uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vmulltq_int_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_u8.c index 650c947..01713fb 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_int_x_u8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmulltq_int_x_u8 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.u8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.u8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmulltq_int_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_m_p16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_m_p16.c index 944db4c..6d368e2 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_m_p16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_m_p16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.p16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint32x4_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmulltq_poly_m_p16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.p16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.p16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint32x4_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmulltq_poly_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.p16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_m_p8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_m_p8.c index d073119..75b8811 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_m_p8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_m_p8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.p8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint16x8_t inactive, uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmulltq_poly_m_p8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.p8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.p8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint16x8_t inactive, uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmulltq_poly_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.p8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_p16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_p16.c index 121de8e..9f08d57 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_p16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_p16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmullt.p16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint16x8_t a, uint16x8_t b) { return vmulltq_poly_p16 (a, b); } -/* { dg-final { scan-assembler "vmullt.p16" } } */ +/* +**foo1: +** ... +** vmullt.p16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint16x8_t a, uint16x8_t b) { return vmulltq_poly (a, b); } -/* { dg-final { scan-assembler "vmullt.p16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_p8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_p8.c index c7d9548..59e6e1b 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_p8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_p8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmullt.p8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint8x16_t a, uint8x16_t b) { return vmulltq_poly_p8 (a, b); } -/* { dg-final { scan-assembler "vmullt.p8" } } */ +/* +**foo1: +** ... +** vmullt.p8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint8x16_t a, uint8x16_t b) { return vmulltq_poly (a, b); } -/* { dg-final { scan-assembler "vmullt.p8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_x_p16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_x_p16.c index fb4b849..f3d3de2 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_x_p16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_x_p16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.p16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo (uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmulltq_poly_x_p16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.p16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.p16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vmulltq_poly_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_x_p8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_x_p8.c index 1e79b29..2c7a629 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_x_p8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulltq_poly_x_p8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.p8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo (uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmulltq_poly_x_p8 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vmulltt.p8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vmulltt.p8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vmulltq_poly_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From 6764c13b14b036e70da28b0245c1299aecc061a9 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:33:58 +0100 Subject: arm: improve tests for vcaddq* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vcaddq_rot270_f16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u8.c: Likewise. --- .../arm/mve/intrinsics/vcaddq_rot270_f16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot270_f32.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot270_m_f16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcaddq_rot270_m_f32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcaddq_rot270_m_s16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcaddq_rot270_m_s32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcaddq_rot270_m_s8.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcaddq_rot270_m_u16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcaddq_rot270_m_u32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcaddq_rot270_m_u8.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcaddq_rot270_s16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot270_s32.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot270_s8.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot270_u16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot270_u32.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot270_u8.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot270_x_f16.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot270_x_f32.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot270_x_s16.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot270_x_s32.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot270_x_s8.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot270_x_u16.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot270_x_u32.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot270_x_u8.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot90_f16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot90_f32.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot90_m_f16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcaddq_rot90_m_f32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcaddq_rot90_m_s16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcaddq_rot90_m_s32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcaddq_rot90_m_s8.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcaddq_rot90_m_u16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcaddq_rot90_m_u32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcaddq_rot90_m_u8.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcaddq_rot90_s16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot90_s32.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot90_s8.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot90_u16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot90_u32.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot90_u8.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot90_x_f16.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot90_x_f32.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot90_x_s16.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot90_x_s32.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot90_x_s8.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot90_x_u16.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot90_x_u32.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcaddq_rot90_x_u8.c | 33 +++++++++++++++++++-- 48 files changed, 1312 insertions(+), 144 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_f16.c index b50a5d5..fb83a1c 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_f16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcadd.f16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b) { return vcaddq_rot270_f16 (a, b); } -/* { dg-final { scan-assembler "vcadd.f16" } } */ +/* +**foo1: +** ... +** vcadd.f16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b) { return vcaddq_rot270 (a, b); } -/* { dg-final { scan-assembler "vcadd.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_f32.c index 0a12ff6..f8341a7 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_f32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcadd.f32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b) { return vcaddq_rot270_f32 (a, b); } -/* { dg-final { scan-assembler "vcadd.f32" } } */ +/* +**foo1: +** ... +** vcadd.f32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b) { return vcaddq_rot270 (a, b); } -/* { dg-final { scan-assembler "vcadd.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_f16.c index e78bbd5..b4e2ffd 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_f16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.f16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcaddq_rot270_m_f16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.f16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcaddq_rot270_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_f32.c index 8b53c66..e7adc1b 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_f32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.f32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t inactive, float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcaddq_rot270_m_f32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.f32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t inactive, float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcaddq_rot270_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s16.c index 61948bb..fdde2f5 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vcaddq_rot270_m_s16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vcaddq_rot270_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s32.c index 0bbe24b..1cb6afb 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vcaddq_rot270_m_s32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vcaddq_rot270_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s8.c index e9cab3d..39f0639 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i8 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vcaddq_rot270_m_s8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i8 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vcaddq_rot270_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u16.c index 25c7125..fd28528 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint16x8_t foo (uint16x8_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vcaddq_rot270_m_u16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint16x8_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vcaddq_rot270_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u32.c index ee437ee..053a611 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint32x4_t foo (uint32x4_t inactive, uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vcaddq_rot270_m_u32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint32x4_t inactive, uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vcaddq_rot270_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u8.c index 419ba7e..869983a 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i8 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint8x16_t foo (uint8x16_t inactive, uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vcaddq_rot270_m_u8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i8 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint8x16_t foo1 (uint8x16_t inactive, uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vcaddq_rot270_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_s16.c index 832be00..67b0d0a 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_s16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcadd.i16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t a, int16x8_t b) { return vcaddq_rot270_s16 (a, b); } -/* { dg-final { scan-assembler "vcadd.i16" } } */ +/* +**foo1: +** ... +** vcadd.i16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t a, int16x8_t b) { return vcaddq_rot270 (a, b); } -/* { dg-final { scan-assembler "vcadd.i16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_s32.c index dbebe22..ab28458 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcadd.i32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t a, int32x4_t b) { return vcaddq_rot270_s32 (a, b); } -/* { dg-final { scan-assembler "vcadd.i32" } } */ +/* +**foo1: +** ... +** vcadd.i32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t a, int32x4_t b) { return vcaddq_rot270 (a, b); } -/* { dg-final { scan-assembler "vcadd.i32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_s8.c index 5f7852f..842d6ad 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcadd.i8 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t a, int8x16_t b) { return vcaddq_rot270_s8 (a, b); } -/* { dg-final { scan-assembler "vcadd.i8" } } */ +/* +**foo1: +** ... +** vcadd.i8 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t a, int8x16_t b) { return vcaddq_rot270 (a, b); } -/* { dg-final { scan-assembler "vcadd.i8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_u16.c index 80b6c0f..97773d8 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_u16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcadd.i16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint16x8_t foo (uint16x8_t a, uint16x8_t b) { return vcaddq_rot270_u16 (a, b); } -/* { dg-final { scan-assembler "vcadd.i16" } } */ +/* +**foo1: +** ... +** vcadd.i16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint16x8_t a, uint16x8_t b) { return vcaddq_rot270 (a, b); } -/* { dg-final { scan-assembler "vcadd.i16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_u32.c index 260c5b8..17d5c14 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_u32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcadd.i32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint32x4_t foo (uint32x4_t a, uint32x4_t b) { return vcaddq_rot270_u32 (a, b); } -/* { dg-final { scan-assembler "vcadd.i32" } } */ +/* +**foo1: +** ... +** vcadd.i32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint32x4_t a, uint32x4_t b) { return vcaddq_rot270 (a, b); } -/* { dg-final { scan-assembler "vcadd.i32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_u8.c index ae9c4f4..faf01a1 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_u8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcadd.i8 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint8x16_t foo (uint8x16_t a, uint8x16_t b) { return vcaddq_rot270_u8 (a, b); } -/* { dg-final { scan-assembler "vcadd.i8" } } */ +/* +**foo1: +** ... +** vcadd.i8 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint8x16_t foo1 (uint8x16_t a, uint8x16_t b) { return vcaddq_rot270 (a, b); } -/* { dg-final { scan-assembler "vcadd.i8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_f16.c index 4b99c63..f35aaf0 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_f16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.f16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcaddq_rot270_x_f16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.f16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcaddq_rot270_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_f32.c index 2532ef7..6446d9e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_f32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.f32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcaddq_rot270_x_f32 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.f32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcaddq_rot270_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s16.c index 676efa8..b92fd2e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t a, int16x8_t b, mve_pred16_t p) { return vcaddq_rot270_x_s16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t a, int16x8_t b, mve_pred16_t p) { return vcaddq_rot270_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s32.c index 9aa05d5..b8acc67 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t a, int32x4_t b, mve_pred16_t p) { return vcaddq_rot270_x_s32 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t a, int32x4_t b, mve_pred16_t p) { return vcaddq_rot270_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s8.c index 4532296..78ec786 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i8 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t a, int8x16_t b, mve_pred16_t p) { return vcaddq_rot270_x_s8 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i8 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t a, int8x16_t b, mve_pred16_t p) { return vcaddq_rot270_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u16.c index 51db937..ea78162 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint16x8_t foo (uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vcaddq_rot270_x_u16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vcaddq_rot270_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u32.c index a2e51c1..a43d806 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint32x4_t foo (uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vcaddq_rot270_x_u32 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vcaddq_rot270_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u8.c index 6ae7f69..eb9cf0c 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i8 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint8x16_t foo (uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vcaddq_rot270_x_u8 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i8 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ uint8x16_t foo1 (uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vcaddq_rot270_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_f16.c index e1b21e6..1e78bd1 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_f16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcadd.f16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b) { return vcaddq_rot90_f16 (a, b); } -/* { dg-final { scan-assembler "vcadd.f16" } } */ +/* +**foo1: +** ... +** vcadd.f16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b) { return vcaddq_rot90 (a, b); } -/* { dg-final { scan-assembler "vcadd.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_f32.c index 118489e..9611f89 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_f32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcadd.f32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b) { return vcaddq_rot90_f32 (a, b); } -/* { dg-final { scan-assembler "vcadd.f32" } } */ +/* +**foo1: +** ... +** vcadd.f32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b) { return vcaddq_rot90 (a, b); } -/* { dg-final { scan-assembler "vcadd.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_f16.c index e47e242..58608b4 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_f16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.f16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcaddq_rot90_m_f16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.f16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcaddq_rot90_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_f32.c index 833aa9c..125dbe5 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_f32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.f32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t inactive, float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcaddq_rot90_m_f32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.f32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t inactive, float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcaddq_rot90_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s16.c index 46babedb..38e0e47 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vcaddq_rot90_m_s16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vcaddq_rot90_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s32.c index 15774e5..455d838 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vcaddq_rot90_m_s32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vcaddq_rot90_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s8.c index 6f2bb4d..7217dad 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i8 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vcaddq_rot90_m_s8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i8 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vcaddq_rot90_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u16.c index b9113fe..d3edbaa 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint16x8_t foo (uint16x8_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vcaddq_rot90_m_u16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint16x8_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vcaddq_rot90_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u32.c index b7fe510..eb1bf2a 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint32x4_t foo (uint32x4_t inactive, uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vcaddq_rot90_m_u32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint32x4_t inactive, uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vcaddq_rot90_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u8.c index e6c4e9f..3343399 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i8 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint8x16_t foo (uint8x16_t inactive, uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vcaddq_rot90_m_u8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i8 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint8x16_t foo1 (uint8x16_t inactive, uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vcaddq_rot90_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_s16.c index 8279da9..134fba6 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_s16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcadd.i16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t a, int16x8_t b) { return vcaddq_rot90_s16 (a, b); } -/* { dg-final { scan-assembler "vcadd.i16" } } */ +/* +**foo1: +** ... +** vcadd.i16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t a, int16x8_t b) { return vcaddq_rot90 (a, b); } -/* { dg-final { scan-assembler "vcadd.i16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_s32.c index 6d59da7..b8e8167 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcadd.i32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t a, int32x4_t b) { return vcaddq_rot90_s32 (a, b); } -/* { dg-final { scan-assembler "vcadd.i32" } } */ +/* +**foo1: +** ... +** vcadd.i32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t a, int32x4_t b) { return vcaddq_rot90 (a, b); } -/* { dg-final { scan-assembler "vcadd.i32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_s8.c index b4f5a22..2a37b8e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcadd.i8 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t a, int8x16_t b) { return vcaddq_rot90_s8 (a, b); } -/* { dg-final { scan-assembler "vcadd.i8" } } */ +/* +**foo1: +** ... +** vcadd.i8 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t a, int8x16_t b) { return vcaddq_rot90 (a, b); } -/* { dg-final { scan-assembler "vcadd.i8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_u16.c index e203bd0..51e1871 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_u16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcadd.i16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint16x8_t foo (uint16x8_t a, uint16x8_t b) { return vcaddq_rot90_u16 (a, b); } -/* { dg-final { scan-assembler "vcadd.i16" } } */ +/* +**foo1: +** ... +** vcadd.i16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint16x8_t a, uint16x8_t b) { return vcaddq_rot90 (a, b); } -/* { dg-final { scan-assembler "vcadd.i16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_u32.c index 0cba5d5..5905062 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_u32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcadd.i32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint32x4_t foo (uint32x4_t a, uint32x4_t b) { return vcaddq_rot90_u32 (a, b); } -/* { dg-final { scan-assembler "vcadd.i32" } } */ +/* +**foo1: +** ... +** vcadd.i32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint32x4_t a, uint32x4_t b) { return vcaddq_rot90 (a, b); } -/* { dg-final { scan-assembler "vcadd.i32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_u8.c index f4f0476..3737463 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_u8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcadd.i8 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint8x16_t foo (uint8x16_t a, uint8x16_t b) { return vcaddq_rot90_u8 (a, b); } -/* { dg-final { scan-assembler "vcadd.i8" } } */ +/* +**foo1: +** ... +** vcadd.i8 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint8x16_t foo1 (uint8x16_t a, uint8x16_t b) { return vcaddq_rot90 (a, b); } -/* { dg-final { scan-assembler "vcadd.i8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_f16.c index 476648a..4223c4d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_f16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.f16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcaddq_rot90_x_f16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.f16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcaddq_rot90_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_f32.c index ae9a196..9e67c56 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_f32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.f32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcaddq_rot90_x_f32 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.f32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcaddq_rot90_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s16.c index 16b5949..553fc28 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t a, int16x8_t b, mve_pred16_t p) { return vcaddq_rot90_x_s16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t a, int16x8_t b, mve_pred16_t p) { return vcaddq_rot90_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s32.c index d30150e..1cd7338 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t a, int32x4_t b, mve_pred16_t p) { return vcaddq_rot90_x_s32 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t a, int32x4_t b, mve_pred16_t p) { return vcaddq_rot90_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s8.c index fa79ce2..13373d4 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i8 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t a, int8x16_t b, mve_pred16_t p) { return vcaddq_rot90_x_s8 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i8 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t a, int8x16_t b, mve_pred16_t p) { return vcaddq_rot90_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u16.c index e18a39e..3f89577 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint16x8_t foo (uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vcaddq_rot90_x_u16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint16x8_t foo1 (uint16x8_t a, uint16x8_t b, mve_pred16_t p) { return vcaddq_rot90_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u32.c index b9b95fe..34cb036 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint32x4_t foo (uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vcaddq_rot90_x_u32 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint32x4_t foo1 (uint32x4_t a, uint32x4_t b, mve_pred16_t p) { return vcaddq_rot90_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u8.c index b8b8978..d383404 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i8 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint8x16_t foo (uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vcaddq_rot90_x_u8 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcaddt.i8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcaddt.i8 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ uint8x16_t foo1 (uint8x16_t a, uint8x16_t b, mve_pred16_t p) { return vcaddq_rot90_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From 0ea30b2a83c908323d73309b6f698331607eb2e0 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:34:41 +0100 Subject: arm: improve tests for vcmlaq* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vcmlaq_f16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vcmlaq_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmlaq_m_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmlaq_m_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmlaq_rot180_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmlaq_rot180_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmlaq_rot180_m_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmlaq_rot180_m_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmlaq_rot270_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmlaq_rot270_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmlaq_rot270_m_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmlaq_rot270_m_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmlaq_rot90_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmlaq_rot90_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmlaq_rot90_m_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmlaq_rot90_m_f32.c: Likewise. --- .../gcc.target/arm/mve/intrinsics/vcmlaq_f16.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vcmlaq_f32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vcmlaq_m_f16.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vcmlaq_m_f32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcmlaq_rot180_f16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcmlaq_rot180_f32.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcmlaq_rot180_m_f16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcmlaq_rot180_m_f32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcmlaq_rot270_f16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcmlaq_rot270_f32.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcmlaq_rot270_m_f16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcmlaq_rot270_m_f32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcmlaq_rot90_f16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcmlaq_rot90_f32.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcmlaq_rot90_m_f16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcmlaq_rot90_m_f32.c | 34 +++++++++++++++++++--- 16 files changed, 416 insertions(+), 48 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_f16.c index fa7d0c0..bb8a997 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_f16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcmla.f16 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b, float16x8_t c) { return vcmlaq_f16 (a, b, c); } -/* { dg-final { scan-assembler "vcmla.f16" } } */ +/* +**foo1: +** ... +** vcmla.f16 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b, float16x8_t c) { return vcmlaq (a, b, c); } -/* { dg-final { scan-assembler "vcmla.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_f32.c index 166bf42..71ec4b84 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_f32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcmla.f32 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b, float32x4_t c) { return vcmlaq_f32 (a, b, c); } -/* { dg-final { scan-assembler "vcmla.f32" } } */ +/* +**foo1: +** ... +** vcmla.f32 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b, float32x4_t c) { return vcmlaq (a, b, c); } -/* { dg-final { scan-assembler "vcmla.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_m_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_m_f16.c index 0929f5a..3db345d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_m_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_m_f16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmlat.f16 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b, float16x8_t c, mve_pred16_t p) { return vcmlaq_m_f16 (a, b, c, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmlat.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmlat.f16 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b, float16x8_t c, mve_pred16_t p) { return vcmlaq_m (a, b, c, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmlat.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_m_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_m_f32.c index 1f4ba45..dcbd2dc 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_m_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_m_f32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmlat.f32 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b, float32x4_t c, mve_pred16_t p) { return vcmlaq_m_f32 (a, b, c, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmlat.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmlat.f32 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b, float32x4_t c, mve_pred16_t p) { return vcmlaq_m (a, b, c, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmlat.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot180_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot180_f16.c index fc6ba30..f76ae23 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot180_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot180_f16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcmla.f16 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b, float16x8_t c) { return vcmlaq_rot180_f16 (a, b, c); } -/* { dg-final { scan-assembler "vcmla.f16" } } */ +/* +**foo1: +** ... +** vcmla.f16 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b, float16x8_t c) { return vcmlaq_rot180 (a, b, c); } -/* { dg-final { scan-assembler "vcmla.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot180_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot180_f32.c index dbe3f26..c97d0d0 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot180_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot180_f32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcmla.f32 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b, float32x4_t c) { return vcmlaq_rot180_f32 (a, b, c); } -/* { dg-final { scan-assembler "vcmla.f32" } } */ +/* +**foo1: +** ... +** vcmla.f32 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b, float32x4_t c) { return vcmlaq_rot180 (a, b, c); } -/* { dg-final { scan-assembler "vcmla.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot180_m_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot180_m_f16.c index 84a3bd8..132cdf9 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot180_m_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot180_m_f16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmlat.f16 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b, float16x8_t c, mve_pred16_t p) { return vcmlaq_rot180_m_f16 (a, b, c, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmlat.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmlat.f16 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b, float16x8_t c, mve_pred16_t p) { return vcmlaq_rot180_m (a, b, c, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmlat.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot180_m_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot180_m_f32.c index 61f5716..99e96eb 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot180_m_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot180_m_f32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmlat.f32 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b, float32x4_t c, mve_pred16_t p) { return vcmlaq_rot180_m_f32 (a, b, c, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmlat.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmlat.f32 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b, float32x4_t c, mve_pred16_t p) { return vcmlaq_rot180_m (a, b, c, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmlat.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot270_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot270_f16.c index 1b0bef9..fae8510 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot270_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot270_f16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcmla.f16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b, float16x8_t c) { return vcmlaq_rot270_f16 (a, b, c); } -/* { dg-final { scan-assembler "vcmla.f16" } } */ +/* +**foo1: +** ... +** vcmla.f16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b, float16x8_t c) { return vcmlaq_rot270 (a, b, c); } -/* { dg-final { scan-assembler "vcmla.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot270_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot270_f32.c index 83e1502..54a9b66 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot270_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot270_f32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcmla.f32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b, float32x4_t c) { return vcmlaq_rot270_f32 (a, b, c); } -/* { dg-final { scan-assembler "vcmla.f32" } } */ +/* +**foo1: +** ... +** vcmla.f32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b, float32x4_t c) { return vcmlaq_rot270 (a, b, c); } -/* { dg-final { scan-assembler "vcmla.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot270_m_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot270_m_f16.c index 6e033b1..e34f831 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot270_m_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot270_m_f16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmlat.f16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b, float16x8_t c, mve_pred16_t p) { return vcmlaq_rot270_m_f16 (a, b, c, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmlat.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmlat.f16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b, float16x8_t c, mve_pred16_t p) { return vcmlaq_rot270_m (a, b, c, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmlat.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot270_m_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot270_m_f32.c index 4928341..cdba91b 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot270_m_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot270_m_f32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmlat.f32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b, float32x4_t c, mve_pred16_t p) { return vcmlaq_rot270_m_f32 (a, b, c, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmlat.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmlat.f32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b, float32x4_t c, mve_pred16_t p) { return vcmlaq_rot270_m (a, b, c, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmlat.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot90_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot90_f16.c index 16744a4..f767b2b 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot90_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot90_f16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcmla.f16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b, float16x8_t c) { return vcmlaq_rot90_f16 (a, b, c); } -/* { dg-final { scan-assembler "vcmla.f16" } } */ +/* +**foo1: +** ... +** vcmla.f16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b, float16x8_t c) { return vcmlaq_rot90 (a, b, c); } -/* { dg-final { scan-assembler "vcmla.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot90_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot90_f32.c index f1f19a8..6c9b24f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot90_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot90_f32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcmla.f32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b, float32x4_t c) { return vcmlaq_rot90_f32 (a, b, c); } -/* { dg-final { scan-assembler "vcmla.f32" } } */ +/* +**foo1: +** ... +** vcmla.f32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b, float32x4_t c) { return vcmlaq_rot90 (a, b, c); } -/* { dg-final { scan-assembler "vcmla.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot90_m_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot90_m_f16.c index 7133ddc..9141c9e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot90_m_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot90_m_f16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmlat.f16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b, float16x8_t c, mve_pred16_t p) { return vcmlaq_rot90_m_f16 (a, b, c, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmlat.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmlat.f16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b, float16x8_t c, mve_pred16_t p) { return vcmlaq_rot90_m (a, b, c, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmlat.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot90_m_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot90_m_f32.c index 6022e3b..f317d41 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot90_m_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmlaq_rot90_m_f32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmlat.f32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b, float32x4_t c, mve_pred16_t p) { return vcmlaq_rot90_m_f32 (a, b, c, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmlat.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmlat.f32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b, float32x4_t c, mve_pred16_t p) { return vcmlaq_rot90_m (a, b, c, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmlat.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From c3c828436e7db1787d644153fe07daf356c99f2a Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:35:24 +0100 Subject: arm: improve tests for vcmulq* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vcmulq_f16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vcmulq_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_m_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_m_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot180_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot180_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot180_m_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot180_m_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot180_x_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot180_x_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot270_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot270_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot270_m_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot270_m_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot270_x_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot270_x_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot90_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot90_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot90_m_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot90_m_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot90_x_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_rot90_x_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_x_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vcmulq_x_f32.c: Likewise. --- .../gcc.target/arm/mve/intrinsics/vcmulq_f16.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vcmulq_f32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vcmulq_m_f16.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vcmulq_m_f32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcmulq_rot180_f16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcmulq_rot180_f32.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcmulq_rot180_m_f16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcmulq_rot180_m_f32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcmulq_rot180_x_f16.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcmulq_rot180_x_f32.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcmulq_rot270_f16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcmulq_rot270_f32.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcmulq_rot270_m_f16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcmulq_rot270_m_f32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcmulq_rot270_x_f16.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcmulq_rot270_x_f32.c | 33 +++++++++++++++++++-- .../arm/mve/intrinsics/vcmulq_rot90_f16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcmulq_rot90_f32.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vcmulq_rot90_m_f16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcmulq_rot90_m_f32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcmulq_rot90_x_f16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vcmulq_rot90_x_f32.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vcmulq_x_f16.c | 33 +++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vcmulq_x_f32.c | 33 +++++++++++++++++++-- 24 files changed, 656 insertions(+), 74 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_f16.c index 142c315..456370e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_f16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcmul.f16 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b) { return vcmulq_f16 (a, b); } -/* { dg-final { scan-assembler "vcmul.f16" } } */ +/* +**foo1: +** ... +** vcmul.f16 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b) { return vcmulq (a, b); } -/* { dg-final { scan-assembler "vcmul.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_f32.c index 158d750..64db652 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_f32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcmul.f32 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b) { return vcmulq_f32 (a, b); } -/* { dg-final { scan-assembler "vcmul.f32" } } */ +/* +**foo1: +** ... +** vcmul.f32 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b) { return vcmulq (a, b); } -/* { dg-final { scan-assembler "vcmul.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_m_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_m_f16.c index b38e0d9..b60f5d7 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_m_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_m_f16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f16 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcmulq_m_f16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f16 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcmulq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_m_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_m_f32.c index 7bf6873..22157d4 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_m_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_m_f32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f32 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t inactive, float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcmulq_m_f32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f32 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t inactive, float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcmulq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_f16.c index fc7162a..f01b0f3 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_f16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcmul.f16 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b) { return vcmulq_rot180_f16 (a, b); } -/* { dg-final { scan-assembler "vcmul.f16" } } */ +/* +**foo1: +** ... +** vcmul.f16 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b) { return vcmulq_rot180 (a, b); } -/* { dg-final { scan-assembler "vcmul.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_f32.c index 13a4553..537385c 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_f32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcmul.f32 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b) { return vcmulq_rot180_f32 (a, b); } -/* { dg-final { scan-assembler "vcmul.f32" } } */ +/* +**foo1: +** ... +** vcmul.f32 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b) { return vcmulq_rot180 (a, b); } -/* { dg-final { scan-assembler "vcmul.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_m_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_m_f16.c index 8767e2b..bc8692e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_m_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_m_f16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f16 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcmulq_rot180_m_f16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f16 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcmulq_rot180_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_m_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_m_f32.c index 3f95103..d2a0b6d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_m_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_m_f32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f32 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t inactive, float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcmulq_rot180_m_f32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f32 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t inactive, float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcmulq_rot180_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_x_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_x_f16.c index f8e835f..37d7b79 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_x_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_x_f16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f16 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcmulq_rot180_x_f16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f16 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcmulq_rot180_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_x_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_x_f32.c index d0d30c5..1e57fba 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_x_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot180_x_f32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f32 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcmulq_rot180_x_f32 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f32 q[0-9]+, q[0-9]+, q[0-9]+, #180(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcmulq_rot180_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_f16.c index 225b8910..05c444a 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_f16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcmul.f16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b) { return vcmulq_rot270_f16 (a, b); } -/* { dg-final { scan-assembler "vcmul.f16" } } */ +/* +**foo1: +** ... +** vcmul.f16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b) { return vcmulq_rot270 (a, b); } -/* { dg-final { scan-assembler "vcmul.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_f32.c index 1c8b0eb..b599c9f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_f32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcmul.f32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b) { return vcmulq_rot270_f32 (a, b); } -/* { dg-final { scan-assembler "vcmul.f32" } } */ +/* +**foo1: +** ... +** vcmul.f32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b) { return vcmulq_rot270 (a, b); } -/* { dg-final { scan-assembler "vcmul.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_m_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_m_f16.c index 20ccb5e..fded8a0 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_m_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_m_f16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcmulq_rot270_m_f16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcmulq_rot270_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_m_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_m_f32.c index 7499f42..54d939e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_m_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_m_f32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t inactive, float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcmulq_rot270_m_f32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t inactive, float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcmulq_rot270_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_x_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_x_f16.c index d1b52e7..d1e58cb 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_x_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_x_f16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcmulq_rot270_x_f16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f16 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcmulq_rot270_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_x_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_x_f32.c index 35da593..07c781f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_x_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot270_x_f32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcmulq_rot270_x_f32 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f32 q[0-9]+, q[0-9]+, q[0-9]+, #270(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcmulq_rot270_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_f16.c index 17f96cb..53b1930 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_f16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcmul.f16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b) { return vcmulq_rot90_f16 (a, b); } -/* { dg-final { scan-assembler "vcmul.f16" } } */ +/* +**foo1: +** ... +** vcmul.f16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b) { return vcmulq_rot90 (a, b); } -/* { dg-final { scan-assembler "vcmul.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_f32.c index 739fc9c..147f180 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_f32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vcmul.f32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b) { return vcmulq_rot90_f32 (a, b); } -/* { dg-final { scan-assembler "vcmul.f32" } } */ +/* +**foo1: +** ... +** vcmul.f32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b) { return vcmulq_rot90 (a, b); } -/* { dg-final { scan-assembler "vcmul.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_m_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_m_f16.c index 8259baa..8c4b090 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_m_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_m_f16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcmulq_rot90_m_f16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcmulq_rot90_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_m_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_m_f32.c index 751a9a6..b3131a5 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_m_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_m_f32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t inactive, float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcmulq_rot90_m_f32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t inactive, float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcmulq_rot90_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_x_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_x_f16.c index c4aef6c..0006103 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_x_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_x_f16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcmulq_rot90_x_f16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f16 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcmulq_rot90_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_x_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_x_f32.c index 9c54f08..8e31ad5 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_x_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_rot90_x_f32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcmulq_rot90_x_f32 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f32 q[0-9]+, q[0-9]+, q[0-9]+, #90(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcmulq_rot90_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_x_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_x_f16.c index 7634d61..b533247 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_x_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_x_f16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f16 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float16x8_t foo (float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcmulq_x_f16 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f16 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float16x8_t foo1 (float16x8_t a, float16x8_t b, mve_pred16_t p) { return vcmulq_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_x_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_x_f32.c index 21b6acf..a73482a 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_x_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmulq_x_f32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f32 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float32x4_t foo (float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcmulq_x_f32 (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vcmult.f32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vcmult.f32 q[0-9]+, q[0-9]+, q[0-9]+, #0(?: @.*|) +** ... +*/ float32x4_t foo1 (float32x4_t a, float32x4_t b, mve_pred16_t p) { return vcmulq_x (a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From 672eec5db5e673713540022c5a467ce6be165f53 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:39:16 +0100 Subject: arm: improve tests and fix vqabsq* gcc/ChangeLog: * config/arm/mve.md (mve_vqabsq_s): Fix spacing. gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vqabsq_m_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vqabsq_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqabsq_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqabsq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqabsq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqabsq_s8.c: Likewise. --- gcc/config/arm/mve.md | 2 +- .../gcc.target/arm/mve/intrinsics/vqabsq_m_s16.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqabsq_m_s32.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqabsq_m_s8.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqabsq_s16.c | 28 +++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vqabsq_s32.c | 28 +++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vqabsq_s8.c | 24 ++++++++++++++-- 7 files changed, 161 insertions(+), 20 deletions(-) (limited to 'gcc') diff --git a/gcc/config/arm/mve.md b/gcc/config/arm/mve.md index 7767f94..27691a1 100644 --- a/gcc/config/arm/mve.md +++ b/gcc/config/arm/mve.md @@ -388,7 +388,7 @@ VQABSQ_S)) ] "TARGET_HAVE_MVE" - "vqabs.s%# %q0, %q1" + "vqabs.s%#\t%q0, %q1" [(set_attr "type" "mve_move") ]) diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_m_s16.c index e74e04a..7172ac5 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_m_s16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqabst.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, mve_pred16_t p) { return vqabsq_m_s16 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqabst.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqabst.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, mve_pred16_t p) { return vqabsq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_m_s32.c index f6ca8a6..297cb19 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_m_s32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqabst.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, mve_pred16_t p) { return vqabsq_m_s32 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqabst.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqabst.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, mve_pred16_t p) { return vqabsq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_m_s8.c index d89a5aa..83c6993 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_m_s8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqabst.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, mve_pred16_t p) { return vqabsq_m_s8 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqabst.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqabst.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, mve_pred16_t p) { return vqabsq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_s16.c index e67c008..bf849fe9 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_s16.c @@ -1,21 +1,41 @@ -/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ -/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqabs.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t a) { return vqabsq_s16 (a); } -/* { dg-final { scan-assembler "vqabs.s16" } } */ +/* +**foo1: +** ... +** vqabs.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t a) { return vqabsq (a); } -/* { dg-final { scan-assembler "vqabs.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_s32.c index 8023ff8..1f88821 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_s32.c @@ -1,21 +1,41 @@ -/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ -/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqabs.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t a) { return vqabsq_s32 (a); } -/* { dg-final { scan-assembler "vqabs.s32" } } */ +/* +**foo1: +** ... +** vqabs.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t a) { return vqabsq (a); } -/* { dg-final { scan-assembler "vqabs.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_s8.c index b36d2b7..1399f7c 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqabsq_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqabs.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t a) { return vqabsq_s8 (a); } -/* { dg-final { scan-assembler "vqabs.s8" } } */ +/* +**foo1: +** ... +** vqabs.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t a) { return vqabsq (a); } -/* { dg-final { scan-assembler "vqabs.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From d26036dd88ab6c792928032ed05cc7e0a3dd345e Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:40:39 +0100 Subject: arm: improve tests for vqdmladhq* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vqdmladhq_m_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vqdmladhq_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmladhq_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmladhq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmladhq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmladhq_s8.c: Likewise. --- .../arm/mve/intrinsics/vqdmladhq_m_s16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqdmladhq_m_s32.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vqdmladhq_m_s8.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vqdmladhq_s16.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqdmladhq_s32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqdmladhq_s8.c | 24 +++++++++++++-- 6 files changed, 156 insertions(+), 18 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_m_s16.c index 51cdadc..aa9c78c 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_m_s16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmladht.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqdmladhq_m_s16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmladht.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmladht.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqdmladhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmladht.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_m_s32.c index 7e43fed..4694a6f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_m_s32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmladht.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqdmladhq_m_s32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmladht.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmladht.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqdmladhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmladht.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_m_s8.c index adf5910..c8dc67f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_m_s8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmladht.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqdmladhq_m_s8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmladht.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmladht.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqdmladhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmladht.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_s16.c index 2dc453b..74ebbfa 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_s16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqdmladh.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b) { return vqdmladhq_s16 (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmladh.s16" } } */ +/* +**foo1: +** ... +** vqdmladh.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b) { return vqdmladhq (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmladh.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_s32.c index 06f3204..796de4d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqdmladh.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b) { return vqdmladhq_s32 (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmladh.s32" } } */ +/* +**foo1: +** ... +** vqdmladh.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b) { return vqdmladhq (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmladh.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_s8.c index 79670b8..d585f5f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhq_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqdmladh.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b) { return vqdmladhq_s8 (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmladh.s8" } } */ +/* +**foo1: +** ... +** vqdmladh.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b) { return vqdmladhq (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmladh.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From f2a324b29e07b5d9b3b0c299dbb6558a9f3b8574 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:41:30 +0100 Subject: arm: improve tests for vqdmladhxq* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmladhxq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmladhxq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmladhxq_s8.c: Likewise. --- .../arm/mve/intrinsics/vqdmladhxq_m_s16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqdmladhxq_m_s32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqdmladhxq_m_s8.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vqdmladhxq_s16.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqdmladhxq_s32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqdmladhxq_s8.c | 24 +++++++++++++-- 6 files changed, 156 insertions(+), 18 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s16.c index c2446e6..19c5ce5 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmladhxt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqdmladhxq_m_s16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmladhxt.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmladhxt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqdmladhxq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmladhxt.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s32.c index 12b4551..e00162a 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmladhxt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqdmladhxq_m_s32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmladhxt.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmladhxt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqdmladhxq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmladhxt.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s8.c index 146aa51..19767d2 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmladhxt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqdmladhxq_m_s8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmladhxt.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmladhxt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqdmladhxq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmladhxt.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_s16.c index 5a6f445..c6a2fa8 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_s16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqdmladhx.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b) { return vqdmladhxq_s16 (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmladhx.s16" } } */ +/* +**foo1: +** ... +** vqdmladhx.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b) { return vqdmladhxq (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmladhx.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_s32.c index 4eafa6f..d38bd69 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqdmladhx.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b) { return vqdmladhxq_s32 (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmladhx.s32" } } */ +/* +**foo1: +** ... +** vqdmladhx.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b) { return vqdmladhxq (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmladhx.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_s8.c index cc66435..322f702 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmladhxq_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqdmladhx.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b) { return vqdmladhxq_s8 (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmladhx.s8" } } */ +/* +**foo1: +** ... +** vqdmladhx.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b) { return vqdmladhxq (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmladhx.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From 6c43db2480f0e50878ba4da4d47c6621513fe91f Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:42:09 +0100 Subject: arm: improve tests for vqrdmladhq* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmladhq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmladhq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmladhq_s8.c: Likewise. --- .../arm/mve/intrinsics/vqrdmladhq_m_s16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqrdmladhq_m_s32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqrdmladhq_m_s8.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vqrdmladhq_s16.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqrdmladhq_s32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqrdmladhq_s8.c | 24 +++++++++++++-- 6 files changed, 156 insertions(+), 18 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s16.c index fce4f5a..5b0e134 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmladht.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqrdmladhq_m_s16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmladht.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmladht.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqrdmladhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmladht.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s32.c index e550b6a..6fdf387 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmladht.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqrdmladhq_m_s32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmladht.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmladht.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqrdmladhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmladht.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s8.c index b07b28e..ef75f73 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmladht.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqrdmladhq_m_s8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmladht.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmladht.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqrdmladhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmladht.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_s16.c index 5bdac92..cf7cdb2 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_s16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmladh.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b) { return vqrdmladhq_s16 (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmladh.s16" } } */ +/* +**foo1: +** ... +** vqrdmladh.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b) { return vqrdmladhq (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmladh.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_s32.c index aade9bb..5a022fe 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmladh.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b) { return vqrdmladhq_s32 (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmladh.s32" } } */ +/* +**foo1: +** ... +** vqrdmladh.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b) { return vqrdmladhq (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmladh.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_s8.c index bde80fa..2cb27df 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhq_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmladh.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b) { return vqrdmladhq_s8 (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmladh.s8" } } */ +/* +**foo1: +** ... +** vqrdmladh.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b) { return vqrdmladhq (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmladh.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From 22a02a9576d234c517f33972e572541438eb9018 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:42:42 +0100 Subject: arm: improve tests for vqrdmladhxq* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmladhxq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmladhxq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmladhxq_s8.c: Likewise. --- .../arm/mve/intrinsics/vqrdmladhxq_m_s16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqrdmladhxq_m_s32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqrdmladhxq_m_s8.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqrdmladhxq_s16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vqrdmladhxq_s32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqrdmladhxq_s8.c | 24 +++++++++++++-- 6 files changed, 156 insertions(+), 18 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s16.c index 677efdc..1f68671 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmladhxt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqrdmladhxq_m_s16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmladhxt.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmladhxt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqrdmladhxq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmladhxt.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s32.c index 8ee8bbb..eaea6e1 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmladhxt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqrdmladhxq_m_s32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmladhxt.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmladhxt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqrdmladhxq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmladhxt.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s8.c index 7cfa88f..0f582a9 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmladhxt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqrdmladhxq_m_s8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmladhxt.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmladhxt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqrdmladhxq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmladhxt.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_s16.c index 2410ef1..a26898e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_s16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmladhx.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b) { return vqrdmladhxq_s16 (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmladhx.s16" } } */ +/* +**foo1: +** ... +** vqrdmladhx.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b) { return vqrdmladhxq (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmladhx.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_s32.c index 716028c..572486e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmladhx.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b) { return vqrdmladhxq_s32 (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmladhx.s32" } } */ +/* +**foo1: +** ... +** vqrdmladhx.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b) { return vqrdmladhxq (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmladhx.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_s8.c index 8f9bed5..00e478b 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmladhxq_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmladhx.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b) { return vqrdmladhxq_s8 (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmladhx.s8" } } */ +/* +**foo1: +** ... +** vqrdmladhx.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b) { return vqrdmladhxq (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmladhx.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From 26c400b1d82482b905f4d804e959b090fe72ab39 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:44:29 +0100 Subject: arm: improve tests for vqrdmlashq* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s8.c: Likewise. --- .../arm/mve/intrinsics/vqrdmlashq_n_s16.c | 32 ++++++++++++++++++---- .../arm/mve/intrinsics/vqrdmlashq_n_s32.c | 32 ++++++++++++++++++---- .../arm/mve/intrinsics/vqrdmlashq_n_s8.c | 32 ++++++++++++++++++---- 3 files changed, 78 insertions(+), 18 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s16.c index 8ff8c34..2710f2f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmlash.s16 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int16x8_t -foo (int16x8_t a, int16x8_t b, int16_t c) +foo (int16x8_t m1, int16x8_t m2, int16_t add) { - return vqrdmlashq_n_s16 (a, b, c); + return vqrdmlashq_n_s16 (m1, m2, add); } -/* { dg-final { scan-assembler "vqrdmlash.s16" } } */ +/* +**foo1: +** ... +** vqrdmlash.s16 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int16x8_t -foo1 (int16x8_t a, int16x8_t b, int16_t c) +foo1 (int16x8_t m1, int16x8_t m2, int16_t add) { - return vqrdmlashq (a, b, c); + return vqrdmlashq (m1, m2, add); +} + +#ifdef __cplusplus } +#endif -/* { dg-final { scan-assembler "vqrdmlash.s16" } } */ +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s32.c index 02583f0..5fefc39 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmlash.s32 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int32x4_t -foo (int32x4_t a, int32x4_t b, int32_t c) +foo (int32x4_t m1, int32x4_t m2, int32_t add) { - return vqrdmlashq_n_s32 (a, b, c); + return vqrdmlashq_n_s32 (m1, m2, add); } -/* { dg-final { scan-assembler "vqrdmlash.s32" } } */ +/* +**foo1: +** ... +** vqrdmlash.s32 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int32x4_t -foo1 (int32x4_t a, int32x4_t b, int32_t c) +foo1 (int32x4_t m1, int32x4_t m2, int32_t add) { - return vqrdmlashq (a, b, c); + return vqrdmlashq (m1, m2, add); +} + +#ifdef __cplusplus } +#endif -/* { dg-final { scan-assembler "vqrdmlash.s32" } } */ +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s8.c index 0bd5bca..df96fe8 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmlash.s8 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int8x16_t -foo (int8x16_t a, int8x16_t b, int8_t c) +foo (int8x16_t m1, int8x16_t m2, int8_t add) { - return vqrdmlashq_n_s8 (a, b, c); + return vqrdmlashq_n_s8 (m1, m2, add); } -/* { dg-final { scan-assembler "vqrdmlash.s8" } } */ +/* +**foo1: +** ... +** vqrdmlash.s8 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int8x16_t -foo1 (int8x16_t a, int8x16_t b, int8_t c) +foo1 (int8x16_t m1, int8x16_t m2, int8_t add) { - return vqrdmlashq (a, b, c); + return vqrdmlashq (m1, m2, add); +} + +#ifdef __cplusplus } +#endif -/* { dg-final { scan-assembler "vqrdmlash.s8" } } */ +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From 8de09beb71a9bdc24c969ab648c4c5570204ab87 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:44:48 +0100 Subject: arm: improve tests for vqdmlsdhq* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlsdhq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlsdhq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlsdhq_s8.c: Likewise. --- .../arm/mve/intrinsics/vqdmlsdhq_m_s16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqdmlsdhq_m_s32.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s8.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vqdmlsdhq_s16.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqdmlsdhq_s32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqdmlsdhq_s8.c | 24 +++++++++++++-- 6 files changed, 156 insertions(+), 18 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s16.c index d1e6686..f87287a 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmlsdht.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqdmlsdhq_m_s16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmlsdht.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmlsdht.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqdmlsdhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmlsdht.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s32.c index cc80f21..8155aaf 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmlsdht.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqdmlsdhq_m_s32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmlsdht.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmlsdht.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqdmlsdhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmlsdht.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s8.c index 5c9d81a..d39badc 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmlsdht.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqdmlsdhq_m_s8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmlsdht.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmlsdht.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqdmlsdhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmlsdht.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_s16.c index eb058fb..a4fa1d5 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_s16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqdmlsdh.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b) { return vqdmlsdhq_s16 (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmlsdh.s16" } } */ +/* +**foo1: +** ... +** vqdmlsdh.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b) { return vqdmlsdhq (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmlsdh.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_s32.c index 27b93d6..0c6ba42 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqdmlsdh.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b) { return vqdmlsdhq_s32 (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmlsdh.s32" } } */ +/* +**foo1: +** ... +** vqdmlsdh.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b) { return vqdmlsdhq (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmlsdh.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_s8.c index 1dd2a59..089c4cd 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhq_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqdmlsdh.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b) { return vqdmlsdhq_s8 (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmlsdh.s8" } } */ +/* +**foo1: +** ... +** vqdmlsdh.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b) { return vqdmlsdhq (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmlsdh.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From 8b9fcce72f7f93b11129a298c54c9c178e510cf0 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:45:45 +0100 Subject: arm: improve tests for vqdmlsdhxq* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s8.c: Likewise. --- .../arm/mve/intrinsics/vqdmlsdhxq_m_s16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqdmlsdhxq_m_s32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqdmlsdhxq_m_s8.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s16.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s8.c | 24 +++++++++++++-- 6 files changed, 156 insertions(+), 18 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s16.c index 6ab9743..1742d47 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmlsdhxt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqdmlsdhxq_m_s16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmlsdhxt.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmlsdhxt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqdmlsdhxq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmlsdhxt.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s32.c index a34618e..1c1b73a 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmlsdhxt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqdmlsdhxq_m_s32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmlsdhxt.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmlsdhxt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqdmlsdhxq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmlsdhxt.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s8.c index fdbe89a..0a980a0 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmlsdhxt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqdmlsdhxq_m_s8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmlsdhxt.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqdmlsdhxt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqdmlsdhxq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqdmlsdhxt.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s16.c index 786decc..713ce97 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqdmlsdhx.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b) { return vqdmlsdhxq_s16 (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmlsdhx.s16" } } */ +/* +**foo1: +** ... +** vqdmlsdhx.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b) { return vqdmlsdhxq (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmlsdhx.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s32.c index c0244c4..02f0a3c 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqdmlsdhx.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b) { return vqdmlsdhxq_s32 (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmlsdhx.s32" } } */ +/* +**foo1: +** ... +** vqdmlsdhx.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b) { return vqdmlsdhxq (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmlsdhx.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s8.c index 12b43c8..c179287 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqdmlsdhx.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b) { return vqdmlsdhxq_s8 (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmlsdhx.s8" } } */ +/* +**foo1: +** ... +** vqdmlsdhx.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b) { return vqdmlsdhxq (inactive, a, b); } -/* { dg-final { scan-assembler "vqdmlsdhx.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From 79090d68ba7bd59b1cf2585a1478fd5781f577d4 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:46:25 +0100 Subject: arm: improve tests for vqrdmlsdhq* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s8.c: Likewise. --- .../arm/mve/intrinsics/vqrdmlsdhq_m_s16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqrdmlsdhq_m_s32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqrdmlsdhq_m_s8.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s16.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s8.c | 24 +++++++++++++-- 6 files changed, 156 insertions(+), 18 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s16.c index d0054b8..6a57762 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmlsdht.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqrdmlsdhq_m_s16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmlsdht.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmlsdht.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqrdmlsdhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmlsdht.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s32.c index 7d3fe45..9539e24 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmlsdht.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqrdmlsdhq_m_s32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmlsdht.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmlsdht.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqrdmlsdhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmlsdht.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s8.c index c33f8ea..69e54f5 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmlsdht.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqrdmlsdhq_m_s8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmlsdht.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmlsdht.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqrdmlsdhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmlsdht.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s16.c index 3bd760d3..3eb957d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmlsdh.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b) { return vqrdmlsdhq_s16 (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmlsdh.s16" } } */ +/* +**foo1: +** ... +** vqrdmlsdh.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b) { return vqrdmlsdhq (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmlsdh.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s32.c index e23dc94..3a3fb506 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmlsdh.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b) { return vqrdmlsdhq_s32 (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmlsdh.s32" } } */ +/* +**foo1: +** ... +** vqrdmlsdh.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b) { return vqrdmlsdhq (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmlsdh.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s8.c index 836e04a..65ac15d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmlsdh.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b) { return vqrdmlsdhq_s8 (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmlsdh.s8" } } */ +/* +**foo1: +** ... +** vqrdmlsdh.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b) { return vqrdmlsdhq (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmlsdh.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From ef0bec9036cef36b26006d9a3d22b879d705e75c Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:47:00 +0100 Subject: arm: improve tests for vqrdmlsdhxq* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s8.c: Likewise. --- .../arm/mve/intrinsics/vqrdmlsdhxq_m_s16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqrdmlsdhxq_m_s32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqrdmlsdhxq_m_s8.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqrdmlsdhxq_s16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vqrdmlsdhxq_s32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s8.c | 24 +++++++++++++-- 6 files changed, 156 insertions(+), 18 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s16.c index 2fbd351..3598f50 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmlsdhxt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqrdmlsdhxq_m_s16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmlsdhxt.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmlsdhxt.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqrdmlsdhxq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmlsdhxt.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s32.c index 324a6e6..1ab22ed 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmlsdhxt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqrdmlsdhxq_m_s32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmlsdhxt.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmlsdhxt.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqrdmlsdhxq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmlsdhxt.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s8.c index 287868b..01103e9 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmlsdhxt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqrdmlsdhxq_m_s8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmlsdhxt.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmlsdhxt.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqrdmlsdhxq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmlsdhxt.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s16.c index 9d8ea9b..522d0ba 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmlsdhx.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b) { return vqrdmlsdhxq_s16 (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmlsdhx.s16" } } */ +/* +**foo1: +** ... +** vqrdmlsdhx.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b) { return vqrdmlsdhxq (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmlsdhx.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s32.c index aca0b35..5198dfa 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmlsdhx.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b) { return vqrdmlsdhxq_s32 (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmlsdhx.s32" } } */ +/* +**foo1: +** ... +** vqrdmlsdhx.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b) { return vqrdmlsdhxq (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmlsdhx.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s8.c index 18f9531..b5baa3d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmlsdhx.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b) { return vqrdmlsdhxq_s8 (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmlsdhx.s8" } } */ +/* +**foo1: +** ... +** vqrdmlsdhx.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b) { return vqrdmlsdhxq (inactive, a, b); } -/* { dg-final { scan-assembler "vqrdmlsdhx.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From 73a712e9c6620f8b7aede3eb1c2984fb91646201 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:47:54 +0100 Subject: arm: improve tests for vqrdmulhq* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmulhq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmulhq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqrdmulhq_s8.c: Likewise. --- .../arm/mve/intrinsics/vqrdmulhq_m_n_s16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqrdmulhq_m_n_s32.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqrdmulhq_m_n_s8.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqrdmulhq_m_s16.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqrdmulhq_m_s32.c | 34 +++++++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s8.c | 34 +++++++++++++++++++--- .../arm/mve/intrinsics/vqrdmulhq_n_s16.c | 24 +++++++++++++-- .../arm/mve/intrinsics/vqrdmulhq_n_s32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s8.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqrdmulhq_s16.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqrdmulhq_s32.c | 24 +++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqrdmulhq_s8.c | 24 +++++++++++++-- 12 files changed, 312 insertions(+), 36 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s16.c index c4b6b7e2..fc3a330 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmulht.s16 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16_t b, mve_pred16_t p) { return vqrdmulhq_m_n_s16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmulht.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmulht.s16 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16_t b, mve_pred16_t p) { return vqrdmulhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmulht.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s32.c index 6de3eb1..897ad5b 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmulht.s32 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32_t b, mve_pred16_t p) { return vqrdmulhq_m_n_s32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmulht.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmulht.s32 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32_t b, mve_pred16_t p) { return vqrdmulhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmulht.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s8.c index df3dfa8..05ab060 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmulht.s8 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8_t b, mve_pred16_t p) { return vqrdmulhq_m_n_s8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmulht.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmulht.s8 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8_t b, mve_pred16_t p) { return vqrdmulhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmulht.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s16.c index 24831e8..1d9dc07 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s16.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmulht.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqrdmulhq_m_s16 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmulht.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmulht.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) { return vqrdmulhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmulht.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s32.c index 70257c3..76d7507 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s32.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmulht.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqrdmulhq_m_s32 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmulht.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmulht.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) { return vqrdmulhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmulht.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s8.c index 7cd39d2..7fd2119 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s8.c @@ -1,23 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmulht.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqrdmulhq_m_s8 (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmulht.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqrdmulht.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) { return vqrdmulhq_m (inactive, a, b, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqrdmulht.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s16.c index 42fe9cb..8a90a39 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmulh.s16 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t a, int16_t b) { return vqrdmulhq_n_s16 (a, b); } -/* { dg-final { scan-assembler "vqrdmulh.s16" } } */ +/* +**foo1: +** ... +** vqrdmulh.s16 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t a, int16_t b) { return vqrdmulhq (a, b); } -/* { dg-final { scan-assembler "vqrdmulh.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s32.c index 5f014fa..973464b 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmulh.s32 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t a, int32_t b) { return vqrdmulhq_n_s32 (a, b); } -/* { dg-final { scan-assembler "vqrdmulh.s32" } } */ +/* +**foo1: +** ... +** vqrdmulh.s32 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t a, int32_t b) { return vqrdmulhq (a, b); } -/* { dg-final { scan-assembler "vqrdmulh.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s8.c index 887e294..65aab96 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmulh.s8 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t a, int8_t b) { return vqrdmulhq_n_s8 (a, b); } -/* { dg-final { scan-assembler "vqrdmulh.s8" } } */ +/* +**foo1: +** ... +** vqrdmulh.s8 q[0-9]+, q[0-9]+, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t a, int8_t b) { return vqrdmulhq (a, b); } -/* { dg-final { scan-assembler "vqrdmulh.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_s16.c index 409fc29..f3153c8 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_s16.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmulh.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t a, int16x8_t b) { return vqrdmulhq_s16 (a, b); } -/* { dg-final { scan-assembler "vqrdmulh.s16" } } */ +/* +**foo1: +** ... +** vqrdmulh.s16 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t a, int16x8_t b) { return vqrdmulhq (a, b); } -/* { dg-final { scan-assembler "vqrdmulh.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_s32.c index 18e11b1..48b10db 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmulh.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t a, int32x4_t b) { return vqrdmulhq_s32 (a, b); } -/* { dg-final { scan-assembler "vqrdmulh.s32" } } */ +/* +**foo1: +** ... +** vqrdmulh.s32 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t a, int32x4_t b) { return vqrdmulhq (a, b); } -/* { dg-final { scan-assembler "vqrdmulh.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_s8.c index 3f1441d..9f0346f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmulhq_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqrdmulh.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t a, int8x16_t b) { return vqrdmulhq_s8 (a, b); } -/* { dg-final { scan-assembler "vqrdmulh.s8" } } */ +/* +**foo1: +** ... +** vqrdmulh.s8 q[0-9]+, q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t a, int8x16_t b) { return vqrdmulhq (a, b); } -/* { dg-final { scan-assembler "vqrdmulh.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From 1563de6f9d3a9607ae2872b87d9718add3cf6e6a Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Nov 2022 17:49:36 +0100 Subject: arm: improve tests and fix vqnegq* gcc/ChangeLog: * config/arm/mve.md (mve_vqnegq_s): Fix spacing. gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vqnegq_m_s16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vqnegq_m_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqnegq_m_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqnegq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqnegq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqnegq_s8.c: Likewise. --- gcc/config/arm/mve.md | 2 +- .../gcc.target/arm/mve/intrinsics/vqnegq_m_s16.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqnegq_m_s32.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqnegq_m_s8.c | 33 ++++++++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqnegq_s16.c | 28 +++++++++++++++--- .../gcc.target/arm/mve/intrinsics/vqnegq_s32.c | 24 ++++++++++++++-- .../gcc.target/arm/mve/intrinsics/vqnegq_s8.c | 24 ++++++++++++++-- 7 files changed, 159 insertions(+), 18 deletions(-) (limited to 'gcc') diff --git a/gcc/config/arm/mve.md b/gcc/config/arm/mve.md index 27691a1..555ad1b 100644 --- a/gcc/config/arm/mve.md +++ b/gcc/config/arm/mve.md @@ -374,7 +374,7 @@ VQNEGQ_S)) ] "TARGET_HAVE_MVE" - "vqneg.s%# %q0, %q1" + "vqneg.s%#\t%q0, %q1" [(set_attr "type" "mve_move") ]) diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_m_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_m_s16.c index 4f0145d..f3799a3 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_m_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_m_s16.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqnegt.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t inactive, int16x8_t a, mve_pred16_t p) { return vqnegq_m_s16 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqnegt.s16" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqnegt.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t inactive, int16x8_t a, mve_pred16_t p) { return vqnegq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_m_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_m_s32.c index da4f90b..bbe64ff 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_m_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_m_s32.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqnegt.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t inactive, int32x4_t a, mve_pred16_t p) { return vqnegq_m_s32 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqnegt.s32" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqnegt.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t inactive, int32x4_t a, mve_pred16_t p) { return vqnegq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_m_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_m_s8.c index ac1250b..71fcdd7 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_m_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_m_s8.c @@ -1,22 +1,49 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqnegt.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t inactive, int8x16_t a, mve_pred16_t p) { return vqnegq_m_s8 (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ -/* { dg-final { scan-assembler "vqnegt.s8" } } */ +/* +**foo1: +** ... +** vmsr p0, (?:ip|fp|r[0-9]+)(?: @.*|) +** ... +** vpst(?: @.*|) +** ... +** vqnegt.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t inactive, int8x16_t a, mve_pred16_t p) { return vqnegq_m (inactive, a, p); } -/* { dg-final { scan-assembler "vpst" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_s16.c index f9210cd..d5fb4a1 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_s16.c @@ -1,21 +1,41 @@ -/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ -/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqneg.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo (int16x8_t a) { return vqnegq_s16 (a); } -/* { dg-final { scan-assembler "vqneg.s16" } } */ +/* +**foo1: +** ... +** vqneg.s16 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int16x8_t foo1 (int16x8_t a) { return vqnegq (a); } -/* { dg-final { scan-assembler "vqneg.s16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_s32.c index c2ded7f..2c8e709 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_s32.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqneg.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo (int32x4_t a) { return vqnegq_s32 (a); } -/* { dg-final { scan-assembler "vqneg.s32" } } */ +/* +**foo1: +** ... +** vqneg.s32 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int32x4_t foo1 (int32x4_t a) { return vqnegq (a); } -/* { dg-final { scan-assembler "vqneg.s32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_s8.c index d1cc83a..2f7f761 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqnegq_s8.c @@ -1,21 +1,41 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vqneg.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo (int8x16_t a) { return vqnegq_s8 (a); } -/* { dg-final { scan-assembler "vqneg.s8" } } */ +/* +**foo1: +** ... +** vqneg.s8 q[0-9]+, q[0-9]+(?: @.*|) +** ... +*/ int8x16_t foo1 (int8x16_t a) { return vqnegq (a); } -/* { dg-final { scan-assembler "vqneg.s8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From a8704dc9d5f00bff9f52cf626f129ac1c6520d65 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Tue, 29 Nov 2022 16:45:10 +0100 Subject: arm: improve tests for vld2q* gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vld2q_f16.c: Use check-function-bodies instead of scan-assembler checks. Use extern "C" for C++ testing. * gcc.target/arm/mve/intrinsics/vld2q_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vld2q_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vld2q_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vld2q_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vld2q_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vld2q_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vld2q_u8.c: Likewise. --- .../gcc.target/arm/mve/intrinsics/vld2q_f16.c | 33 ++++++++++++++++++---- .../gcc.target/arm/mve/intrinsics/vld2q_f32.c | 33 ++++++++++++++++++---- .../gcc.target/arm/mve/intrinsics/vld2q_s16.c | 33 ++++++++++++++++++---- .../gcc.target/arm/mve/intrinsics/vld2q_s32.c | 33 ++++++++++++++++++---- .../gcc.target/arm/mve/intrinsics/vld2q_s8.c | 33 ++++++++++++++++++---- .../gcc.target/arm/mve/intrinsics/vld2q_u16.c | 33 ++++++++++++++++++---- .../gcc.target/arm/mve/intrinsics/vld2q_u32.c | 33 ++++++++++++++++++---- .../gcc.target/arm/mve/intrinsics/vld2q_u8.c | 33 ++++++++++++++++++---- 8 files changed, 224 insertions(+), 40 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_f16.c index 24e7a2e..81690b1 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_f16.c @@ -1,22 +1,45 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vld20.16 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +** vld21.16 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +*/ float16x8x2_t -foo (float16_t const * addr) +foo (float16_t const *addr) { return vld2q_f16 (addr); } -/* { dg-final { scan-assembler "vld20.16" } } */ -/* { dg-final { scan-assembler "vld21.16" } } */ +/* +**foo1: +** ... +** vld20.16 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +** vld21.16 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +*/ float16x8x2_t -foo1 (float16_t const * addr) +foo1 (float16_t const *addr) { return vld2q (addr); } -/* { dg-final { scan-assembler "vld20.16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_f32.c index 727484c..d2ae31f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_f32.c @@ -1,22 +1,45 @@ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vld20.32 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +** vld21.32 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +*/ float32x4x2_t -foo (float32_t const * addr) +foo (float32_t const *addr) { return vld2q_f32 (addr); } -/* { dg-final { scan-assembler "vld20.32" } } */ -/* { dg-final { scan-assembler "vld21.32" } } */ +/* +**foo1: +** ... +** vld20.32 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +** vld21.32 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +*/ float32x4x2_t -foo1 (float32_t const * addr) +foo1 (float32_t const *addr) { return vld2q (addr); } -/* { dg-final { scan-assembler "vld20.32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_s16.c index f2864a0..fb4dc1b 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_s16.c @@ -1,22 +1,45 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vld20.16 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +** vld21.16 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +*/ int16x8x2_t -foo (int16_t const * addr) +foo (int16_t const *addr) { return vld2q_s16 (addr); } -/* { dg-final { scan-assembler "vld20.16" } } */ -/* { dg-final { scan-assembler "vld21.16" } } */ +/* +**foo1: +** ... +** vld20.16 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +** vld21.16 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +*/ int16x8x2_t -foo1 (int16_t const * addr) +foo1 (int16_t const *addr) { return vld2q (addr); } -/* { dg-final { scan-assembler "vld20.16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_s32.c index 9fe2e04..aeb8523 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_s32.c @@ -1,22 +1,45 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vld20.32 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +** vld21.32 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +*/ int32x4x2_t -foo (int32_t const * addr) +foo (int32_t const *addr) { return vld2q_s32 (addr); } -/* { dg-final { scan-assembler "vld20.32" } } */ -/* { dg-final { scan-assembler "vld21.32" } } */ +/* +**foo1: +** ... +** vld20.32 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +** vld21.32 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +*/ int32x4x2_t -foo1 (int32_t const * addr) +foo1 (int32_t const *addr) { return vld2q (addr); } -/* { dg-final { scan-assembler "vld20.32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_s8.c index 736080a..687e5de 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_s8.c @@ -1,22 +1,45 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vld20.8 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +** vld21.8 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +*/ int8x16x2_t -foo (int8_t const * addr) +foo (int8_t const *addr) { return vld2q_s8 (addr); } -/* { dg-final { scan-assembler "vld20.8" } } */ -/* { dg-final { scan-assembler "vld21.8" } } */ +/* +**foo1: +** ... +** vld20.8 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +** vld21.8 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +*/ int8x16x2_t -foo1 (int8_t const * addr) +foo1 (int8_t const *addr) { return vld2q (addr); } -/* { dg-final { scan-assembler "vld20.8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_u16.c index 2d89ebd..281fe5e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_u16.c @@ -1,22 +1,45 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vld20.16 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +** vld21.16 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +*/ uint16x8x2_t -foo (uint16_t const * addr) +foo (uint16_t const *addr) { return vld2q_u16 (addr); } -/* { dg-final { scan-assembler "vld20.16" } } */ -/* { dg-final { scan-assembler "vld21.16" } } */ +/* +**foo1: +** ... +** vld20.16 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +** vld21.16 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +*/ uint16x8x2_t -foo1 (uint16_t const * addr) +foo1 (uint16_t const *addr) { return vld2q (addr); } -/* { dg-final { scan-assembler "vld20.16" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_u32.c index 28d311e..524afee 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_u32.c @@ -1,22 +1,45 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vld20.32 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +** vld21.32 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +*/ uint32x4x2_t -foo (uint32_t const * addr) +foo (uint32_t const *addr) { return vld2q_u32 (addr); } -/* { dg-final { scan-assembler "vld20.32" } } */ -/* { dg-final { scan-assembler "vld21.32" } } */ +/* +**foo1: +** ... +** vld20.32 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +** vld21.32 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +*/ uint32x4x2_t -foo1 (uint32_t const * addr) +foo1 (uint32_t const *addr) { return vld2q (addr); } -/* { dg-final { scan-assembler "vld20.32" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_u8.c index 790c974..9eebbd4 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vld2q_u8.c @@ -1,22 +1,45 @@ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ /* { dg-additional-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* +**foo: +** ... +** vld20.8 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +** vld21.8 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +*/ uint8x16x2_t -foo (uint8_t const * addr) +foo (uint8_t const *addr) { return vld2q_u8 (addr); } -/* { dg-final { scan-assembler "vld20.8" } } */ -/* { dg-final { scan-assembler "vld21.8" } } */ +/* +**foo1: +** ... +** vld20.8 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +** vld21.8 {q[0-9]+, q[0-9]+}, \[(?:ip|fp|r[0-9]+)\](?: @.*|) +** ... +*/ uint8x16x2_t -foo1 (uint8_t const * addr) +foo1 (uint8_t const *addr) { return vld2q (addr); } -/* { dg-final { scan-assembler "vld20.8" } } */ +#ifdef __cplusplus +} +#endif + +/* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From 267f01a493ab8a0bec9325ce3386b946c46f2e98 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Wed, 18 Jan 2023 17:38:42 +0100 Subject: arm: fix missing extern "C" in MVE tests gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vhaddq_n_s16.c: Add missing extern "C". * gcc.target/arm/mve/intrinsics/vhaddq_n_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_n_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_n_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_n_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_n_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_x_n_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_x_n_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_x_n_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_x_n_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_x_n_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_x_n_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_x_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_x_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_x_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_x_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_x_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vhaddq_x_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_n_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_n_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_n_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_n_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_n_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_n_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_x_n_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_x_n_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_x_n_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_x_n_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_x_n_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_x_n_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_x_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_x_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_x_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_x_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_x_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vhsubq_x_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmladavaxq_p_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmladavaxq_p_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmladavaxq_p_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vmladavaxq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vmladavaxq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vmladavaxq_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqaddq_n_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqaddq_n_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqaddq_n_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqaddq_n_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqaddq_n_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqaddq_n_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqaddq_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqaddq_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqaddq_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqaddq_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqaddq_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqaddq_u8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlahq_n_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlahq_n_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlahq_n_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlashq_n_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlashq_n_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vqdmlashq_n_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vsetq_lane_f16.c: Likewise. * gcc.target/arm/mve/intrinsics/vsetq_lane_f32.c: Likewise. * gcc.target/arm/mve/intrinsics/vsetq_lane_s16.c: Likewise. * gcc.target/arm/mve/intrinsics/vsetq_lane_s32.c: Likewise. * gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c: Likewise. * gcc.target/arm/mve/intrinsics/vsetq_lane_s8.c: Likewise. * gcc.target/arm/mve/intrinsics/vsetq_lane_u16.c: Likewise. * gcc.target/arm/mve/intrinsics/vsetq_lane_u32.c: Likewise. * gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c: Likewise. * gcc.target/arm/mve/intrinsics/vsetq_lane_u8.c: Likewise. --- gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_s16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_s32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_s8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_u16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_u32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_u8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_s16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_s32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_s8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_u16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_u32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_u8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_s16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_s32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_s8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_u16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_u32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_u8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_s16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_s32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_s8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_u16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_u32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_u8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_s16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_s32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_s8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_u16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_u32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_u8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_s16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_s32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_s8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_u16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_u32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_u8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_s16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_s32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_s8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_u16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_u32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_u8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_s16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_s32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_s8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_u16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_u32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_u8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_p_s16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_p_s32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_p_s8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_s16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_s32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_s8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_s16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_s32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_s8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_u16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_u32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_u8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_s16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_s32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_s8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_u16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_u32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_u8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_s16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_s32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_s8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s8.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u16.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u32.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c | 8 ++++++++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u8.c | 8 ++++++++ 85 files changed, 680 insertions(+) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_s16.c index 20a999d..31f78b3 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_s16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int16x8_t a, int16_t b) return vhaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_s32.c index 986cb8d..77c0521 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_s32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int32x4_t a, int32_t b) return vhaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_s8.c index 57a4b36..1cf93d5 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_s8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int8x16_t a, int8_t b) return vhaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_u16.c index abed33b..98d80e4 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_u16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -42,4 +46,8 @@ foo2 (uint16x8_t a) return vhaddq (a, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_u32.c index 5e5204f..9b7e611 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_u32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -42,4 +46,8 @@ foo2 (uint32x4_t a) return vhaddq (a, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_u8.c index b35221e..4d82970 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_n_u8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -42,4 +46,8 @@ foo2 (uint8x16_t a) return vhaddq (a, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_s16.c index 310964f..2788eb2 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_s16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int16x8_t a, int16x8_t b) return vhaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_s32.c index d822264..67872a7 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_s32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int32x4_t a, int32x4_t b) return vhaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_s8.c index 85b2fee..1ec8905 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_s8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int8x16_t a, int8x16_t b) return vhaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_u16.c index 2da0aa0..bc84618 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_u16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (uint16x8_t a, uint16x8_t b) return vhaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_u32.c index 49b865a..6abdfce 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_u32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (uint32x4_t a, uint32x4_t b) return vhaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_u8.c index 5ecd3cb..0c68c68 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_u8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (uint8x16_t a, uint8x16_t b) return vhaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_s16.c index a4e277d..d5bff94 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_s16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int16x8_t a, int16_t b, mve_pred16_t p) return vhaddq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_s32.c index c79b88d..af3e219 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_s32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int32x4_t a, int32_t b, mve_pred16_t p) return vhaddq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_s8.c index 6189353..a4551e2 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_s8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int8x16_t a, int8_t b, mve_pred16_t p) return vhaddq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_u16.c index 146d226..71facc4 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_u16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -54,4 +58,8 @@ foo2 (uint16x8_t a, mve_pred16_t p) return vhaddq_x (a, 1, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_u32.c index b70014f..d45421c 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_u32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -54,4 +58,8 @@ foo2 (uint32x4_t a, mve_pred16_t p) return vhaddq_x (a, 1, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_u8.c index 03978df..5f16fbd 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_n_u8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -54,4 +58,8 @@ foo2 (uint8x16_t a, mve_pred16_t p) return vhaddq_x (a, 1, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_s16.c index c3c7875..4e33273 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_s16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int16x8_t a, int16x8_t b, mve_pred16_t p) return vhaddq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_s32.c index a1ab196..5cdfd39 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_s32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int32x4_t a, int32x4_t b, mve_pred16_t p) return vhaddq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_s8.c index 061ae89..7a2ed23 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_s8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int8x16_t a, int8x16_t b, mve_pred16_t p) return vhaddq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_u16.c index 0ee8852..e24ff16 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_u16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (uint16x8_t a, uint16x8_t b, mve_pred16_t p) return vhaddq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_u32.c index 0a0e512..e9f1395 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_u32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (uint32x4_t a, uint32x4_t b, mve_pred16_t p) return vhaddq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_u8.c index c495641..cba0a30 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhaddq_x_u8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (uint8x16_t a, uint8x16_t b, mve_pred16_t p) return vhaddq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_s16.c index af4f534..4d1bab9 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_s16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int16x8_t a, int16_t b) return vhsubq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_s32.c index 941d380..8effffa 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_s32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int32x4_t a, int32_t b) return vhsubq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_s8.c index 9ceb4ef..f55cd8f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_s8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int8x16_t a, int8_t b) return vhsubq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_u16.c index 037ed2c..73575a4 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_u16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -42,4 +46,8 @@ foo2 (uint16x8_t a) return vhsubq (a, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_u32.c index f51eb10..f152ef1 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_u32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -42,4 +46,8 @@ foo2 (uint32x4_t a) return vhsubq (a, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_u8.c index 24dd45d..0a58b1e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_n_u8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -42,4 +46,8 @@ foo2 (uint8x16_t a) return vhsubq (a, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_s16.c index 0f275d4..ec8d9aa 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_s16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int16x8_t a, int16x8_t b) return vhsubq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_s32.c index 21aeb9d..e98635a 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_s32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int32x4_t a, int32x4_t b) return vhsubq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_s8.c index b3ee943..3107bb5 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_s8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int8x16_t a, int8x16_t b) return vhsubq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_u16.c index 690ef2d..783309f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_u16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (uint16x8_t a, uint16x8_t b) return vhsubq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_u32.c index cfe1257..99bc278 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_u32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (uint32x4_t a, uint32x4_t b) return vhsubq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_u8.c index 1926bc3..ae18651 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_u8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (uint8x16_t a, uint8x16_t b) return vhsubq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_s16.c index fcda4c5..260ba9e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_s16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int16x8_t a, int16_t b, mve_pred16_t p) return vhsubq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_s32.c index 5563722..be5cc04 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_s32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int32x4_t a, int32_t b, mve_pred16_t p) return vhsubq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_s8.c index ecfe188..b0c28be 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_s8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int8x16_t a, int8_t b, mve_pred16_t p) return vhsubq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_u16.c index bf3d6c3..f31bb3f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_u16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -54,4 +58,8 @@ foo2 (uint16x8_t a, mve_pred16_t p) return vhsubq_x (a, 1, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_u32.c index 4ae75b0..a35346d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_u32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -54,4 +58,8 @@ foo2 (uint32x4_t a, mve_pred16_t p) return vhsubq_x (a, 1, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_u8.c index edfa421..25c8544 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_n_u8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -54,4 +58,8 @@ foo2 (uint8x16_t a, mve_pred16_t p) return vhsubq_x (a, 1, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_s16.c index bd2771b..dc3433c 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_s16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int16x8_t a, int16x8_t b, mve_pred16_t p) return vhsubq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_s32.c index 0ea40df..a1e1fae 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_s32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int32x4_t a, int32x4_t b, mve_pred16_t p) return vhsubq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_s8.c index 90ee94d..bbfce81 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_s8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int8x16_t a, int8x16_t b, mve_pred16_t p) return vhsubq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_u16.c index d700741..86fc9d7 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_u16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (uint16x8_t a, uint16x8_t b, mve_pred16_t p) return vhsubq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_u32.c index f43c962..5327426 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_u32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (uint32x4_t a, uint32x4_t b, mve_pred16_t p) return vhsubq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_u8.c index a0908ba..04d89c6 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vhsubq_x_u8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (uint8x16_t a, uint8x16_t b, mve_pred16_t p) return vhsubq_x (a, b, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_p_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_p_s16.c index f201d5f..5925d9e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_p_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_p_s16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int32_t add, int16x8_t m1, int16x8_t m2, mve_pred16_t p) return vmladavaxq_p (add, m1, m2, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_p_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_p_s32.c index c90647a..87d66e6 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_p_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_p_s32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int32_t add, int32x4_t m1, int32x4_t m2, mve_pred16_t p) return vmladavaxq_p (add, m1, m2, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_p_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_p_s8.c index 57af7bc..803a5be 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_p_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_p_s8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int32_t add, int8x16_t m1, int8x16_t m2, mve_pred16_t p) return vmladavaxq_p (add, m1, m2, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_s16.c index 684580d..6a81b4a 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_s16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int32_t add, int16x8_t m1, int16x8_t m2) return vmladavaxq (add, m1, m2); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_s32.c index 5d15264..b63ca43 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_s32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int32_t add, int32x4_t m1, int32x4_t m2) return vmladavaxq (add, m1, m2); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_s8.c index 71bcdc9..2430858 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmladavaxq_s8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int32_t add, int8x16_t m1, int8x16_t m2) return vmladavaxq (add, m1, m2); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_s16.c index 0fac7ab..17b28cf 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_s16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int16x8_t a, int16_t b) return vqaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_s32.c index d750b1f..e6bb4e0 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_s32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int32x4_t a, int32_t b) return vqaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_s8.c index 5fc796e..f39451f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_s8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int8x16_t a, int8_t b) return vqaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_u16.c index decad65..a87163c 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_u16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -42,4 +46,8 @@ foo2 (uint16x8_t a) return vqaddq (a, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_u32.c index b0a6d79..a6aa9b5d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_u32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -42,4 +46,8 @@ foo2 (uint32x4_t a) return vqaddq (a, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_u8.c index f9ca9a1..4bd4731 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_n_u8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -42,4 +46,8 @@ foo2 (uint8x16_t a) return vqaddq (a, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_s16.c index ffa3146..97e2a60 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_s16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int16x8_t a, int16x8_t b) return vqaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_s32.c index c5937a9..db9355d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_s32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int32x4_t a, int32x4_t b) return vqaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_s8.c index 9f93751..2804d66 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_s8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int8x16_t a, int8x16_t b) return vqaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_u16.c index aa4be43..17e5996 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_u16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (uint16x8_t a, uint16x8_t b) return vqaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_u32.c index daef60e..ce3a397 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_u32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (uint32x4_t a, uint32x4_t b) return vqaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_u8.c index e28807e..faa881f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqaddq_u8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (uint8x16_t a, uint8x16_t b) return vqaddq (a, b); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_s16.c index 210bace..909631c 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_s16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int16x8_t add, int16x8_t m1, int16_t m2) return vqdmlahq (add, m1, m2); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_s32.c index dbb2494..fb670be 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_s32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int32x4_t add, int32x4_t m1, int32_t m2) return vqdmlahq (add, m1, m2); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_s8.c index a7962f8..f66740b 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_s8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int8x16_t add, int8x16_t m1, int8_t m2) return vqdmlahq (add, m1, m2); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s16.c index 34d407f..918de95 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int16x8_t m1, int16x8_t m2, int16_t add, mve_pred16_t p) return vqdmlashq_m (m1, m2, add, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s32.c index 50a665e..b25b660 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int32x4_t m1, int32x4_t m2, int32_t add, mve_pred16_t p) return vqdmlashq_m (m1, m2, add, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s8.c index 45f34b6..b796f20 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -38,4 +42,8 @@ foo1 (int8x16_t m1, int8x16_t m2, int8_t add, mve_pred16_t p) return vqdmlashq_m (m1, m2, add, p); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s16.c index a3f1ae8..9a25494 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int16x8_t m1, int16x8_t m2, int16_t add) return vqdmlashq (m1, m2, add); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s32.c index cf867e5..36fc7b0 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int32x4_t m1, int32x4_t m2, int32_t add) return vqdmlashq (m1, m2, add); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s8.c index 7e9362c..1e7cd44 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int8x16_t m1, int8x16_t m2, int8_t add) return vqdmlashq (m1, m2, add); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f16.c index 6b148a4..5b1731f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -42,4 +46,8 @@ foo2 (float16x8_t b) return vsetq_lane (1.1, b, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f32.c index e4e7f89..34b403d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -42,4 +46,8 @@ foo2 (float32x4_t b) return vsetq_lane (1.1, b, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s16.c index 950cd01..458fd5e 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int16_t a, int16x8_t b) return vsetq_lane (a, b, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s32.c index 6b49ccd..44672f6c 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int32_t a, int32x4_t b) return vsetq_lane (a, b, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c index 95ba4da..62e8ee5 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int64_t a, int64x2_t b) return vsetq_lane (a, b, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s8.c index 91a5bae..3a79ab1 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -30,4 +34,8 @@ foo1 (int8_t a, int8x16_t b) return vsetq_lane (a, b, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u16.c index 53986a5..8a42773 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u16.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -42,4 +46,8 @@ foo2 (uint16x8_t b) return vsetq_lane (1, b, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u32.c index 3f17db9..43778e6 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u32.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u32.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -42,4 +46,8 @@ foo2 (uint32x4_t b) return vsetq_lane (1, b, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c index 5ce4c54..c75bfa4 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -42,4 +46,8 @@ foo2 (uint64x2_t b) return vsetq_lane (1, b, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u8.c index 58e932b..5fb2016 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u8.c @@ -5,6 +5,10 @@ #include "arm_mve.h" +#ifdef __cplusplus +extern "C" { +#endif + /* **foo: ** ... @@ -42,4 +46,8 @@ foo2 (uint8x16_t b) return vsetq_lane (1, b, 1); } +#ifdef __cplusplus +} +#endif + /* { dg-final { scan-assembler-not "__ARM_undef" } } */ \ No newline at end of file -- cgit v1.1 From 9d4c00cdaccc3decd07740e817387ce844ef3ac9 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 25 Jan 2023 15:13:30 +0100 Subject: c++: Fix up mangling of static lambdas [PR108525] Before the P1169R4 changes, operator () of a lambda was always a method, so it was fine to pass method_p = 1 unconditionally, but it isn't always the case, so this patch adds a check for whether it is a method or nor. 2023-01-25 Jakub Jelinek PR c++/108525 * mangle.cc (write_closure_type_name): Don't assume all lambda operator() fns are methods. * g++.dg/cpp23/static-operator-call5.C: New test. --- gcc/cp/mangle.cc | 2 +- gcc/testsuite/g++.dg/cpp23/static-operator-call5.C | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/cp/mangle.cc b/gcc/cp/mangle.cc index 62e9f9f..f2cda3b 100644 --- a/gcc/cp/mangle.cc +++ b/gcc/cp/mangle.cc @@ -1816,7 +1816,7 @@ write_closure_type_name (const tree type) if (abi_warn_or_compat_version_crosses (18)) G.need_abi_warning = true; - write_method_parms (parms, /*method_p=*/1, fn); + write_method_parms (parms, TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE, fn); write_char ('E'); if ((LAMBDA_EXPR_SCOPE_SIG_DISCRIMINATOR (lambda) != LAMBDA_EXPR_SCOPE_ONLY_DISCRIMINATOR (lambda)) diff --git a/gcc/testsuite/g++.dg/cpp23/static-operator-call5.C b/gcc/testsuite/g++.dg/cpp23/static-operator-call5.C index ae022d0..ecbb843 100644 --- a/gcc/testsuite/g++.dg/cpp23/static-operator-call5.C +++ b/gcc/testsuite/g++.dg/cpp23/static-operator-call5.C @@ -1,3 +1,8 @@ +// PR c++/108525 +// { dg-do compile { target c++23 } } + +auto b = [](...) static { return 1; }; +auto foo () { return b (); } // PR c++/108526 // { dg-do compile { target c++23 } } -- cgit v1.1 From 80cf2c5e8f496bed9c6facf55f9ae31d0d90fd28 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Mon, 16 Jan 2023 14:07:20 +0000 Subject: modula-2: Fixes for preprocessing [PR102343, PR108182]. Modula-2 uses the C preprocessor to implement handling for conditional code and macros. However, this is not done directly, because the process is applied recursively to imported definitions and modules. The cc1gm2 executable records the parameters as a template command line needed to create a composite 'cc1 -E' for each file to be preprocessed starting with the main file from the original command line. This patch fixes the capture of the C preprocessor template to include the target information needed for correct multilib operation. In order to match the existing semantics of '-E, -M and -MM' these have to be handled as a 'pre-processor only' job (i.e. the recursion is omitted and only the main file is processed). Whereas C-family front ends always pre-process, Modula-2 only does so when specifically requested (via the -fcpp option). '-MD, -MMD and -MQ' also require special handling, since (in principle) these options can be applied to any command line (with -fcpp) providing dependency information as a by-product. TODO: the preprocessor is not able to determine def and mod dependencies for Modula-2 and so the output of this only shows the object to module dep. We should be able to append the .def and .mod dependencies. The patch amends save-temps handling to cater for the preprocessor recursion and to avoid writing saved files into the source directories. The patch changes the extension for Modula-2 preprocessed source to .m2i to avoid clashes with .i. The main driver code is amended to add default handlers for .mod and .m2i so that a useful error message will be emitted if the Modula-2 compiler is not built-in. The compiler will now also handle code generation from a .m2i preprocessed source. TODO: We should not need to pass the '-c' option to the compiler to alter the processing of init code. Signed-off-by: Iain Sandoe PR modula2/102343 PR modula2/108182 gcc/ChangeLog: * gcc.cc: Provide default specs for Modula-2 so that when the language is not built-in better diagnostics are emitted for attempts to use .mod or .m2i file extensions. gcc/m2/ChangeLog: * gm2-compiler/M2Comp.mod: Early exit for pre-processor-only jobs. * gm2-compiler/M2Options.def (SetPPOnly, GetPPOnly, SetMD, GetMD, SetMMD, GetMMD, SetMQ, GetMQ, SetObj, GetObj, SetDumpDir, GetDumpDir):New. * gm2-compiler/M2Options.mod:(SetPPOnly, GetPPOnly, SetMD, GetMD, SetMMD, GetMMD, SetMQ, GetMQ, SetObj, GetObj, SetDumpDir, GetDumpDir):New. * gm2-compiler/M2Preprocess.def (PreprocessModule): Add flag to indicate the main file. * gm2-compiler/M2Preprocess.mod: Handle Preprocess-only jobs, handle MD, MMD and MQ options. * gm2-gcc/m2options.h (M2Options_SetPPOnly, M2Options_GetPPOnly, M2Options_SetDumpDir, M2Options_SetMD, M2Options_GetMD, M2Options_SetMMD, M2Options_GetMMD, M2Options_SetMQ, M2Options_GetMQ, M2Options_SetObj, M2Options_GetObj): New. * gm2-gcc/m2type.cc (m2type_InitBaseTypes): Early exit for pre- processor-only jobs. * gm2-lang.cc (gm2_langhook_init): Handle preprocess-only commands. (gm2_langhook_option_lang_mask): Claim C and Driver options so that we can intercept them for building pre-processor commands. (gm2_langhook_init_options): Collect the preprocessor line here. Save options that have different actions for preprocessor and compile commands. (gm2_langhook_handle_option): Only handle the modula-2 options here. (gm2_langhook_post_options): Do not create a back-end for pre- processor-only jobs. * gm2spec.cc (lang_specific_driver): Ignore PCH options, append a scaffold-main for cases where we are building a main module with -c. * lang-specs.h: Revise to handle preprocessor-only jobs and to consume pre-processed files. * lang.opt: Remove Driver and C options copies (we claim these separately). --- gcc/gcc.cc | 1 + gcc/m2/gm2-compiler/M2Comp.mod | 38 ++++-- gcc/m2/gm2-compiler/M2Options.def | 90 ++++++++++++- gcc/m2/gm2-compiler/M2Options.mod | 139 +++++++++++++++++++- gcc/m2/gm2-compiler/M2Preprocess.def | 2 +- gcc/m2/gm2-compiler/M2Preprocess.mod | 130 +++++++++++++++++-- gcc/m2/gm2-gcc/m2options.h | 11 ++ gcc/m2/gm2-gcc/m2type.cc | 4 + gcc/m2/gm2-lang.cc | 237 +++++++++++++++++++++++++---------- gcc/m2/gm2spec.cc | 33 ++++- gcc/m2/lang-specs.h | 40 ++++-- gcc/m2/lang.opt | 119 +----------------- 12 files changed, 619 insertions(+), 225 deletions(-) (limited to 'gcc') diff --git a/gcc/gcc.cc b/gcc/gcc.cc index d629ca5..d813002 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc @@ -1423,6 +1423,7 @@ static const struct compiler default_compilers[] = {".r", "#Ratfor", 0, 0, 0}, {".go", "#Go", 0, 1, 0}, {".d", "#D", 0, 1, 0}, {".dd", "#D", 0, 1, 0}, {".di", "#D", 0, 1, 0}, + {".mod", "#Modula-2", 0, 0, 0}, {".m2i", "#Modula-2", 0, 0, 0}, /* Next come the entries for C. */ {".c", "@c", 0, 0, 1}, {"@c", diff --git a/gcc/m2/gm2-compiler/M2Comp.mod b/gcc/m2/gm2-compiler/M2Comp.mod index fd5ea1b..05eaacc 100644 --- a/gcc/m2/gm2-compiler/M2Comp.mod +++ b/gcc/m2/gm2-compiler/M2Comp.mod @@ -22,7 +22,8 @@ along with GNU Modula-2; see the file COPYING3. If not see IMPLEMENTATION MODULE M2Comp ; -FROM M2Options IMPORT Statistics, Quiet, WholeProgram, ExtendedOpaque, GenModuleList ; +FROM M2Options IMPORT PPonly, Statistics, Quiet, WholeProgram, + ExtendedOpaque, GenModuleList ; FROM M2Pass IMPORT SetPassToPass0, SetPassToPass1, SetPassToPass2, SetPassToPassC, SetPassToPass3, SetPassToNoPass, SetPassToPassHidden ; @@ -60,11 +61,12 @@ FROM SymbolTable IMPORT GetSymName, IsDefImp, NulSym, ResolveConstructorTypes, SanityCheckConstants, IsDefinitionForC, IsBuiltinInModule, PutModLink, IsDefLink, IsModLink ; -FROM FIO IMPORT StdErr ; +FROM FIO IMPORT StdErr, StdOut ; FROM NameKey IMPORT Name, GetKey, KeyToCharStar, makekey ; FROM M2Printf IMPORT fprintf1 ; FROM M2Quiet IMPORT qprintf0, qprintf1, qprintf2 ; FROM DynamicStrings IMPORT String, InitString, KillString, InitStringCharStar, Dup, Mark, string ; +FROM M2Options IMPORT Verbose ; CONST Debugging = FALSE ; @@ -126,6 +128,10 @@ PROCEDURE Compile (s: String) ; BEGIN DoPass0(s) ; FlushWarnings ; FlushErrors ; + IF PPonly + THEN + RETURN + END; ResetForNewPass ; ResetErrorScope ; qprintf0('Pass 1: scopes, enumerated types, imports and exports\n') ; DoPass1 ; @@ -198,7 +204,7 @@ VAR name : ADDRESS ; isdefimp: BOOLEAN ; BEGIN - IF OpenSource(PreprocessModule(s)) + IF OpenSource(s) THEN ExamineCompilationUnit(name, isdefimp) ; IF isdefimp @@ -226,15 +232,26 @@ VAR Sym : CARDINAL ; i : CARDINAL ; SymName, - FileName: String ; + FileName, + PPSource: String ; BEGIN P0Init ; SetPassToPass0 ; - PeepInto(s) ; + (* Maybe preprocess the main file. *) + PPSource := PreprocessModule(s, TRUE); + IF PPonly + THEN + RETURN + END; + PeepInto (PPSource) ; Main := GetMainModule() ; i := 1 ; Sym := GetModuleNo(i) ; - qprintf1('Compiling: %s\n', s) ; + qprintf1('Compiling: %s\n', PPSource) ; + IF Verbose + THEN + fprintf1(StdOut, 'Compiling: %s\n', PPSource) ; + END ; qprintf0('Pass 0: lexical analysis, parsing, modules and associated filenames\n') ; WHILE Sym#NulSym DO SymName := InitStringCharStar(KeyToCharStar(GetSymName(Sym))) ; @@ -243,7 +260,7 @@ BEGIN IF FindSourceDefFile(SymName, FileName) THEN ModuleType := Definition ; - IF OpenSource(AssociateDefinition(PreprocessModule(FileName), Sym)) + IF OpenSource(AssociateDefinition(PreprocessModule(FileName, FALSE), Sym)) THEN IF NOT P0SyntaxCheck.CompilationUnit() THEN @@ -280,15 +297,16 @@ BEGIN (* only need to read implementation module if hidden types are declared or it is the main module *) IF Main=Sym THEN - FileName := Dup(s) + FileName := Dup (PPSource) ELSE IF FindSourceModFile (SymName, FileName) THEN + FileName := PreprocessModule (FileName, FALSE) END END ; IF FileName#NIL THEN - IF OpenSource (AssociateModule (PreprocessModule (FileName), Sym)) + IF OpenSource (AssociateModule (Dup (FileName), Sym)) THEN IF NOT P0SyntaxCheck.CompilationUnit() THEN @@ -325,7 +343,7 @@ BEGIN IF FindSourceModFile (SymName, FileName) THEN qprintf2 (' Module %-20s : %s (linking)\n', SymName, FileName) ; - IF OpenSource (AssociateModule (PreprocessModule (FileName), Sym)) + IF OpenSource (AssociateModule (PreprocessModule (FileName, FALSE), Sym)) THEN PutModLink (Sym, TRUE) ; (* This source is only used to determine link time info. *) IF NOT P0SyntaxCheck.CompilationUnit () diff --git a/gcc/m2/gm2-compiler/M2Options.def b/gcc/m2/gm2-compiler/M2Options.def index e7b34cf..df42a4a 100644 --- a/gcc/m2/gm2-compiler/M2Options.def +++ b/gcc/m2/gm2-compiler/M2Options.def @@ -52,11 +52,12 @@ EXPORT QUALIFIED SetReturnCheck, SetNilCheck, SetCaseCheck, SetWholeValueCheck, GetWholeValueCheck, SetLowerCaseKeywords, SetIndex, SetRange, SetWholeDiv, SetStrictTypeChecking, - Setc, Getc, SetUselist, GetUselist, GetUselistFilename, - SetShared, SetB, + Setc, Getc, SetPPOnly, GetPPOnly, + SetUselist, GetUselist, GetUselistFilename, + SetShared, Iso, Pim, Pim2, Pim3, Pim4, - cflag, + PPonly, cflag, PositiveModFloorDiv, Pedantic, Verbose, Statistics, UnboundedByReference, VerboseUnbounded, @@ -83,7 +84,7 @@ EXPORT QUALIFIED SetReturnCheck, SetNilCheck, SetCaseCheck, DebugBuiltins, setdefextension, setmodextension, SetStatistics, SetWall, SetSaveTemps, SetSaveTempsDir, SaveTemps, GetSaveTempsDir, - GenModuleList, + SetDumpDir, GetDumpDir, GenModuleList, CppArg, CppCommandLine, CppRemember, SetDebugFunctionLineNumbers, DebugFunctionLineNumbers, SetGenerateStatementNote, GenerateStatementNote, @@ -92,10 +93,11 @@ EXPORT QUALIFIED SetReturnCheck, SetNilCheck, SetCaseCheck, SetScaffoldMain, ScaffoldMain, SetRuntimeModuleOverride, GetRuntimeModuleOverride, SetGenModuleList, GetGenModuleFilename, SharedFlag, - GetB ; + SetB, GetB, SetMD, GetMD, SetMMD, GetMMD, SetObj, GetObj ; VAR + PPonly, (* -E/M/MM present? - preprocessing only *) cflag, (* -c flag present? *) Iso, (* -fiso use ISO SYSTEM.def *) Pim, (* -fpim use PIM [234] SYSTEM.def *) @@ -174,6 +176,18 @@ VAR Coding, Profiling : BOOLEAN ; +(* + SetPPOnly - set the PPonly to value (on E, M, MM). +*) + +PROCEDURE SetPPOnly (value: BOOLEAN) ; + + +(* + GetPPOnly - get the PPonly (Preprocess only). +*) + +PROCEDURE GetPPOnly () : BOOLEAN ; (* Setc - set the cflag (compile only flag -c) to value. @@ -195,13 +209,64 @@ PROCEDURE Getc () : BOOLEAN ; PROCEDURE SetB (arg: ADDRESS) ; - (* GetB - returns argument to the -B option as a string or NIL if it were never set. *) PROCEDURE GetB () : ADDRESS ; +(* + SetMD - assigns MD file to arg. +*) + +PROCEDURE SetMD (arg: ADDRESS) ; + +(* + GetMD - returns the filename set for MD or NIL if it was never set. +*) + +PROCEDURE GetMD () : ADDRESS ; + + +(* + SetMMD - assigns MMD file to arg. +*) + +PROCEDURE SetMMD (arg: ADDRESS) ; + +(* + GetMMD - returns the filename set for MMD or NIL if it was never set. +*) + +PROCEDURE GetMMD () : ADDRESS ; + +(* + SetMQ - assigns MQ file to arg. +*) + +PROCEDURE SetMQ (arg: ADDRESS) ; + +(* + GetMQ - returns the filename set for MQ or NIL if it was never set. +*) + +PROCEDURE GetMQ () : ADDRESS ; + +(* + SetScaffoldDynamic - set the -fscaffold-dynamic flag. +*) + +(* + SetObj - assigns given object file to arg. +*) + +PROCEDURE SetObj (arg: ADDRESS) ; + +(* + GetObj - returns the filename set for Object or NIL if it was never set. +*) + +PROCEDURE GetObj () : ADDRESS ; (* SetScaffoldDynamic - set the -fscaffold-dynamic flag. @@ -784,6 +849,19 @@ PROCEDURE SetSaveTempsDir (arg: ADDRESS) ; PROCEDURE GetSaveTempsDir () : String ; +(* + SetDumpDir - Specify dump dir. +*) + +PROCEDURE SetDumpDir (arg: ADDRESS) ; + + +(* + GetDumpDir - return DumpDir or NIL. +*) + +PROCEDURE GetDumpDir () : String ; + (* SetGenModuleList - set the GenModuleList flag to value and pass diff --git a/gcc/m2/gm2-compiler/M2Options.mod b/gcc/m2/gm2-compiler/M2Options.mod index 14e978a..865b857 100644 --- a/gcc/m2/gm2-compiler/M2Options.mod +++ b/gcc/m2/gm2-compiler/M2Options.mod @@ -54,7 +54,12 @@ CONST VAR Barg, + MDarg, + MMDarg, + MQarg, + CmdLineObj, SaveTempsDir, + DumpDir, GenModuleListFilename, UselistFilename, RuntimeModuleOverride, @@ -133,6 +138,94 @@ END GetB ; (* + SetMD - assigns MDarg to the filename from arg. + This overrides any previous MMD. +*) + +PROCEDURE SetMD (arg: ADDRESS) ; +BEGIN + MMDarg := KillString (MMDarg) ; + MDarg := KillString (MDarg) ; + MDarg := InitStringCharStar (arg) +END SetMD ; + + +(* + GetMD - returns MDarg filename as a c-string or NIL if it was never set. +*) + +PROCEDURE GetMD () : ADDRESS ; +BEGIN + RETURN string (MDarg) +END GetMD ; + + +(* + SetMMD - assigns MMDarg to the filename from arg. + This overrides any previous MD. +*) + +PROCEDURE SetMMD (arg: ADDRESS) ; +BEGIN + MDarg := KillString (MDarg) ; + MMDarg := KillString (MMDarg) ; + MMDarg := InitStringCharStar (arg) +END SetMMD ; + + +(* + GetMMD - returns MMDarg filename as a c-string or NIL if it was never set. +*) + +PROCEDURE GetMMD () : ADDRESS ; +BEGIN + RETURN string (MMDarg) +END GetMMD ; + + +(* + SetMQ - assigns MQarg to the filename from arg. +*) + +PROCEDURE SetMQ (arg: ADDRESS) ; +BEGIN + MQarg := KillString (MQarg) ; + MQarg := InitStringCharStar (arg) +END SetMQ ; + + +(* + GetMMD - returns MQarg filename as a c-string or NIL if it was never set. +*) + +PROCEDURE GetMQ () : ADDRESS ; +BEGIN + RETURN string (MQarg) +END GetMQ ; + + +(* + SetObj - assigns CmdLineObj to the filename from arg. +*) + +PROCEDURE SetObj (arg: ADDRESS) ; +BEGIN + CmdLineObj := KillString (CmdLineObj) ; + CmdLineObj := InitStringCharStar (arg) +END SetObj ; + + +(* + GetObj - returns CmdLineObj filename as a c-string or NIL if it was never set. +*) + +PROCEDURE GetObj () : ADDRESS ; +BEGIN + RETURN string (CmdLineObj) +END GetObj ; + + +(* CppCommandLine - returns the Cpp command line and all arguments. NIL is returned if the -fcpp is absent. *) @@ -365,6 +458,25 @@ END GetCpp ; (* + SetPPOnly - set the PPonly (preprocess only) to value. +*) + +PROCEDURE SetPPOnly (value: BOOLEAN) ; +BEGIN + PPonly := value +END SetPPOnly ; + +(* + GetPPOnly - get the PPonly (preprocess only). +*) + +PROCEDURE GetPPOnly () : BOOLEAN ; +BEGIN + RETURN PPonly +END GetPPOnly ; + + +(* Setc - set the cflag (compile only flag -c) to value. *) @@ -1050,7 +1162,8 @@ END SetSaveTemps ; PROCEDURE SetSaveTempsDir (arg: ADDRESS) ; BEGIN - SaveTempsDir := InitStringCharStar (arg) + SaveTempsDir := InitStringCharStar (arg) ; + SaveTemps := TRUE END SetSaveTempsDir ; @@ -1063,6 +1176,24 @@ BEGIN RETURN SaveTempsDir END GetSaveTempsDir ; +(* + SetDumpDir - Set the dump dir. +*) + +PROCEDURE SetDumpDir (arg: ADDRESS) ; +BEGIN + DumpDir := InitStringCharStar (arg) +END SetDumpDir ; + + +(* + GetDumpDir - return DumpDir or NIL. +*) + +PROCEDURE GetDumpDir () : String ; +BEGIN + RETURN DumpDir +END GetDumpDir ; (* SetScaffoldDynamic - set the -fscaffold-dynamic flag. @@ -1247,5 +1378,9 @@ BEGIN GenModuleListFilename := NIL ; SharedFlag := FALSE ; Barg := NIL ; - SaveTempsDir := NIL + MDarg := NIL ; + MMDarg := NIL ; + MQarg := NIL ; + SaveTempsDir := NIL ; + DumpDir := NIL END M2Options. diff --git a/gcc/m2/gm2-compiler/M2Preprocess.def b/gcc/m2/gm2-compiler/M2Preprocess.def index 08fe192..0258580 100644 --- a/gcc/m2/gm2-compiler/M2Preprocess.def +++ b/gcc/m2/gm2-compiler/M2Preprocess.def @@ -45,7 +45,7 @@ EXPORT QUALIFIED PreprocessModule ; All temporary files will be deleted when the compiler exits. *) -PROCEDURE PreprocessModule (filename: String) : String ; +PROCEDURE PreprocessModule (filename: String; isMain: BOOLEAN) : String ; END M2Preprocess. diff --git a/gcc/m2/gm2-compiler/M2Preprocess.mod b/gcc/m2/gm2-compiler/M2Preprocess.mod index eb08015..ebd9cb9 100644 --- a/gcc/m2/gm2-compiler/M2Preprocess.mod +++ b/gcc/m2/gm2-compiler/M2Preprocess.mod @@ -25,7 +25,7 @@ IMPLEMENTATION MODULE M2Preprocess ; FROM SYSTEM IMPORT WORD ; FROM DynamicStrings IMPORT string, InitString, Mark, KillString, EqualArray, InitStringCharStar, - Dup, ConCat, ConCatChar, RIndex, Slice ; + Dup, ConCat, ConCatChar, RIndex, Slice, Length ; FROM choosetemp IMPORT make_temp_file ; FROM pexecute IMPORT pexecute ; @@ -33,7 +33,8 @@ FROM libc IMPORT system, exit, unlink, printf, atexit ; FROM Lists IMPORT List, InitList, KillList, IncludeItemIntoList, ForeachItemInListDo ; FROM FIO IMPORT StdErr, StdOut ; FROM M2Printf IMPORT fprintf1 ; -FROM M2Options IMPORT Verbose, CppCommandLine, SaveTemps ; +FROM M2Options IMPORT Verbose, PPonly, GetObj, GetMD, GetMMD, GetMQ, + CppCommandLine, SaveTemps, GetSaveTempsDir, GetDumpDir ; FROM NameKey IMPORT Name, MakeKey, KeyToCharStar, makekey ; @@ -77,14 +78,80 @@ BEGIN RETURN 0 END RemoveFiles ; +(* + Return the filename with no path. +*) + +PROCEDURE GetFileName (Path: String) : String ; +VAR + fstart: INTEGER ; +BEGIN + fstart := RIndex(Path, '/', 0) ; + IF fstart=-1 + THEN + fstart := 0 + ELSE + fstart := fstart + 1 + END ; + RETURN Dup (Slice(Path, fstart, Length (Path))) +END GetFileName ; + + +(* + Return basename. +*) + +PROCEDURE BaseName (Path: String) : String ; +VAR + ext, + basename: INTEGER ; +BEGIN + basename := RIndex(Path, '/', 0) ; + IF basename=-1 + THEN + basename := 0 + ELSE + basename := basename + 1 + END ; + ext := RIndex(Path, '.', 0) ; + IF ext=-1 + THEN + ext := 0 + END ; + RETURN Dup (Slice(Path, basename, ext)) +END BaseName ; (* - MakeSaveTempsFileName - return a temporary file "filename.i". + MakeSaveTempsFileName - return a temporary file like + "./filename.{def,mod}.m2i" in the CWD unless SaveTempsDir = obj, + when we put it in the dumpdir if that is specified (or fallback to '.' + if not). + We have to keep the original extension because that disambiguates .def + and .mod files (otherwise, we'd need two 'preprocessed' extensions). *) PROCEDURE MakeSaveTempsFileName (filename: String) : String ; +VAR + NewName, + DumpDir, + NewDir: String ; BEGIN - RETURN ConCat (Dup (filename), InitString ('.i')) + NewName := ConCat (GetFileName (filename), InitString ('.m2i')) ; + NewDir := GetSaveTempsDir () ; + DumpDir := GetDumpDir () ; +(* IF Verbose + THEN + fprintf1 (StdOut, "newname: %s", NewName) ; + fprintf1 (StdOut, " NewDir: %s", NewDir) ; + fprintf1 (StdOut, " DumpDir: %s\n", DumpDir) + END ; +*) + IF (NewDir AND EqualArray (NewDir, 'obj')) AND DumpDir + THEN + RETURN Dup (ConCat (DumpDir, NewName)) + ELSE + RETURN Dup (ConCat (InitString ('./'), NewName)) + END ; END MakeSaveTempsFileName ; @@ -98,7 +165,7 @@ END MakeSaveTempsFileName ; All temporary files will be deleted when the compiler exits. *) -PROCEDURE PreprocessModule (filename: String) : String ; +PROCEDURE PreprocessModule (filename: String; isMain: BOOLEAN) : String ; VAR tempfile, command, @@ -107,18 +174,55 @@ BEGIN command := CppCommandLine () ; IF (command = NIL) OR EqualArray (command, '') THEN - RETURN filename + RETURN Dup (filename) ELSE - IF SaveTemps + commandLine := Dup (command) ; + tempfile := NIL ; + (* We support MD and MMD for the main file only, at present. *) + IF isMain OR PPonly + THEN + IF GetMD () + THEN + tempfile := ConCat( Mark (InitString(' -MD ')), + InitStringCharStar (GetMD ())) + ELSIF GetMMD () + THEN + tempfile := ConCat( Mark (InitString(' -MMD ')), + InitStringCharStar (GetMMD ())) + END ; + IF tempfile + THEN + commandLine := ConCat (Dup (commandLine), Dup (tempfile)) ; + (* We can only add MQ if we already have an MD/MMD. *) + IF GetMQ () + THEN + tempfile := ConCat( Mark (InitString(' -MQ ')), + InitStringCharStar (GetMQ ())) ; + commandLine := ConCat (Dup (commandLine), Dup (tempfile)) + END ; + END ; + END ; + (* The output file depends on whether we are in stand-alone PP mode, and + if an output file is specified. *) + tempfile := NIL ; + IF PPonly + THEN + IF GetObj() + THEN + tempfile := InitStringCharStar (GetObj ()) + END ; + ELSIF SaveTemps THEN - tempfile := InitStringCharStar (MakeSaveTempsFileName (filename)) + tempfile := MakeSaveTempsFileName (filename) ELSE - tempfile := InitStringCharStar (make_temp_file (KeyToCharStar (MakeKey('i')))) + tempfile := InitStringCharStar (make_temp_file (KeyToCharStar (MakeKey('.m2i')))) + END ; + commandLine := ConCat (ConCatChar (Dup (commandLine), ' '), filename) ; + IF tempfile + THEN + commandLine := ConCat (ConCat (Dup (commandLine), + Mark (InitString(' -o '))), tempfile) ; END ; - commandLine := Dup (command) ; - commandLine := ConCat (ConCat (ConCat (ConCatChar (Dup (commandLine), ' '), filename), - Mark (InitString(' -o '))), - tempfile) ; (* use pexecute in the future res := pexecute(string(Slice(commandLine, 0, Index(commandLine, ' ', 0))), etc etc ); *) diff --git a/gcc/m2/gm2-gcc/m2options.h b/gcc/m2/gm2-gcc/m2options.h index 9cccb37..92b4fd5 100644 --- a/gcc/m2/gm2-gcc/m2options.h +++ b/gcc/m2/gm2-gcc/m2options.h @@ -61,6 +61,8 @@ EXTERN int M2Options_GetWholeValueCheck (void); EXTERN void M2Options_Setc (int value); EXTERN int M2Options_Getc (void); +EXTERN void M2Options_SetPPOnly (int value); +EXTERN int M2Options_GetPPOnly (void); EXTERN void M2Options_SetUselist (int value, const char *filename); EXTERN void M2Options_SetAutoInit (int value); @@ -112,6 +114,7 @@ EXTERN void M2Options_SetStrictTypeChecking (int value); EXTERN void M2Options_SetWall (int value); EXTERN void M2Options_SetSaveTemps (int value); EXTERN void M2Options_SetSaveTempsDir (const char *arg); +EXTERN void M2Options_SetDumpDir (const char *arg); EXTERN int M2Options_GetSaveTemps (void); EXTERN void M2Options_SetScaffoldStatic (int value); EXTERN void M2Options_SetScaffoldDynamic (int value); @@ -121,6 +124,14 @@ EXTERN void M2Options_SetGenModuleList (int value, const char *filename); EXTERN void M2Options_SetShared (int value); EXTERN void M2Options_SetB (const char *arg); EXTERN char *M2Options_GetB (void); +EXTERN void M2Options_SetMD (const char *arg); +EXTERN char *M2Options_GetMD (void); +EXTERN void M2Options_SetMMD (const char *arg); +EXTERN char *M2Options_GetMMD (void); +EXTERN void M2Options_SetMQ (const char *arg); +EXTERN char *M2Options_GetMQ (void); +EXTERN void M2Options_SetObj (const char *arg); +EXTERN char *M2Options_GetObj (void); #undef EXTERN #endif /* m2options_h. */ diff --git a/gcc/m2/gm2-gcc/m2type.cc b/gcc/m2/gm2-gcc/m2type.cc index ad5064f..634fad8 100644 --- a/gcc/m2/gm2-gcc/m2type.cc +++ b/gcc/m2/gm2-gcc/m2type.cc @@ -36,6 +36,7 @@ along with GNU Modula-2; see the file COPYING3. If not see #include "m2tree.h" #include "m2treelib.h" #include "m2type.h" +#include "m2options.h" #undef USE_BOOLEAN static int broken_set_debugging_info = TRUE; @@ -1782,6 +1783,9 @@ m2type_InitBaseTypes (location_t location) m2_packed_boolean_type_node = build_nonstandard_integer_type (1, TRUE); + if (M2Options_GetPPOnly ()) + return; + m2builtins_init (location); m2except_InitExceptions (location); m2expr_init (location); diff --git a/gcc/m2/gm2-lang.cc b/gcc/m2/gm2-lang.cc index 9870743..4d9cae2 100644 --- a/gcc/m2/gm2-lang.cc +++ b/gcc/m2/gm2-lang.cc @@ -107,6 +107,8 @@ struct GTY (()) language_function /* Language hooks. */ +static void gm2_langhook_parse_file (void); + bool gm2_langhook_init (void) { @@ -120,6 +122,13 @@ gm2_langhook_init (void) /* GNU Modula-2 uses exceptions. */ using_eh_for_cleanups (); + + if (M2Options_GetPPOnly ()) + { + /* preprocess the file here. */ + gm2_langhook_parse_file (); + return false; /* Finish now, no further compilation. */ + } return true; } @@ -128,7 +137,9 @@ gm2_langhook_init (void) static unsigned int gm2_langhook_option_lang_mask (void) { - return CL_ModulaX2; + /* We need to process some driver options and pass through some C + ones to build our preprocessing lines. */ + return CL_ModulaX2 | CL_C | CL_DRIVER; } /* Initialize the options structure. */ @@ -155,27 +166,146 @@ gm2_langhook_init_options_struct (struct gcc_options *opts) static vec filename_cpp; +/* Build the C preprocessor command line here, since we need to include + options that are not passed to the handle_option function. */ + void gm2_langhook_init_options (unsigned int decoded_options_count, struct cl_decoded_option *decoded_options) { unsigned int i; bool in_cpp_args = false; + bool building_cpp_command = false; for (i = 1; i < decoded_options_count; i++) { - switch (decoded_options[i].opt_index) - { - case OPT_fcpp_begin: - in_cpp_args = true; - break; - case OPT_fcpp_end: - in_cpp_args = false; - break; - case OPT_SPECIAL_input_file: - case OPT_SPECIAL_program_name: - filename_cpp.safe_push (in_cpp_args); - } + enum opt_code code = (enum opt_code)decoded_options[i].opt_index; + const struct cl_option *option = &cl_options[code]; + const char *opt = (const char *)option->opt_text; + const char *arg = decoded_options[i].arg; + HOST_WIDE_INT value = decoded_options[i].value; + switch (code) + { + case OPT_fcpp: + gcc_checking_assert (building_cpp_command); + break; + case OPT_fcpp_begin: + in_cpp_args = true; + building_cpp_command = true; + break; + case OPT_fcpp_end: + in_cpp_args = false; + break; + case OPT_SPECIAL_input_file: + filename_cpp.safe_push (in_cpp_args); + break; + + /* C and driver opts that are not passed to the preprocessor for + modula-2, but that we use internally for building preprocesor + command lines. */ + case OPT_B: + M2Options_SetB (arg); + break; + case OPT_c: + M2Options_Setc (value); + break; + case OPT_dumpdir: + if (building_cpp_command) + M2Options_SetDumpDir (arg); + break; + case OPT_save_temps: + if (building_cpp_command) + M2Options_SetSaveTemps (value); + break; + case OPT_save_temps_: + if (building_cpp_command) + /* Also sets SaveTemps. */ + M2Options_SetSaveTempsDir (arg); + break; + + case OPT_E: + if (!in_cpp_args) + { + M2Options_SetPPOnly (value); + building_cpp_command = true; + } + M2Options_CppArg (opt, arg, (option->flags & CL_JOINED) + && !(option->flags & CL_SEPARATE)); + break; + case OPT_M: + case OPT_MM: + gcc_checking_assert (building_cpp_command); + M2Options_SetPPOnly (value); + /* This is a preprocessor command. */ + M2Options_CppArg (opt, arg, (option->flags & CL_JOINED) + && !(option->flags & CL_SEPARATE)); + break; + + /* We can only use MQ when the command line is either PP-only, or + when there is a MD/MMD on it. */ + case OPT_MQ: + M2Options_SetMQ (arg); + break; + + case OPT_o: + M2Options_SetObj (arg); + break; + + /* C and driver options that we ignore for the preprocessor lines. */ + case OPT_fpch_deps: + case OPT_fpch_preprocess: + break; + + case OPT_fplugin_: + /* FIXME: We might need to handle this specially, since the modula-2 + plugin is not usable here, but others might be. + For now skip all plugins to avoid fails with the m2 one. */ + break; + + /* Preprocessor arguments with a following filename. */ + case OPT_MD: + case OPT_MMD: + /* Save the filename associated with the MD/MMD which will also + mark the option as used. FIXME: maybe we should diagnose a + missing filename here, rather than assert. */ + gcc_checking_assert (i+1 < decoded_options_count); + gcc_checking_assert (decoded_options[i+1].opt_index + == OPT_SPECIAL_input_file); + /* Pick up the following filename. */ + arg = decoded_options[i+1].arg; + if (code == OPT_MD) + M2Options_SetMD (arg); + else + M2Options_SetMMD (arg); + break; + + /* Options we act on and also pass to the preprocessor. */ + case OPT_O: + M2Options_SetOptimizing (value); + if (building_cpp_command) + M2Options_CppArg (opt, arg, (option->flags & CL_JOINED) + && !(option->flags & CL_SEPARATE)); + break; + case OPT_v: + M2Options_SetVerbose (value); + /* FALLTHROUGH */ + default: + if (code >= N_OPTS) + { + // FIXME remove debug. + fprintf(stderr, "%s : %s\n", opt, (arg ? arg : "")); + break; + } + /* Do not pass Modula-2 args to the preprocessor, any that we care + about here should already have been handled above. */ + if (option->flags & CL_ModulaX2) + break; + /* Otherwise, add this to the CPP command line. */ + if (building_cpp_command) + M2Options_CppArg (opt, arg, (option->flags & CL_JOINED) + && !(option->flags & CL_SEPARATE)); + break; + } } filename_cpp.safe_push (false); } @@ -197,28 +327,16 @@ gm2_langhook_handle_option ( { enum opt_code code = (enum opt_code)scode; + const struct cl_option *option = &cl_options[scode]; + const char *opt = (const char *)option->opt_text; /* ignore file names. */ if (code == N_OPTS) return 1; switch (code) { - case OPT_B: - M2Options_SetB (arg); - return 1; - case OPT_c: - M2Options_Setc (value); - return 1; case OPT_I: - if (insideCppArgs) - { - const struct cl_option *option = &cl_options[scode]; - const char *opt = (const char *)option->opt_text; - M2Options_CppArg (opt, arg, (option->flags & CL_JOINED) - && !(option->flags & CL_SEPARATE)); - } - else - Ipaths.push_back (arg); + Ipaths.push_back (arg); return 1; case OPT_fiso: M2Options_SetISO (value); @@ -358,6 +476,9 @@ gm2_langhook_handle_option ( case OPT_fcpp: M2Options_SetCpp (value); return 1; + case OPT_fpreprocessed: + /* Provided for compatibility; ignore for now. */ + return 1; case OPT_fcpp_begin: insideCppArgs = TRUE; return 1; @@ -396,31 +517,25 @@ gm2_langhook_handle_option ( return 1; break; case OPT_iprefix: + iprefix = arg; + return 1; + break; case OPT_imultilib: + imultilib = arg; + return 1; + break; case OPT_isystem: + isystem.push_back (arg); + return 1; + break; case OPT_iquote: + iquote.push_back (arg); + return 1; + break; case OPT_isysroot: - if (insideCppArgs) - { - const struct cl_option *option = &cl_options[scode]; - const char *opt = (const char *)option->opt_text; - M2Options_CppArg (opt, arg, (option->flags & CL_JOINED) - && !(option->flags & CL_SEPARATE)); - } - if (code == OPT_iprefix) - iprefix = arg; - else if (code == OPT_imultilib) - imultilib = arg; - else if (code == OPT_iquote) - iquote.push_back (arg); - else if (code == OPT_isystem) - isystem.push_back (arg); /* Otherwise, ignored, at least for now. */ return 1; break; - case OPT_O: - M2Options_SetOptimizing (value); - return 1; case OPT_quiet: M2Options_SetQuiet (value); return 1; @@ -445,24 +560,19 @@ gm2_langhook_handle_option ( } else return 0; - case OPT_save_temps: - M2Options_SetSaveTemps (value); - return 1; - case OPT_save_temps_: - M2Options_SetSaveTempsDir (arg); - return 1; - case OPT_v: - M2Options_SetVerbose (value); + case OPT_o: + /* Options we ignore, always. */ return 1; default: if (insideCppArgs) - { - const struct cl_option *option = &cl_options[scode]; - const char *opt = (const char *)option->opt_text; - M2Options_CppArg (opt, arg, (option->flags & CL_JOINED) - && !(option->flags & CL_SEPARATE)); - return 1; - } + /* Already handled. */ + return 1; + else if (option->flags & CL_DRIVER) + /* Ignore driver options we do not specifically use. */ + return 1; + else if (option->flags & CL_C) + /* Ignore C options we do not specifically use. */ + return 1; return 0; } return 0; @@ -574,7 +684,7 @@ gm2_langhook_post_options (const char **pfilename) add_m2_import_paths (flibs); /* Returning false means that the backend should be used. */ - return false; + return M2Options_GetPPOnly (); } /* Call the compiler for every source filename on the command line. */ @@ -597,7 +707,8 @@ static void gm2_langhook_parse_file (void) { gm2_parse_input_files (in_fnames, num_in_fnames); - write_globals (); + if (!M2Options_GetPPOnly ()) + write_globals (); } static tree diff --git a/gcc/m2/gm2spec.cc b/gcc/m2/gm2spec.cc index c248d1b..bc93133 100644 --- a/gcc/m2/gm2spec.cc +++ b/gcc/m2/gm2spec.cc @@ -133,8 +133,10 @@ static const char *add_include (const char *libpath, const char *library); static bool seen_scaffold_static = false; static bool seen_scaffold_dynamic = false; -static bool scaffold_dynamic = true; // Default uses -fscaffold-dynamic. +static bool seen_scaffold_main = false; static bool scaffold_static = false; +static bool scaffold_dynamic = true; // Default uses -fscaffold-dynamic. +static bool scaffold_main = false; static bool seen_gen_module_list = false; static bool seen_uselist = false; static bool uselist = false; @@ -525,17 +527,20 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, scaffold_static = decoded_options[i].value; args[i] |= SKIPOPT; /* We will add the option if it is needed. */ break; + case OPT_fscaffold_main: + seen_scaffold_main = true; + scaffold_main = decoded_options[i].value; + args[i] |= SKIPOPT; /* We will add the option if it is needed. */ + break; case OPT_fgen_module_list_: seen_gen_module_list = true; gen_module_list = decoded_options[i].value; if (gen_module_list) gen_module_filename = decoded_options[i].arg; - args[i] |= SKIPOPT; /* We will add the option if it is needed. */ break; case OPT_fuse_list_: seen_uselist = true; uselist = decoded_options[i].value; - args[i] |= SKIPOPT; /* We will add the option if it is needed. */ break; case OPT_nostdlib: @@ -592,6 +597,14 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, library = -1; break; + /* PCH makes no sense here, we do not catch -output-pch on purpose, + that should flag an error. */ + case OPT_fpch_deps: + case OPT_fpch_preprocess: + case OPT_Winvalid_pch: + args[i] |= SKIPOPT; + break; + case OPT_static: static_link = 1; break; @@ -694,8 +707,10 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, We also add default scaffold linking options. */ /* If we have not seen either uselist or gen_module_list and we need - to link then we turn on -fgen_module_list=- as the default. */ - if ((! (seen_uselist || seen_gen_module_list)) && linking) + to link or compile a module list then we turn on -fgen_module_list=- + as the default. */ + if (!seen_uselist && !seen_gen_module_list + && (linking || scaffold_main)) append_option (OPT_fgen_module_list_, "-", 1); /* We checked that they were not both enabled above, if there was a set @@ -705,6 +720,14 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, if (seen_scaffold_static) append_option (OPT_fscaffold_static, NULL, scaffold_static); + /* If the user has set fscaffold-main specifically, use that. Otherwise, if + we are linking then set it so that we generate the relevant code for the + main module. */ + if (seen_scaffold_main) + append_option (OPT_fscaffold_main, NULL, scaffold_main); + else if (linking) + append_option (OPT_fscaffold_main, NULL, true); + if (allow_libraries) { /* If the libraries have not been specified by the user, select the diff --git a/gcc/m2/lang-specs.h b/gcc/m2/lang-specs.h index bf88264..6228c3c 100644 --- a/gcc/m2/lang-specs.h +++ b/gcc/m2/lang-specs.h @@ -21,19 +21,35 @@ along with GCC; see the file COPYING3. If not see /* This is the contribution to the `default_compilers' array in gcc.c for GNU Modula-2. */ -/* Pass the preprocessor options on the command line together with - the exec prefix. */ - +/* A spec for the 'integrated' preprocessor implementation for Modula-2. */ #define M2CPP \ - "%{fcpp:-fcpp-begin " \ - " -E -lang-asm -traditional-cpp " \ - " %(cpp_unique_options) -fcpp-end; \ - : %I } " + "%{E|M|MM|fcpp: %{E} -fcpp-begin " \ + " %{!E:-E} %(cpp_unique_options) -traditional-cpp -ansi " \ + " -fcpp-end %{B*} %{save-temps*} ; \ + : %{v} %I } " + +/* We have three modes: + 1. When the preprocessing step is explict and there is no following + compilation. Here we do a similar process to cc1 -E where most of + the compilation is short-circuited. + 2. When we are mimicking an integrated preprocessor. Here we use the + modula-2 'fcpp' to construct a command line for the preprocessor and + snarf save-temps and dumpdir inputs to try and be consistent. + 3. We can consume a pre-processed modula-2 source. */ {".mod", "@modula-2", 0, 0, 0}, {"@modula-2", - "cc1gm2 " M2CPP - " %(cc1_options) %{B*} %{c*} %{+e*} %{I*} " - " %{i*} %{save-temps*} %{v} " - " %i %{!fsyntax-only:%(invoke_as)}", - 0, 0, 0}, + /* For preprocessing we use cc1 but wrap it in cc1gm2. */ + "%{E|M|MM:\ + cc1gm2 " M2CPP " %{!fcpp:-fcpp;:%{fcpp}} %{I*} %i } \ + %{!E:%{!M:%{!MM:\ + cc1gm2 " M2CPP " %(cc1_options) %{I*} %i %{c} \ + %{MF*:%eto generate dependencies you must specify either '-M' or '-MM'} \ + %{!fsyntax-only:%(invoke_as)} \ + }}}", 0, 0, 0}, + {".m2i", "@modula-2-cpp-output", 0, 0, 0}, + {"@modula-2-cpp-output", + "%{!M:%{!MM:%{!E: \ + cc1gm2 % Date: Wed, 25 Jan 2023 20:38:43 +0100 Subject: Fortran: ICE in gfc_compare_array_spec [PR108528] gcc/fortran/ChangeLog: PR fortran/108528 * array.cc (compare_bounds): Return false instead of generating an internal error on an invalid argument type. gcc/testsuite/ChangeLog: PR fortran/108528 * gfortran.dg/pr108528.f90: New test. --- gcc/fortran/array.cc | 4 ++-- gcc/testsuite/gfortran.dg/pr108528.f90 | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr108528.f90 (limited to 'gcc') diff --git a/gcc/fortran/array.cc b/gcc/fortran/array.cc index e8a2c32..be5eb8b 100644 --- a/gcc/fortran/array.cc +++ b/gcc/fortran/array.cc @@ -967,7 +967,7 @@ gfc_copy_array_spec (gfc_array_spec *src) /* Returns nonzero if the two expressions are equal. - We should not need to support more than constant values, as that’s what is + We should not need to support more than constant values, as that's what is allowed in derived type component array spec. However, we may create types with non-constant array spec for dummy variable class container types, for which the _data component holds the array spec of the variable declaration. @@ -979,7 +979,7 @@ compare_bounds (gfc_expr *bound1, gfc_expr *bound2) if (bound1 == NULL || bound2 == NULL || bound1->ts.type != BT_INTEGER || bound2->ts.type != BT_INTEGER) - gfc_internal_error ("gfc_compare_array_spec(): Array spec clobbered"); + return false; /* What qualifies as identical bounds? We could probably just check that the expressions are exact clones. We avoid rewriting a specific comparison diff --git a/gcc/testsuite/gfortran.dg/pr108528.f90 b/gcc/testsuite/gfortran.dg/pr108528.f90 new file mode 100644 index 0000000..7a353cb --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr108528.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! PR fortran/108528 - +! Contributed by G.Steinmetz + +function f() ! { dg-error "mismatched array specifications" } + integer :: f((2.)) ! { dg-error "must be of INTEGER type" } + integer :: g((2)) +entry g() +end -- cgit v1.1 From 9bb6515b10c51a07436577d0eb73531ba279ffa4 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 26 Jan 2023 00:17:46 +0000 Subject: Daily bump. --- gcc/ChangeLog | 66 +++++++ gcc/DATESTAMP | 2 +- gcc/cp/ChangeLog | 6 + gcc/fortran/ChangeLog | 6 + gcc/m2/ChangeLog | 38 ++++ gcc/testsuite/ChangeLog | 516 ++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 633 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8fd7335..2955641 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,69 @@ +2023-01-25 Iain Sandoe + + PR modula2/102343 + PR modula2/108182 + * gcc.cc: Provide default specs for Modula-2 so that when the + language is not built-in better diagnostics are emitted for + attempts to use .mod or .m2i file extensions. + +2023-01-25 Andrea Corallo + + * config/arm/mve.md (mve_vqnegq_s): Fix spacing. + +2023-01-25 Andrea Corallo + + * config/arm/mve.md (mve_vqabsq_s): Fix spacing. + +2023-01-25 Andrea Corallo + + * config/arm/mve.md (mve_vnegq_f, mve_vnegq_s): + Fix spacing. + +2023-01-25 Andrea Corallo + + * config/arm/mve.md (@mve_vclzq_s): Fix spacing. + +2023-01-25 Andrea Corallo + + * config/arm/mve.md (mve_vclsq_s): Fix spacing. + +2023-01-25 Richard Biener + + PR tree-optimization/108523 + * tree-ssa-sccvn.cc (visit_phi): Avoid using the exclusive + backedge value for the result when using predication to + prove equivalence. + +2023-01-25 Richard Biener + + * doc/lto.texi (Command line options): Reword and update reference + to removed lto_read_all_file_options. + +2023-01-25 Richard Sandiford + + * config/aarch64/aarch64.md (umax3): Separate the CNT and CSSC + tests. + +2023-01-25 Gerald Pfeifer + + * doc/contrib.texi: Add Jose E. Marchesi. + +2023-01-25 Jakub Jelinek + + PR tree-optimization/108498 + * gimple-ssa-store-merging.cc (class store_operand_info): + End coment with full stop rather than comma. + (split_group): Likewise. + (merged_store_group::apply_stores): Clear string_concatenation if + start or end aren't on a byte boundary. + +2023-01-25 Siddhesh Poyarekar + Jakub Jelinek + + PR tree-optimization/108522 + * tree-object-size.cc (compute_object_offset): Use + TREE_OPERAND(ref, 2) for COMPONENT_REF when available. + 2023-01-24 Takayuki 'January June' Suwa * config/xtensa/xtensa.md: diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e26ffa6..b0742d6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20230125 +20230126 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 53e9949..e2aad60 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2023-01-25 Jakub Jelinek + + PR c++/108525 + * mangle.cc (write_closure_type_name): Don't assume all + lambda operator() fns are methods. + 2023-01-24 Jason Merrill PR c++/108504 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index bd9ecfd..aaae5f5 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2023-01-25 Steve Kargl + + PR fortran/108528 + * array.cc (compare_bounds): Return false instead of generating an + internal error on an invalid argument type. + 2023-01-24 Harald Anlauf PR fortran/108529 diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog index 07ab75d..92eacaf 100644 --- a/gcc/m2/ChangeLog +++ b/gcc/m2/ChangeLog @@ -1,3 +1,41 @@ +2023-01-25 Iain Sandoe + + PR modula2/102343 + PR modula2/108182 + * gm2-compiler/M2Comp.mod: Early exit for pre-processor-only jobs. + * gm2-compiler/M2Options.def (SetPPOnly, GetPPOnly, SetMD, GetMD, + SetMMD, GetMMD, SetMQ, GetMQ, SetObj, GetObj, SetDumpDir, + GetDumpDir):New. + * gm2-compiler/M2Options.mod:(SetPPOnly, GetPPOnly, SetMD, GetMD, + SetMMD, GetMMD, SetMQ, GetMQ, SetObj, GetObj, SetDumpDir, + GetDumpDir):New. + * gm2-compiler/M2Preprocess.def (PreprocessModule): Add flag to + indicate the main file. + * gm2-compiler/M2Preprocess.mod: Handle Preprocess-only jobs, + handle MD, MMD and MQ options. + * gm2-gcc/m2options.h (M2Options_SetPPOnly, M2Options_GetPPOnly, + M2Options_SetDumpDir, M2Options_SetMD, M2Options_GetMD, + M2Options_SetMMD, M2Options_GetMMD, M2Options_SetMQ, M2Options_GetMQ, + M2Options_SetObj, M2Options_GetObj): New. + * gm2-gcc/m2type.cc (m2type_InitBaseTypes): Early exit for pre- + processor-only jobs. + * gm2-lang.cc (gm2_langhook_init): Handle preprocess-only commands. + (gm2_langhook_option_lang_mask): Claim C and Driver options so that + we can intercept them for building pre-processor commands. + (gm2_langhook_init_options): Collect the preprocessor line here. + Save options that have different actions for preprocessor and compile + commands. + (gm2_langhook_handle_option): Only handle the modula-2 options here. + (gm2_langhook_post_options): Do not create a back-end for pre- + processor-only jobs. + * gm2spec.cc (lang_specific_driver): Ignore PCH options, append a + scaffold-main for cases where we are building a main module with + -c. + * lang-specs.h: Revise to handle preprocessor-only jobs and to + consume pre-processed files. + * lang.opt: Remove Driver and C options copies (we claim these + separately). + 2023-01-24 Co-Authored by: Iain Sandoe * Make-lang.in (GM2-COMP-BOOT-DEFS): Add diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dd07af3..ca896ce 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,519 @@ +2023-01-25 Steve Kargl + + PR fortran/108528 + * gfortran.dg/pr108528.f90: New test. + +2023-01-25 Jakub Jelinek + + PR c++/108525 + * g++.dg/cpp23/static-operator-call5.C: New test. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vhaddq_n_s16.c: Add missing extern + "C". + * gcc.target/arm/mve/intrinsics/vhaddq_n_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_n_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_n_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_n_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_n_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_x_n_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_x_n_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_x_n_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_x_n_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_x_n_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_x_n_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_x_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_x_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_x_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_x_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_x_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhaddq_x_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_n_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_n_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_n_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_n_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_n_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_n_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_x_n_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_x_n_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_x_n_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_x_n_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_x_n_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_x_n_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_x_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_x_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_x_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_x_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_x_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vhsubq_x_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmladavaxq_p_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmladavaxq_p_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmladavaxq_p_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmladavaxq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmladavaxq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmladavaxq_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqaddq_n_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqaddq_n_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqaddq_n_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqaddq_n_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqaddq_n_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqaddq_n_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqaddq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqaddq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqaddq_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqaddq_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqaddq_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqaddq_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlahq_n_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlahq_n_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlahq_n_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlashq_n_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlashq_n_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlashq_n_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vsetq_lane_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vsetq_lane_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vsetq_lane_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vsetq_lane_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c: Likewise. + * gcc.target/arm/mve/intrinsics/vsetq_lane_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vsetq_lane_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vsetq_lane_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c: Likewise. + * gcc.target/arm/mve/intrinsics/vsetq_lane_u8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vld2q_f16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vld2q_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vld2q_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vld2q_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vld2q_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vld2q_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vld2q_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vld2q_u8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vqnegq_m_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vqnegq_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqnegq_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqnegq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqnegq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqnegq_s8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmulhq_m_n_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmulhq_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmulhq_n_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmulhq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmulhq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmulhq_s8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmlsdhxq_s8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmlsdhq_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmlsdhq_s8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlsdhxq_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlsdhxq_s8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlsdhq_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlsdhq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlsdhq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmlsdhq_s8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmlashq_n_s8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmladhxq_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmladhxq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmladhxq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmladhxq_s8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmladhq_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmladhq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmladhq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqrdmladhq_s8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmladhxq_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmladhxq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmladhxq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmladhxq_s8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vqdmladhq_m_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vqdmladhq_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmladhq_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmladhq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmladhq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqdmladhq_s8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vqabsq_m_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vqabsq_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqabsq_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqabsq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqabsq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vqabsq_s8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vcmulq_f16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vcmulq_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_m_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_m_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot180_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot180_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot180_m_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot180_m_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot180_x_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot180_x_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot270_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot270_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot270_m_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot270_m_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot270_x_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot270_x_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot90_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot90_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot90_m_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot90_m_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot90_x_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_rot90_x_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_x_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmulq_x_f32.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vcmlaq_f16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vcmlaq_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmlaq_m_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmlaq_m_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmlaq_rot180_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmlaq_rot180_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmlaq_rot180_m_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmlaq_rot180_m_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmlaq_rot270_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmlaq_rot270_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmlaq_rot270_m_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmlaq_rot270_m_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmlaq_rot90_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmlaq_rot90_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmlaq_rot90_m_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcmlaq_rot90_m_f32.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_f16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_m_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot270_x_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_m_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vcaddq_rot90_x_u8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vmulltq_int_m_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vmulltq_int_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_int_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_int_m_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_int_m_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_int_m_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_int_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_int_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_int_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_int_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_int_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_int_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_int_x_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_int_x_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_int_x_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_int_x_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_int_x_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_int_x_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_poly_m_p16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_poly_m_p8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_poly_p16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_poly_p8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_poly_x_p16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulltq_poly_x_p8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vmullbq_int_m_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vmullbq_int_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_int_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_int_m_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_int_m_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_int_m_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_int_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_int_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_int_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_int_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_int_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_int_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_int_x_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_int_x_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_int_x_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_int_x_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_int_x_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_int_x_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_poly_m_p16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_poly_m_p8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_poly_p16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_poly_p8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_poly_x_p16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmullbq_poly_x_p8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vmulhq_m_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vmulhq_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulhq_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulhq_m_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulhq_m_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulhq_m_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulhq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulhq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulhq_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulhq_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulhq_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulhq_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulhq_x_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulhq_x_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulhq_x_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulhq_x_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulhq_x_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vmulhq_x_u8.c: Likewise. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vnegq_f16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vnegq_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vnegq_m_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vnegq_m_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vnegq_m_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vnegq_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vnegq_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vnegq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vnegq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vnegq_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vnegq_x_f16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vnegq_x_f32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vnegq_x_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vnegq_x_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vnegq_x_s8.c: Likewise. + * gcc.target/arm/simd/mve-vneg.c: Update test. + * gcc.target/arm/simd/mve-vshr.c: Likewise + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vclzq_m_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use + extern "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vclzq_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclzq_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclzq_m_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclzq_m_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclzq_m_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclzq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclzq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclzq_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclzq_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclzq_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclzq_u8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclzq_x_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclzq_x_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclzq_x_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclzq_x_u16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclzq_x_u32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclzq_x_u8.c: Likewise. + * gcc.target/arm/simd/mve-vclz.c: Update test. + +2023-01-25 Andrea Corallo + + * gcc.target/arm/mve/intrinsics/vclsq_m_s16.c: Use + check-function-bodies instead of scan-assembler checks. Use extern + "C" for C++ testing. + * gcc.target/arm/mve/intrinsics/vclsq_m_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclsq_m_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclsq_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclsq_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclsq_s8.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclsq_x_s16.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclsq_x_s32.c: Likewise. + * gcc.target/arm/mve/intrinsics/vclsq_x_s8.c: Likewise. + +2023-01-25 Richard Sandiford + + * gcc.target/aarch64/sve/acle/general-c/sizeless-1.c: Avoid + "initializer element is not constant" error. + * gcc.target/aarch64/sve/acle/general-c/sizeless-2.c: Likewise. + +2023-01-25 Andre Vieira + + * lib/target-supports.exp (check_effective_target_vect_long_long): Add + aarch64 to list of targets supporting long long vectorization. + +2023-01-25 Jakub Jelinek + + PR tree-optimization/108498 + * gcc.c-torture/execute/pr108498-1.c: New test. + * gcc.c-torture/execute/pr108498-2.c: New test. + +2023-01-25 Siddhesh Poyarekar + Jakub Jelinek + + PR tree-optimization/108522 + * gcc.dg/builtin-dynamic-object-size-0.c + (test_dynarray_struct_member): New test. + (main): Call it. + 2023-01-24 Jakub Jelinek PR c++/107329 -- cgit v1.1 From 66132b1f213c2907512259cd0197ef49a74897b9 Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Thu, 26 Jan 2023 00:55:56 +0000 Subject: PR-108135 Remove PACKAGE_* definitions from gm2config.h PR-108135 gcc/m2/configure generates gm2config.h and automatically adds PACKAGE defines. gcc/m2/Make-lang.in now removes these PACKAGE definitions. The patch also contains fixes to remove an unused variable Dim from BuildConstHighFromSym and also uses withTok in StartBuildWith. StartBuildWith will generate a nop (for improved debugging) if requested. gcc/m2/ChangeLog: * Make-lang.in (m2/gm2config.h): Rewrite rule to be dependent upon m2/gm2config.aci. (m2/gm2config.aci): Newrule. * configure.ac (AC_CONFIG_HEADERS): Change destination to gm2config.aci. * configure: Regenerate. * gm2-libs/config-host: Regenerate. * gm2-compiler/M2GCCDeclare.mod (AddSymToWatch): Comment out. * gm2-compiler/M2Quads.mod (BuildConstHighFromSym): Remove Dim. (StartBuildWith): Call BuildStmtNoteTok. (BuildStmtNoteTok): New procedure. (BuildStmtNote): Re-implement re-factor into two procedures and call BuildStmtNoteTok. * gm2config.h.in: Remove. * gm2config.aci.in: New file. Signed-off-by: Gaius Mulley --- gcc/m2/Make-lang.in | 5 ++- gcc/m2/configure | 6 ++-- gcc/m2/configure.ac | 4 +-- gcc/m2/gm2-compiler/M2GCCDeclare.mod | 2 ++ gcc/m2/gm2-compiler/M2Quads.mod | 39 ++++++++++++-------- gcc/m2/gm2-libs/config-host | 6 ++-- gcc/m2/gm2config.aci.in | 70 ++++++++++++++++++++++++++++++++++++ gcc/m2/gm2config.h.in | 70 ------------------------------------ 8 files changed, 108 insertions(+), 94 deletions(-) create mode 100644 gcc/m2/gm2config.aci.in delete mode 100644 gcc/m2/gm2config.h.in (limited to 'gcc') diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in index 0d3ff23..122a35c 100644 --- a/gcc/m2/Make-lang.in +++ b/gcc/m2/Make-lang.in @@ -1503,7 +1503,10 @@ m2/gm2-libs/gm2-libs-host.h: # Autoconf inserts -DCROSS_DIRECTORY_STRUCTURE if we are building a # cross compiler and the ../Makefile.in above appends this to INTERNAL_CFLAGS. -m2/gm2config.h: +m2/gm2config.h: m2/gm2config.aci + grep -v define\ PACKAGE_ $< > $@ + +m2/gm2config.aci: NEW_SRCDIR=`${srcdir}/m2/tools-src/calcpath ../ ${srcdir} m2` ; \ export NEW_SRCDIR ; \ cd m2 ; \ diff --git a/gcc/m2/configure b/gcc/m2/configure index 91768ab..de78fdd 100755 --- a/gcc/m2/configure +++ b/gcc/m2/configure @@ -3645,7 +3645,7 @@ $as_echo "#define HAVE_OPENDIR 1" >>confdefs.h fi -ac_config_headers="$ac_config_headers gm2config.h" +ac_config_headers="$ac_config_headers gm2config.aci" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -4319,7 +4319,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 for ac_config_target in $ac_config_targets do case $ac_config_target in - "gm2config.h") CONFIG_HEADERS="$CONFIG_HEADERS gm2config.h" ;; + "gm2config.aci") CONFIG_HEADERS="$CONFIG_HEADERS gm2config.aci" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac @@ -4630,7 +4630,7 @@ $as_echo "$as_me: $ac_file is unchanged" >&6;} case $ac_file$ac_mode in - "gm2config.h":H) echo timestamp > stamp-h ;; + "gm2config.aci":H) echo timestamp > stamp-h ;; esac done # for ac_tag diff --git a/gcc/m2/configure.ac b/gcc/m2/configure.ac index a9c952a..0a77cae 100644 --- a/gcc/m2/configure.ac +++ b/gcc/m2/configure.ac @@ -1,4 +1,4 @@ -# configure.ac provides gm2spec.c with access to config values. +# configure.ac provides gm2spec.cc with access to config values. # Copyright (C) 2001-2023 Free Software Foundation, Inc. # Contributed by Gaius Mulley . @@ -29,5 +29,5 @@ AC_CHECK_FUNCS([stpcpy]) AC_CHECK_HEADERS(sys/types.h) AC_HEADER_DIRENT AC_CHECK_LIB([c],[opendir],[AC_DEFINE([HAVE_OPENDIR],[1],[found opendir])]) -AC_CONFIG_HEADERS(gm2config.h, [echo timestamp > stamp-h]) +AC_CONFIG_HEADERS(gm2config.aci, [echo timestamp > stamp-h]) AC_OUTPUT diff --git a/gcc/m2/gm2-compiler/M2GCCDeclare.mod b/gcc/m2/gm2-compiler/M2GCCDeclare.mod index fa27cb4..2774598 100644 --- a/gcc/m2/gm2-compiler/M2GCCDeclare.mod +++ b/gcc/m2/gm2-compiler/M2GCCDeclare.mod @@ -347,6 +347,7 @@ END DebugSetNumbers ; lists. *) +(* PROCEDURE AddSymToWatch (sym: WORD) ; BEGIN IF (sym#NulSym) AND (NOT IsElementInSet(WatchList, sym)) @@ -357,6 +358,7 @@ BEGIN FIO.FlushBuffer(FIO.StdOut) END END AddSymToWatch ; +*) (* diff --git a/gcc/m2/gm2-compiler/M2Quads.mod b/gcc/m2/gm2-compiler/M2Quads.mod index a58de93..939758f 100644 --- a/gcc/m2/gm2-compiler/M2Quads.mod +++ b/gcc/m2/gm2-compiler/M2Quads.mod @@ -8101,14 +8101,11 @@ END BuildHighFunction ; PROCEDURE BuildConstHighFromSym (tok: CARDINAL) ; VAR - Dim, NoOfParam, ReturnVar: CARDINAL ; BEGIN PopT (NoOfParam) ; ReturnVar := MakeTemporary (tok, ImmediateValue) ; - Dim := OperandD (1) ; - INC (Dim) ; GenHigh (tok, ReturnVar, 1, OperandT (1)) ; PopN (NoOfParam+1) ; PushTtok (ReturnVar, tok) @@ -11445,6 +11442,7 @@ VAR Sym, Type, Ref : CARDINAL ; BEGIN + BuildStmtNoteTok (withTok) ; DisplayStack ; PopTFtok (Sym, Type, tok) ; Type := SkipType (Type) ; @@ -14107,26 +14105,37 @@ END PushLineNo ; PROCEDURE BuildStmtNote (offset: INTEGER) ; VAR - filename: Name ; - f : QuadFrame ; - i : INTEGER ; + tokenno: INTEGER ; BEGIN IF NextQuad#Head THEN - f := GetQF (NextQuad-1) ; - i := offset ; - INC (i, GetTokenNo ()) ; - (* no need to have multiple notes at the same position. *) - IF (f^.Operator # StatementNoteOp) OR (f^.Operand3 # VAL (CARDINAL, i)) - THEN - filename := makekey (string (GetFileName ())) ; - GenQuad (StatementNoteOp, WORD (filename), NulSym, i) - END + tokenno := offset ; + INC (tokenno, GetTokenNo ()) ; + BuildStmtNoteTok (VAL(CARDINAL, tokenno)) END END BuildStmtNote ; (* + BuildStmtNoteTok - adds a nop (with an assigned tokenno location) to the code. +*) + +PROCEDURE BuildStmtNoteTok (tokenno: CARDINAL) ; +VAR + filename: Name ; + f : QuadFrame ; +BEGIN + f := GetQF (NextQuad-1) ; + (* no need to have multiple notes at the same position. *) + IF (f^.Operator # StatementNoteOp) OR (f^.Operand3 # tokenno) + THEN + filename := makekey (string (GetFileName ())) ; + GenQuad (StatementNoteOp, WORD (filename), NulSym, tokenno) + END +END BuildStmtNoteTok ; + + +(* AddRecordToList - adds the record held on the top of stack to the list of records and varient fields. *) diff --git a/gcc/m2/gm2-libs/config-host b/gcc/m2/gm2-libs/config-host index 184c363..5d6d33d 100755 --- a/gcc/m2/gm2-libs/config-host +++ b/gcc/m2/gm2-libs/config-host @@ -5,7 +5,7 @@ # Report bugs to . # # -# Copyright (C) 1992-2023 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -1369,7 +1369,7 @@ if $ac_init_version; then ASCII.def configure 1.9.5 generated by GNU Autoconf 2.69 -Copyright (C) 2012-2023 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -5298,7 +5298,7 @@ ASCII.def config.status 1.9.5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2012-2023 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." diff --git a/gcc/m2/gm2config.aci.in b/gcc/m2/gm2config.aci.in new file mode 100644 index 0000000..cb9f505 --- /dev/null +++ b/gcc/m2/gm2config.aci.in @@ -0,0 +1,70 @@ +/* gm2config.aci.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_DIRENT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* found opendir */ +#undef HAVE_OPENDIR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `stpcpy' function. */ +#undef HAVE_STPCPY + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS diff --git a/gcc/m2/gm2config.h.in b/gcc/m2/gm2config.h.in deleted file mode 100644 index fe2f814..0000000 --- a/gcc/m2/gm2config.h.in +++ /dev/null @@ -1,70 +0,0 @@ -/* gm2config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#undef HAVE_DIRENT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file, and it defines `DIR'. */ -#undef HAVE_NDIR_H - -/* found opendir */ -#undef HAVE_OPENDIR - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `stpcpy' function. */ -#undef HAVE_STPCPY - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#undef HAVE_SYS_DIR_H - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#undef HAVE_SYS_NDIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS -- cgit v1.1 From 1f6d05e9ad858b59b824f57d09400adcb2c5e4ad Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 26 Jan 2023 08:38:35 +0100 Subject: tree-optimization/108523 - testcase for the bug This adds a reduced testcase for the PR. PR tree-optimization/108523 * gcc.dg/torture/pr108523.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr108523.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr108523.c (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/torture/pr108523.c b/gcc/testsuite/gcc.dg/torture/pr108523.c new file mode 100644 index 0000000..a04160b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr108523.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ + +int g_149, g_167, g_481; +int main() { + int *l_1478 = &g_149; + *l_1478 ^= g_167; +lbl_1481: + for (;;) { + g_481 = 1; + for (; g_481 < 100000; g_481 += 1) { + g_167 ^= *l_1478; + if (g_149) + goto lbl_1481; + } + } +} -- cgit v1.1 From d427407a199a0c276cb02d6bbb64e6ecc02e590d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 26 Jan 2023 10:41:10 +0100 Subject: openmp, c++: Workaround fold_for_warn ICE on invalid OpenMP collapsed loops [PR108503] My recent change to deduce structured binding vars earlier caused the following invalid testcase to ICE. The problem is that because at cp_convert_omp_range_for when !processing_template_decl we aren't yet ready to finalize the structured bindings (e.g. can't emit there associated code) but need to deduce types of the vars so that we don't get errors if we parse invalid uses of those vars in inner loops of the collapsed construct. This is done by temporarily bumping processing_template_decl around the call to cp_finish_decomp. Unfortunately, as we can't finalize it yet, the types of the vars will be deduced, but their DECL_VALUE_EXPR is not finalized yet and if say fold_for_warn tries to constant expression evaluate them, it recurses on DECL_VALUE_EXPR and ICEs because it sees e.g. ARRAY_REF (with NULL type) on a VAR_DECL with class type. The following patch works around that by temporarily hiding the DECL_VALUE_EXPRs by clearing DECL_HAS_VALUE_EXPR_P in that case during cp_convert_omp_range_for and arranging for cp_finish_omp_range_for to set it back before doing the final cp_finish_decomp. 2023-01-25 Jakub Jelinek PR c++/108503 * parser.cc (cp_convert_omp_range_for): If cp_finish_decomp has been called in !processing_template_decl with processing_template_decl temporarily set, clear DECL_HAS_VALUE_EXPR_P on the vars temporarily. (cp_finish_omp_range_for): And set it back again here. * g++.dg/gomp/pr108503.C: New test. --- gcc/cp/parser.cc | 27 +++++++++++++++++++++++++++ gcc/testsuite/g++.dg/gomp/pr108503.C | 27 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 gcc/testsuite/g++.dg/gomp/pr108503.C (limited to 'gcc') diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index 07ec0e1..e0c46d2 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -43039,6 +43039,7 @@ cp_convert_omp_range_for (tree &this_pre_body, vec *for_block, { tree begin, end, range_temp_decl = NULL_TREE; tree iter_type, begin_expr, end_expr; + bool clear_has_value_expr = false; if (processing_template_decl) { @@ -43185,6 +43186,8 @@ cp_convert_omp_range_for (tree &this_pre_body, vec *for_block, ++processing_template_decl; cp_finish_decomp (orig_decl, decomp_first_name, decomp_cnt); --processing_template_decl; + if (!processing_template_decl) + clear_has_value_expr = true; } } } @@ -43193,8 +43196,20 @@ cp_convert_omp_range_for (tree &this_pre_body, vec *for_block, TREE_VEC_ELT (v, 0) = range_temp_decl; TREE_VEC_ELT (v, 1) = end; TREE_VEC_ELT (v, 2) = orig_decl; + if (clear_has_value_expr) + TREE_PUBLIC (v) = 1; for (unsigned i = 0; i < decomp_cnt; i++) { + if (clear_has_value_expr) + { + /* If cp_finish_decomp was called with processing_template_decl + temporarily set to 1, then decomp names will have deduced + name but the DECL_VALUE_EXPR will be dependent. Hide those + from folding of other loop initializers e.g. for warning + purposes until cp_finish_omp_range_for. */ + gcc_checking_assert (DECL_HAS_VALUE_EXPR_P (decomp_first_name)); + DECL_HAS_VALUE_EXPR_P (decomp_first_name) = 0; + } TREE_VEC_ELT (v, i + 3) = decomp_first_name; decomp_first_name = DECL_CHAIN (decomp_first_name); } @@ -43217,6 +43232,18 @@ cp_finish_omp_range_for (tree orig, tree begin) { decomp_first_name = TREE_VEC_ELT (TREE_CHAIN (orig), 3); decomp_cnt = TREE_VEC_LENGTH (TREE_CHAIN (orig)) - 3; + if (TREE_PUBLIC (TREE_CHAIN (orig))) + { + /* Undo temporary clearing of DECL_HAS_VALUE_EXPR_P done + by cp_convert_omp_range_for above. */ + TREE_PUBLIC (TREE_CHAIN (orig)) = 0; + tree d = decomp_first_name; + for (unsigned i = 0; i < decomp_cnt; i++) + { + DECL_HAS_VALUE_EXPR_P (d) = 1; + d = DECL_CHAIN (d); + } + } cp_maybe_mangle_decomp (decl, decomp_first_name, decomp_cnt); } diff --git a/gcc/testsuite/g++.dg/gomp/pr108503.C b/gcc/testsuite/g++.dg/gomp/pr108503.C new file mode 100644 index 0000000..906d41b --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr108503.C @@ -0,0 +1,27 @@ +// PR c++/108503 +// { dg-do compile { target c++17 } } +// { dg-additional-options "-Wall" } + +namespace std { + template struct tuple_size; + template struct tuple_element; +} +struct A { + template int get () { return 1; } +}; +template <> struct std::tuple_size { static const int value = 3; }; +template struct std::tuple_element { using type = int; }; + +struct B { + A *begin (); + A *end (); +}; + +void +foo (B a) +{ + #pragma omp for collapse(2) + for (auto [i, j, k] : a) + for (int l = i; l < j; l += k) // { dg-error "initializer expression refers to iteration variable 'i'" } + ; // { dg-error "condition expression refers to iteration variable 'j'" "" { target *-*-* } .-1 } +} // { dg-error "increment expression refers to iteration variable 'k'" "" { target *-*-* } .-2 } -- cgit v1.1 From 41c3d02fd6a71ed3d86d0e496654b9f6350a2ce5 Mon Sep 17 00:00:00 2001 From: Gerald Pfeifer Date: Thu, 26 Jan 2023 12:25:44 +0100 Subject: doc: Refer to projects as GCC and GDB ...instead of gcc and gdb which are the executables (and in case of GCC the C language front end). gcc/ChangeLog: * doc/sourcebuild.texi: Refer to projects as GCC and GDB. --- gcc/doc/sourcebuild.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index be43182..df54526 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -73,10 +73,10 @@ The runtime support library for atomic operations (e.g.@: for @code{__sync} and @code{__atomic}). @item libbacktrace -A library that allows gcc to produce backtraces when it crashes. +A library that allows GCC to produce backtraces when it crashes. @item libcc1 -A library that allows gdb to make use of the compiler. +A library that allows GDB to make use of the compiler. @item libcody A compiler dynamism library to allow communication between compilers and -- cgit v1.1 From 59a42fe6a99db39f2fed21c2a69faf6fa78ccfd4 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Thu, 26 Jan 2023 11:49:47 +0000 Subject: aarch64: Add Linux kernel hwcap string for FEAT_CSSC The Linux kernel has done basic enablement and detection of FEAT_CSSC so we can use the cpuinfo string that they've specified. This patchlet does that. Bootstrapped and tested on aarch64-none-linux-gnu. gcc/ChangeLog: * config/aarch64/aarch64-option-extensions.def (cssc): Specify FEATURE_STRING field. --- gcc/config/aarch64/aarch64-option-extensions.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/config/aarch64/aarch64-option-extensions.def b/gcc/config/aarch64/aarch64-option-extensions.def index 36c1fbb..825f3bf 100644 --- a/gcc/config/aarch64/aarch64-option-extensions.def +++ b/gcc/config/aarch64/aarch64-option-extensions.def @@ -149,6 +149,6 @@ AARCH64_OPT_EXTENSION("ls64", LS64, (), (), (), "") AARCH64_OPT_EXTENSION("mops", MOPS, (), (), (), "") -AARCH64_OPT_EXTENSION("cssc", CSSC, (), (), (), "") +AARCH64_OPT_EXTENSION("cssc", CSSC, (), (), (), "cssc") #undef AARCH64_OPT_EXTENSION -- cgit v1.1 From 0573a0778af88e805f7630ac8640ecd67d692665 Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Thu, 26 Jan 2023 07:07:03 -0500 Subject: tree-optimization/108522 Use component_ref_field_offset Instead of using TREE_OPERAND (expr, 2) directly, use component_ref_field_offset instead, which does scaling for us. The function also substitutes PLACEHOLDER_EXPRs but it is not relevant for tree-object-size. gcc/ChangeLog: PR tree-optimization/108522 * tree-object-size.cc (compute_object_offset): Make EXPR argument non-const. Call component_ref_field_offset. gcc/testsuite/ChangeLog: PR tree-optimization/108522 * gcc.dg/builtin-dynamic-object-size-0.c (DEFSTRUCT): New macro. (test_dynarray_struct_member_b, test_dynarray_struct_member_c, test_dynarray_struct_member_d, test_dynarray_struct_member_subobj_b, test_dynarray_struct_member_subobj_c, test_dynarray_struct_member_subobj_d): New tests. (main): Call them. Signed-off-by: Siddhesh Poyarekar --- .../gcc.dg/builtin-dynamic-object-size-0.c | 81 ++++++++++++++++++++-- gcc/tree-object-size.cc | 7 +- 2 files changed, 77 insertions(+), 11 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/builtin-dynamic-object-size-0.c b/gcc/testsuite/gcc.dg/builtin-dynamic-object-size-0.c index 569c0a8..76079d8 100644 --- a/gcc/testsuite/gcc.dg/builtin-dynamic-object-size-0.c +++ b/gcc/testsuite/gcc.dg/builtin-dynamic-object-size-0.c @@ -315,21 +315,72 @@ test_dynarray_struct_subobj2 (size_t sz, size_t off, size_t *objsz) } /* See pr #108522. */ + +#define DEFSTRUCT(_s, _n) \ + struct DS \ + { \ + char a[_n]; \ + unsigned long long b; \ + int c; \ + char d[2 * _n]; \ + } _s + size_t __attribute__ ((noinline)) -test_dynarray_struct_member (size_t sz) +test_dynarray_struct_member_b (size_t sz) { - struct - { - char a[sz]; - char b; - } s; + DEFSTRUCT (s, sz); return __builtin_dynamic_object_size (&s.b, 0); } size_t __attribute__ ((noinline)) +test_dynarray_struct_member_c (size_t sz) +{ + DEFSTRUCT (s, sz); + + return __builtin_dynamic_object_size (&s.c, 0); +} + +size_t +__attribute__ ((noinline)) +test_dynarray_struct_member_d (size_t sz, size_t offset) +{ + DEFSTRUCT (s, sz); + + return __builtin_dynamic_object_size (&s.d[offset], 0); +} + +size_t +__attribute__ ((noinline)) +test_dynarray_struct_member_subobj_b (size_t sz) +{ + DEFSTRUCT (s, sz); + + return __builtin_dynamic_object_size (&s.b, 1); +} + +size_t +__attribute__ ((noinline)) +test_dynarray_struct_member_subobj_c (size_t sz) +{ + DEFSTRUCT (s, sz); + + return __builtin_dynamic_object_size (&s.c, 1); +} + +size_t +__attribute__ ((noinline)) +test_dynarray_struct_member_subobj_d (size_t sz, size_t offset) +{ + DEFSTRUCT (s, sz); + + return __builtin_dynamic_object_size (&s.d[offset], 1); +} + +size_t +__attribute__ ((noinline)) test_substring (size_t sz, size_t off) { char str[sz]; @@ -633,7 +684,23 @@ main (int argc, char **argv) if (test_dynarray_struct_subobj2 (42, 4, &objsz) != objsz - 4 - sizeof (long) - sizeof (int)) FAIL (); - if (test_dynarray_struct_member (42) != sizeof (char)) + DEFSTRUCT(ds, 64); + const size_t n = sizeof (ds.a); + if (test_dynarray_struct_member_b (n) + != sizeof (ds) - __builtin_offsetof (struct DS, b)) + FAIL (); + if (test_dynarray_struct_member_c (n) + != sizeof (ds) - __builtin_offsetof (struct DS, c)) + FAIL (); + if (test_dynarray_struct_member_d (n, 0) + != sizeof (ds) - __builtin_offsetof (struct DS, d)) + FAIL (); + if (test_dynarray_struct_member_subobj_b (n) != sizeof (ds.b)) + FAIL (); + if (test_dynarray_struct_member_subobj_c (n) != sizeof (ds.c)) + FAIL (); + if (test_dynarray_struct_member_subobj_d (n, n - 2) + != sizeof (ds) - __builtin_offsetof (struct DS, d) - n + 2) FAIL (); if (test_substring_ptrplus (128, 4) != (128 - 4) * sizeof (int)) FAIL (); diff --git a/gcc/tree-object-size.cc b/gcc/tree-object-size.cc index de93ffa..9a936a9 100644 --- a/gcc/tree-object-size.cc +++ b/gcc/tree-object-size.cc @@ -56,7 +56,7 @@ struct GTY(()) object_size tree wholesize; }; -static tree compute_object_offset (const_tree, const_tree); +static tree compute_object_offset (tree, const_tree); static bool addr_object_size (struct object_size_info *, const_tree, int, tree *, tree *t = NULL); static tree alloc_object_size (const gcall *, int); @@ -396,7 +396,7 @@ size_for_offset (tree sz, tree offset, tree wholesize = NULL_TREE) if unknown. */ static tree -compute_object_offset (const_tree expr, const_tree var) +compute_object_offset (tree expr, const_tree var) { enum tree_code code = PLUS_EXPR; tree base, off, t; @@ -413,8 +413,7 @@ compute_object_offset (const_tree expr, const_tree var) t = TREE_OPERAND (expr, 1); off = size_binop (PLUS_EXPR, - (TREE_OPERAND (expr, 2) ? TREE_OPERAND (expr, 2) - : DECL_FIELD_OFFSET (t)), + component_ref_field_offset (expr), size_int (tree_to_uhwi (DECL_FIELD_BIT_OFFSET (t)) / BITS_PER_UNIT)); break; -- cgit v1.1 From c71a128a3e1ff6ee5274fc2df49ea650bc9e6c2d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 26 Jan 2023 08:59:20 +0100 Subject: tree-optimization/108547 - robustify uninit predicate analysis Predicate analysis, when looking through casts doesn't bother to convert boundary constants to the type of the bounded variables. The following robustifies value_sat_pred_p to use widest_ints to deal with this, like other code in predicate analysis. PR tree-optimization/108547 * gimple-predicate-analysis.cc (value_sat_pred_p): Use widest_int. * gcc.dg/uninit-pr108547.c: New testcase. --- gcc/gimple-predicate-analysis.cc | 6 +++--- gcc/testsuite/gcc.dg/uninit-pr108547.c | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/uninit-pr108547.c (limited to 'gcc') diff --git a/gcc/gimple-predicate-analysis.cc b/gcc/gimple-predicate-analysis.cc index a7719ff..094e8c7 100644 --- a/gcc/gimple-predicate-analysis.cc +++ b/gcc/gimple-predicate-analysis.cc @@ -728,11 +728,11 @@ value_sat_pred_p (tree val, tree boundary, tree_code cmpc, if (cmpc != BIT_AND_EXPR) return is_value_included_in (val, boundary, cmpc); - wide_int andw = wi::to_wide (val) & wi::to_wide (boundary); + widest_int andw = wi::to_widest (val) & wi::to_widest (boundary); if (exact_p) - return andw == wi::to_wide (val); + return andw == wi::to_widest (val); - return andw.to_uhwi (); + return wi::ne_p (andw, 0); } /* Return true if the domain of single predicate expression PRED1 diff --git a/gcc/testsuite/gcc.dg/uninit-pr108547.c b/gcc/testsuite/gcc.dg/uninit-pr108547.c new file mode 100644 index 0000000..d8f6c9f --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-pr108547.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wuninitialized" } */ + +int func_7_uc_10li_19 (int); +int li_4, li_5, us_8; +unsigned char func_7_ptr_13, func_7_uc_14; +void func_7_ptr_18() { + if (li_5) { + for (;;) + ; + short s_15; + for (; func_7_uc_14;) { + us_8 = 7; + for (; us_8; us_8 += 1) + lblD2AF1FAB: + if (us_8) + li_4 = 1; + func_7_uc_14 += (__INTPTR_TYPE__)func_7_ptr_18; + if (func_7_ptr_13 & 1 && (func_7_uc_14 &= func_7_ptr_13)) + s_15 %= func_7_uc_10li_19(s_15); /* { dg-warning "uninitialized" } */ + } + } + goto lblD2AF1FAB; +} -- cgit v1.1 From 7bffea89f1f164efc10dd37d979a83c4c5fbfa7e Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 26 Jan 2023 09:12:21 -0500 Subject: analyzer: fix false positives from -Wanalyzer-infinite-recursion [PR108524] Reject -Wanalyzer-infinite-recursion diagnostics in which control flow has been affected by conjured_svalues between the initial call to a function and the subsequent entry to that function. This prevents false positives such as in qemu's recursive JSON parser where function calls are changing state in the rest of the program (e.g. consuming tokens), despite the modelled state being effectively identical at both nested entrypoints. gcc/analyzer/ChangeLog: PR analyzer/108524 * analyzer.h (class feasible_node): New forward decl. * diagnostic-manager.cc (epath_finder::get_best_epath): Add "pd" param. (epath_finder::explore_feasible_paths): Likewise. (epath_finder::process_worklist_item): Likewise. Use it to call pending_diagnostic::check_valid_fpath_p on the final fpath to give pending_diagnostic a way to add additional restrictions on feasibility. (saved_diagnostic::calc_best_epath): Pass pending_diagnostic to epath_finder::get_best_epath. * infinite-recursion.cc: Include "analyzer/feasible-graph.h". (infinite_recursion_diagnostic::check_valid_fpath_p): New. (infinite_recursion_diagnostic::fedge_uses_conjured_svalue_p): New. (infinite_recursion_diagnostic::expr_uses_conjured_svalue_p): New. * pending-diagnostic.h (pending_diagnostic::check_valid_fpath_p): New vfunc. gcc/testsuite/ChangeLog: PR analyzer/108524 * gcc.dg/analyzer/infinite-recursion-pr108524-1.c: New test. * gcc.dg/analyzer/infinite-recursion-pr108524-2.c: New test. * gcc.dg/analyzer/infinite-recursion-pr108524-qobject-json-parser.c: New test. Signed-off-by: David Malcolm --- gcc/analyzer/analyzer.h | 2 + gcc/analyzer/diagnostic-manager.cc | 26 +- gcc/analyzer/infinite-recursion.cc | 100 +++++++ gcc/analyzer/pending-diagnostic.h | 9 + .../analyzer/infinite-recursion-pr108524-1.c | 145 ++++++++++ .../analyzer/infinite-recursion-pr108524-2.c | 113 ++++++++ ...finite-recursion-pr108524-qobject-json-parser.c | 322 +++++++++++++++++++++ 7 files changed, 712 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/analyzer/infinite-recursion-pr108524-1.c create mode 100644 gcc/testsuite/gcc.dg/analyzer/infinite-recursion-pr108524-2.c create mode 100644 gcc/testsuite/gcc.dg/analyzer/infinite-recursion-pr108524-qobject-json-parser.c (limited to 'gcc') diff --git a/gcc/analyzer/analyzer.h b/gcc/analyzer/analyzer.h index 8f79e4b..a161952 100644 --- a/gcc/analyzer/analyzer.h +++ b/gcc/analyzer/analyzer.h @@ -126,6 +126,8 @@ class call_summary_replay; struct per_function_data; struct interesting_t; +class feasible_node; + /* Forward decls of functions. */ extern void dump_tree (pretty_printer *pp, tree t); diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc index 1227d6c..4f036a6 100644 --- a/gcc/analyzer/diagnostic-manager.cc +++ b/gcc/analyzer/diagnostic-manager.cc @@ -88,6 +88,7 @@ public: std::unique_ptr get_best_epath (const exploded_node *target_enode, + const pending_diagnostic &pd, const char *desc, unsigned diag_idx, std::unique_ptr *out_problem); @@ -96,12 +97,14 @@ private: std::unique_ptr explore_feasible_paths (const exploded_node *target_enode, + const pending_diagnostic &pd, const char *desc, unsigned diag_idx); bool process_worklist_item (feasible_worklist *worklist, const trimmed_graph &tg, feasible_graph *fg, const exploded_node *target_enode, + const pending_diagnostic &pd, unsigned diag_idx, std::unique_ptr *out_best_path) const; void dump_trimmed_graph (const exploded_node *target_enode, @@ -138,6 +141,7 @@ private: std::unique_ptr epath_finder::get_best_epath (const exploded_node *enode, + const pending_diagnostic &pd, const char *desc, unsigned diag_idx, std::unique_ptr *out_problem) { @@ -161,7 +165,7 @@ epath_finder::get_best_epath (const exploded_node *enode, if (logger) logger->log ("trying to find shortest feasible path"); if (std::unique_ptr epath - = explore_feasible_paths (enode, desc, diag_idx)) + = explore_feasible_paths (enode, pd, desc, diag_idx)) { if (logger) logger->log ("accepting %qs at EN: %i, SN: %i (sd: %i)" @@ -374,6 +378,7 @@ private: std::unique_ptr epath_finder::explore_feasible_paths (const exploded_node *target_enode, + const pending_diagnostic &pd, const char *desc, unsigned diag_idx) { logger *logger = get_logger (); @@ -415,8 +420,8 @@ epath_finder::explore_feasible_paths (const exploded_node *target_enode, { auto_checking_feasibility sentinel (mgr); - while (process_worklist_item (&worklist, tg, &fg, target_enode, diag_idx, - &best_path)) + while (process_worklist_item (&worklist, tg, &fg, target_enode, pd, + diag_idx, &best_path)) { /* Empty; the work is done within process_worklist_item. */ } @@ -449,7 +454,10 @@ epath_finder::explore_feasible_paths (const exploded_node *target_enode, Return false if the processing of the worklist should stop (either due to reaching TARGET_ENODE, or hitting a limit). Write to *OUT_BEST_PATH if stopping due to finding a feasible path - to TARGET_ENODE. */ + to TARGET_ENODE. + Use PD to provide additional restrictions on feasibility of + the final path in the feasible_graph before converting to + an exploded_path. */ bool epath_finder:: @@ -457,6 +465,7 @@ process_worklist_item (feasible_worklist *worklist, const trimmed_graph &tg, feasible_graph *fg, const exploded_node *target_enode, + const pending_diagnostic &pd, unsigned diag_idx, std::unique_ptr *out_best_path) const { @@ -514,6 +523,13 @@ process_worklist_item (feasible_worklist *worklist, " (length: %i)", target_enode->m_index, diag_idx, succ_fnode->get_path_length ()); + if (!pd.check_valid_fpath_p (succ_fnode)) + { + if (logger) + logger->log ("rejecting feasible path due to" + " pending_diagnostic"); + return false; + } *out_best_path = fg->make_epath (succ_fnode); if (flag_dump_analyzer_feasibility) dump_feasible_path (target_enode, diag_idx, *fg, *succ_fnode); @@ -808,7 +824,7 @@ saved_diagnostic::calc_best_epath (epath_finder *pf) LOG_SCOPE (logger); m_problem = NULL; - m_best_epath = pf->get_best_epath (m_enode, m_d->get_kind (), m_idx, + m_best_epath = pf->get_best_epath (m_enode, *m_d, m_d->get_kind (), m_idx, &m_problem); /* Handle failure to find a feasible path. */ diff --git a/gcc/analyzer/infinite-recursion.cc b/gcc/analyzer/infinite-recursion.cc index c4e85bf..8d101d1 100644 --- a/gcc/analyzer/infinite-recursion.cc +++ b/gcc/analyzer/infinite-recursion.cc @@ -62,6 +62,7 @@ along with GCC; see the file COPYING3. If not see #include "analyzer/exploded-graph.h" #include "make-unique.h" #include "analyzer/checker-path.h" +#include "analyzer/feasible-graph.h" /* A subclass of pending_diagnostic for complaining about suspected infinite recursion. */ @@ -199,7 +200,106 @@ public: NULL, NULL, NULL)); } + /* Reject paths in which conjured svalues have affected control flow + since m_prev_entry_enode. */ + + bool check_valid_fpath_p (const feasible_node *final_fnode) + const final override + { + /* Reject paths in which calls with unknown side effects have occurred + since m_prev_entry_enode. + Find num calls with side effects. Walk backward until we reach the + pref */ + gcc_assert (final_fnode->get_inner_node () == m_new_entry_enode); + + /* FG is actually a tree. Walk backwards from FINAL_FNODE until we + reach the prev_entry_enode (or the origin). */ + const feasible_node *iter_fnode = final_fnode; + while (iter_fnode->get_inner_node ()->m_index != 0) + { + gcc_assert (iter_fnode->m_preds.length () == 1); + + feasible_edge *pred_fedge + = static_cast (iter_fnode->m_preds[0]); + + /* Determine if conjured svalues have affected control flow + since the prev entry node. */ + if (fedge_uses_conjured_svalue_p (pred_fedge)) + /* If so, then reject this diagnostic. */ + return false; + iter_fnode = static_cast (pred_fedge->m_src); + if (iter_fnode->get_inner_node () == m_prev_entry_enode) + /* Accept this diagnostic. */ + return true; + } + + /* We shouldn't get here; if we do, reject the diagnostic. */ + gcc_unreachable (); + return false; + } + private: + /* Return true iff control flow along FEDGE was affected by + a conjured_svalue. */ + static bool fedge_uses_conjured_svalue_p (feasible_edge *fedge) + { + const exploded_edge *eedge = fedge->get_inner_edge (); + const superedge *sedge = eedge->m_sedge; + if (!sedge) + return false; + const cfg_superedge *cfg_sedge = sedge->dyn_cast_cfg_superedge (); + if (!cfg_sedge) + return false; + const gimple *last_stmt = sedge->m_src->get_last_stmt (); + if (!last_stmt) + return false; + + const feasible_node *dst_fnode + = static_cast (fedge->m_dest); + const region_model &model = dst_fnode->get_state ().get_model (); + + if (const gcond *cond_stmt = dyn_cast (last_stmt)) + { + if (expr_uses_conjured_svalue_p (model, gimple_cond_lhs (cond_stmt))) + return true; + if (expr_uses_conjured_svalue_p (model, gimple_cond_rhs (cond_stmt))) + return true; + } + else if (const gswitch *switch_stmt + = dyn_cast (last_stmt)) + { + if (expr_uses_conjured_svalue_p (model, + gimple_switch_index (switch_stmt))) + return true; + } + return false; + } + + /* Return true iff EXPR is affected by a conjured_svalue. */ + static bool expr_uses_conjured_svalue_p (const region_model &model, + tree expr) + { + class conjured_svalue_finder : public visitor + { + public: + conjured_svalue_finder () : m_found_conjured_svalues (false) + { + } + void + visit_conjured_svalue (const conjured_svalue *) final override + { + m_found_conjured_svalues = true; + } + + bool m_found_conjured_svalues; + }; + + const svalue *sval = model.get_rvalue (expr, NULL); + conjured_svalue_finder v; + sval->accept (&v); + return v.m_found_conjured_svalues; + } + const exploded_node *m_prev_entry_enode; const exploded_node *m_new_entry_enode; tree m_callee_fndecl; diff --git a/gcc/analyzer/pending-diagnostic.h b/gcc/analyzer/pending-diagnostic.h index de79890..b919d5b 100644 --- a/gcc/analyzer/pending-diagnostic.h +++ b/gcc/analyzer/pending-diagnostic.h @@ -347,6 +347,15 @@ class pending_diagnostic { /* Default no-op implementation. */ } + + /* Vfunc to give diagnostic subclasses the opportunity to reject diagnostics + by imposing their own additional feasibility checks on the path to a + given feasible_node. */ + virtual bool check_valid_fpath_p (const feasible_node *) const + { + /* Default implementation: accept this path. */ + return true; + } }; /* A template to make it easier to make subclasses of pending_diagnostic. diff --git a/gcc/testsuite/gcc.dg/analyzer/infinite-recursion-pr108524-1.c b/gcc/testsuite/gcc.dg/analyzer/infinite-recursion-pr108524-1.c new file mode 100644 index 0000000..d9221fa8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/infinite-recursion-pr108524-1.c @@ -0,0 +1,145 @@ +/* Reduced from qemu-7.2.0's qobject/json-parser.c, which + is licensed under LGPLv2.1 or later. */ + +/* { dg-additional-options "-fno-analyzer-call-summaries -Wno-analyzer-too-complex" } */ + +#define NULL ((void *)0) +typedef __builtin_va_list va_list; + +typedef struct _GQueue GQueue; +typedef struct Error Error; +typedef struct QList QList; +typedef struct QObject QObject; + +struct QObjectBase_ { + /* [...snip...] */ +}; + + +struct QObject { + struct QObjectBase_ base; +}; + +#define QOBJECT(obj) ((QObject *)obj) +#define qobject_unref(OBJ) /* [...snip...] */ + +typedef struct QTailQLink { + void *tql_next; + struct QTailQLink *tql_prev; +} QTailQLink; + +struct QList { + struct QObjectBase_ base; + union { + struct QListEntry *tqh_first; + QTailQLink tqh_circ; + } head; +}; +QList *qlist_new(void); +void qlist_append_obj(QList *qlist, QObject *obj); + +typedef enum json_token_type { + /* [...snip...] */ + JSON_LSQUARE, + JSON_RSQUARE, + /* [...snip...] */ + JSON_COMMA, + /* [...snip...] */ + JSON_KEYWORD, + /* [...snip...] */ +} JSONTokenType; +typedef struct JSONToken JSONToken; + +struct JSONToken { + JSONTokenType type; + int x; + int y; + char str[]; +}; + +typedef struct JSONParserContext { + Error *err; + JSONToken *current; + GQueue *buf; + va_list *ap; +} JSONParserContext; +static QObject *parse_value(JSONParserContext *ctxt); + +JSONToken *parser_context_pop_token(JSONParserContext *ctxt); +JSONToken *parser_context_peek_token(JSONParserContext *ctxt); + +static QObject *parse_array(JSONParserContext *ctxt) { + QList *list = NULL; + JSONToken *token, *peek; + + token = parser_context_pop_token(ctxt); + + list = qlist_new(); + + peek = parser_context_peek_token(ctxt); + if (peek == NULL) { + goto out; + } + + if (peek->type != JSON_RSQUARE) { + QObject *obj; + + obj = parse_value(ctxt); /* { dg-bogus "infinite recursion" } */ + if (obj == NULL) { + goto out; + } + + qlist_append_obj(list, obj); + + token = parser_context_pop_token(ctxt); + if (token == NULL) { + goto out; + } + + while (token->type != JSON_RSQUARE) { + if (token->type != JSON_COMMA) { + goto out; + } + + obj = parse_value(ctxt); + if (obj == NULL) { + goto out; + } + + qlist_append_obj(list, obj); + + token = parser_context_pop_token(ctxt); + if (token == NULL) { + goto out; + } + } + } else { + (void)parser_context_pop_token(ctxt); + } + + return QOBJECT(list); + +out: + qobject_unref(list); + return NULL; +} + +QObject *parse_keyword(JSONParserContext *ctxt); + +QObject *parse_value(JSONParserContext *ctxt) { + JSONToken *token; + + token = parser_context_peek_token(ctxt); + if (token == NULL) { + return NULL; + } + + switch (token->type) { + case JSON_LSQUARE: + return parse_array(ctxt); /* { dg-bogus "infinite recursion" } */ + case JSON_KEYWORD: + return parse_keyword(ctxt); + default: + return NULL; + } +} diff --git a/gcc/testsuite/gcc.dg/analyzer/infinite-recursion-pr108524-2.c b/gcc/testsuite/gcc.dg/analyzer/infinite-recursion-pr108524-2.c new file mode 100644 index 0000000..58f6d2f --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/infinite-recursion-pr108524-2.c @@ -0,0 +1,113 @@ +struct st1; + +int foo (struct st1 *p); +int bar (struct st1 *p); + +void test_1 (struct st1 *p) +{ + test_1 (p); /* { dg-warning "infinite recursion" } */ +} + +void test_2_if (struct st1 *p) +{ + if (foo (p)) + test_2_if (p); /* { dg-bogus "infinite recursion" } */ +} + +void test_2_switch (struct st1 *p) +{ + switch (foo (p)) + { + case 0 ... 9: + test_2_switch (p); /* { dg-bogus "infinite recursion" } */ + break; + default: + break; + } +} + +void test_2_if_compound (struct st1 *p) +{ + if ((foo (p) + bar (p)) >= 0) + test_2_if_compound (p); /* { dg-bogus "infinite recursion" } */ +} + +void test_3 (struct st1 *p) +{ + foo (p); + test_3 (p); /* { dg-warning "infinite recursion" } */ + /* The content of *p never affects control flow, so we should + report this. */ +} + +struct st2 +{ + int i; +}; + +void test_4 (struct st2 *p) +{ + if (p->i > 0) + test_4 (p); /* { dg-warning "infinite recursion" } */ +} + +void test_5 (struct st2 *p) +{ + if (p->i-- > 0) + test_5 (p); /* { dg-bogus "infinite recursion" } */ +} + +/* Mixtures of heap allocation and recursion. It's not clear what we + should do for such cases, but make sure we don't ICE. */ + +void test_6 (struct st2 *p) +{ + struct st2 *q = __builtin_malloc (p->i); + if (!q) + return; + q->i = p->i; + test_6 (q); + __builtin_free (q); +} + +void test_7 (struct st2 *p) +{ + struct st2 *q = __builtin_malloc (p->i); + q->i = p->i; /* { dg-warning "dereference of possibly-NULL 'q'" } */ + test_7 (q); + __builtin_free (q); +} + +void test_switch_1 (int i) +{ + int j; + switch (i) + { + case 0: + j = 1066; + break; + case 1: + j = 1776; + break; + default: + j = 1492; + break; + } + test_switch_1 (j); /* { dg-warning "infinite recursion" "" { xfail *-*-* } } */ +} + +void test_switch_2 (int i) +{ + switch (i) + { + case 0: + test_switch_2 (1066); + break; + case 1: + test_switch_2 (1776); + break; + default: + test_switch_2 (1492); /* { dg-warning "infinite recursion" "" { xfail *-*-* } } */ + break; + } +} diff --git a/gcc/testsuite/gcc.dg/analyzer/infinite-recursion-pr108524-qobject-json-parser.c b/gcc/testsuite/gcc.dg/analyzer/infinite-recursion-pr108524-qobject-json-parser.c new file mode 100644 index 0000000..b40326f --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/infinite-recursion-pr108524-qobject-json-parser.c @@ -0,0 +1,322 @@ +/* Reduced from qemu-7.2.0's qobject/json-parser.c, which + is licensed under LGPLv2.1 or later. */ + +/* { dg-additional-options "-fno-analyzer-call-summaries -Wno-analyzer-too-complex" } */ + +#define NULL ((void *)0) +typedef __builtin_va_list va_list; +typedef __SIZE_TYPE__ size_t; + +typedef struct _GString GString; +typedef struct _GQueue GQueue; +typedef struct Error Error; +typedef struct QDict QDict; +typedef struct QList QList; +typedef struct QObject QObject; +typedef struct QString QString; + +typedef enum QType { + /* [...snip...] */ + QTYPE_QSTRING, + /* [...snip...] */ +} QType; + +struct QObjectBase_ { + QType type; +}; + +struct QObject { + struct QObjectBase_ base; +}; + +#define QOBJECT(obj) ((QObject *)obj) +#define qobject_unref(OBJ) /* [...snip...] */ + +void qobject_ref_impl(QObject *obj); +QType qobject_type(const QObject *obj); +QObject *qobject_check_type(const QObject *obj, QType type); + +typedef struct QTailQLink { + void *tql_next; + struct QTailQLink *tql_prev; +} QTailQLink; + +typedef struct QDictEntry { + char *key; + QObject *value; + struct { + struct QDictEntry *le_next; + struct QDictEntry **le_prev; + } next; +} QDictEntry; + +struct QDict { + struct QObjectBase_ base; + size_t size; + struct { + struct QDictEntry *lh_first; + } table[512]; +}; + +QDict *qdict_new(void); +void qdict_put_obj(QDict *qdict, const char *key, QObject *value); +int qdict_haskey(const QDict *qdict, const char *key); +typedef struct QListEntry { + QObject *value; + union { + struct QListEntry *tqe_next; + QTailQLink tqe_circ; + } next; +} QListEntry; + +struct QList { + struct QObjectBase_ base; + union { + struct QListEntry *tqh_first; + QTailQLink tqh_circ; + } head; +}; +QList *qlist_new(void); +void qlist_append_obj(QList *qlist, QObject *obj); + +struct QString { + struct QObjectBase_ base; + const char *string; +}; +QString *qstring_from_str(const char *str); +const char *qstring_get_str(const QString *qstring); + +typedef enum json_token_type { + JSON_ERROR = 0, + + JSON_LCURLY = 100, + JSON_MIN = JSON_LCURLY, + JSON_RCURLY, + JSON_LSQUARE, + JSON_RSQUARE, + JSON_COLON, + JSON_COMMA, + JSON_INTEGER, + JSON_FLOAT, + JSON_KEYWORD, + JSON_STRING, + JSON_INTERP, + JSON_END_OF_INPUT, + JSON_MAX = JSON_END_OF_INPUT +} JSONTokenType; +typedef struct JSONToken JSONToken; + +struct JSONToken { + JSONTokenType type; + int x; + int y; + char str[]; +}; + +typedef struct JSONParserContext { + Error *err; + JSONToken *current; + GQueue *buf; + va_list *ap; +} JSONParserContext; +static QObject *parse_value(JSONParserContext *ctxt); + +void __attribute__((__format__(gnu_printf, 3, 4))) +parse_error(JSONParserContext *ctxt, JSONToken *token, const char *msg, ...); + +JSONToken *parser_context_pop_token(JSONParserContext *ctxt); +JSONToken *parser_context_peek_token(JSONParserContext *ctxt); + +static int parse_pair(JSONParserContext *ctxt, QDict *dict) { + QObject *key_obj = NULL; + QString *key; + QObject *value; + JSONToken *peek, *token; + + peek = parser_context_peek_token(ctxt); + if (peek == NULL) { + parse_error(ctxt, NULL, "premature EOI"); + goto out; + } + + key_obj = parse_value(ctxt); /* { dg-bogus "infinite recursion" } */ + key = ((QString *)qobject_check_type(key_obj, QTYPE_QSTRING)); + if (!key) { + parse_error(ctxt, peek, "key is not a string in object"); + goto out; + } + + token = parser_context_pop_token(ctxt); + if (token == NULL) { + parse_error(ctxt, NULL, "premature EOI"); + goto out; + } + + if (token->type != JSON_COLON) { + parse_error(ctxt, token, "missing : in object pair"); + goto out; + } + + value = parse_value(ctxt); + if (value == NULL) { + parse_error(ctxt, token, "Missing value in dict"); + goto out; + } + + if (qdict_haskey(dict, qstring_get_str(key))) { + parse_error(ctxt, token, "duplicate key"); + goto out; + } + + qdict_put_obj(dict, qstring_get_str(key), value); + + qobject_unref(key_obj); + return 0; + +out: + qobject_unref(key_obj); + return -1; +} + +static QObject *parse_object(JSONParserContext *ctxt) { + QDict *dict = NULL; + JSONToken *token, *peek; + + token = parser_context_pop_token(ctxt); + + dict = qdict_new(); + + peek = parser_context_peek_token(ctxt); + if (peek == NULL) { + parse_error(ctxt, NULL, "premature EOI"); + goto out; + } + + if (peek->type != JSON_RCURLY) { + if (parse_pair(ctxt, dict) == -1) { + goto out; + } + + token = parser_context_pop_token(ctxt); + if (token == NULL) { + parse_error(ctxt, NULL, "premature EOI"); + goto out; + } + + while (token->type != JSON_RCURLY) { + if (token->type != JSON_COMMA) { + parse_error(ctxt, token, "expected separator in dict"); + goto out; + } + + if (parse_pair(ctxt, dict) == -1) { + goto out; + } + + token = parser_context_pop_token(ctxt); + if (token == NULL) { + parse_error(ctxt, NULL, "premature EOI"); + goto out; + } + } + } else { + (void)parser_context_pop_token(ctxt); + } + + return QOBJECT(dict); + +out: + qobject_unref (dict); + return NULL; +} + +static QObject *parse_array(JSONParserContext *ctxt) { + QList *list = NULL; + JSONToken *token, *peek; + + token = parser_context_pop_token(ctxt); + + list = qlist_new(); + + peek = parser_context_peek_token(ctxt); + if (peek == NULL) { + parse_error(ctxt, NULL, "premature EOI"); + goto out; + } + + if (peek->type != JSON_RSQUARE) { + QObject *obj; + + obj = parse_value(ctxt); /* { dg-bogus "infinite recursion" } */ + if (obj == NULL) { + parse_error(ctxt, token, "expecting value"); + goto out; + } + + qlist_append_obj(list, obj); + + token = parser_context_pop_token(ctxt); + if (token == NULL) { + parse_error(ctxt, NULL, "premature EOI"); + goto out; + } + + while (token->type != JSON_RSQUARE) { + if (token->type != JSON_COMMA) { + parse_error(ctxt, token, "expected separator in list"); + goto out; + } + + obj = parse_value(ctxt); + if (obj == NULL) { + parse_error(ctxt, token, "expecting value"); + goto out; + } + + qlist_append_obj(list, obj); + + token = parser_context_pop_token(ctxt); + if (token == NULL) { + parse_error(ctxt, NULL, "premature EOI"); + goto out; + } + } + } else { + (void)parser_context_pop_token(ctxt); + } + + return QOBJECT(list); + +out: + qobject_unref(list); + return NULL; +} + +QObject *parse_keyword(JSONParserContext *ctxt); +QObject *parse_literal(JSONParserContext *ctxt); + +QObject *parse_value(JSONParserContext *ctxt) { + JSONToken *token; + + token = parser_context_peek_token(ctxt); + if (token == NULL) { + parse_error(ctxt, NULL, "premature EOI"); + return NULL; + } + + switch (token->type) { + case JSON_LCURLY: + return parse_object(ctxt); /* { dg-bogus "infinite recursion" } */ + case JSON_LSQUARE: + return parse_array(ctxt); /* { dg-bogus "infinite recursion" } */ + case JSON_INTEGER: + case JSON_FLOAT: + case JSON_STRING: + return parse_literal(ctxt); + case JSON_KEYWORD: + return parse_keyword(ctxt); + default: + parse_error(ctxt, token, "expecting value"); + return NULL; + } +} -- cgit v1.1 From f1eab269288ffa80ba924ddb4c4b36f8f781d613 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 26 Jan 2023 09:12:21 -0500 Subject: analyzer: fix SARD-tc841-basic-00182-min.c test case [PR108507] gcc/testsuite/ChangeLog: PR analyzer/108507 * gcc.dg/analyzer/SARD-tc841-basic-00182-min.c: Add -Wno-stringop-overflow. Signed-off-by: David Malcolm --- gcc/testsuite/gcc.dg/analyzer/SARD-tc841-basic-00182-min.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/analyzer/SARD-tc841-basic-00182-min.c b/gcc/testsuite/gcc.dg/analyzer/SARD-tc841-basic-00182-min.c index 577dce1..ed9ad31 100644 --- a/gcc/testsuite/gcc.dg/analyzer/SARD-tc841-basic-00182-min.c +++ b/gcc/testsuite/gcc.dg/analyzer/SARD-tc841-basic-00182-min.c @@ -4,6 +4,9 @@ Black, P. , Koo, H. and Irish, T. (2013), A Basic CWE-121 Buffer Overflow Effectiveness Test Suite, Proc. 6th Latin-American Symposium on Dependable Computing, Rio de Janeiro, -1, [online], https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=913117 (Accessed January 17, 2023) */ +/* The purpose of this testcase is to see if -fanalyzer can detect the bug. */ +/* { dg-additional-options "-Wno-stringop-overflow" } */ + /* Taxonomy Classification: 0000300602130000031110 */ /* -- cgit v1.1 From 9f353b0c1dc9385ba8b8a64b65d66d5452383c11 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Fri, 11 Nov 2022 17:59:30 -0500 Subject: c++: Reject UDLs in certain contexts [PR105300] In this PR, we are crashing because we've encountered a UDL where a string-literal is expected. This patch makes the parser reject string and character UDLs in all places where the grammar requires a string-literal and not a user-defined-string-literal. I've introduced two new wrappers; the existing cp_parser_string_literal was renamed to cp_parser_string_literal_common and should not be called directly. finish_userdef_string_literal is renamed from cp_parser_userdef_string_literal. PR c++/105300 gcc/c-family/ChangeLog: * c-pragma.cc (handle_pragma_message): Warn for CPP_STRING_USERDEF. gcc/cp/ChangeLog: * parser.cc: Remove unnecessary forward declarations. (cp_parser_string_literal): New wrapper. (cp_parser_string_literal_common): Renamed from cp_parser_string_literal. Add a bool parameter. Give an error when UDLs are not permitted. (cp_parser_userdef_string_literal): New wrapper. (finish_userdef_string_literal): Renamed from cp_parser_userdef_string_literal. (cp_parser_primary_expression): Call cp_parser_userdef_string_literal instead of cp_parser_string_literal. (cp_parser_linkage_specification): Move a variable declaration closer to its first use. (cp_parser_static_assert): Likewise. (cp_parser_operator): Call cp_parser_userdef_string_literal instead of cp_parser_string_literal. (cp_parser_asm_definition): Move a variable declaration closer to its first use. (cp_parser_asm_specification_opt): Move variable declarations closer to their first use. (cp_parser_asm_operand_list): Likewise. (cp_parser_asm_clobber_list): Likewise. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/udlit-error1.C: New test. --- gcc/c-family/c-pragma.cc | 3 + gcc/cp/parser.cc | 133 ++++++++++++++++++++---------- gcc/testsuite/g++.dg/cpp0x/udlit-error1.C | 21 +++++ 3 files changed, 113 insertions(+), 44 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/udlit-error1.C (limited to 'gcc') diff --git a/gcc/c-family/c-pragma.cc b/gcc/c-family/c-pragma.cc index 68d1c8b..0d2b333 100644 --- a/gcc/c-family/c-pragma.cc +++ b/gcc/c-family/c-pragma.cc @@ -1390,6 +1390,9 @@ handle_pragma_message (cpp_reader *) } else if (token == CPP_STRING) message = x; + else if (token == CPP_STRING_USERDEF) + GCC_BAD ("string literal with user-defined suffix is invalid in this " + "context"); else GCC_BAD ("expected a string after %<#pragma message%>"); diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index e0c46d2..4cdc1cd 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -2227,16 +2227,8 @@ pop_unparsed_function_queues (cp_parser *parser) /* Lexical conventions [gram.lex] */ -static cp_expr cp_parser_identifier - (cp_parser *); -static cp_expr cp_parser_string_literal - (cp_parser *, bool, bool, bool); -static cp_expr cp_parser_userdef_char_literal - (cp_parser *); -static tree cp_parser_userdef_string_literal +static tree finish_userdef_string_literal (tree); -static cp_expr cp_parser_userdef_numeric_literal - (cp_parser *); /* Basic concepts [gram.basic] */ @@ -4408,11 +4400,15 @@ cp_parser_identifier (cp_parser* parser) return error_mark_node; } -/* Parse a sequence of adjacent string constants. Returns a +/* Worker for cp_parser_string_literal and cp_parser_userdef_string_literal. + Do not call this directly; use either of the above. + + Parse a sequence of adjacent string constants. Return a TREE_STRING representing the combined, nul-terminated string constant. If TRANSLATE is true, translate the string to the execution character set. If WIDE_OK is true, a wide string is - invalid here. + valid here. If UDL_OK is true, a string literal with user-defined + suffix can be used in this context. C++98 [lex.string] says that if a narrow string literal token is adjacent to a wide string literal token, the behavior is undefined. @@ -4422,9 +4418,11 @@ cp_parser_identifier (cp_parser* parser) This code is largely lifted from lex_string() in c-lex.cc. FUTURE: ObjC++ will need to handle @-strings here. */ + static cp_expr -cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok, - bool lookup_udlit = true) +cp_parser_string_literal_common (cp_parser *parser, bool translate, + bool wide_ok, bool udl_ok, + bool lookup_udlit) { tree value; size_t count; @@ -4449,6 +4447,12 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok, if (cpp_userdef_string_p (tok->type)) { + if (!udl_ok) + { + error_at (loc, "string literal with user-defined suffix " + "is invalid in this context"); + return error_mark_node; + } string_tree = USERDEF_LITERAL_VALUE (tok->u.value); curr_type = cpp_userdef_string_remove_type (tok->type); curr_tok_is_userdef_p = true; @@ -4539,6 +4543,12 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok, tok = cp_lexer_peek_token (parser->lexer); if (cpp_userdef_string_p (tok->type)) { + if (!udl_ok) + { + error_at (loc, "string literal with user-defined suffix " + "is invalid in this context"); + return error_mark_node; + } string_tree = USERDEF_LITERAL_VALUE (tok->u.value); curr_type = cpp_userdef_string_remove_type (tok->type); curr_tok_is_userdef_p = true; @@ -4608,7 +4618,7 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok, tree literal = build_userdef_literal (suffix_id, value, OT_NONE, NULL_TREE); if (lookup_udlit) - value = cp_parser_userdef_string_literal (literal); + value = finish_userdef_string_literal (literal); else value = literal; } @@ -4626,6 +4636,37 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok, return cp_expr (value, loc); } +/* Parse a sequence of adjacent string constants. Return a TREE_STRING + representing the combined, nul-terminated string constant. If + TRANSLATE is true, translate the string to the execution character set. + If WIDE_OK is true, a wide string is valid here. + + This function issues an error if a user defined string literal is + encountered; use cp_parser_userdef_string_literal if UDLs are allowed. */ + +static inline cp_expr +cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok) +{ + return cp_parser_string_literal_common (parser, translate, wide_ok, + /*udl_ok=*/false, + /*lookup_udlit=*/false); +} + +/* Parse a string literal or user defined string literal. + + user-defined-string-literal : + string-literal ud-suffix + + If LOOKUP_UDLIT, perform a lookup for a suitable template function. */ + +static inline cp_expr +cp_parser_userdef_string_literal (cp_parser *parser, bool lookup_udlit) +{ + return cp_parser_string_literal_common (parser, /*translate=*/true, + /*wide_ok=*/true, /*udl_ok=*/true, + lookup_udlit); +} + /* Look up a literal operator with the name and the exact arguments. */ static tree @@ -4923,7 +4964,7 @@ cp_parser_userdef_numeric_literal (cp_parser *parser) as arguments. */ static tree -cp_parser_userdef_string_literal (tree literal) +finish_userdef_string_literal (tree literal) { tree suffix_id = USERDEF_LITERAL_SUFFIX_ID (literal); tree name = cp_literal_operator_id (IDENTIFIER_POINTER (suffix_id)); @@ -5663,10 +5704,15 @@ cp_parser_primary_expression (cp_parser *parser, /* ??? Should wide strings be allowed when parser->translate_strings_p is false (i.e. in attributes)? If not, we can kill the third argument to cp_parser_string_literal. */ - return (cp_parser_string_literal (parser, - parser->translate_strings_p, - true) - .maybe_add_location_wrapper ()); + if (parser->translate_strings_p) + return (cp_parser_userdef_string_literal (parser, + /*lookup_udlit=*/true) + .maybe_add_location_wrapper ()); + else + return (cp_parser_string_literal (parser, + /*translate=*/false, + /*wide_ok=*/true) + .maybe_add_location_wrapper ()); case CPP_OPEN_PAREN: /* If we see `( { ' then we are looking at the beginning of @@ -16222,15 +16268,14 @@ cp_parser_function_specifier_opt (cp_parser* parser, static void cp_parser_linkage_specification (cp_parser* parser, tree prefix_attr) { - tree linkage; - /* Look for the `extern' keyword. */ cp_token *extern_token = cp_parser_require_keyword (parser, RID_EXTERN, RT_EXTERN); /* Look for the string-literal. */ cp_token *string_token = cp_lexer_peek_token (parser->lexer); - linkage = cp_parser_string_literal (parser, false, false); + tree linkage = cp_parser_string_literal (parser, /*translate=*/false, + /*wide_ok=*/false); /* Transform the literal into an identifier. If the literal is a wide-character string, or contains embedded NULs, then we can't @@ -16360,9 +16405,8 @@ cp_parser_static_assert(cp_parser *parser, bool member_p) cp_parser_require (parser, CPP_COMMA, RT_COMMA); /* Parse the string-literal message. */ - message = cp_parser_string_literal (parser, - /*translate=*/false, - /*wide_ok=*/true); + message = cp_parser_string_literal (parser, /*translate=*/false, + /*wide_ok=*/true); /* A `)' completes the static assertion. */ if (!parens.require_close (parser)) @@ -17410,7 +17454,6 @@ cp_parser_operator (cp_parser* parser, location_t start_loc) case CPP_STRING16_USERDEF: case CPP_STRING32_USERDEF: { - cp_expr str; tree string_tree; int sz, len; @@ -17418,8 +17461,8 @@ cp_parser_operator (cp_parser* parser, location_t start_loc) maybe_warn_cpp0x (CPP0X_USER_DEFINED_LITERALS); /* Consume the string. */ - str = cp_parser_string_literal (parser, /*translate=*/true, - /*wide_ok=*/true, /*lookup_udlit=*/false); + cp_expr str = cp_parser_userdef_string_literal (parser, + /*lookup_udlit=*/false); if (str == error_mark_node) return error_mark_node; else if (TREE_CODE (str) == USERDEF_LITERAL) @@ -22072,7 +22115,6 @@ cp_parser_using_directive (cp_parser* parser) static void cp_parser_asm_definition (cp_parser* parser) { - tree string; tree outputs = NULL_TREE; tree inputs = NULL_TREE; tree clobbers = NULL_TREE; @@ -22180,7 +22222,8 @@ cp_parser_asm_definition (cp_parser* parser) if (!cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN)) return; /* Look for the string. */ - string = cp_parser_string_literal (parser, false, false); + tree string = cp_parser_string_literal (parser, /*translate=*/false, + /*wide_ok=*/false); if (string == error_mark_node) { cp_parser_skip_to_closing_parenthesis (parser, true, false, @@ -28655,11 +28698,8 @@ cp_parser_yield_expression (cp_parser* parser) static tree cp_parser_asm_specification_opt (cp_parser* parser) { - cp_token *token; - tree asm_specification; - /* Peek at the next token. */ - token = cp_lexer_peek_token (parser->lexer); + cp_token *token = cp_lexer_peek_token (parser->lexer); /* If the next token isn't the `asm' keyword, then there's no asm-specification. */ if (!cp_parser_is_keyword (token, RID_ASM)) @@ -28672,7 +28712,9 @@ cp_parser_asm_specification_opt (cp_parser* parser) parens.require_open (parser); /* Look for the string-literal. */ - asm_specification = cp_parser_string_literal (parser, false, false); + tree asm_specification = cp_parser_string_literal (parser, + /*translate=*/false, + /*wide_ok=*/false); /* Look for the `)'. */ parens.require_close (parser); @@ -28705,8 +28747,6 @@ cp_parser_asm_operand_list (cp_parser* parser) while (true) { - tree string_literal; - tree expression; tree name; if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE)) @@ -28724,13 +28764,15 @@ cp_parser_asm_operand_list (cp_parser* parser) else name = NULL_TREE; /* Look for the string-literal. */ - string_literal = cp_parser_string_literal (parser, false, false); + tree string_literal = cp_parser_string_literal (parser, + /*translate=*/false, + /*wide_ok=*/false); /* Look for the `('. */ matching_parens parens; parens.require_open (parser); /* Parse the expression. */ - expression = cp_parser_expression (parser); + tree expression = cp_parser_expression (parser); /* Look for the `)'. */ parens.require_close (parser); @@ -28770,10 +28812,10 @@ cp_parser_asm_clobber_list (cp_parser* parser) while (true) { - tree string_literal; - /* Look for the string literal. */ - string_literal = cp_parser_string_literal (parser, false, false); + tree string_literal = cp_parser_string_literal (parser, + /*translate=*/false, + /*wide_ok=*/false); /* Add it to the list. */ clobbers = tree_cons (NULL_TREE, string_literal, clobbers); /* If the next token is not a `,', then the list is @@ -46372,7 +46414,9 @@ cp_parser_omp_context_selector (cp_parser *parser, tree set, bool has_parms_p) cp_lexer_consume_token (parser->lexer); } else if (cp_lexer_next_token_is (parser->lexer, CPP_STRING)) - value = cp_parser_string_literal (parser, false, false); + value = cp_parser_string_literal (parser, + /*translate=*/false, + /*wide_ok=*/false); else { cp_parser_error (parser, "expected identifier or " @@ -49394,7 +49438,8 @@ pragma_lex (tree *value, location_t *loc) if (ret == CPP_PRAGMA_EOL) ret = CPP_EOF; else if (ret == CPP_STRING) - *value = cp_parser_string_literal (the_parser, false, false); + *value = cp_parser_string_literal (the_parser, /*translate=*/false, + /*wide_ok=*/false); else { if (ret == CPP_KEYWORD) diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-error1.C b/gcc/testsuite/g++.dg/cpp0x/udlit-error1.C new file mode 100644 index 0000000..66e300e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-error1.C @@ -0,0 +1,21 @@ +// PR c++/105300 +// { dg-do compile { target c++11 } } + +void operator""_x(const char *, decltype(sizeof(0))); + +#include ""_x // { dg-error "include expects" } +#line ""_x // { dg-error "not a positive integer" } +#if __has_include(""_x) // { dg-error "requires a header-name" } +#endif + +#pragma message "hi"_x // { dg-warning "string literal with user-defined suffix is invalid in this context" } + +extern "C"_x { void g(); } // { dg-error "before user-defined string literal" } +static_assert(true, "foo"_x); // { dg-error "string literal with user-defined suffix is invalid in this context|expected" } + +[[deprecated("oof"_x)]] +void +lol () // { dg-error "not a string" } +{ + asm (""_x); // { dg-error "string literal with user-defined suffix is invalid in this context" } +} -- cgit v1.1 From b4308a65546b633a6bce98d1156c6dc05f724929 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 26 Jan 2023 15:50:59 +0000 Subject: aarch64: Remove slp_13.c XFAILs These tests started passing after g:b073f2b098ba7819450d6c14a0fb96cb1c09f242. gcc/testsuite/ * gcc.target/aarch64/sve/slp_13.c: Remove XFAILs. --- gcc/testsuite/gcc.target/aarch64/sve/slp_13.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/aarch64/sve/slp_13.c b/gcc/testsuite/gcc.target/aarch64/sve/slp_13.c index 37b5f11..2e8c396 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/slp_13.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/slp_13.c @@ -32,14 +32,11 @@ vec_slp_##TYPE (TYPE *restrict a, int n) \ TEST_ALL (VEC_PERM) -/* ??? We don't treat the uint loops as SLP. */ /* The loop should be fully-masked. */ -/* { dg-final { scan-assembler-times {\tld1b\t} 2 { xfail *-*-* } } } */ -/* { dg-final { scan-assembler-times {\tld1h\t} 3 { xfail *-*-* } } } */ -/* { dg-final { scan-assembler-times {\tld1w\t} 3 { xfail *-*-* } } } */ -/* { dg-final { scan-assembler-times {\tld1w\t} 2 } } */ -/* { dg-final { scan-assembler-times {\tld1d\t} 3 { xfail *-*-* } } } */ -/* { dg-final { scan-assembler-times {\tld1d\t} 2 } } */ +/* { dg-final { scan-assembler-times {\tld1b\t} 2 } } */ +/* { dg-final { scan-assembler-times {\tld1h\t} 3 } } */ +/* { dg-final { scan-assembler-times {\tld1w\t} 3 } } */ +/* { dg-final { scan-assembler-times {\tld1d\t} 3 } } */ /* { dg-final { scan-assembler-not {\tldr} } } */ /* { dg-final { scan-assembler-times {\twhilelo\tp[0-7]\.b} 4 } } */ -- cgit v1.1 From 4b4ba37bc1a0aba0b03ec512b46c6d7d6314d9d6 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 26 Jan 2023 15:50:59 +0000 Subject: aarch64: Suppress warnings in pr99766.C pr99766.C is an ICE regression test that now triggers a warning about converting float to _Float16. gcc/testsuite/ * g++.target/aarch64/sve/pr99766.C: Disable warnings. --- gcc/testsuite/g++.target/aarch64/sve/pr99766.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr99766.C b/gcc/testsuite/g++.target/aarch64/sve/pr99766.C index 0ca8aee..528d9dd 100644 --- a/gcc/testsuite/g++.target/aarch64/sve/pr99766.C +++ b/gcc/testsuite/g++.target/aarch64/sve/pr99766.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-additional-options "-O3 -march=armv8.2-a+sve" } */ +/* { dg-additional-options "-O3 -march=armv8.2-a+sve -w" } */ typedef float a __attribute__((__mode__(HF))); typedef struct { a b; -- cgit v1.1 From 2923d9e954dd944e88436dc96809449130766ac2 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 26 Jan 2023 15:51:00 +0000 Subject: Update guality XFAILs for aarch64*-*-* As in previous years, this patch updates the list of guality XFAILs for aarch64*-*-*, based this time on an aarch64-linux-gnu target with GDB 12 installed. The justification for XFAILing without specific PRs is that anyone who is interested in improving debug quality can look at the XFAILs in the guality directory, which is more likely to be kept up-to-date than a bugzilla ticket. gcc/testsuite/ * gcc.dg/guality/pr36728-2.c: Update XFAILs for aarch64*-*-*. * gcc.dg/guality/pr54519-1.c: Likewise. * gcc.dg/guality/pr54519-3.c: Likewise. * gcc.dg/guality/pr54693-2.c: Likewise. * gcc.dg/guality/sra-1.c: Likewise. --- gcc/testsuite/gcc.dg/guality/pr36728-2.c | 28 ++++++++++++++-------------- gcc/testsuite/gcc.dg/guality/pr54519-1.c | 6 +++--- gcc/testsuite/gcc.dg/guality/pr54519-3.c | 6 +++--- gcc/testsuite/gcc.dg/guality/pr54693-2.c | 4 ++-- gcc/testsuite/gcc.dg/guality/sra-1.c | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/guality/pr36728-2.c b/gcc/testsuite/gcc.dg/guality/pr36728-2.c index 6e8d775..d670c87 100644 --- a/gcc/testsuite/gcc.dg/guality/pr36728-2.c +++ b/gcc/testsuite/gcc.dg/guality/pr36728-2.c @@ -25,21 +25,21 @@ foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7) and arg2. So it is expected that these values are unavailable in some of these tests. */ -/* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ -/* { dg-final { gdb-test 16 "arg2" "2" { target { ! "s390*-*-*" } xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ -/* { dg-final { gdb-test 16 "arg3" "3" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ -/* { dg-final { gdb-test 16 "arg4" "4" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ -/* { dg-final { gdb-test 16 "arg5" "5" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ -/* { dg-final { gdb-test 16 "arg6" "6" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ -/* { dg-final { gdb-test 16 "arg7" "30" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ +/* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } } } } */ +/* { dg-final { gdb-test 16 "arg2" "2" } } */ +/* { dg-final { gdb-test 16 "arg3" "3" } } */ +/* { dg-final { gdb-test 16 "arg4" "4" } } */ +/* { dg-final { gdb-test 16 "arg5" "5" } } */ +/* { dg-final { gdb-test 16 "arg6" "6" } } */ +/* { dg-final { gdb-test 16 "arg7" "30" } } */ /* { dg-final { gdb-test 16 "y" "2" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ -/* { dg-final { gdb-test 18 "arg1" "1" { target { ! "s390*-*-*" } xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ -/* { dg-final { gdb-test 18 "arg2" "2" { target { ! "s390*-*-*" } xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ -/* { dg-final { gdb-test 18 "arg3" "3" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ -/* { dg-final { gdb-test 18 "arg4" "4" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ -/* { dg-final { gdb-test 18 "arg5" "5" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ -/* { dg-final { gdb-test 18 "arg6" "6" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ -/* { dg-final { gdb-test 18 "arg7" "30" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ +/* { dg-final { gdb-test 18 "arg1" "1" { target { ! "s390*-*-*" } } } } */ +/* { dg-final { gdb-test 18 "arg2" "2" { target { ! "s390*-*-*" } } } } */ +/* { dg-final { gdb-test 18 "arg3" "3" } } */ +/* { dg-final { gdb-test 18 "arg4" "4" } } */ +/* { dg-final { gdb-test 18 "arg5" "5" } } */ +/* { dg-final { gdb-test 18 "arg6" "6" } } */ +/* { dg-final { gdb-test 18 "arg7" "30" } } */ /* { dg-final { gdb-test 18 "*x" "(char) 25" } } */ /* { dg-final { gdb-test 18 "y" "2" } } */ diff --git a/gcc/testsuite/gcc.dg/guality/pr54519-1.c b/gcc/testsuite/gcc.dg/guality/pr54519-1.c index 5880d9b..81703eb 100644 --- a/gcc/testsuite/gcc.dg/guality/pr54519-1.c +++ b/gcc/testsuite/gcc.dg/guality/pr54519-1.c @@ -18,9 +18,9 @@ fn2 (int x, int y, int z) fn1 (x); /* { dg-final { gdb-test .+2 "x" "36" } } */ if (x == 36) /* { dg-final { gdb-test .+1 "y" "25" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ fn1 (x); /* { dg-final { gdb-test . "z" "6" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ - fn1 (x); /* { dg-final { gdb-test .+2 "x" "98" { xfail { aarch64*-*-* && { any-opts "-Os" } } } } } */ - if (x == 98) /* { dg-final { gdb-test .+1 "y" "117" { xfail { aarch64*-*-* && { any-opts "-Os" "-flto" } } } } } */ - fn1 (x); /* { dg-final { gdb-test . "z" "8" { xfail { aarch64*-*-* && { any-opts "-Os" "-flto" } } } } } */ + fn1 (x); /* { dg-final { gdb-test .+2 "x" "98" } } */ + if (x == 98) /* { dg-final { gdb-test .+1 "y" "117" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ + fn1 (x); /* { dg-final { gdb-test . "z" "8" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ fn1 (x); fn1 (x + a); } diff --git a/gcc/testsuite/gcc.dg/guality/pr54519-3.c b/gcc/testsuite/gcc.dg/guality/pr54519-3.c index 9c18993..fabab96 100644 --- a/gcc/testsuite/gcc.dg/guality/pr54519-3.c +++ b/gcc/testsuite/gcc.dg/guality/pr54519-3.c @@ -18,9 +18,9 @@ fn2 (int x, int y, int z) fn1 (x); /* { dg-final { gdb-test .+2 "x" "36" } } */ if (x == 36) /* { dg-final { gdb-test .+1 "y" "25" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ fn1 (x); /* { dg-final { gdb-test . "z" "6" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ - fn1 (x); /* { dg-final { gdb-test .+2 "x" "98" { xfail { aarch64*-*-* && { any-opts "-Os" } } } } } */ - if (x == 98) /* { dg-final { gdb-test .+1 "y" "117" { xfail { aarch64*-*-* && { any-opts "-Os" "-flto" } } } } } */ - fn1 (x); /* { dg-final { gdb-test . "z" "8" { xfail { aarch64*-*-* && { any-opts "-Os" "-flto" } } } } } */ + fn1 (x); /* { dg-final { gdb-test .+2 "x" "98" } } */ + if (x == 98) /* { dg-final { gdb-test .+1 "y" "117" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ + fn1 (x); /* { dg-final { gdb-test . "z" "8" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ fn1 (x); fn1 (x + a); } diff --git a/gcc/testsuite/gcc.dg/guality/pr54693-2.c b/gcc/testsuite/gcc.dg/guality/pr54693-2.c index 68aa6c6..7a0ae73 100644 --- a/gcc/testsuite/gcc.dg/guality/pr54693-2.c +++ b/gcc/testsuite/gcc.dg/guality/pr54693-2.c @@ -17,8 +17,8 @@ foo (int x, int y, int z) int i = 0; while (x > 3 && y > 3 && z > 3) { /* { dg-final { gdb-test .+2 "i" "v + 1" } } */ - /* { dg-final { gdb-test .+1 "x" "10 - i" } } */ - bar (i); /* { dg-final { gdb-test . "y" "20 - 2 * i" } } */ + /* { dg-final { gdb-test .+1 "x" "10 - i" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ + bar (i); /* { dg-final { gdb-test . "y" "20 - 2 * i" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ /* { dg-final { gdb-test .-1 "z" "30 - 3 * i" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-Os" } } } } } */ i++, x--, y -= 2, z -= 3; } diff --git a/gcc/testsuite/gcc.dg/guality/sra-1.c b/gcc/testsuite/gcc.dg/guality/sra-1.c index e9b920e..c0d1cf6 100644 --- a/gcc/testsuite/gcc.dg/guality/sra-1.c +++ b/gcc/testsuite/gcc.dg/guality/sra-1.c @@ -39,7 +39,7 @@ f3 (int k) struct B a = { 4, k + 6 }; asm ("" : "+r" (a.i)); a.j++; - bar (a.i); /* { dg-final { gdb-test .+1 "a.i" "4" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */ + bar (a.i); /* { dg-final { gdb-test .+1 "a.i" "4" { xfail { aarch64*-*-* && { { any-opts "-Og" "-O2" "-O3" } && { ! { any-opts "-fno-fat-lto-objects" } } } } } } } */ bar (a.j); /* { dg-final { gdb-test . "a.j" "14" { xfail { aarch64*-*-* && { any-opts "-Og" "-fno-fat-lto-objects" } } } } } */ return a.i + a.j; } -- cgit v1.1 From 96fbe541481fcc7d1a8884fb8dbefd7979eb9543 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 26 Jan 2023 15:51:00 +0000 Subject: aarch64: Remove expected error for compound literals GCC no longer treats empty compound literals as an error (see 14cfa01755a66afbae2539f8b5796c960ddcecc6). gcc/testsuite/ * gcc.target/aarch64/bfloat16_scalar_typecheck.c: Accept empty compound literals. --- gcc/testsuite/gcc.target/aarch64/bfloat16_scalar_typecheck.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/aarch64/bfloat16_scalar_typecheck.c b/gcc/testsuite/gcc.target/aarch64/bfloat16_scalar_typecheck.c index 7c9188c..f4ae680 100644 --- a/gcc/testsuite/gcc.target/aarch64/bfloat16_scalar_typecheck.c +++ b/gcc/testsuite/gcc.target/aarch64/bfloat16_scalar_typecheck.c @@ -40,7 +40,7 @@ bfloat16_t footest (bfloat16_t scalar0) short initi_1_4 = glob_bfloat; /* { dg-error {invalid conversion from type 'bfloat16_t'} } */ double initi_1_5 = glob_bfloat; /* { dg-error {invalid conversion from type 'bfloat16_t'} } */ - bfloat16_t scalar2_1 = {}; /* { dg-error {empty scalar initializer} } */ + bfloat16_t scalar2_1 = {}; bfloat16_t scalar2_2 = { glob_bfloat }; bfloat16_t scalar2_3 = { 0 }; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */ bfloat16_t scalar2_4 = { 0.1 }; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */ @@ -92,7 +92,7 @@ bfloat16_t footest (bfloat16_t scalar0) /* Compound literals. */ - (bfloat16_t) {}; /* { dg-error {empty scalar initializer} } */ + (bfloat16_t) {}; (bfloat16_t) { glob_bfloat }; (bfloat16_t) { 0 }; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */ (bfloat16_t) { 0.1 }; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */ -- cgit v1.1 From a2dddefeed258119fc24d288b697d58da9e8b7e3 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 26 Jan 2023 16:01:09 +0000 Subject: testsuite: Fix hwasan/arguments-3.c failures This testcase had three dg-error tests for ".*.*". But since . matches \n in Tcl regexps, the first dg-error ate all the output, leaving the other two to fail. The regexp is eventually embedded in a larger one, so we can't prefix it with (?n). But the .*s aren't necessary, since dg-error tests for a partial rather than a full match. gcc/testsuite/ * c-c++-common/hwasan/arguments-3.c: Remove extraneous .*s. --- gcc/testsuite/c-c++-common/hwasan/arguments-3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/c-c++-common/hwasan/arguments-3.c b/gcc/testsuite/c-c++-common/hwasan/arguments-3.c index 2bf8917..6dbec92 100644 --- a/gcc/testsuite/c-c++-common/hwasan/arguments-3.c +++ b/gcc/testsuite/c-c++-common/hwasan/arguments-3.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ /* { dg-additional-options "-fsanitize=thread,address" } */ -/* { dg-error ".*'-fsanitize=thread' is incompatible with '-fsanitize=address'.*" "" { target *-*-* } 0 } */ -/* { dg-error ".*'-fsanitize=thread' is incompatible with '-fsanitize=hwaddress'.*" "" { target *-*-* } 0 } */ -/* { dg-error ".*'-fsanitize=hwaddress' is incompatible with '-fsanitize=address'.*" "" { target *-*-* } 0 } */ +/* { dg-error "'-fsanitize=thread' is incompatible with '-fsanitize=address'" "" { target *-*-* } 0 } */ +/* { dg-error "'-fsanitize=thread' is incompatible with '-fsanitize=hwaddress'" "" { target *-*-* } 0 } */ +/* { dg-error "'-fsanitize=hwaddress' is incompatible with '-fsanitize=address'" "" { target *-*-* } 0 } */ -- cgit v1.1 From 0cdb609f43eb6131053fb88e32fdc5490f4ef293 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 26 Jan 2023 17:20:23 +0100 Subject: value-relation: Small tweaks to tables As I said earlier, all these tables are used solely in value-relation.cc and never modified, plus because VREL_LAST is small especially the two-dimensional arrays are vast a lot of .data (or .rodata) space - 576 bytes each. The following patch makes those arrays static const and uses unsigned char instead of relation_kind so that the two-dimensional arrays shrink to 144 bytes. 2023-01-26 Jakub Jelinek * value-relation.cc (kind_string): Add const. (rr_negate_table, rr_swap_table, rr_intersect_table, rr_union_table, rr_transitive_table): Add static const, change element type from relation_kind to unsigned char. (relation_negate, relation_swap, relation_intersect, relation_union, relation_transitive): Cast rr_*_table element to relation_kind. (relation_to_code): Add static const. (relation_tests): Assert VREL_LAST is smaller than UCHAR_MAX. --- gcc/value-relation.cc | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'gcc') diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc index 6f8a1b7..5ca8a7e 100644 --- a/gcc/value-relation.cc +++ b/gcc/value-relation.cc @@ -32,7 +32,7 @@ along with GCC; see the file COPYING3. If not see #include "alloc-pool.h" #include "dominance.h" -static const char *kind_string[VREL_LAST] = +static const char *const kind_string[VREL_LAST] = { "varying", "undefined", "<", "<=", ">", ">=", "==", "!=", "pe8", "pe16", "pe32", "pe64" }; @@ -45,7 +45,7 @@ print_relation (FILE *f, relation_kind rel) } // This table is used to negate the operands. op1 REL op2 -> !(op1 REL op2). -relation_kind rr_negate_table[VREL_LAST] = { +static const unsigned char rr_negate_table[VREL_LAST] = { VREL_VARYING, VREL_UNDEFINED, VREL_GE, VREL_GT, VREL_LE, VREL_LT, VREL_NE, VREL_EQ }; @@ -54,11 +54,11 @@ relation_kind rr_negate_table[VREL_LAST] = { relation_kind relation_negate (relation_kind r) { - return rr_negate_table [r]; + return relation_kind (rr_negate_table [r]); } // This table is used to swap the operands. op1 REL op2 -> op2 REL op1. -relation_kind rr_swap_table[VREL_LAST] = { +static const unsigned char rr_swap_table[VREL_LAST] = { VREL_VARYING, VREL_UNDEFINED, VREL_GT, VREL_GE, VREL_LT, VREL_LE, VREL_EQ, VREL_NE }; @@ -67,12 +67,12 @@ relation_kind rr_swap_table[VREL_LAST] = { relation_kind relation_swap (relation_kind r) { - return rr_swap_table [r]; + return relation_kind (rr_swap_table [r]); } // This table is used to perform an intersection between 2 relations. -relation_kind rr_intersect_table[VREL_LAST][VREL_LAST] = { +static const unsigned char rr_intersect_table[VREL_LAST][VREL_LAST] = { // VREL_VARYING { VREL_VARYING, VREL_UNDEFINED, VREL_LT, VREL_LE, VREL_GT, VREL_GE, VREL_EQ, VREL_NE }, @@ -104,13 +104,13 @@ relation_kind rr_intersect_table[VREL_LAST][VREL_LAST] = { relation_kind relation_intersect (relation_kind r1, relation_kind r2) { - return rr_intersect_table[r1][r2]; + return relation_kind (rr_intersect_table[r1][r2]); } // This table is used to perform a union between 2 relations. -relation_kind rr_union_table[VREL_LAST][VREL_LAST] = { +static const unsigned char rr_union_table[VREL_LAST][VREL_LAST] = { // VREL_VARYING { VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING }, @@ -141,14 +141,14 @@ relation_kind rr_union_table[VREL_LAST][VREL_LAST] = { relation_kind relation_union (relation_kind r1, relation_kind r2) { - return rr_union_table[r1][r2]; + return relation_kind (rr_union_table[r1][r2]); } // This table is used to determine transitivity between 2 relations. // (A relation0 B) and (B relation1 C) implies (A result C) -relation_kind rr_transitive_table[VREL_LAST][VREL_LAST] = { +static const unsigned char rr_transitive_table[VREL_LAST][VREL_LAST] = { // VREL_VARYING { VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING }, @@ -180,12 +180,12 @@ relation_kind rr_transitive_table[VREL_LAST][VREL_LAST] = { relation_kind relation_transitive (relation_kind r1, relation_kind r2) { - return rr_transitive_table[r1][r2]; + return relation_kind (rr_transitive_table[r1][r2]); } // This vector maps a relation to the equivalent tree code. -tree_code relation_to_code [VREL_LAST] = { +static const tree_code relation_to_code [VREL_LAST] = { ERROR_MARK, ERROR_MARK, LT_EXPR, LE_EXPR, GT_EXPR, GE_EXPR, EQ_EXPR, NE_EXPR }; @@ -1727,6 +1727,8 @@ namespace selftest void relation_tests () { + // rr_*_table tables use unsigned char rather than relation_kind. + ASSERT_LT (VREL_LAST, UCHAR_MAX); // Verify commutativity of relation_intersect and relation_union. for (relation_kind r1 = VREL_VARYING; r1 < VREL_PE8; r1 = relation_kind (r1 + 1)) -- cgit v1.1 From 09176201ec6a21c25b1edb07f19f83be22a123f9 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 26 Jan 2023 17:21:22 +0100 Subject: frange: Fix up foperator_{,not_}equal::fold_range for signed zeros [PR108540] The following testcases are miscompiled, because threader sees some SSA_NAME would have -0.0 value and when computing range of SSA_NAME == 0.0 foperator_equal::fold_range sees one operand has [-0.0, -0.0] singleton range, the other [0.0, 0.0], they aren't equal (frange operator== uses real_identical etc. rather than real comparisons) and so it thinks they compare unequal. With signed zeros -0.0 == 0.0 is true though, so we need to special case the both ranges singleton code. Similarly, if we see op1 range being say [-42.0, -0.0] and op2 range [0.0, 42.0], we'd check that the intersection of the two ranges is empty (that is correct) and fold the result of == between such operands to [0, 0] which is wrong, because -0.0 == 0.0, it needs to be [0, 1]. Similarly for foperator_not_equal::fold_range. 2023-01-26 Jakub Jelinek PR tree-optimization/108540 * range-op-float.cc (foperator_equal::fold_range): If both op1 and op2 are singletons, use range_true even if op1 != op2 when one range is [-0.0, -0.0] and another [0.0, 0.0]. Similarly, even if intersection of the ranges is empty and one has zero low bound and another zero high bound, use range_true_and_false rather than range_false. (foperator_not_equal::fold_range): If both op1 and op2 are singletons, use range_false even if op1 != op2 when one range is [-0.0, -0.0] and another [0.0, 0.0]. Similarly, even if intersection of the ranges is empty and one has zero low bound and another zero high bound, use range_true_and_false rather than range_true. * gcc.c-torture/execute/ieee/pr108540-1.c: New test. * gcc.c-torture/execute/ieee/pr108540-2.c: New test. --- gcc/range-op-float.cc | 40 +++++++++-- .../gcc.c-torture/execute/ieee/pr108540-1.c | 84 ++++++++++++++++++++++ .../gcc.c-torture/execute/ieee/pr108540-2.c | 23 ++++++ 3 files changed, 142 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/pr108540-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/pr108540-2.c (limited to 'gcc') diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 74ac465..2db83ae 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -607,6 +607,10 @@ foperator_equal::fold_range (irange &r, tree type, { if (op1 == op2) r = range_true (type); + // If one operand is -0.0 and other 0.0, they are still equal. + else if (real_iszero (&op1.lower_bound ()) + && real_iszero (&op2.lower_bound ())) + r = range_true (type); else r = range_false (type); } @@ -617,7 +621,18 @@ foperator_equal::fold_range (irange &r, tree type, frange tmp = op1; tmp.intersect (op2); if (tmp.undefined_p ()) - r = range_false (type); + { + // If one range is [whatever, -0.0] and another + // [0.0, whatever2], we don't know anything either, + // because -0.0 == 0.0. + if ((real_iszero (&op1.upper_bound ()) + && real_iszero (&op2.lower_bound ())) + || (real_iszero (&op1.lower_bound ()) + && real_iszero (&op2.upper_bound ()))) + r = range_true_and_false (type); + else + r = range_false (type); + } else r = range_true_and_false (type); } @@ -708,10 +723,14 @@ foperator_not_equal::fold_range (irange &r, tree type, // consist of a single value, and then compare them. else if (op1.singleton_p () && op2.singleton_p ()) { - if (op1 != op2) - r = range_true (type); - else + if (op1 == op2) r = range_false (type); + // If one operand is -0.0 and other 0.0, they are still equal. + else if (real_iszero (&op1.lower_bound ()) + && real_iszero (&op2.lower_bound ())) + r = range_false (type); + else + r = range_true (type); } else if (!maybe_isnan (op1, op2)) { @@ -720,7 +739,18 @@ foperator_not_equal::fold_range (irange &r, tree type, frange tmp = op1; tmp.intersect (op2); if (tmp.undefined_p ()) - r = range_true (type); + { + // If one range is [whatever, -0.0] and another + // [0.0, whatever2], we don't know anything either, + // because -0.0 == 0.0. + if ((real_iszero (&op1.upper_bound ()) + && real_iszero (&op2.lower_bound ())) + || (real_iszero (&op1.lower_bound ()) + && real_iszero (&op2.upper_bound ()))) + r = range_true_and_false (type); + else + r = range_true (type); + } else r = range_true_and_false (type); } diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/pr108540-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/pr108540-1.c new file mode 100644 index 0000000..ebd4c50 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/pr108540-1.c @@ -0,0 +1,84 @@ +/* PR tree-optimization/108540 */ + +__attribute__((noipa)) void +bar (const char *cp, unsigned long size, char sign, int dsgn) +{ + if (__builtin_strcmp (cp, "ZERO") != 0 || size != 4 || sign != '-' || dsgn != 1) + __builtin_abort (); +} + +__attribute__((noipa)) void +foo (int x, int ch, double d) +{ + const char *cp = ""; + unsigned long size = 0; + char sign = '\0'; + switch (x) + { + case 42: + if (__builtin_isinf (d)) + { + if (d < 0) + sign = '-'; + cp = "Inf"; + size = 3; + break; + } + if (__builtin_isnan (d)) + { + cp = "NaN"; + size = 3; + break; + } + if (d < 0) + { + d = -d; + sign = '-'; + } + else if (d == 0.0 && __builtin_signbit (d)) + sign = '-'; + else + sign = '\0'; + if (ch == 'a' || ch == 'A') + { + union U { long long l; double d; } u; + int dsgn; + u.d = d; + if (u.l < 0) + { + dsgn = 1; + u.l &= 0x7fffffffffffffffLL; + } + else + dsgn = 0; + if (__builtin_isinf (d)) + { + cp = "INF"; + size = 3; + } + else if (__builtin_isnan (d)) + { + cp = "NAN"; + size = 3; + } + else if (d == 0) + { + cp = "ZERO"; + size = 4; + } + else + { + cp = "WRONG"; + size = 5; + } + bar (cp, size, sign, dsgn); + } + } +} + +int +main () +{ + foo (42, 'a', -0.0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/pr108540-2.c b/gcc/testsuite/gcc.c-torture/execute/ieee/pr108540-2.c new file mode 100644 index 0000000..f1b13c9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/pr108540-2.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/108540 */ + +__attribute__((noipa)) int +foo (int x, double d) +{ + if (x == 42) + d = -0.0; + if (d == 0.0) + return 42; + return 12; +} + +int +main () +{ + if (foo (42, 5.0) != 42 + || foo (42, 0.0) != 42 + || foo (42, -0.0) != 42 + || foo (10, 5.0) != 12 + || foo (10, 0.0) != 42 + || foo (10, -0.0) != 42) + __builtin_abort (); +} -- cgit v1.1 From 6dd4578f4779b27b2115d78226ff7df46c939061 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Thu, 26 Jan 2023 09:46:32 +0000 Subject: Modula-2: Remove debug code [PR108553]. Remove debugging code accidentally left in place in r13-5373-g80cf2c5e8f496b. Signed-off-by: Iain Sandoe PR modula2/108553 gcc/m2/ChangeLog: * gm2-lang.cc (gm2_langhook_init_options): Remove debug code. --- gcc/m2/gm2-lang.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'gcc') diff --git a/gcc/m2/gm2-lang.cc b/gcc/m2/gm2-lang.cc index 4d9cae2..a30e626 100644 --- a/gcc/m2/gm2-lang.cc +++ b/gcc/m2/gm2-lang.cc @@ -290,12 +290,9 @@ gm2_langhook_init_options (unsigned int decoded_options_count, M2Options_SetVerbose (value); /* FALLTHROUGH */ default: + /* We handled input files above. */ if (code >= N_OPTS) - { - // FIXME remove debug. - fprintf(stderr, "%s : %s\n", opt, (arg ? arg : "")); - break; - } + break; /* Do not pass Modula-2 args to the preprocessor, any that we care about here should already have been handled above. */ if (option->flags & CL_ModulaX2) -- cgit v1.1 From a82ce9c8d155ecda2d1c647d5c588f29e21ef4a3 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 25 Jan 2023 17:19:54 -0500 Subject: opts: SANITIZE_ADDRESS wrongly cleared [PR108543] Here we crash on a null fndecl ultimately because we haven't defined the built-ins described in sanitizer.def. So builtin_decl_explicit (BUILT_IN_ASAN_POINTER_SUBTRACT); returns NULL_TREE, causing an ICE later. DEF_SANITIZER_BUILTIN only actually defines the built-ins when flag_sanitize has SANITIZE_ADDRESS, or some of the other SANITIZE_*, but it doesn't check SANITIZE_KERNEL_ADDRESS or SANITIZE_USER_ADDRESS. Unfortunately, with -fsanitize=address -fno-sanitize=kernel-address or -fsanitize=kernel-address -fno-sanitize=address SANITIZE_ADDRESS ends up being unset from flag_sanitize even though _USER/_KERNEL are set. That's because -fsanitize=address means SANITIZE_ADDRESS | SANITIZE_USER_ADDRESS and -fsanitize=kernel-address is SANITIZE_ADDRESS | SANITIZE_KERNEL_ADDRESS but parse_sanitizer_options does flags &= ~sanitizer_opts[i].flag; so the subsequent -fno- unsets SANITIZE_ADDRESS. Then no sanitizer built-ins are actually defined. I'm not sure why SANITIZE_ADDRESS isn't just SANITIZE_USER_ADDRESS | SANITIZE_KERNEL_ADDRESS, I don't think we need 3 bits. PR middle-end/108543 gcc/ChangeLog: * opts.cc (parse_sanitizer_options): Don't always clear SANITIZE_ADDRESS if it was previously set. gcc/testsuite/ChangeLog: * c-c++-common/asan/pointer-subtract-5.c: New test. * c-c++-common/asan/pointer-subtract-6.c: New test. * c-c++-common/asan/pointer-subtract-7.c: New test. * c-c++-common/asan/pointer-subtract-8.c: New test. --- gcc/opts.cc | 9 ++++++++- gcc/testsuite/c-c++-common/asan/pointer-subtract-5.c | 15 +++++++++++++++ gcc/testsuite/c-c++-common/asan/pointer-subtract-6.c | 15 +++++++++++++++ gcc/testsuite/c-c++-common/asan/pointer-subtract-7.c | 15 +++++++++++++++ gcc/testsuite/c-c++-common/asan/pointer-subtract-8.c | 15 +++++++++++++++ 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/c-c++-common/asan/pointer-subtract-5.c create mode 100644 gcc/testsuite/c-c++-common/asan/pointer-subtract-6.c create mode 100644 gcc/testsuite/c-c++-common/asan/pointer-subtract-7.c create mode 100644 gcc/testsuite/c-c++-common/asan/pointer-subtract-8.c (limited to 'gcc') diff --git a/gcc/opts.cc b/gcc/opts.cc index 9ba47d7..a032cd4 100644 --- a/gcc/opts.cc +++ b/gcc/opts.cc @@ -2246,7 +2246,14 @@ parse_sanitizer_options (const char *p, location_t loc, int scode, flags |= sanitizer_opts[i].flag; } else - flags &= ~sanitizer_opts[i].flag; + { + flags &= ~sanitizer_opts[i].flag; + /* Don't always clear SANITIZE_ADDRESS if it was previously + set: -fsanitize=address -fno-sanitize=kernel-address should + leave SANITIZE_ADDRESS set. */ + if (flags & (SANITIZE_KERNEL_ADDRESS | SANITIZE_USER_ADDRESS)) + flags |= SANITIZE_ADDRESS; + } found = true; break; } diff --git a/gcc/testsuite/c-c++-common/asan/pointer-subtract-5.c b/gcc/testsuite/c-c++-common/asan/pointer-subtract-5.c new file mode 100644 index 0000000..867eda0 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/pointer-subtract-5.c @@ -0,0 +1,15 @@ +/* PR middle-end/108543 */ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=address -fno-sanitize=kernel-address -fsanitize=pointer-subtract" } */ + +struct S { + long _M_p; +}; + +typedef struct S S; + +__PTRDIFF_TYPE__ +f (S __x, S __y) +{ + return &__x._M_p - &__y._M_p; +} diff --git a/gcc/testsuite/c-c++-common/asan/pointer-subtract-6.c b/gcc/testsuite/c-c++-common/asan/pointer-subtract-6.c new file mode 100644 index 0000000..785b90b --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/pointer-subtract-6.c @@ -0,0 +1,15 @@ +/* PR middle-end/108543 */ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=kernel-address -fno-sanitize=address -fsanitize=pointer-subtract" } */ + +struct S { + long _M_p; +}; + +typedef struct S S; + +__PTRDIFF_TYPE__ +f (S __x, S __y) +{ + return &__x._M_p - &__y._M_p; +} diff --git a/gcc/testsuite/c-c++-common/asan/pointer-subtract-7.c b/gcc/testsuite/c-c++-common/asan/pointer-subtract-7.c new file mode 100644 index 0000000..11b6340 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/pointer-subtract-7.c @@ -0,0 +1,15 @@ +/* PR middle-end/108543 */ +/* { dg-do compile } */ +/* { dg-options "-fno-sanitize=kernel-address -fsanitize=address -fsanitize=pointer-subtract" } */ + +struct S { + long _M_p; +}; + +typedef struct S S; + +__PTRDIFF_TYPE__ +f (S __x, S __y) +{ + return &__x._M_p - &__y._M_p; +} diff --git a/gcc/testsuite/c-c++-common/asan/pointer-subtract-8.c b/gcc/testsuite/c-c++-common/asan/pointer-subtract-8.c new file mode 100644 index 0000000..ac2b9c3 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/pointer-subtract-8.c @@ -0,0 +1,15 @@ +/* PR middle-end/108543 */ +/* { dg-do compile } */ +/* { dg-options "-fno-sanitize=address -fsanitize=kernel-address -fsanitize=pointer-subtract" } */ + +struct S { + long _M_p; +}; + +typedef struct S S; + +__PTRDIFF_TYPE__ +f (S __x, S __y) +{ + return &__x._M_p - &__y._M_p; +} -- cgit v1.1 From c8e07c7951421e718bcafbe5924e75c9aa133af9 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Wed, 25 Jan 2023 22:47:26 +0100 Subject: Fortran: fix ICE in check_host_association [PR108544] gcc/fortran/ChangeLog: PR fortran/108544 * resolve.cc (check_host_association): Extend host association check so that it is not restricted to functions. Also prevent NULL pointer dereference. gcc/testsuite/ChangeLog: PR fortran/108544 * gfortran.dg/pr108544.f90: New test. * gfortran.dg/pr96102b.f90: New test. --- gcc/fortran/resolve.cc | 4 +++- gcc/testsuite/gfortran.dg/pr108544.f90 | 11 +++++++++++ gcc/testsuite/gfortran.dg/pr96102b.f90 | 24 ++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr108544.f90 create mode 100644 gcc/testsuite/gfortran.dg/pr96102b.f90 (limited to 'gcc') diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 94213cd..9e2edf7 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -6087,7 +6087,6 @@ check_host_association (gfc_expr *e) gfc_find_symbol (e->symtree->name, gfc_current_ns, 1, &sym); if (sym && old_sym != sym - && sym->ts.type == old_sym->ts.type && sym->attr.flavor == FL_PROCEDURE && sym->attr.contained) { @@ -6132,6 +6131,9 @@ check_host_association (gfc_expr *e) return false; } + if (ref == NULL) + return false; + gcc_assert (ref->type == REF_ARRAY); /* Grab the start expressions from the array ref and diff --git a/gcc/testsuite/gfortran.dg/pr108544.f90 b/gcc/testsuite/gfortran.dg/pr108544.f90 new file mode 100644 index 0000000..783cb7a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr108544.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! PR fortran/108544 - ICE in check_host_association +! Contributed by G.Steinmetz + +module m +contains + subroutine s + select type (s => 1) ! { dg-error "Selector shall be polymorphic" } + end select + end +end diff --git a/gcc/testsuite/gfortran.dg/pr96102b.f90 b/gcc/testsuite/gfortran.dg/pr96102b.f90 new file mode 100644 index 0000000..82147da --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr96102b.f90 @@ -0,0 +1,24 @@ +! { dg-do compile } +! +! PR fortran/108544 - host association +! Variation of testcase pr96102.f90 using subroutines instead of functions + +module m + type mytype + integer :: i + end type + type(mytype) :: d = mytype (42) ! { dg-error "is host associated" } + integer :: n = 2 ! { dg-error "is host associated" } +contains + subroutine s + if ( n /= 0 ) stop 1 ! { dg-error "internal procedure of the same name" } + if ( d%i /= 0 ) stop 2 ! { dg-error "internal procedure of the same name" } + contains + subroutine n() + end + subroutine d() + end + end +end + +! { dg-prune-output "Operands of comparison operator" } -- cgit v1.1 From f91cd98ebc3599d514c42db23606b4b9474ef1fe Mon Sep 17 00:00:00 2001 From: Ju-Zhe Zhong Date: Wed, 28 Dec 2022 13:11:08 +0800 Subject: RISC-V: Fix pointer tree type for store pointer. For store intrinsic, the function type should be void store (T *...) instead of void store (const T *...) gcc/ChangeLog: * config/riscv/riscv-vector-builtins.cc: Change to scalar pointer. --- gcc/config/riscv/riscv-vector-builtins.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/config/riscv/riscv-vector-builtins.cc b/gcc/config/riscv/riscv-vector-builtins.cc index 59d4f2d..d7a9fe4 100644 --- a/gcc/config/riscv/riscv-vector-builtins.cc +++ b/gcc/config/riscv/riscv-vector-builtins.cc @@ -158,7 +158,7 @@ static CONSTEXPR const rvv_arg_type_info scalar_const_ptr_args[] /* A list of args for void func (scalar_type *, vector_type) function. */ static CONSTEXPR const rvv_arg_type_info scalar_ptr_args[] - = {rvv_arg_type_info (RVV_BASE_scalar_const_ptr), + = {rvv_arg_type_info (RVV_BASE_scalar_ptr), rvv_arg_type_info (RVV_BASE_vector), rvv_arg_type_info_end}; /* A list of none preds that will be registered for intrinsic functions. */ -- cgit v1.1 From 856eec0d6b65c7b28b4b6c4fd6ccc10f2f6a22b1 Mon Sep 17 00:00:00 2001 From: Ju-Zhe Zhong Date: Thu, 29 Dec 2022 23:34:02 +0800 Subject: RISC-V: Fix inferior codegen for vse intrinsics. Currently we use pred_mov to to do the codegen for vse intrinsics. However, it generates inferior codegen when I am testing AVL model of VSETVL PASS using vse intrinsics. Consider this following code: void f2 (int * restrict in, int * restrict out, void * restrict mask_in, int n) { vfloat32mf2_t v = __riscv_vle32_v_f32mf2 ((float *)(in + 10000), 19); __riscv_vse32_v_f32mf2 ((float *)(out + 10000), v, 19); vbool64_t mask = *(vbool64_t*)mask_in; for (int i = 0; i < n; i++) { vint16mf2_t v1 = __riscv_vle16_v_i16mf2 ((int16_t *)(in + i + 1), 19); __riscv_vse16_v_i16mf2 ((int16_t *)(out + i + 1), v1, 19); vint32mf2_t v2 = __riscv_vle32_v_i32mf2 ((int32_t *)(in + i + 2), 19); __riscv_vse32_v_i32mf2 ((int32_t *)(out + i + 2), v2, 19); vint32mf2_t v3 = __riscv_vle32_v_i32mf2_tumu (mask, v2, (int32_t *)(in + i + 200), 13); __riscv_vse32_v_i32mf2 ((int32_t *)(out + i + 200), v2, 13); vfloat64m1_t v4 = __riscv_vle64_v_f64m1_m (mask, (double *)(in + i + 300), 11); __riscv_vse64_v_f64m1 ((double *)(out + i + 300), v4, 11); vfloat64m1_t v5 = __riscv_vle64_v_f64m1_tum (mask, v4, (double *)(in + i + 500), 11); __riscv_vse64_v_f64m1 ((double *)(out + i + 500), v5, 11); vfloat64m1_t v6 = __riscv_vle64_v_f64m1_mu (mask, v5, (double *)(in + i + 600), 11); __riscv_vse64_v_f64m1_m (mask, (double *)(out + i + 600), v6, 11); vuint8mf4_t v7 = __riscv_vle8_v_u8mf4 ((uint8_t *)(in + i + 700), 11); __riscv_vse8_v_u8mf4 ((uint8_t *)(out + i + 700), v7, 11); } } Before this patch: csrr t2,vlenb srli t2,t2,1 slli s0,t2,2 vsetvli zero,19,e16,mf2,ta,ma sub s0,s0,t2 csrr t2,vlenb vle16.v v24,0(a3) mv a4,a3 vse16.v v24,0(a1) srli t2,t2,1 add a2,a3,t6 add s0,s0,sp vsetvli zero,19,e32,mf2,ta,ma addi a3,a3,4 vle32.v v24,0(a3) vsetvli zero,t0,e32,mf2,ta,ma vse32.v v24,0(s0) slli s0,t2,2 sub s0,s0,t2 add s0,s0,sp vsetvli t0,zero,e32,mf2,ta,ma vle32.v v24,0(s0) mv s0,t2 slli t2,t2,2 mv a5,a1 vsetvli zero,19,e32,mf2,ta,ma addi a1,a1,4 sub t2,t2,s0 vse32.v v24,0(a1) add t2,t2,sp vsetvli t0,zero,e32,mf2,ta,ma addi t1,a5,796 vle32.v v24,0(t2) addi t5,a4,1196 addi a7,a5,1196 addi t4,a4,1996 addi a6,a5,1996 vsetvli zero,13,e32,mf2,ta,ma add a4,a4,t3 vse32.v v24,0(t1) add a5,a5,t3 vsetvli zero,11,e64,m1,tu,mu vle64.v v24,0(t5),v0.t vse64.v v24,0(a7) vle64.v v24,0(t4),v0.t vse64.v v24,0(a6) vle64.v v24,0(a4),v0.t vse64.v v24,0(a5),v0.t vsetvli zero,11,e8,mf4,ta,ma vle8.v v24,0(a2) vse8.v v24,0(a2) bne a0,a3,.L8 csrr t0,vlenb slli t1,t0,1 add sp,sp,t1 lw s0,12(sp) addi sp,sp,16 jr ra We are generating redundant spilling codes. Here we introduce a dedicated pred_store pattern for vse intrinsics like maskstore in ARM SVE. After this patch: vsetvli zero,19,e16,mf2,ta,ma mv a5,a4 vle16.v v24,0(a0) mv a3,a0 vse16.v 19,0(a4) addi t1,a4,796 vsetvli zero,19,e32,mf2,ta,ma addi a0,a0,4 addi a4,a4,4 vle32.v v24,0(a0) addi t0,a3,1196 vse32.v 19,0(a4) addi a7,a5,1196 addi t6,a3,1996 addi a6,a5,1996 add t5,a3,t4 vsetvli zero,13,e32,mf2,ta,ma add a2,a5,t4 vse32.v 13,0(t1) add a3,a3,t3 vsetvli zero,11,e64,m1,tu,mu add a5,a5,t3 vle64.v v24,0(t0),v0.t vse64.v 11,0(a7) vle64.v v24,0(t6),v0.t vse64.v 11,0(a6) vle64.v v24,0(t5),v0.t vse64.v 11,0(a2),v0.t vsetvli zero,11,e8,mf4,ta,ma vle8.v v24,0(a3) vse8.v 11,0(a5) bne a1,a4,.L8 .L6: ret gcc/ChangeLog: * config/riscv/riscv-vector-builtins-bases.cc (class loadstore): use pred_store for vse. * config/riscv/riscv-vector-builtins.cc (function_expander::add_mem_operand): Refine function. (function_expander::use_contiguous_load_insn): Adjust new implementation. (function_expander::use_contiguous_store_insn): Ditto. * config/riscv/riscv-vector-builtins.h: Refine function. * config/riscv/vector.md (@pred_store): New pattern. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/vse-constraint-1.c: New test. --- gcc/config/riscv/riscv-vector-builtins-bases.cc | 2 +- gcc/config/riscv/riscv-vector-builtins.cc | 22 ++--- gcc/config/riscv/riscv-vector-builtins.h | 8 +- gcc/config/riscv/vector.md | 23 ++++- .../gcc.target/riscv/rvv/base/vse-constraint-1.c | 97 ++++++++++++++++++++++ 5 files changed, 128 insertions(+), 24 deletions(-) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/vse-constraint-1.c (limited to 'gcc') diff --git a/gcc/config/riscv/riscv-vector-builtins-bases.cc b/gcc/config/riscv/riscv-vector-builtins-bases.cc index ee923da..5cd8e4d 100644 --- a/gcc/config/riscv/riscv-vector-builtins-bases.cc +++ b/gcc/config/riscv/riscv-vector-builtins-bases.cc @@ -106,7 +106,7 @@ class loadstore : public function_base rtx expand (function_expander &e) const override { if (STORE_P) - return e.use_contiguous_store_insn (code_for_pred_mov (e.vector_mode ())); + return e.use_contiguous_store_insn (code_for_pred_store (e.vector_mode ())); else return e.use_contiguous_load_insn (code_for_pred_mov (e.vector_mode ())); } diff --git a/gcc/config/riscv/riscv-vector-builtins.cc b/gcc/config/riscv/riscv-vector-builtins.cc index d7a9fe4..4c5ecce 100644 --- a/gcc/config/riscv/riscv-vector-builtins.cc +++ b/gcc/config/riscv/riscv-vector-builtins.cc @@ -845,15 +845,15 @@ function_expander::add_vundef_operand (machine_mode mode) } /* Add a memory operand with mode MODE and address ADDR. */ -rtx -function_expander::add_mem_operand (machine_mode mode, rtx addr) +void +function_expander::add_mem_operand (machine_mode mode, unsigned argno) { gcc_assert (VECTOR_MODE_P (mode)); + rtx addr = expand_normal (CALL_EXPR_ARG (exp, argno)); rtx mem = gen_rtx_MEM (mode, memory_address (mode, addr)); /* The memory is only guaranteed to be element-aligned. */ set_mem_align (mem, GET_MODE_ALIGNMENT (GET_MODE_INNER (mode))); add_fixed_operand (mem); - return mem; } /* Use contiguous load INSN. */ @@ -878,9 +878,7 @@ function_expander::use_contiguous_load_insn (insn_code icode) else add_vundef_operand (mode); - tree addr_arg = CALL_EXPR_ARG (exp, arg_offset++); - rtx addr = expand_normal (addr_arg); - add_mem_operand (mode, addr); + add_mem_operand (mode, arg_offset++); for (int argno = arg_offset; argno < call_expr_nargs (exp); argno++) add_input_operand (argno); @@ -904,27 +902,17 @@ function_expander::use_contiguous_store_insn (insn_code icode) /* Record the offset to get the argument. */ int arg_offset = 0; - int addr_loc = use_real_mask_p (pred) ? 1 : 0; - tree addr_arg = CALL_EXPR_ARG (exp, addr_loc); - rtx addr = expand_normal (addr_arg); - rtx mem = add_mem_operand (mode, addr); + add_mem_operand (mode, use_real_mask_p (pred) ? 1 : 0); if (use_real_mask_p (pred)) add_input_operand (arg_offset++); else add_all_one_mask_operand (mask_mode); - /* To model "+m" constraint, we include memory operand into input. */ - add_input_operand (mode, mem); - arg_offset++; for (int argno = arg_offset; argno < call_expr_nargs (exp); argno++) add_input_operand (argno); - add_input_operand (Pmode, get_tail_policy_for_pred (pred)); - add_input_operand (Pmode, get_mask_policy_for_pred (pred)); - add_input_operand (Pmode, get_avl_type_rtx (avl_type::NONVLMAX)); - return generate_insn (icode); } diff --git a/gcc/config/riscv/riscv-vector-builtins.h b/gcc/config/riscv/riscv-vector-builtins.h index bd33095..fb3f818 100644 --- a/gcc/config/riscv/riscv-vector-builtins.h +++ b/gcc/config/riscv/riscv-vector-builtins.h @@ -317,12 +317,12 @@ public: rtx expand (); void add_input_operand (machine_mode, rtx); - void add_input_operand (unsigned argno); + void add_input_operand (unsigned); void add_output_operand (machine_mode, rtx); - void add_all_one_mask_operand (machine_mode mode); - void add_vundef_operand (machine_mode mode); + void add_all_one_mask_operand (machine_mode); + void add_vundef_operand (machine_mode); void add_fixed_operand (rtx); - rtx add_mem_operand (machine_mode, rtx); + void add_mem_operand (machine_mode, unsigned); machine_mode vector_mode (void) const; diff --git a/gcc/config/riscv/vector.md b/gcc/config/riscv/vector.md index f2b18c1..1ec0a4d 100644 --- a/gcc/config/riscv/vector.md +++ b/gcc/config/riscv/vector.md @@ -209,7 +209,7 @@ ;; The index of operand[] to get the merge op. (define_attr "merge_op_idx" "" - (cond [(eq_attr "type" "vlde,vste,vimov,vfmov,vldm,vstm,vlds,vmalu") + (cond [(eq_attr "type" "vlde,vimov,vfmov,vldm,vstm,vlds,vmalu") (const_int 2)] (const_int INVALID_ATTRIBUTE))) @@ -667,7 +667,7 @@ (reg:SI VL_REGNUM) (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE) (match_operand:V 3 "vector_move_operand" " m, m, vr, vr, viWc0") - (match_operand:V 2 "vector_merge_operand" " 0, vu, vu0, vu0, vu0")))] + (match_operand:V 2 "vector_merge_operand" " 0, vu, vu, vu0, vu0")))] "TARGET_VECTOR" "@ vle.v\t%0,%3%p1 @@ -683,6 +683,25 @@ [(set_attr "type" "vlde,vlde,vste,vimov,vimov") (set_attr "mode" "")]) +;; Dedicated pattern for vse.v instruction since we can't reuse pred_mov pattern to include +;; memory operand as input which will produce inferior codegen. +(define_insn "@pred_store" + [(set (match_operand:V 0 "memory_operand" "+m") + (if_then_else:V + (unspec: + [(match_operand: 1 "vector_mask_operand" "vmWc1") + (match_operand 3 "vector_length_operand" " rK") + (reg:SI VL_REGNUM) + (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE) + (match_operand:V 2 "register_operand" " vr") + (match_dup 0)))] + "TARGET_VECTOR" + "vse.v\t%2,%0%p1" + [(set_attr "type" "vste") + (set_attr "mode" "") + (set (attr "avl_type") (symbol_ref "riscv_vector::NONVLMAX")) + (set_attr "vl_op_idx" "3")]) + ;; vlm.v/vsm.v/vmclr.m/vmset.m. ;; constraint alternative 0 match vlm.v. ;; constraint alternative 1 match vsm.v. diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/vse-constraint-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/vse-constraint-1.c new file mode 100644 index 0000000..5b8b9b4 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/vse-constraint-1.c @@ -0,0 +1,97 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */ + +#include "riscv_vector.h" + +void f (int * restrict in, int * restrict out, void * restrict mask_in, int n) +{ + vfloat32mf2_t v = __riscv_vle32_v_f32mf2 ((float *)(in + 10000), 19); + __riscv_vse32_v_f32mf2 ((float *)(out + 10000), v, 19); + vbool64_t mask = *(vbool64_t*)mask_in; + for (int i = 0; i < n; i++) + { + vint16mf2_t v1 = __riscv_vle16_v_i16mf2 ((int16_t *)(in + i + 1), 19); + __riscv_vse16_v_i16mf2 ((int16_t *)(out + i + 1), v1, 19); + + vint32mf2_t v2 = __riscv_vle32_v_i32mf2 ((int32_t *)(in + i + 2), 19); + __riscv_vse32_v_i32mf2 ((int32_t *)(out + i + 2), v2, 19); + + vint32mf2_t v3 = __riscv_vle32_v_i32mf2_tumu (mask, v2, (int32_t *)(in + i + 200), 13); + __riscv_vse32_v_i32mf2 ((int32_t *)(out + i + 200), v3, 13); + + vfloat64m1_t v4 = __riscv_vle64_v_f64m1_m (mask, (double *)(in + i + 300), 11); + __riscv_vse64_v_f64m1 ((double *)(out + i + 300), v4, 11); + + vfloat64m1_t v5 = __riscv_vle64_v_f64m1_tum (mask, v4, (double *)(in + i + 500), 11); + __riscv_vse64_v_f64m1 ((double *)(out + i + 500), v5, 11); + + vfloat64m1_t v6 = __riscv_vle64_v_f64m1_mu (mask, v5, (double *)(in + i + 600), 11); + __riscv_vse64_v_f64m1_m (mask, (double *)(out + i + 600), v6, 11); + + vuint8mf4_t v7 = __riscv_vle8_v_u8mf4 ((uint8_t *)(in + i + 700), 11); + __riscv_vse8_v_u8mf4 ((uint8_t *)(out + i + 700), v7, 11); + } +} + +void f2 (int * restrict in, int * restrict out, void * restrict mask_in, int n) +{ + vfloat32mf2_t v = __riscv_vle32_v_f32mf2 ((float *)(in + 10000), 19); + __riscv_vse32_v_f32mf2 ((float *)(out + 10000), v, 19); + vbool64_t mask = *(vbool64_t*)mask_in; + for (int i = 0; i < n; i++) + { + vint16mf2_t v1 = __riscv_vle16_v_i16mf2 ((int16_t *)(in + i + 1), 19); + __riscv_vse16_v_i16mf2 ((int16_t *)(out + i + 1), v1, 19); + + vint32mf2_t v2 = __riscv_vle32_v_i32mf2 ((int32_t *)(in + i + 2), 19); + __riscv_vse32_v_i32mf2 ((int32_t *)(out + i + 2), v2, 19); + + vint32mf2_t v3 = __riscv_vle32_v_i32mf2_tumu (mask, v2, (int32_t *)(in + i + 200), 13); + __riscv_vse32_v_i32mf2 ((int32_t *)(out + i + 200), v2, 13); + + vfloat64m1_t v4 = __riscv_vle64_v_f64m1_m (mask, (double *)(in + i + 300), 11); + __riscv_vse64_v_f64m1 ((double *)(out + i + 300), v4, 11); + + vfloat64m1_t v5 = __riscv_vle64_v_f64m1_tum (mask, v4, (double *)(in + i + 500), 11); + __riscv_vse64_v_f64m1 ((double *)(out + i + 500), v5, 11); + + vfloat64m1_t v6 = __riscv_vle64_v_f64m1_mu (mask, v5, (double *)(in + i + 600), 11); + __riscv_vse64_v_f64m1_m (mask, (double *)(out + i + 600), v6, 11); + + vuint8mf4_t v7 = __riscv_vle8_v_u8mf4 ((uint8_t *)(in + i + 700), 11); + __riscv_vse8_v_u8mf4 ((uint8_t *)(out + i + 700), v7, 11); + } +} + +void f3 (int * restrict in, int * restrict out, void * restrict mask_in, int n) +{ + vfloat32mf2_t v = __riscv_vle32_v_f32mf2 ((float *)(in + 10000), 19); + __riscv_vse32_v_f32mf2 ((float *)(out + 10000), v, 19); + vbool64_t mask = *(vbool64_t*)mask_in; + for (int i = 0; i < n; i++) + { + vint16mf2_t v1 = __riscv_vle16_v_i16mf2 ((int16_t *)(in + i + 1), 19); + __riscv_vse16_v_i16mf2 ((int16_t *)(out + i + 1), v1, 19); + + vint32mf2_t v2 = __riscv_vle32_v_i32mf2 ((int32_t *)(in + i + 2), 19); + __riscv_vse32_v_i32mf2 ((int32_t *)(out + i + 2), v2, 19); + + vint32mf2_t v3 = __riscv_vle32_v_i32mf2_tumu (mask, v2, (int32_t *)(in + i + 200), 13); + *(vint32mf2_t*)(out + i + 200) = v3; + + vfloat64m1_t v4 = __riscv_vle64_v_f64m1_m (mask, (double *)(in + i + 300), 11); + __riscv_vse64_v_f64m1 ((double *)(out + i + 300), v4, 11); + + vfloat64m1_t v5 = __riscv_vle64_v_f64m1_tum (mask, v4, (double *)(in + i + 500), 11); + __riscv_vse64_v_f64m1 ((double *)(out + i + 500), v5, 11); + + vfloat64m1_t v6 = __riscv_vle64_v_f64m1_mu (mask, v5, (double *)(in + i + 600), 11); + __riscv_vse64_v_f64m1_m (mask, (double *)(out + i + 600), v6, 11); + + vuint8mf4_t v7 = __riscv_vle8_v_u8mf4 ((uint8_t *)(in + i + 700), 11); + __riscv_vse8_v_u8mf4 ((uint8_t *)(out + i + 700), v7, 11); + } +} + +/* It should not have redundant vector register spills which produce csrr vlenb instructions allocate stack. */ +/* { dg-final { scan-assembler-not {csrr\s+[a-x0-9]+,\s*vlenb} } } */ -- cgit v1.1 From 91a41201b5cea1d72cd84e0e8751289774fcba42 Mon Sep 17 00:00:00 2001 From: Ju-Zhe Zhong Date: Tue, 3 Jan 2023 09:39:57 +0800 Subject: RISC-V: Fix vsetivli instruction asm for IMM AVL Notice that we should used vsetivli zero,4 instead of vsetvli zero,4 for IMM AVL (0 ~ 31) according to RVV ISA. This patch fix vsetivli instruction asm bug. gcc/ChangeLog: * config/riscv/vector.md: gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/vle-constraint-1.c: --- gcc/config/riscv/vector.md | 2 +- gcc/testsuite/gcc.target/riscv/rvv/base/vle-constraint-1.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'gcc') diff --git a/gcc/config/riscv/vector.md b/gcc/config/riscv/vector.md index 1ec0a4d..83bc1ab 100644 --- a/gcc/config/riscv/vector.md +++ b/gcc/config/riscv/vector.md @@ -581,7 +581,7 @@ (match_operand 3 "const_int_operand" "i") (match_operand 4 "const_int_operand" "i")] UNSPEC_VSETVL))] "TARGET_VECTOR" - "vsetvli\tzero,%0,e%1,%m2,t%p3,m%p4" + "vset%i0vli\tzero,%0,e%1,%m2,t%p3,m%p4" [(set_attr "type" "vsetvl") (set_attr "mode" "")]) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/vle-constraint-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/vle-constraint-1.c index b7cf98b..8d01e20 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/vle-constraint-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/vle-constraint-1.c @@ -6,7 +6,7 @@ /* ** f1: -** vsetvli\tzero,4,e32,m1,tu,ma +** vsetivli\tzero,4,e32,m1,tu,ma ** vle32\.v\tv[0-9]+,0\([a-x0-9]+\) ** vle32\.v\tv[0-9]+,0\([a-x0-9]+\) ** vse32\.v\tv[0-9]+,0\([a-x0-9]+\) @@ -23,7 +23,7 @@ void f1 (float * in, float *out) ** f2: ** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma ** vlm.v\tv[0-9]+,0\([a-x0-9]+\) -** vsetvli\tzero,4,e32,m1,ta,ma +** vsetivli\tzero,4,e32,m1,ta,ma ** vle32.v\tv[0-9]+,0\([a-x0-9]+\),v0.t ** vse32.v\tv[0-9]+,0\([a-x0-9]+\) ** ret @@ -41,7 +41,7 @@ void f2 (float * in, float *out) ** f3: ** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma ** vlm.v\tv[0-9]+,0\([a-x0-9]+\) -** vsetvli\tzero,4,e32,m1,tu,mu +** vsetivli\tzero,4,e32,m1,tu,mu ** vle32\.v\tv[0-9]+,0\([a-x0-9]+\) ** vle32.v\tv[0-9]+,0\([a-x0-9]+\),v0.t ** vse32.v\tv[0-9]+,0\([a-x0-9]+\) @@ -58,7 +58,7 @@ void f3 (float * in, float *out) /* ** f4: -** vsetvli\tzero,4,e8,mf8,tu,ma +** vsetivli\tzero,4,e8,mf8,tu,ma ** vle8\.v\tv[0-9]+,0\([a-x0-9]+\) ** vle8\.v\tv[0-9]+,0\([a-x0-9]+\) ** vse8\.v\tv[0-9]+,0\([a-x0-9]+\) @@ -75,7 +75,7 @@ void f4 (int8_t * in, int8_t *out) ** f5: ** vsetvli\t[a-x0-9]+,zero,e8,mf8,ta,ma ** vlm.v\tv[0-9]+,0\([a-x0-9]+\) -** vsetvli\tzero,4,e8,mf8,ta,ma +** vsetivli\tzero,4,e8,mf8,ta,ma ** vle8.v\tv[0-9]+,0\([a-x0-9]+\),v0.t ** vse8.v\tv[0-9]+,0\([a-x0-9]+\) ** ret @@ -93,7 +93,7 @@ void f5 (int8_t * in, int8_t *out) ** f6: ** vsetvli\t[a-x0-9]+,zero,e8,mf8,ta,ma ** vlm.v\tv[0-9]+,0\([a-x0-9]+\) -** vsetvli\tzero,4,e8,mf8,tu,mu +** vsetivli\tzero,4,e8,mf8,tu,mu ** vle8\.v\tv[0-9]+,0\([a-x0-9]+\) ** vle8.v\tv[0-9]+,0\([a-x0-9]+\),v0.t ** vse8.v\tv[0-9]+,0\([a-x0-9]+\) -- cgit v1.1 From 005fad9d251b7ce6c009b646e213fbbf8d43a02b Mon Sep 17 00:00:00 2001 From: Ju-Zhe Zhong Date: Tue, 3 Jan 2023 14:55:30 +0800 Subject: RISC-V: Fix bugs for refine vsetvl a5, zero into vsetvl zero, zero incorrectly Currently we support this optimization: bb 0: vsetvli a5,zero,e32,mf2 bb 1: vsetvli a5,zero,e64,m1 --> vsetvli zero,zero,e64,m1 According RVV ISA, we can do this optimization only if both RATIO and AVL are equal. However, current VSETVL PASS missed the check of AVL. This patch add this condition check to fix bugs. gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (vector_infos_manager::all_same_avl_p): New function. (pass_vsetvl::can_refine_vsetvl_p): Add AVL check. (pass_vsetvl::commit_vsetvls): Ditto. * config/riscv/riscv-vsetvl.h: New function declaration. --- gcc/config/riscv/riscv-vsetvl.cc | 35 +++++++++++++++++++++++++++++++---- gcc/config/riscv/riscv-vsetvl.h | 3 +++ 2 files changed, 34 insertions(+), 4 deletions(-) (limited to 'gcc') diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 0f2cdff..3b84db3 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -1440,6 +1440,29 @@ vector_infos_manager::all_same_ratio_p (sbitmap bitdata) const return true; } +bool +vector_infos_manager::all_same_avl_p (const basic_block cfg_bb, + sbitmap bitdata) const +{ + if (bitmap_empty_p (bitdata)) + return false; + + const auto &block_info = vector_block_infos[cfg_bb->index]; + if (!block_info.local_dem.demand_p (DEMAND_AVL)) + return true; + + avl_info avl = block_info.local_dem.get_avl_info (); + unsigned int bb_index; + sbitmap_iterator sbi; + + EXECUTE_IF_SET_IN_BITMAP (bitdata, 0, bb_index, sbi) + { + if (vector_exprs[bb_index]->get_avl_info () != avl) + return false; + } + return true; +} + size_t vector_infos_manager::expr_set_num (sbitmap bitdata) const { @@ -2111,6 +2134,10 @@ pass_vsetvl::can_refine_vsetvl_p (const basic_block cfg_bb, uint8_t ratio) const m_vector_manager->vector_avin[cfg_bb->index])) return false; + if (!m_vector_manager->all_same_avl_p ( + cfg_bb, m_vector_manager->vector_avin[cfg_bb->index])) + return false; + size_t expr_id = bitmap_first_set_bit (m_vector_manager->vector_avin[cfg_bb->index]); if (m_vector_manager->vector_exprs[expr_id]->get_ratio () != ratio) @@ -2225,11 +2252,11 @@ pass_vsetvl::commit_vsetvls (void) insn_info *insn = require->get_insn (); vector_insn_info prev_info = vector_insn_info (); - if (m_vector_manager->all_same_ratio_p ( - m_vector_manager->vector_avout[eg->src->index])) + sbitmap bitdata = m_vector_manager->vector_avout[eg->src->index]; + if (m_vector_manager->all_same_ratio_p (bitdata) + && m_vector_manager->all_same_avl_p (eg->dest, bitdata)) { - size_t first = bitmap_first_set_bit ( - m_vector_manager->vector_avout[eg->src->index]); + size_t first = bitmap_first_set_bit (bitdata); prev_info = *m_vector_manager->vector_exprs[first]; } diff --git a/gcc/config/riscv/riscv-vsetvl.h b/gcc/config/riscv/riscv-vsetvl.h index dfe54d3..f05b166 100644 --- a/gcc/config/riscv/riscv-vsetvl.h +++ b/gcc/config/riscv/riscv-vsetvl.h @@ -333,6 +333,9 @@ public: /* Get all relaxer expression id for corresponding vector info. */ auto_vec get_all_available_exprs (const vector_insn_info &) const; + /* Return true if all expression set in bitmap are same AVL. */ + bool all_same_avl_p (const basic_block, sbitmap) const; + /* Return true if all expression set in bitmap are same ratio. */ bool all_same_ratio_p (sbitmap) const; -- cgit v1.1 From 011ba384b343e99bb86eb3ac86c7628c4cd98f8b Mon Sep 17 00:00:00 2001 From: Ju-Zhe Zhong Date: Tue, 3 Jan 2023 15:11:59 +0800 Subject: RISC-V: Fix wrong in_group flag in validate_change call function Since we only change insn which is not in group. The flag currently is not correct. gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (change_insn): Adjust in_group in validate_change. --- gcc/config/riscv/riscv-vsetvl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 3b84db3..7933644 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -787,7 +787,7 @@ change_insn (rtx_insn *rinsn, rtx new_pat) print_rtl_single (dump_file, PATTERN (rinsn)); } - validate_change (rinsn, &PATTERN (rinsn), new_pat, true); + validate_change (rinsn, &PATTERN (rinsn), new_pat, false); if (dump_file) { -- cgit v1.1 From 8d8cc482ea49fd6fed81b47c948263fd82a1936b Mon Sep 17 00:00:00 2001 From: Ju-Zhe Zhong Date: Tue, 3 Jan 2023 15:16:41 +0800 Subject: RISC-V: Fix backward_propagate_worthwhile_p gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (loop_basic_block_p): Adjust function. (backward_propagate_worthwhile_p): Fix non-worthwhile. --- gcc/config/riscv/riscv-vsetvl.cc | 91 +++++++++++++++++++++++++++++++--------- 1 file changed, 71 insertions(+), 20 deletions(-) (limited to 'gcc') diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 7933644..4d0e97d 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -116,10 +116,27 @@ vlmax_avl_insn_p (rtx_insn *rinsn) || INSN_CODE (rinsn) == CODE_FOR_vlmax_avldi); } +/* Return true if the block is a loop itself: + local_dem + __________ + ____|____ | + | | | + |________| | + |_________| + reaching_out +*/ static bool loop_basic_block_p (const basic_block cfg_bb) { - return JUMP_P (BB_END (cfg_bb)) && any_condjump_p (BB_END (cfg_bb)); + if (JUMP_P (BB_END (cfg_bb)) && any_condjump_p (BB_END (cfg_bb))) + { + edge e; + edge_iterator ei; + FOR_EACH_EDGE (e, ei, cfg_bb->succs) + if (e->dest->index == cfg_bb->index) + return true; + } + return false; } /* Return true if it is an RVV instruction depends on VTYPE global @@ -271,26 +288,60 @@ backward_propagate_worthwhile_p (const basic_block cfg_bb, { if (loop_basic_block_p (cfg_bb)) { - if (block_info.local_dem.compatible_p (block_info.reaching_out)) - return true; - - /* There is a obvious case that is not worthwhile and meaningless - to propagate the demand information: - local_dem - __________ - ____|____ | - | | | - |________| | - |_________| - reaching_out - Header is incompatible with reaching_out and the block is loop itself, - we don't backward propagate the local_dem since we can't avoid emit - vsetvl for the local_dem. */ - edge e; - edge_iterator ei; - FOR_EACH_EDGE (e, ei, cfg_bb->succs) - if (e->dest->index == cfg_bb->index) + if (block_info.reaching_out.valid_or_dirty_p ()) + { + if (block_info.local_dem.compatible_p (block_info.reaching_out)) + { + /* Case 1 (Can backward propagate): + .... + bb0: + ... + for (int i = 0; i < n; i++) + { + vint16mf4_t v = __riscv_vle16_v_i16mf4 (in + i + 5, 7); + __riscv_vse16_v_i16mf4 (out + i + 5, v, 7); + } + The local_dem is compatible with reaching_out. Such case is + worthwhile backward propagation. */ + return true; + } + else + { + /* Case 2 (Don't backward propagate): + .... + bb0: + ... + for (int i = 0; i < n; i++) + { + vint16mf4_t v = __riscv_vle16_v_i16mf4 (in + i + 5, 7); + __riscv_vse16_v_i16mf4 (out + i + 5, v, 7); + vint16mf2_t v2 = __riscv_vle16_v_i16mf2 (in + i + 6, 8); + __riscv_vse16_v_i16mf2 (out + i + 6, v, 8); + } + The local_dem is incompatible with reaching_out. + It makes no sense to backward propagate the local_dem since we + can't avoid VSETVL inside the loop. */ + return false; + } + } + else + { + gcc_assert (block_info.reaching_out.unknown_p ()); + /* Case 3 (Don't backward propagate): + .... + bb0: + ... + for (int i = 0; i < n; i++) + { + vint16mf4_t v = __riscv_vle16_v_i16mf4 (in + i + 5, 7); + __riscv_vse16_v_i16mf4 (out + i + 5, v, 7); + fn3 (); + } + The local_dem is VALID, but the reaching_out is UNKNOWN. + It makes no sense to backward propagate the local_dem since we + can't avoid VSETVL inside the loop. */ return false; + } } return true; -- cgit v1.1 From aef20243b842284587023306e922e483b2401f34 Mon Sep 17 00:00:00 2001 From: Ju-Zhe Zhong Date: Tue, 3 Jan 2023 15:24:36 +0800 Subject: RISC-V: Simplify codes of changing vsetvl instruction This patch is NFC patch. I move these code as a function since we will reuse it in the following patch (Refine phase 3 of VSETVL PASS) gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (change_vsetvl_insn): New function. (pass_vsetvl::compute_global_backward_infos): Simplify codes. --- gcc/config/riscv/riscv-vsetvl.cc | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'gcc') diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 4d0e97d..f6f24f7 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -880,6 +880,25 @@ change_insn (function_info *ssa, insn_change change, insn_info *insn, return true; } +static void +change_vsetvl_insn (const insn_info *insn, const vector_insn_info &info) +{ + rtx_insn *rinsn; + if (vector_config_insn_p (insn->rtl ())) + { + rinsn = insn->rtl (); + gcc_assert (vsetvl_insn_p (rinsn) && "Can't handle X0, rs1 vsetvli yet"); + } + else + { + gcc_assert (has_vtype_op (insn->rtl ())); + rinsn = PREV_INSN (insn->rtl ()); + gcc_assert (vector_config_insn_p (rinsn)); + } + rtx new_pat = gen_vsetvl_pat (rinsn, info); + change_insn (rinsn, new_pat); +} + avl_info::avl_info (const avl_info &other) { m_value = other.get_value (); @@ -1941,7 +1960,6 @@ pass_vsetvl::compute_global_backward_infos (void) /* Backward propagate to each predecessor. */ FOR_EACH_EDGE (e, ei, cfg_bb->preds) { - rtx new_pat; auto &block_info = m_vector_manager->vector_block_infos[e->src->index]; @@ -2011,21 +2029,7 @@ pass_vsetvl::compute_global_backward_infos (void) be_merged = block_info.local_dem; vector_insn_info new_info = be_merged.merge (prop, true); - rtx_insn *rinsn; - if (vector_config_insn_p (new_info.get_insn ()->rtl ())) - { - rinsn = new_info.get_insn ()->rtl (); - gcc_assert (vsetvl_insn_p (rinsn) - && "Can't handle X0, rs1 vsetvli yet"); - } - else - { - gcc_assert (has_vtype_op (new_info.get_insn ()->rtl ())); - rinsn = PREV_INSN (new_info.get_insn ()->rtl ()); - gcc_assert (vector_config_insn_p (rinsn)); - } - new_pat = gen_vsetvl_pat (rinsn, new_info); - change_insn (rinsn, new_pat); + change_vsetvl_insn (new_info.get_insn (), new_info); if (block_info.local_dem == block_info.reaching_out) block_info.local_dem = new_info; block_info.reaching_out = new_info; -- cgit v1.1 From cca9c44eca42d71ef20fc00a261616ba66edd089 Mon Sep 17 00:00:00 2001 From: Ju-Zhe Zhong Date: Tue, 3 Jan 2023 15:30:30 +0800 Subject: RISC-V: Fix bugs of available condition. Suppose there are 2 demand infos: Demand 1: demand TAIL. Demand 2: not demand TAIL. If a block is demand 1, we should adjust this block is available both for demand 1 && 2. However, if a block is demand 2, we should only adjust this block is available for demand 2 only. gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (vector_insn_info::operator>=): Fix available condition. --- gcc/config/riscv/riscv-vsetvl.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'gcc') diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index f6f24f7..7e292f0 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -1048,12 +1048,10 @@ vector_insn_info::operator>= (const vector_insn_info &other) const } } - if (demand_p (DEMAND_TAIL_POLICY) && !other.demand_p (DEMAND_TAIL_POLICY) - && get_ta () != other.get_ta ()) + if (!demand_p (DEMAND_TAIL_POLICY) && other.demand_p (DEMAND_TAIL_POLICY)) return false; - if (demand_p (DEMAND_MASK_POLICY) && !other.demand_p (DEMAND_MASK_POLICY) - && get_ma () != other.get_ma ()) + if (!demand_p (DEMAND_MASK_POLICY) && other.demand_p (DEMAND_MASK_POLICY)) return false; return true; -- cgit v1.1 From 387cd9d37950a93225f19bc4054e45638dd7d29a Mon Sep 17 00:00:00 2001 From: Ju-Zhe Zhong Date: Wed, 4 Jan 2023 21:45:26 +0800 Subject: RISC-V: Refine Phase 3 of VSETVL PASS gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (can_backward_propagate_p): Fix for null iter_bb. (vector_insn_info::set_demand_info): New function. (pass_vsetvl::emit_local_forward_vsetvls): Adjust for refinement of Phase 3. (pass_vsetvl::merge_successors): Ditto. (pass_vsetvl::compute_global_backward_infos): Ditto. (pass_vsetvl::backward_demand_fusion): Ditto. (pass_vsetvl::forward_demand_fusion): Ditto. (pass_vsetvl::demand_fusion): New function. (pass_vsetvl::lazy_vsetvl): Adjust for refinement of phase 3. * config/riscv/riscv-vsetvl.h: New function declaration. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-27.c: Update testcase. * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-28.c: Ditto. * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-45.c: Ditto. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-25.c: Ditto. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-26.c: Ditto. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-27.c: Ditto. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-28.c: Ditto. * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-3.c: Ditto. * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-7.c: Ditto. * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-12.c: Ditto. --- gcc/config/riscv/riscv-vsetvl.cc | 137 +++++++++++++++++++-- gcc/config/riscv/riscv-vsetvl.h | 1 + .../riscv/rvv/vsetvl/vlmax_back_prop-27.c | 4 +- .../riscv/rvv/vsetvl/vlmax_back_prop-28.c | 4 +- .../riscv/rvv/vsetvl/vlmax_back_prop-45.c | 2 +- .../gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-25.c | 14 +-- .../gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-26.c | 12 +- .../gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-27.c | 12 +- .../gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-28.c | 2 +- .../gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-3.c | 2 +- .../gcc.target/riscv/rvv/vsetvl/vlmax_conflict-7.c | 1 - .../riscv/rvv/vsetvl/vlmax_switch_vtype-12.c | 2 +- 12 files changed, 155 insertions(+), 38 deletions(-) (limited to 'gcc') diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 7e292f0..9ed081d 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -43,7 +43,8 @@ along with GCC; see the file COPYING3. If not see - Phase 2 - Emit vsetvl instructions within each basic block according to demand, compute and save ANTLOC && AVLOC of each block. - - Phase 3 - Backward demanded info propagation and fusion across blocks. + - Phase 3 - Backward && forward demanded info propagation and fusion across + blocks. - Phase 4 - Lazy code motion including: compute local properties, pre_edge_lcm and vsetvl insertion && delete edges for LCM results. @@ -434,8 +435,12 @@ can_backward_propagate_p (const function_info *ssa, const basic_block cfg_bb, set_info *ultimate_def = look_through_degenerate_phi (set); const basic_block ultimate_bb = ultimate_def->bb ()->cfg_bb (); FOR_BB_BETWEEN (iter_bb, ultimate_bb, def->bb ()->cfg_bb (), next_bb) - if (iter_bb->index == cfg_bb->index) - return true; + { + if (!iter_bb) + break; + if (iter_bb->index == cfg_bb->index) + return true; + } return false; }; @@ -1173,6 +1178,19 @@ vector_insn_info::parse_insn (insn_info *insn) } void +vector_insn_info::set_demand_info (const vector_insn_info &other) +{ + set_sew (other.get_sew ()); + set_vlmul (other.get_vlmul ()); + set_ratio (other.get_ratio ()); + set_ta (other.get_ta ()); + set_ma (other.get_ma ()); + set_avl_info (other.get_avl_info ()); + for (size_t i = 0; i < NUM_DEMAND; i++) + m_demands[i] = other.demand_p ((enum demand_type) i); +} + +void vector_insn_info::demand_vl_vtype () { m_state = VALID; @@ -1691,8 +1709,10 @@ private: void emit_local_forward_vsetvls (const bb_info *); /* Phase 3. */ - void merge_successors (const basic_block, const basic_block); - void compute_global_backward_infos (void); + bool merge_successors (const basic_block, const basic_block); + bool backward_demand_fusion (void); + bool forward_demand_fusion (void); + void demand_fusion (void); /* Phase 4. */ void prune_expressions (void); @@ -1866,7 +1886,7 @@ pass_vsetvl::emit_local_forward_vsetvls (const bb_info *bb) } /* Merge all successors of Father except child node. */ -void +bool pass_vsetvl::merge_successors (const basic_block father, const basic_block child) { @@ -1878,6 +1898,7 @@ pass_vsetvl::merge_successors (const basic_block father, gcc_assert (father_info.reaching_out.dirty_p () || father_info.reaching_out.empty_p ()); + bool changed_p = false; FOR_EACH_EDGE (e, ei, father->succs) { const basic_block succ = e->dest; @@ -1907,12 +1928,15 @@ pass_vsetvl::merge_successors (const basic_block father, father_info.local_dem = new_info; father_info.reaching_out = new_info; + changed_p = true; } + + return changed_p; } /* Compute global backward demanded info. */ -void -pass_vsetvl::compute_global_backward_infos (void) +bool +pass_vsetvl::backward_demand_fusion (void) { /* We compute global infos by backward propagation. We want to have better performance in these following cases: @@ -1939,6 +1963,7 @@ pass_vsetvl::compute_global_backward_infos (void) We backward propagate the first VSETVL into e32,mf2 so that we could be able to eliminate the second VSETVL in LCM. */ + bool changed_p = false; for (const bb_info *bb : crtl->ssa->reverse_bbs ()) { basic_block cfg_bb = bb->cfg_bb (); @@ -1982,9 +2007,10 @@ pass_vsetvl::compute_global_backward_infos (void) block_info.reaching_out.set_dirty (); block_info.reaching_out.set_dirty_pat (new_pat); block_info.local_dem = block_info.reaching_out; + changed_p = true; } - merge_successors (e->src, cfg_bb); + changed_p |= merge_successors (e->src, cfg_bb); } else if (block_info.reaching_out.dirty_p ()) { @@ -2011,6 +2037,7 @@ pass_vsetvl::compute_global_backward_infos (void) new_info.set_dirty_pat (new_pat); block_info.local_dem = new_info; block_info.reaching_out = new_info; + changed_p = true; } else { @@ -2031,9 +2058,99 @@ pass_vsetvl::compute_global_backward_infos (void) if (block_info.local_dem == block_info.reaching_out) block_info.local_dem = new_info; block_info.reaching_out = new_info; + changed_p = true; } } } + return changed_p; +} + +/* Compute global forward demanded info. */ +bool +pass_vsetvl::forward_demand_fusion (void) +{ + /* Enhance the global information propagation especially + backward propagation miss the propagation. + Consider such case: + + bb0 + (TU) + / \ + bb1 bb2 + (TU) (ANY) + existing edge -----> \ / (TU) <----- LCM create this edge. + bb3 + (TU) + + Base on the situation, LCM fails to eliminate the VSETVL instruction and + insert an edge from bb2 to bb3 since we can't backward propagate bb3 into + bb2. To avoid this confusing LCM result and non-optimal codegen, we should + forward propagate information from bb0 to bb2 which is friendly to LCM. */ + bool changed_p = false; + for (const bb_info *bb : crtl->ssa->bbs ()) + { + basic_block cfg_bb = bb->cfg_bb (); + const auto &prop + = m_vector_manager->vector_block_infos[cfg_bb->index].reaching_out; + + /* If there is nothing to propagate, just skip it. */ + if (!prop.valid_or_dirty_p ()) + continue; + + edge e; + edge_iterator ei; + /* Forward propagate to each successor. */ + FOR_EACH_EDGE (e, ei, cfg_bb->succs) + { + auto &local_dem + = m_vector_manager->vector_block_infos[e->dest->index].local_dem; + auto &reaching_out + = m_vector_manager->vector_block_infos[e->dest->index].reaching_out; + + /* It's quite obvious, we don't need to propagate itself. */ + if (e->dest->index == cfg_bb->index) + continue; + + /* If there is nothing to propagate, just skip it. */ + if (!local_dem.valid_or_dirty_p ()) + continue; + + if (prop > local_dem) + { + if (local_dem.dirty_p ()) + { + gcc_assert (local_dem == reaching_out); + rtx dirty_pat + = gen_vsetvl_pat (prop.get_insn ()->rtl (), prop); + local_dem = prop; + local_dem.set_dirty (); + local_dem.set_dirty_pat (dirty_pat); + reaching_out = local_dem; + } + else + { + if (reaching_out == local_dem) + reaching_out.set_demand_info (prop); + local_dem.set_demand_info (prop); + change_vsetvl_insn (local_dem.get_insn (), prop); + } + changed_p = true; + } + } + } + return changed_p; +} + +void +pass_vsetvl::demand_fusion (void) +{ + bool changed_p = true; + while (changed_p) + { + changed_p = false; + changed_p |= backward_demand_fusion (); + changed_p |= forward_demand_fusion (); + } if (dump_file) { @@ -2517,7 +2634,7 @@ pass_vsetvl::lazy_vsetvl (void) /* Phase 3 - Propagate demanded info across blocks. */ if (dump_file) fprintf (dump_file, "\nPhase 3: Demands propagation across blocks\n"); - compute_global_backward_infos (); + demand_fusion (); if (dump_file) m_vector_manager->dump (dump_file); diff --git a/gcc/config/riscv/riscv-vsetvl.h b/gcc/config/riscv/riscv-vsetvl.h index f05b166..72a0228 100644 --- a/gcc/config/riscv/riscv-vsetvl.h +++ b/gcc/config/riscv/riscv-vsetvl.h @@ -273,6 +273,7 @@ public: void set_dirty () { m_state = DIRTY; } void set_dirty_pat (rtx pat) { m_dirty_pat = pat; } void set_insn (rtl_ssa::insn_info *insn) { m_insn = insn; } + void set_demand_info (const vector_insn_info &); bool demand_p (enum demand_type type) const { return m_demands[type]; } void demand (enum demand_type type) { m_demands[type] = true; } diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-27.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-27.c index e148a1c..52e16d6 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-27.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-27.c @@ -38,7 +38,7 @@ void f (void * restrict in, void * restrict out, void * restrict in2, void * res } } -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ @@ -48,4 +48,4 @@ void f (void * restrict in, void * restrict out, void * restrict in2, void * res /* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli} 9 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 10 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-28.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-28.c index e8340a6..98df1fc 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-28.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-28.c @@ -40,7 +40,7 @@ void f (void * restrict in, void * restrict out, void * restrict in2, void * res } } -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ @@ -51,4 +51,4 @@ void f (void * restrict in, void * restrict out, void * restrict in2, void * res /* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ /* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli} 10 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 11 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-45.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-45.c index 0f6b96e..3c2b527 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-45.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-45.c @@ -30,5 +30,5 @@ void foo5_5 (int32_t * restrict in, int32_t * restrict out, size_t n, size_t m, } } -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]\s+j\s+\.L[0-9]+} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]\s+j\s+\.L[0-9]+} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ /* { dg-final { scan-assembler-times {vsetvli} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-25.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-25.c index f87a8cc..13aa25e 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-25.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-25.c @@ -563,10 +563,10 @@ void f7 (int8_t * restrict in, int8_t * restrict out, int n) } } -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m1,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m1,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-26.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-26.c index c123855..a5e065d 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-26.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-26.c @@ -483,10 +483,10 @@ void f6 (int8_t * restrict in, int8_t * restrict out, int n) } } -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-27.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-27.c index 6265000..9275951 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-27.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-27.c @@ -483,9 +483,9 @@ void f6 (int8_t * restrict in, int8_t * restrict out, int n) } } -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-28.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-28.c index de7c5f9..cbb4501 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-28.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-28.c @@ -83,4 +83,4 @@ void f6 (int8_t * restrict in, int8_t * restrict out, int n) } } -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-3.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-3.c index f920017..ad89899 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-3.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-3.c @@ -31,5 +31,5 @@ void f (int8_t * restrict in, int8_t * restrict out, int n) } } -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ /* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-7.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-7.c index 05058b8..46f6292 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-7.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_conflict-7.c @@ -23,4 +23,3 @@ void f (int32_t * restrict in, int32_t * restrict out, size_t n, size_t cond, si /* { dg-final { scan-assembler-times {vsetvli} 4 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ /* { dg-final { scan-assembler-times {j\s+\.L[0-9]+\s+\.L[0-9]+:\s+vlm\.v} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*m8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-12.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-12.c index eaf6992..66c36ab 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-12.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-12.c @@ -52,4 +52,4 @@ void foo (int8_t * restrict in, int8_t * restrict out, int n, int cond1, int con } } /* { dg-final { scan-assembler-times {vsetvli} 9 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]\s+j\s+\.L[0-9]+} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" no-opts "-flto" } } } } */ + -- cgit v1.1 From cfe3fbc678d7b69785d2b017d3ff3cd78cd91580 Mon Sep 17 00:00:00 2001 From: Ju-Zhe Zhong Date: Tue, 10 Jan 2023 06:33:07 +0800 Subject: RISC-V: Cleanup the codes of bitmap create and free [NFC] This patch is a NFC patch to move the codes into a wrapper function so that they can be reused. I will reuse them in the following patches. gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (vector_infos_manager::create_bitmap_vectors): New function. (vector_infos_manager::free_bitmap_vectors): Ditto. (pass_vsetvl::pre_vsetvl): Adjust codes. * config/riscv/riscv-vsetvl.h: New function declaration. --- gcc/config/riscv/riscv-vsetvl.cc | 95 ++++++++++++++++++++++++---------------- gcc/config/riscv/riscv-vsetvl.h | 2 + 2 files changed, 59 insertions(+), 38 deletions(-) (limited to 'gcc') diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 9ed081d..f67459c 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -1570,18 +1570,62 @@ vector_infos_manager::release (void) vector_exprs.release (); if (optimize > 0) - { - /* Finished. Free up all the things we've allocated. */ - free_edge_list (vector_edge_list); - sbitmap_vector_free (vector_del); - sbitmap_vector_free (vector_insert); - sbitmap_vector_free (vector_kill); - sbitmap_vector_free (vector_antic); - sbitmap_vector_free (vector_transp); - sbitmap_vector_free (vector_comp); - sbitmap_vector_free (vector_avin); - sbitmap_vector_free (vector_avout); - } + free_bitmap_vectors (); +} + +void +vector_infos_manager::create_bitmap_vectors (void) +{ + /* Create the bitmap vectors. */ + vector_antic = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), + vector_exprs.length ()); + vector_transp = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), + vector_exprs.length ()); + vector_comp = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), + vector_exprs.length ()); + vector_avin = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), + vector_exprs.length ()); + vector_avout = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), + vector_exprs.length ()); + vector_kill = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), + vector_exprs.length ()); + + bitmap_vector_ones (vector_transp, last_basic_block_for_fn (cfun)); + bitmap_vector_clear (vector_antic, last_basic_block_for_fn (cfun)); + bitmap_vector_clear (vector_comp, last_basic_block_for_fn (cfun)); +} + +void +vector_infos_manager::free_bitmap_vectors (void) +{ + /* Finished. Free up all the things we've allocated. */ + free_edge_list (vector_edge_list); + if (vector_del) + sbitmap_vector_free (vector_del); + if (vector_insert) + sbitmap_vector_free (vector_insert); + if (vector_kill) + sbitmap_vector_free (vector_kill); + if (vector_antic) + sbitmap_vector_free (vector_antic); + if (vector_transp) + sbitmap_vector_free (vector_transp); + if (vector_comp) + sbitmap_vector_free (vector_comp); + if (vector_avin) + sbitmap_vector_free (vector_avin); + if (vector_avout) + sbitmap_vector_free (vector_avout); + + vector_edge_list = nullptr; + vector_kill = nullptr; + vector_del = nullptr; + vector_insert = nullptr; + vector_antic = nullptr; + vector_transp = nullptr; + vector_comp = nullptr; + vector_avin = nullptr; + vector_avout = nullptr; } void @@ -2479,32 +2523,7 @@ pass_vsetvl::pre_vsetvl (void) /* Compute entity list. */ prune_expressions (); - /* Create the bitmap vectors. */ - m_vector_manager->vector_antic - = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), - m_vector_manager->vector_exprs.length ()); - m_vector_manager->vector_transp - = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), - m_vector_manager->vector_exprs.length ()); - m_vector_manager->vector_comp - = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), - m_vector_manager->vector_exprs.length ()); - m_vector_manager->vector_avin - = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), - m_vector_manager->vector_exprs.length ()); - m_vector_manager->vector_avout - = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), - m_vector_manager->vector_exprs.length ()); - m_vector_manager->vector_kill - = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), - m_vector_manager->vector_exprs.length ()); - - bitmap_vector_ones (m_vector_manager->vector_transp, - last_basic_block_for_fn (cfun)); - bitmap_vector_clear (m_vector_manager->vector_antic, - last_basic_block_for_fn (cfun)); - bitmap_vector_clear (m_vector_manager->vector_comp, - last_basic_block_for_fn (cfun)); + m_vector_manager->create_bitmap_vectors (); compute_local_properties (); m_vector_manager->vector_edge_list = pre_edge_lcm_avs ( m_vector_manager->vector_exprs.length (), m_vector_manager->vector_transp, diff --git a/gcc/config/riscv/riscv-vsetvl.h b/gcc/config/riscv/riscv-vsetvl.h index 72a0228..1038f35 100644 --- a/gcc/config/riscv/riscv-vsetvl.h +++ b/gcc/config/riscv/riscv-vsetvl.h @@ -341,6 +341,8 @@ public: bool all_same_ratio_p (sbitmap) const; void release (void); + void create_bitmap_vectors (void); + void free_bitmap_vectors (void); void dump (FILE *) const; }; -- cgit v1.1 From 00fb7698f0b3ae14d6d472db0f8b64744c84678b Mon Sep 17 00:00:00 2001 From: Ju-Zhe Zhong Date: Tue, 10 Jan 2023 06:40:07 +0800 Subject: RISC-V: Avoid redundant flow in forward fusion gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (pass_vsetvl::forward_demand_fusion): Add pre-check for redundant flow. --- gcc/config/riscv/riscv-vsetvl.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc') diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index f67459c..9140b18 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -2141,6 +2141,9 @@ pass_vsetvl::forward_demand_fusion (void) if (!prop.valid_or_dirty_p ()) continue; + if (cfg_bb == ENTRY_BLOCK_PTR_FOR_FN (cfun)) + continue; + edge e; edge_iterator ei; /* Forward propagate to each successor. */ @@ -2154,6 +2157,11 @@ pass_vsetvl::forward_demand_fusion (void) /* It's quite obvious, we don't need to propagate itself. */ if (e->dest->index == cfg_bb->index) continue; + /* We don't propagate through critical edges. */ + if (e->flags & EDGE_COMPLEX) + continue; + if (e->dest->index == EXIT_BLOCK_PTR_FOR_FN (cfun)->index) + continue; /* If there is nothing to propagate, just skip it. */ if (!local_dem.valid_or_dirty_p ()) -- cgit v1.1 From b9b251b7b95c78b485022802908970c598d9f6e1 Mon Sep 17 00:00:00 2001 From: Ju-Zhe Zhong Date: Tue, 10 Jan 2023 06:47:26 +0800 Subject: RISC-V: Refine codes in backward fusion [NFC] This NFC patch is preparing for the following patches. gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (pass_vsetvl::backward_demand_fusion): Refine codes. --- gcc/config/riscv/riscv-vsetvl.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc') diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 9140b18..f9dd7ca 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -2011,15 +2011,15 @@ pass_vsetvl::backward_demand_fusion (void) for (const bb_info *bb : crtl->ssa->reverse_bbs ()) { basic_block cfg_bb = bb->cfg_bb (); - const auto &prop - = m_vector_manager->vector_block_infos[cfg_bb->index].local_dem; + const auto &curr_block_info + = m_vector_manager->vector_block_infos[cfg_bb->index]; + const auto &prop = curr_block_info.local_dem; /* If there is nothing to propagate, just skip it. */ if (!prop.valid_or_dirty_p ()) continue; - if (!backward_propagate_worthwhile_p ( - cfg_bb, m_vector_manager->vector_block_infos[cfg_bb->index])) + if (!backward_propagate_worthwhile_p (cfg_bb, curr_block_info)) continue; edge e; -- cgit v1.1 From 27a2a4b6ed36784cc44e33451eed602f93ef3488 Mon Sep 17 00:00:00 2001 From: Ju-Zhe Zhong Date: Tue, 10 Jan 2023 06:56:43 +0800 Subject: RISC-V: Rename insn into rinsn for rtx_insn * [NFC] Since the PASS is implemented base on RTL_SSA framework. According to rtl_ssa, they name insn_info * as insn and name rtx_insn * rinsn. I follow this rule in this pass but I missed this function. So rename it to make codes be consistent to RTL_SSA framework. gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (add_label_notes): Rename insn to rinsn. --- gcc/config/riscv/riscv-vsetvl.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gcc') diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index f9dd7ca..4c78e58 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -683,7 +683,7 @@ insert_vsetvl (enum emit_type emit_type, rtx_insn *rinsn, necessary REG_LABEL_OPERAND and REG_LABEL_TARGET notes. */ static void -add_label_notes (rtx x, rtx_insn *insn) +add_label_notes (rtx x, rtx_insn *rinsn) { enum rtx_code code = GET_CODE (x); int i, j; @@ -700,8 +700,8 @@ add_label_notes (rtx x, rtx_insn *insn) /* There's no reason for current users to emit jump-insns with such a LABEL_REF, so we don't have to handle REG_LABEL_TARGET notes. */ - gcc_assert (!JUMP_P (insn)); - add_reg_note (insn, REG_LABEL_OPERAND, label_ref_label (x)); + gcc_assert (!JUMP_P (rinsn)); + add_reg_note (rinsn, REG_LABEL_OPERAND, label_ref_label (x)); if (LABEL_P (label_ref_label (x))) LABEL_NUSES (label_ref_label (x))++; @@ -712,10 +712,10 @@ add_label_notes (rtx x, rtx_insn *insn) for (i = GET_RTX_LENGTH (code) - 1, fmt = GET_RTX_FORMAT (code); i >= 0; i--) { if (fmt[i] == 'e') - add_label_notes (XEXP (x, i), insn); + add_label_notes (XEXP (x, i), rinsn); else if (fmt[i] == 'E') for (j = XVECLEN (x, i) - 1; j >= 0; j--) - add_label_notes (XVECEXP (x, i, j), insn); + add_label_notes (XVECEXP (x, i, j), rinsn); } } -- cgit v1.1 From 7ae4d1dfb8f43b99aea4e86e3ec8e48e9480045f Mon Sep 17 00:00:00 2001 From: Ju-Zhe Zhong Date: Tue, 10 Jan 2023 07:10:59 +0800 Subject: RISC-V: Remove dirty_pat since it is redundant gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (vector_insn_info::operator==): Remove dirty_pat. (vector_insn_info::merge): Ditto. (vector_insn_info::dump): Ditto. (pass_vsetvl::merge_successors): Ditto. (pass_vsetvl::backward_demand_fusion): Ditto. (pass_vsetvl::forward_demand_fusion): Ditto. (pass_vsetvl::commit_vsetvls): Ditto. * config/riscv/riscv-vsetvl.h: Ditto. --- gcc/config/riscv/riscv-vsetvl.cc | 28 ++++++++++++---------------- gcc/config/riscv/riscv-vsetvl.h | 11 +---------- 2 files changed, 13 insertions(+), 26 deletions(-) (limited to 'gcc') diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 4c78e58..2f9de9d 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -1084,10 +1084,10 @@ vector_insn_info::operator== (const vector_insn_info &other) const if (m_demands[i] != other.demand_p ((enum demand_type) i)) return false; - if (m_insn != other.get_insn ()) - return false; - if (m_dirty_pat != other.get_dirty_pat ()) - return false; + if (vector_config_insn_p (m_insn->rtl ()) + || vector_config_insn_p (other.get_insn ()->rtl ())) + if (m_insn != other.get_insn ()) + return false; if (!same_avl_p (other)) return false; @@ -1318,8 +1318,6 @@ vector_insn_info::merge (const vector_insn_info &merge_info, new_info.set_insn (merge_info.get_insn ()); } - new_info.set_dirty_pat (merge_info.get_dirty_pat ()); - if (!demand_p (DEMAND_AVL) && !merge_info.demand_p (DEMAND_AVL)) new_info.undemand (DEMAND_AVL); if (!demand_p (DEMAND_SEW) && !merge_info.demand_p (DEMAND_SEW)) @@ -1432,11 +1430,6 @@ vector_insn_info::dump (FILE *file) const fprintf (file, "The real INSN="); print_rtl_single (file, get_insn ()->rtl ()); } - if (get_dirty_pat ()) - { - fprintf (file, "Dirty RTL Pattern="); - print_rtl_single (file, get_dirty_pat ()); - } } } @@ -1968,7 +1961,6 @@ pass_vsetvl::merge_successors (const basic_block father, new_info.set_dirty (); rtx new_pat = gen_vsetvl_pat (new_info.get_insn ()->rtl (), new_info); - new_info.set_dirty_pat (new_pat); father_info.local_dem = new_info; father_info.reaching_out = new_info; @@ -2049,7 +2041,6 @@ pass_vsetvl::backward_demand_fusion (void) block_info.reaching_out = prop; block_info.reaching_out.set_dirty (); - block_info.reaching_out.set_dirty_pat (new_pat); block_info.local_dem = block_info.reaching_out; changed_p = true; } @@ -2078,7 +2069,6 @@ pass_vsetvl::backward_demand_fusion (void) rtx new_pat = gen_vsetvl_pat (new_info.get_insn ()->rtl (), new_info); new_info.set_dirty (); - new_info.set_dirty_pat (new_pat); block_info.local_dem = new_info; block_info.reaching_out = new_info; changed_p = true; @@ -2176,7 +2166,6 @@ pass_vsetvl::forward_demand_fusion (void) = gen_vsetvl_pat (prop.get_insn ()->rtl (), prop); local_dem = prop; local_dem.set_dirty (); - local_dem.set_dirty_pat (dirty_pat); reaching_out = local_dem; } else @@ -2503,10 +2492,17 @@ pass_vsetvl::commit_vsetvls (void) if (!reaching_out.dirty_p ()) continue; - rtx new_pat = reaching_out.get_dirty_pat (); + + rtx new_pat; if (can_refine_vsetvl_p (cfg_bb, reaching_out.get_ratio ())) new_pat = gen_vsetvl_pat (VSETVL_VTYPE_CHANGE_ONLY, reaching_out, NULL_RTX); + else if (vlmax_avl_p (reaching_out.get_avl ())) + new_pat = gen_vsetvl_pat (VSETVL_NORMAL, reaching_out, + get_vl (reaching_out.get_insn ()->rtl ())); + else + new_pat + = gen_vsetvl_pat (VSETVL_DISCARD_RESULT, reaching_out, NULL_RTX); start_sequence (); emit_insn (new_pat); diff --git a/gcc/config/riscv/riscv-vsetvl.h b/gcc/config/riscv/riscv-vsetvl.h index 1038f35..7b56802 100644 --- a/gcc/config/riscv/riscv-vsetvl.h +++ b/gcc/config/riscv/riscv-vsetvl.h @@ -220,13 +220,6 @@ private: (with AVL included) before vmv.x.s, but vmv.x.s is not the INSN holding the definition of AVL. */ rtl_ssa::insn_info *m_insn; - /* Save instruction pattern for Dirty block. - Since empty block may be polluted as a dirty block during dem backward - propagation (phase 3) which is intending to cheat LCM there is a VSETVL - instruction here to gain better LCM optimization. Such instruction is not - emit yet, we save this here and then emit it in the 4th phase if it is - necessary. */ - rtx m_dirty_pat; /* Parse the instruction to get VL/VTYPE information and demanding * information. */ @@ -243,7 +236,7 @@ private: public: vector_insn_info () : vl_vtype_info (), m_state (UNINITIALIZED), m_demands{false}, - m_insn (nullptr), m_dirty_pat (NULL_RTX) + m_insn (nullptr) {} bool operator> (const vector_insn_info &) const; @@ -271,7 +264,6 @@ public: void set_unknown () { m_state = UNKNOWN; } void set_empty () { m_state = EMPTY; } void set_dirty () { m_state = DIRTY; } - void set_dirty_pat (rtx pat) { m_dirty_pat = pat; } void set_insn (rtl_ssa::insn_info *insn) { m_insn = insn; } void set_demand_info (const vector_insn_info &); @@ -287,7 +279,6 @@ public: vector_insn_info merge (const vector_insn_info &, bool) const; rtl_ssa::insn_info *get_insn () const { return m_insn; } - rtx get_dirty_pat () const { return m_dirty_pat; } void dump (FILE *) const; }; -- cgit v1.1 From acc10c793127d5683b19158fd89fd0d4f4fc9db0 Mon Sep 17 00:00:00 2001 From: Ju-Zhe Zhong Date: Tue, 10 Jan 2023 07:17:20 +0800 Subject: RISC-V: Add probability model of each block to prevent endless loop of Phase 3 Notice that the PASS is just simpily pick the probability >= 50% to do the backward fusion which will create endless loop on Phase 3. Adding this probability to fix this bug. gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (vector_infos_manager::vector_infos_manager): Add probability. (vector_infos_manager::dump): Ditto. (pass_vsetvl::compute_probabilities): Ditto. * config/riscv/riscv-vsetvl.h (struct vector_block_info): Ditto. --- gcc/config/riscv/riscv-vsetvl.cc | 39 +++++++++++++++++++++++++++++++++++++++ gcc/config/riscv/riscv-vsetvl.h | 3 +++ 2 files changed, 42 insertions(+) (limited to 'gcc') diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 2f9de9d..02bdfeb 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -1466,6 +1466,7 @@ vector_infos_manager::vector_infos_manager () vector_block_infos[bb->index ()].reaching_out = vector_insn_info (); for (insn_info *insn : bb->real_insns ()) vector_insn_infos[insn->uid ()].parse_insn (insn); + vector_block_infos[bb->index ()].probability = profile_probability (); } } } @@ -1643,6 +1644,8 @@ vector_infos_manager::dump (FILE *file) const } fprintf (file, "