; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mcpu=pwr9 -ppc-asm-full-reg-names -verify-machineinstrs \
; RUN:   -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s \
; RUN:   --check-prefix=P9
; RUN: llc -mcpu=pwr8 -ppc-asm-full-reg-names -verify-machineinstrs \
; RUN:   -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s \
; RUN:   --check-prefix=P8
define dso_local float @testfmax(float %a, float %b) local_unnamed_addr {
; P9-LABEL: testfmax:
; P9:       # %bb.0: # %entry
; P9-NEXT:    xsmaxcdp f1, f1, f2
; P9-NEXT:    blr
;
; P8-LABEL: testfmax:
; P8:       # %bb.0: # %entry
; P8-NEXT:    fcmpu cr0, f1, f2
; P8-NEXT:    bgtlr cr0
; P8-NEXT:  # %bb.1: # %entry
; P8-NEXT:    fmr f1, f2
; P8-NEXT:    blr
entry:
  %cmp = fcmp ogt float %a, %b
  %cond = select i1 %cmp, float %a, float %b
  ret float %cond
}

define dso_local double @testdmax(double %a, double %b) local_unnamed_addr {
; P9-LABEL: testdmax:
; P9:       # %bb.0: # %entry
; P9-NEXT:    xsmaxcdp f1, f1, f2
; P9-NEXT:    blr
;
; P8-LABEL: testdmax:
; P8:       # %bb.0: # %entry
; P8-NEXT:    xscmpudp cr0, f1, f2
; P8-NEXT:    bgtlr cr0
; P8-NEXT:  # %bb.1: # %entry
; P8-NEXT:    fmr f1, f2
; P8-NEXT:    blr
entry:
  %cmp = fcmp ogt double %a, %b
  %cond = select i1 %cmp, double %a, double %b
  ret double %cond
}

define dso_local float @testfmin(float %a, float %b) local_unnamed_addr {
; P9-LABEL: testfmin:
; P9:       # %bb.0: # %entry
; P9-NEXT:    xsmincdp f1, f1, f2
; P9-NEXT:    blr
;
; P8-LABEL: testfmin:
; P8:       # %bb.0: # %entry
; P8-NEXT:    fcmpu cr0, f1, f2
; P8-NEXT:    bltlr cr0
; P8-NEXT:  # %bb.1: # %entry
; P8-NEXT:    fmr f1, f2
; P8-NEXT:    blr
entry:
  %cmp = fcmp olt float %a, %b
  %cond = select i1 %cmp, float %a, float %b
  ret float %cond
}

define dso_local double @testdmin(double %a, double %b) local_unnamed_addr {
; P9-LABEL: testdmin:
; P9:       # %bb.0: # %entry
; P9-NEXT:    xsmincdp f1, f1, f2
; P9-NEXT:    blr
;
; P8-LABEL: testdmin:
; P8:       # %bb.0: # %entry
; P8-NEXT:    xscmpudp cr0, f1, f2
; P8-NEXT:    bltlr cr0
; P8-NEXT:  # %bb.1: # %entry
; P8-NEXT:    fmr f1, f2
; P8-NEXT:    blr
entry:
  %cmp = fcmp olt double %a, %b
  %cond = select i1 %cmp, double %a, double %b
  ret double %cond
}

define dso_local float @testfmax_fast(float %a, float %b) local_unnamed_addr {
; P9-LABEL: testfmax_fast:
; P9:       # %bb.0: # %entry
; P9-NEXT:    xsmaxdp f1, f1, f2
; P9-NEXT:    blr
;
; P8-LABEL: testfmax_fast:
; P8:       # %bb.0: # %entry
; P8-NEXT:    xsmaxdp f1, f1, f2
; P8-NEXT:    blr
entry:
  %cmp = fcmp nnan ninf ogt float %a, %b
  %cond = select nnan nsz i1 %cmp, float %a, float %b
  ret float %cond
}
define dso_local double @testdmax_fast(double %a, double %b) local_unnamed_addr {
; P9-LABEL: testdmax_fast:
; P9:       # %bb.0: # %entry
; P9-NEXT:    xsmaxdp f1, f1, f2
; P9-NEXT:    blr
;
; P8-LABEL: testdmax_fast:
; P8:       # %bb.0: # %entry
; P8-NEXT:    xsmaxdp f1, f1, f2
; P8-NEXT:    blr
entry:
  %cmp = fcmp nnan ninf ogt double %a, %b
  %cond = select nnan nsz i1 %cmp, double %a, double %b
  ret double %cond
}
define dso_local float @testfmin_fast(float %a, float %b) local_unnamed_addr {
; P9-LABEL: testfmin_fast:
; P9:       # %bb.0: # %entry
; P9-NEXT:    xsmindp f1, f1, f2
; P9-NEXT:    blr
;
; P8-LABEL: testfmin_fast:
; P8:       # %bb.0: # %entry
; P8-NEXT:    xsmindp f1, f1, f2
; P8-NEXT:    blr
entry:
  %cmp = fcmp nnan ninf olt float %a, %b
  %cond = select nnan nsz i1 %cmp, float %a, float %b
  ret float %cond
}
define dso_local double @testdmin_fast(double %a, double %b) local_unnamed_addr {
; P9-LABEL: testdmin_fast:
; P9:       # %bb.0: # %entry
; P9-NEXT:    xsmindp f1, f1, f2
; P9-NEXT:    blr
;
; P8-LABEL: testdmin_fast:
; P8:       # %bb.0: # %entry
; P8-NEXT:    xsmindp f1, f1, f2
; P8-NEXT:    blr
entry:
  %cmp = fcmp nnan ninf olt double %a, %b
  %cond = select nnan nsz i1 %cmp, double %a, double %b
  ret double %cond
}
