Skip to content

Commit f0ae3c2

Browse files
committed
[ARM] in LowerConstantFP, make sure we cover armv6-m execute-only
Currently in LowerConstantFP, when we compile for execute-only (XO) we don't check what architecture we're compiling for (v6m=< or >v6m). We shouldn't get here for v6m, so put in an assert. Reviewed By: simonwallis2, dmgreen Differential Revision: https://reviews.llvm.org/D154506
1 parent 842a672 commit f0ae3c2

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7070,6 +7070,10 @@ SDValue ARMTargetLowering::LowerConstantFP(SDValue Op, SelectionDAG &DAG,
70707070
// Prevent floating-point constants from using literal loads
70717071
// when execute-only is enabled.
70727072
if (ST->genExecuteOnly()) {
7073+
// We shouldn't trigger this for v6m execute-only
7074+
assert((!ST->isThumb1Only() || ST->hasV8MBaselineOps()) &&
7075+
"Unexpected architecture");
7076+
70737077
// If we can represent the constant as an immediate, don't lower it
70747078
if (isFPImmLegal(FPVal, VT))
70757079
return Op;

llvm/test/CodeGen/Thumb2/float-ops-vmovsr-nofp-xo.ll renamed to llvm/test/CodeGen/ARM/float-ops-xo.ll

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
22
; RUN: llc < %s -mtriple=thumbv8.1m.main-none-eabihf -mattr=+mve,+execute-only | FileCheck %s
3+
; RUN: llc < %s -mtriple=thumbv6m -mattr=+execute-only | FileCheck %s --check-prefix=V6M
34

45
declare void @ext_fn(float)
56

@@ -12,6 +13,13 @@ define void @test1() {
1213
; CHECK-NEXT: vmov s0, r0
1314
; CHECK-NEXT: bl ext_fn
1415
; CHECK-NEXT: pop {r7, pc}
16+
;
17+
; V6M-LABEL: test1:
18+
; V6M: @ %bb.0: @ %entry
19+
; V6M-NEXT: push {r7, lr}
20+
; V6M-NEXT: movs r0, #0
21+
; V6M-NEXT: bl ext_fn
22+
; V6M-NEXT: pop {r7, pc}
1523
entry:
1624
call void @ext_fn(float 0.000000e+00)
1725
ret void
@@ -24,6 +32,17 @@ define float @test2() {
2432
; CHECK-NEXT: movt r0, #16673
2533
; CHECK-NEXT: vmov s0, r0
2634
; CHECK-NEXT: bx lr
35+
;
36+
; V6M-LABEL: test2:
37+
; V6M: @ %bb.0: @ %entry
38+
; V6M-NEXT: movs r0, #65
39+
; V6M-NEXT: lsls r0, r0, #8
40+
; V6M-NEXT: adds r0, #33
41+
; V6M-NEXT: lsls r0, r0, #8
42+
; V6M-NEXT: adds r0, #249
43+
; V6M-NEXT: lsls r0, r0, #8
44+
; V6M-NEXT: adds r0, #167
45+
; V6M-NEXT: bx lr
2746
entry:
2847
ret float 0x40243F34E0000000
2948
}

0 commit comments

Comments
 (0)