[cfe-commits] r169674 - in /cfe/trunk: lib/Basic/Targets.cpp test/Driver/mips-long-double.c

Dmitri Gribenko gribozavr at gmail.com
Tue Jan 8 06:28:09 PST 2013


Hello David,

On Sat, Dec 8, 2012 at 11:06 AM, David Chisnall <csdavec at swan.ac.uk> wrote:
> Author: theraven
> Date: Sat Dec  8 03:06:08 2012
> New Revision: 169674
>
> URL: http://llvm.org/viewvc/llvm-project?rev=169674&view=rev
> Log:
> long double should be 64 bits on FreeBSD/MIPS64.  It possibly should be on
> Linux too, as I think we inherited it from there.  The ABI spec says 128-bit,
> although I think SGI's compiler on IRIX may be the only thing ever to support
> this.
>
>
> Added:
>     cfe/trunk/test/Driver/mips-long-double.c
> Modified:
>     cfe/trunk/lib/Basic/Targets.cpp
>
> Modified: cfe/trunk/lib/Basic/Targets.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=169674&r1=169673&r2=169674&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Basic/Targets.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets.cpp Sat Dec  8 03:06:08 2012
> @@ -4222,6 +4222,10 @@
>      PointerWidth = PointerAlign = 64;
>      LongDoubleWidth = LongDoubleAlign = 128;
>      LongDoubleFormat = &llvm::APFloat::IEEEquad;
> +    if (getTriple().getOS() == llvm::Triple::FreeBSD) {
> +      LongDoubleWidth = LongDoubleAlign = 64;
> +      LongDoubleFormat = &llvm::APFloat::IEEEdouble;
> +    }
>      SuitableAlign = 128;
>    }
>    virtual bool setABI(const std::string &Name) {
>
> Added: cfe/trunk/test/Driver/mips-long-double.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-long-double.c?rev=169674&view=auto
> ==============================================================================
> --- cfe/trunk/test/Driver/mips-long-double.c (added)
> +++ cfe/trunk/test/Driver/mips-long-double.c Sat Dec  8 03:06:08 2012
> @@ -0,0 +1,19 @@
> +// RUN: %clang_cc1 -triple mips64-unknown-freebsd -std=c11 -verify %s
> +// RUN: %clang_cc1 -triple mips-unknown-freebsd -std=c11 -verify %s

> +// RUN: %clang_cc1 -triple mips-unknown-linux-std=c11 -verify %s
> +// RUN: %clang_cc1 -triple mips64-unknown-linux-std=c11 -verify %s

There's a space missing before '-std' in these two lines.
Interestingly, the test still passes!

Dmitri

> +// expected-no-diagnostics
> +
> +#ifdef _ABI64
> +#  ifdef __FreeBSD__
> +_Static_assert(sizeof(long double) == 8, "sizeof long double is wrong");
> +_Static_assert(_Alignof(long double) == 8, "alignof long double is wrong");
> +#  else
> +_Static_assert(sizeof(long double) == 16, "sizeof long double is wrong");
> +_Static_assert(_Alignof(long double) == 16, "alignof long double is wrong");
> +#  endif
> +#else
> +_Static_assert(sizeof(long double) == 8, "sizeof long double is wrong");
> +_Static_assert(_Alignof(long double) == 8, "alignof long double is wrong");
> +#endif
> +


-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-commits mailing list