|
| 1 | +/// |
| 2 | +/// Perform several driver tests for SYCL -Xarch_device/host on Linux |
| 3 | +/// |
| 4 | + |
| 5 | +// UNSUPPORTED: system-windows |
| 6 | + |
| 7 | +/// ########################################################################### |
| 8 | + |
| 9 | +/// test behavior of -Xarch_device with 1 option for SYCL compiler, the flag |
| 10 | +/// should be passed to device compilation only. |
| 11 | +// RUN: %clangxx -fsycl %s -Xarch_device -fsanitize=address -### 2>&1 \ |
| 12 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_DEVICE_OPTION |
| 13 | +// RUN: %clangxx -fsycl %s -Xarch_device -fsanitize=address -### 2>&1 \ |
| 14 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_DEVICE_ONLY |
| 15 | +// SYCL_XARCH_DEVICE_OPTION: clang{{.*}} "-fsycl-is-device" |
| 16 | +// SYCL_XARCH_DEVICE_OPTION-SAME: -fsanitize=address |
| 17 | +// SYCL_XARCH_DEVICE_OPTION-SAME: -fsanitize-address-use-after-return=never |
| 18 | +// SYCL_XARCH_DEVICE_OPTION-SAME: -fno-sanitize-address-use-after-scope |
| 19 | +// SYCL_XARCH_DEVICE_OPTION-SAME: "-mllvm" "-asan-instrumentation-with-call-threshold=0" |
| 20 | +// SYCL_XARCH_DEVICE_OPTION-SAME: "-mllvm" "-asan-stack=0" |
| 21 | +// SYCL_XARCH_DEVICE_OPTION-SAME: "-mllvm" "-asan-globals=0" |
| 22 | +// SYCL_XARCH_DEVICE_ONLY: llc{{.*}} "-filetype=obj" |
| 23 | +// SYCL_XARCH_DEVICE_ONLY-NOT: fsanitize=address |
| 24 | + |
| 25 | +/// test behavior of -Xarch_device with multiple options for SYCL compiler, the |
| 26 | +/// flags should be passed to device compilation only. |
| 27 | +// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -DXARCH_DEVICE_TEST -mllvm -enable-merge-functions" -### 2>&1 \ |
| 28 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_DEVICE_OPTIONS1 |
| 29 | +// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -DXARCH_DEVICE_TEST -mllvm -enable-merge-functions" -### 2>&1 \ |
| 30 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_DEVICE_OPTIONS1 |
| 31 | +// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -DXARCH_DEVICE_TEST -mllvm -enable-merge-functions" -### 2>&1 \ |
| 32 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_DEVICE_OPTIONS2 |
| 33 | +// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -DXARCH_DEVICE_TEST -mllvm -enable-merge-functions" -### 2>&1 \ |
| 34 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_DEVICE_OPTIONS3 |
| 35 | +// SYCL_XARCH_DEVICE_OPTIONS1: clang{{.*}} "-fsycl-is-device" |
| 36 | +// SYCL_XARCH_DEVICE_OPTIONS1-SAME: -fsanitize=address |
| 37 | +// SYCL_XARCH_DEVICE_OPTIONS1-SAME: -fsanitize-address-use-after-return=never |
| 38 | +// SYCL_XARCH_DEVICE_OPTIONS1-SAME: -fno-sanitize-address-use-after-scope |
| 39 | +// SYCL_XARCH_DEVICE_OPTIONS1-SAME: "-mllvm" "-asan-instrumentation-with-call-threshold=0" |
| 40 | +// SYCL_XARCH_DEVICE_OPTIONS1-SAME: "-mllvm" "-asan-stack=0" |
| 41 | +// SYCL_XARCH_DEVICE_OPTIONS1-SAME: "-mllvm" "-asan-globals=0" |
| 42 | +// SYCL_XARCH_DEVICE_OPTIONS2: clang{{.*}} "-fsycl-is-device" |
| 43 | +// SYCL_XARCH_DEVICE_OPTIONS2-SAME: XARCH_DEVICE_TEST |
| 44 | +// SYCL_XARCH_DEVICE_OPTIONS3: clang{{.*}} "-fsycl-is-device" |
| 45 | +// SYCL_XARCH_DEVICE_OPTIONS3-SAME: "-mllvm" "-enable-merge-functions" |
| 46 | + |
| 47 | + |
| 48 | +/// test behavior of -Xarch_host with 1 option for SYCL compiler, the flag |
| 49 | +/// should be passed to host compilation only. |
| 50 | +// RUN: %clangxx -fsycl %s -Xarch_host -fsanitize=address -### 2>&1 \ |
| 51 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_OPTION |
| 52 | +// RUN: %clangxx -fsycl %s -Xarch_host -fsanitize=address -### 2>&1 \ |
| 53 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_ONLY |
| 54 | +// SYCL_XARCH_HOST_OPTION: clang{{.*}} "-fsycl-is-host" |
| 55 | +// SYCL_XARCH_HOST_OPTION-SAME: -fsanitize=address |
| 56 | +// SYCL_XARCH_HOST_OPTION-SAME: -fsanitize-address-use-after-scope |
| 57 | +// SYCL_XARCH_HOST_OPTION-NEXT: libclang_rt.asan |
| 58 | +// SYCL_XARCH_HOST_ONLY: clang{{.*}} "-fsycl-is-device" |
| 59 | +// SYCL_XARCH_HOST_ONLY-NOT: -fsanitize=address |
| 60 | +// SYCL_XARCH_HOST_ONLY: clang{{.*}} "-fsycl-is-host" |
| 61 | + |
| 62 | +/// test behavior of -Xarch_host with multiple options for SYCL compiler, the |
| 63 | +/// flags should be passed to host compilation only. |
| 64 | +// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -DXARCH_HOST_TEST -mllvm -enable-merge-functions" -### 2>&1 \ |
| 65 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_OPTIONS1 |
| 66 | +// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -DXARCH_HOST_TEST -mllvm -enable-merge-functions" -### 2>&1 \ |
| 67 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_OPTIONS2 |
| 68 | +// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -DXARCH_HOST_TEST -mllvm -enable-merge-functions" -### 2>&1 \ |
| 69 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_OPTIONS3 |
| 70 | +// SYCL_XARCH_HOST_OPTIONS1: clang{{.*}} "-fsycl-is-host" |
| 71 | +// SYCL_XARCH_HOST_OPTIONS1-SAME: -fsanitize=address |
| 72 | +// SYCL_XARCH_HOST_OPTIONS1-SAME: -fsanitize-address-use-after-scope |
| 73 | +// SYCL_XARCH_HOST_OPTIONS2: clang{{.*}} "-fsycl-is-host" |
| 74 | +// SYCL_XARCH_HOST_OPTIONS2-SAME: XARCH_HOST_TEST |
| 75 | +// SYCL_XARCH_HOST_OPTIONS3: clang{{.*}} "-fsycl-is-host" |
| 76 | +// SYCL_XARCH_HOST_OPTIONS3-SAME: "-mllvm" "-enable-merge-functions" |
| 77 | + |
| 78 | +// test behavior of combination of -Xarch_device and -Xarch_device. |
| 79 | +// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -mllvm -enable-merge-functions" \ |
| 80 | +// RUN: -Xarch_host "-fsanitize=memory -DUSE_XARCH_HOST -fno-builtin" -### 2>&1 \ |
| 81 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_COM_DEVICE_OPTIONS1 |
| 82 | +// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -mllvm -enable-merge-functions" \ |
| 83 | +// RUN: -Xarch_host "-fsanitize=memory -DUSE_XARCH_HOST -fno-builtin" -### 2>&1 \ |
| 84 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_COM_DEVICE_OPTIONS2 |
| 85 | +// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -mllvm -enable-merge-functions" \ |
| 86 | +// RUN: -Xarch_host "-fsanitize=memory -DUSE_XARCH_HOST -fno-builtin" -### 2>&1 \ |
| 87 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_COM_NO_DEVICE |
| 88 | +// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -mllvm -enable-merge-functions" \ |
| 89 | +// RUN: -Xarch_host "-fsanitize=memory -DUSE_XARCH_HOST -fno-builtin" -### 2>&1 \ |
| 90 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_COM_HOST_OPTIONS1 |
| 91 | +// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -mllvm -enable-merge-functions" \ |
| 92 | +// RUN: -Xarch_host "-fsanitize=memory -DUSE_XARCH_HOST -fno-builtin" -### 2>&1 \ |
| 93 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_COM_HOST_OPTIONS2 |
| 94 | +// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -mllvm -enable-merge-functions" \ |
| 95 | +// RUN: -Xarch_host "-fsanitize=memory -DUSE_XARCH_HOST -fno-builtin" -### 2>&1 \ |
| 96 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_COM_HOST_OPTIONS3 |
| 97 | +// RUN: %clangxx -fsycl %s -Xarch_device "-fsanitize=address -mllvm -enable-merge-functions" \ |
| 98 | +// RUN: -Xarch_host "-fsanitize=memory -DUSE_XARCH_HOST -fno-builtin" -### 2>&1 \ |
| 99 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_COM_NO_HOST |
| 100 | +// SYCL_XARCH_COM_DEVICE_OPTIONS1: clang{{.*}} "-fsycl-is-device" |
| 101 | +// SYCL_XARCH_COM_DEVICE_OPTIONS1-SAME: -fsanitize=address |
| 102 | +// SYCL_XARCH_COM_DEVICE_OPTIONS1-SAME: -fsanitize-address-use-after-return=never |
| 103 | +// SYCL_XARCH_COM_DEVICE_OPTIONS1-SAME: -fno-sanitize-address-use-after-scope |
| 104 | +// SYCL_XARCH_COM_DEVICE_OPTIONS1-SAME: "-mllvm" "-asan-instrumentation-with-call-threshold=0" |
| 105 | +// SYCL_XARCH_COM_DEVICE_OPTIONS1-SAME: "-mllvm" "-asan-stack=0" |
| 106 | +// SYCL_XARCH_COM_DEVICE_OPTIONS1-SAME: "-mllvm" "-asan-globals=0" |
| 107 | +// SYCL_XARCH_COM_DEVICE_OPTIONS2: clang{{.*}} "-fsycl-is-device" |
| 108 | +// SYCL_XARCH_COM_DEVICE_OPTIONS2-SAME: "-mllvm" "-enable-merge-functions" |
| 109 | +// SYCL_XARCH_COM_NO_DEVICE: clang{{.*}} "-fsycl-is-device" |
| 110 | +// SYCL_XARCH_COM_NO_DEVICE-NOT: USE_XARCH_HOST |
| 111 | +// SYCL_XARCH_COM_NO_DEVICE: clang{{.*}} "-fsycl-is-host" |
| 112 | +// SYCL_XARCH_COM_HOST_OPTIONS1: clang{{.*}} "-fsycl-is-host" |
| 113 | +// SYCL_XARCH_COM_HOST_OPTIONS1-SAME: -fsanitize=memory |
| 114 | +// SYCL_XARCH_COM_HOST_OPTIONS1-NEXT: libclang_rt.msan |
| 115 | +// SYCL_XARCH_COM_HOST_OPTIONS2: clang{{.*}} "-fsycl-is-host" |
| 116 | +// SYCL_XARCH_COM_HOST_OPTIONS2-SAME: USE_XARCH_HOST |
| 117 | +// SYCL_XARCH_COM_HOST_OPTIONS3: clang{{.*}} "-fsycl-is-host" |
| 118 | +// SYCL_XARCH_COM_HOST_OPTIONS3-SAME: -fno-builtin |
| 119 | +// SYCL_XARCH_COM_NO_HOST: clang{{.*}} "-fsycl-is-host" |
| 120 | +// SYCL_XARCH_COM_NO_HOST-NOT: "-mllvm" "-enable-merge-functions" |
| 121 | + |
| 122 | + |
| 123 | +// test behavior of multiple usage of -Xarch_host in single command line |
| 124 | +// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -mllvm -enable-merge-functions" \ |
| 125 | +// RUN: -Xarch_host -DFOO -Xarch_host -DFOO1 -### 2>&1 \ |
| 126 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_MULTIPLE1 |
| 127 | +// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -mllvm -enable-merge-functions" \ |
| 128 | +// RUN: -Xarch_host -DFOO -Xarch_host -DFOO1 -### 2>&1 \ |
| 129 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_MULTIPLE2 |
| 130 | +// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -mllvm -enable-merge-functions" \ |
| 131 | +// RUN: -Xarch_host -DFOO -Xarch_host -DFOO1 -### 2>&1 \ |
| 132 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_MULTIPLE3 |
| 133 | +// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -mllvm -enable-merge-functions" \ |
| 134 | +// RUN: -Xarch_host -DFOO -Xarch_host -DFOO1 -### 2>&1 \ |
| 135 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_HOST_MULTIPLE4 |
| 136 | +// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -mllvm -enable-merge-functions" \ |
| 137 | +// RUN: -Xarch_host -DFOO -Xarch_host -DFOO1 -### 2>&1 \ |
| 138 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_NO_DEVICE_MULTIPLE1 |
| 139 | +// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -mllvm -enable-merge-functions" \ |
| 140 | +// RUN: -Xarch_host -DFOO -Xarch_host -DFOO1 -### 2>&1 \ |
| 141 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_NO_DEVICE_MULTIPLE2 |
| 142 | +// RUN: %clangxx -fsycl %s -Xarch_host "-fsanitize=address -mllvm -enable-merge-functions" \ |
| 143 | +// RUN: -Xarch_host -DFOO -Xarch_host -DFOO1 -### 2>&1 \ |
| 144 | +// RUN: | FileCheck %s -check-prefix=SYCL_XARCH_NO_DEVICE_MULTIPLE3 |
| 145 | +// SYCL_XARCH_HOST_MULTIPLE1: clang{{.*}} "-fsycl-is-host" |
| 146 | +// SYCL_XARCH_HOST_MULTIPLE1-SAME: -fsanitize=address |
| 147 | +// SYCL_XARCH_HOST_MULTIPLE1-NEXT: libclang_rt.asan |
| 148 | +// SYCL_XARCH_HOST_MULTIPLE2: clang{{.*}} "-fsycl-is-host" |
| 149 | +// SYCL_XARCH_HOST_MULTIPLE2-SAME: "-mllvm" "-enable-merge-functions" |
| 150 | +// SYCL_XARCH_HOST_MULTIPLE3: clang{{.*}} "-fsycl-is-host" |
| 151 | +// SYCL_XARCH_HOST_MULTIPLE3-SAME: "FOO" |
| 152 | +// SYCL_XARCH_HOST_MULTIPLE4: clang{{.*}} "-fsycl-is-host" |
| 153 | +// SYCL_XARCH_HOST_MULTIPLE4-SAME: "FOO1" |
| 154 | +// SYCL_XARCH_NO_DEVICE_MULTIPLE1: clang{{.*}} "-fsycl-is-device" |
| 155 | +// SYCL_XARCH_NO_DEVICE_MULTIPLE1-NOT: -fsanitize=address |
| 156 | +// SYCL_XARCH_NO_DEVICE_MULTIPLE1: llc{{.*}} "-filetype=obj" |
| 157 | +// SYCL_XARCH_NO_DEVICE_MULTIPLE2: clang{{.*}} "-fsycl-is-device" |
| 158 | +// SYCL_XARCH_NO_DEVICE_MULTIPLE2-NOT: "-mllvm" "-enable-merge-functions" |
| 159 | +// SYCL_XARCH_NO_DEVICE_MULTIPLE2: llc{{.*}} "-filetype=obj" |
| 160 | +// SYCL_XARCH_NO_DEVICE_MULTIPLE3: clang{{.*}} "-fsycl-is-device" |
| 161 | +// SYCL_XARCH_NO_DEVICE_MULTIPLE3-NOT: "FOO" |
| 162 | +// SYCL_XARCH_NO_DEVICE_MULTIPLE3: llc{{.*}} "-filetype=obj" |
0 commit comments