reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
; Check that 0.0 is not materialized for CSEL when comparing against it.

; RUN: llc -mtriple=aarch64-linux-gnu -o - < %s | FileCheck %s

define float @foeq(float %a, float %b) #0 {
  %t = fcmp oeq float %a, 0.0
  %v = select i1 %t, float 0.0, float %b
  ret float %v
; CHECK-LABEL: foeq
; CHECK: fcmp [[R:s[0-9]+]], #0.0
; CHECK-NEXT: fcsel {{s[0-9]+}}, [[R]], {{s[0-9]+}}, eq
}

define float @fueq(float %a, float %b) #0 {
  %t = fcmp ueq float %a, 0.0
  %v = select i1 %t, float 0.0, float %b
  ret float %v
; CHECK-LABEL: fueq
; CHECK: fcmp [[R:s[0-9]+]], #0.0
; CHECK-NEXT: fcsel {{s[0-9]+}}, [[R]], {{s[0-9]+}}, eq
; CHECK-NEXT: fcsel {{s[0-9]+}}, [[R]], {{s[0-9]+}}, vs
}

define float @fone(float %a, float %b) #0 {
  %t = fcmp one float %a, 0.0
  %v = select i1 %t, float %b, float 0.0
  ret float %v
; CHECK-LABEL: fone
; CHECK: fcmp [[R:s[0-9]+]], #0.0
; CHECK-NEXT: fcsel {{s[0-9]+}}, {{s[0-9]+}}, [[R]], mi
; CHECK-NEXT: fcsel {{s[0-9]+}}, {{s[0-9]+}}, [[R]], gt
}

define float @fune(float %a, float %b) #0 {
  %t = fcmp une float %a, 0.0
  %v = select i1 %t, float %b, float 0.0
  ret float %v
; CHECK-LABEL: fune
; CHECK: fcmp [[R:s[0-9]+]], #0.0
; CHECK-NEXT: fcsel {{s[0-9]+}}, {{s[0-9]+}}, [[R]], ne
}

define double @doeq(double %a, double %b) #0 {
  %t = fcmp oeq double %a, 0.0
  %v = select i1 %t, double 0.0, double %b
  ret double %v
; CHECK-LABEL: doeq
; CHECK: fcmp [[R:d[0-9]+]], #0.0
; CHECK-NEXT: fcsel {{d[0-9]+}}, [[R]], {{d[0-9]+}}, eq
}

define double @dueq(double %a, double %b) #0 {
  %t = fcmp ueq double %a, 0.0
  %v = select i1 %t, double 0.0, double %b
  ret double %v
; CHECK-LABEL: dueq
; CHECK: fcmp [[R:d[0-9]+]], #0.0
; CHECK-NEXT: fcsel {{d[0-9]+}}, [[R]], {{d[0-9]+}}, eq
; CHECK-NEXT: fcsel {{d[0-9]+}}, [[R]], {{d[0-9]+}}, vs
}

define double @done(double %a, double %b) #0 {
  %t = fcmp one double %a, 0.0
  %v = select i1 %t, double %b, double 0.0
  ret double %v
; CHECK-LABEL: done
; CHECK: fcmp [[R:d[0-9]+]], #0.0
; CHECK-NEXT: fcsel {{d[0-9]+}}, {{d[0-9]+}}, [[R]], mi
; CHECK-NEXT: fcsel {{d[0-9]+}}, {{d[0-9]+}}, [[R]], gt
}

define double @dune(double %a, double %b) #0 {
  %t = fcmp une double %a, 0.0
  %v = select i1 %t, double %b, double 0.0
  ret double %v
; CHECK-LABEL: dune
; CHECK: fcmp [[R:d[0-9]+]], #0.0
; CHECK-NEXT: fcsel {{d[0-9]+}}, {{d[0-9]+}}, [[R]], ne
}

attributes #0 = { nounwind "unsafe-fp-math"="true" }