Skip to content

Commit 9a8fae7

Browse files
author
Sumanth Gundapaneni
committed
[Hexagon] Update Instruction Info to include LD/ST offsets of vector instructions.
The hook HexagonInstrInfo::isValidOffset() is updated to evaluate offsets of missed LD/ST vector instructions.
1 parent 3b7ba24 commit 9a8fae7

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2765,12 +2765,40 @@ bool HexagonInstrInfo::isValidOffset(unsigned Opcode, int Offset,
27652765
case Hexagon::PS_vloadrw_nt_ai:
27662766
case Hexagon::V6_vL32b_ai:
27672767
case Hexagon::V6_vS32b_ai:
2768+
case Hexagon::V6_vS32b_pred_ai:
2769+
case Hexagon::V6_vS32b_npred_ai:
27682770
case Hexagon::V6_vS32b_qpred_ai:
27692771
case Hexagon::V6_vS32b_nqpred_ai:
2772+
case Hexagon::V6_vS32b_new_ai:
2773+
case Hexagon::V6_vS32b_new_pred_ai:
2774+
case Hexagon::V6_vS32b_new_npred_ai:
2775+
case Hexagon::V6_vS32b_nt_pred_ai:
2776+
case Hexagon::V6_vS32b_nt_npred_ai:
2777+
case Hexagon::V6_vS32b_nt_new_ai:
2778+
case Hexagon::V6_vS32b_nt_new_pred_ai:
2779+
case Hexagon::V6_vS32b_nt_new_npred_ai:
2780+
case Hexagon::V6_vS32b_nt_qpred_ai:
2781+
case Hexagon::V6_vS32b_nt_nqpred_ai:
27702782
case Hexagon::V6_vL32b_nt_ai:
27712783
case Hexagon::V6_vS32b_nt_ai:
27722784
case Hexagon::V6_vL32Ub_ai:
27732785
case Hexagon::V6_vS32Ub_ai:
2786+
case Hexagon::V6_vL32b_cur_ai:
2787+
case Hexagon::V6_vL32b_tmp_ai:
2788+
case Hexagon::V6_vL32b_pred_ai:
2789+
case Hexagon::V6_vL32b_npred_ai:
2790+
case Hexagon::V6_vL32b_cur_pred_ai:
2791+
case Hexagon::V6_vL32b_cur_npred_ai:
2792+
case Hexagon::V6_vL32b_tmp_pred_ai:
2793+
case Hexagon::V6_vL32b_tmp_npred_ai:
2794+
case Hexagon::V6_vL32b_nt_cur_ai:
2795+
case Hexagon::V6_vL32b_nt_tmp_ai:
2796+
case Hexagon::V6_vL32b_nt_pred_ai:
2797+
case Hexagon::V6_vL32b_nt_npred_ai:
2798+
case Hexagon::V6_vL32b_nt_cur_pred_ai:
2799+
case Hexagon::V6_vL32b_nt_cur_npred_ai:
2800+
case Hexagon::V6_vL32b_nt_tmp_pred_ai:
2801+
case Hexagon::V6_vL32b_nt_tmp_npred_ai:
27742802
case Hexagon::V6_vgathermh_pseudo:
27752803
case Hexagon::V6_vgathermw_pseudo:
27762804
case Hexagon::V6_vgathermhw_pseudo:
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
; REQUIRES: asserts
2+
; RUN: llc -O3 -march=hexagon < %s -o /dev/null
3+
; Make sure that this doesn't crash.
4+
; This test validates that the compiler would not assert when analyzing the
5+
; offset of V6_vS32b_pred_ai instruction
6+
7+
%struct.pluto = type <{ ptr, i16, ptr }>
8+
9+
@global = external hidden unnamed_addr constant [62 x i8], align 1
10+
@global.1 = external hidden unnamed_addr constant [47 x i8], align 1
11+
@global.2 = hidden local_unnamed_addr constant %struct.pluto <{ ptr @global, i16 892, ptr @global.1 }>, align 1
12+
@global.3 = local_unnamed_addr constant [1 x i32] zeroinitializer
13+
14+
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
15+
declare void @llvm.assume(i1 noundef) #0
16+
17+
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
18+
declare <32 x i32> @llvm.hexagon.V6.vd0.128B() #1
19+
20+
; Function Attrs: noinline nounwind
21+
declare hidden fastcc void @zot(i32, i32, i32, i32) unnamed_addr #2
22+
23+
; Function Attrs: noinline nounwind
24+
define void @barney(ptr nocapture %arg, ptr nocapture readnone %arg1, i8 signext %arg2, i32 %arg3, ptr nocapture readnone %arg4, ptr nocapture readnone %arg5, i32 %arg6, i32 %arg7, ptr nocapture readnone %arg8, ptr nocapture readnone %arg9, ptr nocapture readnone %arg10, ptr nocapture readnone %arg11, ptr nocapture readnone %arg12, ptr nocapture readnone %arg13, ptr nocapture readnone %arg14, ptr nocapture readnone %arg15, ptr nocapture readnone %arg16, ptr nocapture readnone %arg17) local_unnamed_addr #2 {
25+
bb:
26+
%icmp = icmp ult i32 %arg3, 4
27+
tail call void @llvm.assume(i1 %icmp) #3
28+
%call = tail call <32 x i32> @llvm.hexagon.V6.vd0.128B() #3
29+
br label %bb18
30+
31+
bb18: ; preds = %bb22, %bb
32+
%phi = phi i32 [ %and, %bb22 ], [ %arg3, %bb ]
33+
%phi19 = phi i32 [ %add23, %bb22 ], [ 4, %bb ]
34+
%icmp20 = icmp eq i32 %phi, 0
35+
br i1 %icmp20, label %bb21, label %bb22
36+
37+
bb21: ; preds = %bb18
38+
%shl = shl i32 %phi19, 8
39+
%getelementptr = getelementptr inbounds i8, ptr %arg, i32 %shl
40+
%bitcast = bitcast ptr %getelementptr to ptr
41+
store <32 x i32> %call, ptr %bitcast, align 128
42+
br label %bb22
43+
44+
bb22: ; preds = %bb21, %bb18
45+
%add = add nuw nsw i32 %phi, 1
46+
%and = and i32 %add, 3
47+
%add23 = add nuw nsw i32 %phi19, 1
48+
%icmp24 = icmp eq i32 %add23, 8
49+
br i1 %icmp24, label %bb25, label %bb18
50+
51+
bb25: ; preds = %bb22
52+
tail call fastcc void @zot(i32 %arg6, i32 %arg7, i32 0, i32 %arg3)
53+
ret void
54+
}
55+
56+
attributes #0 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
57+
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }
58+
attributes #2 = { noinline nounwind "target-cpu"="hexagonv68" "target-features"="+hvx-length128b,+hvxv68,+v68,+hvx-ieee-fp,-long-calls,-small-data" "unsafe-fp-math"="true" "use-soft-float"="false" }
59+
attributes #3 = { nounwind }

0 commit comments

Comments
 (0)