1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X64
3 ; RUN: llc < %s -mtriple=i386-unknown-unknown | FileCheck %s --check-prefix=X32
5 define i8 @select_i8_neg1_or_0(i1 %a) {
6 ; X64-LABEL: select_i8_neg1_or_0:
8 ; X64-NEXT: movl %edi, %eax
9 ; X64-NEXT: andb $1, %al
11 ; X64-NEXT: # kill: def $al killed $al killed $eax
14 ; X32-LABEL: select_i8_neg1_or_0:
16 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
17 ; X32-NEXT: andb $1, %al
24 define i8 @select_i8_neg1_or_0_zeroext(i1 zeroext %a) {
25 ; X64-LABEL: select_i8_neg1_or_0_zeroext:
27 ; X64-NEXT: movl %edi, %eax
29 ; X64-NEXT: # kill: def $al killed $al killed $eax
32 ; X32-LABEL: select_i8_neg1_or_0_zeroext:
34 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
41 define i16 @select_i16_neg1_or_0(i1 %a) {
42 ; X64-LABEL: select_i16_neg1_or_0:
44 ; X64-NEXT: movl %edi, %eax
45 ; X64-NEXT: andl $1, %eax
47 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
50 ; X32-LABEL: select_i16_neg1_or_0:
52 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
53 ; X32-NEXT: andl $1, %eax
55 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
57 %b = sext i1 %a to i16
61 define i16 @select_i16_neg1_or_0_zeroext(i1 zeroext %a) {
62 ; X64-LABEL: select_i16_neg1_or_0_zeroext:
64 ; X64-NEXT: movl %edi, %eax
66 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
69 ; X32-LABEL: select_i16_neg1_or_0_zeroext:
71 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
73 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
75 %b = sext i1 %a to i16
79 define i32 @select_i32_neg1_or_0(i1 %a) {
80 ; X64-LABEL: select_i32_neg1_or_0:
82 ; X64-NEXT: movl %edi, %eax
83 ; X64-NEXT: andl $1, %eax
87 ; X32-LABEL: select_i32_neg1_or_0:
89 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
90 ; X32-NEXT: andl $1, %eax
93 %b = sext i1 %a to i32
97 define i32 @select_i32_neg1_or_0_zeroext(i1 zeroext %a) {
98 ; X64-LABEL: select_i32_neg1_or_0_zeroext:
100 ; X64-NEXT: movl %edi, %eax
101 ; X64-NEXT: negl %eax
104 ; X32-LABEL: select_i32_neg1_or_0_zeroext:
106 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
107 ; X32-NEXT: negl %eax
109 %b = sext i1 %a to i32
113 define i64 @select_i64_neg1_or_0(i1 %a) {
114 ; X64-LABEL: select_i64_neg1_or_0:
116 ; X64-NEXT: movl %edi, %eax
117 ; X64-NEXT: andl $1, %eax
118 ; X64-NEXT: negq %rax
121 ; X32-LABEL: select_i64_neg1_or_0:
123 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
124 ; X32-NEXT: andl $1, %eax
125 ; X32-NEXT: negl %eax
126 ; X32-NEXT: movl %eax, %edx
128 %b = sext i1 %a to i64
132 define i64 @select_i64_neg1_or_0_zeroext(i1 zeroext %a) {
133 ; X64-LABEL: select_i64_neg1_or_0_zeroext:
135 ; X64-NEXT: movl %edi, %eax
136 ; X64-NEXT: negq %rax
139 ; X32-LABEL: select_i64_neg1_or_0_zeroext:
141 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
142 ; X32-NEXT: negl %eax
143 ; X32-NEXT: movl %eax, %edx
145 %b = sext i1 %a to i64