Skip to content

Commit 1523332

Browse files
authored
[ARM] Mark function calls as possibly changing FPSCR (llvm#160699)
This patch does the same changes as D143001 for AArch64. This PR is part of the work on adding strict FP support in ARM, which was previously discussed in llvm#137101.
1 parent 9ed8896 commit 1523332

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22109,6 +22109,11 @@ bool ARMTargetLowering::isComplexDeinterleavingOperationSupported(
2210922109
ScalarTy->isIntegerTy(32));
2211022110
}
2211122111

22112+
ArrayRef<MCPhysReg> ARMTargetLowering::getRoundingControlRegisters() const {
22113+
static const MCPhysReg RCRegs[] = {ARM::FPSCR_RM};
22114+
return RCRegs;
22115+
}
22116+
2211222117
Value *ARMTargetLowering::createComplexDeinterleavingIR(
2211322118
IRBuilderBase &B, ComplexDeinterleavingOperation OperationType,
2211422119
ComplexDeinterleavingRotation Rotation, Value *InputA, Value *InputB,

llvm/lib/Target/ARM/ARMISelLowering.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,8 @@ class VectorType;
10091009

10101010
bool isUnsupportedFloatingType(EVT VT) const;
10111011

1012+
ArrayRef<MCPhysReg> getRoundingControlRegisters() const override;
1013+
10121014
SDValue getCMOV(const SDLoc &dl, EVT VT, SDValue FalseVal, SDValue TrueVal,
10131015
SDValue ARMcc, SDValue Flags, SelectionDAG &DAG) const;
10141016
SDValue getARMCmp(SDValue LHS, SDValue RHS, ISD::CondCode CC,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
; RUN: llc -mtriple arm-none-eabi -stop-after=finalize-isel %s -o - | FileCheck %s
2+
3+
define float @func_02(float %x, float %y) strictfp nounwind {
4+
%call = call float @func_01(float %x) strictfp
5+
%res = call float @llvm.experimental.constrained.fadd.f32(float %call, float %y, metadata !"round.dynamic", metadata !"fpexcept.ignore") strictfp
6+
ret float %res
7+
}
8+
; CHECK-LABEL: name: func_02
9+
; CHECK: BL @func_01, {{.*}}, implicit-def $fpscr_rm
10+
11+
12+
declare float @func_01(float)
13+
declare float @llvm.experimental.constrained.fadd.f32(float, float, metadata, metadata)

0 commit comments

Comments
 (0)