Clang Project

clang_source_code/test/Driver/sparc-float.c
1// Check handling -mhard-float / -msoft-float options
2// when build for SPARC platforms.
3//
4// Default sparc
5// RUN: %clang -c %s -### -o %t.o 2>&1 \
6// RUN:     -target sparc-linux-gnu \
7// RUN:   | FileCheck --check-prefix=CHECK-DEF %s
8// CHECK-DEF-NOT: "-target-feature" "+soft-float"
9// CHECK-DEF-NOT: "-msoft-float"
10//
11// -mhard-float
12// RUN: %clang -c %s -### -o %t.o 2>&1 \
13// RUN:     -target sparc-linux-gnu -mhard-float \
14// RUN:   | FileCheck --check-prefix=CHECK-HARD %s
15// CHECK-HARD-NOT: "-msoft-float"
16//
17// -msoft-float
18// RUN: %clang -c %s -### -o %t.o 2>&1 \
19// RUN:     -target sparc-linux-gnu -msoft-float \
20// RUN:   | FileCheck --check-prefix=CHECK-SOFT %s
21// CHECK-SOFT: "-target-feature" "+soft-float"
22//
23// -mfloat-abi=soft
24// RUN: %clang -c %s -### -o %t.o 2>&1 \
25// RUN:     -target sparc-linux-gnu -mfloat-abi=soft \
26// RUN:   | FileCheck --check-prefix=CHECK-FLOATABISOFT %s
27// CHECK-FLOATABISOFT: "-target-feature" "+soft-float"
28//
29// -mfloat-abi=hard
30// RUN: %clang -c %s -### -o %t.o 2>&1 \
31// RUN:     -target sparc-linux-gnu -mfloat-abi=hard \
32// RUN:   | FileCheck --check-prefix=CHECK-FLOATABIHARD %s
33// CHECK-FLOATABIHARD-NOT: "-target-feature" "+soft-float"
34//
35// check invalid -mfloat-abi
36// RUN: %clang -c %s -### -o %t.o 2>&1 \
37// RUN:     -target sparc-linux-gnu -mfloat-abi=x \
38// RUN:   | FileCheck --check-prefix=CHECK-ERRMSG %s
39// CHECK-ERRMSG: error: invalid float ABI '-mfloat-abi=x'
40//
41// Default sparc64
42// RUN: %clang -c %s -### -o %t.o 2>&1 \
43// RUN:     -target sparc64-linux-gnu \
44// RUN:   | FileCheck --check-prefix=CHECK-DEF-SPARC64 %s
45// CHECK-DEF-SPARC64-NOT: "-target-feature" "+soft-float"
46// CHECK-DEF-SPARC64-NOT: "-msoft-float"
47//
48// -mhard-float
49// RUN: %clang -c %s -### -o %t.o 2>&1 \
50// RUN:     -target sparc64-linux-gnu -mhard-float \
51// RUN:   | FileCheck --check-prefix=CHECK-HARD-SPARC64 %s
52// CHECK-HARD-SPARC64-NOT: "-msoft-float"
53//
54// -msoft-float
55// RUN: %clang -c %s -### -o %t.o 2>&1 \
56// RUN:     -target sparc64-linux-gnu -msoft-float \
57// RUN:   | FileCheck --check-prefix=CHECK-SOFT-SPARC64 %s
58// CHECK-SOFT-SPARC64: "-target-feature" "+soft-float"
59//
60// -mfloat-abi=soft
61// RUN: %clang -c %s -### -o %t.o 2>&1 \
62// RUN:     -target sparc64-linux-gnu -mfloat-abi=soft \
63// RUN:   | FileCheck --check-prefix=CHECK-FLOATABISOFT64 %s
64// CHECK-FLOATABISOFT64: "-target-feature" "+soft-float"
65//
66// -mfloat-abi=hard
67// RUN: %clang -c %s -### -o %t.o 2>&1 \
68// RUN:     -target sparc64-linux-gnu -mfloat-abi=hard \
69// RUN:   | FileCheck --check-prefix=CHECK-FLOATABIHARD64 %s
70// CHECK-FLOATABIHARD64-NOT: "-target-feature" "+soft-float"
71//
72// check invalid -mfloat-abi
73// RUN: %clang -c %s -### -o %t.o 2>&1 \
74// RUN:     -target sparc64-linux-gnu -mfloat-abi=x \
75// RUN:   | FileCheck --check-prefix=CHECK-ERRMSG64 %s
76// CHECK-ERRMSG64: error: invalid float ABI '-mfloat-abi=x'
77