1// REQUIRES: x86-registered-target
2// REQUIRES: arm-registered-target
3// REQUIRES: aarch64-registered-target
4
5// RUN: rm -rf %t
6
7// Sanity check one of the compilations.
8// RUN: %clang_cc1 -triple aarch64-unknown-unknown -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs -fsyntax-only %s -verify -DSANITY_CHECK
9// expected-no-diagnostics
10
11// Check all the targets:
12// RUN: not %clang_cc1 -triple armv7-unknown-unknown -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs -fsyntax-only  %s 2> %t.aarch32
13// RUN: FileCheck %s -check-prefix=AARCH32 < %t.aarch32
14// RUN: not %clang_cc1 -triple aarch64-unknown-unknown -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs -fsyntax-only  %s 2> %t.aarch64
15// RUN: FileCheck %s -check-prefix=AARCH64 < %t.aarch64
16// RUN: not %clang_cc1 -triple i386-unknown-unknown -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs -fsyntax-only  %s 2> %t.x86_32
17// RUN: FileCheck %s -check-prefix=X86_32 < %t.x86_32
18// RUN: not %clang_cc1 -triple x86_64-unknown-unknown -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs -fsyntax-only  %s 2> %t.x86_64
19// RUN: FileCheck %s -check-prefix=X86_64 < %t.x86_64
20
21#ifndef SANITY_CHECK
22@import TargetFeatures;
23// AARCH32-NOT: module 'TargetFeatures' requires
24// AARCH64-NOT: module 'TargetFeatures' requires
25// X86_32-NOT: module 'TargetFeatures' requires
26// X86_64-NOT: module 'TargetFeatures' requires
27@import TargetFeatures.arm;
28// AARCH32-NOT: module 'TargetFeatures.arm' requires
29// AARCH64-NOT: module 'TargetFeatures.arm' requires
30// X86_32: module 'TargetFeatures.arm' requires feature 'arm'
31// X86_64: module 'TargetFeatures.arm' requires feature 'arm'
32@import TargetFeatures.arm.aarch32;
33// AARCH32-NOT: module 'TargetFeatures.arm.aarch32' requires
34// AARCH64: module 'TargetFeatures.arm.aarch32' requires feature 'aarch32'
35// X86_32: module 'TargetFeatures.arm.aarch32' requires feature 
36// X86_64: module 'TargetFeatures.arm.aarch32' requires feature
37#endif
38
39@import TargetFeatures.arm.aarch64;
40// AARCH32: module 'TargetFeatures.arm.aarch64' requires feature 'aarch64'
41// AARCH64-NOT: module 'TargetFeatures.arm.aarch64' requires
42// X86_32: module 'TargetFeatures.arm.aarch64' requires feature 
43// X86_64: module 'TargetFeatures.arm.aarch64' requires feature
44
45#ifndef SANITY_CHECK
46@import TargetFeatures.x86;
47// AARCH32:  module 'TargetFeatures.x86' requires feature 'x86'
48// AARCH64:  module 'TargetFeatures.x86' requires feature 'x86'
49// X86_32-NOT: module 'TargetFeatures.x86' requires
50// X86_64-NOT: module 'TargetFeatures.x86' requires
51@import TargetFeatures.x86.x86_32;
52// AARCH32:  module 'TargetFeatures.x86.x86_32' requires feature
53// AARCH64:  module 'TargetFeatures.x86.x86_32' requires feature
54// X86_32-NOT: module 'TargetFeatures.x86.x86_32' requires
55// X86_64: module 'TargetFeatures.x86.x86_32' requires feature 'x86_32'
56@import TargetFeatures.x86.x86_64;
57// AARCH32:  module 'TargetFeatures.x86.x86_64' requires feature
58// AARCH64:  module 'TargetFeatures.x86.x86_64' requires feature
59// X86_32: module 'TargetFeatures.x86.x86_64' requires feature 'x86_64'
60// X86_64-NOT: module 'TargetFeatures.x86.x86_64' requires
61#endif
62