1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=x86_64-unknown-unknown -show-mc-encoding | FileCheck %s 3 4@d = global i8 0, align 1 5 6define i32 @test1(i32 %X, i32* %y) nounwind { 7; CHECK-LABEL: test1: 8; CHECK: # %bb.0: # %entry 9; CHECK-NEXT: cmpl $0, (%rsi) # encoding: [0x83,0x3e,0x00] 10; CHECK-NEXT: je .LBB0_2 # encoding: [0x74,A] 11; CHECK-NEXT: # fixup A - offset: 1, value: .LBB0_2-1, kind: FK_PCRel_1 12; CHECK-NEXT: # %bb.1: # %cond_true 13; CHECK-NEXT: movl $1, %eax # encoding: [0xb8,0x01,0x00,0x00,0x00] 14; CHECK-NEXT: retq # encoding: [0xc3] 15; CHECK-NEXT: .LBB0_2: # %ReturnBlock 16; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 17; CHECK-NEXT: retq # encoding: [0xc3] 18entry: 19 %tmp = load i32, i32* %y 20 %tmp.upgrd.1 = icmp eq i32 %tmp, 0 21 br i1 %tmp.upgrd.1, label %ReturnBlock, label %cond_true 22 23cond_true: 24 ret i32 1 25 26ReturnBlock: 27 ret i32 0 28} 29 30define i32 @test2(i32 %X, i32* %y) nounwind { 31; CHECK-LABEL: test2: 32; CHECK: # %bb.0: # %entry 33; CHECK-NEXT: testl $536870911, (%rsi) # encoding: [0xf7,0x06,0xff,0xff,0xff,0x1f] 34; CHECK-NEXT: # imm = 0x1FFFFFFF 35; CHECK-NEXT: je .LBB1_2 # encoding: [0x74,A] 36; CHECK-NEXT: # fixup A - offset: 1, value: .LBB1_2-1, kind: FK_PCRel_1 37; CHECK-NEXT: # %bb.1: # %cond_true 38; CHECK-NEXT: movl $1, %eax # encoding: [0xb8,0x01,0x00,0x00,0x00] 39; CHECK-NEXT: retq # encoding: [0xc3] 40; CHECK-NEXT: .LBB1_2: # %ReturnBlock 41; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 42; CHECK-NEXT: retq # encoding: [0xc3] 43entry: 44 %tmp = load i32, i32* %y 45 %tmp1 = shl i32 %tmp, 3 46 %tmp1.upgrd.2 = icmp eq i32 %tmp1, 0 47 br i1 %tmp1.upgrd.2, label %ReturnBlock, label %cond_true 48 49cond_true: 50 ret i32 1 51 52ReturnBlock: 53 ret i32 0 54} 55 56define i8 @test2b(i8 %X, i8* %y) nounwind { 57; CHECK-LABEL: test2b: 58; CHECK: # %bb.0: # %entry 59; CHECK-NEXT: testb $31, (%rsi) # encoding: [0xf6,0x06,0x1f] 60; CHECK-NEXT: je .LBB2_2 # encoding: [0x74,A] 61; CHECK-NEXT: # fixup A - offset: 1, value: .LBB2_2-1, kind: FK_PCRel_1 62; CHECK-NEXT: # %bb.1: # %cond_true 63; CHECK-NEXT: movb $1, %al # encoding: [0xb0,0x01] 64; CHECK-NEXT: retq # encoding: [0xc3] 65; CHECK-NEXT: .LBB2_2: # %ReturnBlock 66; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 67; CHECK-NEXT: retq # encoding: [0xc3] 68entry: 69 %tmp = load i8, i8* %y 70 %tmp1 = shl i8 %tmp, 3 71 %tmp1.upgrd.2 = icmp eq i8 %tmp1, 0 72 br i1 %tmp1.upgrd.2, label %ReturnBlock, label %cond_true 73 74cond_true: 75 ret i8 1 76 77ReturnBlock: 78 ret i8 0 79} 80 81define i64 @test3(i64 %x) nounwind { 82; CHECK-LABEL: test3: 83; CHECK: # %bb.0: # %entry 84; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 85; CHECK-NEXT: testq %rdi, %rdi # encoding: [0x48,0x85,0xff] 86; CHECK-NEXT: sete %al # encoding: [0x0f,0x94,0xc0] 87; CHECK-NEXT: retq # encoding: [0xc3] 88entry: 89 %t = icmp eq i64 %x, 0 90 %r = zext i1 %t to i64 91 ret i64 %r 92} 93 94define i64 @test4(i64 %x) nounwind { 95; CHECK-LABEL: test4: 96; CHECK: # %bb.0: # %entry 97; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 98; CHECK-NEXT: testq %rdi, %rdi # encoding: [0x48,0x85,0xff] 99; CHECK-NEXT: setle %al # encoding: [0x0f,0x9e,0xc0] 100; CHECK-NEXT: retq # encoding: [0xc3] 101entry: 102 %t = icmp slt i64 %x, 1 103 %r = zext i1 %t to i64 104 ret i64 %r 105} 106 107define i32 @test5(double %A) nounwind { 108; CHECK-LABEL: test5: 109; CHECK: # %bb.0: # %entry 110; CHECK-NEXT: ucomisd {{.*}}(%rip), %xmm0 # encoding: [0x66,0x0f,0x2e,0x05,A,A,A,A] 111; CHECK-NEXT: # fixup A - offset: 4, value: {{\.LCPI.*}}-4, kind: reloc_riprel_4byte 112; CHECK-NEXT: ja .LBB5_3 # encoding: [0x77,A] 113; CHECK-NEXT: # fixup A - offset: 1, value: .LBB5_3-1, kind: FK_PCRel_1 114; CHECK-NEXT: # %bb.1: # %entry 115; CHECK-NEXT: ucomisd {{.*}}(%rip), %xmm0 # encoding: [0x66,0x0f,0x2e,0x05,A,A,A,A] 116; CHECK-NEXT: # fixup A - offset: 4, value: {{\.LCPI.*}}-4, kind: reloc_riprel_4byte 117; CHECK-NEXT: jb .LBB5_3 # encoding: [0x72,A] 118; CHECK-NEXT: # fixup A - offset: 1, value: .LBB5_3-1, kind: FK_PCRel_1 119; CHECK-NEXT: # %bb.2: # %bb12 120; CHECK-NEXT: movl $32, %eax # encoding: [0xb8,0x20,0x00,0x00,0x00] 121; CHECK-NEXT: retq # encoding: [0xc3] 122; CHECK-NEXT: .LBB5_3: # %bb8 123; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 124; CHECK-NEXT: jmp foo # TAILCALL 125; CHECK-NEXT: # encoding: [0xeb,A] 126; CHECK-NEXT: # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1 127entry: 128 %tmp2 = fcmp ogt double %A, 1.500000e+02 129 %tmp5 = fcmp ult double %A, 7.500000e+01 130 %bothcond = or i1 %tmp2, %tmp5 131 br i1 %bothcond, label %bb8, label %bb12 132 133bb8: 134 %tmp9 = tail call i32 (...) @foo() nounwind 135 ret i32 %tmp9 136 137bb12: 138 ret i32 32 139} 140 141declare dso_local i32 @foo(...) 142 143define i32 @test6() nounwind align 2 { 144; CHECK-LABEL: test6: 145; CHECK: # %bb.0: # %entry 146; CHECK-NEXT: cmpq $0, -{{[0-9]+}}(%rsp) # encoding: [0x48,0x83,0x7c,0x24,0xf8,0x00] 147; CHECK-NEXT: je .LBB6_1 # encoding: [0x74,A] 148; CHECK-NEXT: # fixup A - offset: 1, value: .LBB6_1-1, kind: FK_PCRel_1 149; CHECK-NEXT: # %bb.2: # %F 150; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 151; CHECK-NEXT: retq # encoding: [0xc3] 152; CHECK-NEXT: .LBB6_1: # %T 153; CHECK-NEXT: movl $1, %eax # encoding: [0xb8,0x01,0x00,0x00,0x00] 154; CHECK-NEXT: retq # encoding: [0xc3] 155entry: 156 %A = alloca { i64, i64 }, align 8 157 %B = getelementptr inbounds { i64, i64 }, { i64, i64 }* %A, i64 0, i32 1 158 %C = load i64, i64* %B 159 %D = icmp eq i64 %C, 0 160 br i1 %D, label %T, label %F 161 162T: 163 ret i32 1 164 165F: 166 ret i32 0 167} 168 169define i32 @test7(i64 %res) nounwind { 170; CHECK-LABEL: test7: 171; CHECK: # %bb.0: # %entry 172; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 173; CHECK-NEXT: shrq $32, %rdi # encoding: [0x48,0xc1,0xef,0x20] 174; CHECK-NEXT: sete %al # encoding: [0x0f,0x94,0xc0] 175; CHECK-NEXT: retq # encoding: [0xc3] 176entry: 177 %lnot = icmp ult i64 %res, 4294967296 178 %lnot.ext = zext i1 %lnot to i32 179 ret i32 %lnot.ext 180} 181 182define i32 @test8(i64 %res) nounwind { 183; CHECK-LABEL: test8: 184; CHECK: # %bb.0: # %entry 185; CHECK-NEXT: shrq $32, %rdi # encoding: [0x48,0xc1,0xef,0x20] 186; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 187; CHECK-NEXT: cmpl $3, %edi # encoding: [0x83,0xff,0x03] 188; CHECK-NEXT: setb %al # encoding: [0x0f,0x92,0xc0] 189; CHECK-NEXT: retq # encoding: [0xc3] 190entry: 191 %lnot = icmp ult i64 %res, 12884901888 192 %lnot.ext = zext i1 %lnot to i32 193 ret i32 %lnot.ext 194} 195 196define i32 @test9(i64 %res) nounwind { 197; CHECK-LABEL: test9: 198; CHECK: # %bb.0: # %entry 199; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 200; CHECK-NEXT: shrq $33, %rdi # encoding: [0x48,0xc1,0xef,0x21] 201; CHECK-NEXT: sete %al # encoding: [0x0f,0x94,0xc0] 202; CHECK-NEXT: retq # encoding: [0xc3] 203entry: 204 %lnot = icmp ult i64 %res, 8589934592 205 %lnot.ext = zext i1 %lnot to i32 206 ret i32 %lnot.ext 207} 208 209define i32 @test10(i64 %res) nounwind { 210; CHECK-LABEL: test10: 211; CHECK: # %bb.0: # %entry 212; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 213; CHECK-NEXT: shrq $32, %rdi # encoding: [0x48,0xc1,0xef,0x20] 214; CHECK-NEXT: setne %al # encoding: [0x0f,0x95,0xc0] 215; CHECK-NEXT: retq # encoding: [0xc3] 216entry: 217 %lnot = icmp uge i64 %res, 4294967296 218 %lnot.ext = zext i1 %lnot to i32 219 ret i32 %lnot.ext 220} 221 222define i32 @test11(i64 %l) nounwind { 223; CHECK-LABEL: test11: 224; CHECK: # %bb.0: # %entry 225; CHECK-NEXT: shrq $47, %rdi # encoding: [0x48,0xc1,0xef,0x2f] 226; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 227; CHECK-NEXT: cmpl $1, %edi # encoding: [0x83,0xff,0x01] 228; CHECK-NEXT: sete %al # encoding: [0x0f,0x94,0xc0] 229; CHECK-NEXT: retq # encoding: [0xc3] 230entry: 231 %shr.mask = and i64 %l, -140737488355328 232 %cmp = icmp eq i64 %shr.mask, 140737488355328 233 %conv = zext i1 %cmp to i32 234 ret i32 %conv 235} 236 237define i32 @test12() ssp uwtable { 238; CHECK-LABEL: test12: 239; CHECK: # %bb.0: # %entry 240; CHECK-NEXT: pushq %rax # encoding: [0x50] 241; CHECK-NEXT: .cfi_def_cfa_offset 16 242; CHECK-NEXT: callq test12b # encoding: [0xe8,A,A,A,A] 243; CHECK-NEXT: # fixup A - offset: 1, value: test12b-4, kind: reloc_branch_4byte_pcrel 244; CHECK-NEXT: testb %al, %al # encoding: [0x84,0xc0] 245; CHECK-NEXT: je .LBB12_2 # encoding: [0x74,A] 246; CHECK-NEXT: # fixup A - offset: 1, value: .LBB12_2-1, kind: FK_PCRel_1 247; CHECK-NEXT: # %bb.1: # %T 248; CHECK-NEXT: movl $1, %eax # encoding: [0xb8,0x01,0x00,0x00,0x00] 249; CHECK-NEXT: popq %rcx # encoding: [0x59] 250; CHECK-NEXT: .cfi_def_cfa_offset 8 251; CHECK-NEXT: retq # encoding: [0xc3] 252; CHECK-NEXT: .LBB12_2: # %F 253; CHECK-NEXT: .cfi_def_cfa_offset 16 254; CHECK-NEXT: movl $2, %eax # encoding: [0xb8,0x02,0x00,0x00,0x00] 255; CHECK-NEXT: popq %rcx # encoding: [0x59] 256; CHECK-NEXT: .cfi_def_cfa_offset 8 257; CHECK-NEXT: retq # encoding: [0xc3] 258entry: 259 %tmp1 = call zeroext i1 @test12b() 260 br i1 %tmp1, label %T, label %F 261 262T: 263 ret i32 1 264 265F: 266 ret i32 2 267} 268 269declare dso_local zeroext i1 @test12b() 270 271define i32 @test13(i32 %mask, i32 %base, i32 %intra) { 272; CHECK-LABEL: test13: 273; CHECK: # %bb.0: # %entry 274; CHECK-NEXT: movl %esi, %eax # encoding: [0x89,0xf0] 275; CHECK-NEXT: testb $8, %dil # encoding: [0x40,0xf6,0xc7,0x08] 276; CHECK-NEXT: cmovnel %edx, %eax # encoding: [0x0f,0x45,0xc2] 277; CHECK-NEXT: retq # encoding: [0xc3] 278entry: 279 %and = and i32 %mask, 8 280 %tobool = icmp ne i32 %and, 0 281 %cond = select i1 %tobool, i32 %intra, i32 %base 282 ret i32 %cond 283 284} 285 286define i32 @test14(i32 %mask, i32 %base, i32 %intra) { 287; CHECK-LABEL: test14: 288; CHECK: # %bb.0: # %entry 289; CHECK-NEXT: movl %esi, %eax # encoding: [0x89,0xf0] 290; CHECK-NEXT: shrl $7, %edi # encoding: [0xc1,0xef,0x07] 291; CHECK-NEXT: cmovnsl %edx, %eax # encoding: [0x0f,0x49,0xc2] 292; CHECK-NEXT: retq # encoding: [0xc3] 293entry: 294 %s = lshr i32 %mask, 7 295 %tobool = icmp sgt i32 %s, -1 296 %cond = select i1 %tobool, i32 %intra, i32 %base 297 ret i32 %cond 298 299} 300 301; PR19964 302define zeroext i1 @test15(i32 %bf.load, i32 %n) { 303; CHECK-LABEL: test15: 304; CHECK: # %bb.0: # %entry 305; CHECK-NEXT: shrl $16, %edi # encoding: [0xc1,0xef,0x10] 306; CHECK-NEXT: sete %cl # encoding: [0x0f,0x94,0xc1] 307; CHECK-NEXT: cmpl %esi, %edi # encoding: [0x39,0xf7] 308; CHECK-NEXT: setae %al # encoding: [0x0f,0x93,0xc0] 309; CHECK-NEXT: orb %cl, %al # encoding: [0x08,0xc8] 310; CHECK-NEXT: retq # encoding: [0xc3] 311entry: 312 %bf.lshr = lshr i32 %bf.load, 16 313 %cmp2 = icmp eq i32 %bf.lshr, 0 314 %cmp5 = icmp uge i32 %bf.lshr, %n 315 %.cmp5 = or i1 %cmp2, %cmp5 316 ret i1 %.cmp5 317 318} 319 320define i8 @test16(i16 signext %L) { 321; CHECK-LABEL: test16: 322; CHECK: # %bb.0: # %entry 323; CHECK-NEXT: testw %di, %di # encoding: [0x66,0x85,0xff] 324; CHECK-NEXT: setns %al # encoding: [0x0f,0x99,0xc0] 325; CHECK-NEXT: retq # encoding: [0xc3] 326entry: 327 %lshr = lshr i16 %L, 15 328 %trunc = trunc i16 %lshr to i8 329 %not = xor i8 %trunc, 1 330 ret i8 %not 331 332} 333 334define i8 @test17(i32 %L) { 335; CHECK-LABEL: test17: 336; CHECK: # %bb.0: # %entry 337; CHECK-NEXT: testl %edi, %edi # encoding: [0x85,0xff] 338; CHECK-NEXT: setns %al # encoding: [0x0f,0x99,0xc0] 339; CHECK-NEXT: retq # encoding: [0xc3] 340entry: 341 %lshr = lshr i32 %L, 31 342 %trunc = trunc i32 %lshr to i8 343 %not = xor i8 %trunc, 1 344 ret i8 %not 345 346} 347 348define i8 @test18(i64 %L) { 349; CHECK-LABEL: test18: 350; CHECK: # %bb.0: # %entry 351; CHECK-NEXT: testq %rdi, %rdi # encoding: [0x48,0x85,0xff] 352; CHECK-NEXT: setns %al # encoding: [0x0f,0x99,0xc0] 353; CHECK-NEXT: retq # encoding: [0xc3] 354entry: 355 %lshr = lshr i64 %L, 63 356 %trunc = trunc i64 %lshr to i8 357 %not = xor i8 %trunc, 1 358 ret i8 %not 359 360} 361 362define zeroext i1 @test19(i32 %L) { 363; CHECK-LABEL: test19: 364; CHECK: # %bb.0: # %entry 365; CHECK-NEXT: testl %edi, %edi # encoding: [0x85,0xff] 366; CHECK-NEXT: setns %al # encoding: [0x0f,0x99,0xc0] 367; CHECK-NEXT: retq # encoding: [0xc3] 368entry: 369 %lshr = lshr i32 %L, 31 370 %trunc = trunc i32 %lshr to i1 371 %not = xor i1 %trunc, true 372 ret i1 %not 373 374} 375 376; This test failed due to incorrect handling of "shift + icmp" sequence 377define void @test20(i32 %bf.load, i8 %x1, i8* %b_addr) { 378; CHECK-LABEL: test20: 379; CHECK: # %bb.0: # %entry 380; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 381; CHECK-NEXT: testl $16777215, %edi # encoding: [0xf7,0xc7,0xff,0xff,0xff,0x00] 382; CHECK-NEXT: # imm = 0xFFFFFF 383; CHECK-NEXT: setne %al # encoding: [0x0f,0x95,0xc0] 384; CHECK-NEXT: movzbl %sil, %ecx # encoding: [0x40,0x0f,0xb6,0xce] 385; CHECK-NEXT: addl %eax, %ecx # encoding: [0x01,0xc1] 386; CHECK-NEXT: setne (%rdx) # encoding: [0x0f,0x95,0x02] 387; CHECK-NEXT: testl $16777215, %edi # encoding: [0xf7,0xc7,0xff,0xff,0xff,0x00] 388; CHECK-NEXT: # imm = 0xFFFFFF 389; CHECK-NEXT: setne {{.*}}(%rip) # encoding: [0x0f,0x95,0x05,A,A,A,A] 390; CHECK-NEXT: # fixup A - offset: 3, value: d-4, kind: reloc_riprel_4byte 391; CHECK-NEXT: retq # encoding: [0xc3] 392entry: 393 %bf.shl = shl i32 %bf.load, 8 394 %bf.ashr = ashr exact i32 %bf.shl, 8 395 %tobool4 = icmp ne i32 %bf.ashr, 0 396 %conv = zext i1 %tobool4 to i32 397 %conv6 = zext i8 %x1 to i32 398 %add = add nuw nsw i32 %conv, %conv6 399 %tobool7 = icmp ne i32 %add, 0 400 %frombool = zext i1 %tobool7 to i8 401 store i8 %frombool, i8* %b_addr, align 1 402 %tobool14 = icmp ne i32 %bf.shl, 0 403 %frombool15 = zext i1 %tobool14 to i8 404 store i8 %frombool15, i8* @d, align 1 405 ret void 406 407} 408 409define i32 @test21(i64 %val) { 410; CHECK-LABEL: test21: 411; CHECK: # %bb.0: # %entry 412; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 413; CHECK-NEXT: shrq $41, %rdi # encoding: [0x48,0xc1,0xef,0x29] 414; CHECK-NEXT: setne %al # encoding: [0x0f,0x95,0xc0] 415; CHECK-NEXT: retq # encoding: [0xc3] 416entry: 417 %and = and i64 %val, -2199023255552 418 %cmp = icmp ne i64 %and, 0 419 %ret = zext i1 %cmp to i32 420 ret i32 %ret 421 422} 423 424; AND-to-SHR transformation is enabled for eq/ne condition codes only. 425define i32 @test22(i64 %val) { 426; CHECK-LABEL: test22: 427; CHECK: # %bb.0: # %entry 428; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 429; CHECK-NEXT: retq # encoding: [0xc3] 430entry: 431 %and = and i64 %val, -2199023255552 432 %cmp = icmp ult i64 %and, 0 433 %ret = zext i1 %cmp to i32 434 ret i32 %ret 435 436} 437 438define i32 @test23(i64 %val) { 439; CHECK-LABEL: test23: 440; CHECK: # %bb.0: # %entry 441; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 442; CHECK-NEXT: testq $-1048576, %rdi # encoding: [0x48,0xf7,0xc7,0x00,0x00,0xf0,0xff] 443; CHECK-NEXT: # imm = 0xFFF00000 444; CHECK-NEXT: setne %al # encoding: [0x0f,0x95,0xc0] 445; CHECK-NEXT: retq # encoding: [0xc3] 446entry: 447 %and = and i64 %val, -1048576 448 %cmp = icmp ne i64 %and, 0 449 %ret = zext i1 %cmp to i32 450 ret i32 %ret 451 452} 453 454define i32 @test24(i64 %val) { 455; CHECK-LABEL: test24: 456; CHECK: # %bb.0: # %entry 457; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 458; CHECK-NEXT: shlq $16, %rdi # encoding: [0x48,0xc1,0xe7,0x10] 459; CHECK-NEXT: setne %al # encoding: [0x0f,0x95,0xc0] 460; CHECK-NEXT: retq # encoding: [0xc3] 461entry: 462 %and = and i64 %val, 281474976710655 463 %cmp = icmp ne i64 %and, 0 464 %ret = zext i1 %cmp to i32 465 ret i32 %ret 466 467} 468 469define { i64, i64 } @pr39968(i64, i64, i32) { 470; CHECK-LABEL: pr39968: 471; CHECK: # %bb.0: 472; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] 473; CHECK-NEXT: testb $64, %dl # encoding: [0xf6,0xc2,0x40] 474; CHECK-NEXT: cmovneq %rdi, %rsi # encoding: [0x48,0x0f,0x45,0xf7] 475; CHECK-NEXT: cmovneq %rdi, %rax # encoding: [0x48,0x0f,0x45,0xc7] 476; CHECK-NEXT: movq %rsi, %rdx # encoding: [0x48,0x89,0xf2] 477; CHECK-NEXT: retq # encoding: [0xc3] 478 %4 = and i32 %2, 64 479 %5 = icmp ne i32 %4, 0 480 %6 = select i1 %5, i64 %0, i64 %1 481 %7 = select i1 %5, i64 %0, i64 0 482 %8 = insertvalue { i64, i64 } undef, i64 %7, 0 483 %9 = insertvalue { i64, i64 } %8, i64 %6, 1 484 ret { i64, i64 } %9 485} 486 487; Make sure we use a 32-bit comparison without an extend based on the input 488; being pre-sign extended by caller. 489define i32 @pr42189(i16 signext %c) { 490; CHECK-LABEL: pr42189: 491; CHECK: # %bb.0: # %entry 492; CHECK-NEXT: cmpl $32767, %edi # encoding: [0x81,0xff,0xff,0x7f,0x00,0x00] 493; CHECK-NEXT: # imm = 0x7FFF 494; CHECK-NEXT: jne .LBB26_2 # encoding: [0x75,A] 495; CHECK-NEXT: # fixup A - offset: 1, value: .LBB26_2-1, kind: FK_PCRel_1 496; CHECK-NEXT: # %bb.1: # %if.then 497; CHECK-NEXT: jmp g # TAILCALL 498; CHECK-NEXT: # encoding: [0xeb,A] 499; CHECK-NEXT: # fixup A - offset: 1, value: g-1, kind: FK_PCRel_1 500; CHECK-NEXT: .LBB26_2: # %if.end 501; CHECK-NEXT: jmp f # TAILCALL 502; CHECK-NEXT: # encoding: [0xeb,A] 503; CHECK-NEXT: # fixup A - offset: 1, value: f-1, kind: FK_PCRel_1 504entry: 505 %cmp = icmp eq i16 %c, 32767 506 br i1 %cmp, label %if.then, label %if.end 507 508if.then: ; preds = %entry 509 %call = tail call i32 @g() 510 br label %return 511 512if.end: ; preds = %entry 513 %call2 = tail call i32 @f() 514 br label %return 515 516return: ; preds = %if.end, %if.then 517 %retval.0 = phi i32 [ %call, %if.then ], [ %call2, %if.end ] 518 ret i32 %retval.0 519} 520 521declare dso_local i32 @g() 522 523declare dso_local i32 @f() 524 525