Repository navigation
Commit 74a523f
committed
Fix constant folding of frac for negative values
The DXIL constant folder evaluated Frc as fabs(modf(x)), which is
|x - trunc(x)|, so frac(-1.75) folded to 0.75 instead of 0.25. Scalars
are folded earlier with x - floor(x), but matrix arguments reach the DXIL
folder. Use x - floor(x) there as well.
The existing frac_literal.hlsl expectations for the negative matrix
elements encoded the old result; update them and add the case from the
issue.
Fixes #89371 parent 5cf9f59 commit 74a523f
3 files changed
Lines changed: 12 additions & 5 deletions
File tree
- docs
- lib/Analysis
- tools/clang/test/HLSLFileCheck/hlsl/intrinsics/basic
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
199 | 198 | | |
200 | 199 | | |
201 | 200 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
63 | 68 | | |
0 commit comments