[mc][gfx7] Some VOP3 F32 insns (v_cubeid_f32, v_fma_f32 etc) -- negative inline constants not supported
| Bugzilla Link | 28170 |
| Resolution | FIXED |
| Resolved on | Mar 28, 2017 03:16 |
| Version | trunk |
| OS | Windows NT |
| Attachments | 04173.tests_tg_gfx7_asm_lit1_bug.06.08.v_cubeid_etc_f32--const.zip |
| CC | @atamazov,@dpreobra |
Extended Description
The following instructions have issues with negative inline constants:
v_cubeid_f32 v_cubema_f32 v_cubesc_f32 v_cubetc_f32 v_div_fixup_f32 v_div_fmas_f32 v_fma_f32 v_mad_f32 v_mad_legacy_f32 v_max3_f32 v_med3_f32 v_min3_f32 v_mullit_f32
Number of failing lit1 tests (-search=simple) = 4173.
I am almost sure that issue appears for other sub-targets as well, e.g. gfx8
Tested with r272673 (git # da10a460d7c98278561225fda90855b303675f35)
Closed by commit rL298265
More tests (5) - 00006.tests_tg_gfx7_asm_lit1_bug.06.08.min.v_cvt_pk_u8_f32--const.zip More failing test cases.
With r278539, the issue is still observed.
More tests (4) - 01482.tests_tg_gfx7_asm_lit1_bug.06.08.min.v_cvt_pkaccum_etc_f32_e64--const.zip Same issue, another instructions.
More tests (3) - 00430.tests_tg_gfx7_asm_lit1_bug.06.08.min.v_mul_etc_f32_e64-const.zip Tests failing due to the same issue, other instructions.
[Future directions] Note that enabling constructs like
v_add_f32 v0, 1 // typo: missing ".0" -- adds denorm_min instead of 1.0 v_add_i32 v0, 1.0 // typo: extra ".0" -- adds 0xbf800000 instead of 1 may lead to errors which is hard to find.
Perhaps we shall invent "reinterpret operators", for example:
v_add_f32 v0, 1 // This should lead to assembly error v_add_f32 v0, reinterpret_f32(1) // Correct. Value is is denorm_min (0x01 interpreted as float)
The 32-bit binary representation of integer -1 is 0xffffffff (negative qNAN), while neg(0x00000001) is represented as 0x80000001 (negative numeric_limits
::denorm_min()). Currently, asm syntax does not allow for the former encoding.
Looks like the solution is adding explicit syntax form of neg modifier, see Bug 28202. Neg modifier should not be applied to integer values unless explicit syntax is used.
Note this solution would require updating the tests.
The 32-bit binary representation of integer -1 is 0xffffffff (negative qNAN), while neg(0x00000001) is represented as 0x80000001 (negative numeric_limits
Note that floating operands like "|-1|" seem useless but possible to encode and even may have some practical use.
assigned to @dpreobra