From: Karl Meakin Date: Wed, 1 Jul 2026 12:16:40 +0000 (+0000) Subject: aarch64: Relax type-checking assert [PR126064] X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9bfc05c8a91f3f89d579afa3a79cce1c0da34184;p=thirdparty%2Fgcc.git aarch64: Relax type-checking assert [PR126064] Comparing `arg_type` and `TREE_TYPE (b)` by pointer address causes an assertion failure when one type is a `typedef` for the other (eg `uint32x2_t` and `__Uint32x2_t`. Fix by using a more relaxed comparison. gcc/ChangeLog: PR target/126064 * config/aarch64/aarch64-neon-builtins-base.cc: Compare `arg_type` and `TREE_TYPE (b)` using `types_compatible_p` rather than comparing their pointer addresses. gcc/testsuite/ChangeLog: PR target/126064 * gcc.target/aarch64/pr126064.c: New test. --- diff --git a/gcc/config/aarch64/aarch64-neon-builtins-base.cc b/gcc/config/aarch64/aarch64-neon-builtins-base.cc index 9e61ba7688c..d8fae81388e 100644 --- a/gcc/config/aarch64/aarch64-neon-builtins-base.cc +++ b/gcc/config/aarch64/aarch64-neon-builtins-base.cc @@ -562,7 +562,7 @@ public: std::swap (a, b); auto arg_type = TREE_TYPE (a); - gcc_assert (arg_type == TREE_TYPE (b)); + gcc_assert (types_compatible_p (arg_type, TREE_TYPE (b))); auto tuple_type = TREE_TYPE (f.lhs); auto tuple = create_tmp_var (tuple_type); diff --git a/gcc/testsuite/gcc.target/aarch64/pr126064.c b/gcc/testsuite/gcc.target/aarch64/pr126064.c new file mode 100644 index 00000000000..9d792588781 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr126064.c @@ -0,0 +1,28 @@ +/* { dg-options "-std=c99" } */ + +/* Check that `gimple_permute_pair::fold()` does not trip an assert when the LHS + type is `uint32x2_t` and the RHS type is `__Uint32x2_t`. */ + +#include + +void +repro (uint8_t *dst, uint8x8_t a, uint8x8_t b) +{ + uint32x2x2_t t; + uint32x2_t r; + uint8x8_t c; + + r = vrev64_u32 (vreinterpret_u32_u8 (b)); + t = vtrn_u32 (vreinterpret_u32_u8 (a), r); + c = vreinterpret_u8_u32 (t.val[1]); + t = vtrn_u32 (t.val[0], vreinterpret_u32_u8 (c)); + t.val[1] = vrev64_u32 (t.val[1]); + + vst1_u8 (dst, vreinterpret_u8_u32 (t.val[1])); +} + +uint32x2_t +minimized_repro (uint32x2_t a, uint32x2_t b) +{ + return vtrn_u32 (a, vrev64_u32 (b)).val[1]; +}