1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=CHECK --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=CHECK --check-prefix=X64
5 define i32 @extractelt_undef_insertelt(i32 %x, i32 %y) {
6 ; CHECK-LABEL: extractelt_undef_insertelt:
8 ; CHECK-NEXT: ret{{[l|q]}}
9 %b = insertelement <4 x i32> zeroinitializer, i32 %x, i64 3
10 %c = icmp uge i32 %y, %y
11 %d = extractelement <4 x i32> %b, i1 %c
15 define i8 @extractelt_bitcast(i32 %x) nounwind {
16 ; X86-LABEL: extractelt_bitcast:
18 ; X86-NEXT: movb {{[0-9]+}}(%esp), %al
21 ; X64-LABEL: extractelt_bitcast:
23 ; X64-NEXT: movl %edi, %eax
24 ; X64-NEXT: # kill: def $al killed $al killed $eax
26 %bc = bitcast i32 %x to <4 x i8>
27 %ext = extractelement <4 x i8> %bc, i32 0
31 define i8 @extractelt_bitcast_extra_use(i32 %x, <4 x i8>* %p) nounwind {
32 ; X86-LABEL: extractelt_bitcast_extra_use:
34 ; X86-NEXT: pushl %eax
35 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
36 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
37 ; X86-NEXT: movl %eax, (%ecx)
38 ; X86-NEXT: # kill: def $al killed $al killed $eax
42 ; X64-LABEL: extractelt_bitcast_extra_use:
44 ; X64-NEXT: movl %edi, %eax
45 ; X64-NEXT: movl %edi, (%rsi)
46 ; X64-NEXT: # kill: def $al killed $al killed $eax
48 %bc = bitcast i32 %x to <4 x i8>
49 store <4 x i8> %bc, <4 x i8>* %p
50 %ext = extractelement <4 x i8> %bc, i32 0
54 define i32 @trunc_i64_to_i32_le(i64 %x) {
55 ; X86-LABEL: trunc_i64_to_i32_le:
57 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
60 ; X64-LABEL: trunc_i64_to_i32_le:
62 ; X64-NEXT: movq %rdi, %rax
63 ; X64-NEXT: # kill: def $eax killed $eax killed $rax
65 %ins = insertelement <2 x i64> undef, i64 %x, i32 0
66 %bc = bitcast <2 x i64> %ins to <4 x i32>
67 %ext = extractelement <4 x i32> %bc, i32 0
71 define i16 @trunc_i64_to_i16_le(i64 %x) {
72 ; X86-LABEL: trunc_i64_to_i16_le:
74 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
75 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
78 ; X64-LABEL: trunc_i64_to_i16_le:
80 ; X64-NEXT: movq %rdi, %rax
81 ; X64-NEXT: # kill: def $ax killed $ax killed $rax
83 %ins = insertelement <2 x i64> undef, i64 %x, i32 0
84 %bc = bitcast <2 x i64> %ins to <8 x i16>
85 %ext = extractelement <8 x i16> %bc, i32 0
89 define i8 @trunc_i32_to_i8_le(i32 %x) {
90 ; X86-LABEL: trunc_i32_to_i8_le:
92 ; X86-NEXT: movb {{[0-9]+}}(%esp), %al
95 ; X64-LABEL: trunc_i32_to_i8_le:
97 ; X64-NEXT: movl %edi, %eax
98 ; X64-NEXT: # kill: def $al killed $al killed $eax
100 %ins = insertelement <4 x i32> undef, i32 %x, i32 0
101 %bc = bitcast <4 x i32> %ins to <16 x i8>
102 %ext = extractelement <16 x i8> %bc, i32 0