Skip to content

Commit 8807139

Browse files
committed
[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
1 parent 1a0d466 commit 8807139

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

llvm/lib/Target/ARM/ARMISelLowering.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4586,7 +4586,7 @@ SDValue ARMTargetLowering::LowerUnsignedALUO(SDValue Op,
45864586
static SDValue LowerSADDSUBSAT(SDValue Op, SelectionDAG &DAG,
45874587
const ARMSubtarget *Subtarget) {
45884588
EVT VT = Op.getValueType();
4589-
if (!Subtarget->hasDSP())
4589+
if (!Subtarget->hasV6Ops() || !Subtarget->hasDSP())
45904590
return SDValue();
45914591
if (!VT.isSimple())
45924592
return SDValue();

llvm/test/CodeGen/ARM/sadd_sat.ll

+1
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)