1 ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
2 ; RUN: -mattr=-altivec -simplifycfg-require-and-preserve-domtree=1 < %s | \
3 ; RUN: FileCheck --check-prefixes=ASM,ASMNFS,ASM32 %s
5 ; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 \
6 ; RUN: -mattr=-altivec -simplifycfg-require-and-preserve-domtree=1 < %s | \
7 ; RUN: FileCheck --check-prefixes=ASM,ASMNFS,ASM64 %s
9 ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
10 ; RUN: -mattr=-altivec -simplifycfg-require-and-preserve-domtree=1 \
11 ; RUN: -function-sections < %s | \
12 ; RUN: FileCheck --check-prefixes=ASM,ASMFS,ASM32 %s
14 ; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 \
15 ; RUN: -mattr=-altivec -simplifycfg-require-and-preserve-domtree=1 \
16 ; RUN: -function-sections < %s | \
17 ; RUN: FileCheck --check-prefixes=ASM,ASMFS,ASM64 %s
19 @_ZTIi = external constant ptr
21 define void @_Z9throwFuncv() {
23 %exception = call ptr @__cxa_allocate_exception(i32 4) #2
24 store i32 1, ptr %exception, align 16
25 call void @__cxa_throw(ptr %exception, ptr @_ZTIi, ptr null) #3
29 ; ASMNFS: ._Z9throwFuncv:
30 ; ASMFS: .csect ._Z9throwFuncv[PR],5
31 ; ASM: bl .__cxa_allocate_exception[PR]
33 ; ASM32: lwz 4, L..C0(2)
34 ; ASM64: ld 4, L..C0(2)
35 ; ASM: bl .__cxa_throw[PR]
38 define i32 @_Z9catchFuncv() personality ptr @__xlcxx_personality_v1 {
40 %retval = alloca i32, align 4
41 %exn.slot = alloca ptr, align 4
42 %ehselector.slot = alloca i32, align 4
43 %0 = alloca i32, align 4
44 invoke void @_Z9throwFuncv()
45 to label %invoke.cont unwind label %lpad
47 invoke.cont: ; preds = %entry
50 lpad: ; preds = %entry
51 %1 = landingpad { ptr, i32 }
53 %2 = extractvalue { ptr, i32 } %1, 0
54 store ptr %2, ptr %exn.slot, align 4
55 %3 = extractvalue { ptr, i32 } %1, 1
56 store i32 %3, ptr %ehselector.slot, align 4
57 br label %catch.dispatch
59 catch.dispatch: ; preds = %lpad
60 %sel = load i32, ptr %ehselector.slot, align 4
61 %4 = call i32 @llvm.eh.typeid.for(ptr @_ZTIi) #2
62 %matches = icmp eq i32 %sel, %4
63 br i1 %matches, label %catch, label %eh.resume
65 catch: ; preds = %catch.dispatch
66 %exn = load ptr, ptr %exn.slot, align 4
67 %5 = call ptr @__cxa_begin_catch(ptr %exn) #2
68 %6 = load i32, ptr %5, align 4
69 store i32 %6, ptr %0, align 4
70 store i32 2, ptr %retval, align 4
71 call void @__cxa_end_catch() #2
74 try.cont: ; preds = %invoke.cont
75 store i32 1, ptr %retval, align 4
78 return: ; preds = %try.cont, %catch
79 %7 = load i32, ptr %retval, align 4
82 eh.resume: ; preds = %catch.dispatch
83 %exn1 = load ptr, ptr %exn.slot, align 4
84 %sel2 = load i32, ptr %ehselector.slot, align 4
85 %lpad.val = insertvalue { ptr, i32 } undef, ptr %exn1, 0
86 %lpad.val3 = insertvalue { ptr, i32 } %lpad.val, i32 %sel2, 1
87 resume { ptr, i32 } %lpad.val3
90 ; ASMNFS: ._Z9catchFuncv:
91 ; ASMFS: .csect ._Z9catchFuncv[PR],5
92 ; ASM: L..func_begin0:
93 ; ASM: # %bb.0: # %entry
96 ; ASM: bl ._Z9throwFuncv
99 ; ASM: # %bb.1: # %invoke.cont
101 ; ASM: L..BB1_2: # %return
104 ; ASM: L..BB1_3: # %lpad
106 ; ASM: bl .__cxa_begin_catch[PR]
108 ; ASM: bl .__cxa_end_catch[PR]
112 ; ASM: L.._Z9catchFuncv0:
113 ; ASM: .vbyte 4, 0x00000000 # Traceback table begin
114 ; ASM: .byte 0x00 # Version = 0
115 ; ASM: .byte 0x09 # Language = CPlusPlus
116 ; ASM: .byte 0x20 # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue
117 ; ASM: # +HasTraceBackTableOffset, -IsInternalProcedure
118 ; ASM: # -HasControlledStorage, -IsTOCless
119 ; ASM: # -IsFloatingPointPresent
120 ; ASM: # -IsFloatingPointOperationLogOrAbortEnabled
121 ; ASM: .byte 0x41 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed
122 ; ASM: # OnConditionDirective = 0, -IsCRSaved, +IsLRSaved
123 ; ASM: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0
124 ; ASM: .byte 0x80 # +HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0
125 ; ASM: .byte 0x00 # NumberOfFixedParms = 0
126 ; ASM: .byte 0x01 # NumberOfFPParms = 0, +HasParmsOnStack
127 ; ASMNFS: .vbyte 4, L.._Z9catchFuncv0-._Z9catchFuncv # Function size
128 ; ASMFS: .vbyte 4, L.._Z9catchFuncv0-._Z9catchFuncv[PR] # Function size
129 ; ASM: .vbyte 2, 0x000d # Function name len = 13
130 ; ASM: .byte "_Z9catchFuncv" # Function Name
131 ; ASM: .byte 0x08 # ExtensionTableFlag = TB_EH_INFO
133 ; ASM32: .vbyte 4, L..C1-TOC[TC0] # EHInfo Table
134 ; ASM64: .vbyte 8, L..C1-TOC[TC0] # EHInfo Table
137 ; ASMNFS: .csect .gcc_except_table[RO],2
138 ; ASMFS: .csect .gcc_except_table._Z9catchFuncv[RO],2
140 ; ASM: GCC_except_table1:
141 ; ASM: L..exception0:
142 ; ASM: .byte 255 # @LPStart Encoding = omit
143 ; ASM32: .byte 187 # @TType Encoding = indirect datarel sdata4
144 ; ASM64: .byte 188 # @TType Encoding = indirect datarel sdata8
147 ; ASM: .byte 3 # Call site Encoding = udata4
149 ; ASM: .vbyte 4, L..tmp0-L..func_begin0 # >> Call Site 1 <<
150 ; ASM: .vbyte 4, L..tmp1-L..tmp0 # Call between L..tmp0 and L..tmp1
151 ; ASM: .vbyte 4, L..tmp2-L..func_begin0 # jumps to L..tmp2
152 ; ASM: .byte 1 # On action: 1
153 ; ASM: .vbyte 4, L..tmp1-L..func_begin0 # >> Call Site 2 <<
154 ; ASM: .vbyte 4, L..func_end0-L..tmp1 # Call between L..tmp1 and L..func_end0
155 ; ASM: .vbyte 4, 0 # has no landing pad
156 ; ASM: .byte 0 # On action: cleanup
158 ; ASM: .byte 1 # >> Action Record 1 <<
159 ; ASM: # Catch TypeInfo 1
160 ; ASM: .byte 0 # No further actions
162 ; ASM: # >> Catch TypeInfos <<
163 ; ASM32: .vbyte 4, L..C0-TOC[TC0] # TypeInfo 1
164 ; ASM64: .vbyte 8, L..C0-TOC[TC0] # TypeInfo 1
168 ; ASMNFS: .csect .eh_info_table[RW],2
169 ; ASMFS: .csect .eh_info_table._Z9catchFuncv[RW],2
173 ; ASM32: .vbyte 4, GCC_except_table1
174 ; ASM32: .vbyte 4, __xlcxx_personality_v1[DS]
176 ; ASM64: .vbyte 8, GCC_except_table1
177 ; ASM64: .vbyte 8, __xlcxx_personality_v1[DS]
181 ; ASM: .tc _ZTIi[TC],_ZTIi[UA]
183 ; ASM: .tc __ehinfo.1[TC],__ehinfo.1
185 declare ptr @__cxa_allocate_exception(i32)
186 declare void @__cxa_throw(ptr, ptr, ptr)
187 declare i32 @__xlcxx_personality_v1(...)
188 declare i32 @llvm.eh.typeid.for(ptr)
189 declare ptr @__cxa_begin_catch(ptr)
190 declare void @__cxa_end_catch()