self.assertEqual(sim.gpr(i), SelectableInt(expected[i], 64))
def test_svstep_1(self):
- lst = SVP64Asm(["setvl 0, 0, 9, 1, 1, 1", # actual setvl (VF mode)
- "setvl 0, 0, 0, 1, 0, 0", # svstep
- "setvl 0, 0, 0, 1, 0, 0" # svstep
+ lst = SVP64Asm(["setvl 0, 0, 10, 1, 1, 1", # actual setvl (VF mode)
+ "setvl 0, 0, 1, 1, 0, 0", # svstep
+ "setvl 0, 0, 1, 1, 0, 0" # svstep
])
lst = list(lst)
def test_svstep_2(self):
"""tests svstep when it reaches VL
"""
- lst = SVP64Asm(["setvl 0, 0, 1, 1, 1, 1", # actual setvl (VF mode)
- "setvl. 0, 0, 0, 1, 0, 0", # svstep (Rc=1)
- "setvl. 0, 0, 0, 1, 0, 0" # svstep (Rc=1)
+ lst = SVP64Asm(["setvl 0, 0, 2, 1, 1, 1", # actual setvl (VF mode)
+ "setvl. 0, 0, 1, 1, 0, 0", # svstep (Rc=1)
+ "setvl. 0, 0, 1, 1, 0, 0" # svstep (Rc=1)
])
lst = list(lst)
def test_svstep_3(self):
"""tests svstep when it *doesn't* reach VL
"""
- lst = SVP64Asm(["setvl 0, 0, 2, 1, 1, 1", # actual setvl (VF mode)
- "setvl. 0, 0, 0, 1, 0, 0", # svstep (Rc=1)
- "setvl. 0, 0, 0, 1, 0, 0" # svstep (Rc=1)
+ lst = SVP64Asm(["setvl 0, 0, 3, 1, 1, 1", # actual setvl (VF mode)
+ "setvl. 0, 0, 1, 1, 0, 0", # svstep (Rc=1)
+ "setvl. 0, 0, 1, 1, 0, 0" # svstep (Rc=1)
])
lst = list(lst)
def test_setvl_1(self):
"""straight setvl, testing if VL and MVL are over-ridden
"""
- lst = SVP64Asm(["setvl 1, 0, 9, 0, 1, 1",
+ lst = SVP64Asm(["setvl 1, 0, 10, 0, 1, 1",
])
lst = list(lst)
* 1 = 5 + 9 => 0x5555 = 0x4321+0x1234
* 2 = 6 + 10 => 0x3334 = 0x2223+0x1111
"""
- isa = SVP64Asm(["setvl 3, 0, 1, 0, 1, 1",
+ isa = SVP64Asm(["setvl 3, 0, 2, 0, 1, 1",
'sv.add 1.v, 5.v, 9.v'
])
lst = list(isa)
def test_svstep_add_1(self):
"""tests svstep with an add, when it reaches VL
- lst = SVP64Asm(["setvl 3, 0, 1, 1, 1, 1",
+ lst = SVP64Asm(["setvl 3, 0, 2, 1, 1, 1",
'sv.add 1.v, 5.v, 9.v',
- "setvl. 0, 0, 0, 1, 0, 0",
+ "setvl. 0, 0, 1, 1, 0, 0",
'sv.add 1.v, 5.v, 9.v',
- "setvl. 0, 0, 0, 1, 0, 0"
+ "setvl. 0, 0, 1, 1, 0, 0"
])
sequence is as follows:
* setvl sets VL=2 but also "Vertical First" mode.
which now equals VL. srcstep and dststep are both set to
zero, and MSR[SVF] is cleared.
"""
- lst = SVP64Asm(["setvl 3, 0, 1, 1, 1, 1",
+ lst = SVP64Asm(["setvl 3, 0, 2, 1, 1, 1",
'sv.add 1.v, 5.v, 9.v',
- "setvl. 0, 0, 0, 1, 0, 0", # svstep
+ "setvl. 0, 0, 1, 1, 0, 0", # svstep
'sv.add 1.v, 5.v, 9.v',
- "setvl. 0, 0, 0, 1, 0, 0" # svstep
+ "setvl. 0, 0, 1, 1, 0, 0" # svstep
])
lst = list(lst)
def test_svstep_add_2(self):
"""tests svstep with a branch.
- lst = SVP64Asm(["setvl 3, 0, 1, 1, 1, 1",
+ lst = SVP64Asm(["setvl 3, 0, 2, 1, 1, 1",
'sv.add 1.v, 5.v, 9.v',
- "setvl. 0, 0, 0, 1, 0, 0",
+ "setvl. 0, 0, 1, 1, 0, 0",
"bc 4, 2, -0xc"
])
sequence is as follows:
first, then looping back and running all element 1, then all element 2
etc.
"""
- lst = SVP64Asm(["setvl 3, 0, 1, 1, 1, 1",
+ lst = SVP64Asm(["setvl 3, 0, 2, 1, 1, 1",
'sv.add 1.v, 5.v, 9.v',
- "setvl. 0, 0, 0, 1, 0, 0", # svstep - this is 64-bit!
+ "setvl. 0, 0, 1, 1, 0, 0", # svstep - this is 64-bit!
"bc 4, 2, -0xc" # branch to add (64-bit op so -0xc!)
])
lst = list(lst)
"svshape 8, 1, 1, 1, 1",
"svremap 31, 1, 0, 2, 0, 1",
"sv.ffmadds 0.v, 0.v, 0.v, 8.v",
- "setvl. 0, 0, 0, 1, 0, 0",
+ "setvl. 0, 0, 1, 1, 0, 0",
"bc 4, 2, -16"
])
runs a full in-place O(N log2 N) butterfly schedule for
"svshape 8, 1, 1, 1, 1",
"svremap 31, 1, 0, 2, 0, 1",
"sv.ffmadds 0.v, 0.v, 0.v, 8.v",
- "setvl. 0, 0, 0, 1, 0, 0",
+ "setvl. 0, 0, 1, 1, 0, 0",
"bc 4, 2, -16"
])
lst = list(lst)
# RA: scal RB: jl (S0) RC: n/a RT: jl (S0) EA: jh (S1)
"svremap 26, 0, 0, 0, 0, 1",
"sv.ffadds 0.v, 24, 0.v",
- "setvl. 0, 0, 0, 1, 0, 0",
+ "setvl. 0, 0, 1, 1, 0, 0",
"bc 4, 2, -28"
])
# RA: scal RB: jl (S0) RC: n/a RT: jl (S0) EA: jh (S1)
"svremap 26, 0, 0, 0, 0, 1",
"sv.ffadds 0.v, 24, 0.v",
- "setvl. 0, 0, 0, 1, 0, 0",
+ "setvl. 0, 0, 1, 1, 0, 0",
"bc 4, 2, -28"
])
lst = list(lst)
"sv.ffadds 8.v, 26, 8.v", # vh/vl +- tpim
# svstep loop
- "setvl. 0, 0, 0, 1, 0, 0",
+ "setvl. 0, 0, 1, 1, 0, 0",
"bc 4, 2, -84"
])
lst = list(lst)
def test_svstep_add_1(self):
"""tests svstep with an add, using scalar adds, when it reaches VL
- lst = SVP64Asm(["setvl 3, 0, 1, 1, 1, 1",
+ lst = SVP64Asm(["setvl 3, 0, 2, 1, 1, 1",
'sv.add 1, 5.v, 9.v',
'sv.addi 12.v, 1, 1',
- "setvl. 0, 0, 0, 1, 0, 0",
+ "setvl. 0, 0, 1, 1, 0, 0",
'sv.add 1, 5.v, 9.v',
'sv.addi 12.v, 1, 1',
- "setvl. 0, 0, 0, 1, 0, 0"
+ "setvl. 0, 0, 1, 1, 0, 0"
])
sequence is as follows:
store the result in r13 (0x3335).
"""
- lst = SVP64Asm(["setvl 3, 0, 1, 1, 1, 1",
+ lst = SVP64Asm(["setvl 3, 0, 2, 1, 1, 1",
'sv.add 1, 5.v, 9.v', # scalar dest (into r1)
'sv.addi 12.v, 1, 1', # scalar src (from r1)
- "setvl. 0, 0, 0, 1, 0, 0", # svstep
+ "setvl. 0, 0, 1, 1, 0, 0", # svstep
'sv.add 1, 5.v, 9.v', # again, scalar dest
'sv.addi 12.v, 1, 1', # but vector dest
- "setvl. 0, 0, 0, 1, 0, 0" # svstep
+ "setvl. 0, 0, 1, 1, 0, 0" # svstep
])
lst = list(lst)