1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=i686-unknown-linux-gnu | FileCheck %s --check-prefix=X86 3; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefix=X64 4 5define i32 @fn() { 6; X86-LABEL: fn: 7; X86: # %bb.0: # %entry 8; X86-NEXT: xorl %eax, %eax 9; X86-NEXT: cmpl $1, %eax 10; X86-NEXT: setne %al 11; X86-NEXT: sete %cl 12; X86-NEXT: negl %eax 13; X86-NEXT: addb %cl, %cl 14; X86-NEXT: shll %cl, %eax 15; X86-NEXT: .p2align 4, 0x90 16; X86-NEXT: .LBB0_1: # %bb1 17; X86-NEXT: # =>This Inner Loop Header: Depth=1 18; X86-NEXT: testl %eax, %eax 19; X86-NEXT: je .LBB0_1 20; X86-NEXT: # %bb.2: # %bb2 21; X86-NEXT: retl 22; 23; X64-LABEL: fn: 24; X64: # %bb.0: # %entry 25; X64-NEXT: xorl %eax, %eax 26; X64-NEXT: cmpl $1, %eax 27; X64-NEXT: setne %al 28; X64-NEXT: sete %cl 29; X64-NEXT: negl %eax 30; X64-NEXT: addb %cl, %cl 31; X64-NEXT: shll %cl, %eax 32; X64-NEXT: .p2align 4, 0x90 33; X64-NEXT: .LBB0_1: # %bb1 34; X64-NEXT: # =>This Inner Loop Header: Depth=1 35; X64-NEXT: testl %eax, %eax 36; X64-NEXT: je .LBB0_1 37; X64-NEXT: # %bb.2: # %bb2 38; X64-NEXT: retq 39entry: 40 %cmp1 = icmp ne i32 undef, 1 41 %cmp2 = icmp eq i32 undef, 1 42 %sel1 = select i1 %cmp1, i32 0, i32 2 43 %sel2 = select i1 %cmp2, i32 2, i32 0 44 %sext = sext i1 %cmp1 to i32 45 %shl1 = shl i32 %sext, %sel1 46 %shl2 = shl i32 %sext, %sel2 47 %tobool = icmp eq i32 %shl1, 0 48 br label %bb1 49 50bb1: ; preds = %bb1, %entry 51 br i1 %tobool, label %bb1, label %bb2 52 53bb2: ; preds = %bb1 54 ret i32 %shl2 55} 56