-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Closed as duplicate of#93414
Labels
duplicateResolved as duplicateResolved as duplicatefloating-pointFloating-point mathFloating-point mathllvm:SelectionDAGSelectionDAGISel as wellSelectionDAGISel as wellmiscompilation
Description
let's take this IR:
define float @f(float %0, float %1) {
%3 = fcmp nnan ogt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}we're lowering it like so:
Johns-MacBook-Pro-2:build regehr$ ~/llvm-project/for-alive/bin/llc -o - foo2.ll
.section __TEXT,__text,regular,pure_instructions
.build_version macos, 15, 0
.globl _f ; -- Begin function f
.p2align 2
_f: ; @f
.cfi_startproc
; %bb.0:
fmaxnm s0, s0, s1
ret
.cfi_endproc
; -- End function
.subsections_via_symbols
Johns-MacBook-Pro-2:build regehr$
now let's look at invoking f(+0.0, -0.0). at the LLVM level, the fcmp ogt returns false, so we get -0.0 as the function return value. however, at least on my M1 Mac, I'm getting +0.0 as the result of the emitted fmaxnm when passed those same arguments.
Metadata
Metadata
Assignees
Labels
duplicateResolved as duplicateResolved as duplicatefloating-pointFloating-point mathFloating-point mathllvm:SelectionDAGSelectionDAGISel as wellSelectionDAGISel as wellmiscompilation