Commit graph

7 commits

Author SHA1 Message Date
Michael Forney
d6c9669c3c Fix conversion from float/double to unsigned int
signed int can't represent all the values of unsigned int, so we
need to do the conversion to signed long, and use the lower 32 bits
as the result.
2023-08-26 15:16:45 +02:00
Quentin Carbonneaux
8403dcb709 fix test/fpcnv (wrong spacing) 2022-01-28 11:08:11 +01:00
Bor Grošelj Simić
3964574a83 implement float -> unsigned casts
amd64 lacks instruction for this so it has to be implemented with
float -> signed casts. The approach is borrowed from llvm.
2022-01-28 09:24:15 +01:00
Bor Grošelj Simić
74d022f975 implement unsigned -> float casts
amd64 lacks an instruction for this so it has to be implemented with
signed -> float casts:
 - Word casting is done by zero-extending the word to a long and then doing
   a regular signed cast.
 - Long casting is done by dividing by two with correct rounding if the
   highest bit is set and casting that to float, then adding
   1 to mantissa with integer addition
2022-01-28 09:24:15 +01:00
Quentin Carbonneaux
55476d0738 refine fp conversion instructions 2016-04-22 15:11:18 -04:00
Quentin Carbonneaux
1b4943eb1f implement export control 2016-03-28 14:57:20 -04:00
Quentin Carbonneaux
36635660b4 extract tests out of src 2016-03-27 15:00:45 -04:00
Renamed from src/test/fpcnv.ssa (Browse further)