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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
|
; RUN: llc -march=hexagon < %s | FileCheck %s
;
; Test that all FP ordered compare instructions generate the correct
; post-processing to accommodate NaNs.
;
; Specifically for ordered FP compares, we have to check if one of
; the operands was a NaN to comform to the semantics of the ordered
; fcmp bitcode instruction
;
target triple = "hexagon"
;
; Functions for float:
;
;
; CHECK-DAG: [[REG0:p([0-3])]] = sfcmp.eq(r0,r1)
; CHECK-DAG: [[REG1:p([0-3])]] = sfcmp.uo(r0,r1)
; CHECK: [[REG2:p([0-3])]] = and([[REG0]],![[REG1]])
; CHECK: r0 = mux([[REG2]],#1,#0)
;
define i32 @compare_oeq_f(float %val, float %val2) local_unnamed_addr #0 {
entry:
%cmpinf = fcmp oeq float %val, %val2
%0 = zext i1 %cmpinf to i32
ret i32 %0
}
;
; CHECK-DAG: [[REG0:p([0-3])]] = sfcmp.eq(r0,r1)
; CHECK-DAG: [[REG1:p([0-3])]] = sfcmp.uo(r0,r1)
; CHECK: [[REG2:p([0-3])]] = or([[REG0]],[[REG1]])
; CHECK: r0 = mux([[REG2]],#0,#1)
;
define i32 @compare_one_f(float %val, float %val2) local_unnamed_addr #0 {
entry:
%cmpinf = fcmp one float %val, %val2
%0 = zext i1 %cmpinf to i32
ret i32 %0
}
;
; CHECK-DAG: [[REG0:p([0-3])]] = sfcmp.gt(r0,r1)
; CHECK-DAG: [[REG1:p([0-3])]] = sfcmp.uo(r0,r1)
; CHECK: [[REG2:p([0-3])]] = and([[REG0]],![[REG1]])
; CHECK: r0 = mux([[REG2]],#1,#0)
;
define i32 @compare_ogt_f(float %val, float %val2) local_unnamed_addr #0 {
entry:
%cmpinf = fcmp ogt float %val, %val2
%0 = zext i1 %cmpinf to i32
ret i32 %0
}
;
; CHECK-DAG: [[REG0:p([0-3])]] = sfcmp.ge(r1,r0)
; CHECK-DAG: [[REG1:p([0-3])]] = sfcmp.uo(r1,r0)
; CHECK: [[REG2:p([0-3])]] = and([[REG0]],![[REG1]])
; CHECK: r0 = mux([[REG2]],#1,#0)
;
define i32 @compare_ole_f(float %val, float %val2) local_unnamed_addr #0 {
entry:
%cmpinf = fcmp ole float %val, %val2
%0 = zext i1 %cmpinf to i32
ret i32 %0
}
;
; CHECK-DAG: [[REG0:p([0-3])]] = sfcmp.ge(r0,r1)
; CHECK-DAG: [[REG1:p([0-3])]] = sfcmp.uo(r0,r1)
; CHECK: [[REG2:p([0-3])]] = and([[REG0]],![[REG1]])
; CHECK: r0 = mux([[REG2]],#1,#0)
;
define i32 @compare_oge_f(float %val, float %val2) local_unnamed_addr #0 {
entry:
%cmpinf = fcmp oge float %val, %val2
%0 = zext i1 %cmpinf to i32
ret i32 %0
}
;
; CHECK-DAG: [[REG0:p([0-3])]] = sfcmp.gt(r1,r0)
; CHECK-DAG: [[REG1:p([0-3])]] = sfcmp.uo(r1,r0)
; CHECK: [[REG2:p([0-3])]] = and([[REG0]],![[REG1]])
; CHECK: r0 = mux([[REG2]],#1,#0)
;
define i32 @compare_olt_f(float %val, float %val2) local_unnamed_addr #0 {
entry:
%cmpinf = fcmp olt float %val, %val2
%0 = zext i1 %cmpinf to i32
ret i32 %0
}
;
; Functions for double:
;
;
; CHECK-DAG: [[REG0:p([0-3])]] = dfcmp.eq(r1:0,r3:2)
; CHECK-DAG: [[REG1:p([0-3])]] = dfcmp.uo(r1:0,r3:2)
; CHECK: [[REG2:p([0-3])]] = and([[REG0]],![[REG1]])
; CHECK: r0 = mux([[REG2]],#1,#0)
;
define i32 @compare_oeq_d(double %val, double %val2) local_unnamed_addr #0 {
entry:
%cmpinf = fcmp oeq double %val, %val2
%0 = zext i1 %cmpinf to i32
ret i32 %0
}
;
; CHECK-DAG: [[REG0:p([0-3])]] = dfcmp.eq(r1:0,r3:2)
; CHECK-DAG: [[REG1:p([0-3])]] = dfcmp.uo(r1:0,r3:2)
; CHECK: [[REG2:p([0-3])]] = or([[REG0]],[[REG1]])
; CHECK: r0 = mux([[REG2]],#0,#1)
;
define i32 @compare_one_d(double %val, double %val2) local_unnamed_addr #0 {
entry:
%cmpinf = fcmp one double %val, %val2
%0 = zext i1 %cmpinf to i32
ret i32 %0
}
;
; CHECK-DAG: [[REG0:p([0-3])]] = dfcmp.gt(r1:0,r3:2)
; CHECK-DAG: [[REG1:p([0-3])]] = dfcmp.uo(r1:0,r3:2)
; CHECK: [[REG2:p([0-3])]] = and([[REG0]],![[REG1]])
; CHECK: r0 = mux([[REG2]],#1,#0)
;
define i32 @compare_ogt_d(double %val, double %val2) local_unnamed_addr #0 {
entry:
%cmpinf = fcmp ogt double %val, %val2
%0 = zext i1 %cmpinf to i32
ret i32 %0
}
;
; CHECK-DAG: [[REG0:p([0-3])]] = dfcmp.ge(r3:2,r1:0)
; CHECK-DAG: [[REG1:p([0-3])]] = dfcmp.uo(r3:2,r1:0)
; CHECK: [[REG2:p([0-3])]] = and([[REG0]],![[REG1]])
; CHECK: r0 = mux([[REG2]],#1,#0)
;
define i32 @compare_ole_d(double %val, double %val2) local_unnamed_addr #0 {
entry:
%cmpinf = fcmp ole double %val, %val2
%0 = zext i1 %cmpinf to i32
ret i32 %0
}
;
; CHECK-DAG: [[REG0:p([0-3])]] = dfcmp.ge(r1:0,r3:2)
; CHECK-DAG: [[REG1:p([0-3])]] = dfcmp.uo(r1:0,r3:2)
; CHECK: [[REG2:p([0-3])]] = and([[REG0]],![[REG1]])
; CHECK: r0 = mux([[REG2]],#1,#0)
;
define i32 @compare_oge_d(double %val, double %val2) local_unnamed_addr #0 {
entry:
%cmpinf = fcmp oge double %val, %val2
%0 = zext i1 %cmpinf to i32
ret i32 %0
}
;
; CHECK-DAG: [[REG0:p([0-3])]] = dfcmp.gt(r3:2,r1:0)
; CHECK-DAG: [[REG1:p([0-3])]] = dfcmp.uo(r3:2,r1:0)
; CHECK: [[REG2:p([0-3])]] = and([[REG0]],![[REG1]])
; CHECK: r0 = mux([[REG2]],#1,#0)
;
define i32 @compare_olt_d(double %val, double %val2) local_unnamed_addr #0 {
entry:
%cmpinf = fcmp olt double %val, %val2
%0 = zext i1 %cmpinf to i32
ret i32 %0
}
|