search for: typepromotefloat

Displaying 2 results from an estimated 2 matches for "typepromotefloat".

2019 Dec 10
2
TypePromoteFloat loses intermediate rounding operations
...; > > > *From:* Craig Topper <craig.topper at gmail.com> > *Sent:* Tuesday, December 10, 2019 12:18 PM > *To:* llvm-dev <llvm-dev at lists.llvm.org>; Eli Friedman < > efriedma at quicinc.com>; Tim Northover <t.p.northover at gmail.com> > *Subject:* [EXT] TypePromoteFloat loses intermediate rounding operations > > > > For the following C code > > > > __fp16 x, y, z, w; > > > > void foo() { > > x = y + z; > > x = x + w; > > } > > > > clang produces IR that extends each operand to float and then truncat...
2019 Dec 10
2
TypePromoteFloat loses intermediate rounding operations
...I assumed SelectionDAG should produce something equivalent to the original clang code with 4 total extends to f32 and 2 truncates. Instead we got 3 extends and 1 truncate. So we lost the intermediate rounding between the 2 adds that was in the original clang IR. I believe this occurs because the TypePromoteFloat legalization converts all arithmetic operations to their f32 equivalents, but does not place conversions to/from half around them. Instead fp_to_f16 and f16_to_fp nodes are only generated at loads, stores, bitcasts, and a probably a few other places. Basically only the place where the 16-bit size i...