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
5 define i32 @test_1(i32 %a, i32 %b, i32 %tValue, i32 %fValue) {
7 ; X64: # %bb.0: # %entry
8 ; X64-NEXT: cmpl %esi, %edi
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
16 ; X64-NEXT: .LBB0_2: # %if.else
17 ; X64-NEXT: movl %ecx, -{{[0-9]+}}(%rsp)
18 ; X64-NEXT: movl -{{[0-9]+}}(%rsp), %eax
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)
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
39 ; X32-NEXT: .cfi_def_cfa_offset 4
42 %retval = alloca i32, align 4
43 %cmp = icmp slt i32 %a, %b
44 br i1 %cmp, label %if.then, label %if.else
47 store i32 %tValue, i32* %retval, align 4
51 store i32 %fValue, i32* %retval, align 4
55 %0 = load i32, i32* %retval, align 4
59 define i32 @test_2(i32 %a) {
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
67 ; X64-NEXT: .LBB1_2: # %if.else
68 ; X64-NEXT: movl $1, %eax
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
79 ; X32-NEXT: .LBB1_2: # %if.else
80 ; X32-NEXT: movl $1, %eax
83 %cmp = trunc i32 %a to i1
84 br i1 %cmp, label %if.then, label %if.else