annotate clang/test/Preprocessor/flt_eval_macro.cpp @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents
children 1f2b6ac9f198
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
236
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
1 // RUN: %clang_cc1 -E -dM -triple=x86_64-none-none %s -o - \
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
2 // RUN: | FileCheck %s -strict-whitespace
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
3
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
4 // RUN: %clang_cc1 -E -dM -triple=x86_64-none-none -target-feature -sse \
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
5 // RUN: %s -o - | FileCheck %s -check-prefix=EXT -strict-whitespace
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
6
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
7 // RUN: %clang_cc1 -E -dM -triple=arm64e-apple-ios -target-feature -sse \
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
8 // RUN: %s -o - | FileCheck %s -strict-whitespace
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
9
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
10 // RUN: %clang_cc1 -E -dM -triple=arm64e-apple-ios -target-feature +sse \
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
11 // RUN: %s -o - | FileCheck %s -strict-whitespace
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
12
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
13 // RUN: %clang_cc1 -E -dM -triple=arm64_32-apple-ios %s -o - \
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
14 // RUN: | FileCheck %s -strict-whitespace
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
15
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
16 // RUN: %clang_cc1 -E -dM -triple=arm64_32-apple-ios -target-feature -sse \
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
17 // RUN: %s -o - | FileCheck %s -strict-whitespace
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
18
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
19 // RUN: %clang_cc1 -E -dM -triple=x86_64-apple-macos13.0 -ffast-math \
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
20 // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-MINUS-ONE -strict-whitespace
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
21
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
22 // RUN: %clang_cc1 -E -dM -triple i386-pc-windows -target-cpu pentium4 %s -o - \
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
23 // RUN: | FileCheck %s -strict-whitespace
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
24
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
25 // RUN: %clang_cc1 -E -dM -triple i386-pc-windows -target-cpu pentium4 \
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
26 // RUN: -target-feature -sse %s -o - | FileCheck -check-prefix=EXT %s \
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
27 // RUN: -strict-whitespace
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
28
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
29 #ifdef __FLT_EVAL_METHOD__
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
30 #if __FLT_EVAL_METHOD__ == 3
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
31 #define __GLIBC_FLT_EVAL_METHOD 2
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
32 #else
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
33 #define __GLIBC_FLT_EVAL_METHOD __FLT_EVAL_METHOD__
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
34 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
35 #elif defined __x86_64__
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
36 #define __GLIBC_FLT_EVAL_METHOD 0
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
37 #else
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
38 #define __GLIBC_FLT_EVAL_METHOD 2
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
39 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
40
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
41 #if __GLIBC_FLT_EVAL_METHOD == -1
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
42 #define Name "MinusOne"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
43 #elif __GLIBC_FLT_EVAL_METHOD == 0 || __GLIBC_FLT_EVAL_METHOD == 16
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
44 #define Name "One"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
45 #elif __GLIBC_FLT_EVAL_METHOD == 1
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
46 #define Name "Two"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
47 #elif __GLIBC_FLT_EVAL_METHOD == 2
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
48 #define Name "Three"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
49 #elif __GLIBC_FLT_EVAL_METHOD == 32
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
50 #define Name "Four"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
51 #elif __GLIBC_FLT_EVAL_METHOD == 33
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
52 #define Name "Five"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
53 #elif __GLIBC_FLT_EVAL_METHOD == 64
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
54 #define Name "Six"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
55 #elif __GLIBC_FLT_EVAL_METHOD == 65
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
56 #define Name "Seven"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
57 #elif __GLIBC_FLT_EVAL_METHOD == 128
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
58 #define Name "Eight"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
59 #elif __GLIBC_FLT_EVAL_METHOD == 129
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
60 #define Name "Nine"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
61 #else
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
62 #error "Unknown __GLIBC_FLT_EVAL_METHOD"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
63 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
64
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
65 int foo() {
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
66 // CHECK: #define Name "One"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
67 // CHECK-MINUS-ONE: #define Name "MinusOne"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
68 // EXT: #define Name "Three"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
69 return Name;
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
70 }
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
71
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
72 #pragma fp eval_method(double)
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
73
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
74 #if __FLT_EVAL_METHOD__ == 3
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
75 #define Val "Unset"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
76 #elif __FLT_EVAL_METHOD__ == 0
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
77 #define Val "val0"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
78 #elif __FLT_EVAL_METHOD__ == 1
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
79 #define Val "val1"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
80 #elif __FLT_EVAL_METHOD__ == 2
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
81 #define Val "val2"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
82 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
83
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
84 int goo() {
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
85 // CHECK: #define Val "val0"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
86 // EXT: #define Val "val2"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
87 return Val;
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
88 }