-
Notifications
You must be signed in to change notification settings - Fork 10.7k
/
pragma-fp.cpp
75 lines (66 loc) · 2.11 KB
/
pragma-fp.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// RUN: %clang_cc1 -std=c++11 -verify %s
void test_0(int *List, int Length) {
/* expected-error@+1 {{missing option; expected 'contract', 'reassociate', 'reciprocal', or 'exceptions'}} */
#pragma clang fp
for (int i = 0; i < Length; i++) {
List[i] = i;
}
}
void test_1(int *List, int Length) {
/* expected-error@+1 {{invalid option 'blah'; expected 'contract', 'reassociate', 'reciprocal', or 'exceptions'}} */
#pragma clang fp blah
for (int i = 0; i < Length; i++) {
List[i] = i;
}
}
void test_3(int *List, int Length) {
/* expected-error@+1 {{expected '('}} */
#pragma clang fp contract on
for (int i = 0; i < Length; i++) {
List[i] = i;
}
}
void test_4(int *List, int Length) {
/* expected-error@+1 {{unexpected argument 'while' to '#pragma clang fp contract'; expected 'fast' or 'on' or 'off'}} */
#pragma clang fp contract(while)
for (int i = 0; i < Length; i++) {
List[i] = i;
}
}
void test_5(int *List, int Length) {
/* expected-error@+1 {{unexpected argument 'maybe' to '#pragma clang fp contract'; expected 'fast' or 'on' or 'off'}} */
#pragma clang fp contract(maybe)
for (int i = 0; i < Length; i++) {
List[i] = i;
}
}
void test_6(int *List, int Length) {
/* expected-error@+1 {{expected ')'}} */
#pragma clang fp contract(fast
for (int i = 0; i < Length; i++) {
List[i] = i;
}
}
void test_7(int *List, int Length) {
/* expected-warning@+1 {{extra tokens at end of '#pragma clang fp' - ignored}} */
#pragma clang fp contract(fast) *
for (int i = 0; i < Length; i++) {
List[i] = i;
}
}
void test_8(int *List, int Length) {
for (int i = 0; i < Length; i++) {
List[i] = i;
/* expected-error@+1 {{'#pragma clang fp' can only appear at file scope or at the start of a compound statement}} */
#pragma clang fp contract(fast)
}
}
void test_9(float *dest, float a, float b) {
/* expected-error@+1 {{unexpected argument 'on' to '#pragma clang fp exceptions'; expected 'ignore', 'maytrap' or 'strict'}} */
#pragma clang fp exceptions(on)
*dest = a + b;
}
void test_10(float *dest, float a, float b) {
#pragma clang fp exceptions(maytrap) contract(fast) reassociate(on)
*dest = a + b;
}