1; RUN: llc -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s 2 3; The test case is rather involved, because we need to get to a state where 4; We have a sext(setcc x, y, cc) -> (select (setcc x, y, cc), T, 0) combine, 5; BUT this combine is only triggered post-legalization, so the setcc's return 6; type is i8. So we can't have the combine opportunity be exposed too early. 7; Basically, what we want to see is that the compare result zero-extended, and 8; then stored. Only one zext, and no sexts. 9 10; CHECK-LABEL: main: 11; CHECK: movzbl (%rdi), %[[EAX:.*]] 12; CHECK-NEXT: xorl %e[[C:.]]x, %e[[C]]x 13; CHECK-NEXT: cmpl $1, %[[EAX]] 14; CHECK-NEXT: sete %[[C]]l 15; CHECK-NEXT: movl %e[[C]]x, (%rsi) 16define void @main(i8* %p, i32* %q) { 17bb: 18 %tmp4 = load i8, i8* %p, align 1 19 %tmp5 = sext i8 %tmp4 to i32 20 %tmp6 = load i8, i8* %p, align 1 21 %tmp7 = zext i8 %tmp6 to i32 22 %tmp8 = sub nsw i32 %tmp5, %tmp7 23 %tmp11 = icmp eq i32 %tmp7, 1 24 %tmp12 = zext i1 %tmp11 to i32 25 %tmp13 = add nsw i32 %tmp8, %tmp12 26 %tmp14 = trunc i32 %tmp13 to i8 27 %tmp15 = sext i8 %tmp14 to i16 28 %tmp16 = sext i16 %tmp15 to i32 29 store i32 %tmp16, i32* %q, align 4 30 br i1 %tmp11, label %bb21, label %bb22 31 32bb21: ; preds = %bb 33 unreachable 34 35bb22: ; preds = %bb 36 ret void 37} 38