Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5475,7 +5475,8 @@ void PPCDAGToDAGISel::Select(SDNode *N) {
// generate secure plt code for TLS symbols.
getGlobalBaseReg();
} break;
case PPCISD::CALL: {
case PPCISD::CALL:
case PPCISD::CALL_RM: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are your targeting this for SPE? SPE should have no floating point instructions? So round mode should not be a concern? For SPE, we may stop generate CALL_RM where it is generated. Note that CALL_RM performs worse than normal CALL even after instruction selection. They are selected to different instructions.

If for other PPC32 targets, the fix looks reasonable to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are your targeting this for SPE?

This is not for SPE.

if (PPCLowering->getPointerTy(CurDAG->getDataLayout()) != MVT::i32 ||
!TM.isPositionIndependent() || !Subtarget->isSecurePlt() ||
!Subtarget->isTargetELF())
Expand All @@ -5491,8 +5492,7 @@ void PPCDAGToDAGISel::Select(SDNode *N) {
if (ES->getTargetFlags() == PPCII::MO_PLT)
getGlobalBaseReg();
}
}
break;
} break;

case PPCISD::GlobalBaseReg:
ReplaceNode(N, getGlobalBaseReg());
Expand Down
21 changes: 21 additions & 0 deletions llvm/test/CodeGen/PowerPC/ppc32-secure-plt-rm.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -mattr=+secure-plt -relocation-model=pic | FileCheck %s
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use auto generate script for it?


; This variant of ppc32-pic-large.ll checks that a strictfp call sets
; r30 for the secure PLT.

declare void @call_foo()

define void @foo() {
entry:
call void @call_foo() #0
ret void
}

attributes #0 = { strictfp }

!llvm.module.flags = !{!0}
!0 = !{i32 1, !"PIC Level", i32 2}

; CHECK: addis 30, 30, .LTOC-.L0$pb@ha
; CHECK: addi 30, 30, .LTOC-.L0$pb@l
; CHECK: bl call_foo@PLT+32768