Revision 83b00736
b/target-s390x/fpu_helper.c | ||
---|---|---|
266 | 266 |
return RET128(ret); |
267 | 267 |
} |
268 | 268 |
|
269 |
/* 64-bit FP multiplication RR */
|
|
270 |
void HELPER(mdbr)(CPUS390XState *env, uint32_t f1, uint32_t f2)
|
|
269 |
/* 32-bit FP multiplication */
|
|
270 |
uint64_t HELPER(meeb)(CPUS390XState *env, uint64_t f1, uint64_t f2)
|
|
271 | 271 |
{ |
272 |
env->fregs[f1].d = float64_mul(env->fregs[f1].d, env->fregs[f2].d, |
|
273 |
&env->fpu_status); |
|
272 |
float32 ret = float32_mul(f1, f2, &env->fpu_status); |
|
273 |
handle_exceptions(env, GETPC()); |
|
274 |
return ret; |
|
274 | 275 |
} |
275 | 276 |
|
276 |
/* 128-bit FP multiplication RR */
|
|
277 |
void HELPER(mxbr)(CPUS390XState *env, uint32_t f1, uint32_t f2)
|
|
277 |
/* 64-bit FP multiplication */
|
|
278 |
uint64_t HELPER(mdb)(CPUS390XState *env, uint64_t f1, uint64_t f2)
|
|
278 | 279 |
{ |
279 |
CPU_QuadU v1; |
|
280 |
CPU_QuadU v2; |
|
281 |
CPU_QuadU res; |
|
280 |
float64 ret = float64_mul(f1, f2, &env->fpu_status); |
|
281 |
handle_exceptions(env, GETPC()); |
|
282 |
return ret; |
|
283 |
} |
|
282 | 284 |
|
283 |
v1.ll.upper = env->fregs[f1].ll; |
|
284 |
v1.ll.lower = env->fregs[f1 + 2].ll; |
|
285 |
v2.ll.upper = env->fregs[f2].ll; |
|
286 |
v2.ll.lower = env->fregs[f2 + 2].ll; |
|
287 |
res.q = float128_mul(v1.q, v2.q, &env->fpu_status); |
|
288 |
env->fregs[f1].ll = res.ll.upper; |
|
289 |
env->fregs[f1 + 2].ll = res.ll.lower; |
|
285 |
/* 64/32-bit FP multiplication */ |
|
286 |
uint64_t HELPER(mdeb)(CPUS390XState *env, uint64_t f1, uint64_t f2) |
|
287 |
{ |
|
288 |
float64 ret = float32_to_float64(f2, &env->fpu_status); |
|
289 |
ret = float64_mul(f1, ret, &env->fpu_status); |
|
290 |
handle_exceptions(env, GETPC()); |
|
291 |
return ret; |
|
292 |
} |
|
293 |
|
|
294 |
/* 128-bit FP multiplication */ |
|
295 |
uint64_t HELPER(mxb)(CPUS390XState *env, uint64_t ah, uint64_t al, |
|
296 |
uint64_t bh, uint64_t bl) |
|
297 |
{ |
|
298 |
float128 ret = float128_mul(make_float128(ah, al), |
|
299 |
make_float128(bh, bl), |
|
300 |
&env->fpu_status); |
|
301 |
handle_exceptions(env, GETPC()); |
|
302 |
return RET128(ret); |
|
303 |
} |
|
304 |
|
|
305 |
/* 128/64-bit FP multiplication */ |
|
306 |
uint64_t HELPER(mxdb)(CPUS390XState *env, uint64_t ah, uint64_t al, |
|
307 |
uint64_t f2) |
|
308 |
{ |
|
309 |
float128 ret = float64_to_float128(f2, &env->fpu_status); |
|
310 |
ret = float128_mul(make_float128(ah, al), ret, &env->fpu_status); |
|
311 |
handle_exceptions(env, GETPC()); |
|
312 |
return RET128(ret); |
|
290 | 313 |
} |
291 | 314 |
|
292 | 315 |
/* convert 32-bit float to 64-bit float */ |
... | ... | |
402 | 425 |
return set_cc_nz_f128(x1.q); |
403 | 426 |
} |
404 | 427 |
|
405 |
/* 32-bit FP multiplication RM */ |
|
406 |
void HELPER(meeb)(CPUS390XState *env, uint32_t f1, uint32_t val) |
|
407 |
{ |
|
408 |
float32 v1 = env->fregs[f1].l.upper; |
|
409 |
CPU_FloatU v2; |
|
410 |
|
|
411 |
v2.l = val; |
|
412 |
HELPER_LOG("%s: multiplying 0x%d from f%d and 0x%d\n", __func__, |
|
413 |
v1, f1, v2.f); |
|
414 |
env->fregs[f1].l.upper = float32_mul(v1, v2.f, &env->fpu_status); |
|
415 |
} |
|
416 |
|
|
417 | 428 |
/* 32-bit FP compare */ |
418 | 429 |
uint32_t HELPER(ceb)(CPUS390XState *env, uint64_t f1, uint64_t f2) |
419 | 430 |
{ |
... | ... | |
441 | 452 |
return float_comp_to_cc(env, cmp); |
442 | 453 |
} |
443 | 454 |
|
444 |
/* 64-bit FP multiplication RM */ |
|
445 |
void HELPER(mdb)(CPUS390XState *env, uint32_t f1, uint64_t a2) |
|
446 |
{ |
|
447 |
float64 v1 = env->fregs[f1].d; |
|
448 |
CPU_DoubleU v2; |
|
449 |
|
|
450 |
v2.ll = cpu_ldq_data(env, a2); |
|
451 |
HELPER_LOG("%s: multiplying 0x%lx from f%d and 0x%ld\n", __func__, |
|
452 |
v1, f1, v2.d); |
|
453 |
env->fregs[f1].d = float64_mul(v1, v2.d, &env->fpu_status); |
|
454 |
} |
|
455 |
|
|
456 | 455 |
static void set_round_mode(CPUS390XState *env, int m3) |
457 | 456 |
{ |
458 | 457 |
switch (m3) { |
... | ... | |
582 | 581 |
env->fregs[f1 + 1].ll = x.ll.lower; |
583 | 582 |
} |
584 | 583 |
|
585 |
/* 32-bit FP multiplication RR */ |
|
586 |
void HELPER(meebr)(CPUS390XState *env, uint32_t f1, uint32_t f2) |
|
587 |
{ |
|
588 |
env->fregs[f1].l.upper = float32_mul(env->fregs[f1].l.upper, |
|
589 |
env->fregs[f2].l.upper, |
|
590 |
&env->fpu_status); |
|
591 |
} |
|
592 |
|
|
593 | 584 |
/* 64-bit FP multiply and add RM */ |
594 | 585 |
void HELPER(madb)(CPUS390XState *env, uint32_t f1, uint64_t a2, uint32_t f3) |
595 | 586 |
{ |
b/target-s390x/helper.h | ||
---|---|---|
45 | 45 |
DEF_HELPER_3(deb, i64, env, i64, i64) |
46 | 46 |
DEF_HELPER_3(ddb, i64, env, i64, i64) |
47 | 47 |
DEF_HELPER_5(dxb, i64, env, i64, i64, i64, i64) |
48 |
DEF_HELPER_3(mdbr, void, env, i32, i32) |
|
49 |
DEF_HELPER_3(mxbr, void, env, i32, i32) |
|
48 |
DEF_HELPER_3(meeb, i64, env, i64, i64) |
|
49 |
DEF_HELPER_3(mdeb, i64, env, i64, i64) |
|
50 |
DEF_HELPER_3(mdb, i64, env, i64, i64) |
|
51 |
DEF_HELPER_5(mxb, i64, env, i64, i64, i64, i64) |
|
52 |
DEF_HELPER_4(mxdb, i64, env, i64, i64, i64) |
|
50 | 53 |
DEF_HELPER_2(ldeb, i64, env, i64) |
51 | 54 |
DEF_HELPER_3(ldxb, i64, env, i64, i64) |
52 | 55 |
DEF_HELPER_2(lxdb, i64, env, i64) |
... | ... | |
59 | 62 |
DEF_HELPER_3(lcebr, i32, env, i32, i32) |
60 | 63 |
DEF_HELPER_3(lcdbr, i32, env, i32, i32) |
61 | 64 |
DEF_HELPER_3(lcxbr, i32, env, i32, i32) |
62 |
DEF_HELPER_3(meeb, void, env, i32, i32) |
|
63 |
DEF_HELPER_3(mdb, void, env, i32, i64) |
|
64 | 65 |
DEF_HELPER_FLAGS_3(ceb, TCG_CALL_NO_WG_SE, i32, env, i64, i64) |
65 | 66 |
DEF_HELPER_FLAGS_3(cdb, TCG_CALL_NO_WG_SE, i32, env, i64, i64) |
66 | 67 |
DEF_HELPER_FLAGS_5(cxb, TCG_CALL_NO_WG_SE, i32, env, i64, i64, i64, i64) |
... | ... | |
73 | 74 |
DEF_HELPER_4(cfebr, i32, env, i32, i32, i32) |
74 | 75 |
DEF_HELPER_4(cfdbr, i32, env, i32, i32, i32) |
75 | 76 |
DEF_HELPER_4(cfxbr, i32, env, i32, i32, i32) |
76 |
DEF_HELPER_3(meebr, void, env, i32, i32) |
|
77 | 77 |
DEF_HELPER_4(madb, void, env, i32, i64, i32) |
78 | 78 |
DEF_HELPER_4(maebr, void, env, i32, i32, i32) |
79 | 79 |
DEF_HELPER_4(madbr, void, env, i32, i32, i32) |
b/target-s390x/insn-data.def | ||
---|---|---|
359 | 359 |
C(0x1c00, MR, RR_a, Z, r1p1_32s, r2_32s, new, r1_D32, mul, 0) |
360 | 360 |
C(0x5c00, M, RX_a, Z, r1p1_32s, m2_32s, new, r1_D32, mul, 0) |
361 | 361 |
C(0xe35c, MFY, RXY_a, GIE, r1p1_32s, m2_32s, new, r1_D32, mul, 0) |
362 |
C(0xb317, MEEBR, RRE, Z, e1, e2, new, e1, meeb, 0) |
|
363 |
C(0xb31c, MDBR, RRE, Z, f1_o, f2_o, f1, 0, mdb, 0) |
|
364 |
C(0xb34c, MXBR, RRE, Z, 0, x2_o, x1, 0, mxb, 0) |
|
365 |
C(0xb30c, MDEBR, RRE, Z, f1_o, e2, f1, 0, mdeb, 0) |
|
366 |
C(0xb307, MXDBR, RRE, Z, 0, f2_o, x1, 0, mxdb, 0) |
|
367 |
C(0xed17, MEEB, RXE, Z, e1, m2_32u, new, e1, meeb, 0) |
|
368 |
C(0xed1c, MDB, RXE, Z, f1_o, m2_64, f1, 0, mdb, 0) |
|
369 |
C(0xed0c, MDEB, RXE, Z, f1_o, m2_32u, f1, 0, mdeb, 0) |
|
370 |
C(0xed07, MXDB, RXE, Z, 0, m2_64, x1, 0, mxdb, 0) |
|
362 | 371 |
/* MULTIPLY HALFWORD */ |
363 | 372 |
C(0x4c00, MH, RX_a, Z, r1_o, m2_16s, new, r1_32, mul, 0) |
364 | 373 |
C(0xe37c, MHY, RXY_a, GIE, r1_o, m2_16s, new, r1_32, mul, 0) |
b/target-s390x/translate.c | ||
---|---|---|
991 | 991 |
int x2, int b2, int d2, int r1b) |
992 | 992 |
{ |
993 | 993 |
TCGv_i32 tmp_r1, tmp32; |
994 |
TCGv_i64 addr, tmp;
|
|
994 |
TCGv_i64 addr; |
|
995 | 995 |
addr = get_address(s, x2, b2, d2); |
996 | 996 |
tmp_r1 = tcg_const_i32(r1); |
997 | 997 |
switch (op) { |
... | ... | |
1010 | 1010 |
gen_helper_tcxb(cc_op, cpu_env, tmp_r1, addr); |
1011 | 1011 |
set_cc_static(s); |
1012 | 1012 |
break; |
1013 |
case 0x17: /* MEEB R1,D2(X2,B2) [RXE] */ |
|
1014 |
tmp = tcg_temp_new_i64(); |
|
1015 |
tmp32 = tcg_temp_new_i32(); |
|
1016 |
tcg_gen_qemu_ld32u(tmp, addr, get_mem_index(s)); |
|
1017 |
tcg_gen_trunc_i64_i32(tmp32, tmp); |
|
1018 |
gen_helper_meeb(cpu_env, tmp_r1, tmp32); |
|
1019 |
tcg_temp_free_i64(tmp); |
|
1020 |
tcg_temp_free_i32(tmp32); |
|
1021 |
break; |
|
1022 |
case 0x1c: /* MDB R1,D2(X2,B2) [RXE] */ |
|
1023 |
potential_page_fault(s); |
|
1024 |
gen_helper_mdb(cpu_env, tmp_r1, addr); |
|
1025 |
break; |
|
1026 | 1013 |
case 0x1e: /* MADB R1,R3,D2(X2,B2) [RXF] */ |
1027 | 1014 |
/* for RXF insns, r1 is R3 and r1b is R1 */ |
1028 | 1015 |
tmp32 = tcg_const_i32(r1b); |
... | ... | |
1452 | 1439 |
case 0x15: /* SQBDR R1,R2 [RRE] */ |
1453 | 1440 |
FP_HELPER(sqdbr); |
1454 | 1441 |
break; |
1455 |
case 0x17: /* MEEBR R1,R2 [RRE] */ |
|
1456 |
FP_HELPER(meebr); |
|
1457 |
break; |
|
1458 |
case 0x1c: /* MDBR R1,R2 [RRE] */ |
|
1459 |
FP_HELPER(mdbr); |
|
1460 |
break; |
|
1461 | 1442 |
case 0xe: /* MAEBR R1,R3,R2 [RRF] */ |
1462 | 1443 |
case 0x1e: /* MADBR R1,R3,R2 [RRF] */ |
1463 | 1444 |
case 0x1f: /* MSDBR R1,R3,R2 [RRF] */ |
... | ... | |
1488 | 1469 |
case 0x43: /* LCXBR R1,R2 [RRE] */ |
1489 | 1470 |
FP_HELPER_CC(lcxbr); |
1490 | 1471 |
break; |
1491 |
case 0x4c: /* MXBR R1,R2 [RRE] */ |
|
1492 |
FP_HELPER(mxbr); |
|
1493 |
break; |
|
1494 | 1472 |
case 0x65: /* LXR R1,R2 [RRE] */ |
1495 | 1473 |
tmp = load_freg(r2); |
1496 | 1474 |
store_freg(r1, tmp); |
... | ... | |
2827 | 2805 |
return NO_EXIT; |
2828 | 2806 |
} |
2829 | 2807 |
|
2808 |
static ExitStatus op_meeb(DisasContext *s, DisasOps *o) |
|
2809 |
{ |
|
2810 |
gen_helper_meeb(o->out, cpu_env, o->in1, o->in2); |
|
2811 |
return NO_EXIT; |
|
2812 |
} |
|
2813 |
|
|
2814 |
static ExitStatus op_mdeb(DisasContext *s, DisasOps *o) |
|
2815 |
{ |
|
2816 |
gen_helper_mdeb(o->out, cpu_env, o->in1, o->in2); |
|
2817 |
return NO_EXIT; |
|
2818 |
} |
|
2819 |
|
|
2820 |
static ExitStatus op_mdb(DisasContext *s, DisasOps *o) |
|
2821 |
{ |
|
2822 |
gen_helper_mdb(o->out, cpu_env, o->in1, o->in2); |
|
2823 |
return NO_EXIT; |
|
2824 |
} |
|
2825 |
|
|
2826 |
static ExitStatus op_mxb(DisasContext *s, DisasOps *o) |
|
2827 |
{ |
|
2828 |
gen_helper_mxb(o->out, cpu_env, o->out, o->out2, o->in1, o->in2); |
|
2829 |
return_low128(o->out2); |
|
2830 |
return NO_EXIT; |
|
2831 |
} |
|
2832 |
|
|
2833 |
static ExitStatus op_mxdb(DisasContext *s, DisasOps *o) |
|
2834 |
{ |
|
2835 |
gen_helper_mxdb(o->out, cpu_env, o->out, o->out2, o->in2); |
|
2836 |
return_low128(o->out2); |
|
2837 |
return NO_EXIT; |
|
2838 |
} |
|
2839 |
|
|
2830 | 2840 |
static ExitStatus op_nabs(DisasContext *s, DisasOps *o) |
2831 | 2841 |
{ |
2832 | 2842 |
gen_helper_nabs_i64(o->out, o->in2); |
Also available in: Unified diff