1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i386-apple-darwin10.0 | FileCheck %s --check-prefix=CHECK-X86
3 ; RUN: llc < %s -mtriple=x86_64-grtev4-linux-gnu | FileCheck %s --check-prefix=CHECK-X64
5 @g_14 = dso_local global i8 -6, align 1 ; <ptr> [#uses=1]
7 declare i32 @func_16(i8 signext %p_19, i32 %p_20) nounwind
9 define dso_local i32 @func_35(i64 %p_38) nounwind ssp {
10 ; CHECK-X86-LABEL: func_35:
11 ; CHECK-X86: ## %bb.0: ## %entry
12 ; CHECK-X86-NEXT: subl $12, %esp
13 ; CHECK-X86-NEXT: movsbl _g_14, %eax
14 ; CHECK-X86-NEXT: xorl %ecx, %ecx
15 ; CHECK-X86-NEXT: testl $255, %eax
16 ; CHECK-X86-NEXT: setg %cl
17 ; CHECK-X86-NEXT: subl $8, %esp
18 ; CHECK-X86-NEXT: pushl %ecx
19 ; CHECK-X86-NEXT: pushl %eax
20 ; CHECK-X86-NEXT: calll _func_16
21 ; CHECK-X86-NEXT: addl $16, %esp
22 ; CHECK-X86-NEXT: movl $1, %eax
23 ; CHECK-X86-NEXT: addl $12, %esp
24 ; CHECK-X86-NEXT: retl
26 ; CHECK-X64-LABEL: func_35:
27 ; CHECK-X64: # %bb.0: # %entry
28 ; CHECK-X64-NEXT: pushq %rax
29 ; CHECK-X64-NEXT: movsbl g_14(%rip), %edi
30 ; CHECK-X64-NEXT: xorl %esi, %esi
31 ; CHECK-X64-NEXT: testl $255, %edi
32 ; CHECK-X64-NEXT: setg %sil
33 ; CHECK-X64-NEXT: callq func_16@PLT
34 ; CHECK-X64-NEXT: movl $1, %eax
35 ; CHECK-X64-NEXT: popq %rcx
36 ; CHECK-X64-NEXT: retq
38 %tmp = load i8, ptr @g_14 ; <i8> [#uses=2]
39 %conv = zext i8 %tmp to i32 ; <i32> [#uses=1]
40 %cmp = icmp sle i32 1, %conv ; <i1> [#uses=1]
41 %conv2 = zext i1 %cmp to i32 ; <i32> [#uses=1]
42 %call = call i32 @func_16(i8 signext %tmp, i32 %conv2) ssp ; <i32> [#uses=1]
46 define dso_local void @fail(i16 %a, <2 x i8> %b) {
47 ; CHECK-X86-LABEL: fail:
48 ; CHECK-X86: ## %bb.0:
49 ; CHECK-X86-NEXT: subl $12, %esp
50 ; CHECK-X86-NEXT: .cfi_def_cfa_offset 16
51 ; CHECK-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
52 ; CHECK-X86-NEXT: cmpb $123, {{[0-9]+}}(%esp)
53 ; CHECK-X86-NEXT: setne %cl
54 ; CHECK-X86-NEXT: testl $263, %eax ## imm = 0x107
55 ; CHECK-X86-NEXT: setne %al
56 ; CHECK-X86-NEXT: testb %cl, %al
57 ; CHECK-X86-NEXT: jne LBB1_2
58 ; CHECK-X86-NEXT: ## %bb.1: ## %yes
59 ; CHECK-X86-NEXT: addl $12, %esp
60 ; CHECK-X86-NEXT: retl
61 ; CHECK-X86-NEXT: LBB1_2: ## %no
62 ; CHECK-X86-NEXT: calll _bar
63 ; CHECK-X86-NEXT: addl $12, %esp
64 ; CHECK-X86-NEXT: retl
66 ; CHECK-X64-LABEL: fail:
68 ; CHECK-X64-NEXT: pslld $8, %xmm0
69 ; CHECK-X64-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
70 ; CHECK-X64-NEXT: pextrw $1, %xmm0, %eax
71 ; CHECK-X64-NEXT: xorb $1, %al
72 ; CHECK-X64-NEXT: testl $263, %edi # imm = 0x107
73 ; CHECK-X64-NEXT: setne %cl
74 ; CHECK-X64-NEXT: testb %al, %cl
75 ; CHECK-X64-NEXT: jne .LBB1_2
76 ; CHECK-X64-NEXT: # %bb.1: # %yes
77 ; CHECK-X64-NEXT: retq
78 ; CHECK-X64-NEXT: .LBB1_2: # %no
79 ; CHECK-X64-NEXT: pushq %rax
80 ; CHECK-X64-NEXT: .cfi_def_cfa_offset 16
81 ; CHECK-X64-NEXT: callq bar@PLT
82 ; CHECK-X64-NEXT: popq %rax
83 ; CHECK-X64-NEXT: .cfi_def_cfa_offset 8
84 ; CHECK-X64-NEXT: retq
85 %1 = icmp eq <2 x i8> %b, <i8 40, i8 123>
86 %2 = extractelement <2 x i1> %1, i32 1
88 %4 = icmp eq i16 %3, 0
90 br i1 %merge, label %yes, label %no