| 125 | } |
| 126 | |
| 127 | bool IsNonNegative(const HloInstruction* hlo, |
| 128 | const AlgebraicSimplifierOptions& options) { |
| 129 | // Utility only handles real types. |
| 130 | if (IsAnyOperandComplex(hlo)) { |
| 131 | return false; |
| 132 | } |
| 133 | switch (hlo->opcode()) { |
| 134 | case HloOpcode::kMultiply: { |
| 135 | return hlo->operand(0) == hlo->operand(1); |
| 136 | } |
| 137 | case HloOpcode::kAbs: { |
| 138 | return true; |
| 139 | } |
| 140 | default: |
| 141 | return IsPositive(hlo, options); |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | // Checks whether `op` is a floating-point constant or broadcast of a constant |
| 146 | // of the form +/- 2^k for some integer k positive, negative, or zero. Such |
no test coverage detected