target-s390: Convert FP SQUARE ROOT

Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
Richard Henderson 2012-08-23 14:33:03 -07:00
parent 5d7fd045ca
commit 16d7b2a43b
4 changed files with 50 additions and 7 deletions

View File

@ -613,8 +613,26 @@ uint32_t HELPER(tcxb)(uint64_t ah, uint64_t al, uint64_t m2)
return cc;
}
/* square root 64-bit RR */
void HELPER(sqdbr)(CPUS390XState *env, uint32_t f1, uint32_t f2)
/* square root 32-bit */
uint64_t HELPER(sqeb)(CPUS390XState *env, uint64_t f2)
{
env->fregs[f1].d = float64_sqrt(env->fregs[f2].d, &env->fpu_status);
float32 ret = float32_sqrt(f2, &env->fpu_status);
handle_exceptions(env, GETPC());
return ret;
}
/* square root 64-bit */
uint64_t HELPER(sqdb)(CPUS390XState *env, uint64_t f2)
{
float64 ret = float64_sqrt(f2, &env->fpu_status);
handle_exceptions(env, GETPC());
return ret;
}
/* square root 128-bit */
uint64_t HELPER(sqxb)(CPUS390XState *env, uint64_t ah, uint64_t al)
{
float128 ret = float128_sqrt(make_float128(ah, al), &env->fpu_status);
handle_exceptions(env, GETPC());
return RET128(ret);
}

View File

@ -76,7 +76,9 @@ DEF_HELPER_FLAGS_2(tceb, TCG_CALL_NO_RWG_SE, i32, i64, i64)
DEF_HELPER_FLAGS_2(tcdb, TCG_CALL_NO_RWG_SE, i32, i64, i64)
DEF_HELPER_FLAGS_3(tcxb, TCG_CALL_NO_RWG_SE, i32, i64, i64, i64)
DEF_HELPER_3(flogr, i32, env, i32, i64)
DEF_HELPER_3(sqdbr, void, env, i32, i32)
DEF_HELPER_2(sqeb, i64, env, i64)
DEF_HELPER_2(sqdb, i64, env, i64)
DEF_HELPER_3(sqxb, i64, env, i64, i64)
DEF_HELPER_FLAGS_1(cvd, TCG_CALL_NO_RWG_SE, i64, s32)
DEF_HELPER_4(unpk, void, env, i32, i64, i64)
DEF_HELPER_4(tr, void, env, i32, i64, i64)

View File

@ -459,6 +459,13 @@
/* SHIFT RIGHT DOUBLE LOGICAL */
C(0x8c00, SRDL, RS_a, Z, r1_D32, sh64, new, r1_D32, srl, 0)
/* SQUARE ROOT */
C(0xb314, SQEBR, RRE, Z, 0, e2, new, e1, sqeb, 0)
C(0xb315, SQDBR, RRE, Z, 0, f2_o, f1, 0, sqdb, 0)
C(0xb316, SQXBR, RRE, Z, 0, x2_o, x1, 0, sqxb, 0)
C(0xed14, SQEB, RXE, Z, 0, m2_32u, new, e1, sqeb, 0)
C(0xed15, SQDB, RXE, Z, 0, m2_64, f1, 0, sqdb, 0)
/* STORE */
C(0x5000, ST, RX_a, Z, r1_o, a2, 0, 0, st32, 0)
C(0xe350, STY, RXY_a, LD, r1_o, a2, 0, 0, st32, 0)

View File

@ -1385,9 +1385,6 @@ static void disas_b3(CPUS390XState *env, DisasContext *s, int op, int m3,
tcg_temp_free_i32(tmp32_2);
switch (op) {
case 0x15: /* SQBDR R1,R2 [RRE] */
FP_HELPER(sqdbr);
break;
case 0x74: /* LZER R1 [RRE] */
tmp32_1 = tcg_const_i32(r1);
gen_helper_lzer(cpu_env, tmp32_1);
@ -2936,6 +2933,25 @@ static ExitStatus op_sxb(DisasContext *s, DisasOps *o)
return NO_EXIT;
}
static ExitStatus op_sqeb(DisasContext *s, DisasOps *o)
{
gen_helper_sqeb(o->out, cpu_env, o->in2);
return NO_EXIT;
}
static ExitStatus op_sqdb(DisasContext *s, DisasOps *o)
{
gen_helper_sqdb(o->out, cpu_env, o->in2);
return NO_EXIT;
}
static ExitStatus op_sqxb(DisasContext *s, DisasOps *o)
{
gen_helper_sqxb(o->out, cpu_env, o->in1, o->in2);
return_low128(o->out2);
return NO_EXIT;
}
#ifndef CONFIG_USER_ONLY
static ExitStatus op_sigp(DisasContext *s, DisasOps *o)
{