1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i386-apple-darwin -disable-cgp-branch-opts | FileCheck %s
4 %struct.DBC_t = type { i32, ptr, i16, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, ptr, i8, i16, ptr, i16 }
5 %struct.DRVOPT = type { i16, i32, i8, ptr }
6 %struct.GENV_t = type { i32, ptr, i16, ptr, ptr, i32, i32, i32, i32, ptr, i16 }
7 %struct.pthread_mutex_t = type { i32, [40 x i8] }
8 @iodbcdm_global_lock = external global %struct.pthread_mutex_t ; <ptr> [#uses=1]
10 define i16 @SQLDriversW(ptr %henv, i16 zeroext %fDir, ptr %szDrvDesc, i16 signext %cbDrvDescMax, ptr %pcbDrvDesc, ptr %szDrvAttr, i16 signext %cbDrvAttrMax, ptr %pcbDrvAttr) nounwind {
11 ; CHECK-LABEL: SQLDriversW:
12 ; CHECK: ## %bb.0: ## %entry
13 ; CHECK-NEXT: pushl %ebp
14 ; CHECK-NEXT: pushl %ebx
15 ; CHECK-NEXT: pushl %edi
16 ; CHECK-NEXT: pushl %esi
17 ; CHECK-NEXT: subl $12, %esp
18 ; CHECK-NEXT: movb $1, %al
19 ; CHECK-NEXT: testb %al, %al
20 ; CHECK-NEXT: je LBB0_1
21 ; CHECK-NEXT: ## %bb.3: ## %bb28
22 ; CHECK-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
23 ; CHECK-NEXT: movzwl {{[0-9]+}}(%esp), %ebx
24 ; CHECK-NEXT: movzwl {{[0-9]+}}(%esp), %ebp
25 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %edi
26 ; CHECK-NEXT: movw $-2, %si
27 ; CHECK-NEXT: jne LBB0_6
28 ; CHECK-NEXT: ## %bb.4: ## %bb37
29 ; CHECK-NEXT: movw $0, 40(%edi)
30 ; CHECK-NEXT: testb %al, %al
31 ; CHECK-NEXT: leal (,%ecx,4), %ecx
32 ; CHECK-NEXT: leal (,%ebx,4), %edx
33 ; CHECK-NEXT: subl $12, %esp
34 ; CHECK-NEXT: movzwl %bp, %eax
35 ; CHECK-NEXT: movswl %cx, %ecx
36 ; CHECK-NEXT: movswl %dx, %edx
37 ; CHECK-NEXT: pushl $87
38 ; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
39 ; CHECK-NEXT: pushl %ecx
40 ; CHECK-NEXT: pushl $0
41 ; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
42 ; CHECK-NEXT: pushl %edx
43 ; CHECK-NEXT: pushl $0
44 ; CHECK-NEXT: pushl %eax
45 ; CHECK-NEXT: pushl %edi
46 ; CHECK-NEXT: calll _SQLDrivers_Internal
47 ; CHECK-NEXT: addl $48, %esp
48 ; CHECK-NEXT: movl %eax, %esi
49 ; CHECK-NEXT: xorl %eax, %eax
50 ; CHECK-NEXT: testb %al, %al
51 ; CHECK-NEXT: je LBB0_1
52 ; CHECK-NEXT: ## %bb.5:
53 ; CHECK-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
54 ; CHECK-NEXT: LBB0_6: ## %done
55 ; CHECK-NEXT: xorl %eax, %eax
56 ; CHECK-NEXT: testb %al, %al
57 ; CHECK-NEXT: je LBB0_7
58 ; CHECK-NEXT: ## %bb.8: ## %bb167
59 ; CHECK-NEXT: subl $12, %esp
60 ; CHECK-NEXT: movl L_iodbcdm_global_lock$non_lazy_ptr, %eax
61 ; CHECK-NEXT: pushl %eax
62 ; CHECK-NEXT: calll _pthread_mutex_unlock
63 ; CHECK-NEXT: addl $16, %esp
64 ; CHECK-NEXT: movl %esi, %eax
65 ; CHECK-NEXT: jmp LBB0_2
66 ; CHECK-NEXT: LBB0_7: ## %bb150
67 ; CHECK-NEXT: movswl %si, %eax
68 ; CHECK-NEXT: subl $8, %esp
69 ; CHECK-NEXT: movswl %cx, %ecx
70 ; CHECK-NEXT: movswl %bx, %edx
71 ; CHECK-NEXT: movzwl %bp, %esi
72 ; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
73 ; CHECK-NEXT: pushl %ecx
74 ; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
75 ; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
76 ; CHECK-NEXT: pushl %edx
77 ; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
78 ; CHECK-NEXT: pushl %esi
79 ; CHECK-NEXT: pushl %edi
80 ; CHECK-NEXT: pushl %eax
81 ; CHECK-NEXT: pushl $1
82 ; CHECK-NEXT: calll _trace_SQLDriversW
83 ; CHECK-NEXT: addl $48, %esp
84 ; CHECK-NEXT: LBB0_1: ## %bb
85 ; CHECK-NEXT: xorl %eax, %eax
86 ; CHECK-NEXT: LBB0_2: ## %bb
87 ; CHECK-NEXT: addl $12, %esp
88 ; CHECK-NEXT: popl %esi
89 ; CHECK-NEXT: popl %edi
90 ; CHECK-NEXT: popl %ebx
91 ; CHECK-NEXT: popl %ebp
94 br i1 true, label %bb28, label %bb
97 bb28: ; preds = %entry
98 br i1 false, label %bb37, label %done
100 %tmp46 = getelementptr %struct.GENV_t, ptr %henv, i32 0, i32 10 ; <ptr> [#uses=1]
101 store i16 0, ptr %tmp46, align 4
102 br i1 false, label %bb74, label %bb92
103 bb74: ; preds = %bb37
105 bb92: ; preds = %bb74, %bb37
106 %tmp95180 = shl i16 %cbDrvAttrMax, 2 ; <i16> [#uses=1]
107 %tmp100178 = shl i16 %cbDrvDescMax, 2 ; <i16> [#uses=1]
108 %tmp113 = tail call i16 @SQLDrivers_Internal( ptr %henv, i16 zeroext %fDir, ptr null, i16 signext %tmp100178, ptr %pcbDrvDesc, ptr null, i16 signext %tmp95180, ptr %pcbDrvAttr, i8 zeroext 87 ) nounwind ; <i16> [#uses=1]
109 br i1 false, label %done, label %bb137
110 bb137: ; preds = %bb92
112 done: ; preds = %bb92, %bb28
113 %retcode.0 = phi i16 [ -2, %bb28 ], [ %tmp113, %bb92 ] ; <i16> [#uses=2]
114 br i1 false, label %bb167, label %bb150
115 bb150: ; preds = %done
116 %tmp157158 = sext i16 %retcode.0 to i32 ; <i32> [#uses=1]
117 tail call void @trace_SQLDriversW( i32 1, i32 %tmp157158, ptr %henv, i16 zeroext %fDir, ptr %szDrvDesc, i16 signext %cbDrvDescMax, ptr %pcbDrvDesc, ptr %szDrvAttr, i16 signext %cbDrvAttrMax, ptr %pcbDrvAttr ) nounwind
119 bb167: ; preds = %done
120 %tmp168 = tail call i32 @pthread_mutex_unlock( ptr @iodbcdm_global_lock ) nounwind ; <i32> [#uses=0]
124 declare i32 @pthread_mutex_unlock(ptr)
126 declare i16 @SQLDrivers_Internal(ptr, i16 zeroext , ptr, i16 signext , ptr, ptr, i16 signext , ptr, i8 zeroext ) nounwind
128 declare void @trace_SQLDriversW(i32, i32, ptr, i16 zeroext , ptr, i16 signext , ptr, ptr, i16 signext , ptr)