1 // RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-linux-gnu -target-feature -x87
2 // RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-linux-gnu -DNOERROR
5 // expected-no-diagnostics
8 typedef long double long_double
;
10 // Declaration is fine, unless it is called or defined.
11 double decl(long_double x
, long_double y
);
16 // No code is generated for deleted functions
17 long_double
decl_ld_del(long_double
) = delete;
18 double decl_ld_del(double) = delete;
19 float decl_ld_del(float) = delete;
22 // expected-error@+4{{'def' requires 'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
23 // expected-note@+3{{'def' defined here}}
24 // expected-note@+2{{'x' defined here}}
26 int def(long_double x
) {
28 // expected-error@+2{{'x' requires 'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
34 // expected-note@+3{{'ld_args' defined here}}
35 // expected-note@+2{{'ld_args' defined here}}
37 int ld_args(long_double x
, long_double y
);
39 int call1(float x
, float y
) {
41 // expected-error@+2 2{{'ld_args' requires 'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
47 // expected-note@+2{{'ld_ret' defined here}}
49 long_double
ld_ret(double x
, double y
);
51 int call2(float x
, float y
) {
53 // expected-error@+2{{'ld_ret' requires 'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
55 return (int)ld_ret(x
, y
);
58 int binop(double x
, double y
) {
60 // expected-error@+2 2{{expression requires 'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
62 double z
= (long_double
)x
* (long_double
)y
;
66 void assign1(long_double
*ret
, double x
) {
68 // expected-error@+2{{expression requires 'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
73 struct st_long_double1
{
75 // expected-note@+2{{'ld' defined here}}
80 struct st_long_double2
{
82 // expected-note@+2{{'ld' defined here}}
87 struct st_long_double3
{
89 // expected-note@+2{{'ld' defined here}}
95 struct st_long_double1 st
;
97 // expected-error@+3{{expression requires 'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
98 // expected-error@+2{{'ld' requires 'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
104 struct st_long_double2 st
;
106 // expected-error@+3{{expression requires 'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
107 // expected-error@+2{{'ld' requires 'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
112 void assign4(double d
) {
113 struct st_long_double3 st
;
115 // expected-error@+3{{expression requires 'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
116 // expected-error@+2{{'ld' requires 'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
122 // unused variable declaration is fine
123 long_double ld
= 0.42;
126 // Double and Float return type on x86_64 do not use x87 registers
127 double d_ret1(float x
) {
131 double d_ret2(float x
);
133 int d_ret3(float x
) {
134 return (int)d_ret2(x
);
137 float f_ret1(float x
) {
141 float f_ret2(float x
);
143 int f_ret3(float x
) {
144 return (int)f_ret2(x
);