Commit Graph

4 Commits

Author SHA1 Message Date
Erik Eckstein
e9a735ae7b tests: fix SILOptimizer/constant_fold_float.swift
This test only works on 64 bit architectures

rdar://148440511
2025-04-02 20:44:03 +02:00
Erik Eckstein
3ec0570574 tests: add an end-to-end to check complete constant folding of generic floating point literal construction. 2025-04-01 18:13:01 +02:00
Erik Eckstein
4d1df28de0 ConstantFolding: add constant folding for some floating point intrinsics
* `sitofp` signed integer to floating point
* `rint` round floating point to integral
* `bitcast` between integer and floating point

Constant folding `bitcast`s also made it necessary to rewrite constant folding for Nan and inf values, because the old code explicitly checked for `bitcast` intrinsics.
Relying on constant folded `bitcast`s makes the new version much simpler.

It is important to constant fold these intrinsics already in SIL because it enables other optimizations.
2025-04-01 18:13:01 +02:00
Erik Eckstein
fa85745f2d ConstantFolding: fix wrong constant folding for float-infinity compares
Only if the other operand of a comparison with Inf is a literal we can be sure that it's not Inf or NaN.

Fixes a miscompile
rdar://122605966
2024-02-14 16:09:23 +01:00