Chandler Carruth | 0d745bc | 2015-03-14 04:47:43 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
| 2 | // RUN: cd %S |
Adrian Prantl | bc06858 | 2015-07-08 01:00:30 +0000 | [diff] [blame] | 3 | // REQUIRES: x86-registered-target |
Chandler Carruth | 0d745bc | 2015-03-14 04:47:43 +0000 | [diff] [blame] | 4 | // RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ |
| 5 | // RUN: -iquote Inputs/merge-target-features \ |
Richard Smith | 47972af | 2015-06-16 00:08:24 +0000 | [diff] [blame] | 6 | // RUN: -fno-implicit-modules \ |
Chandler Carruth | 0d745bc | 2015-03-14 04:47:43 +0000 | [diff] [blame] | 7 | // RUN: -fmodule-map-file-home-is-cwd \ |
| 8 | // RUN: -emit-module -fmodule-name=foo -o %t/foo.pcm \ |
| 9 | // RUN: -triple i386-unknown-unknown \ |
| 10 | // RUN: -target-cpu i386 -target-feature +sse2 \ |
| 11 | // RUN: Inputs/merge-target-features/module.modulemap |
| 12 | // |
| 13 | // RUN: not %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ |
| 14 | // RUN: -iquote Inputs/merge-target-features \ |
Richard Smith | 47972af | 2015-06-16 00:08:24 +0000 | [diff] [blame] | 15 | // RUN: -fno-implicit-modules \ |
Chandler Carruth | 0d745bc | 2015-03-14 04:47:43 +0000 | [diff] [blame] | 16 | // RUN: -fmodule-map-file-home-is-cwd \ |
| 17 | // RUN: -fmodule-map-file=Inputs/merge-target-features/module.modulemap \ |
| 18 | // RUN: -fmodule-file=%t/foo.pcm \ |
| 19 | // RUN: -triple i386-unknown-unknown \ |
| 20 | // RUN: -target-cpu i386 \ |
| 21 | // RUN: -fsyntax-only merge-target-features.cpp 2>&1 \ |
Richard Smith | 7a985e1 | 2018-05-24 20:03:51 +0000 | [diff] [blame] | 22 | // RUN: | FileCheck --check-prefix=SUBSET --implicit-check-not=error: %s |
| 23 | // SUBSET: error: AST file was compiled with the target feature '+sse2' but the current translation unit is not |
Richard Smith | 95dc57a | 2015-10-16 23:20:19 +0000 | [diff] [blame] | 24 | // SUBSET: error: {{.*}} configuration mismatch |
Chandler Carruth | 0d745bc | 2015-03-14 04:47:43 +0000 | [diff] [blame] | 25 | // |
| 26 | // RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ |
| 27 | // RUN: -iquote Inputs/merge-target-features \ |
Richard Smith | 47972af | 2015-06-16 00:08:24 +0000 | [diff] [blame] | 28 | // RUN: -fno-implicit-modules \ |
Chandler Carruth | 0d745bc | 2015-03-14 04:47:43 +0000 | [diff] [blame] | 29 | // RUN: -fmodule-map-file-home-is-cwd \ |
| 30 | // RUN: -fmodule-map-file=Inputs/merge-target-features/module.modulemap \ |
| 31 | // RUN: -fmodule-file=%t/foo.pcm \ |
| 32 | // RUN: -triple i386-unknown-unknown \ |
| 33 | // RUN: -target-cpu i386 -target-feature +sse2 \ |
| 34 | // RUN: -fsyntax-only merge-target-features.cpp 2>&1 \ |
| 35 | // RUN: | FileCheck --allow-empty --check-prefix=SAME %s |
| 36 | // SAME-NOT: error: |
| 37 | // |
| 38 | // RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ |
| 39 | // RUN: -iquote Inputs/merge-target-features \ |
Richard Smith | 47972af | 2015-06-16 00:08:24 +0000 | [diff] [blame] | 40 | // RUN: -fno-implicit-modules \ |
Chandler Carruth | 0d745bc | 2015-03-14 04:47:43 +0000 | [diff] [blame] | 41 | // RUN: -fmodule-map-file-home-is-cwd \ |
| 42 | // RUN: -fmodule-map-file=Inputs/merge-target-features/module.modulemap \ |
| 43 | // RUN: -fmodule-file=%t/foo.pcm \ |
| 44 | // RUN: -triple i386-unknown-unknown \ |
| 45 | // RUN: -target-cpu i386 -target-feature +sse2 -target-feature +sse3 \ |
| 46 | // RUN: -fsyntax-only merge-target-features.cpp 2>&1 \ |
| 47 | // RUN: | FileCheck --allow-empty --check-prefix=SUPERSET %s |
| 48 | // SUPERSET-NOT: error: |
| 49 | // |
| 50 | // RUN: not %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ |
| 51 | // RUN: -iquote Inputs/merge-target-features \ |
Richard Smith | 47972af | 2015-06-16 00:08:24 +0000 | [diff] [blame] | 52 | // RUN: -fno-implicit-modules \ |
Chandler Carruth | 0d745bc | 2015-03-14 04:47:43 +0000 | [diff] [blame] | 53 | // RUN: -fmodule-map-file-home-is-cwd \ |
| 54 | // RUN: -fmodule-map-file=Inputs/merge-target-features/module.modulemap \ |
| 55 | // RUN: -fmodule-file=%t/foo.pcm \ |
| 56 | // RUN: -triple i386-unknown-unknown \ |
| 57 | // RUN: -target-cpu i386 -target-feature +cx16 \ |
| 58 | // RUN: -fsyntax-only merge-target-features.cpp 2>&1 \ |
Richard Smith | 7a985e1 | 2018-05-24 20:03:51 +0000 | [diff] [blame] | 59 | // RUN: | FileCheck --check-prefix=MISMATCH --implicit-check-not=error: %s |
| 60 | // MISMATCH: error: AST file was compiled with the target feature '+sse2' but the current translation unit is not |
| 61 | // MISMATCH: error: current translation unit is compiled with the target feature '+cx16' but the AST file was not |
Richard Smith | 95dc57a | 2015-10-16 23:20:19 +0000 | [diff] [blame] | 62 | // MISMATCH: error: {{.*}} configuration mismatch |
Chandler Carruth | 0d745bc | 2015-03-14 04:47:43 +0000 | [diff] [blame] | 63 | |
| 64 | #include "foo.h" |
| 65 | |
| 66 | int test(int x) { |
| 67 | return foo(x); |
| 68 | } |