Skip to content

AArch64 backend folds fcmp nnan nsz + select to fminnm, causing confusion between +0.0 and -0.0 #137998

Open
@regehr

Description

@regehr

we're lowing this:

define float @f(float %0, float %1) {
  %3 = fcmp nnan nsz ole float %0, %1
  %4 = select i1 %3, float %0, float %1
  ret float %4
}

to:

_f: 
	fminnm	s0, s0, s1
	ret

but this appears to be incorrect for f(0.0, -0.0). in the LLVM code, %3 = true, so we return 0.0. but the ARM version returns -0.0 for the same inputs.

cc @nunoplopes @arsenm @dtcxzyw

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions