2014-05-24 12:50:23 +00:00
|
|
|
; RUN: llc < %s -march=arm64 -mcpu=cyclone -aarch64-neon-syntax=apple | FileCheck %s
|
2014-03-29 10:18:08 +00:00
|
|
|
; rdar://10263824
|
|
|
|
|
|
|
|
define i1 @fcmp_float1(float %a) nounwind ssp {
|
|
|
|
entry:
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_float1
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp s0, #0.0
|
2014-05-12 18:04:06 +00:00
|
|
|
; CHECK: cset w0, ne
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp une float %a, 0.000000e+00
|
|
|
|
ret i1 %cmp
|
|
|
|
}
|
|
|
|
|
|
|
|
define i1 @fcmp_float2(float %a, float %b) nounwind ssp {
|
|
|
|
entry:
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_float2
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp s0, s1
|
2014-05-12 18:04:06 +00:00
|
|
|
; CHECK: cset w0, ne
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp une float %a, %b
|
|
|
|
ret i1 %cmp
|
|
|
|
}
|
|
|
|
|
|
|
|
define i1 @fcmp_double1(double %a) nounwind ssp {
|
|
|
|
entry:
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_double1
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp d0, #0.0
|
2014-05-12 18:04:06 +00:00
|
|
|
; CHECK: cset w0, ne
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp une double %a, 0.000000e+00
|
|
|
|
ret i1 %cmp
|
|
|
|
}
|
|
|
|
|
|
|
|
define i1 @fcmp_double2(double %a, double %b) nounwind ssp {
|
|
|
|
entry:
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_double2
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp d0, d1
|
2014-05-12 18:04:06 +00:00
|
|
|
; CHECK: cset w0, ne
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp une double %a, %b
|
|
|
|
ret i1 %cmp
|
|
|
|
}
|
|
|
|
|
|
|
|
; Check each fcmp condition
|
|
|
|
define float @fcmp_oeq(float %a, float %b) nounwind ssp {
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_oeq
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp s0, s1
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-DAG: movi.2d v[[ZERO:[0-9]+]], #0
|
|
|
|
; CHECK-DAG: fmov s[[ONE:[0-9]+]], #1.0
|
|
|
|
; CHECK: fcsel s0, s[[ONE]], s[[ZERO]], eq
|
|
|
|
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp oeq float %a, %b
|
|
|
|
%conv = uitofp i1 %cmp to float
|
|
|
|
ret float %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @fcmp_ogt(float %a, float %b) nounwind ssp {
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_ogt
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp s0, s1
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-DAG: movi.2d v[[ZERO:[0-9]+]], #0
|
|
|
|
; CHECK-DAG: fmov s[[ONE:[0-9]+]], #1.0
|
|
|
|
; CHECK: fcsel s0, s[[ONE]], s[[ZERO]], gt
|
|
|
|
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp ogt float %a, %b
|
|
|
|
%conv = uitofp i1 %cmp to float
|
|
|
|
ret float %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @fcmp_oge(float %a, float %b) nounwind ssp {
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_oge
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp s0, s1
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-DAG: movi.2d v[[ZERO:[0-9]+]], #0
|
|
|
|
; CHECK-DAG: fmov s[[ONE:[0-9]+]], #1.0
|
|
|
|
; CHECK: fcsel s0, s[[ONE]], s[[ZERO]], ge
|
|
|
|
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp oge float %a, %b
|
|
|
|
%conv = uitofp i1 %cmp to float
|
|
|
|
ret float %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @fcmp_olt(float %a, float %b) nounwind ssp {
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_olt
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp s0, s1
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-DAG: movi.2d v[[ZERO:[0-9]+]], #0
|
|
|
|
; CHECK-DAG: fmov s[[ONE:[0-9]+]], #1.0
|
|
|
|
; CHECK: fcsel s0, s[[ONE]], s[[ZERO]], mi
|
|
|
|
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp olt float %a, %b
|
|
|
|
%conv = uitofp i1 %cmp to float
|
|
|
|
ret float %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @fcmp_ole(float %a, float %b) nounwind ssp {
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_ole
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp s0, s1
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-DAG: movi.2d v[[ZERO:[0-9]+]], #0
|
|
|
|
; CHECK-DAG: fmov s[[ONE:[0-9]+]], #1.0
|
|
|
|
; CHECK: fcsel s0, s[[ONE]], s[[ZERO]], ls
|
|
|
|
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp ole float %a, %b
|
|
|
|
%conv = uitofp i1 %cmp to float
|
|
|
|
ret float %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @fcmp_ord(float %a, float %b) nounwind ssp {
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_ord
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp s0, s1
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-DAG: movi.2d v[[ZERO:[0-9]+]], #0
|
|
|
|
; CHECK-DAG: fmov s[[ONE:[0-9]+]], #1.0
|
|
|
|
; CHECK: fcsel s0, s[[ONE]], s[[ZERO]], vc
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp ord float %a, %b
|
|
|
|
%conv = uitofp i1 %cmp to float
|
|
|
|
ret float %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @fcmp_uno(float %a, float %b) nounwind ssp {
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_uno
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp s0, s1
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-DAG: movi.2d v[[ZERO:[0-9]+]], #0
|
|
|
|
; CHECK-DAG: fmov s[[ONE:[0-9]+]], #1.0
|
|
|
|
; CHECK: fcsel s0, s[[ONE]], s[[ZERO]], vs
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp uno float %a, %b
|
|
|
|
%conv = uitofp i1 %cmp to float
|
|
|
|
ret float %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @fcmp_ugt(float %a, float %b) nounwind ssp {
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_ugt
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp s0, s1
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-DAG: movi.2d v[[ZERO:[0-9]+]], #0
|
|
|
|
; CHECK-DAG: fmov s[[ONE:[0-9]+]], #1.0
|
|
|
|
; CHECK: fcsel s0, s[[ONE]], s[[ZERO]], hi
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp ugt float %a, %b
|
|
|
|
%conv = uitofp i1 %cmp to float
|
|
|
|
ret float %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @fcmp_uge(float %a, float %b) nounwind ssp {
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_uge
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp s0, s1
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-DAG: movi.2d v[[ZERO:[0-9]+]], #0
|
|
|
|
; CHECK-DAG: fmov s[[ONE:[0-9]+]], #1.0
|
|
|
|
; CHECK: fcsel s0, s[[ONE]], s[[ZERO]], pl
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp uge float %a, %b
|
|
|
|
%conv = uitofp i1 %cmp to float
|
|
|
|
ret float %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @fcmp_ult(float %a, float %b) nounwind ssp {
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_ult
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp s0, s1
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-DAG: movi.2d v[[ZERO:[0-9]+]], #0
|
|
|
|
; CHECK-DAG: fmov s[[ONE:[0-9]+]], #1.0
|
|
|
|
; CHECK: fcsel s0, s[[ONE]], s[[ZERO]], lt
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp ult float %a, %b
|
|
|
|
%conv = uitofp i1 %cmp to float
|
|
|
|
ret float %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @fcmp_ule(float %a, float %b) nounwind ssp {
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_ule
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp s0, s1
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-DAG: movi.2d v[[ZERO:[0-9]+]], #0
|
|
|
|
; CHECK-DAG: fmov s[[ONE:[0-9]+]], #1.0
|
|
|
|
; CHECK: fcsel s0, s[[ONE]], s[[ZERO]], le
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp ule float %a, %b
|
|
|
|
%conv = uitofp i1 %cmp to float
|
|
|
|
ret float %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @fcmp_une(float %a, float %b) nounwind ssp {
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_une
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp s0, s1
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-DAG: movi.2d v[[ZERO:[0-9]+]], #0
|
|
|
|
; CHECK-DAG: fmov s[[ONE:[0-9]+]], #1.0
|
|
|
|
; CHECK: fcsel s0, s[[ONE]], s[[ZERO]], ne
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp une float %a, %b
|
|
|
|
%conv = uitofp i1 %cmp to float
|
|
|
|
ret float %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
; Possible opportunity for improvement. See comment in
|
|
|
|
; ARM64TargetLowering::LowerSETCC()
|
|
|
|
define float @fcmp_one(float %a, float %b) nounwind ssp {
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_one
|
2014-03-29 10:18:08 +00:00
|
|
|
; fcmp s0, s1
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-DAG: movi.2d v[[ZERO:[0-9]+]], #0
|
|
|
|
; CHECK-DAG: fmov s[[ONE:[0-9]+]], #1.0
|
|
|
|
; CHECK: fcsel [[TMP:s[0-9]+]], s[[ONE]], s[[ZERO]], mi
|
|
|
|
; CHECK: fcsel s0, s[[ONE]], [[TMP]], gt
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp one float %a, %b
|
|
|
|
%conv = uitofp i1 %cmp to float
|
|
|
|
ret float %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
; Possible opportunity for improvement. See comment in
|
|
|
|
; ARM64TargetLowering::LowerSETCC()
|
|
|
|
define float @fcmp_ueq(float %a, float %b) nounwind ssp {
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-LABEL: @fcmp_ueq
|
2014-03-29 10:18:08 +00:00
|
|
|
; CHECK: fcmp s0, s1
|
2014-04-16 09:03:09 +00:00
|
|
|
; CHECK-DAG: movi.2d v[[ZERO:[0-9]+]], #0
|
|
|
|
; CHECK-DAG: fmov s[[ONE:[0-9]+]], #1.0
|
|
|
|
; CHECK: fcsel [[TMP:s[0-9]+]], s[[ONE]], s[[ZERO]], eq
|
|
|
|
; CHECK: fcsel s0, s[[ONE]], [[TMP]], vs
|
2014-03-29 10:18:08 +00:00
|
|
|
%cmp = fcmp ueq float %a, %b
|
|
|
|
%conv = uitofp i1 %cmp to float
|
|
|
|
ret float %conv
|
|
|
|
}
|