Skip to content

Cannot select llvm.canonicalize.f64 #32650

Closed
@nagisa

Description

@nagisa
Bugzilla Link 33303
Version 4.0
OS Linux
CC @topperc,@hfinkel,@RKSimon,@arsenm,@rotateright

Extended Description

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nounwind readnone uwtable
define double @max(double, double) unnamed_addr #0 {
start:
  %2 = fcmp olt double %0, %1
  %3 = fcmp uno double %0, 0.000000e+00
  %or.cond.i.i = or i1 %3, %2
  %4 = select i1 %or.cond.i.i, double %1, double %0
  %5 = tail call double @llvm.canonicalize.f64(double %4) #2
  ret double %5
}

; Function Attrs: nounwind readnone
declare double @llvm.canonicalize.f64(double) #1

attributes #0 = { nounwind readnone uwtable }
attributes #1 = { nounwind readnone }
attributes #2 = { nounwind }

Will fail during instruction selection with (when compiled with `llc test.ll`)

LLVM ERROR: Cannot select: 0x2258ce8: f64 = fcanonicalize 0x2258c80
  0x2258c80: f64 = X86ISD::FOR 0x2258a10, 0x2258bb0
    0x2258a10: f64 = X86ISD::FANDN 0x2258ef0, 0x2258c18
      0x2258ef0: f64 = X86ISD::FSETCC 0x22588d8, 0x22588d8, Constant:i8<3>
        0x22588d8: f64,ch = CopyFromReg 0x21eb3c0, Register:f64 %vreg0
          0x2258870: f64 = Register %vreg0
        0x22588d8: f64,ch = CopyFromReg 0x21eb3c0, Register:f64 %vreg0
          0x2258870: f64 = Register %vreg0
        0x2258a78: i8 = Constant<3>
      0x2258c18: f64 = X86ISD::FMAX 0x22589a8, 0x22588d8
        0x22589a8: f64,ch = CopyFromReg 0x21eb3c0, Register:f64 %vreg1
          0x2258940: f64 = Register %vreg1
        0x22588d8: f64,ch = CopyFromReg 0x21eb3c0, Register:f64 %vreg0
          0x2258870: f64 = Register %vreg0
    0x2258bb0: f64 = X86ISD::FAND 0x2258ef0, 0x22589a8
      0x2258ef0: f64 = X86ISD::FSETCC 0x22588d8, 0x22588d8, Constant:i8<3>
        0x22588d8: f64,ch = CopyFromReg 0x21eb3c0, Register:f64 %vreg0
          0x2258870: f64 = Register %vreg0
        0x22588d8: f64,ch = CopyFromReg 0x21eb3c0, Register:f64 %vreg0
          0x2258870: f64 = Register %vreg0
        0x2258a78: i8 = Constant<3>
      0x22589a8: f64,ch = CopyFromReg 0x21eb3c0, Register:f64 %vreg1
        0x2258940: f64 = Register %vreg1
In function: max

Happens with x86, arm, powerpc, mips, etc backends.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions