Skip to content

Commit f3164f7

Browse files
davemgreentstellar
authored andcommitted
[ARM] Only produce qadd8b under hasV6Ops
When compiling for a arm5te cpu from clang, the +dsp attribute is set. This meant we could try and generate qadd8 instructions where we would end up having no pattern. I've changed the condition here to be hasV6Ops && hasDSP, which is what other parts of ARMISelLowering seem to use for similar instructions. Fixed PR45677. Differential Revision: https://reviews.llvm.org/D78877 (cherry picked from commit 8807139)
1 parent 3de89ab commit f3164f7

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4549,7 +4549,7 @@ SDValue ARMTargetLowering::LowerUnsignedALUO(SDValue Op,
45494549
static SDValue LowerSADDSUBSAT(SDValue Op, SelectionDAG &DAG,
45504550
const ARMSubtarget *Subtarget) {
45514551
EVT VT = Op.getValueType();
4552-
if (!Subtarget->hasDSP())
4552+
if (!Subtarget->hasV6Ops() || !Subtarget->hasDSP())
45534553
return SDValue();
45544554
if (!VT.isSimple())
45554555
return SDValue();

llvm/test/CodeGen/ARM/sadd_sat.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
; RUN: llc < %s -mtriple=thumbv7em-none-eabi | FileCheck %s --check-prefix=CHECK-T2 --check-prefix=CHECK-T2DSP
55
; RUN: llc < %s -mtriple=armv5t-none-eabi | FileCheck %s --check-prefix=CHECK-ARM --check-prefix=CHECK-ARMNODPS
66
; RUN: llc < %s -mtriple=armv5te-none-eabi | FileCheck %s --check-prefix=CHECK-ARM --check-prefix=CHECK-ARMBASEDSP
7+
; RUN: llc < %s -mtriple=armv5te-none-eabi -mattr=+dsp | FileCheck %s --check-prefix=CHECK-ARM --check-prefix=CHECK-ARMBASEDSP
78
; RUN: llc < %s -mtriple=armv6-none-eabi | FileCheck %s --check-prefix=CHECK-ARM --check-prefix=CHECK-ARMDSP
89

910
declare i4 @llvm.sadd.sat.i4(i4, i4)

0 commit comments

Comments
 (0)