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=ALL 3 4define i8 @test_i8(i32 %a, i8 %f, i8 %t) { 5; ALL-LABEL: test_i8: 6; ALL: # %bb.0: # %entry 7; ALL-NEXT: xorl %eax, %eax 8; ALL-NEXT: cmpl %eax, %edi 9; ALL-NEXT: setg %al 10; ALL-NEXT: testb $1, %al 11; ALL-NEXT: jne .LBB0_2 12; ALL-NEXT: # %bb.1: # %cond.false 13; ALL-NEXT: movl %edx, %esi 14; ALL-NEXT: .LBB0_2: # %cond.end 15; ALL-NEXT: movl %esi, %eax 16; ALL-NEXT: retq 17entry: 18 %cmp = icmp sgt i32 %a, 0 19 br i1 %cmp, label %cond.true, label %cond.false 20 21cond.true: ; preds = %entry 22 br label %cond.end 23 24cond.false: ; preds = %entry 25 br label %cond.end 26 27cond.end: ; preds = %cond.false, %cond.true 28 %cond = phi i8 [ %f, %cond.true ], [ %t, %cond.false ] 29 ret i8 %cond 30} 31 32define i16 @test_i16(i32 %a, i16 %f, i16 %t) { 33; ALL-LABEL: test_i16: 34; ALL: # %bb.0: # %entry 35; ALL-NEXT: xorl %eax, %eax 36; ALL-NEXT: cmpl %eax, %edi 37; ALL-NEXT: setg %al 38; ALL-NEXT: testb $1, %al 39; ALL-NEXT: jne .LBB1_2 40; ALL-NEXT: # %bb.1: # %cond.false 41; ALL-NEXT: movl %edx, %esi 42; ALL-NEXT: .LBB1_2: # %cond.end 43; ALL-NEXT: movl %esi, %eax 44; ALL-NEXT: retq 45entry: 46 %cmp = icmp sgt i32 %a, 0 47 br i1 %cmp, label %cond.true, label %cond.false 48 49cond.true: ; preds = %entry 50 br label %cond.end 51 52cond.false: ; preds = %entry 53 br label %cond.end 54 55cond.end: ; preds = %cond.false, %cond.true 56 %cond = phi i16 [ %f, %cond.true ], [ %t, %cond.false ] 57 ret i16 %cond 58} 59 60define i32 @test_i32(i32 %a, i32 %f, i32 %t) { 61; ALL-LABEL: test_i32: 62; ALL: # %bb.0: # %entry 63; ALL-NEXT: xorl %eax, %eax 64; ALL-NEXT: cmpl %eax, %edi 65; ALL-NEXT: setg %al 66; ALL-NEXT: testb $1, %al 67; ALL-NEXT: jne .LBB2_2 68; ALL-NEXT: # %bb.1: # %cond.false 69; ALL-NEXT: movl %edx, %esi 70; ALL-NEXT: .LBB2_2: # %cond.end 71; ALL-NEXT: movl %esi, %eax 72; ALL-NEXT: retq 73entry: 74 %cmp = icmp sgt i32 %a, 0 75 br i1 %cmp, label %cond.true, label %cond.false 76 77cond.true: ; preds = %entry 78 br label %cond.end 79 80cond.false: ; preds = %entry 81 br label %cond.end 82 83cond.end: ; preds = %cond.false, %cond.true 84 %cond = phi i32 [ %f, %cond.true ], [ %t, %cond.false ] 85 ret i32 %cond 86} 87 88define i64 @test_i64(i32 %a, i64 %f, i64 %t) { 89; ALL-LABEL: test_i64: 90; ALL: # %bb.0: # %entry 91; ALL-NEXT: xorl %eax, %eax 92; ALL-NEXT: cmpl %eax, %edi 93; ALL-NEXT: setg %al 94; ALL-NEXT: testb $1, %al 95; ALL-NEXT: jne .LBB3_2 96; ALL-NEXT: # %bb.1: # %cond.false 97; ALL-NEXT: movq %rdx, %rsi 98; ALL-NEXT: .LBB3_2: # %cond.end 99; ALL-NEXT: movq %rsi, %rax 100; ALL-NEXT: retq 101entry: 102 %cmp = icmp sgt i32 %a, 0 103 br i1 %cmp, label %cond.true, label %cond.false 104 105cond.true: ; preds = %entry 106 br label %cond.end 107 108cond.false: ; preds = %entry 109 br label %cond.end 110 111cond.end: ; preds = %cond.false, %cond.true 112 %cond = phi i64 [ %f, %cond.true ], [ %t, %cond.false ] 113 ret i64 %cond 114} 115 116define float @test_float(i32 %a, float %f, float %t) { 117; ALL-LABEL: test_float: 118; ALL: # %bb.0: # %entry 119; ALL-NEXT: xorl %eax, %eax 120; ALL-NEXT: cmpl %eax, %edi 121; ALL-NEXT: setg %al 122; ALL-NEXT: testb $1, %al 123; ALL-NEXT: jne .LBB4_2 124; ALL-NEXT: # %bb.1: # %cond.false 125; ALL-NEXT: movaps %xmm1, %xmm0 126; ALL-NEXT: .LBB4_2: # %cond.end 127; ALL-NEXT: retq 128entry: 129 %cmp = icmp sgt i32 %a, 0 130 br i1 %cmp, label %cond.true, label %cond.false 131 132cond.true: ; preds = %entry 133 br label %cond.end 134 135cond.false: ; preds = %entry 136 br label %cond.end 137 138cond.end: ; preds = %cond.false, %cond.true 139 %cond = phi float [ %f, %cond.true ], [ %t, %cond.false ] 140 ret float %cond 141} 142 143define double @test_double(i32 %a, double %f, double %t) { 144; ALL-LABEL: test_double: 145; ALL: # %bb.0: # %entry 146; ALL-NEXT: xorl %eax, %eax 147; ALL-NEXT: cmpl %eax, %edi 148; ALL-NEXT: setg %al 149; ALL-NEXT: testb $1, %al 150; ALL-NEXT: jne .LBB5_2 151; ALL-NEXT: # %bb.1: # %cond.false 152; ALL-NEXT: movaps %xmm1, %xmm0 153; ALL-NEXT: .LBB5_2: # %cond.end 154; ALL-NEXT: retq 155entry: 156 %cmp = icmp sgt i32 %a, 0 157 br i1 %cmp, label %cond.true, label %cond.false 158 159cond.true: ; preds = %entry 160 br label %cond.end 161 162cond.false: ; preds = %entry 163 br label %cond.end 164 165cond.end: ; preds = %cond.false, %cond.true 166 %cond = phi double [ %f, %cond.true ], [ %t, %cond.false ] 167 ret double %cond 168} 169