1 ; RUN: llc < %s -march=cellspu > %t1.s 2 ; RUN: grep ceqb %t1.s | count 24 3 ; RUN: grep ceqbi %t1.s | count 12 4 ; RUN: grep clgtb %t1.s | count 11 5 ; RUN: grep cgtb %t1.s | count 13 6 ; RUN: grep cgtbi %t1.s | count 5 7 ; RUN: grep {selb\t\\\$3, \\\$6, \\\$5, \\\$3} %t1.s | count 7 8 ; RUN: grep {selb\t\\\$3, \\\$5, \\\$6, \\\$3} %t1.s | count 3 9 ; RUN: grep {selb\t\\\$3, \\\$5, \\\$4, \\\$3} %t1.s | count 11 10 ; RUN: grep {selb\t\\\$3, \\\$4, \\\$5, \\\$3} %t1.s | count 4 11 12 target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i16:16:128-i8:8:128-i1:8:128-a0:0:128-v128:128:128-s0:128:128" 13 target triple = "spu" 14 15 ; $3 = %arg1, $4 = %arg2, $5 = %val1, $6 = %val2 16 ; $3 = %arg1, $4 = %val1, $5 = %val2 17 ; 18 ; For "positive" comparisons: 19 ; selb $3, $6, $5, <i1> 20 ; selb $3, $5, $4, <i1> 21 ; 22 ; For "negative" comparisons, i.e., those where the result of the comparison 23 ; must be inverted (setne, for example): 24 ; selb $3, $5, $6, <i1> 25 ; selb $3, $4, $5, <i1> 26 27 ; i8 integer comparisons: 28 define i8 @icmp_eq_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 29 entry: 30 %A = icmp eq i8 %arg1, %arg2 31 %B = select i1 %A, i8 %val1, i8 %val2 32 ret i8 %B 33 } 34 35 define i1 @icmp_eq_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 36 entry: 37 %A = icmp eq i8 %arg1, %arg2 38 ret i1 %A 39 } 40 41 define i8 @icmp_eq_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 42 entry: 43 %A = icmp eq i8 %arg1, 127 44 %B = select i1 %A, i8 %val1, i8 %val2 45 ret i8 %B 46 } 47 48 define i8 @icmp_eq_immed02_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 49 entry: 50 %A = icmp eq i8 %arg1, -128 51 %B = select i1 %A, i8 %val1, i8 %val2 52 ret i8 %B 53 } 54 55 define i8 @icmp_eq_immed03_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 56 entry: 57 %A = icmp eq i8 %arg1, -1 58 %B = select i1 %A, i8 %val1, i8 %val2 59 ret i8 %B 60 } 61 62 define i8 @icmp_ne_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 63 entry: 64 %A = icmp ne i8 %arg1, %arg2 65 %B = select i1 %A, i8 %val1, i8 %val2 66 ret i8 %B 67 } 68 69 define i1 @icmp_ne_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 70 entry: 71 %A = icmp ne i8 %arg1, %arg2 72 ret i1 %A 73 } 74 75 define i8 @icmp_ne_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 76 entry: 77 %A = icmp ne i8 %arg1, 127 78 %B = select i1 %A, i8 %val1, i8 %val2 79 ret i8 %B 80 } 81 82 define i8 @icmp_ne_immed02_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 83 entry: 84 %A = icmp ne i8 %arg1, -128 85 %B = select i1 %A, i8 %val1, i8 %val2 86 ret i8 %B 87 } 88 89 define i8 @icmp_ne_immed03_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 90 entry: 91 %A = icmp ne i8 %arg1, -1 92 %B = select i1 %A, i8 %val1, i8 %val2 93 ret i8 %B 94 } 95 96 define i8 @icmp_ugt_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 97 entry: 98 %A = icmp ugt i8 %arg1, %arg2 99 %B = select i1 %A, i8 %val1, i8 %val2 100 ret i8 %B 101 } 102 103 define i1 @icmp_ugt_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 104 entry: 105 %A = icmp ugt i8 %arg1, %arg2 106 ret i1 %A 107 } 108 109 define i8 @icmp_ugt_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 110 entry: 111 %A = icmp ugt i8 %arg1, 126 112 %B = select i1 %A, i8 %val1, i8 %val2 113 ret i8 %B 114 } 115 116 define i8 @icmp_uge_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 117 entry: 118 %A = icmp uge i8 %arg1, %arg2 119 %B = select i1 %A, i8 %val1, i8 %val2 120 ret i8 %B 121 } 122 123 define i1 @icmp_uge_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 124 entry: 125 %A = icmp uge i8 %arg1, %arg2 126 ret i1 %A 127 } 128 129 ;; Note: icmp uge i8 %arg1, <immed> can always be transformed into 130 ;; icmp ugt i8 %arg1, <immed>-1 131 ;; 132 ;; Consequently, even though the patterns exist to match, it's unlikely 133 ;; they'll ever be generated. 134 135 define i8 @icmp_ult_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 136 entry: 137 %A = icmp ult i8 %arg1, %arg2 138 %B = select i1 %A, i8 %val1, i8 %val2 139 ret i8 %B 140 } 141 142 define i1 @icmp_ult_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 143 entry: 144 %A = icmp ult i8 %arg1, %arg2 145 ret i1 %A 146 } 147 148 define i8 @icmp_ult_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 149 entry: 150 %A = icmp ult i8 %arg1, 253 151 %B = select i1 %A, i8 %val1, i8 %val2 152 ret i8 %B 153 } 154 155 define i8 @icmp_ult_immed02_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 156 entry: 157 %A = icmp ult i8 %arg1, 129 158 %B = select i1 %A, i8 %val1, i8 %val2 159 ret i8 %B 160 } 161 162 define i8 @icmp_ule_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 163 entry: 164 %A = icmp ule i8 %arg1, %arg2 165 %B = select i1 %A, i8 %val1, i8 %val2 166 ret i8 %B 167 } 168 169 define i1 @icmp_ule_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 170 entry: 171 %A = icmp ule i8 %arg1, %arg2 172 ret i1 %A 173 } 174 175 ;; Note: icmp ule i8 %arg1, <immed> can always be transformed into 176 ;; icmp ult i8 %arg1, <immed>+1 177 ;; 178 ;; Consequently, even though the patterns exist to match, it's unlikely 179 ;; they'll ever be generated. 180 181 define i8 @icmp_sgt_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 182 entry: 183 %A = icmp sgt i8 %arg1, %arg2 184 %B = select i1 %A, i8 %val1, i8 %val2 185 ret i8 %B 186 } 187 188 define i1 @icmp_sgt_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 189 entry: 190 %A = icmp sgt i8 %arg1, %arg2 191 ret i1 %A 192 } 193 194 define i8 @icmp_sgt_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 195 entry: 196 %A = icmp sgt i8 %arg1, 96 197 %B = select i1 %A, i8 %val1, i8 %val2 198 ret i8 %B 199 } 200 201 define i8 @icmp_sgt_immed02_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 202 entry: 203 %A = icmp sgt i8 %arg1, -1 204 %B = select i1 %A, i8 %val1, i8 %val2 205 ret i8 %B 206 } 207 208 define i8 @icmp_sgt_immed03_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 209 entry: 210 %A = icmp sgt i8 %arg1, -128 211 %B = select i1 %A, i8 %val1, i8 %val2 212 ret i8 %B 213 } 214 215 define i8 @icmp_sge_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 216 entry: 217 %A = icmp sge i8 %arg1, %arg2 218 %B = select i1 %A, i8 %val1, i8 %val2 219 ret i8 %B 220 } 221 222 define i1 @icmp_sge_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 223 entry: 224 %A = icmp sge i8 %arg1, %arg2 225 ret i1 %A 226 } 227 228 ;; Note: icmp sge i8 %arg1, <immed> can always be transformed into 229 ;; icmp sgt i8 %arg1, <immed>-1 230 ;; 231 ;; Consequently, even though the patterns exist to match, it's unlikely 232 ;; they'll ever be generated. 233 234 define i8 @icmp_slt_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 235 entry: 236 %A = icmp slt i8 %arg1, %arg2 237 %B = select i1 %A, i8 %val1, i8 %val2 238 ret i8 %B 239 } 240 241 define i1 @icmp_slt_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 242 entry: 243 %A = icmp slt i8 %arg1, %arg2 244 ret i1 %A 245 } 246 247 define i8 @icmp_slt_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 248 entry: 249 %A = icmp slt i8 %arg1, 96 250 %B = select i1 %A, i8 %val1, i8 %val2 251 ret i8 %B 252 } 253 254 define i8 @icmp_slt_immed02_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 255 entry: 256 %A = icmp slt i8 %arg1, -120 257 %B = select i1 %A, i8 %val1, i8 %val2 258 ret i8 %B 259 } 260 261 define i8 @icmp_slt_immed03_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 262 entry: 263 %A = icmp slt i8 %arg1, -1 264 %B = select i1 %A, i8 %val1, i8 %val2 265 ret i8 %B 266 } 267 268 define i8 @icmp_sle_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 269 entry: 270 %A = icmp sle i8 %arg1, %arg2 271 %B = select i1 %A, i8 %val1, i8 %val2 272 ret i8 %B 273 } 274 275 define i1 @icmp_sle_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 276 entry: 277 %A = icmp sle i8 %arg1, %arg2 278 ret i1 %A 279 } 280 281 ;; Note: icmp sle i8 %arg1, <immed> can always be transformed into 282 ;; icmp slt i8 %arg1, <immed>+1 283 ;; 284 ;; Consequently, even though the patterns exist to match, it's unlikely 285 ;; they'll ever be generated. 286 287