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 12target 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" 13target 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: 28define i8 @icmp_eq_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 29entry: 30 %A = icmp eq i8 %arg1, %arg2 31 %B = select i1 %A, i8 %val1, i8 %val2 32 ret i8 %B 33} 34 35define i1 @icmp_eq_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 36entry: 37 %A = icmp eq i8 %arg1, %arg2 38 ret i1 %A 39} 40 41define i8 @icmp_eq_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 42entry: 43 %A = icmp eq i8 %arg1, 127 44 %B = select i1 %A, i8 %val1, i8 %val2 45 ret i8 %B 46} 47 48define i8 @icmp_eq_immed02_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 49entry: 50 %A = icmp eq i8 %arg1, -128 51 %B = select i1 %A, i8 %val1, i8 %val2 52 ret i8 %B 53} 54 55define i8 @icmp_eq_immed03_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 56entry: 57 %A = icmp eq i8 %arg1, -1 58 %B = select i1 %A, i8 %val1, i8 %val2 59 ret i8 %B 60} 61 62define i8 @icmp_ne_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 63entry: 64 %A = icmp ne i8 %arg1, %arg2 65 %B = select i1 %A, i8 %val1, i8 %val2 66 ret i8 %B 67} 68 69define i1 @icmp_ne_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 70entry: 71 %A = icmp ne i8 %arg1, %arg2 72 ret i1 %A 73} 74 75define i8 @icmp_ne_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 76entry: 77 %A = icmp ne i8 %arg1, 127 78 %B = select i1 %A, i8 %val1, i8 %val2 79 ret i8 %B 80} 81 82define i8 @icmp_ne_immed02_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 83entry: 84 %A = icmp ne i8 %arg1, -128 85 %B = select i1 %A, i8 %val1, i8 %val2 86 ret i8 %B 87} 88 89define i8 @icmp_ne_immed03_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 90entry: 91 %A = icmp ne i8 %arg1, -1 92 %B = select i1 %A, i8 %val1, i8 %val2 93 ret i8 %B 94} 95 96define i8 @icmp_ugt_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 97entry: 98 %A = icmp ugt i8 %arg1, %arg2 99 %B = select i1 %A, i8 %val1, i8 %val2 100 ret i8 %B 101} 102 103define i1 @icmp_ugt_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 104entry: 105 %A = icmp ugt i8 %arg1, %arg2 106 ret i1 %A 107} 108 109define i8 @icmp_ugt_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 110entry: 111 %A = icmp ugt i8 %arg1, 126 112 %B = select i1 %A, i8 %val1, i8 %val2 113 ret i8 %B 114} 115 116define i8 @icmp_uge_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 117entry: 118 %A = icmp uge i8 %arg1, %arg2 119 %B = select i1 %A, i8 %val1, i8 %val2 120 ret i8 %B 121} 122 123define i1 @icmp_uge_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 124entry: 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 135define i8 @icmp_ult_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 136entry: 137 %A = icmp ult i8 %arg1, %arg2 138 %B = select i1 %A, i8 %val1, i8 %val2 139 ret i8 %B 140} 141 142define i1 @icmp_ult_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 143entry: 144 %A = icmp ult i8 %arg1, %arg2 145 ret i1 %A 146} 147 148define i8 @icmp_ult_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 149entry: 150 %A = icmp ult i8 %arg1, 253 151 %B = select i1 %A, i8 %val1, i8 %val2 152 ret i8 %B 153} 154 155define i8 @icmp_ult_immed02_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 156entry: 157 %A = icmp ult i8 %arg1, 129 158 %B = select i1 %A, i8 %val1, i8 %val2 159 ret i8 %B 160} 161 162define i8 @icmp_ule_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 163entry: 164 %A = icmp ule i8 %arg1, %arg2 165 %B = select i1 %A, i8 %val1, i8 %val2 166 ret i8 %B 167} 168 169define i1 @icmp_ule_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 170entry: 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 181define i8 @icmp_sgt_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 182entry: 183 %A = icmp sgt i8 %arg1, %arg2 184 %B = select i1 %A, i8 %val1, i8 %val2 185 ret i8 %B 186} 187 188define i1 @icmp_sgt_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 189entry: 190 %A = icmp sgt i8 %arg1, %arg2 191 ret i1 %A 192} 193 194define i8 @icmp_sgt_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 195entry: 196 %A = icmp sgt i8 %arg1, 96 197 %B = select i1 %A, i8 %val1, i8 %val2 198 ret i8 %B 199} 200 201define i8 @icmp_sgt_immed02_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 202entry: 203 %A = icmp sgt i8 %arg1, -1 204 %B = select i1 %A, i8 %val1, i8 %val2 205 ret i8 %B 206} 207 208define i8 @icmp_sgt_immed03_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 209entry: 210 %A = icmp sgt i8 %arg1, -128 211 %B = select i1 %A, i8 %val1, i8 %val2 212 ret i8 %B 213} 214 215define i8 @icmp_sge_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 216entry: 217 %A = icmp sge i8 %arg1, %arg2 218 %B = select i1 %A, i8 %val1, i8 %val2 219 ret i8 %B 220} 221 222define i1 @icmp_sge_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 223entry: 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 234define i8 @icmp_slt_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 235entry: 236 %A = icmp slt i8 %arg1, %arg2 237 %B = select i1 %A, i8 %val1, i8 %val2 238 ret i8 %B 239} 240 241define i1 @icmp_slt_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 242entry: 243 %A = icmp slt i8 %arg1, %arg2 244 ret i1 %A 245} 246 247define i8 @icmp_slt_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 248entry: 249 %A = icmp slt i8 %arg1, 96 250 %B = select i1 %A, i8 %val1, i8 %val2 251 ret i8 %B 252} 253 254define i8 @icmp_slt_immed02_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 255entry: 256 %A = icmp slt i8 %arg1, -120 257 %B = select i1 %A, i8 %val1, i8 %val2 258 ret i8 %B 259} 260 261define i8 @icmp_slt_immed03_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind { 262entry: 263 %A = icmp slt i8 %arg1, -1 264 %B = select i1 %A, i8 %val1, i8 %val2 265 ret i8 %B 266} 267 268define i8 @icmp_sle_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 269entry: 270 %A = icmp sle i8 %arg1, %arg2 271 %B = select i1 %A, i8 %val1, i8 %val2 272 ret i8 %B 273} 274 275define i1 @icmp_sle_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind { 276entry: 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