We can do this conversion by converting the same sized integer type, then compare the result with 0. The conversion is undefined if the converted FP value doesn't fit in an i1.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
I must be missing something very obvious: wouldn't 2.0 round to 2 and then give us i1 0 because its LSB is 0?
Comment Actions
Ah right! Thanks. I'd say to remove the extra masking, checking other targets don't seem to bother.
Just curious why you chose a narrowing conversion rather than a regular one, perhaps you want to reduce the register pressure for the result or the expectation is that it'll be faster?
Comment Actions
I copied from the regular FP_TO_SINT code. Which is also where I got the AND since it went through TRUNCATE lowering.
comment's out of date: no more and?