• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=i686-pc-windows-msvc | FileCheck %s -check-prefix=X32
2; Control Flow Guard is currently only available on Windows
3
4
5; Test that Control Flow Guard checks are correctly added for x86 vector calls.
6define void @func_cf_vector_x86(void (%struct.HVA)* %0, %struct.HVA* %1) #0 {
7entry:
8  %2 = alloca %struct.HVA, align 8
9  %3 = bitcast %struct.HVA* %2 to i8*
10  %4 = bitcast %struct.HVA* %1 to i8*
11  call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %3, i8* align 8 %4, i32 32, i1 false)
12  %5 = load %struct.HVA, %struct.HVA* %2, align 8
13  call x86_vectorcallcc void %0(%struct.HVA inreg %5)
14  ret void
15
16  ; X32-LABEL: func_cf_vector_x86
17  ; X32: 	     movl 12(%ebp), %eax
18  ; X32: 	     movl 8(%ebp), %ecx
19  ; X32: 	     movsd 24(%eax), %xmm4         # xmm4 = mem[0],zero
20  ; X32: 	     movsd %xmm4, 24(%esp)
21  ; X32: 	     movsd 16(%eax), %xmm5         # xmm5 = mem[0],zero
22  ; X32: 	     movsd %xmm5, 16(%esp)
23  ; X32: 	     movsd (%eax), %xmm6           # xmm6 = mem[0],zero
24  ; X32: 	     movsd 8(%eax), %xmm7          # xmm7 = mem[0],zero
25  ; X32: 	     movsd %xmm7, 8(%esp)
26  ; X32: 	     movsd %xmm6, (%esp)
27  ; X32: 	     calll *___guard_check_icall_fptr
28  ; X32: 	     movaps %xmm6, %xmm0
29  ; X32: 	     movaps %xmm7, %xmm1
30  ; X32: 	     movaps %xmm5, %xmm2
31  ; X32: 	     movaps %xmm4, %xmm3
32  ; X32: 	     calll  *%ecx
33}
34attributes #0 = { "target-cpu"="pentium4" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" }
35
36%struct.HVA = type { double, double, double, double }
37
38declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i1 immarg) #1
39attributes #1 = { argmemonly nounwind willreturn }
40
41
42!llvm.module.flags = !{!0}
43!0 = !{i32 2, !"cfguard", i32 2}
44