Skip to content

Commit 0181eb1

Browse files
add missing zfh testcases (#572)
Co-authored-by: Umer Shahid <[email protected]>
1 parent fd7add2 commit 0181eb1

27 files changed

+10955
-0
lines changed
Lines changed: 353 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,353 @@
1+
2+
// -----------
3+
// This file was generated by riscv_ctg (https://github.com/riscv-software-src/riscv-ctg)
4+
// version : 0.12.2
5+
// timestamp : Fri Sep 13 19:12:48 2024 GMT
6+
// usage : riscv_ctg \
7+
// -- cgf // --cgf /home/pager/Desktop/work/riscv-ctg/sample_cgfs/dataset.cgf \
8+
// --cgf /home/pager/Desktop/work/riscv-ctg/sample_cgfs/sample_cgfs_fext/RV32H/rv32h_fcvt.d.h.cgf \
9+
\
10+
// -- xlen 32 \
11+
// -----------
12+
//
13+
// -----------
14+
// Copyright (c) 2020. RISC-V International. All rights reserved.
15+
// SPDX-License-Identifier: BSD-3-Clause
16+
// -----------
17+
//
18+
// This assembly file tests the fcvt.d.h instruction of the RISC-V RV32FD_Zicsr_Zfh,RV64FD_Zicsr_Zfh extension for the fcvt.d.h_b1 covergroup.
19+
//
20+
#include "model_test.h"
21+
#include "arch_test.h"
22+
RVTEST_ISA("RV32IFD_Zicsr_Zfh,RV64IFD_Zicsr_Zfh")
23+
24+
.section .text.init
25+
.globl rvtest_entry_point
26+
rvtest_entry_point:
27+
RVMODEL_BOOT
28+
RVTEST_CODE_BEGIN
29+
30+
#ifdef TEST_CASE_1
31+
32+
RVTEST_CASE(0,"//check ISA:=regex(.*I.*F.*D.*Zfh.*);def TEST_CASE_1=True;",fcvt.d.h_b1)
33+
34+
RVTEST_FP_ENABLE()
35+
RVTEST_VALBASEUPD(x3,test_dataset_0)
36+
RVTEST_SIGBASE(x1,signature_x1_1)
37+
38+
inst_0:
39+
// rs1 == rd, rs1==f31, rd==f31,fs1 == 0 and fe1 == 0x00 and fm1 == 0x000 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
40+
/* opcode: fcvt.d.h ; op1:f31; dest:f31; op1val:0x0; valaddr_reg:x3;
41+
val_offset:0*FLEN/8; correctval:??; testreg:x2;
42+
fcsr_val: 0 */
43+
TEST_FPSR_OP_NRM(fcvt.d.h, f31, f31, 0, 0, x3, 0*FLEN/8, x4, x1, x2)
44+
45+
inst_1:
46+
// rs1 != rd, rs1==f29, rd==f30,fs1 == 1 and fe1 == 0x00 and fm1 == 0x000 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
47+
/* opcode: fcvt.d.h ; op1:f29; dest:f30; op1val:0x8000; valaddr_reg:x3;
48+
val_offset:1*FLEN/8; correctval:??; testreg:x2;
49+
fcsr_val: 0 */
50+
TEST_FPSR_OP_NRM(fcvt.d.h, f30, f29, 0, 0, x3, 1*FLEN/8, x4, x1, x2)
51+
52+
inst_2:
53+
// rs1==f30, rd==f29,fs1 == 0 and fe1 == 0x00 and fm1 == 0x001 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
54+
/* opcode: fcvt.d.h ; op1:f30; dest:f29; op1val:0x1; valaddr_reg:x3;
55+
val_offset:2*FLEN/8; correctval:??; testreg:x2;
56+
fcsr_val: 0 */
57+
TEST_FPSR_OP_NRM(fcvt.d.h, f29, f30, 0, 0, x3, 2*FLEN/8, x4, x1, x2)
58+
59+
inst_3:
60+
// rs1==f27, rd==f28,fs1 == 1 and fe1 == 0x00 and fm1 == 0x001 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
61+
/* opcode: fcvt.d.h ; op1:f27; dest:f28; op1val:0x8001; valaddr_reg:x3;
62+
val_offset:3*FLEN/8; correctval:??; testreg:x2;
63+
fcsr_val: 0 */
64+
TEST_FPSR_OP_NRM(fcvt.d.h, f28, f27, 0, 0, x3, 3*FLEN/8, x4, x1, x2)
65+
66+
inst_4:
67+
// rs1==f28, rd==f27,fs1 == 0 and fe1 == 0x00 and fm1 == 0x002 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
68+
/* opcode: fcvt.d.h ; op1:f28; dest:f27; op1val:0x2; valaddr_reg:x3;
69+
val_offset:4*FLEN/8; correctval:??; testreg:x2;
70+
fcsr_val: 0 */
71+
TEST_FPSR_OP_NRM(fcvt.d.h, f27, f28, 0, 0, x3, 4*FLEN/8, x4, x1, x2)
72+
73+
inst_5:
74+
// rs1==f25, rd==f26,fs1 == 1 and fe1 == 0x00 and fm1 == 0x3fe and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
75+
/* opcode: fcvt.d.h ; op1:f25; dest:f26; op1val:0x83fe; valaddr_reg:x3;
76+
val_offset:5*FLEN/8; correctval:??; testreg:x2;
77+
fcsr_val: 0 */
78+
TEST_FPSR_OP_NRM(fcvt.d.h, f26, f25, 0, 0, x3, 5*FLEN/8, x4, x1, x2)
79+
80+
inst_6:
81+
// rs1==f26, rd==f25,fs1 == 0 and fe1 == 0x00 and fm1 == 0x3ff and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
82+
/* opcode: fcvt.d.h ; op1:f26; dest:f25; op1val:0x3ff; valaddr_reg:x3;
83+
val_offset:6*FLEN/8; correctval:??; testreg:x2;
84+
fcsr_val: 0 */
85+
TEST_FPSR_OP_NRM(fcvt.d.h, f25, f26, 0, 0, x3, 6*FLEN/8, x4, x1, x2)
86+
87+
inst_7:
88+
// rs1==f23, rd==f24,fs1 == 1 and fe1 == 0x00 and fm1 == 0x3ff and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
89+
/* opcode: fcvt.d.h ; op1:f23; dest:f24; op1val:0x83ff; valaddr_reg:x3;
90+
val_offset:7*FLEN/8; correctval:??; testreg:x2;
91+
fcsr_val: 0 */
92+
TEST_FPSR_OP_NRM(fcvt.d.h, f24, f23, 0, 0, x3, 7*FLEN/8, x4, x1, x2)
93+
94+
inst_8:
95+
// rs1==f24, rd==f23,fs1 == 0 and fe1 == 0x01 and fm1 == 0x000 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
96+
/* opcode: fcvt.d.h ; op1:f24; dest:f23; op1val:0x400; valaddr_reg:x3;
97+
val_offset:8*FLEN/8; correctval:??; testreg:x2;
98+
fcsr_val: 0 */
99+
TEST_FPSR_OP_NRM(fcvt.d.h, f23, f24, 0, 0, x3, 8*FLEN/8, x4, x1, x2)
100+
101+
inst_9:
102+
// rs1==f21, rd==f22,fs1 == 1 and fe1 == 0x01 and fm1 == 0x000 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
103+
/* opcode: fcvt.d.h ; op1:f21; dest:f22; op1val:0x8400; valaddr_reg:x3;
104+
val_offset:9*FLEN/8; correctval:??; testreg:x2;
105+
fcsr_val: 0 */
106+
TEST_FPSR_OP_NRM(fcvt.d.h, f22, f21, 0, 0, x3, 9*FLEN/8, x4, x1, x2)
107+
108+
inst_10:
109+
// rs1==f22, rd==f21,fs1 == 0 and fe1 == 0x01 and fm1 == 0x001 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
110+
/* opcode: fcvt.d.h ; op1:f22; dest:f21; op1val:0x401; valaddr_reg:x3;
111+
val_offset:10*FLEN/8; correctval:??; testreg:x2;
112+
fcsr_val: 0 */
113+
TEST_FPSR_OP_NRM(fcvt.d.h, f21, f22, 0, 0, x3, 10*FLEN/8, x4, x1, x2)
114+
115+
inst_11:
116+
// rs1==f19, rd==f20,fs1 == 1 and fe1 == 0x01 and fm1 == 0x055 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
117+
/* opcode: fcvt.d.h ; op1:f19; dest:f20; op1val:0x8455; valaddr_reg:x3;
118+
val_offset:11*FLEN/8; correctval:??; testreg:x2;
119+
fcsr_val: 0 */
120+
TEST_FPSR_OP_NRM(fcvt.d.h, f20, f19, 0, 0, x3, 11*FLEN/8, x4, x1, x2)
121+
122+
inst_12:
123+
// rs1==f20, rd==f19,fs1 == 0 and fe1 == 0x1e and fm1 == 0x3ff and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
124+
/* opcode: fcvt.d.h ; op1:f20; dest:f19; op1val:0x7bff; valaddr_reg:x3;
125+
val_offset:12*FLEN/8; correctval:??; testreg:x2;
126+
fcsr_val: 0 */
127+
TEST_FPSR_OP_NRM(fcvt.d.h, f19, f20, 0, 0, x3, 12*FLEN/8, x4, x1, x2)
128+
129+
inst_13:
130+
// rs1==f17, rd==f18,fs1 == 1 and fe1 == 0x1e and fm1 == 0x3ff and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
131+
/* opcode: fcvt.d.h ; op1:f17; dest:f18; op1val:0xfbff; valaddr_reg:x3;
132+
val_offset:13*FLEN/8; correctval:??; testreg:x2;
133+
fcsr_val: 0 */
134+
TEST_FPSR_OP_NRM(fcvt.d.h, f18, f17, 0, 0, x3, 13*FLEN/8, x4, x1, x2)
135+
136+
inst_14:
137+
// rs1==f18, rd==f17,fs1 == 0 and fe1 == 0x1f and fm1 == 0x000 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
138+
/* opcode: fcvt.d.h ; op1:f18; dest:f17; op1val:0x7c00; valaddr_reg:x3;
139+
val_offset:14*FLEN/8; correctval:??; testreg:x2;
140+
fcsr_val: 0 */
141+
TEST_FPSR_OP_NRM(fcvt.d.h, f17, f18, 0, 0, x3, 14*FLEN/8, x4, x1, x2)
142+
143+
inst_15:
144+
// rs1==f15, rd==f16,fs1 == 1 and fe1 == 0x1f and fm1 == 0x000 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
145+
/* opcode: fcvt.d.h ; op1:f15; dest:f16; op1val:0xfc00; valaddr_reg:x3;
146+
val_offset:15*FLEN/8; correctval:??; testreg:x2;
147+
fcsr_val: 0 */
148+
TEST_FPSR_OP_NRM(fcvt.d.h, f16, f15, 0, 0, x3, 15*FLEN/8, x4, x1, x2)
149+
150+
inst_16:
151+
// rs1==f16, rd==f15,fs1 == 0 and fe1 == 0x1f and fm1 == 0x200 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
152+
/* opcode: fcvt.d.h ; op1:f16; dest:f15; op1val:0x7e00; valaddr_reg:x3;
153+
val_offset:16*FLEN/8; correctval:??; testreg:x2;
154+
fcsr_val: 0 */
155+
TEST_FPSR_OP_NRM(fcvt.d.h, f15, f16, 0, 0, x3, 16*FLEN/8, x4, x1, x2)
156+
157+
inst_17:
158+
// rs1==f13, rd==f14,fs1 == 1 and fe1 == 0x1f and fm1 == 0x200 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
159+
/* opcode: fcvt.d.h ; op1:f13; dest:f14; op1val:0xfe00; valaddr_reg:x3;
160+
val_offset:17*FLEN/8; correctval:??; testreg:x2;
161+
fcsr_val: 0 */
162+
TEST_FPSR_OP_NRM(fcvt.d.h, f14, f13, 0, 0, x3, 17*FLEN/8, x4, x1, x2)
163+
164+
inst_18:
165+
// rs1==f14, rd==f13,fs1 == 0 and fe1 == 0x1f and fm1 == 0x201 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
166+
/* opcode: fcvt.d.h ; op1:f14; dest:f13; op1val:0x7e01; valaddr_reg:x3;
167+
val_offset:18*FLEN/8; correctval:??; testreg:x2;
168+
fcsr_val: 0 */
169+
TEST_FPSR_OP_NRM(fcvt.d.h, f13, f14, 0, 0, x3, 18*FLEN/8, x4, x1, x2)
170+
171+
inst_19:
172+
// rs1==f11, rd==f12,fs1 == 1 and fe1 == 0x1f and fm1 == 0x255 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
173+
/* opcode: fcvt.d.h ; op1:f11; dest:f12; op1val:0xfe55; valaddr_reg:x3;
174+
val_offset:19*FLEN/8; correctval:??; testreg:x2;
175+
fcsr_val: 0 */
176+
TEST_FPSR_OP_NRM(fcvt.d.h, f12, f11, 0, 0, x3, 19*FLEN/8, x4, x1, x2)
177+
178+
inst_20:
179+
// rs1==f12, rd==f11,fs1 == 0 and fe1 == 0x1f and fm1 == 0x001 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
180+
/* opcode: fcvt.d.h ; op1:f12; dest:f11; op1val:0x7c01; valaddr_reg:x3;
181+
val_offset:20*FLEN/8; correctval:??; testreg:x2;
182+
fcsr_val: 0 */
183+
TEST_FPSR_OP_NRM(fcvt.d.h, f11, f12, 0, 0, x3, 20*FLEN/8, x4, x1, x2)
184+
185+
inst_21:
186+
// rs1==f9, rd==f10,fs1 == 1 and fe1 == 0x1f and fm1 == 0x155 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
187+
/* opcode: fcvt.d.h ; op1:f9; dest:f10; op1val:0xfd55; valaddr_reg:x3;
188+
val_offset:21*FLEN/8; correctval:??; testreg:x2;
189+
fcsr_val: 0 */
190+
TEST_FPSR_OP_NRM(fcvt.d.h, f10, f9, 0, 0, x3, 21*FLEN/8, x4, x1, x2)
191+
192+
inst_22:
193+
// rs1==f10, rd==f9,fs1 == 0 and fe1 == 0x0f and fm1 == 0x000 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
194+
/* opcode: fcvt.d.h ; op1:f10; dest:f9; op1val:0x3c00; valaddr_reg:x3;
195+
val_offset:22*FLEN/8; correctval:??; testreg:x2;
196+
fcsr_val: 0 */
197+
TEST_FPSR_OP_NRM(fcvt.d.h, f9, f10, 0, 0, x3, 22*FLEN/8, x4, x1, x2)
198+
199+
inst_23:
200+
// rs1==f7, rd==f8,fs1 == 1 and fe1 == 0x0f and fm1 == 0x000 and fcsr == 0x0 and rm_val == 7 and rs1_nan_prefix == 0xffff
201+
/* opcode: fcvt.d.h ; op1:f7; dest:f8; op1val:0xbc00; valaddr_reg:x3;
202+
val_offset:23*FLEN/8; correctval:??; testreg:x2;
203+
fcsr_val: 0 */
204+
TEST_FPSR_OP_NRM(fcvt.d.h, f8, f7, 0, 0, x3, 23*FLEN/8, x4, x1, x2)
205+
206+
inst_24:
207+
// rs1==f8, rd==f7,
208+
/* opcode: fcvt.d.h ; op1:f8; dest:f7; op1val:0x0; valaddr_reg:x3;
209+
val_offset:24*FLEN/8; correctval:??; testreg:x2;
210+
fcsr_val: 0 */
211+
TEST_FPSR_OP_NRM(fcvt.d.h, f7, f8, 0, 0, x3, 24*FLEN/8, x4, x1, x2)
212+
213+
inst_25:
214+
// rs1==f5, rd==f6,
215+
/* opcode: fcvt.d.h ; op1:f5; dest:f6; op1val:0x0; valaddr_reg:x3;
216+
val_offset:25*FLEN/8; correctval:??; testreg:x2;
217+
fcsr_val: 0 */
218+
TEST_FPSR_OP_NRM(fcvt.d.h, f6, f5, 0, 0, x3, 25*FLEN/8, x4, x1, x2)
219+
220+
inst_26:
221+
// rs1==f6, rd==f5,
222+
/* opcode: fcvt.d.h ; op1:f6; dest:f5; op1val:0x0; valaddr_reg:x3;
223+
val_offset:26*FLEN/8; correctval:??; testreg:x2;
224+
fcsr_val: 0 */
225+
TEST_FPSR_OP_NRM(fcvt.d.h, f5, f6, 0, 0, x3, 26*FLEN/8, x4, x1, x2)
226+
227+
inst_27:
228+
// rs1==f3, rd==f4,
229+
/* opcode: fcvt.d.h ; op1:f3; dest:f4; op1val:0x0; valaddr_reg:x3;
230+
val_offset:27*FLEN/8; correctval:??; testreg:x2;
231+
fcsr_val: 0 */
232+
TEST_FPSR_OP_NRM(fcvt.d.h, f4, f3, 0, 0, x3, 27*FLEN/8, x4, x1, x2)
233+
234+
inst_28:
235+
// rs1==f4, rd==f3,
236+
/* opcode: fcvt.d.h ; op1:f4; dest:f3; op1val:0x0; valaddr_reg:x3;
237+
val_offset:28*FLEN/8; correctval:??; testreg:x2;
238+
fcsr_val: 0 */
239+
TEST_FPSR_OP_NRM(fcvt.d.h, f3, f4, 0, 0, x3, 28*FLEN/8, x4, x1, x2)
240+
241+
inst_29:
242+
// rs1==f1, rd==f2,
243+
/* opcode: fcvt.d.h ; op1:f1; dest:f2; op1val:0x0; valaddr_reg:x3;
244+
val_offset:29*FLEN/8; correctval:??; testreg:x2;
245+
fcsr_val: 0 */
246+
TEST_FPSR_OP_NRM(fcvt.d.h, f2, f1, 0, 0, x3, 29*FLEN/8, x4, x1, x2)
247+
248+
inst_30:
249+
// rs1==f2, rd==f1,
250+
/* opcode: fcvt.d.h ; op1:f2; dest:f1; op1val:0x0; valaddr_reg:x3;
251+
val_offset:30*FLEN/8; correctval:??; testreg:x2;
252+
fcsr_val: 0 */
253+
TEST_FPSR_OP_NRM(fcvt.d.h, f1, f2, 0, 0, x3, 30*FLEN/8, x4, x1, x2)
254+
255+
inst_31:
256+
// rs1==f0,
257+
/* opcode: fcvt.d.h ; op1:f0; dest:f31; op1val:0x0; valaddr_reg:x3;
258+
val_offset:31*FLEN/8; correctval:??; testreg:x2;
259+
fcsr_val: 0 */
260+
TEST_FPSR_OP_NRM(fcvt.d.h, f31, f0, 0, 0, x3, 31*FLEN/8, x4, x1, x2)
261+
262+
inst_32:
263+
// rd==f0,
264+
/* opcode: fcvt.d.h ; op1:f31; dest:f0; op1val:0x0; valaddr_reg:x3;
265+
val_offset:32*FLEN/8; correctval:??; testreg:x2;
266+
fcsr_val: 0 */
267+
TEST_FPSR_OP_NRM(fcvt.d.h, f0, f31, 0, 0, x3, 32*FLEN/8, x4, x1, x2)
268+
#endif
269+
270+
271+
RVTEST_CODE_END
272+
RVMODEL_HALT
273+
274+
RVTEST_DATA_BEGIN
275+
.align 4
276+
rvtest_data:
277+
.word 0xbabecafe
278+
.word 0xabecafeb
279+
.word 0xbecafeba
280+
.word 0xecafebab
281+
test_dataset_0:
282+
NAN_BOXED(0,16,FLEN)
283+
NAN_BOXED(32768,16,FLEN)
284+
NAN_BOXED(1,16,FLEN)
285+
NAN_BOXED(32769,16,FLEN)
286+
NAN_BOXED(2,16,FLEN)
287+
NAN_BOXED(33790,16,FLEN)
288+
NAN_BOXED(1023,16,FLEN)
289+
NAN_BOXED(33791,16,FLEN)
290+
NAN_BOXED(1024,16,FLEN)
291+
NAN_BOXED(33792,16,FLEN)
292+
NAN_BOXED(1025,16,FLEN)
293+
NAN_BOXED(33877,16,FLEN)
294+
NAN_BOXED(31743,16,FLEN)
295+
NAN_BOXED(64511,16,FLEN)
296+
NAN_BOXED(31744,16,FLEN)
297+
NAN_BOXED(64512,16,FLEN)
298+
NAN_BOXED(32256,16,FLEN)
299+
NAN_BOXED(65024,16,FLEN)
300+
NAN_BOXED(32257,16,FLEN)
301+
NAN_BOXED(65109,16,FLEN)
302+
NAN_BOXED(31745,16,FLEN)
303+
NAN_BOXED(64853,16,FLEN)
304+
NAN_BOXED(15360,16,FLEN)
305+
NAN_BOXED(48128,16,FLEN)
306+
NAN_BOXED(0,16,FLEN)
307+
NAN_BOXED(0,16,FLEN)
308+
NAN_BOXED(0,16,FLEN)
309+
NAN_BOXED(0,16,FLEN)
310+
NAN_BOXED(0,16,FLEN)
311+
NAN_BOXED(0,16,FLEN)
312+
NAN_BOXED(0,16,FLEN)
313+
NAN_BOXED(0,16,FLEN)
314+
NAN_BOXED(0,16,FLEN)
315+
RVTEST_DATA_END
316+
317+
RVMODEL_DATA_BEGIN
318+
rvtest_sig_begin:
319+
sig_begin_canary:
320+
CANARY;
321+
322+
323+
324+
signature_x1_0:
325+
.fill 0*((SIGALIGN)/4),4,0xdeadbeef
326+
327+
328+
signature_x1_1:
329+
.fill 66*((SIGALIGN)/4),4,0xdeadbeef
330+
331+
#ifdef rvtest_mtrap_routine
332+
tsig_begin_canary:
333+
CANARY;
334+
335+
mtrap_sigptr:
336+
.fill 64*XLEN/32,4,0xdeadbeef
337+
338+
tsig_end_canary:
339+
CANARY;
340+
#endif
341+
342+
#ifdef rvtest_gpr_save
343+
344+
gpr_save:
345+
.fill 32*XLEN/32,4,0xdeadbeef
346+
347+
#endif
348+
349+
350+
sig_end_canary:
351+
CANARY;
352+
rvtest_sig_end:
353+
RVMODEL_DATA_END

0 commit comments

Comments
 (0)