From 058666a8d02f5cd348150862a3401c9c4bd0b4d0 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Thu, 4 Oct 2012 19:42:20 +0000 Subject: Driver: Link crtfastmath.o if it's available and -ffast-math is specified. crtfastmath.o contains routines to set the floating point flags to a faster, unsafe mode. Linking it in speeds up code dealing with denormals significantly (PR14024). For now this is only enabled on linux where I can test it and crtfastmath.o is widely available. We may want to provide a similar file with compiler-rt eventually and/or enable it on other platforms too. llvm-svn: 165240 --- .../gcc/x86_64-unknown-linux/4.6.0/crtfastmath.o | 0 clang/test/Driver/linux-ld.c | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtfastmath.o (limited to 'clang/test') diff --git a/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtfastmath.o b/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtfastmath.o new file mode 100644 index 00000000000..e69de29bb2d diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c index 7c7837f666c..7021f92f46b 100644 --- a/clang/test/Driver/linux-ld.c +++ b/clang/test/Driver/linux-ld.c @@ -501,3 +501,24 @@ // CHECK-FSL-PPC64: "{{.*}}/crt1.o" // CHECK-FSL-PPC64: "{{.*}}/crtbegin.o" // CHECK-FSL-PPC64: "-L[[SYSROOT]]/usr/lib64/powerpc64-fsl-linux/4.6.2/../.." +// +// Check that crtfastmath.o is linked with -ffast-math. +// RUN: %clang -target x86_64-unknown-linux -### %s \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s +// RUN: %clang -target x86_64-unknown-linux -### %s -ffast-math \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s +// RUN: %clang -target x86_64-unknown-linux -### %s -funsafe-math-optimizations\ +// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s +// RUN: %clang -target x86_64-unknown-linux -### %s -ffast-math -fno-fast-math \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s +// We don't have crtfastmath.o in the i386 tree, use it to check that file +// detection works. +// RUN: %clang -target i386-unknown-linux -### %s -ffast-math \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s +// CHECK-CRTFASTMATH: usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtfastmath.o +// CHECK-NOCRTFASTMATH-NOT: crtfastmath.o -- cgit v1.2.3