Skip to content

Commit 4851dbb

Browse files
committed
[Hexagon] Use getSignedConstant for RoundTo8 XForm
To handle negative offset addrmodes correctly. Fixes #117558 (comment).
1 parent 54fcf3e commit 4851dbb

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

llvm/lib/Target/Hexagon/HexagonPatterns.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2675,7 +2675,7 @@ def s30_2ProperPred : PatLeaf<(i32 imm), [{
26752675
}]>;
26762676
def RoundTo8 : SDNodeXForm<imm, [{
26772677
int32_t Imm = N->getSExtValue();
2678-
return CurDAG->getTargetConstant(Imm & -8, SDLoc(N), MVT::i32);
2678+
return CurDAG->getSignedTargetConstant(Imm & -8, SDLoc(N), MVT::i32);
26792679
}]>;
26802680

26812681
let AddedComplexity = 150 in
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
; RUN: llc -mtriple=hexagon < %s | FileCheck %s
2+
3+
; CHECK: r0 = add(r0,#4)
4+
; CHECK: memd(r0+#-16) =
5+
define void @neg_gep_store(ptr %ptr) {
6+
%gep = getelementptr i8, ptr %ptr, i32 -12
7+
store i64 0, ptr %gep, align 8
8+
ret void
9+
}

0 commit comments

Comments
 (0)