|
Message-ID: <20200120223204.GP23985@port70.net> Date: Mon, 20 Jan 2020 23:32:07 +0100 From: Szabolcs Nagy <nsz@...t70.net> To: musl@...ts.openwall.com Subject: Re: Triggering Overflow (or Underflow) without triggering Inexact on i386 * Damian McGuckin <damianm@....com.au> [2020-01-21 08:11:50 +1100]: > I am trying to write arithmetic expressions using only x87 instructions to > trigger an exception. The ASM instruction to raise the flag in the status > register has way too much overhead. > > My normal technique of doing either of these would also trigger Inexact. > > e.g. > volatile long double t; > > Overflow: t = largest normal long double, t *= t; > Underflow: t = smallest normal long double, t *= t; > > Can it be triggered WITHOUT also triggering INEXACT? ieee operations raise inexact and underflow/overflow together. so you cannot implement feraiseexcept by only doing arithmetic ops (which can do individual underflow/overflow), but that's a rare function so it can be slow fldenv/fwait etc. note that there is __math_uflow/__math_oflow now for internal math code (and they don't use the smallest/largest normal, instead they use small/large numbers with simple representation since sometimes those can be constructed as immediates on some targets, but this is a micro-optimization).
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.