Excerpts from liushuyu's message of Februar 6, 2025 2:02 am:
> From: Zixing Liu <liushuyu...@gmail.com>
> 
> This set of patches will add proper IEEE 128 quad precision marking to GDC
> compiler, so that it works with the new changes in D standard library
> where POWER system can use any math functions inside the standard library
> that requires the "real" type.
> 
> The patch also adds the ELFv1 and ELFv2 version identifiers to bridge
> the gap between LLVM D Compiler (LDC) and GNU D Compiler (GDC) so that
> the user can reliably use the "version(...)" syntax to check for which
> ABI is currently in use.

Thanks. I wonder if something could be done to predefine ELFv1 for other 
targets too. Unconditionally calling add_builtin_version in glibc-d.cc, 
freebsd-d.cc, ..., doesn't seem like the best thing to do, but I'm open 
for suggestions.

> +
> +  if (TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128)
> +    d_add_builtin_version ("D_PPCUseIEEE128");

It says in the spec that all version identifiers derived from any 
predefined versions by appending any character(s) are reserved.

So there's no need for the `D_` prefix, `PPC_UseIEEE128` will suffice.

> +
> +// { dg-final { scan-assembler "test_version" } }
> +extern (C) bool test_version() {
> +    // { dg-final { scan-assembler "li 3,1" } }
> +    version (D_PPCUseIEEE128) return true;
> +    else return false;
> +}
> +
> +// { dg-final { scan-assembler "test_elf_version" } }
> +extern (C) bool test_elf_version() {
> +    // { dg-final { scan-assembler "li 3,1" } }
> +    version (ELFv2) return true;
> +    else return false;
> +}

These two tests should return a different value, otherwise you could 
just end up matching the same function return twice.

Kind regards,
Iain.

Reply via email to