Inline asm mult-alt constraint tests.
[oota-llvm.git] / test / CodeGen / X86 / 2009-04-09-InlineAsmCrash.ll
1 ; RUN: llc < %s 
2 ; rdar://6774324
3 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
4 target triple = "i386-apple-darwin10.0"
5         type <{ i32, %1 }>              ; type %0
6         type <{ [216 x i8] }>           ; type %1
7         type <{ %3, %4*, %28*, i64, i32, %6, %6, i32, i32, i32, i32, void (i8*, i32)*, i8*, %29*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [2 x i8*], i32, %30, i32, %24, %4*, %4*, i64, i64, i32, i32, void (i32, %2*)*, i32, i32, i32, i32, i32, i32, i32, i32, %24, i64, i64, i64, i64, i64, %21, i32, i32, %21, i32, %31*, %3, %33, %34, %9*, i32, i32, %3, %3, %35, %41*, %42*, %11, i32, i32, i32, i8, i8, i8, i8, %69*, %69, %9*, %9*, [11 x %61], %3, i8*, i32, i64, i64, i32, i32, i32, i64 }>           ; type %2
8         type <{ %3*, %3* }>             ; type %3
9         type <{ %3, i32, %2*, %2*, %2*, %5*, i32, i32, %21, i64, i64, i64, i32, %22, %9*, %6, %4*, %23 }>               ; type %4
10         type <{ %3, %3, %4*, %4*, i32, %6, %9*, %9*, %5*, %20* }>               ; type %5
11         type <{ %7, i16, i8, i8, %8 }>          ; type %6
12         type <{ i32 }>          ; type %7
13         type <{ i8*, i8*, [2 x i32], i16, i8, i8, i8*, i8, i8, i8, i8, i8* }>           ; type %8
14         type <{ %10, %13, %15, i32, i32, i32, i32, %9*, %9*, %16*, i32, %17*, i64, i32 }>               ; type %9
15         type <{ i32, i32, %11 }>                ; type %10
16         type <{ %12 }>          ; type %11
17         type <{ [12 x i8] }>            ; type %12
18         type <{ %14 }>          ; type %13
19         type <{ [40 x i8] }>            ; type %14
20         type <{ [4 x i8] }>             ; type %15
21         type <{ %15, %15 }>             ; type %16
22         type <{ %17*, %17*, %9*, i32, %18*, %19* }>             ; type %17
23         type opaque             ; type %18
24         type <{ i32, i32, %9*, %9*, i32, i32 }>         ; type %19
25         type <{ %5*, %20*, %20*, %20* }>                ; type %20
26         type <{ %3, %3*, void (i8*, i8*)*, i8*, i8*, i64 }>             ; type %21
27         type <{ i32, [4 x i32], i32, i32, [128 x %3] }>         ; type %22
28         type <{ %24, %24, %24, %24*, %24*, %24*, %25, %26, %27, i32, i32, i8* }>                ; type %23
29         type <{ i64, i32, i32, i32 }>           ; type %24
30         type <{ i32, i32 }>             ; type %25
31         type <{ i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, i64, i64, i32, i32 }>            ; type %26
32         type <{ [16 x %17*], i32 }>             ; type %27
33         type <{ i8, i8, i8, i8, %7, %3 }>               ; type %28
34         type <{ i32, %11*, i8*, i8*, %11* }>            ; type %29
35         type <{ i32, i32, i32, i32, i64 }>              ; type %30
36         type <{ %32*, %3, %3, i32, i32, i32, %5* }>             ; type %31
37         type opaque             ; type %32
38         type <{ [44 x i8] }>            ; type %33
39         type <{ %17* }>         ; type %34
40         type <{ %36, %36*, i32, [4 x %40], i32, i32, i64, i32 }>                ; type %35
41         type <{ i8*, %0*, %37*, i64, %39, i32, %39, %6, i64, i64, i8*, i32 }>           ; type %36
42         type <{ i32, i32, i8, i8, i8, i8, i8, i8, i8, i8, %38 }>                ; type %37
43         type <{ i16, i16, i8, i8, i16, i32, i16, i16, i32, i16, i16, i32, i32, [8 x [8 x i16]], [8 x [16 x i16]], [96 x i8] }>          ; type %38
44         type <{ i8, i8, i8, i8, i8, i8, i8, i8 }>               ; type %39
45         type <{ i64 }>          ; type %40
46         type <{ %11, i32, i32, i32, %42*, %3, i8*, %3, %5*, %32*, i32, i32, i32, i32, i32, i32, i32, %59, %60, i64, i64, i32, %11, %9*, %9*, %9*, [11 x %61], %9*, %9*, %9*, %9*, %9*, [3 x %9*], %62*, %3, %3, i32, i32, %9*, %9*, i32, %67*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, %68*, [2 x i32], i64, i64, i32 }>            ; type %41
47         type <{ %43, %44, %47*, i64, i64, i64, i32, %11, %54, %46*, %46*, i32, i32, i32, i32, i32, i32, i32 }>          ; type %42
48         type <{ i16, i8, i8, i32, i32 }>                ; type %43
49         type <{ %45, i32, i32 }>                ; type %44
50         type <{ %46*, %46*, i64, i64 }>         ; type %45
51         type <{ %45, %15, i64, i8, i8, i8, i8, i16, i16 }>              ; type %46
52         type <{ i64*, i64, %48*, i32, i32, i32, %6, %53, i32, i64, i64*, i64*, %48*, %48*, %48*, i32 }>         ; type %47
53         type <{ %3, %43, i64, %49*, i32, i32, i32, i32, %48*, %48*, i64, %50*, i64, %52*, i32, i16, i16, i8, i8, i8, i8, %3, %3, i64, i32, i32, i32, i8*, i32, i8, i8, i8, i8, %3 }>            ; type %48
54         type <{ %3, %3, %49*, %48*, i64, i8, i8, i8, i8, i32, i8, i8, i8, i8 }>         ; type %49
55         type <{ i32, %51* }>            ; type %50
56         type <{ void (%50*)*, void (%50*)*, i32 (%50*, %52*, i32)*, i32 (%50*)*, i32 (%50*, i64, i32, i32, i32*)*, i32 (%50*, i64, i32, i64*, i32*, i32, i32, i32)*, i32 (%50*, i64, i32)*, i32 (%50*, i64, i64, i32)*, i32 (%50*, i64, i64, i32)*, i32 (%50*, i32)*, i32 (%50*)*, i8* }>               ; type %51
57         type <{ i32, %48* }>            ; type %52
58         type <{ i32, i32, i32 }>                ; type %53
59         type <{ %11, %55*, i32, %53, i64 }>             ; type %54
60         type <{ %3, i32, i32, i32, i32, i32, [64 x i8], %56 }>          ; type %55
61         type <{ %57, %58, %58 }>                ; type %56
62         type <{ i64, i64, i64, i64, i64 }>              ; type %57
63         type <{ i64, i64, i64, i64, i64, i64, i64, i64 }>               ; type %58
64         type <{ [2 x i32] }>            ; type %59
65         type <{ [8 x i32] }>            ; type %60
66         type <{ %9*, i32, i32, i32 }>           ; type %61
67         type <{ %11, i32, %11, i32, i32, %63*, i32, %64*, %65, i32, i32, i32, i32, %41* }>              ; type %62
68         type <{ %10*, i32, %15, %15 }>          ; type %63
69         type opaque             ; type %64
70         type <{ i32, %66*, %66*, %66**, %66*, %66** }>          ; type %65
71         type <{ %63, i32, %62*, %66*, %66* }>           ; type %66
72         type <{ i32, i32, [0 x %39] }>          ; type %67
73         type opaque             ; type %68
74         type <{ %69*, void (%69*, %2*)* }>              ; type %69
75         type <{ %70*, %2*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i32, i32, i32, i32, i32, i32, i32, %71, i32, i32, i64, i64, i64, %72, i8*, i8*, %73, %4*, %79*, %81*, %39*, %84, i32, i32, i32, i8*, i32, i32, i32, i32, i32, i32, i32, i64*, i32, i64*, i8*, i32, [256 x i32], i64, i64, %86, %77*, i64, i64, %88*, %2*, %2* }>           ; type %70
76         type <{ %3, i64, i32, i32 }>            ; type %71
77         type <{ i64, i64, i64 }>                ; type %72
78         type <{ %73*, %73*, %73*, %73*, %74*, %75*, %76*, %70*, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, [3 x %78*], i8*, i8* }>               ; type %73
79         type <{ %74*, %74*, %75*, %76*, %73*, i32, i32, i32, i32, i32, i8*, i8* }>              ; type %74
80         type <{ %75*, %73*, %74*, %76*, i32, i32, i32, i32, %78*, i8*, i8* }>           ; type %75
81         type <{ %76*, %73*, %74*, %75*, i32, i32, i32, i32, i8*, i8*, %77* }>           ; type %76
82         type opaque             ; type %77
83         type <{ %78*, %75*, i8, i8, i8, i8, i16, i16, i16, i8, i8, i32, [0 x %73*] }>           ; type %78
84         type <{ i32, i32, i32, [20 x %80] }>            ; type %79
85         type <{ i64*, i8* }>            ; type %80
86         type <{ [256 x %39], [19 x %39], i8, i8, i8, i8, i8, i8, i8, i8, %82, i8, i8, i8, i8, i8, i8, i8, i8, %82, %83 }>               ; type %81
87         type <{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16 }>                ; type %82
88         type <{ [16 x i64], i64 }>              ; type %83
89         type <{ %82*, %85, %85, %39*, i32 }>            ; type %84
90         type <{ i16, %39* }>            ; type %85
91         type <{ %87, i8* }>             ; type %86
92         type <{ i32, i32, i32, i8, i8, i16, i32, i32, i32, i32, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }>               ; type %87
93         type <{ i64, i64, i32, i32, i32, i32 }>         ; type %88
94         type <{ i32, i32, i32, i32, i32, i32, i32 }>            ; type %89
95 @kernel_stack_size = external global i32                ; <i32*> [#uses=1]
96
97 define void @test(%0*) nounwind {
98         %2 = tail call %2* asm sideeffect "mov %gs:${1:P},$0", "=r,i,~{dirflag},~{fpsr},~{flags}"(i32 ptrtoint (%2** getelementptr (%70* null, i32 0, i32 1) to i32)) nounwind          ; <%2*> [#uses=1]
99         %3 = getelementptr %2* %2, i32 0, i32 15                ; <i32*> [#uses=1]
100         %4 = load i32* %3               ; <i32> [#uses=2]
101         %5 = icmp eq i32 %4, 0          ; <i1> [#uses=1]
102         br i1 %5, label %47, label %6
103
104 ; <label>:6             ; preds = %1
105         %7 = load i32* @kernel_stack_size               ; <i32> [#uses=1]
106         %8 = add i32 %7, %4             ; <i32> [#uses=1]
107         %9 = inttoptr i32 %8 to %89*            ; <%89*> [#uses=12]
108         %10 = tail call %2* asm sideeffect "mov %gs:${1:P},$0", "=r,i,~{dirflag},~{fpsr},~{flags}"(i32 ptrtoint (%2** getelementptr (%70* null, i32 0, i32 1) to i32)) nounwind         ; <%2*> [#uses=1]
109         %11 = getelementptr %2* %10, i32 0, i32 65, i32 1               ; <%36**> [#uses=1]
110         %12 = load %36** %11            ; <%36*> [#uses=1]
111         %13 = getelementptr %36* %12, i32 0, i32 1              ; <%0**> [#uses=1]
112         %14 = load %0** %13             ; <%0*> [#uses=1]
113         %15 = icmp eq %0* %14, %0               ; <i1> [#uses=1]
114         br i1 %15, label %40, label %16
115
116 ; <label>:16            ; preds = %6
117         %17 = getelementptr %0* %0, i32 0, i32 1                ; <%1*> [#uses=1]
118         %18 = getelementptr %89* %9, i32 -1, i32 0              ; <i32*> [#uses=1]
119         %19 = getelementptr %0* %0, i32 0, i32 1, i32 0, i32 32         ; <i8*> [#uses=1]
120         %20 = bitcast i8* %19 to i32*           ; <i32*> [#uses=1]
121         %21 = load i32* %20             ; <i32> [#uses=1]
122         store i32 %21, i32* %18
123         %22 = getelementptr %89* %9, i32 -1, i32 1              ; <i32*> [#uses=1]
124         %23 = ptrtoint %1* %17 to i32           ; <i32> [#uses=1]
125         store i32 %23, i32* %22
126         %24 = getelementptr %89* %9, i32 -1, i32 2              ; <i32*> [#uses=1]
127         %25 = getelementptr %0* %0, i32 0, i32 1, i32 0, i32 24         ; <i8*> [#uses=1]
128         %26 = bitcast i8* %25 to i32*           ; <i32*> [#uses=1]
129         %27 = load i32* %26             ; <i32> [#uses=1]
130         store i32 %27, i32* %24
131         %28 = getelementptr %89* %9, i32 -1, i32 3              ; <i32*> [#uses=1]
132         %29 = getelementptr %0* %0, i32 0, i32 1, i32 0, i32 16         ; <i8*> [#uses=1]
133         %30 = bitcast i8* %29 to i32*           ; <i32*> [#uses=1]
134         %31 = load i32* %30             ; <i32> [#uses=1]
135         store i32 %31, i32* %28
136         %32 = getelementptr %89* %9, i32 -1, i32 4              ; <i32*> [#uses=1]
137         %33 = getelementptr %0* %0, i32 0, i32 1, i32 0, i32 20         ; <i8*> [#uses=1]
138         %34 = bitcast i8* %33 to i32*           ; <i32*> [#uses=1]
139         %35 = load i32* %34             ; <i32> [#uses=1]
140         store i32 %35, i32* %32
141         %36 = getelementptr %89* %9, i32 -1, i32 5              ; <i32*> [#uses=1]
142         %37 = getelementptr %0* %0, i32 0, i32 1, i32 0, i32 56         ; <i8*> [#uses=1]
143         %38 = bitcast i8* %37 to i32*           ; <i32*> [#uses=1]
144         %39 = load i32* %38             ; <i32> [#uses=1]
145         store i32 %39, i32* %36
146         ret void
147
148 ; <label>:40            ; preds = %6
149         %41 = getelementptr %89* %9, i32 -1, i32 0              ; <i32*> [#uses=1]
150         tail call void asm sideeffect "movl %ebx, $0", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* %41) nounwind
151         %42 = getelementptr %89* %9, i32 -1, i32 1              ; <i32*> [#uses=1]
152         tail call void asm sideeffect "movl %esp, $0", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* %42) nounwind
153         %43 = getelementptr %89* %9, i32 -1, i32 2              ; <i32*> [#uses=1]
154         tail call void asm sideeffect "movl %ebp, $0", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* %43) nounwind
155         %44 = getelementptr %89* %9, i32 -1, i32 3              ; <i32*> [#uses=1]
156         tail call void asm sideeffect "movl %edi, $0", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* %44) nounwind
157         %45 = getelementptr %89* %9, i32 -1, i32 4              ; <i32*> [#uses=1]
158         tail call void asm sideeffect "movl %esi, $0", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* %45) nounwind
159         %46 = getelementptr %89* %9, i32 -1, i32 5              ; <i32*> [#uses=1]
160         tail call void asm sideeffect "movl $$1f, $0\0A1:", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* %46) nounwind
161         ret void
162
163 ; <label>:47            ; preds = %1
164         ret void
165 }