From: Julian Seward Date: Mon, 30 Mar 2015 08:50:27 +0000 (+0000) Subject: Add IR level support for 16 bit floating point types (Ity_F16) and add X-Git-Tag: svn/VALGRIND_3_11_0^2~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c74bb4eccb2dca7fcc77591649b75c535bcb9ee0;p=thirdparty%2Fvalgrind.git Add IR level support for 16 bit floating point types (Ity_F16) and add four new IROps that use it: Iop_F16toF64, Iop_F64toF16, Iop_F16toF32, Iop_F32toF16. git-svn-id: svn://svn.valgrind.org/vex/trunk@3110 --- diff --git a/VEX/priv/ir_defs.c b/VEX/priv/ir_defs.c index 7cc66cccdb..0b70f39fc2 100644 --- a/VEX/priv/ir_defs.c +++ b/VEX/priv/ir_defs.c @@ -54,6 +54,7 @@ void ppIRType ( IRType ty ) case Ity_I32: vex_printf( "I32"); break; case Ity_I64: vex_printf( "I64"); break; case Ity_I128: vex_printf( "I128"); break; + case Ity_F16: vex_printf( "F16"); break; case Ity_F32: vex_printf( "F32"); break; case Ity_F64: vex_printf( "F64"); break; case Ity_F128: vex_printf( "F128"); break; @@ -340,6 +341,11 @@ void ppIROp ( IROp op ) case Iop_RecpExpF64: vex_printf("RecpExpF64"); return; case Iop_RecpExpF32: vex_printf("RecpExpF32"); return; + case Iop_F16toF64: vex_printf("F16toF64"); return; + case Iop_F64toF16: vex_printf("F64toF16"); return; + case Iop_F16toF32: vex_printf("F16toF32"); return; + case Iop_F32toF16: vex_printf("F32toF16"); return; + case Iop_QAdd32S: vex_printf("QAdd32S"); return; case Iop_QSub32S: vex_printf("QSub32S"); return; case Iop_Add16x2: vex_printf("Add16x2"); return; @@ -2802,7 +2808,12 @@ void typeOfPrimop ( IROp op, case Iop_I64StoF32: BINARY(ity_RMode,Ity_I64, Ity_F32); case Iop_F32toF64: UNARY(Ity_F32, Ity_F64); + case Iop_F16toF64: UNARY(Ity_F16, Ity_F64); + case Iop_F16toF32: UNARY(Ity_F16, Ity_F32); + case Iop_F64toF32: BINARY(ity_RMode,Ity_F64, Ity_F32); + case Iop_F64toF16: BINARY(ity_RMode,Ity_F64, Ity_F16); + case Iop_F32toF16: BINARY(ity_RMode,Ity_F32, Ity_F16); case Iop_ReinterpI64asF64: UNARY(Ity_I64, Ity_F64); case Iop_ReinterpF64asI64: UNARY(Ity_F64, Ity_I64); @@ -3577,7 +3588,7 @@ Bool isPlausibleIRType ( IRType ty ) case Ity_INVALID: case Ity_I1: case Ity_I8: case Ity_I16: case Ity_I32: case Ity_I64: case Ity_I128: - case Ity_F32: case Ity_F64: case Ity_F128: + case Ity_F16: case Ity_F32: case Ity_F64: case Ity_F128: case Ity_D32: case Ity_D64: case Ity_D128: case Ity_V128: case Ity_V256: return True; @@ -4615,6 +4626,7 @@ Int sizeofIRType ( IRType ty ) case Ity_I32: return 4; case Ity_I64: return 8; case Ity_I128: return 16; + case Ity_F16: return 2; case Ity_F32: return 4; case Ity_F64: return 8; case Ity_F128: return 16; diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index e592f388c1..52cef9bad2 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -6482,7 +6482,7 @@ static void considerExpensives ( /*OUT*/Bool* hasGetIorPutI, case Ity_I1: case Ity_I8: case Ity_I16: case Ity_I32: case Ity_I64: case Ity_I128: break; - case Ity_F32: case Ity_F64: case Ity_F128: + case Ity_F16: case Ity_F32: case Ity_F64: case Ity_F128: case Ity_V128: case Ity_V256: *hasVorFtemps = True; break; diff --git a/VEX/pub/libvex_ir.h b/VEX/pub/libvex_ir.h index 3d2c2b2be7..7178c7e2e1 100644 --- a/VEX/pub/libvex_ir.h +++ b/VEX/pub/libvex_ir.h @@ -225,6 +225,7 @@ typedef Ity_I32, Ity_I64, Ity_I128, /* 128-bit scalar */ + Ity_F16, /* 16 bit float */ Ity_F32, /* IEEE 754 float */ Ity_F64, /* IEEE 754 double */ Ity_D32, /* 32-bit Decimal floating point */ @@ -759,6 +760,14 @@ typedef Iop_RecpExpF64, /* FRECPX d :: IRRoundingMode(I32) x F64 -> F64 */ Iop_RecpExpF32, /* FRECPX s :: IRRoundingMode(I32) x F32 -> F32 */ + /* ------------------ 16-bit scalar FP ------------------ */ + + Iop_F16toF64, /* F16 -> F64 */ + Iop_F64toF16, /* IRRoundingMode(I32) x F64 -> F16 */ + + Iop_F16toF32, /* F16 -> F32 */ + Iop_F32toF16, /* IRRoundingMode(I32) x F32 -> F16 */ + /* ------------------ 32-bit SIMD Integer ------------------ */ /* 32x1 saturating add/sub (ok, well, not really SIMD :) */