1; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu --verify-machineinstrs \ 2; RUN: -stop-after=prologepilog < %s | FileCheck \ 3; RUN: --check-prefixes=CHECK,CHECK64,ELFV2 %s 4 5; RUN: llc -mtriple=powerpc64-unknown-aix-xcoff -mcpu=pwr4 \ 6; RUN: --verify-machineinstrs --mattr=-altivec -stop-after=prologepilog < %s | \ 7; RUN: FileCheck --check-prefixes=CHECK,CHECK64,V1ANDAIX %s 8 9; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 --verify-machineinstrs \ 10; RUN: -stop-after=prologepilog < %s | FileCheck \ 11; RUN: --check-prefixes=CHECK,CHECK64,V1ANDAIX %s 12 13; RUN: llc -mtriple=powerpc-unknown-aix-xcoff -mcpu=pwr4 \ 14; RUN: --verify-machineinstrs --mattr=-altivec -stop-after=prologepilog < %s | \ 15; RUN: FileCheck --check-prefixes=CHECK,CHECK32 %s 16 17define dso_local signext i32 @test(i32 signext %n) { 18entry: 19 %conv = sext i32 %n to i64 20 %0 = alloca double, i64 %conv, align 16 21 tail call void asm sideeffect "", "~{cr2}"() 22 %call = call signext i32 @do_something(double* nonnull %0) 23 ret i32 %call 24} 25 26declare signext i32 @do_something(double*) 27 28; CHECK: name: test 29; CHECK: alignment: 16 30; CHECK: liveins: 31; CHECK64: - { reg: '$x3', virtual-reg: '' } 32; CHECK32: - { reg: '$r3', virtual-reg: '' } 33 34; ELFV2: stackSize: 48 35; V1ANDAIX: stackSize: 128 36; CHECK32: stackSize: 80 37 38; ELFV2: maxCallFrameSize: 32 39; V1ANDAIX: maxCallFrameSize: 112 40; CHECK32: maxCallFrameSize: 64 41 42; CHECK64: fixedStack: 43; CHECK64-NEXT: - { id: 0, type: default, offset: 8, size: 4, alignment: 8, stack-id: default, 44; CHECK64-NEXT: isImmutable: true, isAliased: false, callee-saved-register: '$cr2', 45; CHECK64-NEXT: callee-saved-restored: true, debug-info-variable: '', debug-info-expression: '', 46; CHECK64-NEXT: debug-info-location: '' } 47; CHECK64-NEXT: - { id: 1, type: default, offset: -8, size: 8, alignment: 8, stack-id: default, 48; CHECK64-NEXT: isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, 49; CHECK64-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 50 51; CHECK64-NEXT: stack: 52; CHECK64-NEXT: - { id: 0, name: '<unnamed alloca>', type: variable-sized, offset: -8, 53; CHECK64-NEXT: alignment: 1, stack-id: default, callee-saved-register: '', callee-saved-restored: true, 54; CHECK64-NEXT: local-offset: 0, debug-info-variable: '', debug-info-expression: '', 55; CHECK64-NEXT: debug-info-location: '' } 56; CHECK64-NEXT: - { id: 1, name: '', type: default, offset: -16, size: 8, alignment: 8, 57; CHECK64-NEXT: stack-id: default, callee-saved-register: '', callee-saved-restored: true, 58; CHECK64-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 59 60 61; CHECK32: fixedStack: 62; CHECK32-NEXT: - { id: 0, type: default, offset: 4, size: 4, alignment: 4, stack-id: default, 63; CHECK32-NEXT: isImmutable: true, isAliased: false, callee-saved-register: '$cr2', 64; CHECK32-NEXT: callee-saved-restored: true, debug-info-variable: '', debug-info-expression: '', 65; CHECK32-NEXT: debug-info-location: '' } 66; CHECK32-NEXT: - { id: 1, type: default, offset: -4, size: 4, alignment: 4, stack-id: default, 67; CHECK32-NEXT: isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, 68; CHECK32-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 69 70; CHECK32-NEXT: stack: 71; CHECK32-NEXT: - { id: 0, name: '<unnamed alloca>', type: variable-sized, offset: -4, 72; CHECK32-NEXT: alignment: 1, stack-id: default, callee-saved-register: '', callee-saved-restored: true, 73; CHECK32-NEXT: local-offset: 0, debug-info-variable: '', debug-info-expression: '', 74; CHECK32-NEXT: debug-info-location: '' } 75; CHECK32-NEXT: - { id: 1, name: '', type: default, offset: -8, size: 4, alignment: 4, 76; CHECK32-NEXT: stack-id: default, callee-saved-register: '', callee-saved-restored: true, 77; CHECK32-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 78 79 80; CHECK64: bb.0.entry: 81; CHECK64-NEXT: liveins: $x3, $cr2 82 83; Prologue: 84; CHECK64: $x0 = MFLR8 implicit $lr8 85; ELFV2-NEXT: $x12 = MFOCRF8 killed $cr2 86; V1ANDAIX-NEXT: $x12 = MFCR8 implicit killed $cr2 87; CHECK64-DAG: STD $x31, -8, $x1 88; CHECK64-DAG: STD killed $x0, 16, $x1 89; CHECK64-DAG: STW8 killed $x12, 8, $x1 90 91; ELFV2-NEXT: $x1 = STDU $x1, -48, $x1 92; V1ANDAIX-NEXT: x1 = STDU $x1, -128, $x1 93 94; CHECK64: $x31 = OR8 $x1, $x1 95 96; ELFV2: $[[ORIGSP:x[0-9]+]] = ADDI8 $x31, 48 97; V1ANDAIX: $[[ORIGSP:x[0-9]+]] = ADDI8 $x31, 128 98; CHECK64: $x1 = STDUX killed $[[ORIGSP]], $x1, killed $x{{[0-9]}} 99; CHECK64: INLINEASM {{.*}} early-clobber $cr2 100; CHECK64: BL8_NOP 101 102 103; Epilogue: 104; CHECK64: $x1 = LD 0, $x1 105; CHECK64-DAG: $x0 = LD 16, $x1 106; CHECK64-DAG: $x12 = LWZ8 8, $x1 107; CHECK64-DAG: $x31 = LD -8, $x1 108; CHECK64: $cr2 = MTOCRF8 killed $x12 109; CHECK64-NEXT: MTLR8 $x0, implicit-def $lr8 110; CHECK64-NEXT: BLR8 implicit $lr8, implicit $rm, implicit $x3 111 112; CHECK32: bb.0.entry: 113; CHECK32-NEXT: liveins: $r3, $cr2 114 115; Prologue: 116; CHECK32: $r0 = MFLR implicit $lr 117; CHECK32-NEXT: $r12 = MFCR implicit killed $cr2 118; CHECK32-DAG: STW $r31, -4, $r1 119; CHECK32-DAG: STW killed $r0, 8, $r1 120; CHECK32-DAG: STW killed $r12, 4, $r1 121; CHECK32: $r1 = STWU $r1, -80, $r1 122 123; CHECK32: $r31 = OR $r1, $r1 124; CHECK32: $[[ORIGSP:r[0-9]+]] = ADDI $r31, 80 125; CHECK32: $r1 = STWUX killed $[[ORIGSP]], $r1, killed $r{{[0-9]}} 126; CHECK32: INLINEASM {{.*}} early-clobber $cr2 127; CHECK32: BL_NOP 128 129; Epilogue: 130; CHECK32: $r1 = LWZ 0, $r1 131; CHECK32-DAG: $r0 = LWZ 8, $r1 132; CHECK32-DAG: $r12 = LWZ 4, $r1 133; CHECK32-DAG: $r31 = LWZ -4, $r1 134; CHECK32: $cr2 = MTOCRF killed $r12 135; CHECK32-NEXT: MTLR $r0, implicit-def $lr 136; CHECK32-NEXT: BLR implicit $lr, implicit $rm, implicit $r3 137