This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Possible C++ patch: mangling of 128-bit integers
Jason Merrill <jason@redhat.com> writes:
> > ! if (GET_MODE_BITSIZE (TYPE_MODE (type)) == 128)
>
> TYPE_PRECISION seems simpler. Otherwise OK for trunk and branch.
Thanks. I accidentally sent an earlier (buggy) version of the
patch, so here's what I checked in, with your suggested change
applied. Sorry for any confusion.
Richard
[cp/]
* mangle.c (write_builtin_type): Handle 128-bit integers even if
they are not a standard integer type.
[testsuite/]
* g++.dg/abi/mangle6.C: New test.
Index: cp/mangle.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/mangle.c,v
retrieving revision 1.44
diff -c -p -d -r1.44 mangle.c
*** cp/mangle.c 2002/02/20 04:09:04 1.44
--- cp/mangle.c 2002/03/13 17:35:48
*************** write_CV_qualifiers_for_type (type)
*** 1506,1513 ****
::= m # unsigned long
::= x # long long, __int64
::= y # unsigned long long, __int64
! ::= n # __int128 [not supported]
! ::= o # unsigned __int128 [not supported]
::= f # float
::= d # double
::= e # long double, __float80
--- 1506,1513 ----
::= m # unsigned long
::= x # long long, __int64
::= y # unsigned long long, __int64
! ::= n # __int128
! ::= o # unsigned __int128
::= f # float
::= d # double
::= e # long double, __float80
*************** write_builtin_type (type)
*** 1552,1566 ****
write_char (integer_type_codes[itk]);
break;
}
!
if (itk == itk_none)
{
tree t = type_for_mode (TYPE_MODE (type), TREE_UNSIGNED (type));
if (type == t)
! /* Couldn't find this type. */
! abort ();
! type = t;
! goto iagain;
}
}
break;
--- 1552,1574 ----
write_char (integer_type_codes[itk]);
break;
}
!
if (itk == itk_none)
{
tree t = type_for_mode (TYPE_MODE (type), TREE_UNSIGNED (type));
if (type == t)
! {
! if (TYPE_PRECISION (type) == 128)
! write_char (TREE_UNSIGNED (type) ? 'o' : 'n');
! else
! /* Couldn't find this type. */
! abort ();
! }
! else
! {
! type = t;
! goto iagain;
! }
}
}
break;
*** /dev/null Tue Nov 14 21:44:43 2000
--- testsuite/g++.dg/abi/mangle6.C Tue Mar 12 18:24:02 2002
***************
*** 0 ****
--- 1,18 ----
+ /* Check that __int128 types are mangled. */
+ /* { dg-do compile { target mips64*-*-* } } */
+
+ typedef int int128 __attribute__ ((mode(TI)));
+ typedef unsigned int uint128 __attribute__ ((mode(TI)));
+
+ struct S
+ {
+ int128 i;
+ int128 func1 (int128) const { return i; }
+ uint128 func2 (uint128) const { return i; }
+ };
+
+ int128 (S::*ptr1) (int128) const = &S::func1;
+ uint128 (S::*ptr2) (uint128) const = &S::func2;
+
+ /* { dg-final { scan-assembler _ZNK1S5func1En } } */
+ /* { dg-final { scan-assembler _ZNK1S5func2Eo } } */