1 // RUN: %clang_cc1 -ffreestanding -Wall -pedantic -fno-experimental-new-pass-manager -triple x86_64-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,X86_64
2 // RUN: %clang_cc1 -ffreestanding -Wall -pedantic -fno-experimental-new-pass-manager -triple i386-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK
3 // RUN: %clang_cc1 -ffreestanding -Wall -pedantic -fexperimental-new-pass-manager -triple x86_64-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,X86_64
4 // RUN: %clang_cc1 -ffreestanding -Wall -pedantic -fexperimental-new-pass-manager -triple i386-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK
5 
6 #include <immintrin.h>
7 #include <stdint.h>
8 
test_directstore32(void * dst,uint32_t value)9 void test_directstore32(void *dst, uint32_t value) {
10   // CHECK-LABEL: test_directstore32
11   // CHECK: call void @llvm.x86.directstore32
12   _directstoreu_u32(dst, value);
13 }
14 
15 #ifdef __x86_64__
16 
test_directstore64(void * dst,uint64_t value)17 void test_directstore64(void *dst, uint64_t value) {
18   // X86_64-LABEL: test_directstore64
19   // X86_64: call void @llvm.x86.directstore64
20   _directstoreu_u64(dst, value);
21 }
22 
23 #endif
24 
test_dir64b(void * dst,const void * src)25 void test_dir64b(void *dst, const void *src) {
26   // CHECK-LABEL: test_dir64b
27   // CHECK: call void @llvm.x86.movdir64b
28   _movdir64b(dst, src);
29 }
30 
31 // CHECK: declare void @llvm.x86.directstore32(i8*, i32)
32 // X86_64: declare void @llvm.x86.directstore64(i8*, i64)
33 // CHECK: declare void @llvm.x86.movdir64b(i8*, i8*)
34