aboutsummaryrefslogtreecommitdiff
path: root/test/Driver/mips-float.c
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2012-03-26 17:37:20 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2012-03-26 17:37:20 +0000
commit54edd4764db4c266359f757daabdb0189199e4ed (patch)
treef3724ef3407e7d9029ac6c8623adefe4bc2d9824 /test/Driver/mips-float.c
parent8cb4a070d491ddd671b049110cc8d0accb08b905 (diff)
Test case for r153348.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153449 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Driver/mips-float.c')
-rw-r--r--test/Driver/mips-float.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/test/Driver/mips-float.c b/test/Driver/mips-float.c
new file mode 100644
index 0000000000..4a666eefaf
--- /dev/null
+++ b/test/Driver/mips-float.c
@@ -0,0 +1,59 @@
+// Check handling -mhard-float / -msoft-float / -mfloat-abi options
+// when build for MIPS platforms.
+//
+// Default
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
+// RUN: -target mips-linux-gnu \
+// RUN: | FileCheck --check-prefix=CHECK-DEF %s
+// CHECK-DEF: "-mfloat-abi" "hard"
+//
+// -mhard-float
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
+// RUN: -target mips-linux-gnu -mhard-float \
+// RUN: | FileCheck --check-prefix=CHECK-HARD %s
+// CHECK-HARD: "-mfloat-abi" "hard"
+//
+// -msoft-float
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
+// RUN: -target mips-linux-gnu -msoft-float \
+// RUN: | FileCheck --check-prefix=CHECK-SOFT %s
+// CHECK-SOFT: "-msoft-float"
+// CHECK-SOFT: "-mfloat-abi" "soft"
+// CHECK-SOFT: "-target-feature" "+soft-float"
+//
+// -mfloat-abi=hard
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
+// RUN: -target mips-linux-gnu -mfloat-abi=hard \
+// RUN: | FileCheck --check-prefix=CHECK-ABI-HARD %s
+// CHECK-ABI-HARD: "-mfloat-abi" "hard"
+//
+// -mfloat-abi=soft
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
+// RUN: -target mips-linux-gnu -mfloat-abi=soft \
+// RUN: | FileCheck --check-prefix=CHECK-ABI-SOFT %s
+// CHECK-ABI-SOFT: "-msoft-float"
+// CHECK-ABI-SOFT: "-mfloat-abi" "soft"
+// CHECK-ABI-SOFT: "-target-feature" "+soft-float"
+//
+// -mfloat-abi=single
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
+// RUN: -target mips-linux-gnu -mfloat-abi=single \
+// RUN: | FileCheck --check-prefix=CHECK-ABI-SINGLE %s
+// CHECK-ABI-SINGLE: "-target-feature" "+single-float"
+//
+// Let's check float ABI related macros.
+//
+// -mfloat-abi=hard
+// RUN: %clang -c %s -dM -E 2>&1 \
+// RUN: -target mips-linux-gnu -mfloat-abi=hard \
+// RUN: | grep "#define __mips_hard_float 1"
+//
+// -mfloat-abi=soft
+// RUN: %clang -c %s -dM -E 2>&1 \
+// RUN: -target mips-linux-gnu -mfloat-abi=soft \
+// RUN: | grep "#define __mips_soft_float 1"
+//
+// -mfloat-abi=single
+// RUN: %clang -c %s -dM -E 2>&1 \
+// RUN: -target mips-linux-gnu -mfloat-abi=single \
+// RUN: | grep "#define __mips_single_float 1"