summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/attr-target-x86.c6
-rw-r--r--test/CodeGen/avx512bitalg-builtins.c54
-rw-r--r--test/CodeGen/avx512vbmi2-builtins.c304
-rw-r--r--test/CodeGen/avx512vlbitalg-builtins.c104
-rw-r--r--test/CodeGen/avx512vlvbmi2-builtins.c604
-rw-r--r--test/CodeGen/avx512vlvnni-builtins.c148
-rw-r--r--test/CodeGen/avx512vnni-builtins.c76
-rw-r--r--test/CodeGen/gfni-builtins.c182
-rw-r--r--test/CodeGen/vaes-builtins.c55
-rw-r--r--test/CodeGen/vpclmulqdq-builtins.c17
-rw-r--r--test/CodeGenCXX/ubsan-vtable-checks.cpp12
-rw-r--r--test/Driver/x86-target-features.c39
-rw-r--r--test/Index/skipped-bodies-ctors.cpp16
-rw-r--r--test/OpenMP/nvptx_data_sharing.cpp4
-rw-r--r--test/OpenMP/nvptx_target_teams_codegen.cpp4
-rw-r--r--test/OpenMP/target_enter_data_depend_codegen.cpp378
-rw-r--r--test/OpenMP/target_exit_data_depend_codegen.cpp378
-rw-r--r--test/OpenMP/target_update_depend_codegen.cpp378
-rw-r--r--test/OpenMP/teams_distribute_parallel_for_num_threads_codegen.cpp6
-rw-r--r--test/OpenMP/teams_distribute_parallel_for_simd_num_threads_codegen.cpp6
-rw-r--r--test/Parser/c2x-attributes.c6
-rw-r--r--test/Parser/cxx-decl.cpp2
-rw-r--r--test/Parser/cxx0x-attributes.cpp9
-rw-r--r--test/Preprocessor/arm-acle-6.4.c10
-rw-r--r--test/Preprocessor/arm-acle-6.5.c4
-rw-r--r--test/Preprocessor/arm-target-features.c68
-rw-r--r--test/Preprocessor/predefined-arch-macros.c24
-rw-r--r--test/Preprocessor/x86_target_features.c68
28 files changed, 2899 insertions, 63 deletions
diff --git a/test/CodeGen/attr-target-x86.c b/test/CodeGen/attr-target-x86.c
index 6ec2d6578dc43..9e46de74916bc 100644
--- a/test/CodeGen/attr-target-x86.c
+++ b/test/CodeGen/attr-target-x86.c
@@ -38,9 +38,9 @@ int __attribute__((target("arch=lakemont,mmx"))) lake(int a) { return 4; }
// CHECK: lake{{.*}} #7
// CHECK: #0 = {{.*}}"target-cpu"="i686" "target-features"="+x87"
// CHECK: #1 = {{.*}}"target-cpu"="ivybridge" "target-features"="+aes,+avx,+cx16,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt"
-// CHECK: #2 = {{.*}}"target-cpu"="i686" "target-features"="+x87,-aes,-avx,-avx2,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vl,-avx512vpopcntdq,-f16c,-fma,-fma4,-pclmul,-sha,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-xop,-xsave,-xsaveopt"
+// CHECK: #2 = {{.*}}"target-cpu"="i686" "target-features"="+x87,-aes,-avx,-avx2,-avx512bitalg,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vbmi2,-avx512vl,-avx512vnni,-avx512vpopcntdq,-f16c,-fma,-fma4,-gfni,-pclmul,-sha,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-vaes,-vpclmulqdq,-xop,-xsave,-xsaveopt"
// CHECK: #3 = {{.*}}"target-cpu"="i686" "target-features"="+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87"
-// CHECK: #4 = {{.*}}"target-cpu"="i686" "target-features"="+x87,-avx,-avx2,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vl,-avx512vpopcntdq,-f16c,-fma,-fma4,-sse4.1,-sse4.2,-xop,-xsave,-xsaveopt"
-// CHECK: #5 = {{.*}}"target-cpu"="ivybridge" "target-features"="+avx,+cx16,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt,-aes"
+// CHECK: #4 = {{.*}}"target-cpu"="i686" "target-features"="+x87,-avx,-avx2,-avx512bitalg,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vbmi2,-avx512vl,-avx512vnni,-avx512vpopcntdq,-f16c,-fma,-fma4,-sse4.1,-sse4.2,-vaes,-vpclmulqdq,-xop,-xsave,-xsaveopt"
+// CHECK: #5 = {{.*}}"target-cpu"="ivybridge" "target-features"="+avx,+cx16,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt,-aes,-vaes"
// CHECK: #6 = {{.*}}"target-cpu"="i686" "target-features"="+x87,-3dnow,-3dnowa,-mmx"
// CHECK: #7 = {{.*}}"target-cpu"="lakemont" "target-features"="+mmx"
diff --git a/test/CodeGen/avx512bitalg-builtins.c b/test/CodeGen/avx512bitalg-builtins.c
new file mode 100644
index 0000000000000..5770c662f07e7
--- /dev/null
+++ b/test/CodeGen/avx512bitalg-builtins.c
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512bitalg -emit-llvm -o - -Wall -Werror | FileCheck %s
+
+#include <immintrin.h>
+
+__m512i test_mm512_popcnt_epi16(__m512i __A) {
+ // CHECK-LABEL: @test_mm512_popcnt_epi16
+ // CHECK: @llvm.ctpop.v32i16
+ return _mm512_popcnt_epi16(__A);
+}
+
+__m512i test_mm512_mask_popcnt_epi16(__m512i __A, __mmask32 __U, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_popcnt_epi16
+ // CHECK: @llvm.ctpop.v32i16
+ // CHECK: select <32 x i1> %{{[0-9]+}}, <32 x i16> %{{[0-9]+}}, <32 x i16> {{.*}}
+ return _mm512_mask_popcnt_epi16(__A, __U, __B);
+}
+__m512i test_mm512_maskz_popcnt_epi16(__mmask32 __U, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_popcnt_epi16
+ // CHECK: @llvm.ctpop.v32i16
+ // CHECK: select <32 x i1> %{{[0-9]+}}, <32 x i16> %{{[0-9]+}}, <32 x i16> {{.*}}
+ return _mm512_maskz_popcnt_epi16(__U, __B);
+}
+
+__m512i test_mm512_popcnt_epi8(__m512i __A) {
+ // CHECK-LABEL: @test_mm512_popcnt_epi8
+ // CHECK: @llvm.ctpop.v64i8
+ return _mm512_popcnt_epi8(__A);
+}
+
+__m512i test_mm512_mask_popcnt_epi8(__m512i __A, __mmask64 __U, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_popcnt_epi8
+ // CHECK: @llvm.ctpop.v64i8
+ // CHECK: select <64 x i1> %{{[0-9]+}}, <64 x i8> %{{[0-9]+}}, <64 x i8> {{.*}}
+ return _mm512_mask_popcnt_epi8(__A, __U, __B);
+}
+__m512i test_mm512_maskz_popcnt_epi8(__mmask64 __U, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_popcnt_epi8
+ // CHECK: @llvm.ctpop.v64i8
+ // CHECK: select <64 x i1> %{{[0-9]+}}, <64 x i8> %{{[0-9]+}}, <64 x i8> {{.*}}
+ return _mm512_maskz_popcnt_epi8(__U, __B);
+}
+
+__mmask64 test_mm512_mask_bitshuffle_epi64_mask(__mmask64 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_bitshuffle_epi64_mask
+ // CHECK: @llvm.x86.avx512.mask.vpshufbitqmb.512
+ return _mm512_mask_bitshuffle_epi64_mask(__U, __A, __B);
+}
+
+__mmask64 test_mm512_bitshuffle_epi64_mask(__m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_bitshuffle_epi64_mask
+ // CHECK: @llvm.x86.avx512.mask.vpshufbitqmb.512
+ return _mm512_bitshuffle_epi64_mask(__A, __B);
+}
+
diff --git a/test/CodeGen/avx512vbmi2-builtins.c b/test/CodeGen/avx512vbmi2-builtins.c
new file mode 100644
index 0000000000000..4da21e39d4e37
--- /dev/null
+++ b/test/CodeGen/avx512vbmi2-builtins.c
@@ -0,0 +1,304 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512vbmi2 -emit-llvm -o - -Wall -Werror | FileCheck %s
+
+#include <immintrin.h>
+
+__m512i test_mm512_mask_compress_epi16(__m512i __S, __mmask32 __U, __m512i __D) {
+ // CHECK-LABEL: @test_mm512_mask_compress_epi16
+ // CHECK: @llvm.x86.avx512.mask.compress.w.512
+ return _mm512_mask_compress_epi16(__S, __U, __D);
+}
+
+__m512i test_mm512_maskz_compress_epi16(__mmask32 __U, __m512i __D) {
+ // CHECK-LABEL: @test_mm512_maskz_compress_epi16
+ // CHECK: @llvm.x86.avx512.mask.compress.w.512
+ return _mm512_maskz_compress_epi16(__U, __D);
+}
+
+__m512i test_mm512_mask_compress_epi8(__m512i __S, __mmask64 __U, __m512i __D) {
+ // CHECK-LABEL: @test_mm512_mask_compress_epi8
+ // CHECK: @llvm.x86.avx512.mask.compress.b.512
+ return _mm512_mask_compress_epi8(__S, __U, __D);
+}
+
+__m512i test_mm512_maskz_compress_epi8(__mmask64 __U, __m512i __D) {
+ // CHECK-LABEL: @test_mm512_maskz_compress_epi8
+ // CHECK: @llvm.x86.avx512.mask.compress.b.512
+ return _mm512_maskz_compress_epi8(__U, __D);
+}
+
+void test_mm512_mask_compressstoreu_epi16(void *__P, __mmask32 __U, __m512i __D) {
+ // CHECK-LABEL: @test_mm512_mask_compressstoreu_epi16
+ // CHECK: @llvm.x86.avx512.mask.compress.store.w.512
+ _mm512_mask_compressstoreu_epi16(__P, __U, __D);
+}
+
+void test_mm512_mask_compressstoreu_epi8(void *__P, __mmask64 __U, __m512i __D) {
+ // CHECK-LABEL: @test_mm512_mask_compressstoreu_epi8
+ // CHECK: @llvm.x86.avx512.mask.compress.store.b.512
+ _mm512_mask_compressstoreu_epi8(__P, __U, __D);
+}
+
+__m512i test_mm512_mask_expand_epi16(__m512i __S, __mmask32 __U, __m512i __D) {
+ // CHECK-LABEL: @test_mm512_mask_expand_epi16
+ // CHECK: @llvm.x86.avx512.mask.expand.w.512
+ return _mm512_mask_expand_epi16(__S, __U, __D);
+}
+
+__m512i test_mm512_maskz_expand_epi16(__mmask32 __U, __m512i __D) {
+ // CHECK-LABEL: @test_mm512_maskz_expand_epi16
+ // CHECK: @llvm.x86.avx512.mask.expand.w.512
+ return _mm512_maskz_expand_epi16(__U, __D);
+}
+
+__m512i test_mm512_mask_expand_epi8(__m512i __S, __mmask64 __U, __m512i __D) {
+ // CHECK-LABEL: @test_mm512_mask_expand_epi8
+ // CHECK: @llvm.x86.avx512.mask.expand.b.512
+ return _mm512_mask_expand_epi8(__S, __U, __D);
+}
+
+__m512i test_mm512_maskz_expand_epi8(__mmask64 __U, __m512i __D) {
+ // CHECK-LABEL: @test_mm512_maskz_expand_epi8
+ // CHECK: @llvm.x86.avx512.mask.expand.b.512
+ return _mm512_maskz_expand_epi8(__U, __D);
+}
+
+__m512i test_mm512_mask_expandloadu_epi16(__m512i __S, __mmask32 __U, void const* __P) {
+ // CHECK-LABEL: @test_mm512_mask_expandloadu_epi16
+ // CHECK: @llvm.x86.avx512.mask.expand.load.w.512
+ return _mm512_mask_expandloadu_epi16(__S, __U, __P);
+}
+
+__m512i test_mm512_maskz_expandloadu_epi16(__mmask32 __U, void const* __P) {
+ // CHECK-LABEL: @test_mm512_maskz_expandloadu_epi16
+ // CHECK: @llvm.x86.avx512.mask.expand.load.w.512
+ return _mm512_maskz_expandloadu_epi16(__U, __P);
+}
+
+__m512i test_mm512_mask_expandloadu_epi8(__m512i __S, __mmask64 __U, void const* __P) {
+ // CHECK-LABEL: @test_mm512_mask_expandloadu_epi8
+ // CHECK: @llvm.x86.avx512.mask.expand.load.b.512
+ return _mm512_mask_expandloadu_epi8(__S, __U, __P);
+}
+
+__m512i test_mm512_maskz_expandloadu_epi8(__mmask64 __U, void const* __P) {
+ // CHECK-LABEL: @test_mm512_maskz_expandloadu_epi8
+ // CHECK: @llvm.x86.avx512.mask.expand.load.b.512
+ return _mm512_maskz_expandloadu_epi8(__U, __P);
+}
+
+__m512i test_mm512_mask_shldi_epi64(__m512i __S, __mmask8 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_shldi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshld.q.512
+ return _mm512_mask_shldi_epi64(__S, __U, __A, __B, 127);
+}
+
+__m512i test_mm512_maskz_shldi_epi64(__mmask8 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_shldi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshld.q.512
+ return _mm512_maskz_shldi_epi64(__U, __A, __B, 63);
+}
+
+__m512i test_mm512_shldi_epi64(__m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_shldi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshld.q.512
+ return _mm512_shldi_epi64(__A, __B, 31);
+}
+
+__m512i test_mm512_mask_shldi_epi32(__m512i __S, __mmask16 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_shldi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshld.d.512
+ return _mm512_mask_shldi_epi32(__S, __U, __A, __B, 127);
+}
+
+__m512i test_mm512_maskz_shldi_epi32(__mmask16 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_shldi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshld.d.512
+ return _mm512_maskz_shldi_epi32(__U, __A, __B, 63);
+}
+
+__m512i test_mm512_shldi_epi32(__m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_shldi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshld.d.512
+ return _mm512_shldi_epi32(__A, __B, 31);
+}
+
+__m512i test_mm512_mask_shldi_epi16(__m512i __S, __mmask32 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_shldi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshld.w.512
+ return _mm512_mask_shldi_epi16(__S, __U, __A, __B, 127);
+}
+
+__m512i test_mm512_maskz_shldi_epi16(__mmask32 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_shldi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshld.w.512
+ return _mm512_maskz_shldi_epi16(__U, __A, __B, 63);
+}
+
+__m512i test_mm512_shldi_epi16(__m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_shldi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshld.w.512
+ return _mm512_shldi_epi16(__A, __B, 31);
+}
+
+__m512i test_mm512_mask_shrdi_epi64(__m512i __S, __mmask8 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_shrdi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.q.512
+ return _mm512_mask_shrdi_epi64(__S, __U, __A, __B, 127);
+}
+
+__m512i test_mm512_maskz_shrdi_epi64(__mmask8 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_shrdi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.q.512
+ return _mm512_maskz_shrdi_epi64(__U, __A, __B, 63);
+}
+
+__m512i test_mm512_shrdi_epi64(__m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_shrdi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.q.512
+ return _mm512_shrdi_epi64(__A, __B, 31);
+}
+
+__m512i test_mm512_mask_shrdi_epi32(__m512i __S, __mmask16 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_shrdi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.d.512
+ return _mm512_mask_shrdi_epi32(__S, __U, __A, __B, 127);
+}
+
+__m512i test_mm512_maskz_shrdi_epi32(__mmask16 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_shrdi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.d.512
+ return _mm512_maskz_shrdi_epi32(__U, __A, __B, 63);
+}
+
+__m512i test_mm512_shrdi_epi32(__m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_shrdi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.d.512
+ return _mm512_shrdi_epi32(__A, __B, 31);
+}
+
+__m512i test_mm512_mask_shrdi_epi16(__m512i __S, __mmask32 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_shrdi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.w.512
+ return _mm512_mask_shrdi_epi16(__S, __U, __A, __B, 127);
+}
+
+__m512i test_mm512_maskz_shrdi_epi16(__mmask32 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_shrdi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.w.512
+ return _mm512_maskz_shrdi_epi16(__U, __A, __B, 63);
+}
+
+__m512i test_mm512_shrdi_epi16(__m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_shrdi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.w.512
+ return _mm512_shrdi_epi16(__A, __B, 31);
+}
+
+__m512i test_mm512_mask_shldv_epi64(__m512i __S, __mmask8 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_shldv_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.q.512
+ return _mm512_mask_shldv_epi64(__S, __U, __A, __B);
+}
+
+__m512i test_mm512_maskz_shldv_epi64(__mmask8 __U, __m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_shldv_epi64
+ // CHECK: @llvm.x86.avx512.maskz.vpshldv.q.512
+ return _mm512_maskz_shldv_epi64(__U, __S, __A, __B);
+}
+
+__m512i test_mm512_shldv_epi64(__m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_shldv_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.q.512
+ return _mm512_shldv_epi64(__S, __A, __B);
+}
+
+__m512i test_mm512_mask_shldv_epi32(__m512i __S, __mmask16 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_shldv_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.d.512
+ return _mm512_mask_shldv_epi32(__S, __U, __A, __B);
+}
+
+__m512i test_mm512_maskz_shldv_epi32(__mmask16 __U, __m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_shldv_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpshldv.d.512
+ return _mm512_maskz_shldv_epi32(__U, __S, __A, __B);
+}
+
+__m512i test_mm512_shldv_epi32(__m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_shldv_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.d.512
+ return _mm512_shldv_epi32(__S, __A, __B);
+}
+
+__m512i test_mm512_mask_shldv_epi16(__m512i __S, __mmask32 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_shldv_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.w.512
+ return _mm512_mask_shldv_epi16(__S, __U, __A, __B);
+}
+
+__m512i test_mm512_maskz_shldv_epi16(__mmask32 __U, __m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_shldv_epi16
+ // CHECK: @llvm.x86.avx512.maskz.vpshldv.w.512
+ return _mm512_maskz_shldv_epi16(__U, __S, __A, __B);
+}
+
+__m512i test_mm512_shldv_epi16(__m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_shldv_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.w.512
+ return _mm512_shldv_epi16(__S, __A, __B);
+}
+
+__m512i test_mm512_mask_shrdv_epi64(__m512i __S, __mmask8 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_shrdv_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.q.512
+ return _mm512_mask_shrdv_epi64(__S, __U, __A, __B);
+}
+
+__m512i test_mm512_maskz_shrdv_epi64(__mmask8 __U, __m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_shrdv_epi64
+ // CHECK: @llvm.x86.avx512.maskz.vpshrdv.q.512
+ return _mm512_maskz_shrdv_epi64(__U, __S, __A, __B);
+}
+
+__m512i test_mm512_shrdv_epi64(__m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_shrdv_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.q.512
+ return _mm512_shrdv_epi64(__S, __A, __B);
+}
+
+__m512i test_mm512_mask_shrdv_epi32(__m512i __S, __mmask16 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_shrdv_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.d.512
+ return _mm512_mask_shrdv_epi32(__S, __U, __A, __B);
+}
+
+__m512i test_mm512_maskz_shrdv_epi32(__mmask16 __U, __m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_shrdv_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpshrdv.d.512
+ return _mm512_maskz_shrdv_epi32(__U, __S, __A, __B);
+}
+
+__m512i test_mm512_shrdv_epi32(__m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_shrdv_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.d.512
+ return _mm512_shrdv_epi32(__S, __A, __B);
+}
+
+__m512i test_mm512_mask_shrdv_epi16(__m512i __S, __mmask32 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_shrdv_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.w.512
+ return _mm512_mask_shrdv_epi16(__S, __U, __A, __B);
+}
+
+__m512i test_mm512_maskz_shrdv_epi16(__mmask32 __U, __m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_shrdv_epi16
+ // CHECK: @llvm.x86.avx512.maskz.vpshrdv.w.512
+ return _mm512_maskz_shrdv_epi16(__U, __S, __A, __B);
+}
+
+__m512i test_mm512_shrdv_epi16(__m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_shrdv_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.w.512
+ return _mm512_shrdv_epi16(__S, __A, __B);
+}
+
diff --git a/test/CodeGen/avx512vlbitalg-builtins.c b/test/CodeGen/avx512vlbitalg-builtins.c
new file mode 100644
index 0000000000000..9b2a1a469b2a5
--- /dev/null
+++ b/test/CodeGen/avx512vlbitalg-builtins.c
@@ -0,0 +1,104 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512bitalg -target-feature +avx512vl -emit-llvm -o - -Wall -Werror | FileCheck %s
+
+#include <immintrin.h>
+
+__m256i test_mm256_popcnt_epi16(__m256i __A) {
+ // CHECK-LABEL: @test_mm256_popcnt_epi16
+ // CHECK: @llvm.ctpop.v16i16
+ return _mm256_popcnt_epi16(__A);
+}
+
+__m256i test_mm256_mask_popcnt_epi16(__m256i __A, __mmask16 __U, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_popcnt_epi16
+ // CHECK: @llvm.ctpop.v16i16
+ // CHECK: select <16 x i1> %{{[0-9]+}}, <16 x i16> %{{[0-9]+}}, <16 x i16> {{.*}}
+ return _mm256_mask_popcnt_epi16(__A, __U, __B);
+}
+__m256i test_mm256_maskz_popcnt_epi16(__mmask16 __U, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_popcnt_epi16
+ // CHECK: @llvm.ctpop.v16i16
+ // CHECK: select <16 x i1> %{{[0-9]+}}, <16 x i16> %{{[0-9]+}}, <16 x i16> {{.*}}
+ return _mm256_maskz_popcnt_epi16(__U, __B);
+}
+
+__m128i test_mm128_popcnt_epi16(__m128i __A) {
+ // CHECK-LABEL: @test_mm128_popcnt_epi16
+ // CHECK: @llvm.ctpop.v8i16
+ return _mm128_popcnt_epi16(__A);
+}
+
+__m128i test_mm128_mask_popcnt_epi16(__m128i __A, __mmask8 __U, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_popcnt_epi16
+ // CHECK: @llvm.ctpop.v8i16
+ // CHECK: select <8 x i1> %{{[0-9]+}}, <8 x i16> %{{[0-9]+}}, <8 x i16> {{.*}}
+ return _mm128_mask_popcnt_epi16(__A, __U, __B);
+}
+__m128i test_mm128_maskz_popcnt_epi16(__mmask8 __U, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_popcnt_epi16
+ // CHECK: @llvm.ctpop.v8i16
+ // CHECK: select <8 x i1> %{{[0-9]+}}, <8 x i16> %{{[0-9]+}}, <8 x i16> {{.*}}
+ return _mm128_maskz_popcnt_epi16(__U, __B);
+}
+
+__m256i test_mm256_popcnt_epi8(__m256i __A) {
+ // CHECK-LABEL: @test_mm256_popcnt_epi8
+ // CHECK: @llvm.ctpop.v32i8
+ return _mm256_popcnt_epi8(__A);
+}
+
+__m256i test_mm256_mask_popcnt_epi8(__m256i __A, __mmask32 __U, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_popcnt_epi8
+ // CHECK: @llvm.ctpop.v32i8
+ // CHECK: select <32 x i1> %{{[0-9]+}}, <32 x i8> %{{[0-9]+}}, <32 x i8> {{.*}}
+ return _mm256_mask_popcnt_epi8(__A, __U, __B);
+}
+__m256i test_mm256_maskz_popcnt_epi8(__mmask32 __U, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_popcnt_epi8
+ // CHECK: @llvm.ctpop.v32i8
+ // CHECK: select <32 x i1> %{{[0-9]+}}, <32 x i8> %{{[0-9]+}}, <32 x i8> {{.*}}
+ return _mm256_maskz_popcnt_epi8(__U, __B);
+}
+
+__m128i test_mm128_popcnt_epi8(__m128i __A) {
+ // CHECK-LABEL: @test_mm128_popcnt_epi8
+ // CHECK: @llvm.ctpop.v16i8
+ return _mm128_popcnt_epi8(__A);
+}
+
+__m128i test_mm128_mask_popcnt_epi8(__m128i __A, __mmask16 __U, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_popcnt_epi8
+ // CHECK: @llvm.ctpop.v16i8
+ // CHECK: select <16 x i1> %{{[0-9]+}}, <16 x i8> %{{[0-9]+}}, <16 x i8> {{.*}}
+ return _mm128_mask_popcnt_epi8(__A, __U, __B);
+}
+__m128i test_mm128_maskz_popcnt_epi8(__mmask16 __U, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_popcnt_epi8
+ // CHECK: @llvm.ctpop.v16i8
+ // CHECK: select <16 x i1> %{{[0-9]+}}, <16 x i8> %{{[0-9]+}}, <16 x i8> {{.*}}
+ return _mm128_maskz_popcnt_epi8(__U, __B);
+}
+
+__mmask32 test_mm256_mask_bitshuffle_epi32_mask(__mmask32 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_bitshuffle_epi32_mask
+ // CHECK: @llvm.x86.avx512.mask.vpshufbitqmb.256
+ return _mm256_mask_bitshuffle_epi32_mask(__U, __A, __B);
+}
+
+__mmask32 test_mm256_bitshuffle_epi32_mask(__m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_bitshuffle_epi32_mask
+ // CHECK: @llvm.x86.avx512.mask.vpshufbitqmb.256
+ return _mm256_bitshuffle_epi32_mask(__A, __B);
+}
+
+__mmask16 test_mm128_mask_bitshuffle_epi16_mask(__mmask16 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_bitshuffle_epi16_mask
+ // CHECK: @llvm.x86.avx512.mask.vpshufbitqmb.128
+ return _mm128_mask_bitshuffle_epi16_mask(__U, __A, __B);
+}
+
+__mmask16 test_mm128_bitshuffle_epi16_mask(__m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_bitshuffle_epi16_mask
+ // CHECK: @llvm.x86.avx512.mask.vpshufbitqmb.128
+ return _mm128_bitshuffle_epi16_mask(__A, __B);
+}
+
diff --git a/test/CodeGen/avx512vlvbmi2-builtins.c b/test/CodeGen/avx512vlvbmi2-builtins.c
new file mode 100644
index 0000000000000..6edc66d30eee2
--- /dev/null
+++ b/test/CodeGen/avx512vlvbmi2-builtins.c
@@ -0,0 +1,604 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512vl -target-feature +avx512vbmi2 -emit-llvm -o - -Wall -Werror | FileCheck %s
+
+#include <immintrin.h>
+
+__m128i test_mm128_mask_compress_epi16(__m128i __S, __mmask8 __U, __m128i __D) {
+ // CHECK-LABEL: @test_mm128_mask_compress_epi16
+ // CHECK: @llvm.x86.avx512.mask.compress.w.128
+ return _mm128_mask_compress_epi16(__S, __U, __D);
+}
+
+__m128i test_mm128_maskz_compress_epi16(__mmask8 __U, __m128i __D) {
+ // CHECK-LABEL: @test_mm128_maskz_compress_epi16
+ // CHECK: @llvm.x86.avx512.mask.compress.w.128
+ return _mm128_maskz_compress_epi16(__U, __D);
+}
+
+__m128i test_mm128_mask_compress_epi8(__m128i __S, __mmask16 __U, __m128i __D) {
+ // CHECK-LABEL: @test_mm128_mask_compress_epi8
+ // CHECK: @llvm.x86.avx512.mask.compress.b.128
+ return _mm128_mask_compress_epi8(__S, __U, __D);
+}
+
+__m128i test_mm128_maskz_compress_epi8(__mmask16 __U, __m128i __D) {
+ // CHECK-LABEL: @test_mm128_maskz_compress_epi8
+ // CHECK: @llvm.x86.avx512.mask.compress.b.128
+ return _mm128_maskz_compress_epi8(__U, __D);
+}
+
+void test_mm128_mask_compressstoreu_epi16(void *__P, __mmask8 __U, __m128i __D) {
+ // CHECK-LABEL: @test_mm128_mask_compressstoreu_epi16
+ // CHECK: @llvm.x86.avx512.mask.compress.store.w.128
+ _mm128_mask_compressstoreu_epi16(__P, __U, __D);
+}
+
+void test_mm128_mask_compressstoreu_epi8(void *__P, __mmask16 __U, __m128i __D) {
+ // CHECK-LABEL: @test_mm128_mask_compressstoreu_epi8
+ // CHECK: @llvm.x86.avx512.mask.compress.store.b.128
+ _mm128_mask_compressstoreu_epi8(__P, __U, __D);
+}
+
+__m128i test_mm128_mask_expand_epi16(__m128i __S, __mmask8 __U, __m128i __D) {
+ // CHECK-LABEL: @test_mm128_mask_expand_epi16
+ // CHECK: @llvm.x86.avx512.mask.expand.w.128
+ return _mm128_mask_expand_epi16(__S, __U, __D);
+}
+
+__m128i test_mm128_maskz_expand_epi16(__mmask8 __U, __m128i __D) {
+ // CHECK-LABEL: @test_mm128_maskz_expand_epi16
+ // CHECK: @llvm.x86.avx512.mask.expand.w.128
+ return _mm128_maskz_expand_epi16(__U, __D);
+}
+
+__m128i test_mm128_mask_expand_epi8(__m128i __S, __mmask16 __U, __m128i __D) {
+ // CHECK-LABEL: @test_mm128_mask_expand_epi8
+ // CHECK: @llvm.x86.avx512.mask.expand.b.128
+ return _mm128_mask_expand_epi8(__S, __U, __D);
+}
+
+__m128i test_mm128_maskz_expand_epi8(__mmask16 __U, __m128i __D) {
+ // CHECK-LABEL: @test_mm128_maskz_expand_epi8
+ // CHECK: @llvm.x86.avx512.mask.expand.b.128
+ return _mm128_maskz_expand_epi8(__U, __D);
+}
+
+__m128i test_mm128_mask_expandloadu_epi16(__m128i __S, __mmask8 __U, void const* __P) {
+ // CHECK-LABEL: @test_mm128_mask_expandloadu_epi16
+ // CHECK: @llvm.x86.avx512.mask.expand.load.w.128
+ return _mm128_mask_expandloadu_epi16(__S, __U, __P);
+}
+
+__m128i test_mm128_maskz_expandloadu_epi16(__mmask8 __U, void const* __P) {
+ // CHECK-LABEL: @test_mm128_maskz_expandloadu_epi16
+ // CHECK: @llvm.x86.avx512.mask.expand.load.w.128
+ return _mm128_maskz_expandloadu_epi16(__U, __P);
+}
+
+__m128i test_mm128_mask_expandloadu_epi8(__m128i __S, __mmask16 __U, void const* __P) {
+ // CHECK-LABEL: @test_mm128_mask_expandloadu_epi8
+ // CHECK: @llvm.x86.avx512.mask.expand.load.b.128
+ return _mm128_mask_expandloadu_epi8(__S, __U, __P);
+}
+
+__m128i test_mm128_maskz_expandloadu_epi8(__mmask16 __U, void const* __P) {
+ // CHECK-LABEL: @test_mm128_maskz_expandloadu_epi8
+ // CHECK: @llvm.x86.avx512.mask.expand.load.b.128
+ return _mm128_maskz_expandloadu_epi8(__U, __P);
+}
+
+__m256i test_mm256_mask_compress_epi16(__m256i __S, __mmask16 __U, __m256i __D) {
+ // CHECK-LABEL: @test_mm256_mask_compress_epi16
+ // CHECK: @llvm.x86.avx512.mask.compress.w.256
+ return _mm256_mask_compress_epi16(__S, __U, __D);
+}
+
+__m256i test_mm256_maskz_compress_epi16(__mmask16 __U, __m256i __D) {
+ // CHECK-LABEL: @test_mm256_maskz_compress_epi16
+ // CHECK: @llvm.x86.avx512.mask.compress.w.256
+ return _mm256_maskz_compress_epi16(__U, __D);
+}
+
+__m256i test_mm256_mask_compress_epi8(__m256i __S, __mmask32 __U, __m256i __D) {
+ // CHECK-LABEL: @test_mm256_mask_compress_epi8
+ // CHECK: @llvm.x86.avx512.mask.compress.b.256
+ return _mm256_mask_compress_epi8(__S, __U, __D);
+}
+
+__m256i test_mm256_maskz_compress_epi8(__mmask32 __U, __m256i __D) {
+ // CHECK-LABEL: @test_mm256_maskz_compress_epi8
+ // CHECK: @llvm.x86.avx512.mask.compress.b.256
+ return _mm256_maskz_compress_epi8(__U, __D);
+}
+
+void test_mm256_mask_compressstoreu_epi16(void *__P, __mmask16 __U, __m256i __D) {
+ // CHECK-LABEL: @test_mm256_mask_compressstoreu_epi16
+ // CHECK: @llvm.x86.avx512.mask.compress.store.w.256
+ _mm256_mask_compressstoreu_epi16(__P, __U, __D);
+}
+
+void test_mm256_mask_compressstoreu_epi8(void *__P, __mmask32 __U, __m256i __D) {
+ // CHECK-LABEL: @test_mm256_mask_compressstoreu_epi8
+ // CHECK: @llvm.x86.avx512.mask.compress.store.b.256
+ _mm256_mask_compressstoreu_epi8(__P, __U, __D);
+}
+
+__m256i test_mm256_mask_expand_epi16(__m256i __S, __mmask16 __U, __m256i __D) {
+ // CHECK-LABEL: @test_mm256_mask_expand_epi16
+ // CHECK: @llvm.x86.avx512.mask.expand.w.256
+ return _mm256_mask_expand_epi16(__S, __U, __D);
+}
+
+__m256i test_mm256_maskz_expand_epi16(__mmask16 __U, __m256i __D) {
+ // CHECK-LABEL: @test_mm256_maskz_expand_epi16
+ // CHECK: @llvm.x86.avx512.mask.expand.w.256
+ return _mm256_maskz_expand_epi16(__U, __D);
+}
+
+__m256i test_mm256_mask_expand_epi8(__m256i __S, __mmask32 __U, __m256i __D) {
+ // CHECK-LABEL: @test_mm256_mask_expand_epi8
+ // CHECK: @llvm.x86.avx512.mask.expand.b.256
+ return _mm256_mask_expand_epi8(__S, __U, __D);
+}
+
+__m256i test_mm256_maskz_expand_epi8(__mmask32 __U, __m256i __D) {
+ // CHECK-LABEL: @test_mm256_maskz_expand_epi8
+ // CHECK: @llvm.x86.avx512.mask.expand.b.256
+ return _mm256_maskz_expand_epi8(__U, __D);
+}
+
+__m256i test_mm256_mask_expandloadu_epi16(__m256i __S, __mmask16 __U, void const* __P) {
+ // CHECK-LABEL: @test_mm256_mask_expandloadu_epi16
+ // CHECK: @llvm.x86.avx512.mask.expand.load.w.256
+ return _mm256_mask_expandloadu_epi16(__S, __U, __P);
+}
+
+__m256i test_mm256_maskz_expandloadu_epi16(__mmask16 __U, void const* __P) {
+ // CHECK-LABEL: @test_mm256_maskz_expandloadu_epi16
+ // CHECK: @llvm.x86.avx512.mask.expand.load.w.256
+ return _mm256_maskz_expandloadu_epi16(__U, __P);
+}
+
+__m256i test_mm256_mask_expandloadu_epi8(__m256i __S, __mmask32 __U, void const* __P) {
+ // CHECK-LABEL: @test_mm256_mask_expandloadu_epi8
+ // CHECK: @llvm.x86.avx512.mask.expand.load.b.256
+ return _mm256_mask_expandloadu_epi8(__S, __U, __P);
+}
+
+__m256i test_mm256_maskz_expandloadu_epi8(__mmask32 __U, void const* __P) {
+ // CHECK-LABEL: @test_mm256_maskz_expandloadu_epi8
+ // CHECK: @llvm.x86.avx512.mask.expand.load.b.256
+ return _mm256_maskz_expandloadu_epi8(__U, __P);
+}
+
+__m256i test_mm256_mask_shldi_epi64(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_shldi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshld.q.256
+ return _mm256_mask_shldi_epi64(__S, __U, __A, __B, 127);
+}
+
+__m256i test_mm256_maskz_shldi_epi64(__mmask8 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_shldi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshld.q.256
+ return _mm256_maskz_shldi_epi64(__U, __A, __B, 63);
+}
+
+__m256i test_mm256_shldi_epi64(__m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_shldi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshld.q.256
+ return _mm256_shldi_epi64(__A, __B, 31);
+}
+
+__m128i test_mm128_mask_shldi_epi64(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_shldi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshld.q.128
+ return _mm128_mask_shldi_epi64(__S, __U, __A, __B, 127);
+}
+
+__m128i test_mm128_maskz_shldi_epi64(__mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_shldi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshld.q.128
+ return _mm128_maskz_shldi_epi64(__U, __A, __B, 63);
+}
+
+__m128i test_mm128_shldi_epi64(__m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_shldi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshld.q.128
+ return _mm128_shldi_epi64(__A, __B, 31);
+}
+
+__m256i test_mm256_mask_shldi_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_shldi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshld.d.256
+ return _mm256_mask_shldi_epi32(__S, __U, __A, __B, 127);
+}
+
+__m256i test_mm256_maskz_shldi_epi32(__mmask8 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_shldi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshld.d.256
+ return _mm256_maskz_shldi_epi32(__U, __A, __B, 63);
+}
+
+__m256i test_mm256_shldi_epi32(__m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_shldi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshld.d.256
+ return _mm256_shldi_epi32(__A, __B, 31);
+}
+
+__m128i test_mm128_mask_shldi_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_shldi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshld.d.128
+ return _mm128_mask_shldi_epi32(__S, __U, __A, __B, 127);
+}
+
+__m128i test_mm128_maskz_shldi_epi32(__mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_shldi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshld.d.128
+ return _mm128_maskz_shldi_epi32(__U, __A, __B, 63);
+}
+
+__m128i test_mm128_shldi_epi32(__m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_shldi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshld.d.128
+ return _mm128_shldi_epi32(__A, __B, 31);
+}
+
+__m256i test_mm256_mask_shldi_epi16(__m256i __S, __mmask16 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_shldi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshld.w.256
+ return _mm256_mask_shldi_epi16(__S, __U, __A, __B, 127);
+}
+
+__m256i test_mm256_maskz_shldi_epi16(__mmask16 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_shldi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshld.w.256
+ return _mm256_maskz_shldi_epi16(__U, __A, __B, 63);
+}
+
+__m256i test_mm256_shldi_epi16(__m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_shldi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshld.w.256
+ return _mm256_shldi_epi16(__A, __B, 31);
+}
+
+__m128i test_mm128_mask_shldi_epi16(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_shldi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshld.w.128
+ return _mm128_mask_shldi_epi16(__S, __U, __A, __B, 127);
+}
+
+__m128i test_mm128_maskz_shldi_epi16(__mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_shldi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshld.w.128
+ return _mm128_maskz_shldi_epi16(__U, __A, __B, 63);
+}
+
+__m128i test_mm128_shldi_epi16(__m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_shldi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshld.w.128
+ return _mm128_shldi_epi16(__A, __B, 31);
+}
+
+__m256i test_mm256_mask_shrdi_epi64(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_shrdi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.q.256
+ return _mm256_mask_shrdi_epi64(__S, __U, __A, __B, 127);
+}
+
+__m256i test_mm256_maskz_shrdi_epi64(__mmask8 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_shrdi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.q.256
+ return _mm256_maskz_shrdi_epi64(__U, __A, __B, 63);
+}
+
+__m256i test_mm256_shrdi_epi64(__m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_shrdi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.q.256
+ return _mm256_shrdi_epi64(__A, __B, 31);
+}
+
+__m128i test_mm128_mask_shrdi_epi64(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_shrdi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.q.128
+ return _mm128_mask_shrdi_epi64(__S, __U, __A, __B, 127);
+}
+
+__m128i test_mm128_maskz_shrdi_epi64(__mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_shrdi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.q.128
+ return _mm128_maskz_shrdi_epi64(__U, __A, __B, 63);
+}
+
+__m128i test_mm128_shrdi_epi64(__m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_shrdi_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.q.128
+ return _mm128_shrdi_epi64(__A, __B, 31);
+}
+
+__m256i test_mm256_mask_shrdi_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_shrdi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.d.256
+ return _mm256_mask_shrdi_epi32(__S, __U, __A, __B, 127);
+}
+
+__m256i test_mm256_maskz_shrdi_epi32(__mmask8 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_shrdi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.d.256
+ return _mm256_maskz_shrdi_epi32(__U, __A, __B, 63);
+}
+
+__m256i test_mm256_shrdi_epi32(__m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_shrdi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.d.256
+ return _mm256_shrdi_epi32(__A, __B, 31);
+}
+
+__m128i test_mm128_mask_shrdi_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_shrdi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.d.128
+ return _mm128_mask_shrdi_epi32(__S, __U, __A, __B, 127);
+}
+
+__m128i test_mm128_maskz_shrdi_epi32(__mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_shrdi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.d.128
+ return _mm128_maskz_shrdi_epi32(__U, __A, __B, 63);
+}
+
+__m128i test_mm128_shrdi_epi32(__m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_shrdi_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.d.128
+ return _mm128_shrdi_epi32(__A, __B, 31);
+}
+
+__m256i test_mm256_mask_shrdi_epi16(__m256i __S, __mmask16 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_shrdi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.w.256
+ return _mm256_mask_shrdi_epi16(__S, __U, __A, __B, 127);
+}
+
+__m256i test_mm256_maskz_shrdi_epi16(__mmask16 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_shrdi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.w.256
+ return _mm256_maskz_shrdi_epi16(__U, __A, __B, 63);
+}
+
+__m256i test_mm256_shrdi_epi16(__m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_shrdi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.w.256
+ return _mm256_shrdi_epi16(__A, __B, 31);
+}
+
+__m128i test_mm128_mask_shrdi_epi16(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_shrdi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.w.128
+ return _mm128_mask_shrdi_epi16(__S, __U, __A, __B, 127);
+}
+
+__m128i test_mm128_maskz_shrdi_epi16(__mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_shrdi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.w.128
+ return _mm128_maskz_shrdi_epi16(__U, __A, __B, 63);
+}
+
+__m128i test_mm128_shrdi_epi16(__m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_shrdi_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshrd.w.128
+ return _mm128_shrdi_epi16(__A, __B, 31);
+}
+
+__m256i test_mm256_mask_shldv_epi64(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_shldv_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.q.256
+ return _mm256_mask_shldv_epi64(__S, __U, __A, __B);
+}
+
+__m256i test_mm256_maskz_shldv_epi64(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_shldv_epi64
+ // CHECK: @llvm.x86.avx512.maskz.vpshldv.q.256
+ return _mm256_maskz_shldv_epi64(__U, __S, __A, __B);
+}
+
+__m256i test_mm256_shldv_epi64(__m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_shldv_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.q.256
+ return _mm256_shldv_epi64(__S, __A, __B);
+}
+
+__m128i test_mm128_mask_shldv_epi64(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_shldv_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.q.128
+ return _mm128_mask_shldv_epi64(__S, __U, __A, __B);
+}
+
+__m128i test_mm128_maskz_shldv_epi64(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_shldv_epi64
+ // CHECK: @llvm.x86.avx512.maskz.vpshldv.q.128
+ return _mm128_maskz_shldv_epi64(__U, __S, __A, __B);
+}
+
+__m128i test_mm128_shldv_epi64(__m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_shldv_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.q.128
+ return _mm128_shldv_epi64(__S, __A, __B);
+}
+
+__m256i test_mm256_mask_shldv_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_shldv_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.d.256
+ return _mm256_mask_shldv_epi32(__S, __U, __A, __B);
+}
+
+__m256i test_mm256_maskz_shldv_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_shldv_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpshldv.d.256
+ return _mm256_maskz_shldv_epi32(__U, __S, __A, __B);
+}
+
+__m256i test_mm256_shldv_epi32(__m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_shldv_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.d.256
+ return _mm256_shldv_epi32(__S, __A, __B);
+}
+
+__m128i test_mm128_mask_shldv_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_shldv_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.d.128
+ return _mm128_mask_shldv_epi32(__S, __U, __A, __B);
+}
+
+__m128i test_mm128_maskz_shldv_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_shldv_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpshldv.d.128
+ return _mm128_maskz_shldv_epi32(__U, __S, __A, __B);
+}
+
+__m128i test_mm128_shldv_epi32(__m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_shldv_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.d.128
+ return _mm128_shldv_epi32(__S, __A, __B);
+}
+
+__m256i test_mm256_mask_shldv_epi16(__m256i __S, __mmask16 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_shldv_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.w.256
+ return _mm256_mask_shldv_epi16(__S, __U, __A, __B);
+}
+
+__m256i test_mm256_maskz_shldv_epi16(__mmask16 __U, __m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_shldv_epi16
+ // CHECK: @llvm.x86.avx512.maskz.vpshldv.w.256
+ return _mm256_maskz_shldv_epi16(__U, __S, __A, __B);
+}
+
+__m256i test_mm256_shldv_epi16(__m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_shldv_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.w.256
+ return _mm256_shldv_epi16(__S, __A, __B);
+}
+
+__m128i test_mm128_mask_shldv_epi16(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_shldv_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.w.128
+ return _mm128_mask_shldv_epi16(__S, __U, __A, __B);
+}
+
+__m128i test_mm128_maskz_shldv_epi16(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_shldv_epi16
+ // CHECK: @llvm.x86.avx512.maskz.vpshldv.w.128
+ return _mm128_maskz_shldv_epi16(__U, __S, __A, __B);
+}
+
+__m128i test_mm128_shldv_epi16(__m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_shldv_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshldv.w.128
+ return _mm128_shldv_epi16(__S, __A, __B);
+}
+
+__m256i test_mm256_mask_shrdv_epi64(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_shrdv_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.q.256
+ return _mm256_mask_shrdv_epi64(__S, __U, __A, __B);
+}
+
+__m256i test_mm256_maskz_shrdv_epi64(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_shrdv_epi64
+ // CHECK: @llvm.x86.avx512.maskz.vpshrdv.q.256
+ return _mm256_maskz_shrdv_epi64(__U, __S, __A, __B);
+}
+
+__m256i test_mm256_shrdv_epi64(__m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_shrdv_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.q.256
+ return _mm256_shrdv_epi64(__S, __A, __B);
+}
+
+__m128i test_mm128_mask_shrdv_epi64(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_shrdv_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.q.128
+ return _mm128_mask_shrdv_epi64(__S, __U, __A, __B);
+}
+
+__m128i test_mm128_maskz_shrdv_epi64(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_shrdv_epi64
+ // CHECK: @llvm.x86.avx512.maskz.vpshrdv.q.128
+ return _mm128_maskz_shrdv_epi64(__U, __S, __A, __B);
+}
+
+__m128i test_mm128_shrdv_epi64(__m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_shrdv_epi64
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.q.128
+ return _mm128_shrdv_epi64(__S, __A, __B);
+}
+
+__m256i test_mm256_mask_shrdv_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_shrdv_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.d.256
+ return _mm256_mask_shrdv_epi32(__S, __U, __A, __B);
+}
+
+__m256i test_mm256_maskz_shrdv_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_shrdv_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpshrdv.d.256
+ return _mm256_maskz_shrdv_epi32(__U, __S, __A, __B);
+}
+
+__m256i test_mm256_shrdv_epi32(__m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_shrdv_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.d.256
+ return _mm256_shrdv_epi32(__S, __A, __B);
+}
+
+__m128i test_mm128_mask_shrdv_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_shrdv_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.d.128
+ return _mm128_mask_shrdv_epi32(__S, __U, __A, __B);
+}
+
+__m128i test_mm128_maskz_shrdv_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_shrdv_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpshrdv.d.128
+ return _mm128_maskz_shrdv_epi32(__U, __S, __A, __B);
+}
+
+__m128i test_mm128_shrdv_epi32(__m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_shrdv_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.d.128
+ return _mm128_shrdv_epi32(__S, __A, __B);
+}
+
+__m256i test_mm256_mask_shrdv_epi16(__m256i __S, __mmask16 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_shrdv_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.w.256
+ return _mm256_mask_shrdv_epi16(__S, __U, __A, __B);
+}
+
+__m256i test_mm256_maskz_shrdv_epi16(__mmask16 __U, __m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_shrdv_epi16
+ // CHECK: @llvm.x86.avx512.maskz.vpshrdv.w.256
+ return _mm256_maskz_shrdv_epi16(__U, __S, __A, __B);
+}
+
+__m256i test_mm256_shrdv_epi16(__m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_shrdv_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.w.256
+ return _mm256_shrdv_epi16(__S, __A, __B);
+}
+
+__m128i test_mm128_mask_shrdv_epi16(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_shrdv_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.w.128
+ return _mm128_mask_shrdv_epi16(__S, __U, __A, __B);
+}
+
+__m128i test_mm128_maskz_shrdv_epi16(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_shrdv_epi16
+ // CHECK: @llvm.x86.avx512.maskz.vpshrdv.w.128
+ return _mm128_maskz_shrdv_epi16(__U, __S, __A, __B);
+}
+
+__m128i test_mm128_shrdv_epi16(__m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_shrdv_epi16
+ // CHECK: @llvm.x86.avx512.mask.vpshrdv.w.128
+ return _mm128_shrdv_epi16(__S, __A, __B);
+}
+
diff --git a/test/CodeGen/avx512vlvnni-builtins.c b/test/CodeGen/avx512vlvnni-builtins.c
new file mode 100644
index 0000000000000..861b915fdb290
--- /dev/null
+++ b/test/CodeGen/avx512vlvnni-builtins.c
@@ -0,0 +1,148 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512vnni -target-feature +avx512vl -emit-llvm -o - -Wall -Werror | FileCheck %s
+
+#include <immintrin.h>
+
+__m256i test_mm256_mask_dpbusd_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_dpbusd_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpbusd.256
+ return _mm256_mask_dpbusd_epi32(__S, __U, __A, __B);
+}
+
+__m256i test_mm256_maskz_dpbusd_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_dpbusd_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpdpbusd.256
+ return _mm256_maskz_dpbusd_epi32(__U, __S, __A, __B);
+}
+
+__m256i test_mm256_dpbusd_epi32(__m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_dpbusd_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpbusd.256
+ return _mm256_dpbusd_epi32(__S, __A, __B);
+}
+
+__m256i test_mm256_mask_dpbusds_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_dpbusds_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpbusds.256
+ return _mm256_mask_dpbusds_epi32(__S, __U, __A, __B);
+}
+
+__m256i test_mm256_maskz_dpbusds_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_dpbusds_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpdpbusds.256
+ return _mm256_maskz_dpbusds_epi32(__U, __S, __A, __B);
+}
+
+__m256i test_mm256_dpbusds_epi32(__m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_dpbusds_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpbusds.256
+ return _mm256_dpbusds_epi32(__S, __A, __B);
+}
+
+__m256i test_mm256_mask_dpwssd_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_dpwssd_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpwssd.256
+ return _mm256_mask_dpwssd_epi32(__S, __U, __A, __B);
+}
+
+__m256i test_mm256_maskz_dpwssd_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_dpwssd_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpdpwssd.256
+ return _mm256_maskz_dpwssd_epi32(__U, __S, __A, __B);
+}
+
+__m256i test_mm256_dpwssd_epi32(__m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_dpwssd_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpwssd.256
+ return _mm256_dpwssd_epi32(__S, __A, __B);
+}
+
+__m256i test_mm256_mask_dpwssds_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_mask_dpwssds_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpwssds.256
+ return _mm256_mask_dpwssds_epi32(__S, __U, __A, __B);
+}
+
+__m256i test_mm256_maskz_dpwssds_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_maskz_dpwssds_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpdpwssds.256
+ return _mm256_maskz_dpwssds_epi32(__U, __S, __A, __B);
+}
+
+__m256i test_mm256_dpwssds_epi32(__m256i __S, __m256i __A, __m256i __B) {
+ // CHECK-LABEL: @test_mm256_dpwssds_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpwssds.256
+ return _mm256_dpwssds_epi32(__S, __A, __B);
+}
+
+__m128i test_mm128_mask_dpbusd_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_dpbusd_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpbusd.128
+ return _mm128_mask_dpbusd_epi32(__S, __U, __A, __B);
+}
+
+__m128i test_mm128_maskz_dpbusd_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_dpbusd_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpdpbusd.128
+ return _mm128_maskz_dpbusd_epi32(__U, __S, __A, __B);
+}
+
+__m128i test_mm128_dpbusd_epi32(__m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_dpbusd_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpbusd.128
+ return _mm128_dpbusd_epi32(__S, __A, __B);
+}
+
+__m128i test_mm128_mask_dpbusds_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_dpbusds_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpbusds.128
+ return _mm128_mask_dpbusds_epi32(__S, __U, __A, __B);
+}
+
+__m128i test_mm128_maskz_dpbusds_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_dpbusds_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpdpbusds.128
+ return _mm128_maskz_dpbusds_epi32(__U, __S, __A, __B);
+}
+
+__m128i test_mm128_dpbusds_epi32(__m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_dpbusds_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpbusds.128
+ return _mm128_dpbusds_epi32(__S, __A, __B);
+}
+
+__m128i test_mm128_mask_dpwssd_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_dpwssd_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpwssd.128
+ return _mm128_mask_dpwssd_epi32(__S, __U, __A, __B);
+}
+
+__m128i test_mm128_maskz_dpwssd_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_dpwssd_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpdpwssd.128
+ return _mm128_maskz_dpwssd_epi32(__U, __S, __A, __B);
+}
+
+__m128i test_mm128_dpwssd_epi32(__m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_dpwssd_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpwssd.128
+ return _mm128_dpwssd_epi32(__S, __A, __B);
+}
+
+__m128i test_mm128_mask_dpwssds_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_mask_dpwssds_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpwssds.128
+ return _mm128_mask_dpwssds_epi32(__S, __U, __A, __B);
+}
+
+__m128i test_mm128_maskz_dpwssds_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_maskz_dpwssds_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpdpwssds.128
+ return _mm128_maskz_dpwssds_epi32(__U, __S, __A, __B);
+}
+
+__m128i test_mm128_dpwssds_epi32(__m128i __S, __m128i __A, __m128i __B) {
+ // CHECK-LABEL: @test_mm128_dpwssds_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpwssds.128
+ return _mm128_dpwssds_epi32(__S, __A, __B);
+}
+
diff --git a/test/CodeGen/avx512vnni-builtins.c b/test/CodeGen/avx512vnni-builtins.c
new file mode 100644
index 0000000000000..d79046aa04995
--- /dev/null
+++ b/test/CodeGen/avx512vnni-builtins.c
@@ -0,0 +1,76 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512vnni -emit-llvm -o - -Wall -Werror | FileCheck %s
+
+#include <immintrin.h>
+
+__m512i test_mm512_mask_dpbusd_epi32(__m512i __S, __mmask16 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_dpbusd_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpbusd.512
+ return _mm512_mask_dpbusd_epi32(__S, __U, __A, __B);
+}
+
+__m512i test_mm512_maskz_dpbusd_epi32(__mmask16 __U, __m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_dpbusd_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpdpbusd.512
+ return _mm512_maskz_dpbusd_epi32(__U, __S, __A, __B);
+}
+
+__m512i test_mm512_dpbusd_epi32(__m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_dpbusd_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpbusd.512
+ return _mm512_dpbusd_epi32(__S, __A, __B);
+}
+
+__m512i test_mm512_mask_dpbusds_epi32(__m512i __S, __mmask16 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_dpbusds_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpbusds.512
+ return _mm512_mask_dpbusds_epi32(__S, __U, __A, __B);
+}
+
+__m512i test_mm512_maskz_dpbusds_epi32(__mmask16 __U, __m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_dpbusds_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpdpbusds.512
+ return _mm512_maskz_dpbusds_epi32(__U, __S, __A, __B);
+}
+
+__m512i test_mm512_dpbusds_epi32(__m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_dpbusds_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpbusds.512
+ return _mm512_dpbusds_epi32(__S, __A, __B);
+}
+
+__m512i test_mm512_mask_dpwssd_epi32(__m512i __S, __mmask16 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_dpwssd_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpwssd.512
+ return _mm512_mask_dpwssd_epi32(__S, __U, __A, __B);
+}
+
+__m512i test_mm512_maskz_dpwssd_epi32(__mmask16 __U, __m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_dpwssd_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpdpwssd.512
+ return _mm512_maskz_dpwssd_epi32(__U, __S, __A, __B);
+}
+
+__m512i test_mm512_dpwssd_epi32(__m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_dpwssd_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpwssd.512
+ return _mm512_dpwssd_epi32(__S, __A, __B);
+}
+
+__m512i test_mm512_mask_dpwssds_epi32(__m512i __S, __mmask16 __U, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_mask_dpwssds_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpwssds.512
+ return _mm512_mask_dpwssds_epi32(__S, __U, __A, __B);
+}
+
+__m512i test_mm512_maskz_dpwssds_epi32(__mmask16 __U, __m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_maskz_dpwssds_epi32
+ // CHECK: @llvm.x86.avx512.maskz.vpdpwssds.512
+ return _mm512_maskz_dpwssds_epi32(__U, __S, __A, __B);
+}
+
+__m512i test_mm512_dpwssds_epi32(__m512i __S, __m512i __A, __m512i __B) {
+ // CHECK-LABEL: @test_mm512_dpwssds_epi32
+ // CHECK: @llvm.x86.avx512.mask.vpdpwssds.512
+ return _mm512_dpwssds_epi32(__S, __A, __B);
+}
+
diff --git a/test/CodeGen/gfni-builtins.c b/test/CodeGen/gfni-builtins.c
new file mode 100644
index 0000000000000..95cfd4fcd5c79
--- /dev/null
+++ b/test/CodeGen/gfni-builtins.c
@@ -0,0 +1,182 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +gfni -emit-llvm -o - | FileCheck %s --check-prefix SSE
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -DAVX -target-feature +gfni -target-feature +avx -emit-llvm -o - | FileCheck %s --check-prefixes SSE,AVX
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -DAVX512 -target-feature +gfni -target-feature +avx512bw -target-feature +avx512vl -emit-llvm -o - | FileCheck %s --check-prefixes SSE,AVX,AVX512
+
+#include <immintrin.h>
+
+__m128i test_mm_gf2p8affineinv_epi64_epi8(__m128i A, __m128i B) {
+ // SSE-LABEL: @test_mm_gf2p8affineinv_epi64_epi8
+ // SSE: @llvm.x86.vgf2p8affineinvqb.128
+ return _mm_gf2p8affineinv_epi64_epi8(A, B, 1);
+}
+
+__m128i test_mm_gf2p8affine_epi64_epi8(__m128i A, __m128i B) {
+ // SSE-LABEL: @test_mm_gf2p8affine_epi64_epi8
+ // SSE: @llvm.x86.vgf2p8affineqb.128
+ return _mm_gf2p8affine_epi64_epi8(A, B, 1);
+}
+
+__m128i test_mm_gf2p8mul_epi8(__m128i A, __m128i B) {
+ // SSE-LABEL: @test_mm_gf2p8mul_epi8
+ // SSE: @llvm.x86.vgf2p8mulb.128
+ return _mm_gf2p8mul_epi8(A, B);
+}
+
+#if defined(AVX) || defined(AVX512)
+__m256i test_mm256_gf2p8affineinv_epi64_epi8(__m256i A, __m256i B) {
+ // AVX-LABEL: @test_mm256_gf2p8affineinv_epi64_epi8
+ // AVX: @llvm.x86.vgf2p8affineinvqb.256
+ return _mm256_gf2p8affineinv_epi64_epi8(A, B, 1);
+}
+
+__m256i test_mm256_gf2p8affine_epi64_epi8(__m256i A, __m256i B) {
+ // AVX-LABEL: @test_mm256_gf2p8affine_epi64_epi8
+ // AVX: @llvm.x86.vgf2p8affineqb.256
+ return _mm256_gf2p8affine_epi64_epi8(A, B, 1);
+}
+
+__m256i test_mm256_gf2p8mul_epi8(__m256i A, __m256i B) {
+ // AVX-LABEL: @test_mm256_gf2p8mul_epi8
+ // AVX: @llvm.x86.vgf2p8mulb.256
+ return _mm256_gf2p8mul_epi8(A, B);
+}
+#endif // AVX
+
+#ifdef AVX512
+__m512i test_mm512_gf2p8affineinv_epi64_epi8(__m512i A, __m512i B) {
+ // AVX512-LABEL: @test_mm512_gf2p8affineinv_epi64_epi8
+ // AVX512: @llvm.x86.vgf2p8affineinvqb.512
+ return _mm512_gf2p8affineinv_epi64_epi8(A, B, 1);
+}
+
+__m512i test_mm512_mask_gf2p8affineinv_epi64_epi8(__m512i S, __mmask64 U, __m512i A, __m512i B) {
+ // AVX512-LABEL: @test_mm512_mask_gf2p8affineinv_epi64_epi8
+ // AVX512: @llvm.x86.vgf2p8affineinvqb.512
+ // AVX512: select <64 x i1> %{{[0-9]+}}, <64 x i8> %{{[0-9]+}}, <64 x i8> {{.*}}
+ return _mm512_mask_gf2p8affineinv_epi64_epi8(S, U, A, B, 1);
+}
+
+__m512i test_mm512_maskz_gf2p8affineinv_epi64_epi8(__mmask64 U, __m512i A, __m512i B) {
+ // AVX512-LABEL: @test_mm512_maskz_gf2p8affineinv_epi64_epi8
+ // AVX512: @llvm.x86.vgf2p8affineinvqb.512
+ // AVX512: select <64 x i1> %{{[0-9]+}}, <64 x i8> %{{[0-9]+}}, <64 x i8> {{.*}}
+ return _mm512_maskz_gf2p8affineinv_epi64_epi8(U, A, B, 1);
+}
+
+__m256i test_mm256_mask_gf2p8affineinv_epi64_epi8(__m256i S, __mmask32 U, __m256i A, __m256i B) {
+ // AVX256-LABEL: @test_mm256_mask_gf2p8affineinv_epi64_epi8
+ // AVX256: @llvm.x86.vgf2p8affineinvqb.256
+ // AVX256: select <32 x i1> %{{[0-9]+}}, <32 x i8> %{{[0-9]+}}, <32 x i8> {{.*}}
+ return _mm256_mask_gf2p8affineinv_epi64_epi8(S, U, A, B, 1);
+}
+
+__m256i test_mm256_maskz_gf2p8affineinv_epi64_epi8(__mmask32 U, __m256i A, __m256i B) {
+ // AVX256-LABEL: @test_mm256_maskz_gf2p8affineinv_epi64_epi8
+ // AVX256: @llvm.x86.vgf2p8affineinvqb.256
+ // AVX256: select <32 x i1> %{{[0-9]+}}, <32 x i8> %{{[0-9]+}}, <32 x i8> {{.*}}
+ return _mm256_maskz_gf2p8affineinv_epi64_epi8(U, A, B, 1);
+}
+
+__m128i test_mm_mask_gf2p8affineinv_epi64_epi8(__m128i S, __mmask16 U, __m128i A, __m128i B) {
+ // AVX512-LABEL: @test_mm_mask_gf2p8affineinv_epi64_epi8
+ // AVX512: @llvm.x86.vgf2p8affineinvqb.128
+ // AVX512: select <16 x i1> %{{[0-9]+}}, <16 x i8> %{{[0-9]+}}, <16 x i8> {{.*}}
+ return _mm_mask_gf2p8affineinv_epi64_epi8(S, U, A, B, 1);
+}
+
+__m128i test_mm_maskz_gf2p8affineinv_epi64_epi8(__mmask16 U, __m128i A, __m128i B) {
+ // AVX512-LABEL: @test_mm_maskz_gf2p8affineinv_epi64_epi8
+ // AVX512: @llvm.x86.vgf2p8affineinvqb.128
+ // AVX512: select <16 x i1> %{{[0-9]+}}, <16 x i8> %{{[0-9]+}}, <16 x i8> {{.*}}
+ return _mm_maskz_gf2p8affineinv_epi64_epi8(U, A, B, 1);
+}
+
+__m512i test_mm512_gf2p8affine_epi64_epi8(__m512i A, __m512i B) {
+ // AVX512-LABEL: @test_mm512_gf2p8affine_epi64_epi8
+ // AVX512: @llvm.x86.vgf2p8affineqb.512
+ return _mm512_gf2p8affine_epi64_epi8(A, B, 1);
+}
+
+__m512i test_mm512_mask_gf2p8affine_epi64_epi8(__m512i S, __mmask64 U, __m512i A, __m512i B) {
+ // AVX512-LABEL: @test_mm512_mask_gf2p8affine_epi64_epi8
+ // AVX512: @llvm.x86.vgf2p8affineqb.512
+ // AVX512: select <64 x i1> %{{[0-9]+}}, <64 x i8> %{{[0-9]+}}, <64 x i8> {{.*}}
+ return _mm512_mask_gf2p8affine_epi64_epi8(S, U, A, B, 1);
+}
+
+__m512i test_mm512_maskz_gf2p8affine_epi64_epi8(__mmask64 U, __m512i A, __m512i B) {
+ // AVX512-LABEL: @test_mm512_maskz_gf2p8affine_epi64_epi8
+ // AVX512: @llvm.x86.vgf2p8affineqb.512
+ // AVX512: select <64 x i1> %{{[0-9]+}}, <64 x i8> %{{[0-9]+}}, <64 x i8> {{.*}}
+ return _mm512_maskz_gf2p8affine_epi64_epi8(U, A, B, 1);
+}
+
+__m256i test_mm256_mask_gf2p8affine_epi64_epi8(__m256i S, __mmask32 U, __m256i A, __m256i B) {
+ // AVX256-LABEL: @test_mm256_mask_gf2p8affine_epi64_epi8
+ // AVX256: @llvm.x86.vgf2p8affineqb.256
+ // AVX256: select <32 x i1> %{{[0-9]+}}, <32 x i8> %{{[0-9]+}}, <32 x i8> {{.*}}
+ return _mm256_mask_gf2p8affine_epi64_epi8(S, U, A, B, 1);
+}
+
+__m256i test_mm256_maskz_gf2p8affine_epi64_epi8(__mmask32 U, __m256i A, __m256i B) {
+ // AVX256-LABEL: @test_mm256_maskz_gf2p8affine_epi64_epi8
+ // AVX256: @llvm.x86.vgf2p8affineqb.256
+ // AVX256: select <32 x i1> %{{[0-9]+}}, <32 x i8> %{{[0-9]+}}, <32 x i8> {{.*}}
+ return _mm256_maskz_gf2p8affine_epi64_epi8(U, A, B, 1);
+}
+
+__m128i test_mm_mask_gf2p8affine_epi64_epi8(__m128i S, __mmask16 U, __m128i A, __m128i B) {
+ // AVX512-LABEL: @test_mm_mask_gf2p8affine_epi64_epi8
+ // AVX512: @llvm.x86.vgf2p8affineqb.128
+ // AVX512: select <16 x i1> %{{[0-9]+}}, <16 x i8> %{{[0-9]+}}, <16 x i8> {{.*}}
+ return _mm_mask_gf2p8affine_epi64_epi8(S, U, A, B, 1);
+}
+
+__m128i test_mm_maskz_gf2p8affine_epi64_epi8(__mmask16 U, __m128i A, __m128i B) {
+ // AVX512-LABEL: @test_mm_maskz_gf2p8affine_epi64_epi8
+ // AVX512: @llvm.x86.vgf2p8affineqb.128
+ // AVX512: select <16 x i1> %{{[0-9]+}}, <16 x i8> %{{[0-9]+}}, <16 x i8> {{.*}}
+ return _mm_maskz_gf2p8affine_epi64_epi8(U, A, B, 1);
+}
+
+__m512i test_mm512_gf2p8mul_epi8(__m512i A, __m512i B) {
+ // AVX512-LABEL: @test_mm512_gf2p8mul_epi8
+ // AVX512: @llvm.x86.vgf2p8mulb.512
+ return _mm512_gf2p8mul_epi8(A, B);
+}
+
+__m512i test_mm512_mask_gf2p8mul_epi8(__m512i S, __mmask64 U, __m512i A, __m512i B) {
+ // AVX512-LABEL: @test_mm512_mask_gf2p8mul_epi8
+ // AVX512: @llvm.x86.vgf2p8mulb.512
+ // AVX512: select <64 x i1> %{{[0-9]+}}, <64 x i8> %{{[0-9]+}}, <64 x i8> {{.*}}
+ return _mm512_mask_gf2p8mul_epi8(S, U, A, B);
+}
+
+__m512i test_mm512_maskz_gf2p8mul_epi8(__mmask64 U, __m512i A, __m512i B) {
+ // AVX512-LABEL: @test_mm512_maskz_gf2p8mul_epi8
+ // AVX512: @llvm.x86.vgf2p8mulb.512
+ // AVX512: select <64 x i1> %{{[0-9]+}}, <64 x i8> %{{[0-9]+}}, <64 x i8> {{.*}}
+ return _mm512_maskz_gf2p8mul_epi8(U, A, B);
+}
+
+__m256i test_mm256_mask_gf2p8mul_epi8(__m256i S, __mmask32 U, __m256i A, __m256i B) {
+ // AVX256-LABEL: @test_mm256_mask_gf2p8mul_epi8
+ // AVX256: @llvm.x86.vgf2p8mulb.256
+ // AVX256: select <32 x i1> %{{[0-9]+}}, <32 x i8> %{{[0-9]+}}, <32 x i8> {{.*}}
+ return _mm256_mask_gf2p8mul_epi8(S, U, A, B);
+}
+
+__m256i test_mm256_maskz_gf2p8mul_epi8(__mmask32 U, __m256i A, __m256i B) {
+ // AVX256-LABEL: @test_mm256_maskz_gf2p8mul_epi8
+ // AVX256: @llvm.x86.vgf2p8mulb.256
+ // AVX256: select <32 x i1> %{{[0-9]+}}, <32 x i8> %{{[0-9]+}}, <32 x i8> {{.*}}
+ return _mm256_maskz_gf2p8mul_epi8(U, A, B);
+}
+
+__m128i test_mm_mask_gf2p8mul_epi8(__m128i S, __mmask16 U, __m128i A, __m128i B) {
+ // AVX512-LABEL: @test_mm_mask_gf2p8mul_epi8
+ // AVX512: @llvm.x86.vgf2p8mulb.128
+ // AVX512: select <16 x i1> %{{[0-9]+}}, <16 x i8> %{{[0-9]+}}, <16 x i8> {{.*}}
+ return _mm_mask_gf2p8mul_epi8(S, U, A, B);
+}
+#endif // AVX512
diff --git a/test/CodeGen/vaes-builtins.c b/test/CodeGen/vaes-builtins.c
new file mode 100644
index 0000000000000..df160aa16ee3b
--- /dev/null
+++ b/test/CodeGen/vaes-builtins.c
@@ -0,0 +1,55 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +vaes -emit-llvm -o - | FileCheck %s --check-prefix AVX
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -DAVX512 -target-feature +vaes -target-feature +avx512f -emit-llvm -o - | FileCheck %s --check-prefixes AVX,AVX512
+
+#include <immintrin.h>
+
+__m256i test_mm256_aesenc_epi128(__m256i __A, __m256i __B) {
+ // AVX-LABEL: @test_mm256_aesenc_epi128
+ // AVX: @llvm.x86.aesni.aesenc.256
+ return _mm256_aesenc_epi128(__A, __B);
+}
+
+__m256i test_mm256_aesenclast_epi128(__m256i __A, __m256i __B) {
+ // AVX-LABEL: @test_mm256_aesenclast_epi128
+ // AVX: @llvm.x86.aesni.aesenclast.256
+ return _mm256_aesenclast_epi128(__A, __B);
+}
+
+__m256i test_mm256_aesdec_epi128(__m256i __A, __m256i __B) {
+ // AVX-LABEL: @test_mm256_aesdec_epi128
+ // AVX: @llvm.x86.aesni.aesdec.256
+ return _mm256_aesdec_epi128(__A, __B);
+}
+
+__m256i test_mm256_aesdeclast_epi128(__m256i __A, __m256i __B) {
+ // AVX-LABEL: @test_mm256_aesdeclast_epi128
+ // AVX: @llvm.x86.aesni.aesdeclast.256
+ return _mm256_aesdeclast_epi128(__A, __B);
+}
+
+#ifdef AVX512
+__m512i test_mm512_aesenc_epi128(__m512i __A, __m512i __B) {
+ // AVX512-LABEL: @test_mm512_aesenc_epi128
+ // AVX512: @llvm.x86.aesni.aesenc.512
+ return _mm512_aesenc_epi128(__A, __B);
+}
+
+__m512i test_mm512_aesenclast_epi128(__m512i __A, __m512i __B) {
+ // AVX512-LABEL: @test_mm512_aesenclast_epi128
+ // AVX512: @llvm.x86.aesni.aesenclast.512
+ return _mm512_aesenclast_epi128(__A, __B);
+}
+
+__m512i test_mm512_aesdec_epi128(__m512i __A, __m512i __B) {
+ // AVX512-LABEL: @test_mm512_aesdec_epi128
+ // AVX512: @llvm.x86.aesni.aesdec.512
+ return _mm512_aesdec_epi128(__A, __B);
+}
+
+__m512i test_mm512_aesdeclast_epi128(__m512i __A, __m512i __B) {
+ // AVX512-LABEL: @test_mm512_aesdeclast_epi128
+ // AVX512: @llvm.x86.aesni.aesdeclast.512
+ return _mm512_aesdeclast_epi128(__A, __B);
+}
+#endif
+
diff --git a/test/CodeGen/vpclmulqdq-builtins.c b/test/CodeGen/vpclmulqdq-builtins.c
new file mode 100644
index 0000000000000..8c610e2d851cd
--- /dev/null
+++ b/test/CodeGen/vpclmulqdq-builtins.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +vpclmulqdq -emit-llvm -o - | FileCheck %s --check-prefix AVX
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -DAVX512 -target-feature +vpclmulqdq -target-feature +avx512f -emit-llvm -o - | FileCheck %s --check-prefixes AVX,AVX512
+
+#include <immintrin.h>
+
+__m256i test_mm256_clmulepi64_epi128(__m256i A, __m256i B) {
+ // AVX: @llvm.x86.pclmulqdq.256
+ return _mm256_clmulepi64_epi128(A, B, 0);
+}
+
+#ifdef AVX512
+__m512i test_mm512_clmulepi64_epi128(__m512i A, __m512i B) {
+ // AVX512: @llvm.x86.pclmulqdq.512
+ return _mm512_clmulepi64_epi128(A, B, 0);
+}
+#endif
+
diff --git a/test/CodeGenCXX/ubsan-vtable-checks.cpp b/test/CodeGenCXX/ubsan-vtable-checks.cpp
index 5e17913a2c89a..090707c29d746 100644
--- a/test/CodeGenCXX/ubsan-vtable-checks.cpp
+++ b/test/CodeGenCXX/ubsan-vtable-checks.cpp
@@ -38,3 +38,15 @@ void delete_it(T *t) {
// CHECK-VPTR: load {{.*}} (%struct.T*{{.*}})**, {{.*}} (%struct.T*{{.*}})***
delete t;
}
+
+// ITANIUM: define %struct.U* @_Z7dyncastP1T
+// MSABI: define %struct.U* @"\01?dyncast
+U* dyncast(T *t) {
+ // First, we check that dynamic_cast is not called before a type check.
+ // CHECK-VPTR-NOT: call i8* @__{{dynamic_cast|RTDynamicCast}}
+ // CHECK-VPTR: br i1 {{.*}} label %{{.*}}
+ // CHECK-VPTR: call void @__ubsan_handle_dynamic_type_cache_miss_abort
+ // Second, we check that dynamic_cast is actually called once the type check is done.
+ // CHECK-VPTR: call i8* @__{{dynamic_cast|RTDynamicCast}}
+ return dynamic_cast<U*>(t);
+}
diff --git a/test/Driver/x86-target-features.c b/test/Driver/x86-target-features.c
index c552ef7bd2753..1289823d1dbed 100644
--- a/test/Driver/x86-target-features.c
+++ b/test/Driver/x86-target-features.c
@@ -20,10 +20,10 @@
// SSE4-AES: "-target-feature" "+sse4.2" "-target-feature" "+aes"
// NO-SSE4-AES: "-target-feature" "-sse4.1" "-target-feature" "-aes"
-// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mavx -mavx2 -mavx512f -mavx512cd -mavx512er -mavx512pf -mavx512dq -mavx512bw -mavx512vl -mavx512vbmi -mavx512ifma %s -### -o %t.o 2>&1 | FileCheck -check-prefix=AVX %s
-// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-avx -mno-avx2 -mno-avx512f -mno-avx512cd -mno-avx512er -mno-avx512pf -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512vbmi -mno-avx512ifma %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-AVX %s
-// AVX: "-target-feature" "+avx" "-target-feature" "+avx2" "-target-feature" "+avx512f" "-target-feature" "+avx512cd" "-target-feature" "+avx512er" "-target-feature" "+avx512pf" "-target-feature" "+avx512dq" "-target-feature" "+avx512bw" "-target-feature" "+avx512vl" "-target-feature" "+avx512vbmi" "-target-feature" "+avx512ifma"
-// NO-AVX: "-target-feature" "-avx" "-target-feature" "-avx2" "-target-feature" "-avx512f" "-target-feature" "-avx512cd" "-target-feature" "-avx512er" "-target-feature" "-avx512pf" "-target-feature" "-avx512dq" "-target-feature" "-avx512bw" "-target-feature" "-avx512vl" "-target-feature" "-avx512vbmi" "-target-feature" "-avx512ifma"
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mavx -mavx2 -mavx512f -mavx512cd -mavx512er -mavx512pf -mavx512dq -mavx512bw -mavx512vl -mavx512vbmi -mavx512vbmi2 -mavx512ifma %s -### -o %t.o 2>&1 | FileCheck -check-prefix=AVX %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-avx -mno-avx2 -mno-avx512f -mno-avx512cd -mno-avx512er -mno-avx512pf -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512vbmi -mno-avx512vbmi2 -mno-avx512ifma %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-AVX %s
+// AVX: "-target-feature" "+avx" "-target-feature" "+avx2" "-target-feature" "+avx512f" "-target-feature" "+avx512cd" "-target-feature" "+avx512er" "-target-feature" "+avx512pf" "-target-feature" "+avx512dq" "-target-feature" "+avx512bw" "-target-feature" "+avx512vl" "-target-feature" "+avx512vbmi" "-target-feature" "+avx512vbmi2" "-target-feature" "+avx512ifma"
+// NO-AVX: "-target-feature" "-avx" "-target-feature" "-avx2" "-target-feature" "-avx512f" "-target-feature" "-avx512cd" "-target-feature" "-avx512er" "-target-feature" "-avx512pf" "-target-feature" "-avx512dq" "-target-feature" "-avx512bw" "-target-feature" "-avx512vl" "-target-feature" "-avx512vbmi" "-target-feature" "-avx512vbmi2" "-target-feature" "-avx512ifma"
// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mpclmul -mrdrnd -mfsgsbase -mbmi -mbmi2 %s -### -o %t.o 2>&1 | FileCheck -check-prefix=BMI %s
// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-pclmul -mno-rdrnd -mno-fsgsbase -mno-bmi -mno-bmi2 %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-BMI %s
@@ -94,3 +94,34 @@
// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-clzero %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-CLZERO %s
// CLZERO: "-target-feature" "+clzero"
// NO-CLZERO: "-target-feature" "-clzero"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mvaes %s -### -o %t.o 2>&1 | FileCheck -check-prefix=VAES %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-vaes %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-VAES %s
+// VAES: "-target-feature" "+vaes"
+// NO-VAES: "-target-feature" "-vaes"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mgfni %s -### -o %t.o 2>&1 | FileCheck -check-prefix=GFNI %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-gfni %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-GFNI %s
+// GFNI: "-target-feature" "+gfni"
+// NO-GFNI: "-target-feature" "-gfni
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mvpclmulqdq %s -### -o %t.o 2>&1 | FileCheck -check-prefix=VPCLMULQDQ %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-vpclmulqdq %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-VPCLMULQDQ %s
+// VPCLMULQDQ: "-target-feature" "+vpclmulqdq"
+// NO-VPCLMULQDQ: "-target-feature" "-vpclmulqdq"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mavx512bitalg %s -### -o %t.o 2>&1 | FileCheck -check-prefix=BITALG %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-avx512bitalg %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-BITALG %s
+// BITALG: "-target-feature" "+avx512bitalg"
+// NO-BITALG: "-target-feature" "-avx512bitalg"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mavx512vnni %s -### -o %t.o 2>&1 | FileCheck -check-prefix=VNNI %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-avx512vnni %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-VNNI %s
+// VNNI: "-target-feature" "+avx512vnni"
+// NO-VNNI: "-target-feature" "-avx512vnni"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mavx512vbmi2 %s -### -o %t.o 2>&1 | FileCheck -check-prefix=VBMI2 %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-avx512vbmi2 %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-VBMI2 %s
+// VBMI2: "-target-feature" "+avx512vbmi2"
+// NO-VBMI2: "-target-feature" "-avx512vbmi2"
+
diff --git a/test/Index/skipped-bodies-ctors.cpp b/test/Index/skipped-bodies-ctors.cpp
new file mode 100644
index 0000000000000..8a559ee0c74b7
--- /dev/null
+++ b/test/Index/skipped-bodies-ctors.cpp
@@ -0,0 +1,16 @@
+// RUN: env CINDEXTEST_SKIP_FUNCTION_BODIES=1 c-index-test -test-load-source all %s 2>&1 \
+// RUN: | FileCheck --implicit-check-not "error:" %s
+
+
+template <class T>
+struct Foo {
+ template <class = int>
+ Foo(int &a) : a(a) {
+ }
+
+ int &a;
+};
+
+
+int bar = Foo<int>(bar).a + Foo<int>(bar).a;
+// CHECK-NOT: error: constructor for 'Foo<int>' must explicitly initialize the reference
diff --git a/test/OpenMP/nvptx_data_sharing.cpp b/test/OpenMP/nvptx_data_sharing.cpp
index 65215cd2c4f97..53bac3ced96b3 100644
--- a/test/OpenMP/nvptx_data_sharing.cpp
+++ b/test/OpenMP/nvptx_data_sharing.cpp
@@ -24,7 +24,7 @@ void test_ds(){
// CK1: define internal void @__omp_offloading_{{.*}}test_ds{{.*}}worker() [[ATTR1:#.*]] {
// CK1: [[SHAREDARGS:%.+]] = alloca i8**
-// CK1: call i1 @__kmpc_kernel_parallel(i8** %work_fn, i8*** [[SHAREDARGS]])
+// CK1: call i1 @__kmpc_kernel_parallel(i8** %work_fn, i8*** [[SHAREDARGS]], i16 1)
// CK1: [[SHARGSTMP:%.+]] = load i8**, i8*** [[SHAREDARGS]]
// CK1: call void @__omp_outlined___wrapper{{.*}}({{.*}}, i8** [[SHARGSTMP]])
@@ -32,7 +32,7 @@ void test_ds(){
// CK1: {{.*}}define void @__omp_offloading{{.*}}test_ds{{.*}}() [[ATTR2:#.*]] {
// CK1: [[SHAREDARGS1:%.+]] = alloca i8**
-// CK1: call void @__kmpc_kernel_prepare_parallel({{.*}}, i8*** [[SHAREDARGS1]], i32 1)
+// CK1: call void @__kmpc_kernel_prepare_parallel({{.*}}, i8*** [[SHAREDARGS1]], i32 1, i16 1)
// CK1: [[SHARGSTMP1:%.+]] = load i8**, i8*** [[SHAREDARGS1]]
// CK1: [[SHARGSTMP2:%.+]] = getelementptr inbounds i8*, i8** [[SHARGSTMP1]]
// CK1: [[SHAREDVAR:%.+]] = bitcast i32* {{.*}} to i8*
diff --git a/test/OpenMP/nvptx_target_teams_codegen.cpp b/test/OpenMP/nvptx_target_teams_codegen.cpp
index b79fd185d77a8..8b016cc307d58 100644
--- a/test/OpenMP/nvptx_target_teams_codegen.cpp
+++ b/test/OpenMP/nvptx_target_teams_codegen.cpp
@@ -60,7 +60,7 @@ int bar(int n){
//
// CHECK: [[AWAIT_WORK]]
// CHECK: call void @llvm.nvvm.barrier0()
- // CHECK: [[KPR:%.+]] = call i1 @__kmpc_kernel_parallel(i8** [[OMP_WORK_FN]], i8*** %shared_args)
+ // CHECK: [[KPR:%.+]] = call i1 @__kmpc_kernel_parallel(i8** [[OMP_WORK_FN]], i8*** %shared_args, i16 1)
// CHECK: [[KPRB:%.+]] = zext i1 [[KPR]] to i8
// store i8 [[KPRB]], i8* [[OMP_EXEC_STATUS]], align 1
// CHECK: [[WORK:%.+]] = load i8*, i8** [[OMP_WORK_FN]],
@@ -148,7 +148,7 @@ int bar(int n){
//
// CHECK: [[AWAIT_WORK]]
// CHECK: call void @llvm.nvvm.barrier0()
- // CHECK: [[KPR:%.+]] = call i1 @__kmpc_kernel_parallel(i8** [[OMP_WORK_FN]], i8*** %shared_args)
+ // CHECK: [[KPR:%.+]] = call i1 @__kmpc_kernel_parallel(i8** [[OMP_WORK_FN]], i8*** %shared_args, i16 1)
// CHECK: [[KPRB:%.+]] = zext i1 [[KPR]] to i8
// store i8 [[KPRB]], i8* [[OMP_EXEC_STATUS]], align 1
// CHECK: [[WORK:%.+]] = load i8*, i8** [[OMP_WORK_FN]],
diff --git a/test/OpenMP/target_enter_data_depend_codegen.cpp b/test/OpenMP/target_enter_data_depend_codegen.cpp
new file mode 100644
index 0000000000000..469a161eb341a
--- /dev/null
+++ b/test/OpenMP/target_enter_data_depend_codegen.cpp
@@ -0,0 +1,378 @@
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
+
+// expected-no-diagnostics
+// CK1: [[ST:%.+]] = type { i32, double* }
+// CK1: %struct.kmp_depend_info = type { i[[sz:64|32]],
+// CK1-SAME: i[[sz]], i8 }
+#ifndef HEADER
+#define HEADER
+
+template <typename T>
+struct ST {
+ T a;
+ double *b;
+};
+
+ST<int> gb;
+double gc[100];
+
+// CK1: [[SIZE00:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] 800]
+// CK1: [[MTYPE00:@.+]] = {{.+}}constant [1 x i64] [i64 32]
+
+// CK1: [[SIZE02:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] 4]
+// CK1: [[MTYPE02:@.+]] = {{.+}}constant [1 x i64] [i64 33]
+
+// CK1: [[MTYPE03:@.+]] = {{.+}}constant [1 x i64] [i64 32]
+
+// CK1: [[SIZE04:@.+]] = {{.+}}constant [2 x i[[sz]]] [i[[sz]] {{8|4}}, i[[sz]] 24]
+// CK1: [[MTYPE04:@.+]] = {{.+}}constant [2 x i64] [i64 33, i64 17]
+
+// CK1-LABEL: _Z3fooi
+void foo(int arg) {
+ int la;
+ float lb[arg];
+
+ // CK1: alloca [1 x %struct.kmp_depend_info],
+ // CK1: alloca [3 x %struct.kmp_depend_info],
+ // CK1: alloca [4 x %struct.kmp_depend_info],
+ // CK1: alloca [5 x %struct.kmp_depend_info],
+
+ // Region 00
+ // CK1: [[BP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP:%.+]], i32 0, i32 0
+ // CK1: [[BP0_BC:%.+]] = bitcast i8** [[BP0]] to [100 x double]**
+ // CK1: store [100 x double]* @gc, [100 x double]** [[BP0_BC]],
+ // CK1: [[P0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P:%.+]], i32 0, i32 0
+ // CK1: [[P0_BC:%.+]] = bitcast i8** [[P0]] to [100 x double]**
+ // CK1: store [100 x double]* @gc, [100 x double]** [[P0_BC]],
+ // CK1: [[GEPBP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP]], i32 0, i32 0
+ // CK1: [[GEPP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P]], i32 0, i32 0
+ // CK1: [[CAP_DEVICE:%.+]] = getelementptr inbounds %struct.anon, %struct.anon* [[CAPTURES:%.+]], i32 0, i32 0
+ // CK1: [[DEVICE:%.+]] = load i32, i32* %{{.+}}
+ // CK1: store i32 [[DEVICE]], i32* [[CAP_DEVICE]],
+ // CK1: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* {{.+}}, i32 {{.+}}, i32 1, i[[sz]] [[sz]], i[[sz]] 4, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates*)* [[TASK_ENTRY0:@.+]] to i32 (i32, i8*)*))
+ // CK1: [[BC:%.+]] = bitcast i8* [[RES]] to %struct.kmp_task_t_with_privates*
+ // CK1: [[TASK_T:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates, %struct.kmp_task_t_with_privates* [[BC]], i32 0, i32 0
+ // CK1: [[SHAREDS:%.+]] = getelementptr inbounds %struct.kmp_task_t, %struct.kmp_task_t* [[TASK_T]], i32 0, i32 0
+ // CK1: [[SHAREDS_REF:%.+]] = load i8*, i8** [[SHAREDS]],
+ // CK1: [[BC1:%.+]] = bitcast %struct.anon* [[CAPTURES]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[SHAREDS_REF]], i8* [[BC1]], i[[sz]] 4, i32 4, i1 false)
+ // CK1: [[PRIVS:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates, %struct.kmp_task_t_with_privates* [[BC]], i32 0, i32 1
+ // CK1: [[PRIVS_BASEPTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t, %struct..kmp_privates.t* [[PRIVS]], i32 0, i32 0
+ // CK1: [[BC_PRIVS_BASEPTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_BASEPTRS]] to i8*
+ // CK1: [[BC_BASEPTRS:%.+]] = bitcast i8** [[GEPBP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_BASEPTRS]], i8* [[BC_BASEPTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_PTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t, %struct..kmp_privates.t* [[PRIVS]], i32 0, i32 1
+ // CK1: [[BC_PRIVS_PTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_PTRS]] to i8*
+ // CK1: [[BC_PTRS:%.+]] = bitcast i8** [[GEPP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_PTRS]], i8* [[BC_PTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_SIZES:%.+]] = getelementptr inbounds %struct..kmp_privates.t, %struct..kmp_privates.t* [[PRIVS]], i32 0, i32 2
+ // CK1: [[BC_PRIVS_SIZES:%.+]] = bitcast [1 x i[[sz]]]* [[PRIVS_SIZES]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_SIZES]], i8* bitcast ([1 x i[[sz]]]* [[SIZE00]] to i8*), i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* [[MAIN_DEP:%.+]], i[[sz]] 0, i[[sz]] 0
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0
+ // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8*
+ // CK1: = call i32 @__kmpc_omp_task_with_deps(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i8* [[BC]], i32 0, i8* null)
+
+ // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+ #pragma omp target enter data if(1+3-5) device(arg) map(alloc:gc) nowait depend(in: arg)
+ {++arg;}
+
+ // Region 01
+ // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+ #pragma omp target enter data map(to:la) if(1+3-4) depend(in: la) depend(out: arg)
+ {++arg;}
+
+ // Region 02
+ // CK1: br i1 %{{[^,]+}}, label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]]
+ // CK1: [[IFTHEN]]
+ // CK1: [[BP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP:%.+]], i32 0, i32 0
+ // CK1: [[BP0_BC:%.+]] = bitcast i8** [[BP0]] to i32**
+ // CK1: store i32* [[ARG:%.+]], i32** [[BP0_BC]],
+ // CK1: [[P0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P:%.+]], i32 0, i32 0
+ // CK1: [[P0_BC:%.+]] = bitcast i8** [[P0]] to i32**
+ // CK1: store i32* [[ARG]], i32** [[P0_BC]],
+ // CK1: [[GEPBP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP]], i32 0, i32 0
+ // CK1: [[GEPP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P]], i32 0, i32 0
+ // CK1: [[IF_DEVICE:%.+]] = getelementptr inbounds %struct.anon{{.+}}, %struct.anon{{.+}}* [[CAPTURES:%.+]], i32 0, i32 0
+ // CK1: [[IF:%.+]] = load i8, i8* %{{.+}}
+ // CK1: [[IF_BOOL:%.+]] = trunc i8 [[IF]] to i1
+ // CK1: [[IF:%.+]] = zext i1 [[IF_BOOL]] to i8
+ // CK1: store i8 [[IF]], i8* [[IF_DEVICE]],
+ // CK1: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* {{.+}}, i32 {{.+}}, i32 1, i[[sz]] [[sz]], i[[sz]] 1, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates{{.+}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*))
+ // CK1: [[RES_BC:%.+]] = bitcast i8* [[RES]] to %struct.kmp_task_t_with_privates{{.+}}*
+ // CK1: [[TASK_T:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 0
+ // CK1: [[SHAREDS:%.+]] = getelementptr inbounds %struct.kmp_task_t, %struct.kmp_task_t* [[TASK_T]], i32 0, i32 0
+ // CK1: [[SHAREDS_REF:%.+]] = load i8*, i8** [[SHAREDS]],
+ // CK1: [[BC1:%.+]] = bitcast %struct.anon{{.+}}* [[CAPTURES]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[SHAREDS_REF]], i8* [[BC1]], i[[sz]] 1, i32 1, i1 false)
+ // CK1: [[PRIVS:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 1
+ // CK1: [[PRIVS_BASEPTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 0
+ // CK1: [[BC_PRIVS_BASEPTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_BASEPTRS]] to i8*
+ // CK1: [[BC_BASEPTRS:%.+]] = bitcast i8** [[GEPBP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_BASEPTRS]], i8* [[BC_BASEPTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_PTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 1
+ // CK1: [[BC_PRIVS_PTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_PTRS]] to i8*
+ // CK1: [[BC_PTRS:%.+]] = bitcast i8** [[GEPP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_PTRS]], i8* [[BC_PTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_SIZES:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 2
+ // CK1: [[BC_PRIVS_SIZES:%.+]] = bitcast [1 x i[[sz]]]* [[PRIVS_SIZES]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_SIZES]], i8* bitcast ([1 x i[[sz]]]* [[SIZE02]] to i8*), i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP:%.+]], i[[sz]] 0, i[[sz]] 0
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 1
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 2
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: store i[[sz]] ptrtoint ([100 x double]* @gc to i[[sz]]), i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 800, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0
+ // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8*
+ // CK1: call void @__kmpc_omp_wait_deps(%ident_t* @{{.+}}, i32 %{{.+}}, i32 3, i8* [[BC]], i32 0, i8* null)
+ // CK1: call void @__kmpc_omp_task_begin_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+ // CK1: = call i32 [[TASK_ENTRY2]](i32 %{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]])
+ // CK1: call void @__kmpc_omp_task_complete_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+
+ // CK1: br label %[[IFEND:[^,]+]]
+
+ // CK1: [[IFELSE]]
+ // CK1: br label %[[IFEND]]
+ // CK1: [[IFEND]]
+ // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+ #pragma omp target enter data map(to:arg) if(arg) device(4) depend(inout: arg, la, gc)
+ {++arg;}
+
+ // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+ {++arg;}
+
+ // Region 03
+ // CK1: [[BP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP:%.+]], i32 0, i32 0
+ // CK1: [[BP0_BC:%.+]] = bitcast i8** [[BP0]] to float**
+ // CK1: store float* [[VLA:%.+]], float** [[BP0_BC]],
+ // CK1: [[P0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P:%.+]], i32 0, i32 0
+ // CK1: [[P0_BC:%.+]] = bitcast i8** [[P0]] to float**
+ // CK1: store float* [[VLA]], float** [[P0_BC]],
+ // CK1: [[S0:%.+]] = getelementptr inbounds [1 x i[[sz]]], [1 x i[[sz]]]* [[S:%.+]], i32 0, i32 0
+ // CK1: store i[[sz]] {{.+}}, i[[sz]]* [[S0]],
+ // CK1: [[GEPBP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP]], i32 0, i32 0
+ // CK1: [[GEPP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P]], i32 0, i32 0
+ // CK1: [[GEPS0:%.+]] = getelementptr inbounds [1 x i[[sz]]], [1 x i[[sz]]]* [[S]], i32 0, i32 0
+ // CK1: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* {{.+}}, i32 {{.+}}, i32 1, i[[sz]] [[sz]], i[[sz]] 1, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates{{.+}}*)* [[TASK_ENTRY3:@.+]] to i32 (i32, i8*)*))
+ // CK1: [[RES_BC:%.+]] = bitcast i8* [[RES]] to %struct.kmp_task_t_with_privates{{.+}}*
+ // CK1: [[TASK_T:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 0
+ // CK1: [[PRIVS:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 1
+ // CK1: [[PRIVS_BASEPTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 0
+ // CK1: [[BC_PRIVS_BASEPTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_BASEPTRS]] to i8*
+ // CK1: [[BC_BASEPTRS:%.+]] = bitcast i8** [[GEPBP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_BASEPTRS]], i8* [[BC_BASEPTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_PTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 1
+ // CK1: [[BC_PRIVS_PTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_PTRS]] to i8*
+ // CK1: [[BC_PTRS:%.+]] = bitcast i8** [[GEPP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_PTRS]], i8* [[BC_PTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_SIZES:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 2
+ // CK1: [[BC_PRIVS_SIZES:%.+]] = bitcast [1 x i[[sz]]]* [[PRIVS_SIZES]] to i8*
+ // CK1: [[BC_SIZES:%.+]] = bitcast i[[sz]]* [[GEPS0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_SIZES]], i8* [[BC_SIZES]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP:%.+]], i[[sz]] 0, i[[sz]] 0
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint float* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] %{{.+}}, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 1
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 2
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 3
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: store i[[sz]] ptrtoint ([100 x double]* @gc to i[[sz]]), i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 800, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0
+ // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8*
+ // CK1: call void @__kmpc_omp_wait_deps(%ident_t* @{{.+}}, i32 %{{.+}}, i32 4, i8* [[BC]], i32 0, i8* null)
+ // CK1: call void @__kmpc_omp_task_begin_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+ // CK1: = call i32 [[TASK_ENTRY3]](i32 %{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]])
+ // CK1: call void @__kmpc_omp_task_complete_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+ #pragma omp target enter data map(alloc:lb) depend(out: lb, arg, la, gc)
+ {++arg;}
+
+ // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+ {++arg;}
+
+ // Region 04
+ // CK1: [[BP0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BP:%.+]], i32 0, i32 0
+ // CK1: [[BP0_BC:%.+]] = bitcast i8** [[BP0]] to %struct.ST**
+ // CK1: store %struct.ST* @gb, %struct.ST** [[BP0_BC]],
+ // CK1: [[P0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[P:%.+]], i32 0, i32 0
+ // CK1: [[P0_BC:%.+]] = bitcast i8** [[P0]] to double***
+ // CK1: store double** getelementptr inbounds (%struct.ST, %struct.ST* @gb, i32 0, i32 1), double*** [[P0_BC]],
+ // CK1: [[BP1:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BP]], i32 0, i32 1
+ // CK1: [[BP1_BC:%.+]] = bitcast i8** [[BP1]] to double***
+ // CK1: store double** getelementptr inbounds (%struct.ST, %struct.ST* @gb, i32 0, i32 1), double*** [[BP1_BC]],
+ // CK1: [[P1:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[P]], i32 0, i32 1
+ // CK1: [[P1_BC:%.+]] = bitcast i8** [[P1]] to double**
+ // CK1: store double* %{{.+}}, double** [[P1_BC]],
+ // CK1: [[GEPBP0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BP]], i32 0, i32 0
+ // CK1: [[GEPP0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[P]], i32 0, i32 0
+ // CK1: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* {{.+}}, i32 {{.+}}, i32 1, i[[sz]] {{88|44}}, i[[sz]] 1, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates{{.+}}*)* [[TASK_ENTRY4:@.+]] to i32 (i32, i8*)*))
+ // CK1: [[RES_BC:%.+]] = bitcast i8* [[RES]] to %struct.kmp_task_t_with_privates{{.+}}*
+ // CK1: [[TASK_T:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 0
+ // CK1: [[PRIVS:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 1
+ // CK1: [[PRIVS_BASEPTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 0
+ // CK1: [[BC_PRIVS_BASEPTRS:%.+]] = bitcast [2 x i8*]* [[PRIVS_BASEPTRS]] to i8*
+ // CK1: [[BC_BASEPTRS:%.+]] = bitcast i8** [[GEPBP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_BASEPTRS]], i8* [[BC_BASEPTRS]], i[[sz]] {{16|8}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_PTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 1
+ // CK1: [[BC_PRIVS_PTRS:%.+]] = bitcast [2 x i8*]* [[PRIVS_PTRS]] to i8*
+ // CK1: [[BC_PTRS:%.+]] = bitcast i8** [[GEPP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_PTRS]], i8* [[BC_PTRS]], i[[sz]] {{16|8}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_SIZES:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 2
+ // CK1: [[BC_PRIVS_SIZES:%.+]] = bitcast [2 x i[[sz]]]* [[PRIVS_SIZES]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_SIZES]], i8* bitcast ([2 x i[[sz]]]* [[SIZE04]] to i8*), i[[sz]] {{16|8}}, i32 {{8|4}}, i1 false)
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP:%.+]], i[[sz]] 0, i[[sz]] 0
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint double* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] %{{.+}}, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 1
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 2
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint float* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] %{{.+}}, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 3
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: store i[[sz]] ptrtoint ([100 x double]* @gc to i[[sz]]), i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 800, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 4
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0
+ // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8*
+ // CK1: call void @__kmpc_omp_wait_deps(%ident_t* @{{.+}}, i32 %{{.+}}, i32 5, i8* [[BC]], i32 0, i8* null)
+ // CK1: call void @__kmpc_omp_task_begin_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+ // CK1: = call i32 [[TASK_ENTRY4]](i32 %{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]])
+ // CK1: call void @__kmpc_omp_task_complete_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+ #pragma omp target enter data map(to:gb.b[:3]) depend(in: gb.b[:3], la, lb, gc, arg)
+ {++arg;}
+}
+
+// CK1: define internal{{.*}} i32 [[TASK_ENTRY0]](i32{{.*}}, %struct.kmp_task_t_with_privates* noalias)
+// CK1-DAG: call void @__tgt_target_data_begin_nowait(i64 [[DEV:%[^,]+]], i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
+// CK1-DAG: [[DEV]] = sext i32 [[DEVi32:%[^,]+]] to i64
+// CK1-DAG: [[DEVi32]] = load i32, i32* %{{[^,]+}},
+// CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+// CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+// CK1-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
+// CK1-DAG: [[BP]] = load [1 x i8*]*, [1 x i8*]** [[BP_PRIV:%.+]],
+// CK1-DAG: [[P]] = load [1 x i8*]*, [1 x i8*]** [[P_PRIV:%.+]],
+// CK1-DAG: [[S]] = load [1 x i[[sz]]]*, [1 x i[[sz]]]** [[S_PRIV:%.+]],
+// CK1-DAG: call void (i8*, ...) %{{.+}}(i8* %{{[^,]+}}, [1 x i8*]** [[BP_PRIV]], [1 x i8*]** [[P_PRIV]], [1 x i[[sz]]]** [[S_PRIV]])
+// CK1: ret i32 0
+// CK1: }
+
+// CK1: define internal{{.*}} i32 [[TASK_ENTRY2]](i32{{.*}}, %struct.kmp_task_t_with_privates{{.+}}* noalias)
+// CK1-DAG: call void @__tgt_target_data_begin(i64 4, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
+// CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+// CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+// CK1-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
+// CK1-DAG: [[BP]] = load [1 x i8*]*, [1 x i8*]** [[BP_PRIV:%.+]],
+// CK1-DAG: [[P]] = load [1 x i8*]*, [1 x i8*]** [[P_PRIV:%.+]],
+// CK1-DAG: [[S]] = load [1 x i[[sz]]]*, [1 x i[[sz]]]** [[S_PRIV:%.+]],
+// CK1-DAG: call void (i8*, ...) %{{.+}}(i8* %{{[^,]+}}, [1 x i8*]** [[BP_PRIV]], [1 x i8*]** [[P_PRIV]], [1 x i[[sz]]]** [[S_PRIV]])
+// CK1: ret i32 0
+// CK1: }
+
+// CK1: define internal{{.*}} i32 [[TASK_ENTRY3]](i32{{.*}}, %struct.kmp_task_t_with_privates{{.+}}* noalias)
+// CK1-DAG: call void @__tgt_target_data_begin(i64 -1, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
+// CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+// CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+// CK1-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
+
+// CK1-DAG: [[BP]] = load [1 x i8*]*, [1 x i8*]** [[BP_PRIV:%.+]],
+// CK1-DAG: [[P]] = load [1 x i8*]*, [1 x i8*]** [[P_PRIV:%.+]],
+// CK1-DAG: [[S]] = load [1 x i[[sz]]]*, [1 x i[[sz]]]** [[S_PRIV:%.+]],
+// CK1-DAG: call void (i8*, ...) %{{.+}}(i8* %{{[^,]+}}, [1 x i8*]** [[BP_PRIV]], [1 x i8*]** [[P_PRIV]], [1 x i[[sz]]]** [[S_PRIV]])
+// CK1-NOT: __tgt_target_data_end
+// CK1: ret i32 0
+// CK1: }
+
+// CK1: define internal{{.*}} i32 [[TASK_ENTRY4]](i32{{.*}}, %struct.kmp_task_t_with_privates{{.+}}* noalias)
+// CK1-DAG: call void @__tgt_target_data_begin(i64 -1, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE04]]{{.+}})
+// CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+// CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+// CK1-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
+
+// CK1-DAG: [[BP]] = load [2 x i8*]*, [2 x i8*]** [[BP_PRIV:%.+]],
+// CK1-DAG: [[P]] = load [2 x i8*]*, [2 x i8*]** [[P_PRIV:%.+]],
+// CK1-DAG: [[S]] = load [2 x i[[sz]]]*, [2 x i[[sz]]]** [[S_PRIV:%.+]],
+// CK1-DAG: call void (i8*, ...) %{{.+}}(i8* %{{[^,]+}}, [2 x i8*]** [[BP_PRIV]], [2 x i8*]** [[P_PRIV]], [2 x i[[sz]]]** [[S_PRIV]])
+// CK1-NOT: __tgt_target_data_end
+// CK1: ret i32 0
+// CK1: }
+
+#endif
diff --git a/test/OpenMP/target_exit_data_depend_codegen.cpp b/test/OpenMP/target_exit_data_depend_codegen.cpp
new file mode 100644
index 0000000000000..6f7fba23db003
--- /dev/null
+++ b/test/OpenMP/target_exit_data_depend_codegen.cpp
@@ -0,0 +1,378 @@
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
+
+// expected-no-diagnostics
+// CK1: [[ST:%.+]] = type { i32, double* }
+// CK1: %struct.kmp_depend_info = type { i[[sz:64|32]],
+// CK1-SAME: i[[sz]], i8 }
+#ifndef HEADER
+#define HEADER
+
+template <typename T>
+struct ST {
+ T a;
+ double *b;
+};
+
+ST<int> gb;
+double gc[100];
+
+// CK1: [[SIZE00:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] 800]
+// CK1: [[MTYPE00:@.+]] = {{.+}}constant [1 x i64] [i64 34]
+
+// CK1: [[SIZE02:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] 4]
+// CK1: [[MTYPE02:@.+]] = {{.+}}constant [1 x i64] [i64 40]
+
+// CK1: [[MTYPE03:@.+]] = {{.+}}constant [1 x i64] [i64 34]
+
+// CK1: [[SIZE04:@.+]] = {{.+}}constant [2 x i[[sz]]] [i[[sz]] {{8|4}}, i[[sz]] 24]
+// CK1: [[MTYPE04:@.+]] = {{.+}}constant [2 x i64] [i64 34, i64 18]
+
+// CK1-LABEL: _Z3fooi
+void foo(int arg) {
+ int la;
+ float lb[arg];
+
+ // CK1: alloca [1 x %struct.kmp_depend_info],
+ // CK1: alloca [3 x %struct.kmp_depend_info],
+ // CK1: alloca [4 x %struct.kmp_depend_info],
+ // CK1: alloca [5 x %struct.kmp_depend_info],
+
+ // Region 00
+ // CK1: [[BP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP:%.+]], i32 0, i32 0
+ // CK1: [[BP0_BC:%.+]] = bitcast i8** [[BP0]] to [100 x double]**
+ // CK1: store [100 x double]* @gc, [100 x double]** [[BP0_BC]],
+ // CK1: [[P0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P:%.+]], i32 0, i32 0
+ // CK1: [[P0_BC:%.+]] = bitcast i8** [[P0]] to [100 x double]**
+ // CK1: store [100 x double]* @gc, [100 x double]** [[P0_BC]],
+ // CK1: [[GEPBP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP]], i32 0, i32 0
+ // CK1: [[GEPP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P]], i32 0, i32 0
+ // CK1: [[CAP_DEVICE:%.+]] = getelementptr inbounds %struct.anon, %struct.anon* [[CAPTURES:%.+]], i32 0, i32 0
+ // CK1: [[DEVICE:%.+]] = load i32, i32* %{{.+}}
+ // CK1: store i32 [[DEVICE]], i32* [[CAP_DEVICE]],
+ // CK1: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* {{.+}}, i32 {{.+}}, i32 1, i[[sz]] [[sz]], i[[sz]] 4, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates*)* [[TASK_ENTRY0:@.+]] to i32 (i32, i8*)*))
+ // CK1: [[BC:%.+]] = bitcast i8* [[RES]] to %struct.kmp_task_t_with_privates*
+ // CK1: [[TASK_T:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates, %struct.kmp_task_t_with_privates* [[BC]], i32 0, i32 0
+ // CK1: [[SHAREDS:%.+]] = getelementptr inbounds %struct.kmp_task_t, %struct.kmp_task_t* [[TASK_T]], i32 0, i32 0
+ // CK1: [[SHAREDS_REF:%.+]] = load i8*, i8** [[SHAREDS]],
+ // CK1: [[BC1:%.+]] = bitcast %struct.anon* [[CAPTURES]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[SHAREDS_REF]], i8* [[BC1]], i[[sz]] 4, i32 4, i1 false)
+ // CK1: [[PRIVS:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates, %struct.kmp_task_t_with_privates* [[BC]], i32 0, i32 1
+ // CK1: [[PRIVS_BASEPTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t, %struct..kmp_privates.t* [[PRIVS]], i32 0, i32 0
+ // CK1: [[BC_PRIVS_BASEPTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_BASEPTRS]] to i8*
+ // CK1: [[BC_BASEPTRS:%.+]] = bitcast i8** [[GEPBP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_BASEPTRS]], i8* [[BC_BASEPTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_PTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t, %struct..kmp_privates.t* [[PRIVS]], i32 0, i32 1
+ // CK1: [[BC_PRIVS_PTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_PTRS]] to i8*
+ // CK1: [[BC_PTRS:%.+]] = bitcast i8** [[GEPP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_PTRS]], i8* [[BC_PTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_SIZES:%.+]] = getelementptr inbounds %struct..kmp_privates.t, %struct..kmp_privates.t* [[PRIVS]], i32 0, i32 2
+ // CK1: [[BC_PRIVS_SIZES:%.+]] = bitcast [1 x i[[sz]]]* [[PRIVS_SIZES]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_SIZES]], i8* bitcast ([1 x i[[sz]]]* [[SIZE00]] to i8*), i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* [[MAIN_DEP:%.+]], i[[sz]] 0, i[[sz]] 0
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0
+ // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8*
+ // CK1: = call i32 @__kmpc_omp_task_with_deps(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i8* [[BC]], i32 0, i8* null)
+
+ // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+ #pragma omp target exit data if(1+3-5) device(arg) map(from:gc) nowait depend(in: arg)
+ {++arg;}
+
+ // Region 01
+ // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+ #pragma omp target exit data map(release: la) if(1+3-4) depend(in: la) depend(out: arg)
+ {++arg;}
+
+ // Region 02
+ // CK1: br i1 %{{[^,]+}}, label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]]
+ // CK1: [[IFTHEN]]
+ // CK1: [[BP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP:%.+]], i32 0, i32 0
+ // CK1: [[BP0_BC:%.+]] = bitcast i8** [[BP0]] to i32**
+ // CK1: store i32* [[ARG:%.+]], i32** [[BP0_BC]],
+ // CK1: [[P0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P:%.+]], i32 0, i32 0
+ // CK1: [[P0_BC:%.+]] = bitcast i8** [[P0]] to i32**
+ // CK1: store i32* [[ARG]], i32** [[P0_BC]],
+ // CK1: [[GEPBP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP]], i32 0, i32 0
+ // CK1: [[GEPP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P]], i32 0, i32 0
+ // CK1: [[IF_DEVICE:%.+]] = getelementptr inbounds %struct.anon{{.+}}, %struct.anon{{.+}}* [[CAPTURES:%.+]], i32 0, i32 0
+ // CK1: [[IF:%.+]] = load i8, i8* %{{.+}}
+ // CK1: [[IF_BOOL:%.+]] = trunc i8 [[IF]] to i1
+ // CK1: [[IF:%.+]] = zext i1 [[IF_BOOL]] to i8
+ // CK1: store i8 [[IF]], i8* [[IF_DEVICE]],
+ // CK1: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* {{.+}}, i32 {{.+}}, i32 1, i[[sz]] [[sz]], i[[sz]] 1, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates{{.+}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*))
+ // CK1: [[RES_BC:%.+]] = bitcast i8* [[RES]] to %struct.kmp_task_t_with_privates{{.+}}*
+ // CK1: [[TASK_T:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 0
+ // CK1: [[SHAREDS:%.+]] = getelementptr inbounds %struct.kmp_task_t, %struct.kmp_task_t* [[TASK_T]], i32 0, i32 0
+ // CK1: [[SHAREDS_REF:%.+]] = load i8*, i8** [[SHAREDS]],
+ // CK1: [[BC1:%.+]] = bitcast %struct.anon{{.+}}* [[CAPTURES]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[SHAREDS_REF]], i8* [[BC1]], i[[sz]] 1, i32 1, i1 false)
+ // CK1: [[PRIVS:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 1
+ // CK1: [[PRIVS_BASEPTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 0
+ // CK1: [[BC_PRIVS_BASEPTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_BASEPTRS]] to i8*
+ // CK1: [[BC_BASEPTRS:%.+]] = bitcast i8** [[GEPBP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_BASEPTRS]], i8* [[BC_BASEPTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_PTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 1
+ // CK1: [[BC_PRIVS_PTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_PTRS]] to i8*
+ // CK1: [[BC_PTRS:%.+]] = bitcast i8** [[GEPP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_PTRS]], i8* [[BC_PTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_SIZES:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 2
+ // CK1: [[BC_PRIVS_SIZES:%.+]] = bitcast [1 x i[[sz]]]* [[PRIVS_SIZES]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_SIZES]], i8* bitcast ([1 x i[[sz]]]* [[SIZE02]] to i8*), i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP:%.+]], i[[sz]] 0, i[[sz]] 0
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 1
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 2
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: store i[[sz]] ptrtoint ([100 x double]* @gc to i[[sz]]), i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 800, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0
+ // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8*
+ // CK1: call void @__kmpc_omp_wait_deps(%ident_t* @{{.+}}, i32 %{{.+}}, i32 3, i8* [[BC]], i32 0, i8* null)
+ // CK1: call void @__kmpc_omp_task_begin_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+ // CK1: = call i32 [[TASK_ENTRY2]](i32 %{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]])
+ // CK1: call void @__kmpc_omp_task_complete_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+
+ // CK1: br label %[[IFEND:[^,]+]]
+
+ // CK1: [[IFELSE]]
+ // CK1: br label %[[IFEND]]
+ // CK1: [[IFEND]]
+ // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+ #pragma omp target exit data map(delete: arg) if(arg) device(4) depend(inout: arg, la, gc)
+ {++arg;}
+
+ // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+ {++arg;}
+
+ // Region 03
+ // CK1: [[BP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP:%.+]], i32 0, i32 0
+ // CK1: [[BP0_BC:%.+]] = bitcast i8** [[BP0]] to float**
+ // CK1: store float* [[VLA:%.+]], float** [[BP0_BC]],
+ // CK1: [[P0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P:%.+]], i32 0, i32 0
+ // CK1: [[P0_BC:%.+]] = bitcast i8** [[P0]] to float**
+ // CK1: store float* [[VLA]], float** [[P0_BC]],
+ // CK1: [[S0:%.+]] = getelementptr inbounds [1 x i[[sz]]], [1 x i[[sz]]]* [[S:%.+]], i32 0, i32 0
+ // CK1: store i[[sz]] {{.+}}, i[[sz]]* [[S0]],
+ // CK1: [[GEPBP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP]], i32 0, i32 0
+ // CK1: [[GEPP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P]], i32 0, i32 0
+ // CK1: [[GEPS0:%.+]] = getelementptr inbounds [1 x i[[sz]]], [1 x i[[sz]]]* [[S]], i32 0, i32 0
+ // CK1: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* {{.+}}, i32 {{.+}}, i32 1, i[[sz]] [[sz]], i[[sz]] 1, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates{{.+}}*)* [[TASK_ENTRY3:@.+]] to i32 (i32, i8*)*))
+ // CK1: [[RES_BC:%.+]] = bitcast i8* [[RES]] to %struct.kmp_task_t_with_privates{{.+}}*
+ // CK1: [[TASK_T:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 0
+ // CK1: [[PRIVS:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 1
+ // CK1: [[PRIVS_BASEPTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 0
+ // CK1: [[BC_PRIVS_BASEPTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_BASEPTRS]] to i8*
+ // CK1: [[BC_BASEPTRS:%.+]] = bitcast i8** [[GEPBP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_BASEPTRS]], i8* [[BC_BASEPTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_PTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 1
+ // CK1: [[BC_PRIVS_PTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_PTRS]] to i8*
+ // CK1: [[BC_PTRS:%.+]] = bitcast i8** [[GEPP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_PTRS]], i8* [[BC_PTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_SIZES:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 2
+ // CK1: [[BC_PRIVS_SIZES:%.+]] = bitcast [1 x i[[sz]]]* [[PRIVS_SIZES]] to i8*
+ // CK1: [[BC_SIZES:%.+]] = bitcast i[[sz]]* [[GEPS0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_SIZES]], i8* [[BC_SIZES]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP:%.+]], i[[sz]] 0, i[[sz]] 0
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint float* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] %{{.+}}, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 1
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 2
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 3
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: store i[[sz]] ptrtoint ([100 x double]* @gc to i[[sz]]), i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 800, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0
+ // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8*
+ // CK1: call void @__kmpc_omp_wait_deps(%ident_t* @{{.+}}, i32 %{{.+}}, i32 4, i8* [[BC]], i32 0, i8* null)
+ // CK1: call void @__kmpc_omp_task_begin_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+ // CK1: = call i32 [[TASK_ENTRY3]](i32 %{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]])
+ // CK1: call void @__kmpc_omp_task_complete_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+ #pragma omp target exit data map(from:lb) depend(out: lb, arg, la, gc)
+ {++arg;}
+
+ // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+ {++arg;}
+
+ // Region 04
+ // CK1: [[BP0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BP:%.+]], i32 0, i32 0
+ // CK1: [[BP0_BC:%.+]] = bitcast i8** [[BP0]] to %struct.ST**
+ // CK1: store %struct.ST* @gb, %struct.ST** [[BP0_BC]],
+ // CK1: [[P0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[P:%.+]], i32 0, i32 0
+ // CK1: [[P0_BC:%.+]] = bitcast i8** [[P0]] to double***
+ // CK1: store double** getelementptr inbounds (%struct.ST, %struct.ST* @gb, i32 0, i32 1), double*** [[P0_BC]],
+ // CK1: [[BP1:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BP]], i32 0, i32 1
+ // CK1: [[BP1_BC:%.+]] = bitcast i8** [[BP1]] to double***
+ // CK1: store double** getelementptr inbounds (%struct.ST, %struct.ST* @gb, i32 0, i32 1), double*** [[BP1_BC]],
+ // CK1: [[P1:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[P]], i32 0, i32 1
+ // CK1: [[P1_BC:%.+]] = bitcast i8** [[P1]] to double**
+ // CK1: store double* %{{.+}}, double** [[P1_BC]],
+ // CK1: [[GEPBP0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BP]], i32 0, i32 0
+ // CK1: [[GEPP0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[P]], i32 0, i32 0
+ // CK1: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* {{.+}}, i32 {{.+}}, i32 1, i[[sz]] {{88|44}}, i[[sz]] 1, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates{{.+}}*)* [[TASK_ENTRY4:@.+]] to i32 (i32, i8*)*))
+ // CK1: [[RES_BC:%.+]] = bitcast i8* [[RES]] to %struct.kmp_task_t_with_privates{{.+}}*
+ // CK1: [[TASK_T:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 0
+ // CK1: [[PRIVS:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 1
+ // CK1: [[PRIVS_BASEPTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 0
+ // CK1: [[BC_PRIVS_BASEPTRS:%.+]] = bitcast [2 x i8*]* [[PRIVS_BASEPTRS]] to i8*
+ // CK1: [[BC_BASEPTRS:%.+]] = bitcast i8** [[GEPBP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_BASEPTRS]], i8* [[BC_BASEPTRS]], i[[sz]] {{16|8}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_PTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 1
+ // CK1: [[BC_PRIVS_PTRS:%.+]] = bitcast [2 x i8*]* [[PRIVS_PTRS]] to i8*
+ // CK1: [[BC_PTRS:%.+]] = bitcast i8** [[GEPP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_PTRS]], i8* [[BC_PTRS]], i[[sz]] {{16|8}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_SIZES:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 2
+ // CK1: [[BC_PRIVS_SIZES:%.+]] = bitcast [2 x i[[sz]]]* [[PRIVS_SIZES]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_SIZES]], i8* bitcast ([2 x i[[sz]]]* [[SIZE04]] to i8*), i[[sz]] {{16|8}}, i32 {{8|4}}, i1 false)
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP:%.+]], i[[sz]] 0, i[[sz]] 0
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint double* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] %{{.+}}, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 1
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 2
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint float* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] %{{.+}}, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 3
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: store i[[sz]] ptrtoint ([100 x double]* @gc to i[[sz]]), i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 800, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 4
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0
+ // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8*
+ // CK1: call void @__kmpc_omp_wait_deps(%ident_t* @{{.+}}, i32 %{{.+}}, i32 5, i8* [[BC]], i32 0, i8* null)
+ // CK1: call void @__kmpc_omp_task_begin_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+ // CK1: = call i32 [[TASK_ENTRY4]](i32 %{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]])
+ // CK1: call void @__kmpc_omp_task_complete_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+ #pragma omp target exit data map(from:gb.b[:3]) depend(in: gb.b[:3], la, lb, gc, arg)
+ {++arg;}
+}
+
+// CK1: define internal{{.*}} i32 [[TASK_ENTRY0]](i32{{.*}}, %struct.kmp_task_t_with_privates* noalias)
+// CK1-DAG: call void @__tgt_target_data_end_nowait(i64 [[DEV:%[^,]+]], i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
+// CK1-DAG: [[DEV]] = sext i32 [[DEVi32:%[^,]+]] to i64
+// CK1-DAG: [[DEVi32]] = load i32, i32* %{{[^,]+}},
+// CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+// CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+// CK1-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
+// CK1-DAG: [[BP]] = load [1 x i8*]*, [1 x i8*]** [[BP_PRIV:%.+]],
+// CK1-DAG: [[P]] = load [1 x i8*]*, [1 x i8*]** [[P_PRIV:%.+]],
+// CK1-DAG: [[S]] = load [1 x i[[sz]]]*, [1 x i[[sz]]]** [[S_PRIV:%.+]],
+// CK1-DAG: call void (i8*, ...) %{{.+}}(i8* %{{[^,]+}}, [1 x i8*]** [[BP_PRIV]], [1 x i8*]** [[P_PRIV]], [1 x i[[sz]]]** [[S_PRIV]])
+// CK1: ret i32 0
+// CK1: }
+
+// CK1: define internal{{.*}} i32 [[TASK_ENTRY2]](i32{{.*}}, %struct.kmp_task_t_with_privates{{.+}}* noalias)
+// CK1-DAG: call void @__tgt_target_data_end(i64 4, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
+// CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+// CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+// CK1-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
+// CK1-DAG: [[BP]] = load [1 x i8*]*, [1 x i8*]** [[BP_PRIV:%.+]],
+// CK1-DAG: [[P]] = load [1 x i8*]*, [1 x i8*]** [[P_PRIV:%.+]],
+// CK1-DAG: [[S]] = load [1 x i[[sz]]]*, [1 x i[[sz]]]** [[S_PRIV:%.+]],
+// CK1-DAG: call void (i8*, ...) %{{.+}}(i8* %{{[^,]+}}, [1 x i8*]** [[BP_PRIV]], [1 x i8*]** [[P_PRIV]], [1 x i[[sz]]]** [[S_PRIV]])
+// CK1: ret i32 0
+// CK1: }
+
+// CK1: define internal{{.*}} i32 [[TASK_ENTRY3]](i32{{.*}}, %struct.kmp_task_t_with_privates{{.+}}* noalias)
+// CK1-DAG: call void @__tgt_target_data_end(i64 -1, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
+// CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+// CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+// CK1-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
+
+// CK1-DAG: [[BP]] = load [1 x i8*]*, [1 x i8*]** [[BP_PRIV:%.+]],
+// CK1-DAG: [[P]] = load [1 x i8*]*, [1 x i8*]** [[P_PRIV:%.+]],
+// CK1-DAG: [[S]] = load [1 x i[[sz]]]*, [1 x i[[sz]]]** [[S_PRIV:%.+]],
+// CK1-DAG: call void (i8*, ...) %{{.+}}(i8* %{{[^,]+}}, [1 x i8*]** [[BP_PRIV]], [1 x i8*]** [[P_PRIV]], [1 x i[[sz]]]** [[S_PRIV]])
+// CK1-NOT: __tgt_target_data_end
+// CK1: ret i32 0
+// CK1: }
+
+// CK1: define internal{{.*}} i32 [[TASK_ENTRY4]](i32{{.*}}, %struct.kmp_task_t_with_privates{{.+}}* noalias)
+// CK1-DAG: call void @__tgt_target_data_end(i64 -1, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE04]]{{.+}})
+// CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+// CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+// CK1-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
+
+// CK1-DAG: [[BP]] = load [2 x i8*]*, [2 x i8*]** [[BP_PRIV:%.+]],
+// CK1-DAG: [[P]] = load [2 x i8*]*, [2 x i8*]** [[P_PRIV:%.+]],
+// CK1-DAG: [[S]] = load [2 x i[[sz]]]*, [2 x i[[sz]]]** [[S_PRIV:%.+]],
+// CK1-DAG: call void (i8*, ...) %{{.+}}(i8* %{{[^,]+}}, [2 x i8*]** [[BP_PRIV]], [2 x i8*]** [[P_PRIV]], [2 x i[[sz]]]** [[S_PRIV]])
+// CK1-NOT: __tgt_target_data_end
+// CK1: ret i32 0
+// CK1: }
+
+#endif
diff --git a/test/OpenMP/target_update_depend_codegen.cpp b/test/OpenMP/target_update_depend_codegen.cpp
new file mode 100644
index 0000000000000..6542aa1958d3e
--- /dev/null
+++ b/test/OpenMP/target_update_depend_codegen.cpp
@@ -0,0 +1,378 @@
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
+
+// expected-no-diagnostics
+// CK1: [[ST:%.+]] = type { i32, double* }
+// CK1: %struct.kmp_depend_info = type { i[[sz:64|32]],
+// CK1-SAME: i[[sz]], i8 }
+#ifndef HEADER
+#define HEADER
+
+template <typename T>
+struct ST {
+ T a;
+ double *b;
+};
+
+ST<int> gb;
+double gc[100];
+
+// CK1: [[SIZE00:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] 800]
+// CK1: [[MTYPE00:@.+]] = {{.+}}constant [1 x i64] [i64 34]
+
+// CK1: [[SIZE02:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] 4]
+// CK1: [[MTYPE02:@.+]] = {{.+}}constant [1 x i64] [i64 33]
+
+// CK1: [[MTYPE03:@.+]] = {{.+}}constant [1 x i64] [i64 34]
+
+// CK1: [[SIZE04:@.+]] = {{.+}}constant [2 x i[[sz]]] [i[[sz]] {{8|4}}, i[[sz]] 24]
+// CK1: [[MTYPE04:@.+]] = {{.+}}constant [2 x i64] [i64 33, i64 17]
+
+// CK1-LABEL: _Z3fooi
+void foo(int arg) {
+ int la;
+ float lb[arg];
+
+ // CK1: alloca [1 x %struct.kmp_depend_info],
+ // CK1: alloca [3 x %struct.kmp_depend_info],
+ // CK1: alloca [4 x %struct.kmp_depend_info],
+ // CK1: alloca [5 x %struct.kmp_depend_info],
+
+ // Region 00
+ // CK1: [[BP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP:%.+]], i32 0, i32 0
+ // CK1: [[BP0_BC:%.+]] = bitcast i8** [[BP0]] to [100 x double]**
+ // CK1: store [100 x double]* @gc, [100 x double]** [[BP0_BC]],
+ // CK1: [[P0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P:%.+]], i32 0, i32 0
+ // CK1: [[P0_BC:%.+]] = bitcast i8** [[P0]] to [100 x double]**
+ // CK1: store [100 x double]* @gc, [100 x double]** [[P0_BC]],
+ // CK1: [[GEPBP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP]], i32 0, i32 0
+ // CK1: [[GEPP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P]], i32 0, i32 0
+ // CK1: [[CAP_DEVICE:%.+]] = getelementptr inbounds %struct.anon, %struct.anon* [[CAPTURES:%.+]], i32 0, i32 0
+ // CK1: [[DEVICE:%.+]] = load i32, i32* %{{.+}}
+ // CK1: store i32 [[DEVICE]], i32* [[CAP_DEVICE]],
+ // CK1: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* {{.+}}, i32 {{.+}}, i32 1, i[[sz]] [[sz]], i[[sz]] 4, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates*)* [[TASK_ENTRY0:@.+]] to i32 (i32, i8*)*))
+ // CK1: [[BC:%.+]] = bitcast i8* [[RES]] to %struct.kmp_task_t_with_privates*
+ // CK1: [[TASK_T:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates, %struct.kmp_task_t_with_privates* [[BC]], i32 0, i32 0
+ // CK1: [[SHAREDS:%.+]] = getelementptr inbounds %struct.kmp_task_t, %struct.kmp_task_t* [[TASK_T]], i32 0, i32 0
+ // CK1: [[SHAREDS_REF:%.+]] = load i8*, i8** [[SHAREDS]],
+ // CK1: [[BC1:%.+]] = bitcast %struct.anon* [[CAPTURES]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[SHAREDS_REF]], i8* [[BC1]], i[[sz]] 4, i32 4, i1 false)
+ // CK1: [[PRIVS:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates, %struct.kmp_task_t_with_privates* [[BC]], i32 0, i32 1
+ // CK1: [[PRIVS_BASEPTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t, %struct..kmp_privates.t* [[PRIVS]], i32 0, i32 0
+ // CK1: [[BC_PRIVS_BASEPTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_BASEPTRS]] to i8*
+ // CK1: [[BC_BASEPTRS:%.+]] = bitcast i8** [[GEPBP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_BASEPTRS]], i8* [[BC_BASEPTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_PTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t, %struct..kmp_privates.t* [[PRIVS]], i32 0, i32 1
+ // CK1: [[BC_PRIVS_PTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_PTRS]] to i8*
+ // CK1: [[BC_PTRS:%.+]] = bitcast i8** [[GEPP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_PTRS]], i8* [[BC_PTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_SIZES:%.+]] = getelementptr inbounds %struct..kmp_privates.t, %struct..kmp_privates.t* [[PRIVS]], i32 0, i32 2
+ // CK1: [[BC_PRIVS_SIZES:%.+]] = bitcast [1 x i[[sz]]]* [[PRIVS_SIZES]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_SIZES]], i8* bitcast ([1 x i[[sz]]]* [[SIZE00]] to i8*), i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* [[MAIN_DEP:%.+]], i[[sz]] 0, i[[sz]] 0
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0
+ // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8*
+ // CK1: = call i32 @__kmpc_omp_task_with_deps(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i8* [[BC]], i32 0, i8* null)
+
+ // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+ #pragma omp target update if(1+3-5) device(arg) from(gc) nowait depend(in: arg)
+ {++arg;}
+
+ // Region 01
+ // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+ #pragma omp target update to(la) if(1+3-4) depend(in: la) depend(out: arg)
+ {++arg;}
+
+ // Region 02
+ // CK1: br i1 %{{[^,]+}}, label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]]
+ // CK1: [[IFTHEN]]
+ // CK1: [[BP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP:%.+]], i32 0, i32 0
+ // CK1: [[BP0_BC:%.+]] = bitcast i8** [[BP0]] to i32**
+ // CK1: store i32* [[ARG:%.+]], i32** [[BP0_BC]],
+ // CK1: [[P0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P:%.+]], i32 0, i32 0
+ // CK1: [[P0_BC:%.+]] = bitcast i8** [[P0]] to i32**
+ // CK1: store i32* [[ARG]], i32** [[P0_BC]],
+ // CK1: [[GEPBP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP]], i32 0, i32 0
+ // CK1: [[GEPP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P]], i32 0, i32 0
+ // CK1: [[IF_DEVICE:%.+]] = getelementptr inbounds %struct.anon{{.+}}, %struct.anon{{.+}}* [[CAPTURES:%.+]], i32 0, i32 0
+ // CK1: [[IF:%.+]] = load i8, i8* %{{.+}}
+ // CK1: [[IF_BOOL:%.+]] = trunc i8 [[IF]] to i1
+ // CK1: [[IF:%.+]] = zext i1 [[IF_BOOL]] to i8
+ // CK1: store i8 [[IF]], i8* [[IF_DEVICE]],
+ // CK1: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* {{.+}}, i32 {{.+}}, i32 1, i[[sz]] [[sz]], i[[sz]] 1, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates{{.+}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*))
+ // CK1: [[RES_BC:%.+]] = bitcast i8* [[RES]] to %struct.kmp_task_t_with_privates{{.+}}*
+ // CK1: [[TASK_T:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 0
+ // CK1: [[SHAREDS:%.+]] = getelementptr inbounds %struct.kmp_task_t, %struct.kmp_task_t* [[TASK_T]], i32 0, i32 0
+ // CK1: [[SHAREDS_REF:%.+]] = load i8*, i8** [[SHAREDS]],
+ // CK1: [[BC1:%.+]] = bitcast %struct.anon{{.+}}* [[CAPTURES]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[SHAREDS_REF]], i8* [[BC1]], i[[sz]] 1, i32 1, i1 false)
+ // CK1: [[PRIVS:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 1
+ // CK1: [[PRIVS_BASEPTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 0
+ // CK1: [[BC_PRIVS_BASEPTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_BASEPTRS]] to i8*
+ // CK1: [[BC_BASEPTRS:%.+]] = bitcast i8** [[GEPBP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_BASEPTRS]], i8* [[BC_BASEPTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_PTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 1
+ // CK1: [[BC_PRIVS_PTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_PTRS]] to i8*
+ // CK1: [[BC_PTRS:%.+]] = bitcast i8** [[GEPP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_PTRS]], i8* [[BC_PTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_SIZES:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 2
+ // CK1: [[BC_PRIVS_SIZES:%.+]] = bitcast [1 x i[[sz]]]* [[PRIVS_SIZES]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_SIZES]], i8* bitcast ([1 x i[[sz]]]* [[SIZE02]] to i8*), i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP:%.+]], i[[sz]] 0, i[[sz]] 0
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 1
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 2
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: store i[[sz]] ptrtoint ([100 x double]* @gc to i[[sz]]), i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 800, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0
+ // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8*
+ // CK1: call void @__kmpc_omp_wait_deps(%ident_t* @{{.+}}, i32 %{{.+}}, i32 3, i8* [[BC]], i32 0, i8* null)
+ // CK1: call void @__kmpc_omp_task_begin_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+ // CK1: = call i32 [[TASK_ENTRY2]](i32 %{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]])
+ // CK1: call void @__kmpc_omp_task_complete_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+
+ // CK1: br label %[[IFEND:[^,]+]]
+
+ // CK1: [[IFELSE]]
+ // CK1: br label %[[IFEND]]
+ // CK1: [[IFEND]]
+ // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+ #pragma omp target update to(arg) if(arg) device(4) depend(inout: arg, la, gc)
+ {++arg;}
+
+ // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+ {++arg;}
+
+ // Region 03
+ // CK1: [[BP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP:%.+]], i32 0, i32 0
+ // CK1: [[BP0_BC:%.+]] = bitcast i8** [[BP0]] to float**
+ // CK1: store float* [[VLA:%.+]], float** [[BP0_BC]],
+ // CK1: [[P0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P:%.+]], i32 0, i32 0
+ // CK1: [[P0_BC:%.+]] = bitcast i8** [[P0]] to float**
+ // CK1: store float* [[VLA]], float** [[P0_BC]],
+ // CK1: [[S0:%.+]] = getelementptr inbounds [1 x i[[sz]]], [1 x i[[sz]]]* [[S:%.+]], i32 0, i32 0
+ // CK1: store i[[sz]] {{.+}}, i[[sz]]* [[S0]],
+ // CK1: [[GEPBP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP]], i32 0, i32 0
+ // CK1: [[GEPP0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P]], i32 0, i32 0
+ // CK1: [[GEPS0:%.+]] = getelementptr inbounds [1 x i[[sz]]], [1 x i[[sz]]]* [[S]], i32 0, i32 0
+ // CK1: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* {{.+}}, i32 {{.+}}, i32 1, i[[sz]] [[sz]], i[[sz]] 1, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates{{.+}}*)* [[TASK_ENTRY3:@.+]] to i32 (i32, i8*)*))
+ // CK1: [[RES_BC:%.+]] = bitcast i8* [[RES]] to %struct.kmp_task_t_with_privates{{.+}}*
+ // CK1: [[TASK_T:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 0
+ // CK1: [[PRIVS:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 1
+ // CK1: [[PRIVS_BASEPTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 0
+ // CK1: [[BC_PRIVS_BASEPTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_BASEPTRS]] to i8*
+ // CK1: [[BC_BASEPTRS:%.+]] = bitcast i8** [[GEPBP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_BASEPTRS]], i8* [[BC_BASEPTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_PTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 1
+ // CK1: [[BC_PRIVS_PTRS:%.+]] = bitcast [1 x i8*]* [[PRIVS_PTRS]] to i8*
+ // CK1: [[BC_PTRS:%.+]] = bitcast i8** [[GEPP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_PTRS]], i8* [[BC_PTRS]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_SIZES:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 2
+ // CK1: [[BC_PRIVS_SIZES:%.+]] = bitcast [1 x i[[sz]]]* [[PRIVS_SIZES]] to i8*
+ // CK1: [[BC_SIZES:%.+]] = bitcast i[[sz]]* [[GEPS0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_SIZES]], i8* [[BC_SIZES]], i[[sz]] {{8|4}}, i32 {{8|4}}, i1 false)
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP:%.+]], i[[sz]] 0, i[[sz]] 0
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint float* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] %{{.+}}, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 1
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 2
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 3
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: store i[[sz]] ptrtoint ([100 x double]* @gc to i[[sz]]), i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 800, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 3, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0
+ // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8*
+ // CK1: call void @__kmpc_omp_wait_deps(%ident_t* @{{.+}}, i32 %{{.+}}, i32 4, i8* [[BC]], i32 0, i8* null)
+ // CK1: call void @__kmpc_omp_task_begin_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+ // CK1: = call i32 [[TASK_ENTRY3]](i32 %{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]])
+ // CK1: call void @__kmpc_omp_task_complete_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+ #pragma omp target update from(lb) depend(out: lb, arg, la, gc)
+ {++arg;}
+
+ // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+ {++arg;}
+
+ // Region 04
+ // CK1: [[BP0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BP:%.+]], i32 0, i32 0
+ // CK1: [[BP0_BC:%.+]] = bitcast i8** [[BP0]] to %struct.ST**
+ // CK1: store %struct.ST* @gb, %struct.ST** [[BP0_BC]],
+ // CK1: [[P0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[P:%.+]], i32 0, i32 0
+ // CK1: [[P0_BC:%.+]] = bitcast i8** [[P0]] to double***
+ // CK1: store double** getelementptr inbounds (%struct.ST, %struct.ST* @gb, i32 0, i32 1), double*** [[P0_BC]],
+ // CK1: [[BP1:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BP]], i32 0, i32 1
+ // CK1: [[BP1_BC:%.+]] = bitcast i8** [[BP1]] to double***
+ // CK1: store double** getelementptr inbounds (%struct.ST, %struct.ST* @gb, i32 0, i32 1), double*** [[BP1_BC]],
+ // CK1: [[P1:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[P]], i32 0, i32 1
+ // CK1: [[P1_BC:%.+]] = bitcast i8** [[P1]] to double**
+ // CK1: store double* %{{.+}}, double** [[P1_BC]],
+ // CK1: [[GEPBP0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BP]], i32 0, i32 0
+ // CK1: [[GEPP0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[P]], i32 0, i32 0
+ // CK1: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* {{.+}}, i32 {{.+}}, i32 1, i[[sz]] {{88|44}}, i[[sz]] 1, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates{{.+}}*)* [[TASK_ENTRY4:@.+]] to i32 (i32, i8*)*))
+ // CK1: [[RES_BC:%.+]] = bitcast i8* [[RES]] to %struct.kmp_task_t_with_privates{{.+}}*
+ // CK1: [[TASK_T:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 0
+ // CK1: [[PRIVS:%.+]] = getelementptr inbounds %struct.kmp_task_t_with_privates{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]], i32 0, i32 1
+ // CK1: [[PRIVS_BASEPTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 0
+ // CK1: [[BC_PRIVS_BASEPTRS:%.+]] = bitcast [2 x i8*]* [[PRIVS_BASEPTRS]] to i8*
+ // CK1: [[BC_BASEPTRS:%.+]] = bitcast i8** [[GEPBP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_BASEPTRS]], i8* [[BC_BASEPTRS]], i[[sz]] {{16|8}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_PTRS:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 1
+ // CK1: [[BC_PRIVS_PTRS:%.+]] = bitcast [2 x i8*]* [[PRIVS_PTRS]] to i8*
+ // CK1: [[BC_PTRS:%.+]] = bitcast i8** [[GEPP0]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_PTRS]], i8* [[BC_PTRS]], i[[sz]] {{16|8}}, i32 {{8|4}}, i1 false)
+ // CK1: [[PRIVS_SIZES:%.+]] = getelementptr inbounds %struct..kmp_privates.t{{.+}}, %struct..kmp_privates.t{{.+}}* [[PRIVS]], i32 0, i32 2
+ // CK1: [[BC_PRIVS_SIZES:%.+]] = bitcast [2 x i[[sz]]]* [[PRIVS_SIZES]] to i8*
+ // CK1: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* [[BC_PRIVS_SIZES]], i8* bitcast ([2 x i[[sz]]]* [[SIZE04]] to i8*), i[[sz]] {{16|8}}, i32 {{8|4}}, i1 false)
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP:%.+]], i[[sz]] 0, i[[sz]] 0
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint double* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] %{{.+}}, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 1
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 2
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint float* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] %{{.+}}, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 3
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: store i[[sz]] ptrtoint ([100 x double]* @gc to i[[sz]]), i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 800, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 4
+ // CK1: [[DEP_ADR:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 0
+ // CK1: [[BC_ADR:%.+]] = ptrtoint i32* %{{.+}} to i[[sz]]
+ // CK1: store i[[sz]] [[BC_ADR]], i[[sz]]* [[DEP_ADR]],
+ // CK1: [[DEP_SIZE:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 1
+ // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]],
+ // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2
+ // CK1: store i8 1, i8* [[DEP_ATTRS]]
+ // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0
+ // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8*
+ // CK1: call void @__kmpc_omp_wait_deps(%ident_t* @{{.+}}, i32 %{{.+}}, i32 5, i8* [[BC]], i32 0, i8* null)
+ // CK1: call void @__kmpc_omp_task_begin_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+ // CK1: = call i32 [[TASK_ENTRY4]](i32 %{{.+}}, %struct.kmp_task_t_with_privates{{.+}}* [[RES_BC]])
+ // CK1: call void @__kmpc_omp_task_complete_if0(%ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]])
+ #pragma omp target update to(gb.b[:3]) depend(in: gb.b[:3], la, lb, gc, arg)
+ {++arg;}
+}
+
+// CK1: define internal{{.*}} i32 [[TASK_ENTRY0]](i32{{.*}}, %struct.kmp_task_t_with_privates* noalias)
+// CK1-DAG: call void @__tgt_target_data_update_nowait(i64 [[DEV:%[^,]+]], i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
+// CK1-DAG: [[DEV]] = sext i32 [[DEVi32:%[^,]+]] to i64
+// CK1-DAG: [[DEVi32]] = load i32, i32* %{{[^,]+}},
+// CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+// CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+// CK1-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
+// CK1-DAG: [[BP]] = load [1 x i8*]*, [1 x i8*]** [[BP_PRIV:%.+]],
+// CK1-DAG: [[P]] = load [1 x i8*]*, [1 x i8*]** [[P_PRIV:%.+]],
+// CK1-DAG: [[S]] = load [1 x i[[sz]]]*, [1 x i[[sz]]]** [[S_PRIV:%.+]],
+// CK1-DAG: call void (i8*, ...) %{{.+}}(i8* %{{[^,]+}}, [1 x i8*]** [[BP_PRIV]], [1 x i8*]** [[P_PRIV]], [1 x i[[sz]]]** [[S_PRIV]])
+// CK1: ret i32 0
+// CK1: }
+
+// CK1: define internal{{.*}} i32 [[TASK_ENTRY2]](i32{{.*}}, %struct.kmp_task_t_with_privates{{.+}}* noalias)
+// CK1-DAG: call void @__tgt_target_data_update(i64 4, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
+// CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+// CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+// CK1-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
+// CK1-DAG: [[BP]] = load [1 x i8*]*, [1 x i8*]** [[BP_PRIV:%.+]],
+// CK1-DAG: [[P]] = load [1 x i8*]*, [1 x i8*]** [[P_PRIV:%.+]],
+// CK1-DAG: [[S]] = load [1 x i[[sz]]]*, [1 x i[[sz]]]** [[S_PRIV:%.+]],
+// CK1-DAG: call void (i8*, ...) %{{.+}}(i8* %{{[^,]+}}, [1 x i8*]** [[BP_PRIV]], [1 x i8*]** [[P_PRIV]], [1 x i[[sz]]]** [[S_PRIV]])
+// CK1: ret i32 0
+// CK1: }
+
+// CK1: define internal{{.*}} i32 [[TASK_ENTRY3]](i32{{.*}}, %struct.kmp_task_t_with_privates{{.+}}* noalias)
+// CK1-DAG: call void @__tgt_target_data_update(i64 -1, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
+// CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+// CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+// CK1-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
+
+// CK1-DAG: [[BP]] = load [1 x i8*]*, [1 x i8*]** [[BP_PRIV:%.+]],
+// CK1-DAG: [[P]] = load [1 x i8*]*, [1 x i8*]** [[P_PRIV:%.+]],
+// CK1-DAG: [[S]] = load [1 x i[[sz]]]*, [1 x i[[sz]]]** [[S_PRIV:%.+]],
+// CK1-DAG: call void (i8*, ...) %{{.+}}(i8* %{{[^,]+}}, [1 x i8*]** [[BP_PRIV]], [1 x i8*]** [[P_PRIV]], [1 x i[[sz]]]** [[S_PRIV]])
+// CK1-NOT: __tgt_target_data_end
+// CK1: ret i32 0
+// CK1: }
+
+// CK1: define internal{{.*}} i32 [[TASK_ENTRY4]](i32{{.*}}, %struct.kmp_task_t_with_privates{{.+}}* noalias)
+// CK1-DAG: call void @__tgt_target_data_update(i64 -1, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE04]]{{.+}})
+// CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+// CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+// CK1-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
+
+// CK1-DAG: [[BP]] = load [2 x i8*]*, [2 x i8*]** [[BP_PRIV:%.+]],
+// CK1-DAG: [[P]] = load [2 x i8*]*, [2 x i8*]** [[P_PRIV:%.+]],
+// CK1-DAG: [[S]] = load [2 x i[[sz]]]*, [2 x i[[sz]]]** [[S_PRIV:%.+]],
+// CK1-DAG: call void (i8*, ...) %{{.+}}(i8* %{{[^,]+}}, [2 x i8*]** [[BP_PRIV]], [2 x i8*]** [[P_PRIV]], [2 x i[[sz]]]** [[S_PRIV]])
+// CK1-NOT: __tgt_target_data_end
+// CK1: ret i32 0
+// CK1: }
+
+#endif
diff --git a/test/OpenMP/teams_distribute_parallel_for_num_threads_codegen.cpp b/test/OpenMP/teams_distribute_parallel_for_num_threads_codegen.cpp
index 304cc8b3f4aa3..5aed5b172af6a 100644
--- a/test/OpenMP/teams_distribute_parallel_for_num_threads_codegen.cpp
+++ b/test/OpenMP/teams_distribute_parallel_for_num_threads_codegen.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-ibm-linux-gnu -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-ibm-linux-gnu -fexceptions -fcxx-exceptions -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-ibm-linux-gnu -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
// expected-no-diagnostics
#ifndef HEADER
#define HEADER
diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_num_threads_codegen.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_num_threads_codegen.cpp
index 2576241725caa..aa7b9331da12c 100644
--- a/test/OpenMP/teams_distribute_parallel_for_simd_num_threads_codegen.cpp
+++ b/test/OpenMP/teams_distribute_parallel_for_simd_num_threads_codegen.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-ibm-linux-gnu -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-ibm-linux-gnu -fexceptions -fcxx-exceptions -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-ibm-linux-gnu -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
// expected-no-diagnostics
#ifndef HEADER
#define HEADER
diff --git a/test/Parser/c2x-attributes.c b/test/Parser/c2x-attributes.c
index 1be69f1ca28cd..f261dee200a76 100644
--- a/test/Parser/c2x-attributes.c
+++ b/test/Parser/c2x-attributes.c
@@ -7,7 +7,7 @@ enum [[]] E {
};
enum [[]] { Four };
-[[]] enum E2 { Five }; // expected-error {{an attribute list cannot appear here}}
+[[]] enum E2 { Five }; // expected-error {{misplaced attributes}}
// FIXME: this diagnostic can be improved.
enum { [[]] Six }; // expected-error {{expected identifier}}
@@ -24,7 +24,7 @@ struct [[]] S1 {
int o [[]] : 12;
};
-[[]] struct S2 { int a; }; // expected-error {{an attribute list cannot appear here}}
+[[]] struct S2 { int a; }; // expected-error {{misplaced attributes}}
struct S3 [[]] { int a; }; // expected-error {{an attribute list cannot appear here}}
union [[]] U {
@@ -32,7 +32,7 @@ union [[]] U {
[[]] int i;
};
-[[]] union U2 { double d; }; // expected-error {{an attribute list cannot appear here}}
+[[]] union U2 { double d; }; // expected-error {{misplaced attributes}}
union U3 [[]] { double d; }; // expected-error {{an attribute list cannot appear here}}
struct [[]] IncompleteStruct;
diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp
index 58ad08079c1da..1a24520b8f550 100644
--- a/test/Parser/cxx-decl.cpp
+++ b/test/Parser/cxx-decl.cpp
@@ -199,7 +199,7 @@ namespace PR15017 {
// expected-error@-2 {{expected expression}}
// expected-error@-3 {{expected unqualified-id}}
#else
-// expected-error@-5 {{an attribute list cannot appear here}}
+// expected-error@-5 {{misplaced attributes}}
#endif
namespace test7 {
diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp
index 4e3a2e4685e62..e01491db41339 100644
--- a/test/Parser/cxx0x-attributes.cpp
+++ b/test/Parser/cxx0x-attributes.cpp
@@ -64,6 +64,13 @@ struct MemberFnOrder {
struct [[]] struct_attr;
class [[]] class_attr {};
union [[]] union_attr;
+enum [[]] E { };
+namespace test_misplacement {
+[[]] struct struct_attr2; //expected-error{{misplaced attributes}}
+[[]] class class_attr2; //expected-error{{misplaced attributes}}
+[[]] union union_attr2; //expected-error{{misplaced attributes}}
+[[]] enum E2 { }; //expected-error{{misplaced attributes}}
+}
// Checks attributes placed at wrong syntactic locations of class specifiers.
class [[]] [[]]
@@ -91,7 +98,7 @@ class C final [[deprecated(l]] {}); // expected-error {{use of undeclared identi
class D final alignas ([l) {}]{}); // expected-error {{expected ',' or ']' in lambda capture list}} expected-error {{an attribute list cannot appear here}}
[[]] struct with_init_declarators {} init_declarator;
-[[]] struct no_init_declarators; // expected-error {{an attribute list cannot appear here}}
+[[]] struct no_init_declarators; // expected-error {{misplaced attributes}}
template<typename> [[]] struct no_init_declarators_template; // expected-error {{an attribute list cannot appear here}}
void fn_with_structs() {
[[]] struct with_init_declarators {} init_declarator;
diff --git a/test/Preprocessor/arm-acle-6.4.c b/test/Preprocessor/arm-acle-6.4.c
index 3102bd48cabc1..9e4253a3596c5 100644
--- a/test/Preprocessor/arm-acle-6.4.c
+++ b/test/Preprocessor/arm-acle-6.4.c
@@ -91,7 +91,7 @@
// RUN: %clang -target arm-none-linux-eabi -march=armv6k -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-V6K
-// CHECK-V6K: __ARM_FEATURE_LDREX 0xF
+// CHECK-V6K: __ARM_FEATURE_LDREX 0xf
// RUN: %clang -target arm-none-linux-eabi -march=armv7-a -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-V7A
@@ -101,7 +101,7 @@
// CHECK-V7A: __ARM_ARCH_PROFILE 'A'
// CHECK-V7A: __ARM_FEATURE_CLZ 1
// CHECK-V7A: __ARM_FEATURE_DSP 1
-// CHECK-V7A: __ARM_FEATURE_LDREX 0xF
+// CHECK-V7A: __ARM_FEATURE_LDREX 0xf
// CHECK-V7A: __ARM_FEATURE_QBIT 1
// CHECK-V7A: __ARM_FEATURE_SAT 1
// CHECK-V7A: __ARM_FEATURE_SIMD32 1
@@ -129,7 +129,7 @@
// CHECK-V7VE: __ARM_FEATURE_CLZ 1
// CHECK-V7VE: __ARM_FEATURE_DSP 1
// CHECK-V7VE: __ARM_FEATURE_IDIV 1
-// CHECK-V7VE: __ARM_FEATURE_LDREX 0xF
+// CHECK-V7VE: __ARM_FEATURE_LDREX 0xf
// CHECK-V7VE: __ARM_FEATURE_QBIT 1
// CHECK-V7VE: __ARM_FEATURE_SAT 1
// CHECK-V7VE: __ARM_FEATURE_SIMD32 1
@@ -143,7 +143,7 @@
// CHECK-V7R: __ARM_ARCH_PROFILE 'R'
// CHECK-V7R: __ARM_FEATURE_CLZ 1
// CHECK-V7R: __ARM_FEATURE_DSP 1
-// CHECK-V7R: __ARM_FEATURE_LDREX 0xF
+// CHECK-V7R: __ARM_FEATURE_LDREX 0xf
// CHECK-V7R: __ARM_FEATURE_QBIT 1
// CHECK-V7R: __ARM_FEATURE_SAT 1
// CHECK-V7R: __ARM_FEATURE_SIMD32 1
@@ -188,7 +188,7 @@
// CHECK-V8A: __ARM_FEATURE_CLZ 1
// CHECK-V8A: __ARM_FEATURE_DSP 1
// CHECK-V8A: __ARM_FEATURE_IDIV 1
-// CHECK-V8A: __ARM_FEATURE_LDREX 0xF
+// CHECK-V8A: __ARM_FEATURE_LDREX 0xf
// CHECK-V8A: __ARM_FEATURE_QBIT 1
// CHECK-V8A: __ARM_FEATURE_SAT 1
// CHECK-V8A: __ARM_FEATURE_SIMD32 1
diff --git a/test/Preprocessor/arm-acle-6.5.c b/test/Preprocessor/arm-acle-6.5.c
index 7ad91bd7fc854..143ed75bed8db 100644
--- a/test/Preprocessor/arm-acle-6.5.c
+++ b/test/Preprocessor/arm-acle-6.5.c
@@ -26,7 +26,7 @@
// RUN: %clang -target armv7a-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP
// RUN: %clang -target armv7ve-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP
-// CHECK-SP-DP: __ARM_FP 0xC
+// CHECK-SP-DP: __ARM_FP 0xc
// RUN: %clang -target arm-eabi -mfpu=vfpv3-fp16 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP-HP
// RUN: %clang -target arm-eabi -mfpu=vfpv3-d16-fp16 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP-HP
@@ -40,7 +40,7 @@
// RUN: %clang -target arm-eabi -mfpu=crypto-neon-fp-armv8 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP-HP
// RUN: %clang -target armv8-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP-HP
-// CHECK-SP-DP-HP: __ARM_FP 0xE
+// CHECK-SP-DP-HP: __ARM_FP 0xe
// RUN: %clang -target armv4-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-NO-FMA
// RUN: %clang -target armv5-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-NO-FMA
diff --git a/test/Preprocessor/arm-target-features.c b/test/Preprocessor/arm-target-features.c
index 0067e108d338a..43c9c7c65ff58 100644
--- a/test/Preprocessor/arm-target-features.c
+++ b/test/Preprocessor/arm-target-features.c
@@ -5,7 +5,7 @@
// CHECK-V8A: #define __ARM_FEATURE_CRC32 1
// CHECK-V8A: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
// CHECK-V8A: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
-// CHECK-V8A: #define __ARM_FP 0xE
+// CHECK-V8A: #define __ARM_FP 0xe
// CHECK-V8A: #define __ARM_FP16_ARGS 1
// CHECK-V8A: #define __ARM_FP16_FORMAT_IEEE 1
@@ -16,7 +16,7 @@
// CHECK-V8R: #define __ARM_FEATURE_CRC32 1
// CHECK-V8R: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
// CHECK-V8R: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
-// CHECK-V8R: #define __ARM_FP 0xE
+// CHECK-V8R: #define __ARM_FP 0xe
// RUN: %clang -target armv7a-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7 %s
// CHECK-V7: #define __ARMEL__ 1
@@ -25,14 +25,14 @@
// CHECK-V7-NOT: __ARM_FEATURE_CRC32
// CHECK-V7-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
// CHECK-V7-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
-// CHECK-V7: #define __ARM_FP 0xC
+// CHECK-V7: #define __ARM_FP 0xc
// RUN: %clang -target armv7ve-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7VE %s
// CHECK-V7VE: #define __ARMEL__ 1
// CHECK-V7VE: #define __ARM_ARCH 7
// CHECK-V7VE: #define __ARM_ARCH_7VE__ 1
// CHECK-V7VE: #define __ARM_ARCH_EXT_IDIV__ 1
-// CHECK-V7VE: #define __ARM_FP 0xC
+// CHECK-V7VE: #define __ARM_FP 0xc
// RUN: %clang -target x86_64-apple-macosx10.10 -arch armv7s -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7S %s
// CHECK-V7S: #define __ARMEL__ 1
@@ -41,7 +41,7 @@
// CHECK-V7S-NOT: __ARM_FEATURE_CRC32
// CHECK-V7S-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
// CHECK-V7S-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
-// CHECK-V7S: #define __ARM_FP 0xE
+// CHECK-V7S: #define __ARM_FP 0xe
// RUN: %clang -target armv8a -mfloat-abi=hard -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-V8-BAREHF %s
// CHECK-V8-BAREHF: #define __ARMEL__ 1
@@ -50,19 +50,19 @@
// CHECK-V8-BAREHF: #define __ARM_FEATURE_CRC32 1
// CHECK-V8-BAREHF: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
// CHECK-V8-BAREHF: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
-// CHECK-V8-BAREHP: #define __ARM_FP 0xE
+// CHECK-V8-BAREHP: #define __ARM_FP 0xe
// CHECK-V8-BAREHF: #define __ARM_NEON__ 1
// CHECK-V8-BAREHF: #define __ARM_PCS_VFP 1
// CHECK-V8-BAREHF: #define __VFP_FP__ 1
// RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=fp-armv8 -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-V8-BAREHF-FP %s
// CHECK-V8-BAREHF-FP-NOT: __ARM_NEON__ 1
-// CHECK-V8-BAREHP-FP: #define __ARM_FP 0xE
+// CHECK-V8-BAREHP-FP: #define __ARM_FP 0xe
// CHECK-V8-BAREHF-FP: #define __VFP_FP__ 1
// RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=neon-fp-armv8 -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-V8-BAREHF-NEON-FP %s
// RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=crypto-neon-fp-armv8 -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-V8-BAREHF-NEON-FP %s
-// CHECK-V8-BAREHP-NEON-FP: #define __ARM_FP 0xE
+// CHECK-V8-BAREHP-NEON-FP: #define __ARM_FP 0xe
// CHECK-V8-BAREHF-NEON-FP: #define __ARM_NEON__ 1
// CHECK-V8-BAREHF-NEON-FP: #define __VFP_FP__ 1
@@ -88,7 +88,7 @@
// RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A %s
// RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A %s
// V8A:#define __ARM_ARCH_EXT_IDIV__ 1
-// V8A:#define __ARM_FP 0xE
+// V8A:#define __ARM_FP 0xe
// RUN: %clang -target armv8m.base-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_BASELINE %s
// V8M_BASELINE: #define __ARM_ARCH 8
@@ -111,7 +111,7 @@
// V8M_MAINLINE: #define __ARM_ARCH_PROFILE 'M'
// V8M_MAINLINE-NOT: __ARM_FEATURE_CRC32
// V8M_MAINLINE-NOT: __ARM_FEATURE_DSP
-// V8M_MAINLINE: #define __ARM_FP 0xE
+// V8M_MAINLINE: #define __ARM_FP 0xe
// V8M_MAINLINE: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
// RUN: %clang -target arm-none-linux-gnu -march=armv8-m.main+dsp -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_MAINLINE_DSP %s
@@ -123,7 +123,7 @@
// V8M_MAINLINE_DSP: #define __ARM_ARCH_PROFILE 'M'
// V8M_MAINLINE_DSP-NOT: __ARM_FEATURE_CRC32
// V8M_MAINLINE_DSP: #define __ARM_FEATURE_DSP 1
-// V8M_MAINLINE_DSP: #define __ARM_FP 0xE
+// V8M_MAINLINE_DSP: #define __ARM_FP 0xe
// V8M_MAINLINE_DSP: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
// RUN: %clang -target arm-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-DEFS %s
@@ -161,7 +161,7 @@
// Check that -mfpu works properly for Cortex-A7 (enabled by default).
// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A7 %s
// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A7 %s
-// DEFAULTFPU-A7:#define __ARM_FP 0xE
+// DEFAULTFPU-A7:#define __ARM_FP 0xe
// DEFAULTFPU-A7:#define __ARM_NEON__ 1
// DEFAULTFPU-A7:#define __ARM_VFPV4__ 1
@@ -173,14 +173,14 @@
// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a7 -mfpu=vfp4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NONEON-A7 %s
// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a7 -mfpu=vfp4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NONEON-A7 %s
-// NONEON-A7:#define __ARM_FP 0xE
+// NONEON-A7:#define __ARM_FP 0xe
// NONEON-A7-NOT:#define __ARM_NEON__ 1
// NONEON-A7:#define __ARM_VFPV4__ 1
// Check that -mfpu works properly for Cortex-A5 (enabled by default).
// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A5 %s
// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A5 %s
-// DEFAULTFPU-A5:#define __ARM_FP 0xE
+// DEFAULTFPU-A5:#define __ARM_FP 0xe
// DEFAULTFPU-A5:#define __ARM_NEON__ 1
// DEFAULTFPU-A5:#define __ARM_VFPV4__ 1
@@ -192,7 +192,7 @@
// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a5 -mfpu=vfp4-d16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NONEON-A5 %s
// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a5 -mfpu=vfp4-d16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NONEON-A5 %s
-// NONEON-A5:#define __ARM_FP 0xE
+// NONEON-A5:#define __ARM_FP 0xe
// NONEON-A5-NOT:#define __ARM_NEON__ 1
// NONEON-A5:#define __ARM_VFPV4__ 1
@@ -218,7 +218,7 @@
// A5-NOT: #define __ARM_FEATURE_DIRECTED_ROUNDING
// A5:#define __ARM_FEATURE_DSP 1
// A5-NOT: #define __ARM_FEATURE_NUMERIC_MAXMIN
-// A5:#define __ARM_FP 0xE
+// A5:#define __ARM_FP 0xe
// Test whether predefines are as expected when targeting cortex-a7.
// RUN: %clang -target armv7k -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7 %s
@@ -228,7 +228,7 @@
// A7:#define __ARM_ARCH_PROFILE 'A'
// A7-NOT:#define __ARM_DWARF_EH__ 1
// A7:#define __ARM_FEATURE_DSP 1
-// A7:#define __ARM_FP 0xE
+// A7:#define __ARM_FP 0xe
// Test whether predefines are as expected when targeting cortex-a7.
// RUN: %clang -target x86_64-apple-darwin -arch armv7k -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV7K %s
@@ -237,7 +237,7 @@
// ARMV7K:#define __ARM_ARCH_PROFILE 'A'
// ARMV7K:#define __ARM_DWARF_EH__ 1
// ARMV7K:#define __ARM_FEATURE_DSP 1
-// ARMV7K:#define __ARM_FP 0xE
+// ARMV7K:#define __ARM_FP 0xe
// ARMV7K:#define __ARM_PCS_VFP 1
@@ -246,20 +246,20 @@
// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8 %s
// A8-NOT:#define __ARM_ARCH_EXT_IDIV__
// A8:#define __ARM_FEATURE_DSP 1
-// A8:#define __ARM_FP 0xC
+// A8:#define __ARM_FP 0xc
// Test whether predefines are as expected when targeting cortex-a9.
// RUN: %clang -target armv7 -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9 %s
// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9 %s
// A9-NOT:#define __ARM_ARCH_EXT_IDIV__
// A9:#define __ARM_FEATURE_DSP 1
-// A9:#define __ARM_FP 0xE
+// A9:#define __ARM_FP 0xe
// Check that -mfpu works properly for Cortex-A12 (enabled by default).
// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A12 %s
// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A12 %s
-// DEFAULTFPU-A12:#define __ARM_FP 0xE
+// DEFAULTFPU-A12:#define __ARM_FP 0xe
// DEFAULTFPU-A12:#define __ARM_NEON__ 1
// DEFAULTFPU-A12:#define __ARM_VFPV4__ 1
@@ -277,19 +277,19 @@
// A12:#define __ARM_ARCH_EXT_IDIV__ 1
// A12:#define __ARM_ARCH_PROFILE 'A'
// A12:#define __ARM_FEATURE_DSP 1
-// A12:#define __ARM_FP 0xE
+// A12:#define __ARM_FP 0xe
// Test whether predefines are as expected when targeting cortex-a15.
// RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15 %s
// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15 %s
// A15:#define __ARM_ARCH_EXT_IDIV__ 1
// A15:#define __ARM_FEATURE_DSP 1
-// A15:#define __ARM_FP 0xE
+// A15:#define __ARM_FP 0xe
// Check that -mfpu works properly for Cortex-A17 (enabled by default).
// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A17 %s
// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A17 %s
-// DEFAULTFPU-A17:#define __ARM_FP 0xE
+// DEFAULTFPU-A17:#define __ARM_FP 0xe
// DEFAULTFPU-A17:#define __ARM_NEON__ 1
// DEFAULTFPU-A17:#define __ARM_VFPV4__ 1
@@ -307,14 +307,14 @@
// A17:#define __ARM_ARCH_EXT_IDIV__ 1
// A17:#define __ARM_ARCH_PROFILE 'A'
// A17:#define __ARM_FEATURE_DSP 1
-// A17:#define __ARM_FP 0xE
+// A17:#define __ARM_FP 0xe
// Test whether predefines are as expected when targeting swift.
// RUN: %clang -target armv7s -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT %s
// RUN: %clang -target armv7s -mthumb -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT %s
// SWIFT:#define __ARM_ARCH_EXT_IDIV__ 1
// SWIFT:#define __ARM_FEATURE_DSP 1
-// SWIFT:#define __ARM_FP 0xE
+// SWIFT:#define __ARM_FP 0xe
// Test whether predefines are as expected when targeting ARMv8-A Cortex implementations
// RUN: %clang -target armv8 -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
@@ -331,7 +331,7 @@
// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
// ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1
// ARMV8:#define __ARM_FEATURE_DSP 1
-// ARMV8:#define __ARM_FP 0xE
+// ARMV8:#define __ARM_FP 0xe
// Test whether predefines are as expected when targeting cortex-r4.
// RUN: %clang -target armv7 -mcpu=cortex-r4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4-ARM %s
@@ -348,19 +348,19 @@
// RUN: %clang -target armv7 -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-ARM %s
// R4F-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
// R4F-ARM:#define __ARM_FEATURE_DSP 1
-// R4F-ARM:#define __ARM_FP 0xC
+// R4F-ARM:#define __ARM_FP 0xc
// RUN: %clang -target armv7 -mthumb -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-THUMB %s
// R4F-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
// R4F-THUMB:#define __ARM_FEATURE_DSP 1
-// R4F-THUMB:#define __ARM_FP 0xC
+// R4F-THUMB:#define __ARM_FP 0xc
// Test whether predefines are as expected when targeting cortex-r5.
// RUN: %clang -target armv7 -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5 %s
// RUN: %clang -target armv7 -mthumb -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5 %s
// R5:#define __ARM_ARCH_EXT_IDIV__ 1
// R5:#define __ARM_FEATURE_DSP 1
-// R5:#define __ARM_FP 0xC
+// R5:#define __ARM_FP 0xc
// Test whether predefines are as expected when targeting cortex-r7 and cortex-r8.
// RUN: %clang -target armv7 -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
@@ -369,7 +369,7 @@
// RUN: %clang -target armv7 -mthumb -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
// R7-R8:#define __ARM_ARCH_EXT_IDIV__ 1
// R7-R8:#define __ARM_FEATURE_DSP 1
-// R7-R8:#define __ARM_FP 0xE
+// R7-R8:#define __ARM_FP 0xe
// Test whether predefines are as expected when targeting cortex-m0.
// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m0 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
@@ -397,7 +397,7 @@
// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M7-THUMB %s
// M7-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
// M7-THUMB:#define __ARM_FEATURE_DSP 1
-// M7-THUMB:#define __ARM_FP 0xE
+// M7-THUMB:#define __ARM_FP 0xe
// M7-THUMB:#define __ARM_FPV5__ 1
// Test whether predefines are as expected when targeting v8m cores
@@ -437,11 +437,11 @@
// CHECK-V81A: #define __ARM_ARCH_8_1A__ 1
// CHECK-V81A: #define __ARM_ARCH_PROFILE 'A'
// CHECK-V81A: #define __ARM_FEATURE_QRDMX 1
-// CHECK-V81A: #define __ARM_FP 0xE
+// CHECK-V81A: #define __ARM_FP 0xe
// RUN: %clang -target armv8.2a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V82A %s
// CHECK-V82A: #define __ARM_ARCH 8
// CHECK-V82A: #define __ARM_ARCH_8_2A__ 1
// CHECK-V82A: #define __ARM_ARCH_PROFILE 'A'
// CHECK-V82A: #define __ARM_FEATURE_QRDMX 1
-// CHECK-V82A: #define __ARM_FP 0xE
+// CHECK-V82A: #define __ARM_FP 0xe
diff --git a/test/Preprocessor/predefined-arch-macros.c b/test/Preprocessor/predefined-arch-macros.c
index f370f3e5f0776..dac137c575363 100644
--- a/test/Preprocessor/predefined-arch-macros.c
+++ b/test/Preprocessor/predefined-arch-macros.c
@@ -886,6 +886,7 @@
// CHECK_SKX_M32: #define __MMX__ 1
// CHECK_SKX_M32: #define __MPX__ 1
// CHECK_SKX_M32: #define __PCLMUL__ 1
+// CHECK_SKX_M32: #define __PKU__ 1
// CHECK_SKX_M32: #define __POPCNT__ 1
// CHECK_SKX_M32: #define __PRFCHW__ 1
// CHECK_SKX_M32: #define __RDRND__ 1
@@ -929,6 +930,7 @@
// CHECK_SKX_M64: #define __MMX__ 1
// CHECK_SKX_M64: #define __MPX__ 1
// CHECK_SKX_M64: #define __PCLMUL__ 1
+// CHECK_SKX_M64: #define __PKU__ 1
// CHECK_SKX_M64: #define __POPCNT__ 1
// CHECK_SKX_M64: #define __PRFCHW__ 1
// CHECK_SKX_M64: #define __RDRND__ 1
@@ -970,12 +972,14 @@
// CHECK_CNL_M32: #define __BMI2__ 1
// CHECK_CNL_M32: #define __BMI__ 1
// CHECK_CNL_M32: #define __CLFLUSHOPT__ 1
+// CHECK_CNL_M32-NOT: #define __CLWB__ 1
// CHECK_CNL_M32: #define __F16C__ 1
// CHECK_CNL_M32: #define __FMA__ 1
// CHECK_CNL_M32: #define __LZCNT__ 1
// CHECK_CNL_M32: #define __MMX__ 1
// CHECK_CNL_M32: #define __MPX__ 1
// CHECK_CNL_M32: #define __PCLMUL__ 1
+// CHECK_CNL_M32-NOT: #define __PKU__ 1
// CHECK_CNL_M32: #define __POPCNT__ 1
// CHECK_CNL_M32: #define __PRFCHW__ 1
// CHECK_CNL_M32: #define __RDRND__ 1
@@ -1015,12 +1019,14 @@
// CHECK_CNL_M64: #define __BMI2__ 1
// CHECK_CNL_M64: #define __BMI__ 1
// CHECK_CNL_M64: #define __CLFLUSHOPT__ 1
+// CHECK_CNL_M64-NOT: #define __CLWB__ 1
// CHECK_CNL_M64: #define __F16C__ 1
// CHECK_CNL_M64: #define __FMA__ 1
// CHECK_CNL_M64: #define __LZCNT__ 1
// CHECK_CNL_M64: #define __MMX__ 1
// CHECK_CNL_M64: #define __MPX__ 1
// CHECK_CNL_M64: #define __PCLMUL__ 1
+// CHECK_CNL_M64-NOT: #define __PKU__ 1
// CHECK_CNL_M64: #define __POPCNT__ 1
// CHECK_CNL_M64: #define __PRFCHW__ 1
// CHECK_CNL_M64: #define __RDRND__ 1
@@ -1050,23 +1056,30 @@
// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_ICL_M32
// CHECK_ICL_M32: #define __AES__ 1
// CHECK_ICL_M32: #define __AVX2__ 1
+// CHECK_ICL_M32: #define __AVX512BITALG__ 1
// CHECK_ICL_M32: #define __AVX512BW__ 1
// CHECK_ICL_M32: #define __AVX512CD__ 1
// CHECK_ICL_M32: #define __AVX512DQ__ 1
// CHECK_ICL_M32: #define __AVX512F__ 1
// CHECK_ICL_M32: #define __AVX512IFMA__ 1
+// CHECK_ICL_M32: #define __AVX512VBMI2__ 1
// CHECK_ICL_M32: #define __AVX512VBMI__ 1
// CHECK_ICL_M32: #define __AVX512VL__ 1
+// CHECK_ICL_M32: #define __AVX512VNNI__ 1
+// CHECK_ICL_M32: #define __AVX512VPOPCNTDQ__ 1
// CHECK_ICL_M32: #define __AVX__ 1
// CHECK_ICL_M32: #define __BMI2__ 1
// CHECK_ICL_M32: #define __BMI__ 1
// CHECK_ICL_M32: #define __CLFLUSHOPT__ 1
+// CHECK_ICL_M32: #define __CLWB__ 1
// CHECK_ICL_M32: #define __F16C__ 1
// CHECK_ICL_M32: #define __FMA__ 1
+// CHECK_ICL_M32: #define __GFNI__ 1
// CHECK_ICL_M32: #define __LZCNT__ 1
// CHECK_ICL_M32: #define __MMX__ 1
// CHECK_ICL_M32: #define __MPX__ 1
// CHECK_ICL_M32: #define __PCLMUL__ 1
+// CHECK_ICL_M32-NOT: #define __PKU__ 1
// CHECK_ICL_M32: #define __POPCNT__ 1
// CHECK_ICL_M32: #define __PRFCHW__ 1
// CHECK_ICL_M32: #define __RDRND__ 1
@@ -1079,6 +1092,8 @@
// CHECK_ICL_M32: #define __SSE4_2__ 1
// CHECK_ICL_M32: #define __SSE__ 1
// CHECK_ICL_M32: #define __SSSE3__ 1
+// CHECK_ICL_M32: #define __VAES__ 1
+// CHECK_ICL_M32: #define __VPCLMULQDQ__ 1
// CHECK_ICL_M32: #define __XSAVEC__ 1
// CHECK_ICL_M32: #define __XSAVEOPT__ 1
// CHECK_ICL_M32: #define __XSAVES__ 1
@@ -1095,23 +1110,30 @@
// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_ICL_M64
// CHECK_ICL_M64: #define __AES__ 1
// CHECK_ICL_M64: #define __AVX2__ 1
+// CHECK_ICL_M64: #define __AVX512BITALG__ 1
// CHECK_ICL_M64: #define __AVX512BW__ 1
// CHECK_ICL_M64: #define __AVX512CD__ 1
// CHECK_ICL_M64: #define __AVX512DQ__ 1
// CHECK_ICL_M64: #define __AVX512F__ 1
// CHECK_ICL_M64: #define __AVX512IFMA__ 1
+// CHECK_ICL_M64: #define __AVX512VBMI2__ 1
// CHECK_ICL_M64: #define __AVX512VBMI__ 1
// CHECK_ICL_M64: #define __AVX512VL__ 1
+// CHECK_ICL_M64: #define __AVX512VNNI__ 1
+// CHECK_ICL_M64: #define __AVX512VPOPCNTDQ__ 1
// CHECK_ICL_M64: #define __AVX__ 1
// CHECK_ICL_M64: #define __BMI2__ 1
// CHECK_ICL_M64: #define __BMI__ 1
// CHECK_ICL_M64: #define __CLFLUSHOPT__ 1
+// CHECK_ICL_M64: #define __CLWB__ 1
// CHECK_ICL_M64: #define __F16C__ 1
// CHECK_ICL_M64: #define __FMA__ 1
+// CHECK_ICL_M64: #define __GFNI__ 1
// CHECK_ICL_M64: #define __LZCNT__ 1
// CHECK_ICL_M64: #define __MMX__ 1
// CHECK_ICL_M64: #define __MPX__ 1
// CHECK_ICL_M64: #define __PCLMUL__ 1
+// CHECK_ICL_M64-NOT: #define __PKU__ 1
// CHECK_ICL_M64: #define __POPCNT__ 1
// CHECK_ICL_M64: #define __PRFCHW__ 1
// CHECK_ICL_M64: #define __RDRND__ 1
@@ -1124,6 +1146,8 @@
// CHECK_ICL_M64: #define __SSE4_2__ 1
// CHECK_ICL_M64: #define __SSE__ 1
// CHECK_ICL_M64: #define __SSSE3__ 1
+// CHECK_ICL_M64: #define __VAES__ 1
+// CHECK_ICL_M64: #define __VPCLMULQDQ__ 1
// CHECK_ICL_M64: #define __XSAVEC__ 1
// CHECK_ICL_M64: #define __XSAVEOPT__ 1
// CHECK_ICL_M64: #define __XSAVES__ 1
diff --git a/test/Preprocessor/x86_target_features.c b/test/Preprocessor/x86_target_features.c
index e2d0e39a03f8d..542328aca047f 100644
--- a/test/Preprocessor/x86_target_features.c
+++ b/test/Preprocessor/x86_target_features.c
@@ -209,11 +209,54 @@
// AVX512VBMI: #define __SSE__ 1
// AVX512VBMI: #define __SSSE3__ 1
+// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512bitalg -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512BITALG %s
+
+// AVX512BITALG: #define __AVX2__ 1
+// AVX512BITALG: #define __AVX512BITALG__ 1
+// AVX512BITALG: #define __AVX512BW__ 1
+// AVX512BITALG: #define __AVX512F__ 1
+// AVX512BITALG: #define __AVX__ 1
+// AVX512BITALG: #define __SSE2_MATH__ 1
+// AVX512BITALG: #define __SSE2__ 1
+// AVX512BITALG: #define __SSE3__ 1
+// AVX512BITALG: #define __SSE4_1__ 1
+// AVX512BITALG: #define __SSE4_2__ 1
+// AVX512BITALG: #define __SSE_MATH__ 1
+// AVX512BITALG: #define __SSE__ 1
+// AVX512BITALG: #define __SSSE3__ 1
+
+
// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512vbmi -mno-avx512bw -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512VBMINOAVX512BW %s
// AVX512VBMINOAVX512BW-NOT: #define __AVX512BW__ 1
// AVX512VBMINOAVX512BW-NOT: #define __AVX512VBMI__ 1
+// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512vbmi2 -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512VBMI2 %s
+
+// AVX512VBMI2: #define __AVX2__ 1
+// AVX512VBMI2: #define __AVX512BW__ 1
+// AVX512VBMI2: #define __AVX512F__ 1
+// AVX512VBMI2: #define __AVX512VBMI2__ 1
+// AVX512VBMI2: #define __AVX__ 1
+// AVX512VBMI2: #define __SSE2_MATH__ 1
+// AVX512VBMI2: #define __SSE2__ 1
+// AVX512VBMI2: #define __SSE3__ 1
+// AVX512VBMI2: #define __SSE4_1__ 1
+// AVX512VBMI2: #define __SSE4_2__ 1
+// AVX512VBMI2: #define __SSE_MATH__ 1
+// AVX512VBMI2: #define __SSE__ 1
+// AVX512VBMI2: #define __SSSE3__ 1
+
+// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512vbmi2 -mno-avx512bw -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512VBMI2NOAVX512BW %s
+
+// AVX512VBMI2NOAVX512BW-NOT: #define __AVX512BW__ 1
+// AVX512VBMI2NOAVX512BW-NOT: #define __AVX512VBMI2__ 1
+
+// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512bitalg -mno-avx512bw -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512BITALGNOAVX512BW %s
+
+// AVX512BITALGNOAVX512BW-NOT: #define __AVX512BITALG__ 1
+// AVX512BITALGNOAVX512BW-NOT: #define __AVX512BW__ 1
+
// RUN: %clang -target i386-unknown-unknown -march=atom -msse4.2 -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=SSE42POPCNT %s
// SSE42POPCNT: #define __POPCNT__ 1
@@ -368,3 +411,28 @@
// RUN: %clang -target i386-unknown-unknown -march=atom -mclflushopt -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=CLFLUSHOPT %s
// CLFLUSHOPT: #define __CLFLUSHOPT__ 1
+
+// RUN: %clang -target i386-unknown-unknown -march=atom -mvaes -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=VAES %s
+
+// VAES: #define __AES__ 1
+// VAES: #define __VAES__ 1
+
+// RUN: %clang -target i386-unknown-unknown -march=atom -mvaes -mno-aes -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=VAESNOAES %s
+
+// VAESNOAES-NOT: #define __AES__ 1
+// VAESNOAES-NOT: #define __VAES__ 1
+
+// RUN: %clang -target i386-unknown-unknown -march=atom -mgfni -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=GFNI %s
+
+// GFNI: #define __GFNI__ 1
+// GFNI: #define __SSE2__ 1
+
+// RUN: %clang -target i386-unknown-unknown -march=atom -mvpclmulqdq -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=VPCLMULQDQ %s
+
+// VPCLMULQDQ: #define __PCLMUL__ 1
+// VPCLMULQDQ: #define __VPCLMULQDQ__ 1
+
+// RUN: %clang -target i386-unknown-unknown -march=atom -mvpclmulqdq -mno-pclmul -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=VPCLMULQDQNOPCLMUL %s
+// VPCLMULQDQNOPCLMUL-NOT: #define __PCLMUL__ 1
+// VPCLMULQDQNOPCLMUL-NOT: #define __VPCLMULQDQ__ 1
+