[all-commits] [llvm/llvm-project] 4c98f5: [DAG] Use copysign in frem power-2 fold. (#91751)

David Green via All-commits all-commits at lists.llvm.org
Sat May 18 14:50:41 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4c98f5b439ddd204d8ff1e423104215ebd0e1720
      https://github.com/llvm/llvm-project/commit/4c98f5b439ddd204d8ff1e423104215ebd0e1720
  Author: David Green <david.green at arm.com>
  Date:   2024-05-18 (Sat, 18 May 2024)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/AArch64/frem-power2.ll
    M llvm/test/CodeGen/ARM/frem-power2.ll

  Log Message:
  -----------
  [DAG] Use copysign in frem power-2 fold. (#91751)

As a small addition to #91148, this uses copysign to produce the correct
sign for zero when converting frem to div/trunc/mul when we do not know
that the input is positive (and we care about sign bits). The copysign
lets us get the sign of zero correct.

In testing, the only case this produced different results than fmod was:
frem -inf, 4.0 -> nan vs -nan



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list