Clang Project

clang_source_code/test/Driver/ppc-dependent-options.cpp
1// REQUIRES: powerpc-registered-target
2// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
3// RUN: -mcpu=power8 -std=c++11 %s 2>&1 | FileCheck %s \
4// RUN: -check-prefix=CHECK-DEFAULT
5
6// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
7// RUN: -mcpu=power8 -std=c++11 -mno-vsx -mpower8-vector %s 2>&1 | \
8// RUN: FileCheck %s -check-prefix=CHECK-NVSX-P8V
9
10// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
11// RUN: -mcpu=power8 -std=c++11 -mno-vsx -mdirect-move %s 2>&1 | FileCheck %s \
12// RUN: -check-prefix=CHECK-NVSX-DMV
13
14// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
15// RUN: -mcpu=power8 -std=c++11 -mno-vsx -mpower8-vector -mvsx %s 2>&1 | \
16// RUN: FileCheck %s -check-prefix=CHECK-DEFAULT
17
18// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
19// RUN: -mcpu=power8 -std=c++11 -mno-vsx -mdirect-move -mvsx %s 2>&1 | \
20// RUN: FileCheck %s -check-prefix=CHECK-DEFAULT
21
22// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
23// RUN: -mcpu=power8 -std=c++11 -mpower8-vector -mno-vsx %s 2>&1 | \
24// RUN: FileCheck %s -check-prefix=CHECK-NVSX-P8V
25
26// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
27// RUN: -mcpu=power8 -std=c++11 -mdirect-move -mno-vsx %s 2>&1 | FileCheck %s \
28// RUN: -check-prefix=CHECK-NVSX-DMV
29
30// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
31// RUN: -mcpu=power8 -std=c++11 -mno-vsx %s 2>&1 | FileCheck %s \
32// RUN: -check-prefix=CHECK-NVSX
33
34// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
35// RUN: -mcpu=power6 -std=c++11 %s 2>&1 | FileCheck %s -check-prefix=CHECK-NVSX
36
37// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
38// RUN: -mcpu=power6 -std=c++11 -mpower8-vector %s 2>&1 | FileCheck %s \
39// RUN: -check-prefix=CHECK-DEFAULT
40
41// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
42// RUN: -mcpu=power6 -std=c++11 -mdirect-move %s 2>&1 | FileCheck %s \
43// RUN: -check-prefix=CHECK-VSX
44
45// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
46// RUN: -mcpu=power9 -std=c++11 %s 2>&1 | FileCheck %s \
47// RUN: -check-prefix=CHECK-DEFAULT-P9
48
49// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
50// RUN: -mcpu=power9 -std=c++11 -mno-vsx -mpower9-vector %s 2>&1 | \
51// RUN: FileCheck %s -check-prefix=CHECK-NVSX-P9V
52
53// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
54// RUN: -mcpu=power9 -std=c++11 -mno-vsx -mfloat128 %s 2>&1 | \
55// RUN: FileCheck %s -check-prefix=CHECK-NVSX-FLT128
56
57#ifdef __VSX__
58static_assert(false, "VSX enabled");
59#endif
60
61#ifdef __POWER8_VECTOR__
62static_assert(false, "P8V enabled");
63#endif
64
65#ifdef __POWER9_VECTOR__
66static_assert(false, "P9V enabled");
67#endif
68
69#if !defined(__VSX__) && !defined(__POWER8_VECTOR__) && \
70    !defined(__POWER9_VECTOR__)
71static_assert(false, "Neither enabled");
72#endif
73
74// CHECK-DEFAULT: VSX enabled
75// CHECK-DEFAULT: P8V enabled
76// CHECK-DEFAULT-P9: P9V enabled
77// CHECK-NVSX-P8V: error: option '-mpower8-vector' cannot be specified with '-mno-vsx'
78// CHECK-NVSX-P9V: error: option '-mpower9-vector' cannot be specified with '-mno-vsx'
79// CHECK-NVSX-FLT128: error: option '-mfloat128' cannot be specified with '-mno-vsx'
80// CHECK-NVSX-DMV: error: option '-mdirect-move' cannot be specified with '-mno-vsx'
81// CHECK-NVSX: Neither enabled
82// CHECK-VSX: VSX enabled
83