};
TRANS(FNEG_s, do_fp1_scalar_int, a, &f_scalar_fneg)
+typedef struct FPScalar1 {
+ void (*gen_h)(TCGv_i32, TCGv_i32, TCGv_ptr);
+ void (*gen_s)(TCGv_i32, TCGv_i32, TCGv_ptr);
+ void (*gen_d)(TCGv_i64, TCGv_i64, TCGv_ptr);
+} FPScalar1;
+
+static bool do_fp1_scalar(DisasContext *s, arg_rr_e *a,
+ const FPScalar1 *f, int rmode)
+{
+ TCGv_i32 tcg_rmode = NULL;
+ TCGv_ptr fpst;
+ TCGv_i64 t64;
+ TCGv_i32 t32;
+ int check = fp_access_check_scalar_hsd(s, a->esz);
+
+ if (check <= 0) {
+ return check == 0;
+ }
+
+ fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
+ if (rmode >= 0) {
+ tcg_rmode = gen_set_rmode(rmode, fpst);
+ }
+
+ switch (a->esz) {
+ case MO_64:
+ t64 = read_fp_dreg(s, a->rn);
+ f->gen_d(t64, t64, fpst);
+ write_fp_dreg(s, a->rd, t64);
+ break;
+ case MO_32:
+ t32 = read_fp_sreg(s, a->rn);
+ f->gen_s(t32, t32, fpst);
+ write_fp_sreg(s, a->rd, t32);
+ break;
+ case MO_16:
+ t32 = read_fp_hreg(s, a->rn);
+ f->gen_h(t32, t32, fpst);
+ write_fp_sreg(s, a->rd, t32);
+ break;
+ default:
+ g_assert_not_reached();
+ }
+
+ if (rmode >= 0) {
+ gen_restore_rmode(tcg_rmode, fpst);
+ }
+ return true;
+}
+
+static const FPScalar1 f_scalar_fsqrt = {
+ gen_helper_vfp_sqrth,
+ gen_helper_vfp_sqrts,
+ gen_helper_vfp_sqrtd,
+};
+TRANS(FSQRT_s, do_fp1_scalar, a, &f_scalar_fsqrt, -1)
+
/* Floating-point data-processing (1 source) - half precision */
static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn)
{
TCGv_i32 tcg_res = tcg_temp_new_i32();
switch (opcode) {
- case 0x3: /* FSQRT */
- fpst = fpstatus_ptr(FPST_FPCR_F16);
- gen_helper_vfp_sqrth(tcg_res, tcg_op, fpst);
- break;
case 0x8: /* FRINTN */
case 0x9: /* FRINTP */
case 0xa: /* FRINTM */
case 0x0: /* FMOV */
case 0x1: /* FABS */
case 0x2: /* FNEG */
+ case 0x3: /* FSQRT */
g_assert_not_reached();
}
tcg_res = tcg_temp_new_i32();
switch (opcode) {
- case 0x3: /* FSQRT */
- gen_fpst = gen_helper_vfp_sqrts;
- break;
case 0x6: /* BFCVT */
gen_fpst = gen_helper_bfcvt;
break;
case 0x0: /* FMOV */
case 0x1: /* FABS */
case 0x2: /* FNEG */
+ case 0x3: /* FSQRT */
g_assert_not_reached();
}
tcg_res = tcg_temp_new_i64();
switch (opcode) {
- case 0x3: /* FSQRT */
- gen_fpst = gen_helper_vfp_sqrtd;
- break;
case 0x8: /* FRINTN */
case 0x9: /* FRINTP */
case 0xa: /* FRINTM */
case 0x0: /* FMOV */
case 0x1: /* FABS */
case 0x2: /* FNEG */
+ case 0x3: /* FSQRT */
g_assert_not_reached();
}
goto do_unallocated;
}
/* fall through */
- case 0x3:
case 0x8 ... 0xc:
case 0xe ... 0xf:
/* 32-to-32 and 64-to-64 ops */
case 0x0: /* FMOV */
case 0x1: /* FABS */
case 0x2: /* FNEG */
+ case 0x3: /* FSQRT */
unallocated_encoding(s);
break;
}