File tree Expand file tree Collapse file tree 5 files changed +38
-9
lines changed
Expand file tree Collapse file tree 5 files changed +38
-9
lines changed Original file line number Diff line number Diff line change @@ -955,8 +955,8 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
955955 OutContext),
956956 MCConstantExpr::create (4 , OutContext), OutContext);
957957
958- // Emit the 'bl' .
959- EmitToStreamer (*OutStreamer, MCInstBuilder (PPC::BL ).addExpr (OffsExpr));
958+ // Emit 'bcl 20,31,.+4' so the link stack is not corrupted .
959+ EmitToStreamer (*OutStreamer, MCInstBuilder (PPC::BCLalways ).addExpr (OffsExpr));
960960 return ;
961961 }
962962 case PPC::MovePCtoLR:
@@ -967,9 +967,9 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
967967 // L1$pb:
968968 MCSymbol *PICBase = MF->getPICBaseSymbol ();
969969
970- // Emit the 'bl' .
970+ // Emit 'bcl 20,31,.+4' so the link stack is not corrupted .
971971 EmitToStreamer (*OutStreamer,
972- MCInstBuilder (PPC::BL )
972+ MCInstBuilder (PPC::BCLalways )
973973 // FIXME: We would like an efficient form for this, so we
974974 // don't have to do a lot of extra uniquing.
975975 .addExpr (MCSymbolRefExpr::create (PICBase, OutContext)));
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ sw.epilog: ; preds = %sw.bb3, %sw.default
5151 ret i32 %5
5252}
5353; CHECK-LABEL: test_jump_table:
54- ; CHECK-NOT: bl .L0$pb
54+ ; CHECK-NOT: bcl 20, 31, .L0$pb
5555
5656; CHECK: addis [[REG1:[0-9]+]], 2, .LC[[TOCNUM:[0-9]+]]@toc@ha
5757; CHECK: ld [[REG2:[0-9]+]], .LC[[TOCNUM]]@toc@l([[REG1]])
@@ -64,7 +64,7 @@ sw.epilog: ; preds = %sw.bb3, %sw.default
6464; CHECK-NEXT: .long .LBB0_{{[0-9]+}}-.LJTI0_0
6565
6666; LARGE-LABEL: test_jump_table:
67- ; LARGE: bl .L0$pb
67+ ; LARGE: bcl 20, 31, .L0$pb
6868; LARGE-NEXT: .L0$pb:
6969; LARGE: mflr [[REGBASE:[0-9]+]]
7070
Original file line number Diff line number Diff line change 1+ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+ ; RUN: llc < %s -mtriple=powerpc -relocation-model=pic | \
3+ ; RUN: FileCheck -check-prefixes=SMALL %s
4+
5+ @val = global i8 0 , align 1
6+
7+ define zeroext i8 @testbcl () nounwind {
8+ ; SMALL-LABEL: testbcl:
9+ ; SMALL: # %bb.0: # %entry
10+ ; SMALL-NEXT: mflr 0
11+ ; SMALL-NEXT: stwu 1, -16(1)
12+ ; SMALL-NEXT: stw 30, 8(1)
13+ ; SMALL-NEXT: stw 0, 20(1)
14+ ; SMALL-NEXT: bcl 20, 31, .L0$pb
15+ ; SMALL-NEXT: .L0$pb:
16+ ; SMALL-NEXT: mflr 30
17+ ; SMALL-NEXT: lwz 3, .L0$poff-.L0$pb(30)
18+ ; SMALL-NEXT: add 30, 3, 30
19+ ; SMALL-NEXT: lwz 3, .LC0-.LTOC(30)
20+ ; SMALL-NEXT: lbz 3, 0(3)
21+ ; SMALL-NEXT: lwz 0, 20(1)
22+ ; SMALL-NEXT: lwz 30, 8(1)
23+ ; SMALL-NEXT: addi 1, 1, 16
24+ ; SMALL-NEXT: mtlr 0
25+ ; SMALL-NEXT: blr
26+ entry:
27+ %0 = load i8 , ptr @val , align 1
28+ ret i8 %0
29+ }
Original file line number Diff line number Diff line change 5555; LARGE-BSS-NEXT: foo:
5656; LARGE-BSS: stwu 1, -32(1)
5757; LARGE-BSS: stw 30, 24(1)
58- ; LARGE-BSS: bl [[PB]]
58+ ; LARGE-BSS: bcl 20, 31, [[PB]]
5959; LARGE-BSS-NEXT: [[PB]]:
6060; LARGE-BSS: mflr 30
6161; LARGE-BSS: lwz [[REG:[0-9]+]], [[POFF]]-[[PB]](30)
Original file line number Diff line number Diff line change 1818; SMALL-LABEL: foo:
1919; SMALL: stwu 1, -32(1)
2020; SMALL: stw 30, 24(1)
21- ; SMALL-BSS: bl _GLOBAL_OFFSET_TABLE_@local-4
22- ; SMALL-SECURE: bl .L0$pb
21+ ; SMALL-BSS: bcl 20, 31, _GLOBAL_OFFSET_TABLE_@local-4
22+ ; SMALL-SECURE: bcl 20, 31, .L0$pb
2323; SMALL: mflr 30
2424; SMALL-SECURE: addis 30, 30, _GLOBAL_OFFSET_TABLE_-.L0$pb@ha
2525; SMALL-SECURE: addi 30, 30, _GLOBAL_OFFSET_TABLE_-.L0$pb@l
You can’t perform that action at this time.
0 commit comments