[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: patch s390x/tcg: Implement Miscellaneous-Instruction-Extensions Faci
From: |
David Miller |
Subject: |
Re: patch s390x/tcg: Implement Miscellaneous-Instruction-Extensions Facility 3 for the s390x |
Date: |
Wed, 9 Feb 2022 12:25:58 -0500 |
Sorry typo in last patch: op_popcnt the second operand should be
o->in2 in : tcg_gen_ctpop_i64(o->out, o->in2);
Corrected patch below.
diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index c0a89e2787..a0601c38e4 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -3792,7 +3792,18 @@ static DisasJumpType op_pku(DisasContext *s, DisasOps *o)
static DisasJumpType op_popcnt(DisasContext *s, DisasOps *o)
{
- gen_helper_popcnt(o->out, o->in2);
+ int m3 = get_field(s, m3);
+
+ if (m3) {
+ if ((m3 & ~1) || !s390_has_feat(S390_FEAT_MISC_INSTRUCTION_EXT3)) {
+ gen_program_exception(s, PGM_SPECIFICATION);
+ return DISAS_NORETURN;
+ }
+ tcg_gen_ctpop_i64(o->out, o->in2);
+ }
+ else {
+ gen_helper_popcnt(o->out, o->in2);
+ }
return DISAS_NEXT;
}
On Wed, Feb 9, 2022 at 12:23 PM David Miller <dmiller423@gmail.com> wrote:
>
> diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
> index c0a89e2787..a0601c38e4 100644
> --- a/target/s390x/tcg/translate.c
> +++ b/target/s390x/tcg/translate.c
> @@ -3792,7 +3792,18 @@ static DisasJumpType op_pku(DisasContext *s, DisasOps
> *o)
>
> static DisasJumpType op_popcnt(DisasContext *s, DisasOps *o)
> {
> - gen_helper_popcnt(o->out, o->in2);
> + int m3 = get_field(s, m3);
> +
> + if (m3) {
> + if ((m3 & ~1) || !s390_has_feat(S390_FEAT_MISC_INSTRUCTION_EXT3)) {
> + gen_program_exception(s, PGM_SPECIFICATION);
> + return DISAS_NORETURN;
> + }
> + tcg_gen_ctpop_i64(o->out, o->out);
> + }
> + else {
> + gen_helper_popcnt(o->out, o->in2);
> + }
> return DISAS_NEXT;
> }
>
>
> On Wed, Feb 9, 2022 at 8:55 AM David Hildenbrand <david@redhat.com> wrote:
> >
> > >> +/* SELECT */
> > >> + C(0xb9f0, SELR, RRF_a, MIE3, r2, r3, new, r1_32, sel, 0)
> > >> + C(0xb9e3, SELGR, RRF_a, MIE3, r2, r3, r1, 0, sel, 0)
> > >> +/* SELECT HIGH */
> > >> + C(0xb9c0, SELFHR, RRF_a, MIE3, r2, r3, new, r1_32h, sel, 0)
> > >> +
> > >> /* SET ACCESS */
> > >> C(0xb24e, SAR, RRE, Z, 0, r2_o, 0, 0, sar, 0)
> > >> /* SET ADDRESSING MODE */
> > >
> > >
> > > I quickly verified that the mnemonics and binary instructions match.
> > >
> > > One thing that might be missing:
> > > I could not find the POPCOUNT changes mentioned in SA22-7832-12
> > >
> > > --snip--
> > > In addition, POPULATION COUNT includes a control
> > > in an M 3 field for counting the number of one bits in
> > > each byte or the entire 64-bit register.
> > > --snip--
> > >
> > > Can you have a look?
> > >
> >
> > I most probably won't find time to have a look this week (reading the
> > PoP to catch corner cases takes time), but I'll add it on my todo list
> > for next week.
> >
> > We should most probably split off the tests into a separate patch and
> > add some meat to the patch description ;)
> >
> > Thanks!
> >
> > --
> > Thanks,
> >
> > David / dhildenb
> >