1 ; RUN: llc -verify-machineinstrs -enable-machine-outliner -mtriple=aarch64-arm-none-eabi < %s | FileCheck %s
2 ; RUN: llc -verify-machineinstrs -enable-machine-outliner -mtriple=aarch64-arm-none-eabi -stop-after=machine-outliner < %s | FileCheck %s -check-prefix=TARGET_FEATURES
4 ; Make sure that we haven't added nouwind.
5 ; TARGET_FEATURES: define internal void @OUTLINED_FUNCTION_0()
6 ; TARGET_FEATURES-SAME: #[[ATTR_NUM:[0-9]+]]
7 ; TARGET_FEATURES: attributes #[[ATTR_NUM]] = { minsize optsize }
9 define dso_local i32 @_Z5func1i(i32 %x) #0 {
10 ; CHECK-LABEL: _Z5func1i:
11 ; CHECK: // %bb.0: // %entry
12 ; CHECK-NEXT: stp x30, x19, [sp, #-16]! // 16-byte Folded Spill
13 ; CHECK-NEXT: .cfi_def_cfa_offset 16
14 ; CHECK-NEXT: .cfi_offset w19, -8
15 ; CHECK-NEXT: .cfi_offset w30, -16
16 ; CHECK-NEXT: orr w8, wzr, #0x1
17 ; CHECK-NEXT: madd w19, w0, w0, w8
18 ; CHECK-NEXT: mov w0, #4
19 ; CHECK-NEXT: bl __cxa_allocate_exception
20 ; CHECK-NEXT: bl OUTLINED_FUNCTION_0
22 %mul = mul nsw i32 %x, %x
23 %add = add nuw nsw i32 %mul, 1
24 %exception = tail call i8* @__cxa_allocate_exception(i64 4) #1
25 %0 = bitcast i8* %exception to i32*
26 store i32 %add, i32* %0, align 16
27 tail call void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) #2
31 define dso_local i32 @_Z5func2c(i8 %x) #0 {
32 ; CHECK-LABEL: _Z5func2c:
33 ; CHECK: // %bb.0: // %entry
34 ; CHECK-NEXT: stp x30, x19, [sp, #-16]! // 16-byte Folded Spill
35 ; CHECK-NEXT: .cfi_def_cfa_offset 16
36 ; CHECK-NEXT: .cfi_offset w19, -8
37 ; CHECK-NEXT: .cfi_offset w30, -16
38 ; CHECK-NEXT: and w8, w0, #0xff
39 ; CHECK-NEXT: orr w9, wzr, #0x1
40 ; CHECK-NEXT: mov w0, #4
41 ; CHECK-NEXT: madd w19, w8, w8, w9
42 ; CHECK-NEXT: bl __cxa_allocate_exception
43 ; CHECK-NEXT: bl OUTLINED_FUNCTION_0
45 %conv = zext i8 %x to i32
46 %mul = mul nuw nsw i32 %conv, %conv
47 %add = add nuw nsw i32 %mul, 1
48 %exception = tail call i8* @__cxa_allocate_exception(i64 4) #1
49 %0 = bitcast i8* %exception to i32*
50 store i32 %add, i32* %0, align 16
51 tail call void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) #2
55 ; CHECK-LABEL: OUTLINED_FUNCTION_0:
56 ; CHECK: .cfi_startproc
57 ; CHECK: adrp x1, _ZTIi
58 ; CHECK-NEXT: add x1, x1, :lo12:_ZTIi
59 ; CHECK-NEXT: mov x2, xzr
60 ; CHECK-NEXT: str w19, [x0]
61 ; CHECK-NEXT: b __cxa_throw
65 @_ZTIi = external dso_local constant i8*
66 declare dso_local i8* @__cxa_allocate_exception(i64) local_unnamed_addr
67 declare dso_local void @__cxa_throw(i8*, i8*, i8*) local_unnamed_addr
69 attributes #0 = { minsize noreturn optsize }
70 attributes #1 = { nounwind }
71 attributes #2 = { noreturn }