https://github.com/dtcxzyw commented:
I don't think your proof works: https://alive2.llvm.org/ce/z/T_dpgL See https://github.com/AliveToolkit/alive2/blob/20a8472b77ba8a1f0b172059d422a55cb4dff120/ir/instr.cpp#L1168-L1170 Looks like alive2 only respects the standard IEEE fp semantics. BTW, I'd like to see a two-stage fold: https://alive2.llvm.org/ce/z/DMKuW4 ``` define half @src0(half %x, half %y) { %hard.canonical = call half @llvm.canonicalize.f32(half %x) %ord = fcmp ord half %x, 0.0 %x.canon = select i1 %ord, half %hard.canonical, half %y ret half %x.canon } define half @tgt0(half %x, half %y) { %ord = fcmp ord half %x, 0.0 %x.canon = select i1 %ord, half %x, half %y ret half %x.canon } define half @src1(half %x, half %y) { %cond = fcmp ord half %x, 0.0 %rcp = fdiv half 1.0, %x %sel = select i1 %cond, half %y, half %rcp ret half %sel } define half @tgt1(half %x, half %y) { %cond = fcmp ord half %x, 0.0 %sel = select i1 %cond, half %y, half %x ret half %sel } ``` Both arms should be simplified independently. https://github.com/llvm/llvm-project/pull/172998 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
