<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/85642>85642</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Possible error in description of fptosi instruction
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
JohnMcHugh
</td>
</tr>
</table>
<pre>
In the examples for this instruction we find the following:
%Y = fptosi float 1.0E-247 to i1 ; yields undefined:1
But, the semantics say "The ‘fptosi’ instruction converts its [floating-point](https://llvm.org/docs/LangRef.html#t-floating) operand into the nearest (rounding towards zero) signed integer value." Rounding a small(< 1.0), positive floating point value towards zero should yield 0, The semantics continue: "If the value cannot fit in ty2, the result is a [poison value](https://llvm.org/docs/LangRef.html#poisonvalues)." The bit values for i1 are 1 and 0, interpreted as -1 and 0 in the signed case so
the "value" given by the rounding should fit and the result, in my opinion, should be
%Y = fptosi float 1.0E-247 to i1 ; yields: i1 : 0
If the real problem is that 1.0E-247 has an exponent that is too small for a legitimate float value (though legitimate for a double) that should be diagnosed earlier and not left to the semantics of the fptosi instruction. What am I missing?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVMGO47YS_Br60rAhUfZaOuiws7PG24cECBYLBDlSYkvqgGILbGpmna8PSMmYGSCnxAcLEtnFqupqGhEaPWKrLk_q8nwwa5w4tP_nyf_a_28dp0PH9t5-8xAnBPxp5sWhwMAB4kQC5CWGtY_EHl4RBvI27xzYOX4lP6rqsyqeVfH415c_QFXPMCyRhWBwbCKUp-LrUZ-vEBmohPxT1RPcCZ0VWL3FgTxaVX0u36M9rVHpL_lAwdn4SL2AmDsorX9MCOqrVnWhmno77fHafKDds3_BEAUoCqjLU6ZEfjwuTD6qy7PS9RTjIkmKvil9c-5lPnEYlb5Z7kXp2y_Gj99xOE1xdkpX8fgAUboBXjAYb4F85MzVowkoEZSuA6_ekh8h8qsJVuAvDJyKcltyDY4Y4MW4FU9Ka4DvjxIDMhvnlK5V9SV5qHST7FhYKNILwoMEZCUbxoeDQCZend18hiIVw48PZvbsI_kVVfU5mfptyAI2pN54zxEGikAe4l0_ehFQVheBBEwydGES9lvRv7JzA8j1onSTbUg0O9pFbYGkEkxAKCGZncUk98ISMKIFI3DclzLdJHPzuDeCILxFKn1XWm9ktYaRXtBDd9-EPazffUvSzZ74TfR2Ksx34IU8sU8f9t0dwn8dhdQGKiE9ivdYe18CGgdL4M7hnOyP03vEyQgYD_hzYY8-bqtpF_OWpOyiAYcjRZpN3BO0t1vpOk68jtOHDbnC8to5TLHNmG96LZnRs6AFNMERhmxXSo3DIcI-D29x403H7si7KT3B7wnZzPANZhLJN8vtYNvKNlVjDtiW17K4XouiqQ5Tey46W9e97qtzOWCvr42-mL5DUw1X_ITFgVpd6HNRlXVZXc6X6mR13dhmsEVpi-5aD-pc4GzInR7pPJDIim19-XTWB2c6dJIvTa09vkJeVFqnOzS0qebYraOoc-FIoryhRIoO299YhDqHgCGk5HqwKH2gJd9IPPyDA4c1uPbj4IwUp7U79TzvU7Q_jkvgP7GPSt8yrzRSmfffAQAA__8zcvRE">