Skip to content

Commit

Permalink
[AIE2] Update instr. postinc LDA 3D to use itinerary based on regClas…
Browse files Browse the repository at this point in the history
…s, partWord postinc load_3d to use II_LDA_3D_R
  • Loading branch information
krishnamtibrewala committed Sep 5, 2024
1 parent a119b3d commit ce9e492
Show file tree
Hide file tree
Showing 9 changed files with 280 additions and 1 deletion.
7 changes: 6 additions & 1 deletion llvm/lib/Target/AIE/AIE2GenInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,19 @@ let mayLoad = true, mayStore = false in {
}

let Itinerary = II_LDA_POST_3D, Constraints = "$ptr = $ptr_out" in {
let DecoderMethod = "DecodeLDA_3D_Instruction" in {
let ItineraryRegPairs = [ItinRegClassPair<II_LDA_POST_3D_R,eR>, ItinRegClassPair<II_LDA_POST_3D_P,eP>,
ItinRegClassPair<II_LDA_POST_3D_M,eM>, ItinRegClassPair<II_LDA_POST_3D_DC,eDC>,
ItinRegClassPair<II_LDA_POST_3D_DJ,eDJ>, ItinRegClassPair<II_LDA_POST_3D_DN,eDN>],
DecoderMethod = "DecodeLDA_3D_Instruction" in {
def LDA_3D_dms_lda : AIE2_dms_lda_inst_lda<
(outs OP_mLdaScl:$mLdaScl, eP:$ptr_out, eDC:$count_lo_out, eDC:$count_hi_out),
(ins eP:$ptr, eDS:$mod),
"lda.3d", "$mLdaScl, [$ptr], $mod">,
AIE2_ag_all__ag_pstm_3d;
}
}

let Itinerary = II_LDA_POST_3D_R, Constraints = "$ptr = $ptr_out" in {
let DecoderMethod = "DecodeLDA_3D_HBInstruction" in {

def LDA_3D_S8_dmhb_lda : AIE2_dmhb_lda_inst_lda<0b00,
Expand Down
30 changes: 30 additions & 0 deletions llvm/lib/Target/AIE/AIE2Schedule.td
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ def II_LDA_POST_2D_M : InstrItinClass;
def II_LDA_POST_2D_P : InstrItinClass;
def II_LDA_POST_2D_R : InstrItinClass;
def II_LDA_POST_3D : InstrItinClass;
def II_LDA_POST_3D_DC : InstrItinClass;
def II_LDA_POST_3D_DJ : InstrItinClass;
def II_LDA_POST_3D_DN : InstrItinClass;
def II_LDA_POST_3D_M : InstrItinClass;
def II_LDA_POST_3D_P : InstrItinClass;
def II_LDA_POST_3D_R : InstrItinClass;
def II_LDA_TM : InstrItinClass;
def II_LSHL : InstrItinClass;
def II_LT : InstrItinClass;
Expand Down Expand Up @@ -537,6 +543,30 @@ MemInstrItinData<II_LDA_POST_3D,
PrefixCycle<DN_WM_PORT>, PrefixCycle<DC_WM_PORT>, SimpleCycle<R_WA_PORT>],
[7,1,1,1,1,1],
MemoryCycles<[5]>>,
MemInstrItinData<II_LDA_POST_3D_DC,
[AvoidPartWordStore, EmptyCycles<1>, SimpleCycle<LOAD_UNIT_A>,
EmptyCycles<4>, SimpleCycle<DC_WM_PORT>], [7,1,1,1,1,1],
MemoryCycles<[5]>>,
MemInstrItinData<II_LDA_POST_3D_DJ,
[AvoidPartWordStore, EmptyCycles<1>, SimpleCycle<LOAD_UNIT_A>,
EmptyCycles<4>, SimpleCycle<DJ_WM_PORT>], [7,1,1,1,1,1],
MemoryCycles<[5]>>,
MemInstrItinData<II_LDA_POST_3D_DN,
[AvoidPartWordStore, EmptyCycles<1>, SimpleCycle<LOAD_UNIT_A>,
EmptyCycles<4>, SimpleCycle<DN_WM_PORT>], [7,1,1,1,1,1],
MemoryCycles<[5]>>,
MemInstrItinData<II_LDA_POST_3D_M,
[AvoidPartWordStore, EmptyCycles<1>, SimpleCycle<LOAD_UNIT_A>,
EmptyCycles<4>, SimpleCycle<M_WM_PORT>], [7,1,1,1,1,1],
MemoryCycles<[5]>>,
MemInstrItinData<II_LDA_POST_3D_P,
[AvoidPartWordStore, EmptyCycles<1>, SimpleCycle<LOAD_UNIT_A>,
EmptyCycles<4>, PrefixCycle<DC_WM_PORT>, SimpleCycle<P_WM_PORT>], [7,1,1,1,1,1],
MemoryCycles<[5]>>,
MemInstrItinData<II_LDA_POST_3D_R,
[AvoidPartWordStore, EmptyCycles<1>, SimpleCycle<LOAD_UNIT_A>,
EmptyCycles<4>, SimpleCycle<R_WA_PORT>], [7,1,1,1,1,1],
MemoryCycles<[5]>>,
MemInstrItinData<II_LDA_TM,
[SimpleCycle<PROC_BUS>, SimpleCycle<LOAD_UNIT_A>, EmptyCycles<4>,
SimpleCycle<R_WA_PORT>],
Expand Down
30 changes: 30 additions & 0 deletions llvm/test/CodeGen/AIE/aie2/schedule/resource/dc_wm.mir
Original file line number Diff line number Diff line change
Expand Up @@ -598,3 +598,33 @@ body: |
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
...

---
name: lda3DPost_to_DC
alignment: 16
body: |
bb.0.entry:
; CHECK-LABEL: name: lda3DPost_to_DC
; CHECK: BUNDLE implicit-def $dc1, implicit-def $p0, implicit-def $dc0, implicit-def $dc4, implicit-def $r1, implicit-def $p2, implicit killed $p0, implicit killed $d0_3d, implicit $r4 {
; CHECK-NEXT: $dc1, $p0, $dc0, $dc4 = LDA_3D_dms_lda killed $p0, killed $d0_3d
; CHECK-NEXT: $r1 = MOVX_alu_cg 0
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: }
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl killed $r4
$dc1, $p0, $dc0, $dc4 = LDA_3D_dms_lda $p0, $d0_3d
$r1 = MOVX_alu_cg 0
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
...
32 changes: 32 additions & 0 deletions llvm/test/CodeGen/AIE/aie2/schedule/resource/dj_wm.mir
Original file line number Diff line number Diff line change
Expand Up @@ -569,3 +569,35 @@ body: |
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
...

---
name: lda3DPost_to_DJ
alignment: 16
body: |
bb.0.entry:
; CHECK-LABEL: name: lda3DPost_to_DJ
; CHECK: BUNDLE implicit-def $dj1, implicit-def $p0, implicit-def $dc0, implicit-def $dc4, implicit-def $r1, implicit-def $p2, implicit killed $p0, implicit killed $d0_3d, implicit $r4 {
; CHECK-NEXT: $dj1, $p0, $dc0, $dc4 = LDA_3D_dms_lda killed $p0, killed $d0_3d
; CHECK-NEXT: $r1 = MOVX_alu_cg 0
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: }
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $r2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl killed $r4
$dj1, $p0, $dc0, $dc4 = LDA_3D_dms_lda $p0, $d0_3d
$r1 = MOVX_alu_cg 0
$r2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
...
32 changes: 32 additions & 0 deletions llvm/test/CodeGen/AIE/aie2/schedule/resource/dn_wm.mir
Original file line number Diff line number Diff line change
Expand Up @@ -577,3 +577,35 @@ body: |
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
...

---
name: lda3DPost_to_DN
alignment: 16
body: |
bb.0.entry:
; CHECK-LABEL: name: lda3DPost_to_DN
; CHECK: BUNDLE implicit-def $dn1, implicit-def $p0, implicit-def $dc0, implicit-def $dc4, implicit-def $r1, implicit-def $p2, implicit killed $p0, implicit killed $d0_3d, implicit $r4 {
; CHECK-NEXT: $dn1, $p0, $dc0, $dc4 = LDA_3D_dms_lda killed $p0, killed $d0_3d
; CHECK-NEXT: $r1 = MOVX_alu_cg 0
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: }
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $r2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl killed $r4
$dn1, $p0, $dc0, $dc4 = LDA_3D_dms_lda $p0, $d0_3d
$r1 = MOVX_alu_cg 0
$r2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
...
32 changes: 32 additions & 0 deletions llvm/test/CodeGen/AIE/aie2/schedule/resource/m_wm.mir
Original file line number Diff line number Diff line change
Expand Up @@ -597,3 +597,35 @@ body: |
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
...

---
name: lda3DPost_to_M
alignment: 16
body: |
bb.0.entry:
; CHECK-LABEL: name: lda3DPost_to_M
; CHECK: BUNDLE implicit-def $m1, implicit-def $p0, implicit-def $dc0, implicit-def $dc4, implicit-def $r1, implicit-def $p2, implicit killed $p0, implicit killed $d0_3d, implicit $r4 {
; CHECK-NEXT: $m1, $p0, $dc0, $dc4 = LDA_3D_dms_lda killed $p0, killed $d0_3d
; CHECK-NEXT: $r1 = MOVX_alu_cg 0
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: }
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $dj0 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl killed $r4
$m1, $p0, $dc0, $dc4 = LDA_3D_dms_lda $p0, $d0_3d
$r1 = MOVX_alu_cg 0
$dj0 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
...
32 changes: 32 additions & 0 deletions llvm/test/CodeGen/AIE/aie2/schedule/resource/p_rm.mir
Original file line number Diff line number Diff line change
Expand Up @@ -676,3 +676,35 @@ body: |
$m2 = MOV_mv_scl $r4
$m2 = MOV_mv_scl $r4
...

---
name: lda3DPost_to_P
alignment: 16
body: |
bb.0.entry:
; CHECK-LABEL: name: lda3DPost_to_P
; CHECK: BUNDLE implicit-def $p2, implicit-def $p0, implicit-def $dc0, implicit-def $dc4, implicit-def $r1, implicit-def $p1, implicit killed $p0, implicit killed $d0_3d, implicit $r4 {
; CHECK-NEXT: $p2, $p0, $dc0, $dc4 = LDA_3D_dms_lda killed $p0, killed $d0_3d
; CHECK-NEXT: $r1 = MOVX_alu_cg 0
; CHECK-NEXT: $p1 = MOV_mv_scl $r4
; CHECK-NEXT: }
; CHECK-NEXT: $p1 = MOV_mv_scl $r4
; CHECK-NEXT: $p1 = MOV_mv_scl $r4
; CHECK-NEXT: $p1 = MOV_mv_scl $r4
; CHECK-NEXT: $p1 = MOV_mv_scl $r4
; CHECK-NEXT: $p1 = MOV_mv_scl $r4
; CHECK-NEXT: $r0 = MOV_mv_scl $r4
; CHECK-NEXT: $p1 = MOV_mv_scl $r4
; CHECK-NEXT: $p1 = MOV_mv_scl killed $r4
$p2, $p0, $dc0, $dc4 = LDA_3D_dms_lda $p0, $d0_3d
$r1 = MOVX_alu_cg 0
$r0 = MOV_mv_scl $r4
$p1 = MOV_mv_scl $r4
$p1 = MOV_mv_scl $r4
$p1 = MOV_mv_scl $r4
$p1 = MOV_mv_scl $r4
$p1 = MOV_mv_scl $r4
$p1 = MOV_mv_scl $r4
$p1 = MOV_mv_scl $r4
$p1 = MOV_mv_scl $r4
...
22 changes: 22 additions & 0 deletions llvm/test/CodeGen/AIE/aie2/schedule/resource/p_wm.mir
Original file line number Diff line number Diff line change
Expand Up @@ -444,3 +444,25 @@ body: |
$r2 = MOV_mv_scl $r4
$r2 = MOV_mv_scl $r4
...

---
name: lda3DPost_to_P
alignment: 16
body: |
bb.0.entry:
; CHECK-LABEL: name: lda3DPost_to_P
; CHECK: BUNDLE implicit-def $p2, implicit-def $p0, implicit-def $dc0, implicit-def $dc4, implicit-def $r1, implicit-def $dj0, implicit killed $p0, implicit killed $d0_3d, implicit killed $r4 {
; CHECK-NEXT: $p2, $p0, $dc0, $dc4 = LDA_3D_dms_lda killed $p0, killed $d0_3d
; CHECK-NEXT: $r1 = MOVX_alu_cg 0
; CHECK-NEXT: $dj0 = MOV_mv_scl killed $r4
; CHECK-NEXT: }
; CHECK-NEXT: NOP
; CHECK-NEXT: NOP
; CHECK-NEXT: NOP
; CHECK-NEXT: NOP
; CHECK-NEXT: NOP
; CHECK-NEXT: NOP
$p2, $p0, $dc0, $dc4 = LDA_3D_dms_lda $p0, $d0_3d
$r1 = MOVX_alu_cg 0
$dj0 = MOV_mv_scl $r4
...
64 changes: 64 additions & 0 deletions llvm/test/CodeGen/AIE/aie2/schedule/resource/r_wa.mir
Original file line number Diff line number Diff line change
Expand Up @@ -480,3 +480,67 @@ body: |
$r2 = MOV_mv_scl $r4
$r2 = MOV_mv_scl $r4
...

---
name: lda3DPost_to_R
alignment: 16
body: |
bb.0.entry:
; CHECK-LABEL: name: lda3DPost_to_R
; CHECK: BUNDLE implicit-def $r3, implicit-def $p0, implicit-def $dc0, implicit-def $dc4, implicit-def $r1, implicit-def $p2, implicit killed $p0, implicit killed $d0_3d, implicit $r4 {
; CHECK-NEXT: $r3, $p0, $dc0, $dc4 = LDA_3D_dms_lda killed $p0, killed $d0_3d
; CHECK-NEXT: $r1 = MOVX_alu_cg 0
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: }
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $dj0 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl killed $r4
$r3, $p0, $dc0, $dc4 = LDA_3D_dms_lda $p0, $d0_3d
$r1 = MOVX_alu_cg 0
$dj0 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
...

---
name: lda3DPost_to_R_MOV_to_R
alignment: 16
body: |
bb.0.entry:
; CHECK-LABEL: name: lda3DPost_to_R_MOV_to_R
; CHECK: BUNDLE implicit-def $r3, implicit-def $p0, implicit-def $dc0, implicit-def $dc4, implicit-def $r1, implicit-def $p2, implicit killed $p0, implicit killed $d0_3d, implicit $r4 {
; CHECK-NEXT: $r3, $p0, $dc0, $dc4 = LDA_3D_dms_lda killed $p0, killed $d0_3d
; CHECK-NEXT: $r1 = MOVX_alu_cg 0
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: }
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl $r4
; CHECK-NEXT: $p1 = MOV_mv_scl $r4
; CHECK-NEXT: $p2 = MOV_mv_scl killed $r4
$r3, $p0, $dc0, $dc4 = LDA_3D_dms_lda $p0, $d0_3d
$r1 = MOVX_alu_cg 0
$p1 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
$p2 = MOV_mv_scl $r4
...

0 comments on commit ce9e492

Please sign in to comment.