[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Preprocessor / flt_eval_macro.cpp
blob37c28f21333f95c874e45358b30b34f26beefba7
1 // RUN: %clang_cc1 -E -dM -triple=x86_64-none-none %s -o - \
2 // RUN: | FileCheck %s -strict-whitespace
4 // RUN: %clang_cc1 -E -dM -triple=x86_64-none-none -target-feature -sse \
5 // RUN: %s -o - | FileCheck %s -check-prefix=EXT -strict-whitespace
7 // RUN: %clang_cc1 -E -dM -triple=arm64e-apple-ios -target-feature -sse \
8 // RUN: %s -o - | FileCheck %s -strict-whitespace
10 // RUN: %clang_cc1 -E -dM -triple=arm64e-apple-ios -target-feature +sse \
11 // RUN: %s -o - | FileCheck %s -strict-whitespace
13 // RUN: %clang_cc1 -E -dM -triple=arm64_32-apple-ios %s -o - \
14 // RUN: | FileCheck %s -strict-whitespace
16 // RUN: %clang_cc1 -E -dM -triple=arm64_32-apple-ios -target-feature -sse \
17 // RUN: %s -o - | FileCheck %s -strict-whitespace
19 // RUN: %clang_cc1 -E -dM -triple=x86_64-apple-macos13.0 -ffast-math \
20 // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-MINUS-ONE -strict-whitespace
22 // RUN: %clang_cc1 -E -dM -triple i386-pc-windows -target-cpu pentium4 %s -o - \
23 // RUN: | FileCheck %s -strict-whitespace
25 // RUN: %clang_cc1 -E -dM -triple i386-pc-windows -target-cpu pentium4 \
26 // RUN: -target-feature -sse %s -o - | FileCheck -check-prefix=EXT %s \
27 // RUN: -strict-whitespace
29 #ifdef __FLT_EVAL_METHOD__
30 #if __FLT_EVAL_METHOD__ == 3
31 #define __GLIBC_FLT_EVAL_METHOD 2
32 #else
33 #define __GLIBC_FLT_EVAL_METHOD __FLT_EVAL_METHOD__
34 #endif
35 #elif defined __x86_64__
36 #define __GLIBC_FLT_EVAL_METHOD 0
37 #else
38 #define __GLIBC_FLT_EVAL_METHOD 2
39 #endif
41 #if __GLIBC_FLT_EVAL_METHOD == -1
42 #define Name "MinusOne"
43 #elif __GLIBC_FLT_EVAL_METHOD == 0 || __GLIBC_FLT_EVAL_METHOD == 16
44 #define Name "One"
45 #elif __GLIBC_FLT_EVAL_METHOD == 1
46 #define Name "Two"
47 #elif __GLIBC_FLT_EVAL_METHOD == 2
48 #define Name "Three"
49 #elif __GLIBC_FLT_EVAL_METHOD == 32
50 #define Name "Four"
51 #elif __GLIBC_FLT_EVAL_METHOD == 33
52 #define Name "Five"
53 #elif __GLIBC_FLT_EVAL_METHOD == 64
54 #define Name "Six"
55 #elif __GLIBC_FLT_EVAL_METHOD == 65
56 #define Name "Seven"
57 #elif __GLIBC_FLT_EVAL_METHOD == 128
58 #define Name "Eight"
59 #elif __GLIBC_FLT_EVAL_METHOD == 129
60 #define Name "Nine"
61 #else
62 #error "Unknown __GLIBC_FLT_EVAL_METHOD"
63 #endif
65 int foo() {
66 // CHECK: #define Name "One"
67 // CHECK-MINUS-ONE: #define Name "MinusOne"
68 // EXT: #define Name "Three"
69 return Name;
72 #pragma fp eval_method(double)
74 #if __FLT_EVAL_METHOD__ == 3
75 #define Val "Unset"
76 #elif __FLT_EVAL_METHOD__ == 0
77 #define Val "val0"
78 #elif __FLT_EVAL_METHOD__ == 1
79 #define Val "val1"
80 #elif __FLT_EVAL_METHOD__ == 2
81 #define Val "val2"
82 #endif
84 int goo() {
85 // CHECK: #define Val "val0"
86 // EXT: #define Val "val2"
87 return Val;