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=CHECK --check-prefix=X64 3 ; RUN: llc -mtriple=i386-linux-gnu -global-isel -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=X32 4 5 define 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 ; X32-LABEL: test_1: 22 ; X32: # %bb.0: # %entry 23 ; X32-NEXT: pushl %eax 24 ; X32-NEXT: .cfi_def_cfa_offset 8 25 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax 26 ; X32-NEXT: cmpl %eax, {{[0-9]+}}(%esp) 27 ; X32-NEXT: setl %al 28 ; X32-NEXT: testb $1, %al 29 ; X32-NEXT: je .LBB0_2 30 ; X32-NEXT: # %bb.1: # %if.then 31 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax 32 ; X32-NEXT: jmp .LBB0_3 33 ; X32-NEXT: .LBB0_2: # %if.else 34 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax 35 ; X32-NEXT: .LBB0_3: # %return 36 ; X32-NEXT: movl %eax, (%esp) 37 ; X32-NEXT: movl (%esp), %eax 38 ; X32-NEXT: popl %ecx 39 ; X32-NEXT: .cfi_def_cfa_offset 4 40 ; X32-NEXT: retl 41 entry: 42 %retval = alloca i32, align 4 43 %cmp = icmp slt i32 %a, %b 44 br i1 %cmp, label %if.then, label %if.else 45 46 if.then: 47 store i32 %tValue, i32* %retval, align 4 48 br label %return 49 50 if.else: 51 store i32 %fValue, i32* %retval, align 4 52 br label %return 53 54 return: 55 %0 = load i32, i32* %retval, align 4 56 ret i32 %0 57 } 58 59 define 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 ; X32-LABEL: test_2: 72 ; X32: # %bb.0: # %entry 73 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax 74 ; X32-NEXT: testb $1, %al 75 ; X32-NEXT: je .LBB1_2 76 ; X32-NEXT: # %bb.1: # %if.then 77 ; X32-NEXT: xorl %eax, %eax 78 ; X32-NEXT: retl 79 ; X32-NEXT: .LBB1_2: # %if.else 80 ; X32-NEXT: movl $1, %eax 81 ; X32-NEXT: retl 82 entry: 83 %cmp = trunc i32 %a to i1 84 br i1 %cmp, label %if.then, label %if.else 85 86 if.then: 87 ret i32 0 88 if.else: 89 ret i32 1 90 } 91 92