1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=X64 3; RUN: llc -mtriple=i386-linux-gnu -global-isel -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=X86 4 5define i32 @test_1(i32 %a, i32 %b, i32 %tValue, i32 %fValue) { 6; X64-LABEL: test_1: 7; X64: # %bb.0: # %entry 8; X64-NEXT: cmpl %esi, %edi 9; X64-NEXT: setl %al 10; X64-NEXT: testb $1, %al 11; X64-NEXT: je .LBB0_2 12; X64-NEXT: # %bb.1: # %if.then 13; X64-NEXT: movl %edx, -{{[0-9]+}}(%rsp) 14; X64-NEXT: movl -{{[0-9]+}}(%rsp), %eax 15; X64-NEXT: retq 16; X64-NEXT: .LBB0_2: # %if.else 17; X64-NEXT: movl %ecx, -{{[0-9]+}}(%rsp) 18; X64-NEXT: movl -{{[0-9]+}}(%rsp), %eax 19; X64-NEXT: retq 20; 21; X86-LABEL: test_1: 22; X86: # %bb.0: # %entry 23; X86-NEXT: pushl %eax 24; X86-NEXT: .cfi_def_cfa_offset 8 25; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 26; X86-NEXT: cmpl %eax, {{[0-9]+}}(%esp) 27; X86-NEXT: setl %al 28; X86-NEXT: testb $1, %al 29; X86-NEXT: je .LBB0_2 30; X86-NEXT: # %bb.1: # %if.then 31; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 32; X86-NEXT: jmp .LBB0_3 33; X86-NEXT: .LBB0_2: # %if.else 34; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 35; X86-NEXT: .LBB0_3: # %return 36; X86-NEXT: movl %eax, (%esp) 37; X86-NEXT: movl (%esp), %eax 38; X86-NEXT: popl %ecx 39; X86-NEXT: .cfi_def_cfa_offset 4 40; X86-NEXT: retl 41entry: 42 %retval = alloca i32, align 4 43 %cmp = icmp slt i32 %a, %b 44 br i1 %cmp, label %if.then, label %if.else 45 46if.then: 47 store i32 %tValue, i32* %retval, align 4 48 br label %return 49 50if.else: 51 store i32 %fValue, i32* %retval, align 4 52 br label %return 53 54return: 55 %0 = load i32, i32* %retval, align 4 56 ret i32 %0 57} 58 59define i32 @test_2(i32 %a) { 60; X64-LABEL: test_2: 61; X64: # %bb.0: # %entry 62; X64-NEXT: testb $1, %dil 63; X64-NEXT: je .LBB1_2 64; X64-NEXT: # %bb.1: # %if.then 65; X64-NEXT: xorl %eax, %eax 66; X64-NEXT: retq 67; X64-NEXT: .LBB1_2: # %if.else 68; X64-NEXT: movl $1, %eax 69; X64-NEXT: retq 70; 71; X86-LABEL: test_2: 72; X86: # %bb.0: # %entry 73; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 74; X86-NEXT: testb $1, %al 75; X86-NEXT: je .LBB1_2 76; X86-NEXT: # %bb.1: # %if.then 77; X86-NEXT: xorl %eax, %eax 78; X86-NEXT: retl 79; X86-NEXT: .LBB1_2: # %if.else 80; X86-NEXT: movl $1, %eax 81; X86-NEXT: retl 82entry: 83 %cmp = trunc i32 %a to i1 84 br i1 %cmp, label %if.then, label %if.else 85 86if.then: 87 ret i32 0 88if.else: 89 ret i32 1 90} 91 92