Skip to content

Commit

Permalink
Update checker for gnu auto generated test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
yulong18 authored and eopXD committed Oct 11, 2023
1 parent e67d66d commit 66cfdc2
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 22 deletions.
2 changes: 1 addition & 1 deletion auto-generated/gnu-api-tests/vcreate.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,4 +910,4 @@ vuint64m4x2_t test_vcreate_v_u64m4x2(vuint64m4_t v0, vuint64m4_t v1) {
return __riscv_vcreate_v_u64m4x2(v0, v1);
}

/* { dg-final { scan-assembler-times {vseti?vli\s+[a-z0-9]+,\s*[a-z0-9]+,\s*e[0-9]+,\s*mf?[1248],\s*t[au],\s*m[au]\s+vcreate\.[ivxfswum.]+\s+} 226 } } */
/* { dg-final { scan-assembler-times {vl[124]re[0-9]*\.v\s+v[124],0\([a-z0-9]*\)\s+vs[124]r\.+[ivxfswum.]*\s+} 506 } } */
2 changes: 1 addition & 1 deletion auto-generated/gnu-api-tests/vget.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,4 +1174,4 @@ vuint64m4_t test_vget_v_u64m4x2_u64m4(vuint64m4x2_t src, size_t index) {
return __riscv_vget_v_u64m4x2_u64m4(src, 0);
}

/* { dg-final { scan-assembler-times {vl[124]re[0-9]*\.v\s+v[124],0\([a-z0-9]*\)\s+vs[124]r\.+[ivxfswum.]*\s+} 292 } } */
/* { dg-final { scan-assembler-times {vl[124]re[0-9]*\.v\s+v[124],0\([a-z0-9]*\)\s+vs[124]r\.+[ivxfswum.]*\s+} 187 } } */
2 changes: 1 addition & 1 deletion auto-generated/gnu-api-tests/vmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,4 +770,4 @@ vuint64m8_t test_vmv_s_x_u64m8(uint64_t src, size_t vl) {
return __riscv_vmv_s_x_u64m8(src, vl);
}

/* { dg-final { scan-assembler-times {v[ml][s]*[ve][0-9]*\.[ivxfswum.]+\s+} 191 } } */
/* { dg-final { scan-assembler-times {v[ml][s]*[ve][0-9]*\.[ivxfswum.]+\s+} 218 } } */
2 changes: 1 addition & 1 deletion auto-generated/gnu-api-tests/vreinterpret.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,4 +1222,4 @@ vuint64m1_t test_vreinterpret_v_b8_u64m1(vbool8_t src) {
return __riscv_vreinterpret_v_b8_u64m1(src);
}

/* { dg-final { scan-assembler-times {vs[1248e][r123468]+\.[ivxfswum.]+\s+[,\sa-x0-9()]+} 304 } } */
/* { dg-final { scan-assembler-times {vs[1248e][r123468]+\.[ivxfswum.]+\s+[,\sa-x0-9()]+} 260 } } */
2 changes: 1 addition & 1 deletion auto-generated/gnu-api-tests/vset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,4 +1174,4 @@ vuint64m4x2_t test_vset_v_u64m4_u64m4x2(vuint64m4x2_t dest, size_t index, vuint6
return __riscv_vset_v_u64m4_u64m4x2(dest, 0, val);
}

/* { dg-final { scan-assembler-times {vl[1248]re[0-9]*\.v\s+v[1248],0\([a-z0-9]*\)\s+vl[1248]re[0-9]*\.v\s+v[1248],0\([a-z0-9]*\)+[ivxfswum.]*\s+} 292 } } */
/* { dg-final { scan-assembler-times {vl[1248]re[0-9]*\.v\s+v[1248],0\([a-z0-9]*\)\s+vl[1248]re[0-9]*\.v\s+v[1248],0\([a-z0-9]*\)+[ivxfswum.]*\s+} 66 } } */
2 changes: 1 addition & 1 deletion auto-generated/gnu-overloaded-tests/vget.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,4 +1174,4 @@ vuint64m4_t test_vget_v_u64m4x2_u64m4(vuint64m4x2_t src, size_t index) {
return __riscv_vget_u64m4(src, 0);
}

/* { dg-final { scan-assembler-times {vl[124]re[0-9]*\.v\s+v[124],0\([a-z0-9]*\)\s+vs[124]r\.+[ivxfswum.]*\s+} 292 } } */
/* { dg-final { scan-assembler-times {vl[124]re[0-9]*\.v\s+v[124],0\([a-z0-9]*\)\s+vs[124]r\.+[ivxfswum.]*\s+} 187 } } */
2 changes: 1 addition & 1 deletion auto-generated/gnu-overloaded-tests/vmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,4 +418,4 @@ uint64_t test_vmv_x_s_u64m8_u64(vuint64m8_t src) {
return __riscv_vmv_x(src);
}

/* { dg-final { scan-assembler-times {v[ml][s]*[ve][0-9]*\.[ivxfswum.]+\s+} 103 } } */
/* { dg-final { scan-assembler-times {v[ml][s]*[ve][0-9]*\.[ivxfswum.]+\s+} 130 } } */
2 changes: 1 addition & 1 deletion auto-generated/gnu-overloaded-tests/vreinterpret.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,4 +1222,4 @@ vuint64m1_t test_vreinterpret_v_b8_u64m1(vbool8_t src) {
return __riscv_vreinterpret_u64m1(src);
}

/* { dg-final { scan-assembler-times {vs[1248e][r123468]+\.[ivxfswum.]+\s+[,\sa-x0-9()]+} 304 } } */
/* { dg-final { scan-assembler-times {vs[1248e][r123468]+\.[ivxfswum.]+\s+[,\sa-x0-9()]+} 260 } } */
2 changes: 1 addition & 1 deletion auto-generated/gnu-overloaded-tests/vset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,4 +1174,4 @@ vuint64m4x2_t test_vset_v_u64m4_u64m4x2(vuint64m4x2_t dest, size_t index, vuint6
return __riscv_vset(dest, 0, val);
}

/* { dg-final { scan-assembler-times {vl[1248]re[0-9]*\.v\s+v[1248],0\([a-z0-9]*\)\s+vl[1248]re[0-9]*\.v\s+v[1248],0\([a-z0-9]*\)+[ivxfswum.]*\s+} 292 } } */
/* { dg-final { scan-assembler-times {vl[1248]re[0-9]*\.v\s+v[1248],0\([a-z0-9]*\)\s+vl[1248]re[0-9]*\.v\s+v[1248],0\([a-z0-9]*\)+[ivxfswum.]*\s+} 66 } } */
2 changes: 1 addition & 1 deletion auto-generated/policy_funcs/gnu-api-tests/vle16.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,4 @@ vuint16m8_t test_vle16_v_u16m8_mu(vbool2_t mask, vuint16m8_t maskedoff, const ui
return __riscv_vle16_v_u16m8_mu(mask, maskedoff, base, vl);
}

/* { dg-final { scan-assembler-times {vseti?vli\s+[a-z0-9]+,\s*[a-z0-9]+,\s*e[0-9]+,\s*mf?[1248],\s*t[au],\s*m[au]\s+vle16\.[ivxfswum.]+\s+} 52 } } */
/* { dg-final { scan-assembler-times {vseti?vli\s+[a-z0-9]+,\s*[a-z0-9]+,\s*e[0-9]+,\s*mf?[1248],\s*t[au],\s*m[au]\s+vle16\.[ivxfswum.]+\s+} 78 } } */
2 changes: 1 addition & 1 deletion auto-generated/policy_funcs/gnu-api-tests/vmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,4 +594,4 @@ vuint64m8_t test_vmv_s_x_u64m8_tu(vuint64m8_t maskedoff, uint64_t src, size_t vl
return __riscv_vmv_s_x_u64m8_tu(maskedoff, src, vl);
}

/* { dg-final { scan-assembler-times {v[ml][s]*[ve][0-9]*\.[ivxfswum.]+\s+} 147 } } */
/* { dg-final { scan-assembler-times {v[ml][s]*[ve][0-9]*\.[ivxfswum.]+\s+} 201 } } */
2 changes: 1 addition & 1 deletion auto-generated/policy_funcs/gnu-overloaded-tests/vle16.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,4 @@ vuint16m8_t test_vle16_v_u16m8_mu(vbool2_t mask, vuint16m8_t maskedoff, const ui
return __riscv_vle16_mu(mask, maskedoff, base, vl);
}

/* { dg-final { scan-assembler-times {vseti?vli\s+[a-z0-9]+,\s*[a-z0-9]+,\s*e[0-9]+,\s*mf?[1248],\s*t[au],\s*m[au]\s+vle16\.[ivxfswum.]+\s+} 52 } } */
/* { dg-final { scan-assembler-times {vseti?vli\s+[a-z0-9]+,\s*[a-z0-9]+,\s*e[0-9]+,\s*mf?[1248],\s*t[au],\s*m[au]\s+vle16\.[ivxfswum.]+\s+} 78 } } */
2 changes: 1 addition & 1 deletion auto-generated/policy_funcs/gnu-overloaded-tests/vmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,4 +594,4 @@ vuint64m8_t test_vmv_s_x_u64m8_tu(vuint64m8_t maskedoff, uint64_t src, size_t vl
return __riscv_vmv_s_tu(maskedoff, src, vl);
}

/* { dg-final { scan-assembler-times {v[ml][s]*[ve][0-9]*\.[ivxfswum.]+\s+} 147 } } */
/* { dg-final { scan-assembler-times {v[ml][s]*[ve][0-9]*\.[ivxfswum.]+\s+} 201 } } */
39 changes: 30 additions & 9 deletions rvv-intrinsic-generator/rvv_intrinsic_gen/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,38 @@ def is_support_overloaded(name, **kwargs):
# ________________________________
# | vle32 | 63 |
# ________________________________
# | vreinterpret | 260 |
# ________________________________
# | vget | 187 |
# ________________________________
# | vset | 66 |
# ________________________________
# | vcreate | 506 |
# ________________________________
# | vmv | 218 |
# ________________________________
@staticmethod
def adjust_gnu_api_count(api_count, test_file, has_policy):
def adjust_api_count_for_vle(api_count, test_file, has_policy, is_overloaded):
if test_file == "vle8.c":
api_count = 62 if has_policy else api_count
if test_file == "vle16.c":
api_count = 52 if has_policy else api_count
api_count = 78 if has_policy else api_count
if test_file == "vle32.c":
api_count = 63 if has_policy else api_count
if test_file == "vreinterpret.c":
api_count = 260
if test_file == "vget.c":
api_count = 187
if test_file == "vset.c":
api_count = 66
if test_file == "vcreate.c":
api_count = 506
if test_file == "vmv.c":
api_count = 218
if is_overloaded and not has_policy:
api_count = 130
if has_policy:
api_count = 201
return api_count

@staticmethod
Expand All @@ -175,7 +199,7 @@ def adjust_gnu_pattern_str(opcode):
pattern_str = "vms[gl][et]"
elif opcode in ["vmsgeu", "vmsltu"]:
pattern_str = "vms[gl][et]u"
elif opcode == "vget":
elif opcode in ["vget", "vcreate"]:
pattern_str = r"vl[124]re[0-9]*\.v\s+v[124],0\([a-z0-9]*\)\s+vs[124]r\.+"
elif opcode == "vset":
pattern_str = r"vl[1248]re[0-9]*\.v\s+v[1248],0\([a-z0-9]*\)\s+" \
Expand Down Expand Up @@ -208,11 +232,7 @@ def gen_gnu_dg_pattern_str(opcode, pattern_str, api_count):
elif opcode in ["vmv", "vxor", "vsub", "vsbc", "vrsub", "vremu", "vrem", "vor", "vnmsub", "vnmsac", \
"vmul", "vmsne", "vmsltu", "vmslt", "vmsleu", "vmsle", "vmsgtu", "vmsgt", "vmsgeu", \
"vmsge", "vmseq", "vmsbc", "vminu", "vmin", "vmerge", "vmaxu", "vmax", "vmadd", "vmadc", \
"vmacc", "vdivu", "vdiv", "vand", "vadd", "vadc"]:
return rf"/* {{ dg-final {{ scan-assembler-times {{{pattern_str}\s+}} {api_count} }} }} */" + "\n"
elif opcode == "vget":
return rf"/* {{ dg-final {{ scan-assembler-times {{{pattern_str}\s+}} {api_count} }} }} */" + "\n"
elif opcode == "vset":
"vmacc", "vdivu", "vdiv", "vand", "vadd", "vadc", "vget", "vset", "vcreate"]:
return rf"/* {{ dg-final {{ scan-assembler-times {{{pattern_str}\s+}} {api_count} }} }} */" + "\n"
else:
#pylint: disable=line-too-long
Expand Down Expand Up @@ -559,10 +579,11 @@ def post_gen(self):
api_count = self.fd.read().count("__riscv_")
self.fd.close()

api_count = Generator.adjust_gnu_api_count(
api_count = Generator.adjust_api_count_for_vle(
api_count,
test_file,
self.has_tail_policy,
self.is_overloaded,
)

opcode = test_file[:-2]
Expand Down

0 comments on commit 66cfdc2

Please sign in to comment.