1 ;RUN: llc < %s -march=r600 -mcpu=SI -verify-machineinstrs| FileCheck --check-prefix=SI --check-prefix=FUNC %s 2 3 ; XXX: Merge this into setcc, once R600 supports 64-bit operations 4 5 ;;;==========================================================================;;; 6 ;; Double comparisons 7 ;;;==========================================================================;;; 8 9 ; FUNC-LABEL: @f64_oeq 10 ; SI: V_CMP_EQ_F64 11 define void @f64_oeq(i32 addrspace(1)* %out, double %a, double %b) { 12 entry: 13 %0 = fcmp oeq double %a, %b 14 %1 = sext i1 %0 to i32 15 store i32 %1, i32 addrspace(1)* %out 16 ret void 17 } 18 19 ; FUNC-LABEL: @f64_ogt 20 ; SI: V_CMP_GT_F64 21 define void @f64_ogt(i32 addrspace(1)* %out, double %a, double %b) { 22 entry: 23 %0 = fcmp ogt double %a, %b 24 %1 = sext i1 %0 to i32 25 store i32 %1, i32 addrspace(1)* %out 26 ret void 27 } 28 29 ; FUNC-LABEL: @f64_oge 30 ; SI: V_CMP_GE_F64 31 define void @f64_oge(i32 addrspace(1)* %out, double %a, double %b) { 32 entry: 33 %0 = fcmp oge double %a, %b 34 %1 = sext i1 %0 to i32 35 store i32 %1, i32 addrspace(1)* %out 36 ret void 37 } 38 39 ; FUNC-LABEL: @f64_olt 40 ; SI: V_CMP_LT_F64 41 define void @f64_olt(i32 addrspace(1)* %out, double %a, double %b) { 42 entry: 43 %0 = fcmp olt double %a, %b 44 %1 = sext i1 %0 to i32 45 store i32 %1, i32 addrspace(1)* %out 46 ret void 47 } 48 49 ; FUNC-LABEL: @f64_ole 50 ; SI: V_CMP_LE_F64 51 define void @f64_ole(i32 addrspace(1)* %out, double %a, double %b) { 52 entry: 53 %0 = fcmp ole double %a, %b 54 %1 = sext i1 %0 to i32 55 store i32 %1, i32 addrspace(1)* %out 56 ret void 57 } 58 59 ; FUNC-LABEL: @f64_one 60 ; SI: V_CMP_O_F64 61 ; SI: V_CMP_NEQ_F64 62 ; SI: V_CNDMASK_B32_e64 63 ; SI: V_CNDMASK_B32_e64 64 ; SI: V_AND_B32_e32 65 define void @f64_one(i32 addrspace(1)* %out, double %a, double %b) { 66 entry: 67 %0 = fcmp one double %a, %b 68 %1 = sext i1 %0 to i32 69 store i32 %1, i32 addrspace(1)* %out 70 ret void 71 } 72 73 ; FUNC-LABEL: @f64_ord 74 ; SI: V_CMP_O_F64 75 define void @f64_ord(i32 addrspace(1)* %out, double %a, double %b) { 76 entry: 77 %0 = fcmp ord double %a, %b 78 %1 = sext i1 %0 to i32 79 store i32 %1, i32 addrspace(1)* %out 80 ret void 81 } 82 83 ; FUNC-LABEL: @f64_ueq 84 ; SI: V_CMP_U_F64 85 ; SI: V_CMP_EQ_F64 86 ; SI: V_CNDMASK_B32_e64 87 ; SI: V_CNDMASK_B32_e64 88 ; SI: V_OR_B32_e32 89 define void @f64_ueq(i32 addrspace(1)* %out, double %a, double %b) { 90 entry: 91 %0 = fcmp ueq double %a, %b 92 %1 = sext i1 %0 to i32 93 store i32 %1, i32 addrspace(1)* %out 94 ret void 95 } 96 97 ; FUNC-LABEL: @f64_ugt 98 ; SI: V_CMP_U_F64 99 ; SI: V_CMP_GT_F64 100 ; SI: V_CNDMASK_B32_e64 101 ; SI: V_CNDMASK_B32_e64 102 ; SI: V_OR_B32_e32 103 define void @f64_ugt(i32 addrspace(1)* %out, double %a, double %b) { 104 entry: 105 %0 = fcmp ugt double %a, %b 106 %1 = sext i1 %0 to i32 107 store i32 %1, i32 addrspace(1)* %out 108 ret void 109 } 110 111 ; FUNC-LABEL: @f64_uge 112 ; SI: V_CMP_U_F64 113 ; SI: V_CMP_GE_F64 114 ; SI: V_CNDMASK_B32_e64 115 ; SI: V_CNDMASK_B32_e64 116 ; SI: V_OR_B32_e32 117 define void @f64_uge(i32 addrspace(1)* %out, double %a, double %b) { 118 entry: 119 %0 = fcmp uge double %a, %b 120 %1 = sext i1 %0 to i32 121 store i32 %1, i32 addrspace(1)* %out 122 ret void 123 } 124 125 ; FUNC-LABEL: @f64_ult 126 ; SI: V_CMP_U_F64 127 ; SI: V_CMP_LT_F64 128 ; SI: V_CNDMASK_B32_e64 129 ; SI: V_CNDMASK_B32_e64 130 ; SI: V_OR_B32_e32 131 define void @f64_ult(i32 addrspace(1)* %out, double %a, double %b) { 132 entry: 133 %0 = fcmp ult double %a, %b 134 %1 = sext i1 %0 to i32 135 store i32 %1, i32 addrspace(1)* %out 136 ret void 137 } 138 139 ; FUNC-LABEL: @f64_ule 140 ; SI: V_CMP_U_F64 141 ; SI: V_CMP_LE_F64 142 ; SI: V_CNDMASK_B32_e64 143 ; SI: V_CNDMASK_B32_e64 144 ; SI: V_OR_B32_e32 145 define void @f64_ule(i32 addrspace(1)* %out, double %a, double %b) { 146 entry: 147 %0 = fcmp ule double %a, %b 148 %1 = sext i1 %0 to i32 149 store i32 %1, i32 addrspace(1)* %out 150 ret void 151 } 152 153 ; FUNC-LABEL: @f64_une 154 ; SI: V_CMP_NEQ_F64 155 define void @f64_une(i32 addrspace(1)* %out, double %a, double %b) { 156 entry: 157 %0 = fcmp une double %a, %b 158 %1 = sext i1 %0 to i32 159 store i32 %1, i32 addrspace(1)* %out 160 ret void 161 } 162 163 ; FUNC-LABEL: @f64_uno 164 ; SI: V_CMP_U_F64 165 define void @f64_uno(i32 addrspace(1)* %out, double %a, double %b) { 166 entry: 167 %0 = fcmp uno double %a, %b 168 %1 = sext i1 %0 to i32 169 store i32 %1, i32 addrspace(1)* %out 170 ret void 171 } 172 173 ;;;==========================================================================;;; 174 ;; 64-bit integer comparisons 175 ;;;==========================================================================;;; 176 177 ; FUNC-LABEL: @i64_eq 178 ; SI: V_CMP_EQ_I64 179 define void @i64_eq(i32 addrspace(1)* %out, i64 %a, i64 %b) { 180 entry: 181 %0 = icmp eq i64 %a, %b 182 %1 = sext i1 %0 to i32 183 store i32 %1, i32 addrspace(1)* %out 184 ret void 185 } 186 187 ; FUNC-LABEL: @i64_ne 188 ; SI: V_CMP_NE_I64 189 define void @i64_ne(i32 addrspace(1)* %out, i64 %a, i64 %b) { 190 entry: 191 %0 = icmp ne i64 %a, %b 192 %1 = sext i1 %0 to i32 193 store i32 %1, i32 addrspace(1)* %out 194 ret void 195 } 196 197 ; FUNC-LABEL: @i64_ugt 198 ; SI: V_CMP_GT_U64 199 define void @i64_ugt(i32 addrspace(1)* %out, i64 %a, i64 %b) { 200 entry: 201 %0 = icmp ugt i64 %a, %b 202 %1 = sext i1 %0 to i32 203 store i32 %1, i32 addrspace(1)* %out 204 ret void 205 } 206 207 ; FUNC-LABEL: @i64_uge 208 ; SI: V_CMP_GE_U64 209 define void @i64_uge(i32 addrspace(1)* %out, i64 %a, i64 %b) { 210 entry: 211 %0 = icmp uge i64 %a, %b 212 %1 = sext i1 %0 to i32 213 store i32 %1, i32 addrspace(1)* %out 214 ret void 215 } 216 217 ; FUNC-LABEL: @i64_ult 218 ; SI: V_CMP_LT_U64 219 define void @i64_ult(i32 addrspace(1)* %out, i64 %a, i64 %b) { 220 entry: 221 %0 = icmp ult i64 %a, %b 222 %1 = sext i1 %0 to i32 223 store i32 %1, i32 addrspace(1)* %out 224 ret void 225 } 226 227 ; FUNC-LABEL: @i64_ule 228 ; SI: V_CMP_LE_U64 229 define void @i64_ule(i32 addrspace(1)* %out, i64 %a, i64 %b) { 230 entry: 231 %0 = icmp ule i64 %a, %b 232 %1 = sext i1 %0 to i32 233 store i32 %1, i32 addrspace(1)* %out 234 ret void 235 } 236 237 ; FUNC-LABEL: @i64_sgt 238 ; SI: V_CMP_GT_I64 239 define void @i64_sgt(i32 addrspace(1)* %out, i64 %a, i64 %b) { 240 entry: 241 %0 = icmp sgt i64 %a, %b 242 %1 = sext i1 %0 to i32 243 store i32 %1, i32 addrspace(1)* %out 244 ret void 245 } 246 247 ; FUNC-LABEL: @i64_sge 248 ; SI: V_CMP_GE_I64 249 define void @i64_sge(i32 addrspace(1)* %out, i64 %a, i64 %b) { 250 entry: 251 %0 = icmp sge i64 %a, %b 252 %1 = sext i1 %0 to i32 253 store i32 %1, i32 addrspace(1)* %out 254 ret void 255 } 256 257 ; FUNC-LABEL: @i64_slt 258 ; SI: V_CMP_LT_I64 259 define void @i64_slt(i32 addrspace(1)* %out, i64 %a, i64 %b) { 260 entry: 261 %0 = icmp slt i64 %a, %b 262 %1 = sext i1 %0 to i32 263 store i32 %1, i32 addrspace(1)* %out 264 ret void 265 } 266 267 ; FUNC-LABEL: @i64_sle 268 ; SI: V_CMP_LE_I64 269 define void @i64_sle(i32 addrspace(1)* %out, i64 %a, i64 %b) { 270 entry: 271 %0 = icmp sle i64 %a, %b 272 %1 = sext i1 %0 to i32 273 store i32 %1, i32 addrspace(1)* %out 274 ret void 275 } 276