1; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=SI %s 2 3declare i32 @llvm.amdgcn.workitem.id.x() #0 4 5; -------------------------------------------------------------------------------- 6; i32 compares 7; -------------------------------------------------------------------------------- 8 9; GCN-LABEL: {{^}}commute_eq_64_i32: 10; GCN: v_cmp_eq_i32_e32 vcc, 64, v{{[0-9]+}} 11define void @commute_eq_64_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) #1 { 12 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 13 %gep.in = getelementptr i32, i32 addrspace(1)* %in, i32 %tid 14 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 15 %val = load i32, i32 addrspace(1)* %gep.in 16 %cmp = icmp eq i32 %val, 64 17 %ext = sext i1 %cmp to i32 18 store i32 %ext, i32 addrspace(1)* %gep.out 19 ret void 20} 21 22; GCN-LABEL: {{^}}commute_ne_64_i32: 23; GCN: v_cmp_ne_i32_e32 vcc, 64, v{{[0-9]+}} 24define void @commute_ne_64_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) #1 { 25 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 26 %gep.in = getelementptr i32, i32 addrspace(1)* %in, i32 %tid 27 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 28 %val = load i32, i32 addrspace(1)* %gep.in 29 %cmp = icmp ne i32 %val, 64 30 %ext = sext i1 %cmp to i32 31 store i32 %ext, i32 addrspace(1)* %gep.out 32 ret void 33} 34 35; FIXME: Why isn't this being folded as a constant? 36; GCN-LABEL: {{^}}commute_ne_litk_i32: 37; GCN: v_mov_b32_e32 [[K:v[0-9]+]], 0x3039 38; GCN: v_cmp_ne_i32_e32 vcc, [[K]], v{{[0-9]+}} 39define void @commute_ne_litk_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) #1 { 40 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 41 %gep.in = getelementptr i32, i32 addrspace(1)* %in, i32 %tid 42 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 43 %val = load i32, i32 addrspace(1)* %gep.in 44 %cmp = icmp ne i32 %val, 12345 45 %ext = sext i1 %cmp to i32 46 store i32 %ext, i32 addrspace(1)* %gep.out 47 ret void 48} 49 50; GCN-LABEL: {{^}}commute_ugt_64_i32: 51; GCN: v_cmp_lt_u32_e32 vcc, 64, v{{[0-9]+}} 52define void @commute_ugt_64_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) #1 { 53 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 54 %gep.in = getelementptr i32, i32 addrspace(1)* %in, i32 %tid 55 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 56 %val = load i32, i32 addrspace(1)* %gep.in 57 %cmp = icmp ugt i32 %val, 64 58 %ext = sext i1 %cmp to i32 59 store i32 %ext, i32 addrspace(1)* %gep.out 60 ret void 61} 62 63; GCN-LABEL: {{^}}commute_uge_64_i32: 64; GCN: v_cmp_lt_u32_e32 vcc, 63, v{{[0-9]+}} 65define void @commute_uge_64_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) #1 { 66 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 67 %gep.in = getelementptr i32, i32 addrspace(1)* %in, i32 %tid 68 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 69 %val = load i32, i32 addrspace(1)* %gep.in 70 %cmp = icmp uge i32 %val, 64 71 %ext = sext i1 %cmp to i32 72 store i32 %ext, i32 addrspace(1)* %gep.out 73 ret void 74} 75 76; GCN-LABEL: {{^}}commute_ult_64_i32: 77; GCN: v_cmp_gt_u32_e32 vcc, 64, v{{[0-9]+}} 78define void @commute_ult_64_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) #1 { 79 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 80 %gep.in = getelementptr i32, i32 addrspace(1)* %in, i32 %tid 81 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 82 %val = load i32, i32 addrspace(1)* %gep.in 83 %cmp = icmp ult i32 %val, 64 84 %ext = sext i1 %cmp to i32 85 store i32 %ext, i32 addrspace(1)* %gep.out 86 ret void 87} 88 89; GCN-LABEL: {{^}}commute_ule_63_i32: 90; GCN: v_cmp_gt_u32_e32 vcc, 64, v{{[0-9]+}} 91define void @commute_ule_63_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) #1 { 92 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 93 %gep.in = getelementptr i32, i32 addrspace(1)* %in, i32 %tid 94 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 95 %val = load i32, i32 addrspace(1)* %gep.in 96 %cmp = icmp ule i32 %val, 63 97 %ext = sext i1 %cmp to i32 98 store i32 %ext, i32 addrspace(1)* %gep.out 99 ret void 100} 101 102; FIXME: Undo canonicalization to gt (x + 1) since it doesn't use the inline imm 103 104; GCN-LABEL: {{^}}commute_ule_64_i32: 105; GCN: v_mov_b32_e32 [[K:v[0-9]+]], 0x41{{$}} 106; GCN: v_cmp_gt_u32_e32 vcc, [[K]], v{{[0-9]+}} 107define void @commute_ule_64_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) #1 { 108 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 109 %gep.in = getelementptr i32, i32 addrspace(1)* %in, i32 %tid 110 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 111 %val = load i32, i32 addrspace(1)* %gep.in 112 %cmp = icmp ule i32 %val, 64 113 %ext = sext i1 %cmp to i32 114 store i32 %ext, i32 addrspace(1)* %gep.out 115 ret void 116} 117 118; GCN-LABEL: {{^}}commute_sgt_neg1_i32: 119; GCN: v_cmp_lt_i32_e32 vcc, -1, v{{[0-9]+}} 120define void @commute_sgt_neg1_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) #1 { 121 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 122 %gep.in = getelementptr i32, i32 addrspace(1)* %in, i32 %tid 123 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 124 %val = load i32, i32 addrspace(1)* %gep.in 125 %cmp = icmp sgt i32 %val, -1 126 %ext = sext i1 %cmp to i32 127 store i32 %ext, i32 addrspace(1)* %gep.out 128 ret void 129} 130 131; GCN-LABEL: {{^}}commute_sge_neg2_i32: 132; GCN: v_cmp_lt_i32_e32 vcc, -3, v{{[0-9]+}} 133define void @commute_sge_neg2_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) #1 { 134 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 135 %gep.in = getelementptr i32, i32 addrspace(1)* %in, i32 %tid 136 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 137 %val = load i32, i32 addrspace(1)* %gep.in 138 %cmp = icmp sge i32 %val, -2 139 %ext = sext i1 %cmp to i32 140 store i32 %ext, i32 addrspace(1)* %gep.out 141 ret void 142} 143 144; GCN-LABEL: {{^}}commute_slt_neg16_i32: 145; GCN: v_cmp_gt_i32_e32 vcc, -16, v{{[0-9]+}} 146define void @commute_slt_neg16_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) #1 { 147 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 148 %gep.in = getelementptr i32, i32 addrspace(1)* %in, i32 %tid 149 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 150 %val = load i32, i32 addrspace(1)* %gep.in 151 %cmp = icmp slt i32 %val, -16 152 %ext = sext i1 %cmp to i32 153 store i32 %ext, i32 addrspace(1)* %gep.out 154 ret void 155} 156 157; GCN-LABEL: {{^}}commute_sle_5_i32: 158; GCN: v_cmp_gt_i32_e32 vcc, 6, v{{[0-9]+}} 159define void @commute_sle_5_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) #1 { 160 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 161 %gep.in = getelementptr i32, i32 addrspace(1)* %in, i32 %tid 162 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 163 %val = load i32, i32 addrspace(1)* %gep.in 164 %cmp = icmp sle i32 %val, 5 165 %ext = sext i1 %cmp to i32 166 store i32 %ext, i32 addrspace(1)* %gep.out 167 ret void 168} 169 170; -------------------------------------------------------------------------------- 171; i64 compares 172; -------------------------------------------------------------------------------- 173 174; GCN-LABEL: {{^}}commute_eq_64_i64: 175; GCN: v_cmp_eq_i64_e32 vcc, 64, v{{\[[0-9]+:[0-9]+\]}} 176define void @commute_eq_64_i64(i32 addrspace(1)* %out, i64 addrspace(1)* %in) #1 { 177 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 178 %gep.in = getelementptr i64, i64 addrspace(1)* %in, i32 %tid 179 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 180 %val = load i64, i64 addrspace(1)* %gep.in 181 %cmp = icmp eq i64 %val, 64 182 %ext = sext i1 %cmp to i32 183 store i32 %ext, i32 addrspace(1)* %gep.out 184 ret void 185} 186 187; GCN-LABEL: {{^}}commute_ne_64_i64: 188; GCN: v_cmp_ne_i64_e32 vcc, 64, v{{\[[0-9]+:[0-9]+\]}} 189define void @commute_ne_64_i64(i32 addrspace(1)* %out, i64 addrspace(1)* %in) #1 { 190 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 191 %gep.in = getelementptr i64, i64 addrspace(1)* %in, i32 %tid 192 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 193 %val = load i64, i64 addrspace(1)* %gep.in 194 %cmp = icmp ne i64 %val, 64 195 %ext = sext i1 %cmp to i32 196 store i32 %ext, i32 addrspace(1)* %gep.out 197 ret void 198} 199 200; GCN-LABEL: {{^}}commute_ugt_64_i64: 201; GCN: v_cmp_lt_u64_e32 vcc, 64, v{{\[[0-9]+:[0-9]+\]}} 202define void @commute_ugt_64_i64(i32 addrspace(1)* %out, i64 addrspace(1)* %in) #1 { 203 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 204 %gep.in = getelementptr i64, i64 addrspace(1)* %in, i32 %tid 205 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 206 %val = load i64, i64 addrspace(1)* %gep.in 207 %cmp = icmp ugt i64 %val, 64 208 %ext = sext i1 %cmp to i32 209 store i32 %ext, i32 addrspace(1)* %gep.out 210 ret void 211} 212 213; GCN-LABEL: {{^}}commute_uge_64_i64: 214; GCN: v_cmp_lt_u64_e32 vcc, 63, v{{\[[0-9]+:[0-9]+\]}} 215define void @commute_uge_64_i64(i32 addrspace(1)* %out, i64 addrspace(1)* %in) #1 { 216 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 217 %gep.in = getelementptr i64, i64 addrspace(1)* %in, i32 %tid 218 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 219 %val = load i64, i64 addrspace(1)* %gep.in 220 %cmp = icmp uge i64 %val, 64 221 %ext = sext i1 %cmp to i32 222 store i32 %ext, i32 addrspace(1)* %gep.out 223 ret void 224} 225 226; GCN-LABEL: {{^}}commute_ult_64_i64: 227; GCN: v_cmp_gt_u64_e32 vcc, 64, v{{\[[0-9]+:[0-9]+\]}} 228define void @commute_ult_64_i64(i32 addrspace(1)* %out, i64 addrspace(1)* %in) #1 { 229 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 230 %gep.in = getelementptr i64, i64 addrspace(1)* %in, i32 %tid 231 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 232 %val = load i64, i64 addrspace(1)* %gep.in 233 %cmp = icmp ult i64 %val, 64 234 %ext = sext i1 %cmp to i32 235 store i32 %ext, i32 addrspace(1)* %gep.out 236 ret void 237} 238 239; GCN-LABEL: {{^}}commute_ule_63_i64: 240; GCN: v_cmp_gt_u64_e32 vcc, 64, v{{\[[0-9]+:[0-9]+\]}} 241define void @commute_ule_63_i64(i32 addrspace(1)* %out, i64 addrspace(1)* %in) #1 { 242 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 243 %gep.in = getelementptr i64, i64 addrspace(1)* %in, i32 %tid 244 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 245 %val = load i64, i64 addrspace(1)* %gep.in 246 %cmp = icmp ule i64 %val, 63 247 %ext = sext i1 %cmp to i32 248 store i32 %ext, i32 addrspace(1)* %gep.out 249 ret void 250} 251 252; FIXME: Undo canonicalization to gt (x + 1) since it doesn't use the inline imm 253 254; GCN-LABEL: {{^}}commute_ule_64_i64: 255; GCN-DAG: s_movk_i32 s[[KLO:[0-9]+]], 0x41{{$}} 256; GCN: v_cmp_gt_u64_e32 vcc, s{{\[}}[[KLO]]:{{[0-9]+\]}}, v{{\[[0-9]+:[0-9]+\]}} 257define void @commute_ule_64_i64(i32 addrspace(1)* %out, i64 addrspace(1)* %in) #1 { 258 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 259 %gep.in = getelementptr i64, i64 addrspace(1)* %in, i32 %tid 260 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 261 %val = load i64, i64 addrspace(1)* %gep.in 262 %cmp = icmp ule i64 %val, 64 263 %ext = sext i1 %cmp to i32 264 store i32 %ext, i32 addrspace(1)* %gep.out 265 ret void 266} 267 268; GCN-LABEL: {{^}}commute_sgt_neg1_i64: 269; GCN: v_cmp_lt_i64_e32 vcc, -1, v{{\[[0-9]+:[0-9]+\]}} 270define void @commute_sgt_neg1_i64(i32 addrspace(1)* %out, i64 addrspace(1)* %in) #1 { 271 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 272 %gep.in = getelementptr i64, i64 addrspace(1)* %in, i32 %tid 273 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 274 %val = load i64, i64 addrspace(1)* %gep.in 275 %cmp = icmp sgt i64 %val, -1 276 %ext = sext i1 %cmp to i32 277 store i32 %ext, i32 addrspace(1)* %gep.out 278 ret void 279} 280 281; GCN-LABEL: {{^}}commute_sge_neg2_i64: 282; GCN: v_cmp_lt_i64_e32 vcc, -3, v{{\[[0-9]+:[0-9]+\]}} 283define void @commute_sge_neg2_i64(i32 addrspace(1)* %out, i64 addrspace(1)* %in) #1 { 284 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 285 %gep.in = getelementptr i64, i64 addrspace(1)* %in, i32 %tid 286 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 287 %val = load i64, i64 addrspace(1)* %gep.in 288 %cmp = icmp sge i64 %val, -2 289 %ext = sext i1 %cmp to i32 290 store i32 %ext, i32 addrspace(1)* %gep.out 291 ret void 292} 293 294; GCN-LABEL: {{^}}commute_slt_neg16_i64: 295; GCN: v_cmp_gt_i64_e32 vcc, -16, v{{\[[0-9]+:[0-9]+\]}} 296define void @commute_slt_neg16_i64(i32 addrspace(1)* %out, i64 addrspace(1)* %in) #1 { 297 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 298 %gep.in = getelementptr i64, i64 addrspace(1)* %in, i32 %tid 299 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 300 %val = load i64, i64 addrspace(1)* %gep.in 301 %cmp = icmp slt i64 %val, -16 302 %ext = sext i1 %cmp to i32 303 store i32 %ext, i32 addrspace(1)* %gep.out 304 ret void 305} 306 307; GCN-LABEL: {{^}}commute_sle_5_i64: 308; GCN: v_cmp_gt_i64_e32 vcc, 6, v{{\[[0-9]+:[0-9]+\]}} 309define void @commute_sle_5_i64(i32 addrspace(1)* %out, i64 addrspace(1)* %in) #1 { 310 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 311 %gep.in = getelementptr i64, i64 addrspace(1)* %in, i32 %tid 312 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 313 %val = load i64, i64 addrspace(1)* %gep.in 314 %cmp = icmp sle i64 %val, 5 315 %ext = sext i1 %cmp to i32 316 store i32 %ext, i32 addrspace(1)* %gep.out 317 ret void 318} 319 320; -------------------------------------------------------------------------------- 321; f32 compares 322; -------------------------------------------------------------------------------- 323 324 325; GCN-LABEL: {{^}}commute_oeq_2.0_f32: 326; GCN: v_cmp_eq_f32_e32 vcc, 2.0, v{{[0-9]+}} 327define void @commute_oeq_2.0_f32(i32 addrspace(1)* %out, float addrspace(1)* %in) #1 { 328 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 329 %gep.in = getelementptr float, float addrspace(1)* %in, i32 %tid 330 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 331 %val = load float, float addrspace(1)* %gep.in 332 %cmp = fcmp oeq float %val, 2.0 333 %ext = sext i1 %cmp to i32 334 store i32 %ext, i32 addrspace(1)* %gep.out 335 ret void 336} 337 338 339; GCN-LABEL: {{^}}commute_ogt_2.0_f32: 340; GCN: v_cmp_lt_f32_e32 vcc, 2.0, v{{[0-9]+}} 341define void @commute_ogt_2.0_f32(i32 addrspace(1)* %out, float addrspace(1)* %in) #1 { 342 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 343 %gep.in = getelementptr float, float addrspace(1)* %in, i32 %tid 344 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 345 %val = load float, float addrspace(1)* %gep.in 346 %cmp = fcmp ogt float %val, 2.0 347 %ext = sext i1 %cmp to i32 348 store i32 %ext, i32 addrspace(1)* %gep.out 349 ret void 350} 351 352; GCN-LABEL: {{^}}commute_oge_2.0_f32: 353; GCN: v_cmp_le_f32_e32 vcc, 2.0, v{{[0-9]+}} 354define void @commute_oge_2.0_f32(i32 addrspace(1)* %out, float addrspace(1)* %in) #1 { 355 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 356 %gep.in = getelementptr float, float addrspace(1)* %in, i32 %tid 357 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 358 %val = load float, float addrspace(1)* %gep.in 359 %cmp = fcmp oge float %val, 2.0 360 %ext = sext i1 %cmp to i32 361 store i32 %ext, i32 addrspace(1)* %gep.out 362 ret void 363} 364 365; GCN-LABEL: {{^}}commute_olt_2.0_f32: 366; GCN: v_cmp_gt_f32_e32 vcc, 2.0, v{{[0-9]+}} 367define void @commute_olt_2.0_f32(i32 addrspace(1)* %out, float addrspace(1)* %in) #1 { 368 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 369 %gep.in = getelementptr float, float addrspace(1)* %in, i32 %tid 370 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 371 %val = load float, float addrspace(1)* %gep.in 372 %cmp = fcmp olt float %val, 2.0 373 %ext = sext i1 %cmp to i32 374 store i32 %ext, i32 addrspace(1)* %gep.out 375 ret void 376} 377 378; GCN-LABEL: {{^}}commute_ole_2.0_f32: 379; GCN: v_cmp_ge_f32_e32 vcc, 2.0, v{{[0-9]+}} 380define void @commute_ole_2.0_f32(i32 addrspace(1)* %out, float addrspace(1)* %in) #1 { 381 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 382 %gep.in = getelementptr float, float addrspace(1)* %in, i32 %tid 383 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 384 %val = load float, float addrspace(1)* %gep.in 385 %cmp = fcmp ole float %val, 2.0 386 %ext = sext i1 %cmp to i32 387 store i32 %ext, i32 addrspace(1)* %gep.out 388 ret void 389} 390 391; GCN-LABEL: {{^}}commute_one_2.0_f32: 392; GCN: v_cmp_lg_f32_e32 vcc, 2.0, v{{[0-9]+}} 393define void @commute_one_2.0_f32(i32 addrspace(1)* %out, float addrspace(1)* %in) #1 { 394 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 395 %gep.in = getelementptr float, float addrspace(1)* %in, i32 %tid 396 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 397 %val = load float, float addrspace(1)* %gep.in 398 %cmp = fcmp one float %val, 2.0 399 %ext = sext i1 %cmp to i32 400 store i32 %ext, i32 addrspace(1)* %gep.out 401 ret void 402} 403 404; GCN-LABEL: {{^}}commute_ord_2.0_f32: 405; GCN: v_cmp_o_f32_e32 vcc, [[REG:v[0-9]+]], [[REG]] 406define void @commute_ord_2.0_f32(i32 addrspace(1)* %out, float addrspace(1)* %in) #1 { 407 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 408 %gep.in = getelementptr float, float addrspace(1)* %in, i32 %tid 409 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 410 %val = load float, float addrspace(1)* %gep.in 411 %cmp = fcmp ord float %val, 2.0 412 %ext = sext i1 %cmp to i32 413 store i32 %ext, i32 addrspace(1)* %gep.out 414 ret void 415} 416 417; GCN-LABEL: {{^}}commute_ueq_2.0_f32: 418; GCN: v_cmp_nlg_f32_e32 vcc, 2.0, v{{[0-9]+}} 419define void @commute_ueq_2.0_f32(i32 addrspace(1)* %out, float addrspace(1)* %in) #1 { 420 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 421 %gep.in = getelementptr float, float addrspace(1)* %in, i32 %tid 422 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 423 %val = load float, float addrspace(1)* %gep.in 424 %cmp = fcmp ueq float %val, 2.0 425 %ext = sext i1 %cmp to i32 426 store i32 %ext, i32 addrspace(1)* %gep.out 427 ret void 428} 429 430; GCN-LABEL: {{^}}commute_ugt_2.0_f32: 431; GCN: v_cmp_nge_f32_e32 vcc, 2.0, v{{[0-9]+}} 432define void @commute_ugt_2.0_f32(i32 addrspace(1)* %out, float addrspace(1)* %in) #1 { 433 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 434 %gep.in = getelementptr float, float addrspace(1)* %in, i32 %tid 435 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 436 %val = load float, float addrspace(1)* %gep.in 437 %cmp = fcmp ugt float %val, 2.0 438 %ext = sext i1 %cmp to i32 439 store i32 %ext, i32 addrspace(1)* %gep.out 440 ret void 441} 442 443; GCN-LABEL: {{^}}commute_uge_2.0_f32: 444; GCN: v_cmp_ngt_f32_e32 vcc, 2.0, v{{[0-9]+}} 445define void @commute_uge_2.0_f32(i32 addrspace(1)* %out, float addrspace(1)* %in) #1 { 446 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 447 %gep.in = getelementptr float, float addrspace(1)* %in, i32 %tid 448 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 449 %val = load float, float addrspace(1)* %gep.in 450 %cmp = fcmp uge float %val, 2.0 451 %ext = sext i1 %cmp to i32 452 store i32 %ext, i32 addrspace(1)* %gep.out 453 ret void 454} 455 456; GCN-LABEL: {{^}}commute_ult_2.0_f32: 457; GCN: v_cmp_nle_f32_e32 vcc, 2.0, v{{[0-9]+}} 458define void @commute_ult_2.0_f32(i32 addrspace(1)* %out, float addrspace(1)* %in) #1 { 459 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 460 %gep.in = getelementptr float, float addrspace(1)* %in, i32 %tid 461 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 462 %val = load float, float addrspace(1)* %gep.in 463 %cmp = fcmp ult float %val, 2.0 464 %ext = sext i1 %cmp to i32 465 store i32 %ext, i32 addrspace(1)* %gep.out 466 ret void 467} 468 469; GCN-LABEL: {{^}}commute_ule_2.0_f32: 470; GCN: v_cmp_nlt_f32_e32 vcc, 2.0, v{{[0-9]+}} 471define void @commute_ule_2.0_f32(i32 addrspace(1)* %out, float addrspace(1)* %in) #1 { 472 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 473 %gep.in = getelementptr float, float addrspace(1)* %in, i32 %tid 474 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 475 %val = load float, float addrspace(1)* %gep.in 476 %cmp = fcmp ule float %val, 2.0 477 %ext = sext i1 %cmp to i32 478 store i32 %ext, i32 addrspace(1)* %gep.out 479 ret void 480} 481 482; GCN-LABEL: {{^}}commute_une_2.0_f32: 483; GCN: v_cmp_neq_f32_e32 vcc, 2.0, v{{[0-9]+}} 484define void @commute_une_2.0_f32(i32 addrspace(1)* %out, float addrspace(1)* %in) #1 { 485 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 486 %gep.in = getelementptr float, float addrspace(1)* %in, i32 %tid 487 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 488 %val = load float, float addrspace(1)* %gep.in 489 %cmp = fcmp une float %val, 2.0 490 %ext = sext i1 %cmp to i32 491 store i32 %ext, i32 addrspace(1)* %gep.out 492 ret void 493} 494 495; GCN-LABEL: {{^}}commute_uno_2.0_f32: 496; GCN: v_cmp_u_f32_e32 vcc, [[REG:v[0-9]+]], [[REG]] 497define void @commute_uno_2.0_f32(i32 addrspace(1)* %out, float addrspace(1)* %in) #1 { 498 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 499 %gep.in = getelementptr float, float addrspace(1)* %in, i32 %tid 500 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 501 %val = load float, float addrspace(1)* %gep.in 502 %cmp = fcmp uno float %val, 2.0 503 %ext = sext i1 %cmp to i32 504 store i32 %ext, i32 addrspace(1)* %gep.out 505 ret void 506} 507 508; -------------------------------------------------------------------------------- 509; f64 compares 510; -------------------------------------------------------------------------------- 511 512 513; GCN-LABEL: {{^}}commute_oeq_2.0_f64: 514; GCN: v_cmp_eq_f64_e32 vcc, 2.0, v{{\[[0-9]+:[0-9]+\]}} 515define void @commute_oeq_2.0_f64(i32 addrspace(1)* %out, double addrspace(1)* %in) #1 { 516 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 517 %gep.in = getelementptr double, double addrspace(1)* %in, i32 %tid 518 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 519 %val = load double, double addrspace(1)* %gep.in 520 %cmp = fcmp oeq double %val, 2.0 521 %ext = sext i1 %cmp to i32 522 store i32 %ext, i32 addrspace(1)* %gep.out 523 ret void 524} 525 526 527; GCN-LABEL: {{^}}commute_ogt_2.0_f64: 528; GCN: v_cmp_lt_f64_e32 vcc, 2.0, v{{\[[0-9]+:[0-9]+\]}} 529define void @commute_ogt_2.0_f64(i32 addrspace(1)* %out, double addrspace(1)* %in) #1 { 530 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 531 %gep.in = getelementptr double, double addrspace(1)* %in, i32 %tid 532 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 533 %val = load double, double addrspace(1)* %gep.in 534 %cmp = fcmp ogt double %val, 2.0 535 %ext = sext i1 %cmp to i32 536 store i32 %ext, i32 addrspace(1)* %gep.out 537 ret void 538} 539 540; GCN-LABEL: {{^}}commute_oge_2.0_f64: 541; GCN: v_cmp_le_f64_e32 vcc, 2.0, v{{\[[0-9]+:[0-9]+\]}} 542define void @commute_oge_2.0_f64(i32 addrspace(1)* %out, double addrspace(1)* %in) #1 { 543 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 544 %gep.in = getelementptr double, double addrspace(1)* %in, i32 %tid 545 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 546 %val = load double, double addrspace(1)* %gep.in 547 %cmp = fcmp oge double %val, 2.0 548 %ext = sext i1 %cmp to i32 549 store i32 %ext, i32 addrspace(1)* %gep.out 550 ret void 551} 552 553; GCN-LABEL: {{^}}commute_olt_2.0_f64: 554; GCN: v_cmp_gt_f64_e32 vcc, 2.0, v{{\[[0-9]+:[0-9]+\]}} 555define void @commute_olt_2.0_f64(i32 addrspace(1)* %out, double addrspace(1)* %in) #1 { 556 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 557 %gep.in = getelementptr double, double addrspace(1)* %in, i32 %tid 558 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 559 %val = load double, double addrspace(1)* %gep.in 560 %cmp = fcmp olt double %val, 2.0 561 %ext = sext i1 %cmp to i32 562 store i32 %ext, i32 addrspace(1)* %gep.out 563 ret void 564} 565 566; GCN-LABEL: {{^}}commute_ole_2.0_f64: 567; GCN: v_cmp_ge_f64_e32 vcc, 2.0, v{{\[[0-9]+:[0-9]+\]}} 568define void @commute_ole_2.0_f64(i32 addrspace(1)* %out, double addrspace(1)* %in) #1 { 569 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 570 %gep.in = getelementptr double, double addrspace(1)* %in, i32 %tid 571 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 572 %val = load double, double addrspace(1)* %gep.in 573 %cmp = fcmp ole double %val, 2.0 574 %ext = sext i1 %cmp to i32 575 store i32 %ext, i32 addrspace(1)* %gep.out 576 ret void 577} 578 579; GCN-LABEL: {{^}}commute_one_2.0_f64: 580; GCN: v_cmp_lg_f64_e32 vcc, 2.0, v{{\[[0-9]+:[0-9]+\]}} 581define void @commute_one_2.0_f64(i32 addrspace(1)* %out, double addrspace(1)* %in) #1 { 582 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 583 %gep.in = getelementptr double, double addrspace(1)* %in, i32 %tid 584 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 585 %val = load double, double addrspace(1)* %gep.in 586 %cmp = fcmp one double %val, 2.0 587 %ext = sext i1 %cmp to i32 588 store i32 %ext, i32 addrspace(1)* %gep.out 589 ret void 590} 591 592; GCN-LABEL: {{^}}commute_ord_2.0_f64: 593; GCN: v_cmp_o_f64_e32 vcc, [[REG:v\[[0-9]+:[0-9]+\]]], [[REG]] 594define void @commute_ord_2.0_f64(i32 addrspace(1)* %out, double addrspace(1)* %in) #1 { 595 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 596 %gep.in = getelementptr double, double addrspace(1)* %in, i32 %tid 597 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 598 %val = load double, double addrspace(1)* %gep.in 599 %cmp = fcmp ord double %val, 2.0 600 %ext = sext i1 %cmp to i32 601 store i32 %ext, i32 addrspace(1)* %gep.out 602 ret void 603} 604 605; GCN-LABEL: {{^}}commute_ueq_2.0_f64: 606; GCN: v_cmp_nlg_f64_e32 vcc, 2.0, v{{\[[0-9]+:[0-9]+\]}} 607define void @commute_ueq_2.0_f64(i32 addrspace(1)* %out, double addrspace(1)* %in) #1 { 608 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 609 %gep.in = getelementptr double, double addrspace(1)* %in, i32 %tid 610 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 611 %val = load double, double addrspace(1)* %gep.in 612 %cmp = fcmp ueq double %val, 2.0 613 %ext = sext i1 %cmp to i32 614 store i32 %ext, i32 addrspace(1)* %gep.out 615 ret void 616} 617 618; GCN-LABEL: {{^}}commute_ugt_2.0_f64: 619; GCN: v_cmp_nge_f64_e32 vcc, 2.0, v{{\[[0-9]+:[0-9]+\]}} 620define void @commute_ugt_2.0_f64(i32 addrspace(1)* %out, double addrspace(1)* %in) #1 { 621 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 622 %gep.in = getelementptr double, double addrspace(1)* %in, i32 %tid 623 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 624 %val = load double, double addrspace(1)* %gep.in 625 %cmp = fcmp ugt double %val, 2.0 626 %ext = sext i1 %cmp to i32 627 store i32 %ext, i32 addrspace(1)* %gep.out 628 ret void 629} 630 631; GCN-LABEL: {{^}}commute_uge_2.0_f64: 632; GCN: v_cmp_ngt_f64_e32 vcc, 2.0, v{{\[[0-9]+:[0-9]+\]}} 633define void @commute_uge_2.0_f64(i32 addrspace(1)* %out, double addrspace(1)* %in) #1 { 634 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 635 %gep.in = getelementptr double, double addrspace(1)* %in, i32 %tid 636 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 637 %val = load double, double addrspace(1)* %gep.in 638 %cmp = fcmp uge double %val, 2.0 639 %ext = sext i1 %cmp to i32 640 store i32 %ext, i32 addrspace(1)* %gep.out 641 ret void 642} 643 644; GCN-LABEL: {{^}}commute_ult_2.0_f64: 645; GCN: v_cmp_nle_f64_e32 vcc, 2.0, v{{\[[0-9]+:[0-9]+\]}} 646define void @commute_ult_2.0_f64(i32 addrspace(1)* %out, double addrspace(1)* %in) #1 { 647 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 648 %gep.in = getelementptr double, double addrspace(1)* %in, i32 %tid 649 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 650 %val = load double, double addrspace(1)* %gep.in 651 %cmp = fcmp ult double %val, 2.0 652 %ext = sext i1 %cmp to i32 653 store i32 %ext, i32 addrspace(1)* %gep.out 654 ret void 655} 656 657; GCN-LABEL: {{^}}commute_ule_2.0_f64: 658; GCN: v_cmp_nlt_f64_e32 vcc, 2.0, v{{\[[0-9]+:[0-9]+\]}} 659define void @commute_ule_2.0_f64(i32 addrspace(1)* %out, double addrspace(1)* %in) #1 { 660 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 661 %gep.in = getelementptr double, double addrspace(1)* %in, i32 %tid 662 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 663 %val = load double, double addrspace(1)* %gep.in 664 %cmp = fcmp ule double %val, 2.0 665 %ext = sext i1 %cmp to i32 666 store i32 %ext, i32 addrspace(1)* %gep.out 667 ret void 668} 669 670; GCN-LABEL: {{^}}commute_une_2.0_f64: 671; GCN: v_cmp_neq_f64_e32 vcc, 2.0, v{{\[[0-9]+:[0-9]+\]}} 672define void @commute_une_2.0_f64(i32 addrspace(1)* %out, double addrspace(1)* %in) #1 { 673 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 674 %gep.in = getelementptr double, double addrspace(1)* %in, i32 %tid 675 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 676 %val = load double, double addrspace(1)* %gep.in 677 %cmp = fcmp une double %val, 2.0 678 %ext = sext i1 %cmp to i32 679 store i32 %ext, i32 addrspace(1)* %gep.out 680 ret void 681} 682 683; GCN-LABEL: {{^}}commute_uno_2.0_f64: 684; GCN: v_cmp_u_f64_e32 vcc, [[REG:v\[[0-9]+:[0-9]+\]]], [[REG]] 685define void @commute_uno_2.0_f64(i32 addrspace(1)* %out, double addrspace(1)* %in) #1 { 686 %tid = call i32 @llvm.amdgcn.workitem.id.x() #0 687 %gep.in = getelementptr double, double addrspace(1)* %in, i32 %tid 688 %gep.out = getelementptr i32, i32 addrspace(1)* %out, i32 %tid 689 %val = load double, double addrspace(1)* %gep.in 690 %cmp = fcmp uno double %val, 2.0 691 %ext = sext i1 %cmp to i32 692 store i32 %ext, i32 addrspace(1)* %gep.out 693 ret void 694} 695 696attributes #0 = { nounwind readnone } 697attributes #1 = { nounwind } 698